Polyjuice Client v0.4.4 Polyjuice.Client.LowLevel View Source
A lower-level client than Polyjuice.Client
.
Compared to Polyjuice.Client
, this module:
- does not manage the access token, user ID, or device ID; whenever these change (e.g. after logging in), the application must create a new client to use the new values
- does not provide a process for syncing with the server
- does not ensure that room requests (such as sending messages) are run in a queue
- does not start any processes
This module would be suitable, for example, for a bot that only sends messages and does not respond to messages.
Link to this section Summary
Functions
create(base_url, opts \\ [])
deprecated
Log in with a password.
Log out an existing session.
Create a client.
Register a user.
Link to this section Types
Link to this section Functions
This function is deprecated. use `Polyjuice.Client.LowLevel.new/2` instead.
Log in with a password.
identifier
may be a single string (in which case it represents a username
-- either just the localpart or the full MXID), a tuple of the form
{:email, "email@address"}
, a tuple of the form {:phone, "country_code", "phone_number"}
, or a map that is passed directly to the login endpoint.
opts
is a keyword list of options:
device_id:
(string) the device ID to useinitial_device_display_name:
(string) the display name to use for the device
Log out an existing session.
Create a client.
opts
may contain:
access_token
: (required to make calls that require authorization) the access token to use.user_id
: (required by some endpoints) the ID of the userdevice_id
: the device IDstorage
: (required by sync) the storage backend to use (seePolyjuice.Client.Storage
)application_service
: whether the client belongs to an Application Service and should make requests as the user specified in theuser_id
parameter, rather than as the Application Service's user.proxy
: use a proxy to connect to the homeserver. This may be of the form{:http, host, port}
or{:http, host, port, user, pass}
for HTTP proxies, or{:socks5, host, port}
or{:socks5, host, port, user, pass}
for SOCKS5 proxies.ssl_options
: SSL/TLS options. This is a list oftls_client_option
s as defined at https://erlang.org/doc/man/ssl.htmlfollow_redirect
: whether redirects should be automatically followed. May either a number indicating the maximum number of redirects to follow, ortrue
, meaning that redirects should be followed up to a default maximum number.
Register a user.
opts
is a keyword list of options:
username:
(string) the basis for the localpart of the desired Matrix IDauth:
is the authentication map containing the type of authentication type and sometime the session keypassword:
(string) the desired password for the accountdevice_id:
(string) the device ID to useinitial_device_display_name:
(string) the display name to use for the deviceinhibit_login:
(boolean) don't login after successful registerkind:
(atom) kind of account to register. Defaults to user. One of: ["guest", "user"]