[PowerShell] module to serve as template for PowerShell generator (#5509)

* Added PowerShell module. See #4320

MVP PowerShell module to serve as a template for a PowerShell generator.

* Fixed function name

* Removed module manifest

It should be generated by the build script

* Ignore module manifests

* Removed binding from prop. name for Pet
This commit is contained in:
beatcracker
2017-05-05 12:21:11 +03:00
committed by wing328
parent 167cbe9726
commit d214e0ad4b
16 changed files with 992 additions and 0 deletions

View File

@@ -0,0 +1,185 @@
# Ref: https://gist.github.com/kmorcinek/2710267
# Download this file using PowerShell v3 under Windows with the following comand
# Invoke-WebRequest https://gist.githubusercontent.com/kmorcinek/2710267/raw/ -OutFile .gitignore
# User-specific files
*.suo
*.user
*.sln.docstates
# Build results
[Dd]ebug/
[Rr]elease/
x64/
build/
[Bb]in/
[Oo]bj/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.log
*.scc
# OS generated files #
.DS_Store*
ehthumbs.db
Icon?
Thumbs.db
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
*.ncrunch*
.*crunch*.local.xml
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.Publish.xml
# Windows Azure Build Output
csx
*.build.csdef
# Windows Store app package directory
AppPackages/
# Others
sql/
*.Cache
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.[Pp]ublish.xml
*.pfx
*.publishsettings
modulesbin/
tempbin/
# EPiServer Site file (VPP)
AppData/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# vim
*.txt~
*.swp
*.swo
# svn
.svn
# SQL Server files
**/App_Data/*.mdf
**/App_Data/*.ldf
**/App_Data/*.sdf
#LightSwitch generated files
GeneratedArtifacts/
_Pvt_Extensions/
ModelManifest.xml
# =========================
# Windows detritus
# =========================
# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Mac desktop service store files
.DS_Store
# SASS Compiler cache
.sass-cache
# Visual Studio 2014 CTP
**/*.sln.ide

View File

@@ -0,0 +1,49 @@
$ScriptDir = Split-Path $script:MyInvocation.MyCommand.Path
$ClientPath = "$ScriptDir\..\..\csharp\SwaggerClient"
$PublicPath = "$ScriptDir\src\IO.Swagger\Public"
$BinPath = "$ScriptDir\src\IO.Swagger\Bin"
Start-Process -FilePath "$ClientPath\build.bat" -WorkingDirectory $ClientPath -Wait -NoNewWindow
if (!(Test-Path "$ScriptDir\src\IO.Swagger\Bin" -PathType Container)) {
New-Item "$ScriptDir\src\IO.Swagger\Bin" -ItemType Directory > $null
}
Copy-Item "$ClientPath\bin\*.dll" $BinPath
$Manifest = @{
Path = "$ScriptDir\src\IO.Swagger\IO.Swagger.psd1"
Author = 'apiteam@swagger.io'
CompanyName = 'swagger.io'
Description = 'IO.Swagger - the PowerShell module for the Swagger Petstore'
RootModule = 'IO.Swagger.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 = Get-ChildItem "$PublicPath\*.ps1" | ForEach-Object {
$_.BaseName
}
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.
#
# DefaultCommandPrefix = 'PetStore'
}
New-ModuleManifest @Manifest

View File

