Replace powershell generator with powershell-experimental generator (#6213)

* replace powershell generator with powershell-experimental generator

* add back samples

* add back scripts

* remove outdated script

* update doc
This commit is contained in:
William Cheng
2020-05-08 20:13:01 +08:00
committed by GitHub
parent 6e619e0a15
commit f327f01c19
118 changed files with 1423 additions and 2408 deletions

View File

@@ -1 +1 @@
4.2.3-SNAPSHOT
5.0.0-SNAPSHOT

View File

@@ -1,3 +1,10 @@
#
# OpenAPI Petstore
# This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
# Version: 1.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#
function Get-FunctionsToExport {
[CmdletBinding()]
Param (
@@ -38,51 +45,28 @@ function Get-FunctionsToExport {
}
$ScriptDir = Split-Path $script:MyInvocation.MyCommand.Path
$ClientPath = ("$ScriptDir\..\..\petstore\csharp\OpenAPIClient" | Resolve-Path).ProviderPath
$FunctionPath = 'API', 'Model' | ForEach-Object {Join-Path "$ScriptDir\src\Org.OpenAPITools\" $_}
$BinPath = "$ScriptDir\src\Org.OpenAPITools\Bin"
Start-Process -FilePath "$ClientPath\build.bat" -WorkingDirectory $ClientPath -Wait -NoNewWindow
if (!(Test-Path "$ScriptDir\src\Org.OpenAPITools\Bin" -PathType Container)) {
New-Item "$ScriptDir\src\Org.OpenAPITools\Bin" -ItemType Directory > $null
}
Copy-Item "$ClientPath\bin\*.dll" $BinPath
$FunctionPath = 'Api', 'Model', 'Client' | ForEach-Object {Join-Path "$ScriptDir\src\PSPetstore\" $_}
$Manifest = @{
Path = "$ScriptDir\src\Org.OpenAPITools\Org.OpenAPITools.psd1"
Path = "$ScriptDir\src\PSPetstore\PSPetstore.psd1"
Author = 'OpenAPI Generator Team'
CompanyName = 'openapitools.org'
Description = 'Org.OpenAPITools - the PowerShell module for OpenAPI Petstore'
Description = 'PSPetstore - the PowerShell module for OpenAPI Petstore'
RootModule = 'Org.OpenAPITools.psm1'
ModuleVersion = '0.1.2'
RootModule = 'PSPetstore.psm1'
Guid = 'a27b908d-2a20-467f-bc32-af6f3a654ac5' # Has to be static, otherwise each new build will be considered different module
PowerShellVersion = '3.0'
RequiredAssemblies = Get-ChildItem "$BinPath\*.dll" | ForEach-Object {
Join-Path $_.Directory.Name $_.Name
}
FunctionsToExport = $FunctionPath | Get-ChildItem -Filter *.ps1 | Get-FunctionsToExport
VariablesToExport = @()
AliasesToExport = @()
CmdletsToExport = @()
# Should we use prefix to prevent command name collisions?
# https://www.sapien.com/blog/2016/02/15/use-prefixes-to-prevent-command-name-collision/
#
# Kirk Munro recommends against it:
# https://www.sapien.com/blog/2016/02/15/use-prefixes-to-prevent-command-name-collision/#comment-20820
#
# If not, we'd need to generate functions name with prefix. For examples,
#
# DefaultCommandPrefix = 'PetApi'
# DefaultCommandPrefix = 'StoreApi'
# DefaultCommandPrefix = 'UserApi'
}
New-ModuleManifest @Manifest

View File

@@ -1,30 +1,120 @@
# Org.OpenAPITools - the PowerShell module for the OpenAPI Petstore
# PSPetstore - the PowerShell module for the OpenAPI Petstore
This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
This PowerShell module is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
- API version: 1.0.0
- SDK version:
- SDK version: 0.1.2
- Build package: org.openapitools.codegen.languages.PowerShellClientCodegen
<a name="frameworks-supported"></a>
## Frameworks supported
- PowerShell 3.0 or later
- PowerShell 5.0 or later
<a name="dependencies"></a>
## Dependencies
- C# API client generated by OpenAPI Generator AND should be located in $ScriptDir\..\..\petstore\csharp\OpenAPIClient as stated in Build.ps1
<a name="installation"></a>
## Installation
Run the following command to generate the DLL
- [Windows] `Build.ps1`
Then import module from the .\src\Org.OpenAPITools folder:
To install from PowerShell Gallery (https://www.powershellgallery.com/packages/PSPetstore)
```powershell
using Org.OpenAPITools.Org.OpenAPITools/API;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Org.OpenAPITools/Model;
Import-Module -Name PSPetstore -Verbose
```
To install from the source, run the following command to build and install the PowerShell module locally:
```powershell
Build.ps1
Import-Module -Name '.\src\PSPetstore' -Verbose
```
To avoid function name collision, one can use `-Prefix`, e.g. `Import-Module -Name '.\src\PSPetstore' -Prefix prefix`
To uninstall the module, simply run:
```powershell
Remove-Module -FullyQualifiedName @{ModuleName = "PSPetstore"; ModuleVersion = "0.1.2"}
```
<a name="tests"></a>
## Tests
To install and run `Pester`, please execute the following commands in the terminal:
```powershell
Install-module -name Pester -force
Invoker-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://petstore.swagger.io:80/v2*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*PSPetApi* | [**Add-PSPet**](docs/PSPetApi.md#Add-PSPet) | **POST** /pet | Add a new pet to the store
*PSPetApi* | [**Remove-Pet**](docs/PSPetApi.md#remove-pet) | **DELETE** /pet/{petId} | Deletes a pet
*PSPetApi* | [**Find-PSPetsByStatus**](docs/PSPetApi.md#Find-PSPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status
*PSPetApi* | [**Find-PSPetsByTags**](docs/PSPetApi.md#Find-PSPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags
*PSPetApi* | [**Get-PSPetById**](docs/PSPetApi.md#Get-PSPetById) | **GET** /pet/{petId} | Find pet by ID
*PSPetApi* | [**Update-PSPet**](docs/PSPetApi.md#Update-PSPet) | **PUT** /pet | Update an existing pet
*PSPetApi* | [**Update-PSPetWithForm**](docs/PSPetApi.md#Update-PSPetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
*PSPetApi* | [**Invoke-PSUploadFile**](docs/PSPetApi.md#Invoke-PSUploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
*PSStoreApi* | [**Remove-PSOrder**](docs/PSStoreApi.md#Remove-PSOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
*PSStoreApi* | [**Get-PSInventory**](docs/PSStoreApi.md#Get-PSInventory) | **GET** /store/inventory | Returns pet inventories by status
*PSStoreApi* | [**Get-PSOrderById**](docs/PSStoreApi.md#Get-PSOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID
*PSStoreApi* | [**Invoke-PSPlaceOrder**](docs/PSStoreApi.md#Invoke-PSPlaceOrder) | **POST** /store/order | Place an order for a pet
*PSUserApi* | [**New-PSUser**](docs/PSUserApi.md#New-PSUser) | **POST** /user | Create user
*PSUserApi* | [**New-PSUsersWithArrayInput**](docs/PSUserApi.md#New-PSUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array
*PSUserApi* | [**New-PSUsersWithListInput**](docs/PSUserApi.md#New-PSUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array
*PSUserApi* | [**Remove-PSUser**](docs/PSUserApi.md#Remove-PSUser) | **DELETE** /user/{username} | Delete user
*PSUserApi* | [**Get-PSUserByName**](docs/PSUserApi.md#Get-PSUserByName) | **GET** /user/{username} | Get user by user name
*PSUserApi* | [**Invoke-PSLoginUser**](docs/PSUserApi.md#Invoke-PSLoginUser) | **GET** /user/login | Logs user into the system
*PSUserApi* | [**Invoke-PSLogoutUser**](docs/PSUserApi.md#Invoke-PSLogoutUser) | **GET** /user/logout | Logs out current logged in user session
*PSUserApi* | [**Update-PSUser**](docs/PSUserApi.md#Update-PSUser) | **PUT** /user/{username} | Updated user
## Documentation for Models
- [PSPetstore/Model.ApiResponse](docs/ApiResponse.md)
- [PSPetstore/Model.Category](docs/Category.md)
- [PSPetstore/Model.InlineObject](docs/InlineObject.md)
- [PSPetstore/Model.InlineObject1](docs/InlineObject1.md)
- [PSPetstore/Model.Order](docs/Order.md)
- [PSPetstore/Model.Pet](docs/Pet.md)
- [PSPetstore/Model.Tag](docs/Tag.md)
- [PSPetstore/Model.User](docs/User.md)
## Documentation for Authorization
### api_key
- **Type**: API key
- **API key parameter name**: api_key
- **Location**: HTTP header
### auth_cookie
- **Type**: API key
- **API key parameter name**: AUTH_KEY
- **Location**:
### petstore_auth
- **Type**: OAuth
- **Flow**: implicit
- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
- **Scopes**:
- write:pets: modify pets in your account
- read:pets: read your pets

View File

@@ -0,0 +1,77 @@
#Remove-Module -FullyQualifiedName @{ModuleName = "Org.OpenAPITools"; ModuleVersion = "0.0.1"}
#Remove-Module -FullyQualifiedName @{ModuleName = "PSOpenAPITools"; ModuleVersion = "0.0.1"}
Remove-Module -FullyQualifiedName @{ModuleName = "PSPetstore"; ModuleVersion = "0.1.2"}
#Remove-Module -FullyQualifiedName @{ModuleName = "PSPetstore"; ModuleVersion = "0.0"}
Import-Module -Name '.\src\PSPetstore\PSPetstore.psd1' -Verbose
#Import-Module -Name '.\src\PSPetstore\PSPetstore.psd1' -Verbose
#Import-Module -Name '.\src\PSOpenAPITools'
#Import-Module -Name '.\src\Org.OpenAPITools'
#Import-Module -Name './src/Org.OpenAPITools'
#$DebugPreference = 'Continue'
$body = (Initialize-PSUser -Id 123 -Username "Username_example" -FirstName "FirstName_example" -LastName "LastName_example" -Email "Email_example" -Password "Password_example" -Phone "Phone_example" -UserStatus 123)
$Id = 38369
#$result = Update-PSPetWithForm
#try {
$pet = Initialize-PSPet -Id $Id -Name 'foo' -Category (
Initialize-PSCategory -Id $Id -Name 'bar'
) -PhotoUrls @(
'http://example.com/foo',
'http://example.com/bar'
) -Tags (
Initialize-PSTag -Id 3 -Name 'baz'
) -Status Available
#Write-Host $pet
$Result = Add-PSPet -Pet $pet
Set-PSConfigurationApiKey -Id "api_key" -ApiKey "zzZZZZZZZZZZZZZ"
$Result2 = Get-PSPetById -petId ($Id) -Verbose -WithHttpInfo #-testHeader "testing only" -testQuery "testing something here"
Write-Host $Result2["Headers"]["Content-Type"]
$Result3 = Get-PSPetById -petId ($Id) -Verbose -WithHttpInfo -ReturnType "application/xml" #-testHeader "testing only" -testQuery "testing something here"
Write-Host $Result3["Headers"]["Content-Type"]
Write-Host $Result3["Response"]
#} catch {
# Write-Host ("Exception occured when calling '': {0}" -f ($_.ErrorDetails | ConvertFrom-Json))
# Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json))
#}
#$Result = Add-PSPet -Pet $pet -ReturnType "application/xml"
#Write-Host "Before exit $($Result2.GetType())"
#$result | Write-Host
#$result | Select-Object -Property "photoUrls" | ConvertTo-Json | Write-Host
#Write-Host "result =" + $result.photoUrls
#$pet2 = Initialize-PSPet -Id 20129 -Name '2foo' -Category (
# Initialize-PSCategory -Id 20129 -Name '2bar'
#) -PhotoUrls @(
# 'http://example.com/2foo',
# 'http://example.com/2bar'
#) -Tags (
# Initialize-PSTag -Id 3 -Name 'baz'
#) -Status Available
#
##Write-Host $pet
#$Result = Add-PSPet -Pet $pet2
#
#$Result = Find-PSPetsByTags 'baz'
#Write-Host $Result.GetType().Name
#Write-Host $Result
#$Result = Invoke-PetApiUpdatePetWithForm -petId $Id -Name "PowerShell Update" -Status "Pending"
#$file = Get-Item "./plus.gif"
##$Result = Invoke-PetApiUploadFile -petId $Id -additionalMetadata "Additional data" -File $file
#
#Set-PSConfiguration -Username "test_username" -Password "test_password"
#
#$conf = Get-PSConfiguration
#
#$conf | ConvertTo-Json | Write-Host

View File

@@ -0,0 +1,23 @@
#
# OpenAPI Petstore
# This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
# Version: 1.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#
version: 1.0.{build}
image:
- Visual Studio 2017 # PS 5.x
- Ubuntu # PS 6.x
- macOS # PS 6.x
install:
- ps: $PSVersionTable.PSVersion
- ps: Install-Module Pester -Force -Scope CurrentUser
build: off
test_script:
- ps: |
$Result = Invoke-Pester -PassThru
if ($Result.FailedCount -gt 0) {
$host.SetShouldExit($Result.FailedCount)
exit $Result.FailedCount
}

View File

@@ -0,0 +1,25 @@
# ApiResponse
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Code** | **Int32** | | [optional] [default to null]
**Type** | **String** | | [optional] [default to null]
**Message** | **String** | | [optional] [default to null]
## Examples
- Prepare the resource
```powershell
Initialize-PSPetstoreApiResponse -Code null `
-Type null `
-Message null
```
- Convert the resource to JSON
```powershell
$ | Convert-ToJSON
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,23 @@
# Category
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Id** | **Int64** | | [optional] [default to null]
**Name** | **String** | | [optional] [default to null]
## Examples
- Prepare the resource
```powershell
Initialize-PSPetstoreCategory -Id null `
-Name null
```
- Convert the resource to JSON
```powershell
$ | Convert-ToJSON
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,23 @@
# InlineObject
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Name** | **String** | Updated name of the pet | [optional] [default to null]
**Status** | **String** | Updated status of the pet | [optional] [default to null]
## Examples
- Prepare the resource
```powershell
Initialize-PSPetstoreInlineObject -Name null `
-Status null
```
- Convert the resource to JSON
```powershell
$ | Convert-ToJSON
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,23 @@
# InlineObject1
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**AdditionalMetadata** | **String** | Additional data to pass to server | [optional] [default to null]
**File** | **System.IO.FileInfo** | file to upload | [optional] [default to null]
## Examples
- Prepare the resource
```powershell
Initialize-PSPetstoreInlineObject1 -AdditionalMetadata null `
-File null
```
- Convert the resource to JSON
```powershell
$ | Convert-ToJSON
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,31 @@
# Order
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Id** | **Int64** | | [optional] [default to null]
**PetId** | **Int64** | | [optional] [default to null]
**Quantity** | **Int32** | | [optional] [default to null]
**ShipDate** | **System.DateTime** | | [optional] [default to null]
**Status** | **String** | Order Status | [optional] [default to null]
**Complete** | **Boolean** | | [optional] [default to false]
## Examples
- Prepare the resource
```powershell
Initialize-PSPetstoreOrder -Id null `
-PetId null `
-Quantity null `
-ShipDate null `
-Status null `
-Complete null
```
- Convert the resource to JSON
```powershell
$ | Convert-ToJSON
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,415 @@
# PSPetstore.PSPetstore/Api.PSPetApi
All URIs are relative to *http://petstore.swagger.io:80/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**Add-PSPet**](PSPetApi.md#Add-PSPet) | **POST** /pet | Add a new pet to the store
[**Remove-Pet**](PSPetApi.md#remove-pet) | **DELETE** /pet/{petId} | Deletes a pet
[**Find-PSPetsByStatus**](PSPetApi.md#Find-PSPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status
[**Find-PSPetsByTags**](PSPetApi.md#Find-PSPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags
[**Get-PSPetById**](PSPetApi.md#Get-PSPetById) | **GET** /pet/{petId} | Find pet by ID
[**Update-PSPet**](PSPetApi.md#Update-PSPet) | **PUT** /pet | Update an existing pet
[**Update-PSPetWithForm**](PSPetApi.md#Update-PSPetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
[**Invoke-PSUploadFile**](PSPetApi.md#Invoke-PSUploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
<a name="Add-PSPet"></a>
# **Add-PSPet**
> Pet Add-PSPet<br>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[-Pet] <PSCustomObject><br>
Add a new pet to the store
### Example
```powershell
Import-Module -Name PSPetstore
$Configuration = Get-PSPetstoreConfiguration
# Configure OAuth2 access token for authorization: petstore_auth
$Configuration["AccessToken"] = "YOUR_ACCESS_TOKEN";
$Pet = (Initialize-Pet-Id 123 -Category (Initialize-Category-Id 123 -Name "Name_example") -Name "Name_example" -PhotoUrls @("PhotoUrls_example") -Tags @((Initialize-Tag-Id 123 -Name "Name_example")) -Status "Status_example") # Pet | Pet object that needs to be added to the store
# Add a new pet to the store
try {
Pet $Result = Add-PSPet -Pet $Pet
} catch {
Write-Host ("Exception occured when calling Add-PSPet: {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 |
### Return type
[**Pet**](Pet.md)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: application/json, application/xml
- **Accept**: application/xml, 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)
<a name="remove-pet"></a>
# **Remove-Pet**
> void Remove-Pet<br>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[-PetId] <Int64><br>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[-ApiKey] <String><br>
Deletes a pet
### Example
```powershell
Import-Module -Name PSPetstore
$Configuration = Get-PSPetstoreConfiguration
# Configure OAuth2 access token for authorization: petstore_auth
$Configuration["AccessToken"] = "YOUR_ACCESS_TOKEN";
$PetId = 987 # Int64 | Pet id to delete (default to null)
$ApiKey = "ApiKey_example" # String | (optional) (default to null)
# Deletes a pet
try {
Remove-Pet -PetId $PetId -ApiKey $ApiKey
} catch {
Write-Host ("Exception occured when calling Remove-Pet: {0}" -f ($_.ErrorDetails | ConvertFrom-Json))
Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json))
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**PetId** | **Int64**| Pet id to delete | [default to null]
**ApiKey** | **String**| | [optional] [default to null]
### Return type
void (empty response body)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[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)
<a name="Find-PSPetsByStatus"></a>
# **Find-PSPetsByStatus**
> Pet[] Find-PSPetsByStatus<br>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[-Status] <String[]><br>
Finds Pets by status
Multiple status values can be provided with comma separated strings
### Example
```powershell
Import-Module -Name PSPetstore
$Configuration = Get-PSPetstoreConfiguration
# Configure OAuth2 access token for authorization: petstore_auth
$Configuration["AccessToken"] = "YOUR_ACCESS_TOKEN";
$Status = @("Status_example") # String[] | Status values that need to be considered for filter (default to null)
# Finds Pets by status
try {
Pet[] $Result = Find-PSPetsByStatus -Status $Status
} catch {
Write-Host ("Exception occured when calling Find-PSPetsByStatus: {0}" -f ($_.ErrorDetails | ConvertFrom-Json))
Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json))
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**Status** | [**String[]**](String.md)| Status values that need to be considered for filter | [default to null]
### Return type
[**Pet[]**](Pet.md)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, 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)
<a name="Find-PSPetsByTags"></a>
# **Find-PSPetsByTags**
> Pet[] Find-PSPetsByTags<br>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[-Tags] <String[]><br>
Finds Pets by tags
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
### Example
```powershell
Import-Module -Name PSPetstore
$Configuration = Get-PSPetstoreConfiguration
# Configure OAuth2 access token for authorization: petstore_auth
$Configuration["AccessToken"] = "YOUR_ACCESS_TOKEN";
$Tags = @("Inner_example") # String[] | Tags to filter by (default to null)
# Finds Pets by tags
try {
Pet[] $Result = Find-PSPetsByTags -Tags $Tags
} catch {
Write-Host ("Exception occured when calling Find-PSPetsByTags: {0}" -f ($_.ErrorDetails | ConvertFrom-Json))
Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json))
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**Tags** | [**String[]**](String.md)| Tags to filter by | [default to null]
### Return type
[**Pet[]**](Pet.md)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, 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)
<a name="Get-PSPetById"></a>
# **Get-PSPetById**
> Pet Get-PSPetById<br>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[-PetId] <Int64><br>
Find pet by ID
Returns a single pet
### Example
```powershell
Import-Module -Name PSPetstore
$Configuration = Get-PSPetstoreConfiguration
# Configure API key authorization: api_key
$Configuration["ApiKey"]["api_key"] = "YOUR_API_KEY"
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#$Configuration["ApiKeyPrefix"]["api_key"] = "Bearer"
$PetId = 987 # Int64 | ID of pet to return (default to null)
# Find pet by ID
try {
Pet $Result = Get-PSPetById -PetId $PetId
} catch {
Write-Host ("Exception occured when calling Get-PSPetById: {0}" -f ($_.ErrorDetails | ConvertFrom-Json))
Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json))
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**PetId** | **Int64**| ID of pet to return | [default to null]
### Return type
[**Pet**](Pet.md)
### Authorization
[api_key](../README.md#api_key)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, 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)
<a name="Update-PSPet"></a>
# **Update-PSPet**
> Pet Update-PSPet<br>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[-Pet] <PSCustomObject><br>
Update an existing pet
### Example
```powershell
Import-Module -Name PSPetstore
$Configuration = Get-PSPetstoreConfiguration
# Configure OAuth2 access token for authorization: petstore_auth
$Configuration["AccessToken"] = "YOUR_ACCESS_TOKEN";
$Pet = (Initialize-Pet-Id 123 -Category (Initialize-Category-Id 123 -Name "Name_example") -Name "Name_example" -PhotoUrls @("PhotoUrls_example") -Tags @((Initialize-Tag-Id 123 -Name "Name_example")) -Status "Status_example") # Pet | Pet object that needs to be added to the store
# Update an existing pet
try {
Pet $Result = Update-PSPet -Pet $Pet
} catch {
Write-Host ("Exception occured when calling Update-PSPet: {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 |
### Return type
[**Pet**](Pet.md)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: application/json, application/xml
- **Accept**: application/xml, 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)
<a name="Update-PSPetWithForm"></a>
# **Update-PSPetWithForm**
> void Update-PSPetWithForm<br>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[-PetId] <Int64><br>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[-Name] <String><br>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[-Status] <String><br>
Updates a pet in the store with form data
### Example
```powershell
Import-Module -Name PSPetstore
$Configuration = Get-PSPetstoreConfiguration
# Configure OAuth2 access token for authorization: petstore_auth
$Configuration["AccessToken"] = "YOUR_ACCESS_TOKEN";
$PetId = 987 # Int64 | ID of pet that needs to be updated (default to null)
$Name = "Name_example" # String | Updated name of the pet (optional) (default to null)
$Status = "Status_example" # String | Updated status of the pet (optional) (default to null)
# Updates a pet in the store with form data
try {
Update-PSPetWithForm -PetId $PetId -Name $Name -Status $Status
} catch {
Write-Host ("Exception occured when calling Update-PSPetWithForm: {0}" -f ($_.ErrorDetails | ConvertFrom-Json))
Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json))
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**PetId** | **Int64**| ID of pet that needs to be updated | [default to null]
**Name** | **String**| Updated name of the pet | [optional] [default to null]
**Status** | **String**| Updated status of the pet | [optional] [default to null]
### Return type
void (empty response body)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: application/x-www-form-urlencoded
- **Accept**: Not defined
[[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)
<a name="Invoke-PSUploadFile"></a>
# **Invoke-PSUploadFile**
> ApiResponse Invoke-PSUploadFile<br>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[-PetId] <Int64><br>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[-AdditionalMetadata] <String><br>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[-File] <System.IO.FileInfo><br>
uploads an image
### Example
```powershell
Import-Module -Name PSPetstore
$Configuration = Get-PSPetstoreConfiguration
# Configure OAuth2 access token for authorization: petstore_auth
$Configuration["AccessToken"] = "YOUR_ACCESS_TOKEN";
$PetId = 987 # Int64 | ID of pet to update (default to null)
$AdditionalMetadata = "AdditionalMetadata_example" # String | Additional data to pass to server (optional) (default to null)
$File = 987 # System.IO.FileInfo | file to upload (optional) (default to null)
# uploads an image
try {
ApiResponse $Result = Invoke-PSUploadFile -PetId $PetId -AdditionalMetadata $AdditionalMetadata -File $File
} catch {
Write-Host ("Exception occured when calling Invoke-PSUploadFile: {0}" -f ($_.ErrorDetails | ConvertFrom-Json))
Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json))
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**PetId** | **Int64**| ID of pet to update | [default to null]
**AdditionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null]
**File** | **System.IO.FileInfo****System.IO.FileInfo**| file to upload | [optional] [default to null]
### Return type
[**ApiResponse**](ApiResponse.md)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: multipart/form-data
- **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)

View File

@@ -0,0 +1,191 @@
# PSPetstore.PSPetstore/Api.PSStoreApi
All URIs are relative to *http://petstore.swagger.io:80/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**Remove-PSOrder**](PSStoreApi.md#Remove-PSOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
[**Get-PSInventory**](PSStoreApi.md#Get-PSInventory) | **GET** /store/inventory | Returns pet inventories by status
[**Get-PSOrderById**](PSStoreApi.md#Get-PSOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID
[**Invoke-PSPlaceOrder**](PSStoreApi.md#Invoke-PSPlaceOrder) | **POST** /store/order | Place an order for a pet
<a name="Remove-PSOrder"></a>
# **Remove-PSOrder**
> void Remove-PSOrder<br>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[-OrderId] <String><br>
Delete purchase order by ID
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
### Example
```powershell
Import-Module -Name PSPetstore
$OrderId = "OrderId_example" # String | ID of the order that needs to be deleted (default to null)
# Delete purchase order by ID
try {
Remove-PSOrder -OrderId $OrderId
} catch {
Write-Host ("Exception occured when calling Remove-PSOrder: {0}" -f ($_.ErrorDetails | ConvertFrom-Json))
Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json))
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**OrderId** | **String**| ID of the order that needs to be deleted | [default to null]
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[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)
<a name="Get-PSInventory"></a>
# **Get-PSInventory**
> System.Collections.Hashtable Get-PSInventory<br>
Returns pet inventories by status
Returns a map of status codes to quantities
### Example
```powershell
Import-Module -Name PSPetstore
$Configuration = Get-PSPetstoreConfiguration
# Configure API key authorization: api_key
$Configuration["ApiKey"]["api_key"] = "YOUR_API_KEY"
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#$Configuration["ApiKeyPrefix"]["api_key"] = "Bearer"
# Returns pet inventories by status
try {
System.Collections.Hashtable $Result = Get-PSInventory
} catch {
Write-Host ("Exception occured when calling Get-PSInventory: {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.Collections.Hashtable**
### Authorization
[api_key](../README.md#api_key)
### HTTP request headers
- **Content-Type**: Not defined
- **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)
<a name="Get-PSOrderById"></a>
# **Get-PSOrderById**
> Order Get-PSOrderById<br>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[-OrderId] <Int64><br>
Find purchase order by ID
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
### Example
```powershell
Import-Module -Name PSPetstore
$OrderId = 987 # Int64 | ID of pet that needs to be fetched (default to null)
# Find purchase order by ID
try {
Order $Result = Get-PSOrderById -OrderId $OrderId
} catch {
Write-Host ("Exception occured when calling Get-PSOrderById: {0}" -f ($_.ErrorDetails | ConvertFrom-Json))
Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json))
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**OrderId** | **Int64**| ID of pet that needs to be fetched | [default to null]
### Return type
[**Order**](Order.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, 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)
<a name="Invoke-PSPlaceOrder"></a>
# **Invoke-PSPlaceOrder**
> Order Invoke-PSPlaceOrder<br>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[-Order] <PSCustomObject><br>
Place an order for a pet
### Example
```powershell
Import-Module -Name PSPetstore
$Order = (Initialize-Order-Id 123 -PetId 123 -Quantity 123 -ShipDate Get-Date -Status "Status_example" -Complete $false) # Order | order placed for purchasing the pet
# Place an order for a pet
try {
Order $Result = Invoke-PSPlaceOrder -Order $Order
} catch {
Write-Host ("Exception occured when calling Invoke-PSPlaceOrder: {0}" -f ($_.ErrorDetails | ConvertFrom-Json))
Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json))
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**Order** | [**Order**](Order.md)| order placed for purchasing the pet |
### Return type
[**Order**](Order.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/xml, 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)

View File

@@ -0,0 +1,403 @@
# PSPetstore.PSPetstore/Api.PSUserApi
All URIs are relative to *http://petstore.swagger.io:80/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**New-PSUser**](PSUserApi.md#New-PSUser) | **POST** /user | Create user
[**New-PSUsersWithArrayInput**](PSUserApi.md#New-PSUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array
[**New-PSUsersWithListInput**](PSUserApi.md#New-PSUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array
[**Remove-PSUser**](PSUserApi.md#Remove-PSUser) | **DELETE** /user/{username} | Delete user
[**Get-PSUserByName**](PSUserApi.md#Get-PSUserByName) | **GET** /user/{username} | Get user by user name
[**Invoke-PSLoginUser**](PSUserApi.md#Invoke-PSLoginUser) | **GET** /user/login | Logs user into the system
[**Invoke-PSLogoutUser**](PSUserApi.md#Invoke-PSLogoutUser) | **GET** /user/logout | Logs out current logged in user session
[**Update-PSUser**](PSUserApi.md#Update-PSUser) | **PUT** /user/{username} | Updated user
<a name="New-PSUser"></a>
# **New-PSUser**
> void New-PSUser<br>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[-User] <PSCustomObject><br>
Create user
This can only be done by the logged in user.
### Example
```powershell
Import-Module -Name PSPetstore
$Configuration = Get-PSPetstoreConfiguration
# Configure API key authorization: auth_cookie
$Configuration["ApiKey"]["AUTH_KEY"] = "YOUR_API_KEY"
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#$Configuration["ApiKeyPrefix"]["AUTH_KEY"] = "Bearer"
$User = (Initialize-User-Id 123 -Username "Username_example" -FirstName "FirstName_example" -LastName "LastName_example" -Email "Email_example" -Password "Password_example" -Phone "Phone_example" -UserStatus 123) # User | Created user object
# Create user
try {
New-PSUser -User $User
} catch {
Write-Host ("Exception occured when calling New-PSUser: {0}" -f ($_.ErrorDetails | ConvertFrom-Json))
Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json))
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**User** | [**User**](User.md)| Created user object |
### Return type
void (empty response body)
### Authorization
[auth_cookie](../README.md#auth_cookie)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: Not defined
[[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)
<a name="New-PSUsersWithArrayInput"></a>
# **New-PSUsersWithArrayInput**
> void New-PSUsersWithArrayInput<br>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[-User] <PSCustomObject[]><br>
Creates list of users with given input array
### Example
```powershell
Import-Module -Name PSPetstore
$Configuration = Get-PSPetstoreConfiguration
# Configure API key authorization: auth_cookie
$Configuration["ApiKey"]["AUTH_KEY"] = "YOUR_API_KEY"
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#$Configuration["ApiKeyPrefix"]["AUTH_KEY"] = "Bearer"
$User = @((Initialize-User-Id 123 -Username "Username_example" -FirstName "FirstName_example" -LastName "LastName_example" -Email "Email_example" -Password "Password_example" -Phone "Phone_example" -UserStatus 123)) # User[] | List of user object
# Creates list of users with given input array
try {
New-PSUsersWithArrayInput -User $User
} catch {
Write-Host ("Exception occured when calling New-PSUsersWithArrayInput: {0}" -f ($_.ErrorDetails | ConvertFrom-Json))
Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json))
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**User** | [**User[]**](User.md)| List of user object |
### Return type
void (empty response body)
### Authorization
[auth_cookie](../README.md#auth_cookie)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: Not defined
[[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)
<a name="New-PSUsersWithListInput"></a>
# **New-PSUsersWithListInput**
> void New-PSUsersWithListInput<br>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[-User] <PSCustomObject[]><br>
Creates list of users with given input array
### Example
```powershell
Import-Module -Name PSPetstore
$Configuration = Get-PSPetstoreConfiguration
# Configure API key authorization: auth_cookie
$Configuration["ApiKey"]["AUTH_KEY"] = "YOUR_API_KEY"
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#$Configuration["ApiKeyPrefix"]["AUTH_KEY"] = "Bearer"
$User = @() # User[] | List of user object
# Creates list of users with given input array
try {
New-PSUsersWithListInput -User $User
} catch {
Write-Host ("Exception occured when calling New-PSUsersWithListInput: {0}" -f ($_.ErrorDetails | ConvertFrom-Json))
Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json))
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**User** | [**User[]**](User.md)| List of user object |
### Return type
void (empty response body)
### Authorization
[auth_cookie](../README.md#auth_cookie)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: Not defined
[[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)
<a name="Remove-PSUser"></a>
# **Remove-PSUser**
> void Remove-PSUser<br>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[-Username] <String><br>
Delete user
This can only be done by the logged in user.
### Example
```powershell
Import-Module -Name PSPetstore
$Configuration = Get-PSPetstoreConfiguration
# Configure API key authorization: auth_cookie
$Configuration["ApiKey"]["AUTH_KEY"] = "YOUR_API_KEY"
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#$Configuration["ApiKeyPrefix"]["AUTH_KEY"] = "Bearer"
$Username = "Username_example" # String | The name that needs to be deleted (default to null)
# Delete user
try {
Remove-PSUser -Username $Username
} catch {
Write-Host ("Exception occured when calling Remove-PSUser: {0}" -f ($_.ErrorDetails | ConvertFrom-Json))
Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json))
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**Username** | **String**| The name that needs to be deleted | [default to null]
### Return type
void (empty response body)
### Authorization
[auth_cookie](../README.md#auth_cookie)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[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)
<a name="Get-PSUserByName"></a>
# **Get-PSUserByName**
> User Get-PSUserByName<br>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[-Username] <String><br>
Get user by user name
### Example
```powershell
Import-Module -Name PSPetstore
$Username = "Username_example" # String | The name that needs to be fetched. Use user1 for testing. (default to null)
# Get user by user name
try {
User $Result = Get-PSUserByName -Username $Username
} catch {
Write-Host ("Exception occured when calling Get-PSUserByName: {0}" -f ($_.ErrorDetails | ConvertFrom-Json))
Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json))
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**Username** | **String**| The name that needs to be fetched. Use user1 for testing. | [default to null]
### Return type
[**User**](User.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, 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)
<a name="Invoke-PSLoginUser"></a>
# **Invoke-PSLoginUser**
> String Invoke-PSLoginUser<br>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[-Username] <String><br>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[-Password] <String><br>
Logs user into the system
### Example
```powershell
Import-Module -Name PSPetstore
$Username = "Username_example" # String | The user name for login (default to null)
$Password = "Password_example" # String | The password for login in clear text (default to null)
# Logs user into the system
try {
String $Result = Invoke-PSLoginUser -Username $Username -Password $Password
} catch {
Write-Host ("Exception occured when calling Invoke-PSLoginUser: {0}" -f ($_.ErrorDetails | ConvertFrom-Json))
Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json))
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**Username** | **String**| The user name for login | [default to null]
**Password** | **String**| The password for login in clear text | [default to null]
### Return type
**String**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, 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)
<a name="Invoke-PSLogoutUser"></a>
# **Invoke-PSLogoutUser**
> void Invoke-PSLogoutUser<br>
Logs out current logged in user session
### Example
```powershell
Import-Module -Name PSPetstore
$Configuration = Get-PSPetstoreConfiguration
# Configure API key authorization: auth_cookie
$Configuration["ApiKey"]["AUTH_KEY"] = "YOUR_API_KEY"
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#$Configuration["ApiKeyPrefix"]["AUTH_KEY"] = "Bearer"
# Logs out current logged in user session
try {
Invoke-PSLogoutUser
} catch {
Write-Host ("Exception occured when calling Invoke-PSLogoutUser: {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
void (empty response body)
### Authorization
[auth_cookie](../README.md#auth_cookie)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[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)
<a name="Update-PSUser"></a>
# **Update-PSUser**
> void Update-PSUser<br>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[-Username] <String><br>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[-User] <PSCustomObject><br>
Updated user
This can only be done by the logged in user.
### Example
```powershell
Import-Module -Name PSPetstore
$Configuration = Get-PSPetstoreConfiguration
# Configure API key authorization: auth_cookie
$Configuration["ApiKey"]["AUTH_KEY"] = "YOUR_API_KEY"
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#$Configuration["ApiKeyPrefix"]["AUTH_KEY"] = "Bearer"
$Username = "Username_example" # String | name that need to be deleted (default to null)
$User = # User | Updated user object
# Updated user
try {
Update-PSUser -Username $Username -User $User
} catch {
Write-Host ("Exception occured when calling Update-PSUser: {0}" -f ($_.ErrorDetails | ConvertFrom-Json))
Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json))
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**Username** | **String**| name that need to be deleted | [default to null]
**User** | [**User**](User.md)| Updated user object |
### Return type
void (empty response body)
### Authorization
[auth_cookie](../README.md#auth_cookie)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: Not defined
[[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)

View File

@@ -0,0 +1,31 @@
# Pet
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Id** | **Int64** | | [optional] [default to null]
**Category** | [**Category**](Category.md) | | [optional] [default to null]
**Name** | **String** | | [default to null]
**PhotoUrls** | **String[]** | | [default to null]
**Tags** | [**Tag[]**](Tag.md) | | [optional] [default to null]
**Status** | **String** | pet status in the store | [optional] [default to null]
## Examples
- Prepare the resource
```powershell
Initialize-PSPetstorePet -Id null `
-Category null `
-Name doggie `
-PhotoUrls null `
-Tags null `
-Status null
```
- Convert the resource to JSON
```powershell
$ | Convert-ToJSON
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,23 @@
# Tag
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Id** | **Int64** | | [optional] [default to null]
**Name** | **String** | | [optional] [default to null]
## Examples
- Prepare the resource
```powershell
Initialize-PSPetstoreTag -Id null `
-Name null
```
- Convert the resource to JSON
```powershell
$ | Convert-ToJSON
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,35 @@
# User
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Id** | **Int64** | | [optional] [default to null]
**Username** | **String** | | [optional] [default to null]
**FirstName** | **String** | | [optional] [default to null]
**LastName** | **String** | | [optional] [default to null]
**Email** | **String** | | [optional] [default to null]
**Password** | **String** | | [optional] [default to null]
**Phone** | **String** | | [optional] [default to null]
**UserStatus** | **Int32** | User Status | [optional] [default to null]
## Examples
- Prepare the resource
```powershell
Initialize-PSPetstoreUser -Id null `
-Username null `
-FirstName null `
-LastName null `
-Email null `
-Password null `
-Phone null `
-UserStatus null
```
- Convert the resource to JSON
```powershell
$ | Convert-ToJSON
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 B

View File

@@ -1,164 +0,0 @@
function Invoke-PetApiAddPet {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
[Org.OpenAPITools.Model.Pet]
${body}
)
Process {
'Calling method: PetApi-AddPet' | Write-Verbose
$PSBoundParameters | Out-DebugParameter | Write-Debug
$Script:PetApi.AddPet(
${body}
)
}
}
function Invoke-PetApiDeletePet {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
[Int64]
${petId},
[Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
[String]
${apiKey}
)
Process {
'Calling method: PetApi-DeletePet' | Write-Verbose
$PSBoundParameters | Out-DebugParameter | Write-Debug
$Script:PetApi.DeletePet(
${petId},
${apiKey}
)
}
}
function Invoke-PetApiFindPetsByStatus {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
[String[]]
${status}
)
Process {
'Calling method: PetApi-FindPetsByStatus' | Write-Verbose
$PSBoundParameters | Out-DebugParameter | Write-Debug
$Script:PetApi.FindPetsByStatus(
${status}
)
}
}
function Invoke-PetApiFindPetsByTags {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
[String[]]
${tags}
)
Process {
'Calling method: PetApi-FindPetsByTags' | Write-Verbose
$PSBoundParameters | Out-DebugParameter | Write-Debug
$Script:PetApi.FindPetsByTags(
${tags}
)
}
}
function Invoke-PetApiGetPetById {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
[Int64]
${petId}
)
Process {
'Calling method: PetApi-GetPetById' | Write-Verbose
$PSBoundParameters | Out-DebugParameter | Write-Debug
$Script:PetApi.GetPetById(
${petId}
)
}
}
function Invoke-PetApiUpdatePet {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
[Org.OpenAPITools.Model.Pet]
${body}
)
Process {
'Calling method: PetApi-UpdatePet' | Write-Verbose
$PSBoundParameters | Out-DebugParameter | Write-Debug
$Script:PetApi.UpdatePet(
${body}
)
}
}
function Invoke-PetApiUpdatePetWithForm {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
[Int64]
${petId},
[Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
[String]
${name},
[Parameter(Position = 2, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
[String]
${status}
)
Process {
'Calling method: PetApi-UpdatePetWithForm' | Write-Verbose
$PSBoundParameters | Out-DebugParameter | Write-Debug
$Script:PetApi.UpdatePetWithForm(
${petId},
${name},
${status}
)
}
}
function Invoke-PetApiUploadFile {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
[Int64]
${petId},
[Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
[String]
${additionalMetadata},
[Parameter(Position = 2, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
[String]
${file}
)
Process {
'Calling method: PetApi-UploadFile' | Write-Verbose
$PSBoundParameters | Out-DebugParameter | Write-Debug
$Script:PetApi.UploadFile(
${petId},
${additionalMetadata},
${file}
)
}
}

View File

@@ -1,68 +0,0 @@
function Invoke-StoreApiDeleteOrder {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
[String]
${orderId}
)
Process {
'Calling method: StoreApi-DeleteOrder' | Write-Verbose
$PSBoundParameters | Out-DebugParameter | Write-Debug
$Script:StoreApi.DeleteOrder(
${orderId}
)
}
}
function Invoke-StoreApiGetInventory {
[CmdletBinding()]
Param (
)
Process {
'Calling method: StoreApi-GetInventory' | Write-Verbose
$PSBoundParameters | Out-DebugParameter | Write-Debug
$Script:StoreApi.GetInventory(
)
}
}
function Invoke-StoreApiGetOrderById {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
[Int64]
${orderId}
)
Process {
'Calling method: StoreApi-GetOrderById' | Write-Verbose
$PSBoundParameters | Out-DebugParameter | Write-Debug
$Script:StoreApi.GetOrderById(
${orderId}
)
}
}
function Invoke-StoreApiPlaceOrder {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
[Org.OpenAPITools.Model.Order]
${body}
)
Process {
'Calling method: StoreApi-PlaceOrder' | Write-Verbose
$PSBoundParameters | Out-DebugParameter | Write-Debug
$Script:StoreApi.PlaceOrder(
${body}
)
}
}

View File

@@ -1,148 +0,0 @@
function Invoke-UserApiCreateUser {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
[Org.OpenAPITools.Model.User]
${body}
)
Process {
'Calling method: UserApi-CreateUser' | Write-Verbose
$PSBoundParameters | Out-DebugParameter | Write-Debug
$Script:UserApi.CreateUser(
${body}
)
}
}
function Invoke-UserApiCreateUsersWithArrayInput {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
[Org.OpenAPITools.Model.User[]]
${body}
)
Process {
'Calling method: UserApi-CreateUsersWithArrayInput' | Write-Verbose
$PSBoundParameters | Out-DebugParameter | Write-Debug
$Script:UserApi.CreateUsersWithArrayInput(
${body}
)
}
}
function Invoke-UserApiCreateUsersWithListInput {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
[Org.OpenAPITools.Model.User[]]
${body}
)
Process {
'Calling method: UserApi-CreateUsersWithListInput' | Write-Verbose
$PSBoundParameters | Out-DebugParameter | Write-Debug
$Script:UserApi.CreateUsersWithListInput(
${body}
)
}
}
function Invoke-UserApiDeleteUser {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
[String]
${username}
)
Process {
'Calling method: UserApi-DeleteUser' | Write-Verbose
$PSBoundParameters | Out-DebugParameter | Write-Debug
$Script:UserApi.DeleteUser(
${username}
)
}
}
function Invoke-UserApiGetUserByName {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
[String]
${username}
)
Process {
'Calling method: UserApi-GetUserByName' | Write-Verbose
$PSBoundParameters | Out-DebugParameter | Write-Debug
$Script:UserApi.GetUserByName(
${username}
)
}
}
function Invoke-UserApiLoginUser {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
[String]
${username},
[Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
[String]
${password}
)
Process {
'Calling method: UserApi-LoginUser' | Write-Verbose
$PSBoundParameters | Out-DebugParameter | Write-Debug
$Script:UserApi.LoginUser(
${username},
${password}
)
}
}
function Invoke-UserApiLogoutUser {
[CmdletBinding()]
Param (
)
Process {
'Calling method: UserApi-LogoutUser' | Write-Verbose
$PSBoundParameters | Out-DebugParameter | Write-Debug
$Script:UserApi.LogoutUser(
)
}
}
function Invoke-UserApiUpdateUser {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
[String]
${username},
[Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
[Org.OpenAPITools.Model.User]
${body}
)
Process {
'Calling method: UserApi-UpdateUser' | Write-Verbose
$PSBoundParameters | Out-DebugParameter | Write-Debug
$Script:UserApi.UpdateUser(
${username},
${body}
)
}
}

View File

@@ -1,25 +0,0 @@
function New-ApiResponse {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
[System.Nullable[Int32]]
${code},
[Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)]
[String]
${type},
[Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)]
[String]
${message}
)
Process {
'Creating object: Org.OpenAPITools.Model.ApiResponse' | Write-Verbose
$PSBoundParameters | Out-DebugParameter | Write-Debug
New-Object -TypeName Org.OpenAPITools.Model.ApiResponse -ArgumentList @(
${code},
${type},
${message}
)
}
}

View File

@@ -1,21 +0,0 @@
function New-Category {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
[System.Nullable[Int64]]
${id},
[Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)]
[String]
${name}
)
Process {
'Creating object: Org.OpenAPITools.Model.Category' | Write-Verbose
$PSBoundParameters | Out-DebugParameter | Write-Debug
New-Object -TypeName Org.OpenAPITools.Model.Category -ArgumentList @(
${id},
${name}
)
}
}

View File

@@ -1,21 +0,0 @@
function New-InlineObject {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
[String]
${name},
[Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)]
[String]
${status}
)
Process {
'Creating object: Org.OpenAPITools.Model.InlineObject' | Write-Verbose
$PSBoundParameters | Out-DebugParameter | Write-Debug
New-Object -TypeName Org.OpenAPITools.Model.InlineObject -ArgumentList @(
${name},
${status}
)
}
}

View File

@@ -1,21 +0,0 @@
function New-InlineObject1 {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
[String]
${additionalMetadata},
[Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)]
[System.Nullable[String]]
${file}
)
Process {
'Creating object: Org.OpenAPITools.Model.InlineObject1' | Write-Verbose
$PSBoundParameters | Out-DebugParameter | Write-Debug
New-Object -TypeName Org.OpenAPITools.Model.InlineObject1 -ArgumentList @(
${additionalMetadata},
${file}
)
}
}

View File

@@ -1,37 +0,0 @@
function New-Order {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
[System.Nullable[Int64]]
${id},
[Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)]
[System.Nullable[Int64]]
${petId},
[Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)]
[System.Nullable[Int32]]
${quantity},
[Parameter(Position = 3, ValueFromPipelineByPropertyName = $true)]
[System.Nullable[System.DateTime]]
${shipDate},
[Parameter(Position = 4, ValueFromPipelineByPropertyName = $true)]
[String]
${status},
[Parameter(Position = 5, ValueFromPipelineByPropertyName = $true)]
[System.Nullable[Boolean]]
${complete}
)
Process {
'Creating object: Org.OpenAPITools.Model.Order' | Write-Verbose
$PSBoundParameters | Out-DebugParameter | Write-Debug
New-Object -TypeName Org.OpenAPITools.Model.Order -ArgumentList @(
${id},
${petId},
${quantity},
${shipDate},
${status},
${complete}
)
}
}

