mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-11 13:42:44 +00:00
[python-nextgen] add support for StrictBytes (#15365)
* add strictbyte support in python-nextgen client * update samples * use union of strictbytes, strictstr for backward compatibility
This commit is contained in:
@@ -452,7 +452,7 @@ public class PythonNextgenClientCodegen extends AbstractPythonCodegen implements
|
|||||||
typingImports.add("Dict");
|
typingImports.add("Dict");
|
||||||
return String.format(Locale.ROOT, "Dict[str, %s]",
|
return String.format(Locale.ROOT, "Dict[str, %s]",
|
||||||
getPydanticType(cp.items, typingImports, pydanticImports, datetimeImports, modelImports, exampleImports, classname));
|
getPydanticType(cp.items, typingImports, pydanticImports, datetimeImports, modelImports, exampleImports, classname));
|
||||||
} else if (cp.isString || cp.isBinary || cp.isByteArray) {
|
} else if (cp.isString) {
|
||||||
if (cp.hasValidation) {
|
if (cp.hasValidation) {
|
||||||
List<String> fieldCustomization = new ArrayList<>();
|
List<String> fieldCustomization = new ArrayList<>();
|
||||||
// e.g. constr(regex=r'/[a-z]/i', strict=True)
|
// e.g. constr(regex=r'/[a-z]/i', strict=True)
|
||||||
@@ -567,12 +567,10 @@ public class PythonNextgenClientCodegen extends AbstractPythonCodegen implements
|
|||||||
pydanticImports.add("conint");
|
pydanticImports.add("conint");
|
||||||
return String.format(Locale.ROOT, "%s(%s)", "conint",
|
return String.format(Locale.ROOT, "%s(%s)", "conint",
|
||||||
StringUtils.join(fieldCustomization, ", "));
|
StringUtils.join(fieldCustomization, ", "));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
pydanticImports.add("StrictInt");
|
pydanticImports.add("StrictInt");
|
||||||
return "StrictInt";
|
return "StrictInt";
|
||||||
}
|
}
|
||||||
/* comment out the following as byte/binary is a string at the moment (path to the file, e.g. "/var/tmp/a.gif")
|
|
||||||
} else if (cp.isBinary || cp.isByteArray) {
|
} else if (cp.isBinary || cp.isByteArray) {
|
||||||
if (cp.hasValidation) {
|
if (cp.hasValidation) {
|
||||||
List<String> fieldCustomization = new ArrayList<>();
|
List<String> fieldCustomization = new ArrayList<>();
|
||||||
@@ -584,14 +582,23 @@ public class PythonNextgenClientCodegen extends AbstractPythonCodegen implements
|
|||||||
if (cp.getMaxLength() != null) {
|
if (cp.getMaxLength() != null) {
|
||||||
fieldCustomization.add("max_length=" + cp.getMaxLength());
|
fieldCustomization.add("max_length=" + cp.getMaxLength());
|
||||||
}
|
}
|
||||||
|
if (cp.getPattern() != null) {
|
||||||
|
pydanticImports.add("validator");
|
||||||
|
// use validator instead as regex doesn't support flags, e.g. IGNORECASE
|
||||||
|
//fieldCustomization.add(Locale.ROOT, String.format(Locale.ROOT, "regex=r'%s'", cp.getPattern()));
|
||||||
|
}
|
||||||
|
|
||||||
pydanticImports.add("conbytes");
|
pydanticImports.add("conbytes");
|
||||||
return String.format(Locale.ROOT, "%s(%s)", "conbytes", StringUtils.join(fieldCustomization, ", "));
|
pydanticImports.add("constr");
|
||||||
|
typingImports.add("Union");
|
||||||
|
return String.format(Locale.ROOT, "%s(%s)", "Union[conbytes, constr]", StringUtils.join(fieldCustomization, ", "));
|
||||||
} else {
|
} else {
|
||||||
// same as above which has validation
|
// same as above which has validation
|
||||||
pydanticImports.add("StrictBytes");
|
pydanticImports.add("StrictBytes");
|
||||||
return "StrictBytes";
|
pydanticImports.add("StrictStr");
|
||||||
}*/
|
typingImports.add("Union");
|
||||||
|
return "Union[StrictBytes, StrictStr]";
|
||||||
|
}
|
||||||
} else if (cp.isBoolean) {
|
} else if (cp.isBoolean) {
|
||||||
pydanticImports.add("StrictBool");
|
pydanticImports.add("StrictBool");
|
||||||
return "StrictBool";
|
return "StrictBool";
|
||||||
@@ -862,11 +869,15 @@ public class PythonNextgenClientCodegen extends AbstractPythonCodegen implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
pydanticImports.add("conbytes");
|
pydanticImports.add("conbytes");
|
||||||
return String.format(Locale.ROOT, "%s(%s)", "conbytes", StringUtils.join(fieldCustomization, ", "));
|
pydanticImports.add("constr");
|
||||||
|
typingImports.add("Union");
|
||||||
|
return String.format(Locale.ROOT, "%s(%s)", "Union[conbytes, constr]", StringUtils.join(fieldCustomization, ", "));
|
||||||
} else {
|
} else {
|
||||||
// same as above which has validation
|
// same as above which has validation
|
||||||
pydanticImports.add("StrictBytes");
|
pydanticImports.add("StrictBytes");
|
||||||
return "StrictBytes";
|
pydanticImports.add("StrictStr");
|
||||||
|
typingImports.add("Union");
|
||||||
|
return "Union[StrictBytes, StrictStr]";
|
||||||
}
|
}
|
||||||
} else if (cp.isBoolean) {
|
} else if (cp.isBoolean) {
|
||||||
pydanticImports.add("StrictBool");
|
pydanticImports.add("StrictBool");
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
{{>partial_header}}
|
{{>partial_header}}
|
||||||
|
|
||||||
import re # noqa: F401
|
import re # noqa: F401
|
||||||
|
import io
|
||||||
|
|
||||||
from pydantic import validate_arguments, ValidationError
|
from pydantic import validate_arguments, ValidationError
|
||||||
from typing_extensions import Annotated{{#asyncio}}
|
from typing_extensions import Annotated{{#asyncio}}
|
||||||
@@ -223,13 +224,13 @@ class {{classname}}(object):
|
|||||||
{{#formParams}}
|
{{#formParams}}
|
||||||
if _params['{{paramName}}']:
|
if _params['{{paramName}}']:
|
||||||
{{^isFile}}
|
{{^isFile}}
|
||||||
_form_params.append(('{{baseName}}', _params['{{paramName}}']))
|
_form_params.append(('{{{baseName}}}', _params['{{paramName}}']))
|
||||||
{{/isFile}}
|
{{/isFile}}
|
||||||
{{#isFile}}
|
{{#isFile}}
|
||||||
_files['{{baseName}}'] = _params['{{paramName}}']
|
_files['{{{baseName}}}'] = _params['{{paramName}}']
|
||||||
{{/isFile}}
|
{{/isFile}}
|
||||||
{{#isArray}}
|
{{#isArray}}
|
||||||
_collection_formats['{{baseName}}'] = '{{collectionFormat}}'
|
_collection_formats['{{{baseName}}}'] = '{{collectionFormat}}'
|
||||||
{{/isArray}}
|
{{/isArray}}
|
||||||
|
|
||||||
{{/formParams}}
|
{{/formParams}}
|
||||||
@@ -238,6 +239,13 @@ class {{classname}}(object):
|
|||||||
{{#bodyParam}}
|
{{#bodyParam}}
|
||||||
if _params['{{paramName}}'] is not None:
|
if _params['{{paramName}}'] is not None:
|
||||||
_body_params = _params['{{paramName}}']
|
_body_params = _params['{{paramName}}']
|
||||||
|
{{#isBinary}}
|
||||||
|
# convert to byte array if the input is a file name (str)
|
||||||
|
if isinstance(_body_params, str):
|
||||||
|
with io.open(_body_params, "rb") as _fp:
|
||||||
|
_body_params_from_file = _fp.read()
|
||||||
|
_body_params = _body_params_from_file
|
||||||
|
{{/isBinary}}
|
||||||
|
|
||||||
{{/bodyParam}}
|
{{/bodyParam}}
|
||||||
{{#hasProduces}}
|
{{#hasProduces}}
|
||||||
|
|||||||
@@ -319,6 +319,27 @@ paths:
|
|||||||
text/plain:
|
text/plain:
|
||||||
schema:
|
schema:
|
||||||
type: string
|
type: string
|
||||||
|
# body parameter tests
|
||||||
|
/body/application/octetstream/binary:
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- body
|
||||||
|
summary: Test body parameter(s)
|
||||||
|
description: Test body parameter(s)
|
||||||
|
operationId: test/body/application/octetstream/binary
|
||||||
|
requestBody:
|
||||||
|
content:
|
||||||
|
application/octet-stream:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
format: binary
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Successful operation
|
||||||
|
content:
|
||||||
|
text/plain:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
/echo/body/Pet:
|
/echo/body/Pet:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
|
|||||||
@@ -106,6 +106,7 @@ All URIs are relative to *http://localhost:3000*
|
|||||||
Class | Method | HTTP request | Description
|
Class | Method | HTTP request | Description
|
||||||
------------ | ------------- | ------------- | -------------
|
------------ | ------------- | ------------- | -------------
|
||||||
*BodyApi* | [**testBinaryGif**](docs/BodyApi.md#testBinaryGif) | **POST** /binary/gif | Test binary (gif) response body
|
*BodyApi* | [**testBinaryGif**](docs/BodyApi.md#testBinaryGif) | **POST** /binary/gif | Test binary (gif) response body
|
||||||
|
*BodyApi* | [**testBodyApplicationOctetstreamBinary**](docs/BodyApi.md#testBodyApplicationOctetstreamBinary) | **POST** /body/application/octetstream/binary | Test body parameter(s)
|
||||||
*BodyApi* | [**testEchoBodyFreeFormObjectResponseString**](docs/BodyApi.md#testEchoBodyFreeFormObjectResponseString) | **POST** /echo/body/FreeFormObject/response_string | Test free form object
|
*BodyApi* | [**testEchoBodyFreeFormObjectResponseString**](docs/BodyApi.md#testEchoBodyFreeFormObjectResponseString) | **POST** /echo/body/FreeFormObject/response_string | Test free form object
|
||||||
*BodyApi* | [**testEchoBodyPet**](docs/BodyApi.md#testEchoBodyPet) | **POST** /echo/body/Pet | Test body parameter(s)
|
*BodyApi* | [**testEchoBodyPet**](docs/BodyApi.md#testEchoBodyPet) | **POST** /echo/body/Pet | Test body parameter(s)
|
||||||
*BodyApi* | [**testEchoBodyPetResponseString**](docs/BodyApi.md#testEchoBodyPetResponseString) | **POST** /echo/body/Pet/response_string | Test empty response body
|
*BodyApi* | [**testEchoBodyPetResponseString**](docs/BodyApi.md#testEchoBodyPetResponseString) | **POST** /echo/body/Pet/response_string | Test empty response body
|
||||||
|
|||||||
@@ -313,6 +313,28 @@ paths:
|
|||||||
tags:
|
tags:
|
||||||
- query
|
- query
|
||||||
x-accepts: text/plain
|
x-accepts: text/plain
|
||||||
|
/body/application/octetstream/binary:
|
||||||
|
post:
|
||||||
|
description: Test body parameter(s)
|
||||||
|
operationId: test/body/application/octetstream/binary
|
||||||
|
requestBody:
|
||||||
|
content:
|
||||||
|
application/octet-stream:
|
||||||
|
schema:
|
||||||
|
format: binary
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
content:
|
||||||
|
text/plain:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
description: Successful operation
|
||||||
|
summary: Test body parameter(s)
|
||||||
|
tags:
|
||||||
|
- body
|
||||||
|
x-content-type: application/octet-stream
|
||||||
|
x-accepts: text/plain
|
||||||
/echo/body/Pet:
|
/echo/body/Pet:
|
||||||
post:
|
post:
|
||||||
description: Test body parameter(s)
|
description: Test body parameter(s)
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ All URIs are relative to *http://localhost:3000*
|
|||||||
| Method | HTTP request | Description |
|
| Method | HTTP request | Description |
|
||||||
|------------- | ------------- | -------------|
|
|------------- | ------------- | -------------|
|
||||||
| [**testBinaryGif**](BodyApi.md#testBinaryGif) | **POST** /binary/gif | Test binary (gif) response body |
|
| [**testBinaryGif**](BodyApi.md#testBinaryGif) | **POST** /binary/gif | Test binary (gif) response body |
|
||||||
|
| [**testBodyApplicationOctetstreamBinary**](BodyApi.md#testBodyApplicationOctetstreamBinary) | **POST** /body/application/octetstream/binary | Test body parameter(s) |
|
||||||
| [**testEchoBodyFreeFormObjectResponseString**](BodyApi.md#testEchoBodyFreeFormObjectResponseString) | **POST** /echo/body/FreeFormObject/response_string | Test free form object |
|
| [**testEchoBodyFreeFormObjectResponseString**](BodyApi.md#testEchoBodyFreeFormObjectResponseString) | **POST** /echo/body/FreeFormObject/response_string | Test free form object |
|
||||||
| [**testEchoBodyPet**](BodyApi.md#testEchoBodyPet) | **POST** /echo/body/Pet | Test body parameter(s) |
|
| [**testEchoBodyPet**](BodyApi.md#testEchoBodyPet) | **POST** /echo/body/Pet | Test body parameter(s) |
|
||||||
| [**testEchoBodyPetResponseString**](BodyApi.md#testEchoBodyPetResponseString) | **POST** /echo/body/Pet/response_string | Test empty response body |
|
| [**testEchoBodyPetResponseString**](BodyApi.md#testEchoBodyPetResponseString) | **POST** /echo/body/Pet/response_string | Test empty response body |
|
||||||
@@ -74,6 +75,72 @@ No authorization required
|
|||||||
| **200** | Successful operation | - |
|
| **200** | Successful operation | - |
|
||||||
|
|
||||||
|
|
||||||
|
## testBodyApplicationOctetstreamBinary
|
||||||
|
|
||||||
|
> String testBodyApplicationOctetstreamBinary(body)
|
||||||
|
|
||||||
|
Test body parameter(s)
|
||||||
|
|
||||||
|
Test body parameter(s)
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
```java
|
||||||
|
// 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);
|
||||||
|
File body = new File("/path/to/file"); // File |
|
||||||
|
try {
|
||||||
|
String result = apiInstance.testBodyApplicationOctetstreamBinary(body);
|
||||||
|
System.out.println(result);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling BodyApi#testBodyApplicationOctetstreamBinary");
|
||||||
|
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 |
|
||||||
|
|------------- | ------------- | ------------- | -------------|
|
||||||
|
| **body** | **File**| | [optional] |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
**String**
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/octet-stream
|
||||||
|
- **Accept**: text/plain
|
||||||
|
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **200** | Successful operation | - |
|
||||||
|
|
||||||
|
|
||||||
## testEchoBodyFreeFormObjectResponseString
|
## testEchoBodyFreeFormObjectResponseString
|
||||||
|
|
||||||
> String testEchoBodyFreeFormObjectResponseString(body)
|
> String testEchoBodyFreeFormObjectResponseString(body)
|
||||||
|
|||||||
@@ -121,6 +121,75 @@ public class BodyApi {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test body parameter(s)
|
||||||
|
* Test body parameter(s)
|
||||||
|
* @param body (optional)
|
||||||
|
* @return String
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
*/
|
||||||
|
public String testBodyApplicationOctetstreamBinary(File body) throws ApiException {
|
||||||
|
return this.testBodyApplicationOctetstreamBinary(body, Collections.emptyMap());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test body parameter(s)
|
||||||
|
* Test body parameter(s)
|
||||||
|
* @param body (optional)
|
||||||
|
* @param additionalHeaders additionalHeaders for this call
|
||||||
|
* @return String
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
*/
|
||||||
|
public String testBodyApplicationOctetstreamBinary(File body, Map<String, String> additionalHeaders) throws ApiException {
|
||||||
|
Object localVarPostBody = body;
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
String localVarPath = "/body/application/octetstream/binary";
|
||||||
|
|
||||||
|
StringJoiner localVarQueryStringJoiner = new StringJoiner("&");
|
||||||
|
String localVarQueryParameterBaseName;
|
||||||
|
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||||
|
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
|
||||||
|
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
|
||||||
|
Map<String, String> localVarCookieParams = new HashMap<String, String>();
|
||||||
|
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
|
||||||
|
localVarHeaderParams.putAll(additionalHeaders);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
final String[] localVarAccepts = {
|
||||||
|
"text/plain"
|
||||||
|
};
|
||||||
|
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||||
|
|
||||||
|
final String[] localVarContentTypes = {
|
||||||
|
"application/octet-stream"
|
||||||
|
};
|
||||||
|
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||||
|
|
||||||
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
TypeReference<String> localVarReturnType = new TypeReference<String>() {};
|
||||||
|
return apiClient.invokeAPI(
|
||||||
|
localVarPath,
|
||||||
|
"POST",
|
||||||
|
localVarQueryParams,
|
||||||
|
localVarCollectionQueryParams,
|
||||||
|
localVarQueryStringJoiner.toString(),
|
||||||
|
localVarPostBody,
|
||||||
|
localVarHeaderParams,
|
||||||
|
localVarCookieParams,
|
||||||
|
localVarFormParams,
|
||||||
|
localVarAccept,
|
||||||
|
localVarContentType,
|
||||||
|
localVarAuthNames,
|
||||||
|
localVarReturnType
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test free form object
|
* Test free form object
|
||||||
* Test free form object
|
* Test free form object
|
||||||
|
|||||||
@@ -313,6 +313,28 @@ paths:
|
|||||||
tags:
|
tags:
|
||||||
- query
|
- query
|
||||||
x-accepts: text/plain
|
x-accepts: text/plain
|
||||||
|
/body/application/octetstream/binary:
|
||||||
|
post:
|
||||||
|
description: Test body parameter(s)
|
||||||
|
operationId: test/body/application/octetstream/binary
|
||||||
|
requestBody:
|
||||||
|
content:
|
||||||
|
application/octet-stream:
|
||||||
|
schema:
|
||||||
|
format: binary
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
content:
|
||||||
|
text/plain:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
description: Successful operation
|
||||||
|
summary: Test body parameter(s)
|
||||||
|
tags:
|
||||||
|
- body
|
||||||
|
x-content-type: application/octet-stream
|
||||||
|
x-accepts: text/plain
|
||||||
/echo/body/Pet:
|
/echo/body/Pet:
|
||||||
post:
|
post:
|
||||||
description: Test body parameter(s)
|
description: Test body parameter(s)
|
||||||
|
|||||||
@@ -43,6 +43,35 @@ public interface BodyApi extends ApiClient.Api {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test body parameter(s)
|
||||||
|
* Test body parameter(s)
|
||||||
|
* @param body (optional)
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
|
@RequestLine("POST /body/application/octetstream/binary")
|
||||||
|
@Headers({
|
||||||
|
"Content-Type: application/octet-stream",
|
||||||
|
"Accept: text/plain",
|
||||||
|
})
|
||||||
|
String testBodyApplicationOctetstreamBinary(File body);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test body parameter(s)
|
||||||
|
* Similar to <code>testBodyApplicationOctetstreamBinary</code> but it also returns the http response headers .
|
||||||
|
* Test body parameter(s)
|
||||||
|
* @param body (optional)
|
||||||
|
* @return A ApiResponse that wraps the response boyd and the http headers.
|
||||||
|
*/
|
||||||
|
@RequestLine("POST /body/application/octetstream/binary")
|
||||||
|
@Headers({
|
||||||
|
"Content-Type: application/octet-stream",
|
||||||
|
"Accept: text/plain",
|
||||||
|
})
|
||||||
|
ApiResponse<String> testBodyApplicationOctetstreamBinaryWithHttpInfo(File body);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test free form object
|
* Test free form object
|
||||||
* Test free form object
|
* Test free form object
|
||||||
|
|||||||
@@ -106,6 +106,8 @@ Class | Method | HTTP request | Description
|
|||||||
------------ | ------------- | ------------- | -------------
|
------------ | ------------- | ------------- | -------------
|
||||||
*BodyApi* | [**testBinaryGif**](docs/BodyApi.md#testBinaryGif) | **POST** /binary/gif | Test binary (gif) response body
|
*BodyApi* | [**testBinaryGif**](docs/BodyApi.md#testBinaryGif) | **POST** /binary/gif | Test binary (gif) response body
|
||||||
*BodyApi* | [**testBinaryGifWithHttpInfo**](docs/BodyApi.md#testBinaryGifWithHttpInfo) | **POST** /binary/gif | Test binary (gif) response body
|
*BodyApi* | [**testBinaryGifWithHttpInfo**](docs/BodyApi.md#testBinaryGifWithHttpInfo) | **POST** /binary/gif | Test binary (gif) response body
|
||||||
|
*BodyApi* | [**testBodyApplicationOctetstreamBinary**](docs/BodyApi.md#testBodyApplicationOctetstreamBinary) | **POST** /body/application/octetstream/binary | Test body parameter(s)
|
||||||
|
*BodyApi* | [**testBodyApplicationOctetstreamBinaryWithHttpInfo**](docs/BodyApi.md#testBodyApplicationOctetstreamBinaryWithHttpInfo) | **POST** /body/application/octetstream/binary | Test body parameter(s)
|
||||||
*BodyApi* | [**testEchoBodyFreeFormObjectResponseString**](docs/BodyApi.md#testEchoBodyFreeFormObjectResponseString) | **POST** /echo/body/FreeFormObject/response_string | Test free form object
|
*BodyApi* | [**testEchoBodyFreeFormObjectResponseString**](docs/BodyApi.md#testEchoBodyFreeFormObjectResponseString) | **POST** /echo/body/FreeFormObject/response_string | Test free form object
|
||||||
*BodyApi* | [**testEchoBodyFreeFormObjectResponseStringWithHttpInfo**](docs/BodyApi.md#testEchoBodyFreeFormObjectResponseStringWithHttpInfo) | **POST** /echo/body/FreeFormObject/response_string | Test free form object
|
*BodyApi* | [**testEchoBodyFreeFormObjectResponseStringWithHttpInfo**](docs/BodyApi.md#testEchoBodyFreeFormObjectResponseStringWithHttpInfo) | **POST** /echo/body/FreeFormObject/response_string | Test free form object
|
||||||
*BodyApi* | [**testEchoBodyPet**](docs/BodyApi.md#testEchoBodyPet) | **POST** /echo/body/Pet | Test body parameter(s)
|
*BodyApi* | [**testEchoBodyPet**](docs/BodyApi.md#testEchoBodyPet) | **POST** /echo/body/Pet | Test body parameter(s)
|
||||||
|
|||||||
@@ -313,6 +313,28 @@ paths:
|
|||||||
tags:
|
tags:
|
||||||
- query
|
- query
|
||||||
x-accepts: text/plain
|
x-accepts: text/plain
|
||||||
|
/body/application/octetstream/binary:
|
||||||
|
post:
|
||||||
|
description: Test body parameter(s)
|
||||||
|
operationId: test/body/application/octetstream/binary
|
||||||
|
requestBody:
|
||||||
|
content:
|
||||||
|
application/octet-stream:
|
||||||
|
schema:
|
||||||
|
format: binary
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
content:
|
||||||
|
text/plain:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
description: Successful operation
|
||||||
|
summary: Test body parameter(s)
|
||||||
|
tags:
|
||||||
|
- body
|
||||||
|
x-content-type: application/octet-stream
|
||||||
|
x-accepts: text/plain
|
||||||
/echo/body/Pet:
|
/echo/body/Pet:
|
||||||
post:
|
post:
|
||||||
description: Test body parameter(s)
|
description: Test body parameter(s)
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ All URIs are relative to *http://localhost:3000*
|
|||||||
|------------- | ------------- | -------------|
|
|------------- | ------------- | -------------|
|
||||||
| [**testBinaryGif**](BodyApi.md#testBinaryGif) | **POST** /binary/gif | Test binary (gif) response body |
|
| [**testBinaryGif**](BodyApi.md#testBinaryGif) | **POST** /binary/gif | Test binary (gif) response body |
|
||||||
| [**testBinaryGifWithHttpInfo**](BodyApi.md#testBinaryGifWithHttpInfo) | **POST** /binary/gif | Test binary (gif) response body |
|
| [**testBinaryGifWithHttpInfo**](BodyApi.md#testBinaryGifWithHttpInfo) | **POST** /binary/gif | Test binary (gif) response body |
|
||||||
|
| [**testBodyApplicationOctetstreamBinary**](BodyApi.md#testBodyApplicationOctetstreamBinary) | **POST** /body/application/octetstream/binary | Test body parameter(s) |
|
||||||
|
| [**testBodyApplicationOctetstreamBinaryWithHttpInfo**](BodyApi.md#testBodyApplicationOctetstreamBinaryWithHttpInfo) | **POST** /body/application/octetstream/binary | Test body parameter(s) |
|
||||||
| [**testEchoBodyFreeFormObjectResponseString**](BodyApi.md#testEchoBodyFreeFormObjectResponseString) | **POST** /echo/body/FreeFormObject/response_string | Test free form object |
|
| [**testEchoBodyFreeFormObjectResponseString**](BodyApi.md#testEchoBodyFreeFormObjectResponseString) | **POST** /echo/body/FreeFormObject/response_string | Test free form object |
|
||||||
| [**testEchoBodyFreeFormObjectResponseStringWithHttpInfo**](BodyApi.md#testEchoBodyFreeFormObjectResponseStringWithHttpInfo) | **POST** /echo/body/FreeFormObject/response_string | Test free form object |
|
| [**testEchoBodyFreeFormObjectResponseStringWithHttpInfo**](BodyApi.md#testEchoBodyFreeFormObjectResponseStringWithHttpInfo) | **POST** /echo/body/FreeFormObject/response_string | Test free form object |
|
||||||
| [**testEchoBodyPet**](BodyApi.md#testEchoBodyPet) | **POST** /echo/body/Pet | Test body parameter(s) |
|
| [**testEchoBodyPet**](BodyApi.md#testEchoBodyPet) | **POST** /echo/body/Pet | Test body parameter(s) |
|
||||||
@@ -143,6 +145,140 @@ No authorization required
|
|||||||
| **200** | Successful operation | - |
|
| **200** | Successful operation | - |
|
||||||
|
|
||||||
|
|
||||||
|
## testBodyApplicationOctetstreamBinary
|
||||||
|
|
||||||
|
> String testBodyApplicationOctetstreamBinary(body)
|
||||||
|
|
||||||
|
Test body parameter(s)
|
||||||
|
|
||||||
|
Test body parameter(s)
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
```java
|
||||||
|
// 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);
|
||||||
|
File body = new File("/path/to/file"); // File |
|
||||||
|
try {
|
||||||
|
String result = apiInstance.testBodyApplicationOctetstreamBinary(body);
|
||||||
|
System.out.println(result);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling BodyApi#testBodyApplicationOctetstreamBinary");
|
||||||
|
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 |
|
||||||
|
|------------- | ------------- | ------------- | -------------|
|
||||||
|
| **body** | **File**| | [optional] |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
**String**
|
||||||
|
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/octet-stream
|
||||||
|
- **Accept**: text/plain
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **200** | Successful operation | - |
|
||||||
|
|
||||||
|
## testBodyApplicationOctetstreamBinaryWithHttpInfo
|
||||||
|
|
||||||
|
> ApiResponse<String> testBodyApplicationOctetstreamBinary testBodyApplicationOctetstreamBinaryWithHttpInfo(body)
|
||||||
|
|
||||||
|
Test body parameter(s)
|
||||||
|
|
||||||
|
Test body parameter(s)
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
```java
|
||||||
|
// 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);
|
||||||
|
File body = new File("/path/to/file"); // File |
|
||||||
|
try {
|
||||||
|
ApiResponse<String> response = apiInstance.testBodyApplicationOctetstreamBinaryWithHttpInfo(body);
|
||||||
|
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#testBodyApplicationOctetstreamBinary");
|
||||||
|
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 |
|
||||||
|
|------------- | ------------- | ------------- | -------------|
|
||||||
|
| **body** | **File**| | [optional] |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
ApiResponse<**String**>
|
||||||
|
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/octet-stream
|
||||||
|
- **Accept**: text/plain
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **200** | Successful operation | - |
|
||||||
|
|
||||||
|
|
||||||
## testEchoBodyFreeFormObjectResponseString
|
## testEchoBodyFreeFormObjectResponseString
|
||||||
|
|
||||||
> String testEchoBodyFreeFormObjectResponseString(body)
|
> String testEchoBodyFreeFormObjectResponseString(body)
|
||||||
|
|||||||
@@ -148,6 +148,87 @@ public class BodyApi {
|
|||||||
}
|
}
|
||||||
return localVarRequestBuilder;
|
return localVarRequestBuilder;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Test body parameter(s)
|
||||||
|
* Test body parameter(s)
|
||||||
|
* @param body (optional)
|
||||||
|
* @return String
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
*/
|
||||||
|
public String testBodyApplicationOctetstreamBinary(File body) throws ApiException {
|
||||||
|
ApiResponse<String> localVarResponse = testBodyApplicationOctetstreamBinaryWithHttpInfo(body);
|
||||||
|
return localVarResponse.getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test body parameter(s)
|
||||||
|
* Test body parameter(s)
|
||||||
|
* @param body (optional)
|
||||||
|
* @return ApiResponse<String>
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
*/
|
||||||
|
public ApiResponse<String> testBodyApplicationOctetstreamBinaryWithHttpInfo(File body) throws ApiException {
|
||||||
|
HttpRequest.Builder localVarRequestBuilder = testBodyApplicationOctetstreamBinaryRequestBuilder(body);
|
||||||
|
try {
|
||||||
|
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
|
||||||
|
localVarRequestBuilder.build(),
|
||||||
|
HttpResponse.BodyHandlers.ofInputStream());
|
||||||
|
if (memberVarResponseInterceptor != null) {
|
||||||
|
memberVarResponseInterceptor.accept(localVarResponse);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||||
|
throw getApiException("testBodyApplicationOctetstreamBinary", localVarResponse);
|
||||||
|
}
|
||||||
|
// for plain text response
|
||||||
|
if (localVarResponse.headers().map().containsKey("Content-Type") &&
|
||||||
|
"text/plain".equalsIgnoreCase(localVarResponse.headers().map().get("Content-Type").get(0))) {
|
||||||
|
java.util.Scanner s = new java.util.Scanner(localVarResponse.body()).useDelimiter("\\A");
|
||||||
|
String responseBodyText = s.hasNext() ? s.next() : "";
|
||||||
|
return new ApiResponse<String>(
|
||||||
|
localVarResponse.statusCode(),
|
||||||
|
localVarResponse.headers().map(),
|
||||||
|
responseBodyText
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException("Error! The response Content-Type is supposed to be `text/plain` but it's not: " + localVarResponse);
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new ApiException(e);
|
||||||
|
}
|
||||||
|
catch (InterruptedException e) {
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
|
throw new ApiException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private HttpRequest.Builder testBodyApplicationOctetstreamBinaryRequestBuilder(File body) throws ApiException {
|
||||||
|
|
||||||
|
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
|
||||||
|
|
||||||
|
String localVarPath = "/body/application/octetstream/binary";
|
||||||
|
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
|
||||||
|
|
||||||
|
localVarRequestBuilder.header("Content-Type", "application/octet-stream");
|
||||||
|
localVarRequestBuilder.header("Accept", "text/plain");
|
||||||
|
|
||||||
|
try {
|
||||||
|
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body);
|
||||||
|
localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new ApiException(e);
|
||||||
|
}
|
||||||
|
if (memberVarReadTimeout != null) {
|
||||||
|
localVarRequestBuilder.timeout(memberVarReadTimeout);
|
||||||
|
}
|
||||||
|
if (memberVarInterceptor != null) {
|
||||||
|
memberVarInterceptor.accept(localVarRequestBuilder);
|
||||||
|
}
|
||||||
|
return localVarRequestBuilder;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Test free form object
|
* Test free form object
|
||||||
* Test free form object
|
* Test free form object
|
||||||
|
|||||||
@@ -113,6 +113,7 @@ All URIs are relative to *http://localhost:3000*
|
|||||||
Class | Method | HTTP request | Description
|
Class | Method | HTTP request | Description
|
||||||
------------ | ------------- | ------------- | -------------
|
------------ | ------------- | ------------- | -------------
|
||||||
*BodyApi* | [**testBinaryGif**](docs/BodyApi.md#testBinaryGif) | **POST** /binary/gif | Test binary (gif) response body
|
*BodyApi* | [**testBinaryGif**](docs/BodyApi.md#testBinaryGif) | **POST** /binary/gif | Test binary (gif) response body
|
||||||
|
*BodyApi* | [**testBodyApplicationOctetstreamBinary**](docs/BodyApi.md#testBodyApplicationOctetstreamBinary) | **POST** /body/application/octetstream/binary | Test body parameter(s)
|
||||||
*BodyApi* | [**testEchoBodyFreeFormObjectResponseString**](docs/BodyApi.md#testEchoBodyFreeFormObjectResponseString) | **POST** /echo/body/FreeFormObject/response_string | Test free form object
|
*BodyApi* | [**testEchoBodyFreeFormObjectResponseString**](docs/BodyApi.md#testEchoBodyFreeFormObjectResponseString) | **POST** /echo/body/FreeFormObject/response_string | Test free form object
|
||||||
*BodyApi* | [**testEchoBodyPet**](docs/BodyApi.md#testEchoBodyPet) | **POST** /echo/body/Pet | Test body parameter(s)
|
*BodyApi* | [**testEchoBodyPet**](docs/BodyApi.md#testEchoBodyPet) | **POST** /echo/body/Pet | Test body parameter(s)
|
||||||
*BodyApi* | [**testEchoBodyPetResponseString**](docs/BodyApi.md#testEchoBodyPetResponseString) | **POST** /echo/body/Pet/response_string | Test empty response body
|
*BodyApi* | [**testEchoBodyPetResponseString**](docs/BodyApi.md#testEchoBodyPetResponseString) | **POST** /echo/body/Pet/response_string | Test empty response body
|
||||||
|
|||||||
@@ -313,6 +313,28 @@ paths:
|
|||||||
tags:
|
tags:
|
||||||
- query
|
- query
|
||||||
x-accepts: text/plain
|
x-accepts: text/plain
|
||||||
|
/body/application/octetstream/binary:
|
||||||
|
post:
|
||||||
|
description: Test body parameter(s)
|
||||||
|
operationId: test/body/application/octetstream/binary
|
||||||
|
requestBody:
|
||||||
|
content:
|
||||||
|
application/octet-stream:
|
||||||
|
schema:
|
||||||
|
format: binary
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
content:
|
||||||
|
text/plain:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
description: Successful operation
|
||||||
|
summary: Test body parameter(s)
|
||||||
|
tags:
|
||||||
|
- body
|
||||||
|
x-content-type: application/octet-stream
|
||||||
|
x-accepts: text/plain
|
||||||
/echo/body/Pet:
|
/echo/body/Pet:
|
||||||
post:
|
post:
|
||||||
description: Test body parameter(s)
|
description: Test body parameter(s)
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ All URIs are relative to *http://localhost:3000*
|
|||||||
| Method | HTTP request | Description |
|
| Method | HTTP request | Description |
|
||||||
|------------- | ------------- | -------------|
|
|------------- | ------------- | -------------|
|
||||||
| [**testBinaryGif**](BodyApi.md#testBinaryGif) | **POST** /binary/gif | Test binary (gif) response body |
|
| [**testBinaryGif**](BodyApi.md#testBinaryGif) | **POST** /binary/gif | Test binary (gif) response body |
|
||||||
|
| [**testBodyApplicationOctetstreamBinary**](BodyApi.md#testBodyApplicationOctetstreamBinary) | **POST** /body/application/octetstream/binary | Test body parameter(s) |
|
||||||
| [**testEchoBodyFreeFormObjectResponseString**](BodyApi.md#testEchoBodyFreeFormObjectResponseString) | **POST** /echo/body/FreeFormObject/response_string | Test free form object |
|
| [**testEchoBodyFreeFormObjectResponseString**](BodyApi.md#testEchoBodyFreeFormObjectResponseString) | **POST** /echo/body/FreeFormObject/response_string | Test free form object |
|
||||||
| [**testEchoBodyPet**](BodyApi.md#testEchoBodyPet) | **POST** /echo/body/Pet | Test body parameter(s) |
|
| [**testEchoBodyPet**](BodyApi.md#testEchoBodyPet) | **POST** /echo/body/Pet | Test body parameter(s) |
|
||||||
| [**testEchoBodyPetResponseString**](BodyApi.md#testEchoBodyPetResponseString) | **POST** /echo/body/Pet/response_string | Test empty response body |
|
| [**testEchoBodyPetResponseString**](BodyApi.md#testEchoBodyPetResponseString) | **POST** /echo/body/Pet/response_string | Test empty response body |
|
||||||
@@ -69,6 +70,68 @@ No authorization required
|
|||||||
|-------------|-------------|------------------|
|
|-------------|-------------|------------------|
|
||||||
| **200** | Successful operation | - |
|
| **200** | Successful operation | - |
|
||||||
|
|
||||||
|
<a name="testBodyApplicationOctetstreamBinary"></a>
|
||||||
|
# **testBodyApplicationOctetstreamBinary**
|
||||||
|
> String testBodyApplicationOctetstreamBinary(body)
|
||||||
|
|
||||||
|
Test body parameter(s)
|
||||||
|
|
||||||
|
Test body parameter(s)
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```java
|
||||||
|
// 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);
|
||||||
|
File body = new File("/path/to/file"); // File |
|
||||||
|
try {
|
||||||
|
String result = apiInstance.testBodyApplicationOctetstreamBinary(body);
|
||||||
|
System.out.println(result);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling BodyApi#testBodyApplicationOctetstreamBinary");
|
||||||
|
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 |
|
||||||
|
|------------- | ------------- | ------------- | -------------|
|
||||||
|
| **body** | **File**| | [optional] |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
**String**
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/octet-stream
|
||||||
|
- **Accept**: text/plain
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **200** | Successful operation | - |
|
||||||
|
|
||||||
<a name="testEchoBodyFreeFormObjectResponseString"></a>
|
<a name="testEchoBodyFreeFormObjectResponseString"></a>
|
||||||
# **testEchoBodyFreeFormObjectResponseString**
|
# **testEchoBodyFreeFormObjectResponseString**
|
||||||
> String testEchoBodyFreeFormObjectResponseString(body)
|
> String testEchoBodyFreeFormObjectResponseString(body)
|
||||||
|
|||||||
@@ -188,6 +188,124 @@ public class BodyApi {
|
|||||||
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
|
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
|
||||||
return localVarCall;
|
return localVarCall;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Build call for testBodyApplicationOctetstreamBinary
|
||||||
|
* @param body (optional)
|
||||||
|
* @param _callback Callback for upload/download progress
|
||||||
|
* @return Call to execute
|
||||||
|
* @throws ApiException If fail to serialize the request body object
|
||||||
|
* @http.response.details
|
||||||
|
<table summary="Response Details" border="1">
|
||||||
|
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
|
||||||
|
<tr><td> 200 </td><td> Successful operation </td><td> - </td></tr>
|
||||||
|
</table>
|
||||||
|
*/
|
||||||
|
public okhttp3.Call testBodyApplicationOctetstreamBinaryCall(File body, final ApiCallback _callback) throws ApiException {
|
||||||
|
String basePath = null;
|
||||||
|
// Operation Servers
|
||||||
|
String[] localBasePaths = new String[] { };
|
||||||
|
|
||||||
|
// Determine Base Path to Use
|
||||||
|
if (localCustomBaseUrl != null){
|
||||||
|
basePath = localCustomBaseUrl;
|
||||||
|
} else if ( localBasePaths.length > 0 ) {
|
||||||
|
basePath = localBasePaths[localHostIndex];
|
||||||
|
} else {
|
||||||
|
basePath = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Object localVarPostBody = body;
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
String localVarPath = "/body/application/octetstream/binary";
|
||||||
|
|
||||||
|
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||||
|
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
|
||||||
|
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
|
||||||
|
Map<String, String> localVarCookieParams = new HashMap<String, String>();
|
||||||
|
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
final String[] localVarAccepts = {
|
||||||
|
"text/plain"
|
||||||
|
};
|
||||||
|
final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
|
||||||
|
if (localVarAccept != null) {
|
||||||
|
localVarHeaderParams.put("Accept", localVarAccept);
|
||||||
|
}
|
||||||
|
|
||||||
|
final String[] localVarContentTypes = {
|
||||||
|
"application/octet-stream"
|
||||||
|
};
|
||||||
|
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
|
||||||
|
if (localVarContentType != null) {
|
||||||
|
localVarHeaderParams.put("Content-Type", localVarContentType);
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
|
private okhttp3.Call testBodyApplicationOctetstreamBinaryValidateBeforeCall(File body, final ApiCallback _callback) throws ApiException {
|
||||||
|
return testBodyApplicationOctetstreamBinaryCall(body, _callback);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test body parameter(s)
|
||||||
|
* Test body parameter(s)
|
||||||
|
* @param body (optional)
|
||||||
|
* @return String
|
||||||
|
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||||
|
* @http.response.details
|
||||||
|
<table summary="Response Details" border="1">
|
||||||
|
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
|
||||||
|
<tr><td> 200 </td><td> Successful operation </td><td> - </td></tr>
|
||||||
|
</table>
|
||||||
|
*/
|
||||||
|
public String testBodyApplicationOctetstreamBinary(File body) throws ApiException {
|
||||||
|
ApiResponse<String> localVarResp = testBodyApplicationOctetstreamBinaryWithHttpInfo(body);
|
||||||
|
return localVarResp.getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test body parameter(s)
|
||||||
|
* Test body parameter(s)
|
||||||
|
* @param body (optional)
|
||||||
|
* @return ApiResponse<String>
|
||||||
|
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||||
|
* @http.response.details
|
||||||
|
<table summary="Response Details" border="1">
|
||||||
|
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
|
||||||
|
<tr><td> 200 </td><td> Successful operation </td><td> - </td></tr>
|
||||||
|
</table>
|
||||||
|
*/
|
||||||
|
public ApiResponse<String> testBodyApplicationOctetstreamBinaryWithHttpInfo(File body) throws ApiException {
|
||||||
|
okhttp3.Call localVarCall = testBodyApplicationOctetstreamBinaryValidateBeforeCall(body, null);
|
||||||
|
Type localVarReturnType = new TypeToken<String>(){}.getType();
|
||||||
|
return localVarApiClient.execute(localVarCall, localVarReturnType);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test body parameter(s) (asynchronously)
|
||||||
|
* Test body parameter(s)
|
||||||
|
* @param body (optional)
|
||||||
|
* @param _callback The callback to be executed when the API call finishes
|
||||||
|
* @return The request call
|
||||||
|
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
|
||||||
|
* @http.response.details
|
||||||
|
<table summary="Response Details" border="1">
|
||||||
|
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
|
||||||
|
<tr><td> 200 </td><td> Successful operation </td><td> - </td></tr>
|
||||||
|
</table>
|
||||||
|
*/
|
||||||
|
public okhttp3.Call testBodyApplicationOctetstreamBinaryAsync(File body, final ApiCallback<String> _callback) throws ApiException {
|
||||||
|
|
||||||
|
okhttp3.Call localVarCall = testBodyApplicationOctetstreamBinaryValidateBeforeCall(body, _callback);
|
||||||
|
Type localVarReturnType = new TypeToken<String>(){}.getType();
|
||||||
|
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
|
||||||
|
return localVarCall;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Build call for testEchoBodyFreeFormObjectResponseString
|
* Build call for testEchoBodyFreeFormObjectResponseString
|
||||||
* @param body Free form object (optional)
|
* @param body Free form object (optional)
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ All URIs are relative to *http://localhost:3000*
|
|||||||
Class | Method | HTTP request | Description
|
Class | Method | HTTP request | Description
|
||||||
------------ | ------------- | ------------- | -------------
|
------------ | ------------- | ------------- | -------------
|
||||||
*BodyApi* | [**test_binary_gif**](docs/BodyApi.md#test_binary_gif) | **POST** /binary/gif | Test binary (gif) response body
|
*BodyApi* | [**test_binary_gif**](docs/BodyApi.md#test_binary_gif) | **POST** /binary/gif | Test binary (gif) response body
|
||||||
|
*BodyApi* | [**test_body_application_octetstream_binary**](docs/BodyApi.md#test_body_application_octetstream_binary) | **POST** /body/application/octetstream/binary | Test body parameter(s)
|
||||||
*BodyApi* | [**test_echo_body_free_form_object_response_string**](docs/BodyApi.md#test_echo_body_free_form_object_response_string) | **POST** /echo/body/FreeFormObject/response_string | Test free form object
|
*BodyApi* | [**test_echo_body_free_form_object_response_string**](docs/BodyApi.md#test_echo_body_free_form_object_response_string) | **POST** /echo/body/FreeFormObject/response_string | Test free form object
|
||||||
*BodyApi* | [**test_echo_body_pet**](docs/BodyApi.md#test_echo_body_pet) | **POST** /echo/body/Pet | Test body parameter(s)
|
*BodyApi* | [**test_echo_body_pet**](docs/BodyApi.md#test_echo_body_pet) | **POST** /echo/body/Pet | Test body parameter(s)
|
||||||
*BodyApi* | [**test_echo_body_pet_response_string**](docs/BodyApi.md#test_echo_body_pet_response_string) | **POST** /echo/body/Pet/response_string | Test empty response body
|
*BodyApi* | [**test_echo_body_pet_response_string**](docs/BodyApi.md#test_echo_body_pet_response_string) | **POST** /echo/body/Pet/response_string | Test empty response body
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ All URIs are relative to *http://localhost:3000*
|
|||||||
Method | HTTP request | Description
|
Method | HTTP request | Description
|
||||||
------------- | ------------- | -------------
|
------------- | ------------- | -------------
|
||||||
[**test_binary_gif**](BodyApi.md#test_binary_gif) | **POST** /binary/gif | Test binary (gif) response body
|
[**test_binary_gif**](BodyApi.md#test_binary_gif) | **POST** /binary/gif | Test binary (gif) response body
|
||||||
|
[**test_body_application_octetstream_binary**](BodyApi.md#test_body_application_octetstream_binary) | **POST** /body/application/octetstream/binary | Test body parameter(s)
|
||||||
[**test_echo_body_free_form_object_response_string**](BodyApi.md#test_echo_body_free_form_object_response_string) | **POST** /echo/body/FreeFormObject/response_string | Test free form object
|
[**test_echo_body_free_form_object_response_string**](BodyApi.md#test_echo_body_free_form_object_response_string) | **POST** /echo/body/FreeFormObject/response_string | Test free form object
|
||||||
[**test_echo_body_pet**](BodyApi.md#test_echo_body_pet) | **POST** /echo/body/Pet | Test body parameter(s)
|
[**test_echo_body_pet**](BodyApi.md#test_echo_body_pet) | **POST** /echo/body/Pet | Test body parameter(s)
|
||||||
[**test_echo_body_pet_response_string**](BodyApi.md#test_echo_body_pet_response_string) | **POST** /echo/body/Pet/response_string | Test empty response body
|
[**test_echo_body_pet_response_string**](BodyApi.md#test_echo_body_pet_response_string) | **POST** /echo/body/Pet/response_string | Test empty response body
|
||||||
@@ -72,6 +73,71 @@ No authorization required
|
|||||||
|
|
||||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
# **test_body_application_octetstream_binary**
|
||||||
|
> str test_body_application_octetstream_binary(body=body)
|
||||||
|
|
||||||
|
Test body parameter(s)
|
||||||
|
|
||||||
|
Test body parameter(s)
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
```python
|
||||||
|
import time
|
||||||
|
import os
|
||||||
|
import openapi_client
|
||||||
|
from openapi_client.rest import ApiException
|
||||||
|
from pprint import pprint
|
||||||
|
|
||||||
|
# Defining the host is optional and defaults to http://localhost:3000
|
||||||
|
# See configuration.py for a list of all supported configuration parameters.
|
||||||
|
configuration = openapi_client.Configuration(
|
||||||
|
host = "http://localhost:3000"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# Enter a context with an instance of the API client
|
||||||
|
with openapi_client.ApiClient(configuration) as api_client:
|
||||||
|
# Create an instance of the API class
|
||||||
|
api_instance = openapi_client.BodyApi(api_client)
|
||||||
|
body = None # bytearray | (optional)
|
||||||
|
|
||||||
|
try:
|
||||||
|
# Test body parameter(s)
|
||||||
|
api_response = api_instance.test_body_application_octetstream_binary(body=body)
|
||||||
|
print("The response of BodyApi->test_body_application_octetstream_binary:\n")
|
||||||
|
pprint(api_response)
|
||||||
|
except Exception as e:
|
||||||
|
print("Exception when calling BodyApi->test_body_application_octetstream_binary: %s\n" % e)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**body** | **bytearray**| | [optional]
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
**str**
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/octet-stream
|
||||||
|
- **Accept**: text/plain
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
**200** | Successful operation | - |
|
||||||
|
|
||||||
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||||
|
|
||||||
# **test_echo_body_free_form_object_response_string**
|
# **test_echo_body_free_form_object_response_string**
|
||||||
> str test_echo_body_free_form_object_response_string(body=body)
|
> str test_echo_body_free_form_object_response_string(body=body)
|
||||||
|
|
||||||
|
|||||||
@@ -14,13 +14,14 @@
|
|||||||
|
|
||||||
|
|
||||||
import re # noqa: F401
|
import re # noqa: F401
|
||||||
|
import io
|
||||||
|
|
||||||
from pydantic import validate_arguments, ValidationError
|
from pydantic import validate_arguments, ValidationError
|
||||||
from typing_extensions import Annotated
|
from typing_extensions import Annotated
|
||||||
|
|
||||||
from pydantic import Field
|
from pydantic import Field, StrictBytes, StrictStr
|
||||||
|
|
||||||
from typing import Any, Dict, Optional
|
from typing import Any, Dict, Optional, Union
|
||||||
|
|
||||||
from openapi_client.models.pet import Pet
|
from openapi_client.models.pet import Pet
|
||||||
from openapi_client.models.tag import Tag
|
from openapi_client.models.tag import Tag
|
||||||
@@ -176,6 +177,158 @@ class BodyApi(object):
|
|||||||
collection_formats=_collection_formats,
|
collection_formats=_collection_formats,
|
||||||
_request_auth=_params.get('_request_auth'))
|
_request_auth=_params.get('_request_auth'))
|
||||||
|
|
||||||
|
@validate_arguments
|
||||||
|
def test_body_application_octetstream_binary(self, body : Optional[Union[StrictBytes, StrictStr]] = None, **kwargs) -> str: # noqa: E501
|
||||||
|
"""Test body parameter(s) # noqa: E501
|
||||||
|
|
||||||
|
Test body parameter(s) # noqa: E501
|
||||||
|
This method makes a synchronous HTTP request by default. To make an
|
||||||
|
asynchronous HTTP request, please pass async_req=True
|
||||||
|
|
||||||
|
>>> thread = api.test_body_application_octetstream_binary(body, async_req=True)
|
||||||
|
>>> result = thread.get()
|
||||||
|
|
||||||
|
:param body:
|
||||||
|
:type body: bytearray
|
||||||
|
:param async_req: Whether to execute the request asynchronously.
|
||||||
|
:type async_req: bool, optional
|
||||||
|
:param _preload_content: if False, the urllib3.HTTPResponse object will
|
||||||
|
be returned without reading/decoding response
|
||||||
|
data. Default is True.
|
||||||
|
:type _preload_content: bool, optional
|
||||||
|
:param _request_timeout: timeout setting for this request. If one
|
||||||
|
number provided, it will be total request
|
||||||
|
timeout. It can also be a pair (tuple) of
|
||||||
|
(connection, read) timeouts.
|
||||||
|
:return: Returns the result object.
|
||||||
|
If the method is called asynchronously,
|
||||||
|
returns the request thread.
|
||||||
|
:rtype: str
|
||||||
|
"""
|
||||||
|
kwargs['_return_http_data_only'] = True
|
||||||
|
return self.test_body_application_octetstream_binary_with_http_info(body, **kwargs) # noqa: E501
|
||||||
|
|
||||||
|
@validate_arguments
|
||||||
|
def test_body_application_octetstream_binary_with_http_info(self, body : Optional[Union[StrictBytes, StrictStr]] = None, **kwargs): # noqa: E501
|
||||||
|
"""Test body parameter(s) # noqa: E501
|
||||||
|
|
||||||
|
Test body parameter(s) # noqa: E501
|
||||||
|
This method makes a synchronous HTTP request by default. To make an
|
||||||
|
asynchronous HTTP request, please pass async_req=True
|
||||||
|
|
||||||
|
>>> thread = api.test_body_application_octetstream_binary_with_http_info(body, async_req=True)
|
||||||
|
>>> result = thread.get()
|
||||||
|
|
||||||
|
:param body:
|
||||||
|
:type body: bytearray
|
||||||
|
:param async_req: Whether to execute the request asynchronously.
|
||||||
|
:type async_req: bool, optional
|
||||||
|
:param _return_http_data_only: response data without head status code
|
||||||
|
and headers
|
||||||
|
:type _return_http_data_only: bool, optional
|
||||||
|
:param _preload_content: if False, the urllib3.HTTPResponse object will
|
||||||
|
be returned without reading/decoding response
|
||||||
|
data. Default is True.
|
||||||
|
:type _preload_content: bool, optional
|
||||||
|
:param _request_timeout: timeout setting for this request. If one
|
||||||
|
number provided, it will be total request
|
||||||
|
timeout. It can also be a pair (tuple) of
|
||||||
|
(connection, read) timeouts.
|
||||||
|
:param _request_auth: set to override the auth_settings for an a single
|
||||||
|
request; this effectively ignores the authentication
|
||||||
|
in the spec for a single request.
|
||||||
|
:type _request_auth: dict, optional
|
||||||
|
:type _content_type: string, optional: force content-type for the request
|
||||||
|
:return: Returns the result object.
|
||||||
|
If the method is called asynchronously,
|
||||||
|
returns the request thread.
|
||||||
|
:rtype: tuple(str, status_code(int), headers(HTTPHeaderDict))
|
||||||
|
"""
|
||||||
|
|
||||||
|
_params = locals()
|
||||||
|
|
||||||
|
_all_params = [
|
||||||
|
'body'
|
||||||
|
]
|
||||||
|
_all_params.extend(
|
||||||
|
[
|
||||||
|
'async_req',
|
||||||
|
'_return_http_data_only',
|
||||||
|
'_preload_content',
|
||||||
|
'_request_timeout',
|
||||||
|
'_request_auth',
|
||||||
|
'_content_type',
|
||||||
|
'_headers'
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
# validate the arguments
|
||||||
|
for _key, _val in _params['kwargs'].items():
|
||||||
|
if _key not in _all_params:
|
||||||
|
raise ApiTypeError(
|
||||||
|
"Got an unexpected keyword argument '%s'"
|
||||||
|
" to method test_body_application_octetstream_binary" % _key
|
||||||
|
)
|
||||||
|
_params[_key] = _val
|
||||||
|
del _params['kwargs']
|
||||||
|
|
||||||
|
_collection_formats = {}
|
||||||
|
|
||||||
|
# process the path parameters
|
||||||
|
_path_params = {}
|
||||||
|
|
||||||
|
# process the query parameters
|
||||||
|
_query_params = []
|
||||||
|
# process the header parameters
|
||||||
|
_header_params = dict(_params.get('_headers', {}))
|
||||||
|
# process the form parameters
|
||||||
|
_form_params = []
|
||||||
|
_files = {}
|
||||||
|
# process the body parameter
|
||||||
|
_body_params = None
|
||||||
|
if _params['body'] is not None:
|
||||||
|
_body_params = _params['body']
|
||||||
|
# convert to byte array if the input is a file name (str)
|
||||||
|
if isinstance(_body_params, str):
|
||||||
|
with io.open(_body_params, "rb") as _fp:
|
||||||
|
_body_params_from_file = _fp.read()
|
||||||
|
_body_params = _body_params_from_file
|
||||||
|
|
||||||
|
# set the HTTP header `Accept`
|
||||||
|
_header_params['Accept'] = self.api_client.select_header_accept(
|
||||||
|
['text/plain']) # noqa: E501
|
||||||
|
|
||||||
|
# set the HTTP header `Content-Type`
|
||||||
|
_content_types_list = _params.get('_content_type',
|
||||||
|
self.api_client.select_header_content_type(
|
||||||
|
['application/octet-stream']))
|
||||||
|
if _content_types_list:
|
||||||
|
_header_params['Content-Type'] = _content_types_list
|
||||||
|
|
||||||
|
# authentication setting
|
||||||
|
_auth_settings = [] # noqa: E501
|
||||||
|
|
||||||
|
_response_types_map = {
|
||||||
|
'200': "str",
|
||||||
|
}
|
||||||
|
|
||||||
|
return self.api_client.call_api(
|
||||||
|
'/body/application/octetstream/binary', 'POST',
|
||||||
|
_path_params,
|
||||||
|
_query_params,
|
||||||
|
_header_params,
|
||||||
|
body=_body_params,
|
||||||
|
post_params=_form_params,
|
||||||
|
files=_files,
|
||||||
|
response_types_map=_response_types_map,
|
||||||
|
auth_settings=_auth_settings,
|
||||||
|
async_req=_params.get('async_req'),
|
||||||
|
_return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501
|
||||||
|
_preload_content=_params.get('_preload_content', True),
|
||||||
|
_request_timeout=_params.get('_request_timeout'),
|
||||||
|
collection_formats=_collection_formats,
|
||||||
|
_request_auth=_params.get('_request_auth'))
|
||||||
|
|
||||||
@validate_arguments
|
@validate_arguments
|
||||||
def test_echo_body_free_form_object_response_string(self, body : Annotated[Optional[Dict[str, Any]], Field(description="Free form object")] = None, **kwargs) -> str: # noqa: E501
|
def test_echo_body_free_form_object_response_string(self, body : Annotated[Optional[Dict[str, Any]], Field(description="Free form object")] = None, **kwargs) -> str: # noqa: E501
|
||||||
"""Test free form object # noqa: E501
|
"""Test free form object # noqa: E501
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
|
|
||||||
import re # noqa: F401
|
import re # noqa: F401
|
||||||
|
import io
|
||||||
|
|
||||||
from pydantic import validate_arguments, ValidationError
|
from pydantic import validate_arguments, ValidationError
|
||||||
from typing_extensions import Annotated
|
from typing_extensions import Annotated
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
|
|
||||||
import re # noqa: F401
|
import re # noqa: F401
|
||||||
|
import io
|
||||||
|
|
||||||
from pydantic import validate_arguments, ValidationError
|
from pydantic import validate_arguments, ValidationError
|
||||||
from typing_extensions import Annotated
|
from typing_extensions import Annotated
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
|
|
||||||
import re # noqa: F401
|
import re # noqa: F401
|
||||||
|
import io
|
||||||
|
|
||||||
from pydantic import validate_arguments, ValidationError
|
from pydantic import validate_arguments, ValidationError
|
||||||
from typing_extensions import Annotated
|
from typing_extensions import Annotated
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
|
|
||||||
import re # noqa: F401
|
import re # noqa: F401
|
||||||
|
import io
|
||||||
|
|
||||||
from pydantic import validate_arguments, ValidationError
|
from pydantic import validate_arguments, ValidationError
|
||||||
from typing_extensions import Annotated
|
from typing_extensions import Annotated
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ from __future__ import absolute_import
|
|||||||
import unittest
|
import unittest
|
||||||
import datetime
|
import datetime
|
||||||
import base64
|
import base64
|
||||||
|
import os
|
||||||
|
|
||||||
import openapi_client
|
import openapi_client
|
||||||
from openapi_client.api.query_api import QueryApi # noqa: E501
|
from openapi_client.api.query_api import QueryApi # noqa: E501
|
||||||
@@ -23,8 +24,15 @@ from openapi_client.rest import ApiException
|
|||||||
class TestManual(unittest.TestCase):
|
class TestManual(unittest.TestCase):
|
||||||
"""Manually written tests"""
|
"""Manually written tests"""
|
||||||
|
|
||||||
|
gif_base64 = "R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="
|
||||||
|
|
||||||
|
def setUpFiles(self):
|
||||||
|
self.test_file_dir = os.path.join(os.path.dirname(__file__), "..", "testfiles")
|
||||||
|
self.test_file_dir = os.path.realpath(self.test_file_dir)
|
||||||
|
self.test_gif = os.path.join(self.test_file_dir, "test.gif")
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
pass
|
self.setUpFiles()
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
pass
|
pass
|
||||||
@@ -71,7 +79,7 @@ class TestManual(unittest.TestCase):
|
|||||||
|
|
||||||
# Test binary response
|
# Test binary response
|
||||||
api_response = api_instance.test_binary_gif()
|
api_response = api_instance.test_binary_gif()
|
||||||
self.assertEqual((base64.b64encode(api_response)).decode("utf-8"), "R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==")
|
self.assertEqual((base64.b64encode(api_response)).decode("utf-8"), self.gif_base64)
|
||||||
|
|
||||||
def testNumberPropertiesOnly(self):
|
def testNumberPropertiesOnly(self):
|
||||||
n = openapi_client.NumberPropertiesOnly.from_json('{"number": 123, "float": 456, "double": 34}')
|
n = openapi_client.NumberPropertiesOnly.from_json('{"number": 123, "float": 456, "double": 34}')
|
||||||
@@ -84,6 +92,28 @@ class TestManual(unittest.TestCase):
|
|||||||
self.assertEqual(n.float, 456.2)
|
self.assertEqual(n.float, 456.2)
|
||||||
self.assertEqual(n.double, 34.3)
|
self.assertEqual(n.double, 34.3)
|
||||||
|
|
||||||
|
def testApplicatinOctetStreamBinaryBodyParameter(self):
|
||||||
|
api_instance = openapi_client.BodyApi()
|
||||||
|
binary_body = base64.b64decode(self.gif_base64)
|
||||||
|
api_response = api_instance.test_body_application_octetstream_binary(binary_body)
|
||||||
|
e = EchoServerResponseParser(api_response)
|
||||||
|
self.assertEqual(e.path, "/body/application/octetstream/binary")
|
||||||
|
self.assertEqual(e.headers["Content-Type"], 'application/octet-stream')
|
||||||
|
self.assertEqual(bytes(e.body, "utf-8"), b'GIF89a\x01\x00\x01\x00\xef\xbf\xbd\x01\x00\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\x00\x00\x00!\xef\xbf\xbd\x04\x01\n\x00\x01\x00,\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02L\x01\x00;')
|
||||||
|
|
||||||
|
def testApplicatinOctetStreamBinaryBodyParameterWithFile(self):
|
||||||
|
api_instance = openapi_client.BodyApi()
|
||||||
|
try:
|
||||||
|
api_response = api_instance.test_body_application_octetstream_binary("invalid_file_path")
|
||||||
|
except FileNotFoundError as err:
|
||||||
|
self.assertEqual("[Errno 2] No such file or directory: 'invalid_file_path'", str(err))
|
||||||
|
|
||||||
|
api_response = api_instance.test_body_application_octetstream_binary(self.test_gif)
|
||||||
|
e = EchoServerResponseParser(api_response)
|
||||||
|
self.assertEqual(e.path, "/body/application/octetstream/binary")
|
||||||
|
self.assertEqual(e.headers["Content-Type"], 'application/octet-stream')
|
||||||
|
self.assertEqual(bytes(e.body, "utf-8"), b'GIF89a\x01\x00\x01\x00\xef\xbf\xbd\x01\x00\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\x00\x00\x00!\xef\xbf\xbd\x04\x01\n\x00\x01\x00,\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02L\x01\x00;')
|
||||||
|
|
||||||
def testBodyParameter(self):
|
def testBodyParameter(self):
|
||||||
n = openapi_client.Pet.from_dict({"name": "testing", "photoUrls": ["http://1", "http://2"]})
|
n = openapi_client.Pet.from_dict({"name": "testing", "photoUrls": ["http://1", "http://2"]})
|
||||||
api_instance = openapi_client.BodyApi()
|
api_instance = openapi_client.BodyApi()
|
||||||
@@ -121,7 +151,7 @@ class EchoServerResponseParser():
|
|||||||
if http_response is None:
|
if http_response is None:
|
||||||
raise ValueError("http response must not be None.")
|
raise ValueError("http response must not be None.")
|
||||||
|
|
||||||
lines = http_response.split("\n")
|
lines = http_response.splitlines()
|
||||||
self.headers = dict()
|
self.headers = dict()
|
||||||
x = 0
|
x = 0
|
||||||
while x < len(lines):
|
while x < len(lines):
|
||||||
@@ -131,7 +161,7 @@ class EchoServerResponseParser():
|
|||||||
self.path = items[1];
|
self.path = items[1];
|
||||||
self.protocol = items[2];
|
self.protocol = items[2];
|
||||||
elif lines[x] == "": # blank line
|
elif lines[x] == "": # blank line
|
||||||
self.body = "\n".join(lines[x:])
|
self.body = "\n".join(lines[x+1:])
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
key_value = lines[x].split(": ")
|
key_value = lines[x].split(": ")
|
||||||
|
|||||||
BIN
samples/client/echo_api/python-nextgen/testfiles/test.gif
Normal file
BIN
samples/client/echo_api/python-nextgen/testfiles/test.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 43 B |
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
|
|
||||||
import re # noqa: F401
|
import re # noqa: F401
|
||||||
|
import io
|
||||||
|
|
||||||
from pydantic import validate_arguments, ValidationError
|
from pydantic import validate_arguments, ValidationError
|
||||||
from typing_extensions import Annotated
|
from typing_extensions import Annotated
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
|
|
||||||
import re # noqa: F401
|
import re # noqa: F401
|
||||||
|
import io
|
||||||
|
|
||||||
from pydantic import validate_arguments, ValidationError
|
from pydantic import validate_arguments, ValidationError
|
||||||
from typing_extensions import Annotated
|
from typing_extensions import Annotated
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
|
|
||||||
import re # noqa: F401
|
import re # noqa: F401
|
||||||
|
import io
|
||||||
|
|
||||||
from pydantic import validate_arguments, ValidationError
|
from pydantic import validate_arguments, ValidationError
|
||||||
from typing_extensions import Annotated
|
from typing_extensions import Annotated
|
||||||
@@ -20,9 +21,9 @@ from typing import overload, Optional, Union, Awaitable
|
|||||||
|
|
||||||
from datetime import date, datetime
|
from datetime import date, datetime
|
||||||
|
|
||||||
from pydantic import Field, StrictBool, StrictInt, StrictStr, confloat, conint, conlist, constr, validator
|
from pydantic import Field, StrictBool, StrictBytes, StrictInt, StrictStr, confloat, conint, conlist, constr, validator
|
||||||
|
|
||||||
from typing import Any, Dict, Optional
|
from typing import Any, Dict, Optional, Union
|
||||||
|
|
||||||
from petstore_api.models.client import Client
|
from petstore_api.models.client import Client
|
||||||
from petstore_api.models.enum_class import EnumClass
|
from petstore_api.models.enum_class import EnumClass
|
||||||
@@ -1434,15 +1435,15 @@ class FakeApi(object):
|
|||||||
_request_auth=_params.get('_request_auth'))
|
_request_auth=_params.get('_request_auth'))
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
async def test_body_with_binary(self, body : Annotated[Optional[StrictStr], Field(..., description="image to upload")], **kwargs) -> None: # noqa: E501
|
async def test_body_with_binary(self, body : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(..., description="image to upload")], **kwargs) -> None: # noqa: E501
|
||||||
...
|
...
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def test_body_with_binary(self, body : Annotated[Optional[StrictStr], Field(..., description="image to upload")], async_req: Optional[bool]=True, **kwargs) -> None: # noqa: E501
|
def test_body_with_binary(self, body : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(..., description="image to upload")], async_req: Optional[bool]=True, **kwargs) -> None: # noqa: E501
|
||||||
...
|
...
|
||||||
|
|
||||||
@validate_arguments
|
@validate_arguments
|
||||||
def test_body_with_binary(self, body : Annotated[Optional[StrictStr], Field(..., description="image to upload")], async_req: Optional[bool]=None, **kwargs) -> Union[None, Awaitable[None]]: # noqa: E501
|
def test_body_with_binary(self, body : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(..., description="image to upload")], async_req: Optional[bool]=None, **kwargs) -> Union[None, Awaitable[None]]: # noqa: E501
|
||||||
"""test_body_with_binary # noqa: E501
|
"""test_body_with_binary # noqa: E501
|
||||||
|
|
||||||
For this test, the body has to be a binary file. # noqa: E501
|
For this test, the body has to be a binary file. # noqa: E501
|
||||||
@@ -1475,7 +1476,7 @@ class FakeApi(object):
|
|||||||
return self.test_body_with_binary_with_http_info(body, **kwargs) # noqa: E501
|
return self.test_body_with_binary_with_http_info(body, **kwargs) # noqa: E501
|
||||||
|
|
||||||
@validate_arguments
|
@validate_arguments
|
||||||
def test_body_with_binary_with_http_info(self, body : Annotated[Optional[StrictStr], Field(..., description="image to upload")], **kwargs): # noqa: E501
|
def test_body_with_binary_with_http_info(self, body : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(..., description="image to upload")], **kwargs): # noqa: E501
|
||||||
"""test_body_with_binary # noqa: E501
|
"""test_body_with_binary # noqa: E501
|
||||||
|
|
||||||
For this test, the body has to be a binary file. # noqa: E501
|
For this test, the body has to be a binary file. # noqa: E501
|
||||||
@@ -1554,6 +1555,11 @@ class FakeApi(object):
|
|||||||
_body_params = None
|
_body_params = None
|
||||||
if _params['body'] is not None:
|
if _params['body'] is not None:
|
||||||
_body_params = _params['body']
|
_body_params = _params['body']
|
||||||
|
# convert to byte array if the input is a file name (str)
|
||||||
|
if isinstance(_body_params, str):
|
||||||
|
with io.open(_body_params, "rb") as _fp:
|
||||||
|
_body_params_from_file = _fp.read()
|
||||||
|
_body_params = _body_params_from_file
|
||||||
|
|
||||||
# set the HTTP header `Content-Type`
|
# set the HTTP header `Content-Type`
|
||||||
_content_types_list = _params.get('_content_type',
|
_content_types_list = _params.get('_content_type',
|
||||||
@@ -2203,15 +2209,15 @@ class FakeApi(object):
|
|||||||
_request_auth=_params.get('_request_auth'))
|
_request_auth=_params.get('_request_auth'))
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
async def test_endpoint_parameters(self, number : Annotated[confloat(le=543.2, ge=32.1), Field(..., description="None")], double : Annotated[confloat(le=123.4, ge=67.8), Field(..., description="None")], pattern_without_delimiter : Annotated[constr(strict=True), Field(..., description="None")], byte : Annotated[StrictStr, Field(..., description="None")], integer : Annotated[Optional[conint(strict=True, le=100, ge=10)], Field(description="None")] = None, int32 : Annotated[Optional[conint(strict=True, le=200, ge=20)], Field(description="None")] = None, int64 : Annotated[Optional[StrictInt], Field(description="None")] = None, float : Annotated[Optional[confloat(le=987.6)], Field(description="None")] = None, string : Annotated[Optional[constr(strict=True)], Field(description="None")] = None, binary : Annotated[Optional[StrictStr], Field(description="None")] = None, var_date : Annotated[Optional[date], Field(description="None")] = None, date_time : Annotated[Optional[datetime], Field(description="None")] = None, password : Annotated[Optional[constr(strict=True, max_length=64, min_length=10)], Field(description="None")] = None, param_callback : Annotated[Optional[StrictStr], Field(description="None")] = None, **kwargs) -> None: # noqa: E501
|
async def test_endpoint_parameters(self, number : Annotated[confloat(le=543.2, ge=32.1), Field(..., description="None")], double : Annotated[confloat(le=123.4, ge=67.8), Field(..., description="None")], pattern_without_delimiter : Annotated[constr(strict=True), Field(..., description="None")], byte : Annotated[Union[StrictBytes, StrictStr], Field(..., description="None")], integer : Annotated[Optional[conint(strict=True, le=100, ge=10)], Field(description="None")] = None, int32 : Annotated[Optional[conint(strict=True, le=200, ge=20)], Field(description="None")] = None, int64 : Annotated[Optional[StrictInt], Field(description="None")] = None, float : Annotated[Optional[confloat(le=987.6)], Field(description="None")] = None, string : Annotated[Optional[constr(strict=True)], Field(description="None")] = None, binary : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="None")] = None, var_date : Annotated[Optional[date], Field(description="None")] = None, date_time : Annotated[Optional[datetime], Field(description="None")] = None, password : Annotated[Optional[constr(strict=True, max_length=64, min_length=10)], Field(description="None")] = None, param_callback : Annotated[Optional[StrictStr], Field(description="None")] = None, **kwargs) -> None: # noqa: E501
|
||||||
...
|
...
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def test_endpoint_parameters(self, number : Annotated[confloat(le=543.2, ge=32.1), Field(..., description="None")], double : Annotated[confloat(le=123.4, ge=67.8), Field(..., description="None")], pattern_without_delimiter : Annotated[constr(strict=True), Field(..., description="None")], byte : Annotated[StrictStr, Field(..., description="None")], integer : Annotated[Optional[conint(strict=True, le=100, ge=10)], Field(description="None")] = None, int32 : Annotated[Optional[conint(strict=True, le=200, ge=20)], Field(description="None")] = None, int64 : Annotated[Optional[StrictInt], Field(description="None")] = None, float : Annotated[Optional[confloat(le=987.6)], Field(description="None")] = None, string : Annotated[Optional[constr(strict=True)], Field(description="None")] = None, binary : Annotated[Optional[StrictStr], Field(description="None")] = None, var_date : Annotated[Optional[date], Field(description="None")] = None, date_time : Annotated[Optional[datetime], Field(description="None")] = None, password : Annotated[Optional[constr(strict=True, max_length=64, min_length=10)], Field(description="None")] = None, param_callback : Annotated[Optional[StrictStr], Field(description="None")] = None, async_req: Optional[bool]=True, **kwargs) -> None: # noqa: E501
|
def test_endpoint_parameters(self, number : Annotated[confloat(le=543.2, ge=32.1), Field(..., description="None")], double : Annotated[confloat(le=123.4, ge=67.8), Field(..., description="None")], pattern_without_delimiter : Annotated[constr(strict=True), Field(..., description="None")], byte : Annotated[Union[StrictBytes, StrictStr], Field(..., description="None")], integer : Annotated[Optional[conint(strict=True, le=100, ge=10)], Field(description="None")] = None, int32 : Annotated[Optional[conint(strict=True, le=200, ge=20)], Field(description="None")] = None, int64 : Annotated[Optional[StrictInt], Field(description="None")] = None, float : Annotated[Optional[confloat(le=987.6)], Field(description="None")] = None, string : Annotated[Optional[constr(strict=True)], Field(description="None")] = None, binary : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="None")] = None, var_date : Annotated[Optional[date], Field(description="None")] = None, date_time : Annotated[Optional[datetime], Field(description="None")] = None, password : Annotated[Optional[constr(strict=True, max_length=64, min_length=10)], Field(description="None")] = None, param_callback : Annotated[Optional[StrictStr], Field(description="None")] = None, async_req: Optional[bool]=True, **kwargs) -> None: # noqa: E501
|
||||||
...
|
...
|
||||||
|
|
||||||
@validate_arguments
|
@validate_arguments
|
||||||
def test_endpoint_parameters(self, number : Annotated[confloat(le=543.2, ge=32.1), Field(..., description="None")], double : Annotated[confloat(le=123.4, ge=67.8), Field(..., description="None")], pattern_without_delimiter : Annotated[constr(strict=True), Field(..., description="None")], byte : Annotated[StrictStr, Field(..., description="None")], integer : Annotated[Optional[conint(strict=True, le=100, ge=10)], Field(description="None")] = None, int32 : Annotated[Optional[conint(strict=True, le=200, ge=20)], Field(description="None")] = None, int64 : Annotated[Optional[StrictInt], Field(description="None")] = None, float : Annotated[Optional[confloat(le=987.6)], Field(description="None")] = None, string : Annotated[Optional[constr(strict=True)], Field(description="None")] = None, binary : Annotated[Optional[StrictStr], Field(description="None")] = None, var_date : Annotated[Optional[date], Field(description="None")] = None, date_time : Annotated[Optional[datetime], Field(description="None")] = None, password : Annotated[Optional[constr(strict=True, max_length=64, min_length=10)], Field(description="None")] = None, param_callback : Annotated[Optional[StrictStr], Field(description="None")] = None, async_req: Optional[bool]=None, **kwargs) -> Union[None, Awaitable[None]]: # noqa: E501
|
def test_endpoint_parameters(self, number : Annotated[confloat(le=543.2, ge=32.1), Field(..., description="None")], double : Annotated[confloat(le=123.4, ge=67.8), Field(..., description="None")], pattern_without_delimiter : Annotated[constr(strict=True), Field(..., description="None")], byte : Annotated[Union[StrictBytes, StrictStr], Field(..., description="None")], integer : Annotated[Optional[conint(strict=True, le=100, ge=10)], Field(description="None")] = None, int32 : Annotated[Optional[conint(strict=True, le=200, ge=20)], Field(description="None")] = None, int64 : Annotated[Optional[StrictInt], Field(description="None")] = None, float : Annotated[Optional[confloat(le=987.6)], Field(description="None")] = None, string : Annotated[Optional[constr(strict=True)], Field(description="None")] = None, binary : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="None")] = None, var_date : Annotated[Optional[date], Field(description="None")] = None, date_time : Annotated[Optional[datetime], Field(description="None")] = None, password : Annotated[Optional[constr(strict=True, max_length=64, min_length=10)], Field(description="None")] = None, param_callback : Annotated[Optional[StrictStr], Field(description="None")] = None, async_req: Optional[bool]=None, **kwargs) -> Union[None, Awaitable[None]]: # noqa: E501
|
||||||
"""Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501
|
"""Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501
|
||||||
|
|
||||||
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501
|
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501
|
||||||
@@ -2270,7 +2276,7 @@ class FakeApi(object):
|
|||||||
return self.test_endpoint_parameters_with_http_info(number, double, pattern_without_delimiter, byte, integer, int32, int64, float, string, binary, var_date, date_time, password, param_callback, **kwargs) # noqa: E501
|
return self.test_endpoint_parameters_with_http_info(number, double, pattern_without_delimiter, byte, integer, int32, int64, float, string, binary, var_date, date_time, password, param_callback, **kwargs) # noqa: E501
|
||||||
|
|
||||||
@validate_arguments
|
@validate_arguments
|
||||||
def test_endpoint_parameters_with_http_info(self, number : Annotated[confloat(le=543.2, ge=32.1), Field(..., description="None")], double : Annotated[confloat(le=123.4, ge=67.8), Field(..., description="None")], pattern_without_delimiter : Annotated[constr(strict=True), Field(..., description="None")], byte : Annotated[StrictStr, Field(..., description="None")], integer : Annotated[Optional[conint(strict=True, le=100, ge=10)], Field(description="None")] = None, int32 : Annotated[Optional[conint(strict=True, le=200, ge=20)], Field(description="None")] = None, int64 : Annotated[Optional[StrictInt], Field(description="None")] = None, float : Annotated[Optional[confloat(le=987.6)], Field(description="None")] = None, string : Annotated[Optional[constr(strict=True)], Field(description="None")] = None, binary : Annotated[Optional[StrictStr], Field(description="None")] = None, var_date : Annotated[Optional[date], Field(description="None")] = None, date_time : Annotated[Optional[datetime], Field(description="None")] = None, password : Annotated[Optional[constr(strict=True, max_length=64, min_length=10)], Field(description="None")] = None, param_callback : Annotated[Optional[StrictStr], Field(description="None")] = None, **kwargs): # noqa: E501
|
def test_endpoint_parameters_with_http_info(self, number : Annotated[confloat(le=543.2, ge=32.1), Field(..., description="None")], double : Annotated[confloat(le=123.4, ge=67.8), Field(..., description="None")], pattern_without_delimiter : Annotated[constr(strict=True), Field(..., description="None")], byte : Annotated[Union[StrictBytes, StrictStr], Field(..., description="None")], integer : Annotated[Optional[conint(strict=True, le=100, ge=10)], Field(description="None")] = None, int32 : Annotated[Optional[conint(strict=True, le=200, ge=20)], Field(description="None")] = None, int64 : Annotated[Optional[StrictInt], Field(description="None")] = None, float : Annotated[Optional[confloat(le=987.6)], Field(description="None")] = None, string : Annotated[Optional[constr(strict=True)], Field(description="None")] = None, binary : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="None")] = None, var_date : Annotated[Optional[date], Field(description="None")] = None, date_time : Annotated[Optional[datetime], Field(description="None")] = None, password : Annotated[Optional[constr(strict=True, max_length=64, min_length=10)], Field(description="None")] = None, param_callback : Annotated[Optional[StrictStr], Field(description="None")] = None, **kwargs): # noqa: E501
|
||||||
"""Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501
|
"""Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501
|
||||||
|
|
||||||
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501
|
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
|
|
||||||
import re # noqa: F401
|
import re # noqa: F401
|
||||||
|
import io
|
||||||
|
|
||||||
from pydantic import validate_arguments, ValidationError
|
from pydantic import validate_arguments, ValidationError
|
||||||
from typing_extensions import Annotated
|
from typing_extensions import Annotated
|
||||||
|
|||||||
@@ -13,14 +13,15 @@
|
|||||||
|
|
||||||
|
|
||||||
import re # noqa: F401
|
import re # noqa: F401
|
||||||
|
import io
|
||||||
|
|
||||||
from pydantic import validate_arguments, ValidationError
|
from pydantic import validate_arguments, ValidationError
|
||||||
from typing_extensions import Annotated
|
from typing_extensions import Annotated
|
||||||
from typing import overload, Optional, Union, Awaitable
|
from typing import overload, Optional, Union, Awaitable
|
||||||
|
|
||||||
from pydantic import Field, StrictInt, StrictStr, conlist, validator
|
from pydantic import Field, StrictBytes, StrictInt, StrictStr, conlist, validator
|
||||||
|
|
||||||
from typing import List, Optional
|
from typing import List, Optional, Union
|
||||||
|
|
||||||
from petstore_api.models.api_response import ApiResponse
|
from petstore_api.models.api_response import ApiResponse
|
||||||
from petstore_api.models.pet import Pet
|
from petstore_api.models.pet import Pet
|
||||||
@@ -1122,15 +1123,15 @@ class PetApi(object):
|
|||||||
_request_auth=_params.get('_request_auth'))
|
_request_auth=_params.get('_request_auth'))
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
async def upload_file(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, file : Annotated[Optional[StrictStr], Field(description="file to upload")] = None, **kwargs) -> ApiResponse: # noqa: E501
|
async def upload_file(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, file : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="file to upload")] = None, **kwargs) -> ApiResponse: # noqa: E501
|
||||||
...
|
...
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def upload_file(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, file : Annotated[Optional[StrictStr], Field(description="file to upload")] = None, async_req: Optional[bool]=True, **kwargs) -> ApiResponse: # noqa: E501
|
def upload_file(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, file : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="file to upload")] = None, async_req: Optional[bool]=True, **kwargs) -> ApiResponse: # noqa: E501
|
||||||
...
|
...
|
||||||
|
|
||||||
@validate_arguments
|
@validate_arguments
|
||||||
def upload_file(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, file : Annotated[Optional[StrictStr], Field(description="file to upload")] = None, async_req: Optional[bool]=None, **kwargs) -> Union[ApiResponse, Awaitable[ApiResponse]]: # noqa: E501
|
def upload_file(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, file : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="file to upload")] = None, async_req: Optional[bool]=None, **kwargs) -> Union[ApiResponse, Awaitable[ApiResponse]]: # noqa: E501
|
||||||
"""uploads an image # noqa: E501
|
"""uploads an image # noqa: E501
|
||||||
|
|
||||||
# noqa: E501
|
# noqa: E501
|
||||||
@@ -1167,7 +1168,7 @@ class PetApi(object):
|
|||||||
return self.upload_file_with_http_info(pet_id, additional_metadata, file, **kwargs) # noqa: E501
|
return self.upload_file_with_http_info(pet_id, additional_metadata, file, **kwargs) # noqa: E501
|
||||||
|
|
||||||
@validate_arguments
|
@validate_arguments
|
||||||
def upload_file_with_http_info(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, file : Annotated[Optional[StrictStr], Field(description="file to upload")] = None, **kwargs): # noqa: E501
|
def upload_file_with_http_info(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, file : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="file to upload")] = None, **kwargs): # noqa: E501
|
||||||
"""uploads an image # noqa: E501
|
"""uploads an image # noqa: E501
|
||||||
|
|
||||||
# noqa: E501
|
# noqa: E501
|
||||||
@@ -1295,15 +1296,15 @@ class PetApi(object):
|
|||||||
_request_auth=_params.get('_request_auth'))
|
_request_auth=_params.get('_request_auth'))
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
async def upload_file_with_required_file(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], required_file : Annotated[StrictStr, Field(..., description="file to upload")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, **kwargs) -> ApiResponse: # noqa: E501
|
async def upload_file_with_required_file(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], required_file : Annotated[Union[StrictBytes, StrictStr], Field(..., description="file to upload")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, **kwargs) -> ApiResponse: # noqa: E501
|
||||||
...
|
...
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def upload_file_with_required_file(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], required_file : Annotated[StrictStr, Field(..., description="file to upload")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, async_req: Optional[bool]=True, **kwargs) -> ApiResponse: # noqa: E501
|
def upload_file_with_required_file(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], required_file : Annotated[Union[StrictBytes, StrictStr], Field(..., description="file to upload")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, async_req: Optional[bool]=True, **kwargs) -> ApiResponse: # noqa: E501
|
||||||
...
|
...
|
||||||
|
|
||||||
@validate_arguments
|
@validate_arguments
|
||||||
def upload_file_with_required_file(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], required_file : Annotated[StrictStr, Field(..., description="file to upload")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, async_req: Optional[bool]=None, **kwargs) -> Union[ApiResponse, Awaitable[ApiResponse]]: # noqa: E501
|
def upload_file_with_required_file(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], required_file : Annotated[Union[StrictBytes, StrictStr], Field(..., description="file to upload")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, async_req: Optional[bool]=None, **kwargs) -> Union[ApiResponse, Awaitable[ApiResponse]]: # noqa: E501
|
||||||
"""uploads an image (required) # noqa: E501
|
"""uploads an image (required) # noqa: E501
|
||||||
|
|
||||||
# noqa: E501
|
# noqa: E501
|
||||||
@@ -1340,7 +1341,7 @@ class PetApi(object):
|
|||||||
return self.upload_file_with_required_file_with_http_info(pet_id, required_file, additional_metadata, **kwargs) # noqa: E501
|
return self.upload_file_with_required_file_with_http_info(pet_id, required_file, additional_metadata, **kwargs) # noqa: E501
|
||||||
|
|
||||||
@validate_arguments
|
@validate_arguments
|
||||||
def upload_file_with_required_file_with_http_info(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], required_file : Annotated[StrictStr, Field(..., description="file to upload")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, **kwargs): # noqa: E501
|
def upload_file_with_required_file_with_http_info(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], required_file : Annotated[Union[StrictBytes, StrictStr], Field(..., description="file to upload")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, **kwargs): # noqa: E501
|
||||||
"""uploads an image (required) # noqa: E501
|
"""uploads an image (required) # noqa: E501
|
||||||
|
|
||||||
# noqa: E501
|
# noqa: E501
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
|
|
||||||
import re # noqa: F401
|
import re # noqa: F401
|
||||||
|
import io
|
||||||
|
|
||||||
from pydantic import validate_arguments, ValidationError
|
from pydantic import validate_arguments, ValidationError
|
||||||
from typing_extensions import Annotated
|
from typing_extensions import Annotated
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
|
|
||||||
import re # noqa: F401
|
import re # noqa: F401
|
||||||
|
import io
|
||||||
|
|
||||||
from pydantic import validate_arguments, ValidationError
|
from pydantic import validate_arguments, ValidationError
|
||||||
from typing_extensions import Annotated
|
from typing_extensions import Annotated
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import re # noqa: F401
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
from datetime import date, datetime
|
from datetime import date, datetime
|
||||||
from typing import Optional
|
from typing import Optional, Union
|
||||||
from pydantic import BaseModel, Field, StrictBytes, StrictInt, StrictStr, condecimal, confloat, conint, constr, validator
|
from pydantic import BaseModel, Field, StrictBytes, StrictInt, StrictStr, condecimal, confloat, conint, constr, validator
|
||||||
|
|
||||||
class FormatTest(BaseModel):
|
class FormatTest(BaseModel):
|
||||||
@@ -34,8 +34,8 @@ class FormatTest(BaseModel):
|
|||||||
decimal: Optional[condecimal()] = None
|
decimal: Optional[condecimal()] = None
|
||||||
string: Optional[constr(strict=True)] = None
|
string: Optional[constr(strict=True)] = None
|
||||||
string_with_double_quote_pattern: Optional[constr(strict=True)] = None
|
string_with_double_quote_pattern: Optional[constr(strict=True)] = None
|
||||||
byte: Optional[StrictBytes] = None
|
byte: Optional[Union[StrictBytes, StrictStr]] = None
|
||||||
binary: Optional[StrictBytes] = None
|
binary: Optional[Union[StrictBytes, StrictStr]] = None
|
||||||
var_date: date = Field(..., alias="date")
|
var_date: date = Field(..., alias="date")
|
||||||
date_time: Optional[datetime] = Field(None, alias="dateTime")
|
date_time: Optional[datetime] = Field(None, alias="dateTime")
|
||||||
uuid: Optional[StrictStr] = None
|
uuid: Optional[StrictStr] = None
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
|
|
||||||
import re # noqa: F401
|
import re # noqa: F401
|
||||||
|
import io
|
||||||
|
|
||||||
from pydantic import validate_arguments, ValidationError
|
from pydantic import validate_arguments, ValidationError
|
||||||
from typing_extensions import Annotated
|
from typing_extensions import Annotated
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
|
|
||||||
import re # noqa: F401
|
import re # noqa: F401
|
||||||
|
import io
|
||||||
|
|
||||||
from pydantic import validate_arguments, ValidationError
|
from pydantic import validate_arguments, ValidationError
|
||||||
from typing_extensions import Annotated
|
from typing_extensions import Annotated
|
||||||
|
|||||||
@@ -13,15 +13,16 @@
|
|||||||
|
|
||||||
|
|
||||||
import re # noqa: F401
|
import re # noqa: F401
|
||||||
|
import io
|
||||||
|
|
||||||
from pydantic import validate_arguments, ValidationError
|
from pydantic import validate_arguments, ValidationError
|
||||||
from typing_extensions import Annotated
|
from typing_extensions import Annotated
|
||||||
|
|
||||||
from datetime import date, datetime
|
from datetime import date, datetime
|
||||||
|
|
||||||
from pydantic import Field, StrictBool, StrictFloat, StrictInt, StrictStr, confloat, conint, conlist, constr, validator
|
from pydantic import Field, StrictBool, StrictBytes, StrictFloat, StrictInt, StrictStr, confloat, conint, conlist, constr, validator
|
||||||
|
|
||||||
from typing import Any, Dict, Optional
|
from typing import Any, Dict, Optional, Union
|
||||||
|
|
||||||
from petstore_api.models.client import Client
|
from petstore_api.models.client import Client
|
||||||
from petstore_api.models.enum_class import EnumClass
|
from petstore_api.models.enum_class import EnumClass
|
||||||
@@ -1343,7 +1344,7 @@ class FakeApi(object):
|
|||||||
_request_auth=_params.get('_request_auth'))
|
_request_auth=_params.get('_request_auth'))
|
||||||
|
|
||||||
@validate_arguments
|
@validate_arguments
|
||||||
def test_body_with_binary(self, body : Annotated[Optional[StrictStr], Field(..., description="image to upload")], **kwargs) -> None: # noqa: E501
|
def test_body_with_binary(self, body : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(..., description="image to upload")], **kwargs) -> None: # noqa: E501
|
||||||
"""test_body_with_binary # noqa: E501
|
"""test_body_with_binary # noqa: E501
|
||||||
|
|
||||||
For this test, the body has to be a binary file. # noqa: E501
|
For this test, the body has to be a binary file. # noqa: E501
|
||||||
@@ -1374,7 +1375,7 @@ class FakeApi(object):
|
|||||||
return self.test_body_with_binary_with_http_info(body, **kwargs) # noqa: E501
|
return self.test_body_with_binary_with_http_info(body, **kwargs) # noqa: E501
|
||||||
|
|
||||||
@validate_arguments
|
@validate_arguments
|
||||||
def test_body_with_binary_with_http_info(self, body : Annotated[Optional[StrictStr], Field(..., description="image to upload")], **kwargs): # noqa: E501
|
def test_body_with_binary_with_http_info(self, body : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(..., description="image to upload")], **kwargs): # noqa: E501
|
||||||
"""test_body_with_binary # noqa: E501
|
"""test_body_with_binary # noqa: E501
|
||||||
|
|
||||||
For this test, the body has to be a binary file. # noqa: E501
|
For this test, the body has to be a binary file. # noqa: E501
|
||||||
@@ -1453,6 +1454,11 @@ class FakeApi(object):
|
|||||||
_body_params = None
|
_body_params = None
|
||||||
if _params['body'] is not None:
|
if _params['body'] is not None:
|
||||||
_body_params = _params['body']
|
_body_params = _params['body']
|
||||||
|
# convert to byte array if the input is a file name (str)
|
||||||
|
if isinstance(_body_params, str):
|
||||||
|
with io.open(_body_params, "rb") as _fp:
|
||||||
|
_body_params_from_file = _fp.read()
|
||||||
|
_body_params = _body_params_from_file
|
||||||
|
|
||||||
# set the HTTP header `Content-Type`
|
# set the HTTP header `Content-Type`
|
||||||
_content_types_list = _params.get('_content_type',
|
_content_types_list = _params.get('_content_type',
|
||||||
@@ -2062,7 +2068,7 @@ class FakeApi(object):
|
|||||||
_request_auth=_params.get('_request_auth'))
|
_request_auth=_params.get('_request_auth'))
|
||||||
|
|
||||||
@validate_arguments
|
@validate_arguments
|
||||||
def test_endpoint_parameters(self, number : Annotated[confloat(le=543.2, ge=32.1, strict=True), Field(..., description="None")], double : Annotated[confloat(le=123.4, ge=67.8, strict=True), Field(..., description="None")], pattern_without_delimiter : Annotated[constr(strict=True), Field(..., description="None")], byte : Annotated[StrictStr, Field(..., description="None")], integer : Annotated[Optional[conint(strict=True, le=100, ge=10)], Field(description="None")] = None, int32 : Annotated[Optional[conint(strict=True, le=200, ge=20)], Field(description="None")] = None, int64 : Annotated[Optional[StrictInt], Field(description="None")] = None, float : Annotated[Optional[confloat(le=987.6, strict=True)], Field(description="None")] = None, string : Annotated[Optional[constr(strict=True)], Field(description="None")] = None, binary : Annotated[Optional[StrictStr], Field(description="None")] = None, var_date : Annotated[Optional[date], Field(description="None")] = None, date_time : Annotated[Optional[datetime], Field(description="None")] = None, password : Annotated[Optional[constr(strict=True, max_length=64, min_length=10)], Field(description="None")] = None, param_callback : Annotated[Optional[StrictStr], Field(description="None")] = None, **kwargs) -> None: # noqa: E501
|
def test_endpoint_parameters(self, number : Annotated[confloat(le=543.2, ge=32.1, strict=True), Field(..., description="None")], double : Annotated[confloat(le=123.4, ge=67.8, strict=True), Field(..., description="None")], pattern_without_delimiter : Annotated[constr(strict=True), Field(..., description="None")], byte : Annotated[Union[StrictBytes, StrictStr], Field(..., description="None")], integer : Annotated[Optional[conint(strict=True, le=100, ge=10)], Field(description="None")] = None, int32 : Annotated[Optional[conint(strict=True, le=200, ge=20)], Field(description="None")] = None, int64 : Annotated[Optional[StrictInt], Field(description="None")] = None, float : Annotated[Optional[confloat(le=987.6, strict=True)], Field(description="None")] = None, string : Annotated[Optional[constr(strict=True)], Field(description="None")] = None, binary : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="None")] = None, var_date : Annotated[Optional[date], Field(description="None")] = None, date_time : Annotated[Optional[datetime], Field(description="None")] = None, password : Annotated[Optional[constr(strict=True, max_length=64, min_length=10)], Field(description="None")] = None, param_callback : Annotated[Optional[StrictStr], Field(description="None")] = None, **kwargs) -> None: # noqa: E501
|
||||||
"""Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501
|
"""Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501
|
||||||
|
|
||||||
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501
|
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501
|
||||||
@@ -2119,7 +2125,7 @@ class FakeApi(object):
|
|||||||
return self.test_endpoint_parameters_with_http_info(number, double, pattern_without_delimiter, byte, integer, int32, int64, float, string, binary, var_date, date_time, password, param_callback, **kwargs) # noqa: E501
|
return self.test_endpoint_parameters_with_http_info(number, double, pattern_without_delimiter, byte, integer, int32, int64, float, string, binary, var_date, date_time, password, param_callback, **kwargs) # noqa: E501
|
||||||
|
|
||||||
@validate_arguments
|
@validate_arguments
|
||||||
def test_endpoint_parameters_with_http_info(self, number : Annotated[confloat(le=543.2, ge=32.1, strict=True), Field(..., description="None")], double : Annotated[confloat(le=123.4, ge=67.8, strict=True), Field(..., description="None")], pattern_without_delimiter : Annotated[constr(strict=True), Field(..., description="None")], byte : Annotated[StrictStr, Field(..., description="None")], integer : Annotated[Optional[conint(strict=True, le=100, ge=10)], Field(description="None")] = None, int32 : Annotated[Optional[conint(strict=True, le=200, ge=20)], Field(description="None")] = None, int64 : Annotated[Optional[StrictInt], Field(description="None")] = None, float : Annotated[Optional[confloat(le=987.6, strict=True)], Field(description="None")] = None, string : Annotated[Optional[constr(strict=True)], Field(description="None")] = None, binary : Annotated[Optional[StrictStr], Field(description="None")] = None, var_date : Annotated[Optional[date], Field(description="None")] = None, date_time : Annotated[Optional[datetime], Field(description="None")] = None, password : Annotated[Optional[constr(strict=True, max_length=64, min_length=10)], Field(description="None")] = None, param_callback : Annotated[Optional[StrictStr], Field(description="None")] = None, **kwargs): # noqa: E501
|
def test_endpoint_parameters_with_http_info(self, number : Annotated[confloat(le=543.2, ge=32.1, strict=True), Field(..., description="None")], double : Annotated[confloat(le=123.4, ge=67.8, strict=True), Field(..., description="None")], pattern_without_delimiter : Annotated[constr(strict=True), Field(..., description="None")], byte : Annotated[Union[StrictBytes, StrictStr], Field(..., description="None")], integer : Annotated[Optional[conint(strict=True, le=100, ge=10)], Field(description="None")] = None, int32 : Annotated[Optional[conint(strict=True, le=200, ge=20)], Field(description="None")] = None, int64 : Annotated[Optional[StrictInt], Field(description="None")] = None, float : Annotated[Optional[confloat(le=987.6, strict=True)], Field(description="None")] = None, string : Annotated[Optional[constr(strict=True)], Field(description="None")] = None, binary : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="None")] = None, var_date : Annotated[Optional[date], Field(description="None")] = None, date_time : Annotated[Optional[datetime], Field(description="None")] = None, password : Annotated[Optional[constr(strict=True, max_length=64, min_length=10)], Field(description="None")] = None, param_callback : Annotated[Optional[StrictStr], Field(description="None")] = None, **kwargs): # noqa: E501
|
||||||
"""Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501
|
"""Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501
|
||||||
|
|
||||||
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501
|
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
|
|
||||||
import re # noqa: F401
|
import re # noqa: F401
|
||||||
|
import io
|
||||||
|
|
||||||
from pydantic import validate_arguments, ValidationError
|
from pydantic import validate_arguments, ValidationError
|
||||||
from typing_extensions import Annotated
|
from typing_extensions import Annotated
|
||||||
|
|||||||
@@ -13,13 +13,14 @@
|
|||||||
|
|
||||||
|
|
||||||
import re # noqa: F401
|
import re # noqa: F401
|
||||||
|
import io
|
||||||
|
|
||||||
from pydantic import validate_arguments, ValidationError
|
from pydantic import validate_arguments, ValidationError
|
||||||
from typing_extensions import Annotated
|
from typing_extensions import Annotated
|
||||||
|
|
||||||
from pydantic import Field, StrictInt, StrictStr, conlist, validator
|
from pydantic import Field, StrictBytes, StrictInt, StrictStr, conlist, validator
|
||||||
|
|
||||||
from typing import List, Optional
|
from typing import List, Optional, Union
|
||||||
|
|
||||||
from petstore_api.models.api_response import ApiResponse
|
from petstore_api.models.api_response import ApiResponse
|
||||||
from petstore_api.models.pet import Pet
|
from petstore_api.models.pet import Pet
|
||||||
@@ -1051,7 +1052,7 @@ class PetApi(object):
|
|||||||
_request_auth=_params.get('_request_auth'))
|
_request_auth=_params.get('_request_auth'))
|
||||||
|
|
||||||
@validate_arguments
|
@validate_arguments
|
||||||
def upload_file(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, file : Annotated[Optional[StrictStr], Field(description="file to upload")] = None, **kwargs) -> ApiResponse: # noqa: E501
|
def upload_file(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, file : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="file to upload")] = None, **kwargs) -> ApiResponse: # noqa: E501
|
||||||
"""uploads an image # noqa: E501
|
"""uploads an image # noqa: E501
|
||||||
|
|
||||||
# noqa: E501
|
# noqa: E501
|
||||||
@@ -1086,7 +1087,7 @@ class PetApi(object):
|
|||||||
return self.upload_file_with_http_info(pet_id, additional_metadata, file, **kwargs) # noqa: E501
|
return self.upload_file_with_http_info(pet_id, additional_metadata, file, **kwargs) # noqa: E501
|
||||||
|
|
||||||
@validate_arguments
|
@validate_arguments
|
||||||
def upload_file_with_http_info(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, file : Annotated[Optional[StrictStr], Field(description="file to upload")] = None, **kwargs): # noqa: E501
|
def upload_file_with_http_info(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, file : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="file to upload")] = None, **kwargs): # noqa: E501
|
||||||
"""uploads an image # noqa: E501
|
"""uploads an image # noqa: E501
|
||||||
|
|
||||||
# noqa: E501
|
# noqa: E501
|
||||||
@@ -1214,7 +1215,7 @@ class PetApi(object):
|
|||||||
_request_auth=_params.get('_request_auth'))
|
_request_auth=_params.get('_request_auth'))
|
||||||
|
|
||||||
@validate_arguments
|
@validate_arguments
|
||||||
def upload_file_with_required_file(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], required_file : Annotated[StrictStr, Field(..., description="file to upload")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, **kwargs) -> ApiResponse: # noqa: E501
|
def upload_file_with_required_file(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], required_file : Annotated[Union[StrictBytes, StrictStr], Field(..., description="file to upload")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, **kwargs) -> ApiResponse: # noqa: E501
|
||||||
"""uploads an image (required) # noqa: E501
|
"""uploads an image (required) # noqa: E501
|
||||||
|
|
||||||
# noqa: E501
|
# noqa: E501
|
||||||
@@ -1249,7 +1250,7 @@ class PetApi(object):
|
|||||||
return self.upload_file_with_required_file_with_http_info(pet_id, required_file, additional_metadata, **kwargs) # noqa: E501
|
return self.upload_file_with_required_file_with_http_info(pet_id, required_file, additional_metadata, **kwargs) # noqa: E501
|
||||||
|
|
||||||
@validate_arguments
|
@validate_arguments
|
||||||
def upload_file_with_required_file_with_http_info(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], required_file : Annotated[StrictStr, Field(..., description="file to upload")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, **kwargs): # noqa: E501
|
def upload_file_with_required_file_with_http_info(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], required_file : Annotated[Union[StrictBytes, StrictStr], Field(..., description="file to upload")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, **kwargs): # noqa: E501
|
||||||
"""uploads an image (required) # noqa: E501
|
"""uploads an image (required) # noqa: E501
|
||||||
|
|
||||||
# noqa: E501
|
# noqa: E501
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
|
|
||||||
import re # noqa: F401
|
import re # noqa: F401
|
||||||
|
import io
|
||||||
|
|
||||||
from pydantic import validate_arguments, ValidationError
|
from pydantic import validate_arguments, ValidationError
|
||||||
from typing_extensions import Annotated
|
from typing_extensions import Annotated
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
|
|
||||||
import re # noqa: F401
|
import re # noqa: F401
|
||||||
|
import io
|
||||||
|
|
||||||
from pydantic import validate_arguments, ValidationError
|
from pydantic import validate_arguments, ValidationError
|
||||||
from typing_extensions import Annotated
|
from typing_extensions import Annotated
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import re # noqa: F401
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
from datetime import date, datetime
|
from datetime import date, datetime
|
||||||
from typing import Optional
|
from typing import Optional, Union
|
||||||
from pydantic import BaseModel, Field, StrictBytes, StrictInt, StrictStr, condecimal, confloat, conint, constr, validator
|
from pydantic import BaseModel, Field, StrictBytes, StrictInt, StrictStr, condecimal, confloat, conint, constr, validator
|
||||||
|
|
||||||
class FormatTest(BaseModel):
|
class FormatTest(BaseModel):
|
||||||
@@ -34,8 +34,8 @@ class FormatTest(BaseModel):
|
|||||||
decimal: Optional[condecimal()] = None
|
decimal: Optional[condecimal()] = None
|
||||||
string: Optional[constr(strict=True)] = None
|
string: Optional[constr(strict=True)] = None
|
||||||
string_with_double_quote_pattern: Optional[constr(strict=True)] = None
|
string_with_double_quote_pattern: Optional[constr(strict=True)] = None
|
||||||
byte: Optional[StrictBytes] = None
|
byte: Optional[Union[StrictBytes, StrictStr]] = None
|
||||||
binary: Optional[StrictBytes] = None
|
binary: Optional[Union[StrictBytes, StrictStr]] = None
|
||||||
var_date: date = Field(..., alias="date")
|
var_date: date = Field(..., alias="date")
|
||||||
date_time: Optional[datetime] = Field(None, alias="dateTime")
|
date_time: Optional[datetime] = Field(None, alias="dateTime")
|
||||||
uuid: Optional[StrictStr] = None
|
uuid: Optional[StrictStr] = None
|
||||||
|
|||||||
Reference in New Issue
Block a user