William Cheng 29183e0280
[PowerShell] support default value in models (#6920)
* support default value in ps

* revert changes to the spec
2020-07-13 13:41:10 +08:00

13 KiB

PSPetstore.PSPetstore/Api.PSPetApi

All URIs are relative to http://petstore.swagger.io:80/v2

Method HTTP request Description
Add-PSPet POST /pet Add a new pet to the store
Remove-Pet DELETE /pet/{petId} Deletes a pet
Find-PSPetsByStatus GET /pet/findByStatus Finds Pets by status
Find-PSPetsByTags GET /pet/findByTags Finds Pets by tags
Get-PSPetById GET /pet/{petId} Find pet by ID
Update-PSPet PUT /pet Update an existing pet
Update-PSPetWithForm POST /pet/{petId} Updates a pet in the store with form data
Invoke-PSUploadFile POST /pet/{petId}/uploadImage uploads an image

Add-PSPet

Pet Add-PSPet
        [-Pet]

Add a new pet to the store

Example

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 object that needs to be added to the store

Return type

Pet

Authorization

petstore_auth

HTTP request headers

  • Content-Type: application/json, application/xml
  • Accept: application/xml, application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

Remove-Pet

void Remove-Pet
        [-PetId]
        [-ApiKey]

Deletes a pet

Example

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
$ApiKey = "ApiKey_example" # String |  (optional)

# 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
ApiKey String [optional]

Return type

void (empty response body)

Authorization

petstore_auth

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

[Back to top] [Back to API list] [Back to Model list] [Back to README]

Find-PSPetsByStatus

Pet[] Find-PSPetsByStatus
        [-Status] <String[]>

Finds Pets by status

Multiple status values can be provided with comma separated strings

Example

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

# 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[] Status values that need to be considered for filter

Return type

Pet[]

Authorization

petstore_auth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/xml, application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

Find-PSPetsByTags

Pet[] Find-PSPetsByTags
        [-Tags] <String[]>

Finds Pets by tags

Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.

Example

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

# 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[] Tags to filter by

Return type

Pet[]

Authorization

petstore_auth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/xml, application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

Get-PSPetById

Pet Get-PSPetById
        [-PetId]

Find pet by ID

Returns a single pet

Example

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

# 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

Return type

Pet

Authorization

api_key

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/xml, application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

Update-PSPet

Pet Update-PSPet
        [-Pet]

Update an existing pet

Example

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 object that needs to be added to the store

Return type

Pet

Authorization

petstore_auth

HTTP request headers

  • Content-Type: application/json, application/xml
  • Accept: application/xml, application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

Update-PSPetWithForm

void Update-PSPetWithForm
        [-PetId]
        [-Name]
        [-Status]

Updates a pet in the store with form data

Example

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
$Name = "Name_example" # String | Updated name of the pet (optional)
$Status = "Status_example" # String | Updated status of the pet (optional)

# 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
Name String Updated name of the pet [optional]
Status String Updated status of the pet [optional]

Return type

void (empty response body)

Authorization

petstore_auth

HTTP request headers

  • Content-Type: application/x-www-form-urlencoded
  • Accept: Not defined

[Back to top] [Back to API list] [Back to Model list] [Back to README]

Invoke-PSUploadFile

ApiResponse Invoke-PSUploadFile
        [-PetId]
        [-AdditionalMetadata]
        [-File] <System.IO.FileInfo>

uploads an image

Example

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
$AdditionalMetadata = "AdditionalMetadata_example" # String | Additional data to pass to server (optional)
$File = 987 # System.IO.FileInfo | file to upload (optional)

# 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
AdditionalMetadata String Additional data to pass to server [optional]
File System.IO.FileInfo****System.IO.FileInfo file to upload [optional]

Return type

ApiResponse

Authorization

petstore_auth

HTTP request headers

  • Content-Type: multipart/form-data
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]