MatrixAPI

MatrixAPI — Base interface for all Client/Server API functionality.

Functions

void matrix_api_abort_pending ()
void matrix_api_media_download ()
void matrix_api_media_thumbnail ()
void matrix_api_media_upload ()
void matrix_api_get_presence_list ()
void matrix_api_update_presence_list ()
void matrix_api_get_user_presence ()
void matrix_api_set_user_presence ()
void matrix_api_update_pusher ()
void matrix_api_get_pushers ()
void matrix_api_delete_pusher ()
void matrix_api_get_pusher ()
void matrix_api_add_pusher ()
void matrix_api_toggle_pusher ()
void matrix_api_create_room ()
void matrix_api_delete_room_alias ()
void matrix_api_get_room_id ()
void matrix_api_create_room_alias ()
void matrix_api_list_public_rooms ()
void matrix_api_ban_user ()
void matrix_api_forget_room ()
void matrix_api_invite_user_3rdparty ()
void matrix_api_invite_user ()
void matrix_api_join_room ()
void matrix_api_leave_room ()
void matrix_api_event_stream ()
void matrix_api_get_event ()
void matrix_api_initial_sync ()
void matrix_api_get_event_context ()
void matrix_api_initial_sync_room ()
void matrix_api_list_room_members ()
void matrix_api_list_room_messages ()
void matrix_api_send_event_receipt ()
void matrix_api_redact_event ()
void matrix_api_send_message_event ()
void matrix_api_get_room_state ()
void matrix_api_send_room_event ()
void matrix_api_notify_room_typing ()
void matrix_api_sync ()
void matrix_api_create_filter ()
void matrix_api_download_filter ()
void matrix_api_search ()
void matrix_api_whois ()
void matrix_api_versions ()
void matrix_api_login ()
void matrix_api_token_refresh ()
void matrix_api_get_3pids ()
void matrix_api_add_3pid ()
void matrix_api_change_password ()
void matrix_api_get_profile ()
void matrix_api_get_avatar_url ()
void matrix_api_set_avatar_url ()
void matrix_api_get_display_name ()
void matrix_api_set_display_name ()
void matrix_api_register_account ()
void matrix_api_set_account_data ()
void matrix_api_get_room_tags ()
void matrix_api_delete_room_tag ()
void matrix_api_add_room_tag ()
void matrix_api_get_turn_server ()
void (*MatrixAPICallback) ()
const gchar * matrix_api_get_token ()
void matrix_api_set_token ()
const gchar * matrix_api_get_refresh_token ()
void matrix_api_set_refresh_token ()
const gchar * matrix_api_get_user_id ()
const gchar * matrix_api_get_homeserver ()

Types and Values

Object Hierarchy


Description

Functions

matrix_api_abort_pending ()

void
matrix_api_abort_pending (MatrixAPI *self);

Abort all pending requests toward a Matrix homeserver. Be aware that this may leave requests in an inconsistent state.

Parameters

self

the MatrixAPI instance

 

matrix_api_media_download ()

void
matrix_api_media_download (MatrixAPI *self,
                           MatrixAPICallback callback,
                           void *callback_target,
                           const gchar *server_name,
                           const gchar *media_id,
                           GError **error);

Download content from the content repository.

Implementors: If server_name or media_id is

null

, implementations MUST throw Matrix.Error.INCOMPLETE.

Parameters

self

the MatrixAPI instance

 

callback

 .

a function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

server_name

 .

the server name from the mxc: URI

.

[in]

media_id

 .

the media ID from the mxc: URI

.

[in]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_media_thumbnail ()

void
matrix_api_media_thumbnail (MatrixAPI *self,
                            MatrixAPICallback callback,
                            void *callback_target,
                            const gchar *server_name,
                            const gchar *media_id,
                            guint width,
                            guint height,
                            MatrixResizeMethod method,
                            GError **error);

Download a thumbnail of the content from the content repository. The actual thumbnail may not match the size specified.

If param server_name or param media_id is

null

, this function returns immediately, and throws Matrix.Error.INCOMPLETE.

Parameters

self

the MatrixAPI instance

 

callback

 .

a function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

server_name

 .

the server name from the mxc: URI

.

[in]

media_id

 .

the media ID from the mxc: URI

.

[in]

width

 

 

height

 

 

method

 

 

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_media_upload ()

void
matrix_api_media_upload (MatrixAPI *self,
                         MatrixAPICallback callback,
                         void *callback_target,
                         const gchar *content_type,
                         GByteArray *content,
                         GError **error);

Upload some content to the content repository.

If param content is

null

, this function returns immediately, and throws Matrix.Error.INCOMPLETE.

Parameters

self

the MatrixAPI instance

 

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

content_type

 .

the type of the content to be uploaded

.

[in][allow-none]

content

 .

the content to be uploaded

.

[in][transfer full]

callback

 

 

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_get_presence_list ()

void
matrix_api_get_presence_list (MatrixAPI *self,
                              MatrixAPICallback callback,
                              void *callback_target,
                              const gchar *user_id,
                              GError **error);

Retrieve a list of presence events for every user on this list.

If param user_id is

null

, this function returns immediately, and throws Matrix.Error.INCOMPLETE.

Parameters

self

the MatrixAPI instance

 

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

user_id

 .

the user whose presence list should be retrieved

.

[in]

callback

 

 

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_update_presence_list ()

void
matrix_api_update_presence_list (MatrixAPI *self,
                                 MatrixAPICallback callback,
                                 void *callback_target,
                                 const gchar *user_id,
                                 GList *drop_ids,
                                 GList *invite_ids,
                                 GError **error);

Add or remove users from the specified user's presence list.

If param user_id, or both param drop_ids and param invite_ids are

null

, this function returns immediately, and throws Matrix.Error.INCOMPLETE.

Parameters

self

the MatrixAPI instance

 

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

user_id

 .

the user whose presence list is being modified

.

[in]

drop_ids

 .

a list of user IDs to remove from the list

.

[in]

invite_ids

 .

a list of user IDs to add to the list

.

[in]

callback

 

 

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_get_user_presence ()

void
matrix_api_get_user_presence (MatrixAPI *self,
                              MatrixAPICallback callback,
                              void *callback_target,
                              const gchar *user_id,
                              GError **error);

Get the given user's presence state.

If param user_id is

null

, this function returns immediately, and throws Matrix.Error.INCOMPLETE.

Parameters

self

the MatrixAPI instance

 

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

user_id

 .

the user whose presence list is being modified

.

[in]

callback

 

 

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_set_user_presence ()

void
matrix_api_set_user_presence (MatrixAPI *self,
                              MatrixAPICallback callback,
                              void *callback_target,
                              const gchar *user_id,
                              MatrixPresence presence,
                              const gchar *status_message,
                              GError **error);