View File

@@ -1,37 +0,0 @@
function New-Pet {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
[System.Nullable[Int64]]
${id},
[Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)]
[Org.OpenAPITools.Model.Category]
${category},
[Parameter(Position = 2, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
[String]
${name},
[Parameter(Position = 3, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
[String[]]
${photoUrls},
[Parameter(Position = 4, ValueFromPipelineByPropertyName = $true)]
[Org.OpenAPITools.Model.Tag[]]
${tags},
[Parameter(Position = 5, ValueFromPipelineByPropertyName = $true)]
[String]
${status}
)
Process {
'Creating object: Org.OpenAPITools.Model.Pet' | Write-Verbose
$PSBoundParameters | Out-DebugParameter | Write-Debug
New-Object -TypeName Org.OpenAPITools.Model.Pet -ArgumentList @(
${id},
${category},
${name},
${photoUrls},
${tags},
${status}
)
}
}

View File

@@ -1,21 +0,0 @@
function New-Tag {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
[System.Nullable[Int64]]
${id},
[Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)]
[String]
${name}
)
Process {
'Creating object: Org.OpenAPITools.Model.Tag' | Write-Verbose
$PSBoundParameters | Out-DebugParameter | Write-Debug
New-Object -TypeName Org.OpenAPITools.Model.Tag -ArgumentList @(
${id},
${name}
)
}
}

