Documentation

Session
in package

A Matrix session.

Note that you should explicitly call 'logout' method to finish the session.

Table of Contents

Properties

$access_token  : string
$matrix_client  : mixed
Matrix client instance.
$user_id  : ID

Methods

__construct()  : mixed
change_password()  : void
Change user password.
create_room()  : Room
Create a new room.
get_access_token()  : string
Get the access token.
get_avatar()  : Content_URI
Get avatar Content URI.
get_joined_rooms()  : array<string|int, mixed>
Get list of joined rooms.
get_matrix_client()  : string
Get the Matrix client instance.
get_server_location()  : string
Get the server location.
get_user_id()  : ID
Get the USER ID.
join_room()  : string
Join a room.
logout()  : void
End the current session by invalidating the access token. Please note that you cannot use this session after calling this method.
send_message()  : Unique
Send a message.
set_avatar()  : void
Set avatar by a Content URI.
sudo()  : Admin_session
Try to acquire admin rights.
sync()  : User
Get all the user's state.
whoami()  : JSON
Return information about the owner of the current access token.

Properties

$access_token

protected string $access_token

$matrix_client

Matrix client instance.

protected mixed $matrix_client

Methods

__construct()

public __construct(Matrix_client $matrix_client, ID $user_id, string $access_token) : mixed
Parameters
$matrix_client : Matrix_client
$user_id : ID
$access_token : string

change_password()

Change user password.

public change_password( $old_password,  $new_password) : void

XXX: This only works when user's old password is needed for the 2nd stage of the authentication.

Parameters
$old_password :

Old user password.

$new_password :

New user password.

create_room()

Create a new room.

public create_room(string $name) : Room
Parameters
$name : string

A room name.

Tags
throws
Matrix_exception

on errors.

Return values
Room

A new room instance.

get_access_token()

Get the access token.

public get_access_token() : string
Return values
string

The access token (can be NULL.)

get_joined_rooms()

Get list of joined rooms.

public get_joined_rooms() : array<string|int, mixed>
Tags
throws
Matrix_exception

on errors.

Return values
array<string|int, mixed>

Array of joined rooms.

get_matrix_client()

Get the Matrix client instance.

public get_matrix_client() : string
Return values
string

The Matrix client instance.

get_server_location()

Get the server location.

public get_server_location() : string
Return values
string

The server location.

get_user_id()

Get the USER ID.

public get_user_id() : ID
Return values
ID

User ID.

join_room()

Join a room.

public join_room(object $room[, array<string|int, mixed> $third_party_signed = [] ]) : string
Parameters
$room : object

A room ID, alias or Room class instance.

$third_party_signed : array<string|int, mixed> = []

If the parameter was supplied, the homeserver must verify that it matches a pending 'm.room.third_party_invite' event in the room, and perform key validity checking if required by the event.

Tags
throws
Matrix_exception

on errors.

Return values
string

ID of a joined room.

logout()

End the current session by invalidating the access token. Please note that you cannot use this session after calling this method.

public logout() : void
Tags
throws
Matrix_exception

on errors.

send_message()

Send a message.

public send_message( $room,  $type,  $body[, string $fmbody = '' ]) : Unique
Parameters
$room :

A Room instance.

$type :

Message type (e.g. 'm.text'.)

$body :

Message body.

$fmbody : string = ''
Tags
throws
Matrix_exception

on errors.

Return values
Unique

event ID that identifies the sent message.

sync()

Get all the user's state.

public sync() : User
Tags
throws
Matrix_exception

on errors.

Return values
User

state.

whoami()

Return information about the owner of the current access token.

public whoami() : JSON
Return values
JSON

response.


        
On this page

Search results