Set the given user's presence. You cannot set the presence of another user.

If param user_id is

null

, this function returns immediately, and throws Matrix.Error.INCOMPLETE.

Parameters

self

the MatrixAPI instance

 

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

user_id

 .

the user whose presence list is being modified

.

[in]

presence

 .

the new presence state

.

[in]

status_message

 .

a status message attached to this state

.

[in][allow-none]

callback

 

 

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_update_pusher ()

void
matrix_api_update_pusher (MatrixAPI *self,
                          MatrixAPICallback callback,
                          void *callback_target,
                          MatrixPusher *pusher,
                          GError **error);

Create, update or delete a pusher for the active user on this homeserver.

If param pusher is

null

, this function returns immediately, and throws Matrix.Error.INCOMPLETE.

Parameters

self

the MatrixAPI instance

 

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

callback

 

 

pusher

 

 

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_get_pushers ()

void
matrix_api_get_pushers (MatrixAPI *self,
                        MatrixAPICallback callback,
                        void *callback_target,
                        GError **error);

Retrieve all push rulesets.

Parameters

self

the MatrixAPI instance

 

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

callback

 

 

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_delete_pusher ()

void
matrix_api_delete_pusher (MatrixAPI *self,
                          MatrixAPICallback callback,
                          void *callback_target,
                          const gchar *scope,
                          MatrixPusherKind kind,
                          const gchar *rule_id,
                          GError **error);

Delete a push rule.

If param scope or param rule_id is

null

, this function returns immediately, and throws Matrix.Error.INCOMPLETE.

Parameters

self

the MatrixAPI instance

 

callback

 .

a function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

scope

 .

either

global

to specify global rules, or

device/<profile tag>

for rules for a given

profile tag

.

[in]

kind

 .

the kind of rule

.

[in]

rule_id

 .

an identifier for the rule

.

[in]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_get_pusher ()

void
matrix_api_get_pusher (MatrixAPI *self,
                       MatrixAPICallback callback,
                       void *callback_target,
                       const gchar *scope,
                       MatrixPusherKind kind,
                       const gchar *rule_id,
                       GError **error);

Retrieve a specific push rule.

If param scope or param rule_id is

null

, this function returns immediately, and throws Matrix.Error.INCOMPLETE.

Parameters

self

the MatrixAPI instance

 

callback

 .

a function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

scope

 .

either

global

to specify global rules, or

device/<profile tag>

for rules for a given

profile tag

.

.

[in]

kind

 .

the kind of rule

.

[in]

rule_id

 .

an identifier for the rule

.

[in]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_add_pusher ()

void
matrix_api_add_pusher (MatrixAPI *self,
                       MatrixAPICallback callback,
                       void *callback_target,
                       const gchar *scope,
                       MatrixPusherKind kind,
                       const gchar *rule_id,
                       const gchar *before,
                       const gchar *after,
                       GList *actions,
                       GList *conditions,
                       GError **error);

Add or change a push rule.

If either param scope, param rule_id or param actions are

null

, this function returns immediately, and throws Matrix.Error.INCOMPLETE.

Parameters

self

the MatrixAPI instance

 

callback

 .

a function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

scope

 .

either

global

to specify global rules, or

device/<profile tag>

for rules for a given

profile tag

.

[in]

kind

 .

the kind of rule

.

[in]

rule_id

 .

an identifier for the rule

.

[in]

before

 .

make the new rule the next-most important than this rule ID

.

[in][allow-none]

after

 .

make the new rule the next-less important than this rule ID

.

[in][allow-none]

actions

 .

the actions to perform when the conditions for this rule are met

.

[in]

conditions

 .

the conditions that must hold true for an event for a rule to be applied. A rule with no conditions always matches

.

[in][allow-none]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_toggle_pusher ()

void
matrix_api_toggle_pusher (MatrixAPI *self,
                          MatrixAPICallback callback,
                          void *callback_target,
                          const gchar *scope,
                          MatrixPusherKind kind,
                          const gchar *rule_id,
                          gboolean enabled,
                          GError **error);

Enable or disable the specified push rule.

If scope or rule_id is NULL, this function returns immediately, and fills error with MATRIX_ERROR_INCOMPLETE.

Parameters

self

the MatrixAPI instance

 

callback

 .

a function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

scope

 .

either

global

to specify global rules, or

device/<profile tag>

for rules for a given

profile tag

.

[in]

kind

 .

the kind of rule

.

[in]

rule_id

 .

an identifier for the rule

.

[in]

enabled

 .

if

true

, the rule will be enabled, otherwise it gets disabled

.

[in]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_create_room ()

void
matrix_api_create_room (MatrixAPI *self,
                        MatrixAPICallback callback,
                        void *callback_target,
                        MatrixRoomPreset preset,
                        const gchar *room_name,
                        const gchar *room_alias,
                        const gchar *topic,
                        MatrixRoomVisibility visibility,
                        JsonNode *creation_content,
                        GList *initial_state,
                        GList *invitees,
                        GList *invite_3pids,
                        GError **error);

Create a new room with the given name and invite the users in param invitees.

Parameters

self

the MatrixAPI instance

 

callback

 .

the function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

preset

 .

a room preset to use

.

[in]

room_name

 .

the desired display name for the room

.

[in][allow-none]

room_alias

 .

an alias of the room

.

[in][allow-none]

topic

 .

the topic of the room

.

[in][allow-none]

visibility

 .

the initial visibility of the room

.

[in]

creation_content

 .

extra keys to be added to the content of m.room.create

.

[in][allow-none]

initial_state

 .

a list of state events to set in the new room

.

[in][allow-none]

invitees

 .

list of user IDs to invite to the new room

.

[in][allow-none]

invite_3pids

 .

a list of 3rd party credentials to invite to the new room

.

[in][allow-none]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_delete_room_alias ()

void
matrix_api_delete_room_alias (MatrixAPI *self,
                              MatrixAPICallback callback,
                              void *callback_target,
                              const gchar *room_alias,
                              GError **error);

Remove the mapping of room_alias to its room ID

Servers may choose to implement additional access control checks here, for instance that room aliases can only be deleted by their creator or a server administrator.

If room_alias is NULL, this function returns immediately, and fills error with MATRIX_ERROR_INCOMPLETE.

Parameters

self

the MatrixAPI instance

 

callback

 .

the function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

room_alias

 .

the alias name to remove

.

[in]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_get_room_id ()

void
matrix_api_get_room_id (MatrixAPI *self,
                        MatrixAPICallback callback,
                        void *callback_target,
                        const gchar *room_alias,
                        GError **error);

Get the room ID corresponding to this room alias.

If param room_alias is

null

, this function returns immediately, throws Matrix.Error.INCOMPLETE.

Parameters

self

the MatrixAPI instance

 

callback

 .

the function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

room_alias

 .

the room alias

