Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ Method | HTTP request | Description
```powershell
Import-Module -Name {{{packageName}}}

# Displays the error message and stops executing. (Default: Continue)
$ErrorActionPreference = "Stop"

{{#hasAuthMethods}}
$Configuration = Get-{{{packageName}}}Configuration
{{#authMethods}}
Expand Down
40 changes: 22 additions & 18 deletions samples/client/petstore/powershell-experimental/Test1.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,33 +29,37 @@ try {
#Write-Host $pet
$Result = Add-PSPet -Pet $pet
Set-PSConfigurationApiKey -Id "api_key" -ApiKey "zzZZZZZZZZZZZZZ"
$result = Get-PSPetById -petId $Id -Verbose #-testHeader "testing only" -testQuery "testing something here"
#$result = Get-PSPetById -petId ($Id+1) -Verbose #-testHeader "testing only" -testQuery "testing something here"
#Write-Host "after get pet by id"
} catch {
Write-Host ("Exception occured when calling '': {0}" -f ($_.ErrorDetails | ConvertFrom-Json))
Write-Host ("Exception occured when calling: {0}" -f ($_.ErrorDetails | ConvertFrom-Json))
Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json))
}

$result = Get-PSPetById -petId ($Id+1) -Verbose -WithHttpInfo #-testHeader "testing only" -testQuery "testing something here"
Write-Host "after get pet by id"
Write-Host $result.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
#$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"

Expand Down
24 changes: 24 additions & 0 deletions samples/client/petstore/powershell-experimental/docs/PSPetApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ Add a new pet to the store
```powershell
Import-Module -Name PSPetstore

# Displays the error message and stops executing. (Default: Continue)
$ErrorActionPreference = "Stop"

$Configuration = Get-PSPetstoreConfiguration
# Configure OAuth2 access token for authorization: petstore_auth
$Configuration["AccessToken"] = "YOUR_ACCESS_TOKEN";
Expand Down Expand Up @@ -73,6 +76,9 @@ Deletes a pet
```powershell
Import-Module -Name PSPetstore

# Displays the error message and stops executing. (Default: Continue)
$ErrorActionPreference = "Stop"

$Configuration = Get-PSPetstoreConfiguration
# Configure OAuth2 access token for authorization: petstore_auth
$Configuration["AccessToken"] = "YOUR_ACCESS_TOKEN";
Expand Down Expand Up @@ -124,6 +130,9 @@ Multiple status values can be provided with comma separated strings
```powershell
Import-Module -Name PSPetstore

# Displays the error message and stops executing. (Default: Continue)
$ErrorActionPreference = "Stop"

$Configuration = Get-PSPetstoreConfiguration
# Configure OAuth2 access token for authorization: petstore_auth
$Configuration["AccessToken"] = "YOUR_ACCESS_TOKEN";
Expand Down Expand Up @@ -173,6 +182,9 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3
```powershell
Import-Module -Name PSPetstore

# Displays the error message and stops executing. (Default: Continue)
$ErrorActionPreference = "Stop"

$Configuration = Get-PSPetstoreConfiguration
# Configure OAuth2 access token for authorization: petstore_auth
$Configuration["AccessToken"] = "YOUR_ACCESS_TOKEN";
Expand Down Expand Up @@ -222,6 +234,9 @@ Returns a single pet
```powershell
Import-Module -Name PSPetstore

# Displays the error message and stops executing. (Default: Continue)
$ErrorActionPreference = "Stop"

$Configuration = Get-PSPetstoreConfiguration
# Configure API key authorization: api_key
$Configuration["ApiKey"]["api_key"] = "YOUR_API_KEY"
Expand Down Expand Up @@ -271,6 +286,9 @@ Update an existing pet
```powershell
Import-Module -Name PSPetstore

# Displays the error message and stops executing. (Default: Continue)
$ErrorActionPreference = "Stop"

$Configuration = Get-PSPetstoreConfiguration
# Configure OAuth2 access token for authorization: petstore_auth
$Configuration["AccessToken"] = "YOUR_ACCESS_TOKEN";
Expand Down Expand Up @@ -320,6 +338,9 @@ Updates a pet in the store with form data
```powershell
Import-Module -Name PSPetstore

# Displays the error message and stops executing. (Default: Continue)
$ErrorActionPreference = "Stop"

$Configuration = Get-PSPetstoreConfiguration
# Configure OAuth2 access token for authorization: petstore_auth
$Configuration["AccessToken"] = "YOUR_ACCESS_TOKEN";
Expand Down Expand Up @@ -373,6 +394,9 @@ uploads an image
```powershell
Import-Module -Name PSPetstore

# Displays the error message and stops executing. (Default: Continue)
$ErrorActionPreference = "Stop"

$Configuration = Get-PSPetstoreConfiguration
# Configure OAuth2 access token for authorization: petstore_auth
$Configuration["AccessToken"] = "YOUR_ACCESS_TOKEN";
Expand Down
12 changes: 12 additions & 0 deletions samples/client/petstore/powershell-experimental/docs/PSStoreApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non
```powershell
Import-Module -Name PSPetstore

