forked from loafle/openapi-generator-original
update c# samples
This commit is contained in:
@@ -114,6 +114,7 @@ Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
*BodyApi* | [**TestBinaryGif**](docs/BodyApi.md#testbinarygif) | **POST** /binary/gif | Test binary (gif) response body
|
||||
*BodyApi* | [**TestBodyApplicationOctetstreamBinary**](docs/BodyApi.md#testbodyapplicationoctetstreambinary) | **POST** /body/application/octetstream/binary | Test body parameter(s)
|
||||
*BodyApi* | [**TestBodyMultipartFormdataArrayOfBinary**](docs/BodyApi.md#testbodymultipartformdataarrayofbinary) | **POST** /body/application/octetstream/array_of_binary | Test array of binary in multipart mime
|
||||
*BodyApi* | [**TestEchoBodyFreeFormObjectResponseString**](docs/BodyApi.md#testechobodyfreeformobjectresponsestring) | **POST** /echo/body/FreeFormObject/response_string | Test free form object
|
||||
*BodyApi* | [**TestEchoBodyPet**](docs/BodyApi.md#testechobodypet) | **POST** /echo/body/Pet | Test body parameter(s)
|
||||
*BodyApi* | [**TestEchoBodyPetResponseString**](docs/BodyApi.md#testechobodypetresponsestring) | **POST** /echo/body/Pet/response_string | Test empty response body
|
||||
|
||||
@@ -404,6 +404,25 @@ paths:
|
||||
summary: Test binary (gif) response body
|
||||
tags:
|
||||
- body
|
||||
/body/application/octetstream/array_of_binary:
|
||||
post:
|
||||
description: Test array of binary in multipart mime
|
||||
operationId: test/body/multipart/formdata/array_of_binary
|
||||
requestBody:
|
||||
content:
|
||||
multipart/form-data:
|
||||
schema:
|
||||
$ref: '#/components/schemas/test_body_multipart_formdata_array_of_binary_request'
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
text/plain:
|
||||
schema:
|
||||
type: string
|
||||
description: Successful operation
|
||||
summary: Test array of binary in multipart mime
|
||||
tags:
|
||||
- body
|
||||
components:
|
||||
requestBodies:
|
||||
Pet:
|
||||
@@ -634,4 +653,14 @@ components:
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/Bird'
|
||||
- $ref: '#/components/schemas/Category'
|
||||
test_body_multipart_formdata_array_of_binary_request:
|
||||
properties:
|
||||
files:
|
||||
items:
|
||||
format: binary
|
||||
type: string
|
||||
type: array
|
||||
required:
|
||||
- files
|
||||
type: object
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ All URIs are relative to *http://localhost:3000*
|
||||
|--------|--------------|-------------|
|
||||
| [**TestBinaryGif**](BodyApi.md#testbinarygif) | **POST** /binary/gif | Test binary (gif) response body |
|
||||
| [**TestBodyApplicationOctetstreamBinary**](BodyApi.md#testbodyapplicationoctetstreambinary) | **POST** /body/application/octetstream/binary | Test body parameter(s) |
|
||||
| [**TestBodyMultipartFormdataArrayOfBinary**](BodyApi.md#testbodymultipartformdataarrayofbinary) | **POST** /body/application/octetstream/array_of_binary | Test array of binary in multipart mime |
|
||||
| [**TestEchoBodyFreeFormObjectResponseString**](BodyApi.md#testechobodyfreeformobjectresponsestring) | **POST** /echo/body/FreeFormObject/response_string | Test free form object |
|
||||
| [**TestEchoBodyPet**](BodyApi.md#testechobodypet) | **POST** /echo/body/Pet | Test body parameter(s) |
|
||||
| [**TestEchoBodyPetResponseString**](BodyApi.md#testechobodypetresponsestring) | **POST** /echo/body/Pet/response_string | Test empty response body |
|
||||
@@ -181,6 +182,97 @@ No authorization required
|
||||
- **Accept**: text/plain
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
| **200** | Successful operation | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
<a id="testbodymultipartformdataarrayofbinary"></a>
|
||||
# **TestBodyMultipartFormdataArrayOfBinary**
|
||||
> string TestBodyMultipartFormdataArrayOfBinary (List<System.IO.Stream> files)
|
||||
|
||||
Test array of binary in multipart mime
|
||||
|
||||
Test array of binary in multipart mime
|
||||
|
||||
### 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 TestBodyMultipartFormdataArrayOfBinaryExample
|
||||
{
|
||||
public static void Main()
|
||||
{
|
||||
Configuration config = new Configuration();
|
||||
config.BasePath = "http://localhost:3000";
|
||||
var apiInstance = new BodyApi(config);
|
||||
var files = new List<System.IO.Stream>(); // List<System.IO.Stream> |
|
||||
|
||||
try
|
||||
{
|
||||
// Test array of binary in multipart mime
|
||||
string result = apiInstance.TestBodyMultipartFormdataArrayOfBinary(files);
|
||||
Debug.WriteLine(result);
|
||||
}
|
||||
catch (ApiException e)
|
||||
{
|
||||
Debug.Print("Exception when calling BodyApi.TestBodyMultipartFormdataArrayOfBinary: " + e.Message);
|
||||
Debug.Print("Status Code: " + e.ErrorCode);
|
||||
Debug.Print(e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Using the TestBodyMultipartFormdataArrayOfBinaryWithHttpInfo variant
|
||||
This returns an ApiResponse object which contains the response data, status code and headers.
|
||||
|
||||
```csharp
|
||||
try
|
||||
{
|
||||
// Test array of binary in multipart mime
|
||||
ApiResponse<string> response = apiInstance.TestBodyMultipartFormdataArrayOfBinaryWithHttpInfo(files);
|
||||
Debug.Write("Status Code: " + response.StatusCode);
|
||||
Debug.Write("Response Headers: " + response.Headers);
|
||||
Debug.Write("Response Body: " + response.Data);
|
||||
}
|
||||
catch (ApiException e)
|
||||
{
|
||||
Debug.Print("Exception when calling BodyApi.TestBodyMultipartFormdataArrayOfBinaryWithHttpInfo: " + e.Message);
|
||||
Debug.Print("Status Code: " + e.ErrorCode);
|
||||
Debug.Print(e.StackTrace);
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------|------|-------------|-------|
|
||||
| **files** | **List<System.IO.Stream>** | | |
|
||||
|
||||
### Return type
|
||||
|
||||
**string**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: text/plain
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
|
||||
@@ -72,6 +72,29 @@ namespace Org.OpenAPITools.Api
|
||||
/// <returns>ApiResponse of string</returns>
|
||||
ApiResponse<string> TestBodyApplicationOctetstreamBinaryWithHttpInfo(System.IO.Stream? body = default(System.IO.Stream?), int operationIndex = 0);
|
||||
/// <summary>
|
||||
/// Test array of binary in multipart mime
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Test array of binary in multipart mime
|
||||
/// </remarks>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="files"></param>
|
||||
/// <param name="operationIndex">Index associated with the operation.</param>
|
||||
/// <returns>string</returns>
|
||||
string TestBodyMultipartFormdataArrayOfBinary(List<System.IO.Stream> files, int operationIndex = 0);
|
||||
|
||||
/// <summary>
|
||||
/// Test array of binary in multipart mime
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Test array of binary in multipart mime
|
||||
/// </remarks>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="files"></param>
|
||||
/// <param name="operationIndex">Index associated with the operation.</param>
|
||||
/// <returns>ApiResponse of string</returns>
|
||||
ApiResponse<string> TestBodyMultipartFormdataArrayOfBinaryWithHttpInfo(List<System.IO.Stream> files, int operationIndex = 0);
|
||||
/// <summary>
|
||||
/// Test free form object
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
@@ -221,6 +244,31 @@ namespace Org.OpenAPITools.Api
|
||||
/// <returns>Task of ApiResponse (string)</returns>
|
||||
System.Threading.Tasks.Task<ApiResponse<string>> TestBodyApplicationOctetstreamBinaryWithHttpInfoAsync(System.IO.Stream? body = default(System.IO.Stream?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
|
||||
/// <summary>
|
||||
/// Test array of binary in multipart mime
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Test array of binary in multipart mime
|
||||
/// </remarks>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="files"></param>
|
||||
/// <param name="operationIndex">Index associated with the operation.</param>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns>Task of string</returns>
|
||||
System.Threading.Tasks.Task<string> TestBodyMultipartFormdataArrayOfBinaryAsync(List<System.IO.Stream> files, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
|
||||
|
||||
/// <summary>
|
||||
/// Test array of binary in multipart mime
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Test array of binary in multipart mime
|
||||
/// </remarks>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="files"></param>
|
||||
/// <param name="operationIndex">Index associated with the operation.</param>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns>Task of ApiResponse (string)</returns>
|
||||
System.Threading.Tasks.Task<ApiResponse<string>> TestBodyMultipartFormdataArrayOfBinaryWithHttpInfoAsync(List<System.IO.Stream> files, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
|
||||
/// <summary>
|
||||
/// Test free form object
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
@@ -700,6 +748,158 @@ namespace Org.OpenAPITools.Api
|
||||
return localVarResponse;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test array of binary in multipart mime Test array of binary in multipart mime
|
||||
/// </summary>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="files"></param>
|
||||
/// <param name="operationIndex">Index associated with the operation.</param>
|
||||
/// <returns>string</returns>
|
||||
public string TestBodyMultipartFormdataArrayOfBinary(List<System.IO.Stream> files, int operationIndex = 0)
|
||||
{
|
||||
Org.OpenAPITools.Client.ApiResponse<string> localVarResponse = TestBodyMultipartFormdataArrayOfBinaryWithHttpInfo(files);
|
||||
return localVarResponse.Data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test array of binary in multipart mime Test array of binary in multipart mime
|
||||
/// </summary>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="files"></param>
|
||||
/// <param name="operationIndex">Index associated with the operation.</param>
|
||||
/// <returns>ApiResponse of string</returns>
|
||||
public Org.OpenAPITools.Client.ApiResponse<string> TestBodyMultipartFormdataArrayOfBinaryWithHttpInfo(List<System.IO.Stream> files, int operationIndex = 0)
|
||||
{
|
||||
// verify the required parameter 'files' is set
|
||||
if (files == null)
|
||||
{
|
||||
throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'files' when calling BodyApi->TestBodyMultipartFormdataArrayOfBinary");
|
||||
}
|
||||
|
||||
Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions();
|
||||
|
||||
string[] _contentTypes = new string[] {
|
||||
"multipart/form-data"
|
||||
};
|
||||
|
||||
// to determine the Accept header
|
||||
string[] _accepts = new string[] {
|
||||
"text/plain"
|
||||
};
|
||||
|
||||
var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
|
||||
if (localVarContentType != null)
|
||||
{
|
||||
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
|
||||
}
|
||||
|
||||
var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts);
|
||||
if (localVarAccept != null)
|
||||
{
|
||||
localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
|
||||
}
|
||||
|
||||
foreach (var file in files)
|
||||
{
|
||||
localVarRequestOptions.FileParameters.Add("files", file);
|
||||
}
|
||||
|
||||
localVarRequestOptions.Operation = "BodyApi.TestBodyMultipartFormdataArrayOfBinary";
|
||||
localVarRequestOptions.OperationIndex = operationIndex;
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
var localVarResponse = this.Client.Post<string>("/body/application/octetstream/array_of_binary", localVarRequestOptions, this.Configuration);
|
||||
if (this.ExceptionFactory != null)
|
||||
{
|
||||
Exception _exception = this.ExceptionFactory("TestBodyMultipartFormdataArrayOfBinary", localVarResponse);
|
||||
if (_exception != null)
|
||||
{
|
||||
throw _exception;
|
||||
}
|
||||
}
|
||||
|
||||
return localVarResponse;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test array of binary in multipart mime Test array of binary in multipart mime
|
||||
/// </summary>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="files"></param>
|
||||
/// <param name="operationIndex">Index associated with the operation.</param>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns>Task of string</returns>
|
||||
public async System.Threading.Tasks.Task<string> TestBodyMultipartFormdataArrayOfBinaryAsync(List<System.IO.Stream> files, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
|
||||
{
|
||||
Org.OpenAPITools.Client.ApiResponse<string> localVarResponse = await TestBodyMultipartFormdataArrayOfBinaryWithHttpInfoAsync(files, operationIndex, cancellationToken).ConfigureAwait(false);
|
||||
return localVarResponse.Data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test array of binary in multipart mime Test array of binary in multipart mime
|
||||
/// </summary>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="files"></param>
|
||||
/// <param name="operationIndex">Index associated with the operation.</param>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns>Task of ApiResponse (string)</returns>
|
||||
public async System.Threading.Tasks.Task<Org.OpenAPITools.Client.ApiResponse<string>> TestBodyMultipartFormdataArrayOfBinaryWithHttpInfoAsync(List<System.IO.Stream> files, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
|
||||
{
|
||||
// verify the required parameter 'files' is set
|
||||
if (files == null)
|
||||
{
|
||||
throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'files' when calling BodyApi->TestBodyMultipartFormdataArrayOfBinary");
|
||||
}
|
||||
|
||||
|
||||
Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions();
|
||||
|
||||
string[] _contentTypes = new string[] {
|
||||
"multipart/form-data"
|
||||
};
|
||||
|
||||
// to determine the Accept header
|
||||
string[] _accepts = new string[] {
|
||||
"text/plain"
|
||||
};
|
||||
|
||||
var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
|
||||
if (localVarContentType != null)
|
||||
{
|
||||
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
|
||||
}
|
||||
|
||||
var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts);
|
||||
if (localVarAccept != null)
|
||||
{
|
||||
localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
|
||||
}
|
||||
|
||||
foreach (var file in files)
|
||||
{
|
||||
localVarRequestOptions.FileParameters.Add("files", file);
|
||||
}
|
||||
|
||||
localVarRequestOptions.Operation = "BodyApi.TestBodyMultipartFormdataArrayOfBinary";
|
||||
localVarRequestOptions.OperationIndex = operationIndex;
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
var localVarResponse = await this.AsynchronousClient.PostAsync<string>("/body/application/octetstream/array_of_binary", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (this.ExceptionFactory != null)
|
||||
{
|
||||
Exception _exception = this.ExceptionFactory("TestBodyMultipartFormdataArrayOfBinary", localVarResponse);
|
||||
if (_exception != null)
|
||||
{
|
||||
throw _exception;
|
||||
}
|
||||
}
|
||||
|
||||
return localVarResponse;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test free form object Test free form object
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user