View File

@@ -1,45 +0,0 @@
function New-User {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
[System.Nullable[Int64]]
${id},
[Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)]
[String]
${username},
[Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)]
[String]
${firstName},
[Parameter(Position = 3, ValueFromPipelineByPropertyName = $true)]
[String]
${lastName},
[Parameter(Position = 4, ValueFromPipelineByPropertyName = $true)]
[String]
${email},
[Parameter(Position = 5, ValueFromPipelineByPropertyName = $true)]
[String]
${password},
[Parameter(Position = 6, ValueFromPipelineByPropertyName = $true)]
[String]
${phone},
[Parameter(Position = 7, ValueFromPipelineByPropertyName = $true)]
[System.Nullable[Int32]]
${userStatus}
)
Process {
'Creating object: Org.OpenAPITools.Model.User' | Write-Verbose
$PSBoundParameters | Out-DebugParameter | Write-Debug
New-Object -TypeName Org.OpenAPITools.Model.User -ArgumentList @(
${id},
${username},
${firstName},
${lastName},
${email},
${password},
${phone},
${userStatus}
)
}
}

View File

@@ -1,29 +0,0 @@
#region Import functions
'API', 'Model', 'Private' | Get-ChildItem -Path {
Join-Path $PSScriptRoot $_
} -Filter '*.ps1' | ForEach-Object {
Write-Verbose "Importing file: $($_.BaseName)"
try {
. $_.FullName
} catch {
Write-Verbose "Can't import function!"
}
}
#endregion
#region Initialize APIs
'Creating object: Org.OpenAPITools.Api.PetApi' | Write-Verbose
$Script:PetApi= New-Object -TypeName Org.OpenAPITools.Api.PetApi -ArgumentList @($null)
'Creating object: Org.OpenAPITools.Api.StoreApi' | Write-Verbose
$Script:StoreApi= New-Object -TypeName Org.OpenAPITools.Api.StoreApi -ArgumentList @($null)
'Creating object: Org.OpenAPITools.Api.UserApi' | Write-Verbose
$Script:UserApi= New-Object -TypeName Org.OpenAPITools.Api.UserApi -ArgumentList @($null)
#endregion

