diff --git a/bin/configs/powershell-echo-api.yaml b/bin/configs/powershell-echo-api.yaml new file mode 100644 index 00000000000..2bf9c383c17 --- /dev/null +++ b/bin/configs/powershell-echo-api.yaml @@ -0,0 +1,7 @@ +generatorName: powershell +outputDir: samples/client/echo_api/powershell +inputSpec: modules/openapi-generator/src/test/resources/3_0/echo_api.yaml +templateDir: modules/openapi-generator/src/main/resources/powershell +additionalProperties: + hideGenerationTimestamp: "true" + packageGuid: a27b908d-2a20-467f-bc32-af6f3a654ac5 diff --git a/modules/openapi-generator/src/test/resources/3_0/powershell/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml b/modules/openapi-generator/src/test/resources/3_0/powershell/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml index aecc1b8d447..ff6dc25960f 100644 --- a/modules/openapi-generator/src/test/resources/3_0/powershell/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/powershell/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml @@ -1206,11 +1206,11 @@ components: 'read:pets': read your pets api_key: type: apiKey - name: api_key + name: api_key_name in: header api_key_query: type: apiKey - name: api_key_query + name: api_key_query_name in: query http_basic_test: type: http diff --git a/samples/client/echo_api/powershell/.openapi-generator-ignore b/samples/client/echo_api/powershell/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/client/echo_api/powershell/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/echo_api/powershell/.openapi-generator/FILES b/samples/client/echo_api/powershell/.openapi-generator/FILES new file mode 100644 index 00000000000..109ec023736 --- /dev/null +++ b/samples/client/echo_api/powershell/.openapi-generator/FILES @@ -0,0 +1,45 @@ +Build.ps1 +README.md +appveyor.yml +docs/AuthApi.md +docs/Bird.md +docs/BodyApi.md +docs/Category.md +docs/DataQuery.md +docs/DefaultValue.md +docs/FormApi.md +docs/HeaderApi.md +docs/NumberPropertiesOnly.md +docs/PathApi.md +docs/Pet.md +docs/Query.md +docs/QueryApi.md +docs/StringEnumRef.md +docs/Tag.md +docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md +docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md +src/PSOpenAPITools/Api/AuthApi.ps1 +src/PSOpenAPITools/Api/BodyApi.ps1 +src/PSOpenAPITools/Api/FormApi.ps1 +src/PSOpenAPITools/Api/HeaderApi.ps1 +src/PSOpenAPITools/Api/PathApi.ps1 +src/PSOpenAPITools/Api/QueryApi.ps1 +src/PSOpenAPITools/Client/Configuration.ps1 +src/PSOpenAPITools/Model/Bird.ps1 +src/PSOpenAPITools/Model/Category.ps1 +src/PSOpenAPITools/Model/DataQuery.ps1 +src/PSOpenAPITools/Model/DefaultValue.ps1 +src/PSOpenAPITools/Model/NumberPropertiesOnly.ps1 +src/PSOpenAPITools/Model/Pet.ps1 +src/PSOpenAPITools/Model/Query.ps1 +src/PSOpenAPITools/Model/StringEnumRef.ps1 +src/PSOpenAPITools/Model/Tag.ps1 +src/PSOpenAPITools/Model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.ps1 +src/PSOpenAPITools/Model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.ps1 +src/PSOpenAPITools/PSOpenAPITools.psm1 +src/PSOpenAPITools/Private/ApiClient.ps1 +src/PSOpenAPITools/Private/Get-CommonParameters.ps1 +src/PSOpenAPITools/Private/HttpSignatureAuth.ps1 +src/PSOpenAPITools/Private/Out-DebugParameter.ps1 +src/PSOpenAPITools/Private/RSAEncryptionProvider.cs +src/PSOpenAPITools/en-US/about_PSOpenAPITools.help.txt diff --git a/samples/client/echo_api/powershell/.openapi-generator/VERSION b/samples/client/echo_api/powershell/.openapi-generator/VERSION new file mode 100644 index 00000000000..40e36364ab2 --- /dev/null +++ b/samples/client/echo_api/powershell/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.1.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/echo_api/powershell/Build.ps1 b/samples/client/echo_api/powershell/Build.ps1 new file mode 100644 index 00000000000..49d6a3a9274 --- /dev/null +++ b/samples/client/echo_api/powershell/Build.ps1 @@ -0,0 +1,73 @@ +# +# Echo Server API +# Echo Server API +# Version: 0.1.0 +# Contact: team@openapitools.org +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +function Get-FunctionsToExport { + [CmdletBinding()] + Param ( + [Parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)] + [ValidateNotNullOrEmpty()] + [Alias('FullName')] + $Path + ) + + Process { + $Token = $null + $ParserErr = $null + + $Ast = [System.Management.Automation.Language.Parser]::ParseFile( + $Path, + [ref]$Token, + [ref]$ParserErr + ) + + if ($ParserErr) { + throw $ParserErr + } else { + foreach ($name in 'Begin', 'Process', 'End') { + foreach ($Statement in $Ast."${name}Block".Statements) { + if ( + [String]::IsNullOrWhiteSpace($Statement.Name) -or + $Statement.Extent.ToString() -notmatch + ('function\W+{0}' -f $Statement.Name) + ) { + continue + } + + $Statement.Name + } + } + } + } +} + +$ScriptDir = Split-Path $script:MyInvocation.MyCommand.Path +$FunctionPath = 'Api', 'Model', 'Client' | ForEach-Object {Join-Path "$ScriptDir\src\PSOpenAPITools\" $_} + +$Manifest = @{ + Path = "$ScriptDir\src\PSOpenAPITools\PSOpenAPITools.psd1" + + Author = 'OpenAPI Generator Team' + CompanyName = 'openapitools.org' + Description = 'PSOpenAPITools - the PowerShell module for Echo Server API' + + ModuleVersion = '0.1.2' + + RootModule = 'PSOpenAPITools.psm1' + Guid = 'a27b908d-2a20-467f-bc32-af6f3a654ac5' # Has to be static, otherwise each new build will be considered different module + + PowerShellVersion = '6.2' + + FunctionsToExport = $FunctionPath | Get-ChildItem -Filter *.ps1 | Get-FunctionsToExport + + VariablesToExport = @() + AliasesToExport = @() + CmdletsToExport = @() + +} + +New-ModuleManifest @Manifest diff --git a/samples/client/echo_api/powershell/README.md b/samples/client/echo_api/powershell/README.md new file mode 100644 index 00000000000..0ef000a4ecc --- /dev/null +++ b/samples/client/echo_api/powershell/README.md @@ -0,0 +1,102 @@ +# PSOpenAPITools - the PowerShell module for the Echo Server API + +Echo Server API + +This PowerShell module is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: 0.1.0 +- SDK version: 0.1.2 +- Build package: org.openapitools.codegen.languages.PowerShellClientCodegen + + +## Frameworks supported +- PowerShell 6.2 or later + + +## Dependencies + + +## Installation + + +To install from the source, run the following command to build and install the PowerShell module locally: +```powershell +Build.ps1 +Import-Module -Name '.\src\PSOpenAPITools' -Verbose +``` + +To avoid function name collision, one can use `-Prefix`, e.g. `Import-Module -Name '.\src\PSOpenAPITools' -Prefix prefix` + +To uninstall the module, simply run: +```powershell +Remove-Module -FullyQualifiedName @{ModuleName = "PSOpenAPITools"; ModuleVersion = "0.1.2"} +``` + + +## Tests + +To install and run `Pester`, please execute the following commands in the terminal: + +```powershell +Install-module -name Pester -force + +Invoke-Pester +``` + +For troubleshooting, please run `$DebugPreference = 'Continue'` to turn on debugging and disable it with `$DebugPreference = 'SilentlyContinue'` when done with the troubleshooting. + +## Documentation for API Endpoints + +All URIs are relative to *http://localhost:3000* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*AuthApi* | [**Test-AuthHttpBasic**](docs/AuthApi.md#Test-AuthHttpBasic) | **POST** /auth/http/basic | To test HTTP basic authentication +*BodyApi* | [**Test-BinaryGif**](docs/BodyApi.md#Test-BinaryGif) | **POST** /binary/gif | Test binary (gif) response body +*BodyApi* | [**Test-BodyApplicationOctetstreamBinary**](docs/BodyApi.md#Test-BodyApplicationOctetstreamBinary) | **POST** /body/application/octetstream/binary | Test body parameter(s) +*BodyApi* | [**Test-BodyMultipartFormdataArrayOfBinary**](docs/BodyApi.md#Test-BodyMultipartFormdataArrayOfBinary) | **POST** /body/application/octetstream/array_of_binary | Test array of binary in multipart mime +*BodyApi* | [**Test-EchoBodyFreeFormObjectResponseString**](docs/BodyApi.md#Test-EchoBodyFreeFormObjectResponseString) | **POST** /echo/body/FreeFormObject/response_string | Test free form object +*BodyApi* | [**Test-EchoBodyPet**](docs/BodyApi.md#Test-EchoBodyPet) | **POST** /echo/body/Pet | Test body parameter(s) +*BodyApi* | [**Test-EchoBodyPetResponseString**](docs/BodyApi.md#Test-EchoBodyPetResponseString) | **POST** /echo/body/Pet/response_string | Test empty response body +*BodyApi* | [**Test-EchoBodyTagResponseString**](docs/BodyApi.md#Test-EchoBodyTagResponseString) | **POST** /echo/body/Tag/response_string | Test empty json (request body) +*BodyApi* | [**Test-EchoBodyAllOfPet**](docs/BodyApi.md#Test-EchoBodyAllOfPet) | **POST** /echo/body/allOf/Pet | Test body parameter(s) +*FormApi* | [**Test-FormIntegerBooleanString**](docs/FormApi.md#Test-FormIntegerBooleanString) | **POST** /form/integer/boolean/string | Test form parameter(s) +*FormApi* | [**Test-FormOneof**](docs/FormApi.md#Test-FormOneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema +*HeaderApi* | [**Test-HeaderIntegerBooleanStringEnums**](docs/HeaderApi.md#Test-HeaderIntegerBooleanStringEnums) | **GET** /header/integer/boolean/string/enums | Test header parameter(s) +*PathApi* | [**Test-sPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath**](docs/PathApi.md#Test-sPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath) | **GET** /path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path} | Test path parameter(s) +*QueryApi* | [**Test-EnumRefString**](docs/QueryApi.md#Test-EnumRefString) | **GET** /query/enum_ref_string | Test query parameter(s) +*QueryApi* | [**Test-QueryDatetimeDateString**](docs/QueryApi.md#Test-QueryDatetimeDateString) | **GET** /query/datetime/date/string | Test query parameter(s) +*QueryApi* | [**Test-QueryIntegerBooleanString**](docs/QueryApi.md#Test-QueryIntegerBooleanString) | **GET** /query/integer/boolean/string | Test query parameter(s) +*QueryApi* | [**Test-QueryStyleDeepObjectExplodeTrueObject**](docs/QueryApi.md#Test-QueryStyleDeepObjectExplodeTrueObject) | **GET** /query/style_deepObject/explode_true/object | Test query parameter(s) +*QueryApi* | [**Test-QueryStyleDeepObjectExplodeTrueObjectAllOf**](docs/QueryApi.md#Test-QueryStyleDeepObjectExplodeTrueObjectAllOf) | **GET** /query/style_deepObject/explode_true/object/allOf | Test query parameter(s) +*QueryApi* | [**Test-QueryStyleFormExplodeTrueArrayString**](docs/QueryApi.md#Test-QueryStyleFormExplodeTrueArrayString) | **GET** /query/style_form/explode_true/array_string | Test query parameter(s) +*QueryApi* | [**Test-QueryStyleFormExplodeTrueObject**](docs/QueryApi.md#Test-QueryStyleFormExplodeTrueObject) | **GET** /query/style_form/explode_true/object | Test query parameter(s) +*QueryApi* | [**Test-QueryStyleFormExplodeTrueObjectAllOf**](docs/QueryApi.md#Test-QueryStyleFormExplodeTrueObjectAllOf) | **GET** /query/style_form/explode_true/object/allOf | Test query parameter(s) + + +## Documentation for Models + + - [PSOpenAPITools\Model.Bird](docs/Bird.md) + - [PSOpenAPITools\Model.Category](docs/Category.md) + - [PSOpenAPITools\Model.DataQuery](docs/DataQuery.md) + - [PSOpenAPITools\Model.DefaultValue](docs/DefaultValue.md) + - [PSOpenAPITools\Model.NumberPropertiesOnly](docs/NumberPropertiesOnly.md) + - [PSOpenAPITools\Model.Pet](docs/Pet.md) + - [PSOpenAPITools\Model.Query](docs/Query.md) + - [PSOpenAPITools\Model.StringEnumRef](docs/StringEnumRef.md) + - [PSOpenAPITools\Model.Tag](docs/Tag.md) + - [PSOpenAPITools\Model.TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter](docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md) + - [PSOpenAPITools\Model.TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter](docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md) + + + +## Documentation for Authorization + + +Authentication schemes defined for the API: + +### http_auth + + +- **Type**: HTTP basic authentication + diff --git a/samples/client/echo_api/powershell/appveyor.yml b/samples/client/echo_api/powershell/appveyor.yml new file mode 100644 index 00000000000..0df91baedea --- /dev/null +++ b/samples/client/echo_api/powershell/appveyor.yml @@ -0,0 +1,41 @@ +# +# Echo Server API +# Echo Server API +# Version: 0.1.0 +# Contact: team@openapitools.org +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +version: 1.0.{build} +image: + - Visual Studio 2019 # PWSH 7.x + #- Visual Studio 2017 # PS 5.x, PWSH 6.x + #- Ubuntu # PWSH 6.x + # ref: https://www.appveyor.com/docs/windows-images-software/ +install: + - pwsh: $PSVersionTable.PSVersion + - pwsh: Install-Module Pester -Force -Scope CurrentUser +build: off +test_script: + - pwsh: | + .\Build.ps1 + Import-Module -Name '.\src\PSOpenAPITools' + $Result = Invoke-Pester -PassThru + if ($Result.FailedCount -gt 0) { + $host.SetShouldExit($Result.FailedCount) + exit $Result.FailedCount + } +deploy_script: + - pwsh: | + if ($env:APPVEYOR_REPO_TAG -eq $true -and $null -ne $env:NuGetApiKey) { + .\Build.ps1 + try { + Publish-Module -NuGetApiKey $env:NuGetApiKey -Path .\src\PSOpenAPITools\ -Confirm:$False -Verbose + Write-Host "Successfully published the PowerShell module." + } catch { + $host.SetShouldExit($LastExitCode) + Write-Host "Error when running Publish-Module:" + Write-Host $_ + exit + } + } diff --git a/samples/client/echo_api/powershell/docs/AuthApi.md b/samples/client/echo_api/powershell/docs/AuthApi.md new file mode 100644 index 00000000000..9fabb8c0d6d --- /dev/null +++ b/samples/client/echo_api/powershell/docs/AuthApi.md @@ -0,0 +1,53 @@ +# PSOpenAPITools.PSOpenAPITools\Api.AuthApi + +All URIs are relative to *http://localhost:3000* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**Test-AuthHttpBasic**](AuthApi.md#Test-AuthHttpBasic) | **POST** /auth/http/basic | To test HTTP basic authentication + + + +# **Test-AuthHttpBasic** +> String Test-AuthHttpBasic
+ +To test HTTP basic authentication + +To test HTTP basic authentication + +### Example +```powershell +# general setting of the PowerShell module, e.g. base URL, authentication, etc +$Configuration = Get-Configuration +# Configure HTTP basic authorization: http_auth +$Configuration.Username = "YOUR_USERNAME" +$Configuration.Password = "YOUR_PASSWORD" + + +# To test HTTP basic authentication +try { + $Result = Test-AuthHttpBasic +} catch { + Write-Host ("Exception occurred when calling Test-AuthHttpBasic: {0}" -f ($_.ErrorDetails | ConvertFrom-Json)) + Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json)) +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +**String** + +### Authorization + +[http_auth](../README.md#http_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/echo_api/powershell/docs/Bird.md b/samples/client/echo_api/powershell/docs/Bird.md new file mode 100644 index 00000000000..1f9a67dfe95 --- /dev/null +++ b/samples/client/echo_api/powershell/docs/Bird.md @@ -0,0 +1,23 @@ +# Bird +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Size** | **String** | | [optional] +**Color** | **String** | | [optional] + +## Examples + +- Prepare the resource +```powershell +$Bird = Initialize-PSOpenAPIToolsBird -Size null ` + -Color null +``` + +- Convert the resource to JSON +```powershell +$Bird | ConvertTo-JSON +``` + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/echo_api/powershell/docs/BodyApi.md b/samples/client/echo_api/powershell/docs/BodyApi.md new file mode 100644 index 00000000000..b2c52e663ed --- /dev/null +++ b/samples/client/echo_api/powershell/docs/BodyApi.md @@ -0,0 +1,361 @@ +# PSOpenAPITools.PSOpenAPITools\Api.BodyApi + +All URIs are relative to *http://localhost:3000* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**Test-BinaryGif**](BodyApi.md#Test-BinaryGif) | **POST** /binary/gif | Test binary (gif) response body +[**Test-BodyApplicationOctetstreamBinary**](BodyApi.md#Test-BodyApplicationOctetstreamBinary) | **POST** /body/application/octetstream/binary | Test body parameter(s) +[**Test-BodyMultipartFormdataArrayOfBinary**](BodyApi.md#Test-BodyMultipartFormdataArrayOfBinary) | **POST** /body/application/octetstream/array_of_binary | Test array of binary in multipart mime +[**Test-EchoBodyFreeFormObjectResponseString**](BodyApi.md#Test-EchoBodyFreeFormObjectResponseString) | **POST** /echo/body/FreeFormObject/response_string | Test free form object +[**Test-EchoBodyPet**](BodyApi.md#Test-EchoBodyPet) | **POST** /echo/body/Pet | Test body parameter(s) +[**Test-EchoBodyPetResponseString**](BodyApi.md#Test-EchoBodyPetResponseString) | **POST** /echo/body/Pet/response_string | Test empty response body +[**Test-EchoBodyTagResponseString**](BodyApi.md#Test-EchoBodyTagResponseString) | **POST** /echo/body/Tag/response_string | Test empty json (request body) +[**Test-EchoBodyAllOfPet**](BodyApi.md#Test-EchoBodyAllOfPet) | **POST** /echo/body/allOf/Pet | Test body parameter(s) + + + +# **Test-BinaryGif** +> System.IO.FileInfo Test-BinaryGif
+ +Test binary (gif) response body + +Test binary (gif) response body + +### Example +```powershell + +# Test binary (gif) response body +try { + $Result = Test-BinaryGif +} catch { + Write-Host ("Exception occurred when calling Test-BinaryGif: {0}" -f ($_.ErrorDetails | ConvertFrom-Json)) + Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json)) +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +**System.IO.FileInfo** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: image/gif + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **Test-BodyApplicationOctetstreamBinary** +> String Test-BodyApplicationOctetstreamBinary
+>         [-Body]
+ +Test body parameter(s) + +Test body parameter(s) + +### Example +```powershell +$Body = # System.IO.FileInfo | (optional) + +# Test body parameter(s) +try { + $Result = Test-BodyApplicationOctetstreamBinary -Body $Body +} catch { + Write-Host ("Exception occurred when calling Test-BodyApplicationOctetstreamBinary: {0}" -f ($_.ErrorDetails | ConvertFrom-Json)) + Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json)) +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **Body** | **System.IO.FileInfo****System.IO.FileInfo**| | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/octet-stream + - **Accept**: text/plain + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **Test-BodyMultipartFormdataArrayOfBinary** +> String Test-BodyMultipartFormdataArrayOfBinary
+>         [-Files]
+ +Test array of binary in multipart mime + +Test array of binary in multipart mime + +### Example +```powershell +$Files = # System.IO.FileInfo[] | + +# Test array of binary in multipart mime +try { + $Result = Test-BodyMultipartFormdataArrayOfBinary -Files $Files +} catch { + Write-Host ("Exception occurred when calling Test-BodyMultipartFormdataArrayOfBinary: {0}" -f ($_.ErrorDetails | ConvertFrom-Json)) + Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json)) +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **Files** | **System.IO.FileInfo[]**| | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: text/plain + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **Test-EchoBodyFreeFormObjectResponseString** +> String Test-EchoBodyFreeFormObjectResponseString
+>         [-Body]
+ +Test free form object + +Test free form object + +### Example +```powershell +$Body = @{ key_example = ... } # SystemCollectionsHashtable | Free form object (optional) + +# Test free form object +try { + $Result = Test-EchoBodyFreeFormObjectResponseString -Body $Body +} catch { + Write-Host ("Exception occurred when calling Test-EchoBodyFreeFormObjectResponseString: {0}" -f ($_.ErrorDetails | ConvertFrom-Json)) + Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json)) +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **Body** | **SystemCollectionsHashtable**| Free form object | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: text/plain + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **Test-EchoBodyPet** +> Pet Test-EchoBodyPet
+>         [-Pet]
+ +Test body parameter(s) + +Test body parameter(s) + +### Example +```powershell +$Category = Initialize-Category -Id 1 -Name "Dogs" +$Tag = Initialize-Tag -Id 0 -Name "MyName" +$Pet = Initialize-Pet -Id 10 -Name "doggie" -Category $Category -PhotoUrls "MyPhotoUrls" -Tags $Tag -Status "available" # Pet | Pet object that needs to be added to the store (optional) + +# Test body parameter(s) +try { + $Result = Test-EchoBodyPet -Pet $Pet +} catch { + Write-Host ("Exception occurred when calling Test-EchoBodyPet: {0}" -f ($_.ErrorDetails | ConvertFrom-Json)) + Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json)) +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **Pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] + +### Return type + +[**Pet**](Pet.md) (PSCustomObject) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **Test-EchoBodyPetResponseString** +> String Test-EchoBodyPetResponseString
+>         [-Pet]
+ +Test empty response body + +Test empty response body + +### Example +```powershell +$Category = Initialize-Category -Id 1 -Name "Dogs" +$Tag = Initialize-Tag -Id 0 -Name "MyName" +$Pet = Initialize-Pet -Id 10 -Name "doggie" -Category $Category -PhotoUrls "MyPhotoUrls" -Tags $Tag -Status "available" # Pet | Pet object that needs to be added to the store (optional) + +# Test empty response body +try { + $Result = Test-EchoBodyPetResponseString -Pet $Pet +} catch { + Write-Host ("Exception occurred when calling Test-EchoBodyPetResponseString: {0}" -f ($_.ErrorDetails | ConvertFrom-Json)) + Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json)) +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **Pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: text/plain + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **Test-EchoBodyTagResponseString** +> String Test-EchoBodyTagResponseString
+>         [-Tag]
+ +Test empty json (request body) + +Test empty json (request body) + +### Example +```powershell +$Tag = Initialize-Tag -Id 0 -Name "MyName" # Tag | Tag object (optional) + +# Test empty json (request body) +try { + $Result = Test-EchoBodyTagResponseString -Tag $Tag +} catch { + Write-Host ("Exception occurred when calling Test-EchoBodyTagResponseString: {0}" -f ($_.ErrorDetails | ConvertFrom-Json)) + Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json)) +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **Tag** | [**Tag**](Tag.md)| Tag object | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: text/plain + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **Test-EchoBodyAllOfPet** +> Pet Test-EchoBodyAllOfPet
+>         [-Pet]
+ +Test body parameter(s) + +Test body parameter(s) + +### Example +```powershell +$Category = Initialize-Category -Id 1 -Name "Dogs" +$Tag = Initialize-Tag -Id 0 -Name "MyName" +$Pet = Initialize-Pet -Id 10 -Name "doggie" -Category $Category -PhotoUrls "MyPhotoUrls" -Tags $Tag -Status "available" # Pet | Pet object that needs to be added to the store (optional) + +# Test body parameter(s) +try { + $Result = Test-EchoBodyAllOfPet -Pet $Pet +} catch { + Write-Host ("Exception occurred when calling Test-EchoBodyAllOfPet: {0}" -f ($_.ErrorDetails | ConvertFrom-Json)) + Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json)) +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **Pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] + +### Return type + +[**Pet**](Pet.md) (PSCustomObject) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/echo_api/powershell/docs/Category.md b/samples/client/echo_api/powershell/docs/Category.md new file mode 100644 index 00000000000..1d6bc8d56be --- /dev/null +++ b/samples/client/echo_api/powershell/docs/Category.md @@ -0,0 +1,23 @@ +# Category +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **Int64** | | [optional] +**Name** | **String** | | [optional] + +## Examples + +- Prepare the resource +```powershell +$Category = Initialize-PSOpenAPIToolsCategory -Id 1 ` + -Name Dogs +``` + +- Convert the resource to JSON +```powershell +$Category | ConvertTo-JSON +``` + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/echo_api/powershell/docs/DataQuery.md b/samples/client/echo_api/powershell/docs/DataQuery.md new file mode 100644 index 00000000000..68ac67b5990 --- /dev/null +++ b/samples/client/echo_api/powershell/docs/DataQuery.md @@ -0,0 +1,29 @@ +# DataQuery +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **Int64** | Query | [optional] +**Outcomes** | **String[]** | | [optional] +**Suffix** | **String** | test suffix | [optional] +**Text** | **String** | Some text containing white spaces | [optional] +**Date** | **System.DateTime** | A date | [optional] + +## Examples + +- Prepare the resource +```powershell +$DataQuery = Initialize-PSOpenAPIToolsDataQuery -Id null ` + -Outcomes null ` + -Suffix null ` + -Text Some text ` + -Date null +``` + +- Convert the resource to JSON +```powershell +$DataQuery | ConvertTo-JSON +``` + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/echo_api/powershell/docs/DefaultValue.md b/samples/client/echo_api/powershell/docs/DefaultValue.md new file mode 100644 index 00000000000..6217b0b2e58 --- /dev/null +++ b/samples/client/echo_api/powershell/docs/DefaultValue.md @@ -0,0 +1,35 @@ +# DefaultValue +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ArrayStringEnumRefDefault** | [**StringEnumRef[]**](StringEnumRef.md) | | [optional] +**ArrayStringEnumDefault** | **String[]** | | [optional] +**ArrayStringDefault** | **String[]** | | [optional] +**ArrayIntegerDefault** | **Int32[]** | | [optional] +**ArrayString** | **String[]** | | [optional] +**ArrayStringNullable** | **String[]** | | [optional] +**ArrayStringExtensionNullable** | **String[]** | | [optional] +**StringNullable** | **String** | | [optional] + +## Examples + +- Prepare the resource +```powershell +$DefaultValue = Initialize-PSOpenAPIToolsDefaultValue -ArrayStringEnumRefDefault null ` + -ArrayStringEnumDefault null ` + -ArrayStringDefault null ` + -ArrayIntegerDefault null ` + -ArrayString null ` + -ArrayStringNullable null ` + -ArrayStringExtensionNullable null ` + -StringNullable null +``` + +- Convert the resource to JSON +```powershell +$DefaultValue | ConvertTo-JSON +``` + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/echo_api/powershell/docs/FormApi.md b/samples/client/echo_api/powershell/docs/FormApi.md new file mode 100644 index 00000000000..96b1e233351 --- /dev/null +++ b/samples/client/echo_api/powershell/docs/FormApi.md @@ -0,0 +1,117 @@ +# PSOpenAPITools.PSOpenAPITools\Api.FormApi + +All URIs are relative to *http://localhost:3000* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**Test-FormIntegerBooleanString**](FormApi.md#Test-FormIntegerBooleanString) | **POST** /form/integer/boolean/string | Test form parameter(s) +[**Test-FormOneof**](FormApi.md#Test-FormOneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema + + + +# **Test-FormIntegerBooleanString** +> String Test-FormIntegerBooleanString
+>         [-IntegerForm]
+>         [-BooleanForm]
+>         [-StringForm]
+ +Test form parameter(s) + +Test form parameter(s) + +### Example +```powershell +$IntegerForm = 56 # Int32 | (optional) +$BooleanForm = $true # Boolean | (optional) +$StringForm = "MyStringForm" # String | (optional) + +# Test form parameter(s) +try { + $Result = Test-FormIntegerBooleanString -IntegerForm $IntegerForm -BooleanForm $BooleanForm -StringForm $StringForm +} catch { + Write-Host ("Exception occurred when calling Test-FormIntegerBooleanString: {0}" -f ($_.ErrorDetails | ConvertFrom-Json)) + Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json)) +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **IntegerForm** | **Int32**| | [optional] + **BooleanForm** | **Boolean**| | [optional] + **StringForm** | **String**| | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: text/plain + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **Test-FormOneof** +> String Test-FormOneof
+>         [-Form1]
+>         [-Form2]
+>         [-Form3]
+>         [-Form4]
+>         [-Id]
+>         [-Name]
+ +Test form parameter(s) for oneOf schema + +Test form parameter(s) for oneOf schema + +### Example +```powershell +$Form1 = "MyForm1" # String | (optional) +$Form2 = 56 # Int32 | (optional) +$Form3 = "MyForm3" # String | (optional) +$Form4 = $true # Boolean | (optional) +$Id = 789 # Int64 | (optional) +$Name = "MyName" # String | (optional) + +# Test form parameter(s) for oneOf schema +try { + $Result = Test-FormOneof -Form1 $Form1 -Form2 $Form2 -Form3 $Form3 -Form4 $Form4 -Id $Id -Name $Name +} catch { + Write-Host ("Exception occurred when calling Test-FormOneof: {0}" -f ($_.ErrorDetails | ConvertFrom-Json)) + Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json)) +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **Form1** | **String**| | [optional] + **Form2** | **Int32**| | [optional] + **Form3** | **String**| | [optional] + **Form4** | **Boolean**| | [optional] + **Id** | **Int64**| | [optional] + **Name** | **String**| | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: text/plain + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/echo_api/powershell/docs/HeaderApi.md b/samples/client/echo_api/powershell/docs/HeaderApi.md new file mode 100644 index 00000000000..74b19de2129 --- /dev/null +++ b/samples/client/echo_api/powershell/docs/HeaderApi.md @@ -0,0 +1,64 @@ +# PSOpenAPITools.PSOpenAPITools\Api.HeaderApi + +All URIs are relative to *http://localhost:3000* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**Test-HeaderIntegerBooleanStringEnums**](HeaderApi.md#Test-HeaderIntegerBooleanStringEnums) | **GET** /header/integer/boolean/string/enums | Test header parameter(s) + + + +# **Test-HeaderIntegerBooleanStringEnums** +> String Test-HeaderIntegerBooleanStringEnums
+>         [-IntegerHeader]
+>         [-BooleanHeader]
+>         [-StringHeader]
+>         [-EnumNonrefStringHeader]
+>         [-EnumRefStringHeader]
+ +Test header parameter(s) + +Test header parameter(s) + +### Example +```powershell +$IntegerHeader = 56 # Int32 | (optional) +$BooleanHeader = $true # Boolean | (optional) +$StringHeader = "MyStringHeader" # String | (optional) +$EnumNonrefStringHeader = "success" # String | (optional) +$EnumRefStringHeader = "success" # StringEnumRef | (optional) + +# Test header parameter(s) +try { + $Result = Test-HeaderIntegerBooleanStringEnums -IntegerHeader $IntegerHeader -BooleanHeader $BooleanHeader -StringHeader $StringHeader -EnumNonrefStringHeader $EnumNonrefStringHeader -EnumRefStringHeader $EnumRefStringHeader +} catch { + Write-Host ("Exception occurred when calling Test-HeaderIntegerBooleanStringEnums: {0}" -f ($_.ErrorDetails | ConvertFrom-Json)) + Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json)) +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **IntegerHeader** | **Int32**| | [optional] + **BooleanHeader** | **Boolean**| | [optional] + **StringHeader** | **String**| | [optional] + **EnumNonrefStringHeader** | **String**| | [optional] + **EnumRefStringHeader** | [**StringEnumRef**](StringEnumRef.md)| | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/echo_api/powershell/docs/NumberPropertiesOnly.md b/samples/client/echo_api/powershell/docs/NumberPropertiesOnly.md new file mode 100644 index 00000000000..155a209a85a --- /dev/null +++ b/samples/client/echo_api/powershell/docs/NumberPropertiesOnly.md @@ -0,0 +1,25 @@ +# NumberPropertiesOnly +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Number** | **Decimal** | | [optional] +**Float** | **Double** | | [optional] +**Double** | **Double** | | [optional] + +## Examples + +- Prepare the resource +```powershell +$NumberPropertiesOnly = Initialize-PSOpenAPIToolsNumberPropertiesOnly -Number null ` + -Float null ` + -Double null +``` + +- Convert the resource to JSON +```powershell +$NumberPropertiesOnly | ConvertTo-JSON +``` + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/echo_api/powershell/docs/PathApi.md b/samples/client/echo_api/powershell/docs/PathApi.md new file mode 100644 index 00000000000..1ee5292fd84 --- /dev/null +++ b/samples/client/echo_api/powershell/docs/PathApi.md @@ -0,0 +1,61 @@ +# PSOpenAPITools.PSOpenAPITools\Api.PathApi + +All URIs are relative to *http://localhost:3000* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**Test-sPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath**](PathApi.md#Test-sPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath) | **GET** /path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path} | Test path parameter(s) + + + +# **Test-sPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath** +> String Test-sPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath
+>         [-PathString]
+>         [-PathInteger]
+>         [-EnumNonrefStringPath]
+>         [-EnumRefStringPath]
+ +Test path parameter(s) + +Test path parameter(s) + +### Example +```powershell +$PathString = "MyPathString" # String | +$PathInteger = 56 # Int32 | +$EnumNonrefStringPath = "success" # String | +$EnumRefStringPath = "success" # StringEnumRef | + +# Test path parameter(s) +try { + $Result = Test-sPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath -PathString $PathString -PathInteger $PathInteger -EnumNonrefStringPath $EnumNonrefStringPath -EnumRefStringPath $EnumRefStringPath +} catch { + Write-Host ("Exception occurred when calling Test-sPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath: {0}" -f ($_.ErrorDetails | ConvertFrom-Json)) + Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json)) +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **PathString** | **String**| | + **PathInteger** | **Int32**| | + **EnumNonrefStringPath** | **String**| | + **EnumRefStringPath** | [**StringEnumRef**](StringEnumRef.md)| | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/echo_api/powershell/docs/Pet.md b/samples/client/echo_api/powershell/docs/Pet.md new file mode 100644 index 00000000000..5839d09c86d --- /dev/null +++ b/samples/client/echo_api/powershell/docs/Pet.md @@ -0,0 +1,31 @@ +# Pet +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **Int64** | | [optional] +**Name** | **String** | | +**Category** | [**Category**](Category.md) | | [optional] +**PhotoUrls** | **String[]** | | +**Tags** | [**Tag[]**](Tag.md) | | [optional] +**Status** | **String** | pet status in the store | [optional] + +## Examples + +- Prepare the resource +```powershell +$Pet = Initialize-PSOpenAPIToolsPet -Id 10 ` + -Name doggie ` + -Category null ` + -PhotoUrls null ` + -Tags null ` + -Status null +``` + +- Convert the resource to JSON +```powershell +$Pet | ConvertTo-JSON +``` + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/echo_api/powershell/docs/Query.md b/samples/client/echo_api/powershell/docs/Query.md new file mode 100644 index 00000000000..b4b02112afb --- /dev/null +++ b/samples/client/echo_api/powershell/docs/Query.md @@ -0,0 +1,23 @@ +# Query +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **Int64** | Query | [optional] +**Outcomes** | **String[]** | | [optional] + +## Examples + +- Prepare the resource +```powershell +$Query = Initialize-PSOpenAPIToolsQuery -Id null ` + -Outcomes null +``` + +- Convert the resource to JSON +```powershell +$Query | ConvertTo-JSON +``` + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/echo_api/powershell/docs/QueryApi.md b/samples/client/echo_api/powershell/docs/QueryApi.md new file mode 100644 index 00000000000..0af0d619391 --- /dev/null +++ b/samples/client/echo_api/powershell/docs/QueryApi.md @@ -0,0 +1,379 @@ +# PSOpenAPITools.PSOpenAPITools\Api.QueryApi + +All URIs are relative to *http://localhost:3000* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**Test-EnumRefString**](QueryApi.md#Test-EnumRefString) | **GET** /query/enum_ref_string | Test query parameter(s) +[**Test-QueryDatetimeDateString**](QueryApi.md#Test-QueryDatetimeDateString) | **GET** /query/datetime/date/string | Test query parameter(s) +[**Test-QueryIntegerBooleanString**](QueryApi.md#Test-QueryIntegerBooleanString) | **GET** /query/integer/boolean/string | Test query parameter(s) +[**Test-QueryStyleDeepObjectExplodeTrueObject**](QueryApi.md#Test-QueryStyleDeepObjectExplodeTrueObject) | **GET** /query/style_deepObject/explode_true/object | Test query parameter(s) +[**Test-QueryStyleDeepObjectExplodeTrueObjectAllOf**](QueryApi.md#Test-QueryStyleDeepObjectExplodeTrueObjectAllOf) | **GET** /query/style_deepObject/explode_true/object/allOf | Test query parameter(s) +[**Test-QueryStyleFormExplodeTrueArrayString**](QueryApi.md#Test-QueryStyleFormExplodeTrueArrayString) | **GET** /query/style_form/explode_true/array_string | Test query parameter(s) +[**Test-QueryStyleFormExplodeTrueObject**](QueryApi.md#Test-QueryStyleFormExplodeTrueObject) | **GET** /query/style_form/explode_true/object | Test query parameter(s) +[**Test-QueryStyleFormExplodeTrueObjectAllOf**](QueryApi.md#Test-QueryStyleFormExplodeTrueObjectAllOf) | **GET** /query/style_form/explode_true/object/allOf | Test query parameter(s) + + + +# **Test-EnumRefString** +> String Test-EnumRefString
+>         [-EnumNonrefStringQuery]
+>         [-EnumRefStringQuery]
+ +Test query parameter(s) + +Test query parameter(s) + +### Example +```powershell +$EnumNonrefStringQuery = "success" # String | (optional) +$EnumRefStringQuery = "success" # StringEnumRef | (optional) + +# Test query parameter(s) +try { + $Result = Test-EnumRefString -EnumNonrefStringQuery $EnumNonrefStringQuery -EnumRefStringQuery $EnumRefStringQuery +} catch { + Write-Host ("Exception occurred when calling Test-EnumRefString: {0}" -f ($_.ErrorDetails | ConvertFrom-Json)) + Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json)) +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **EnumNonrefStringQuery** | **String**| | [optional] + **EnumRefStringQuery** | [**StringEnumRef**](StringEnumRef.md)| | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **Test-QueryDatetimeDateString** +> String Test-QueryDatetimeDateString
+>         [-DatetimeQuery]
+>         [-DateQuery]
+>         [-StringQuery]
+ +Test query parameter(s) + +Test query parameter(s) + +### Example +```powershell +$DatetimeQuery = (Get-Date) # System.DateTime | (optional) +$DateQuery = (Get-Date) # System.DateTime | (optional) +$StringQuery = "MyStringQuery" # String | (optional) + +# Test query parameter(s) +try { + $Result = Test-QueryDatetimeDateString -DatetimeQuery $DatetimeQuery -DateQuery $DateQuery -StringQuery $StringQuery +} catch { + Write-Host ("Exception occurred when calling Test-QueryDatetimeDateString: {0}" -f ($_.ErrorDetails | ConvertFrom-Json)) + Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json)) +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **DatetimeQuery** | **System.DateTime**| | [optional] + **DateQuery** | **System.DateTime**| | [optional] + **StringQuery** | **String**| | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **Test-QueryIntegerBooleanString** +> String Test-QueryIntegerBooleanString
+>         [-IntegerQuery]
+>         [-BooleanQuery]
+>         [-StringQuery]
+ +Test query parameter(s) + +Test query parameter(s) + +### Example +```powershell +$IntegerQuery = 56 # Int32 | (optional) +$BooleanQuery = $true # Boolean | (optional) +$StringQuery = "MyStringQuery" # String | (optional) + +# Test query parameter(s) +try { + $Result = Test-QueryIntegerBooleanString -IntegerQuery $IntegerQuery -BooleanQuery $BooleanQuery -StringQuery $StringQuery +} catch { + Write-Host ("Exception occurred when calling Test-QueryIntegerBooleanString: {0}" -f ($_.ErrorDetails | ConvertFrom-Json)) + Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json)) +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **IntegerQuery** | **Int32**| | [optional] + **BooleanQuery** | **Boolean**| | [optional] + **StringQuery** | **String**| | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **Test-QueryStyleDeepObjectExplodeTrueObject** +> String Test-QueryStyleDeepObjectExplodeTrueObject
+>         [-QueryObject]
+ +Test query parameter(s) + +Test query parameter(s) + +### Example +```powershell +$Category = Initialize-Category -Id 1 -Name "Dogs" +$Tag = Initialize-Tag -Id 0 -Name "MyName" +$Pet = Initialize-Pet -Id 10 -Name "doggie" -Category $Category -PhotoUrls "MyPhotoUrls" -Tags $Tag -Status "available" # Pet | (optional) + +# Test query parameter(s) +try { + $Result = Test-QueryStyleDeepObjectExplodeTrueObject -QueryObject $QueryObject +} catch { + Write-Host ("Exception occurred when calling Test-QueryStyleDeepObjectExplodeTrueObject: {0}" -f ($_.ErrorDetails | ConvertFrom-Json)) + Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json)) +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **QueryObject** | [**Pet**](Pet.md)| | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **Test-QueryStyleDeepObjectExplodeTrueObjectAllOf** +> String Test-QueryStyleDeepObjectExplodeTrueObjectAllOf
+>         [-QueryObject]
+ +Test query parameter(s) + +Test query parameter(s) + +### Example +```powershell +$TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter = Initialize-TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter -Size "MySize" -Color "MyColor" -Id 1 -Name "Dogs" # TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter | (optional) + +# Test query parameter(s) +try { + $Result = Test-QueryStyleDeepObjectExplodeTrueObjectAllOf -QueryObject $QueryObject +} catch { + Write-Host ("Exception occurred when calling Test-QueryStyleDeepObjectExplodeTrueObjectAllOf: {0}" -f ($_.ErrorDetails | ConvertFrom-Json)) + Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json)) +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **QueryObject** | [**TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter**](TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md)| | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **Test-QueryStyleFormExplodeTrueArrayString** +> String Test-QueryStyleFormExplodeTrueArrayString
+>         [-QueryObject]
+ +Test query parameter(s) + +Test query parameter(s) + +### Example +```powershell +$TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter = Initialize-TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter -Values "MyValues" # TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter | (optional) + +# Test query parameter(s) +try { + $Result = Test-QueryStyleFormExplodeTrueArrayString -QueryObject $QueryObject +} catch { + Write-Host ("Exception occurred when calling Test-QueryStyleFormExplodeTrueArrayString: {0}" -f ($_.ErrorDetails | ConvertFrom-Json)) + Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json)) +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **QueryObject** | [**TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter**](TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md)| | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **Test-QueryStyleFormExplodeTrueObject** +> String Test-QueryStyleFormExplodeTrueObject
+>         [-QueryObject]
+ +Test query parameter(s) + +Test query parameter(s) + +### Example +```powershell +$Category = Initialize-Category -Id 1 -Name "Dogs" +$Tag = Initialize-Tag -Id 0 -Name "MyName" +$Pet = Initialize-Pet -Id 10 -Name "doggie" -Category $Category -PhotoUrls "MyPhotoUrls" -Tags $Tag -Status "available" # Pet | (optional) + +# Test query parameter(s) +try { + $Result = Test-QueryStyleFormExplodeTrueObject -QueryObject $QueryObject +} catch { + Write-Host ("Exception occurred when calling Test-QueryStyleFormExplodeTrueObject: {0}" -f ($_.ErrorDetails | ConvertFrom-Json)) + Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json)) +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **QueryObject** | [**Pet**](Pet.md)| | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **Test-QueryStyleFormExplodeTrueObjectAllOf** +> String Test-QueryStyleFormExplodeTrueObjectAllOf
+>         [-QueryObject]
+ +Test query parameter(s) + +Test query parameter(s) + +### Example +```powershell +"SUCCESS"$DataQuery = Initialize-DataQuery -Id 0 -Outcomes "SUCCESS" -Suffix "MySuffix" -Text "Some text" -Date (Get-Date) # DataQuery | (optional) + +# Test query parameter(s) +try { + $Result = Test-QueryStyleFormExplodeTrueObjectAllOf -QueryObject $QueryObject +} catch { + Write-Host ("Exception occurred when calling Test-QueryStyleFormExplodeTrueObjectAllOf: {0}" -f ($_.ErrorDetails | ConvertFrom-Json)) + Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json)) +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **QueryObject** | [**DataQuery**](DataQuery.md)| | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/echo_api/powershell/docs/StringEnumRef.md b/samples/client/echo_api/powershell/docs/StringEnumRef.md new file mode 100644 index 00000000000..0366f951001 --- /dev/null +++ b/samples/client/echo_api/powershell/docs/StringEnumRef.md @@ -0,0 +1,20 @@ +# StringEnumRef +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +## Examples + +- Prepare the resource +```powershell +$StringEnumRef = Initialize-PSOpenAPIToolsStringEnumRef +``` + +- Convert the resource to JSON +```powershell +$StringEnumRef | ConvertTo-JSON +``` + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/echo_api/powershell/docs/Tag.md b/samples/client/echo_api/powershell/docs/Tag.md new file mode 100644 index 00000000000..7f7ef9fbb88 --- /dev/null +++ b/samples/client/echo_api/powershell/docs/Tag.md @@ -0,0 +1,23 @@ +# Tag +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **Int64** | | [optional] +**Name** | **String** | | [optional] + +## Examples + +- Prepare the resource +```powershell +$Tag = Initialize-PSOpenAPIToolsTag -Id null ` + -Name null +``` + +- Convert the resource to JSON +```powershell +$Tag | ConvertTo-JSON +``` + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/echo_api/powershell/docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md b/samples/client/echo_api/powershell/docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md new file mode 100644 index 00000000000..b854fd2b9e6 --- /dev/null +++ b/samples/client/echo_api/powershell/docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md @@ -0,0 +1,27 @@ +# TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Size** | **String** | | [optional] +**Color** | **String** | | [optional] +**Id** | **Int64** | | [optional] +**Name** | **String** | | [optional] + +## Examples + +- Prepare the resource +```powershell +$TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter = Initialize-PSOpenAPIToolsTestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter -Size null ` + -Color null ` + -Id 1 ` + -Name Dogs +``` + +- Convert the resource to JSON +```powershell +$TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter | ConvertTo-JSON +``` + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/echo_api/powershell/docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md b/samples/client/echo_api/powershell/docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md new file mode 100644 index 00000000000..96c091c3b0f --- /dev/null +++ b/samples/client/echo_api/powershell/docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md @@ -0,0 +1,21 @@ +# TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Values** | **String[]** | | [optional] + +## Examples + +- Prepare the resource +```powershell +$TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter = Initialize-PSOpenAPIToolsTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter -Values null +``` + +- Convert the resource to JSON +```powershell +$TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter | ConvertTo-JSON +``` + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/echo_api/powershell/src/PSOpenAPITools/Api/AuthApi.ps1 b/samples/client/echo_api/powershell/src/PSOpenAPITools/Api/AuthApi.ps1 new file mode 100644 index 00000000000..3c3888e4e4e --- /dev/null +++ b/samples/client/echo_api/powershell/src/PSOpenAPITools/Api/AuthApi.ps1 @@ -0,0 +1,78 @@ +# +# Echo Server API +# Echo Server API +# Version: 0.1.0 +# Contact: team@openapitools.org +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +To test HTTP basic authentication + +.DESCRIPTION + +No description available. + +.PARAMETER WithHttpInfo + +A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response + +.OUTPUTS + +String +#> +function Test-AuthHttpBasic { + [CmdletBinding()] + Param ( + [Switch] + $WithHttpInfo + ) + + Process { + 'Calling method: Test-AuthHttpBasic' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $LocalVarAccepts = @() + $LocalVarContentTypes = @() + $LocalVarQueryParameters = @{} + $LocalVarHeaderParameters = @{} + $LocalVarFormParameters = @{} + $LocalVarPathParameters = @{} + $LocalVarCookieParameters = @{} + $LocalVarBodyParameter = $null + + $Configuration = Get-Configuration + # HTTP header 'Accept' (if needed) + $LocalVarAccepts = @('text/plain') + + $LocalVarUri = '/auth/http/basic' + + if ($Configuration["Username"] -and $Configuration["Password"]) { + $LocalVarBytes = [System.Text.Encoding]::UTF8.GetBytes($Configuration["Username"] + ":" + $Configuration["Password"]) + $LocalVarBase64Text =[Convert]::ToBase64String($LocalVarBytes) + $LocalVarHeaderParameters['Authorization'] = "Basic " + $LocalVarBase64Text + Write-Verbose ("Using HTTP basic authentication in {0}" -f $MyInvocation.MyCommand) + } + + $LocalVarResult = Invoke-ApiClient -Method 'POST' ` + -Uri $LocalVarUri ` + -Accepts $LocalVarAccepts ` + -ContentTypes $LocalVarContentTypes ` + -Body $LocalVarBodyParameter ` + -HeaderParameters $LocalVarHeaderParameters ` + -QueryParameters $LocalVarQueryParameters ` + -FormParameters $LocalVarFormParameters ` + -CookieParameters $LocalVarCookieParameters ` + -ReturnType "String" ` + -IsBodyNullable $false + + if ($WithHttpInfo.IsPresent) { + return $LocalVarResult + } else { + return $LocalVarResult["Response"] + } + } +} + diff --git a/samples/client/echo_api/powershell/src/PSOpenAPITools/Api/BodyApi.ps1 b/samples/client/echo_api/powershell/src/PSOpenAPITools/Api/BodyApi.ps1 new file mode 100644 index 00000000000..4ddf81d7948 --- /dev/null +++ b/samples/client/echo_api/powershell/src/PSOpenAPITools/Api/BodyApi.ps1 @@ -0,0 +1,592 @@ +# +# Echo Server API +# Echo Server API +# Version: 0.1.0 +# Contact: team@openapitools.org +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +Test binary (gif) response body + +.DESCRIPTION + +No description available. + +.PARAMETER WithHttpInfo + +A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response + +.OUTPUTS + +System.IO.FileInfo +#> +function Test-BinaryGif { + [CmdletBinding()] + Param ( + [Switch] + $WithHttpInfo + ) + + Process { + 'Calling method: Test-BinaryGif' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $LocalVarAccepts = @() + $LocalVarContentTypes = @() + $LocalVarQueryParameters = @{} + $LocalVarHeaderParameters = @{} + $LocalVarFormParameters = @{} + $LocalVarPathParameters = @{} + $LocalVarCookieParameters = @{} + $LocalVarBodyParameter = $null + + $Configuration = Get-Configuration + # HTTP header 'Accept' (if needed) + $LocalVarAccepts = @('image/gif') + + $LocalVarUri = '/binary/gif' + + $LocalVarResult = Invoke-ApiClient -Method 'POST' ` + -Uri $LocalVarUri ` + -Accepts $LocalVarAccepts ` + -ContentTypes $LocalVarContentTypes ` + -Body $LocalVarBodyParameter ` + -HeaderParameters $LocalVarHeaderParameters ` + -QueryParameters $LocalVarQueryParameters ` + -FormParameters $LocalVarFormParameters ` + -CookieParameters $LocalVarCookieParameters ` + -ReturnType "System.IO.FileInfo" ` + -IsBodyNullable $false + + if ($WithHttpInfo.IsPresent) { + return $LocalVarResult + } else { + return $LocalVarResult["Response"] + } + } +} + +<# +.SYNOPSIS + +Test body parameter(s) + +.DESCRIPTION + +No description available. + +.PARAMETER Body +No description available. + +.PARAMETER WithHttpInfo + +A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response + +.OUTPUTS + +String +#> +function Test-BodyApplicationOctetstreamBinary { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [System.IO.FileInfo] + ${Body}, + [Switch] + $WithHttpInfo + ) + + Process { + 'Calling method: Test-BodyApplicationOctetstreamBinary' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $LocalVarAccepts = @() + $LocalVarContentTypes = @() + $LocalVarQueryParameters = @{} + $LocalVarHeaderParameters = @{} + $LocalVarFormParameters = @{} + $LocalVarPathParameters = @{} + $LocalVarCookieParameters = @{} + $LocalVarBodyParameter = $null + + $Configuration = Get-Configuration + # HTTP header 'Accept' (if needed) + $LocalVarAccepts = @('text/plain') + + # HTTP header 'Content-Type' + $LocalVarContentTypes = @('application/octet-stream') + + $LocalVarUri = '/body/application/octetstream/binary' + + $LocalVarBodyParameter = $Body | ConvertTo-Json -Depth 100 + + $LocalVarResult = Invoke-ApiClient -Method 'POST' ` + -Uri $LocalVarUri ` + -Accepts $LocalVarAccepts ` + -ContentTypes $LocalVarContentTypes ` + -Body $LocalVarBodyParameter ` + -HeaderParameters $LocalVarHeaderParameters ` + -QueryParameters $LocalVarQueryParameters ` + -FormParameters $LocalVarFormParameters ` + -CookieParameters $LocalVarCookieParameters ` + -ReturnType "String" ` + -IsBodyNullable $false + + if ($WithHttpInfo.IsPresent) { + return $LocalVarResult + } else { + return $LocalVarResult["Response"] + } + } +} + +<# +.SYNOPSIS + +Test array of binary in multipart mime + +.DESCRIPTION + +No description available. + +.PARAMETER Files +No description available. + +.PARAMETER WithHttpInfo + +A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response + +.OUTPUTS + +String +#> +function Test-BodyMultipartFormdataArrayOfBinary { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [System.IO.FileInfo[]] + ${Files}, + [Switch] + $WithHttpInfo + ) + + Process { + 'Calling method: Test-BodyMultipartFormdataArrayOfBinary' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $LocalVarAccepts = @() + $LocalVarContentTypes = @() + $LocalVarQueryParameters = @{} + $LocalVarHeaderParameters = @{} + $LocalVarFormParameters = @{} + $LocalVarPathParameters = @{} + $LocalVarCookieParameters = @{} + $LocalVarBodyParameter = $null + + $Configuration = Get-Configuration + # HTTP header 'Accept' (if needed) + $LocalVarAccepts = @('text/plain') + + # HTTP header 'Content-Type' + $LocalVarContentTypes = @('multipart/form-data') + + $LocalVarUri = '/body/application/octetstream/array_of_binary' + + if (!$Files) { + throw "Error! The required parameter `Files` missing when calling test_body_multipart_formdata_arrayOfBinary." + } + $LocalVarFormParameters['files'] = $Files + + $LocalVarResult = Invoke-ApiClient -Method 'POST' ` + -Uri $LocalVarUri ` + -Accepts $LocalVarAccepts ` + -ContentTypes $LocalVarContentTypes ` + -Body $LocalVarBodyParameter ` + -HeaderParameters $LocalVarHeaderParameters ` + -QueryParameters $LocalVarQueryParameters ` + -FormParameters $LocalVarFormParameters ` + -CookieParameters $LocalVarCookieParameters ` + -ReturnType "String" ` + -IsBodyNullable $false + + if ($WithHttpInfo.IsPresent) { + return $LocalVarResult + } else { + return $LocalVarResult["Response"] + } + } +} + +<# +.SYNOPSIS + +Test free form object + +.DESCRIPTION + +No description available. + +.PARAMETER Body +Free form object + +.PARAMETER WithHttpInfo + +A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response + +.OUTPUTS + +String +#> +function Test-EchoBodyFreeFormObjectResponseString { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [System.Nullable[SystemCollectionsHashtable]] + ${Body}, + [Switch] + $WithHttpInfo + ) + + Process { + 'Calling method: Test-EchoBodyFreeFormObjectResponseString' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $LocalVarAccepts = @() + $LocalVarContentTypes = @() + $LocalVarQueryParameters = @{} + $LocalVarHeaderParameters = @{} + $LocalVarFormParameters = @{} + $LocalVarPathParameters = @{} + $LocalVarCookieParameters = @{} + $LocalVarBodyParameter = $null + + $Configuration = Get-Configuration + # HTTP header 'Accept' (if needed) + $LocalVarAccepts = @('text/plain') + + # HTTP header 'Content-Type' + $LocalVarContentTypes = @('application/json') + + $LocalVarUri = '/echo/body/FreeFormObject/response_string' + + $LocalVarBodyParameter = $Body | ConvertTo-Json -Depth 100 + + $LocalVarResult = Invoke-ApiClient -Method 'POST' ` + -Uri $LocalVarUri ` + -Accepts $LocalVarAccepts ` + -ContentTypes $LocalVarContentTypes ` + -Body $LocalVarBodyParameter ` + -HeaderParameters $LocalVarHeaderParameters ` + -QueryParameters $LocalVarQueryParameters ` + -FormParameters $LocalVarFormParameters ` + -CookieParameters $LocalVarCookieParameters ` + -ReturnType "String" ` + -IsBodyNullable $false + + if ($WithHttpInfo.IsPresent) { + return $LocalVarResult + } else { + return $LocalVarResult["Response"] + } + } +} + +<# +.SYNOPSIS + +Test body parameter(s) + +.DESCRIPTION + +No description available. + +.PARAMETER Pet +Pet object that needs to be added to the store + +.PARAMETER WithHttpInfo + +A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response + +.OUTPUTS + +Pet +#> +function Test-EchoBodyPet { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [PSCustomObject] + ${Pet}, + [Switch] + $WithHttpInfo + ) + + Process { + 'Calling method: Test-EchoBodyPet' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $LocalVarAccepts = @() + $LocalVarContentTypes = @() + $LocalVarQueryParameters = @{} + $LocalVarHeaderParameters = @{} + $LocalVarFormParameters = @{} + $LocalVarPathParameters = @{} + $LocalVarCookieParameters = @{} + $LocalVarBodyParameter = $null + + $Configuration = Get-Configuration + # HTTP header 'Accept' (if needed) + $LocalVarAccepts = @('application/json') + + # HTTP header 'Content-Type' + $LocalVarContentTypes = @('application/json') + + $LocalVarUri = '/echo/body/Pet' + + $LocalVarBodyParameter = $Pet | ConvertTo-Json -Depth 100 + + $LocalVarResult = Invoke-ApiClient -Method 'POST' ` + -Uri $LocalVarUri ` + -Accepts $LocalVarAccepts ` + -ContentTypes $LocalVarContentTypes ` + -Body $LocalVarBodyParameter ` + -HeaderParameters $LocalVarHeaderParameters ` + -QueryParameters $LocalVarQueryParameters ` + -FormParameters $LocalVarFormParameters ` + -CookieParameters $LocalVarCookieParameters ` + -ReturnType "Pet" ` + -IsBodyNullable $false + + if ($WithHttpInfo.IsPresent) { + return $LocalVarResult + } else { + return $LocalVarResult["Response"] + } + } +} + +<# +.SYNOPSIS + +Test empty response body + +.DESCRIPTION + +No description available. + +.PARAMETER Pet +Pet object that needs to be added to the store + +.PARAMETER WithHttpInfo + +A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response + +.OUTPUTS + +String +#> +function Test-EchoBodyPetResponseString { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [PSCustomObject] + ${Pet}, + [Switch] + $WithHttpInfo + ) + + Process { + 'Calling method: Test-EchoBodyPetResponseString' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $LocalVarAccepts = @() + $LocalVarContentTypes = @() + $LocalVarQueryParameters = @{} + $LocalVarHeaderParameters = @{} + $LocalVarFormParameters = @{} + $LocalVarPathParameters = @{} + $LocalVarCookieParameters = @{} + $LocalVarBodyParameter = $null + + $Configuration = Get-Configuration + # HTTP header 'Accept' (if needed) + $LocalVarAccepts = @('text/plain') + + # HTTP header 'Content-Type' + $LocalVarContentTypes = @('application/json') + + $LocalVarUri = '/echo/body/Pet/response_string' + + $LocalVarBodyParameter = $Pet | ConvertTo-Json -Depth 100 + + $LocalVarResult = Invoke-ApiClient -Method 'POST' ` + -Uri $LocalVarUri ` + -Accepts $LocalVarAccepts ` + -ContentTypes $LocalVarContentTypes ` + -Body $LocalVarBodyParameter ` + -HeaderParameters $LocalVarHeaderParameters ` + -QueryParameters $LocalVarQueryParameters ` + -FormParameters $LocalVarFormParameters ` + -CookieParameters $LocalVarCookieParameters ` + -ReturnType "String" ` + -IsBodyNullable $false + + if ($WithHttpInfo.IsPresent) { + return $LocalVarResult + } else { + return $LocalVarResult["Response"] + } + } +} + +<# +.SYNOPSIS + +Test empty json (request body) + +.DESCRIPTION + +No description available. + +.PARAMETER Tag +Tag object + +.PARAMETER WithHttpInfo + +A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response + +.OUTPUTS + +String +#> +function Test-EchoBodyTagResponseString { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [PSCustomObject] + ${Tag}, + [Switch] + $WithHttpInfo + ) + + Process { + 'Calling method: Test-EchoBodyTagResponseString' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $LocalVarAccepts = @() + $LocalVarContentTypes = @() + $LocalVarQueryParameters = @{} + $LocalVarHeaderParameters = @{} + $LocalVarFormParameters = @{} + $LocalVarPathParameters = @{} + $LocalVarCookieParameters = @{} + $LocalVarBodyParameter = $null + + $Configuration = Get-Configuration + # HTTP header 'Accept' (if needed) + $LocalVarAccepts = @('text/plain') + + # HTTP header 'Content-Type' + $LocalVarContentTypes = @('application/json') + + $LocalVarUri = '/echo/body/Tag/response_string' + + $LocalVarBodyParameter = $Tag | ConvertTo-Json -Depth 100 + + $LocalVarResult = Invoke-ApiClient -Method 'POST' ` + -Uri $LocalVarUri ` + -Accepts $LocalVarAccepts ` + -ContentTypes $LocalVarContentTypes ` + -Body $LocalVarBodyParameter ` + -HeaderParameters $LocalVarHeaderParameters ` + -QueryParameters $LocalVarQueryParameters ` + -FormParameters $LocalVarFormParameters ` + -CookieParameters $LocalVarCookieParameters ` + -ReturnType "String" ` + -IsBodyNullable $false + + if ($WithHttpInfo.IsPresent) { + return $LocalVarResult + } else { + return $LocalVarResult["Response"] + } + } +} + +<# +.SYNOPSIS + +Test body parameter(s) + +.DESCRIPTION + +No description available. + +.PARAMETER Pet +Pet object that needs to be added to the store + +.PARAMETER WithHttpInfo + +A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response + +.OUTPUTS + +Pet +#> +function Test-EchoBodyAllOfPet { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [PSCustomObject] + ${Pet}, + [Switch] + $WithHttpInfo + ) + + Process { + 'Calling method: Test-EchoBodyAllOfPet' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $LocalVarAccepts = @() + $LocalVarContentTypes = @() + $LocalVarQueryParameters = @{} + $LocalVarHeaderParameters = @{} + $LocalVarFormParameters = @{} + $LocalVarPathParameters = @{} + $LocalVarCookieParameters = @{} + $LocalVarBodyParameter = $null + + $Configuration = Get-Configuration + # HTTP header 'Accept' (if needed) + $LocalVarAccepts = @('application/json') + + # HTTP header 'Content-Type' + $LocalVarContentTypes = @('application/json') + + $LocalVarUri = '/echo/body/allOf/Pet' + + $LocalVarBodyParameter = $Pet | ConvertTo-Json -Depth 100 + + $LocalVarResult = Invoke-ApiClient -Method 'POST' ` + -Uri $LocalVarUri ` + -Accepts $LocalVarAccepts ` + -ContentTypes $LocalVarContentTypes ` + -Body $LocalVarBodyParameter ` + -HeaderParameters $LocalVarHeaderParameters ` + -QueryParameters $LocalVarQueryParameters ` + -FormParameters $LocalVarFormParameters ` + -CookieParameters $LocalVarCookieParameters ` + -ReturnType "Pet" ` + -IsBodyNullable $false + + if ($WithHttpInfo.IsPresent) { + return $LocalVarResult + } else { + return $LocalVarResult["Response"] + } + } +} + diff --git a/samples/client/echo_api/powershell/src/PSOpenAPITools/Api/FormApi.ps1 b/samples/client/echo_api/powershell/src/PSOpenAPITools/Api/FormApi.ps1 new file mode 100644 index 00000000000..677221d160f --- /dev/null +++ b/samples/client/echo_api/powershell/src/PSOpenAPITools/Api/FormApi.ps1 @@ -0,0 +1,230 @@ +# +# Echo Server API +# Echo Server API +# Version: 0.1.0 +# Contact: team@openapitools.org +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +Test form parameter(s) + +.DESCRIPTION + +No description available. + +.PARAMETER IntegerForm +No description available. + +.PARAMETER BooleanForm +No description available. + +.PARAMETER StringForm +No description available. + +.PARAMETER WithHttpInfo + +A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response + +.OUTPUTS + +String +#> +function Test-FormIntegerBooleanString { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [System.Nullable[Int32]] + ${IntegerForm}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [System.Nullable[Boolean]] + ${BooleanForm}, + [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [String] + ${StringForm}, + [Switch] + $WithHttpInfo + ) + + Process { + 'Calling method: Test-FormIntegerBooleanString' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $LocalVarAccepts = @() + $LocalVarContentTypes = @() + $LocalVarQueryParameters = @{} + $LocalVarHeaderParameters = @{} + $LocalVarFormParameters = @{} + $LocalVarPathParameters = @{} + $LocalVarCookieParameters = @{} + $LocalVarBodyParameter = $null + + $Configuration = Get-Configuration + # HTTP header 'Accept' (if needed) + $LocalVarAccepts = @('text/plain') + + # HTTP header 'Content-Type' + $LocalVarContentTypes = @('application/x-www-form-urlencoded') + + $LocalVarUri = '/form/integer/boolean/string' + + if ($IntegerForm) { + $LocalVarFormParameters['integer_form'] = $IntegerForm + } + + if ($BooleanForm) { + $LocalVarFormParameters['boolean_form'] = $BooleanForm + } + + if ($StringForm) { + $LocalVarFormParameters['string_form'] = $StringForm + } + + $LocalVarResult = Invoke-ApiClient -Method 'POST' ` + -Uri $LocalVarUri ` + -Accepts $LocalVarAccepts ` + -ContentTypes $LocalVarContentTypes ` + -Body $LocalVarBodyParameter ` + -HeaderParameters $LocalVarHeaderParameters ` + -QueryParameters $LocalVarQueryParameters ` + -FormParameters $LocalVarFormParameters ` + -CookieParameters $LocalVarCookieParameters ` + -ReturnType "String" ` + -IsBodyNullable $false + + if ($WithHttpInfo.IsPresent) { + return $LocalVarResult + } else { + return $LocalVarResult["Response"] + } + } +} + +<# +.SYNOPSIS + +Test form parameter(s) for oneOf schema + +.DESCRIPTION + +No description available. + +.PARAMETER Form1 +No description available. + +.PARAMETER Form2 +No description available. + +.PARAMETER Form3 +No description available. + +.PARAMETER Form4 +No description available. + +.PARAMETER Id +No description available. + +.PARAMETER Name +No description available. + +.PARAMETER WithHttpInfo + +A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response + +.OUTPUTS + +String +#> +function Test-FormOneof { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [String] + ${Form1}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [System.Nullable[Int32]] + ${Form2}, + [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [String] + ${Form3}, + [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [System.Nullable[Boolean]] + ${Form4}, + [Parameter(Position = 4, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [System.Nullable[Int64]] + ${Id}, + [Parameter(Position = 5, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [String] + ${Name}, + [Switch] + $WithHttpInfo + ) + + Process { + 'Calling method: Test-FormOneof' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $LocalVarAccepts = @() + $LocalVarContentTypes = @() + $LocalVarQueryParameters = @{} + $LocalVarHeaderParameters = @{} + $LocalVarFormParameters = @{} + $LocalVarPathParameters = @{} + $LocalVarCookieParameters = @{} + $LocalVarBodyParameter = $null + + $Configuration = Get-Configuration + # HTTP header 'Accept' (if needed) + $LocalVarAccepts = @('text/plain') + + # HTTP header 'Content-Type' + $LocalVarContentTypes = @('application/x-www-form-urlencoded') + + $LocalVarUri = '/form/oneof' + + if ($Form1) { + $LocalVarFormParameters['form1'] = $Form1 + } + + if ($Form2) { + $LocalVarFormParameters['form2'] = $Form2 + } + + if ($Form3) { + $LocalVarFormParameters['form3'] = $Form3 + } + + if ($Form4) { + $LocalVarFormParameters['form4'] = $Form4 + } + + if ($Id) { + $LocalVarFormParameters['id'] = $Id + } + + if ($Name) { + $LocalVarFormParameters['name'] = $Name + } + + $LocalVarResult = Invoke-ApiClient -Method 'POST' ` + -Uri $LocalVarUri ` + -Accepts $LocalVarAccepts ` + -ContentTypes $LocalVarContentTypes ` + -Body $LocalVarBodyParameter ` + -HeaderParameters $LocalVarHeaderParameters ` + -QueryParameters $LocalVarQueryParameters ` + -FormParameters $LocalVarFormParameters ` + -CookieParameters $LocalVarCookieParameters ` + -ReturnType "String" ` + -IsBodyNullable $false + + if ($WithHttpInfo.IsPresent) { + return $LocalVarResult + } else { + return $LocalVarResult["Response"] + } + } +} + diff --git a/samples/client/echo_api/powershell/src/PSOpenAPITools/Api/HeaderApi.ps1 b/samples/client/echo_api/powershell/src/PSOpenAPITools/Api/HeaderApi.ps1 new file mode 100644 index 00000000000..73e5c3da98e --- /dev/null +++ b/samples/client/echo_api/powershell/src/PSOpenAPITools/Api/HeaderApi.ps1 @@ -0,0 +1,122 @@ +# +# Echo Server API +# Echo Server API +# Version: 0.1.0 +# Contact: team@openapitools.org +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +Test header parameter(s) + +.DESCRIPTION + +No description available. + +.PARAMETER IntegerHeader +No description available. + +.PARAMETER BooleanHeader +No description available. + +.PARAMETER StringHeader +No description available. + +.PARAMETER EnumNonrefStringHeader +No description available. + +.PARAMETER EnumRefStringHeader +No description available. + +.PARAMETER WithHttpInfo + +A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response + +.OUTPUTS + +String +#> +function Test-HeaderIntegerBooleanStringEnums { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [System.Nullable[Int32]] + ${IntegerHeader}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [System.Nullable[Boolean]] + ${BooleanHeader}, + [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [String] + ${StringHeader}, + [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [ValidateSet("success", "failure", "unclassified")] + [String] + ${EnumNonrefStringHeader}, + [Parameter(Position = 4, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [PSCustomObject] + ${EnumRefStringHeader}, + [Switch] + $WithHttpInfo + ) + + Process { + 'Calling method: Test-HeaderIntegerBooleanStringEnums' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $LocalVarAccepts = @() + $LocalVarContentTypes = @() + $LocalVarQueryParameters = @{} + $LocalVarHeaderParameters = @{} + $LocalVarFormParameters = @{} + $LocalVarPathParameters = @{} + $LocalVarCookieParameters = @{} + $LocalVarBodyParameter = $null + + $Configuration = Get-Configuration + # HTTP header 'Accept' (if needed) + $LocalVarAccepts = @('text/plain') + + $LocalVarUri = '/header/integer/boolean/string/enums' + + if ($IntegerHeader) { + $LocalVarHeaderParameters['integer_header'] = $IntegerHeader + } + + if ($BooleanHeader) { + $LocalVarHeaderParameters['boolean_header'] = $BooleanHeader + } + + if ($StringHeader) { + $LocalVarHeaderParameters['string_header'] = $StringHeader + } + + if ($EnumNonrefStringHeader) { + $LocalVarHeaderParameters['enum_nonref_string_header'] = $EnumNonrefStringHeader + } + + if ($EnumRefStringHeader) { + $LocalVarHeaderParameters['enum_ref_string_header'] = $EnumRefStringHeader + } + + $LocalVarResult = Invoke-ApiClient -Method 'GET' ` + -Uri $LocalVarUri ` + -Accepts $LocalVarAccepts ` + -ContentTypes $LocalVarContentTypes ` + -Body $LocalVarBodyParameter ` + -HeaderParameters $LocalVarHeaderParameters ` + -QueryParameters $LocalVarQueryParameters ` + -FormParameters $LocalVarFormParameters ` + -CookieParameters $LocalVarCookieParameters ` + -ReturnType "String" ` + -IsBodyNullable $false + + if ($WithHttpInfo.IsPresent) { + return $LocalVarResult + } else { + return $LocalVarResult["Response"] + } + } +} + diff --git a/samples/client/echo_api/powershell/src/PSOpenAPITools/Api/PathApi.ps1 b/samples/client/echo_api/powershell/src/PSOpenAPITools/Api/PathApi.ps1 new file mode 100644 index 00000000000..1eb5d3453b6 --- /dev/null +++ b/samples/client/echo_api/powershell/src/PSOpenAPITools/Api/PathApi.ps1 @@ -0,0 +1,112 @@ +# +# Echo Server API +# Echo Server API +# Version: 0.1.0 +# Contact: team@openapitools.org +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +Test path parameter(s) + +.DESCRIPTION + +No description available. + +.PARAMETER PathString +No description available. + +.PARAMETER PathInteger +No description available. + +.PARAMETER EnumNonrefStringPath +No description available. + +.PARAMETER EnumRefStringPath +No description available. + +.PARAMETER WithHttpInfo + +A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response + +.OUTPUTS + +String +#> +function Test-sPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [String] + ${PathString}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [Int32] + ${PathInteger}, + [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [ValidateSet("success", "failure", "unclassified")] + [String] + ${EnumNonrefStringPath}, + [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [PSCustomObject] + ${EnumRefStringPath}, + [Switch] + $WithHttpInfo + ) + + Process { + 'Calling method: Test-sPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $LocalVarAccepts = @() + $LocalVarContentTypes = @() + $LocalVarQueryParameters = @{} + $LocalVarHeaderParameters = @{} + $LocalVarFormParameters = @{} + $LocalVarPathParameters = @{} + $LocalVarCookieParameters = @{} + $LocalVarBodyParameter = $null + + $Configuration = Get-Configuration + # HTTP header 'Accept' (if needed) + $LocalVarAccepts = @('text/plain') + + $LocalVarUri = '/path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path}' + if (!$PathString) { + throw "Error! The required parameter `PathString` missing when calling tests_path_string_pathString_integer_pathInteger_enumNonrefStringPath_enumRefStringPath." + } + $LocalVarUri = $LocalVarUri.replace('{path_string}', [System.Web.HTTPUtility]::UrlEncode($PathString)) + if (!$PathInteger) { + throw "Error! The required parameter `PathInteger` missing when calling tests_path_string_pathString_integer_pathInteger_enumNonrefStringPath_enumRefStringPath." + } + $LocalVarUri = $LocalVarUri.replace('{path_integer}', [System.Web.HTTPUtility]::UrlEncode($PathInteger)) + if (!$EnumNonrefStringPath) { + throw "Error! The required parameter `EnumNonrefStringPath` missing when calling tests_path_string_pathString_integer_pathInteger_enumNonrefStringPath_enumRefStringPath." + } + $LocalVarUri = $LocalVarUri.replace('{enum_nonref_string_path}', [System.Web.HTTPUtility]::UrlEncode($EnumNonrefStringPath)) + if (!$EnumRefStringPath) { + throw "Error! The required parameter `EnumRefStringPath` missing when calling tests_path_string_pathString_integer_pathInteger_enumNonrefStringPath_enumRefStringPath." + } + $LocalVarUri = $LocalVarUri.replace('{enum_ref_string_path}', [System.Web.HTTPUtility]::UrlEncode($EnumRefStringPath)) + + $LocalVarResult = Invoke-ApiClient -Method 'GET' ` + -Uri $LocalVarUri ` + -Accepts $LocalVarAccepts ` + -ContentTypes $LocalVarContentTypes ` + -Body $LocalVarBodyParameter ` + -HeaderParameters $LocalVarHeaderParameters ` + -QueryParameters $LocalVarQueryParameters ` + -FormParameters $LocalVarFormParameters ` + -CookieParameters $LocalVarCookieParameters ` + -ReturnType "String" ` + -IsBodyNullable $false + + if ($WithHttpInfo.IsPresent) { + return $LocalVarResult + } else { + return $LocalVarResult["Response"] + } + } +} + diff --git a/samples/client/echo_api/powershell/src/PSOpenAPITools/Api/QueryApi.ps1 b/samples/client/echo_api/powershell/src/PSOpenAPITools/Api/QueryApi.ps1 new file mode 100644 index 00000000000..13bc99c15f4 --- /dev/null +++ b/samples/client/echo_api/powershell/src/PSOpenAPITools/Api/QueryApi.ps1 @@ -0,0 +1,643 @@ +# +# Echo Server API +# Echo Server API +# Version: 0.1.0 +# Contact: team@openapitools.org +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +Test query parameter(s) + +.DESCRIPTION + +No description available. + +.PARAMETER EnumNonrefStringQuery +No description available. + +.PARAMETER EnumRefStringQuery +No description available. + +.PARAMETER WithHttpInfo + +A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response + +.OUTPUTS + +String +#> +function Test-EnumRefString { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [ValidateSet("success", "failure", "unclassified")] + [String] + ${EnumNonrefStringQuery}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [PSCustomObject] + ${EnumRefStringQuery}, + [Switch] + $WithHttpInfo + ) + + Process { + 'Calling method: Test-EnumRefString' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $LocalVarAccepts = @() + $LocalVarContentTypes = @() + $LocalVarQueryParameters = @{} + $LocalVarHeaderParameters = @{} + $LocalVarFormParameters = @{} + $LocalVarPathParameters = @{} + $LocalVarCookieParameters = @{} + $LocalVarBodyParameter = $null + + $Configuration = Get-Configuration + # HTTP header 'Accept' (if needed) + $LocalVarAccepts = @('text/plain') + + $LocalVarUri = '/query/enum_ref_string' + + if ($EnumNonrefStringQuery) { + $LocalVarQueryParameters['enum_nonref_string_query'] = $EnumNonrefStringQuery + } + + if ($EnumRefStringQuery) { + $LocalVarQueryParameters['enum_ref_string_query'] = $EnumRefStringQuery + } + + $LocalVarResult = Invoke-ApiClient -Method 'GET' ` + -Uri $LocalVarUri ` + -Accepts $LocalVarAccepts ` + -ContentTypes $LocalVarContentTypes ` + -Body $LocalVarBodyParameter ` + -HeaderParameters $LocalVarHeaderParameters ` + -QueryParameters $LocalVarQueryParameters ` + -FormParameters $LocalVarFormParameters ` + -CookieParameters $LocalVarCookieParameters ` + -ReturnType "String" ` + -IsBodyNullable $false + + if ($WithHttpInfo.IsPresent) { + return $LocalVarResult + } else { + return $LocalVarResult["Response"] + } + } +} + +<# +.SYNOPSIS + +Test query parameter(s) + +.DESCRIPTION + +No description available. + +.PARAMETER DatetimeQuery +No description available. + +.PARAMETER DateQuery +No description available. + +.PARAMETER StringQuery +No description available. + +.PARAMETER WithHttpInfo + +A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response + +.OUTPUTS + +String +#> +function Test-QueryDatetimeDateString { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [System.Nullable[System.DateTime]] + ${DatetimeQuery}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [System.Nullable[System.DateTime]] + ${DateQuery}, + [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [String] + ${StringQuery}, + [Switch] + $WithHttpInfo + ) + + Process { + 'Calling method: Test-QueryDatetimeDateString' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $LocalVarAccepts = @() + $LocalVarContentTypes = @() + $LocalVarQueryParameters = @{} + $LocalVarHeaderParameters = @{} + $LocalVarFormParameters = @{} + $LocalVarPathParameters = @{} + $LocalVarCookieParameters = @{} + $LocalVarBodyParameter = $null + + $Configuration = Get-Configuration + # HTTP header 'Accept' (if needed) + $LocalVarAccepts = @('text/plain') + + $LocalVarUri = '/query/datetime/date/string' + + if ($DatetimeQuery) { + $LocalVarQueryParameters['datetime_query'] = $DatetimeQuery + } + + if ($DateQuery) { + $LocalVarQueryParameters['date_query'] = $DateQuery + } + + if ($StringQuery) { + $LocalVarQueryParameters['string_query'] = $StringQuery + } + + $LocalVarResult = Invoke-ApiClient -Method 'GET' ` + -Uri $LocalVarUri ` + -Accepts $LocalVarAccepts ` + -ContentTypes $LocalVarContentTypes ` + -Body $LocalVarBodyParameter ` + -HeaderParameters $LocalVarHeaderParameters ` + -QueryParameters $LocalVarQueryParameters ` + -FormParameters $LocalVarFormParameters ` + -CookieParameters $LocalVarCookieParameters ` + -ReturnType "String" ` + -IsBodyNullable $false + + if ($WithHttpInfo.IsPresent) { + return $LocalVarResult + } else { + return $LocalVarResult["Response"] + } + } +} + +<# +.SYNOPSIS + +Test query parameter(s) + +.DESCRIPTION + +No description available. + +.PARAMETER IntegerQuery +No description available. + +.PARAMETER BooleanQuery +No description available. + +.PARAMETER StringQuery +No description available. + +.PARAMETER WithHttpInfo + +A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response + +.OUTPUTS + +String +#> +function Test-QueryIntegerBooleanString { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [System.Nullable[Int32]] + ${IntegerQuery}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [System.Nullable[Boolean]] + ${BooleanQuery}, + [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [String] + ${StringQuery}, + [Switch] + $WithHttpInfo + ) + + Process { + 'Calling method: Test-QueryIntegerBooleanString' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $LocalVarAccepts = @() + $LocalVarContentTypes = @() + $LocalVarQueryParameters = @{} + $LocalVarHeaderParameters = @{} + $LocalVarFormParameters = @{} + $LocalVarPathParameters = @{} + $LocalVarCookieParameters = @{} + $LocalVarBodyParameter = $null + + $Configuration = Get-Configuration + # HTTP header 'Accept' (if needed) + $LocalVarAccepts = @('text/plain') + + $LocalVarUri = '/query/integer/boolean/string' + + if ($IntegerQuery) { + $LocalVarQueryParameters['integer_query'] = $IntegerQuery + } + + if ($BooleanQuery) { + $LocalVarQueryParameters['boolean_query'] = $BooleanQuery + } + + if ($StringQuery) { + $LocalVarQueryParameters['string_query'] = $StringQuery + } + + $LocalVarResult = Invoke-ApiClient -Method 'GET' ` + -Uri $LocalVarUri ` + -Accepts $LocalVarAccepts ` + -ContentTypes $LocalVarContentTypes ` + -Body $LocalVarBodyParameter ` + -HeaderParameters $LocalVarHeaderParameters ` + -QueryParameters $LocalVarQueryParameters ` + -FormParameters $LocalVarFormParameters ` + -CookieParameters $LocalVarCookieParameters ` + -ReturnType "String" ` + -IsBodyNullable $false + + if ($WithHttpInfo.IsPresent) { + return $LocalVarResult + } else { + return $LocalVarResult["Response"] + } + } +} + +<# +.SYNOPSIS + +Test query parameter(s) + +.DESCRIPTION + +No description available. + +.PARAMETER QueryObject +No description available. + +.PARAMETER WithHttpInfo + +A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response + +.OUTPUTS + +String +#> +function Test-QueryStyleDeepObjectExplodeTrueObject { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [PSCustomObject] + ${QueryObject}, + [Switch] + $WithHttpInfo + ) + + Process { + 'Calling method: Test-QueryStyleDeepObjectExplodeTrueObject' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $LocalVarAccepts = @() + $LocalVarContentTypes = @() + $LocalVarQueryParameters = @{} + $LocalVarHeaderParameters = @{} + $LocalVarFormParameters = @{} + $LocalVarPathParameters = @{} + $LocalVarCookieParameters = @{} + $LocalVarBodyParameter = $null + + $Configuration = Get-Configuration + # HTTP header 'Accept' (if needed) + $LocalVarAccepts = @('text/plain') + + $LocalVarUri = '/query/style_deepObject/explode_true/object' + + if ($QueryObject) { + $LocalVarQueryParameters['query_object'] = $QueryObject + } + + $LocalVarResult = Invoke-ApiClient -Method 'GET' ` + -Uri $LocalVarUri ` + -Accepts $LocalVarAccepts ` + -ContentTypes $LocalVarContentTypes ` + -Body $LocalVarBodyParameter ` + -HeaderParameters $LocalVarHeaderParameters ` + -QueryParameters $LocalVarQueryParameters ` + -FormParameters $LocalVarFormParameters ` + -CookieParameters $LocalVarCookieParameters ` + -ReturnType "String" ` + -IsBodyNullable $false + + if ($WithHttpInfo.IsPresent) { + return $LocalVarResult + } else { + return $LocalVarResult["Response"] + } + } +} + +<# +.SYNOPSIS + +Test query parameter(s) + +.DESCRIPTION + +No description available. + +.PARAMETER QueryObject +No description available. + +.PARAMETER WithHttpInfo + +A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response + +.OUTPUTS + +String +#> +function Test-QueryStyleDeepObjectExplodeTrueObjectAllOf { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [PSCustomObject] + ${QueryObject}, + [Switch] + $WithHttpInfo + ) + + Process { + 'Calling method: Test-QueryStyleDeepObjectExplodeTrueObjectAllOf' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $LocalVarAccepts = @() + $LocalVarContentTypes = @() + $LocalVarQueryParameters = @{} + $LocalVarHeaderParameters = @{} + $LocalVarFormParameters = @{} + $LocalVarPathParameters = @{} + $LocalVarCookieParameters = @{} + $LocalVarBodyParameter = $null + + $Configuration = Get-Configuration + # HTTP header 'Accept' (if needed) + $LocalVarAccepts = @('text/plain') + + $LocalVarUri = '/query/style_deepObject/explode_true/object/allOf' + + if ($QueryObject) { + $LocalVarQueryParameters['query_object'] = $QueryObject + } + + $LocalVarResult = Invoke-ApiClient -Method 'GET' ` + -Uri $LocalVarUri ` + -Accepts $LocalVarAccepts ` + -ContentTypes $LocalVarContentTypes ` + -Body $LocalVarBodyParameter ` + -HeaderParameters $LocalVarHeaderParameters ` + -QueryParameters $LocalVarQueryParameters ` + -FormParameters $LocalVarFormParameters ` + -CookieParameters $LocalVarCookieParameters ` + -ReturnType "String" ` + -IsBodyNullable $false + + if ($WithHttpInfo.IsPresent) { + return $LocalVarResult + } else { + return $LocalVarResult["Response"] + } + } +} + +<# +.SYNOPSIS + +Test query parameter(s) + +.DESCRIPTION + +No description available. + +.PARAMETER QueryObject +No description available. + +.PARAMETER WithHttpInfo + +A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response + +.OUTPUTS + +String +#> +function Test-QueryStyleFormExplodeTrueArrayString { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [PSCustomObject] + ${QueryObject}, + [Switch] + $WithHttpInfo + ) + + Process { + 'Calling method: Test-QueryStyleFormExplodeTrueArrayString' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $LocalVarAccepts = @() + $LocalVarContentTypes = @() + $LocalVarQueryParameters = @{} + $LocalVarHeaderParameters = @{} + $LocalVarFormParameters = @{} + $LocalVarPathParameters = @{} + $LocalVarCookieParameters = @{} + $LocalVarBodyParameter = $null + + $Configuration = Get-Configuration + # HTTP header 'Accept' (if needed) + $LocalVarAccepts = @('text/plain') + + $LocalVarUri = '/query/style_form/explode_true/array_string' + + if ($QueryObject) { + $LocalVarQueryParameters['query_object'] = $QueryObject + } + + $LocalVarResult = Invoke-ApiClient -Method 'GET' ` + -Uri $LocalVarUri ` + -Accepts $LocalVarAccepts ` + -ContentTypes $LocalVarContentTypes ` + -Body $LocalVarBodyParameter ` + -HeaderParameters $LocalVarHeaderParameters ` + -QueryParameters $LocalVarQueryParameters ` + -FormParameters $LocalVarFormParameters ` + -CookieParameters $LocalVarCookieParameters ` + -ReturnType "String" ` + -IsBodyNullable $false + + if ($WithHttpInfo.IsPresent) { + return $LocalVarResult + } else { + return $LocalVarResult["Response"] + } + } +} + +<# +.SYNOPSIS + +Test query parameter(s) + +.DESCRIPTION + +No description available. + +.PARAMETER QueryObject +No description available. + +.PARAMETER WithHttpInfo + +A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response + +.OUTPUTS + +String +#> +function Test-QueryStyleFormExplodeTrueObject { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [PSCustomObject] + ${QueryObject}, + [Switch] + $WithHttpInfo + ) + + Process { + 'Calling method: Test-QueryStyleFormExplodeTrueObject' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $LocalVarAccepts = @() + $LocalVarContentTypes = @() + $LocalVarQueryParameters = @{} + $LocalVarHeaderParameters = @{} + $LocalVarFormParameters = @{} + $LocalVarPathParameters = @{} + $LocalVarCookieParameters = @{} + $LocalVarBodyParameter = $null + + $Configuration = Get-Configuration + # HTTP header 'Accept' (if needed) + $LocalVarAccepts = @('text/plain') + + $LocalVarUri = '/query/style_form/explode_true/object' + + if ($QueryObject) { + $LocalVarQueryParameters['query_object'] = $QueryObject + } + + $LocalVarResult = Invoke-ApiClient -Method 'GET' ` + -Uri $LocalVarUri ` + -Accepts $LocalVarAccepts ` + -ContentTypes $LocalVarContentTypes ` + -Body $LocalVarBodyParameter ` + -HeaderParameters $LocalVarHeaderParameters ` + -QueryParameters $LocalVarQueryParameters ` + -FormParameters $LocalVarFormParameters ` + -CookieParameters $LocalVarCookieParameters ` + -ReturnType "String" ` + -IsBodyNullable $false + + if ($WithHttpInfo.IsPresent) { + return $LocalVarResult + } else { + return $LocalVarResult["Response"] + } + } +} + +<# +.SYNOPSIS + +Test query parameter(s) + +.DESCRIPTION + +No description available. + +.PARAMETER QueryObject +No description available. + +.PARAMETER WithHttpInfo + +A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response + +.OUTPUTS + +String +#> +function Test-QueryStyleFormExplodeTrueObjectAllOf { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [PSCustomObject] + ${QueryObject}, + [Switch] + $WithHttpInfo + ) + + Process { + 'Calling method: Test-QueryStyleFormExplodeTrueObjectAllOf' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $LocalVarAccepts = @() + $LocalVarContentTypes = @() + $LocalVarQueryParameters = @{} + $LocalVarHeaderParameters = @{} + $LocalVarFormParameters = @{} + $LocalVarPathParameters = @{} + $LocalVarCookieParameters = @{} + $LocalVarBodyParameter = $null + + $Configuration = Get-Configuration + # HTTP header 'Accept' (if needed) + $LocalVarAccepts = @('text/plain') + + $LocalVarUri = '/query/style_form/explode_true/object/allOf' + + if ($QueryObject) { + $LocalVarQueryParameters['query_object'] = $QueryObject + } + + $LocalVarResult = Invoke-ApiClient -Method 'GET' ` + -Uri $LocalVarUri ` + -Accepts $LocalVarAccepts ` + -ContentTypes $LocalVarContentTypes ` + -Body $LocalVarBodyParameter ` + -HeaderParameters $LocalVarHeaderParameters ` + -QueryParameters $LocalVarQueryParameters ` + -FormParameters $LocalVarFormParameters ` + -CookieParameters $LocalVarCookieParameters ` + -ReturnType "String" ` + -IsBodyNullable $false + + if ($WithHttpInfo.IsPresent) { + return $LocalVarResult + } else { + return $LocalVarResult["Response"] + } + } +} + diff --git a/samples/client/echo_api/powershell/src/PSOpenAPITools/Client/Configuration.ps1 b/samples/client/echo_api/powershell/src/PSOpenAPITools/Client/Configuration.ps1 new file mode 100644 index 00000000000..9e1aa107bbc --- /dev/null +++ b/samples/client/echo_api/powershell/src/PSOpenAPITools/Client/Configuration.ps1 @@ -0,0 +1,515 @@ +# +# Echo Server API +# Echo Server API +# Version: 0.1.0 +# Contact: team@openapitools.org +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +Get the configuration object 'Configuration'. + +.DESCRIPTION + +Get the configuration object 'Configuration'. + +.OUTPUTS + +System.Collections.Hashtable +#> +function Get-Configuration { + + $Configuration = $Script:Configuration + + if ([string]::IsNullOrEmpty($Configuration["BaseUrl"])) { + $Configuration["BaseUrl"] = "http://localhost:3000"; + } + + if (!$Configuration.containsKey("Username")) { + $Configuration["Username"] = $null + } + if (!$Configuration.containsKey("Password")) { + $Configuration["Password"] = $null + } + if (!$Configuration.containsKey("AccessToken")) { + $Configuration["AccessToken"] = $null + } + if (!$Configuration.containsKey("Cookie")) { + $Configuration["Cookie"] = $null + } + + if (!$Configuration["DefaultHeaders"]) { + $Configuration["DefaultHeaders"] = @{} + } + + if (!$Configuration["ApiKey"]) { + $Configuration["ApiKey"] = @{} + } + + if (!$Configuration["ApiKeyPrefix"]) { + $Configuration["ApiKeyPrefix"] = @{} + } + + if (!$Configuration.containsKey("SkipCertificateCheck")) { + $Configuration["SkipCertificateCheck"] = $false + } + + if (!$Configuration.containsKey("Proxy")) { + $Configuration["Proxy"] = $null + } + + Return $Configuration + +} + +<# +.SYNOPSIS + +Set the configuration. + +.DESCRIPTION + +Set the configuration. + +.PARAMETER BaseUrl +Base URL of the HTTP endpoints + +.PARAMETER Username +Username in HTTP basic authentication + +.PARAMETER Password +Password in HTTP basic authentication + +.PARAMETER ApiKey +API Keys for authentication/authorization + +.PARAMETER ApiKeyPrefix +Prefix in the API Keys + +.PARAMETER Cookie +Cookie for authentication/authorization + +.PARAMETER AccessToken +Access token for authentication/authorization + +.PARAMETER SkipCertificateCheck +Skip certificate verification + +.PARAMETER DefaultHeaders +Default HTTP headers to be included in the HTTP request + +.PARAMETER Proxy +Proxy setting in the HTTP request, e.g. + +$proxy = [System.Net.WebRequest]::GetSystemWebProxy() +$proxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials + +.PARAMETER PassThru +Return an object of the Configuration + +.OUTPUTS + +System.Collections.Hashtable +#> +function Set-Configuration { + + [CmdletBinding()] + Param( + [string]$BaseUrl, + [AllowEmptyString()] + [string]$Username, + [AllowEmptyString()] + [string]$Password, + [hashtable]$ApiKey, + [hashtable]$ApiKeyPrefix, + [AllowEmptyString()] + [string]$Cookie, + [AllowEmptyString()] + [string]$AccessToken, + [switch]$SkipCertificateCheck, + [hashtable]$DefaultHeaders, + [System.Object]$Proxy, + [switch]$PassThru + ) + + Process { + + If ($BaseUrl) { + # validate URL + $URL = $BaseUrl -as [System.URI] + if (!($null -ne $URL.AbsoluteURI -and $URL.Scheme -match '[http|https]')) { + throw "Invalid URL '$($BaseUrl)' cannot be used in the base URL." + } + $Script:Configuration["BaseUrl"] = $BaseUrl + } + + If ($Username) { + $Script:Configuration['Username'] = $Username + } + + If ($Password) { + $Script:Configuration['Password'] = $Password + } + + If ($ApiKey) { + $Script:Configuration['ApiKey'] = $ApiKey + } + + If ($ApiKeyPrefix) { + $Script:Configuration['ApiKeyPrefix'] = $ApiKeyPrefix + } + + If ($Cookie) { + $Script:Configuration['Cookie'] = $Cookie + } + + If ($AccessToken) { + $Script:Configuration['AccessToken'] = $AccessToken + } + + If ($SkipCertificateCheck.IsPresent) { + $Script:Configuration['SkipCertificateCheck'] = $true + } else { + $Script:Configuration['SkipCertificateCheck'] = $false + } + + If ($DefaultHeaders) { + $Script:Configuration['DefaultHeaders'] = $DefaultHeaders + } + + If ($null -ne $Proxy) { + If ($Proxy.GetType().FullName -ne "System.Net.SystemWebProxy" -and $Proxy.GetType().FullName -ne "System.Net.WebRequest+WebProxyWrapperOpaque") { + throw "Incorrect Proxy type '$($Proxy.GetType().FullName)'. Must be System.Net.SystemWebProxy or System.Net.WebRequest+WebProxyWrapperOpaque." + } + $Script:Configuration['Proxy'] = $Proxy + } else { + $Script:Configuration['Proxy'] = $null + } + + If ($PassThru.IsPresent) { + $Script:Configuration + } + } +} + +<# +.SYNOPSIS + +Set the API Key. + +.DESCRIPTION + +Set the API Key. + +.PARAMETER Id +ID of the security schema + +.PARAMETER ApiKey +API Key + +.OUTPUTS + +None +#> +function Set-ConfigurationApiKey { + [CmdletBinding()] + Param( + [string]$Id, + [AllowEmptyString()] + [string]$ApiKey + ) + Process { + if (!$Script:Configuration["ApiKey"]) { + $Script:Configuration["ApiKey"] = @{} + } + $Script:Configuration["ApiKey"][$Id] = $ApiKey + } +} + +<# +.SYNOPSIS + +Set the API Key prefix. + +.DESCRIPTION + +Set the API Key prefix. + +.PARAMETER Id +ID of the security schema + +.PARAMETER ApiKey +API Key prefix + +.OUTPUTS + +None +#> +function Set-ConfigurationApiKeyPrefix { + [CmdletBinding()] + Param( + [string]$Id, + [AllowEmptyString()] + [string]$ApiKeyPrefix + ) + Process { + if (!$Script:Configuration["ApiKeyPrefix"]) { + $Script:Configuration["ApiKeyPrefix"] = @{} + } + $Script:Configuration["ApiKeyPrefix"][$Id] = $ApiKeyPrefix + } +} + +<# +.SYNOPSIS + +Set the default header. + +.DESCRIPTION + +Set the default header. + +.PARAMETER Key +Key of the HTTP header + +.PARAMETER Value +Value of the HTTP header + +.OUTPUTS + +None +#> +function Set-ConfigurationDefaultHeader { + [CmdletBinding()] + Param( + [string]$Key, + [AllowEmptyString()] + [string]$Value + ) + Process { + if (!$Script:Configuration["DefaultHeaders"]) { + $Script:Configuration["DefaultHeaders"] = @{} + } + $Script:Configuration["DefaultHeaders"][$Key] = $Value + } +} + + +<# +.SYNOPSIS + +Get the host setting. + +.DESCRIPTION + +Get the host setting in the form of array of hashtables. + +.OUTPUTS + +System.Collections.Hashtable[] +#> +function Get-HostSetting { + return ,@( + @{ + "Url" = "http://localhost:3000"; + "Description" = "No description provided"; + } + ) + +} + +<# +.SYNOPSIS + +Get the URL from the host settings. + +.PARAMETER Index +Index of the host settings (array) + +.PARAMETER Variables +Names and values of the variables (hashtable) + +.DESCRIPTION + +Get the URL from the host settings. + +.OUTPUTS + +String +#> +function Get-UrlFromHostSetting { + + [CmdletBinding()] + Param( + [Parameter(ValueFromPipeline = $true)] + [Int]$Index, + [Hashtable]$Variables = @{} + ) + + Process { + $Hosts = Get-HostSetting + + # check array index out of bound + if ($Index -lt 0 -or $Index -ge $Hosts.Length) { + throw "Invalid index $index when selecting the host. Must be less than $($Hosts.Length)" + } + + $MyHost = $Hosts[$Index]; + $Url = $MyHost["Url"]; + + # go through variable and assign a value + foreach ($h in $MyHost["Variables"].GetEnumerator()) { + if ($Variables.containsKey($h.Name)) { # check to see if it's in the variables provided by the user + if ($h.Value["EnumValues"] -Contains $Variables[$h.Name]) { + $Url = $Url.replace("{$($h.Name)}", $Variables[$h.Name]) + } else { + throw "The variable '$($h.Name)' in the host URL has invalid value $($Variables[$h.Name]). Must be $($h.Value["EnumValues"] -join ",")" + } + } else { + $Url = $Url.replace("{$($h.Name)}", $h.Value["DefaultValue"]) + } + } + + return $Url; + + } +} + +<# +.SYNOPSIS +Sets the configuration for http signing. +.DESCRIPTION + +Sets the configuration for the HTTP signature security scheme. +The HTTP signature security scheme is used to sign HTTP requests with a key +which is in possession of the API client. +An 'Authorization' header is calculated by creating a hash of select headers, +and optionally the body of the HTTP request, then signing the hash value using +a key. The 'Authorization' header is added to outbound HTTP requests. + +Ref: https://openapi-generator.tech + +.PARAMETER KeyId +KeyId for HTTP signing + +.PARAMETER KeyFilePath +KeyFilePath for HTTP signing + +.PARAMETER KeyPassPhrase +KeyPassPhrase, if the HTTP signing key is protected + +.PARAMETER HttpSigningHeader +HttpSigningHeader list of HTTP headers used to calculate the signature. The two special signature headers '(request-target)' and '(created)' +SHOULD be included. + The '(created)' header expresses when the signature was created. + The '(request-target)' header is a concatenation of the lowercased :method, an + ASCII space, and the :path pseudo-headers. +If no headers are specified then '(created)' sets as default. + +.PARAMETER HashAlgorithm +HashAlgorithm to calculate the hash, Supported values are "sha256" and "sha512" + +.PARAMETER SigningAlgorithm +SigningAlgorithm specifies the signature algorithm, supported values are "RSASSA-PKCS1-v1_5" and "RSASSA-PSS" +RSA key : Supported values "RSASSA-PKCS1-v1_5" and "RSASSA-PSS", for ECDSA key this parameter is not applicable + +.PARAMETER SignatureValidityPeriod +SignatureValidityPeriod specifies the signature maximum validity time in seconds. It accepts integer value + +.OUTPUTS + +System.Collections.Hashtable +#> +function Set-ConfigurationHttpSigning { + [CmdletBinding()] + param( + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string]$KeyId, + [Parameter(Mandatory = $true)] + [string]$KeyFilePath, + [Parameter(Mandatory = $false)] + [securestring]$KeyPassPhrase, + [Parameter(Mandatory = $false)] + [ValidateNotNullOrEmpty()] + [string[]] $HttpSigningHeader = @("(created)"), + [Parameter(Mandatory = $false)] + [ValidateSet("sha256", "sha512")] + [string] $HashAlgorithm = "sha256", + [Parameter(Mandatory = $false)] + [ValidateSet("RSASSA-PKCS1-v1_5", "RSASSA-PSS")] + [string]$SigningAlgorithm , + [Parameter(Mandatory = $false)] + [int]$SignatureValidityPeriod + ) + + Process { + $httpSignatureConfiguration = @{ } + + if (Test-Path -Path $KeyFilePath) { + $httpSignatureConfiguration["KeyId"] = $KeyId + $httpSignatureConfiguration["KeyFilePath"] = $KeyFilePath + } + else { + throw "Private key file path does not exist" + } + + $keyType = Get-KeyTypeFromFile -KeyFilePath $KeyFilePath + if ([String]::IsNullOrEmpty($SigningAlgorithm)) { + if ($keyType -eq "RSA") { + $SigningAlgorithm = "RSASSA-PKCS1-v1_5" + } + } + + if ($keyType -eq "RSA" -and + ($SigningAlgorithm -ne "RSASSA-PKCS1-v1_5" -and $SigningAlgorithm -ne "RSASSA-PSS" )) { + throw "Provided Key and SigningAlgorithm : $SigningAlgorithm is not compatible." + } + + if ($HttpSigningHeader -contains "(expires)" -and $SignatureValidityPeriod -le 0) { + throw "SignatureValidityPeriod must be greater than 0 seconds." + } + + if ($HttpSigningHeader -contains "(expires)") { + $httpSignatureConfiguration["SignatureValidityPeriod"] = $SignatureValidityPeriod + } + if ($null -ne $HttpSigningHeader -and $HttpSigningHeader.Length -gt 0) { + $httpSignatureConfiguration["HttpSigningHeader"] = $HttpSigningHeader + } + + if ($null -ne $HashAlgorithm ) { + $httpSignatureConfiguration["HashAlgorithm"] = $HashAlgorithm + } + + if ($null -ne $SigningAlgorithm) { + $httpSignatureConfiguration["SigningAlgorithm"] = $SigningAlgorithm + } + + if ($null -ne $KeyPassPhrase) { + $httpSignatureConfiguration["KeyPassPhrase"] = $KeyPassPhrase + } + + $Script:Configuration["HttpSigning"] = New-Object -TypeName PSCustomObject -Property $httpSignatureConfiguration + } +} + +<# +.SYNOPSIS + +Get the configuration object 'ConfigurationHttpSigning'. + +.DESCRIPTION + +Get the configuration object 'ConfigurationHttpSigning'. + +.OUTPUTS + +[PSCustomObject] +#> +function Get-ConfigurationHttpSigning{ + + $httpSignatureConfiguration = $Script:Configuration["HttpSigning"] + return $httpSignatureConfiguration +} diff --git a/samples/client/echo_api/powershell/src/PSOpenAPITools/Model/Bird.ps1 b/samples/client/echo_api/powershell/src/PSOpenAPITools/Model/Bird.ps1 new file mode 100644 index 00000000000..e699ce79035 --- /dev/null +++ b/samples/client/echo_api/powershell/src/PSOpenAPITools/Model/Bird.ps1 @@ -0,0 +1,111 @@ +# +# Echo Server API +# Echo Server API +# Version: 0.1.0 +# Contact: team@openapitools.org +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER Size +No description available. +.PARAMETER Color +No description available. +.OUTPUTS + +Bird +#> + +function Initialize-Bird { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${Size}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] + [String] + ${Color} + ) + + Process { + 'Creating PSCustomObject: PSOpenAPITools => Bird' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + + $PSO = [PSCustomObject]@{ + "size" = ${Size} + "color" = ${Color} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to Bird + +.DESCRIPTION + +Convert from JSON to Bird + +.PARAMETER Json + +Json object + +.OUTPUTS + +Bird +#> +function ConvertFrom-JsonToBird { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSOpenAPITools => Bird' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in Bird + $AllProperties = ("size", "color") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "size"))) { #optional property not found + $Size = $null + } else { + $Size = $JsonParameters.PSobject.Properties["size"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "color"))) { #optional property not found + $Color = $null + } else { + $Color = $JsonParameters.PSobject.Properties["color"].value + } + + $PSO = [PSCustomObject]@{ + "size" = ${Size} + "color" = ${Color} + } + + return $PSO + } + +} + diff --git a/samples/client/echo_api/powershell/src/PSOpenAPITools/Model/Category.ps1 b/samples/client/echo_api/powershell/src/PSOpenAPITools/Model/Category.ps1 new file mode 100644 index 00000000000..4e561693da9 --- /dev/null +++ b/samples/client/echo_api/powershell/src/PSOpenAPITools/Model/Category.ps1 @@ -0,0 +1,111 @@ +# +# Echo Server API +# Echo Server API +# Version: 0.1.0 +# Contact: team@openapitools.org +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER Id +No description available. +.PARAMETER Name +No description available. +.OUTPUTS + +Category +#> + +function Initialize-Category { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Int64]] + ${Id}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] + [String] + ${Name} + ) + + Process { + 'Creating PSCustomObject: PSOpenAPITools => Category' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + + $PSO = [PSCustomObject]@{ + "id" = ${Id} + "name" = ${Name} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to Category + +.DESCRIPTION + +Convert from JSON to Category + +.PARAMETER Json + +Json object + +.OUTPUTS + +Category +#> +function ConvertFrom-JsonToCategory { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSOpenAPITools => Category' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in Category + $AllProperties = ("id", "name") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "id"))) { #optional property not found + $Id = $null + } else { + $Id = $JsonParameters.PSobject.Properties["id"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "name"))) { #optional property not found + $Name = $null + } else { + $Name = $JsonParameters.PSobject.Properties["name"].value + } + + $PSO = [PSCustomObject]@{ + "id" = ${Id} + "name" = ${Name} + } + + return $PSO + } + +} + diff --git a/samples/client/echo_api/powershell/src/PSOpenAPITools/Model/DataQuery.ps1 b/samples/client/echo_api/powershell/src/PSOpenAPITools/Model/DataQuery.ps1 new file mode 100644 index 00000000000..9fadb40d227 --- /dev/null +++ b/samples/client/echo_api/powershell/src/PSOpenAPITools/Model/DataQuery.ps1 @@ -0,0 +1,151 @@ +# +# Echo Server API +# Echo Server API +# Version: 0.1.0 +# Contact: team@openapitools.org +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER Id +Query +.PARAMETER Outcomes +No description available. +.PARAMETER Suffix +test suffix +.PARAMETER Text +Some text containing white spaces +.PARAMETER Date +A date +.OUTPUTS + +DataQuery +#> + +function Initialize-DataQuery { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Int64]] + ${Id}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] + [ValidateSet("SUCCESS", "FAILURE", "SKIPPED")] + [String[]] + ${Outcomes}, + [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)] + [String] + ${Suffix}, + [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true)] + [String] + ${Text}, + [Parameter(Position = 4, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[System.DateTime]] + ${Date} + ) + + Process { + 'Creating PSCustomObject: PSOpenAPITools => DataQuery' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + + $PSO = [PSCustomObject]@{ + "id" = ${Id} + "outcomes" = ${Outcomes} + "suffix" = ${Suffix} + "text" = ${Text} + "date" = ${Date} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to DataQuery + +.DESCRIPTION + +Convert from JSON to DataQuery + +.PARAMETER Json + +Json object + +.OUTPUTS + +DataQuery +#> +function ConvertFrom-JsonToDataQuery { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSOpenAPITools => DataQuery' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in DataQuery + $AllProperties = ("id", "outcomes", "suffix", "text", "date") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "id"))) { #optional property not found + $Id = $null + } else { + $Id = $JsonParameters.PSobject.Properties["id"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "outcomes"))) { #optional property not found + $Outcomes = $null + } else { + $Outcomes = $JsonParameters.PSobject.Properties["outcomes"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "suffix"))) { #optional property not found + $Suffix = $null + } else { + $Suffix = $JsonParameters.PSobject.Properties["suffix"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "text"))) { #optional property not found + $Text = $null + } else { + $Text = $JsonParameters.PSobject.Properties["text"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "date"))) { #optional property not found + $Date = $null + } else { + $Date = $JsonParameters.PSobject.Properties["date"].value + } + + $PSO = [PSCustomObject]@{ + "id" = ${Id} + "outcomes" = ${Outcomes} + "suffix" = ${Suffix} + "text" = ${Text} + "date" = ${Date} + } + + return $PSO + } + +} + diff --git a/samples/client/echo_api/powershell/src/PSOpenAPITools/Model/DefaultValue.ps1 b/samples/client/echo_api/powershell/src/PSOpenAPITools/Model/DefaultValue.ps1 new file mode 100644 index 00000000000..0b01f22b39b --- /dev/null +++ b/samples/client/echo_api/powershell/src/PSOpenAPITools/Model/DefaultValue.ps1 @@ -0,0 +1,190 @@ +# +# Echo Server API +# Echo Server API +# Version: 0.1.0 +# Contact: team@openapitools.org +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +to test the default value of properties + +.PARAMETER ArrayStringEnumRefDefault +No description available. +.PARAMETER ArrayStringEnumDefault +No description available. +.PARAMETER ArrayStringDefault +No description available. +.PARAMETER ArrayIntegerDefault +No description available. +.PARAMETER ArrayString +No description available. +.PARAMETER ArrayStringNullable +No description available. +.PARAMETER ArrayStringExtensionNullable +No description available. +.PARAMETER StringNullable +No description available. +.OUTPUTS + +DefaultValue +#> + +function Initialize-DefaultValue { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [PSCustomObject[]] + ${ArrayStringEnumRefDefault}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] + [ValidateSet("success", "failure", "unclassified")] + [String[]] + ${ArrayStringEnumDefault}, + [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)] + [String[]] + ${ArrayStringDefault}, + [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true)] + [Int32[]] + ${ArrayIntegerDefault}, + [Parameter(Position = 4, ValueFromPipelineByPropertyName = $true)] + [String[]] + ${ArrayString}, + [Parameter(Position = 5, ValueFromPipelineByPropertyName = $true)] + [String[]] + ${ArrayStringNullable}, + [Parameter(Position = 6, ValueFromPipelineByPropertyName = $true)] + [String[]] + ${ArrayStringExtensionNullable}, + [Parameter(Position = 7, ValueFromPipelineByPropertyName = $true)] + [String] + ${StringNullable} + ) + + Process { + 'Creating PSCustomObject: PSOpenAPITools => DefaultValue' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + + $PSO = [PSCustomObject]@{ + "array_string_enum_ref_default" = ${ArrayStringEnumRefDefault} + "array_string_enum_default" = ${ArrayStringEnumDefault} + "array_string_default" = ${ArrayStringDefault} + "array_integer_default" = ${ArrayIntegerDefault} + "array_string" = ${ArrayString} + "array_string_nullable" = ${ArrayStringNullable} + "array_string_extension_nullable" = ${ArrayStringExtensionNullable} + "string_nullable" = ${StringNullable} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to DefaultValue + +.DESCRIPTION + +Convert from JSON to DefaultValue + +.PARAMETER Json + +Json object + +.OUTPUTS + +DefaultValue +#> +function ConvertFrom-JsonToDefaultValue { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSOpenAPITools => DefaultValue' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in DefaultValue + $AllProperties = ("array_string_enum_ref_default", "array_string_enum_default", "array_string_default", "array_integer_default", "array_string", "array_string_nullable", "array_string_extension_nullable", "string_nullable") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "array_string_enum_ref_default"))) { #optional property not found + $ArrayStringEnumRefDefault = $null + } else { + $ArrayStringEnumRefDefault = $JsonParameters.PSobject.Properties["array_string_enum_ref_default"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "array_string_enum_default"))) { #optional property not found + $ArrayStringEnumDefault = $null + } else { + $ArrayStringEnumDefault = $JsonParameters.PSobject.Properties["array_string_enum_default"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "array_string_default"))) { #optional property not found + $ArrayStringDefault = $null + } else { + $ArrayStringDefault = $JsonParameters.PSobject.Properties["array_string_default"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "array_integer_default"))) { #optional property not found + $ArrayIntegerDefault = $null + } else { + $ArrayIntegerDefault = $JsonParameters.PSobject.Properties["array_integer_default"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "array_string"))) { #optional property not found + $ArrayString = $null + } else { + $ArrayString = $JsonParameters.PSobject.Properties["array_string"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "array_string_nullable"))) { #optional property not found + $ArrayStringNullable = $null + } else { + $ArrayStringNullable = $JsonParameters.PSobject.Properties["array_string_nullable"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "array_string_extension_nullable"))) { #optional property not found + $ArrayStringExtensionNullable = $null + } else { + $ArrayStringExtensionNullable = $JsonParameters.PSobject.Properties["array_string_extension_nullable"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "string_nullable"))) { #optional property not found + $StringNullable = $null + } else { + $StringNullable = $JsonParameters.PSobject.Properties["string_nullable"].value + } + + $PSO = [PSCustomObject]@{ + "array_string_enum_ref_default" = ${ArrayStringEnumRefDefault} + "array_string_enum_default" = ${ArrayStringEnumDefault} + "array_string_default" = ${ArrayStringDefault} + "array_integer_default" = ${ArrayIntegerDefault} + "array_string" = ${ArrayString} + "array_string_nullable" = ${ArrayStringNullable} + "array_string_extension_nullable" = ${ArrayStringExtensionNullable} + "string_nullable" = ${StringNullable} + } + + return $PSO + } + +} + diff --git a/samples/client/echo_api/powershell/src/PSOpenAPITools/Model/NumberPropertiesOnly.ps1 b/samples/client/echo_api/powershell/src/PSOpenAPITools/Model/NumberPropertiesOnly.ps1 new file mode 100644 index 00000000000..131819de86a --- /dev/null +++ b/samples/client/echo_api/powershell/src/PSOpenAPITools/Model/NumberPropertiesOnly.ps1 @@ -0,0 +1,132 @@ +# +# Echo Server API +# Echo Server API +# Version: 0.1.0 +# Contact: team@openapitools.org +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER Number +No description available. +.PARAMETER Float +No description available. +.PARAMETER Double +No description available. +.OUTPUTS + +NumberPropertiesOnly +#> + +function Initialize-NumberPropertiesOnly { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Decimal]] + ${Number}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Double]] + ${Float}, + [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Double]] + ${Double} + ) + + Process { + 'Creating PSCustomObject: PSOpenAPITools => NumberPropertiesOnly' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + if ($Double -and $Double -gt 50.2) { + throw "invalid value for 'Double', must be smaller than or equal to 50.2." + } + + if ($Double -and $Double -lt 0.8) { + throw "invalid value for 'Double', must be greater than or equal to 0.8." + } + + + $PSO = [PSCustomObject]@{ + "number" = ${Number} + "float" = ${Float} + "double" = ${Double} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to NumberPropertiesOnly + +.DESCRIPTION + +Convert from JSON to NumberPropertiesOnly + +.PARAMETER Json + +Json object + +.OUTPUTS + +NumberPropertiesOnly +#> +function ConvertFrom-JsonToNumberPropertiesOnly { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSOpenAPITools => NumberPropertiesOnly' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in NumberPropertiesOnly + $AllProperties = ("number", "float", "double") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "number"))) { #optional property not found + $Number = $null + } else { + $Number = $JsonParameters.PSobject.Properties["number"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "float"))) { #optional property not found + $Float = $null + } else { + $Float = $JsonParameters.PSobject.Properties["float"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "double"))) { #optional property not found + $Double = $null + } else { + $Double = $JsonParameters.PSobject.Properties["double"].value + } + + $PSO = [PSCustomObject]@{ + "number" = ${Number} + "float" = ${Float} + "double" = ${Double} + } + + return $PSO + } + +} + diff --git a/samples/client/echo_api/powershell/src/PSOpenAPITools/Model/Pet.ps1 b/samples/client/echo_api/powershell/src/PSOpenAPITools/Model/Pet.ps1 new file mode 100644 index 00000000000..e89786caafd --- /dev/null +++ b/samples/client/echo_api/powershell/src/PSOpenAPITools/Model/Pet.ps1 @@ -0,0 +1,176 @@ +# +# Echo Server API +# Echo Server API +# Version: 0.1.0 +# Contact: team@openapitools.org +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER Id +No description available. +.PARAMETER Name +No description available. +.PARAMETER Category +No description available. +.PARAMETER PhotoUrls +No description available. +.PARAMETER Tags +No description available. +.PARAMETER Status +pet status in the store +.OUTPUTS + +Pet +#> + +function Initialize-Pet { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Int64]] + ${Id}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] + [String] + ${Name}, + [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)] + [PSCustomObject] + ${Category}, + [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true)] + [String[]] + ${PhotoUrls}, + [Parameter(Position = 4, ValueFromPipelineByPropertyName = $true)] + [PSCustomObject[]] + ${Tags}, + [Parameter(Position = 5, ValueFromPipelineByPropertyName = $true)] + [ValidateSet("available", "pending", "sold")] + [String] + ${Status} + ) + + Process { + 'Creating PSCustomObject: PSOpenAPITools => Pet' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + if ($null -eq $Name) { + throw "invalid value for 'Name', 'Name' cannot be null." + } + + if ($null -eq $PhotoUrls) { + throw "invalid value for 'PhotoUrls', 'PhotoUrls' cannot be null." + } + + + $PSO = [PSCustomObject]@{ + "id" = ${Id} + "name" = ${Name} + "category" = ${Category} + "photoUrls" = ${PhotoUrls} + "tags" = ${Tags} + "status" = ${Status} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to Pet + +.DESCRIPTION + +Convert from JSON to Pet + +.PARAMETER Json + +Json object + +.OUTPUTS + +Pet +#> +function ConvertFrom-JsonToPet { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSOpenAPITools => Pet' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in Pet + $AllProperties = ("id", "name", "category", "photoUrls", "tags", "status") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + If ([string]::IsNullOrEmpty($Json) -or $Json -eq "{}") { # empty json + throw "Error! Empty JSON cannot be serialized due to the required property 'name' missing." + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "name"))) { + throw "Error! JSON cannot be serialized due to the required property 'name' missing." + } else { + $Name = $JsonParameters.PSobject.Properties["name"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "photoUrls"))) { + throw "Error! JSON cannot be serialized due to the required property 'photoUrls' missing." + } else { + $PhotoUrls = $JsonParameters.PSobject.Properties["photoUrls"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "id"))) { #optional property not found + $Id = $null + } else { + $Id = $JsonParameters.PSobject.Properties["id"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "category"))) { #optional property not found + $Category = $null + } else { + $Category = $JsonParameters.PSobject.Properties["category"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "tags"))) { #optional property not found + $Tags = $null + } else { + $Tags = $JsonParameters.PSobject.Properties["tags"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "status"))) { #optional property not found + $Status = $null + } else { + $Status = $JsonParameters.PSobject.Properties["status"].value + } + + $PSO = [PSCustomObject]@{ + "id" = ${Id} + "name" = ${Name} + "category" = ${Category} + "photoUrls" = ${PhotoUrls} + "tags" = ${Tags} + "status" = ${Status} + } + + return $PSO + } + +} + diff --git a/samples/client/echo_api/powershell/src/PSOpenAPITools/Model/Query.ps1 b/samples/client/echo_api/powershell/src/PSOpenAPITools/Model/Query.ps1 new file mode 100644 index 00000000000..def037062dc --- /dev/null +++ b/samples/client/echo_api/powershell/src/PSOpenAPITools/Model/Query.ps1 @@ -0,0 +1,112 @@ +# +# Echo Server API +# Echo Server API +# Version: 0.1.0 +# Contact: team@openapitools.org +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER Id +Query +.PARAMETER Outcomes +No description available. +.OUTPUTS + +Query +#> + +function Initialize-Query { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Int64]] + ${Id}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] + [ValidateSet("SUCCESS", "FAILURE", "SKIPPED")] + [String[]] + ${Outcomes} + ) + + Process { + 'Creating PSCustomObject: PSOpenAPITools => Query' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + + $PSO = [PSCustomObject]@{ + "id" = ${Id} + "outcomes" = ${Outcomes} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to Query + +.DESCRIPTION + +Convert from JSON to Query + +.PARAMETER Json + +Json object + +.OUTPUTS + +Query +#> +function ConvertFrom-JsonToQuery { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSOpenAPITools => Query' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in Query + $AllProperties = ("id", "outcomes") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "id"))) { #optional property not found + $Id = $null + } else { + $Id = $JsonParameters.PSobject.Properties["id"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "outcomes"))) { #optional property not found + $Outcomes = $null + } else { + $Outcomes = $JsonParameters.PSobject.Properties["outcomes"].value + } + + $PSO = [PSCustomObject]@{ + "id" = ${Id} + "outcomes" = ${Outcomes} + } + + return $PSO + } + +} + diff --git a/samples/client/echo_api/powershell/src/PSOpenAPITools/Model/StringEnumRef.ps1 b/samples/client/echo_api/powershell/src/PSOpenAPITools/Model/StringEnumRef.ps1 new file mode 100644 index 00000000000..3ea65a59c5a --- /dev/null +++ b/samples/client/echo_api/powershell/src/PSOpenAPITools/Model/StringEnumRef.ps1 @@ -0,0 +1,27 @@ +# +# Echo Server API +# Echo Server API +# Version: 0.1.0 +# Contact: team@openapitools.org +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +Enum StringEnumRef. + +.DESCRIPTION + +No description available. +#> + +enum StringEnumRef { + # enum value: "success" + success + # enum value: "failure" + failure + # enum value: "unclassified" + unclassified +} + diff --git a/samples/client/echo_api/powershell/src/PSOpenAPITools/Model/Tag.ps1 b/samples/client/echo_api/powershell/src/PSOpenAPITools/Model/Tag.ps1 new file mode 100644 index 00000000000..ab572c56d99 --- /dev/null +++ b/samples/client/echo_api/powershell/src/PSOpenAPITools/Model/Tag.ps1 @@ -0,0 +1,111 @@ +# +# Echo Server API +# Echo Server API +# Version: 0.1.0 +# Contact: team@openapitools.org +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER Id +No description available. +.PARAMETER Name +No description available. +.OUTPUTS + +Tag +#> + +function Initialize-Tag { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Int64]] + ${Id}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] + [String] + ${Name} + ) + + Process { + 'Creating PSCustomObject: PSOpenAPITools => Tag' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + + $PSO = [PSCustomObject]@{ + "id" = ${Id} + "name" = ${Name} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to Tag + +.DESCRIPTION + +Convert from JSON to Tag + +.PARAMETER Json + +Json object + +.OUTPUTS + +Tag +#> +function ConvertFrom-JsonToTag { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSOpenAPITools => Tag' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in Tag + $AllProperties = ("id", "name") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "id"))) { #optional property not found + $Id = $null + } else { + $Id = $JsonParameters.PSobject.Properties["id"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "name"))) { #optional property not found + $Name = $null + } else { + $Name = $JsonParameters.PSobject.Properties["name"].value + } + + $PSO = [PSCustomObject]@{ + "id" = ${Id} + "name" = ${Name} + } + + return $PSO + } + +} + diff --git a/samples/client/echo_api/powershell/src/PSOpenAPITools/Model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.ps1 b/samples/client/echo_api/powershell/src/PSOpenAPITools/Model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.ps1 new file mode 100644 index 00000000000..e38d86a22b8 --- /dev/null +++ b/samples/client/echo_api/powershell/src/PSOpenAPITools/Model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.ps1 @@ -0,0 +1,137 @@ +# +# Echo Server API +# Echo Server API +# Version: 0.1.0 +# Contact: team@openapitools.org +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER Size +No description available. +.PARAMETER Color +No description available. +.PARAMETER Id +No description available. +.PARAMETER Name +No description available. +.OUTPUTS + +TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter +#> + +function Initialize-TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${Size}, + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] + [String] + ${Color}, + [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Int64]] + ${Id}, + [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true)] + [String] + ${Name} + ) + + Process { + 'Creating PSCustomObject: PSOpenAPITools => TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + + $PSO = [PSCustomObject]@{ + "size" = ${Size} + "color" = ${Color} + "id" = ${Id} + "name" = ${Name} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter + +.DESCRIPTION + +Convert from JSON to TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter + +.PARAMETER Json + +Json object + +.OUTPUTS + +TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter +#> +function ConvertFrom-JsonToTestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSOpenAPITools => TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter + $AllProperties = ("size", "color", "id", "name") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "size"))) { #optional property not found + $Size = $null + } else { + $Size = $JsonParameters.PSobject.Properties["size"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "color"))) { #optional property not found + $Color = $null + } else { + $Color = $JsonParameters.PSobject.Properties["color"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "id"))) { #optional property not found + $Id = $null + } else { + $Id = $JsonParameters.PSobject.Properties["id"].value + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "name"))) { #optional property not found + $Name = $null + } else { + $Name = $JsonParameters.PSobject.Properties["name"].value + } + + $PSO = [PSCustomObject]@{ + "size" = ${Size} + "color" = ${Color} + "id" = ${Id} + "name" = ${Name} + } + + return $PSO + } + +} + diff --git a/samples/client/echo_api/powershell/src/PSOpenAPITools/Model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.ps1 b/samples/client/echo_api/powershell/src/PSOpenAPITools/Model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.ps1 new file mode 100644 index 00000000000..61b7084242b --- /dev/null +++ b/samples/client/echo_api/powershell/src/PSOpenAPITools/Model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.ps1 @@ -0,0 +1,98 @@ +# +# Echo Server API +# Echo Server API +# Version: 0.1.0 +# Contact: team@openapitools.org +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER Values +No description available. +.OUTPUTS + +TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter +#> + +function Initialize-TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String[]] + ${Values} + ) + + Process { + 'Creating PSCustomObject: PSOpenAPITools => TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + + $PSO = [PSCustomObject]@{ + "values" = ${Values} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter + +.DESCRIPTION + +Convert from JSON to TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter + +.PARAMETER Json + +Json object + +.OUTPUTS + +TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter +#> +function ConvertFrom-JsonToTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSOpenAPITools => TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter + $AllProperties = ("values") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "values"))) { #optional property not found + $Values = $null + } else { + $Values = $JsonParameters.PSobject.Properties["values"].value + } + + $PSO = [PSCustomObject]@{ + "values" = ${Values} + } + + return $PSO + } + +} + diff --git a/samples/client/echo_api/powershell/src/PSOpenAPITools/PSOpenAPITools.psm1 b/samples/client/echo_api/powershell/src/PSOpenAPITools/PSOpenAPITools.psm1 new file mode 100644 index 00000000000..daf04503ba9 --- /dev/null +++ b/samples/client/echo_api/powershell/src/PSOpenAPITools/PSOpenAPITools.psm1 @@ -0,0 +1,38 @@ +# +# Echo Server API +# Echo Server API +# Version: 0.1.0 +# Contact: team@openapitools.org +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +#region Import functions + +# define the following classes in PowerShell +try { + Add-Type -AssemblyName System.Web -ErrorAction Ignore | Out-Null + Add-Type -AssemblyName System.Net -ErrorAction Ignore | Out-Null +} catch { + Write-Verbose $_ +} + +# set $ErrorActionPreference to 'Stop' globally +$ErrorActionPreference = 'Stop' + +# store the API client's configuration +$Script:Configuration = [System.Collections.HashTable]@{} + +$Script:CmdletBindingParameters = @('Verbose','Debug','ErrorAction','WarningAction','InformationAction','ErrorVariable','WarningVariable','InformationVariable','OutVariable','OutBuffer','PipelineVariable') + +'Api', 'Model', 'Client', 'Private' | Get-ChildItem -Path { + Join-Path $PSScriptRoot $_ +} -Filter '*.ps1' | ForEach-Object { + Write-Debug "Importing file: $($_.BaseName)" + try { + . $_.FullName + } catch { + Write-Error -Message "Failed to import function $($_.Fullname): $_" + } +} + +#endregion diff --git a/samples/client/echo_api/powershell/src/PSOpenAPITools/Private/ApiClient.ps1 b/samples/client/echo_api/powershell/src/PSOpenAPITools/Private/ApiClient.ps1 new file mode 100644 index 00000000000..b25a9e4b0ee --- /dev/null +++ b/samples/client/echo_api/powershell/src/PSOpenAPITools/Private/ApiClient.ps1 @@ -0,0 +1,260 @@ +# +# Echo Server API +# Echo Server API +# Version: 0.1.0 +# Contact: team@openapitools.org +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +function Invoke-ApiClient { + [OutputType('System.Collections.Hashtable')] + [CmdletBinding()] + Param( + [Parameter(Mandatory)] + [string]$Uri, + [Parameter(Mandatory)] + [AllowEmptyCollection()] + [string[]]$Accepts, + [Parameter(Mandatory)] + [AllowEmptyCollection()] + [string[]]$ContentTypes, + [Parameter(Mandatory)] + [hashtable]$HeaderParameters, + [Parameter(Mandatory)] + [hashtable]$FormParameters, + [Parameter(Mandatory)] + [hashtable]$QueryParameters, + [Parameter(Mandatory)] + [hashtable]$CookieParameters, + [Parameter(Mandatory)] + [AllowEmptyString()] + [string]$Body, + [Parameter(Mandatory)] + [string]$Method, + [Parameter(Mandatory)] + [AllowEmptyString()] + [string]$ReturnType, + [Parameter(Mandatory)] + [bool]$IsBodyNullable + ) + + 'Calling method: Invoke-ApiClient' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $Configuration = Get-Configuration + $RequestUri = $Configuration["BaseUrl"] + $Uri + $SkipCertificateCheck = $Configuration["SkipCertificateCheck"] + + # cookie parameters + foreach ($Parameter in $CookieParameters.GetEnumerator()) { + if ($Parameter.Name -eq "cookieAuth") { + $HeaderParameters["Cookie"] = $Parameter.Value + } else { + $HeaderParameters[$Parameter.Name] = $Parameter.Value + } + } + if ($CookieParameters -and $CookieParameters.Count -gt 1) { + Write-Warning "Multiple cookie parameters found. Currently only the first one is supported/used" + } + + # accept, content-type headers + $Accept = SelectHeaders -Headers $Accepts + if ($Accept) { + $HeaderParameters['Accept'] = $Accept + } + + [string]$MultiPartBoundary = $null + $ContentType= SelectHeaders -Headers $ContentTypes + if ($ContentType) { + $HeaderParameters['Content-Type'] = $ContentType + if ($ContentType -eq 'multipart/form-data') { + [string]$MultiPartBoundary = [System.Guid]::NewGuid() + $MultiPartBoundary = "---------------------------$MultiPartBoundary" + $HeaderParameters['Content-Type'] = "$ContentType; boundary=$MultiPartBoundary" + } + } + + # add default headers if any + foreach ($header in $Configuration["DefaultHeaders"].GetEnumerator()) { + $HeaderParameters[$header.Name] = $header.Value + } + + # construct URL query string + $HttpValues = [System.Web.HttpUtility]::ParseQueryString([String]::Empty) + foreach ($Parameter in $QueryParameters.GetEnumerator()) { + if ($Parameter.Value.Count -gt 1) { // array + foreach ($Value in $Parameter.Value) { + $HttpValues.Add($Parameter.Key + '[]', $Value) + } + } else { + $HttpValues.Add($Parameter.Key,$Parameter.Value) + } + } + # Build the request and load it with the query string. + $UriBuilder = [System.UriBuilder]($RequestUri) + $UriBuilder.Query = $HttpValues.ToString() + + # include form parameters in the request body + if ($FormParameters -and $FormParameters.Count -gt 0) { + if (![string]::IsNullOrEmpty($MultiPartBoundary)) { + $RequestBody = "" + $LF = "`r`n" + $FormParameters.Keys | ForEach-Object { + $value = $FormParameters[$_] + $isFile = $value.GetType().FullName -eq "System.IO.FileInfo" + + $RequestBody += "--$MultiPartBoundary$LF" + $RequestBody += "Content-Disposition: form-data; name=`"$_`"" + if ($isFile) { + $fileName = $value.Name + $RequestBody += "; filename=`"$fileName`"$LF" + $RequestBody += "Content-Type: application/octet-stream$LF$LF" + $RequestBody += Get-Content -Path $value.FullName + } else { + $RequestBody += "$LF$LF" + $RequestBody += ([string]$value) + } + $RequestBody += "$LF--$MultiPartBoundary" + } + $RequestBody += "--" + } else { + $RequestBody = $FormParameters + } + } + + + + if ($Body -or $IsBodyNullable) { + $RequestBody = $Body + if ([string]::IsNullOrEmpty($RequestBody) -and $IsBodyNullable -eq $true) { + $RequestBody = "null" + } + } + + if ($SkipCertificateCheck -eq $true) { + if ($null -eq $Configuration["Proxy"]) { + # skip certification check, no proxy + $Response = Invoke-WebRequest -Uri $UriBuilder.Uri ` + -Method $Method ` + -Headers $HeaderParameters ` + -Body $RequestBody ` + -ErrorAction Stop ` + -UseBasicParsing ` + -SkipCertificateCheck + } else { + # skip certification check, use proxy + $Response = Invoke-WebRequest -Uri $UriBuilder.Uri ` + -Method $Method ` + -Headers $HeaderParameters ` + -Body $RequestBody ` + -ErrorAction Stop ` + -UseBasicParsing ` + -SkipCertificateCheck ` + -Proxy $Configuration["Proxy"].GetProxy($UriBuilder.Uri) ` + -ProxyUseDefaultCredentials + } + } else { + if ($null -eq $Configuration["Proxy"]) { + # perform certification check, no proxy + $Response = Invoke-WebRequest -Uri $UriBuilder.Uri ` + -Method $Method ` + -Headers $HeaderParameters ` + -Body $RequestBody ` + -ErrorAction Stop ` + -UseBasicParsing + } else { + # perform certification check, use proxy + $Response = Invoke-WebRequest -Uri $UriBuilder.Uri ` + -Method $Method ` + -Headers $HeaderParameters ` + -Body $RequestBody ` + -ErrorAction Stop ` + -UseBasicParsing ` + -Proxy $Configuration["Proxy"].GetProxy($UriBuilder.Uri) ` + -ProxyUseDefaultCredentials + } + } + + return @{ + Response = DeserializeResponse -Response $Response -ReturnType $ReturnType -ContentTypes $Response.Headers["Content-Type"] + StatusCode = $Response.StatusCode + Headers = $Response.Headers + } +} + +# Select JSON MIME if present, otherwise choose the first one if available +function SelectHeaders { + Param( + [Parameter(Mandatory)] + [AllowEmptyCollection()] + [String[]]$Headers + ) + + foreach ($Header in $Headers) { + if (IsJsonMIME -MIME $Header) { + return $Header + } + } + + if (!($Headers) -or $Headers.Count -eq 0) { + return $null + } else { + return $Headers[0] # return the first one + } +} + +function IsJsonMIME { + Param( + [Parameter(Mandatory)] + [string]$MIME + ) + + if ($MIME -match "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$") { + return $true + } else { + return $false + } +} + +function DeserializeResponse { + Param( + [Parameter(Mandatory)] + [AllowEmptyString()] + [string]$ReturnType, + [Parameter(Mandatory)] + [AllowEmptyString()] + [string]$Response, + [Parameter(Mandatory)] + [AllowEmptyCollection()] + [string[]]$ContentTypes + ) + + If ($null -eq $ContentTypes) { + $ContentTypes = [string[]]@() + } + + If ([string]::IsNullOrEmpty($ReturnType) -and $ContentTypes.Count -eq 0) { # void response + return $Response + } Elseif ($ReturnType -match '\[\]$') { # array + return ConvertFrom-Json $Response + } Elseif (@("String", "Boolean", "System.DateTime") -contains $ReturnType) { # string, boolean ,datetime + return $Response + } Else { # others (e.g. model, file) + if ($ContentTypes) { + $ContentType = $null + if ($ContentTypes.Count -gt 1) { + $ContentType = SelectHeaders -Headers $ContentTypes + } else { + $ContentType = $ContentTypes[0] + } + + if (IsJsonMIME -MIME $ContentType) { # JSON + return ConvertFrom-Json $Response + } else { # XML, file, etc + return $Response + } + } else { # no content type in response header, returning raw response + return $Response + } + } +} diff --git a/samples/client/echo_api/powershell/src/PSOpenAPITools/Private/Get-CommonParameters.ps1 b/samples/client/echo_api/powershell/src/PSOpenAPITools/Private/Get-CommonParameters.ps1 new file mode 100644 index 00000000000..4fb1d8172ec --- /dev/null +++ b/samples/client/echo_api/powershell/src/PSOpenAPITools/Private/Get-CommonParameters.ps1 @@ -0,0 +1,22 @@ +# +# Echo Server API +# Echo Server API +# Version: 0.1.0 +# Contact: team@openapitools.org +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.Synopsis + Helper function to get common parameters (Verbose, Debug, etc.) +.Example + Get-CommonParameters +#> +function Get-CommonParameters { + function tmp { + [CmdletBinding()] + Param () + } + + (Get-Command -Name tmp -CommandType Function).Parameters.Keys +} diff --git a/samples/client/echo_api/powershell/src/PSOpenAPITools/Private/HttpSignatureAuth.ps1 b/samples/client/echo_api/powershell/src/PSOpenAPITools/Private/HttpSignatureAuth.ps1 new file mode 100644 index 00000000000..c0d7175768c --- /dev/null +++ b/samples/client/echo_api/powershell/src/PSOpenAPITools/Private/HttpSignatureAuth.ps1 @@ -0,0 +1,437 @@ +# +# Echo Server API +# Echo Server API +# Version: 0.1.0 +# Contact: team@openapitools.org +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + Gets the headers for HTTP signature. +.DESCRIPTION + Gets the headers for the http signature. +.PARAMETER Method + HTTP method +.PARAMETER UriBuilder + UriBuilder for url and query parameter +.PARAMETER Body + Request body +.OUTPUTS + Hashtable +#> +function Get-HttpSignedHeader { + param( + [string]$Method, + [System.UriBuilder]$UriBuilder, + [string]$Body, + [hashtable]$RequestHeader + ) + + $HEADER_REQUEST_TARGET = '(request-target)' + # The time when the HTTP signature was generated. + $HEADER_CREATED = '(created)' + # The time when the HTTP signature expires. The API server should reject HTTP requests + # that have expired. + $HEADER_EXPIRES = '(expires)' + # The 'Host' header. + $HEADER_HOST = 'Host' + # The 'Date' header. + $HEADER_DATE = 'Date' + # When the 'Digest' header is included in the HTTP signature, the client automatically + # computes the digest of the HTTP request body, per RFC 3230. + $HEADER_DIGEST = 'Digest' + # The 'Authorization' header is automatically generated by the client. It includes + # the list of signed headers and a base64-encoded signature. + $HEADER_AUTHORIZATION = 'Authorization' + + #Hash table to store singed headers + $HttpSignedRequestHeader = @{ } + $HttpSignatureHeader = @{ } + $TargetHost = $UriBuilder.Host + $httpSigningConfiguration = Get-ConfigurationHttpSigning + $Digest = $null + + #get the body digest + $bodyHash = Get-StringHash -String $Body -HashName $httpSigningConfiguration.HashAlgorithm + if ($httpSigningConfiguration.HashAlgorithm -eq "SHA256") { + $Digest = [String]::Format("SHA-256={0}", [Convert]::ToBase64String($bodyHash)) + } elseif ($httpSigningConfiguration.HashAlgorithm -eq "SHA512") { + $Digest = [String]::Format("SHA-512={0}", [Convert]::ToBase64String($bodyHash)) + } + + $dateTime = Get-Date + #get the date in UTC + $currentDate = $dateTime.ToUniversalTime().ToString("r") + + foreach ($headerItem in $httpSigningConfiguration.HttpSigningHeader) { + + if ($headerItem -eq $HEADER_REQUEST_TARGET) { + $requestTargetPath = [string]::Format("{0} {1}{2}", $Method.ToLower(), $UriBuilder.Path, $UriBuilder.Query) + $HttpSignatureHeader.Add($HEADER_REQUEST_TARGET, $requestTargetPath) + } elseif ($headerItem -eq $HEADER_CREATED) { + $created = Get-UnixTime -Date $dateTime -TotalTime TotalSeconds + $HttpSignatureHeader.Add($HEADER_CREATED, $created) + } elseif ($headerItem -eq $HEADER_EXPIRES) { + $expire = $dateTime.AddSeconds($httpSigningConfiguration.SignatureValidityPeriod) + $expireEpocTime = Get-UnixTime -Date $expire -TotalTime TotalSeconds + $HttpSignatureHeader.Add($HEADER_EXPIRES, $expireEpocTime) + } elseif ($headerItem -eq $HEADER_HOST) { + $HttpSignedRequestHeader[$HEADER_HOST] = $TargetHost + $HttpSignatureHeader.Add($HEADER_HOST.ToLower(), $TargetHost) + } elseif ($headerItem -eq $HEADER_DATE) { + $HttpSignedRequestHeader[$HEADER_DATE] = $currentDate + $HttpSignatureHeader.Add($HEADER_DATE.ToLower(), $currentDate) + } elseif ($headerItem -eq $HEADER_DIGEST) { + $HttpSignedRequestHeader[$HEADER_DIGEST] = $Digest + $HttpSignatureHeader.Add($HEADER_DIGEST.ToLower(), $Digest) + } elseif($RequestHeader.ContainsKey($headerItem)) { + $HttpSignatureHeader.Add($headerItem.ToLower(), $RequestHeader[$headerItem]) + } else { + throw "Cannot sign HTTP request. Request does not contain the $headerItem header." + } + } + + # header's name separated by space + $headersKeysString = $HttpSignatureHeader.Keys -join " " + $headerValuesList = @() + foreach ($item in $HttpSignatureHeader.GetEnumerator()) { + $headerValuesList += [string]::Format("{0}: {1}", $item.Name, $item.Value) + } + #Concatenate headers value separated by new line + $headerValuesString = $headerValuesList -join "`n" + + #Gets the hash of the headers value + $signatureHashString = Get-StringHash -String $headerValuesString -HashName $httpSigningConfiguration.HashAlgorithm + + #Gets the Key type to select the correct signing algorithm + $KeyType = Get-KeyTypeFromFile -KeyFilePath $httpSigningConfiguration.KeyFilePath + + if ($keyType -eq "RSA") { + $headerSignatureStr = Get-RSASignature -PrivateKeyFilePath $httpSigningConfiguration.KeyFilePath ` + -DataToSign $signatureHashString ` + -HashAlgorithmName $httpSigningConfiguration.HashAlgorithm ` + -KeyPassPhrase $httpSigningConfiguration.KeyPassPhrase ` + -SigningAlgorithm $httpSigningConfiguration.SigningAlgorithm + } elseif ($KeyType -eq "EC") { + $headerSignatureStr = Get-ECDSASignature -ECKeyFilePath $httpSigningConfiguration.KeyFilePath ` + -DataToSign $signatureHashString ` + -HashAlgorithmName $httpSigningConfiguration.HashAlgorithm ` + -KeyPassPhrase $httpSigningConfiguration.KeyPassPhrase + } + #Deprecated + <#$cryptographicScheme = Get-CryptographicScheme -SigningAlgorithm $httpSigningConfiguration.SigningAlgorithm ` + -HashAlgorithm $httpSigningConfiguration.HashAlgorithm + #> + $cryptographicScheme = "hs2019" + $authorizationHeaderValue = [string]::Format("Signature keyId=""{0}"",algorithm=""{1}""", + $httpSigningConfiguration.KeyId, $cryptographicScheme) + + if ($HttpSignatureHeader.ContainsKey($HEADER_CREATED)) { + $authorizationHeaderValue += [string]::Format(",created={0}", $HttpSignatureHeader[$HEADER_CREATED]) + } + + if ($HttpSignatureHeader.ContainsKey($HEADER_EXPIRES)) { + $authorizationHeaderValue += [string]::Format(",expires={0}", $HttpSignatureHeader[$HEADER_EXPIRES]) + } + + $authorizationHeaderValue += [string]::Format(",headers=""{0}"",signature=""{1}""", + $headersKeysString , $headerSignatureStr) + + $HttpSignedRequestHeader[$HEADER_AUTHORIZATION] = $authorizationHeaderValue + return $HttpSignedRequestHeader +} + +<# +.SYNOPSIS + Gets the RSA signature + +.DESCRIPTION + Gets the RSA signature for the http signing +.PARAMETER PrivateKeyFilePath + Specify the API key file path +.PARAMETER DataToSign + Specify the data to sign +.PARAMETER HashAlgorithmName + HashAlgorithm to calculate the hash +.PARAMETER KeyPassPhrase + KeyPassPhrase for the encrypted key +.OUTPUTS + Base64String +#> +function Get-RSASignature { + Param( + [string]$PrivateKeyFilePath, + [byte[]]$DataToSign, + [string]$HashAlgorithmName, + [string]$SigningAlgorithm, + [securestring]$KeyPassPhrase + ) + try { + + if ($hashAlgorithmName -eq "sha256") { + $hashAlgo = [System.Security.Cryptography.HashAlgorithmName]::SHA256 + } elseif ($hashAlgorithmName -eq "sha512") { + $hashAlgo = [System.Security.Cryptography.HashAlgorithmName]::SHA512 + } + + if ($PSVersionTable.PSVersion.Major -ge 7) { + $ecKeyHeader = "-----BEGIN RSA PRIVATE KEY-----" + $ecKeyFooter = "-----END RSA PRIVATE KEY-----" + $keyStr = Get-Content -Path $PrivateKeyFilePath -Raw + $ecKeyBase64String = $keyStr.Replace($ecKeyHeader, "").Replace($ecKeyFooter, "").Trim() + $keyBytes = [System.Convert]::FromBase64String($ecKeyBase64String) + $rsa = [System.Security.Cryptography.RSA]::Create() + [int]$bytCount = 0 + $rsa.ImportRSAPrivateKey($keyBytes, [ref] $bytCount) + + if ($SigningAlgorithm -eq "RSASSA-PSS") { + $signedBytes = $rsa.SignHash($DataToSign, $hashAlgo, [System.Security.Cryptography.RSASignaturePadding]::Pss) + } else { + $signedBytes = $rsa.SignHash($DataToSign, $hashAlgo, [System.Security.Cryptography.RSASignaturePadding]::Pkcs1) + } + } else { + $rsa_provider_path = Join-Path -Path $PSScriptRoot -ChildPath "RSAEncryptionProvider.cs" + $rsa_provider_sourceCode = Get-Content -Path $rsa_provider_path -Raw + Add-Type -TypeDefinition $rsa_provider_sourceCode + + [System.Security.Cryptography.RSA]$rsa = [RSAEncryption.RSAEncryptionProvider]::GetRSAProviderFromPemFile($PrivateKeyFilePath, $KeyPassPhrase) + + if ($SigningAlgorithm -eq "RSASSA-PSS") { + throw "$SigningAlgorithm is not supported on $($PSVersionTable.PSVersion)" + } else { + $signedBytes = $rsa.SignHash($DataToSign, $hashAlgo, [System.Security.Cryptography.RSASignaturePadding]::Pkcs1) + } + } + + $signedString = [Convert]::ToBase64String($signedBytes) + return $signedString + } catch { + throw $_ + } +} + +<# +.SYNOPSIS + Gets the ECDSA signature + +.DESCRIPTION + Gets the ECDSA signature for the http signing +.PARAMETER PrivateKeyFilePath + Specify the API key file path +.PARAMETER DataToSign + Specify the data to sign +.PARAMETER HashAlgorithmName + HashAlgorithm to calculate the hash +.PARAMETER KeyPassPhrase + KeyPassPhrase for the encrypted key +.OUTPUTS + Base64String +#> +function Get-ECDSASignature { + param( + [Parameter(Mandatory = $true)] + [string]$ECKeyFilePath, + [Parameter(Mandatory = $true)] + [byte[]]$DataToSign, + [Parameter(Mandatory = $false)] + [String]$HashAlgorithmName, + [Parameter(Mandatory = $false)] + [securestring]$KeyPassPhrase + ) + if (!(Test-Path -Path $ECKeyFilePath)) { + throw "key file path does not exist." + } + + if ($PSVersionTable.PSVersion.Major -lt 7) { + throw "ECDSA key is not supported on PowerShell version $($PSVersionTable.PSVersion), Use PowerShell v7.0 and above" + } + + $ecKeyHeader = "-----BEGIN EC PRIVATE KEY-----" + $ecKeyFooter = "-----END EC PRIVATE KEY-----" + $keyStr = Get-Content -Path $ECKeyFilePath -Raw + $ecKeyBase64String = $keyStr.Replace($ecKeyHeader, "").Replace($ecKeyFooter, "").Trim() + $keyBytes = [System.Convert]::FromBase64String($ecKeyBase64String) + $ecdsa = [System.Security.Cryptography.ECDsa]::Create() + + [int]$bytCount =0 + if (![string]::IsNullOrEmpty($KeyPassPhrase)) { + $ecdsa.ImportEncryptedPkcs8PrivateKey($KeyPassPhrase,$keyBytes,[ref]$bytCount) + } else { + $ecdsa.ImportPkcs8PrivateKey($keyBytes,[ref]$bytCount) + } + + $signedBytes = $ecdsa.SignHash($DataToSign) + $derBytes = ConvertTo-ECDSAANS1Format -RawBytes $signedBytes + $signedString = [System.Convert]::ToBase64String($derBytes) + return $signedString +} + +<# +.Synopsis + Gets the hash of string. +.Description + Gets the hash of string +.Parameter String + Specifies the string to calculate the hash +.Parameter HashName + Specifies the hash name to calculate the hash, Accepted values are "SHA1", "SHA256" and "SHA512" + It is recommended not to use "SHA1" to calculate the Hash +.Outputs + String +#> +Function Get-StringHash { + param( + [Parameter(Mandatory = $true)] + [AllowEmptyString()] + [string]$String, + [Parameter(Mandatory = $true)] + [ValidateSet("SHA1", "SHA256", "SHA512")] + $HashName + ) + $hashAlgorithm = [System.Security.Cryptography.HashAlgorithm]::Create($HashName) + $hashAlgorithm.ComputeHash([System.Text.Encoding]::UTF8.GetBytes($String)) +} + +<# +.Synopsis + Gets the Unix time. +.Description + Gets the Unix time +.Parameter Date + Specifies the date to calculate the unix time +.Parameter ToTalTime + Specifies the total time , Accepted values are "TotalDays", "TotalHours", "TotalMinutes", "TotalSeconds" and "TotalMilliseconds" +.Outputs +Integer +#> +function Get-UnixTime { + param( + [Parameter(Mandatory = $true)] + [DateTime]$Date, + [Parameter(Mandatory = $false)] + [ValidateSet("TotalDays", "TotalHours", "TotalMinutes", "TotalSeconds", "TotalMilliseconds")] + [string]$TotalTime = "TotalSeconds" + ) + $date1 = Get-Date -Date "01/01/1970" + $timespan = New-TimeSpan -Start $date1 -End $Date + switch ($TotalTime) { + "TotalDays" { [int]$timespan.TotalDays } + "TotalHours" { [int]$timespan.TotalHours } + "TotalMinutes" { [int]$timespan.TotalMinutes } + "TotalSeconds" { [int]$timespan.TotalSeconds } + "TotalMilliseconds" { [int]$timespan.TotalMilliseconds } + } +} + +function Get-CryptographicScheme { + param( + [Parameter(Mandatory = $true)] + [string]$SigningAlgorithm, + [Parameter(Mandatory = $true)] + [string]$HashAlgorithm + ) + $rsaSignatureType = @("RSASSA-PKCS1-v1_5", "RSASSA-PSS") + $SigningAlgorithm = $null + if ($rsaSignatureType -contains $SigningAlgorithm) { + switch ($HashAlgorithm) { + "sha256" { $SigningAlgorithm = "rsa-sha256" } + "sha512" { $SigningAlgorithm = "rsa-sha512" } + } + } + return $SigningAlgorithm +} + +<# +.Synopsis + Gets the key type from the pem file. +.Description + Gets the key type from the pem file. +.Parameter KeyFilePath + Specifies the key file path (pem file) +.Outputs +String +#> +function Get-KeyTypeFromFile { + param( + [Parameter(Mandatory = $true)] + [string]$KeyFilePath + ) + + if (-not(Test-Path -Path $KeyFilePath)) { + throw "Key file path does not exist." + } + $ecPrivateKeyHeader = "BEGIN EC PRIVATE KEY" + $ecPrivateKeyFooter = "END EC PRIVATE KEY" + $rsaPrivateKeyHeader = "BEGIN RSA PRIVATE KEY" + $rsaPrivateFooter = "END RSA PRIVATE KEY" + $pkcs8Header = "BEGIN PRIVATE KEY" + $pkcs8Footer = "END PRIVATE KEY" + $keyType = $null + $key = Get-Content -Path $KeyFilePath + + if ($key[0] -match $rsaPrivateKeyHeader -and $key[$key.Length - 1] -match $rsaPrivateFooter) { + $KeyType = "RSA" + } elseif ($key[0] -match $ecPrivateKeyHeader -and $key[$key.Length - 1] -match $ecPrivateKeyFooter) { + $keyType = "EC" + } elseif ($key[0] -match $ecPrivateKeyHeader -and $key[$key.Length - 1] -match $ecPrivateKeyFooter) { + <#this type of key can hold many type different types of private key, but here due lack of pem header + Considering this as EC key + #> + #TODO :- update the key based on oid + $keyType = "EC" + } else { + throw "Either the key is invalid or key is not supported" + } + return $keyType +} + + +<# +.Synopsis + Converts sequence of R and S bytes to ANS1 format for ECDSASignature. +.Description + Converts sequence of R and S bytes to ANS1 format for ECDSASignature. +.Parameter RawBytes[] + Specifies the R and S bytes of ECDSA signature. +.Outputs + Byte[] +#> +function ConvertTo-ECDSAANS1Format{ + Param( + [Parameter(Mandatory = $true)] + [byte[]]$RawBytes + ) + + $derLength = 68 #default length for ECDSA code signing bit 0x44 + $rbytesLength = 32 #R length 0x20 + $sbytesLength = 32 #S length 0x20 + [byte[]]$rBytes = $signedBytes[0..31] + [byte[]]$sBytes = $signedBytes[32..63] + + if($rBytes[0] -gt 0x7F){ + $derLength++ + $rbytesLength++ + $rBytes = [byte[]]@(0x00) + $rBytes + } + + if($sBytes[0] -gt 0x7F){ + $derLength++ + $sbytesLength++ + $sBytes = [byte[]]@(0x00) + $sBytes + } + + [byte[]]$derBytes = @() + + $derBytes += 48 # start of the sequence 0x30 + $derBytes += $derLength # total length r length, type and r bytes + + $derBytes += 2 # tag for integer + $derBytes += $rbytesLength # length of r + $derBytes += $rBytes + + $derBytes += 2 #tag for integer + $derBytes += $sbytesLength #length of s + $derBytes += $sBytes + return $derBytes +} \ No newline at end of file diff --git a/samples/client/echo_api/powershell/src/PSOpenAPITools/Private/Out-DebugParameter.ps1 b/samples/client/echo_api/powershell/src/PSOpenAPITools/Private/Out-DebugParameter.ps1 new file mode 100644 index 00000000000..68c37a04cee --- /dev/null +++ b/samples/client/echo_api/powershell/src/PSOpenAPITools/Private/Out-DebugParameter.ps1 @@ -0,0 +1,45 @@ +# +# Echo Server API +# Echo Server API +# Version: 0.1.0 +# Contact: team@openapitools.org +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.Synopsis + Helper function to format debug parameter output. +.Example + $PSBoundParameters | Out-DebugParameter | Write-Debug +#> +function Out-DebugParameter { + [CmdletBinding()] + Param ( + [Parameter(ValueFromPipeline = $true, Mandatory = $true)] + [AllowEmptyCollection()] + $InputObject + ) + + Begin { + $CommonParameters = Get-CommonParameters + } + + Process { + $InputObject.GetEnumerator() | Where-Object { + $CommonParameters -notcontains $_.Key + } | Format-Table -AutoSize -Property ( + @{ + Name = 'Parameter' + Expression = {$_.Key} + }, + @{ + Name = 'Value' + Expression = {$_.Value} + } + ) | Out-String -Stream | ForEach-Object { + if ($_.Trim()) { + $_ + } + } + } +} diff --git a/samples/client/echo_api/powershell/src/PSOpenAPITools/Private/RSAEncryptionProvider.cs b/samples/client/echo_api/powershell/src/PSOpenAPITools/Private/RSAEncryptionProvider.cs new file mode 100644 index 00000000000..e4783e6b17d --- /dev/null +++ b/samples/client/echo_api/powershell/src/PSOpenAPITools/Private/RSAEncryptionProvider.cs @@ -0,0 +1,354 @@ +/* + * Echo Server API + * + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * Generated by: https://github.com/openapitools/openapi-generator.git + */ +using System; +using System.Collections.Generic; +using System.IO; +using System.Net; +using System.Runtime.InteropServices; +using System.Security; +using System.Security.Cryptography; +using System.Text; + +namespace RSAEncryption +{ + /// + /// A RSA enccryption provider. + /// + public class RSAEncryptionProvider + { + /// + /// Get the RSA provider from the PEM file. + /// + /// PEM file. + /// Key pass phrase. + /// Get an instance of RSACryptoServiceProvider. + public static RSACryptoServiceProvider GetRSAProviderFromPemFile(String pemfile,SecureString keyPassPhrase = null) + { + const String pempubheader = "-----BEGIN PUBLIC KEY-----"; + const String pempubfooter = "-----END PUBLIC KEY-----"; + bool isPrivateKeyFile = true; + byte[] pemkey = null; + + if (!File.Exists(pemfile)) + { + throw new Exception("private key file does not exist."); + } + string pemstr = File.ReadAllText(pemfile).Trim(); + + if (pemstr.StartsWith(pempubheader) && pemstr.EndsWith(pempubfooter)) + { + isPrivateKeyFile = false; + } + + if (isPrivateKeyFile) + { + pemkey = ConvertPrivateKeyToBytes(pemstr,keyPassPhrase); + if (pemkey == null) + { + return null; + } + return DecodeRSAPrivateKey(pemkey); + } + return null ; + } + + /// + /// Convert the private key to bytes. + /// + /// Private key. + /// Key pass phrase. + /// The private key in the form of bytes. + static byte[] ConvertPrivateKeyToBytes(String instr, SecureString keyPassPhrase = null) + { + const String pemprivheader = "-----BEGIN RSA PRIVATE KEY-----"; + const String pemprivfooter = "-----END RSA PRIVATE KEY-----"; + String pemstr = instr.Trim(); + byte[] binkey; + + if (!pemstr.StartsWith(pemprivheader) || !pemstr.EndsWith(pemprivfooter)) + { + return null; + } + + StringBuilder sb = new StringBuilder(pemstr); + sb.Replace(pemprivheader, ""); + sb.Replace(pemprivfooter, ""); + String pvkstr = sb.ToString().Trim(); + + try + { // if there are no PEM encryption info lines, this is an UNencrypted PEM private key + binkey = Convert.FromBase64String(pvkstr); + return binkey; + } + catch (System.FormatException) + { + StringReader str = new StringReader(pvkstr); + + //-------- read PEM encryption info. lines and extract salt ----- + if (!str.ReadLine().StartsWith("Proc-Type: 4,ENCRYPTED")) + { + return null; + } + String saltline = str.ReadLine(); + if (!saltline.StartsWith("DEK-Info: DES-EDE3-CBC,")) + { + return null; + } + String saltstr = saltline.Substring(saltline.IndexOf(",") + 1).Trim(); + byte[] salt = new byte[saltstr.Length / 2]; + for (int i = 0; i < salt.Length; i++) + { + salt[i] = Convert.ToByte(saltstr.Substring(i * 2, 2), 16); + } + if (str.ReadLine() != "") + { + return null; + } + + //------ remaining b64 data is encrypted RSA key ---- + String encryptedstr = str.ReadToEnd(); + + try + { //should have b64 encrypted RSA key now + binkey = Convert.FromBase64String(encryptedstr); + } + catch (System.FormatException) + { //data is not in base64 format + return null; + } + + byte[] deskey = GetEncryptedKey(salt, keyPassPhrase, 1, 2); // count=1 (for OpenSSL implementation); 2 iterations to get at least 24 bytes + if (deskey == null) + { + return null; + } + + //------ Decrypt the encrypted 3des-encrypted RSA private key ------ + byte[] rsakey = DecryptKey(binkey, deskey, salt); //OpenSSL uses salt value in PEM header also as 3DES IV + return rsakey; + } + } + + /// + /// Decode the RSA private key. + /// + /// Private key. + /// An instance of RSACryptoServiceProvider. + public static RSACryptoServiceProvider DecodeRSAPrivateKey(byte[] privkey) + { + byte[] bytesModules, bytesE, bytesD, bytesP, bytesQ, bytesDp, bytesDq, bytesIq; + + // --------- Set up stream to decode the asn.1 encoded RSA private key ------ + MemoryStream mem = new MemoryStream(privkey); + BinaryReader binr = new BinaryReader(mem); //wrap Memory Stream with BinaryReader for easy reading + byte bt = 0; + ushort twobytes = 0; + int elems = 0; + try + { + twobytes = binr.ReadUInt16(); + if (twobytes == 0x8130) //data read as little endian order (actual data order for Sequence is 30 81) + { + binr.ReadByte(); //advance 1 byte + } + else if (twobytes == 0x8230) + { + binr.ReadInt16(); //advance 2 bytes + } + else + { + return null; + } + + twobytes = binr.ReadUInt16(); + if (twobytes != 0x0102) //version number + { + return null; + } + bt = binr.ReadByte(); + if (bt != 0x00) + { + return null; + } + + //------ all private key components are Integer sequences ---- + elems = GetIntegerSize(binr); + bytesModules = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + bytesE = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + bytesD = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + bytesP = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + bytesQ = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + bytesDp = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + bytesDq = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + bytesIq = binr.ReadBytes(elems); + + // ------- create RSACryptoServiceProvider instance and initialize with public key ----- + RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(); + RSAParameters RSAparams = new RSAParameters(); + RSAparams.Modulus = bytesModules; + RSAparams.Exponent = bytesE; + RSAparams.D = bytesD; + RSAparams.P = bytesP; + RSAparams.Q = bytesQ; + RSAparams.DP = bytesDp; + RSAparams.DQ = bytesDq; + RSAparams.InverseQ = bytesIq; + rsa.ImportParameters(RSAparams); + return rsa; + } + catch (Exception) + { + return null; + } + finally + { + binr.Close(); + } + } + + private static int GetIntegerSize(BinaryReader binr) + { + byte bt = 0; + byte lowbyte = 0x00; + byte highbyte = 0x00; + int count = 0; + bt = binr.ReadByte(); + if (bt != 0x02) //expect integer + { + return 0; + } + bt = binr.ReadByte(); + + if (bt == 0x81) + { + count = binr.ReadByte(); // data size in next byte + } + else if (bt == 0x82) + { + highbyte = binr.ReadByte(); // data size in next 2 bytes + lowbyte = binr.ReadByte(); + byte[] modint = { lowbyte, highbyte, 0x00, 0x00 }; + count = BitConverter.ToInt32(modint, 0); + } + else + { + count = bt; // we already have the data size + } + while (binr.ReadByte() == 0x00) + { //remove high order zeros in data + count -= 1; + } + binr.BaseStream.Seek(-1, SeekOrigin.Current); + //last ReadByte wasn't a removed zero, so back up a byte + return count; + } + + /// + /// Get the encrypted key. + /// + /// Random bytes to be added. + /// Password. + /// Count. + /// Miter. + /// Decrypted key. + static byte[] GetEncryptedKey(byte[] salt, SecureString secpswd, int count, int miter) + { + IntPtr unmanagedPswd = IntPtr.Zero; + const int HASHLENGTH = 16; //MD5 bytes + byte[] keymaterial = new byte[HASHLENGTH * miter]; //to store concatenated Mi hashed results + + byte[] psbytes = new byte[secpswd.Length]; + unmanagedPswd = Marshal.SecureStringToGlobalAllocAnsi(secpswd); + Marshal.Copy(unmanagedPswd, psbytes, 0, psbytes.Length); + Marshal.ZeroFreeGlobalAllocAnsi(unmanagedPswd); + + // --- concatenate salt and pswd bytes into fixed data array --- + byte[] data00 = new byte[psbytes.Length + salt.Length]; + Array.Copy(psbytes, data00, psbytes.Length); //copy the pswd bytes + Array.Copy(salt, 0, data00, psbytes.Length, salt.Length); //concatenate the salt bytes + + // ---- do multi-hashing and concatenate results D1, D2 ... into keymaterial bytes ---- + MD5 md5 = new MD5CryptoServiceProvider(); + byte[] result = null; + byte[] hashtarget = new byte[HASHLENGTH + data00.Length]; //fixed length initial hashtarget + + for (int j = 0; j < miter; j++) + { + // ---- Now hash consecutively for count times ------ + if (j == 0) + { + result = data00; //initialize + } + else + { + Array.Copy(result, hashtarget, result.Length); + Array.Copy(data00, 0, hashtarget, result.Length, data00.Length); + result = hashtarget; + } + + for (int i = 0; i < count; i++) + { + result = md5.ComputeHash(result); + } + Array.Copy(result, 0, keymaterial, j * HASHLENGTH, result.Length); //concatenate to keymaterial + } + byte[] deskey = new byte[24]; + Array.Copy(keymaterial, deskey, deskey.Length); + + Array.Clear(psbytes, 0, psbytes.Length); + Array.Clear(data00, 0, data00.Length); + Array.Clear(result, 0, result.Length); + Array.Clear(hashtarget, 0, hashtarget.Length); + Array.Clear(keymaterial, 0, keymaterial.Length); + return deskey; + } + + /// + /// Decrypt the key. + /// + /// Cipher data. + /// Key to decrypt. + /// Initialization vector. + /// Decrypted key. + static byte[] DecryptKey(byte[] cipherData, byte[] desKey, byte[] IV) + { + MemoryStream memst = new MemoryStream(); + TripleDES alg = TripleDES.Create(); + alg.Key = desKey; + alg.IV = IV; + try + { + CryptoStream cs = new CryptoStream(memst, alg.CreateDecryptor(), CryptoStreamMode.Write); + cs.Write(cipherData, 0, cipherData.Length); + cs.Close(); + } + catch (Exception) + { + return null; + } + byte[] decryptedData = memst.ToArray(); + return decryptedData; + } + } +} diff --git a/samples/client/echo_api/powershell/src/PSOpenAPITools/en-US/about_PSOpenAPITools.help.txt b/samples/client/echo_api/powershell/src/PSOpenAPITools/en-US/about_PSOpenAPITools.help.txt new file mode 100644 index 00000000000..91395c72626 --- /dev/null +++ b/samples/client/echo_api/powershell/src/PSOpenAPITools/en-US/about_PSOpenAPITools.help.txt @@ -0,0 +1,19 @@ +PSTOPIC + about_PSOpenAPITools + +SHORT DESCRIPTION + PSOpenAPITools - the PowerShell module for the Echo Server API + +LONG DESCRIPTION + Echo Server API + + This PowerShell module is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + + - API version: 0.1.0 + - SDK version: 0.1.2 + - Build package: org.openapitools.codegen.languages.PowerShellClientCodegen + + Frameworks supported: + + * PowerShell 6.2 or later + * .NET 4.0 or later diff --git a/samples/client/echo_api/powershell/tests/Api/AuthApi.Tests.ps1 b/samples/client/echo_api/powershell/tests/Api/AuthApi.Tests.ps1 new file mode 100644 index 00000000000..fb4b6a144d8 --- /dev/null +++ b/samples/client/echo_api/powershell/tests/Api/AuthApi.Tests.ps1 @@ -0,0 +1,18 @@ +# +# Echo Server API +# Echo Server API +# Version: 0.1.0 +# Contact: team@openapitools.org +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSOpenAPITools' -name 'AuthApi' { + Context 'Test-AuthHttpBasic' { + It 'Test Test-AuthHttpBasic' { + #$TestResult = Test-AuthHttpBasic + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 + } + } + +} diff --git a/samples/client/echo_api/powershell/tests/Api/BodyApi.Tests.ps1 b/samples/client/echo_api/powershell/tests/Api/BodyApi.Tests.ps1 new file mode 100644 index 00000000000..4829c660719 --- /dev/null +++ b/samples/client/echo_api/powershell/tests/Api/BodyApi.Tests.ps1 @@ -0,0 +1,74 @@ +# +# Echo Server API +# Echo Server API +# Version: 0.1.0 +# Contact: team@openapitools.org +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSOpenAPITools' -name 'BodyApi' { + Context 'Test-BinaryGif' { + It 'Test Test-BinaryGif' { + #$TestResult = Test-BinaryGif + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 + } + } + + Context 'Test-BodyApplicationOctetstreamBinary' { + It 'Test Test-BodyApplicationOctetstreamBinary' { + #$TestResult = Test-BodyApplicationOctetstreamBinary -Body "TEST_VALUE" + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 + } + } + + Context 'Test-BodyMultipartFormdataArrayOfBinary' { + It 'Test Test-BodyMultipartFormdataArrayOfBinary' { + #$TestResult = Test-BodyMultipartFormdataArrayOfBinary -Files "TEST_VALUE" + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 + } + } + + Context 'Test-EchoBodyFreeFormObjectResponseString' { + It 'Test Test-EchoBodyFreeFormObjectResponseString' { + #$TestResult = Test-EchoBodyFreeFormObjectResponseString -Body "TEST_VALUE" + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 + } + } + + Context 'Test-EchoBodyPet' { + It 'Test Test-EchoBodyPet' { + #$TestResult = Test-EchoBodyPet -Pet "TEST_VALUE" + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 + } + } + + Context 'Test-EchoBodyPetResponseString' { + It 'Test Test-EchoBodyPetResponseString' { + #$TestResult = Test-EchoBodyPetResponseString -Pet "TEST_VALUE" + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 + } + } + + Context 'Test-EchoBodyTagResponseString' { + It 'Test Test-EchoBodyTagResponseString' { + #$TestResult = Test-EchoBodyTagResponseString -Tag "TEST_VALUE" + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 + } + } + + Context 'Test-EchoBodyAllOfPet' { + It 'Test Test-EchoBodyAllOfPet' { + #$TestResult = Test-EchoBodyAllOfPet -Pet "TEST_VALUE" + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 + } + } + +} diff --git a/samples/client/echo_api/powershell/tests/Api/FormApi.Tests.ps1 b/samples/client/echo_api/powershell/tests/Api/FormApi.Tests.ps1 new file mode 100644 index 00000000000..db830207c63 --- /dev/null +++ b/samples/client/echo_api/powershell/tests/Api/FormApi.Tests.ps1 @@ -0,0 +1,26 @@ +# +# Echo Server API +# Echo Server API +# Version: 0.1.0 +# Contact: team@openapitools.org +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSOpenAPITools' -name 'FormApi' { + Context 'Test-FormIntegerBooleanString' { + It 'Test Test-FormIntegerBooleanString' { + #$TestResult = Test-FormIntegerBooleanString -IntegerForm "TEST_VALUE" -BooleanForm "TEST_VALUE" -StringForm "TEST_VALUE" + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 + } + } + + Context 'Test-FormOneof' { + It 'Test Test-FormOneof' { + #$TestResult = Test-FormOneof -Form1 "TEST_VALUE" -Form2 "TEST_VALUE" -Form3 "TEST_VALUE" -Form4 "TEST_VALUE" -Id "TEST_VALUE" -Name "TEST_VALUE" + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 + } + } + +} diff --git a/samples/client/echo_api/powershell/tests/Api/HeaderApi.Tests.ps1 b/samples/client/echo_api/powershell/tests/Api/HeaderApi.Tests.ps1 new file mode 100644 index 00000000000..abb9ffbc5b0 --- /dev/null +++ b/samples/client/echo_api/powershell/tests/Api/HeaderApi.Tests.ps1 @@ -0,0 +1,18 @@ +# +# Echo Server API +# Echo Server API +# Version: 0.1.0 +# Contact: team@openapitools.org +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSOpenAPITools' -name 'HeaderApi' { + Context 'Test-HeaderIntegerBooleanStringEnums' { + It 'Test Test-HeaderIntegerBooleanStringEnums' { + #$TestResult = Test-HeaderIntegerBooleanStringEnums -IntegerHeader "TEST_VALUE" -BooleanHeader "TEST_VALUE" -StringHeader "TEST_VALUE" -EnumNonrefStringHeader "TEST_VALUE" -EnumRefStringHeader "TEST_VALUE" + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 + } + } + +} diff --git a/samples/client/echo_api/powershell/tests/Api/PathApi.Tests.ps1 b/samples/client/echo_api/powershell/tests/Api/PathApi.Tests.ps1 new file mode 100644 index 00000000000..33ea3411b71 --- /dev/null +++ b/samples/client/echo_api/powershell/tests/Api/PathApi.Tests.ps1 @@ -0,0 +1,18 @@ +# +# Echo Server API +# Echo Server API +# Version: 0.1.0 +# Contact: team@openapitools.org +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSOpenAPITools' -name 'PathApi' { + Context 'Test-sPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath' { + It 'Test Test-sPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath' { + #$TestResult = Test-sPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath -PathString "TEST_VALUE" -PathInteger "TEST_VALUE" -EnumNonrefStringPath "TEST_VALUE" -EnumRefStringPath "TEST_VALUE" + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 + } + } + +} diff --git a/samples/client/echo_api/powershell/tests/Api/QueryApi.Tests.ps1 b/samples/client/echo_api/powershell/tests/Api/QueryApi.Tests.ps1 new file mode 100644 index 00000000000..ebbdd643d0b --- /dev/null +++ b/samples/client/echo_api/powershell/tests/Api/QueryApi.Tests.ps1 @@ -0,0 +1,74 @@ +# +# Echo Server API +# Echo Server API +# Version: 0.1.0 +# Contact: team@openapitools.org +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSOpenAPITools' -name 'QueryApi' { + Context 'Test-EnumRefString' { + It 'Test Test-EnumRefString' { + #$TestResult = Test-EnumRefString -EnumNonrefStringQuery "TEST_VALUE" -EnumRefStringQuery "TEST_VALUE" + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 + } + } + + Context 'Test-QueryDatetimeDateString' { + It 'Test Test-QueryDatetimeDateString' { + #$TestResult = Test-QueryDatetimeDateString -DatetimeQuery "TEST_VALUE" -DateQuery "TEST_VALUE" -StringQuery "TEST_VALUE" + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 + } + } + + Context 'Test-QueryIntegerBooleanString' { + It 'Test Test-QueryIntegerBooleanString' { + #$TestResult = Test-QueryIntegerBooleanString -IntegerQuery "TEST_VALUE" -BooleanQuery "TEST_VALUE" -StringQuery "TEST_VALUE" + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 + } + } + + Context 'Test-QueryStyleDeepObjectExplodeTrueObject' { + It 'Test Test-QueryStyleDeepObjectExplodeTrueObject' { + #$TestResult = Test-QueryStyleDeepObjectExplodeTrueObject -QueryObject "TEST_VALUE" + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 + } + } + + Context 'Test-QueryStyleDeepObjectExplodeTrueObjectAllOf' { + It 'Test Test-QueryStyleDeepObjectExplodeTrueObjectAllOf' { + #$TestResult = Test-QueryStyleDeepObjectExplodeTrueObjectAllOf -QueryObject "TEST_VALUE" + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 + } + } + + Context 'Test-QueryStyleFormExplodeTrueArrayString' { + It 'Test Test-QueryStyleFormExplodeTrueArrayString' { + #$TestResult = Test-QueryStyleFormExplodeTrueArrayString -QueryObject "TEST_VALUE" + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 + } + } + + Context 'Test-QueryStyleFormExplodeTrueObject' { + It 'Test Test-QueryStyleFormExplodeTrueObject' { + #$TestResult = Test-QueryStyleFormExplodeTrueObject -QueryObject "TEST_VALUE" + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 + } + } + + Context 'Test-QueryStyleFormExplodeTrueObjectAllOf' { + It 'Test Test-QueryStyleFormExplodeTrueObjectAllOf' { + #$TestResult = Test-QueryStyleFormExplodeTrueObjectAllOf -QueryObject "TEST_VALUE" + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 + } + } + +} diff --git a/samples/client/echo_api/powershell/tests/Model/Bird.Tests.ps1 b/samples/client/echo_api/powershell/tests/Model/Bird.Tests.ps1 new file mode 100644 index 00000000000..d9e7a87e340 --- /dev/null +++ b/samples/client/echo_api/powershell/tests/Model/Bird.Tests.ps1 @@ -0,0 +1,18 @@ +# +# Echo Server API +# Echo Server API +# Version: 0.1.0 +# Contact: team@openapitools.org +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSOpenAPITools' -name 'Bird' { + Context 'Bird' { + It 'Initialize-Bird' { + # a simple test to create an object + #$NewObject = Initialize-Bird -Size "TEST_VALUE" -Color "TEST_VALUE" + #$NewObject | Should -BeOfType Bird + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/echo_api/powershell/tests/Model/Category.Tests.ps1 b/samples/client/echo_api/powershell/tests/Model/Category.Tests.ps1 new file mode 100644 index 00000000000..578a4feaee6 --- /dev/null +++ b/samples/client/echo_api/powershell/tests/Model/Category.Tests.ps1 @@ -0,0 +1,18 @@ +# +# Echo Server API +# Echo Server API +# Version: 0.1.0 +# Contact: team@openapitools.org +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSOpenAPITools' -name 'Category' { + Context 'Category' { + It 'Initialize-Category' { + # a simple test to create an object + #$NewObject = Initialize-Category -Id "TEST_VALUE" -Name "TEST_VALUE" + #$NewObject | Should -BeOfType Category + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/echo_api/powershell/tests/Model/DataQuery.Tests.ps1 b/samples/client/echo_api/powershell/tests/Model/DataQuery.Tests.ps1 new file mode 100644 index 00000000000..909513d04a3 --- /dev/null +++ b/samples/client/echo_api/powershell/tests/Model/DataQuery.Tests.ps1 @@ -0,0 +1,18 @@ +# +# Echo Server API +# Echo Server API +# Version: 0.1.0 +# Contact: team@openapitools.org +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSOpenAPITools' -name 'DataQuery' { + Context 'DataQuery' { + It 'Initialize-DataQuery' { + # a simple test to create an object + #$NewObject = Initialize-DataQuery -Id "TEST_VALUE" -Outcomes "TEST_VALUE" -Suffix "TEST_VALUE" -Text "TEST_VALUE" -Date "TEST_VALUE" + #$NewObject | Should -BeOfType DataQuery + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/echo_api/powershell/tests/Model/DefaultValue.Tests.ps1 b/samples/client/echo_api/powershell/tests/Model/DefaultValue.Tests.ps1 new file mode 100644 index 00000000000..e8c7191f70e --- /dev/null +++ b/samples/client/echo_api/powershell/tests/Model/DefaultValue.Tests.ps1 @@ -0,0 +1,18 @@ +# +# Echo Server API +# Echo Server API +# Version: 0.1.0 +# Contact: team@openapitools.org +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSOpenAPITools' -name 'DefaultValue' { + Context 'DefaultValue' { + It 'Initialize-DefaultValue' { + # a simple test to create an object + #$NewObject = Initialize-DefaultValue -ArrayStringEnumRefDefault "TEST_VALUE" -ArrayStringEnumDefault "TEST_VALUE" -ArrayStringDefault "TEST_VALUE" -ArrayIntegerDefault "TEST_VALUE" -ArrayString "TEST_VALUE" -ArrayStringNullable "TEST_VALUE" -ArrayStringExtensionNullable "TEST_VALUE" -StringNullable "TEST_VALUE" + #$NewObject | Should -BeOfType DefaultValue + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/echo_api/powershell/tests/Model/NumberPropertiesOnly.Tests.ps1 b/samples/client/echo_api/powershell/tests/Model/NumberPropertiesOnly.Tests.ps1 new file mode 100644 index 00000000000..c73cecf3575 --- /dev/null +++ b/samples/client/echo_api/powershell/tests/Model/NumberPropertiesOnly.Tests.ps1 @@ -0,0 +1,18 @@ +# +# Echo Server API +# Echo Server API +# Version: 0.1.0 +# Contact: team@openapitools.org +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSOpenAPITools' -name 'NumberPropertiesOnly' { + Context 'NumberPropertiesOnly' { + It 'Initialize-NumberPropertiesOnly' { + # a simple test to create an object + #$NewObject = Initialize-NumberPropertiesOnly -Number "TEST_VALUE" -Float "TEST_VALUE" -Double "TEST_VALUE" + #$NewObject | Should -BeOfType NumberPropertiesOnly + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/echo_api/powershell/tests/Model/Pet.Tests.ps1 b/samples/client/echo_api/powershell/tests/Model/Pet.Tests.ps1 new file mode 100644 index 00000000000..53a5c902141 --- /dev/null +++ b/samples/client/echo_api/powershell/tests/Model/Pet.Tests.ps1 @@ -0,0 +1,18 @@ +# +# Echo Server API +# Echo Server API +# Version: 0.1.0 +# Contact: team@openapitools.org +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSOpenAPITools' -name 'Pet' { + Context 'Pet' { + It 'Initialize-Pet' { + # a simple test to create an object + #$NewObject = Initialize-Pet -Id "TEST_VALUE" -Name "TEST_VALUE" -Category "TEST_VALUE" -PhotoUrls "TEST_VALUE" -Tags "TEST_VALUE" -Status "TEST_VALUE" + #$NewObject | Should -BeOfType Pet + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/echo_api/powershell/tests/Model/Query.Tests.ps1 b/samples/client/echo_api/powershell/tests/Model/Query.Tests.ps1 new file mode 100644 index 00000000000..9b67d81c768 --- /dev/null +++ b/samples/client/echo_api/powershell/tests/Model/Query.Tests.ps1 @@ -0,0 +1,18 @@ +# +# Echo Server API +# Echo Server API +# Version: 0.1.0 +# Contact: team@openapitools.org +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSOpenAPITools' -name 'Query' { + Context 'Query' { + It 'Initialize-Query' { + # a simple test to create an object + #$NewObject = Initialize-Query -Id "TEST_VALUE" -Outcomes "TEST_VALUE" + #$NewObject | Should -BeOfType Query + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/echo_api/powershell/tests/Model/StringEnumRef.Tests.ps1 b/samples/client/echo_api/powershell/tests/Model/StringEnumRef.Tests.ps1 new file mode 100644 index 00000000000..e13f82b9c5a --- /dev/null +++ b/samples/client/echo_api/powershell/tests/Model/StringEnumRef.Tests.ps1 @@ -0,0 +1,18 @@ +# +# Echo Server API +# Echo Server API +# Version: 0.1.0 +# Contact: team@openapitools.org +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSOpenAPITools' -name 'StringEnumRef' { + Context 'StringEnumRef' { + It 'Initialize-StringEnumRef' { + # a simple test to create an object + #$NewObject = Initialize-StringEnumRef + #$NewObject | Should -BeOfType StringEnumRef + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/echo_api/powershell/tests/Model/Tag.Tests.ps1 b/samples/client/echo_api/powershell/tests/Model/Tag.Tests.ps1 new file mode 100644 index 00000000000..c0100be827a --- /dev/null +++ b/samples/client/echo_api/powershell/tests/Model/Tag.Tests.ps1 @@ -0,0 +1,18 @@ +# +# Echo Server API +# Echo Server API +# Version: 0.1.0 +# Contact: team@openapitools.org +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSOpenAPITools' -name 'Tag' { + Context 'Tag' { + It 'Initialize-Tag' { + # a simple test to create an object + #$NewObject = Initialize-Tag -Id "TEST_VALUE" -Name "TEST_VALUE" + #$NewObject | Should -BeOfType Tag + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/echo_api/powershell/tests/Model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.Tests.ps1 b/samples/client/echo_api/powershell/tests/Model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.Tests.ps1 new file mode 100644 index 00000000000..04997034c0a --- /dev/null +++ b/samples/client/echo_api/powershell/tests/Model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.Tests.ps1 @@ -0,0 +1,18 @@ +# +# Echo Server API +# Echo Server API +# Version: 0.1.0 +# Contact: team@openapitools.org +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSOpenAPITools' -name 'TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter' { + Context 'TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter' { + It 'Initialize-TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter' { + # a simple test to create an object + #$NewObject = Initialize-TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter -Size "TEST_VALUE" -Color "TEST_VALUE" -Id "TEST_VALUE" -Name "TEST_VALUE" + #$NewObject | Should -BeOfType TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/echo_api/powershell/tests/Model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.Tests.ps1 b/samples/client/echo_api/powershell/tests/Model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.Tests.ps1 new file mode 100644 index 00000000000..6bfaed484b8 --- /dev/null +++ b/samples/client/echo_api/powershell/tests/Model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.Tests.ps1 @@ -0,0 +1,18 @@ +# +# Echo Server API +# Echo Server API +# Version: 0.1.0 +# Contact: team@openapitools.org +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSOpenAPITools' -name 'TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter' { + Context 'TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter' { + It 'Initialize-TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter' { + # a simple test to create an object + #$NewObject = Initialize-TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter -Values "TEST_VALUE" + #$NewObject | Should -BeOfType TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/powershell/README.md b/samples/client/petstore/powershell/README.md index 57c663aae01..e02ad9f8eb5 100644 --- a/samples/client/petstore/powershell/README.md +++ b/samples/client/petstore/powershell/README.md @@ -196,7 +196,7 @@ Authentication schemes defined for the API: - **Type**: API key -- **API key parameter name**: api_key +- **API key parameter name**: api_key_name - **Location**: HTTP header @@ -204,7 +204,7 @@ Authentication schemes defined for the API: - **Type**: API key -- **API key parameter name**: api_key_query +- **API key parameter name**: api_key_query_name - **Location**: URL query string diff --git a/samples/client/petstore/powershell/docs/PSFakeClassnameTags123Api.md b/samples/client/petstore/powershell/docs/PSFakeClassnameTags123Api.md index 9da7ec30001..02bfd8628a2 100644 --- a/samples/client/petstore/powershell/docs/PSFakeClassnameTags123Api.md +++ b/samples/client/petstore/powershell/docs/PSFakeClassnameTags123Api.md @@ -21,9 +21,9 @@ To test class name in snake case # general setting of the PowerShell module, e.g. base URL, authentication, etc $Configuration = Get-Configuration # Configure API key authorization: api_key_query -$Configuration.ApiKey.api_key_query = "YOUR_API_KEY" +$Configuration.ApiKey.api_key_query_name = "YOUR_API_KEY" # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -#$Configuration.ApiKeyPrefix.api_key_query = "Bearer" +#$Configuration.ApiKeyPrefix.api_key_query_name = "Bearer" $Client = Initialize-Client -Client "MyClient" # Client | client model diff --git a/samples/client/petstore/powershell/docs/PSPetApi.md b/samples/client/petstore/powershell/docs/PSPetApi.md index 6fc29288adf..48d7f783ce4 100644 --- a/samples/client/petstore/powershell/docs/PSPetApi.md +++ b/samples/client/petstore/powershell/docs/PSPetApi.md @@ -253,9 +253,9 @@ Returns a single pet # general setting of the PowerShell module, e.g. base URL, authentication, etc $Configuration = Get-Configuration # Configure API key authorization: api_key -$Configuration.ApiKey.api_key = "YOUR_API_KEY" +$Configuration.ApiKey.api_key_name = "YOUR_API_KEY" # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -#$Configuration.ApiKeyPrefix.api_key = "Bearer" +#$Configuration.ApiKeyPrefix.api_key_name = "Bearer" $PetId = 789 # Int64 | ID of pet to return diff --git a/samples/client/petstore/powershell/docs/PSStoreApi.md b/samples/client/petstore/powershell/docs/PSStoreApi.md index 3d192a30018..2ff14209a04 100644 --- a/samples/client/petstore/powershell/docs/PSStoreApi.md +++ b/samples/client/petstore/powershell/docs/PSStoreApi.md @@ -66,9 +66,9 @@ Returns a map of status codes to quantities # general setting of the PowerShell module, e.g. base URL, authentication, etc $Configuration = Get-Configuration # Configure API key authorization: api_key -$Configuration.ApiKey.api_key = "YOUR_API_KEY" +$Configuration.ApiKey.api_key_name = "YOUR_API_KEY" # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -#$Configuration.ApiKeyPrefix.api_key = "Bearer" +#$Configuration.ApiKeyPrefix.api_key_name = "Bearer" # Returns pet inventories by status diff --git a/samples/client/petstore/powershell/src/PSPetstore/Api/PSFakeClassnameTags123Api.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Api/PSFakeClassnameTags123Api.ps1 index 35f1186fcce..0ffb6cd7f3b 100644 --- a/samples/client/petstore/powershell/src/PSPetstore/Api/PSFakeClassnameTags123Api.ps1 +++ b/samples/client/petstore/powershell/src/PSPetstore/Api/PSFakeClassnameTags123Api.ps1 @@ -63,9 +63,9 @@ function Test-PSClassname { $LocalVarBodyParameter = $Client | ConvertTo-Json -Depth 100 - if ($Configuration["ApiKey"] -and $Configuration["ApiKey"]["api_key_query"]) { - $LocalVarQueryParameters['api_key_query'] = $Configuration["ApiKey"]["api_key_query"] - Write-Verbose ("Using API key `api_key_query` in the URL query for authentication in {0}" -f $MyInvocation.MyCommand) + if ($Configuration["ApiKey"] -and $Configuration["ApiKey"]["api_key_query_name"]) { + $LocalVarQueryParameters['api_key_query_name'] = $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) } $LocalVarResult = Invoke-PSApiClient -Method 'PATCH' ` diff --git a/samples/client/petstore/powershell/src/PSPetstore/Api/PSPetApi.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Api/PSPetApi.ps1 index 3542112c914..e28ffcabca0 100644 --- a/samples/client/petstore/powershell/src/PSPetstore/Api/PSPetApi.ps1 +++ b/samples/client/petstore/powershell/src/PSPetstore/Api/PSPetApi.ps1 @@ -405,9 +405,9 @@ function Get-PSPetById { } $LocalVarUri = $LocalVarUri.replace('{petId}', [System.Web.HTTPUtility]::UrlEncode($PetId)) - if ($Configuration["ApiKey"] -and $Configuration["ApiKey"]["api_key"]) { - $LocalVarHeaderParameters['api_key'] = $Configuration["ApiKey"]["api_key"] - Write-Verbose ("Using API key 'api_key' in the header for authentication in {0}" -f $MyInvocation.MyCommand) + if ($Configuration["ApiKey"] -and $Configuration["ApiKey"]["api_key_name"]) { + $LocalVarHeaderParameters['api_key_name'] = $Configuration["ApiKey"]["api_key_name"] + Write-Verbose ("Using API key 'api_key_name' in the header for authentication in {0}" -f $MyInvocation.MyCommand) } $LocalVarResult = Invoke-PSApiClient -Method 'GET' ` diff --git a/samples/client/petstore/powershell/src/PSPetstore/Api/PSStoreApi.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Api/PSStoreApi.ps1 index a0f88138a48..40fd1e0c64f 100644 --- a/samples/client/petstore/powershell/src/PSPetstore/Api/PSStoreApi.ps1 +++ b/samples/client/petstore/powershell/src/PSPetstore/Api/PSStoreApi.ps1 @@ -118,9 +118,9 @@ function Get-PSInventory { $LocalVarUri = '/store/inventory' - if ($Configuration["ApiKey"] -and $Configuration["ApiKey"]["api_key"]) { - $LocalVarHeaderParameters['api_key'] = $Configuration["ApiKey"]["api_key"] - Write-Verbose ("Using API key 'api_key' in the header for authentication in {0}" -f $MyInvocation.MyCommand) + if ($Configuration["ApiKey"] -and $Configuration["ApiKey"]["api_key_name"]) { + $LocalVarHeaderParameters['api_key_name'] = $Configuration["ApiKey"]["api_key_name"] + Write-Verbose ("Using API key 'api_key_name' in the header for authentication in {0}" -f $MyInvocation.MyCommand) } $LocalVarResult = Invoke-PSApiClient -Method 'GET' `