forked from loafle/openapi-generator-original
use keyParamName (#17328)
This commit is contained in:
parent
39d5b4ebf9
commit
0ab9f74cfb
@ -31,7 +31,7 @@ namespace {{packageName}}.Test.{{apiPackage}}
|
||||
{{#lambda.trimTrailingWithNewLine}}
|
||||
{{#apiKeyMethods}}
|
||||
string apiKeyTokenValue{{-index}} = context.Configuration["<token>"] ?? throw new Exception("Token not found.");
|
||||
ApiKeyToken apiKeyToken{{-index}} = new{{^net70OrLater}} ApiKeyToken{{/net70OrLater}}(apiKeyTokenValue{{-index}}, ClientUtils.ApiKeyHeader.{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}, timeout: TimeSpan.FromSeconds(1));
|
||||
ApiKeyToken apiKeyToken{{-index}} = new{{^net70OrLater}} ApiKeyToken{{/net70OrLater}}(apiKeyTokenValue{{-index}}, ClientUtils.ApiKeyHeader.{{#lambda.titlecase}}{{keyParamName}}{{/lambda.titlecase}}, timeout: TimeSpan.FromSeconds(1));
|
||||
options.AddTokens(apiKeyToken{{-index}});
|
||||
|
||||
{{/apiKeyMethods}}
|
||||
|
@ -21,7 +21,7 @@ namespace {{packageName}}.Test.{{apiPackage}}
|
||||
{
|
||||
{{#lambda.trimTrailingWithNewLine}}
|
||||
{{#apiKeyMethods}}
|
||||
ApiKeyToken apiKeyToken{{-index}} = new{{^net70OrLater}} ApiKeyToken{{/net70OrLater}}("<token>", ClientUtils.ApiKeyHeader.{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}, timeout: TimeSpan.FromSeconds(1));
|
||||
ApiKeyToken apiKeyToken{{-index}} = new{{^net70OrLater}} ApiKeyToken{{/net70OrLater}}("<token>", ClientUtils.ApiKeyHeader.{{#lambda.titlecase}}{{keyParamName}}{{/lambda.titlecase}}, timeout: TimeSpan.FromSeconds(1));
|
||||
options.AddTokens(apiKeyToken{{-index}});
|
||||
|
||||
{{/apiKeyMethods}}
|
||||
@ -55,7 +55,7 @@ namespace {{packageName}}.Test.{{apiPackage}}
|
||||
{
|
||||
{{#lambda.trimTrailingWithNewLine}}
|
||||
{{#apiKeyMethods}}
|
||||
ApiKeyToken apiKeyToken{{-index}} = new{{^net70OrLater}} ApiKeyToken{{/net70OrLater}}("<token>", ClientUtils.ApiKeyHeader.{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}, timeout: TimeSpan.FromSeconds(1));
|
||||
ApiKeyToken apiKeyToken{{-index}} = new{{^net70OrLater}} ApiKeyToken{{/net70OrLater}}("<token>", ClientUtils.ApiKeyHeader.{{#lambda.titlecase}}{{keyParamName}}{{/lambda.titlecase}}, timeout: TimeSpan.FromSeconds(1));
|
||||
options.AddTokens(apiKeyToken{{-index}});
|
||||
|
||||
{{/apiKeyMethods}}
|
||||
@ -92,7 +92,7 @@ namespace {{packageName}}.Test.{{apiPackage}}
|
||||
{
|
||||
{{#lambda.trimTrailingWithNewLine}}
|
||||
{{#apiKeyMethods}}
|
||||
ApiKeyToken apiKeyToken{{-index}} = new{{^net70OrLater}} ApiKeyToken{{/net70OrLater}}("<token>", ClientUtils.ApiKeyHeader.{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}, timeout: TimeSpan.FromSeconds(1));
|
||||
ApiKeyToken apiKeyToken{{-index}} = new{{^net70OrLater}} ApiKeyToken{{/net70OrLater}}("<token>", ClientUtils.ApiKeyHeader.{{#lambda.titlecase}}{{keyParamName}}{{/lambda.titlecase}}, timeout: TimeSpan.FromSeconds(1));
|
||||
options.AddTokens(apiKeyToken{{-index}});
|
||||
|
||||
{{/apiKeyMethods}}
|
||||
@ -129,7 +129,7 @@ namespace {{packageName}}.Test.{{apiPackage}}
|
||||
{
|
||||
{{#lambda.trimTrailingWithNewLine}}
|
||||
{{#apiKeyMethods}}
|
||||
ApiKeyToken apiKeyToken{{-index}} = new{{^net70OrLater}} ApiKeyToken{{/net70OrLater}}("<token>", ClientUtils.ApiKeyHeader.{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}, timeout: TimeSpan.FromSeconds(1));
|
||||
ApiKeyToken apiKeyToken{{-index}} = new{{^net70OrLater}} ApiKeyToken{{/net70OrLater}}("<token>", ClientUtils.ApiKeyHeader.{{#lambda.titlecase}}{{keyParamName}}{{/lambda.titlecase}}, timeout: TimeSpan.FromSeconds(1));
|
||||
options.AddTokens(apiKeyToken{{-index}});
|
||||
|
||||
{{/apiKeyMethods}}
|
||||
|
@ -80,14 +80,18 @@ namespace YourProject
|
||||
public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args)
|
||||
.Configure{{apiName}}((context, options) =>
|
||||
{
|
||||
{{#authMethods}}// the type of token here depends on the api security specifications
|
||||
ApiKeyToken token = new("<your token>", ClientUtils.ApiKeyHeader.{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}});
|
||||
{{#authMethods}}
|
||||
{{#-first}}
|
||||
// the type of token here depends on the api security specifications
|
||||
ApiKeyToken token = new("<your token>", ClientUtils.ApiKeyHeader.Authorization);
|
||||
options.AddTokens(token);
|
||||
|
||||
// optionally choose the method the tokens will be provided with, default is RateLimitProvider
|
||||
options.UseProvider<RateLimitProvider<ApiKeyToken>, ApiKeyToken>();
|
||||
|
||||
{{/authMethods}}options.ConfigureJsonOptions((jsonOptions) =>
|
||||
{{/-first}}
|
||||
{{/authMethods}}
|
||||
options.ConfigureJsonOptions((jsonOptions) =>
|
||||
{
|
||||
// your custom converters if any
|
||||
});
|
||||
|
@ -69,42 +69,7 @@ namespace YourProject
|
||||
.ConfigureApi((context, options) =>
|
||||
{
|
||||
// the type of token here depends on the api security specifications
|
||||
ApiKeyToken token = new("<your token>", ClientUtils.ApiKeyHeader.Petstore_auth);
|
||||
options.AddTokens(token);
|
||||
|
||||
// optionally choose the method the tokens will be provided with, default is RateLimitProvider
|
||||
options.UseProvider<RateLimitProvider<ApiKeyToken>, ApiKeyToken>();
|
||||
|
||||
// the type of token here depends on the api security specifications
|
||||
ApiKeyToken token = new("<your token>", ClientUtils.ApiKeyHeader.Api_key);
|
||||
options.AddTokens(token);
|
||||
|
||||
// optionally choose the method the tokens will be provided with, default is RateLimitProvider
|
||||
options.UseProvider<RateLimitProvider<ApiKeyToken>, ApiKeyToken>();
|
||||
|
||||
// the type of token here depends on the api security specifications
|
||||
ApiKeyToken token = new("<your token>", ClientUtils.ApiKeyHeader.Api_key_query);
|
||||
options.AddTokens(token);
|
||||
|
||||
// optionally choose the method the tokens will be provided with, default is RateLimitProvider
|
||||
options.UseProvider<RateLimitProvider<ApiKeyToken>, ApiKeyToken>();
|
||||
|
||||
// the type of token here depends on the api security specifications
|
||||
ApiKeyToken token = new("<your token>", ClientUtils.ApiKeyHeader.Http_basic_test);
|
||||
options.AddTokens(token);
|
||||
|
||||
// optionally choose the method the tokens will be provided with, default is RateLimitProvider
|
||||
options.UseProvider<RateLimitProvider<ApiKeyToken>, ApiKeyToken>();
|
||||
|
||||
// the type of token here depends on the api security specifications
|
||||
ApiKeyToken token = new("<your token>", ClientUtils.ApiKeyHeader.Bearer_test);
|
||||
options.AddTokens(token);
|
||||
|
||||
// optionally choose the method the tokens will be provided with, default is RateLimitProvider
|
||||
options.UseProvider<RateLimitProvider<ApiKeyToken>, ApiKeyToken>();
|
||||
|
||||
// the type of token here depends on the api security specifications
|
||||
ApiKeyToken token = new("<your token>", ClientUtils.ApiKeyHeader.Http_signature_test);
|
||||
ApiKeyToken token = new("<your token>", ClientUtils.ApiKeyHeader.Authorization);
|
||||
options.AddTokens(token);
|
||||
|
||||
// optionally choose the method the tokens will be provided with, default is RateLimitProvider
|
||||
|
@ -69,42 +69,7 @@ namespace YourProject
|
||||
.ConfigureApi((context, options) =>
|
||||
{
|
||||
// the type of token here depends on the api security specifications
|
||||
ApiKeyToken token = new("<your token>", ClientUtils.ApiKeyHeader.Petstore_auth);
|
||||
options.AddTokens(token);
|
||||
|
||||
// optionally choose the method the tokens will be provided with, default is RateLimitProvider
|
||||
options.UseProvider<RateLimitProvider<ApiKeyToken>, ApiKeyToken>();
|
||||
|
||||
// the type of token here depends on the api security specifications
|
||||
ApiKeyToken token = new("<your token>", ClientUtils.ApiKeyHeader.Api_key);
|
||||
options.AddTokens(token);
|
||||
|
||||
// optionally choose the method the tokens will be provided with, default is RateLimitProvider
|
||||
options.UseProvider<RateLimitProvider<ApiKeyToken>, ApiKeyToken>();
|
||||
|
||||
// the type of token here depends on the api security specifications
|
||||
ApiKeyToken token = new("<your token>", ClientUtils.ApiKeyHeader.Api_key_query);
|
||||
options.AddTokens(token);
|
||||
|
||||
// optionally choose the method the tokens will be provided with, default is RateLimitProvider
|
||||
options.UseProvider<RateLimitProvider<ApiKeyToken>, ApiKeyToken>();
|
||||
|
||||
// the type of token here depends on the api security specifications
|
||||
ApiKeyToken token = new("<your token>", ClientUtils.ApiKeyHeader.Http_basic_test);
|
||||
options.AddTokens(token);
|
||||
|
||||
// optionally choose the method the tokens will be provided with, default is RateLimitProvider
|
||||
options.UseProvider<RateLimitProvider<ApiKeyToken>, ApiKeyToken>();
|
||||
|
||||
// the type of token here depends on the api security specifications
|
||||
ApiKeyToken token = new("<your token>", ClientUtils.ApiKeyHeader.Bearer_test);
|
||||
options.AddTokens(token);
|
||||
|
||||
// optionally choose the method the tokens will be provided with, default is RateLimitProvider
|
||||
options.UseProvider<RateLimitProvider<ApiKeyToken>, ApiKeyToken>();
|
||||
|
||||
// the type of token here depends on the api security specifications
|
||||
ApiKeyToken token = new("<your token>", ClientUtils.ApiKeyHeader.Http_signature_test);
|
||||
ApiKeyToken token = new("<your token>", ClientUtils.ApiKeyHeader.Authorization);
|
||||
options.AddTokens(token);
|
||||
|
||||
// optionally choose the method the tokens will be provided with, default is RateLimitProvider
|
||||
|
@ -69,42 +69,7 @@ namespace YourProject
|
||||
.ConfigureApi((context, options) =>
|
||||
{
|
||||
// the type of token here depends on the api security specifications
|
||||
ApiKeyToken token = new("<your token>", ClientUtils.ApiKeyHeader.Petstore_auth);
|
||||
options.AddTokens(token);
|
||||
|
||||
// optionally choose the method the tokens will be provided with, default is RateLimitProvider
|
||||
options.UseProvider<RateLimitProvider<ApiKeyToken>, ApiKeyToken>();
|
||||
|
||||
// the type of token here depends on the api security specifications
|
||||
ApiKeyToken token = new("<your token>", ClientUtils.ApiKeyHeader.Api_key);
|
||||
options.AddTokens(token);
|
||||
|
||||
// optionally choose the method the tokens will be provided with, default is RateLimitProvider
|
||||
options.UseProvider<RateLimitProvider<ApiKeyToken>, ApiKeyToken>();
|
||||
|
||||
// the type of token here depends on the api security specifications
|
||||
ApiKeyToken token = new("<your token>", ClientUtils.ApiKeyHeader.Api_key_query);
|
||||
options.AddTokens(token);
|
||||
|
||||
// optionally choose the method the tokens will be provided with, default is RateLimitProvider
|
||||
options.UseProvider<RateLimitProvider<ApiKeyToken>, ApiKeyToken>();
|
||||
|
||||
// the type of token here depends on the api security specifications
|
||||
ApiKeyToken token = new("<your token>", ClientUtils.ApiKeyHeader.Http_basic_test);
|
||||
options.AddTokens(token);
|
||||
|
||||
// optionally choose the method the tokens will be provided with, default is RateLimitProvider
|
||||
options.UseProvider<RateLimitProvider<ApiKeyToken>, ApiKeyToken>();
|
||||
|
||||
// the type of token here depends on the api security specifications
|
||||
ApiKeyToken token = new("<your token>", ClientUtils.ApiKeyHeader.Bearer_test);
|
||||
options.AddTokens(token);
|
||||
|
||||
// optionally choose the method the tokens will be provided with, default is RateLimitProvider
|
||||
options.UseProvider<RateLimitProvider<ApiKeyToken>, ApiKeyToken>();
|
||||
|
||||
// the type of token here depends on the api security specifications
|
||||
ApiKeyToken token = new("<your token>", ClientUtils.ApiKeyHeader.Http_signature_test);
|
||||
ApiKeyToken token = new("<your token>", ClientUtils.ApiKeyHeader.Authorization);
|
||||
options.AddTokens(token);
|
||||
|
||||
// optionally choose the method the tokens will be provided with, default is RateLimitProvider
|
||||
|
@ -69,42 +69,7 @@ namespace YourProject
|
||||
.ConfigureApi((context, options) =>
|
||||
{
|
||||
// the type of token here depends on the api security specifications
|
||||
ApiKeyToken token = new("<your token>", ClientUtils.ApiKeyHeader.Petstore_auth);
|
||||
options.AddTokens(token);
|
||||
|
||||
// optionally choose the method the tokens will be provided with, default is RateLimitProvider
|
||||
options.UseProvider<RateLimitProvider<ApiKeyToken>, ApiKeyToken>();
|
||||
|
||||
// the type of token here depends on the api security specifications
|
||||
ApiKeyToken token = new("<your token>", ClientUtils.ApiKeyHeader.Api_key);
|
||||
options.AddTokens(token);
|
||||
|
||||
// optionally choose the method the tokens will be provided with, default is RateLimitProvider
|
||||
options.UseProvider<RateLimitProvider<ApiKeyToken>, ApiKeyToken>();
|
||||
|
||||
// the type of token here depends on the api security specifications
|
||||
ApiKeyToken token = new("<your token>", ClientUtils.ApiKeyHeader.Api_key_query);
|
||||
options.AddTokens(token);
|
||||
|
||||
// optionally choose the method the tokens will be provided with, default is RateLimitProvider
|
||||
options.UseProvider<RateLimitProvider<ApiKeyToken>, ApiKeyToken>();
|
||||
|
||||
// the type of token here depends on the api security specifications
|
||||
ApiKeyToken token = new("<your token>", ClientUtils.ApiKeyHeader.Http_basic_test);
|
||||
options.AddTokens(token);
|
||||
|
||||
// optionally choose the method the tokens will be provided with, default is RateLimitProvider
|
||||
options.UseProvider<RateLimitProvider<ApiKeyToken>, ApiKeyToken>();
|
||||
|
||||
// the type of token here depends on the api security specifications
|
||||
ApiKeyToken token = new("<your token>", ClientUtils.ApiKeyHeader.Bearer_test);
|
||||
options.AddTokens(token);
|
||||
|
||||
// optionally choose the method the tokens will be provided with, default is RateLimitProvider
|
||||
options.UseProvider<RateLimitProvider<ApiKeyToken>, ApiKeyToken>();
|
||||
|
||||
// the type of token here depends on the api security specifications
|
||||
ApiKeyToken token = new("<your token>", ClientUtils.ApiKeyHeader.Http_signature_test);
|
||||
ApiKeyToken token = new("<your token>", ClientUtils.ApiKeyHeader.Authorization);
|
||||
options.AddTokens(token);
|
||||
|
||||
// optionally choose the method the tokens will be provided with, default is RateLimitProvider
|
||||
|
Loading…
x
Reference in New Issue
Block a user