Import from internal git
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
<Project Sdk="{{projectSdk}}">
|
||||
<PropertyGroup>
|
||||
<Description>{{packageDescription}}{{^packageDescription}}{{packageName}}{{/packageDescription}}</Description>
|
||||
<Copyright>{{packageCopyright}}</Copyright>
|
||||
<Authors>{{packageAuthors}}</Authors>
|
||||
<TargetFramework>{{targetFramework}}</TargetFramework>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<PreserveCompilationContext>true</PreserveCompilationContext>
|
||||
<Version>{{packageVersion}}</Version>
|
||||
{{#nullableReferenceTypes}}
|
||||
<Nullable>annotations</Nullable>
|
||||
{{/nullableReferenceTypes}}
|
||||
{{#isLibrary}}
|
||||
<OutputType>Library</OutputType>
|
||||
{{/isLibrary}}
|
||||
<AssemblyName>{{packageName}}</AssemblyName>
|
||||
<PackageId>{{packageName}}</PackageId>
|
||||
<UserSecretsId>{{userSecretsGuid}}</UserSecretsId>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
<DockerfileContext>..\..</DockerfileContext>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
{{#useSeparateModelProject}}
|
||||
<ProjectReference Include="../{{modelPackage}}/{{modelPackage}}.csproj"/>
|
||||
{{/useSeparateModelProject}}
|
||||
{{#useFrameworkReference}}
|
||||
{{#isLibrary}}
|
||||
<FrameworkReference Include="Microsoft.AspNetCore.App" />
|
||||
{{/isLibrary}}
|
||||
{{/useFrameworkReference}}
|
||||
{{^useFrameworkReference}}
|
||||
<PackageReference Include="Microsoft.AspNetCore.App" />
|
||||
{{/useFrameworkReference}}
|
||||
{{^useSeparateModelProject}}
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="{{aspnetCoreVersion}}.0"/>
|
||||
{{/useSeparateModelProject}}
|
||||
{{#useSwashbuckle}}
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.8" />
|
||||
{{#useNewtonsoft}}
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.Newtonsoft" Version="{{swashbuckleVersion}}"/>
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="{{swashbuckleVersion}}"/>
|
||||
{{/useNewtonsoft}}
|
||||
{{^useNewtonsoft}}
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="{{swashbuckleVersion}}"/>
|
||||
{{/useNewtonsoft}}
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="{{swashbuckleVersion}}" />
|
||||
{{/useSwashbuckle}}
|
||||
{{^useSwashbuckle}}
|
||||
{{#useNewtonsoft}}
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="{{newtonsoftVersion}}" />
|
||||
{{/useNewtonsoft}}
|
||||
{{/useSwashbuckle}}
|
||||
<PackageReference Include="JsonSubTypes" Version="1.8.0" />
|
||||
{{#packageReferences}}
|
||||
<PackageReference Include="{{include}}" Version="{{version}}" />
|
||||
{{/packageReferences}}
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<!--<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="{{aspnetCoreVersion}}.0" />-->
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
100
architecture/api/templates/7.3.0/aspnetcore/controller.mustache
Normal file
100
architecture/api/templates/7.3.0/aspnetcore/controller.mustache
Normal file
@@ -0,0 +1,100 @@
|
||||
{{>partial_header}}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
{{#operationResultTask}}
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
{{/operationResultTask}}
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
{{#useSwashbuckle}}
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
using Swashbuckle.AspNetCore.SwaggerGen;
|
||||
{{/useSwashbuckle}}
|
||||
{{^isLibrary}}
|
||||
{{#useNewtonsoft}}
|
||||
using Newtonsoft.Json;
|
||||
{{/useNewtonsoft}}
|
||||
{{^useNewtonsoft}}
|
||||
using System.Text.Json;
|
||||
{{/useNewtonsoft}}
|
||||
{{/isLibrary}}
|
||||
using {{packageName}}.Attributes;
|
||||
{{^removeModelPackage}}
|
||||
using {{modelPackage}};
|
||||
{{/removeModelPackage}}
|
||||
{{#modelNamespaces}}
|
||||
using {{.}};
|
||||
{{/modelNamespaces}}
|
||||
|
||||
namespace {{apiPackage}}
|
||||
{ {{#operations}}
|
||||
/// <summary>
|
||||
/// {{description}}
|
||||
/// </summary>{{#description}}
|
||||
[Description("{{.}}")]{{/description}}
|
||||
[ApiController]
|
||||
public {{#classModifier}}{{.}} {{/classModifier}}class {{classname}}Controller : ControllerBase
|
||||
{ {{#operation}}
|
||||
/// <summary>
|
||||
/// {{summary}}
|
||||
/// </summary>{{#notes}}
|
||||
/// <remarks>{{.}}</remarks>{{/notes}}{{#allParams}}
|
||||
/// <param name="{{paramName}}">{{description}}{{#isDeprecated}} (deprecated){{/isDeprecated}}</param>{{/allParams}}{{#operationResultTask}}{{#operationIsAsync}}
|
||||
/// <param name="cancellationToken">The cancellation token to cancel the operation.</param>{{/operationIsAsync}}{{/operationResultTask}}{{#responses}}
|
||||
/// <response code="{{code}}">{{message}}</response>{{/responses}}
|
||||
[{{httpMethod}}]
|
||||
[Route("{{{basePathWithoutHost}}}{{{path}}}")]
|
||||
{{#authMethods}}
|
||||
{{#isApiKey}}
|
||||
[Authorize(Policy = "{{name}}")]
|
||||
{{/isApiKey}}
|
||||
{{#isBasicBearer}}
|
||||
[Authorize{{#scopes}}{{#-first}}(Roles = "{{/-first}}{{scope}}{{^-last}},{{/-last}}{{#-last}}"){{/-last}}{{/scopes}}]
|
||||
{{/isBasicBearer}}
|
||||
{{/authMethods}}
|
||||
{{#vendorExtensions.x-aspnetcore-consumes}}
|
||||
[Consumes({{&vendorExtensions.x-aspnetcore-consumes}})]
|
||||
{{/vendorExtensions.x-aspnetcore-consumes}}
|
||||
[ValidateModelState]{{#useSwashbuckle}}
|
||||
[SwaggerOperation("{{operationId}}")]{{#responses}}{{#dataType}}
|
||||
[SwaggerResponse(statusCode: {{code}}, type: typeof({{&dataType}}), description: "{{message}}")]{{/dataType}}{{/responses}}{{/useSwashbuckle}}{{^useSwashbuckle}}{{#responses}}{{#dataType}}
|
||||
[ProducesResponseType(statusCode: {{code}}, type: typeof({{&dataType}}))]{{/dataType}}{{/responses}}{{/useSwashbuckle}}
|
||||
{{#isDeprecated}}
|
||||
[Obsolete]
|
||||
{{/isDeprecated}}
|
||||
public {{operationModifier}} {{#operationResultTask}}{{#operationIsAsync}}async {{/operationIsAsync}}Task<{{/operationResultTask}}{{#responses}}{{#-first}}{{#dataType}}ActionResult<{{&dataType}}>{{/dataType}}{{^dataType}}IActionResult{{/dataType}}{{/-first}}{{/responses}}{{#operationResultTask}}>{{/operationResultTask}} {{operationId}}({{#allParams}}{{>pathParam}}{{>queryParam}}{{>bodyParam}}{{>formParam}}{{>headerParam}}{{^-last}}{{^isCookieParam}}, {{/isCookieParam}}{{/-last}}{{#-last}}{{#operationResultTask}}{{#operationIsAsync}}, {{/operationIsAsync}}{{/operationResultTask}}{{/-last}}{{/allParams}}{{#operationResultTask}}{{#operationIsAsync}}CancellationToken cancellationToken{{/operationIsAsync}}{{/operationResultTask}}){{^generateBody}};{{/generateBody}}
|
||||
{{#generateBody}}
|
||||
{
|
||||
{{#cookieParams}}
|
||||
var {{paramName}} = Request.Cookies["{{paramName}}"];
|
||||
{{/cookieParams}}
|
||||
|
||||
{{#responses}}
|
||||
{{#dataType}}
|
||||
//TODO: Uncomment the next line to return response {{code}} or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
// return StatusCode({{code}}, default({{&dataType}}));
|
||||
{{/dataType}}
|
||||
{{^dataType}}
|
||||
//TODO: Uncomment the next line to return response {{code}} or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
// return StatusCode({{code}});
|
||||
{{/dataType}}
|
||||
{{/responses}}
|
||||
{{#returnType}}
|
||||
string exampleJson = null;
|
||||
{{#examples}}
|
||||
exampleJson = "{{{example}}}";
|
||||
{{/examples}}
|
||||
{{#isListCollection}}{{>listReturn}}{{/isListCollection}}{{^isListCollection}}{{#isMap}}{{>mapReturn}}{{/isMap}}{{^isMap}}{{>objectReturn}}{{/isMap}}{{/isListCollection}}
|
||||
{{!TODO: defaultResponse, examples, auth, consumes, produces, nickname, externalDocs, imports, security}}
|
||||
//TODO: Change the data returned
|
||||
return {{#operationResultTask}}{{#operationIsAsync}}await {{/operationIsAsync}}Task.FromResult<IActionResult>({{/operationResultTask}}new ObjectResult(example){{#operationResultTask}}){{/operationResultTask}};{{/returnType}}{{^returnType}}
|
||||
throw new NotImplementedException();{{/returnType}}
|
||||
}
|
||||
{{/generateBody}}
|
||||
{{/operation}}
|
||||
}
|
||||
{{/operations}}
|
||||
}
|
||||
199
architecture/api/templates/7.3.0/aspnetcore/model.mustache
Normal file
199
architecture/api/templates/7.3.0/aspnetcore/model.mustache
Normal file
@@ -0,0 +1,199 @@
|
||||
{{>partial_header}}
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Runtime.Serialization;
|
||||
{{#useNewtonsoft}}
|
||||
using Newtonsoft.Json;
|
||||
{{/useNewtonsoft}}
|
||||
{{^useNewtonsoft}}
|
||||
using System.Text.Json;
|
||||
{{/useNewtonsoft}}
|
||||
{{#models}}
|
||||
{{#model}}
|
||||
{{#discriminator}}
|
||||
using JsonSubTypes;
|
||||
{{#useSwashbuckle}}
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
{{/useSwashbuckle}}
|
||||
{{/discriminator}}
|
||||
{{/model}}
|
||||
{{/models}}
|
||||
using {{packageName}}.Converters;
|
||||
{{#modelNamespaces}}
|
||||
using {{.}};
|
||||
{{/modelNamespaces}}
|
||||
|
||||
{{#models}}
|
||||
{{#model}}
|
||||
namespace {{modelPackage}}
|
||||
{ {{#isEnum}}{{>enumClass}}{{/isEnum}}{{^isEnum}}
|
||||
/// <summary>
|
||||
/// {{description}}
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
{{#discriminator}}
|
||||
{{#useNewtonsoft}}
|
||||
[JsonConverter(typeof(JsonSubtypes), "{{{discriminatorName}}}")]
|
||||
{{/useNewtonsoft}}
|
||||
{{#useSwashbuckle}}
|
||||
[SwaggerDiscriminator("{{{discriminatorName}}}")]
|
||||
{{/useSwashbuckle}}
|
||||
{{#mappedModels}}
|
||||
[JsonSubtypes.KnownSubType(typeof({{{modelName}}}), "{{^vendorExtensions.x-discriminator-value}}{{{mappingName}}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{.}}}{{/vendorExtensions.x-discriminator-value}}")]
|
||||
{{#useSwashbuckle}}
|
||||
[SwaggerSubType(typeof({{{modelName}}}), DiscriminatorValue = "{{^vendorExtensions.x-discriminator-value}}{{{mappingName}}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{.}}}{{/vendorExtensions.x-discriminator-value}}")]
|
||||
{{/useSwashbuckle}}
|
||||
{{/mappedModels}}
|
||||
{{/discriminator}}
|
||||
public {{#modelClassModifier}}{{.}} {{/modelClassModifier}}class {{classname}} {{#parent}}: {{{.}}}{{^pocoModels}}, {{/pocoModels}}{{/parent}}{{^pocoModels}}{{^parent}}: {{/parent}}IEquatable<{{classname}}>{{/pocoModels}}
|
||||
{
|
||||
{{#vars}}
|
||||
{{#items.isEnum}}
|
||||
{{#items}}
|
||||
{{^complexType}}
|
||||
{{>enumClass}}
|
||||
{{/complexType}}
|
||||
{{/items}}
|
||||
{{/items.isEnum}}
|
||||
{{#isEnum}}
|
||||
{{^complexType}}
|
||||
{{>enumClass}}
|
||||
{{/complexType}}
|
||||
{{/isEnum}}
|
||||
/// <summary>
|
||||
/// {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}}
|
||||
/// </summary>{{#description}}
|
||||
/// <value>{{.}}</value>{{/description}}{{#example}}
|
||||
/// <example>{{.}}</example>{{/example}}{{#required}}
|
||||
[Required]{{/required}}{{#pattern}}
|
||||
[RegularExpression("{{{.}}}")]{{/pattern}}{{#minLength}}{{#maxLength}}
|
||||
[StringLength({{maxLength}}, MinimumLength={{minLength}})]{{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}}
|
||||
[MinLength({{minLength}})]{{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}}
|
||||
[MaxLength({{.}})]{{/maxLength}}{{/minLength}}{{#minimum}}{{#maximum}}
|
||||
[Range({{minimum}}, {{maximum}})]{{/maximum}}{{/minimum}}
|
||||
[DataMember(Name="{{baseName}}", EmitDefaultValue={{#isNullable}}true{{/isNullable}}{{^isNullable}}{{#vendorExtensions.x-is-value-type}}true{{/vendorExtensions.x-is-value-type}}{{^vendorExtensions.x-is-value-type}}false{{/vendorExtensions.x-is-value-type}}{{/isNullable}})]
|
||||
{{#isEnum}}
|
||||
public {{{datatypeWithEnum}}}{{#isNullable}}?{{/isNullable}} {{name}} { get; set; }{{#defaultValue}} = {{{.}}};{{/defaultValue}}
|
||||
{{/isEnum}}
|
||||
{{^isEnum}}
|
||||
public {{{dataType}}} {{name}} { get; set; }{{#defaultValue}} = {{{.}}};{{/defaultValue}}
|
||||
{{/isEnum}}
|
||||
{{^-last}}
|
||||
|
||||
{{/-last}}
|
||||
{{/vars}}
|
||||
|
||||
{{^pocoModels}}
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
/// <returns>String presentation of the object</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("class {{classname}} {\n");
|
||||
{{#vars}}
|
||||
sb.Append(" {{name}}: ").Append({{name}}).Append("\n");
|
||||
{{/vars}}
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the JSON string presentation of the object
|
||||
/// </summary>
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public {{#parent}}{{^isMap}}{{^isArray}}new {{/isArray}}{{/isMap}}{{/parent}}string ToJson()
|
||||
{
|
||||
{{#useNewtonsoft}}
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
{{/useNewtonsoft}}
|
||||
{{^useNewtonsoft}}
|
||||
var options = new JsonSerializerOptions
|
||||
{
|
||||
WriteIndented = true
|
||||
};
|
||||
|
||||
return JsonSerializer.Serialize(this, options);
|
||||
{{/useNewtonsoft}}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if objects are equal
|
||||
/// </summary>
|
||||
/// <param name="obj">Object to be compared</param>
|
||||
/// <returns>Boolean</returns>
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj is null) return false;
|
||||
if (ReferenceEquals(this, obj)) return true;
|
||||
return obj.GetType() == GetType() && Equals(({{classname}})obj);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if {{classname}} instances are equal
|
||||
/// </summary>
|
||||
/// <param name="other">Instance of {{classname}} to be compared</param>
|
||||
/// <returns>Boolean</returns>
|
||||
public bool Equals({{classname}} other)
|
||||
{
|
||||
if (other is null) return false;
|
||||
if (ReferenceEquals(this, other)) return true;
|
||||
|
||||
return {{#vars}}{{^isContainer}}
|
||||
(
|
||||
{{name}} == other.{{name}} ||
|
||||
{{^vendorExtensions.x-is-value-type}}{{name}} != null &&{{/vendorExtensions.x-is-value-type}}
|
||||
{{name}}.Equals(other.{{name}})
|
||||
){{^-last}} && {{/-last}}{{/isContainer}}{{#isContainer}}
|
||||
(
|
||||
{{name}} == other.{{name}} ||
|
||||
{{^vendorExtensions.x-is-value-type}}{{name}} != null &&
|
||||
other.{{name}} != null &&
|
||||
{{/vendorExtensions.x-is-value-type}}{{name}}.SequenceEqual(other.{{name}})
|
||||
){{^-last}} && {{/-last}}{{/isContainer}}{{/vars}}{{^vars}}false{{/vars}};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the hash code
|
||||
/// </summary>
|
||||
/// <returns>Hash code</returns>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
unchecked // Overflow is fine, just wrap
|
||||
{
|
||||
var hashCode = 41;
|
||||
// Suitable nullity checks etc, of course :)
|
||||
{{#vars}}
|
||||
{{^vendorExtensions.x-is-value-type}}if ({{name}} != null){{/vendorExtensions.x-is-value-type}}
|
||||
hashCode = hashCode * 59 + {{name}}.GetHashCode();
|
||||
{{/vars}}
|
||||
return hashCode;
|
||||
}
|
||||
}
|
||||
|
||||
#region Operators
|
||||
#pragma warning disable 1591
|
||||
|
||||
public static bool operator ==({{classname}} left, {{classname}} right)
|
||||
{
|
||||
return Equals(left, right);
|
||||
}
|
||||
|
||||
public static bool operator !=({{classname}} left, {{classname}} right)
|
||||
{
|
||||
return !Equals(left, right);
|
||||
}
|
||||
|
||||
#pragma warning restore 1591
|
||||
#endregion Operators
|
||||
{{/pocoModels}}
|
||||
}
|
||||
{{/isEnum}}
|
||||
{{/model}}
|
||||
{{/models}}
|
||||
}
|
||||
22
architecture/api/templates/7.3.0/aspnetcore/readme.txt
Normal file
22
architecture/api/templates/7.3.0/aspnetcore/readme.txt
Normal file
@@ -0,0 +1,22 @@
|
||||
Ce répertoire doit exister même si il ne contient aucun template modifiés.
|
||||
Il ne doit contenir que les templates modifiés pour cette version du générateur.
|
||||
|
||||
----------------------------
|
||||
controller.mustache
|
||||
----------------------------
|
||||
- Retourner IActionResult uniquement pour les méthodes qui n'ont pas de contenu dans leur première réponse.
|
||||
Sinon, retourner un ActionResult<T> avec le dataType de la première des réponses du endpoint.
|
||||
|
||||
- Ajout de l'option "useModelPackage" pour pouvoir supprimer le using des models si il n'y a plus aucun modèle dans l'api.
|
||||
|
||||
- Ajout automatique des référence vers les package de modèles externes via modelNamespaces
|
||||
|
||||
----------------------------
|
||||
model.mustache
|
||||
----------------------------
|
||||
Ajout automatique des référence vers les package de modèles externes via modelNamespaces
|
||||
|
||||
----------------------------
|
||||
Project.csproj.mustache
|
||||
----------------------------
|
||||
Ajout automatique des références via packageReferences (tableau de couple include/version).
|
||||
@@ -0,0 +1,76 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>{{#useGenericHost}}
|
||||
<GenerateAssemblyInfo>true</GenerateAssemblyInfo> <!-- setting GenerateAssemblyInfo to false causes this bug https://github.com/dotnet/project-system/issues/3934 -->{{/useGenericHost}}{{^useGenericHost}}
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo><!-- setting GenerateAssemblyInfo to false causes this bug https://github.com/dotnet/project-system/issues/3934 -->{{/useGenericHost}}
|
||||
<TargetFramework{{#multiTarget}}s{{/multiTarget}}>{{targetFramework}}</TargetFramework{{#multiTarget}}s{{/multiTarget}}>
|
||||
<AssemblyName>{{packageName}}</AssemblyName>
|
||||
<PackageId>{{packageName}}</PackageId>
|
||||
<OutputType>Library</OutputType>
|
||||
<Authors>{{packageAuthors}}</Authors>
|
||||
<Company>{{packageCompany}}</Company>
|
||||
<AssemblyTitle>{{packageTitle}}</AssemblyTitle>
|
||||
<Description>{{packageDescription}}</Description>
|
||||
<Copyright>{{packageCopyright}}</Copyright>
|
||||
<RootNamespace>{{packageName}}</RootNamespace>
|
||||
<Version>{{packageVersion}}</Version>
|
||||
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\{{packageName}}.xml</DocumentationFile>{{#licenseId}}
|
||||
<PackageLicenseExpression>{{.}}</PackageLicenseExpression>{{/licenseId}}
|
||||
<RepositoryUrl>https://{{{gitHost}}}/{{{gitUserId}}}/{{{gitRepoId}}}.git</RepositoryUrl>
|
||||
<RepositoryType>git</RepositoryType>{{#releaseNote}}
|
||||
<PackageReleaseNotes>{{.}}</PackageReleaseNotes>{{/releaseNote}}{{#packageTags}}
|
||||
<PackageTags>{{{.}}}</PackageTags>{{/packageTags}}{{#nrt}}
|
||||
<Nullable>{{#useGenericHost}}enable{{/useGenericHost}}{{^useGenericHost}}annotations{{/useGenericHost}}</Nullable>{{/nrt}}
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
{{#useCompareNetObjects}}
|
||||
<PackageReference Include="CompareNETObjects" Version="4.82.0" />
|
||||
{{/useCompareNetObjects}}
|
||||
{{^useGenericHost}}
|
||||
<PackageReference Include="JsonSubTypes" Version="2.0.1" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
{{/useGenericHost}}
|
||||
{{#useRestSharp}}
|
||||
<PackageReference Include="RestSharp" Version="110.2.0" />
|
||||
{{/useRestSharp}}
|
||||
{{#useGenericHost}}
|
||||
<PackageReference Include="Microsoft.Extensions.Http" Version="{{#lambda.first}}{{#netStandard}}5.0.0 {{/netStandard}}{{#net47}}7.0.0 {{/net47}}{{#net48}}7.0.0 {{/net48}}{{#net6.0}}6.0.0 {{/net6.0}}{{#net7.0}}7.0.0 {{/net7.0}}{{#net8.0}}8.0.0 {{/net8.0}}{{/lambda.first}}" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="{{#lambda.first}}{{#netStandard}}5.0.0 {{/netStandard}}{{#net47}}7.0.0 {{/net47}}{{#net48}}7.0.0 {{/net48}}{{#net6.0}}6.0.1 {{/net6.0}}{{#net7.0}}7.0.1 {{/net7.0}}{{#net8.0}}8.0.0 {{/net8.0}}{{/lambda.first}}" />
|
||||
{{#supportsRetry}}
|
||||
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="{{#lambda.first}}{{#netStandard}}5.0.1 {{/netStandard}}{{#net47}}7.0.0 {{/net47}}{{#net48}}7.0.0 {{/net48}}{{#net6.0}}6.0.19 {{/net6.0}}{{#net7.0}}7.0.11 {{/net7.0}}{{#net8.0}}8.0.0 {{/net8.0}}{{/lambda.first}}" />
|
||||
{{/supportsRetry}}
|
||||
{{#net80OrLater}}
|
||||
<PackageReference Include="Microsoft.Net.Http.Headers" Version="8.0.0" />
|
||||
{{/net80OrLater}}
|
||||
{{#netStandard}}
|
||||
<PackageReference Include="System.Threading.Channels" Version="8.0.0" />
|
||||
{{/netStandard}}
|
||||
{{/useGenericHost}}
|
||||
{{^useGenericHost}}
|
||||
{{#supportsRetry}}
|
||||
<PackageReference Include="Polly" Version="{{^netStandard}}8.1.0{{/netStandard}}{{#netStandard}}8.1.0{{/netStandard}}" />
|
||||
{{/supportsRetry}}
|
||||
{{/useGenericHost}}
|
||||
{{#validatable}}
|
||||
{{^net60OrLater}}
|
||||
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
||||
{{/net60OrLater}}
|
||||
{{/validatable}}
|
||||
</ItemGroup>
|
||||
|
||||
{{^useGenericHost}}
|
||||
<ItemGroup>
|
||||
<None Remove="System.Web" />
|
||||
{{#net48}}
|
||||
<None Remove="System.Net.Http" />
|
||||
{{/net48}}
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Web" />
|
||||
{{#net48}}
|
||||
<Reference Include="System.Net.Http" />
|
||||
{{/net48}}
|
||||
</ItemGroup>
|
||||
{{/useGenericHost}}
|
||||
{{>netcore_project.additions}}</Project>
|
||||
783
architecture/api/templates/7.3.0/csharp/api.mustache
Normal file
783
architecture/api/templates/7.3.0/csharp/api.mustache
Normal file
@@ -0,0 +1,783 @@
|
||||
{{>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;
|
||||
{{#hasOAuthMethods}}using {{packageName}}.Client.Auth;
|
||||
{{/hasOAuthMethods}}
|
||||
{{#hasImport}}using {{packageName}}.{{modelPackage}};
|
||||
{{/hasImport}}
|
||||
{{#modelNamespaces}}
|
||||
using {{.}};
|
||||
{{/modelNamespaces}}
|
||||
|
||||
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}}/// <param name="operationIndex">Index associated with the operation.</param>
|
||||
/// <returns>{{returnType}}</returns>
|
||||
{{#isDeprecated}}
|
||||
[Obsolete]
|
||||
{{/isDeprecated}}
|
||||
{{{returnType}}}{{^returnType}}void{{/returnType}} {{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = default({{{dataType}}}){{/optionalMethodArgument}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#allParams.0}}, {{/allParams.0}}int operationIndex = 0);
|
||||
|
||||
/// <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="operationIndex">Index associated with the operation.</param>
|
||||
/// <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}}{{#allParams.0}}, {{/allParams.0}}int operationIndex = 0);
|
||||
{{/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="operationIndex">Index associated with the operation.</param>
|
||||
/// <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}}int operationIndex = 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="operationIndex">Index associated with the operation.</param>
|
||||
/// <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}}int operationIndex = 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}} : {{interfacePrefix}}{{classname}}
|
||||
{
|
||||
private {{packageName}}.Client.ExceptionFactory _exceptionFactory = (name, response) => null;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="{{classname}}"/> class.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public {{classname}}() : this((string)null)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="{{classname}}"/> class.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public {{classname}}(string basePath)
|
||||
{
|
||||
this.Configuration = {{packageName}}.Client.Configuration.MergeConfigurations(
|
||||
{{packageName}}.Client.GlobalConfiguration.Instance,
|
||||
new {{packageName}}.Client.Configuration { BasePath = basePath }
|
||||
);
|
||||
this.Client = new {{packageName}}.Client.ApiClient(this.Configuration.BasePath);
|
||||
{{#supportsAsync}}
|
||||
this.AsynchronousClient = new {{packageName}}.Client.ApiClient(this.Configuration.BasePath);
|
||||
{{/supportsAsync}}
|
||||
this.ExceptionFactory = {{packageName}}.Client.Configuration.DefaultExceptionFactory;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="{{classname}}"/> class
|
||||
/// using Configuration object
|
||||
/// </summary>
|
||||
/// <param name="configuration">An instance of Configuration</param>
|
||||
/// <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.Client = new {{packageName}}.Client.ApiClient(this.Configuration.BasePath);
|
||||
{{#supportsAsync}}
|
||||
this.AsynchronousClient = new {{packageName}}.Client.ApiClient(this.Configuration.BasePath);
|
||||
{{/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>
|
||||
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;
|
||||
}
|
||||
|
||||
{{#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}}/// <param name="operationIndex">Index associated with the operation.</param>
|
||||
/// <returns>{{returnType}}</returns>
|
||||
{{#isDeprecated}}
|
||||
[Obsolete]
|
||||
{{/isDeprecated}}
|
||||
public {{{returnType}}}{{^returnType}}void{{/returnType}} {{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = default({{{dataType}}}){{/optionalMethodArgument}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#allParams.0}}, {{/allParams.0}}int operationIndex = 0)
|
||||
{
|
||||
{{#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}}/// <param name="operationIndex">Index associated with the operation.</param>
|
||||
/// <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.0}}, {{/allParams.0}}int operationIndex = 0)
|
||||
{
|
||||
{{#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}}", "{{paramName}}[{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}]", {{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}}
|
||||
{{#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}}
|
||||
localVarRequestOptions.FormParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.{{#isPrimitiveType}}ParameterToString{{/isPrimitiveType}}{{^isPrimitiveType}}Serialize{{/isPrimitiveType}}({{paramName}})); // form parameter
|
||||
{{/isFile}}
|
||||
{{/required}}
|
||||
{{^required}}
|
||||
if ({{paramName}} != null)
|
||||
{
|
||||
{{#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}}
|
||||
localVarRequestOptions.FormParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.{{#isPrimitiveType}}ParameterToString{{/isPrimitiveType}}{{^isPrimitiveType}}Serialize{{/isPrimitiveType}}({{paramName}})); // form parameter
|
||||
{{/isFile}}
|
||||
}
|
||||
{{/required}}
|
||||
{{/formParams}}
|
||||
{{#bodyParam}}
|
||||
localVarRequestOptions.Data = {{paramName}};
|
||||
{{/bodyParam}}
|
||||
|
||||
localVarRequestOptions.Operation = "{{classname}}.{{operationId}}";
|
||||
localVarRequestOptions.OperationIndex = operationIndex;
|
||||
|
||||
{{#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 (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization"))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(this.Configuration.AccessToken))
|
||||
{
|
||||
localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
|
||||
}
|
||||
{{#hasOAuthMethods}}
|
||||
else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) &&
|
||||
!string.IsNullOrEmpty(this.Configuration.OAuthClientId) &&
|
||||
!string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) &&
|
||||
this.Configuration.OAuthFlow != null)
|
||||
{
|
||||
localVarRequestOptions.OAuth = true;
|
||||
}
|
||||
{{/hasOAuthMethods}}
|
||||
}
|
||||
{{/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="operationIndex">Index associated with the operation.</param>
|
||||
/// <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}}int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
|
||||
{
|
||||
{{#returnType}}{{packageName}}.Client.ApiResponse<{{{returnType}}}> localVarResponse = await {{operationId}}WithHttpInfoAsync({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#allParams.0}}, {{/allParams.0}}operationIndex, cancellationToken).ConfigureAwait(false);
|
||||
return localVarResponse.Data;{{/returnType}}{{^returnType}}await {{operationId}}WithHttpInfoAsync({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#allParams.0}}, {{/allParams.0}}operationIndex, cancellationToken).ConfigureAwait(false);{{/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="operationIndex">Index associated with the operation.</param>
|
||||
/// <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}}int operationIndex = 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}}
|
||||
{{#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}}", "{{paramName}}[{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}]", {{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}}
|
||||
{{#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}}
|
||||
localVarRequestOptions.FormParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.{{#isPrimitiveType}}ParameterToString{{/isPrimitiveType}}{{^isPrimitiveType}}Serialize{{/isPrimitiveType}}({{paramName}})); // form parameter
|
||||
{{/isFile}}
|
||||
{{/required}}
|
||||
{{^required}}
|
||||
if ({{paramName}} != null)
|
||||
{
|
||||
{{#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}}
|
||||
localVarRequestOptions.FormParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.{{#isPrimitiveType}}ParameterToString{{/isPrimitiveType}}{{^isPrimitiveType}}Serialize{{/isPrimitiveType}}({{paramName}})); // form parameter
|
||||
{{/isFile}}
|
||||
}
|
||||
{{/required}}
|
||||
{{/formParams}}
|
||||
{{#bodyParam}}
|
||||
localVarRequestOptions.Data = {{paramName}};
|
||||
{{/bodyParam}}
|
||||
|
||||
localVarRequestOptions.Operation = "{{classname}}.{{operationId}}";
|
||||
localVarRequestOptions.OperationIndex = operationIndex;
|
||||
|
||||
{{#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 (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization"))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(this.Configuration.AccessToken))
|
||||
{
|
||||
localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
|
||||
}
|
||||
{{#hasOAuthMethods}}
|
||||
else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) &&
|
||||
!string.IsNullOrEmpty(this.Configuration.OAuthClientId) &&
|
||||
!string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) &&
|
||||
this.Configuration.OAuthFlow != null)
|
||||
{
|
||||
localVarRequestOptions.OAuth = true;
|
||||
}
|
||||
{{/hasOAuthMethods}}
|
||||
}
|
||||
{{/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 = await this.AsynchronousClient.{{#lambda.titlecase}}{{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}{{/lambda.titlecase}}Async<{{{returnType}}}{{^returnType}}Object{{/returnType}}>("{{{path}}}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (this.ExceptionFactory != null)
|
||||
{
|
||||
Exception _exception = this.ExceptionFactory("{{operationId}}", localVarResponse);
|
||||
if (_exception != null)
|
||||
{
|
||||
throw _exception;
|
||||
}
|
||||
}
|
||||
|
||||
return localVarResponse;
|
||||
}
|
||||
|
||||
{{/supportsAsync}}
|
||||
{{/operation}}
|
||||
}
|
||||
{{/operations}}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>{{#useGenericHost}}
|
||||
<GenerateAssemblyInfo>true</GenerateAssemblyInfo> <!-- setting GenerateAssemblyInfo to false causes this bug https://github.com/dotnet/project-system/issues/3934 -->{{/useGenericHost}}{{^useGenericHost}}
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo><!-- setting GenerateAssemblyInfo to false causes this bug https://github.com/dotnet/project-system/issues/3934 -->{{/useGenericHost}}
|
||||
<TargetFramework{{#multiTarget}}s{{/multiTarget}}>{{targetFramework}}</TargetFramework{{#multiTarget}}s{{/multiTarget}}>
|
||||
<AssemblyName>{{packageName}}</AssemblyName>
|
||||
<PackageId>{{packageName}}</PackageId>
|
||||
<OutputType>Library</OutputType>
|
||||
<Authors>{{packageAuthors}}</Authors>
|
||||
<Company>{{packageCompany}}</Company>
|
||||
<AssemblyTitle>{{packageTitle}}</AssemblyTitle>
|
||||
<Description>{{packageDescription}}</Description>
|
||||
<Copyright>{{packageCopyright}}</Copyright>
|
||||
<RootNamespace>{{packageName}}</RootNamespace>
|
||||
<Version>{{packageVersion}}</Version>
|
||||
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\{{packageName}}.xml</DocumentationFile>{{#licenseId}}
|
||||
<PackageLicenseExpression>{{.}}</PackageLicenseExpression>{{/licenseId}}
|
||||
<RepositoryUrl>https://{{{gitHost}}}/{{{gitUserId}}}/{{{gitRepoId}}}.git</RepositoryUrl>
|
||||
<RepositoryType>git</RepositoryType>{{#releaseNote}}
|
||||
<PackageReleaseNotes>{{.}}</PackageReleaseNotes>{{/releaseNote}}{{#packageTags}}
|
||||
<PackageTags>{{{.}}}</PackageTags>{{/packageTags}}{{#nrt}}
|
||||
<Nullable>{{#useGenericHost}}enable{{/useGenericHost}}{{^useGenericHost}}annotations{{/useGenericHost}}</Nullable>{{/nrt}}
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
{{#useCompareNetObjects}}
|
||||
<PackageReference Include="CompareNETObjects" Version="4.82.0" />
|
||||
{{/useCompareNetObjects}}
|
||||
{{^useGenericHost}}
|
||||
<PackageReference Include="JsonSubTypes" Version="2.0.1" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
{{/useGenericHost}}
|
||||
{{#useRestSharp}}
|
||||
<PackageReference Include="RestSharp" Version="110.2.0" />
|
||||
{{/useRestSharp}}
|
||||
{{#useGenericHost}}
|
||||
<PackageReference Include="Microsoft.Extensions.Http" Version="{{#lambda.first}}{{#netStandard}}5.0.0 {{/netStandard}}{{#net47}}7.0.0 {{/net47}}{{#net48}}7.0.0 {{/net48}}{{#net6.0}}6.0.0 {{/net6.0}}{{#net7.0}}7.0.0 {{/net7.0}}{{#net8.0}}8.0.0 {{/net8.0}}{{/lambda.first}}" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="{{#lambda.first}}{{#netStandard}}5.0.0 {{/netStandard}}{{#net47}}7.0.0 {{/net47}}{{#net48}}7.0.0 {{/net48}}{{#net6.0}}6.0.1 {{/net6.0}}{{#net7.0}}7.0.1 {{/net7.0}}{{#net8.0}}8.0.0 {{/net8.0}}{{/lambda.first}}" />
|
||||
{{#supportsRetry}}
|
||||
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="{{#lambda.first}}{{#netStandard}}5.0.1 {{/netStandard}}{{#net47}}7.0.0 {{/net47}}{{#net48}}7.0.0 {{/net48}}{{#net6.0}}6.0.19 {{/net6.0}}{{#net7.0}}7.0.11 {{/net7.0}}{{#net8.0}}8.0.0 {{/net8.0}}{{/lambda.first}}" />
|
||||
{{/supportsRetry}}
|
||||
{{#net80OrLater}}
|
||||
<PackageReference Include="Microsoft.Net.Http.Headers" Version="8.0.0" />
|
||||
{{/net80OrLater}}
|
||||
{{#netStandard}}
|
||||
<PackageReference Include="System.Threading.Channels" Version="8.0.0" />
|
||||
{{/netStandard}}
|
||||
{{/useGenericHost}}
|
||||
{{^useGenericHost}}
|
||||
{{#supportsRetry}}
|
||||
<PackageReference Include="Polly" Version="{{^netStandard}}8.1.0{{/netStandard}}{{#netStandard}}8.1.0{{/netStandard}}" />
|
||||
{{/supportsRetry}}
|
||||
{{/useGenericHost}}
|
||||
{{#validatable}}
|
||||
{{^net60OrLater}}
|
||||
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
||||
{{/net60OrLater}}
|
||||
{{/validatable}}
|
||||
{{#packageReferences}}
|
||||
<PackageReference Include="{{include}}" Version="{{version}}" />
|
||||
{{/packageReferences}}
|
||||
</ItemGroup>
|
||||
|
||||
{{^useGenericHost}}
|
||||
<ItemGroup>
|
||||
<None Remove="System.Web" />
|
||||
{{#net48}}
|
||||
<None Remove="System.Net.Http" />
|
||||
{{/net48}}
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Web" />
|
||||
{{#net48}}
|
||||
<Reference Include="System.Net.Http" />
|
||||
{{/net48}}
|
||||
</ItemGroup>
|
||||
{{/useGenericHost}}
|
||||
{{>netcore_project.additions}}</Project>
|
||||
12
architecture/api/templates/7.3.0/csharp/readme.txt
Normal file
12
architecture/api/templates/7.3.0/csharp/readme.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
Ce répertoire doit exister même si il ne contient aucun template modifiés.
|
||||
Il ne doit contenir que les templates modifiés pour cette version du générateur.
|
||||
|
||||
----------------------------
|
||||
api.mustache
|
||||
----------------------------
|
||||
Ajout automatique des référence vers les package de modèles externes via modelNamespaces
|
||||
|
||||
----------------------------
|
||||
netcore_project.mustache
|
||||
----------------------------
|
||||
Ajout automatique des références via packageReferences (tableau de couple include/version).
|
||||
2
architecture/api/templates/7.3.0/java/readme.txt
Normal file
2
architecture/api/templates/7.3.0/java/readme.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
Ce répertoire doit exister même si il ne contient aucun template modifiés.
|
||||
Il ne doit contenir que les templates modifiés pour cette version du générateur.
|
||||
2
architecture/api/templates/7.3.0/spring/readme.txt
Normal file
2
architecture/api/templates/7.3.0/spring/readme.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
Ce répertoire doit exister même si il ne contient aucun template modifiés.
|
||||
Il ne doit contenir que les templates modifiés pour cette version du générateur.
|
||||
7
architecture/api/templates/NuGet.config
Normal file
7
architecture/api/templates/NuGet.config
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageRestore>
|
||||
<add key="enabled" value="True" />
|
||||
<add key="automatic" value="True" />
|
||||
</packageRestore>
|
||||
</configuration>
|
||||
@@ -0,0 +1,30 @@
|
||||
inputSpec: {{specPath}}
|
||||
generatorName: csharp
|
||||
templateDir: {{templateFolder}}/{{generatorVersion}}/csharp/
|
||||
outputDir: {{outputFolder}}
|
||||
|
||||
modelPackage: Models
|
||||
excludeTests: true
|
||||
{{#if removeModelPackage}}hasImport : false{{/if}}
|
||||
modelNameSuffix: {{modelSuffix}}
|
||||
|
||||
additionalProperties:
|
||||
packageName: {{packageName}}
|
||||
packageVersion: {{packageVersion}}
|
||||
generateBody: "true"
|
||||
classModifier: "abstract"
|
||||
operationModifier: "abstract"
|
||||
isLibrary: "true"
|
||||
buildTarget: "library"
|
||||
enumNameSuffix: ""
|
||||
enumValueSuffix: ""
|
||||
optionalEmitDefaultValues: true
|
||||
operationIsAsync: false
|
||||
|
||||
packageReferences: [
|
||||
{{#each refs}} { include: "{{this.Config.NugetPackage}}", version: "{{this.Info.version}}" },
|
||||
{{/each}}]
|
||||
|
||||
modelNamespaces: [
|
||||
{{#each modelNameSpace}} "{{this.Config.NugetPackage}}.Models",
|
||||
{{/each}}]
|
||||
5
architecture/api/templates/dotnet-client-ignore.mustache
Normal file
5
architecture/api/templates/dotnet-client-ignore.mustache
Normal file
@@ -0,0 +1,5 @@
|
||||
# Remove unused
|
||||
api/*.yaml
|
||||
docs/*.md
|
||||
|
||||
{{#if keepModels}}{{#else}}src/**/Models/*Dto.cs{{/if}}
|
||||
@@ -0,0 +1,39 @@
|
||||
inputSpec: {{specPath}}
|
||||
generatorName: aspnetcore
|
||||
templateDir: {{templateFolder}}/{{generatorVersion}}/aspnetcore/
|
||||
outputDir: {{outputFolder}}
|
||||
{{#if modelSuffix}}modelNameSuffix: {{modelSuffix}}{{/if}}
|
||||
|
||||
typeMappings:
|
||||
file: "IFormFile"
|
||||
|
||||
importMappings:
|
||||
IFormFile: "Microsoft.AspNetCore.Http.IFormFile"
|
||||
|
||||
schemaMappings:
|
||||
IFormFile: "Microsoft.AspNetCore.Http.IFormFile"
|
||||
|
||||
additionalProperties:
|
||||
aspnetCoreVersion: "{{aspnetCoreVersion}}"
|
||||
packageName: "{{packageName}}"
|
||||
packageVersion: "{{packageVersion}}"
|
||||
generateBody: "false"
|
||||
classModifier: "abstract"
|
||||
operationModifier: "abstract"
|
||||
isLibrary: "true"
|
||||
buildTarget: "library"
|
||||
enumNameSuffix: ""
|
||||
enumValueSuffix: ""
|
||||
operationResultTask: true
|
||||
operationIsAsync: true
|
||||
removeModelPackage: true
|
||||
|
||||
packageReferences: [
|
||||
{{#each refs}} { include: "{{this.Config.NugetPackage}}", version: "{{this.Info.version}}" },
|
||||
{{/each}}]
|
||||
|
||||
modelNamespaces: [
|
||||
{{#each modelNameSpace}} "{{this.Config.NugetPackage}}.Models",
|
||||
{{/each}}]
|
||||
|
||||
|
||||
17
architecture/api/templates/dotnet-server-ignore.mustache
Normal file
17
architecture/api/templates/dotnet-server-ignore.mustache
Normal file
@@ -0,0 +1,17 @@
|
||||
src/**/Controllers/DefaultApi.cs
|
||||
|
||||
# Remove unused classes
|
||||
src/**/Authentication/ApiAuthentication.cs
|
||||
src/**/Formatters/InputFormatterStream.cs
|
||||
src/**/OpenApi/TypeExtensions.cs
|
||||
|
||||
{{#if keepModels}}
|
||||
{{#each ignoredModels}}src/**/Models/{{this}}{{modelSuffix}}.cs
|
||||
{{/each}}
|
||||
{{#else}}
|
||||
src/**/Converters/CustomEnumConverter.cs
|
||||
# Remove all models
|
||||
src/**/Models/*.cs
|
||||
{{/if}}
|
||||
|
||||
{{#if isCommon}}src/**/Attributes/ValidateModelStateAttribute.cs{{/if}}
|
||||
25
architecture/api/templates/java-generator-config.mustache
Normal file
25
architecture/api/templates/java-generator-config.mustache
Normal file
@@ -0,0 +1,25 @@
|
||||
inputSpec: {{specPath}}
|
||||
generatorName: spring
|
||||
templateDir: {{templateFolder}}/{{generatorVersion}}/spring/
|
||||
outputDir: {{outputFolder}}
|
||||
|
||||
additionalProperties:
|
||||
groupId : "{{groupId}}"
|
||||
artifactId : "{{artifactId}}"
|
||||
apiPackage : "api"
|
||||
modelPackage : "model"
|
||||
artifactVersion : "{{artifactVersion}}"
|
||||
library : "spring-boot"
|
||||
java8 : "true"
|
||||
dateLibrary : "java8"
|
||||
serializableModel : "true"
|
||||
serializationLibrary : "jackson"
|
||||
interfaceOnly : "true"
|
||||
skipDefaultInterface : "true"
|
||||
prependFormOrBodyParameters : "true"
|
||||
useTags : "true"
|
||||
bigDecimalAsString : "true"
|
||||
booleanGetterPrefix : "is"
|
||||
useBeanValidation : "false"
|
||||
hideGenerationTimestamp : "true"
|
||||
openApiNullable : "false"
|
||||
19
architecture/api/templates/plantUml.mustache
Normal file
19
architecture/api/templates/plantUml.mustache
Normal file
@@ -0,0 +1,19 @@
|
||||
@startuml
|
||||
|
||||
!startsub Definition
|
||||
package {{specName}} {
|
||||
{{#each packages}}[{{this}}]
|
||||
{{/each}}
|
||||
}
|
||||
!endsub
|
||||
|
||||
!startsub Using
|
||||
{{#each references}}[{{this.Item1}}] --> [{{this.Item2}}]
|
||||
{{/each}}
|
||||
!endsub
|
||||
|
||||
!startsub UsedBy
|
||||
|
||||
!endsub
|
||||
|
||||
@enduml
|
||||
36
architecture/api/templates/settings.xml
Normal file
36
architecture/api/templates/settings.xml
Normal file
@@ -0,0 +1,36 @@
|
||||
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
|
||||
https://maven.apache.org/xsd/settings-1.0.0.xsd">
|
||||
<localRepository/>
|
||||
<interactiveMode/>
|
||||
<usePluginRegistry/>
|
||||
<offline/>
|
||||
<pluginGroups/>
|
||||
<servers>
|
||||
<!--
|
||||
In order to deploy a file to the registry and passing credentials to the command line like below
|
||||
mvn deploy:deploy-file \
|
||||
-Dfile=my-app.jar \
|
||||
-DgroupId=my.group.id \
|
||||
-DartifactId=my-artifact \
|
||||
-Dversion=0.1.1 \
|
||||
-Dpackaging=jar \
|
||||
-DgeneratePom=true \
|
||||
-DrepositoryId=my-repository-id \
|
||||
-Durl=my-repository-url \
|
||||
-Drepo.id=my-repository-id \
|
||||
-Drepo.username=admin \
|
||||
-Drepo.password=password
|
||||
-->
|
||||
<server>
|
||||
<id>${repo.id}</id>
|
||||
<username>${repo.username}</username>
|
||||
<password>${repo.password}</password>
|
||||
</server>
|
||||
</servers>
|
||||
<mirrors/>
|
||||
<proxies/>
|
||||
<profiles/>
|
||||
<activeProfiles/>
|
||||
</settings>
|
||||
Reference in New Issue
Block a user