mirror of
https://github.com/Thumbscrew/PSMatrix.git
synced 2025-01-18 09:35:44 +00:00
add optional DeviceDisplayName parameter
This commit is contained in:
parent
e648d011f5
commit
605a50b713
@ -11,6 +11,9 @@
|
||||
.Parameter Credentials
|
||||
PSCredentials Object that contains the Matrix Username and Password for the user you wish to log in with.
|
||||
|
||||
.Parameter DeviceDisplayName
|
||||
Display name to assign to this Access token.
|
||||
|
||||
.Example
|
||||
# Create a PSCredentials Object
|
||||
$creds = Get-Credential
|
||||
@ -22,7 +25,10 @@ function New-MatrixAccessToken {
|
||||
[string]$ServerUrl,
|
||||
|
||||
[Parameter(Mandatory)]
|
||||
[PSCredential]$Credentials
|
||||
[PSCredential]$Credentials,
|
||||
|
||||
[Parameter(Mandatory=$false)]
|
||||
[string]$DeviceDisplayName="PSMatrix"
|
||||
)
|
||||
|
||||
$apiPath = "_matrix/client/v3/login"
|
||||
@ -35,7 +41,7 @@ function New-MatrixAccessToken {
|
||||
}
|
||||
type = "m.login.password"
|
||||
password = $Credentials.Password | ConvertFrom-SecureString -AsPlainText
|
||||
initial_device_display_name = "PSMatrix"
|
||||
initial_device_display_name = $DeviceDisplayName
|
||||
} | ConvertTo-Json
|
||||
|
||||
$res = Invoke-RestMethod -Uri "$ServerUrl/$apiPath" -Method $apiMethod -Body $reqBody
|
||||
|
Loading…
Reference in New Issue
Block a user