Api/PetApi.ps1
# # 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-Pet { [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-Pet' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $LocalVarAccepts = @() $LocalVarContentTypes = @() $LocalVarQueryParameters = @{} $LocalVarHeaderParameters = @{} $LocalVarFormParameters = @{} $LocalVarPathParameters = @{} $LocalVarCookieParameters = @{} $LocalVarBodyParameter = $null $Configuration = Get-Configuration # HTTP header 'Accept' (if needed) $LocalVarAccepts = @('application/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 -Depth 100 $LocalVarResult = Invoke-ApiClient -Method 'POST' ` -Uri $LocalVarUri ` -Accepts $LocalVarAccepts ` -ContentTypes $LocalVarContentTypes ` -Body $LocalVarBodyParameter ` -HeaderParameters $LocalVarHeaderParameters ` -QueryParameters $LocalVarQueryParameters ` -FormParameters $LocalVarFormParameters ` -CookieParameters $LocalVarCookieParameters ` -ReturnType "Pet" ` -IsBodyNullable $false if ($WithHttpInfo.IsPresent) { return $LocalVarResult } else { return $LocalVarResult["Response"] } } } <# .SYNOPSIS 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 Invoke-DeletePet { [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: Invoke-DeletePet' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $LocalVarAccepts = @() $LocalVarContentTypes = @() $LocalVarQueryParameters = @{} $LocalVarHeaderParameters = @{} $LocalVarFormParameters = @{} $LocalVarPathParameters = @{} $LocalVarCookieParameters = @{} $LocalVarBodyParameter = $null $Configuration = Get-Configuration $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-ApiClient -Method 'DELETE' ` -Uri $LocalVarUri ` -Accepts $LocalVarAccepts ` -ContentTypes $LocalVarContentTypes ` -Body $LocalVarBodyParameter ` -HeaderParameters $LocalVarHeaderParameters ` -QueryParameters $LocalVarQueryParameters ` -FormParameters $LocalVarFormParameters ` -CookieParameters $LocalVarCookieParameters ` -ReturnType "" ` -IsBodyNullable $false 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-PetsByStatus { [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-PetsByStatus' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $LocalVarAccepts = @() $LocalVarContentTypes = @() $LocalVarQueryParameters = @{} $LocalVarHeaderParameters = @{} $LocalVarFormParameters = @{} $LocalVarPathParameters = @{} $LocalVarCookieParameters = @{} $LocalVarBodyParameter = $null $Configuration = Get-Configuration # HTTP header 'Accept' (if needed) $LocalVarAccepts = @('application/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-ApiClient -Method 'GET' ` -Uri $LocalVarUri ` -Accepts $LocalVarAccepts ` -ContentTypes $LocalVarContentTypes ` -Body $LocalVarBodyParameter ` -HeaderParameters $LocalVarHeaderParameters ` -QueryParameters $LocalVarQueryParameters ` -FormParameters $LocalVarFormParameters ` -CookieParameters $LocalVarCookieParameters ` -ReturnType "Pet[]" ` -IsBodyNullable $false if ($WithHttpInfo.IsPresent) { return $LocalVarResult } else { return $LocalVarResult["Response"] } } } <# .SYNOPSIS 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-PetsByTags { [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-PetsByTags' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $LocalVarAccepts = @() $LocalVarContentTypes = @() $LocalVarQueryParameters = @{} $LocalVarHeaderParameters = @{} $LocalVarFormParameters = @{} $LocalVarPathParameters = @{} $LocalVarCookieParameters = @{} $LocalVarBodyParameter = $null $Configuration = Get-Configuration # HTTP header 'Accept' (if needed) $LocalVarAccepts = @('application/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-ApiClient -Method 'GET' ` -Uri $LocalVarUri ` -Accepts $LocalVarAccepts ` -ContentTypes $LocalVarContentTypes ` -Body $LocalVarBodyParameter ` -HeaderParameters $LocalVarHeaderParameters ` -QueryParameters $LocalVarQueryParameters ` -FormParameters $LocalVarFormParameters ` -CookieParameters $LocalVarCookieParameters ` -ReturnType "Pet[]" ` -IsBodyNullable $false if ($WithHttpInfo.IsPresent) { return $LocalVarResult } else { return $LocalVarResult["Response"] } } } <# .SYNOPSIS 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-PetById { [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-PetById' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $LocalVarAccepts = @() $LocalVarContentTypes = @() $LocalVarQueryParameters = @{} $LocalVarHeaderParameters = @{} $LocalVarFormParameters = @{} $LocalVarPathParameters = @{} $LocalVarCookieParameters = @{} $LocalVarBodyParameter = $null $Configuration = Get-Configuration # HTTP header 'Accept' (if needed) $LocalVarAccepts = @('application/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-ApiClient -Method 'GET' ` -Uri $LocalVarUri ` -Accepts $LocalVarAccepts ` -ContentTypes $LocalVarContentTypes ` -Body $LocalVarBodyParameter ` -HeaderParameters $LocalVarHeaderParameters ` -QueryParameters $LocalVarQueryParameters ` -FormParameters $LocalVarFormParameters ` -CookieParameters $LocalVarCookieParameters ` -ReturnType "Pet" ` -IsBodyNullable $false if ($WithHttpInfo.IsPresent) { return $LocalVarResult } else { return $LocalVarResult["Response"] } } } <# .SYNOPSIS 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-Pet { [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-Pet' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $LocalVarAccepts = @() $LocalVarContentTypes = @() $LocalVarQueryParameters = @{} $LocalVarHeaderParameters = @{} $LocalVarFormParameters = @{} $LocalVarPathParameters = @{} $LocalVarCookieParameters = @{} $LocalVarBodyParameter = $null $Configuration = Get-Configuration # HTTP header 'Accept' (if needed) $LocalVarAccepts = @('application/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 -Depth 100 $LocalVarResult = Invoke-ApiClient -Method 'PUT' ` -Uri $LocalVarUri ` -Accepts $LocalVarAccepts ` -ContentTypes $LocalVarContentTypes ` -Body $LocalVarBodyParameter ` -HeaderParameters $LocalVarHeaderParameters ` -QueryParameters $LocalVarQueryParameters ` -FormParameters $LocalVarFormParameters ` -CookieParameters $LocalVarCookieParameters ` -ReturnType "Pet" ` -IsBodyNullable $false if ($WithHttpInfo.IsPresent) { return $LocalVarResult } else { return $LocalVarResult["Response"] } } } <# .SYNOPSIS 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-PetWithForm { [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-PetWithForm' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $LocalVarAccepts = @() $LocalVarContentTypes = @() $LocalVarQueryParameters = @{} $LocalVarHeaderParameters = @{} $LocalVarFormParameters = @{} $LocalVarPathParameters = @{} $LocalVarCookieParameters = @{} $LocalVarBodyParameter = $null $Configuration = Get-Configuration # 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-ApiClient -Method 'POST' ` -Uri $LocalVarUri ` -Accepts $LocalVarAccepts ` -ContentTypes $LocalVarContentTypes ` -Body $LocalVarBodyParameter ` -HeaderParameters $LocalVarHeaderParameters ` -QueryParameters $LocalVarQueryParameters ` -FormParameters $LocalVarFormParameters ` -CookieParameters $LocalVarCookieParameters ` -ReturnType "" ` -IsBodyNullable $false 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-UploadFile { [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-UploadFile' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $LocalVarAccepts = @() $LocalVarContentTypes = @() $LocalVarQueryParameters = @{} $LocalVarHeaderParameters = @{} $LocalVarFormParameters = @{} $LocalVarPathParameters = @{} $LocalVarCookieParameters = @{} $LocalVarBodyParameter = $null $Configuration = Get-Configuration # HTTP header 'Accept' (if needed) $LocalVarAccepts = @('application/json') # HTTP header 'Content-Type' $LocalVarContentTypes = @('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-ApiClient -Method 'POST' ` -Uri $LocalVarUri ` -Accepts $LocalVarAccepts ` -ContentTypes $LocalVarContentTypes ` -Body $LocalVarBodyParameter ` -HeaderParameters $LocalVarHeaderParameters ` -QueryParameters $LocalVarQueryParameters ` -FormParameters $LocalVarFormParameters ` -CookieParameters $LocalVarCookieParameters ` -ReturnType "ApiResponse" ` -IsBodyNullable $false if ($WithHttpInfo.IsPresent) { return $LocalVarResult } else { return $LocalVarResult["Response"] } } } |