[v2] (RFC) Csharp netcore generator supports UnityWebRequest library (#14870)

* Base impl

* Improve Unity support

* update samples

* Sync bool property

* Update samples

* Set support file property

* Address comments

* Fix test asmdef

* Fixes for WebGL support

* Add note about Unity version

* Add Unity Sample

---------

Co-authored-by: William Cheng <wing328hk@gmail.com>
This commit is contained in:
Brahim Hadriche 2023-03-10 01:17:50 -05:00 committed by GitHub
parent f9efb7b2fb
commit f3960b2116
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
307 changed files with 40822 additions and 6 deletions

View File

@ -0,0 +1,6 @@
# for .net Unity
generatorName: csharp-netcore
outputDir: samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest
inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
templateDir: modules/openapi-generator/src/main/resources/csharp-netcore
library: unityWebRequest

View File

@ -61,6 +61,7 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
protected static final String RESTSHARP = "restsharp";
protected static final String HTTPCLIENT = "httpclient";
protected static final String GENERICHOST = "generichost";
protected static final String UNITY_WEB_REQUEST = "unityWebRequest";
// Project Variable, determined from target framework. Not intended to be user-settable.
protected static final String TARGET_FRAMEWORK_IDENTIFIER = "targetFrameworkIdentifier";
@ -100,6 +101,7 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
protected boolean supportsRetry = Boolean.TRUE;
protected boolean supportsAsync = Boolean.TRUE;
protected boolean netStandard = Boolean.FALSE;
protected boolean supportsFileParameters = Boolean.TRUE;
protected boolean validatable = Boolean.TRUE;
protected Map<Character, String> regexModifiers;
@ -325,6 +327,8 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
+ "(Experimental. Subject to breaking changes without notice.)");
supportedLibraries.put(HTTPCLIENT, "HttpClient (https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient) "
+ "(Experimental. Subject to breaking changes without notice.)");
supportedLibraries.put(UNITY_WEB_REQUEST, "UnityWebRequest (...) "
+ "(Experimental. Subject to breaking changes without notice.)");
supportedLibraries.put(RESTSHARP, "RestSharp (https://github.com/restsharp/RestSharp)");
CliOption libraryOption = new CliOption(CodegenConstants.LIBRARY, "HTTP library template (sub-template) to use");
@ -701,6 +705,10 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
setLibrary(HTTPCLIENT);
additionalProperties.put("useHttpClient", true);
needsUriBuilder = true;
} else if (UNITY_WEB_REQUEST.equals(getLibrary())) {
setLibrary(UNITY_WEB_REQUEST);
additionalProperties.put("useUnityWebRequest", true);
needsUriBuilder = true;
} else {
throw new RuntimeException("Invalid HTTP library " + getLibrary() + ". Only restsharp, httpclient, and generichost are supported.");
}
@ -780,6 +788,7 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
syncBooleanProperty(additionalProperties, CodegenConstants.OPTIONAL_METHOD_ARGUMENT, this::setOptionalMethodArgumentFlag, optionalMethodArgumentFlag);
syncBooleanProperty(additionalProperties, CodegenConstants.NON_PUBLIC_API, this::setNonPublicApi, isNonPublicApi());
syncBooleanProperty(additionalProperties, CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP, this::setUseOneOfDiscriminatorLookup, this.useOneOfDiscriminatorLookup);
syncBooleanProperty(additionalProperties, "supportsFileParameters", this::setSupportsFileParameters, this.supportsFileParameters);
final String testPackageName = testPackageName();
String packageFolder = sourceFolder + File.separator + packageName;
@ -816,6 +825,20 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
addGenericHostSupportingFiles(clientPackageDir, packageFolder, excludeTests, testPackageFolder, testPackageName, modelPackageDir);
additionalProperties.put("apiDocPath", apiDocPath + File.separatorChar + "apis");
additionalProperties.put("modelDocPath", modelDocPath + File.separatorChar + "models");
} else if (UNITY_WEB_REQUEST.equals(getLibrary())) {
additionalProperties.put(CodegenConstants.VALIDATABLE, false);
setValidatable(false);
setSupportsRetry(false);
setSupportsAsync(true);
// Some consoles and tvOS do not support either Application.persistentDataPath or will refuse to
// compile/link if you even reference GetTempPath as well.
additionalProperties.put("supportsFileParameters", false);
setSupportsFileParameters(false);
addSupportingFiles(clientPackageDir, packageFolder, excludeTests, testPackageFolder, testPackageName, modelPackageDir, authPackageDir);
supportingFiles.add(new SupportingFile("ConnectionException.mustache", clientPackageDir, "ConnectionException.cs"));
supportingFiles.add(new SupportingFile("UnexpectedResponseException.mustache", clientPackageDir, "UnexpectedResponseException.cs"));
} else { //restsharp
addSupportingFiles(clientPackageDir, packageFolder, excludeTests, testPackageFolder, testPackageName, modelPackageDir, authPackageDir);
additionalProperties.put("apiDocPath", apiDocPath);
@ -911,14 +934,24 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));
supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore"));
supportingFiles.add(new SupportingFile("Solution.mustache", "", packageName + ".sln"));
supportingFiles.add(new SupportingFile("netcore_project.mustache", packageFolder, packageName + ".csproj"));
if (Boolean.FALSE.equals(excludeTests.get())) {
supportingFiles.add(new SupportingFile("netcore_testproject.mustache", testPackageFolder, testPackageName + ".csproj"));
if (UNITY_WEB_REQUEST.equals(getLibrary())) {
supportingFiles.add(new SupportingFile("asmdef.mustache", packageFolder, packageName + ".asmdef"));
} else {
supportingFiles.add(new SupportingFile("Solution.mustache", "", packageName + ".sln"));
supportingFiles.add(new SupportingFile("netcore_project.mustache", packageFolder, packageName + ".csproj"));
}
supportingFiles.add(new SupportingFile("appveyor.mustache", "", "appveyor.yml"));
if (Boolean.FALSE.equals(excludeTests.get())) {
if (UNITY_WEB_REQUEST.equals(getLibrary())) {
supportingFiles.add(new SupportingFile("asmdef_test.mustache", testPackageFolder, testPackageName + ".asmdef"));
} else {
supportingFiles.add(new SupportingFile("netcore_testproject.mustache", testPackageFolder, testPackageName + ".csproj"));
}
}
if (!UNITY_WEB_REQUEST.equals(getLibrary())) {
supportingFiles.add(new SupportingFile("appveyor.mustache", "", "appveyor.yml"));
}
supportingFiles.add(new SupportingFile("AbstractOpenAPISchema.mustache", modelPackageDir, "AbstractOpenAPISchema.cs"));
}
@ -1048,6 +1081,10 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
this.supportsAsync = supportsAsync;
}
public void setSupportsFileParameters(Boolean supportsFileParameters) {
this.supportsFileParameters = supportsFileParameters;
}
public void setSupportsRetry(Boolean supportsRetry) {
this.supportsRetry = supportsRetry;
}

View File

