Polyjuice Client v0.2.3 Polyjuice.Client View Source
Matrix client functions.
The struct in this module, or any struct that implements the
Polyjuice.Client.API
protocol, can be used to connect to a Matrix server
using the functions from submodules.
Polyjuice.Client.User
: user-related functionsPolyjuice.Client.Filter
: build filters for use with syncPolyjuice.Client.Room
: interact with rooms, such as sending messagesPolyjuice.Client.MsgBuilder
: build message contents
To sync with the homeserver, start a process using the child spec returned by
Polyjuice.Client.API.sync_child_spec/3
.
Link to this section Summary
Functions
The r0 client URL prefix
The unstable client URL prefix
Synchronize messages from the server.
Link to this section Types
Link to this type
t()
View Sourcet() :: %Polyjuice.Client{ access_token: String.t(), base_url: String.t(), storage: Polyjuice.Client.Storage.t(), user_id: String.t() }
Matrix client data.
base_url
(string): Required. The base URL for the homeserver.access_token
(string): Required to call endpoints that require an authenticated user. The user's access token.user_id
(string): Required for some endpoints and for sync. The user's Matrix ID.storage
(Polyjuice.Client.Storage
): Required for some endpoints and for sync. Storage for the client.
Link to this section Functions
The r0 client URL prefix
The unstable client URL prefix
Link to this function
sync(client_api, opts \\ [])
View Sourcesync(client_api :: Polyjuice.Client.API.t(), opts :: list()) :: {:ok, map()} | Any
Synchronize messages from the server.
Normally, you should use Polyjuice.Client.Sync
rather than calling this
function, but this function may be used where more control is needed.
opts
is a keyword list of options:
filter:
(string or map) a filter to apply to the sync. May be either the ID of a previously uploaded filter, or a new filter.since:
(string) where to start the sync from. Should be a token obtained from thenext_batch
of a previous sync.full_state:
(boolean) whether to return the full room state instead of just the state that has changed since the last syncset_presence:
(one of:online
,:offline
, or:unavailable
) the user's presence to set with this synctimeout:
(integer) the number of milliseconds to wait before the server returns