.

[in]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_create_room_alias ()

void
matrix_api_create_room_alias (MatrixAPI *self,
                              MatrixAPICallback callback,
                              void *callback_target,
                              const gchar *room_id,
                              const gchar *room_alias,
                              GError **error);

Create a new mapping from room alias to room ID.

If param room_alias or param room_id is

null

, this function returns immediately, and throws Matrix.Error.INCOMPLETE.

Parameters

self

the MatrixAPI instance

 

callback

 .

the function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

room_id

 .

the room ID to add this alias to

.

[in]

room_alias

 .

the room alias to set

.

[in]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_list_public_rooms ()

void
matrix_api_list_public_rooms (MatrixAPI *self,
                              MatrixAPICallback callback,
                              void *callback_target,
                              GError **error);

List the public rooms on the server.

Parameters

self

the MatrixAPI instance

 

callback

 .

the function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_ban_user ()

void
matrix_api_ban_user (MatrixAPI *self,
                     MatrixAPICallback callback,
                     void *callback_target,
                     const gchar *room_id,
                     const gchar *user_id,
                     const gchar *reason,
                     GError **error);

Ban the specified user from the specified room. An optional reason can be specified.

If param room_id or param user_id is

null

, this function returns immediately, and throws Matrix.Error.INCOMPLETE.

Parameters

self

the MatrixAPI instance

 

callback

 .

the function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

room_id

 .

the room ID where the user should be banned

.

[in]

user_id

 .

the user ID to ban

.

[in]

reason

 .

the reason of the ban

.

[in][allow-none]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_forget_room ()

void
matrix_api_forget_room (MatrixAPI *self,
                        MatrixAPICallback callback,
                        void *callback_target,
                        const gchar *room_id,
                        GError **error);

Stop the requesting user remembering about a particular room.

In general, history is a first class citizen in Matrix. After this API is called, however, a user will no longer be able to retrieve history for this room. If all users on a homeserver forget a room, the room is eligible for deletion from that homeserver.

If the user is currently joined to the room, they will implicitly leave the room as part of this API call.

If param room_id is

null

, this function returns immediately, and throws Matrix.Error.INCOMPLETE.

Parameters

self

the MatrixAPI instance

 

callback

 .

the function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

room_id

 .

the room ID to forget

.

[in]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_invite_user_3rdparty ()

void
matrix_api_invite_user_3rdparty (MatrixAPI *self,
                                 MatrixAPICallback callback,
                                 void *callback_target,
                                 const gchar *room_id,
                                 Matrix3PidCredential *credential,
                                 GError **error);

Invite a user to the room by a 3rd party identifier. They do not start participating in the room until they actually join the room.

If the identity server does not know a Matrix user identifier for the passed third party identifier, the homeserver will issue an invitation which can be accepted upon providing proof of ownership of the third party identifier.

If param credential is

null

, this function immediately returns, and throws Matrix.Error.INCOMPLETE.

Parameters

self

the MatrixAPI instance

 

callback

 .

the function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

room_id

 .

the room ID to which to invite the user

.

[in]

credential

 .

a Matrix3PidCredential that identifies a user to invite

.

[in]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_invite_user ()

void
matrix_api_invite_user (MatrixAPI *self,
                        MatrixAPICallback callback,
                        void *callback_target,
                        const gchar *room_id,
                        const gchar *user_id,
                        GError **error);

Invite a user to a room.

If room_id or user_id is NULL, this function returns immediately, and fills error with MATRIX_ERROR_INCOMPLETE.

Parameters

self

the MatrixAPI instance

 

callback

 .

the function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

room_id

 .

the room ID to invite the user to

.

[in]

user_id

 .

the user ID to invite

.

[in]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_join_room ()

void
matrix_api_join_room (MatrixAPI *self,
                      MatrixAPICallback callback,
                      void *callback_target,
                      const gchar *room_id,
                      GError **error);

Join a room.

If param room_id is

null

, this function returns immediately, and throws Matrix.Error.INCOMPLETE.

Parameters

self

the MatrixAPI instance

 

callback

 .

the function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

room_id

 .

the room ID to join to

.

[in]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_leave_room ()

void
matrix_api_leave_room (MatrixAPI *self,
                       MatrixAPICallback callback,
                       void *callback_target,
                       const gchar *room_id,
                       GError **error);

Leave a room.

If param room_id is

null

, this function returns immediately, and throws Matrix.Error.INCOMPLETE.

Parameters

self

the MatrixAPI instance

 

callback

 .

the function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

room_id

 .

the room ID to kick the user from

.

[in]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_event_stream ()

void
matrix_api_event_stream (MatrixAPI *self,
                         MatrixAPICallback callback,
                         void *callback_target,
                         const gchar *from_token,
                         gulong timeout,
                         GError **error);

Get the event stream, optionally beginning from from_token .

Parameters

self

the MatrixAPI instance

 

callback

 .

the function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

from_token

 .

events will be listed from this token

.

[in][allow-none]

timeout

 .

timeout of the request

.

[in]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_get_event ()

void
matrix_api_get_event (MatrixAPI *self,
                      MatrixAPICallback callback,
                      void *callback_target,
                      const gchar *event_id,
                      GError **error);

Get a single event by event ID.

If param event_id is

null

, this function returns immediately, and throws Matrix.Error.INCOMPLETE.

Parameters

self

the MatrixAPI instance

 

callback

 .

the function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

event_id

 .

the event ID to get

.

[in]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_initial_sync ()

void
matrix_api_initial_sync (MatrixAPI *self,
                         MatrixAPICallback callback,
                         void *callback_target,
                         guint limit,
                         gboolean archived,
                         GError **error);

Perform an initial sync of events

Parameters

self

the MatrixAPI instance

 

callback

 .

the function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

limit

 .

the maximum number of events to get

.

[in]

archived

 .

whether to include rooms that the user has left

.

[in]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_get_event_context ()

void
matrix_api_get_event_context (MatrixAPI *self,
                              MatrixAPICallback callback,
                              void *callback_target,
                              const gchar *room_id,
                              const gchar *event_id,
                              guint limit,
                              GError **error);

Gets a number of events that happened just before and after the specified event.

If param room_id or param event_id is

null

, this function returns immediately, and throws Matrix.Error.INCOMPLETE.

Parameters

self

the MatrixAPI instance

 

callback

 .

the function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

room_id

 .

the room to get events from

.

[in]

event_id

 .

the event to get context around

.

[in]

limit

 .

the maximum number of events to get. If 0, a default value is used (10, according to the specification)

.

[in]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_initial_sync_room ()

void
matrix_api_initial_sync_room (MatrixAPI *self,
                              MatrixAPICallback callback,
                              void *callback_target,
                              const gchar *room_id,
                              GError **error);

Get a copy of the current state and the most recent messages in a room.

