Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…rator into use-java8-offsetdatetime-for-clients
  • Loading branch information
borsch committed Aug 13, 2020
2 parents 5c4338d + ae6abfc commit 4195324
Show file tree
Hide file tree
Showing 152 changed files with 523 additions and 767 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ using RestSharpMethod = RestSharp.Method;
namespace {{packageName}}.Client
{
/// <summary>
/// Allows RestSharp to Serialize/Deserialize JSON using our custom logic, but only when ContentType is JSON.
/// Allows RestSharp to Serialize/Deserialize JSON using our custom logic, but only when ContentType is JSON.
/// </summary>
internal class CustomJsonCodec : RestSharp.Serializers.ISerializer, RestSharp.Deserializers.IDeserializer
{
Expand Down Expand Up @@ -241,7 +241,7 @@ namespace {{packageName}}.Client
if (path == null) throw new ArgumentNullException("path");
if (options == null) throw new ArgumentNullException("options");
if (configuration == null) throw new ArgumentNullException("configuration");
RestRequest request = new RestRequest(Method(method))
{
Resource = path,
Expand All @@ -255,7 +255,7 @@ namespace {{packageName}}.Client
request.AddParameter(pathParam.Key, pathParam.Value, ParameterType.UrlSegment);
}
}

if (options.QueryParameters != null)
{
foreach (var queryParam in options.QueryParameters)
Expand Down Expand Up @@ -337,7 +337,7 @@ namespace {{packageName}}.Client
request.AddCookie(cookie.Name, cookie.Value);
}
}
return request;
}
Expand All @@ -351,7 +351,7 @@ namespace {{packageName}}.Client
ErrorText = response.ErrorMessage,
Cookies = new List<Cookie>()
};
if (response.Headers != null)
{
foreach (var responseHeader in response.Headers)
Expand All @@ -366,9 +366,9 @@ namespace {{packageName}}.Client
{
transformed.Cookies.Add(
new Cookie(
responseCookies.Name,
responseCookies.Value,
responseCookies.Path,
responseCookies.Name,
responseCookies.Value,
responseCookies.Path,
responseCookies.Domain)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ namespace {{packageName}}.Client
public class ApiResponse<T> : IApiResponse
{
#region Properties
/// <summary>
/// Gets or sets the status code (HTTP status code)
/// </summary>
Expand Down Expand Up @@ -104,11 +104,11 @@ namespace {{packageName}}.Client
/// The raw content
/// </summary>
public string RawContent { get;}

#endregion Properties

#region Constructors

/// <summary>
/// Initializes a new instance of the <see cref="ApiResponse{T}" /> class.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace {{packageName}}.Client
}

/// <summary>
/// Convert params to key/value pairs.
/// Convert params to key/value pairs.
/// Use collectionFormat to properly format lists and collections.
/// </summary>
/// <param name="collectionFormat">The swagger-supported collection format, one of: csv, tsv, ssv, pipes, multi</param>
Expand All @@ -70,7 +70,7 @@ namespace {{packageName}}.Client

return parameters;
}

/// <summary>
/// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime.
/// If parameter is a list, join the list with ",".
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ namespace {{packageName}}.Client
{
return apiKeyPrefix + " " + apiKeyValue;
}

return apiKeyValue;
}

Expand All @@ -224,7 +224,7 @@ namespace {{packageName}}.Client

/// <summary>
/// Gets or sets the access token for OAuth2 authentication.
///
///
/// This helper property simplifies code generation.
/// </summary>
/// <value>The access token.</value>
Expand Down Expand Up @@ -294,13 +294,13 @@ namespace {{packageName}}.Client
/// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name.
///
/// Whatever you set here will be prepended to the value defined in AddApiKey.
///
///
/// An example invocation here might be:
/// <example>
/// ApiKeyPrefix["Authorization"] = "Bearer";
/// </example>
/// … where ApiKey["Authorization"] would then be used to set the value of your bearer token.
///
///
/// <remarks>
/// OAuth2 workflows should set tokens via AccessToken.
/// </remarks>
Expand Down Expand Up @@ -394,11 +394,11 @@ namespace {{packageName}}.Client
public static IReadableConfiguration MergeConfigurations(IReadableConfiguration first, IReadableConfiguration second)
{
if (second == null) return first ?? GlobalConfiguration.Instance;
Dictionary<string, string> apiKey = first.ApiKey.ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
Dictionary<string, string> apiKeyPrefix = first.ApiKeyPrefix.ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
Dictionary<string, string> defaultHeaders = first.DefaultHeaders.ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
foreach (var kvp in second.ApiKey) apiKey[kvp.Key] = kvp.Value;
foreach (var kvp in second.ApiKeyPrefix) apiKeyPrefix[kvp.Key] = kvp.Value;
foreach (var kvp in second.DefaultHeaders) defaultHeaders[kvp.Key] = kvp.Value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace {{packageName}}.Client
/// </summary>
/// <value>The base path</value>
String GetBasePath();

/// <summary>
/// Provides a factory method hook for the creation of exceptions.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace {{packageName}}.Client
{
/// <summary>
/// Contract for Asynchronous RESTful API interactions.
///
///
/// This interface allows consumers to provide a custom API accessor client.
/// </summary>
public interface IAsynchronousClient
Expand All @@ -23,7 +23,7 @@ namespace {{packageName}}.Client
/// <typeparam name="T">The return type.</typeparam>
/// <returns>A task eventually representing the response data, decorated with <see cref="ApiResponse{T}"/></returns>
Task<ApiResponse<T>> GetAsync<T>(String path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
/// <summary>
/// Executes a non-blocking call to some <paramref name="path"/> using the POST http verb.
/// </summary>
Expand All @@ -34,7 +34,7 @@ namespace {{packageName}}.Client
/// <typeparam name="T">The return type.</typeparam>
/// <returns>A task eventually representing the response data, decorated with <see cref="ApiResponse{T}"/></returns>
Task<ApiResponse<T>> PostAsync<T>(String path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
/// <summary>
/// Executes a non-blocking call to some <paramref name="path"/> using the PUT http verb.
/// </summary>
Expand All @@ -45,7 +45,7 @@ namespace {{packageName}}.Client
/// <typeparam name="T">The return type.</typeparam>
/// <returns>A task eventually representing the response data, decorated with <see cref="ApiResponse{T}"/></returns>
Task<ApiResponse<T>> PutAsync<T>(String path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
/// <summary>
/// Executes a non-blocking call to some <paramref name="path"/> using the DELETE http verb.
/// </summary>
Expand All @@ -56,7 +56,7 @@ namespace {{packageName}}.Client
/// <typeparam name="T">The return type.</typeparam>
/// <returns>A task eventually representing the response data, decorated with <see cref="ApiResponse{T}"/></returns>
Task<ApiResponse<T>> DeleteAsync<T>(String path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
/// <summary>
/// Executes a non-blocking call to some <paramref name="path"/> using the HEAD http verb.
/// </summary>
Expand All @@ -67,7 +67,7 @@ namespace {{packageName}}.Client
/// <typeparam name="T">The return type.</typeparam>
/// <returns>A task eventually representing the response data, decorated with <see cref="ApiResponse{T}"/></returns>
Task<ApiResponse<T>> HeadAsync<T>(String path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
/// <summary>
/// Executes a non-blocking call to some <paramref name="path"/> using the OPTIONS http verb.
/// </summary>
Expand All @@ -78,7 +78,7 @@ namespace {{packageName}}.Client
/// <typeparam name="T">The return type.</typeparam>
/// <returns>A task eventually representing the response data, decorated with <see cref="ApiResponse{T}"/></returns>
Task<ApiResponse<T>> OptionsAsync<T>(String path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
/// <summary>
/// Executes a non-blocking call to some <paramref name="path"/> using the PATCH http verb.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace {{packageName}}.Client
{
/// <summary>
/// Contract for Synchronous RESTful API interactions.
///
///
/// This interface allows consumers to provide a custom API accessor client.
/// </summary>
public interface ISynchronousClient
Expand All @@ -21,7 +21,7 @@ namespace {{packageName}}.Client
/// <typeparam name="T">The return type.</typeparam>
/// <returns>The response data, decorated with <see cref="ApiResponse{T}"/></returns>
ApiResponse<T> Get<T>(String path, RequestOptions options, IReadableConfiguration configuration = null);
/// <summary>
/// Executes a blocking call to some <paramref name="path"/> using the POST http verb.
/// </summary>
Expand All @@ -31,7 +31,7 @@ namespace {{packageName}}.Client
/// <typeparam name="T">The return type.</typeparam>
/// <returns>The response data, decorated with <see cref="ApiResponse{T}"/></returns>
ApiResponse<T> Post<T>(String path, RequestOptions options, IReadableConfiguration configuration = null);
/// <summary>
/// Executes a blocking call to some <paramref name="path"/> using the PUT http verb.
/// </summary>
Expand All @@ -41,7 +41,7 @@ namespace {{packageName}}.Client
/// <typeparam name="T">The return type.</typeparam>
/// <returns>The response data, decorated with <see cref="ApiResponse{T}"/></returns>
ApiResponse<T> Put<T>(String path, RequestOptions options, IReadableConfiguration configuration = null);
/// <summary>
/// Executes a blocking call to some <paramref name="path"/> using the DELETE http verb.
/// </summary>
Expand All @@ -51,7 +51,7 @@ namespace {{packageName}}.Client
/// <typeparam name="T">The return type.</typeparam>
/// <returns>The response data, decorated with <see cref="ApiResponse{T}"/></returns>
ApiResponse<T> Delete<T>(String path, RequestOptions options, IReadableConfiguration configuration = null);
/// <summary>
/// Executes a blocking call to some <paramref name="path"/> using the HEAD http verb.
/// </summary>
Expand All @@ -61,7 +61,7 @@ namespace {{packageName}}.Client
/// <typeparam name="T">The return type.</typeparam>
/// <returns>The response data, decorated with <see cref="ApiResponse{T}"/></returns>
ApiResponse<T> Head<T>(String path, RequestOptions options, IReadableConfiguration configuration = null);
/// <summary>
/// Executes a blocking call to some <paramref name="path"/> using the OPTIONS http verb.
/// </summary>
Expand All @@ -71,7 +71,7 @@ namespace {{packageName}}.Client
/// <typeparam name="T">The return type.</typeparam>
/// <returns>The response data, decorated with <see cref="ApiResponse{T}"/></returns>
ApiResponse<T> Options<T>(String path, RequestOptions options, IReadableConfiguration configuration = null);
/// <summary>
/// Executes a blocking call to some <paramref name="path"/> using the PATCH http verb.
/// </summary>
Expand All @@ -82,4 +82,4 @@ namespace {{packageName}}.Client
/// <returns>The response data, decorated with <see cref="ApiResponse{T}"/></returns>
ApiResponse<T> Patch<T>(String path, RequestOptions options, IReadableConfiguration configuration = null);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ namespace {{packageName}}.{{apiPackage}}
/// <summary>
/// {{summary}}
/// </summary>
{{#notes}}
/// <remarks>
/// {{notes}}
/// </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}}</param>
{{/allParams}}/// <returns>{{#returnType}}{{returnType}}{{/returnType}}</returns>
Expand Down Expand Up @@ -244,7 +246,7 @@ namespace {{packageName}}.{{apiPackage}}

String[] _contentTypes = new String[] {
{{#consumes}}
"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}
"{{{mediaType}}}"{{#hasMore}},{{/hasMore}}
{{/consumes}}
};

Expand Down Expand Up @@ -436,7 +438,7 @@ namespace {{packageName}}.{{apiPackage}}

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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
{{/isInherited}}
{{/vars}}
}

{{#vars}}
{{^isInherited}}
{{^isEnum}}
Expand Down Expand Up @@ -125,7 +125,7 @@
sb.Append("}\n");
return sb.ToString();
}

/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
{{#appName}}
* {{{appName}}}
*
Expand All @@ -7,7 +7,11 @@
* {{{appDescription}}}
*
{{/appDescription}}
* {{#version}}The version of the OpenAPI document: {{{version}}}{{/version}}
* {{#infoEmail}}Contact: {{{infoEmail}}}{{/infoEmail}}
{{#version}}
* The version of the OpenAPI document: {{{version}}}
{{/version}}
{{#infoEmail}}
* Contact: {{{infoEmail}}}
{{/infoEmail}}
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/*
/*
* 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: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://github.com/openapitools/openapi-generator.git
*/

Expand Down Expand Up @@ -300,7 +299,7 @@ public Org.OpenAPITools.Client.ApiResponse< ModelClient > Call123TestSpecialTags

var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts);
if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);

localVarRequestOptions.Data = modelClient;


Expand Down
Loading

0 comments on commit 4195324

Please sign in to comment.