mirror of
https://github.com/Thumbscrew/PSMatrix.git
synced 2025-07-08 13:42:46 +00:00
add Join-MatrixRoom
function
This commit is contained in:
23
public/Join-MatrixRoom.ps1
Normal file
23
public/Join-MatrixRoom.ps1
Normal file
@ -0,0 +1,23 @@
|
||||
function Join-MatrixRoom {
|
||||
param(
|
||||
[Parameter(Mandatory)]
|
||||
[string]$ServerUrl,
|
||||
|
||||
[Parameter(Mandatory)]
|
||||
[SecureString]$AccessToken,
|
||||
|
||||
[Parameter(Mandatory)]
|
||||
[string]$RoomAliasOrId
|
||||
)
|
||||
|
||||
$url = New-MatrixUrl -ServerUrl $ServerUrl -ApiPath "_matrix/client/v3/join/$RoomAliasOrId?server_name=techlore.net"
|
||||
$headers = Get-MatrixAuthHeaders -AccessToken $AccessToken
|
||||
$method = "POST"
|
||||
|
||||
try {
|
||||
$res = Invoke-RestMethod -Uri $url -Headers $headers -Method $method
|
||||
return $res
|
||||
} catch {
|
||||
Write-Error $_
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user