If param room_id is

null

, this function returns immediately, and throws Matrix.Error.INCOMPLETE.

Parameters

self

the MatrixAPI instance

 

callback

 .

the function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

room_id

 .

the room to get the data for

.

[in]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_list_room_members ()

void
matrix_api_list_room_members (MatrixAPI *self,
                              MatrixAPICallback callback,
                              void *callback_target,
                              const gchar *room_id,
                              GError **error);

Get the list of members for a room.

If param room_id is

null

, this function returns immediately, and throws Matrix.Error.INCOMPLETE.

Parameters

self

the MatrixAPI instance

 

callback

 .

the function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

room_id

 .

the room to get the member events for

.

[in]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_list_room_messages ()

void
matrix_api_list_room_messages (MatrixAPI *self,
                               MatrixAPICallback callback,
                               void *callback_target,
                               const gchar *room_id,
                               const gchar *from_token,
                               MatrixEventDirection direction,
                               guint limit,
                               GError **error);

Get a list of message and state events for a room.

If param room_id or param from_token is

null

, this function returns immediately, and throws Matrix.Error.INCOMPLETE.

Parameters

self

the MatrixAPI instance

 

callback

 .

the function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

room_id

 .

the room to get the events for

.

[in]

from_token

 .

the token to start returning events from. This token can be obtained by calling matrix_api_initial_sync() or matrix_api_initial_sync_room()

.

[in]

direction

 .

the direction of the returned events

.

[in]

limit

 .

