add Join-MatrixRoom function

This commit is contained in:
2022-03-31 21:30:43 +01:00
parent c16d850676
commit 35edf29957
2 changed files with 25 additions and 1 deletions

View 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 $_
}
}