@ -35,10 +35,12 @@ namespace {{packageName}}.Client
/// </summary>
public Dictionary<string, string> FormParameters { get; set; }
{{#supportsFileParameters}}
/// <summary>
/// File parameters to be sent along with the request.
/// </summary>
public Multimap<string, Stream> FileParameters { get; set; }
{{/supportsFileParameters}}
/// <summary>
/// Cookies to be sent along with the request.
@ -76,7 +78,9 @@ namespace {{packageName}}.Client
QueryParameters = new Multimap<string, string>();
HeaderParameters = new Multimap<string, string>();
FormParameters = new Dictionary<string, string>();
{{#supportsFileParameters}}
FileParameters = new Multimap<string, Stream>();
{{/supportsFileParameters}}
Cookies = new List<Cookie>();
}
}

View File

@ -361,13 +361,17 @@ namespace {{packageName}}.{{apiPackage}}
{{#required}}
{{#isFile}}
{{#isArray}}
{{#supportsFileParameters}}
foreach (var file in {{paramName}})
{
localVarRequestOptions.FileParameters.Add("{{baseName}}", file);
}
{{/supportsFileParameters}}
{{/isArray}}
{{^isArray}}
{{#supportsFileParameters}}
localVarRequestOptions.FileParameters.Add("{{baseName}}", {{paramName}});
{{/supportsFileParameters}}
{{/isArray}}
{{/isFile}}
{{^isFile}}
@ -379,13 +383,17 @@ namespace {{packageName}}.{{apiPackage}}
{
{{#isFile}}
{{#isArray}}
{{#supportsFileParameters}}
foreach (var file in {{paramName}})
{
localVarRequestOptions.FileParameters.Add("{{baseName}}", file);
}
{{/supportsFileParameters}}
{{/isArray}}
{{^isArray}}
{{#supportsFileParameters}}
localVarRequestOptions.FileParameters.Add("{{baseName}}", {{paramName}});
{{/supportsFileParameters}}
{{/isArray}}
{{/isFile}}
{{^isFile}}
@ -602,13 +610,17 @@ namespace {{packageName}}.{{apiPackage}}
{{#required}}
{{#isFile}}
{{#isArray}}
{{#supportsFileParameters}}
foreach (var file in {{paramName}})
{
localVarRequestOptions.FileParameters.Add("{{baseName}}", file);
}
{{/supportsFileParameters}}
{{/isArray}}
{{^isArray}}
{{#supportsFileParameters}}
localVarRequestOptions.FileParameters.Add("{{baseName}}", {{paramName}});
{{/supportsFileParameters}}
{{/isArray}}
{{/isFile}}
{{^isFile}}
@ -620,13 +632,17 @@ namespace {{packageName}}.{{apiPackage}}
{
{{#isFile}}
{{#isArray}}
{{#supportsFileParameters}}
foreach (var file in {{paramName}})
{
localVarRequestOptions.FileParameters.Add("{{baseName}}", file);
}
{{/supportsFileParameters}}
{{/isArray}}
{{^isArray}}
{{#supportsFileParameters}}
localVarRequestOptions.FileParameters.Add("{{baseName}}", {{paramName}});
{{/supportsFileParameters}}
{{/isArray}}
{{/isFile}}
{{^isFile}}

View File

@ -0,0 +1,639 @@
{{>partial_header}}
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters;
using System.Text;
using System.Threading;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using ErrorEventArgs = Newtonsoft.Json.Serialization.ErrorEventArgs;
using System.Net.Http;
using System.Net.Http.Headers;
using UnityEngine.Networking;
using UnityEngine;
namespace {{packageName}}.Client
{
/// <summary>
/// To Serialize/Deserialize JSON using our custom logic, but only when ContentType is JSON.
/// </summary>
internal class CustomJsonCodec
{
private readonly IReadableConfiguration _configuration;
private static readonly string _contentType = "application/json";
private readonly JsonSerializerSettings _serializerSettings = new JsonSerializerSettings
{
// OpenAPI generated types generally hide default constructors.
ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor,
ContractResolver = new DefaultContractResolver
{
NamingStrategy = new CamelCaseNamingStrategy
{
OverrideSpecifiedNames = false
}
}
};
public CustomJsonCodec(IReadableConfiguration configuration)
{
_configuration = configuration;
}
public CustomJsonCodec(JsonSerializerSettings serializerSettings, IReadableConfiguration configuration)
{
_serializerSettings = serializerSettings;
_configuration = configuration;
}
/// <summary>
/// Serialize the object into a JSON string.
/// </summary>
/// <param name="obj">Object to be serialized.</param>
/// <returns>A JSON string.</returns>
public string Serialize(object obj)
{
if (obj != null && obj is {{{packageName}}}.{{modelPackage}}.AbstractOpenAPISchema)
{
// the object to be serialized is an oneOf/anyOf schema
return (({{{packageName}}}.{{modelPackage}}.AbstractOpenAPISchema)obj).ToJson();
}
else
{
return JsonConvert.SerializeObject(obj, _serializerSettings);
}
}
public T Deserialize<T>(UnityWebRequest request)
{
var result = (T) Deserialize(request, typeof(T));
return result;
}
/// <summary>
/// Deserialize the JSON string into a proper object.
/// </summary>
/// <param name="response">The UnityWebRequest after it has a response.</param>
/// <param name="type">Object type.</param>
/// <returns>Object representation of the JSON string.</returns>
internal object Deserialize(UnityWebRequest request, Type type)
{
if (type == typeof(byte[])) // return byte array
{
return request.downloadHandler.data;
}
// TODO: ? if (type.IsAssignableFrom(typeof(Stream)))
if (type == typeof(Stream))
{
// NOTE: Ignoring Content-Disposition filename support, since not all platforms
// have a location on disk to write arbitrary data (tvOS, consoles).
return new MemoryStream(request.downloadHandler.data);
}
if (type.Name.StartsWith("System.Nullable`1[[System.DateTime")) // return a datetime object
{
return DateTime.Parse(request.downloadHandler.text, null, System.Globalization.DateTimeStyles.RoundtripKind);
}
if (type == typeof(string) || type.Name.StartsWith("System.Nullable")) // return primitive type
{
return Convert.ChangeType(request.downloadHandler.text, type);
}
var contentType = request.GetResponseHeader("Content-Type");
if (!string.IsNullOrEmpty(contentType) && contentType.Contains("application/json"))
{
var text = request.downloadHandler?.text;
// Generated APIs that don't expect a return value provide System.Object as the type
if (type == typeof(System.Object) && (string.IsNullOrEmpty(text) || text.Trim() == "null"))
{
return null;
}
if (request.responseCode >= 200 && request.responseCode < 300)
{
try
{
// Deserialize as a model
return JsonConvert.DeserializeObject(text, type, _serializerSettings);
}
catch (Exception e)
{
throw new UnexpectedResponseException(request, type, e.ToString());
}
}
else
{
throw new ApiException((int)request.responseCode, request.error, text);
}
}
if (type != typeof(System.Object) && request.responseCode >= 200 && request.responseCode < 300)
{
throw new UnexpectedResponseException(request, type);
}
return null;
}
public string RootElement { get; set; }
public string Namespace { get; set; }
public string DateFormat { get; set; }
public string ContentType
{
get { return _contentType; }
set { throw new InvalidOperationException("Not allowed to set content type."); }
}
}
/// <summary>
/// Provides a default implementation of an Api client (both synchronous and asynchronous implementations),
/// encapsulating general REST accessor use cases.
/// </summary>
/// <remarks>
/// The Dispose method will manage the HttpClient lifecycle when not passed by constructor.
/// </remarks>
{{>visibility}} partial class ApiClient : IDisposable, ISynchronousClient{{#supportsAsync}}, IAsynchronousClient{{/supportsAsync}}
{
private readonly string _baseUrl;
/// <summary>
/// Specifies the settings on a <see cref="JsonSerializer" /> object.
/// These settings can be adjusted to accommodate custom serialization rules.
/// </summary>
public JsonSerializerSettings SerializerSettings { get; set; } = new JsonSerializerSettings
{
// OpenAPI generated types generally hide default constructors.
ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor,
ContractResolver = new DefaultContractResolver
{
NamingStrategy = new CamelCaseNamingStrategy
{
OverrideSpecifiedNames = false
}
}
};
/// <summary>
/// Initializes a new instance of the <see cref="ApiClient" />, defaulting to the global configurations' base url.
/// </summary>
public ApiClient() :
this({{packageName}}.Client.GlobalConfiguration.Instance.BasePath)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="ApiClient" />.
/// </summary>
/// <param name="basePath">The target service's base path in URL format.</param>
/// <exception cref="ArgumentException"></exception>
public ApiClient(string basePath)
{
if (string.IsNullOrEmpty(basePath)) throw new ArgumentException("basePath cannot be empty");
_baseUrl = basePath;
}
/// <summary>
/// Disposes resources if they were created by us
/// </summary>
public void Dispose()
{
}
/// <summary>
/// Provides all logic for constructing a new UnityWebRequest.
/// At this point, all information for querying the service is known. Here, it is simply
/// mapped into the UnityWebRequest.
/// </summary>
/// <param name="method">The http verb.</param>
/// <param name="path">The target path (or resource).</param>
/// <param name="options">The additional request options.</param>
/// <param name="configuration">A per-request configuration object. It is assumed that any merge with
/// GlobalConfiguration has been done before calling this method.</param>
/// <returns>[private] A new UnityWebRequest instance.</returns>
/// <exception cref="ArgumentNullException"></exception>
private UnityWebRequest NewRequest<T>(
string method,
string path,
RequestOptions options,
IReadableConfiguration configuration)
{
if (path == null) throw new ArgumentNullException("path");
if (options == null) throw new ArgumentNullException("options");
if (configuration == null) throw new ArgumentNullException("configuration");
WebRequestPathBuilder builder = new WebRequestPathBuilder(_baseUrl, path);
builder.AddPathParameters(options.PathParameters);
builder.AddQueryParameters(options.QueryParameters);
string contentType = null;
if (options.HeaderParameters != null && options.HeaderParameters.ContainsKey("Content-Type"))
{
var contentTypes = options.HeaderParameters["Content-Type"];
contentType = contentTypes.FirstOrDefault();
}
var uri = builder.GetFullUri();
UnityWebRequest request = null;
if (contentType == "multipart/form-data")
{
var formData = new List<IMultipartFormSection>();
foreach (var formParameter in options.FormParameters)
{
formData.Add(new MultipartFormDataSection(formParameter.Key, formParameter.Value));
}
request = UnityWebRequest.Post(uri, formData);
request.method = method;
}
else if (contentType == "application/x-www-form-urlencoded")
{
var form = new WWWForm();
foreach (var kvp in options.FormParameters)
{
form.AddField(kvp.Key, kvp.Value);
}
request = UnityWebRequest.Post(uri, form);
request.method = method;
}
else if (options.Data != null)
{
var serializer = new CustomJsonCodec(SerializerSettings, configuration);
var jsonData = serializer.Serialize(options.Data);
// Making a post body application/json encoded is whack with UnityWebRequest.
// See: https://stackoverflow.com/questions/68156230/unitywebrequest-post-not-sending-body
request = UnityWebRequest.Put(uri, jsonData);
request.method = method;
request.SetRequestHeader("Content-Type", "application/json");
}
else
{
request = new UnityWebRequest(builder.GetFullUri(), method);
}
if (request.downloadHandler == null && typeof(T) != typeof(System.Object))
{
request.downloadHandler = new DownloadHandlerBuffer();
}
#if UNITY_EDITOR || !UNITY_WEBGL
if (configuration.UserAgent != null)
{
request.SetRequestHeader("User-Agent", configuration.UserAgent);
}
#endif
if (configuration.DefaultHeaders != null)
{
foreach (var headerParam in configuration.DefaultHeaders)
{
request.SetRequestHeader(headerParam.Key, headerParam.Value);
}
}
if (options.HeaderParameters != null)
{
foreach (var headerParam in options.HeaderParameters)
{
foreach (var value in headerParam.Value)
{
// Todo make content headers actually content headers
request.SetRequestHeader(headerParam.Key, value);
}
}
}
if (options.Cookies != null && options.Cookies.Count > 0)
{
#if UNITY_WEBGL
throw new System.InvalidOperationException("UnityWebRequest does not support setting cookies in WebGL");
#else
if (options.Cookies.Count != 1)
{
UnityEngine.Debug.LogError("Only one cookie supported, ignoring others");
}
request.SetRequestHeader("Cookie", options.Cookies[0].ToString());
#endif
}
return request;
}
partial void InterceptRequest(UnityWebRequest req, string path, RequestOptions options, IReadableConfiguration configuration);
partial void InterceptResponse(UnityWebRequest req, string path, RequestOptions options, IReadableConfiguration configuration, ref object responseData);
private ApiResponse<T> ToApiResponse<T>(UnityWebRequest request, object responseData)
{
T result = (T) responseData;
var transformed = new ApiResponse<T>((HttpStatusCode)request.responseCode, new Multimap<string, string>({{#caseInsensitiveResponseHeaders}}StringComparer.OrdinalIgnoreCase{{/caseInsensitiveResponseHeaders}}), result, request.downloadHandler?.text ?? "")
{
ErrorText = request.error,
Cookies = new List<Cookie>()
};
// process response headers, e.g. Access-Control-Allow-Methods
var responseHeaders = request.GetResponseHeaders();
if (responseHeaders != null)
{
foreach (var responseHeader in request.GetResponseHeaders())
{
transformed.Headers.Add(responseHeader.Key, ClientUtils.ParameterToString(responseHeader.Value));
}
}
return transformed;
}
private async Task<ApiResponse<T>> ExecAsync<T>(
UnityWebRequest request,
string path,
RequestOptions options,
IReadableConfiguration configuration,
System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
var deserializer = new CustomJsonCodec(SerializerSettings, configuration);
using (request)
{
if (configuration.Timeout > 0)
{
request.timeout = (int)Math.Ceiling(configuration.Timeout / 1000.0f);
}
if (configuration.Proxy != null)
{
throw new InvalidOperationException("Configuration `Proxy` not supported by UnityWebRequest");
}
if (configuration.ClientCertificates != null)
{
// Only Android/iOS/tvOS/Standalone players can support certificates, and this
// implementation is intended to work on all platforms.
//
// TODO: Could optionally allow support for this on these platforms.
//
// See: https://docs.unity3d.com/ScriptReference/Networking.CertificateHandler.html
throw new InvalidOperationException("Configuration `ClientCertificates` not supported by UnityWebRequest on all platforms");
}
InterceptRequest(request, path, options, configuration);
var asyncOp = request.SendWebRequest();
TaskCompletionSource<UnityWebRequest.Result> tsc = new TaskCompletionSource<UnityWebRequest.Result>();
asyncOp.completed += (_) => tsc.TrySetResult(request.result);
using (var tokenRegistration = cancellationToken.Register(request.Abort, true))
{
await tsc.Task;
}
if (request.result == UnityWebRequest.Result.ConnectionError ||
request.result == UnityWebRequest.Result.DataProcessingError)
{
throw new ConnectionException(request);
}
object responseData = deserializer.Deserialize<T>(request);
// if the response type is oneOf/anyOf, call FromJSON to deserialize the data
if (typeof({{{packageName}}}.{{modelPackage}}.AbstractOpenAPISchema).IsAssignableFrom(typeof(T)))
{
responseData = (T) typeof(T).GetMethod("FromJson").Invoke(null, new object[] { new ByteArrayContent(request.downloadHandler.data) });
}
else if (typeof(T).Name == "Stream") // for binary response
{
responseData = (T) (object) new MemoryStream(request.downloadHandler.data);
}
InterceptResponse(request, path, options, configuration, ref responseData);
return ToApiResponse<T>(request, responseData);
}
}
{{#supportsAsync}}
#region IAsynchronousClient
/// <summary>
/// Make a HTTP GET request (async).
/// </summary>
/// <param name="path">The target path (or resource).</param>
/// <param name="options">The additional request options.</param>
/// <param name="configuration">A per-request configuration object. It is assumed that any merge with
/// GlobalConfiguration has been done before calling this method.</param>
/// <param name="cancellationToken">Token that enables callers to cancel the request.</param>
/// <returns>A Task containing ApiResponse</returns>
public Task<ApiResponse<T>> GetAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
var config = configuration ?? GlobalConfiguration.Instance;
return ExecAsync<T>(NewRequest<T>("GET", path, options, config), path, options, config, cancellationToken);
}
/// <summary>
/// Make a HTTP POST request (async).
/// </summary>
/// <param name="path">The target path (or resource).</param>
/// <param name="options">The additional request options.</param>
/// <param name="configuration">A per-request configuration object. It is assumed that any merge with
/// GlobalConfiguration has been done before calling this method.</param>
/// <param name="cancellationToken">Token that enables callers to cancel the request.</param>
/// <returns>A Task containing ApiResponse</returns>
public Task<ApiResponse<T>> PostAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
var config = configuration ?? GlobalConfiguration.Instance;
return ExecAsync<T>(NewRequest<T>("POST", path, options, config), path, options, config, cancellationToken);
}
/// <summary>
/// Make a HTTP PUT request (async).
/// </summary>
/// <param name="path">The target path (or resource).</param>
/// <param name="options">The additional request options.</param>
/// <param name="configuration">A per-request configuration object. It is assumed that any merge with
/// GlobalConfiguration has been done before calling this method.</param>
/// <param name="cancellationToken">Token that enables callers to cancel the request.</param>
/// <returns>A Task containing ApiResponse</returns>
public Task<ApiResponse<T>> PutAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
var config = configuration ?? GlobalConfiguration.Instance;
return ExecAsync<T>(NewRequest<T>("PUT", path, options, config), path, options, config, cancellationToken);
}
/// <summary>
/// Make a HTTP DELETE request (async).
/// </summary>
/// <param name="path">The target path (or resource).</param>
/// <param name="options">The additional request options.</param>
/// <param name="configuration">A per-request configuration object. It is assumed that any merge with
/// GlobalConfiguration has been done before calling this method.</param>
/// <param name="cancellationToken">Token that enables callers to cancel the request.</param>
/// <returns>A Task containing ApiResponse</returns>
public Task<ApiResponse<T>> DeleteAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
var config = configuration ?? GlobalConfiguration.Instance;
return ExecAsync<T>(NewRequest<T>("DELETE", path, options, config), path, options, config, cancellationToken);
}
/// <summary>
/// Make a HTTP HEAD request (async).
/// </summary>
/// <param name="path">The target path (or resource).</param>
/// <param name="options">The additional request options.</param>
/// <param name="configuration">A per-request configuration object. It is assumed that any merge with
/// GlobalConfiguration has been done before calling this method.</param>
/// <param name="cancellationToken">Token that enables callers to cancel the request.</param>
/// <returns>A Task containing ApiResponse</returns>
public Task<ApiResponse<T>> HeadAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
var config = configuration ?? GlobalConfiguration.Instance;
return ExecAsync<T>(NewRequest<T>("HEAD", path, options, config), path, options, config, cancellationToken);
}
/// <summary>
/// Make a HTTP OPTION request (async).
/// </summary>
/// <param name="path">The target path (or resource).</param>
/// <param name="options">The additional request options.</param>
/// <param name="configuration">A per-request configuration object. It is assumed that any merge with
/// GlobalConfiguration has been done before calling this method.</param>
/// <param name="cancellationToken">Token that enables callers to cancel the request.</param>
/// <returns>A Task containing ApiResponse</returns>
public Task<ApiResponse<T>> OptionsAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
var config = configuration ?? GlobalConfiguration.Instance;
return ExecAsync<T>(NewRequest<T>("OPTIONS", path, options, config), path, options, config, cancellationToken);
}
/// <summary>
/// Make a HTTP PATCH request (async).
/// </summary>
/// <param name="path">The target path (or resource).</param>
/// <param name="options">The additional request options.</param>
/// <param name="configuration">A per-request configuration object. It is assumed that any merge with
/// GlobalConfiguration has been done before calling this method.</param>
/// <param name="cancellationToken">Token that enables callers to cancel the request.</param>
/// <returns>A Task containing ApiResponse</returns>
public Task<ApiResponse<T>> PatchAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
var config = configuration ?? GlobalConfiguration.Instance;
return ExecAsync<T>(NewRequest<T>("PATCH", path, options, config), path, options, config, cancellationToken);
}
#endregion IAsynchronousClient
{{/supportsAsync}}
#region ISynchronousClient
/// <summary>
/// Make a HTTP GET request (synchronous).
/// </summary>
/// <param name="path">The target path (or resource).</param>
/// <param name="options">The additional request options.</param>
/// <param name="configuration">A per-request configuration object. It is assumed that any merge with
/// GlobalConfiguration has been done before calling this method.</param>
/// <returns>A Task containing ApiResponse</returns>
public ApiResponse<T> Get<T>(string path, RequestOptions options, IReadableConfiguration configuration = null)
{
throw new System.NotImplementedException("UnityWebRequest does not support synchronous operation");
}
/// <summary>
/// Make a HTTP POST request (synchronous).
/// </summary>
/// <param name="path">The target path (or resource).</param>
/// <param name="options">The additional request options.</param>
/// <param name="configuration">A per-request configuration object. It is assumed that any merge with
/// GlobalConfiguration has been done before calling this method.</param>
/// <returns>A Task containing ApiResponse</returns>
public ApiResponse<T> Post<T>(string path, RequestOptions options, IReadableConfiguration configuration = null)
{
throw new System.NotImplementedException("UnityWebRequest does not support synchronous operation");
}
/// <summary>
/// Make a HTTP PUT request (synchronous).
/// </summary>
/// <param name="path">The target path (or resource).</param>
/// <param name="options">The additional request options.</param>
/// <param name="configuration">A per-request configuration object. It is assumed that any merge with
/// GlobalConfiguration has been done before calling this method.</param>
/// <returns>A Task containing ApiResponse</returns>
public ApiResponse<T> Put<T>(string path, RequestOptions options, IReadableConfiguration configuration = null)
{
throw new System.NotImplementedException("UnityWebRequest does not support synchronous operation");
}
/// <summary>
/// Make a HTTP DELETE request (synchronous).
/// </summary>
/// <param name="path">The target path (or resource).</param>
/// <param name="options">The additional request options.</param>
/// <param name="configuration">A per-request configuration object. It is assumed that any merge with
/// GlobalConfiguration has been done before calling this method.</param>
/// <returns>A Task containing ApiResponse</returns>
public ApiResponse<T> Delete<T>(string path, RequestOptions options, IReadableConfiguration configuration = null)
{
throw new System.NotImplementedException("UnityWebRequest does not support synchronous operation");
}
/// <summary>
/// Make a HTTP HEAD request (synchronous).
/// </summary>
/// <param name="path">The target path (or resource).</param>
/// <param name="options">The additional request options.</param>
/// <param name="configuration">A per-request configuration object. It is assumed that any merge with
/// GlobalConfiguration has been done before calling this method.</param>
/// <returns>A Task containing ApiResponse</returns>
public ApiResponse<T> Head<T>(string path, RequestOptions options, IReadableConfiguration configuration = null)
{
throw new System.NotImplementedException("UnityWebRequest does not support synchronous operation");
}
/// <summary>
/// Make a HTTP OPTION request (synchronous).
/// </summary>
/// <param name="path">The target path (or resource).</param>
/// <param name="options">The additional request options.</param>
/// <param name="configuration">A per-request configuration object. It is assumed that any merge with
/// GlobalConfiguration has been done before calling this method.</param>
/// <returns>A Task containing ApiResponse</returns>
public ApiResponse<T> Options<T>(string path, RequestOptions options, IReadableConfiguration configuration = null)
{
throw new System.NotImplementedException("UnityWebRequest does not support synchronous operation");
}
/// <summary>
/// Make a HTTP PATCH request (synchronous).
/// </summary>
/// <param name="path">The target path (or resource).</param>
/// <param name="options">The additional request options.</param>
/// <param name="configuration">A per-request configuration object. It is assumed that any merge with
/// GlobalConfiguration has been done before calling this method.</param>
/// <returns>A Task containing ApiResponse</returns>
public ApiResponse<T> Patch<T>(string path, RequestOptions options, IReadableConfiguration configuration = null)
{
throw new System.NotImplementedException("UnityWebRequest does not support synchronous operation");
}
#endregion ISynchronousClient
}
}

View File

@ -0,0 +1,21 @@
{{>partial_header}}
using System;
using UnityEngine.Networking;
namespace {{packageName}}.Client
{
public class ConnectionException : Exception
{
public UnityWebRequest.Result Result { get; private set; }
public string Error { get; private set; }
// NOTE: Cannot keep reference to the request since it will be disposed.
public ConnectionException(UnityWebRequest request)
: base($"result={request.result} error={request.error}")
{
Result = request.result;
Error = request.error ?? "";
}
}
}

View File

@ -0,0 +1,178 @@
# {{packageName}} - the C# library for the {{appName}}
{{#appDescriptionWithNewLines}}
{{{.}}}
{{/appDescriptionWithNewLines}}
This C# SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
- API version: {{appVersion}}
- SDK version: {{packageVersion}}
{{^hideGenerationTimestamp}}
- Build date: {{generatedDate}}
{{/hideGenerationTimestamp}}
- Build package: {{generatorClass}}
{{#infoUrl}}
For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
{{/infoUrl}}
<a name="version-support"></a>
## Version support
This generator should support all current LTS versions of Unity
- Unity 2020.3 (LTS) and up
- .NET Standard 2.1 / .NET Framework
<a name="dependencies"></a>
## Dependencies
- [Newtonsoft.Json](https://docs.unity3d.com/Packages/com.unity.nuget.newtonsoft-json@3.0/manual/index.html) - 3.0.2 or later
- [Unity Test Framework](https://docs.unity3d.com/Packages/com.unity.test-framework@1.1/manual/index.html) - 1.1.33 or later
<a name="installation"></a>
## Installation
Add the dependencies to `Packages/manifest.json`
```
{
"dependencies": {
...
"com.unity.nuget.newtonsoft-json": "3.0.2",
"com.unity.test-framework": "1.1.33",
}
}
```
Then use the namespaces:
```csharp
using {{packageName}}.{{apiPackage}};
using {{packageName}}.Client;
using {{packageName}}.{{modelPackage}};
```
<a name="getting-started"></a>
## Getting Started
```csharp
using System;
using System.Collections.Generic;
using UnityEngine;
using {{packageName}}.{{apiPackage}};
using {{packageName}}.Client;
using {{packageName}}.{{modelPackage}};
namespace {{packageName}}Example
{
{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}
public class {{operationId}}Example : MonoBehaviour
{
async void Start()
{
Configuration config = new Configuration();
config.BasePath = "{{{basePath}}}";
{{#hasAuthMethods}}
{{#authMethods}}
{{#isBasicBasic}}
// Configure HTTP basic authorization: {{{name}}}
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
{{/isBasicBasic}}
{{#isBasicBearer}}
// Configure Bearer token for authorization: {{{name}}}
config.AccessToken = "YOUR_BEARER_TOKEN";
{{/isBasicBearer}}
{{#isApiKey}}
// Configure API key authorization: {{{name}}}
config.ApiKey.Add("{{{keyParamName}}}", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// config.ApiKeyPrefix.Add("{{{keyParamName}}}", "Bearer");
{{/isApiKey}}
{{#isOAuth}}
// Configure OAuth2 access token for authorization: {{{name}}}
config.AccessToken = "YOUR_ACCESS_TOKEN";
{{/isOAuth}}
{{/authMethods}}
{{/hasAuthMethods}}
var apiInstance = new {{classname}}(config);
{{#allParams}}
{{#isPrimitiveType}}
var {{paramName}} = {{{example}}}; // {{{dataType}}} | {{{description}}}{{^required}} (optional) {{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
{{/isPrimitiveType}}
{{^isPrimitiveType}}
var {{paramName}} = new {{{dataType}}}(); // {{{dataType}}} | {{{description}}}{{^required}} (optional) {{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
{{/isPrimitiveType}}
{{/allParams}}
try
{
{{#summary}}
// {{{.}}}
{{/summary}}
{{#returnType}}{{{.}}} result = {{/returnType}}await apiInstance.{{{operationId}}}Async({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{#returnType}}
Debug.Log(result);{{/returnType}}
Debug.Log("Done!");
}
catch (ApiException e)
{
Debug.LogError("Exception when calling {{classname}}.{{operationId}}: " + e.Message );
Debug.LogError("Status Code: "+ e.ErrorCode);
Debug.LogError(e.StackTrace);
}
{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
}
}
}
```
<a name="documentation-for-api-endpoints"></a>
## Documentation for API Endpoints
All URIs are relative to *{{{basePath}}}*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{{summary}}}
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
<a name="documentation-for-models"></a>
## Documentation for Models
{{#modelPackage}}
{{#models}}{{#model}} - [{{{modelPackage}}}.{{{classname}}}]({{modelDocPath}}{{{classname}}}.md)
{{/model}}{{/models}}
{{/modelPackage}}
{{^modelPackage}}
No model defined in this package
{{/modelPackage}}
<a name="documentation-for-authorization"></a>
## Documentation for Authorization
{{^authMethods}}
All endpoints do not require authorization.
{{/authMethods}}
{{#authMethods}}
{{#last}}
Authentication schemes defined for the API:
{{/last}}
{{/authMethods}}
{{#authMethods}}
<a name="{{name}}"></a>
### {{name}}
{{#isApiKey}}- **Type**: API key
- **API key parameter name**: {{keyParamName}}
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
{{/isApiKey}}
{{#isBasicBasic}}- **Type**: HTTP basic authentication
{{/isBasicBasic}}
{{#isBasicBearer}}- **Type**: Bearer Authentication
{{/isBasicBearer}}
{{#isOAuth}}- **Type**: OAuth
- **Flow**: {{flow}}
- **Authorization URL**: {{authorizationUrl}}
- **Scopes**: {{^scopes}}N/A{{/scopes}}
{{#scopes}} - {{scope}}: {{description}}
{{/scopes}}
{{/isOAuth}}
{{/authMethods}}

View File

@ -0,0 +1,60 @@
{{>partial_header}}
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
namespace {{packageName}}.Client
{
/// <summary>
/// A container for generalized request inputs. This type allows consumers to extend the request functionality
/// by abstracting away from the default (built-in) request framework (e.g. RestSharp).
/// </summary>
public class RequestOptions
{
/// <summary>
/// Parameters to be bound to path parts of the Request's URL
/// </summary>
public Dictionary<string, string> PathParameters { get; set; }
/// <summary>
/// Query parameters to be applied to the request.
/// Keys may have 1 or more values associated.
/// </summary>
public Multimap<string, string> QueryParameters { get; set; }
/// <summary>
/// Header parameters to be applied to to the request.
/// Keys may have 1 or more values associated.
/// </summary>
public Multimap<string, string> HeaderParameters { get; set; }
/// <summary>
/// Form parameters to be sent along with the request.
/// </summary>
public Dictionary<string, string> FormParameters { get; set; }
/// <summary>
/// Cookies to be sent along with the request.
/// </summary>
public List<Cookie> Cookies { get; set; }
/// <summary>
/// Any data associated with a request body.
/// </summary>
public Object Data { get; set; }
/// <summary>
/// Constructs a new instance of <see cref="RequestOptions"/>
/// </summary>
public RequestOptions()
{
PathParameters = new Dictionary<string, string>();
QueryParameters = new Multimap<string, string>();
HeaderParameters = new Multimap<string, string>();
FormParameters = new Dictionary<string, string>();
Cookies = new List<Cookie>();
}
}
}

View File

@ -0,0 +1,26 @@
{{>partial_header}}
using System;
using UnityEngine.Networking;
namespace {{packageName}}.Client
{
// Thrown when a backend doesn't return an expected response based on the expected type
// of the response data.
public class UnexpectedResponseException : Exception
{
public int ErrorCode { get; private set; }
// NOTE: Cannot keep reference to the request since it will be disposed.
public UnexpectedResponseException(UnityWebRequest request, System.Type type, string extra = "")
: base(CreateMessage(request, type, extra))
{
ErrorCode = (int)request.responseCode;
}
private static string CreateMessage(UnityWebRequest request, System.Type type, string extra)
{
return $"httpcode={request.responseCode}, expected {type.Name} but got data: {extra}";
}
}
}

View File

@ -0,0 +1,690 @@
{{>partial_header}}
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Net;
using System.Net.Mime;
using {{packageName}}.Client;
{{#hasImport}}using {{packageName}}.{{modelPackage}};
{{/hasImport}}
namespace {{packageName}}.{{apiPackage}}
{
{{#operations}}
/// <summary>
/// Represents a collection of functions to interact with the API endpoints
/// </summary>
{{>visibility}} interface {{interfacePrefix}}{{classname}}Sync : IApiAccessor
{
#region Synchronous Operations
{{#operation}}
/// <summary>
/// {{summary}}
/// </summary>
{{#notes}}
/// <remarks>
/// {{.}}
/// </remarks>
{{/notes}}
/// <exception cref="{{packageName}}.Client.ApiException">Thrown when fails to make API call</exception>
{{#allParams}}/// <param name="{{paramName}}">{{description}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}}</param>
{{/allParams}}/// <returns>{{returnType}}</returns>
{{#isDeprecated}}
[Obsolete]
{{/isDeprecated}}
{{{returnType}}}{{^returnType}}void{{/returnType}} {{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = default({{{dataType}}}){{/optionalMethodArgument}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}});
/// <summary>
/// {{summary}}
/// </summary>
/// <remarks>
/// {{notes}}
/// </remarks>
/// <exception cref="{{packageName}}.Client.ApiException">Thrown when fails to make API call</exception>
{{#allParams}}/// <param name="{{paramName}}">{{description}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}}</param>
{{/allParams}}/// <returns>ApiResponse of {{returnType}}{{^returnType}}Object(void){{/returnType}}</returns>
{{#isDeprecated}}
[Obsolete]
{{/isDeprecated}}
ApiResponse<{{{returnType}}}{{^returnType}}Object{{/returnType}}> {{operationId}}WithHttpInfo({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = default({{{dataType}}}){{/optionalMethodArgument}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}});
{{/operation}}
#endregion Synchronous Operations
}
{{#supportsAsync}}
/// <summary>
/// Represents a collection of functions to interact with the API endpoints
/// </summary>
{{>visibility}} interface {{interfacePrefix}}{{classname}}Async : IApiAccessor
{
#region Asynchronous Operations
{{#operation}}
/// <summary>
/// {{summary}}
/// </summary>
/// <remarks>
/// {{notes}}
/// </remarks>
/// <exception cref="{{packageName}}.Client.ApiException">Thrown when fails to make API call</exception>
{{#allParams}}
/// <param name="{{paramName}}">{{description}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}}</param>
{{/allParams}}
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of {{returnType}}{{^returnType}}void{{/returnType}}</returns>
{{#isDeprecated}}
[Obsolete]
{{/isDeprecated}}
{{#returnType}}System.Threading.Tasks.Task<{{{.}}}>{{/returnType}}{{^returnType}}System.Threading.Tasks.Task{{/returnType}} {{operationId}}Async({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = default({{{dataType}}}){{/optionalMethodArgument}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#allParams.0}}, {{/allParams.0}}System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
/// <summary>
/// {{summary}}
/// </summary>
/// <remarks>
/// {{notes}}
/// </remarks>
/// <exception cref="{{packageName}}.Client.ApiException">Thrown when fails to make API call</exception>
{{#allParams}}
/// <param name="{{paramName}}">{{description}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}}</param>
{{/allParams}}
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse{{#returnType}} ({{.}}){{/returnType}}</returns>
{{#isDeprecated}}
[Obsolete]
{{/isDeprecated}}
System.Threading.Tasks.Task<ApiResponse<{{{returnType}}}{{^returnType}}Object{{/returnType}}>> {{operationId}}WithHttpInfoAsync({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = default({{{dataType}}}){{/optionalMethodArgument}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#allParams.0}}, {{/allParams.0}}System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
{{/operation}}
#endregion Asynchronous Operations
}
{{/supportsAsync}}
/// <summary>
/// Represents a collection of functions to interact with the API endpoints
/// </summary>
{{>visibility}} interface {{interfacePrefix}}{{classname}} : {{interfacePrefix}}{{classname}}Sync{{#supportsAsync}}, {{interfacePrefix}}{{classname}}Async{{/supportsAsync}}
{
}
/// <summary>
/// Represents a collection of functions to interact with the API endpoints
/// </summary>
{{>visibility}} partial class {{classname}} : IDisposable, {{interfacePrefix}}{{classname}}
{
private {{packageName}}.Client.ExceptionFactory _exceptionFactory = (name, response) => null;
/// <summary>
/// Initializes a new instance of the <see cref="{{classname}}"/> class.
/// **IMPORTANT** This will also create an instance of HttpClient, which is less than ideal.
/// It's better to reuse the <see href="https://docs.microsoft.com/en-us/dotnet/architecture/microservices/implement-resilient-applications/use-httpclientfactory-to-implement-resilient-http-requests#issues-with-the-original-httpclient-class-available-in-net">HttpClient and HttpClientHandler</see>.
/// </summary>
/// <returns></returns>
public {{classname}}() : this((string)null)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="{{classname}}"/> class.
/// **IMPORTANT** This will also create an instance of HttpClient, which is less than ideal.
/// It's better to reuse the <see href="https://docs.microsoft.com/en-us/dotnet/architecture/microservices/implement-resilient-applications/use-httpclientfactory-to-implement-resilient-http-requests#issues-with-the-original-httpclient-class-available-in-net">HttpClient and HttpClientHandler</see>.
/// </summary>
/// <param name="basePath">The target service's base path in URL format.</param>
/// <exception cref="ArgumentException"></exception>
/// <returns></returns>
public {{classname}}(string basePath)
{
this.Configuration = {{packageName}}.Client.Configuration.MergeConfigurations(
{{packageName}}.Client.GlobalConfiguration.Instance,
new {{packageName}}.Client.Configuration { BasePath = basePath }
);
this.ApiClient = new {{packageName}}.Client.ApiClient(this.Configuration.BasePath);
this.Client = this.ApiClient;
{{#supportsAsync}}
this.AsynchronousClient = this.ApiClient;
{{/supportsAsync}}
this.ExceptionFactory = {{packageName}}.Client.Configuration.DefaultExceptionFactory;
}
/// <summary>
/// Initializes a new instance of the <see cref="{{classname}}"/> class using Configuration object.
/// **IMPORTANT** This will also create an instance of HttpClient, which is less than ideal.
/// It's better to reuse the <see href="https://docs.microsoft.com/en-us/dotnet/architecture/microservices/implement-resilient-applications/use-httpclientfactory-to-implement-resilient-http-requests#issues-with-the-original-httpclient-class-available-in-net">HttpClient and HttpClientHandler</see>.
/// </summary>
/// <param name="configuration">An instance of Configuration.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
public {{classname}}({{packageName}}.Client.Configuration configuration)
{
if (configuration == null) throw new ArgumentNullException("configuration");
this.Configuration = {{packageName}}.Client.Configuration.MergeConfigurations(
{{packageName}}.Client.GlobalConfiguration.Instance,
configuration
);
this.ApiClient = new {{packageName}}.Client.ApiClient(this.Configuration.BasePath);
this.Client = this.ApiClient;
{{#supportsAsync}}
this.AsynchronousClient = this.ApiClient;
{{/supportsAsync}}
ExceptionFactory = {{packageName}}.Client.Configuration.DefaultExceptionFactory;
}
/// <summary>
/// Initializes a new instance of the <see cref="{{classname}}"/> class
/// using a Configuration object and client instance.
/// </summary>
/// <param name="client">The client interface for synchronous API access.</param>{{#supportsAsync}}
/// <param name="asyncClient">The client interface for asynchronous API access.</param>{{/supportsAsync}}
/// <param name="configuration">The configuration object.</param>
/// <exception cref="ArgumentNullException"></exception>
public {{classname}}({{packageName}}.Client.ISynchronousClient client, {{#supportsAsync}}{{packageName}}.Client.IAsynchronousClient asyncClient, {{/supportsAsync}}{{packageName}}.Client.IReadableConfiguration configuration)
{
if (client == null) throw new ArgumentNullException("client");
{{#supportsAsync}}
if (asyncClient == null) throw new ArgumentNullException("asyncClient");
{{/supportsAsync}}
if (configuration == null) throw new ArgumentNullException("configuration");
this.Client = client;
{{#supportsAsync}}
this.AsynchronousClient = asyncClient;
{{/supportsAsync}}
this.Configuration = configuration;
this.ExceptionFactory = {{packageName}}.Client.Configuration.DefaultExceptionFactory;
}
/// <summary>
/// Disposes resources if they were created by us
/// </summary>
public void Dispose()
{
this.ApiClient?.Dispose();
}
/// <summary>
/// Holds the ApiClient if created
/// </summary>
public {{packageName}}.Client.ApiClient ApiClient { get; set; } = null;
{{#supportsAsync}}
/// <summary>
/// The client for accessing this underlying API asynchronously.
/// </summary>
public {{packageName}}.Client.IAsynchronousClient AsynchronousClient { get; set; }
{{/supportsAsync}}
/// <summary>
/// The client for accessing this underlying API synchronously.
/// </summary>
public {{packageName}}.Client.ISynchronousClient Client { get; set; }
/// <summary>
/// Gets the base path of the API client.
/// </summary>
/// <value>The base path</value>
public string GetBasePath()
{
return this.Configuration.BasePath;
}
/// <summary>
/// Gets or sets the configuration object
/// </summary>
/// <value>An instance of the Configuration</value>
public {{packageName}}.Client.IReadableConfiguration Configuration { get; set; }
/// <summary>
/// Provides a factory method hook for the creation of exceptions.
/// </summary>
public {{packageName}}.Client.ExceptionFactory ExceptionFactory
{
get
{
if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1)
{
throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported.");
}
return _exceptionFactory;
}
set { _exceptionFactory = value; }
}
{{#operation}}
/// <summary>
/// {{summary}} {{notes}}
/// </summary>
/// <exception cref="{{packageName}}.Client.ApiException">Thrown when fails to make API call</exception>
{{#allParams}}/// <param name="{{paramName}}">{{description}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}}</param>
{{/allParams}}/// <returns>{{returnType}}</returns>
{{#isDeprecated}}
[Obsolete]
{{/isDeprecated}}
public {{{returnType}}}{{^returnType}}void{{/returnType}} {{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = default({{{dataType}}}){{/optionalMethodArgument}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}})
{
{{#returnType}}{{packageName}}.Client.ApiResponse<{{{returnType}}}> localVarResponse = {{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});
return localVarResponse.Data;{{/returnType}}{{^returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{/returnType}}
}
/// <summary>
/// {{summary}} {{notes}}
/// </summary>
/// <exception cref="{{packageName}}.Client.ApiException">Thrown when fails to make API call</exception>
{{#allParams}}/// <param name="{{paramName}}">{{description}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}}</param>
{{/allParams}}/// <returns>ApiResponse of {{returnType}}{{^returnType}}Object(void){{/returnType}}</returns>
{{#isDeprecated}}
[Obsolete]
{{/isDeprecated}}
public {{packageName}}.Client.ApiResponse<{{{returnType}}}{{^returnType}}Object{{/returnType}}> {{operationId}}WithHttpInfo({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = default({{{dataType}}}){{/optionalMethodArgument}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}})
{
{{#allParams}}
{{#required}}
{{^vendorExtensions.x-csharp-value-type}}
// verify the required parameter '{{paramName}}' is set
if ({{paramName}} == null)
throw new {{packageName}}.Client.ApiException(400, "Missing required parameter '{{paramName}}' when calling {{classname}}->{{operationId}}");
{{/vendorExtensions.x-csharp-value-type}}
{{/required}}
{{/allParams}}
{{packageName}}.Client.RequestOptions localVarRequestOptions = new {{packageName}}.Client.RequestOptions();
string[] _contentTypes = new string[] {
{{#consumes}}
"{{{mediaType}}}"{{^-last}},{{/-last}}
{{/consumes}}
};
// to determine the Accept header
string[] _accepts = new string[] {
{{#produces}}
"{{{mediaType}}}"{{^-last}},{{/-last}}
{{/produces}}
};
var localVarContentType = {{packageName}}.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
var localVarAccept = {{packageName}}.Client.ClientUtils.SelectHeaderAccept(_accepts);
if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
{{#pathParams}}
{{#required}}
localVarRequestOptions.PathParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}})); // path parameter
{{/required}}
{{^required}}
if ({{paramName}} != null)
{
localVarRequestOptions.PathParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}})); // path parameter
}
{{/required}}
{{/pathParams}}
{{#queryParams}}
{{#required}}
{{#isDeepObject}}
{{#items.vars}}
localVarRequestOptions.QueryParameters.Add({{packageName}}.Client.ClientUtils.ParameterToMultiMap("{{collectionFormat}}", "{{baseName}}", {{paramName}}.{{name}}));
{{/items.vars}}
{{^items}}
localVarRequestOptions.QueryParameters.Add({{packageName}}.Client.ClientUtils.ParameterToMultiMap("deepObject", "{{baseName}}", {{paramName}}));
{{/items}}
{{/isDeepObject}}
{{^isDeepObject}}
localVarRequestOptions.QueryParameters.Add({{packageName}}.Client.ClientUtils.ParameterToMultiMap("{{collectionFormat}}", "{{baseName}}", {{paramName}}));
{{/isDeepObject}}
{{/required}}
{{^required}}
if ({{paramName}} != null)
{
{{#isDeepObject}}
{{#items.vars}}
if ({{paramName}}.{{name}} != null)
{
localVarRequestOptions.QueryParameters.Add({{packageName}}.Client.ClientUtils.ParameterToMultiMap("{{collectionFormat}}", "{{baseName}}", {{paramName}}.{{name}}));
}
{{/items.vars}}
{{^items}}
localVarRequestOptions.QueryParameters.Add({{packageName}}.Client.ClientUtils.ParameterToMultiMap("deepObject", "{{baseName}}", {{paramName}}));
{{/items}}
{{/isDeepObject}}
{{^isDeepObject}}
localVarRequestOptions.QueryParameters.Add({{packageName}}.Client.ClientUtils.ParameterToMultiMap("{{collectionFormat}}", "{{baseName}}", {{paramName}}));
{{/isDeepObject}}
}
{{/required}}
{{/queryParams}}
{{#headerParams}}
{{#required}}
localVarRequestOptions.HeaderParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}})); // header parameter
{{/required}}
{{^required}}
if ({{paramName}} != null)
{
localVarRequestOptions.HeaderParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}})); // header parameter
}
{{/required}}
{{/headerParams}}
{{#formParams}}
{{#required}}
{{#isFile}}
{{/isFile}}
{{^isFile}}
localVarRequestOptions.FormParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}})); // form parameter
{{/isFile}}
{{/required}}
{{^required}}
if ({{paramName}} != null)
{
{{#isFile}}
{{/isFile}}
{{^isFile}}
localVarRequestOptions.FormParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}})); // form parameter
{{/isFile}}
}
{{/required}}
{{/formParams}}
{{#bodyParam}}
localVarRequestOptions.Data = {{paramName}};
{{/bodyParam}}
{{#authMethods}}
// authentication ({{name}}) required
{{#isApiKey}}
{{#isKeyInCookie}}
// cookie parameter support
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("{{keyParamName}}")))
{
localVarRequestOptions.Cookies.Add(new Cookie("{{keyParamName}}", this.Configuration.GetApiKeyWithPrefix("{{keyParamName}}")));
}
{{/isKeyInCookie}}
{{#isKeyInHeader}}
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("{{keyParamName}}")))
{
localVarRequestOptions.HeaderParameters.Add("{{keyParamName}}", this.Configuration.GetApiKeyWithPrefix("{{keyParamName}}"));
}
{{/isKeyInHeader}}
{{#isKeyInQuery}}
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("{{keyParamName}}")))
{
localVarRequestOptions.QueryParameters.Add({{packageName}}.Client.ClientUtils.ParameterToMultiMap("", "{{keyParamName}}", this.Configuration.GetApiKeyWithPrefix("{{keyParamName}}")));
}
{{/isKeyInQuery}}
{{/isApiKey}}
{{#isBasicBasic}}
// http basic authentication required
if (!string.IsNullOrEmpty(this.Configuration.Username) || !string.IsNullOrEmpty(this.Configuration.Password) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization"))
{
localVarRequestOptions.HeaderParameters.Add("Authorization", "Basic " + {{packageName}}.Client.ClientUtils.Base64Encode(this.Configuration.Username + ":" + this.Configuration.Password));
}
{{/isBasicBasic}}
{{#isBasicBearer}}
// bearer authentication required
if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization"))
{
localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
}
{{/isBasicBearer}}
{{#isOAuth}}
// oauth required
if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization"))
{
localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
}
{{/isOAuth}}
{{#isHttpSignature}}
if (this.Configuration.HttpSigningConfiguration != null)
{
var HttpSigningHeaders = this.Configuration.HttpSigningConfiguration.GetHttpSignedHeader(this.Configuration.BasePath, "{{{httpMethod}}}", "{{{path}}}", localVarRequestOptions);
foreach (var headerItem in HttpSigningHeaders)
{
if (localVarRequestOptions.HeaderParameters.ContainsKey(headerItem.Key))
{
localVarRequestOptions.HeaderParameters[headerItem.Key] = new List<string>() { headerItem.Value };
}
else
{
localVarRequestOptions.HeaderParameters.Add(headerItem.Key, headerItem.Value);
}
}
}
{{/isHttpSignature}}
{{/authMethods}}
// make the HTTP request
var localVarResponse = this.Client.{{#lambda.titlecase}}{{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}{{/lambda.titlecase}}<{{{returnType}}}{{^returnType}}Object{{/returnType}}>("{{{path}}}", localVarRequestOptions, this.Configuration);
if (this.ExceptionFactory != null)
{
Exception _exception = this.ExceptionFactory("{{operationId}}", localVarResponse);
if (_exception != null) throw _exception;
}
return localVarResponse;
}
{{#supportsAsync}}
/// <summary>
/// {{summary}} {{notes}}
/// </summary>
/// <exception cref="{{packageName}}.Client.ApiException">Thrown when fails to make API call</exception>
{{#allParams}}
/// <param name="{{paramName}}">{{description}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}}</param>
{{/allParams}}
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of {{returnType}}{{^returnType}}void{{/returnType}}</returns>
{{#isDeprecated}}
[Obsolete]
{{/isDeprecated}}
{{#returnType}}public async System.Threading.Tasks.Task<{{{.}}}>{{/returnType}}{{^returnType}}public async System.Threading.Tasks.Task{{/returnType}} {{operationId}}Async({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = default({{{dataType}}}){{/optionalMethodArgument}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#allParams.0}}, {{/allParams.0}}System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
var task = {{operationId}}WithHttpInfoAsync({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#allParams.0}}, {{/allParams.0}}cancellationToken);
{{#returnType}}
#if UNITY_EDITOR || !UNITY_WEBGL
{{packageName}}.Client.ApiResponse<{{{returnType}}}> localVarResponse = await task.ConfigureAwait(false);
#else
{{packageName}}.Client.ApiResponse<{{{returnType}}}> localVarResponse = await task;
#endif
return localVarResponse.Data;
{{/returnType}}
{{^returnType}}
#if UNITY_EDITOR || !UNITY_WEBGL
await task.ConfigureAwait(false);
#else
await task;
#endif
{{/returnType}}
}
/// <summary>
/// {{summary}} {{notes}}
/// </summary>
/// <exception cref="{{packageName}}.Client.ApiException">Thrown when fails to make API call</exception>
{{#allParams}}
/// <param name="{{paramName}}">{{description}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}}</param>
{{/allParams}}
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse{{#returnType}} ({{.}}){{/returnType}}</returns>
{{#isDeprecated}}
[Obsolete]
{{/isDeprecated}}
public async System.Threading.Tasks.Task<{{packageName}}.Client.ApiResponse<{{{returnType}}}{{^returnType}}Object{{/returnType}}>> {{operationId}}WithHttpInfoAsync({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = default({{{dataType}}}){{/optionalMethodArgument}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#allParams.0}}, {{/allParams.0}}System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
{{#allParams}}
{{#required}}
{{^vendorExtensions.x-csharp-value-type}}
// verify the required parameter '{{paramName}}' is set
if ({{paramName}} == null)
throw new {{packageName}}.Client.ApiException(400, "Missing required parameter '{{paramName}}' when calling {{classname}}->{{operationId}}");
{{/vendorExtensions.x-csharp-value-type}}
{{/required}}
{{/allParams}}
{{packageName}}.Client.RequestOptions localVarRequestOptions = new {{packageName}}.Client.RequestOptions();
string[] _contentTypes = new string[] {
{{#consumes}}
"{{{mediaType}}}"{{^-last}}, {{/-last}}
{{/consumes}}
};
// to determine the Accept header
string[] _accepts = new string[] {
{{#produces}}
"{{{mediaType}}}"{{^-last}},{{/-last}}
{{/produces}}
};
var localVarContentType = {{packageName}}.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
var localVarAccept = {{packageName}}.Client.ClientUtils.SelectHeaderAccept(_accepts);
if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
{{#pathParams}}
{{#required}}
localVarRequestOptions.PathParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}})); // path parameter
{{/required}}
{{^required}}
if ({{paramName}} != null)
{
localVarRequestOptions.PathParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}})); // path parameter
}
{{/required}}
{{/pathParams}}
{{#queryParams}}
{{#required}}
localVarRequestOptions.QueryParameters.Add({{packageName}}.Client.ClientUtils.ParameterToMultiMap("{{collectionFormat}}", "{{baseName}}", {{paramName}}));
{{/required}}
{{^required}}
if ({{paramName}} != null)
{
localVarRequestOptions.QueryParameters.Add({{packageName}}.Client.ClientUtils.ParameterToMultiMap("{{collectionFormat}}", "{{baseName}}", {{paramName}}));
}
{{/required}}
{{/queryParams}}
{{#headerParams}}
{{#required}}
localVarRequestOptions.HeaderParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}})); // header parameter
{{/required}}
{{^required}}
if ({{paramName}} != null)
{
localVarRequestOptions.HeaderParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}})); // header parameter
}
{{/required}}
{{/headerParams}}
{{#formParams}}
{{#required}}
{{#isFile}}
{{/isFile}}
{{^isFile}}
localVarRequestOptions.FormParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}})); // form parameter
{{/isFile}}
{{/required}}
{{^required}}
if ({{paramName}} != null)
{
{{#isFile}}
{{/isFile}}
{{^isFile}}
localVarRequestOptions.FormParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}})); // form parameter
{{/isFile}}
}
{{/required}}
{{/formParams}}
{{#bodyParam}}
localVarRequestOptions.Data = {{paramName}};
{{/bodyParam}}
{{#authMethods}}
// authentication ({{name}}) required
{{#isApiKey}}
{{#isKeyInCookie}}
// cookie parameter support
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("{{keyParamName}}")))
{
localVarRequestOptions.Cookies.Add(new Cookie("{{keyParamName}}", this.Configuration.GetApiKeyWithPrefix("{{keyParamName}}")));
}
{{/isKeyInCookie}}
{{#isKeyInHeader}}
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("{{keyParamName}}")))
{
localVarRequestOptions.HeaderParameters.Add("{{keyParamName}}", this.Configuration.GetApiKeyWithPrefix("{{keyParamName}}"));
}
{{/isKeyInHeader}}
{{#isKeyInQuery}}
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("{{keyParamName}}")))
{
localVarRequestOptions.QueryParameters.Add({{packageName}}.Client.ClientUtils.ParameterToMultiMap("", "{{keyParamName}}", this.Configuration.GetApiKeyWithPrefix("{{keyParamName}}")));
}
{{/isKeyInQuery}}
{{/isApiKey}}
{{#isBasic}}
{{#isBasicBasic}}
// http basic authentication required
if (!string.IsNullOrEmpty(this.Configuration.Username) || !string.IsNullOrEmpty(this.Configuration.Password) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization"))
{
localVarRequestOptions.HeaderParameters.Add("Authorization", "Basic " + {{packageName}}.Client.ClientUtils.Base64Encode(this.Configuration.Username + ":" + this.Configuration.Password));
}
{{/isBasicBasic}}
{{#isBasicBearer}}
// bearer authentication required
if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization"))
{
localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
}
{{/isBasicBearer}}
{{/isBasic}}
{{#isOAuth}}
// oauth required
if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization"))
{
localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
}
{{/isOAuth}}
{{#isHttpSignature}}
if (this.Configuration.HttpSigningConfiguration != null)
{
var HttpSigningHeaders = this.Configuration.HttpSigningConfiguration.GetHttpSignedHeader(this.Configuration.BasePath, "{{{httpMethod}}}", "{{{path}}}", localVarRequestOptions);
foreach (var headerItem in HttpSigningHeaders)
{
if (localVarRequestOptions.HeaderParameters.ContainsKey(headerItem.Key))
{
localVarRequestOptions.HeaderParameters[headerItem.Key] = new List<string>() { headerItem.Value };
}
else
{
localVarRequestOptions.HeaderParameters.Add(headerItem.Key, headerItem.Value);
}
}
}
{{/isHttpSignature}}
{{/authMethods}}
// make the HTTP request
var task = this.AsynchronousClient.{{#lambda.titlecase}}{{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}{{/lambda.titlecase}}Async<{{{returnType}}}{{^returnType}}Object{{/returnType}}>("{{{path}}}", localVarRequestOptions, this.Configuration, cancellationToken);
#if UNITY_EDITOR || !UNITY_WEBGL
var localVarResponse = await task.ConfigureAwait(false);
#else
var localVarResponse = await task;
#endif
if (this.ExceptionFactory != null)
{
Exception _exception = this.ExceptionFactory("{{operationId}}", localVarResponse);
if (_exception != null) throw _exception;
}
return localVarResponse;
}
{{/supportsAsync}}
{{/operation}}
}
{{/operations}}
}

View File

@ -0,0 +1,74 @@
{{>partial_header}}
using System;
using System.IO;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reflection;
using NUnit.Framework;
using {{packageName}}.Client;
using {{packageName}}.{{apiPackage}};
{{#hasImport}}
// uncomment below to import models
//using {{packageName}}.{{modelPackage}};
{{/hasImport}}
namespace {{packageName}}.Test.Api
{
/// <summary>
/// Class for testing {{classname}}
/// </summary>
/// <remarks>
/// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
/// Please update the test case below to test the API endpoint.
/// </remarks>
public class {{classname}}Tests : IDisposable
{
{{^nonPublicApi}}
private {{classname}} instance;
{{/nonPublicApi}}
public {{classname}}Tests()
{
{{^nonPublicApi}}
instance = new {{classname}}();
{{/nonPublicApi}}
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of {{classname}}
/// </summary>
[Test]
public void {{operationId}}InstanceTest()
{
// TODO uncomment below to test 'IsType' {{classname}}
//Assert.IsType<{{classname}}>(instance);
}
{{#operations}}
{{#operation}}
/// <summary>
/// Test {{operationId}}
/// </summary>
[Test]
public void {{operationId}}Test()
{
// TODO uncomment below to test the method and replace null with proper value
{{#allParams}}
//{{{dataType}}} {{paramName}} = null;
{{/allParams}}
//{{#returnType}}var response = {{/returnType}}instance.{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});
{{#returnType}}
//Assert.IsType<{{{.}}}>(response);
{{/returnType}}
}
{{/operation}}
{{/operations}}
}
}

View File

@ -0,0 +1,7 @@
{
"name": "{{packageName}}",
"overrideReferences": true,
"precompiledReferences": [
"Newtonsoft.Json.dll"
]
}

View File

@ -0,0 +1,15 @@
{
"name": "{{testPackageName}}",
"references": [
"{{packageName}}",
"UnityEngine.TestRunner"
],
"overrideReferences": true,
"precompiledReferences": [
"nunit.framework.dll",
"Newtonsoft.Json.dll"
],
"defineConstraints": [
"UNITY_INCLUDE_TESTS"
]
}

View File

@ -0,0 +1,47 @@
{{>partial_header}}
{{#models}}
{{#model}}
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.IO;
{{#vendorExtensions.x-com-visible}}
using System.Runtime.InteropServices;
{{/vendorExtensions.x-com-visible}}
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
{{/model}}
{{/models}}
{{#validatable}}
using System.ComponentModel.DataAnnotations;
{{/validatable}}
using OpenAPIDateConverter = {{packageName}}.Client.OpenAPIDateConverter;
{{#useCompareNetObjects}}
using OpenAPIClientUtils = {{packageName}}.Client.ClientUtils;
{{/useCompareNetObjects}}
{{#models}}
{{#model}}
{{#oneOf}}
{{#-first}}
using System.Reflection;
{{/-first}}
{{/oneOf}}
{{#anyOf}}
{{#-first}}
using System.Reflection;
{{/-first}}
{{/anyOf}}
namespace {{packageName}}.{{modelPackage}}
{
{{#isEnum}}{{>modelEnum}}{{/isEnum}}{{^isEnum}}{{#oneOf}}{{#-first}}{{>modelOneOf}}{{/-first}}{{/oneOf}}{{#anyOf}}{{#-first}}{{>modelAnyOf}}{{/-first}}{{/anyOf}}{{^oneOf}}{{^anyOf}}{{>modelGeneric}}{{/anyOf}}{{/oneOf}}{{/isEnum}}
{{/model}}
{{/models}}
}

View File

@ -0,0 +1,64 @@
{{>partial_header}}
using System;
using System.Linq;
using System.IO;
using System.Collections.Generic;
using {{packageName}}.{{apiPackage}};
using {{packageName}}.{{modelPackage}};
using {{packageName}}.{{clientPackage}};
using System.Reflection;
using Newtonsoft.Json;
using NUnit.Framework;
{{#models}}
{{#model}}
namespace {{packageName}}.Test.Model
{
/// <summary>
/// Class for testing {{classname}}
/// </summary>
/// <remarks>
/// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
/// Please update the test case below to test the model.
/// </remarks>
public class {{classname}}Tests : IDisposable
{
// TODO uncomment below to declare an instance variable for {{classname}}
//private {{classname}} instance;
public {{classname}}Tests()
{
// TODO uncomment below to create an instance of {{classname}}
//instance = new {{classname}}();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of {{classname}}
/// </summary>
[Test]
public void {{classname}}InstanceTest()
{
// TODO uncomment below to test "IsType" {{classname}}
//Assert.IsType<{{classname}}>(instance);
}
{{#vars}}
/// <summary>
/// Test the property '{{name}}'
/// </summary>
[Test]
public void {{name}}Test()
{
// TODO unit test for the property '{{name}}'
}
{{/vars}}
}
}
{{/model}}
{{/models}}

View File

@ -8,12 +8,14 @@
[ComVisible({{{vendorExtensions.x-com-visible}}})]
{{/vendorExtensions.x-com-visible}}
[DataContract(Name = "{{{name}}}")]
{{^useUnityWebRequest}}
{{#discriminator}}
[JsonConverter(typeof(JsonSubtypes), "{{{discriminatorName}}}")]
{{#mappedModels}}
[JsonSubtypes.KnownSubType(typeof({{{modelName}}}), "{{^vendorExtensions.x-discriminator-value}}{{{mappingName}}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{.}}}{{/vendorExtensions.x-discriminator-value}}")]
{{/mappedModels}}
{{/discriminator}}
{{/useUnityWebRequest}}
{{>visibility}} partial class {{classname}} : {{#parent}}{{{.}}}, {{/parent}}IEquatable<{{classname}}>{{#validatable}}, IValidatableObject{{/validatable}}
{
{{#vars}}

View File

@ -0,0 +1,362 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd

View File

@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.
# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md

View File

@ -0,0 +1,200 @@
.gitignore
README.md
docs/Activity.md
docs/ActivityOutputElementRepresentation.md
docs/AdditionalPropertiesClass.md
docs/Animal.md
docs/AnotherFakeApi.md
docs/ApiResponse.md
docs/Apple.md
docs/AppleReq.md
docs/ArrayOfArrayOfNumberOnly.md
docs/ArrayOfNumberOnly.md
docs/ArrayTest.md
docs/Banana.md
docs/BananaReq.md
docs/BasquePig.md
docs/Capitalization.md
docs/Cat.md
docs/CatAllOf.md
docs/Category.md
docs/ChildCat.md
docs/ChildCatAllOf.md
docs/ClassModel.md
docs/ComplexQuadrilateral.md
docs/DanishPig.md
docs/DateOnlyClass.md
docs/DefaultApi.md
docs/DeprecatedObject.md
docs/Dog.md
docs/DogAllOf.md
docs/Drawing.md
docs/EnumArrays.md
docs/EnumClass.md
docs/EnumTest.md
docs/EquilateralTriangle.md
docs/FakeApi.md
docs/FakeClassnameTags123Api.md
docs/File.md
docs/FileSchemaTestClass.md
docs/Foo.md
docs/FooGetDefaultResponse.md
docs/FormatTest.md
docs/Fruit.md
docs/FruitReq.md
docs/GmFruit.md
docs/GrandparentAnimal.md
docs/HasOnlyReadOnly.md
docs/HealthCheckResult.md
docs/IsoscelesTriangle.md
docs/List.md
docs/Mammal.md
docs/MapTest.md
docs/MixedPropertiesAndAdditionalPropertiesClass.md
docs/Model200Response.md
docs/ModelClient.md
docs/Name.md
docs/NullableClass.md
docs/NullableGuidClass.md
docs/NullableShape.md
docs/NumberOnly.md
docs/ObjectWithDeprecatedFields.md
docs/Order.md
docs/OuterComposite.md
docs/OuterEnum.md
docs/OuterEnumDefaultValue.md
docs/OuterEnumInteger.md
docs/OuterEnumIntegerDefaultValue.md
docs/ParentPet.md
docs/Pet.md
docs/PetApi.md
docs/Pig.md
docs/PolymorphicProperty.md
docs/Quadrilateral.md
docs/QuadrilateralInterface.md
docs/ReadOnlyFirst.md
docs/Return.md
docs/ScaleneTriangle.md
docs/Shape.md
docs/ShapeInterface.md
docs/ShapeOrNull.md
docs/SimpleQuadrilateral.md
docs/SpecialModelName.md
docs/StoreApi.md
docs/Tag.md
docs/Triangle.md
docs/TriangleInterface.md
docs/User.md
docs/UserApi.md
docs/Whale.md
docs/Zebra.md
git_push.sh
src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.asmdef
src/Org.OpenAPITools/Api/AnotherFakeApi.cs
src/Org.OpenAPITools/Api/DefaultApi.cs
src/Org.OpenAPITools/Api/FakeApi.cs
src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs
src/Org.OpenAPITools/Api/PetApi.cs
src/Org.OpenAPITools/Api/StoreApi.cs
src/Org.OpenAPITools/Api/UserApi.cs
src/Org.OpenAPITools/Client/ApiClient.cs
src/Org.OpenAPITools/Client/ApiException.cs
src/Org.OpenAPITools/Client/ApiResponse.cs
src/Org.OpenAPITools/Client/ClientUtils.cs
src/Org.OpenAPITools/Client/Configuration.cs
src/Org.OpenAPITools/Client/ConnectionException.cs
src/Org.OpenAPITools/Client/ExceptionFactory.cs
src/Org.OpenAPITools/Client/GlobalConfiguration.cs
src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs
src/Org.OpenAPITools/Client/IApiAccessor.cs
src/Org.OpenAPITools/Client/IAsynchronousClient.cs
src/Org.OpenAPITools/Client/IReadableConfiguration.cs
src/Org.OpenAPITools/Client/ISynchronousClient.cs
src/Org.OpenAPITools/Client/Multimap.cs
src/Org.OpenAPITools/Client/OpenAPIDateConverter.cs
src/Org.OpenAPITools/Client/RequestOptions.cs
src/Org.OpenAPITools/Client/UnexpectedResponseException.cs
src/Org.OpenAPITools/Client/WebRequestPathBuilder.cs
src/Org.OpenAPITools/Model/AbstractOpenAPISchema.cs
src/Org.OpenAPITools/Model/Activity.cs
src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs
src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs
src/Org.OpenAPITools/Model/Animal.cs
src/Org.OpenAPITools/Model/ApiResponse.cs
src/Org.OpenAPITools/Model/Apple.cs
src/Org.OpenAPITools/Model/AppleReq.cs
src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs
src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs
src/Org.OpenAPITools/Model/ArrayTest.cs
src/Org.OpenAPITools/Model/Banana.cs
src/Org.OpenAPITools/Model/BananaReq.cs
src/Org.OpenAPITools/Model/BasquePig.cs
src/Org.OpenAPITools/Model/Capitalization.cs
src/Org.OpenAPITools/Model/Cat.cs
src/Org.OpenAPITools/Model/CatAllOf.cs
src/Org.OpenAPITools/Model/Category.cs
src/Org.OpenAPITools/Model/ChildCat.cs
src/Org.OpenAPITools/Model/ChildCatAllOf.cs
src/Org.OpenAPITools/Model/ClassModel.cs
src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs
src/Org.OpenAPITools/Model/DanishPig.cs
src/Org.OpenAPITools/Model/DateOnlyClass.cs
src/Org.OpenAPITools/Model/DeprecatedObject.cs
src/Org.OpenAPITools/Model/Dog.cs
src/Org.OpenAPITools/Model/DogAllOf.cs
src/Org.OpenAPITools/Model/Drawing.cs
src/Org.OpenAPITools/Model/EnumArrays.cs
src/Org.OpenAPITools/Model/EnumClass.cs
src/Org.OpenAPITools/Model/EnumTest.cs
src/Org.OpenAPITools/Model/EquilateralTriangle.cs
src/Org.OpenAPITools/Model/File.cs
src/Org.OpenAPITools/Model/FileSchemaTestClass.cs
src/Org.OpenAPITools/Model/Foo.cs
src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs
src/Org.OpenAPITools/Model/FormatTest.cs
src/Org.OpenAPITools/Model/Fruit.cs
src/Org.OpenAPITools/Model/FruitReq.cs
src/Org.OpenAPITools/Model/GmFruit.cs
src/Org.OpenAPITools/Model/GrandparentAnimal.cs
src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs
src/Org.OpenAPITools/Model/HealthCheckResult.cs
src/Org.OpenAPITools/Model/IsoscelesTriangle.cs
src/Org.OpenAPITools/Model/List.cs
src/Org.OpenAPITools/Model/Mammal.cs
src/Org.OpenAPITools/Model/MapTest.cs
src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs
src/Org.OpenAPITools/Model/Model200Response.cs
src/Org.OpenAPITools/Model/ModelClient.cs
src/Org.OpenAPITools/Model/Name.cs
src/Org.OpenAPITools/Model/NullableClass.cs
src/Org.OpenAPITools/Model/NullableGuidClass.cs
src/Org.OpenAPITools/Model/NullableShape.cs
src/Org.OpenAPITools/Model/NumberOnly.cs
src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs
src/Org.OpenAPITools/Model/Order.cs
src/Org.OpenAPITools/Model/OuterComposite.cs
src/Org.OpenAPITools/Model/OuterEnum.cs
src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs
src/Org.OpenAPITools/Model/OuterEnumInteger.cs
src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs
src/Org.OpenAPITools/Model/ParentPet.cs
src/Org.OpenAPITools/Model/Pet.cs
src/Org.OpenAPITools/Model/Pig.cs
src/Org.OpenAPITools/Model/PolymorphicProperty.cs
src/Org.OpenAPITools/Model/Quadrilateral.cs
src/Org.OpenAPITools/Model/QuadrilateralInterface.cs
src/Org.OpenAPITools/Model/ReadOnlyFirst.cs
src/Org.OpenAPITools/Model/Return.cs
src/Org.OpenAPITools/Model/ScaleneTriangle.cs
src/Org.OpenAPITools/Model/Shape.cs
src/Org.OpenAPITools/Model/ShapeInterface.cs
src/Org.OpenAPITools/Model/ShapeOrNull.cs
src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs
src/Org.OpenAPITools/Model/SpecialModelName.cs
src/Org.OpenAPITools/Model/Tag.cs
src/Org.OpenAPITools/Model/Triangle.cs
src/Org.OpenAPITools/Model/TriangleInterface.cs
src/Org.OpenAPITools/Model/User.cs
src/Org.OpenAPITools/Model/Whale.cs
src/Org.OpenAPITools/Model/Zebra.cs
src/Org.OpenAPITools/Org.OpenAPITools.asmdef

View File

@ -0,0 +1,260 @@
# Org.OpenAPITools - the C# library for the OpenAPI Petstore
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
This C# SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
- API version: 1.0.0
- SDK version: 1.0.0
- Build package: org.openapitools.codegen.languages.CSharpNetCoreClientCodegen
<a name="version-support"></a>
## Version support
This generator should support all current LTS versions of Unity
- Unity 2020.3 (LTS) and up
- .NET Standard 2.1 / .NET Framework
<a name="dependencies"></a>
## Dependencies
- [Newtonsoft.Json](https://docs.unity3d.com/Packages/com.unity.nuget.newtonsoft-json@3.0/manual/index.html) - 3.0.2 or later
- [Unity Test Framework](https://docs.unity3d.com/Packages/com.unity.test-framework@1.1/manual/index.html) - 1.1.33 or later
<a name="installation"></a>
## Installation
Add the dependencies to `Packages/manifest.json`
```
{
"dependencies": {
...
"com.unity.nuget.newtonsoft-json": "3.0.2",
"com.unity.test-framework": "1.1.33",
}
}
```
Then use the namespaces:
```csharp
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
```
<a name="getting-started"></a>
## Getting Started
```csharp
using System;
using System.Collections.Generic;
using UnityEngine;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Org.OpenAPIToolsExample
{
public class Call123TestSpecialTagsExample : MonoBehaviour
{
async void Start()
{
Configuration config = new Configuration();
config.BasePath = "http://petstore.swagger.io:80/v2";
var apiInstance = new AnotherFakeApi(config);
var modelClient = new ModelClient(); // ModelClient | client model
try
{
// To test special tags
ModelClient result = await apiInstance.Call123TestSpecialTagsAsync(modelClient);
Debug.Log(result);
Debug.Log("Done!");
}
catch (ApiException e)
{
Debug.LogError("Exception when calling AnotherFakeApi.Call123TestSpecialTags: " + e.Message );
Debug.LogError("Status Code: "+ e.ErrorCode);
Debug.LogError(e.StackTrace);
}
}
}
}
```
<a name="documentation-for-api-endpoints"></a>
## Documentation for API Endpoints
All URIs are relative to *http://petstore.swagger.io:80/v2*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*AnotherFakeApi* | [**Call123TestSpecialTags**](AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags
*DefaultApi* | [**FooGet**](DefaultApi.md#fooget) | **GET** /foo |
*DefaultApi* | [**GetCountry**](DefaultApi.md#getcountry) | **POST** /country |
*FakeApi* | [**FakeHealthGet**](FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint
*FakeApi* | [**FakeOuterBooleanSerialize**](FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean |
*FakeApi* | [**FakeOuterCompositeSerialize**](FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite |
*FakeApi* | [**FakeOuterNumberSerialize**](FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number |
*FakeApi* | [**FakeOuterStringSerialize**](FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string |
*FakeApi* | [**GetArrayOfEnums**](FakeApi.md#getarrayofenums) | **GET** /fake/array-of-enums | Array of Enums
*FakeApi* | [**TestBodyWithFileSchema**](FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema |
*FakeApi* | [**TestBodyWithQueryParams**](FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params |
*FakeApi* | [**TestClientModel**](FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model
*FakeApi* | [**TestEndpointParameters**](FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
*FakeApi* | [**TestEnumParameters**](FakeApi.md#testenumparameters) | **GET** /fake | To test enum parameters
*FakeApi* | [**TestGroupParameters**](FakeApi.md#testgroupparameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional)
*FakeApi* | [**TestInlineAdditionalProperties**](FakeApi.md#testinlineadditionalproperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties
*FakeApi* | [**TestJsonFormData**](FakeApi.md#testjsonformdata) | **GET** /fake/jsonFormData | test json serialization of form data
*FakeApi* | [**TestQueryParameterCollectionFormat**](FakeApi.md#testqueryparametercollectionformat) | **PUT** /fake/test-query-parameters |
*FakeClassnameTags123Api* | [**TestClassname**](FakeClassnameTags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case
*PetApi* | [**AddPet**](PetApi.md#addpet) | **POST** /pet | Add a new pet to the store
*PetApi* | [**DeletePet**](PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet
*PetApi* | [**FindPetsByStatus**](PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status
*PetApi* | [**FindPetsByTags**](PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags
*PetApi* | [**GetPetById**](PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID
*PetApi* | [**UpdatePet**](PetApi.md#updatepet) | **PUT** /pet | Update an existing pet
*PetApi* | [**UpdatePetWithForm**](PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data
*PetApi* | [**UploadFile**](PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image
*PetApi* | [**UploadFileWithRequiredFile**](PetApi.md#uploadfilewithrequiredfile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required)
*StoreApi* | [**DeleteOrder**](StoreApi.md#deleteorder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID
*StoreApi* | [**GetInventory**](StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status
*StoreApi* | [**GetOrderById**](StoreApi.md#getorderbyid) | **GET** /store/order/{order_id} | Find purchase order by ID
*StoreApi* | [**PlaceOrder**](StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet
*UserApi* | [**CreateUser**](UserApi.md#createuser) | **POST** /user | Create user
*UserApi* | [**CreateUsersWithArrayInput**](UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array
*UserApi* | [**CreateUsersWithListInput**](UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array
*UserApi* | [**DeleteUser**](UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user
*UserApi* | [**GetUserByName**](UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name
*UserApi* | [**LoginUser**](UserApi.md#loginuser) | **GET** /user/login | Logs user into the system
*UserApi* | [**LogoutUser**](UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session
*UserApi* | [**UpdateUser**](UserApi.md#updateuser) | **PUT** /user/{username} | Updated user
<a name="documentation-for-models"></a>
## Documentation for Models
- [Model.Activity](Activity.md)
- [Model.ActivityOutputElementRepresentation](ActivityOutputElementRepresentation.md)
- [Model.AdditionalPropertiesClass](AdditionalPropertiesClass.md)
- [Model.Animal](Animal.md)
- [Model.ApiResponse](ApiResponse.md)
- [Model.Apple](Apple.md)
- [Model.AppleReq](AppleReq.md)
- [Model.ArrayOfArrayOfNumberOnly](ArrayOfArrayOfNumberOnly.md)
- [Model.ArrayOfNumberOnly](ArrayOfNumberOnly.md)
- [Model.ArrayTest](ArrayTest.md)
- [Model.Banana](Banana.md)
- [Model.BananaReq](BananaReq.md)
- [Model.BasquePig](BasquePig.md)
- [Model.Capitalization](Capitalization.md)
- [Model.Cat](Cat.md)
- [Model.CatAllOf](CatAllOf.md)
- [Model.Category](Category.md)
- [Model.ChildCat](ChildCat.md)
- [Model.ChildCatAllOf](ChildCatAllOf.md)
- [Model.ClassModel](ClassModel.md)
- [Model.ComplexQuadrilateral](ComplexQuadrilateral.md)
- [Model.DanishPig](DanishPig.md)
- [Model.DateOnlyClass](DateOnlyClass.md)
- [Model.DeprecatedObject](DeprecatedObject.md)
- [Model.Dog](Dog.md)
- [Model.DogAllOf](DogAllOf.md)
- [Model.Drawing](Drawing.md)
- [Model.EnumArrays](EnumArrays.md)
- [Model.EnumClass](EnumClass.md)
- [Model.EnumTest](EnumTest.md)
- [Model.EquilateralTriangle](EquilateralTriangle.md)
- [Model.File](File.md)
- [Model.FileSchemaTestClass](FileSchemaTestClass.md)
- [Model.Foo](Foo.md)
- [Model.FooGetDefaultResponse](FooGetDefaultResponse.md)
- [Model.FormatTest](FormatTest.md)
- [Model.Fruit](Fruit.md)
- [Model.FruitReq](FruitReq.md)
- [Model.GmFruit](GmFruit.md)
- [Model.GrandparentAnimal](GrandparentAnimal.md)
- [Model.HasOnlyReadOnly](HasOnlyReadOnly.md)
- [Model.HealthCheckResult](HealthCheckResult.md)
- [Model.IsoscelesTriangle](IsoscelesTriangle.md)
- [Model.List](List.md)
- [Model.Mammal](Mammal.md)
- [Model.MapTest](MapTest.md)
- [Model.MixedPropertiesAndAdditionalPropertiesClass](MixedPropertiesAndAdditionalPropertiesClass.md)
- [Model.Model200Response](Model200Response.md)
- [Model.ModelClient](ModelClient.md)
- [Model.Name](Name.md)
- [Model.NullableClass](NullableClass.md)
- [Model.NullableGuidClass](NullableGuidClass.md)
- [Model.NullableShape](NullableShape.md)
- [Model.NumberOnly](NumberOnly.md)
- [Model.ObjectWithDeprecatedFields](ObjectWithDeprecatedFields.md)
- [Model.Order](Order.md)
- [Model.OuterComposite](OuterComposite.md)
- [Model.OuterEnum](OuterEnum.md)
- [Model.OuterEnumDefaultValue](OuterEnumDefaultValue.md)
- [Model.OuterEnumInteger](OuterEnumInteger.md)
- [Model.OuterEnumIntegerDefaultValue](OuterEnumIntegerDefaultValue.md)
- [Model.ParentPet](ParentPet.md)
- [Model.Pet](Pet.md)
- [Model.Pig](Pig.md)
- [Model.PolymorphicProperty](PolymorphicProperty.md)
- [Model.Quadrilateral](Quadrilateral.md)
- [Model.QuadrilateralInterface](QuadrilateralInterface.md)
- [Model.ReadOnlyFirst](ReadOnlyFirst.md)
- [Model.Return](Return.md)
- [Model.ScaleneTriangle](ScaleneTriangle.md)
- [Model.Shape](Shape.md)
- [Model.ShapeInterface](ShapeInterface.md)
- [Model.ShapeOrNull](ShapeOrNull.md)
- [Model.SimpleQuadrilateral](SimpleQuadrilateral.md)
- [Model.SpecialModelName](SpecialModelName.md)
- [Model.Tag](Tag.md)
- [Model.Triangle](Triangle.md)
- [Model.TriangleInterface](TriangleInterface.md)
- [Model.User](User.md)
- [Model.Whale](Whale.md)
- [Model.Zebra](Zebra.md)
<a name="documentation-for-authorization"></a>
## Documentation for Authorization
<a name="petstore_auth"></a>
### petstore_auth
- **Type**: OAuth
- **Flow**: implicit
- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
- **Scopes**:
- write:pets: modify pets in your account
- read:pets: read your pets
<a name="api_key"></a>
### api_key
- **Type**: API key
- **API key parameter name**: api_key
- **Location**: HTTP header
<a name="api_key_query"></a>
### api_key_query
- **Type**: API key
- **API key parameter name**: api_key_query
- **Location**: URL query string
<a name="http_basic_test"></a>
### http_basic_test
- **Type**: HTTP basic authentication
<a name="bearer_test"></a>
### bearer_test
- **Type**: Bearer Authentication
<a name="http_signature_test"></a>
### http_signature_test

View File

@ -0,0 +1,11 @@
# Org.OpenAPITools.Model.Activity
test map of maps
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ActivityOutputs** | **Dictionary&lt;string, List&lt;ActivityOutputElementRepresentation&gt;&gt;** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,11 @@
# Org.OpenAPITools.Model.ActivityOutputElementRepresentation
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Prop1** | **string** | | [optional]
**Prop2** | **Object** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,17 @@
# Org.OpenAPITools.Model.AdditionalPropertiesClass
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**MapProperty** | **Dictionary&lt;string, string&gt;** | | [optional]
**MapOfMapProperty** | **Dictionary&lt;string, Dictionary&lt;string, string&gt;&gt;** | | [optional]
**Anytype1** | **Object** | | [optional]
**MapWithUndeclaredPropertiesAnytype1** | **Object** | | [optional]
**MapWithUndeclaredPropertiesAnytype2** | **Object** | | [optional]
**MapWithUndeclaredPropertiesAnytype3** | **Dictionary&lt;string, Object&gt;** | | [optional]
**EmptyMap** | **Object** | an object with no declared properties and no undeclared properties, hence it&#39;s an empty map. | [optional]
**MapWithUndeclaredPropertiesString** | **Dictionary&lt;string, string&gt;** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,11 @@
# Org.OpenAPITools.Model.Animal
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ClassName** | **string** | |
**Color** | **string** | | [optional] [default to "red"]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,99 @@
# Org.OpenAPITools.Api.AnotherFakeApi
All URIs are relative to *http://petstore.swagger.io:80/v2*
| Method | HTTP request | Description |
|--------|--------------|-------------|
| [**Call123TestSpecialTags**](AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags |
<a name="call123testspecialtags"></a>
# **Call123TestSpecialTags**
> ModelClient Call123TestSpecialTags (ModelClient modelClient)
To test special tags
To test special tags and operation ID starting with number
### 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 Call123TestSpecialTagsExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "http://petstore.swagger.io:80/v2";
var apiInstance = new AnotherFakeApi(config);
var modelClient = new ModelClient(); // ModelClient | client model
try
{
// To test special tags
ModelClient result = apiInstance.Call123TestSpecialTags(modelClient);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling AnotherFakeApi.Call123TestSpecialTags: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
```
#### Using the Call123TestSpecialTagsWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
```csharp
try
{
// To test special tags
ApiResponse<ModelClient> response = apiInstance.Call123TestSpecialTagsWithHttpInfo(modelClient);
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 AnotherFakeApi.Call123TestSpecialTagsWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
```
### Parameters
| Name | Type | Description | Notes |
|------|------|-------------|-------|
| **modelClient** | [**ModelClient**](ModelClient.md) | client model | |
### Return type
[**ModelClient**](ModelClient.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | successful operation | - |
[[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)

View File

@ -0,0 +1,12 @@
# Org.OpenAPITools.Model.ApiResponse
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Code** | **int** | | [optional]
**Type** | **string** | | [optional]
**Message** | **string** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,11 @@
# Org.OpenAPITools.Model.Apple
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Cultivar** | **string** | | [optional]
**Origin** | **string** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,11 @@
# Org.OpenAPITools.Model.AppleReq
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Cultivar** | **string** | |
**Mealy** | **bool** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,10 @@
# Org.OpenAPITools.Model.ArrayOfArrayOfNumberOnly
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ArrayArrayNumber** | **List&lt;List&lt;decimal&gt;&gt;** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,10 @@
# Org.OpenAPITools.Model.ArrayOfNumberOnly
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ArrayNumber** | **List&lt;decimal&gt;** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,12 @@
# Org.OpenAPITools.Model.ArrayTest
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ArrayOfString** | **List&lt;string&gt;** | | [optional]
**ArrayArrayOfInteger** | **List&lt;List&lt;long&gt;&gt;** | | [optional]
**ArrayArrayOfModel** | **List&lt;List&lt;ReadOnlyFirst&gt;&gt;** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,10 @@
# Org.OpenAPITools.Model.Banana
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**LengthCm** | **decimal** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,11 @@
# Org.OpenAPITools.Model.BananaReq
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**LengthCm** | **decimal** | |
**Sweet** | **bool** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,10 @@
# Org.OpenAPITools.Model.BasquePig
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ClassName** | **string** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,15 @@
# Org.OpenAPITools.Model.Capitalization
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**SmallCamel** | **string** | | [optional]
**CapitalCamel** | **string** | | [optional]
**SmallSnake** | **string** | | [optional]
**CapitalSnake** | **string** | | [optional]
**SCAETHFlowPoints** | **string** | | [optional]
**ATT_NAME** | **string** | Name of the pet | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,12 @@
# Org.OpenAPITools.Model.Cat
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ClassName** | **string** | |
**Color** | **string** | | [optional] [default to "red"]
**Declawed** | **bool** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,10 @@
# Org.OpenAPITools.Model.CatAllOf
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Declawed** | **bool** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,11 @@
# Org.OpenAPITools.Model.Category
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Id** | **long** | | [optional]
**Name** | **string** | | [default to "default-name"]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,11 @@
# Org.OpenAPITools.Model.ChildCat
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Name** | **string** | | [optional]
**PetType** | **string** | | [optional] [default to PetTypeEnum.ChildCat]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,11 @@
# Org.OpenAPITools.Model.ChildCatAllOf
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Name** | **string** | | [optional]
**PetType** | **string** | | [optional] [default to PetTypeEnum.ChildCat]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,11 @@
# Org.OpenAPITools.Model.ClassModel
Model for testing model with \"_class\" property
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Class** | **string** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,11 @@
# Org.OpenAPITools.Model.ComplexQuadrilateral
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ShapeType** | **string** | |
**QuadrilateralType** | **string** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,10 @@
# Org.OpenAPITools.Model.DanishPig
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ClassName** | **string** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,10 @@
# Org.OpenAPITools.Model.DateOnlyClass
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**DateOnlyProperty** | **DateTime** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,174 @@
# Org.OpenAPITools.Api.DefaultApi
All URIs are relative to *http://petstore.swagger.io:80/v2*
| Method | HTTP request | Description |
|--------|--------------|-------------|
| [**FooGet**](DefaultApi.md#fooget) | **GET** /foo | |
| [**GetCountry**](DefaultApi.md#getcountry) | **POST** /country | |
<a name="fooget"></a>
# **FooGet**
> FooGetDefaultResponse FooGet ()
### 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 FooGetExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "http://petstore.swagger.io:80/v2";
var apiInstance = new DefaultApi(config);
try
{
FooGetDefaultResponse result = apiInstance.FooGet();
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling DefaultApi.FooGet: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
```
#### Using the FooGetWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
```csharp
try
{
ApiResponse<FooGetDefaultResponse> response = apiInstance.FooGetWithHttpInfo();
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 DefaultApi.FooGetWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
```
### Parameters
This endpoint does not need any parameter.
### Return type
[**FooGetDefaultResponse**](FooGetDefaultResponse.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **0** | response | - |
[[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 name="getcountry"></a>
# **GetCountry**
> void GetCountry (string country)
### 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 GetCountryExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "http://petstore.swagger.io:80/v2";
var apiInstance = new DefaultApi(config);
var country = "country_example"; // string |
try
{
apiInstance.GetCountry(country);
}
catch (ApiException e)
{
Debug.Print("Exception when calling DefaultApi.GetCountry: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
```
#### Using the GetCountryWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
```csharp
try
{
apiInstance.GetCountryWithHttpInfo(country);
}
catch (ApiException e)
{
Debug.Print("Exception when calling DefaultApi.GetCountryWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
```
### Parameters
| Name | Type | Description | Notes |
|------|------|-------------|-------|
| **country** | **string** | | |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/x-www-form-urlencoded
- **Accept**: Not defined
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | OK | - |
[[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)

View File

@ -0,0 +1,10 @@
# Org.OpenAPITools.Model.DeprecatedObject
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Name** | **string** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,12 @@
# Org.OpenAPITools.Model.Dog
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ClassName** | **string** | |
**Color** | **string** | | [optional] [default to "red"]
**Breed** | **string** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,10 @@
# Org.OpenAPITools.Model.DogAllOf
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Breed** | **string** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,13 @@
# Org.OpenAPITools.Model.Drawing
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**MainShape** | [**Shape**](Shape.md) | | [optional]
**ShapeOrNull** | [**ShapeOrNull**](ShapeOrNull.md) | | [optional]
**NullableShape** | [**NullableShape**](NullableShape.md) | | [optional]
**Shapes** | [**List&lt;Shape&gt;**](Shape.md) | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,11 @@
# Org.OpenAPITools.Model.EnumArrays
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**JustSymbol** | **string** | | [optional]
**ArrayEnum** | **List&lt;EnumArrays.ArrayEnumEnum&gt;** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,9 @@
# Org.OpenAPITools.Model.EnumClass
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,18 @@
# Org.OpenAPITools.Model.EnumTest
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**EnumString** | **string** | | [optional]
**EnumStringRequired** | **string** | |
**EnumInteger** | **int** | | [optional]
**EnumIntegerOnly** | **int** | | [optional]
**EnumNumber** | **double** | | [optional]
**OuterEnum** | **OuterEnum** | | [optional]
**OuterEnumInteger** | **OuterEnumInteger** | | [optional]
**OuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional]
**OuterEnumIntegerDefaultValue** | **OuterEnumIntegerDefaultValue** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,11 @@
# Org.OpenAPITools.Model.EquilateralTriangle
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ShapeType** | **string** | |
**TriangleType** | **string** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,104 @@
# Org.OpenAPITools.Api.FakeClassnameTags123Api
All URIs are relative to *http://petstore.swagger.io:80/v2*
| Method | HTTP request | Description |
|--------|--------------|-------------|
| [**TestClassname**](FakeClassnameTags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case |
<a name="testclassname"></a>
# **TestClassname**
> ModelClient TestClassname (ModelClient modelClient)
To test class name in snake case
To test class name in snake case
### 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 TestClassnameExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "http://petstore.swagger.io:80/v2";
// Configure API key authorization: api_key_query
config.AddApiKey("api_key_query", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// config.AddApiKeyPrefix("api_key_query", "Bearer");
var apiInstance = new FakeClassnameTags123Api(config);
var modelClient = new ModelClient(); // ModelClient | client model
try
{
// To test class name in snake case
ModelClient result = apiInstance.TestClassname(modelClient);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling FakeClassnameTags123Api.TestClassname: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
```
#### Using the TestClassnameWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
```csharp
try
{
// To test class name in snake case
ApiResponse<ModelClient> response = apiInstance.TestClassnameWithHttpInfo(modelClient);
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 FakeClassnameTags123Api.TestClassnameWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
```
### Parameters
| Name | Type | Description | Notes |
|------|------|-------------|-------|
| **modelClient** | [**ModelClient**](ModelClient.md) | client model | |
### Return type
[**ModelClient**](ModelClient.md)
### Authorization
[api_key_query](../README.md#api_key_query)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
### 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)

View File

@ -0,0 +1,11 @@
# Org.OpenAPITools.Model.File
Must be named `File` for test.
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**SourceURI** | **string** | Test capitalization | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,11 @@
# Org.OpenAPITools.Model.FileSchemaTestClass
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**File** | [**File**](File.md) | | [optional]
**Files** | [**List&lt;File&gt;**](File.md) | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,10 @@
# Org.OpenAPITools.Model.Foo
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Bar** | **string** | | [optional] [default to "bar"]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,10 @@
# Org.OpenAPITools.Model.FooGetDefaultResponse
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**String** | [**Foo**](Foo.md) | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,25 @@
# Org.OpenAPITools.Model.FormatTest
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Integer** | **int** | | [optional]
**Int32** | **int** | | [optional]
**Int64** | **long** | | [optional]
**Number** | **decimal** | |
**Float** | **float** | | [optional]
**Double** | **double** | | [optional]
**Decimal** | **decimal** | | [optional]
**String** | **string** | | [optional]
**Byte** | **byte[]** | |
**Binary** | **System.IO.Stream** | | [optional]
**Date** | **DateTime** | |
**DateTime** | **DateTime** | | [optional]
**Uuid** | **Guid** | | [optional]
**Password** | **string** | |
**PatternWithDigits** | **string** | A string that is a 10 digit number. Can have leading zeros. | [optional]
**PatternWithDigitsAndDelimiter** | **string** | A string starting with &#39;image_&#39; (case insensitive) and one to three digits following i.e. Image_01. | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,13 @@
# Org.OpenAPITools.Model.Fruit
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Color** | **string** | | [optional]
**Cultivar** | **string** | | [optional]
**Origin** | **string** | | [optional]
**LengthCm** | **decimal** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,13 @@
# Org.OpenAPITools.Model.FruitReq
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Cultivar** | **string** | |
**Mealy** | **bool** | | [optional]
**LengthCm** | **decimal** | |
**Sweet** | **bool** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,13 @@
# Org.OpenAPITools.Model.GmFruit
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Color** | **string** | | [optional]
**Cultivar** | **string** | | [optional]
**Origin** | **string** | | [optional]
**LengthCm** | **decimal** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,10 @@
# Org.OpenAPITools.Model.GrandparentAnimal
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**PetType** | **string** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,11 @@
# Org.OpenAPITools.Model.HasOnlyReadOnly
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Bar** | **string** | | [optional] [readonly]
**Foo** | **string** | | [optional] [readonly]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,11 @@
# Org.OpenAPITools.Model.HealthCheckResult
Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model.
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**NullableMessage** | **string** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,11 @@
# Org.OpenAPITools.Model.IsoscelesTriangle
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ShapeType** | **string** | |
**TriangleType** | **string** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,10 @@
# Org.OpenAPITools.Model.List
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**_123List** | **string** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,13 @@
# Org.OpenAPITools.Model.Mammal
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**HasBaleen** | **bool** | | [optional]
**HasTeeth** | **bool** | | [optional]
**ClassName** | **string** | |
**Type** | **string** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,13 @@
# Org.OpenAPITools.Model.MapTest
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**MapMapOfString** | **Dictionary&lt;string, Dictionary&lt;string, string&gt;&gt;** | | [optional]
**MapOfEnumString** | **Dictionary&lt;string, MapTest.InnerEnum&gt;** | | [optional]
**DirectMap** | **Dictionary&lt;string, bool&gt;** | | [optional]
**IndirectMap** | **Dictionary&lt;string, bool&gt;** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,13 @@
# Org.OpenAPITools.Model.MixedPropertiesAndAdditionalPropertiesClass
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**UuidWithPattern** | **Guid** | | [optional]
**Uuid** | **Guid** | | [optional]
**DateTime** | **DateTime** | | [optional]
**Map** | [**Dictionary&lt;string, Animal&gt;**](Animal.md) | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,12 @@
# Org.OpenAPITools.Model.Model200Response
Model for testing model name starting with number
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Name** | **int** | | [optional]
**Class** | **string** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,10 @@
# Org.OpenAPITools.Model.ModelClient
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**_Client** | **string** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,14 @@
# Org.OpenAPITools.Model.Name
Model for testing model name same as property name
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**_Name** | **int** | |
**SnakeCase** | **int** | | [optional] [readonly]
**Property** | **string** | | [optional]
**_123Number** | **int** | | [optional] [readonly]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,21 @@
# Org.OpenAPITools.Model.NullableClass
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**IntegerProp** | **int?** | | [optional]
**NumberProp** | **decimal?** | | [optional]
**BooleanProp** | **bool?** | | [optional]
**StringProp** | **string** | | [optional]
**DateProp** | **DateTime?** | | [optional]
**DatetimeProp** | **DateTime?** | | [optional]
**ArrayNullableProp** | **List&lt;Object&gt;** | | [optional]
**ArrayAndItemsNullableProp** | **List&lt;Object&gt;** | | [optional]
**ArrayItemsNullable** | **List&lt;Object&gt;** | | [optional]
**ObjectNullableProp** | **Dictionary&lt;string, Object&gt;** | | [optional]
**ObjectAndItemsNullableProp** | **Dictionary&lt;string, Object&gt;** | | [optional]
**ObjectItemsNullable** | **Dictionary&lt;string, Object&gt;** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,10 @@
# Org.OpenAPITools.Model.NullableGuidClass
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Uuid** | **Guid?** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,12 @@
# Org.OpenAPITools.Model.NullableShape
The value may be a shape or the 'null' value. The 'nullable' attribute was introduced in OAS schema >= 3.0 and has been deprecated in OAS schema >= 3.1.
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ShapeType** | **string** | |
**QuadrilateralType** | **string** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,10 @@
# Org.OpenAPITools.Model.NumberOnly
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**JustNumber** | **decimal** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,13 @@
# Org.OpenAPITools.Model.ObjectWithDeprecatedFields
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Uuid** | **string** | | [optional]
**Id** | **decimal** | | [optional]
**DeprecatedRef** | [**DeprecatedObject**](DeprecatedObject.md) | | [optional]
**Bars** | **List&lt;string&gt;** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,15 @@
# Org.OpenAPITools.Model.Order
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Id** | **long** | | [optional]
**PetId** | **long** | | [optional]
**Quantity** | **int** | | [optional]
**ShipDate** | **DateTime** | | [optional]
**Status** | **string** | Order Status | [optional]
**Complete** | **bool** | | [optional] [default to false]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,12 @@
# Org.OpenAPITools.Model.OuterComposite
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**MyNumber** | **decimal** | | [optional]
**MyString** | **string** | | [optional]
**MyBoolean** | **bool** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,9 @@
# Org.OpenAPITools.Model.OuterEnum
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,9 @@
# Org.OpenAPITools.Model.OuterEnumDefaultValue
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,9 @@
# Org.OpenAPITools.Model.OuterEnumInteger
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,9 @@
# Org.OpenAPITools.Model.OuterEnumIntegerDefaultValue
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,10 @@
# Org.OpenAPITools.Model.ParentPet
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**PetType** | **string** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,15 @@
# Org.OpenAPITools.Model.Pet
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Id** | **long** | | [optional]
**Category** | [**Category**](Category.md) | | [optional]
**Name** | **string** | |
**PhotoUrls** | **List&lt;string&gt;** | |
**Tags** | [**List&lt;Tag&gt;**](Tag.md) | | [optional]
**Status** | **string** | pet status in the store | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,856 @@
# Org.OpenAPITools.Api.PetApi
All URIs are relative to *http://petstore.swagger.io:80/v2*
| Method | HTTP request | Description |
|--------|--------------|-------------|
| [**AddPet**](PetApi.md#addpet) | **POST** /pet | Add a new pet to the store |
| [**DeletePet**](PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet |
| [**FindPetsByStatus**](PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status |
| [**FindPetsByTags**](PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags |
| [**GetPetById**](PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID |
| [**UpdatePet**](PetApi.md#updatepet) | **PUT** /pet | Update an existing pet |
| [**UpdatePetWithForm**](PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data |
| [**UploadFile**](PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image |
| [**UploadFileWithRequiredFile**](PetApi.md#uploadfilewithrequiredfile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) |
<a name="addpet"></a>
# **AddPet**
> void AddPet (Pet pet)
Add a new pet to the store
### 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 AddPetExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "http://petstore.swagger.io:80/v2";
// Configure OAuth2 access token for authorization: petstore_auth
config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new PetApi(config);
var pet = new Pet(); // Pet | Pet object that needs to be added to the store
try
{
// Add a new pet to the store
apiInstance.AddPet(pet);
}
catch (ApiException e)
{
Debug.Print("Exception when calling PetApi.AddPet: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
```
#### Using the AddPetWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
```csharp
try
{
// Add a new pet to the store
apiInstance.AddPetWithHttpInfo(pet);
}
catch (ApiException e)
{
Debug.Print("Exception when calling PetApi.AddPetWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
```
### Parameters
| Name | Type | Description | Notes |
|------|------|-------------|-------|
| **pet** | [**Pet**](Pet.md) | Pet object that needs to be added to the store | |
### Return type
void (empty response body)
### Authorization
[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test)
### HTTP request headers
- **Content-Type**: application/json, application/xml
- **Accept**: Not defined
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **405** | Invalid input | - |
[[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 name="deletepet"></a>
# **DeletePet**
> void DeletePet (long petId, string apiKey = null)
Deletes a pet
### 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 DeletePetExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "http://petstore.swagger.io:80/v2";
// Configure OAuth2 access token for authorization: petstore_auth
config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new PetApi(config);
var petId = 789L; // long | Pet id to delete
var apiKey = "apiKey_example"; // string | (optional)
try
{
// Deletes a pet
apiInstance.DeletePet(petId, apiKey);
}
catch (ApiException e)
{
Debug.Print("Exception when calling PetApi.DeletePet: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
```
#### Using the DeletePetWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
```csharp
try
{
// Deletes a pet
apiInstance.DeletePetWithHttpInfo(petId, apiKey);
}
catch (ApiException e)
{
Debug.Print("Exception when calling PetApi.DeletePetWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
```
### Parameters
| Name | Type | Description | Notes |
|------|------|-------------|-------|
| **petId** | **long** | Pet id to delete | |
| **apiKey** | **string** | | [optional] |
### Return type
void (empty response body)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **400** | Invalid pet value | - |
[[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 name="findpetsbystatus"></a>
# **FindPetsByStatus**
> List&lt;Pet&gt; FindPetsByStatus (List<string> status)
Finds Pets by status
Multiple status values can be provided with comma separated strings
### 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 FindPetsByStatusExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "http://petstore.swagger.io:80/v2";
// Configure OAuth2 access token for authorization: petstore_auth
config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new PetApi(config);
var status = new List<string>(); // List<string> | Status values that need to be considered for filter
try
{
// Finds Pets by status
List<Pet> result = apiInstance.FindPetsByStatus(status);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling PetApi.FindPetsByStatus: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
```
#### Using the FindPetsByStatusWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
```csharp
try
{
// Finds Pets by status
ApiResponse<List<Pet>> response = apiInstance.FindPetsByStatusWithHttpInfo(status);
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 PetApi.FindPetsByStatusWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
```
### Parameters
| Name | Type | Description | Notes |
|------|------|-------------|-------|
| **status** | [**List&lt;string&gt;**](string.md) | Status values that need to be considered for filter | |
### Return type
[**List&lt;Pet&gt;**](Pet.md)
### Authorization
[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | successful operation | - |
| **400** | Invalid status value | - |
[[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 name="findpetsbytags"></a>
# **FindPetsByTags**
> List&lt;Pet&gt; FindPetsByTags (List<string> tags)
Finds Pets by tags
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
### 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 FindPetsByTagsExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "http://petstore.swagger.io:80/v2";
// Configure OAuth2 access token for authorization: petstore_auth
config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new PetApi(config);
var tags = new List<string>(); // List<string> | Tags to filter by
try
{
// Finds Pets by tags
List<Pet> result = apiInstance.FindPetsByTags(tags);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling PetApi.FindPetsByTags: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
```
#### Using the FindPetsByTagsWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
```csharp
try
{
// Finds Pets by tags
ApiResponse<List<Pet>> response = apiInstance.FindPetsByTagsWithHttpInfo(tags);
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 PetApi.FindPetsByTagsWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
```
### Parameters
| Name | Type | Description | Notes |
|------|------|-------------|-------|
| **tags** | [**List&lt;string&gt;**](string.md) | Tags to filter by | |
### Return type
[**List&lt;Pet&gt;**](Pet.md)
### Authorization
[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | successful operation | - |
| **400** | Invalid tag value | - |
[[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 name="getpetbyid"></a>
# **GetPetById**
> Pet GetPetById (long petId)
Find pet by ID
Returns a single pet
### 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 GetPetByIdExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "http://petstore.swagger.io:80/v2";
// Configure API key authorization: api_key
config.AddApiKey("api_key", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// config.AddApiKeyPrefix("api_key", "Bearer");
var apiInstance = new PetApi(config);
var petId = 789L; // long | ID of pet to return
try
{
// Find pet by ID
Pet result = apiInstance.GetPetById(petId);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling PetApi.GetPetById: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
```
#### Using the GetPetByIdWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
```csharp
try
{
// Find pet by ID
ApiResponse<Pet> response = apiInstance.GetPetByIdWithHttpInfo(petId);
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 PetApi.GetPetByIdWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
```
### Parameters
| Name | Type | Description | Notes |
|------|------|-------------|-------|
| **petId** | **long** | ID of pet to return | |
### Return type
[**Pet**](Pet.md)
### Authorization
[api_key](../README.md#api_key)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | successful operation | - |
| **400** | Invalid ID supplied | - |
| **404** | Pet not found | - |
[[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 name="updatepet"></a>
# **UpdatePet**
> void UpdatePet (Pet pet)
Update an existing pet
### 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 UpdatePetExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "http://petstore.swagger.io:80/v2";
// Configure OAuth2 access token for authorization: petstore_auth
config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new PetApi(config);
var pet = new Pet(); // Pet | Pet object that needs to be added to the store
try
{
// Update an existing pet
apiInstance.UpdatePet(pet);
}
catch (ApiException e)
{
Debug.Print("Exception when calling PetApi.UpdatePet: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
```
#### Using the UpdatePetWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
```csharp
try
{
// Update an existing pet
apiInstance.UpdatePetWithHttpInfo(pet);
}
catch (ApiException e)
{
Debug.Print("Exception when calling PetApi.UpdatePetWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
```
### Parameters
| Name | Type | Description | Notes |
|------|------|-------------|-------|
| **pet** | [**Pet**](Pet.md) | Pet object that needs to be added to the store | |
### Return type
void (empty response body)
### Authorization
[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test)
### HTTP request headers
- **Content-Type**: application/json, application/xml
- **Accept**: Not defined
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **400** | Invalid ID supplied | - |
| **404** | Pet not found | - |
| **405** | Validation exception | - |
[[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 name="updatepetwithform"></a>
# **UpdatePetWithForm**
> void UpdatePetWithForm (long petId, string name = null, string status = null)
Updates a pet in the store with form data
### 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 UpdatePetWithFormExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "http://petstore.swagger.io:80/v2";
// Configure OAuth2 access token for authorization: petstore_auth
config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new PetApi(config);
var petId = 789L; // long | ID of pet that needs to be updated
var name = "name_example"; // string | Updated name of the pet (optional)
var status = "status_example"; // string | Updated status of the pet (optional)
try
{
// Updates a pet in the store with form data
apiInstance.UpdatePetWithForm(petId, name, status);
}
catch (ApiException e)
{
Debug.Print("Exception when calling PetApi.UpdatePetWithForm: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
```
#### Using the UpdatePetWithFormWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
```csharp
try
{
// Updates a pet in the store with form data
apiInstance.UpdatePetWithFormWithHttpInfo(petId, name, status);
}
catch (ApiException e)
{
Debug.Print("Exception when calling PetApi.UpdatePetWithFormWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
```
### Parameters
| Name | Type | Description | Notes |
|------|------|-------------|-------|
| **petId** | **long** | ID of pet that needs to be updated | |
| **name** | **string** | Updated name of the pet | [optional] |
| **status** | **string** | Updated status of the pet | [optional] |
### Return type
void (empty response body)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: application/x-www-form-urlencoded
- **Accept**: Not defined
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **405** | Invalid input | - |
[[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 name="uploadfile"></a>
# **UploadFile**
> ApiResponse UploadFile (long petId, string additionalMetadata = null, System.IO.Stream file = null)
uploads an image
### 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 UploadFileExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "http://petstore.swagger.io:80/v2";
// Configure OAuth2 access token for authorization: petstore_auth
config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new PetApi(config);
var petId = 789L; // long | ID of pet to update
var additionalMetadata = "additionalMetadata_example"; // string | Additional data to pass to server (optional)
var file = new System.IO.MemoryStream(System.IO.File.ReadAllBytes("/path/to/file.txt")); // System.IO.Stream | file to upload (optional)
try
{
// uploads an image
ApiResponse result = apiInstance.UploadFile(petId, additionalMetadata, file);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling PetApi.UploadFile: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
```
#### Using the UploadFileWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
```csharp
try
{
// uploads an image
ApiResponse<ApiResponse> response = apiInstance.UploadFileWithHttpInfo(petId, additionalMetadata, file);
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 PetApi.UploadFileWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
```
### Parameters
| Name | Type | Description | Notes |
|------|------|-------------|-------|
| **petId** | **long** | ID of pet to update | |
| **additionalMetadata** | **string** | Additional data to pass to server | [optional] |
| **file** | **System.IO.Stream****System.IO.Stream** | file to upload | [optional] |
### Return type
[**ApiResponse**](ApiResponse.md)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: multipart/form-data
- **Accept**: application/json
### 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 name="uploadfilewithrequiredfile"></a>
# **UploadFileWithRequiredFile**
> ApiResponse UploadFileWithRequiredFile (long petId, System.IO.Stream requiredFile, string additionalMetadata = null)
uploads an image (required)
### 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 UploadFileWithRequiredFileExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "http://petstore.swagger.io:80/v2";
// Configure OAuth2 access token for authorization: petstore_auth
config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new PetApi(config);
var petId = 789L; // long | ID of pet to update
var requiredFile = new System.IO.MemoryStream(System.IO.File.ReadAllBytes("/path/to/file.txt")); // System.IO.Stream | file to upload
var additionalMetadata = "additionalMetadata_example"; // string | Additional data to pass to server (optional)
try
{
// uploads an image (required)
ApiResponse result = apiInstance.UploadFileWithRequiredFile(petId, requiredFile, additionalMetadata);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling PetApi.UploadFileWithRequiredFile: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
```
#### Using the UploadFileWithRequiredFileWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
```csharp
try
{
// uploads an image (required)
ApiResponse<ApiResponse> response = apiInstance.UploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata);
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 PetApi.UploadFileWithRequiredFileWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
```
### Parameters
| Name | Type | Description | Notes |
|------|------|-------------|-------|
| **petId** | **long** | ID of pet to update | |
| **requiredFile** | **System.IO.Stream****System.IO.Stream** | file to upload | |
| **additionalMetadata** | **string** | Additional data to pass to server | [optional] |
### Return type
[**ApiResponse**](ApiResponse.md)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: multipart/form-data
- **Accept**: application/json, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
### 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)

View File

@ -0,0 +1,10 @@
# Org.OpenAPITools.Model.Pig
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ClassName** | **string** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,9 @@
# Org.OpenAPITools.Model.PolymorphicProperty
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,11 @@
# Org.OpenAPITools.Model.Quadrilateral
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ShapeType** | **string** | |
**QuadrilateralType** | **string** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,10 @@
# Org.OpenAPITools.Model.QuadrilateralInterface
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**QuadrilateralType** | **string** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,11 @@
# Org.OpenAPITools.Model.ReadOnlyFirst
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Bar** | **string** | | [optional] [readonly]
**Baz** | **string** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,11 @@
# Org.OpenAPITools.Model.Return
Model for testing reserved words
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**_Return** | **int** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,11 @@
# Org.OpenAPITools.Model.ScaleneTriangle
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ShapeType** | **string** | |
**TriangleType** | **string** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,11 @@
# Org.OpenAPITools.Model.Shape
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ShapeType** | **string** | |
**QuadrilateralType** | **string** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,10 @@
# Org.OpenAPITools.Model.ShapeInterface
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ShapeType** | **string** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,12 @@
# Org.OpenAPITools.Model.ShapeOrNull
The value may be a shape or the 'null' value. This is introduced in OAS schema >= 3.1.
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ShapeType** | **string** | |
**QuadrilateralType** | **string** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,11 @@
# Org.OpenAPITools.Model.SimpleQuadrilateral
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ShapeType** | **string** | |
**QuadrilateralType** | **string** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Some files were not shown because too many files have changed in this diff Show More