View File

@@ -0,0 +1,718 @@
#
# OpenAPI Petstore
# This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
# Version: 1.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#
<#
.SYNOPSIS
Add a new pet to the store
.DESCRIPTION
No description available.
.PARAMETER Pet
Pet object that needs to be added to the store
.PARAMETER ReturnType
Select the return type (optional): application/xml, application/json
.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 Add-PSPet {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
[PSCustomObject]
${Pet},
[String]
[ValidateSet("application/xml", "application/json")]
$ReturnType,
[Switch]
$WithHttpInfo
)
Process {
'Calling method: Add-PSPet' | Write-Debug
$PSBoundParameters | Out-DebugParameter | Write-Debug
$LocalVarAccepts = @()
$LocalVarContentTypes = @()
$LocalVarQueryParameters = @{}
$LocalVarHeaderParameters = @{}
$LocalVarFormParameters = @{}
$LocalVarPathParameters = @{}
$LocalVarCookieParameters = @{}
$LocalVarBodyParameter = $null
$Configuration = Get-PSConfiguration
# HTTP header 'Accept' (if needed)
$LocalVarAccepts = @('application/xml', 'application/json')
if ($ReturnType) {
# use the return type (MIME) provided by the user
$LocalVarAccepts = @($ReturnType)
}
# HTTP header 'Content-Type'
$LocalVarContentTypes = @('application/json', 'application/xml')
$LocalVarUri = '/pet'
if (!$Pet) {
throw "Error! The required parameter `Pet` missing when calling addPet."
}
$LocalVarBodyParameter = $Pet | ConvertTo-Json
$LocalVarResult = Invoke-PSApiClient -Method 'POST' `
-Uri $LocalVarUri `
-Accepts $LocalVarAccepts `
-ContentTypes $LocalVarContentTypes `
-Body $LocalVarBodyParameter `
-HeaderParameters $LocalVarHeaderParameters `
-QueryParameters $LocalVarQueryParameters `
-FormParameters $LocalVarFormParameters `
-CookieParameters $LocalVarCookieParameters `
-ReturnType "Pet"
if ($WithHttpInfo.IsPresent) {
return $LocalVarResult
} else {
return $LocalVarResult["Response"]
}
}
}
<#
.SYNOPSIS
Deletes a pet
.DESCRIPTION
No description available.
.PARAMETER PetId
Pet id to delete
.PARAMETER ApiKey
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
None
#>
function Remove-Pet {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
[Int64]
${PetId},
[Parameter(Position = 1, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
[String]
${ApiKey},
[Switch]
$WithHttpInfo
)
Process {
'Calling method: Remove-Pet' | Write-Debug
$PSBoundParameters | Out-DebugParameter | Write-Debug
$LocalVarAccepts = @()
$LocalVarContentTypes = @()
$LocalVarQueryParameters = @{}
$LocalVarHeaderParameters = @{}
$LocalVarFormParameters = @{}
$LocalVarPathParameters = @{}
$LocalVarCookieParameters = @{}
$LocalVarBodyParameter = $null
$Configuration = Get-PSConfiguration
$LocalVarUri = '/pet/{petId}'
if (!$PetId) {
throw "Error! The required parameter `PetId` missing when calling deletePet."
}
$LocalVarUri = $LocalVarUri.replace('{petId}', $PetId)
if ($ApiKey) {
$LocalVarHeaderParameters['api_key'] = $ApiKey
}
$LocalVarResult = Invoke-PSApiClient -Method 'DELETE' `
-Uri $LocalVarUri `
-Accepts $LocalVarAccepts `
-ContentTypes $LocalVarContentTypes `
-Body $LocalVarBodyParameter `
-HeaderParameters $LocalVarHeaderParameters `
-QueryParameters $LocalVarQueryParameters `
-FormParameters $LocalVarFormParameters `
-CookieParameters $LocalVarCookieParameters `
-ReturnType ""
if ($WithHttpInfo.IsPresent) {
return $LocalVarResult
} else {
return $LocalVarResult["Response"]
}
}
}
<#
.SYNOPSIS
Finds Pets by status
.DESCRIPTION
No description available.
.PARAMETER Status
Status values that need to be considered for filter
.PARAMETER ReturnType
Select the return type (optional): application/xml, application/json
.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 Find-PSPetsByStatus {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
[ValidateSet("available", "pending", "sold")]
[String[]]
${Status},
[String]
[ValidateSet("application/xml", "application/json")]
$ReturnType,
[Switch]
$WithHttpInfo
)
Process {
'Calling method: Find-PSPetsByStatus' | Write-Debug
$PSBoundParameters | Out-DebugParameter | Write-Debug
$LocalVarAccepts = @()
$LocalVarContentTypes = @()
$LocalVarQueryParameters = @{}
$LocalVarHeaderParameters = @{}
$LocalVarFormParameters = @{}
$LocalVarPathParameters = @{}
$LocalVarCookieParameters = @{}
$LocalVarBodyParameter = $null
$Configuration = Get-PSConfiguration
# HTTP header 'Accept' (if needed)
$LocalVarAccepts = @('application/xml', 'application/json')
if ($ReturnType) {
# use the return type (MIME) provided by the user
$LocalVarAccepts = @($ReturnType)
}
$LocalVarUri = '/pet/findByStatus'
if (!$Status) {
throw "Error! The required parameter `Status` missing when calling findPetsByStatus."
}
$LocalVarQueryParameters['status'] = $Status
$LocalVarResult = Invoke-PSApiClient -Method 'GET' `
-Uri $LocalVarUri `
-Accepts $LocalVarAccepts `
-ContentTypes $LocalVarContentTypes `
-Body $LocalVarBodyParameter `
-HeaderParameters $LocalVarHeaderParameters `
-QueryParameters $LocalVarQueryParameters `
-FormParameters $LocalVarFormParameters `
-CookieParameters $LocalVarCookieParameters `
-ReturnType "Pet[]"
if ($WithHttpInfo.IsPresent) {
return $LocalVarResult
} else {
return $LocalVarResult["Response"]
}
}
}
<#
.SYNOPSIS
Finds Pets by tags
.DESCRIPTION
No description available.
.PARAMETER Tags
Tags to filter by
.PARAMETER ReturnType
Select the return type (optional): application/xml, application/json
.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 Find-PSPetsByTags {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
[String[]]
${Tags},
[String]
[ValidateSet("application/xml", "application/json")]
$ReturnType,
[Switch]
$WithHttpInfo
)
Process {
'Calling method: Find-PSPetsByTags' | Write-Debug
$PSBoundParameters | Out-DebugParameter | Write-Debug
$LocalVarAccepts = @()
$LocalVarContentTypes = @()
$LocalVarQueryParameters = @{}
$LocalVarHeaderParameters = @{}
$LocalVarFormParameters = @{}
$LocalVarPathParameters = @{}
$LocalVarCookieParameters = @{}
$LocalVarBodyParameter = $null
$Configuration = Get-PSConfiguration
# HTTP header 'Accept' (if needed)
$LocalVarAccepts = @('application/xml', 'application/json')
if ($ReturnType) {
# use the return type (MIME) provided by the user
$LocalVarAccepts = @($ReturnType)
}
$LocalVarUri = '/pet/findByTags'
if (!$Tags) {
throw "Error! The required parameter `Tags` missing when calling findPetsByTags."
}
$LocalVarQueryParameters['tags'] = $Tags
$LocalVarResult = Invoke-PSApiClient -Method 'GET' `
-Uri $LocalVarUri `
-Accepts $LocalVarAccepts `
-ContentTypes $LocalVarContentTypes `
-Body $LocalVarBodyParameter `
-HeaderParameters $LocalVarHeaderParameters `
-QueryParameters $LocalVarQueryParameters `
-FormParameters $LocalVarFormParameters `
-CookieParameters $LocalVarCookieParameters `
-ReturnType "Pet[]"
if ($WithHttpInfo.IsPresent) {
return $LocalVarResult
} else {
return $LocalVarResult["Response"]
}
}
}
<#
.SYNOPSIS
Find pet by ID
.DESCRIPTION
No description available.
.PARAMETER PetId
ID of pet to return
.PARAMETER ReturnType
Select the return type (optional): application/xml, application/json
.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 Get-PSPetById {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
[Int64]
${PetId},
[String]
[ValidateSet("application/xml", "application/json")]
$ReturnType,
[Switch]
$WithHttpInfo
)
Process {
'Calling method: Get-PSPetById' | Write-Debug
$PSBoundParameters | Out-DebugParameter | Write-Debug
$LocalVarAccepts = @()
$LocalVarContentTypes = @()
$LocalVarQueryParameters = @{}
$LocalVarHeaderParameters = @{}
$LocalVarFormParameters = @{}
$LocalVarPathParameters = @{}
$LocalVarCookieParameters = @{}
$LocalVarBodyParameter = $null
$Configuration = Get-PSConfiguration
# HTTP header 'Accept' (if needed)
$LocalVarAccepts = @('application/xml', 'application/json')
if ($ReturnType) {
# use the return type (MIME) provided by the user
$LocalVarAccepts = @($ReturnType)
}
$LocalVarUri = '/pet/{petId}'
if (!$PetId) {
throw "Error! The required parameter `PetId` missing when calling getPetById."
}
$LocalVarUri = $LocalVarUri.replace('{petId}', $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)
}
$LocalVarResult = Invoke-PSApiClient -Method 'GET' `
-Uri $LocalVarUri `
-Accepts $LocalVarAccepts `
-ContentTypes $LocalVarContentTypes `
-Body $LocalVarBodyParameter `
-HeaderParameters $LocalVarHeaderParameters `
-QueryParameters $LocalVarQueryParameters `
-FormParameters $LocalVarFormParameters `
-CookieParameters $LocalVarCookieParameters `
-ReturnType "Pet"
if ($WithHttpInfo.IsPresent) {
return $LocalVarResult
} else {
return $LocalVarResult["Response"]
}
}
}
<#
.SYNOPSIS
Update an existing pet
.DESCRIPTION
No description available.
.PARAMETER Pet
Pet object that needs to be added to the store
.PARAMETER ReturnType
Select the return type (optional): application/xml, application/json
.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 Update-PSPet {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
[PSCustomObject]
${Pet},
[String]
[ValidateSet("application/xml", "application/json")]
$ReturnType,
[Switch]
$WithHttpInfo
)
Process {
'Calling method: Update-PSPet' | Write-Debug
$PSBoundParameters | Out-DebugParameter | Write-Debug
$LocalVarAccepts = @()
$LocalVarContentTypes = @()
$LocalVarQueryParameters = @{}
$LocalVarHeaderParameters = @{}
$LocalVarFormParameters = @{}
$LocalVarPathParameters = @{}
$LocalVarCookieParameters = @{}
$LocalVarBodyParameter = $null
$Configuration = Get-PSConfiguration
# HTTP header 'Accept' (if needed)
$LocalVarAccepts = @('application/xml', 'application/json')
if ($ReturnType) {
# use the return type (MIME) provided by the user
$LocalVarAccepts = @($ReturnType)
}
# HTTP header 'Content-Type'
$LocalVarContentTypes = @('application/json', 'application/xml')
$LocalVarUri = '/pet'
if (!$Pet) {
throw "Error! The required parameter `Pet` missing when calling updatePet."
}
$LocalVarBodyParameter = $Pet | ConvertTo-Json
$LocalVarResult = Invoke-PSApiClient -Method 'PUT' `
-Uri $LocalVarUri `
-Accepts $LocalVarAccepts `
-ContentTypes $LocalVarContentTypes `
-Body $LocalVarBodyParameter `
-HeaderParameters $LocalVarHeaderParameters `
-QueryParameters $LocalVarQueryParameters `
-FormParameters $LocalVarFormParameters `
-CookieParameters $LocalVarCookieParameters `
-ReturnType "Pet"
if ($WithHttpInfo.IsPresent) {
return $LocalVarResult
} else {
return $LocalVarResult["Response"]
}
}
}
<#
.SYNOPSIS
Updates a pet in the store with form data
.DESCRIPTION
No description available.
.PARAMETER PetId
ID of pet that needs to be updated
.PARAMETER Name
Updated name of the pet
.PARAMETER Status
Updated status of the pet
.PARAMETER WithHttpInfo
A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response
.OUTPUTS
None
#>
function Update-PSPetWithForm {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
[Int64]
${PetId},
[Parameter(Position = 1, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
[String]
${Name},
[Parameter(Position = 2, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
[String]
${Status},
[Switch]
$WithHttpInfo
)
Process {
'Calling method: Update-PSPetWithForm' | Write-Debug
$PSBoundParameters | Out-DebugParameter | Write-Debug
$LocalVarAccepts = @()
$LocalVarContentTypes = @()
$LocalVarQueryParameters = @{}
$LocalVarHeaderParameters = @{}
$LocalVarFormParameters = @{}
$LocalVarPathParameters = @{}
$LocalVarCookieParameters = @{}
$LocalVarBodyParameter = $null
$Configuration = Get-PSConfiguration
# HTTP header 'Content-Type'
$LocalVarContentTypes = @('application/x-www-form-urlencoded')
$LocalVarUri = '/pet/{petId}'
if (!$PetId) {
throw "Error! The required parameter `PetId` missing when calling updatePetWithForm."
}
$LocalVarUri = $LocalVarUri.replace('{petId}', $PetId)
if ($Name) {
$LocalVarFormParameters['name'] = $Name
}
if ($Status) {
$LocalVarFormParameters['status'] = $Status
}
$LocalVarResult = Invoke-PSApiClient -Method 'POST' `
-Uri $LocalVarUri `
-Accepts $LocalVarAccepts `
-ContentTypes $LocalVarContentTypes `
-Body $LocalVarBodyParameter `
-HeaderParameters $LocalVarHeaderParameters `
-QueryParameters $LocalVarQueryParameters `
-FormParameters $LocalVarFormParameters `
-CookieParameters $LocalVarCookieParameters `
-ReturnType ""
if ($WithHttpInfo.IsPresent) {
return $LocalVarResult
} else {
return $LocalVarResult["Response"]
}
}
}
<#
.SYNOPSIS
uploads an image
.DESCRIPTION
No description available.
.PARAMETER PetId
ID of pet to update
.PARAMETER AdditionalMetadata
Additional data to pass to server
.PARAMETER File
file to upload
.PARAMETER WithHttpInfo
A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response
.OUTPUTS
ApiResponse
#>
function Invoke-PSUploadFile {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
[Int64]
${PetId},
[Parameter(Position = 1, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
[String]
${AdditionalMetadata},
[Parameter(Position = 2, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
[System.IO.FileInfo]
${File},
[Switch]
$WithHttpInfo
)
Process {
'Calling method: Invoke-PSUploadFile' | Write-Debug
$PSBoundParameters | Out-DebugParameter | Write-Debug
$LocalVarAccepts = @()
$LocalVarContentTypes = @()
$LocalVarQueryParameters = @{}
$LocalVarHeaderParameters = @{}
$LocalVarFormParameters = @{}
$LocalVarPathParameters = @{}
$LocalVarCookieParameters = @{}
$LocalVarBodyParameter = $null
$Configuration = Get-PSConfiguration
# HTTP header 'Accept' (if needed)
$LocalVarAccepts = @('application/json')
# HTTP header 'Content-Type'
$LocalVarContentTypes = @('multipart/form-data')
$LocalVarUri = '/pet/{petId}/uploadImage'
if (!$PetId) {
throw "Error! The required parameter `PetId` missing when calling uploadFile."
}
$LocalVarUri = $LocalVarUri.replace('{petId}', $PetId)
if ($AdditionalMetadata) {
$LocalVarFormParameters['additionalMetadata'] = $AdditionalMetadata
}
if ($File) {
$LocalVarFormParameters['file'] = $File
}
$LocalVarResult = Invoke-PSApiClient -Method 'POST' `
-Uri $LocalVarUri `
-Accepts $LocalVarAccepts `
-ContentTypes $LocalVarContentTypes `
-Body $LocalVarBodyParameter `
-HeaderParameters $LocalVarHeaderParameters `
-QueryParameters $LocalVarQueryParameters `
-FormParameters $LocalVarFormParameters `
-CookieParameters $LocalVarCookieParameters `
-ReturnType "ApiResponse"
if ($WithHttpInfo.IsPresent) {
return $LocalVarResult
} else {
return $LocalVarResult["Response"]
}
}
}

View File

@@ -0,0 +1,316 @@
#
# OpenAPI Petstore
# This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
# Version: 1.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#
<#
.SYNOPSIS
Delete purchase order by ID
.DESCRIPTION
No description available.
.PARAMETER OrderId
ID of the order that needs to be deleted
.PARAMETER WithHttpInfo
A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response
.OUTPUTS
None
#>
function Remove-PSOrder {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
[String]
${OrderId},
[Switch]
$WithHttpInfo
)
Process {
'Calling method: Remove-PSOrder' | Write-Debug
$PSBoundParameters | Out-DebugParameter | Write-Debug
$LocalVarAccepts = @()
$LocalVarContentTypes = @()
$LocalVarQueryParameters = @{}
$LocalVarHeaderParameters = @{}
$LocalVarFormParameters = @{}
$LocalVarPathParameters = @{}
$LocalVarCookieParameters = @{}
$LocalVarBodyParameter = $null
$Configuration = Get-PSConfiguration
$LocalVarUri = '/store/order/{orderId}'
if (!$OrderId) {
throw "Error! The required parameter `OrderId` missing when calling deleteOrder."
}
$LocalVarUri = $LocalVarUri.replace('{orderId}', $OrderId)
$LocalVarResult = Invoke-PSApiClient -Method 'DELETE' `
-Uri $LocalVarUri `
-Accepts $LocalVarAccepts `
-ContentTypes $LocalVarContentTypes `
-Body $LocalVarBodyParameter `
-HeaderParameters $LocalVarHeaderParameters `
-QueryParameters $LocalVarQueryParameters `
-FormParameters $LocalVarFormParameters `
-CookieParameters $LocalVarCookieParameters `
-ReturnType ""
if ($WithHttpInfo.IsPresent) {
return $LocalVarResult
} else {
return $LocalVarResult["Response"]
}
}
}
<#
.SYNOPSIS
Returns pet inventories by status
.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.Collections.Hashtable
#>
function Get-PSInventory {
[CmdletBinding()]
Param (
[Switch]
$WithHttpInfo
)
Process {
'Calling method: Get-PSInventory' | Write-Debug
$PSBoundParameters | Out-DebugParameter | Write-Debug
$LocalVarAccepts = @()
$LocalVarContentTypes = @()
$LocalVarQueryParameters = @{}
$LocalVarHeaderParameters = @{}
$LocalVarFormParameters = @{}
$LocalVarPathParameters = @{}
$LocalVarCookieParameters = @{}
$LocalVarBodyParameter = $null
$Configuration = Get-PSConfiguration
# HTTP header 'Accept' (if needed)
$LocalVarAccepts = @('application/json')
$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)
}
$LocalVarResult = Invoke-PSApiClient -Method 'GET' `
-Uri $LocalVarUri `
-Accepts $LocalVarAccepts `
-ContentTypes $LocalVarContentTypes `
-Body $LocalVarBodyParameter `
-HeaderParameters $LocalVarHeaderParameters `
-QueryParameters $LocalVarQueryParameters `
-FormParameters $LocalVarFormParameters `
-CookieParameters $LocalVarCookieParameters `
-ReturnType "System.Collections.Hashtable"
if ($WithHttpInfo.IsPresent) {
return $LocalVarResult
} else {
return $LocalVarResult["Response"]
}
}
}
<#
.SYNOPSIS
Find purchase order by ID
.DESCRIPTION
No description available.
.PARAMETER OrderId
ID of pet that needs to be fetched
.PARAMETER ReturnType
Select the return type (optional): application/xml, application/json
.PARAMETER WithHttpInfo
A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response
.OUTPUTS
Order
#>
function Get-PSOrderById {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
[Int64]
${OrderId},
[String]
[ValidateSet("application/xml", "application/json")]
$ReturnType,
[Switch]
$WithHttpInfo
)
Process {
'Calling method: Get-PSOrderById' | Write-Debug
$PSBoundParameters | Out-DebugParameter | Write-Debug
$LocalVarAccepts = @()
$LocalVarContentTypes = @()
$LocalVarQueryParameters = @{}
$LocalVarHeaderParameters = @{}
$LocalVarFormParameters = @{}
$LocalVarPathParameters = @{}
$LocalVarCookieParameters = @{}
$LocalVarBodyParameter = $null
$Configuration = Get-PSConfiguration
# HTTP header 'Accept' (if needed)
$LocalVarAccepts = @('application/xml', 'application/json')
if ($ReturnType) {
# use the return type (MIME) provided by the user
$LocalVarAccepts = @($ReturnType)
}
$LocalVarUri = '/store/order/{orderId}'
if (!$OrderId) {
throw "Error! The required parameter `OrderId` missing when calling getOrderById."
}
$LocalVarUri = $LocalVarUri.replace('{orderId}', $OrderId)
$LocalVarResult = Invoke-PSApiClient -Method 'GET' `
-Uri $LocalVarUri `
-Accepts $LocalVarAccepts `
-ContentTypes $LocalVarContentTypes `
-Body $LocalVarBodyParameter `
-HeaderParameters $LocalVarHeaderParameters `
-QueryParameters $LocalVarQueryParameters `
-FormParameters $LocalVarFormParameters `
-CookieParameters $LocalVarCookieParameters `
-ReturnType "Order"
if ($WithHttpInfo.IsPresent) {
return $LocalVarResult
} else {
return $LocalVarResult["Response"]
}
}
}
<#
.SYNOPSIS
Place an order for a pet
.DESCRIPTION
No description available.
.PARAMETER Order
order placed for purchasing the pet
.PARAMETER ReturnType
Select the return type (optional): application/xml, application/json
.PARAMETER WithHttpInfo
A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response
.OUTPUTS
Order
#>
function Invoke-PSPlaceOrder {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
[PSCustomObject]
${Order},
[String]
[ValidateSet("application/xml", "application/json")]
$ReturnType,
[Switch]
$WithHttpInfo
)
Process {
'Calling method: Invoke-PSPlaceOrder' | Write-Debug
$PSBoundParameters | Out-DebugParameter | Write-Debug
$LocalVarAccepts = @()
$LocalVarContentTypes = @()
$LocalVarQueryParameters = @{}
$LocalVarHeaderParameters = @{}
$LocalVarFormParameters = @{}
$LocalVarPathParameters = @{}
$LocalVarCookieParameters = @{}
$LocalVarBodyParameter = $null
$Configuration = Get-PSConfiguration
# HTTP header 'Accept' (if needed)
$LocalVarAccepts = @('application/xml', 'application/json')
if ($ReturnType) {
# use the return type (MIME) provided by the user
$LocalVarAccepts = @($ReturnType)
}
# HTTP header 'Content-Type'
$LocalVarContentTypes = @('application/json')
$LocalVarUri = '/store/order'
if (!$Order) {
throw "Error! The required parameter `Order` missing when calling placeOrder."
}
$LocalVarBodyParameter = $Order | ConvertTo-Json
$LocalVarResult = Invoke-PSApiClient -Method 'POST' `
-Uri $LocalVarUri `
-Accepts $LocalVarAccepts `
-ContentTypes $LocalVarContentTypes `
-Body $LocalVarBodyParameter `
-HeaderParameters $LocalVarHeaderParameters `
-QueryParameters $LocalVarQueryParameters `
-FormParameters $LocalVarFormParameters `
-CookieParameters $LocalVarCookieParameters `
-ReturnType "Order"
if ($WithHttpInfo.IsPresent) {
return $LocalVarResult
} else {
return $LocalVarResult["Response"]
}
}
}

View File

@@ -0,0 +1,651 @@
#
# OpenAPI Petstore
# This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
# Version: 1.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#
<#
.SYNOPSIS
Create user
.DESCRIPTION
No description available.
.PARAMETER User
Created user object
.PARAMETER WithHttpInfo
A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response
.OUTPUTS
None
#>
function New-PSUser {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
[PSCustomObject]
${User},
[Switch]
$WithHttpInfo
)
Process {
'Calling method: New-PSUser' | Write-Debug
$PSBoundParameters | Out-DebugParameter | Write-Debug
$LocalVarAccepts = @()
$LocalVarContentTypes = @()
$LocalVarQueryParameters = @{}
$LocalVarHeaderParameters = @{}
$LocalVarFormParameters = @{}
$LocalVarPathParameters = @{}
$LocalVarCookieParameters = @{}
$LocalVarBodyParameter = $null
$Configuration = Get-PSConfiguration
# HTTP header 'Content-Type'
$LocalVarContentTypes = @('application/json')
$LocalVarUri = '/user'
if (!$User) {
throw "Error! The required parameter `User` missing when calling createUser."
}
$LocalVarBodyParameter = $User | ConvertTo-Json
if ($Configuration["Cookie"]) {
$LocalVarCookieParameters['auth_cookie'] = $Configuration["Cookie"]
Write-Verbose ("Using API key `auth_cookie` in the cookie for authentication in {0}" -f $MyInvocation.MyCommand)
}
$LocalVarResult = Invoke-PSApiClient -Method 'POST' `
-Uri $LocalVarUri `
-Accepts $LocalVarAccepts `
-ContentTypes $LocalVarContentTypes `
-Body $LocalVarBodyParameter `
-HeaderParameters $LocalVarHeaderParameters `
-QueryParameters $LocalVarQueryParameters `
-FormParameters $LocalVarFormParameters `
-CookieParameters $LocalVarCookieParameters `
-ReturnType ""
if ($WithHttpInfo.IsPresent) {
return $LocalVarResult
} else {
return $LocalVarResult["Response"]
}
}
}
<#
.SYNOPSIS
Creates list of users with given input array
.DESCRIPTION
No description available.
.PARAMETER User
List of user object
.PARAMETER WithHttpInfo
A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response
.OUTPUTS
None
#>
function New-PSUsersWithArrayInput {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
[PSCustomObject[]]
${User},
[Switch]
$WithHttpInfo
)
Process {
'Calling method: New-PSUsersWithArrayInput' | Write-Debug
$PSBoundParameters | Out-DebugParameter | Write-Debug
$LocalVarAccepts = @()
$LocalVarContentTypes = @()
$LocalVarQueryParameters = @{}
$LocalVarHeaderParameters = @{}
$LocalVarFormParameters = @{}
$LocalVarPathParameters = @{}
$LocalVarCookieParameters = @{}
$LocalVarBodyParameter = $null
$Configuration = Get-PSConfiguration
# HTTP header 'Content-Type'
$LocalVarContentTypes = @('application/json')
$LocalVarUri = '/user/createWithArray'
if (!$User) {
throw "Error! The required parameter `User` missing when calling createUsersWithArrayInput."
}
$LocalVarBodyParameter = $User | ConvertTo-Json
if ($Configuration["Cookie"]) {
$LocalVarCookieParameters['auth_cookie'] = $Configuration["Cookie"]
Write-Verbose ("Using API key `auth_cookie` in the cookie for authentication in {0}" -f $MyInvocation.MyCommand)
}
$LocalVarResult = Invoke-PSApiClient -Method 'POST' `
-Uri $LocalVarUri `
-Accepts $LocalVarAccepts `
-ContentTypes $LocalVarContentTypes `
-Body $LocalVarBodyParameter `
-HeaderParameters $LocalVarHeaderParameters `
-QueryParameters $LocalVarQueryParameters `
-FormParameters $LocalVarFormParameters `
-CookieParameters $LocalVarCookieParameters `
-ReturnType ""
if ($WithHttpInfo.IsPresent) {
return $LocalVarResult
} else {
return $LocalVarResult["Response"]
}
}
}
<#
.SYNOPSIS
Creates list of users with given input array
.DESCRIPTION
No description available.
.PARAMETER User
List of user object
.PARAMETER WithHttpInfo
A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response
.OUTPUTS
None
#>
function New-PSUsersWithListInput {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
[PSCustomObject[]]
${User},
[Switch]
$WithHttpInfo
)
Process {
'Calling method: New-PSUsersWithListInput' | Write-Debug
$PSBoundParameters | Out-DebugParameter | Write-Debug
$LocalVarAccepts = @()
$LocalVarContentTypes = @()
$LocalVarQueryParameters = @{}
$LocalVarHeaderParameters = @{}
$LocalVarFormParameters = @{}
$LocalVarPathParameters = @{}
$LocalVarCookieParameters = @{}
$LocalVarBodyParameter = $null
$Configuration = Get-PSConfiguration
# HTTP header 'Content-Type'
$LocalVarContentTypes = @('application/json')
$LocalVarUri = '/user/createWithList'
if (!$User) {
throw "Error! The required parameter `User` missing when calling createUsersWithListInput."
}
$LocalVarBodyParameter = $User | ConvertTo-Json
if ($Configuration["Cookie"]) {
$LocalVarCookieParameters['auth_cookie'] = $Configuration["Cookie"]
Write-Verbose ("Using API key `auth_cookie` in the cookie for authentication in {0}" -f $MyInvocation.MyCommand)
}
$LocalVarResult = Invoke-PSApiClient -Method 'POST' `
-Uri $LocalVarUri `
-Accepts $LocalVarAccepts `
-ContentTypes $LocalVarContentTypes `
-Body $LocalVarBodyParameter `
-HeaderParameters $LocalVarHeaderParameters `
-QueryParameters $LocalVarQueryParameters `
-FormParameters $LocalVarFormParameters `
-CookieParameters $LocalVarCookieParameters `
-ReturnType ""
if ($WithHttpInfo.IsPresent) {
return $LocalVarResult
} else {
return $LocalVarResult["Response"]
}
}
}
<#
.SYNOPSIS
Delete user
.DESCRIPTION
No description available.
.PARAMETER Username
The name that needs to be deleted
.PARAMETER WithHttpInfo
A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response
.OUTPUTS
None
#>
function Remove-PSUser {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
[String]
${Username},
[Switch]
$WithHttpInfo
)
Process {
'Calling method: Remove-PSUser' | Write-Debug
$PSBoundParameters | Out-DebugParameter | Write-Debug
$LocalVarAccepts = @()
$LocalVarContentTypes = @()
$LocalVarQueryParameters = @{}
$LocalVarHeaderParameters = @{}
$LocalVarFormParameters = @{}
$LocalVarPathParameters = @{}
$LocalVarCookieParameters = @{}
$LocalVarBodyParameter = $null
$Configuration = Get-PSConfiguration
$LocalVarUri = '/user/{username}'
if (!$Username) {
throw "Error! The required parameter `Username` missing when calling deleteUser."
}
$LocalVarUri = $LocalVarUri.replace('{username}', $Username)
if ($Configuration["Cookie"]) {
$LocalVarCookieParameters['auth_cookie'] = $Configuration["Cookie"]
Write-Verbose ("Using API key `auth_cookie` in the cookie for authentication in {0}" -f $MyInvocation.MyCommand)
}
$LocalVarResult = Invoke-PSApiClient -Method 'DELETE' `
-Uri $LocalVarUri `
-Accepts $LocalVarAccepts `
-ContentTypes $LocalVarContentTypes `
-Body $LocalVarBodyParameter `
-HeaderParameters $LocalVarHeaderParameters `
-QueryParameters $LocalVarQueryParameters `
-FormParameters $LocalVarFormParameters `
-CookieParameters $LocalVarCookieParameters `
-ReturnType ""
if ($WithHttpInfo.IsPresent) {
return $LocalVarResult
} else {
return $LocalVarResult["Response"]
}
}
}
<#
.SYNOPSIS
Get user by user name
.DESCRIPTION
No description available.
.PARAMETER Username
The name that needs to be fetched. Use user1 for testing.
.PARAMETER ReturnType
Select the return type (optional): application/xml, application/json
.PARAMETER WithHttpInfo
A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response
.OUTPUTS
User
#>
function Get-PSUserByName {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
[String]
${Username},
[String]
[ValidateSet("application/xml", "application/json")]
$ReturnType,
[Switch]
$WithHttpInfo
)
Process {
'Calling method: Get-PSUserByName' | Write-Debug
$PSBoundParameters | Out-DebugParameter | Write-Debug
$LocalVarAccepts = @()
$LocalVarContentTypes = @()
$LocalVarQueryParameters = @{}
$LocalVarHeaderParameters = @{}
$LocalVarFormParameters = @{}
$LocalVarPathParameters = @{}
$LocalVarCookieParameters = @{}
$LocalVarBodyParameter = $null
$Configuration = Get-PSConfiguration
# HTTP header 'Accept' (if needed)
$LocalVarAccepts = @('application/xml', 'application/json')
if ($ReturnType) {
# use the return type (MIME) provided by the user
$LocalVarAccepts = @($ReturnType)
}
$LocalVarUri = '/user/{username}'
if (!$Username) {
throw "Error! The required parameter `Username` missing when calling getUserByName."
}
$LocalVarUri = $LocalVarUri.replace('{username}', $Username)
$LocalVarResult = Invoke-PSApiClient -Method 'GET' `
-Uri $LocalVarUri `
-Accepts $LocalVarAccepts `
-ContentTypes $LocalVarContentTypes `
-Body $LocalVarBodyParameter `
-HeaderParameters $LocalVarHeaderParameters `
-QueryParameters $LocalVarQueryParameters `
-FormParameters $LocalVarFormParameters `
-CookieParameters $LocalVarCookieParameters `
-ReturnType "User"
if ($WithHttpInfo.IsPresent) {
return $LocalVarResult
} else {
return $LocalVarResult["Response"]
}
}
}
<#
.SYNOPSIS
Logs user into the system
.DESCRIPTION
No description available.
.PARAMETER Username
The user name for login
.PARAMETER Password
The password for login in clear text
.PARAMETER ReturnType
Select the return type (optional): application/xml, application/json
.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 Invoke-PSLoginUser {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
[String]
${Username},
[Parameter(Position = 1, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
[String]
${Password},
[String]
[ValidateSet("application/xml", "application/json")]
$ReturnType,
[Switch]
$WithHttpInfo
)
Process {
'Calling method: Invoke-PSLoginUser' | Write-Debug
$PSBoundParameters | Out-DebugParameter | Write-Debug
$LocalVarAccepts = @()
$LocalVarContentTypes = @()
$LocalVarQueryParameters = @{}
$LocalVarHeaderParameters = @{}
$LocalVarFormParameters = @{}
$LocalVarPathParameters = @{}
$LocalVarCookieParameters = @{}
$LocalVarBodyParameter = $null
$Configuration = Get-PSConfiguration
# HTTP header 'Accept' (if needed)
$LocalVarAccepts = @('application/xml', 'application/json')
if ($ReturnType) {
# use the return type (MIME) provided by the user
$LocalVarAccepts = @($ReturnType)
}
$LocalVarUri = '/user/login'
if (!$Username) {
throw "Error! The required parameter `Username` missing when calling loginUser."
}
$LocalVarQueryParameters['username'] = $Username
if (!$Password) {
throw "Error! The required parameter `Password` missing when calling loginUser."
}
$LocalVarQueryParameters['password'] = $Password
$LocalVarResult = Invoke-PSApiClient -Method 'GET' `
-Uri $LocalVarUri `
-Accepts $LocalVarAccepts `
-ContentTypes $LocalVarContentTypes `
-Body $LocalVarBodyParameter `
-HeaderParameters $LocalVarHeaderParameters `
-QueryParameters $LocalVarQueryParameters `
-FormParameters $LocalVarFormParameters `
-CookieParameters $LocalVarCookieParameters `
-ReturnType "String"
if ($WithHttpInfo.IsPresent) {
return $LocalVarResult
} else {
return $LocalVarResult["Response"]
}
}
}
<#
.SYNOPSIS
Logs out current logged in user session
.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
None
#>
function Invoke-PSLogoutUser {
[CmdletBinding()]
Param (
[Switch]
$WithHttpInfo
)
Process {
'Calling method: Invoke-PSLogoutUser' | Write-Debug
$PSBoundParameters | Out-DebugParameter | Write-Debug
$LocalVarAccepts = @()
$LocalVarContentTypes = @()
$LocalVarQueryParameters = @{}
$LocalVarHeaderParameters = @{}
$LocalVarFormParameters = @{}
$LocalVarPathParameters = @{}
$LocalVarCookieParameters = @{}
$LocalVarBodyParameter = $null
$Configuration = Get-PSConfiguration
$LocalVarUri = '/user/logout'
if ($Configuration["Cookie"]) {
$LocalVarCookieParameters['auth_cookie'] = $Configuration["Cookie"]
Write-Verbose ("Using API key `auth_cookie` in the cookie for authentication in {0}" -f $MyInvocation.MyCommand)
}
$LocalVarResult = Invoke-PSApiClient -Method 'GET' `
-Uri $LocalVarUri `
-Accepts $LocalVarAccepts `
-ContentTypes $LocalVarContentTypes `
-Body $LocalVarBodyParameter `
-HeaderParameters $LocalVarHeaderParameters `
-QueryParameters $LocalVarQueryParameters `
-FormParameters $LocalVarFormParameters `
-CookieParameters $LocalVarCookieParameters `
-ReturnType ""
if ($WithHttpInfo.IsPresent) {
return $LocalVarResult
} else {
return $LocalVarResult["Response"]
}
}
}
<#
.SYNOPSIS
Updated user
.DESCRIPTION
No description available.
.PARAMETER Username
name that need to be deleted
.PARAMETER User
Updated user object
.PARAMETER WithHttpInfo
A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response
.OUTPUTS
None
#>
function Update-PSUser {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
[String]
${Username},
[Parameter(Position = 1, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
[PSCustomObject]
${User},
[Switch]
$WithHttpInfo
)
Process {
'Calling method: Update-PSUser' | Write-Debug
$PSBoundParameters | Out-DebugParameter | Write-Debug
$LocalVarAccepts = @()
$LocalVarContentTypes = @()
$LocalVarQueryParameters = @{}
$LocalVarHeaderParameters = @{}
$LocalVarFormParameters = @{}
$LocalVarPathParameters = @{}
$LocalVarCookieParameters = @{}
$LocalVarBodyParameter = $null
$Configuration = Get-PSConfiguration
# HTTP header 'Content-Type'
$LocalVarContentTypes = @('application/json')
$LocalVarUri = '/user/{username}'
if (!$Username) {
throw "Error! The required parameter `Username` missing when calling updateUser."
}
$LocalVarUri = $LocalVarUri.replace('{username}', $Username)
if (!$User) {
throw "Error! The required parameter `User` missing when calling updateUser."
}
$LocalVarBodyParameter = $User | ConvertTo-Json
if ($Configuration["Cookie"]) {
$LocalVarCookieParameters['auth_cookie'] = $Configuration["Cookie"]
Write-Verbose ("Using API key `auth_cookie` in the cookie for authentication in {0}" -f $MyInvocation.MyCommand)
}
$LocalVarResult = Invoke-PSApiClient -Method 'PUT' `
-Uri $LocalVarUri `
-Accepts $LocalVarAccepts `
-ContentTypes $LocalVarContentTypes `
-Body $LocalVarBodyParameter `
-HeaderParameters $LocalVarHeaderParameters `
-QueryParameters $LocalVarQueryParameters `
-FormParameters $LocalVarFormParameters `
-CookieParameters $LocalVarCookieParameters `
-ReturnType ""
if ($WithHttpInfo.IsPresent) {
return $LocalVarResult
} else {
return $LocalVarResult["Response"]
}
}
}

