mirror of
https://github.com/Thumbscrew/PSMatrix.git
synced 2025-04-12 02:03:39 +00:00
update README with examples
This commit is contained in:
parent
c1f4ea82fb
commit
b0355b0beb
56
README.md
56
README.md
@ -1,2 +1,56 @@
|
|||||||
# PSMatrix
|
# PSMatrix
|
||||||
PowerShell module for interacting with the Matrix API
|
PowerShell module for interacting with the Matrix API
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
1. Clone repo:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/Thumbscrew/PSMatrix.git
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Import module:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
Import-Module ./PSMatrix
|
||||||
|
```
|
||||||
|
|
||||||
|
## Getting Started
|
||||||
|
|
||||||
|
1. Create a `PSCredential` object:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
$creds = Get-Credential
|
||||||
|
|
||||||
|
PowerShell credential request
|
||||||
|
Enter your credentials.
|
||||||
|
User: username
|
||||||
|
Password for user username: **************
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Get an access token from your Matrix homeserver (this will be required for subsequent authenticated requests):
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
# DeviceDisplayName is optional and will default to "PSMatrix"
|
||||||
|
$token = New-MatrixAccessToken -ServerUrl "https://example.matrix.com" -Credentials $creds -DeviceDisplayName "PSMatrix"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
### Get a list Matrix rooms you've joined
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
$rooms = Get-MatrixJoinedRooms -ServerUrl "https://matrix.example.com" -AccessToken $token
|
||||||
|
```
|
||||||
|
|
||||||
|
### Get all members of a joined room
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
Get-MatrixJoinedMembers -ServerUrl "https://matrix.example.com" -AccessToken $token -RoomId "!ehXvUhWNASUkSLvAGP:matrix.org"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Log out of your session
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
Remove-MatrixAccessToken -ServerUrl "https://matrix.example.com" -AccessToken $token
|
||||||
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user