2022-04-24 15:38:16 +08:00

11 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

$User = Initialize-User -Id 0 -Username "MyUsername" -FirstName "MyFirstName" -LastName "MyLastName" -Email "MyEmail" -Password "MyPassword" -Phone "MyPhone" -UserStatus 0 -ObjectWithNoDeclaredProps  -ObjectWithNoDeclaredPropsNullable  -AnyTypeProp  -AnyTypePropNullable # User | Created user object

# Create user
try {
    $Result = New-PSUser -User $User
} catch {
    Write-Host ("Exception occurred 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

No authorization required

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

$User = Initialize-User -Id 0 -Username "MyUsername" -FirstName "MyFirstName" -LastName "MyLastName" -Email "MyEmail" -Password "MyPassword" -Phone "MyPhone" -UserStatus 0 -ObjectWithNoDeclaredProps  -ObjectWithNoDeclaredPropsNullable  -AnyTypeProp  -AnyTypePropNullable # User[] | List of user object

# Creates list of users with given input array
try {
    $Result = New-PSUsersWithArrayInput -User $User
} catch {
    Write-Host ("Exception occurred 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

No authorization required

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

$User = Initialize-User -Id 0 -Username "MyUsername" -FirstName "MyFirstName" -LastName "MyLastName" -Email "MyEmail" -Password "MyPassword" -Phone "MyPhone" -UserStatus 0 -ObjectWithNoDeclaredProps  -ObjectWithNoDeclaredPropsNullable  -AnyTypeProp  -AnyTypePropNullable # User[] | List of user object

# Creates list of users with given input array
try {
    $Result = New-PSUsersWithListInput -User $User
} catch {
    Write-Host ("Exception occurred 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

No authorization required

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

$Username = "MyUsername" # String | The name that needs to be deleted

# Delete user
try {
    $Result = Remove-PSUser -Username $Username
} catch {
    Write-Host ("Exception occurred 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

Return type

void (empty response body)

Authorization

No authorization required

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

$Username = "MyUsername" # String | The name that needs to be fetched. Use user1 for testing.

# Get user by user name
try {
    $Result = Get-PSUserByName -Username $Username
} catch {
    Write-Host ("Exception occurred 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.

Return type

User (PSCustomObject)

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

$Username = "MyUsername" # String | The user name for login
$Password = "MyPassword" # String | The password for login in clear text

# Logs user into the system
try {
    $Result = Invoke-PSLoginUser -Username $Username -Password $Password
} catch {
    Write-Host ("Exception occurred 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
Password String The password for login in clear text

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


# Logs out current logged in user session
try {
    $Result = Invoke-PSLogoutUser
} catch {
    Write-Host ("Exception occurred 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

No authorization required

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

$Username = "MyUsername" # String | name that need to be deleted
$User = Initialize-User -Id 0 -Username "MyUsername" -FirstName "MyFirstName" -LastName "MyLastName" -Email "MyEmail" -Password "MyPassword" -Phone "MyPhone" -UserStatus 0 -ObjectWithNoDeclaredProps  -ObjectWithNoDeclaredPropsNullable  -AnyTypeProp  -AnyTypePropNullable # User | Updated user object

# Updated user
try {
    $Result = Update-PSUser -Username $Username -User $User
} catch {
    Write-Host ("Exception occurred 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
User User Updated user object

Return type

void (empty response body)

Authorization

No authorization required

HTTP request headers

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

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