View File

@@ -0,0 +1,391 @@
#
# OpenAPI Petstore
# This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
# Version: 1.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#
<#
.SYNOPSIS
Get the configuration object 'PSConfiguration'.
.DESCRIPTION
Get the configuration object 'PSConfiguration'.
.OUTPUTS
System.Collections.Hashtable
#>
function Get-PSConfiguration {
$Configuration = $Script:Configuration
if ([string]::IsNullOrEmpty($Configuration["BaseUrl"])) {
$Configuration["BaseUrl"] = "http://petstore.swagger.io:80/v2";
}
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
}
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 Passowrd
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 PassThru
Return an object of the Configuration
.OUTPUTS
System.Collections.Hashtable
#>
function Set-PSConfiguration {
[CmdletBinding()]
Param(
[string]$BaseUrl,
[AllowEmptyString()]
[string]$Username,
[AllowEmptyString()]
[string]$Password,
[hashtable]$ApiKey,
[hashtable]$ApiKeyPrefix,
[AllowEmptyString()]
[string]$Cookie,
[AllowEmptyString()]
[string]$AccessToken,
[switch]$SkipCertificateCheck,
[hashtable]$DefaultHeaders,
[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 ($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-PSConfigurationApiKey {
[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-PSConfigurationApiKeyPrefix {
[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-PSConfigurationDefaultHeader {
[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-PSHostSetting {
return ,@(
@{
"Url" = "http://{server}.swagger.io:{port}/v2";
"Description" = "petstore server";
"Variables" = @{
"server" = @{
"Description" = "No description provided";
"DefaultValue" = "petstore";
"EnumValues" = @(
"petstore",
"qa-petstore",
"dev-petstore"
)
};
"port" = @{
"Description" = "No description provided";
"DefaultValue" = "80";
"EnumValues" = @(
"80",
"8080"
)
}
}
},
@{
"Url" = "https://localhost:8080/{version}";
"Description" = "The local server";
"Variables" = @{
"version" = @{
"Description" = "No description provided";
"DefaultValue" = "v2";
"EnumValues" = @(
"v1",
"v2"
)
}
}
}
)
}
<#
.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-PSUrlFromHostSetting {
[CmdletBinding()]
Param(
[Parameter(ValueFromPipeline = $true)]
[Int]$Index,
[Hashtable]$Variables = @{}
)
Process {
$Hosts = Get-PSHostSetting
# 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;
}
}

View File

@@ -0,0 +1,57 @@
#
# OpenAPI Petstore
# This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
# Version: 1.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#
<#
.SYNOPSIS
No summary available.
.DESCRIPTION
Describes the result of uploading an image resource
.PARAMETER Code
No description available.
.PARAMETER Type
No description available.
.PARAMETER Message
No description available.
.OUTPUTS
ApiResponse<PSCustomObject>
#>
function Initialize-PSApiResponse {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
[System.Nullable[Int32]]
${Code},
[Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)]
[String]
${Type},
[Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)]
[String]
${Message}
)
Process {
'Creating PSCustomObject: PSPetstore => PSApiResponse' | Write-Debug
$PSBoundParameters | Out-DebugParameter | Write-Debug
$PSO = [PSCustomObject]@{
"code" = ${Code}
"type" = ${Type}
"message" = ${Message}
}
return $PSO
}
}

View File

@@ -0,0 +1,51 @@
#
# OpenAPI Petstore
# This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
# Version: 1.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#
<#
.SYNOPSIS
No summary available.
.DESCRIPTION
A category for a pet
.PARAMETER Id
No description available.
.PARAMETER Name
No description available.
.OUTPUTS
Category<PSCustomObject>
#>
function Initialize-PSCategory {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
[System.Nullable[Int64]]
${Id},
[Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)]
[ValidatePattern("^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$")]
[String]
${Name}
)
Process {
'Creating PSCustomObject: PSPetstore => PSCategory' | Write-Debug
$PSBoundParameters | Out-DebugParameter | Write-Debug
$PSO = [PSCustomObject]@{
"id" = ${Id}
"name" = ${Name}
}
return $PSO
}
}

View File

@@ -0,0 +1,50 @@
#
# OpenAPI Petstore
# This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
# Version: 1.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#
<#
.SYNOPSIS
No summary available.
.DESCRIPTION
No description available.
.PARAMETER Name
Updated name of the pet
.PARAMETER Status
Updated status of the pet
.OUTPUTS
InlineObject<PSCustomObject>
#>
function Initialize-PSInlineObject {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
[String]
${Name},
[Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)]
[String]
${Status}
)
Process {
'Creating PSCustomObject: PSPetstore => PSInlineObject' | Write-Debug
$PSBoundParameters | Out-DebugParameter | Write-Debug
$PSO = [PSCustomObject]@{
"name" = ${Name}
"status" = ${Status}
}
return $PSO
}
}

View File

@@ -0,0 +1,50 @@
#
# OpenAPI Petstore
# This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
# Version: 1.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#
<#
.SYNOPSIS
No summary available.
.DESCRIPTION
No description available.
.PARAMETER AdditionalMetadata
Additional data to pass to server
.PARAMETER File
file to upload
.OUTPUTS
InlineObject1<PSCustomObject>
#>
function Initialize-PSInlineObject1 {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
[String]
${AdditionalMetadata},
[Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)]
[System.IO.FileInfo]
${File}
)
Process {
'Creating PSCustomObject: PSPetstore => PSInlineObject1' | Write-Debug
$PSBoundParameters | Out-DebugParameter | Write-Debug
$PSO = [PSCustomObject]@{
"additionalMetadata" = ${AdditionalMetadata}
"file" = ${File}
}
return $PSO
}
}

View File

@@ -0,0 +1,79 @@
#
# OpenAPI Petstore
# This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
# Version: 1.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#
<#
.SYNOPSIS
No summary available.
.DESCRIPTION
An order for a pets from the pet store
.PARAMETER Id
No description available.
.PARAMETER PetId
No description available.
.PARAMETER Quantity
No description available.
.PARAMETER ShipDate
No description available.
.PARAMETER Status
Order Status
.PARAMETER Complete
No description available.
.OUTPUTS
Order<PSCustomObject>
#>
function Initialize-PSOrder {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
[System.Nullable[Int64]]
${Id},
[Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)]
[System.Nullable[Int64]]
${PetId},
[Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)]
[System.Nullable[Int32]]
${Quantity},
[Parameter(Position = 3, ValueFromPipelineByPropertyName = $true)]
[System.Nullable[System.DateTime]]
${ShipDate},
[Parameter(Position = 4, ValueFromPipelineByPropertyName = $true)]
[ValidateSet("placed", "approved", "delivered")]
[String]
${Status},
[Parameter(Position = 5, ValueFromPipelineByPropertyName = $true)]
[System.Nullable[Boolean]]
${Complete}
)
Process {
'Creating PSCustomObject: PSPetstore => PSOrder' | Write-Debug
$PSBoundParameters | Out-DebugParameter | Write-Debug
$PSO = [PSCustomObject]@{
"id" = ${Id}
"petId" = ${PetId}
"quantity" = ${Quantity}
"shipDate" = ${ShipDate}
"status" = ${Status}
"complete" = ${Complete}
}
return $PSO
}
}