the maximum number of events to return. If 0, a default value will be used (10, according to the specification

.

[in]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_send_event_receipt ()

void
matrix_api_send_event_receipt (MatrixAPI *self,
                               MatrixAPICallback callback,
                               void *callback_target,
                               const gchar *room_id,
                               MatrixReceiptType receipt_type,
                               const gchar *event_id,
                               JsonNode *receipt,
                               GError **error);

Update the marker for the given receipt type to the event ID specified.

If param room_id, param event_id or param receipt is

null

, this function returns immediately, and throws Matrix.Error.INCOMPLETE.

Parameters

self

the MatrixAPI instance

 

callback

 .

the function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

room_id

 .

the room in which to send the event

.

[in]

receipt_type

 .

type of the receipt

.

[in]

event_id

 .

the event ID to acknowledge up to

.

[in]

receipt

 .

extra receipt information to attach. Note that the server will automatically attach the

ts

field

.

[in]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_redact_event ()

void
matrix_api_redact_event (MatrixAPI *self,
                         MatrixAPICallback callback,
                         void *callback_target,
                         const gchar *room_id,
                         const gchar *event_id,
                         const gchar *txn_id,
                         const gchar *reason,
                         GError **error);

Strip all information out of an event which isn't critical to the integrity of the server-side representation of the room. This cannot be undone.

Users may redact their own events, and any user with a power level greater than or equal to

redact

power level of the room may redact events there.

If param room_id, param event_id or param txn_id is

null

, this function returns immediately, and throws Matrix.Error.INCOMPLETE.

Parameters

self

the MatrixAPI instance

 

callback

 .

the function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

room_id

 .

the room from which to redact the event

.

[in]

event_id

 .

the event ID to acknowledge up to

.

[in]

txn_id

 .

the transaction ID for this event. Clients should generate a unique ID; it will be used by the server to ensure idempotency of requests

.

[in]

reason

 .

the reason for the event being redacted

.

[in][allow-none]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_send_message_event ()

void
matrix_api_send_message_event (MatrixAPI *self,
                               MatrixAPICallback callback,
                               void *callback_target,
                               const gchar *room_id,
                               const gchar *event_type,
                               const gchar *txn_id,
                               JsonNode *content,
                               GError **error);

Send a message event to the room.

If param room_id, param event_type, param txn_id or content is

null

, this function returns immediately, and throws Matrix.Error.INCOMPLETE.

Parameters

self

the MatrixAPI instance

 

callback

 .

the function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

room_id

 .

the room to send the event to

.

[in]

event_type

 .

the type of event to send

.

[in]

txn_id

 .

the transaction ID for this event. Clients should generate a unique ID; it will be used by the server to ensure idempotency of requests

.

[in]

content

 .

the content of the event as a JsonNode

.

[in][transfer full]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_get_room_state ()

void
matrix_api_get_room_state (MatrixAPI *self,
                           MatrixAPICallback callback,
                           void *callback_target,
                           const gchar *room_id,
                           const gchar *event_type,
                           const gchar *state_key,
                           GError **error);

Look up the contents of a state event in a room. If both param event_type and param state_key are empty, get a list of state events for that room.

If param room_id is

null

, or if param state_key is set with param event_type being

null

, this function returns immediately, and throws Matrix.Error.INCOMPLETE.

Parameters

self

the MatrixAPI instance

 

callback

 .

the function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

room_id

 .

the room ID to get a state for

.

[in]

event_type

 .

the type of state to look up

.

[in][allow-none]

state_key

 .

the key of the state to look up. If param event_type is

null

, this parameter is ignored

.

[in][allow-none]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_send_room_event ()

void
matrix_api_send_room_event (MatrixAPI *self,
                            MatrixAPICallback callback,
                            void *callback_target,
                            const gchar *room_id,
                            const gchar *event_type,
                            const gchar *state_key,
                            JsonNode *content,
                            GError **error);

Send a state event to the room. These events will be overwritten if param room_id, param event_type and param state_key all match.

This request cannot use transaction IDs.

The required fields in the body of the request (param content) vary depending on the type of the event.

If param room_id or param content is

null

, or if param state_key is set with param event_type being

null

, this function returns immediately, and throw Matrix.Error.INCOMPLETE.

Parameters

self

the MatrixAPI instance

 

callback

 .

the function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

room_id

 .

the room ID to get a state for

.

[in]

event_type

 .

the type of state to look up

.

[in]

state_key

 .

the key of the state to look up. If param event_type is

null

, this parameter is ignored

.

[in][allow-none]

content

 .

the content of the state event

.

[in][transfer full]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_notify_room_typing ()

void
matrix_api_notify_room_typing (MatrixAPI *self,
                               MatrixAPICallback callback,
                               void *callback_target,
                               const gchar *user_id,
                               const gchar *room_id,
                               guint timeout,
                               gboolean typing,
                               GError **error);

Tell the server the user is typing for the next param timeout milliseconds. If param typing is

false

, it tells the server that the user stopped typing.

If param user_id or param room_id is

null

, this function returns immediately, and throws Matrix.Error.INCOMPLETE.

Parameters

self

the MatrixAPI instance

 

callback

 .

the function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

user_id

 .

the user who has started to type

.

[in]

room_id

 .

the room in which the user is typing

.

[in]

timeout

 .

the length of time in milliseconds to mark this user as typing

.

[in]

typing

 .

whether the user is typing or not. If

false

, param timeout can be omitted (ie. set to 0)

.

[in]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_sync ()

void
matrix_api_sync (MatrixAPI *self,
                 MatrixAPICallback callback,
                 void *callback_target,
                 const gchar *filter_id,
                 MatrixFilter *filter,
                 const gchar *since,
                 gboolean full_state,
                 gboolean set_presence,
                 gulong timeout,
                 GError **error);

Synchronize the client's state with the latest state on the server. Clients should use this API when they first log in to get an initial snapshot of the state on the server and then continue to call this API to get incremental details to the state and to receive new messages.

Only one of param filter and param filter_id should be specified, or both of them should be set to

null

to receive all events.

Parameters

self

the MatrixAPI instance

 

callback

 .

the function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

filter_id

 .

a filter ID created by the filter API (e.g. matrix_api_create_filter())

.

[in][allow-none]

filter

 .

a definition on what events to fetch

.

[in][allow-none]

since

 .

a point in time to continue a sync from

.

[in][allow-none]

full_state

 .

if

true

, all state events will be returned, even if param since is not empty. If

false

, and param since is not empty, only states which have changed since the point indicated by param since will be returned

.

[in]

set_presence

 .

controls whether the client is automatically marked as online by polling this API.

.

[in]

timeout

 .

the maximum time to poll in milliseconds

.

[in]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_create_filter ()

void
matrix_api_create_filter (MatrixAPI *self,
                          MatrixAPICallback callback,
                          void *callback_target,
                          const gchar *user_id,
                          MatrixFilter *filter,
                          GError **error);

Upload a new filter definition to the homeserver. It will return a filter ID that may be used in future requests.

If param user_id or param filter is

null

, this function returns immediately, and throws Matrix.Error.INCOMPLETE.

Parameters

self

the MatrixAPI instance

 

callback

 .

the function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

user_id

 .

the ID of the user uploading the filter. An access token must be present (either specifying one with matrix_api_set_token() or requested from the server via matrix_api_register_account() or matrix_api_login()).

.

[in]

filter

 .

the filter to upload

.

[in]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_download_filter ()

void
matrix_api_download_filter (MatrixAPI *self,
                            MatrixAPICallback callback,
                            void *callback_target,
                            const gchar *user_id,
                            const gchar *filter_id,
                            GError **error);

Download a filter.

If param user_id or param filter_id is

null

, this function returns immediately, and throws Matrix.Error.INCOMPLETE.

Parameters

self

the MatrixAPI instance

 

callback

 .

the function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

user_id

 .

the user ID to download a filter from

.

[in]

filter_id

 .

the filter ID to download

.

[in]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_search ()

void
matrix_api_search (MatrixAPI *self,
                   MatrixAPICallback callback,
                   void *callback_target,
                   const gchar *next_batch,
                   MatrixSearchCategories *search_categories,
                   GError **error);

Perform a server side search.

Parameters

self

the MatrixAPI instance

 

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

next_batch

 .

the point to return events from. If given, this should be a next_batch result from a previous call to this method

.

[in][allow-none]

search_categories

 .

describes which categories to search, and their criteria

.

[in]

callback

 

 

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_whois ()

void
matrix_api_whois (MatrixAPI *self,
                  MatrixAPICallback callback,
                  void *callback_target,
                  const gchar *user_id,
                  GError **error);

Get information about a particular user.

If param user_id is

null

, this function returns immediately, and throws Matrix.Error.INCOMPLETE.

Parameters

self

the MatrixAPI instance

 

callback

 .

the function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

user_id

 .

the user ID to look up

.

[in]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_versions ()

void
matrix_api_versions (MatrixAPI *self,
                     MatrixAPICallback callback,
                     void *callback_target,
                     GError **error);

Get the versions of the specification supported by the server.

Parameters

self

the MatrixAPI instance

 

callback

 .

the function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_login ()

void
matrix_api_login (MatrixAPI *self,
                  MatrixAPICallback callback,
                  void *callback_target,
                  const gchar *login_type,
                  JsonNode *content,
                  GError **error);

Attempt to login with type param type. Implementations of this method must set the token property on a successful login.

If param login_type or param content is

null

, this function returns immediately, and throws Matrix.Error.INCOMPLETE.

Parameters

self

the MatrixAPI instance

 

callback

 .

the function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

login_type

 .

the login type to use

.

[in]

content

 .

parameters to pass for the login request

.

[in][allow-none]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_token_refresh ()

void
matrix_api_token_refresh (MatrixAPI *self,
                          MatrixAPICallback callback,
                          void *callback_target,
                          const gchar *refresh_token,
                          GError **error);

Exchanges a refresh token for a new access token. This is intended to be used if the access token has expired. If param refresh_token is

null

, implementations MUST send the stored refresh token. If it is not pesent (e.g. because login hasn’t happened yet), this function MUST throw an error.

Parameters

self

the MatrixAPI instance

 

callback

 .

the function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

refresh_token

 .

the refresh token that was issued by the server

.

[in][allow-none]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_get_3pids ()

void
matrix_api_get_3pids (MatrixAPI *self,
                      MatrixAPICallback callback,
                      void *callback_target,
                      GError **error);

Get a list of the third party identifiers that a homeserver has associated with the user's account.

This is not the same as the list of third party identifiers bound to the user's Matrix ID in Identity Servers.

Identifiers in this list may be used by the homeserver as, for example, identifiers to accept to reset the user's account password.

Parameters

self

the MatrixAPI instance

 

callback

 .

the function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_add_3pid ()

void
matrix_api_add_3pid (MatrixAPI *self,
                     MatrixAPICallback callback,
                     void *callback_target,
                     gboolean bind_creds,
                     Matrix3PidCredential *threepid_creds,
                     GError **error);

Add contact information to the user's account.

If param threepid_creds is

null

, this function returns immediately, and throws Matrix.Error.INCOMPLETE.

Parameters

self

the MatrixAPI instance

 

callback

 .

the function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

bind_creds

 .

whether the homeserver should also bind this third party identifier to the account's Matrix ID with the passed Identity Server.

.

[in]

threepid_creds

 .

the credentials to associate with the account

.

[in]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_change_password ()

void
matrix_api_change_password (MatrixAPI *self,
                            MatrixAPICallback callback,
                            void *callback_target,
                            const gchar *new_password,
                            GError **error);

Change the active user's password.

If param new_password is

null

, this function returns immediately, and throws Matrix.Error.INCOMPLETE.

Parameters

self

the MatrixAPI instance

 

callback

 .

the function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

new_password

 .

the new password for the account

.

[in]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_get_profile ()

void
matrix_api_get_profile (MatrixAPI *self,
                        MatrixAPICallback callback,
                        void *callback_target,
                        const gchar *user_id,
                        GError **error);

Get a user's profile.

If param user_id is

null

, this function returns immediately, and throws Matrix.Error.INCOMPLETE.

Parameters

self

the MatrixAPI instance

 

callback

 .

the function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

user_id

 .

the user whose profile to get

.

[in]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_get_avatar_url ()

void
matrix_api_get_avatar_url (MatrixAPI *self,
                           MatrixAPICallback callback,
                           void *callback_target,
                           const gchar *user_id,
                           GError **error);

Get the URL of the specified user's avatar.

If param user_id is

null

, this function returns immediately, and throws Matrix.Error.INCOMPLETE.

Parameters

self

the MatrixAPI instance

 

callback

 .

the function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

user_id

 .

the user whose avatar URL to get

.

[in]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_set_avatar_url ()

void
matrix_api_set_avatar_url (MatrixAPI *self,
                           MatrixAPICallback callback,
                           void *callback_target,
                           const gchar *user_id,
                           const gchar *avatar_url,
                           GError **error);

Set the user's avatar URL.

If param user_id or param avatar_url is

null

, this function returns immediately, and throws Matrix.Error.INCOMPLETE.

Parameters

self

the MatrixAPI instance

 

callback

 .

the function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

user_id

 .

the user whose avatar URL to set

.

[in]

avatar_url

 .

the avatar URL info

.

[in]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_get_display_name ()

void
matrix_api_get_display_name (MatrixAPI *self,
                             MatrixAPICallback callback,
                             void *callback_target,
                             const gchar *user_id,
                             GError **error);

Get the user's display name.

If param user_id is

null

, this function returns immediately, and throws Matrix.Error.INCOMPLETE.

Parameters

self

the MatrixAPI instance

 

callback

 .

the function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

user_id

 .

the user whose display name to get

.

[in]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_set_display_name ()

void
matrix_api_set_display_name (MatrixAPI *self,
                             MatrixAPICallback callback,
                             void *callback_target,
                             const gchar *user_id,
                             const gchar *display_name,
                             GError **error);

Set the user's display name.

If param user_id or param display_name is

null

, this function returns immediately, and throws Matrix.Error.INCOMPLETE.

Parameters

self

the MatrixAPI instance

 

callback

 .

the function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

user_id

 .

the user whose display name to set

.

[in]

display_name

 .

the display name info

.

[in]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_register_account ()

void
matrix_api_register_account (MatrixAPI *self,
                             MatrixAPICallback callback,
                             void *callback_target,
                             MatrixAccountKind account_kind,
                             gboolean bind_email,
                             const gchar *username,
                             const gchar *password,
                             GError **error);

Attempt to register an account with the homeserver using param username and param password.

Implementations of this method must set the token property on a successful login.

If param password is

null

, this function returns immediately, and throws Matrix.Error.INCOMPLETE.

Parameters

self

the MatrixAPI instance

 

callback

 .

the function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

account_kind

 .

the type of account to register

.

[in]

bind_email

 .

if

true

, the server binds the e-mail used for authentication to the Matrix ID with the ID server

.

[in]

username

 .

the local part of the desired Matrix ID. If omitted, the server will generate a local part

.

[in][allow-none]

password

 .

the desired password for the account

.

[in]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_set_account_data ()

void
matrix_api_set_account_data (MatrixAPI *self,
                             MatrixAPICallback callback,
                             void *callback_target,
                             const gchar *user_id,
                             const gchar *room_id,
                             const gchar *event_type,
                             JsonNode *content,
                             GError **error);

Set some account data for the client. This config is only visible to the user who set the account data. The config will be synced to clients in the top-level account data.

If param user_id, param event_type or param content is

null

, this function returns immediately, and throws Matrix.Error.INCOMPLETE.

Parameters

self

the MatrixAPI instance

 

callback

 .

the function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

user_id

 .

the user to set account data for. An access token must be present and be authorized to make requests for this user ID

.

[in]

room_id

 .

the room to set account data for. If

null

, the account data will be set globally

.

[in][allow-none]

event_type

 .

the event type of the account data to set. Custom types should be namespaced to avoid clashes

.

[in]

content

 .

the content of the account data

.

[in][transfer full]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_get_room_tags ()

void
matrix_api_get_room_tags (MatrixAPI *self,
                          MatrixAPICallback callback,
                          void *callback_target,
                          const gchar *user_id,
                          const gchar *room_id,
                          GError **error);

List the tags set by a user on a room.

If param user_id or param room_id is

null

, this function returns immediately, and throws Matrix.Error.INCOMPLETE.

Parameters

self

the MatrixAPI instance

 

callback

 .

the function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

user_id

 .

the ID of the user to get the tags for. An access token must be set, and it must be authorised to make requests for this user ID

.

[in]

room_id

 .

the room to get tags for

.

[in]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_delete_room_tag ()

void
matrix_api_delete_room_tag (MatrixAPI *self,
                            MatrixAPICallback callback,
                            void *callback_target,
                            const gchar *user_id,
                            const gchar *room_id,
                            const gchar *tag,
                            GError **error);

Remove a tag from the room.

If param user_id, param room_id or param tag is

null

, this function returns immediately, and throws Matrix.Error.INCOMPLETE.

Parameters

self

the MatrixAPI instance

 

callback

 .

the function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

user_id

 .

the id of the user to remove a tag for

.

[in]

room_id

 .

the id of the room to remove the tag from

.

[in]

tag

 .

the tag to remove

.

[in]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_add_room_tag ()

void
matrix_api_add_room_tag (MatrixAPI *self,
                         MatrixAPICallback callback,
                         void *callback_target,
                         const gchar *user_id,
                         const gchar *room_id,
                         const gchar *tag,
                         JsonNode *content,
                         GError **error);

Add a tag to the room.

If param user_id, param room_id or param tag is

null

, this function returns immediately, and throws Matrix.Error.INCOMPLETE.

Parameters

self

the MatrixAPI instance

 

callback

 .

the function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

user_id

 .

the ID of the user to add the tag for

.

[in]

room_id

 .

the ID of the room to add the tag for

.

[in]

tag

 .

the tag to add

.

[in]

content

 .

extra data for the tag, e.g. ordering

.

[in][allow-none][transfer full]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_api_get_turn_server ()

void
matrix_api_get_turn_server (MatrixAPI *self,
                            MatrixAPICallback callback,
                            void *callback_target,
                            GError **error);

Get credentials for the client to use when initiating calls.

Parameters

self

the MatrixAPI instance

 

callback

 .

the function to call when the request is finished

.

[in][allow-none]

callback_target

user data to pass to callback .

[allow-none][closure]

callback_target_destroy_notify

function to call when callback_target is no longer needed.

[allow-none]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

MatrixAPICallback ()

void
(*MatrixAPICallback) (MatrixAPI *api,
                      const gchar *content_type,
                      JsonNode *json_content,
                      GByteArray *raw_content,
                      GError *err,
                      void *user_data);

A callback function to use with Client API calls. If the response is JSON, param json_content is set and param raw_content is not. If the response is not JSON, but still has a body (e.g. with media downloads), param json_content is

null

and raw_content holds the content body.

Parameters

api

 .

a Matrix.API instance

.

[in]

content_type

 .

the content type of the response

.

[in]

json_content

 .

the JSON content of the response

.

[in][allow-none]

raw_content

 .

the raw (ie. binary) content of the response

.

[in][allow-none]

err

 .

a GLib.Error that holds any errors that occured during the API call, or

null

.

[in][allow-none]

user_data

data to pass to the delegate function.

[closure]

matrix_api_get_token ()

const gchar *
matrix_api_get_token (MatrixAPI *self);

Get and return the current value of the "token" property.

The token to use for authorization. The Matrix.API.login() and Matrix.API.register_account() calls MUST set this automatically.

Parameters

self

the MatrixAPI instance to query

 

Returns

the value of the "token" property


matrix_api_set_token ()

void
matrix_api_set_token (MatrixAPI *self,
                      const gchar *value);

Set the value of the "token" property to value .

The token to use for authorization. The Matrix.API.login() and Matrix.API.register_account() calls MUST set this automatically.

Parameters

self

the MatrixAPI instance to modify

 

value

the new value of the "token" property

 

matrix_api_get_refresh_token ()

const gchar *
matrix_api_get_refresh_token (MatrixAPI *self);

Get and return the current value of the "refresh-token" property.

The token to use for refreshing the authorization token. It is issued by the server after a successful registration, login or token refresh.

Parameters

self

the MatrixAPI instance to query

 

Returns

the value of the "refresh-token" property


matrix_api_set_refresh_token ()

void
matrix_api_set_refresh_token (MatrixAPI *self,
                              const gchar *value);

Set the value of the "refresh-token" property to value .

The token to use for refreshing the authorization token. It is issued by the server after a successful registration, login or token refresh.

Parameters

self

the MatrixAPI instance to modify

 

value

the new value of the "refresh-token" property

 

matrix_api_get_user_id ()

const gchar *
matrix_api_get_user_id (MatrixAPI *self);

Get and return the current value of the "user-id" property.

The Matrix user ID that is currently authenticated with the server. It is set automatically by the registration and login process.

Parameters

self

the MatrixAPI instance to query

 

Returns

the value of the "user-id" property


matrix_api_get_homeserver ()

const gchar *
matrix_api_get_homeserver (MatrixAPI *self);

Get and return the current value of the "homeserver" property.

The name of the Matrix home server as it calls itself. It is set automatically by the registration and login process.

Parameters

self

the MatrixAPI instance to query

 

Returns

the value of the "homeserver" property

Types and Values

MatrixAPI

typedef struct _MatrixAPI MatrixAPI;

Base interface for all Client/Server API functionality.


struct MatrixAPIIface

struct MatrixAPIIface {
	GTypeInterface parent_iface;
	void (*abort_pending) (MatrixAPI* self);
	void (*media_download) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* server_name, const gchar* media_id, GError** error);
	void (*media_thumbnail) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* server_name, const gchar* media_id, guint width, guint height, MatrixResizeMethod method, GError** error);
	void (*media_upload) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* content_type, GByteArray* content, GError** error);
	void (*get_presence_list) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* user_id, GError** error);
	void (*update_presence_list) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* user_id, GList* drop_ids, GList* invite_ids, GError** error);
	void (*get_user_presence) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* user_id, GError** error);
	void (*set_user_presence) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* user_id, MatrixPresence presence, const gchar* status_message, GError** error);
	void (*update_pusher) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, MatrixPusher* pusher, GError** error);
	void (*get_pushers) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, GError** error);
	void (*delete_pusher) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* scope, MatrixPusherKind kind, const gchar* rule_id, GError** error);
	void (*get_pusher) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* scope, MatrixPusherKind kind, const gchar* rule_id, GError** error);
	void (*add_pusher) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* scope, MatrixPusherKind kind, const gchar* rule_id, const gchar* before, const gchar* after, GList* actions, GList* conditions, GError** error);
	void (*toggle_pusher) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* scope, MatrixPusherKind kind, const gchar* rule_id, gboolean enabled, GError** error);
	void (*create_room) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, MatrixRoomPreset preset, const gchar* room_name, const gchar* room_alias, const gchar* topic, MatrixRoomVisibility visibility, JsonNode* creation_content, GList* initial_state, GList* invitees, GList* invite_3pids, GError** error);
	void (*delete_room_alias) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* room_alias, GError** error);
	void (*get_room_id) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* room_alias, GError** error);
	void (*create_room_alias) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* room_id, const gchar* room_alias, GError** error);
	void (*list_public_rooms) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, GError** error);
	void (*ban_user) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* room_id, const gchar* user_id, const gchar* reason, GError** error);
	void (*forget_room) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* room_id, GError** error);
	void (*invite_user_3rdparty) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* room_id, Matrix3PidCredential* credential, GError** error);
	void (*invite_user) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* room_id, const gchar* user_id, GError** error);
	void (*join_room) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* room_id, GError** error);
	void (*leave_room) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* room_id, GError** error);
	void (*event_stream) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* from_token, gulong timeout, GError** error);
	void (*get_event) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* event_id, GError** error);
	void (*initial_sync) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, guint limit, gboolean archived, GError** error);
	void (*get_event_context) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* room_id, const gchar* event_id, guint limit, GError** error);
	void (*initial_sync_room) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* room_id, GError** error);
	void (*list_room_members) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* room_id, GError** error);
	void (*list_room_messages) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* room_id, const gchar* from_token, MatrixEventDirection direction, guint limit, GError** error);
	void (*send_event_receipt) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* room_id, MatrixReceiptType receipt_type, const gchar* event_id, JsonNode* receipt, GError** error);
	void (*redact_event) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* room_id, const gchar* event_id, const gchar* txn_id, const gchar* reason, GError** error);
	void (*send_message_event) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* room_id, const gchar* event_type, const gchar* txn_id, JsonNode* content, GError** error);
	void (*get_room_state) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* room_id, const gchar* event_type, const gchar* state_key, GError** error);
	void (*send_room_event) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* room_id, const gchar* event_type, const gchar* state_key, JsonNode* content, GError** error);
	void (*notify_room_typing) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* user_id, const gchar* room_id, guint timeout, gboolean typing, GError** error);
	void (*sync) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* filter_id, MatrixFilter* filter, const gchar* since, gboolean full_state, gboolean set_presence, gulong timeout, GError** error);
	void (*create_filter) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* user_id, MatrixFilter* filter, GError** error);
	void (*download_filter) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* user_id, const gchar* filter_id, GError** error);
	void (*search) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* next_batch, MatrixSearchCategories* search_categories, GError** error);
	void (*whois) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* user_id, GError** error);
	void (*versions) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, GError** error);
	void (*login) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* login_type, JsonNode* content, GError** error);
	void (*token_refresh) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* refresh_token, GError** error);
	void (*get_3pids) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, GError** error);
	void (*add_3pid) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, gboolean bind_creds, Matrix3PidCredential* threepid_creds, GError** error);
	void (*change_password) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* new_password, GError** error);
	void (*get_profile) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* user_id, GError** error);
	void (*get_avatar_url) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* user_id, GError** error);
	void (*set_avatar_url) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* user_id, const gchar* avatar_url, GError** error);
	void (*get_display_name) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* user_id, GError** error);
	void (*set_display_name) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* user_id, const gchar* display_name, GError** error);
	void (*register_account) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, MatrixAccountKind account_kind, gboolean bind_email, const gchar* username, const gchar* password, GError** error);
	void (*set_account_data) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* user_id, const gchar* room_id, const gchar* event_type, JsonNode* content, GError** error);
	void (*get_room_tags) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* user_id, const gchar* room_id, GError** error);
	void (*delete_room_tag) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* user_id, const gchar* room_id, const gchar* tag, GError** error);
	void (*add_room_tag) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, const gchar* user_id, const gchar* room_id, const gchar* tag, JsonNode* content, GError** error);
	void (*get_turn_server) (MatrixAPI* self, MatrixAPICallback callback, void* callback_target, GError** error);
	const gchar* (*get_token) (MatrixAPI* self);
	void (*set_token) (MatrixAPI* self, const gchar* value);
	const gchar* (*get_refresh_token) (MatrixAPI* self);
	void (*set_refresh_token) (MatrixAPI* self, const gchar* value);
	const gchar* (*get_user_id) (MatrixAPI* self);
	const gchar* (*get_homeserver) (MatrixAPI* self);
};

