forked from loafle/openapi-generator-original
[PowerShell] Support ApiKeyPrefix (#19133)
* Support for ApiKeyPrefix * Additional files after build
This commit is contained in:
parent
9948ed2cfa
commit
2940d3219c
@ -177,15 +177,20 @@ function {{{vendorExtensions.x-powershell-method-name}}} {
|
||||
{{/bodyParam}}
|
||||
{{#authMethods}}
|
||||
{{#isApiKey}}
|
||||
if ($Configuration["ApiKeyPrefix"] -and $Configuration["ApiKeyPrefix"]["{{{keyParamName}}}"]) {
|
||||
$apiKeyPrefix = $Configuration["ApiKeyPrefix"]["{{{keyParamName}}}"]
|
||||
} else {
|
||||
$apiKeyPrefix = ""
|
||||
}
|
||||
{{#isKeyInHeader}}
|
||||
if ($Configuration["ApiKey"] -and $Configuration["ApiKey"]["{{{keyParamName}}}"]) {
|
||||
$LocalVarHeaderParameters['{{{keyParamName}}}'] = $Configuration["ApiKey"]["{{{keyParamName}}}"]
|
||||
$LocalVarHeaderParameters['{{{keyParamName}}}'] = $apiKeyPrefix + $Configuration["ApiKey"]["{{{keyParamName}}}"]
|
||||
Write-Verbose ("Using API key '{{{keyParamName}}}' in the header for authentication in {0}" -f $MyInvocation.MyCommand)
|
||||
}
|
||||
{{/isKeyInHeader}}
|
||||
{{#isKeyInQuery}}
|
||||
if ($Configuration["ApiKey"] -and $Configuration["ApiKey"]["{{{keyParamName}}}"]) {
|
||||
$LocalVarQueryParameters['{{{keyParamName}}}'] = $Configuration["ApiKey"]["{{{keyParamName}}}"]
|
||||
$LocalVarQueryParameters['{{{keyParamName}}}'] = $apiKeyPrefix + $Configuration["ApiKey"]["{{{keyParamName}}}"]
|
||||
Write-Verbose ("Using API key `{{{keyParamName}}}` in the URL query for authentication in {0}" -f $MyInvocation.MyCommand)
|
||||
}
|
||||
{{/isKeyInQuery}}
|
||||
|
@ -63,8 +63,13 @@ function Test-PSClassname {
|
||||
|
||||
$LocalVarBodyParameter = $Client | ConvertTo-Json -Depth 100
|
||||
|
||||
if ($Configuration["ApiKeyPrefix"] -and $Configuration["ApiKeyPrefix"]["api_key_query_name"]) {
|
||||
$apiKeyPrefix = $Configuration["ApiKeyPrefix"]["api_key_query_name"]
|
||||
} else {
|
||||
$apiKeyPrefix = ""
|
||||
}
|
||||
if ($Configuration["ApiKey"] -and $Configuration["ApiKey"]["api_key_query_name"]) {
|
||||
$LocalVarQueryParameters['api_key_query_name'] = $Configuration["ApiKey"]["api_key_query_name"]
|
||||
$LocalVarQueryParameters['api_key_query_name'] = $apiKeyPrefix + $Configuration["ApiKey"]["api_key_query_name"]
|
||||
Write-Verbose ("Using API key `api_key_query_name` in the URL query for authentication in {0}" -f $MyInvocation.MyCommand)
|
||||
}
|
||||
|
||||
|
@ -405,8 +405,13 @@ function Get-PSPetById {
|
||||
}
|
||||
$LocalVarUri = $LocalVarUri.replace('{petId}', [System.Web.HTTPUtility]::UrlEncode($PetId))
|
||||
|
||||
if ($Configuration["ApiKeyPrefix"] -and $Configuration["ApiKeyPrefix"]["api_key_name"]) {
|
||||
$apiKeyPrefix = $Configuration["ApiKeyPrefix"]["api_key_name"]
|
||||
} else {
|
||||
$apiKeyPrefix = ""
|
||||
}
|
||||
if ($Configuration["ApiKey"] -and $Configuration["ApiKey"]["api_key_name"]) {
|
||||
$LocalVarHeaderParameters['api_key_name'] = $Configuration["ApiKey"]["api_key_name"]
|
||||
$LocalVarHeaderParameters['api_key_name'] = $apiKeyPrefix + $Configuration["ApiKey"]["api_key_name"]
|
||||
Write-Verbose ("Using API key 'api_key_name' in the header for authentication in {0}" -f $MyInvocation.MyCommand)
|
||||
}
|
||||
|
||||
|
@ -118,8 +118,13 @@ function Get-PSInventory {
|
||||
|
||||
$LocalVarUri = '/store/inventory'
|
||||
|
||||
if ($Configuration["ApiKeyPrefix"] -and $Configuration["ApiKeyPrefix"]["api_key_name"]) {
|
||||
$apiKeyPrefix = $Configuration["ApiKeyPrefix"]["api_key_name"]
|
||||
} else {
|
||||
$apiKeyPrefix = ""
|
||||
}
|
||||
if ($Configuration["ApiKey"] -and $Configuration["ApiKey"]["api_key_name"]) {
|
||||
$LocalVarHeaderParameters['api_key_name'] = $Configuration["ApiKey"]["api_key_name"]
|
||||
$LocalVarHeaderParameters['api_key_name'] = $apiKeyPrefix + $Configuration["ApiKey"]["api_key_name"]
|
||||
Write-Verbose ("Using API key 'api_key_name' in the header for authentication in {0}" -f $MyInvocation.MyCommand)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user