View File

@@ -0,0 +1,87 @@
#
# OpenAPI Petstore
# This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
# Version: 1.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#
<#
.SYNOPSIS
No summary available.
.DESCRIPTION
A pet for sale in the pet store
.PARAMETER Id
No description available.
.PARAMETER Category
No description available.
.PARAMETER Name
No description available.
.PARAMETER PhotoUrls
No description available.
.PARAMETER Tags
No description available.
.PARAMETER Status
pet status in the store
.OUTPUTS
Pet<PSCustomObject>
#>
function Initialize-PSPet {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
[System.Nullable[Int64]]
${Id},
[Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)]
[PSCustomObject]
${Category},
[Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)]
[String]
${Name},
[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: PSPetstore => PSPet' | Write-Debug
$PSBoundParameters | Out-DebugParameter | Write-Debug
if (!$Name) {
throw "invalid value for 'Name', 'Name' cannot be null."
}
if (!$PhotoUrls) {
throw "invalid value for 'PhotoUrls', 'PhotoUrls' cannot be null."
}
$PSO = [PSCustomObject]@{
"id" = ${Id}
"category" = ${Category}
"name" = ${Name}
"photoUrls" = ${PhotoUrls}
"tags" = ${Tags}
"status" = ${Status}
}
return $PSO
}
}

View File