Interface for creating MatrixAPI implementations.

Members

GTypeInterface parent_iface;

the parent interface structure

 

abort_pending ()

virtual method called by matrix_api_abort_pending()

 

media_download ()

virtual method called by matrix_api_media_download()

 

media_thumbnail ()

virtual method called by matrix_api_media_thumbnail()

 

media_upload ()

virtual method called by matrix_api_media_upload()

 

get_presence_list ()

virtual method called by matrix_api_get_presence_list()

 

update_presence_list ()

virtual method called by matrix_api_update_presence_list()

 

get_user_presence ()

virtual method called by matrix_api_get_user_presence()

 

set_user_presence ()

virtual method called by matrix_api_set_user_presence()

 

update_pusher ()

virtual method called by matrix_api_update_pusher()

 

get_pushers ()

virtual method called by matrix_api_get_pushers()

 

delete_pusher ()

virtual method called by matrix_api_delete_pusher()

 

get_pusher ()

virtual method called by matrix_api_get_pusher()

 

add_pusher ()

virtual method called by matrix_api_add_pusher()

 

toggle_pusher ()

virtual method called by matrix_api_toggle_pusher()

 

create_room ()

virtual method called by matrix_api_create_room()

 

delete_room_alias ()

virtual method called by matrix_api_delete_room_alias()

 

