William Cheng f327f01c19
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
2020-05-08 20:13:01 +08:00

13 KiB

PSPetstore.PSPetstore/Api.PSUserApi

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

Method HTTP request Description
New-PSUser POST /user Create user
New-PSUsersWithArrayInput POST /user/createWithArray Creates list of users with given input array
New-PSUsersWithListInput POST /user/createWithList Creates list of users with given input array
Remove-PSUser DELETE /user/{username} Delete user
Get-PSUserByName GET /user/{username} Get user by user name
Invoke-PSLoginUser GET /user/login Logs user into the system
Invoke-PSLogoutUser GET /user/logout Logs out current logged in user session
Update-PSUser PUT /user/{username} Updated user

New-PSUser

void New-PSUser
        [-User]

Create user

This can only be done by the logged in user.

Example

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 Created user object

Return type

void (empty response body)

Authorization

auth_cookie

HTTP request headers

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

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

New-PSUsersWithArrayInput

void New-PSUsersWithArrayInput
        [-User] <PSCustomObject[]>

Creates list of users with given input array

Example

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[] List of user object

Return type

void (empty response body)

Authorization

auth_cookie

HTTP request headers

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

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

New-PSUsersWithListInput

void New-PSUsersWithListInput
        [-User] <PSCustomObject[]>

Creates list of users with given input array

Example

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[] List of user object

Return type

void (empty response body)

Authorization

auth_cookie

HTTP request headers

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

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

Remove-PSUser

void Remove-PSUser
        [-Username]

Delete user

This can only be done by the logged in user.

Example

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

HTTP request headers

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

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

Get-PSUserByName

User Get-PSUserByName
        [-Username]

Get user by user name

Example

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

Authorization

No authorization required

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]

Invoke-PSLoginUser

String Invoke-PSLoginUser
        [-Username]
        [-Password]

Logs user into the system

Example

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] [Back to Model list] [Back to README]

Invoke-PSLogoutUser

void Invoke-PSLogoutUser

Logs out current logged in user session

Example

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

HTTP request headers

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

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

Update-PSUser

void Update-PSUser
        [-Username]
        [-User]

Updated user

This can only be done by the logged in user.

Example

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 Updated user object

Return type

void (empty response body)

Authorization

auth_cookie

HTTP request headers

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

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