@@ -0,0 +1,50 @@
#
# OpenAPI Petstore
# This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
# Version: 1.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#
<#
.SYNOPSIS
No summary available.
.DESCRIPTION
A tag for a pet
.PARAMETER Id
No description available.
.PARAMETER Name
No description available.
.OUTPUTS
Tag<PSCustomObject>
#>
function Initialize-PSTag {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
[System.Nullable[Int64]]
${Id},
[Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)]
[String]
${Name}
)
Process {
'Creating PSCustomObject: PSPetstore => PSTag' | Write-Debug
$PSBoundParameters | Out-DebugParameter | Write-Debug
$PSO = [PSCustomObject]@{
"id" = ${Id}
"name" = ${Name}
}
return $PSO
}
}

View File

@@ -0,0 +1,93 @@
#
# OpenAPI Petstore
# This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
# Version: 1.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#
<#
.SYNOPSIS
No summary available.
.DESCRIPTION
A User who is purchasing from the pet store
.PARAMETER Id
No description available.
.PARAMETER Username
No description available.
.PARAMETER FirstName
No description available.
.PARAMETER LastName
No description available.
.PARAMETER Email
No description available.
.PARAMETER Password
No description available.
.PARAMETER Phone
No description available.
.PARAMETER UserStatus
User Status
.OUTPUTS
User<PSCustomObject>
#>
function Initialize-PSUser {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
[System.Nullable[Int64]]
${Id},
[Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)]
[String]
${Username},
[Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)]
[String]
${FirstName},
[Parameter(Position = 3, ValueFromPipelineByPropertyName = $true)]
[String]
${LastName},
[Parameter(Position = 4, ValueFromPipelineByPropertyName = $true)]
[String]
${Email},
[Parameter(Position = 5, ValueFromPipelineByPropertyName = $true)]
[ValidatePattern("[""A-Z]+-[0-9][0-9]")]
[String]
${Password},
[Parameter(Position = 6, ValueFromPipelineByPropertyName = $true)]
[String]
${Phone},
[Parameter(Position = 7, ValueFromPipelineByPropertyName = $true)]
[System.Nullable[Int32]]
${UserStatus}
)
Process {
'Creating PSCustomObject: PSPetstore => PSUser' | Write-Debug
$PSBoundParameters | Out-DebugParameter | Write-Debug
$PSO = [PSCustomObject]@{
"id" = ${Id}
"username" = ${Username}
"firstName" = ${FirstName}
"lastName" = ${LastName}
"email" = ${Email}
"password" = ${Password}
"phone" = ${Phone}
"userStatus" = ${UserStatus}
}
return $PSO
}
}

View File

@@ -1,18 +1,18 @@
#
# Module manifest for module 'Org.OpenAPITools'
# Module manifest for module 'PSPetstore'
#
# Generated by: OpenAPI Generator Team
#
# Generated on: 3/29/20
# Generated on: 4/19/20
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'Org.OpenAPITools.psm1'
RootModule = 'PSPetstore.psm1'
# Version number of this module.
ModuleVersion = '0.0.1'
ModuleVersion = '0.1.2'
# Supported PSEditions
# CompatiblePSEditions = @()
@@ -30,7 +30,7 @@ CompanyName = 'openapitools.org'
Copyright = '(c) OpenAPI Generator Team. All rights reserved.'
# Description of the functionality provided by this module
Description = 'Org.OpenAPITools - the PowerShell module for OpenAPI Petstore'
Description = 'PSPetstore - the PowerShell module for OpenAPI Petstore'
# Minimum version of the PowerShell engine required by this module
PowerShellVersion = '3.0'
@@ -69,20 +69,20 @@ PowerShellVersion = '3.0'
# NestedModules = @()
# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
FunctionsToExport = 'Invoke-PetApiAddPet', 'Invoke-PetApiDeletePet',
'Invoke-PetApiFindPetsByStatus', 'Invoke-PetApiFindPetsByTags',
'Invoke-PetApiGetPetById', 'Invoke-PetApiUpdatePet',
'Invoke-PetApiUpdatePetWithForm', 'Invoke-PetApiUploadFile',
'Invoke-StoreApiDeleteOrder', 'Invoke-StoreApiGetInventory',
'Invoke-StoreApiGetOrderById', 'Invoke-StoreApiPlaceOrder',
'Invoke-UserApiCreateUser',
'Invoke-UserApiCreateUsersWithArrayInput',
'Invoke-UserApiCreateUsersWithListInput',
'Invoke-UserApiDeleteUser', 'Invoke-UserApiGetUserByName',
'Invoke-UserApiLoginUser', 'Invoke-UserApiLogoutUser',
'Invoke-UserApiUpdateUser', 'New-ApiResponse', 'New-Category',
'New-InlineObject', 'New-InlineObject1', 'New-Order', 'New-Pet',
'New-Tag', 'New-User'
FunctionsToExport = 'Add-PSPet', 'Remove-Pet', 'Find-PSPetsByStatus', 'Find-PSPetsByTags',
'Get-PSPetById', 'Update-PSPet', 'Update-PSPetWithForm',
'Invoke-PSUploadFile', 'Remove-PSOrder', 'Get-PSInventory',
'Get-PSOrderById', 'Invoke-PSPlaceOrder', 'New-PSUser',
'New-PSUsersWithArrayInput', 'New-PSUsersWithListInput',
'Remove-PSUser', 'Get-PSUserByName', 'Invoke-PSLoginUser',
'Invoke-PSLogoutUser', 'Update-PSUser', 'Initialize-PSApiResponse',
'Initialize-PSCategory', 'Initialize-PSInlineObject',
'Initialize-PSInlineObject1', 'Initialize-PSOrder',
'Initialize-PSPet', 'Initialize-PSTag', 'Initialize-PSUser',
'Get-PSConfiguration', 'Set-PSConfiguration',
'Set-PSConfigurationApiKey', 'Set-PSConfigurationApiKeyPrefix',
'Set-PSConfigurationDefaultHeader', 'Get-PSHostSetting',
'Get-PSUrlFromHostSetting'
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
CmdletsToExport = @()

View File

@@ -0,0 +1,29 @@
#
# OpenAPI Petstore
# This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
# Version: 1.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#
#region Import functions
# 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

View File

@@ -1,3 +1,10 @@
#
# OpenAPI Petstore
# This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
# Version: 1.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#
<#
.Synopsis
Helper function to get common parameters (Verbose, Debug, etc.)

View File

@@ -1,3 +1,10 @@
#
# OpenAPI Petstore
# This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
# Version: 1.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#
<#
.Synopsis
Helper function to format debug parameter output.

View File