get_room_id ()

virtual method called by matrix_api_get_room_id()

 

create_room_alias ()

virtual method called by matrix_api_create_room_alias()

 

list_public_rooms ()

virtual method called by matrix_api_list_public_rooms()

 

ban_user ()

virtual method called by matrix_api_ban_user()

 

forget_room ()

virtual method called by matrix_api_forget_room()

 

invite_user_3rdparty ()

virtual method called by matrix_api_invite_user_3rdparty()

 

invite_user ()

virtual method called by matrix_api_invite_user()

 

join_room ()

virtual method called by matrix_api_join_room()

 

leave_room ()

virtual method called by matrix_api_leave_room()

 

event_stream ()

virtual method called by matrix_api_event_stream()

 

get_event ()

virtual method called by matrix_api_get_event()

 

initial_sync ()

virtual method called by matrix_api_initial_sync()

 

get_event_context ()

virtual method called by matrix_api_get_event_context()

 

initial_sync_room ()

virtual method called by matrix_api_initial_sync_room()

 

list_room_members ()

virtual method called by matrix_api_list_room_members()

 

list_room_messages ()

virtual method called by matrix_api_list_room_messages()

 

send_event_receipt ()

virtual method called by matrix_api_send_event_receipt()

 

redact_event ()

virtual method called by matrix_api_redact_event()

 