@@ -0,0 +1,148 @@
# IO.Swagger - the PowerShell module for the Swagger Petstore
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
This PowerShell module is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
- API version: 1.0.0
- SDK version: 1.0.0
- Build package: io.swagger.codegen.languages.CSharpClientCodegen
<a name="frameworks-supported"></a>
## Frameworks supported
- PowerShell 3.0 or later
- .NET 4.0 or later
<a name="dependencies"></a>
## Dependencies
- [RestSharp](https://www.nuget.org/packages/RestSharp) - 105.1.0 or later
- [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json/) - 7.0.0 or later
The DLLs included in the package may not be the latest version. We recommend using [NuGet] (https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages:
```
Install-Package RestSharp
Install-Package Newtonsoft.Json
```
NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See [RestSharp#742](https://github.com/restsharp/RestSharp/issues/742)
<a name="installation"></a>
## Installation
Run the following command to generate the DLL
- [Windows] `build.ps1`
Then import module from the `.\src\IO.Swagger` folder:
```posh
Import-Module -Name '.\src\IO.Swagger'
```
<a name="getting-started"></a>
## Getting Started
```posh
Set-ApiCredential -AccessToken 'YOUR_ACCESS_TOKEN'
New-Pet -Id 1 -Name 'foo' -Category (
New-Category -Id 2 -Name 'bar'
) -PhotoUrls @(
'http://example.com/foo',
'http://example.com/bar'
) -Tags (
New-Tag -Id 3 -Name 'baz'
) -Status Available | Update-Pet
Get-PetById -Id 1
```
<a name="documentation-for-api-endpoints"></a>
## Documentation for API Endpoints
All URIs are relative to *http://petstore.swagger.io:80/v2*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*FakeApi* | [**TestClientModel**](docs/FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model
*FakeApi* | [**TestEndpointParameters**](docs/FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
*FakeApi* | [**TestEnumParameters**](docs/FakeApi.md#testenumparameters) | **GET** /fake | To test enum parameters
*PetApi* | [**AddPet**](docs/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store
*PetApi* | [**DeletePet**](docs/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet
*PetApi* | [**FindPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status
*PetApi* | [**FindPetsByTags**](docs/PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags
*PetApi* | [**GetPetById**](docs/PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID
*PetApi* | [**UpdatePet**](docs/PetApi.md#updatepet) | **PUT** /pet | Update an existing pet
*PetApi* | [**UpdatePetWithForm**](docs/PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data
*PetApi* | [**UploadFile**](docs/PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image
*StoreApi* | [**DeleteOrder**](docs/StoreApi.md#deleteorder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID
*StoreApi* | [**GetInventory**](docs/StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status
*StoreApi* | [**GetOrderById**](docs/StoreApi.md#getorderbyid) | **GET** /store/order/{order_id} | Find purchase order by ID
*StoreApi* | [**PlaceOrder**](docs/StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet
*UserApi* | [**CreateUser**](docs/UserApi.md#createuser) | **POST** /user | Create user
*UserApi* | [**CreateUsersWithArrayInput**](docs/UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array
*UserApi* | [**CreateUsersWithListInput**](docs/UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array
*UserApi* | [**DeleteUser**](docs/UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user
*UserApi* | [**GetUserByName**](docs/UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name
*UserApi* | [**LoginUser**](docs/UserApi.md#loginuser) | **GET** /user/login | Logs user into the system
*UserApi* | [**LogoutUser**](docs/UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session
*UserApi* | [**UpdateUser**](docs/UserApi.md#updateuser) | **PUT** /user/{username} | Updated user
<a name="documentation-for-models"></a>
## Documentation for Models
- [Model.AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md)
- [Model.Animal](docs/Animal.md)
- [Model.AnimalFarm](docs/AnimalFarm.md)
- [Model.ApiResponse](docs/ApiResponse.md)
- [Model.ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md)
- [Model.ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
- [Model.ArrayTest](docs/ArrayTest.md)
- [Model.Capitalization](docs/Capitalization.md)
- [Model.Cat](docs/Cat.md)
- [Model.Category](docs/Category.md)
- [Model.ClassModel](docs/ClassModel.md)
- [Model.Dog](docs/Dog.md)
- [Model.EnumArrays](docs/EnumArrays.md)
- [Model.EnumClass](docs/EnumClass.md)
- [Model.EnumTest](docs/EnumTest.md)
- [Model.FormatTest](docs/FormatTest.md)
- [Model.HasOnlyReadOnly](docs/HasOnlyReadOnly.md)
- [Model.List](docs/List.md)
- [Model.MapTest](docs/MapTest.md)
- [Model.MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md)
- [Model.Model200Response](docs/Model200Response.md)
- [Model.ModelClient](docs/ModelClient.md)
- [Model.ModelReturn](docs/ModelReturn.md)
- [Model.Name](docs/Name.md)
- [Model.NumberOnly](docs/NumberOnly.md)
- [Model.Order](docs/Order.md)
- [Model.OuterEnum](docs/OuterEnum.md)
- [Model.Pet](docs/Pet.md)
- [Model.ReadOnlyFirst](docs/ReadOnlyFirst.md)
- [Model.SpecialModelName](docs/SpecialModelName.md)
- [Model.Tag](docs/Tag.md)
- [Model.User](docs/User.md)
<a name="documentation-for-authorization"></a>
## Documentation for Authorization
<a name="api_key"></a>
### api_key
- **Type**: API key
- **API key parameter name**: api_key
- **Location**: HTTP header
<a name="http_basic_test"></a>
### http_basic_test
- **Type**: HTTP basic authentication
<a name="petstore_auth"></a>
### 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,2 @@
# Ignore module manifests
*.psd1

View File

@@ -0,0 +1,36 @@
#region Import functions
$FunctionsToExport = @()
$Folders = 'Public', 'Private'
foreach ($Scope in $Folders) {
Get-ChildItem -LiteralPath (
Join-Path -Path $PSScriptRoot -ChildPath $Scope
) -File -Filter '*.ps1' | ForEach-Object {
$File = $_
try {
Write-Verbose "Dotsourcing file: $File"
. $File.FullName
switch ($Scope) {
'Public' {
$FunctionsToExport += $File.BaseName
}
}
} catch {
throw "Can't import functions from file: $File"
}
}
}
Export-ModuleMember -Function $FunctionsToExport
#endregion
#region Initialize APIs
'Creating object: IO.Swagger.Api.PetApi' | Write-Verbose
$Script:PetApi = New-Object -TypeName IO.Swagger.Api.PetApi -ArgumentList @($null)
#endregion

View File

@@ -0,0 +1,15 @@
<#
.Synopsis
Helper function to get common parameters (Verbose, Debug, etc.)
.Example
Get-CommonParameters
#>
function Get-CommonParameters {
function tmp {
[CmdletBinding()]
Param ()
}
(Get-Command -Name tmp -CommandType Function).Parameters.Keys
}

View File

@@ -0,0 +1,38 @@
<#
.Synopsis
Helper function to format debug parameter output.
.Example
$PSBoundParameters | Out-DebugParameter | Write-Debug
#>
function Out-DebugParameter {
[CmdletBinding()]
Param (
[Parameter(ValueFromPipeline = $true, Mandatory = $true)]
[AllowEmptyCollection()]
$InputObject
)
Begin {
$CommonParameters = Get-CommonParameters
}
Process {
$InputObject.GetEnumerator() | Where-Object {
$CommonParameters -notcontains $_.Key
} | Format-Table -AutoSize -Property (
@{
Name = 'Parameter'
Expression = {$_.Key}
},
@{
Name = 'Value'
Expression = {$_.Value}
}
) | Out-String -Stream | ForEach-Object {
if ($_.Trim()) {
$_
}
}
}
}

View File

@@ -0,0 +1,45 @@
<#
.Synopsis
Find pet by ID.
.Description
Find pet by ID. Returns a single pet.
.Parameter Id
ID of pet to return.
.Example
Get-PetById -Id 1
.Example
1 | Get-PetById
.Inputs
long
.Outputs
IO.Swagger.Model.Pet
.Notes
This function is automatically generated by the Swagger Codegen.
.Link
https://github.com/swagger-api/swagger-codegen
#>
function Get-PetById {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
[long]
${Id}
)
Process {
'Calling method: GetPetById' | Write-Verbose
$PSBoundParameters | Out-DebugParameter | Write-Debug
$Script:PetApi.GetPetById(
${Id}
)
}
}

View File

@@ -0,0 +1,52 @@
<#
.Synopsis
Creates new IO.Swagger.Model.Category object.
.Description
Creates new IO.Swagger.Model.Category object.
.Parameter Id
ID.
.Parameter Name
Name
.Example
New-Category -Id 1 -Name 'foo'
.Inputs
System.Nullable[long]
System.String
.Outputs
IO.Swagger.Model.Category
.Notes
This function is automatically generated by the Swagger Codegen.
.Link
https://github.com/swagger-api/swagger-codegen
#>
function New-Category {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
[System.Nullable[long]]
${Id},
[Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)]
[string]
${Name}
)
Process {
'Creating object: IO.Swagger.Model.Category' | Write-Verbose
$PSBoundParameters | Out-DebugParameter | Write-Debug
New-Object -TypeName IO.Swagger.Model.Category -ArgumentList @(
${Id},
${Name}
)
}
}

View File

@@ -0,0 +1,98 @@
<#
.Synopsis
Creates new IO.Swagger.Model.Pet object.
.Description
Creates new IO.Swagger.Model.Pet object.
.Parameter Id
ID of pet.
.Parameter Category
Category of pet.
.Parameter Name
Name of pet.
.Parameter PhotoUrls
PhotoUrls.
.Parameter Tags
Tags
.Parameter Status
Status.
.Example
New-Pet -Id 1 -Name 'foo' -Category (
New-Category -Id 2 -Name 'bar'
) -PhotoUrls @(
'http://example.com/foo',
'http://example.com/bar'
) -Tags (
New-Tag -Id 3 -Name 'baz'
) -Status 'Available'
.Inputs
System.Nullable[long]
IO.Swagger.Model.Category
System.String
System.Collections.Generic.List[string]
System.Collections.Generic.List[IO.Swagger.Model.Tag]
System.Nullable[IO.Swagger.Model.Pet+StatusEnum]
.Outputs
.Notes
This function is automatically generated by the Swagger Codegen.
.Link
https://github.com/swagger-api/swagger-codegen
#>
function New-Pet {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
[System.Nullable[long]]
${Id},
[Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)]
[IO.Swagger.Model.Category]
${Category},
[Parameter(Position = 2, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
[string]
${Name},
[Parameter(Position = 3, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
[System.Collections.Generic.List[string]]
${PhotoUrls},
[Parameter(Position = 4, ValueFromPipelineByPropertyName = $true)]
[System.Collections.Generic.List[IO.Swagger.Model.Tag]]
${Tags},
[Parameter(Position = 5, ValueFromPipelineByPropertyName = $true)]
[System.Nullable[IO.Swagger.Model.Pet+StatusEnum]]
${Status}
)
Process {
'Creating object: IO.Swagger.Model.Pet' | Write-Verbose
$PSBoundParameters | Out-DebugParameter | Write-Debug
New-Object -TypeName IO.Swagger.Model.Pet -ArgumentList @(
${Id},
${Category},
${Name},
${PhotoUrls},
${Tags},
${Status}
)
}
}

View File

@@ -0,0 +1,52 @@
<#
.Synopsis
Creates new IO.Swagger.Model.Tag object.
.Description
Creates new IO.Swagger.Model.Tag object.
.Parameter Id
ID.
.Parameter Name
Name
.Example
New-Tag -Id 1 -Name 'foo'
.Inputs
System.Nullable[long]
System.String
.Outputs
IO.Swagger.Model.Tag
.Notes
This function is automatically generated by the Swagger Codegen.
.Link
https://github.com/swagger-api/swagger-codegen
#>
function New-Tag {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
[System.Nullable[long]]
${Id},
[Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)]
[string]
${Name}
)
Process {
'Creating object: IO.Swagger.Model.Tag' | Write-Verbose
$PSBoundParameters | Out-DebugParameter | Write-Debug
New-Object -TypeName IO.Swagger.Model.Tag -ArgumentList @(
${Id},
${Name}
)
}
}

View File

@@ -0,0 +1,64 @@
<#
.Synopsis
Set PetStore Authorization data.
.Description
Set PetStore Authorization data.
.Parameter ApiKey
API key.
.Parameter ApiKeyPrefix
API Key prefix.
.Parameter AccessToken
Access Token.
.Example
Set-ApiCredential -ApiKey 'foo'
.Example
Set-ApiCredential -ApiKey 'foo' -ApiPrefix 'Bearer'
.Example
Set-ApiCredential -ApiKey 'foo' -ApiPrefix 'Bearer'
.Example
Set-ApiCredential -AccessToken 'YOUR_ACCESS_TOKEN'
#>
function Set-ApiCredential {
[CmdletBinding(DefaultParameterSetName = 'ApiKey')]
Param (
[Parameter(Position = 0, ParameterSetName = 'ApiKey')]
[string]
${ApiKey},
[Parameter(Position = 1, ParameterSetName = 'ApiKey')]
[string]
${ApiKeyPrefix},
[Parameter(Position = 2, ParameterSetName = 'AccessToken')]
[string]
${AccessToken}
)
End {
if (${ApiKey}) {
([IO.Swagger.Client.Configuration]::Default).ApiKey.Add(
'api_key',
${ApiKey}
)
}
if ($ApiKeyPrefix) {
([IO.Swagger.Client.Configuration]::Default).ApiKeyPrefix.Add(
'api_key',
${ApiKeyPrefix}
)
}
if (${AccessToken}) {
([IO.Swagger.Client.Configuration]::Default).AccessToken = ${AccessToken}
}
}
}

View File

@@ -0,0 +1,44 @@
<#
.Synopsis
Updates a pet in the store.
.Description
Updates a pet in the store.
.Parameter Pet
Pet.
.Example
Update-Pet -Pet $Pet
.Example
$Pet | Update-Pet
.Inputs
IO.Swagger.Model.Pet
.Outputs
.Notes
This function is automatically generated by the Swagger Codegen.
.Link
https://github.com/swagger-api/swagger-codegen
#>
function Update-Pet {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
[IO.Swagger.Model.Pet]
${Pet}
)
Process {
'Calling method: UpdatePet' | Write-Verbose
$PSBoundParameters | Out-DebugParameter | Write-Debug
$Script:PetApi.UpdatePet(
${Pet}
)
}
}

View File

@@ -0,0 +1,90 @@
<#
.Synopsis
Updates a pet in the store.
.Description
Updates a pet in the store.
.Parameter Id
ID of pet to return.
.Example
Update-PetUsingParameterSet -Id 1 -Name 'foo' -Status 'Available'
.Example
Update-PetUsingParameterSet -Id 1 -Name 'foo' -Status 'Available'
.Example
Update-PetUsingParameterSet -Pet $Pet
.Example
$Pet | Update-PetUsingParameterSet
.Inputs
System.Nullable[long]
System.String
System.String
IO.Swagger.Model.Pet
.Outputs
.Notes
This function is automatically generated by the Swagger Codegen.
.Link
https://github.com/swagger-api/swagger-codegen
#>
function Update-PetUsingParameterSet {
[CmdletBinding(DefaultParameterSetName = 'UpdatePetWithForm')]
Param (
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true, Mandatory = $true, ParameterSetName = 'UpdatePetWithForm')]
[System.Nullable[long]]
${Id},
[Parameter(Position = 1, ValueFromPipelineByPropertyName = $true, ParameterSetName = 'UpdatePetWithForm')]
[string]
${Name},
[Parameter(Position = 2, ValueFromPipelineByPropertyName = $true, ParameterSetName = 'UpdatePetWithForm')]
[string]
${Status},
[Parameter(Position = 0, ValueFromPipeline = $true, Mandatory = $true, ParameterSetName = 'UpdatePet')]
[IO.Swagger.Model.Pet]
${Pet}
)
Process {
switch ($PSCmdlet.ParameterSetName) {
'UpdatePetWithForm' {
'Calling method: UpdatePetWithForm' | Write-Verbose
$PSBoundParameters | Out-DebugParameter | Write-Debug
$Script:PetApi.UpdatePetWithForm(
${Id},
${Name},
${Status}
)
break
}
'UpdatePet' {
'Calling method: UpdatePet' | Write-Verbose
$PSBoundParameters | Out-DebugParameter | Write-Debug
$Script:PetApi.UpdatePet(
${Pet}
)
break
}
default {
throw 'Invalid ParameterSet!'
}
}
}
}

View File

@@ -0,0 +1,55 @@
<#
.Synopsis
Updates a pet in the store with form data.
.Description
Updates a pet in the store with form data.
.Parameter Id
ID of pet to return.
.Example
Update-PetWithForm -Id 1 -Name 'foo' -Status 'Available'
.Inputs
System.Nullable[long]
System.String
System.String
.Outputs
.Notes
This function is automatically generated by the Swagger Codegen.
.Link
https://github.com/swagger-api/swagger-codegen
#>
function Update-PetWithForm {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
[System.Nullable[long]]
${Id},
[Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)]
[string]
${Name},
[Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)]
[string]
${Status}
)
Process {
'Calling method: UpdatePetWithForm' | Write-Verbose
$PSBoundParameters | Out-DebugParameter | Write-Debug
$Script:PetApi.UpdatePetWithForm(
${Id},
${Name},
${Status}
)
}
}

View File

@@ -0,0 +1,19 @@
PSTOPIC
about_IO.Swagger
SHORT DESCRIPTION
IO.Swagger - the PowerShell module for the Swagger Petstore
LONG DESCRIPTION
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: " \
This PowerShell module is automatically generated by the Swagger Codegen project.
* API version: 1.0.0
* SDK version: 1.0.0
* Build package: io.swagger.codegen.languages.CSharpClientCodegen
Frameworks supported:
* PowerShell 3.0+
* .NET 4.0 or later