Update fake API to contain sample with binary body (#9610)

This commit is contained in:
Peter Leibiger 2021-05-29 04:26:01 +02:00 committed by GitHub
parent 1b6fd2dd7a
commit f7b93ebdf2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
46 changed files with 1844 additions and 42 deletions

View File

@ -1008,7 +1008,7 @@ paths:
tags: tags:
- fake - fake
description: >- description: >-
For this test, the body for this request much reference a schema named For this test, the body for this request must reference a schema named
`File`. `File`.
operationId: testBodyWithFileSchema operationId: testBodyWithFileSchema
responses: responses:
@ -1020,6 +1020,25 @@ paths:
schema: schema:
$ref: '#/components/schemas/FileSchemaTestClass' $ref: '#/components/schemas/FileSchemaTestClass'
required: true required: true
/fake/body-with-binary:
put:
tags:
- fake
description: >-
For this test, the body has to be a binary file.
operationId: testBodyWithBinary
responses:
'200':
description: Success
requestBody:
content:
image/png:
schema:
type: string
nullable: true
format: binary
description: image to upload
required: true
/fake/test-query-paramters: /fake/test-query-paramters:
put: put:
tags: tags:

View File

@ -114,6 +114,7 @@ Class | Method | HTTP request | Description
*FakeApi* | [**FakeOuterNumberSerialize**](docs/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | *FakeApi* | [**FakeOuterNumberSerialize**](docs/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number |
*FakeApi* | [**FakeOuterStringSerialize**](docs/FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | *FakeApi* | [**FakeOuterStringSerialize**](docs/FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string |
*FakeApi* | [**FakePropertyEnumIntegerSerialize**](docs/FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int | *FakeApi* | [**FakePropertyEnumIntegerSerialize**](docs/FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int |
*FakeApi* | [**TestBodyWithBinary**](docs/FakeApi.md#testbodywithbinary) | **PUT** /fake/body-with-binary |
*FakeApi* | [**TestBodyWithFileSchema**](docs/FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | *FakeApi* | [**TestBodyWithFileSchema**](docs/FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema |
*FakeApi* | [**TestBodyWithQueryParams**](docs/FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | *FakeApi* | [**TestBodyWithQueryParams**](docs/FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params |
*FakeApi* | [**TestClientModel**](docs/FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model *FakeApi* | [**TestClientModel**](docs/FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model

View File

@ -11,6 +11,7 @@ Method | HTTP request | Description
[**FakeOuterNumberSerialize**](FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | [**FakeOuterNumberSerialize**](FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number |
[**FakeOuterStringSerialize**](FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | [**FakeOuterStringSerialize**](FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string |
[**FakePropertyEnumIntegerSerialize**](FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int | [**FakePropertyEnumIntegerSerialize**](FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int |
[**TestBodyWithBinary**](FakeApi.md#testbodywithbinary) | **PUT** /fake/body-with-binary |
[**TestBodyWithFileSchema**](FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | [**TestBodyWithFileSchema**](FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema |
[**TestBodyWithQueryParams**](FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | [**TestBodyWithQueryParams**](FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params |
[**TestClientModel**](FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model [**TestClientModel**](FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model
@ -546,13 +547,87 @@ No authorization required
[[Back to README]](../README.md) [[Back to README]](../README.md)
## TestBodyWithBinary
> void TestBodyWithBinary (System.IO.Stream body)
For this test, the body has to be a binary file.
### Example
```csharp
using System.Collections.Generic;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class TestBodyWithBinaryExample
{
public static void Main()
{
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
var apiInstance = new FakeApi(Configuration.Default);
var body = BINARY_DATA_HERE; // System.IO.Stream | image to upload
try
{
apiInstance.TestBodyWithBinary(body);
}
catch (ApiException e)
{
Debug.Print("Exception when calling FakeApi.TestBodyWithBinary: " + e.Message );
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | **System.IO.Stream**| image to upload |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: image/png
- **Accept**: Not defined
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Success | - |
[[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)
## TestBodyWithFileSchema ## TestBodyWithFileSchema
> void TestBodyWithFileSchema (FileSchemaTestClass fileSchemaTestClass) > void TestBodyWithFileSchema (FileSchemaTestClass fileSchemaTestClass)
For this test, the body for this request much reference a schema named `File`. For this test, the body for this request must reference a schema named `File`.
### Example ### Example

View File

@ -178,7 +178,28 @@ namespace Org.OpenAPITools.Api
/// ///
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// For this test, the body for this request much reference a schema named &#x60;File&#x60;. /// For this test, the body has to be a binary file.
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="body">image to upload</param>
/// <returns></returns>
void TestBodyWithBinary (System.IO.Stream body);
/// <summary>
///
/// </summary>
/// <remarks>
/// For this test, the body has to be a binary file.
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="body">image to upload</param>
/// <returns>ApiResponse of Object(void)</returns>
ApiResponse<Object> TestBodyWithBinaryWithHttpInfo (System.IO.Stream body);
/// <summary>
///
/// </summary>
/// <remarks>
/// For this test, the body for this request must reference a schema named &#x60;File&#x60;.
/// </remarks> /// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="fileSchemaTestClass"></param> /// <param name="fileSchemaTestClass"></param>
@ -189,7 +210,7 @@ namespace Org.OpenAPITools.Api
/// ///
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// For this test, the body for this request much reference a schema named &#x60;File&#x60;. /// For this test, the body for this request must reference a schema named &#x60;File&#x60;.
/// </remarks> /// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="fileSchemaTestClass"></param> /// <param name="fileSchemaTestClass"></param>
@ -594,7 +615,30 @@ namespace Org.OpenAPITools.Api
/// ///
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// For this test, the body for this request much reference a schema named &#x60;File&#x60;. /// For this test, the body has to be a binary file.
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="body">image to upload</param>
/// <param name="cancellationToken">Cancellation Token to cancel request (optional) </param>
/// <returns>Task of void</returns>
System.Threading.Tasks.Task TestBodyWithBinaryAsync (System.IO.Stream body, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
///
/// </summary>
/// <remarks>
/// For this test, the body has to be a binary file.
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="body">image to upload</param>
/// <param name="cancellationToken">Cancellation Token to cancel request (optional) </param>
/// <returns>Task of ApiResponse</returns>
System.Threading.Tasks.Task<ApiResponse<Object>> TestBodyWithBinaryWithHttpInfoAsync (System.IO.Stream body, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
///
/// </summary>
/// <remarks>
/// For this test, the body for this request must reference a schema named &#x60;File&#x60;.
/// </remarks> /// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="fileSchemaTestClass"></param> /// <param name="fileSchemaTestClass"></param>
@ -606,7 +650,7 @@ namespace Org.OpenAPITools.Api
/// ///
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// For this test, the body for this request much reference a schema named &#x60;File&#x60;. /// For this test, the body for this request must reference a schema named &#x60;File&#x60;.
/// </remarks> /// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="fileSchemaTestClass"></param> /// <param name="fileSchemaTestClass"></param>
@ -1988,7 +2032,154 @@ namespace Org.OpenAPITools.Api
} }
/// <summary> /// <summary>
/// For this test, the body for this request much reference a schema named &#x60;File&#x60;. /// For this test, the body has to be a binary file.
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="body">image to upload</param>
/// <returns></returns>
public void TestBodyWithBinary (System.IO.Stream body)
{
TestBodyWithBinaryWithHttpInfo(body);
}
/// <summary>
/// For this test, the body has to be a binary file.
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="body">image to upload</param>
/// <returns>ApiResponse of Object(void)</returns>
public ApiResponse<Object> TestBodyWithBinaryWithHttpInfo (System.IO.Stream body)
{
// verify the required parameter 'body' is set
if (body == null)
throw new ApiException(400, "Missing required parameter 'body' when calling FakeApi->TestBodyWithBinary");
var localVarPath = "/fake/body-with-binary";
var localVarPathParams = new Dictionary<String, String>();
var localVarQueryParams = new List<KeyValuePair<String, String>>();
var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
var localVarFormParams = new Dictionary<String, String>();
var localVarFileParams = new Dictionary<String, FileParameter>();
Object localVarPostBody = null;
// to determine the Content-Type header
String[] localVarHttpContentTypes = new String[] {
"image/png"
};
String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
// to determine the Accept header
String[] localVarHttpHeaderAccepts = new String[] {
};
String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
if (body != null && body.GetType() != typeof(byte[]))
{
localVarPostBody = this.Configuration.ApiClient.Serialize(body); // http body (model) parameter
}
else
{
localVarPostBody = body; // byte array
}
// make the HTTP request
IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath,
Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarHttpContentType);
int localVarStatusCode = (int) localVarResponse.StatusCode;
if (ExceptionFactory != null)
{
Exception exception = ExceptionFactory("TestBodyWithBinary", localVarResponse);
if (exception != null) throw exception;
}
return new ApiResponse<Object>(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)),
null);
}
/// <summary>
/// For this test, the body has to be a binary file.
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="body">image to upload</param>
/// <param name="cancellationToken">Cancellation Token to cancel request (optional) </param>
/// <returns>Task of void</returns>
public async System.Threading.Tasks.Task TestBodyWithBinaryAsync (System.IO.Stream body, CancellationToken cancellationToken = default(CancellationToken))
{
await TestBodyWithBinaryWithHttpInfoAsync(body, cancellationToken);
}
/// <summary>
/// For this test, the body has to be a binary file.
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="body">image to upload</param>
/// <param name="cancellationToken">Cancellation Token to cancel request (optional) </param>
/// <returns>Task of ApiResponse</returns>
public async System.Threading.Tasks.Task<ApiResponse<Object>> TestBodyWithBinaryWithHttpInfoAsync (System.IO.Stream body, CancellationToken cancellationToken = default(CancellationToken))
{
// verify the required parameter 'body' is set
if (body == null)
throw new ApiException(400, "Missing required parameter 'body' when calling FakeApi->TestBodyWithBinary");
var localVarPath = "/fake/body-with-binary";
var localVarPathParams = new Dictionary<String, String>();
var localVarQueryParams = new List<KeyValuePair<String, String>>();
var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
var localVarFormParams = new Dictionary<String, String>();
var localVarFileParams = new Dictionary<String, FileParameter>();
Object localVarPostBody = null;
// to determine the Content-Type header
String[] localVarHttpContentTypes = new String[] {
"image/png"
};
String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
// to determine the Accept header
String[] localVarHttpHeaderAccepts = new String[] {
};
String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
if (body != null && body.GetType() != typeof(byte[]))
{
localVarPostBody = this.Configuration.ApiClient.Serialize(body); // http body (model) parameter
}
else
{
localVarPostBody = body; // byte array
}
// make the HTTP request
IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath,
Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarHttpContentType, cancellationToken);
int localVarStatusCode = (int) localVarResponse.StatusCode;
if (ExceptionFactory != null)
{
Exception exception = ExceptionFactory("TestBodyWithBinary", localVarResponse);
if (exception != null) throw exception;
}
return new ApiResponse<Object>(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)),
null);
}
/// <summary>
/// For this test, the body for this request must reference a schema named &#x60;File&#x60;.
/// </summary> /// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="fileSchemaTestClass"></param> /// <param name="fileSchemaTestClass"></param>
@ -1999,7 +2190,7 @@ namespace Org.OpenAPITools.Api
} }
/// <summary> /// <summary>
/// For this test, the body for this request much reference a schema named &#x60;File&#x60;. /// For this test, the body for this request must reference a schema named &#x60;File&#x60;.
/// </summary> /// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="fileSchemaTestClass"></param> /// <param name="fileSchemaTestClass"></param>
@ -2060,7 +2251,7 @@ namespace Org.OpenAPITools.Api
} }
/// <summary> /// <summary>
/// For this test, the body for this request much reference a schema named &#x60;File&#x60;. /// For this test, the body for this request must reference a schema named &#x60;File&#x60;.
/// </summary> /// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="fileSchemaTestClass"></param> /// <param name="fileSchemaTestClass"></param>
@ -2073,7 +2264,7 @@ namespace Org.OpenAPITools.Api
} }
/// <summary> /// <summary>
/// For this test, the body for this request much reference a schema named &#x60;File&#x60;. /// For this test, the body for this request must reference a schema named &#x60;File&#x60;.
/// </summary> /// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="fileSchemaTestClass"></param> /// <param name="fileSchemaTestClass"></param>

View File

@ -215,7 +215,33 @@ defmodule OpenapiPetstore.Api.Fake do
end end
@doc """ @doc """
For this test, the body for this request much reference a schema named `File`. For this test, the body has to be a binary file.
## Parameters
- connection (OpenapiPetstore.Connection): Connection to server
- body (String.t): image to upload
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, nil} on success
{:error, Tesla.Env.t} on failure
"""
@spec test_body_with_binary(Tesla.Env.client, String.t, keyword()) :: {:ok, nil} | {:error, Tesla.Env.t}
def test_body_with_binary(connection, body, _opts \\ []) do
%{}
|> method(:put)
|> url("/fake/body-with-binary")
|> add_param(:body, :body, body)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, false}
])
end
@doc """
For this test, the body for this request must reference a schema named `File`.
## Parameters ## Parameters

View File

@ -129,6 +129,7 @@ Class | Method | HTTP request | Description
*OpenApiPetstore.FakeApi* | [**fakeOuterNumberSerialize**](docs/FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | *OpenApiPetstore.FakeApi* | [**fakeOuterNumberSerialize**](docs/FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number |
*OpenApiPetstore.FakeApi* | [**fakeOuterStringSerialize**](docs/FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | *OpenApiPetstore.FakeApi* | [**fakeOuterStringSerialize**](docs/FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string |
*OpenApiPetstore.FakeApi* | [**fakePropertyEnumIntegerSerialize**](docs/FakeApi.md#fakePropertyEnumIntegerSerialize) | **POST** /fake/property/enum-int | *OpenApiPetstore.FakeApi* | [**fakePropertyEnumIntegerSerialize**](docs/FakeApi.md#fakePropertyEnumIntegerSerialize) | **POST** /fake/property/enum-int |
*OpenApiPetstore.FakeApi* | [**testBodyWithBinary**](docs/FakeApi.md#testBodyWithBinary) | **PUT** /fake/body-with-binary |
*OpenApiPetstore.FakeApi* | [**testBodyWithFileSchema**](docs/FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema | *OpenApiPetstore.FakeApi* | [**testBodyWithFileSchema**](docs/FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema |
*OpenApiPetstore.FakeApi* | [**testBodyWithQueryParams**](docs/FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | *OpenApiPetstore.FakeApi* | [**testBodyWithQueryParams**](docs/FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params |
*OpenApiPetstore.FakeApi* | [**testClientModel**](docs/FakeApi.md#testClientModel) | **PATCH** /fake | To test \&quot;client\&quot; model *OpenApiPetstore.FakeApi* | [**testClientModel**](docs/FakeApi.md#testClientModel) | **PATCH** /fake | To test \&quot;client\&quot; model

View File

@ -11,6 +11,7 @@ Method | HTTP request | Description
[**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | [**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number |
[**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | [**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string |
[**fakePropertyEnumIntegerSerialize**](FakeApi.md#fakePropertyEnumIntegerSerialize) | **POST** /fake/property/enum-int | [**fakePropertyEnumIntegerSerialize**](FakeApi.md#fakePropertyEnumIntegerSerialize) | **POST** /fake/property/enum-int |
[**testBodyWithBinary**](FakeApi.md#testBodyWithBinary) | **PUT** /fake/body-with-binary |
[**testBodyWithFileSchema**](FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema | [**testBodyWithFileSchema**](FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema |
[**testBodyWithQueryParams**](FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | [**testBodyWithQueryParams**](FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params |
[**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \&quot;client\&quot; model [**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \&quot;client\&quot; model
@ -345,13 +346,58 @@ No authorization required
- **Accept**: */* - **Accept**: */*
## testBodyWithBinary
> testBodyWithBinary(body)
For this test, the body has to be a binary file.
### Example
```javascript
import OpenApiPetstore from 'open_api_petstore';
let apiInstance = new OpenApiPetstore.FakeApi();
let body = "/path/to/file"; // File | image to upload
apiInstance.testBodyWithBinary(body, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully.');
}
});
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | **File**| image to upload |
### Return type
null (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: image/png
- **Accept**: Not defined
## testBodyWithFileSchema ## testBodyWithFileSchema
> testBodyWithFileSchema(fileSchemaTestClass) > testBodyWithFileSchema(fileSchemaTestClass)
For this test, the body for this request much reference a schema named &#x60;File&#x60;. For this test, the body for this request must reference a schema named &#x60;File&#x60;.
### Example ### Example

View File

@ -319,6 +319,46 @@ export default class FakeApi {
); );
} }
/**
* Callback function to receive the result of the testBodyWithBinary operation.
* @callback module:api/FakeApi~testBodyWithBinaryCallback
* @param {String} error Error message, if any.
* @param data This operation does not return a value.
* @param {String} response The complete HTTP response.
*/
/**
* For this test, the body has to be a binary file.
* @param {File} body image to upload
* @param {module:api/FakeApi~testBodyWithBinaryCallback} callback The callback function, accepting three arguments: error, data, response
*/
testBodyWithBinary(body, callback) {
let postBody = body;
// verify the required parameter 'body' is set
if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling testBodyWithBinary");
}
let pathParams = {
};
let queryParams = {
};
let headerParams = {
};
let formParams = {
};
let authNames = [];
let contentTypes = ['image/png'];
let accepts = [];
let returnType = null;
return this.apiClient.callApi(
'/fake/body-with-binary', 'PUT',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null, callback
);
}
/** /**
* Callback function to receive the result of the testBodyWithFileSchema operation. * Callback function to receive the result of the testBodyWithFileSchema operation.
* @callback module:api/FakeApi~testBodyWithFileSchemaCallback * @callback module:api/FakeApi~testBodyWithFileSchemaCallback
@ -328,7 +368,7 @@ export default class FakeApi {
*/ */
/** /**
* For this test, the body for this request much reference a schema named `File`. * For this test, the body for this request must reference a schema named `File`.
* @param {module:model/FileSchemaTestClass} fileSchemaTestClass * @param {module:model/FileSchemaTestClass} fileSchemaTestClass
* @param {module:api/FakeApi~testBodyWithFileSchemaCallback} callback The callback function, accepting three arguments: error, data, response * @param {module:api/FakeApi~testBodyWithFileSchemaCallback} callback The callback function, accepting three arguments: error, data, response
*/ */

View File

@ -127,6 +127,7 @@ Class | Method | HTTP request | Description
*OpenApiPetstore.FakeApi* | [**fakeOuterNumberSerialize**](docs/FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | *OpenApiPetstore.FakeApi* | [**fakeOuterNumberSerialize**](docs/FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number |
*OpenApiPetstore.FakeApi* | [**fakeOuterStringSerialize**](docs/FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | *OpenApiPetstore.FakeApi* | [**fakeOuterStringSerialize**](docs/FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string |
*OpenApiPetstore.FakeApi* | [**fakePropertyEnumIntegerSerialize**](docs/FakeApi.md#fakePropertyEnumIntegerSerialize) | **POST** /fake/property/enum-int | *OpenApiPetstore.FakeApi* | [**fakePropertyEnumIntegerSerialize**](docs/FakeApi.md#fakePropertyEnumIntegerSerialize) | **POST** /fake/property/enum-int |
*OpenApiPetstore.FakeApi* | [**testBodyWithBinary**](docs/FakeApi.md#testBodyWithBinary) | **PUT** /fake/body-with-binary |
*OpenApiPetstore.FakeApi* | [**testBodyWithFileSchema**](docs/FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema | *OpenApiPetstore.FakeApi* | [**testBodyWithFileSchema**](docs/FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema |
*OpenApiPetstore.FakeApi* | [**testBodyWithQueryParams**](docs/FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | *OpenApiPetstore.FakeApi* | [**testBodyWithQueryParams**](docs/FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params |
*OpenApiPetstore.FakeApi* | [**testClientModel**](docs/FakeApi.md#testClientModel) | **PATCH** /fake | To test \&quot;client\&quot; model *OpenApiPetstore.FakeApi* | [**testClientModel**](docs/FakeApi.md#testClientModel) | **PATCH** /fake | To test \&quot;client\&quot; model

View File

@ -11,6 +11,7 @@ Method | HTTP request | Description
[**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | [**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number |
[**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | [**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string |
[**fakePropertyEnumIntegerSerialize**](FakeApi.md#fakePropertyEnumIntegerSerialize) | **POST** /fake/property/enum-int | [**fakePropertyEnumIntegerSerialize**](FakeApi.md#fakePropertyEnumIntegerSerialize) | **POST** /fake/property/enum-int |
[**testBodyWithBinary**](FakeApi.md#testBodyWithBinary) | **PUT** /fake/body-with-binary |
[**testBodyWithFileSchema**](FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema | [**testBodyWithFileSchema**](FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema |
[**testBodyWithQueryParams**](FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | [**testBodyWithQueryParams**](FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params |
[**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \&quot;client\&quot; model [**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \&quot;client\&quot; model
@ -338,13 +339,57 @@ No authorization required
- **Accept**: */* - **Accept**: */*
## testBodyWithBinary
> testBodyWithBinary(body)
For this test, the body has to be a binary file.
### Example
```javascript
import OpenApiPetstore from 'open_api_petstore';
let apiInstance = new OpenApiPetstore.FakeApi();
let body = "/path/to/file"; // File | image to upload
apiInstance.testBodyWithBinary(body).then(() => {
console.log('API called successfully.');
}, (error) => {
console.error(error);
});
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | **File**| image to upload |
### Return type
null (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: image/png
- **Accept**: Not defined
## testBodyWithFileSchema ## testBodyWithFileSchema
> testBodyWithFileSchema(fileSchemaTestClass) > testBodyWithFileSchema(fileSchemaTestClass)
For this test, the body for this request much reference a schema named &#x60;File&#x60;. For this test, the body for this request must reference a schema named &#x60;File&#x60;.
### Example ### Example

View File

@ -356,7 +356,52 @@ export default class FakeApi {
/** /**
* For this test, the body for this request much reference a schema named `File`. * For this test, the body has to be a binary file.
* @param {File} body image to upload
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
*/
testBodyWithBinaryWithHttpInfo(body) {
let postBody = body;
// verify the required parameter 'body' is set
if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling testBodyWithBinary");
}
let pathParams = {
};
let queryParams = {
};
let headerParams = {
};
let formParams = {
};
let authNames = [];
let contentTypes = ['image/png'];
let accepts = [];
let returnType = null;
return this.apiClient.callApi(
'/fake/body-with-binary', 'PUT',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null
);
}
/**
* For this test, the body has to be a binary file.
* @param {File} body image to upload
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
*/
testBodyWithBinary(body) {
return this.testBodyWithBinaryWithHttpInfo(body)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* For this test, the body for this request must reference a schema named `File`.
* @param {module:model/FileSchemaTestClass} fileSchemaTestClass * @param {module:model/FileSchemaTestClass} fileSchemaTestClass
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
*/ */
@ -388,7 +433,7 @@ export default class FakeApi {
} }
/** /**
* For this test, the body for this request much reference a schema named `File`. * For this test, the body for this request must reference a schema named `File`.
* @param {module:model/FileSchemaTestClass} fileSchemaTestClass * @param {module:model/FileSchemaTestClass} fileSchemaTestClass
* @return {Promise} a {@link https://www.promisejs.org/|Promise} * @return {Promise} a {@link https://www.promisejs.org/|Promise}
*/ */

View File

@ -385,6 +385,7 @@ Class | Method | HTTP request | Description
*FakeApi* | [**fake_outer_number_serialize**](docs/FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | *FakeApi* | [**fake_outer_number_serialize**](docs/FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number |
*FakeApi* | [**fake_outer_string_serialize**](docs/FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | *FakeApi* | [**fake_outer_string_serialize**](docs/FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string |
*FakeApi* | [**fake_property_enum_integer_serialize**](docs/FakeApi.md#fake_property_enum_integer_serialize) | **POST** /fake/property/enum-int | *FakeApi* | [**fake_property_enum_integer_serialize**](docs/FakeApi.md#fake_property_enum_integer_serialize) | **POST** /fake/property/enum-int |
*FakeApi* | [**test_body_with_binary**](docs/FakeApi.md#test_body_with_binary) | **PUT** /fake/body-with-binary |
*FakeApi* | [**test_body_with_file_schema**](docs/FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | *FakeApi* | [**test_body_with_file_schema**](docs/FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema |
*FakeApi* | [**test_body_with_query_params**](docs/FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | *FakeApi* | [**test_body_with_query_params**](docs/FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params |
*FakeApi* | [**test_client_model**](docs/FakeApi.md#test_client_model) | **PATCH** /fake | To test \&quot;client\&quot; model *FakeApi* | [**test_client_model**](docs/FakeApi.md#test_client_model) | **PATCH** /fake | To test \&quot;client\&quot; model

View File

@ -16,6 +16,7 @@ Method | HTTP request | Description
[**fake_outer_number_serialize**](FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | [**fake_outer_number_serialize**](FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number |
[**fake_outer_string_serialize**](FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | [**fake_outer_string_serialize**](FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string |
[**fake_property_enum_integer_serialize**](FakeApi.md#fake_property_enum_integer_serialize) | **POST** /fake/property/enum-int | [**fake_property_enum_integer_serialize**](FakeApi.md#fake_property_enum_integer_serialize) | **POST** /fake/property/enum-int |
[**test_body_with_binary**](FakeApi.md#test_body_with_binary) | **PUT** /fake/body-with-binary |
[**test_body_with_file_schema**](FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | [**test_body_with_file_schema**](FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema |
[**test_body_with_query_params**](FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | [**test_body_with_query_params**](FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params |
[**test_client_model**](FakeApi.md#test_client_model) | **PATCH** /fake | To test \&quot;client\&quot; model [**test_client_model**](FakeApi.md#test_client_model) | **PATCH** /fake | To test \&quot;client\&quot; model
@ -347,12 +348,57 @@ 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_with_binary**
> test_body_with_binary(body => $body)
For this test, the body has to be a binary file.
### Example
```perl
use Data::Dumper;
use WWW::OpenAPIClient::FakeApi;
my $api_instance = WWW::OpenAPIClient::FakeApi->new(
);
my $body = WWW::OpenAPIClient::Object::string->new(); # string | image to upload
eval {
$api_instance->test_body_with_binary(body => $body);
};
if ($@) {
warn "Exception when calling FakeApi->test_body_with_binary: $@\n";
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | **string****string**| image to upload |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: image/png
- **Accept**: Not defined
[[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_with_file_schema** # **test_body_with_file_schema**
> test_body_with_file_schema(file_schema_test_class => $file_schema_test_class) > test_body_with_file_schema(file_schema_test_class => $file_schema_test_class)
For this test, the body for this request much reference a schema named `File`. For this test, the body for this request must reference a schema named `File`.
### Example ### Example
```perl ```perl

View File

@ -485,6 +485,62 @@ sub fake_property_enum_integer_serialize {
return $_response_object; return $_response_object;
} }
#
# test_body_with_binary
#
#
#
# @param string $body image to upload (required)
{
my $params = {
'body' => {
data_type => 'string',
description => 'image to upload',
required => '1',
},
};
__PACKAGE__->method_documentation->{ 'test_body_with_binary' } = {
summary => '',
params => $params,
returns => undef,
};
}
# @return void
#
sub test_body_with_binary {
my ($self, %args) = @_;
# parse inputs
my $_resource_path = '/fake/body-with-binary';
my $_method = 'PUT';
my $query_params = {};
my $header_params = {};
my $form_params = {};
# 'Accept' and 'Content-Type' header
my $_header_accept = $self->{api_client}->select_header_accept();
if ($_header_accept) {
$header_params->{'Accept'} = $_header_accept;
}
$header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('image/png');
my $_body_data;
# body params
if ( exists $args{'body'}) {
$_body_data = $args{'body'};
}
# authentication setting, if any
my $auth_settings = [qw()];
# make the API Call
$self->{api_client}->call_api($_resource_path, $_method,
$query_params, $form_params,
$header_params, $_body_data, $auth_settings);
return;
}
# #
# test_body_with_file_schema # test_body_with_file_schema
# #

View File

@ -80,6 +80,7 @@ Class | Method | HTTP request | Description
*FakeApi* | [**fakeOuterNumberSerialize**](docs/Api/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | *FakeApi* | [**fakeOuterNumberSerialize**](docs/Api/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number |
*FakeApi* | [**fakeOuterStringSerialize**](docs/Api/FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | *FakeApi* | [**fakeOuterStringSerialize**](docs/Api/FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string |
*FakeApi* | [**fakePropertyEnumIntegerSerialize**](docs/Api/FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int | *FakeApi* | [**fakePropertyEnumIntegerSerialize**](docs/Api/FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int |
*FakeApi* | [**testBodyWithBinary**](docs/Api/FakeApi.md#testbodywithbinary) | **PUT** /fake/body-with-binary |
*FakeApi* | [**testBodyWithFileSchema**](docs/Api/FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | *FakeApi* | [**testBodyWithFileSchema**](docs/Api/FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema |
*FakeApi* | [**testBodyWithQueryParams**](docs/Api/FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | *FakeApi* | [**testBodyWithQueryParams**](docs/Api/FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params |
*FakeApi* | [**testClientModel**](docs/Api/FakeApi.md#testclientmodel) | **PATCH** /fake | To test \&quot;client\&quot; model *FakeApi* | [**testClientModel**](docs/Api/FakeApi.md#testclientmodel) | **PATCH** /fake | To test \&quot;client\&quot; model

View File

@ -11,6 +11,7 @@ Method | HTTP request | Description
[**fakeOuterNumberSerialize()**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | [**fakeOuterNumberSerialize()**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number |
[**fakeOuterStringSerialize()**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | [**fakeOuterStringSerialize()**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string |
[**fakePropertyEnumIntegerSerialize()**](FakeApi.md#fakePropertyEnumIntegerSerialize) | **POST** /fake/property/enum-int | [**fakePropertyEnumIntegerSerialize()**](FakeApi.md#fakePropertyEnumIntegerSerialize) | **POST** /fake/property/enum-int |
[**testBodyWithBinary()**](FakeApi.md#testBodyWithBinary) | **PUT** /fake/body-with-binary |
[**testBodyWithFileSchema()**](FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema | [**testBodyWithFileSchema()**](FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema |
[**testBodyWithQueryParams()**](FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | [**testBodyWithQueryParams()**](FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params |
[**testClientModel()**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \&quot;client\&quot; model [**testClientModel()**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \&quot;client\&quot; model
@ -412,6 +413,61 @@ No authorization required
[[Back to Model list]](../../README.md#models) [[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md) [[Back to README]](../../README.md)
## `testBodyWithBinary()`
```php
testBodyWithBinary($body)
```
For this test, the body has to be a binary file.
### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$apiInstance = new OpenAPI\Client\Api\FakeApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client()
);
$body = "/path/to/file.txt"; // \SplFileObject | image to upload
try {
$apiInstance->testBodyWithBinary($body);
} catch (Exception $e) {
echo 'Exception when calling FakeApi->testBodyWithBinary: ', $e->getMessage(), PHP_EOL;
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | **\SplFileObject****\SplFileObject**| image to upload |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: `image/png`
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)
## `testBodyWithFileSchema()` ## `testBodyWithFileSchema()`
```php ```php
@ -420,7 +476,7 @@ testBodyWithFileSchema($file_schema_test_class)
For this test, the body for this request much reference a schema named `File`. For this test, the body for this request must reference a schema named `File`.
### Example ### Example

View File

@ -1847,6 +1847,215 @@ class FakeApi
); );
} }
/**
* Operation testBodyWithBinary
*
* @param \SplFileObject $body image to upload (required)
*
* @throws \OpenAPI\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function testBodyWithBinary($body)
{
$this->testBodyWithBinaryWithHttpInfo($body);
}
/**
* Operation testBodyWithBinaryWithHttpInfo
*
* @param \SplFileObject $body image to upload (required)
*
* @throws \OpenAPI\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function testBodyWithBinaryWithHttpInfo($body)
{
$request = $this->testBodyWithBinaryRequest($body);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation testBodyWithBinaryAsync
*
* @param \SplFileObject $body image to upload (required)
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function testBodyWithBinaryAsync($body)
{
return $this->testBodyWithBinaryAsyncWithHttpInfo($body)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation testBodyWithBinaryAsyncWithHttpInfo
*
* @param \SplFileObject $body image to upload (required)
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function testBodyWithBinaryAsyncWithHttpInfo($body)
{
$returnType = '';
$request = $this->testBodyWithBinaryRequest($body);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'testBodyWithBinary'
*
* @param \SplFileObject $body image to upload (required)
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function testBodyWithBinaryRequest($body)
{
// verify the required parameter 'body' is set
if ($body === null || (is_array($body) && count($body) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $body when calling testBodyWithBinary'
);
}
$resourcePath = '/fake/body-with-binary';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
if ($multipart) {
$headers = $this->headerSelector->selectHeadersForMultipart(
[]
);
} else {
$headers = $this->headerSelector->selectHeaders(
[],
['image/png']
);
}
// for model (json/xml)
if (isset($body)) {
if ($headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($body));
} else {
$httpBody = $body;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif ($headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = \GuzzleHttp\Psr7\build_query($formParams);
}
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$query = \GuzzleHttp\Psr7\build_query($queryParams);
return new Request(
'PUT',
$this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/** /**
* Operation testBodyWithFileSchema * Operation testBodyWithFileSchema
* *

View File

@ -84,6 +84,7 @@ Class | Method | HTTP request | Description
*Petstore::FakeApi* | [**fake_outer_number_serialize**](docs/FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | *Petstore::FakeApi* | [**fake_outer_number_serialize**](docs/FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number |
*Petstore::FakeApi* | [**fake_outer_string_serialize**](docs/FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | *Petstore::FakeApi* | [**fake_outer_string_serialize**](docs/FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string |
*Petstore::FakeApi* | [**fake_property_enum_integer_serialize**](docs/FakeApi.md#fake_property_enum_integer_serialize) | **POST** /fake/property/enum-int | *Petstore::FakeApi* | [**fake_property_enum_integer_serialize**](docs/FakeApi.md#fake_property_enum_integer_serialize) | **POST** /fake/property/enum-int |
*Petstore::FakeApi* | [**test_body_with_binary**](docs/FakeApi.md#test_body_with_binary) | **PUT** /fake/body-with-binary |
*Petstore::FakeApi* | [**test_body_with_file_schema**](docs/FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | *Petstore::FakeApi* | [**test_body_with_file_schema**](docs/FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema |
*Petstore::FakeApi* | [**test_body_with_query_params**](docs/FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | *Petstore::FakeApi* | [**test_body_with_query_params**](docs/FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params |
*Petstore::FakeApi* | [**test_client_model**](docs/FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model *Petstore::FakeApi* | [**test_client_model**](docs/FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model

View File

@ -11,6 +11,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
| [**fake_outer_number_serialize**](FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | | | [**fake_outer_number_serialize**](FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | |
| [**fake_outer_string_serialize**](FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | | | [**fake_outer_string_serialize**](FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | |
| [**fake_property_enum_integer_serialize**](FakeApi.md#fake_property_enum_integer_serialize) | **POST** /fake/property/enum-int | | | [**fake_property_enum_integer_serialize**](FakeApi.md#fake_property_enum_integer_serialize) | **POST** /fake/property/enum-int | |
| [**test_body_with_binary**](FakeApi.md#test_body_with_binary) | **PUT** /fake/body-with-binary | |
| [**test_body_with_file_schema**](FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | | | [**test_body_with_file_schema**](FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | |
| [**test_body_with_query_params**](FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | | | [**test_body_with_query_params**](FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | |
| [**test_client_model**](FakeApi.md#test_client_model) | **PATCH** /fake | To test \&quot;client\&quot; model | | [**test_client_model**](FakeApi.md#test_client_model) | **PATCH** /fake | To test \&quot;client\&quot; model |
@ -479,13 +480,76 @@ No authorization required
- **Accept**: */* - **Accept**: */*
## test_body_with_binary
> test_body_with_binary(body)
For this test, the body has to be a binary file.
### Examples
```ruby
require 'time'
require 'petstore'
api_instance = Petstore::FakeApi.new
body = File.new('/path/to/some/file') # File | image to upload
begin
api_instance.test_body_with_binary(body)
rescue Petstore::ApiError => e
puts "Error when calling FakeApi->test_body_with_binary: #{e}"
end
```
#### Using the test_body_with_binary_with_http_info variant
This returns an Array which contains the response data (`nil` in this case), status code and headers.
> <Array(nil, Integer, Hash)> test_body_with_binary_with_http_info(body)
```ruby
begin
data, status_code, headers = api_instance.test_body_with_binary_with_http_info(body)
p status_code # => 2xx
p headers # => { ... }
p data # => nil
rescue Petstore::ApiError => e
puts "Error when calling FakeApi->test_body_with_binary_with_http_info: #{e}"
end
```
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **body** | **File** | image to upload | |
### Return type
nil (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: image/png
- **Accept**: Not defined
## test_body_with_file_schema ## test_body_with_file_schema
> test_body_with_file_schema(file_schema_test_class) > test_body_with_file_schema(file_schema_test_class)
For this test, the body for this request much reference a schema named `File`. For this test, the body for this request must reference a schema named `File`.
### Examples ### Examples

View File

@ -440,7 +440,64 @@ module Petstore
return data, status_code, headers return data, status_code, headers
end end
# For this test, the body for this request much reference a schema named `File`. # For this test, the body has to be a binary file.
# @param body [File] image to upload
# @param [Hash] opts the optional parameters
# @return [nil]
def test_body_with_binary(body, opts = {})
test_body_with_binary_with_http_info(body, opts)
nil
end
# For this test, the body has to be a binary file.
# @param body [File] image to upload
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def test_body_with_binary_with_http_info(body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: FakeApi.test_body_with_binary ...'
end
# resource path
local_var_path = '/fake/body-with-binary'
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['image/png'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
# return_type
return_type = opts[:debug_return_type]
# auth_names
auth_names = opts[:debug_auth_names] || []
new_options = opts.merge(
:operation => :"FakeApi.test_body_with_binary",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: FakeApi#test_body_with_binary\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# For this test, the body for this request must reference a schema named `File`.
# @param file_schema_test_class [FileSchemaTestClass] # @param file_schema_test_class [FileSchemaTestClass]
# @param [Hash] opts the optional parameters # @param [Hash] opts the optional parameters
# @return [nil] # @return [nil]
@ -449,7 +506,7 @@ module Petstore
nil nil
end end
# For this test, the body for this request much reference a schema named &#x60;File&#x60;. # For this test, the body for this request must reference a schema named &#x60;File&#x60;.
# @param file_schema_test_class [FileSchemaTestClass] # @param file_schema_test_class [FileSchemaTestClass]
# @param [Hash] opts the optional parameters # @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

View File

@ -84,6 +84,7 @@ Class | Method | HTTP request | Description
*Petstore::FakeApi* | [**fake_outer_number_serialize**](docs/FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | *Petstore::FakeApi* | [**fake_outer_number_serialize**](docs/FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number |
*Petstore::FakeApi* | [**fake_outer_string_serialize**](docs/FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | *Petstore::FakeApi* | [**fake_outer_string_serialize**](docs/FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string |
*Petstore::FakeApi* | [**fake_property_enum_integer_serialize**](docs/FakeApi.md#fake_property_enum_integer_serialize) | **POST** /fake/property/enum-int | *Petstore::FakeApi* | [**fake_property_enum_integer_serialize**](docs/FakeApi.md#fake_property_enum_integer_serialize) | **POST** /fake/property/enum-int |
*Petstore::FakeApi* | [**test_body_with_binary**](docs/FakeApi.md#test_body_with_binary) | **PUT** /fake/body-with-binary |
*Petstore::FakeApi* | [**test_body_with_file_schema**](docs/FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | *Petstore::FakeApi* | [**test_body_with_file_schema**](docs/FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema |
*Petstore::FakeApi* | [**test_body_with_query_params**](docs/FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | *Petstore::FakeApi* | [**test_body_with_query_params**](docs/FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params |
*Petstore::FakeApi* | [**test_client_model**](docs/FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model *Petstore::FakeApi* | [**test_client_model**](docs/FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model

View File

@ -11,6 +11,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
| [**fake_outer_number_serialize**](FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | | | [**fake_outer_number_serialize**](FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | |
| [**fake_outer_string_serialize**](FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | | | [**fake_outer_string_serialize**](FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | |
| [**fake_property_enum_integer_serialize**](FakeApi.md#fake_property_enum_integer_serialize) | **POST** /fake/property/enum-int | | | [**fake_property_enum_integer_serialize**](FakeApi.md#fake_property_enum_integer_serialize) | **POST** /fake/property/enum-int | |
| [**test_body_with_binary**](FakeApi.md#test_body_with_binary) | **PUT** /fake/body-with-binary | |
| [**test_body_with_file_schema**](FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | | | [**test_body_with_file_schema**](FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | |
| [**test_body_with_query_params**](FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | | | [**test_body_with_query_params**](FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | |
| [**test_client_model**](FakeApi.md#test_client_model) | **PATCH** /fake | To test \&quot;client\&quot; model | | [**test_client_model**](FakeApi.md#test_client_model) | **PATCH** /fake | To test \&quot;client\&quot; model |
@ -479,13 +480,76 @@ No authorization required
- **Accept**: */* - **Accept**: */*
## test_body_with_binary
> test_body_with_binary(body)
For this test, the body has to be a binary file.
### Examples
```ruby
require 'time'
require 'petstore'
api_instance = Petstore::FakeApi.new
body = File.new('/path/to/some/file') # File | image to upload
begin
api_instance.test_body_with_binary(body)
rescue Petstore::ApiError => e
puts "Error when calling FakeApi->test_body_with_binary: #{e}"
end
```
#### Using the test_body_with_binary_with_http_info variant
This returns an Array which contains the response data (`nil` in this case), status code and headers.
> <Array(nil, Integer, Hash)> test_body_with_binary_with_http_info(body)
```ruby
begin
data, status_code, headers = api_instance.test_body_with_binary_with_http_info(body)
p status_code # => 2xx
p headers # => { ... }
p data # => nil
rescue Petstore::ApiError => e
puts "Error when calling FakeApi->test_body_with_binary_with_http_info: #{e}"
end
```
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **body** | **File** | image to upload | |
### Return type
nil (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: image/png
- **Accept**: Not defined
## test_body_with_file_schema ## test_body_with_file_schema
> test_body_with_file_schema(file_schema_test_class) > test_body_with_file_schema(file_schema_test_class)
For this test, the body for this request much reference a schema named `File`. For this test, the body for this request must reference a schema named `File`.
### Examples ### Examples

View File

@ -440,7 +440,64 @@ module Petstore
return data, status_code, headers return data, status_code, headers
end end
# For this test, the body for this request much reference a schema named `File`. # For this test, the body has to be a binary file.
# @param body [File] image to upload
# @param [Hash] opts the optional parameters
# @return [nil]
def test_body_with_binary(body, opts = {})
test_body_with_binary_with_http_info(body, opts)
nil
end
# For this test, the body has to be a binary file.
# @param body [File] image to upload
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def test_body_with_binary_with_http_info(body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: FakeApi.test_body_with_binary ...'
end
# resource path
local_var_path = '/fake/body-with-binary'
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['image/png'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
# return_type
return_type = opts[:debug_return_type]
# auth_names
auth_names = opts[:debug_auth_names] || []
new_options = opts.merge(
:operation => :"FakeApi.test_body_with_binary",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: FakeApi#test_body_with_binary\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# For this test, the body for this request must reference a schema named `File`.
# @param file_schema_test_class [FileSchemaTestClass] # @param file_schema_test_class [FileSchemaTestClass]
# @param [Hash] opts the optional parameters # @param [Hash] opts the optional parameters
# @return [nil] # @return [nil]
@ -449,7 +506,7 @@ module Petstore
nil nil
end end
# For this test, the body for this request much reference a schema named &#x60;File&#x60;. # For this test, the body for this request must reference a schema named &#x60;File&#x60;.
# @param file_schema_test_class [FileSchemaTestClass] # @param file_schema_test_class [FileSchemaTestClass]
# @param [Hash] opts the optional parameters # @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

View File

@ -64,6 +64,10 @@ export interface FakePropertyEnumIntegerSerializeRequest {
outerObjectWithEnumProperty: OuterObjectWithEnumProperty; outerObjectWithEnumProperty: OuterObjectWithEnumProperty;
} }
export interface TestBodyWithBinaryRequest {
body: Blob | null;
}
export interface TestBodyWithFileSchemaRequest { export interface TestBodyWithFileSchemaRequest {
fileSchemaTestClass: FileSchemaTestClass; fileSchemaTestClass: FileSchemaTestClass;
} }
@ -352,7 +356,39 @@ export class FakeApi extends runtime.BaseAPI {
} }
/** /**
* For this test, the body for this request much reference a schema named `File`. * For this test, the body has to be a binary file.
*/
async testBodyWithBinaryRaw(requestParameters: TestBodyWithBinaryRequest): Promise<runtime.ApiResponse<void>> {
if (requestParameters.body === null || requestParameters.body === undefined) {
throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling testBodyWithBinary.');
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
headerParameters['Content-Type'] = 'image/png';
const response = await this.request({
path: `/fake/body-with-binary`,
method: 'PUT',
headers: headerParameters,
query: queryParameters,
body: requestParameters.body as any,
});
return new runtime.VoidApiResponse(response);
}
/**
* For this test, the body has to be a binary file.
*/
async testBodyWithBinary(requestParameters: TestBodyWithBinaryRequest): Promise<void> {
await this.testBodyWithBinaryRaw(requestParameters);
}
/**
* For this test, the body for this request must reference a schema named `File`.
*/ */
async testBodyWithFileSchemaRaw(requestParameters: TestBodyWithFileSchemaRequest): Promise<runtime.ApiResponse<void>> { async testBodyWithFileSchemaRaw(requestParameters: TestBodyWithFileSchemaRequest): Promise<runtime.ApiResponse<void>> {
if (requestParameters.fileSchemaTestClass === null || requestParameters.fileSchemaTestClass === undefined) { if (requestParameters.fileSchemaTestClass === null || requestParameters.fileSchemaTestClass === undefined) {
@ -377,7 +413,7 @@ export class FakeApi extends runtime.BaseAPI {
} }
/** /**
* For this test, the body for this request much reference a schema named `File`. * For this test, the body for this request must reference a schema named `File`.
*/ */
async testBodyWithFileSchema(requestParameters: TestBodyWithFileSchemaRequest): Promise<void> { async testBodyWithFileSchema(requestParameters: TestBodyWithFileSchemaRequest): Promise<void> {
await this.testBodyWithFileSchemaRaw(requestParameters); await this.testBodyWithFileSchemaRaw(requestParameters);

View File

@ -73,6 +73,7 @@ Class | Method | HTTP request | Description
[*FakeApi*](doc/FakeApi.md) | [**fakeOuterNumberSerialize**](doc/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | [*FakeApi*](doc/FakeApi.md) | [**fakeOuterNumberSerialize**](doc/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number |
[*FakeApi*](doc/FakeApi.md) | [**fakeOuterStringSerialize**](doc/FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | [*FakeApi*](doc/FakeApi.md) | [**fakeOuterStringSerialize**](doc/FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string |
[*FakeApi*](doc/FakeApi.md) | [**fakePropertyEnumIntegerSerialize**](doc/FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int | [*FakeApi*](doc/FakeApi.md) | [**fakePropertyEnumIntegerSerialize**](doc/FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int |
[*FakeApi*](doc/FakeApi.md) | [**testBodyWithBinary**](doc/FakeApi.md#testbodywithbinary) | **PUT** /fake/body-with-binary |
[*FakeApi*](doc/FakeApi.md) | [**testBodyWithFileSchema**](doc/FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | [*FakeApi*](doc/FakeApi.md) | [**testBodyWithFileSchema**](doc/FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema |
[*FakeApi*](doc/FakeApi.md) | [**testBodyWithQueryParams**](doc/FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | [*FakeApi*](doc/FakeApi.md) | [**testBodyWithQueryParams**](doc/FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params |
[*FakeApi*](doc/FakeApi.md) | [**testClientModel**](doc/FakeApi.md#testclientmodel) | **PATCH** /fake | To test \&quot;client\&quot; model [*FakeApi*](doc/FakeApi.md) | [**testClientModel**](doc/FakeApi.md#testclientmodel) | **PATCH** /fake | To test \&quot;client\&quot; model

View File

@ -16,6 +16,7 @@ Method | HTTP request | Description
[**fakeOuterNumberSerialize**](FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | [**fakeOuterNumberSerialize**](FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number |
[**fakeOuterStringSerialize**](FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | [**fakeOuterStringSerialize**](FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string |
[**fakePropertyEnumIntegerSerialize**](FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int | [**fakePropertyEnumIntegerSerialize**](FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int |
[**testBodyWithBinary**](FakeApi.md#testbodywithbinary) | **PUT** /fake/body-with-binary |
[**testBodyWithFileSchema**](FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | [**testBodyWithFileSchema**](FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema |
[**testBodyWithQueryParams**](FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | [**testBodyWithQueryParams**](FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params |
[**testClientModel**](FakeApi.md#testclientmodel) | **PATCH** /fake | To test \&quot;client\&quot; model [**testClientModel**](FakeApi.md#testclientmodel) | **PATCH** /fake | To test \&quot;client\&quot; model
@ -326,12 +327,54 @@ 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)
# **testBodyWithBinary**
> testBodyWithBinary(body)
For this test, the body has to be a binary file.
### Example
```dart
import 'package:openapi/api.dart';
final api = Openapi().getFakeApi();
final MultipartFile body = BINARY_DATA_HERE; // MultipartFile | image to upload
try {
api.testBodyWithBinary(body);
} catch on DioError (e) {
print('Exception when calling FakeApi->testBodyWithBinary: $e\n');
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | **MultipartFile**| image to upload |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: image/png
- **Accept**: Not defined
[[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)
# **testBodyWithFileSchema** # **testBodyWithFileSchema**
> testBodyWithFileSchema(fileSchemaTestClass) > testBodyWithFileSchema(fileSchemaTestClass)
For this test, the body for this request much reference a schema named `File`. For this test, the body for this request must reference a schema named `File`.
### Example ### Example
```dart ```dart

View File

@ -660,8 +660,78 @@ class FakeApi {
); );
} }
/// testBodyWithBinary
/// For this test, the body has to be a binary file.
///
/// Parameters:
/// * [body] - image to upload
/// * [cancelToken] - A [CancelToken] that can be used to cancel the operation
/// * [headers] - Can be used to add additional headers to the request
/// * [extras] - Can be used to add flags to the request
/// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response
/// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress
/// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress
///
/// Returns a [Future]
/// Throws [DioError] if API call or serialization fails
Future<Response<void>> testBodyWithBinary({
required MultipartFile body,
CancelToken? cancelToken,
Map<String, dynamic>? headers,
Map<String, dynamic>? extra,
ValidateStatus? validateStatus,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/fake/body-with-binary';
final _options = Options(
method: r'PUT',
headers: <String, dynamic>{
...?headers,
},
extra: <String, dynamic>{
'secure': <Map<String, String>>[],
...?extra,
},
contentType: 'image/png',
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{
};
dynamic _bodyData;
try {
_bodyData = body.finalize();
} catch(error, stackTrace) {
throw DioError(
requestOptions: _options.compose(
_dio.options,
_path,
queryParameters: _queryParameters,
),
type: DioErrorType.other,
error: error,
)..stackTrace = stackTrace;
}
final _response = await _dio.request<Object>(
_path,
data: _bodyData,
options: _options,
queryParameters: _queryParameters,
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
return _response;
}
/// testBodyWithFileSchema /// testBodyWithFileSchema
/// For this test, the body for this request much reference a schema named &#x60;File&#x60;. /// For this test, the body for this request must reference a schema named &#x60;File&#x60;.
/// ///
/// Parameters: /// Parameters:
/// * [fileSchemaTestClass] /// * [fileSchemaTestClass]

View File

@ -67,6 +67,7 @@ Class | Method | HTTP request | Description
*FakeApi* | [**fakeOuterNumberSerialize**](doc/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | *FakeApi* | [**fakeOuterNumberSerialize**](doc/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number |
*FakeApi* | [**fakeOuterStringSerialize**](doc/FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | *FakeApi* | [**fakeOuterStringSerialize**](doc/FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string |
*FakeApi* | [**fakePropertyEnumIntegerSerialize**](doc/FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int | *FakeApi* | [**fakePropertyEnumIntegerSerialize**](doc/FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int |
*FakeApi* | [**testBodyWithBinary**](doc/FakeApi.md#testbodywithbinary) | **PUT** /fake/body-with-binary |
*FakeApi* | [**testBodyWithFileSchema**](doc/FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | *FakeApi* | [**testBodyWithFileSchema**](doc/FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema |
*FakeApi* | [**testBodyWithQueryParams**](doc/FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | *FakeApi* | [**testBodyWithQueryParams**](doc/FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params |
*FakeApi* | [**testClientModel**](doc/FakeApi.md#testclientmodel) | **PATCH** /fake | To test \&quot;client\&quot; model *FakeApi* | [**testClientModel**](doc/FakeApi.md#testclientmodel) | **PATCH** /fake | To test \&quot;client\&quot; model

View File

@ -16,6 +16,7 @@ Method | HTTP request | Description
[**fakeOuterNumberSerialize**](FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | [**fakeOuterNumberSerialize**](FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number |
[**fakeOuterStringSerialize**](FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | [**fakeOuterStringSerialize**](FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string |
[**fakePropertyEnumIntegerSerialize**](FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int | [**fakePropertyEnumIntegerSerialize**](FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int |
[**testBodyWithBinary**](FakeApi.md#testbodywithbinary) | **PUT** /fake/body-with-binary |
[**testBodyWithFileSchema**](FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | [**testBodyWithFileSchema**](FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema |
[**testBodyWithQueryParams**](FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | [**testBodyWithQueryParams**](FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params |
[**testClientModel**](FakeApi.md#testclientmodel) | **PATCH** /fake | To test \&quot;client\&quot; model [**testClientModel**](FakeApi.md#testclientmodel) | **PATCH** /fake | To test \&quot;client\&quot; model
@ -326,12 +327,54 @@ 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)
# **testBodyWithBinary**
> testBodyWithBinary(body)
For this test, the body has to be a binary file.
### Example
```dart
import 'package:openapi/api.dart';
var api_instance = new FakeApi();
var body = new Uint8List(); // Uint8List | image to upload
try {
api_instance.testBodyWithBinary(body);
} catch (e) {
print('Exception when calling FakeApi->testBodyWithBinary: $e\n');
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | **Uint8List**| image to upload |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: image/png
- **Accept**: Not defined
[[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)
# **testBodyWithFileSchema** # **testBodyWithFileSchema**
> testBodyWithFileSchema(fileSchemaTestClass) > testBodyWithFileSchema(fileSchemaTestClass)
For this test, the body for this request much reference a schema named `File`. For this test, the body for this request must reference a schema named `File`.
### Example ### Example
```dart ```dart

View File

@ -413,7 +413,49 @@ class FakeApi {
/// ///
/// ///
/// For this test, the body for this request much reference a schema named `File`. /// For this test, the body has to be a binary file.
Future<Response<void>> testBodyWithBinary(
Uint8List body, {
CancelToken cancelToken,
Map<String, dynamic> headers,
Map<String, dynamic> extra,
ValidateStatus validateStatus,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final _request = RequestOptions(
path: r'/fake/body-with-binary',
method: 'PUT',
headers: <String, dynamic>{
...?headers,
},
extra: <String, dynamic>{
'secure': <Map<String, String>>[],
...?extra,
},
validateStatus: validateStatus,
contentType: 'image/png',
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
dynamic _bodyData;
_bodyData = body;
final _response = await _dio.request<dynamic>(
_request.path,
data: _bodyData,
options: _request,
);
return _response;
}
///
///
/// For this test, the body for this request must reference a schema named `File`.
Future<Response<void>> testBodyWithFileSchema( Future<Response<void>> testBodyWithFileSchema(
FileSchemaTestClass fileSchemaTestClass, { FileSchemaTestClass fileSchemaTestClass, {
CancelToken cancelToken, CancelToken cancelToken,

View File

@ -67,6 +67,7 @@ Class | Method | HTTP request | Description
*FakeApi* | [**fakeOuterNumberSerialize**](doc//FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | *FakeApi* | [**fakeOuterNumberSerialize**](doc//FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number |
*FakeApi* | [**fakeOuterStringSerialize**](doc//FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | *FakeApi* | [**fakeOuterStringSerialize**](doc//FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string |
*FakeApi* | [**fakePropertyEnumIntegerSerialize**](doc//FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int | *FakeApi* | [**fakePropertyEnumIntegerSerialize**](doc//FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int |
*FakeApi* | [**testBodyWithBinary**](doc//FakeApi.md#testbodywithbinary) | **PUT** /fake/body-with-binary |
*FakeApi* | [**testBodyWithFileSchema**](doc//FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | *FakeApi* | [**testBodyWithFileSchema**](doc//FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema |
*FakeApi* | [**testBodyWithQueryParams**](doc//FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | *FakeApi* | [**testBodyWithQueryParams**](doc//FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params |
*FakeApi* | [**testClientModel**](doc//FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model *FakeApi* | [**testClientModel**](doc//FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model

View File

@ -16,6 +16,7 @@ Method | HTTP request | Description
[**fakeOuterNumberSerialize**](FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | [**fakeOuterNumberSerialize**](FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number |
[**fakeOuterStringSerialize**](FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | [**fakeOuterStringSerialize**](FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string |
[**fakePropertyEnumIntegerSerialize**](FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int | [**fakePropertyEnumIntegerSerialize**](FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int |
[**testBodyWithBinary**](FakeApi.md#testbodywithbinary) | **PUT** /fake/body-with-binary |
[**testBodyWithFileSchema**](FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | [**testBodyWithFileSchema**](FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema |
[**testBodyWithQueryParams**](FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | [**testBodyWithQueryParams**](FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params |
[**testClientModel**](FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model [**testClientModel**](FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model
@ -323,12 +324,54 @@ 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)
# **testBodyWithBinary**
> testBodyWithBinary(body)
For this test, the body has to be a binary file.
### Example
```dart
import 'package:openapi/api.dart';
final api_instance = FakeApi();
final body = MultipartFile(); // MultipartFile | image to upload
try {
api_instance.testBodyWithBinary(body);
} catch (e) {
print('Exception when calling FakeApi->testBodyWithBinary: $e\n');
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | **MultipartFile**| image to upload |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: image/png
- **Accept**: Not defined
[[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)
# **testBodyWithFileSchema** # **testBodyWithFileSchema**
> testBodyWithFileSchema(fileSchemaTestClass) > testBodyWithFileSchema(fileSchemaTestClass)
For this test, the body for this request much reference a schema named `File`. For this test, the body for this request must reference a schema named `File`.
### Example ### Example
```dart ```dart

View File

@ -414,7 +414,59 @@ class FakeApi {
return Future<OuterObjectWithEnumProperty>.value(null); return Future<OuterObjectWithEnumProperty>.value(null);
} }
/// For this test, the body for this request much reference a schema named `File`. /// For this test, the body has to be a binary file.
///
/// Note: This method returns the HTTP [Response].
///
/// Parameters:
///
/// * [MultipartFile] body (required):
/// image to upload
Future<Response> testBodyWithBinaryWithHttpInfo(MultipartFile body) async {
// Verify required params are set.
if (body == null) {
throw ApiException(HttpStatus.badRequest, 'Missing required param: body');
}
final path = r'/fake/body-with-binary';
Object postBody = body;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
final contentTypes = <String>['image/png'];
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
final authNames = <String>[];
return await apiClient.invokeAPI(
path,
'PUT',
queryParams,
postBody,
headerParams,
formParams,
nullableContentType,
authNames,
);
}
/// For this test, the body has to be a binary file.
///
/// Parameters:
///
/// * [MultipartFile] body (required):
/// image to upload
Future<void> testBodyWithBinary(MultipartFile body) async {
final response = await testBodyWithBinaryWithHttpInfo(body);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
}
/// For this test, the body for this request must reference a schema named `File`.
/// ///
/// Note: This method returns the HTTP [Response]. /// Note: This method returns the HTTP [Response].
/// ///
@ -452,7 +504,7 @@ class FakeApi {
); );
} }
/// For this test, the body for this request much reference a schema named `File`. /// For this test, the body for this request must reference a schema named `File`.
/// ///
/// Parameters: /// Parameters:
/// ///

View File

@ -67,6 +67,7 @@ Class | Method | HTTP request | Description
*FakeApi* | [**fakeOuterNumberSerialize**](doc//FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | *FakeApi* | [**fakeOuterNumberSerialize**](doc//FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number |
*FakeApi* | [**fakeOuterStringSerialize**](doc//FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | *FakeApi* | [**fakeOuterStringSerialize**](doc//FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string |
*FakeApi* | [**fakePropertyEnumIntegerSerialize**](doc//FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int | *FakeApi* | [**fakePropertyEnumIntegerSerialize**](doc//FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int |
*FakeApi* | [**testBodyWithBinary**](doc//FakeApi.md#testbodywithbinary) | **PUT** /fake/body-with-binary |
*FakeApi* | [**testBodyWithFileSchema**](doc//FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | *FakeApi* | [**testBodyWithFileSchema**](doc//FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema |
*FakeApi* | [**testBodyWithQueryParams**](doc//FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | *FakeApi* | [**testBodyWithQueryParams**](doc//FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params |
*FakeApi* | [**testClientModel**](doc//FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model *FakeApi* | [**testClientModel**](doc//FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model

View File

@ -16,6 +16,7 @@ Method | HTTP request | Description
[**fakeOuterNumberSerialize**](FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | [**fakeOuterNumberSerialize**](FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number |
[**fakeOuterStringSerialize**](FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | [**fakeOuterStringSerialize**](FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string |
[**fakePropertyEnumIntegerSerialize**](FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int | [**fakePropertyEnumIntegerSerialize**](FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int |
[**testBodyWithBinary**](FakeApi.md#testbodywithbinary) | **PUT** /fake/body-with-binary |
[**testBodyWithFileSchema**](FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | [**testBodyWithFileSchema**](FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema |
[**testBodyWithQueryParams**](FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | [**testBodyWithQueryParams**](FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params |
[**testClientModel**](FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model [**testClientModel**](FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model
@ -323,12 +324,54 @@ 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)
# **testBodyWithBinary**
> testBodyWithBinary(body)
For this test, the body has to be a binary file.
### Example
```dart
import 'package:openapi/api.dart';
final api_instance = FakeApi();
final body = MultipartFile(); // MultipartFile | image to upload
try {
api_instance.testBodyWithBinary(body);
} catch (e) {
print('Exception when calling FakeApi->testBodyWithBinary: $e\n');
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | **MultipartFile**| image to upload |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: image/png
- **Accept**: Not defined
[[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)
# **testBodyWithFileSchema** # **testBodyWithFileSchema**
> testBodyWithFileSchema(fileSchemaTestClass) > testBodyWithFileSchema(fileSchemaTestClass)
For this test, the body for this request much reference a schema named `File`. For this test, the body for this request must reference a schema named `File`.
### Example ### Example
```dart ```dart

View File

@ -420,7 +420,59 @@ class FakeApi {
return Future<OuterObjectWithEnumProperty>.value(null); return Future<OuterObjectWithEnumProperty>.value(null);
} }
/// For this test, the body for this request much reference a schema named `File`. /// For this test, the body has to be a binary file.
///
/// Note: This method returns the HTTP [Response].
///
/// Parameters:
///
/// * [MultipartFile] body (required):
/// image to upload
Future<Response> testBodyWithBinaryWithHttpInfo(MultipartFile body) async {
// Verify required params are set.
if (body == null) {
throw ApiException(HttpStatus.badRequest, 'Missing required param: body');
}
final path = r'/fake/body-with-binary';
Object postBody = body;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
final contentTypes = <String>['image/png'];
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
final authNames = <String>[];
return await apiClient.invokeAPI(
path,
'PUT',
queryParams,
postBody,
headerParams,
formParams,
nullableContentType,
authNames,
);
}
/// For this test, the body has to be a binary file.
///
/// Parameters:
///
/// * [MultipartFile] body (required):
/// image to upload
Future<void> testBodyWithBinary(MultipartFile body) async {
final response = await testBodyWithBinaryWithHttpInfo(body);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
}
/// For this test, the body for this request must reference a schema named `File`.
/// ///
/// Note: This method returns the HTTP [Response]. /// Note: This method returns the HTTP [Response].
/// ///
@ -458,7 +510,7 @@ class FakeApi {
); );
} }
/// For this test, the body for this request much reference a schema named `File`. /// For this test, the body for this request must reference a schema named `File`.
/// ///
/// Parameters: /// Parameters:
/// ///

View File

@ -90,6 +90,7 @@ Class | Method | HTTP request | Description
*FakeApi* | [**fake_outer_number_serialize**](docs/FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | *FakeApi* | [**fake_outer_number_serialize**](docs/FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number |
*FakeApi* | [**fake_outer_string_serialize**](docs/FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | *FakeApi* | [**fake_outer_string_serialize**](docs/FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string |
*FakeApi* | [**fake_property_enum_integer_serialize**](docs/FakeApi.md#fake_property_enum_integer_serialize) | **POST** /fake/property/enum-int | *FakeApi* | [**fake_property_enum_integer_serialize**](docs/FakeApi.md#fake_property_enum_integer_serialize) | **POST** /fake/property/enum-int |
*FakeApi* | [**test_body_with_binary**](docs/FakeApi.md#test_body_with_binary) | **PUT** /fake/body-with-binary |
*FakeApi* | [**test_body_with_file_schema**](docs/FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | *FakeApi* | [**test_body_with_file_schema**](docs/FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema |
*FakeApi* | [**test_body_with_query_params**](docs/FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | *FakeApi* | [**test_body_with_query_params**](docs/FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params |
*FakeApi* | [**test_client_model**](docs/FakeApi.md#test_client_model) | **PATCH** /fake | To test \&quot;client\&quot; model *FakeApi* | [**test_client_model**](docs/FakeApi.md#test_client_model) | **PATCH** /fake | To test \&quot;client\&quot; model

View File

@ -11,6 +11,7 @@ Method | HTTP request | Description
[**fake_outer_number_serialize**](FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | [**fake_outer_number_serialize**](FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number |
[**fake_outer_string_serialize**](FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | [**fake_outer_string_serialize**](FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string |
[**fake_property_enum_integer_serialize**](FakeApi.md#fake_property_enum_integer_serialize) | **POST** /fake/property/enum-int | [**fake_property_enum_integer_serialize**](FakeApi.md#fake_property_enum_integer_serialize) | **POST** /fake/property/enum-int |
[**test_body_with_binary**](FakeApi.md#test_body_with_binary) | **PUT** /fake/body-with-binary |
[**test_body_with_file_schema**](FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | [**test_body_with_file_schema**](FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema |
[**test_body_with_query_params**](FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | [**test_body_with_query_params**](FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params |
[**test_client_model**](FakeApi.md#test_client_model) | **PATCH** /fake | To test \&quot;client\&quot; model [**test_client_model**](FakeApi.md#test_client_model) | **PATCH** /fake | To test \&quot;client\&quot; model
@ -510,12 +511,72 @@ 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_with_binary**
> test_body_with_binary(body)
For this test, the body has to be a binary file.
### Example
```python
from __future__ import print_function
import time
import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = petstore_api.Configuration(
host = "http://petstore.swagger.io:80/v2"
)
# Enter a context with an instance of the API client
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = petstore_api.FakeApi(api_client)
body = '/path/to/file' # file | image to upload
try:
api_instance.test_body_with_binary(body)
except ApiException as e:
print("Exception when calling FakeApi->test_body_with_binary: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | **file**| image to upload |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: image/png
- **Accept**: Not defined
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Success | - |
[[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_with_file_schema** # **test_body_with_file_schema**
> test_body_with_file_schema(file_schema_test_class) > test_body_with_file_schema(file_schema_test_class)
For this test, the body for this request much reference a schema named `File`. For this test, the body for this request must reference a schema named `File`.
### Example ### Example

View File

@ -982,10 +982,139 @@ class FakeApi(object):
collection_formats=collection_formats, collection_formats=collection_formats,
_request_auth=local_var_params.get('_request_auth')) _request_auth=local_var_params.get('_request_auth'))
def test_body_with_binary(self, body, **kwargs): # noqa: E501
"""test_body_with_binary # noqa: E501
For this test, the body has to be a binary file. # 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_with_binary(body, async_req=True)
>>> result = thread.get()
:param body: image to upload (required)
:type body: file
: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: None
"""
kwargs['_return_http_data_only'] = True
return self.test_body_with_binary_with_http_info(body, **kwargs) # noqa: E501
def test_body_with_binary_with_http_info(self, body, **kwargs): # noqa: E501
"""test_body_with_binary # noqa: E501
For this test, the body has to be a binary file. # 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_with_binary_with_http_info(body, async_req=True)
>>> result = thread.get()
:param body: image to upload (required)
:type body: file
: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
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
:rtype: None
"""
local_var_params = locals()
all_params = [
'body'
]
all_params.extend(
[
'async_req',
'_return_http_data_only',
'_preload_content',
'_request_timeout',
'_request_auth'
]
)
for key, val in six.iteritems(local_var_params['kwargs']):
if key not in all_params:
raise ApiTypeError(
"Got an unexpected keyword argument '%s'"
" to method test_body_with_binary" % key
)
local_var_params[key] = val
del local_var_params['kwargs']
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'body' in local_var_params:
body_params = local_var_params['body']
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['image/png']) # noqa: E501
# Authentication setting
auth_settings = [] # noqa: E501
response_types_map = {}
return self.api_client.call_api(
'/fake/body-with-binary', 'PUT',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_types_map=response_types_map,
auth_settings=auth_settings,
async_req=local_var_params.get('async_req'),
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
_preload_content=local_var_params.get('_preload_content', True),
_request_timeout=local_var_params.get('_request_timeout'),
collection_formats=collection_formats,
_request_auth=local_var_params.get('_request_auth'))
def test_body_with_file_schema(self, file_schema_test_class, **kwargs): # noqa: E501 def test_body_with_file_schema(self, file_schema_test_class, **kwargs): # noqa: E501
"""test_body_with_file_schema # noqa: E501 """test_body_with_file_schema # noqa: E501
For this test, the body for this request much reference a schema named `File`. # noqa: E501 For this test, the body for this request must reference a schema named `File`. # noqa: E501
This method makes a synchronous HTTP request by default. To make an This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True asynchronous HTTP request, please pass async_req=True
@ -1015,7 +1144,7 @@ class FakeApi(object):
def test_body_with_file_schema_with_http_info(self, file_schema_test_class, **kwargs): # noqa: E501 def test_body_with_file_schema_with_http_info(self, file_schema_test_class, **kwargs): # noqa: E501
"""test_body_with_file_schema # noqa: E501 """test_body_with_file_schema # noqa: E501
For this test, the body for this request much reference a schema named `File`. # noqa: E501 For this test, the body for this request must reference a schema named `File`. # noqa: E501
This method makes a synchronous HTTP request by default. To make an This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True asynchronous HTTP request, please pass async_req=True

View File

@ -153,10 +153,22 @@ public class FakeApi {
return delegate.fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty, securityContext); return delegate.fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty, securityContext);
} }
@PUT @PUT
@Path("/body-with-binary")
@Consumes({ "image/png" })
@io.swagger.annotations.ApiOperation(value = "", notes = "For this test, the body has to be a binary file.", response = Void.class, tags={ "fake", })
@io.swagger.annotations.ApiResponses(value = {
@io.swagger.annotations.ApiResponse(code = 200, message = "Success", response = Void.class)
})
public Response testBodyWithBinary(@ApiParam(value = "image to upload", required = true) @NotNull File body,@Context SecurityContext securityContext)
throws NotFoundException {
return delegate.testBodyWithBinary(body, securityContext);
}
@PUT
@Path("/body-with-file-schema") @Path("/body-with-file-schema")
@Consumes({ "application/json" }) @Consumes({ "application/json" })
@io.swagger.annotations.ApiOperation(value = "", notes = "For this test, the body for this request much reference a schema named `File`.", response = Void.class, tags={ "fake", }) @io.swagger.annotations.ApiOperation(value = "", notes = "For this test, the body for this request must reference a schema named `File`.", response = Void.class, tags={ "fake", })
@io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponses(value = {
@io.swagger.annotations.ApiResponse(code = 200, message = "Success", response = Void.class) @io.swagger.annotations.ApiResponse(code = 200, message = "Success", response = Void.class)
}) })

View File

@ -35,6 +35,7 @@ public abstract class FakeApiService {
public abstract Response fakeOuterNumberSerialize(BigDecimal body,SecurityContext securityContext) throws NotFoundException; public abstract Response fakeOuterNumberSerialize(BigDecimal body,SecurityContext securityContext) throws NotFoundException;
public abstract Response fakeOuterStringSerialize(String body,SecurityContext securityContext) throws NotFoundException; public abstract Response fakeOuterStringSerialize(String body,SecurityContext securityContext) throws NotFoundException;
public abstract Response fakePropertyEnumIntegerSerialize(OuterObjectWithEnumProperty outerObjectWithEnumProperty,SecurityContext securityContext) throws NotFoundException; public abstract Response fakePropertyEnumIntegerSerialize(OuterObjectWithEnumProperty outerObjectWithEnumProperty,SecurityContext securityContext) throws NotFoundException;
public abstract Response testBodyWithBinary(File body,SecurityContext securityContext) throws NotFoundException;
public abstract Response testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass,SecurityContext securityContext) throws NotFoundException; public abstract Response testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass,SecurityContext securityContext) throws NotFoundException;
public abstract Response testBodyWithQueryParams( @NotNull String query,User user,SecurityContext securityContext) throws NotFoundException; public abstract Response testBodyWithQueryParams( @NotNull String query,User user,SecurityContext securityContext) throws NotFoundException;
public abstract Response testClientModel(Client client,SecurityContext securityContext) throws NotFoundException; public abstract Response testClientModel(Client client,SecurityContext securityContext) throws NotFoundException;

View File

@ -64,6 +64,11 @@ public class FakeApiServiceImpl extends FakeApiService {
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
} }
@Override @Override
public Response testBodyWithBinary(File body, SecurityContext securityContext) throws NotFoundException {
// do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
}
@Override
public Response testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass, SecurityContext securityContext) throws NotFoundException { public Response testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass, SecurityContext securityContext) throws NotFoundException {
// do some magic! // do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();

View File

@ -228,6 +228,30 @@ class FakeController extends Controller
return response('How about implementing testGroupParameters as a delete method ?'); return response('How about implementing testGroupParameters as a delete method ?');
} }
/**
* Operation testBodyWithBinary
*
* .
*
*
* @return Http response
*/
public function testBodyWithBinary()
{
$input = Request::all();
//path params validation
//not path params validation
if (!isset($input['body'])) {
throw new \InvalidArgumentException('Missing the required parameter $body when calling testBodyWithBinary');
}
$body = $input['body'];
return response('How about implementing testBodyWithBinary as a put method ?');
}
/** /**
* Operation testBodyWithFileSchema * Operation testBodyWithFileSchema
* *

View File

@ -63,10 +63,17 @@ Route::get('/v2/fake', 'FakeController@testEnumParameters');
*/ */
Route::delete('/v2/fake', 'FakeController@testGroupParameters'); Route::delete('/v2/fake', 'FakeController@testGroupParameters');
/**
* put testBodyWithBinary
* Summary:
* Notes: For this test, the body has to be a binary file.
*/
Route::put('/v2/fake/body-with-binary', 'FakeController@testBodyWithBinary');
/** /**
* put testBodyWithFileSchema * put testBodyWithFileSchema
* Summary: * Summary:
* Notes: For this test, the body for this request much reference a schema named &#x60;File&#x60;. * Notes: For this test, the body for this request must reference a schema named &#x60;File&#x60;.
*/ */
Route::put('/v2/fake/body-with-file-schema', 'FakeController@testBodyWithFileSchema'); Route::put('/v2/fake/body-with-file-schema', 'FakeController@testBodyWithFileSchema');

View File

@ -224,6 +224,30 @@ class FakeApi extends Controller
return response('How about implementing testGroupParameters as a delete method ?'); return response('How about implementing testGroupParameters as a delete method ?');
} }
/**
* Operation testBodyWithBinary
*
* .
*
*
* @return Http response
*/
public function testBodyWithBinary()
{
$input = Request::all();
//path params validation
//not path params validation
if (!isset($input['body'])) {
throw new \InvalidArgumentException('Missing the required parameter $body when calling testBodyWithBinary');
}
$body = $input['body'];
return response('How about implementing testBodyWithBinary as a put method ?');
}
/** /**
* Operation testBodyWithFileSchema * Operation testBodyWithFileSchema
* *

View File

@ -79,10 +79,17 @@ $router->get('/v2/fake', 'FakeApi@testEnumParameters');
*/ */
$router->delete('/v2/fake', 'FakeApi@testGroupParameters'); $router->delete('/v2/fake', 'FakeApi@testGroupParameters');
/**
* put testBodyWithBinary
* Summary:
* Notes: For this test, the body has to be a binary file.
*/
$router->put('/v2/fake/body-with-binary', 'FakeApi@testBodyWithBinary');
/** /**
* put testBodyWithFileSchema * put testBodyWithFileSchema
* Summary: * Summary:
* Notes: For this test, the body for this request much reference a schema named &#x60;File&#x60;. * Notes: For this test, the body for this request must reference a schema named &#x60;File&#x60;.
*/ */
$router->put('/v2/fake/body-with-file-schema', 'FakeApi@testBodyWithFileSchema'); $router->put('/v2/fake/body-with-file-schema', 'FakeApi@testBodyWithFileSchema');