# Displays the error message and stops executing. (Default: Continue)
$ErrorActionPreference = "Stop"

$OrderId = "OrderId_example" # String | ID of the order that needs to be deleted (default to null)

# Delete purchase order by ID
Expand Down Expand Up @@ -67,6 +70,9 @@ Returns a map of status codes to quantities
```powershell
Import-Module -Name PSPetstore

# Displays the error message and stops executing. (Default: Continue)
$ErrorActionPreference = "Stop"

$Configuration = Get-PSPetstoreConfiguration
# Configure API key authorization: api_key
$Configuration["ApiKey"]["api_key"] = "YOUR_API_KEY"
Expand Down Expand Up @@ -114,6 +120,9 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge
```powershell
Import-Module -Name PSPetstore

# Displays the error message and stops executing. (Default: Continue)
$ErrorActionPreference = "Stop"

$OrderId = 987 # Int64 | ID of pet that needs to be fetched (default to null)

# Find purchase order by ID
Expand Down Expand Up @@ -157,6 +166,9 @@ Place an order for a pet
```powershell
Import-Module -Name PSPetstore

# Displays the error message and stops executing. (Default: Continue)
$ErrorActionPreference = "Stop"

$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
Expand Down
24 changes: 24 additions & 0 deletions samples/client/petstore/powershell-experimental/docs/PSUserApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ This can only be done by the logged in user.
```powershell
Import-Module -Name PSPetstore

# Displays the error message and stops executing. (Default: Continue)
$ErrorActionPreference = "Stop"

$Configuration = Get-PSPetstoreConfiguration
# Configure API key authorization: auth_cookie
$Configuration["ApiKey"]["AUTH_KEY"] = "YOUR_API_KEY"
Expand Down Expand Up @@ -76,6 +79,9 @@ Creates list of users with given input array
```powershell
Import-Module -Name PSPetstore

# Displays the error message and stops executing. (Default: Continue)
$ErrorActionPreference = "Stop"

$Configuration = Get-PSPetstoreConfiguration
# Configure API key authorization: auth_cookie
$Configuration["ApiKey"]["AUTH_KEY"] = "YOUR_API_KEY"
Expand Down Expand Up @@ -125,6 +131,9 @@ Creates list of users with given input array
```powershell
Import-Module -Name PSPetstore

# Displays the error message and stops executing. (Default: Continue)
$ErrorActionPreference = "Stop"

$Configuration = Get-PSPetstoreConfiguration
# Configure API key authorization: auth_cookie
$Configuration["ApiKey"]["AUTH_KEY"] = "YOUR_API_KEY"
Expand Down Expand Up @@ -176,6 +185,9 @@ This can only be done by the logged in user.
```powershell
Import-Module -Name PSPetstore

# Displays the error message and stops executing. (Default: Continue)
$ErrorActionPreference = "Stop"

$Configuration = Get-PSPetstoreConfiguration
# Configure API key authorization: auth_cookie
$Configuration["ApiKey"]["AUTH_KEY"] = "YOUR_API_KEY"
Expand Down Expand Up @@ -225,6 +237,9 @@ Get user by user name
```powershell
Import-Module -Name PSPetstore

# Displays the error message and stops executing. (Default: Continue)
$ErrorActionPreference = "Stop"

$Username = "Username_example" # String | The name that needs to be fetched. Use user1 for testing. (default to null)

# Get user by user name
Expand Down Expand Up @@ -269,6 +284,9 @@ Logs user into the system
```powershell
Import-Module -Name PSPetstore

# Displays the error message and stops executing. (Default: Continue)
$ErrorActionPreference = "Stop"

$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)

Expand Down Expand Up @@ -313,6 +331,9 @@ Logs out current logged in user session
```powershell
Import-Module -Name PSPetstore

# Displays the error message and stops executing. (Default: Continue)
$ErrorActionPreference = "Stop"

$Configuration = Get-PSPetstoreConfiguration
# Configure API key authorization: auth_cookie
$Configuration["ApiKey"]["AUTH_KEY"] = "YOUR_API_KEY"
Expand Down Expand Up @@ -361,6 +382,9 @@ This can only be done by the logged in user.
```powershell
Import-Module -Name PSPetstore

# Displays the error message and stops executing. (Default: Continue)
$ErrorActionPreference = "Stop"

$Configuration = Get-PSPetstoreConfiguration
# Configure API key authorization: auth_cookie
$Configuration["ApiKey"]["AUTH_KEY"] = "YOUR_API_KEY"
Expand Down