send_message_event ()

virtual method called by matrix_api_send_message_event()

 

get_room_state ()

virtual method called by matrix_api_get_room_state()

 

send_room_event ()

virtual method called by matrix_api_send_room_event()

 

notify_room_typing ()

virtual method called by matrix_api_notify_room_typing()

 

sync ()

virtual method called by matrix_api_sync()

 

create_filter ()

virtual method called by matrix_api_create_filter()

 

download_filter ()

virtual method called by matrix_api_download_filter()

 

search ()

virtual method called by matrix_api_search()

 

whois ()

virtual method called by matrix_api_whois()

 

versions ()

virtual method called by matrix_api_versions()

 

login ()

virtual method called by matrix_api_login()

 

token_refresh ()

virtual method called by matrix_api_token_refresh()

 

get_3pids ()

virtual method called by matrix_api_get_3pids()

 

add_3pid ()

virtual method called by matrix_api_add_3pid()

 

change_password ()

virtual method called by matrix_api_change_password()

 

get_profile ()

virtual method called by matrix_api_get_profile()

 

get_avatar_url ()

virtual method called by matrix_api_get_avatar_url()

 

set_avatar_url ()

virtual method called by matrix_api_set_avatar_url()

 

get_display_name ()

virtual method called by matrix_api_get_display_name()

 

set_display_name ()

virtual method called by matrix_api_set_display_name()

 

register_account ()

virtual method called by matrix_api_register_account()

 

set_account_data ()

virtual method called by matrix_api_set_account_data()

 

get_room_tags ()

virtual method called by matrix_api_get_room_tags()

 

delete_room_tag ()

virtual method called by matrix_api_delete_room_tag()

 

add_room_tag ()

virtual method called by matrix_api_add_room_tag()

 

get_turn_server ()

virtual method called by matrix_api_get_turn_server()

 

get_token ()

getter method for the abstract property "token"

 

set_token ()

setter method for the abstract property "token"

 

get_refresh_token ()

getter method for the abstract property "refresh-token"

 

set_refresh_token ()

setter method for the abstract property "refresh-token"

 

get_user_id ()

getter method for the abstract property "user-id"

 

get_homeserver ()

getter method for the abstract property "homeserver"