File tree Expand file tree Collapse file tree
modules/openapi-generator/src/main/resources/powershell
samples/client/petstore/powershell/src/PSPetstore/Api Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -177,15 +177,20 @@ function {{{vendorExtensions.x-powershell-method-name}}} {
177177 { {/bodyParam} }
178178 { {#authMethods} }
179179 { {#isApiKey} }
180+ if ($Configuration["ApiKeyPrefix"] -and $Configuration["ApiKeyPrefix"]["{ {{keyParamName} }}"]) {
181+ $apiKeyPrefix = $Configuration [" ApiKeyPrefix" ][" {{{keyParamName}}}" ]
182+ } else {
183+ $apiKeyPrefix = " "
184+ }
180185 { {#isKeyInHeader} }
181186 if ($Configuration["ApiKey"] -and $Configuration["ApiKey"]["{ {{keyParamName} }}"]) {
182- $LocalVarHeaderParameters [' {{{keyParamName}}}' ] = $Configuration [" ApiKey" ][" {{{keyParamName}}}" ]
187+ $LocalVarHeaderParameters [' {{{keyParamName}}}' ] = $apiKeyPrefix + $ Configuration [" ApiKey" ][" {{{keyParamName}}}" ]
183188 Write-Verbose (" Using API key '{{{keyParamName}}}' in the header for authentication in {0}" -f $MyInvocation .MyCommand)
184189 }
185190 { {/isKeyInHeader} }
186191 { {#isKeyInQuery} }
187192 if ($Configuration["ApiKey"] -and $Configuration["ApiKey"]["{ {{keyParamName} }}"]) {
188- $LocalVarQueryParameters [' {{{keyParamName}}}' ] = $Configuration [" ApiKey" ][" {{{keyParamName}}}" ]
193+ $LocalVarQueryParameters [' {{{keyParamName}}}' ] = $apiKeyPrefix + $ Configuration [" ApiKey" ][" {{{keyParamName}}}" ]
189194 Write-Verbose (" Using API key `{{{keyParamName}}}` in the URL query for authentication in {0}" -f $MyInvocation .MyCommand)
190195 }
191196 { {/isKeyInQuery} }
Original file line number Diff line number Diff line change @@ -63,8 +63,13 @@ function Test-PSClassname {
6363
6464 $LocalVarBodyParameter = $Client | ConvertTo-Json - Depth 100
6565
66+ if ($Configuration [" ApiKeyPrefix" ] -and $Configuration [" ApiKeyPrefix" ][" api_key_query_name" ]) {
67+ $apiKeyPrefix = $Configuration [" ApiKeyPrefix" ][" api_key_query_name" ]
68+ } else {
69+ $apiKeyPrefix = " "
70+ }
6671 if ($Configuration [" ApiKey" ] -and $Configuration [" ApiKey" ][" api_key_query_name" ]) {
67- $LocalVarQueryParameters [' api_key_query_name' ] = $Configuration [" ApiKey" ][" api_key_query_name" ]
72+ $LocalVarQueryParameters [' api_key_query_name' ] = $apiKeyPrefix + $ Configuration [" ApiKey" ][" api_key_query_name" ]
6873 Write-Verbose (" Using API key `a pi_key_query_name` in the URL query for authentication in {0}" -f $MyInvocation.MyCommand )
6974 }
7075
Original file line number Diff line number Diff line change @@ -405,8 +405,13 @@ function Get-PSPetById {
405405 }
406406 $LocalVarUri = $LocalVarUri.replace (' {petId}' , [System.Web.HTTPUtility ]::UrlEncode($PetId ))
407407
408+ if ($Configuration [" ApiKeyPrefix" ] -and $Configuration [" ApiKeyPrefix" ][" api_key_name" ]) {
409+ $apiKeyPrefix = $Configuration [" ApiKeyPrefix" ][" api_key_name" ]
410+ } else {
411+ $apiKeyPrefix = " "
412+ }
408413 if ($Configuration [" ApiKey" ] -and $Configuration [" ApiKey" ][" api_key_name" ]) {
409- $LocalVarHeaderParameters [' api_key_name' ] = $Configuration [" ApiKey" ][" api_key_name" ]
414+ $LocalVarHeaderParameters [' api_key_name' ] = $apiKeyPrefix + $ Configuration [" ApiKey" ][" api_key_name" ]
410415 Write-Verbose (" Using API key 'api_key_name' in the header for authentication in {0}" -f $MyInvocation.MyCommand )
411416 }
412417
Original file line number Diff line number Diff line change @@ -118,8 +118,13 @@ function Get-PSInventory {
118118
119119 $LocalVarUri = ' /store/inventory'
120120
121+ if ($Configuration [" ApiKeyPrefix" ] -and $Configuration [" ApiKeyPrefix" ][" api_key_name" ]) {
122+ $apiKeyPrefix = $Configuration [" ApiKeyPrefix" ][" api_key_name" ]
123+ } else {
124+ $apiKeyPrefix = " "
125+ }
121126 if ($Configuration [" ApiKey" ] -and $Configuration [" ApiKey" ][" api_key_name" ]) {
122- $LocalVarHeaderParameters [' api_key_name' ] = $Configuration [" ApiKey" ][" api_key_name" ]
127+ $LocalVarHeaderParameters [' api_key_name' ] = $apiKeyPrefix + $ Configuration [" ApiKey" ][" api_key_name" ]
123128 Write-Verbose (" Using API key 'api_key_name' in the header for authentication in {0}" -f $MyInvocation.MyCommand )
124129 }
125130
You can’t perform that action at this time.
0 commit comments