William Cheng b59d535176
[python-nextgen] Fix binary response (#15076)
* fix binary response in python nextgen client

* update samples
2023-03-31 16:16:58 +08:00

12 KiB

BodyApi

All URIs are relative to http://localhost:3000

Method HTTP request Description
testBinaryGif POST /binary/gif Test binary (gif) response body
testBinaryGifWithHttpInfo POST /binary/gif Test binary (gif) response body
testEchoBodyPet POST /echo/body/Pet Test body parameter(s)
testEchoBodyPetWithHttpInfo POST /echo/body/Pet Test body parameter(s)
testEchoBodyPetResponseString POST /echo/body/Pet/response_string Test empty response body
testEchoBodyPetResponseStringWithHttpInfo POST /echo/body/Pet/response_string Test empty response body

testBinaryGif

File testBinaryGif()

Test binary (gif) response body

Test binary (gif) response body

Example

// Import classes:
import org.openapitools.client.ApiClient;
import org.openapitools.client.ApiException;
import org.openapitools.client.Configuration;
import org.openapitools.client.models.*;
import org.openapitools.client.api.BodyApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        defaultClient.setBasePath("http://localhost:3000");

        BodyApi apiInstance = new BodyApi(defaultClient);
        try {
            File result = apiInstance.testBinaryGif();
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling BodyApi#testBinaryGif");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

This endpoint does not need any parameter.

Return type

File

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: image/gif

HTTP response details

Status code Description Response headers
200 Successful operation -

testBinaryGifWithHttpInfo

ApiResponse testBinaryGif testBinaryGifWithHttpInfo()

Test binary (gif) response body

Test binary (gif) response body

Example

// Import classes:
import org.openapitools.client.ApiClient;
import org.openapitools.client.ApiException;
import org.openapitools.client.ApiResponse;
import org.openapitools.client.Configuration;
import org.openapitools.client.models.*;
import org.openapitools.client.api.BodyApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        defaultClient.setBasePath("http://localhost:3000");

        BodyApi apiInstance = new BodyApi(defaultClient);
        try {
            ApiResponse<File> response = apiInstance.testBinaryGifWithHttpInfo();
            System.out.println("Status code: " + response.getStatusCode());
            System.out.println("Response headers: " + response.getHeaders());
            System.out.println("Response body: " + response.getData());
        } catch (ApiException e) {
            System.err.println("Exception when calling BodyApi#testBinaryGif");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Response headers: " + e.getResponseHeaders());
            System.err.println("Reason: " + e.getResponseBody());
            e.printStackTrace();
        }
    }
}

Parameters

This endpoint does not need any parameter.

Return type

ApiResponse<File>

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: image/gif

HTTP response details

Status code Description Response headers
200 Successful operation -

testEchoBodyPet

Pet testEchoBodyPet(pet)

Test body parameter(s)

Test body parameter(s)

Example

// Import classes:
import org.openapitools.client.ApiClient;
import org.openapitools.client.ApiException;
import org.openapitools.client.Configuration;
import org.openapitools.client.models.*;
import org.openapitools.client.api.BodyApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        defaultClient.setBasePath("http://localhost:3000");

        BodyApi apiInstance = new BodyApi(defaultClient);
        Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store
        try {
            Pet result = apiInstance.testEchoBodyPet(pet);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling BodyApi#testEchoBodyPet");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

Name Type Description Notes
pet Pet Pet object that needs to be added to the store [optional]

Return type

Pet

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful operation -

testEchoBodyPetWithHttpInfo

ApiResponse testEchoBodyPet testEchoBodyPetWithHttpInfo(pet)

Test body parameter(s)

Test body parameter(s)

Example

// Import classes:
import org.openapitools.client.ApiClient;
import org.openapitools.client.ApiException;
import org.openapitools.client.ApiResponse;
import org.openapitools.client.Configuration;
import org.openapitools.client.models.*;
import org.openapitools.client.api.BodyApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        defaultClient.setBasePath("http://localhost:3000");

        BodyApi apiInstance = new BodyApi(defaultClient);
        Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store
        try {
            ApiResponse<Pet> response = apiInstance.testEchoBodyPetWithHttpInfo(pet);
            System.out.println("Status code: " + response.getStatusCode());
            System.out.println("Response headers: " + response.getHeaders());
            System.out.println("Response body: " + response.getData());
        } catch (ApiException e) {
            System.err.println("Exception when calling BodyApi#testEchoBodyPet");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Response headers: " + e.getResponseHeaders());
            System.err.println("Reason: " + e.getResponseBody());
            e.printStackTrace();
        }
    }
}

Parameters

Name Type Description Notes
pet Pet Pet object that needs to be added to the store [optional]

Return type

ApiResponse<Pet>

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful operation -

testEchoBodyPetResponseString

String testEchoBodyPetResponseString(pet)

Test empty response body

Test empty response body

Example

// Import classes:
import org.openapitools.client.ApiClient;
import org.openapitools.client.ApiException;
import org.openapitools.client.Configuration;
import org.openapitools.client.models.*;
import org.openapitools.client.api.BodyApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        defaultClient.setBasePath("http://localhost:3000");

        BodyApi apiInstance = new BodyApi(defaultClient);
        Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store
        try {
            String result = apiInstance.testEchoBodyPetResponseString(pet);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling BodyApi#testEchoBodyPetResponseString");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

Name Type Description Notes
pet Pet Pet object that needs to be added to the store [optional]

Return type

String

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: text/plain

HTTP response details

Status code Description Response headers
200 Successful operation -

testEchoBodyPetResponseStringWithHttpInfo

ApiResponse testEchoBodyPetResponseString testEchoBodyPetResponseStringWithHttpInfo(pet)

Test empty response body

Test empty response body

Example

// Import classes:
import org.openapitools.client.ApiClient;
import org.openapitools.client.ApiException;
import org.openapitools.client.ApiResponse;
import org.openapitools.client.Configuration;
import org.openapitools.client.models.*;
import org.openapitools.client.api.BodyApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        defaultClient.setBasePath("http://localhost:3000");

        BodyApi apiInstance = new BodyApi(defaultClient);
        Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store
        try {
            ApiResponse<String> response = apiInstance.testEchoBodyPetResponseStringWithHttpInfo(pet);
            System.out.println("Status code: " + response.getStatusCode());
            System.out.println("Response headers: " + response.getHeaders());
            System.out.println("Response body: " + response.getData());
        } catch (ApiException e) {
            System.err.println("Exception when calling BodyApi#testEchoBodyPetResponseString");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Response headers: " + e.getResponseHeaders());
            System.err.println("Reason: " + e.getResponseBody());
            e.printStackTrace();
        }
    }
}

Parameters

Name Type Description Notes
pet Pet Pet object that needs to be added to the store [optional]

Return type

ApiResponse<String>

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: text/plain

HTTP response details

Status code Description Response headers
200 Successful operation -