William Cheng 01f02f6c57
[PS][Experimental] Add multiple server support (#5741)
* code comment

* add get host setting

* add multiple server support
2020-03-29 21:44:18 +08:00

12 KiB

PSPetstore.PSPetstore/Api.PSUserApi

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

Method HTTP request Description
Invoke-PSCreateUser POST /user Create user
Invoke-PSCreateUsersWithArrayInput POST /user/createWithArray Creates list of users with given input array
Invoke-PSCreateUsersWithListInput POST /user/createWithList Creates list of users with given input array
Invoke-PSDeleteUser 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

Invoke-PSCreateUser

void Invoke-PSCreateUser
        [-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 = (New-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 {
    Invoke-PSCreateUser -User $User
} catch {
    Write-Host ($_.ErrorDetails | ConvertFrom-Json)
    Write-Host ($_.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]

Invoke-PSCreateUsersWithArrayInput

void Invoke-PSCreateUsersWithArrayInput
        [-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 = @((New-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 {
    Invoke-PSCreateUsersWithArrayInput -User $User
} catch {
    Write-Host ($_.ErrorDetails | ConvertFrom-Json)
    Write-Host ($_.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]

Invoke-PSCreateUsersWithListInput

void Invoke-PSCreateUsersWithListInput
        [-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 {
    Invoke-PSCreateUsersWithListInput -User $User
} catch {
    Write-Host ($_.ErrorDetails | ConvertFrom-Json)
    Write-Host ($_.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]

Invoke-PSDeleteUser

void Invoke-PSDeleteUser
        [-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 {
    Invoke-PSDeleteUser -Username $Username
} catch {
    Write-Host ($_.ErrorDetails | ConvertFrom-Json)
    Write-Host ($_.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 ($_.ErrorDetails | ConvertFrom-Json)
    Write-Host ($_.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 ($_.ErrorDetails | ConvertFrom-Json)
    Write-Host ($_.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 ($_.ErrorDetails | ConvertFrom-Json)
    Write-Host ($_.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 ($_.ErrorDetails | ConvertFrom-Json)
    Write-Host ($_.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]