@@ -0,0 +1,209 @@
#
# OpenAPI Petstore
# This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
# Version: 1.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#
function Invoke-PSApiClient {
[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
)
'Calling method: Invoke-PSApiClient' | Write-Debug
$PSBoundParameters | Out-DebugParameter | Write-Debug
$Configuration = Get-PSConfiguration
$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 "Multipe cookie parameters found. Curently only the first one is supported/used"
}
# accept, content-type headers
$Accept = SelectHeaders -Headers $Accepts
if ($Accept) {
$HeaderParameters['Accept'] = $Accept
}
$ContentType= SelectHeaders -Headers $ContentTypes
if ($ContentType) {
$HeaderParameters['Content-Type'] = $ContentType
}
# add default headers if any
foreach ($header in $Configuration["DefaultHeaders"].GetEnumerator()) {
$HeaderParameters[$header.Name] = $header.Value
}
# constrcut 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) {
$RequestBody = $FormParameters
}
if ($Body) {
$RequestBody = $Body
}
# http signature authentication
if ($null -ne $Configuration['ApiKey'] -and $Configuration['ApiKey'].Count -gt 0) {
$httpSignHeaderArgument = @{
Method = $Method
UriBuilder = $UriBuilder
Body = $Body
}
$signedHeader = Get-PSHttpSignedHeader @httpSignHeaderArgument
if($null -ne $signedHeader -and $signedHeader.Count -gt 0){
foreach($item in $signedHeader.GetEnumerator()){
$HeaderParameters[$item.Name] = $item.Value
}
}
}
if ($SkipCertificateCheck -eq $true) {
$Response = Invoke-WebRequest -Uri $UriBuilder.Uri `
-Method $Method `
-Headers $HeaderParameters `
-Body $RequestBody `
-ErrorAction Stop `
-UseBasicParsing `
-SkipCertificateCheck
} else {
$Response = Invoke-WebRequest -Uri $UriBuilder.Uri `
-Method $Method `
-Headers $HeaderParameters `
-Body $RequestBody `
-ErrorAction Stop `
-UseBasicParsing
}
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 ([string]::IsNullOrEmpty($ReturnType)) { # 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
}
}
}

View File

@@ -1,8 +1,8 @@
PSTOPIC
about_Org.OpenAPITools
about_PSPetstore
SHORT DESCRIPTION
Org.OpenAPITools - the PowerShell module for the OpenAPI Petstore
PSPetstore - the PowerShell module for the OpenAPI Petstore
LONG DESCRIPTION
This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
@@ -10,7 +10,7 @@ LONG DESCRIPTION
This PowerShell module is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
- API version: 1.0.0
- SDK version:
- SDK version: 0.1.2
- Build package: org.openapitools.codegen.languages.PowerShellClientCodegen
Frameworks supported:

View File

@@ -1,2 +0,0 @@
## TODO we need to update the template to test the model files

View File

@@ -1,2 +0,0 @@
## TODO we need to update the template to test the model files

View File

@@ -1,2 +0,0 @@
## TODO we need to update the template to test the model files

View File

@@ -1,2 +0,0 @@
## TODO we need to update the template to test the model files

View File

@@ -1,2 +0,0 @@
## TODO we need to update the template to test the model files

View File

@@ -1,69 +0,0 @@
# This file is auto-generated by OpenAPI Generator (https://openapi-generator.tech)
# Please replace "TEST_VALUE" with a proper value and uncomment the code for testing the function
Describe 'Org.OpenAPITools PetApi' {
Context 'PetApi' {
It 'Invoke-PetApiAddPet' {
$ret = Invoke-PetApiGetPetById -pet "TEST_VALUE"
#$ret | Should BeOfType Org.OpenAPITools.Model.ModelNameHere
#$ret.property | Should Be 0
}
}
Context 'PetApi' {
It 'Invoke-PetApiDeletePet' {
$ret = Invoke-PetApiGetPetById -petId "TEST_VALUE" -apiKey "TEST_VALUE"
#$ret | Should BeOfType Org.OpenAPITools.Model.ModelNameHere
#$ret.property | Should Be 0
}
}
Context 'PetApi' {
It 'Invoke-PetApiFindPetsByStatus' {
$ret = Invoke-PetApiGetPetById -status "TEST_VALUE"
#$ret | Should BeOfType Org.OpenAPITools.Model.ModelNameHere
#$ret.property | Should Be 0
}
}
Context 'PetApi' {
It 'Invoke-PetApiFindPetsByTags' {
$ret = Invoke-PetApiGetPetById -tags "TEST_VALUE"
#$ret | Should BeOfType Org.OpenAPITools.Model.ModelNameHere
#$ret.property | Should Be 0
}
}
Context 'PetApi' {
It 'Invoke-PetApiGetPetById' {
$ret = Invoke-PetApiGetPetById -petId "TEST_VALUE"
#$ret | Should BeOfType Org.OpenAPITools.Model.ModelNameHere
#$ret.property | Should Be 0
}
}
Context 'PetApi' {
It 'Invoke-PetApiUpdatePet' {
$ret = Invoke-PetApiGetPetById -pet "TEST_VALUE"
#$ret | Should BeOfType Org.OpenAPITools.Model.ModelNameHere
#$ret.property | Should Be 0
}
}
Context 'PetApi' {
It 'Invoke-PetApiUpdatePetWithForm' {
$ret = Invoke-PetApiGetPetById -petId "TEST_VALUE" -name "TEST_VALUE" -status "TEST_VALUE"
#$ret | Should BeOfType Org.OpenAPITools.Model.ModelNameHere
#$ret.property | Should Be 0
}
}
Context 'PetApi' {
It 'Invoke-PetApiUploadFile' {
$ret = Invoke-PetApiGetPetById -petId "TEST_VALUE" -additionalMetadata "TEST_VALUE" -file "TEST_VALUE"
#$ret | Should BeOfType Org.OpenAPITools.Model.ModelNameHere
#$ret.property | Should Be 0
}
}
}

View File

@@ -1,2 +0,0 @@
## TODO we need to update the template to test the model files

View File

@@ -1,37 +0,0 @@
# This file is auto-generated by OpenAPI Generator (https://openapi-generator.tech)
# Please replace "TEST_VALUE" with a proper value and uncomment the code for testing the function
Describe 'Org.OpenAPITools StoreApi' {
Context 'StoreApi' {
It 'Invoke-StoreApiDeleteOrder' {
$ret = Invoke-PetApiGetPetById -orderId "TEST_VALUE"
#$ret | Should BeOfType Org.OpenAPITools.Model.ModelNameHere
#$ret.property | Should Be 0
}
}
Context 'StoreApi' {
It 'Invoke-StoreApiGetInventory' {
$ret = Invoke-PetApiGetPetById
#$ret | Should BeOfType Org.OpenAPITools.Model.ModelNameHere
#$ret.property | Should Be 0
}
}
Context 'StoreApi' {
It 'Invoke-StoreApiGetOrderById' {
$ret = Invoke-PetApiGetPetById -orderId "TEST_VALUE"
#$ret | Should BeOfType Org.OpenAPITools.Model.ModelNameHere
#$ret.property | Should Be 0
}
}
Context 'StoreApi' {
It 'Invoke-StoreApiPlaceOrder' {
$ret = Invoke-PetApiGetPetById -order "TEST_VALUE"
#$ret | Should BeOfType Org.OpenAPITools.Model.ModelNameHere
#$ret.property | Should Be 0
}
}
}

View File

@@ -1,2 +0,0 @@
## TODO we need to update the template to test the model files

View File

@@ -1,69 +0,0 @@
# This file is auto-generated by OpenAPI Generator (https://openapi-generator.tech)
# Please replace "TEST_VALUE" with a proper value and uncomment the code for testing the function
Describe 'Org.OpenAPITools UserApi' {
Context 'UserApi' {
It 'Invoke-UserApiCreateUser' {
$ret = Invoke-PetApiGetPetById -user "TEST_VALUE"
#$ret | Should BeOfType Org.OpenAPITools.Model.ModelNameHere
#$ret.property | Should Be 0
}
}
Context 'UserApi' {
It 'Invoke-UserApiCreateUsersWithArrayInput' {
$ret = Invoke-PetApiGetPetById -user "TEST_VALUE"
#$ret | Should BeOfType Org.OpenAPITools.Model.ModelNameHere
#$ret.property | Should Be 0
}
}
Context 'UserApi' {
It 'Invoke-UserApiCreateUsersWithListInput' {
$ret = Invoke-PetApiGetPetById -user "TEST_VALUE"
#$ret | Should BeOfType Org.OpenAPITools.Model.ModelNameHere
#$ret.property | Should Be 0
}
}
Context 'UserApi' {
It 'Invoke-UserApiDeleteUser' {
$ret = Invoke-PetApiGetPetById -username "TEST_VALUE"
#$ret | Should BeOfType Org.OpenAPITools.Model.ModelNameHere
#$ret.property | Should Be 0
}
}
Context 'UserApi' {
It 'Invoke-UserApiGetUserByName' {
$ret = Invoke-PetApiGetPetById -username "TEST_VALUE"
#$ret | Should BeOfType Org.OpenAPITools.Model.ModelNameHere
#$ret.property | Should Be 0
}
}
Context 'UserApi' {
It 'Invoke-UserApiLoginUser' {
$ret = Invoke-PetApiGetPetById -username "TEST_VALUE" -password "TEST_VALUE"
#$ret | Should BeOfType Org.OpenAPITools.Model.ModelNameHere
#$ret.property | Should Be 0
}
}
Context 'UserApi' {
It 'Invoke-UserApiLogoutUser' {
$ret = Invoke-PetApiGetPetById
#$ret | Should BeOfType Org.OpenAPITools.Model.ModelNameHere
#$ret.property | Should Be 0
}
}
Context 'UserApi' {
It 'Invoke-UserApiUpdateUser' {
$ret = Invoke-PetApiGetPetById -username "TEST_VALUE" -user "TEST_VALUE"
#$ret | Should BeOfType Org.OpenAPITools.Model.ModelNameHere
#$ret.property | Should Be 0
}
}
}

View File

@@ -1,2 +0,0 @@
## TODO we need to update the template to test the model files

View File

@@ -0,0 +1,73 @@
#
# OpenAPI Petstore
# This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
# Version: 1.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#
Describe -tag 'PSPetstore' -name 'PSPetApi' {
Context 'Add-PSPet' {
It 'Test Add-PSPet' {
#$TestResult = Invoke-PetApiGetPetById -Pet "TEST_VALUE"
#$TestResult | Should BeOfType TODO
#$TestResult.property | Should Be 0
}
}
Context 'Remove-Pet' {
It 'Test Remove-Pet' {
#$TestResult = Invoke-PetApiGetPetById -PetId "TEST_VALUE" -ApiKey "TEST_VALUE"
#$TestResult | Should BeOfType TODO
#$TestResult.property | Should Be 0
}
}
Context 'Find-PSPetsByStatus' {
It 'Test Find-PSPetsByStatus' {
#$TestResult = Invoke-PetApiGetPetById -Status "TEST_VALUE"
#$TestResult | Should BeOfType TODO
#$TestResult.property | Should Be 0
}
}
Context 'Find-PSPetsByTags' {
It 'Test Find-PSPetsByTags' {
#$TestResult = Invoke-PetApiGetPetById -Tags "TEST_VALUE"
#$TestResult | Should BeOfType TODO
#$TestResult.property | Should Be 0
}
}
Context 'Get-PSPetById' {
It 'Test Get-PSPetById' {
#$TestResult = Invoke-PetApiGetPetById -PetId "TEST_VALUE"
#$TestResult | Should BeOfType TODO
#$TestResult.property | Should Be 0
}
}
Context 'Update-PSPet' {
It 'Test Update-PSPet' {
#$TestResult = Invoke-PetApiGetPetById -Pet "TEST_VALUE"
#$TestResult | Should BeOfType TODO
#$TestResult.property | Should Be 0
}
}
Context 'Update-PSPetWithForm' {
It 'Test Update-PSPetWithForm' {
#$TestResult = Invoke-PetApiGetPetById -PetId "TEST_VALUE" -Name "TEST_VALUE" -Status "TEST_VALUE"
#$TestResult | Should BeOfType TODO
#$TestResult.property | Should Be 0
}
}
Context 'Invoke-PSUploadFile' {
It 'Test Invoke-PSUploadFile' {
#$TestResult = Invoke-PetApiGetPetById -PetId "TEST_VALUE" -AdditionalMetadata "TEST_VALUE" -File "TEST_VALUE"
#$TestResult | Should BeOfType TODO
#$TestResult.property | Should Be 0
}
}
}

View File

@@ -0,0 +1,41 @@
#
# OpenAPI Petstore
# This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
# Version: 1.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#
Describe -tag 'PSPetstore' -name 'PSStoreApi' {
Context 'Remove-PSOrder' {
It 'Test Remove-PSOrder' {
#$TestResult = Invoke-PetApiGetPetById -OrderId "TEST_VALUE"
#$TestResult | Should BeOfType TODO
#$TestResult.property | Should Be 0
}
}
Context 'Get-PSInventory' {
It 'Test Get-PSInventory' {
#$TestResult = Invoke-PetApiGetPetById
#$TestResult | Should BeOfType TODO
#$TestResult.property | Should Be 0
}
}
Context 'Get-PSOrderById' {
It 'Test Get-PSOrderById' {
#$TestResult = Invoke-PetApiGetPetById -OrderId "TEST_VALUE"
#$TestResult | Should BeOfType TODO
#$TestResult.property | Should Be 0
}
}
Context 'Invoke-PSPlaceOrder' {
It 'Test Invoke-PSPlaceOrder' {
#$TestResult = Invoke-PetApiGetPetById -Order "TEST_VALUE"
#$TestResult | Should BeOfType TODO
#$TestResult.property | Should Be 0
}
}
}

View File

@@ -0,0 +1,73 @@
#
# OpenAPI Petstore
# This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
# Version: 1.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#
Describe -tag 'PSPetstore' -name 'PSUserApi' {
Context 'New-PSUser' {
It 'Test New-PSUser' {
#$TestResult = Invoke-PetApiGetPetById -User "TEST_VALUE"
#$TestResult | Should BeOfType TODO
#$TestResult.property | Should Be 0
}
}
Context 'New-PSUsersWithArrayInput' {
It 'Test New-PSUsersWithArrayInput' {
#$TestResult = Invoke-PetApiGetPetById -User "TEST_VALUE"
#$TestResult | Should BeOfType TODO
#$TestResult.property | Should Be 0
}
}
Context 'New-PSUsersWithListInput' {
It 'Test New-PSUsersWithListInput' {
#$TestResult = Invoke-PetApiGetPetById -User "TEST_VALUE"
#$TestResult | Should BeOfType TODO
#$TestResult.property | Should Be 0
}
}
Context 'Remove-PSUser' {
It 'Test Remove-PSUser' {
#$TestResult = Invoke-PetApiGetPetById -Username "TEST_VALUE"
#$TestResult | Should BeOfType TODO
#$TestResult.property | Should Be 0
}
}
Context 'Get-PSUserByName' {
It 'Test Get-PSUserByName' {
#$TestResult = Invoke-PetApiGetPetById -Username "TEST_VALUE"
#$TestResult | Should BeOfType TODO
#$TestResult.property | Should Be 0
}
}
Context 'Invoke-PSLoginUser' {
It 'Test Invoke-PSLoginUser' {
#$TestResult = Invoke-PetApiGetPetById -Username "TEST_VALUE" -Password "TEST_VALUE"
#$TestResult | Should BeOfType TODO
#$TestResult.property | Should Be 0
}
}
Context 'Invoke-PSLogoutUser' {
It 'Test Invoke-PSLogoutUser' {
#$TestResult = Invoke-PetApiGetPetById
#$TestResult | Should BeOfType TODO
#$TestResult.property | Should Be 0
}
}
Context 'Update-PSUser' {
It 'Test Update-PSUser' {
#$TestResult = Invoke-PetApiGetPetById -Username "TEST_VALUE" -User "TEST_VALUE"
#$TestResult | Should BeOfType TODO
#$TestResult.property | Should Be 0
}
}
}

View File

@@ -0,0 +1,17 @@
#
# OpenAPI Petstore
# This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
# Version: 1.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#
Describe -tag 'PSPetstore' -name 'ApiResponse' {
Context 'ApiResponse' {
It 'New-ApiResponse' {
# a simple test to create an object
#$NewObject = New-ApiResponse -Code "TEST_VALUE" -Type "TEST_VALUE" -Message "TEST_VALUE"
#$NewObject | Should BeOfType ApiResponse
#$NewObject.property | Should Be 0
}
}
}

View File

@@ -0,0 +1,17 @@
#
# OpenAPI Petstore
# This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
# Version: 1.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#
Describe -tag 'PSPetstore' -name 'Category' {
Context 'Category' {
It 'New-Category' {
# a simple test to create an object
#$NewObject = New-Category -Id "TEST_VALUE" -Name "TEST_VALUE"
#$NewObject | Should BeOfType Category
#$NewObject.property | Should Be 0
}
}
}

View File

@@ -0,0 +1,17 @@
#
# OpenAPI Petstore
# This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
# Version: 1.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#
Describe -tag 'PSPetstore' -name 'InlineObject' {
Context 'InlineObject' {
It 'New-InlineObject' {
# a simple test to create an object
#$NewObject = New-InlineObject -Name "TEST_VALUE" -Status "TEST_VALUE"
#$NewObject | Should BeOfType InlineObject
#$NewObject.property | Should Be 0
}
}
}

View File

@@ -0,0 +1,17 @@
#
# OpenAPI Petstore
# This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
# Version: 1.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#
Describe -tag 'PSPetstore' -name 'InlineObject1' {
Context 'InlineObject1' {
It 'New-InlineObject1' {
# a simple test to create an object
#$NewObject = New-InlineObject1 -AdditionalMetadata "TEST_VALUE" -File "TEST_VALUE"
#$NewObject | Should BeOfType InlineObject1
#$NewObject.property | Should Be 0
}
}
}

View File

@@ -0,0 +1,17 @@
#
# OpenAPI Petstore
# This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
# Version: 1.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#
Describe -tag 'PSPetstore' -name 'Order' {
Context 'Order' {
It 'New-Order' {
# a simple test to create an object
#$NewObject = New-Order -Id "TEST_VALUE" -PetId "TEST_VALUE" -Quantity "TEST_VALUE" -ShipDate "TEST_VALUE" -Status "TEST_VALUE" -Complete "TEST_VALUE"
#$NewObject | Should BeOfType Order
#$NewObject.property | Should Be 0
}
}
}

View File

@@ -0,0 +1,17 @@
#
# OpenAPI Petstore
# This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
# Version: 1.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#
Describe -tag 'PSPetstore' -name 'Pet' {
Context 'Pet' {
It 'New-Pet' {
# a simple test to create an object
#$NewObject = New-Pet -Id "TEST_VALUE" -Category "TEST_VALUE" -Name "TEST_VALUE" -PhotoUrls "TEST_VALUE" -Tags "TEST_VALUE" -Status "TEST_VALUE"
#$NewObject | Should BeOfType Pet
#$NewObject.property | Should Be 0
}
}
}

View File

@@ -0,0 +1,17 @@
#
# OpenAPI Petstore
# This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
# Version: 1.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#
Describe -tag 'PSPetstore' -name 'Tag' {
Context 'Tag' {
It 'New-Tag' {
# a simple test to create an object
#$NewObject = New-Tag -Id "TEST_VALUE" -Name "TEST_VALUE"
#$NewObject | Should BeOfType Tag
#$NewObject.property | Should Be 0
}
}
}

View File

@@ -0,0 +1,17 @@
#
# OpenAPI Petstore
# This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
# Version: 1.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#
Describe -tag 'PSPetstore' -name 'User' {
Context 'User' {
It 'New-User' {
# a simple test to create an object
#$NewObject = New-User -Id "TEST_VALUE" -Username "TEST_VALUE" -FirstName "TEST_VALUE" -LastName "TEST_VALUE" -Email "TEST_VALUE" -Password "TEST_VALUE" -Phone "TEST_VALUE" -UserStatus "TEST_VALUE"
#$NewObject | Should BeOfType User
#$NewObject.property | Should Be 0
}
}
}

View File

@@ -0,0 +1,177 @@
#
# OpenAPI Petstore
# This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
# Version: 1.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#
Describe -tag 'PSOpenAPITools' -name 'Integration Tests' {
Context 'Pet' {
It 'CRUD tests' {
$Id = 38369
# Add pet
$Pet = Initialize-PSPet -Id $Id -Name 'PowerShell' -Category (
Initialize-PSCategory -Id $Id -Name 'PSCategory'
) -PhotoUrls @(
'http://example.com/foo',
'http://example.com/bar'
) -Tags (
Initialize-PSTag -Id $Id -Name 'PSTag'
) -Status Available
$Result = Add-PSPet -Pet $Pet
# Get
$Result = Get-PSPetById -petId $Id
$Result."id" | Should Be 38369
$Result."name" | Should Be "PowerShell"
$Result."status" | Should Be "Available"
$Result."category"."id" | Should Be $Id
$Result."category"."name" | Should Be 'PSCategory'
$Result.GetType().fullname | Should Be "System.Management.Automation.PSCustomObject"
# Update (form)
$Result = Update-PSPetWithForm -petId $Id -Name "PowerShell Update" -Status "Pending"
$Result = Get-PSPetById -petId $Id
$Result."id" | Should Be 38369
$Result."name" | Should Be "PowerShell Update"
$Result."status" | Should Be "Pending"
# Update (put)
$NewPet = Initialize-PSPet -Id $Id -Name 'PowerShell2' -Category (
Initialize-PSCategory -Id $Id -Name 'PSCategory2'
) -PhotoUrls @(
'http://example.com/foo2',
'http://example.com/bar2'
) -Tags (
Initialize-PSTag -Id $Id -Name 'PSTag2'
) -Status Sold
$Result = Update-PSPet -Pet $NewPet
$Result = Get-PSPetById -petId $Id -WithHttpInfo
$Result.GetType().fullname | Should Be "System.Collections.Hashtable"
#$Result["Response"].GetType().fullanme | Should Be "System.Management.Automation.PSCustomObject"
$Result["Response"]."id" | Should Be 38369
$Result["Response"]."name" | Should Be "PowerShell2"
$Result["Response"]."status" | Should Be "Sold"
$Result["StatusCode"] | Should Be 200
$Result["Headers"]["Content-Type"] | Should Be "application/json"
# upload file
$file = Get-Item "./plus.gif"
#$Result = Invoke-PSUploadFile -petId $Id -additionalMetadata "Additional data" -File $file
# modify and update
#
$NewPet = $Result["response"]
$NewPet."id" = $NewPet."id" + 1
$NewPet."name" = $NewPet."name" + "PowerShell Modify"
$Result = Update-PSPet -Pet $NewPet
$Result = Get-PSPetById -petId $NewPet."id" -WithHttpInfo
$Result["Response"]."id" | Should Be $NewPet."id"
$Result["Response"]."name" | Should Be $NewPet."name"
# Delete
$Result = Remove-Pet -petId $Id
$Result = Remove-Pet -petId $NewPet."id"
}
It 'Find pets test' {
# add 1st pet
$pet = Initialize-PSPet -Id 10129 -Name 'foo' -Category (
Initialize-PSCategory -Id 20129 -Name 'bar'
) -PhotoUrls @(
'http://example.com/foo',
'http://example.com/bar'
) -Tags (
Initialize-PSTag -Id 10129 -Name 'bazbaz'
) -Status Available
$Result = Add-PSPet -Pet $pet
# add 2nd pet
$pet2 = Initialize-PSPet -Id 20129 -Name '2foo' -Category (
Initialize-PSCategory -Id 20129 -Name '2bar'
) -PhotoUrls @(
'http://example.com/2foo',
'http://example.com/2bar'
) -Tags (
Initialize-PSTag -Id 10129 -Name 'bazbaz'
) -Status Available
$Result = Add-PSPet $pet2
# test find pets by tags
$Results = Find-PSPetsByTags 'bazbaz'
$Results.GetType().FullName| Should Be "System.Object[]"
$Results.Count | Should Be 2
if ($Results[0]."id" -gt 10129) {
$Results[0]."id" | Should Be 20129
} else {
$Results[0]."id" | Should Be 10129
}
if ($Results[1]."id" -gt 10129) {
$Results[1]."id" | Should Be 20129
} else {
$Results[1]."id" | Should Be 10129
}
}
}
Context 'Configuration' {
It 'Get-PSHostSetting tests' {
$HS = Get-PSHostSetting
$HS[0]["Url"] | Should Be "http://{server}.swagger.io:{port}/v2"
$HS[0]["Description"] | Should Be "petstore server"
$HS[0]["Variables"]["server"]["Description"] | Should Be "No description provided"
$HS[0]["Variables"]["server"]["DefaultValue"] | Should Be "petstore"
$HS[0]["Variables"]["server"]["EnumValues"] | Should Be @("petstore",
"qa-petstore",
"dev-petstore")
}
It "Get-PSUrlFromHostSetting tests" {
Get-PSUrlFromHostSetting -Index 0 | Should Be "http://petstore.swagger.io:80/v2"
Get-PSUrlFromHostSetting -Index 0 -Variables @{ "port" = "8080" } | Should Be "http://petstore.swagger.io:8080/v2"
#Get-PSUrlFromHostSetting -Index 2 | Should -Throw -ExceptionType ([RuntimeException])
#Get-PSUrlFromHostSetting -Index 2 -ErrorAction Stop | Should -Throw "RuntimeException: Invalid index 2 when selecting the host. Must be less than 2"
#Get-PSUrlFromHostSetting -Index 0 -Variables @{ "port" = "1234" } -ErrorAction Stop | Should -Throw "RuntimeException: The variable 'port' in the host URL has invalid value 1234. Must be 80,8080"
}
It "Default header tests" {
Set-PSConfigurationDefaultHeader -Key "TestKey" -Value "TestValue"
$Configuration = Get-PSConfiguration
$Configuration["DefaultHeaders"].Count | Should Be 1
$Configuration["DefaultHeaders"]["TestKey"] | Should Be "TestValue"
}
It "Configuration tests" {
$Conf = Get-PSConfiguration
$Conf["SkipCertificateCheck"] | Should Be $false
$Conf = Set-PSConfiguration -PassThru -SkipCertificateCheck
$Conf["SkipCertificateCheck"] | Should Be $true
$Conf = Set-PSConfiguration -PassThru # reset SkipCertificateCheck
}
It "Base URL tests" {
$Conf = Set-PSConfiguration -BaseURL "http://localhost"
$Conf = Set-PSConfiguration -BaseURL "https://localhost:8080/api"
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 B