Polyjuice Client v0.2.1 Polyjuice.Client.API protocol View Source

Protocol for calling the Matrix client API.

Link to this section Summary

Functions

Call a Matrix client API.

Get the child spec for the sync process.

Generate a unique transaction ID.

Link to this section Types

Link to this section Functions

Link to this function

call(client_api, endpoint)

View Source

Call a Matrix client API.

This is a lower-level function; generally, clients will want to call one of the higher-level functions from Polyjuice.Client.

Link to this function

sync_child_spec(client_api, listener, opts \\ [])

View Source

Get the child spec for the sync process.

listener will receive messages with the sync results. Messages include:

  • {:connected}: the process has connected to the homeserver
  • {:disconnected}: the process has been disconnected from the homeserver
  • {:initial_sync_completed}: the first sync has completed
  • {:limited, room_id, prev_batch}: a room's timeline has been limited. Previous messages can be fetched using the prev_batch
  • {:message, room_id, event}: a message event has been received
  • {:state, room_id, event}: a state event has been received
  • {:invite, room_id, inviter, invite_state}: the user was invited to a room
  • {:left, room_id}: the user left a room

opts is a keyword list of options:

  • filter: (string or map) the filter to use with the sync
Link to this function

transaction_id(client_api)

View Source

Generate a unique transaction ID.