mirror of
https://github.com/Thumbscrew/PSMatrix.git
synced 2025-01-18 17:45:44 +00:00
add Join-MatrixRoom
function
This commit is contained in:
parent
c16d850676
commit
35edf29957
@ -72,7 +72,8 @@ PowerShellVersion = '7.0'
|
|||||||
FunctionsToExport = @(
|
FunctionsToExport = @(
|
||||||
'New-MatrixAccessToken',
|
'New-MatrixAccessToken',
|
||||||
'Remove-MatrixAccessToken',
|
'Remove-MatrixAccessToken',
|
||||||
'Get-MatrixJoinedRooms'
|
'Get-MatrixJoinedRooms',
|
||||||
|
'Join-MatrixRoom'
|
||||||
)
|
)
|
||||||
|
|
||||||
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
|
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
|
||||||
|
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 $_
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user