View Source Teiserver.Connections.ClientLib (Teiserver v0.0.1)

Library of client related functions.

Summary

Functions

Tells us if the client exists right now or not.

Gets a single client.

Returns the list of client ids.

Given a user, log them in. If the user already exists as a client then no new login process is performed but the client details are still returned.

Functions

@spec client_exists?(Teiserver.user_id()) :: pid() | boolean()

Tells us if the client exists right now or not.

@spec get_client(Teiserver.user_id()) :: Teiserver.Connections.Client.t() | nil

Gets a single client.

Returns nil if the Client does not exist.

Examples

iex> get_client(123)
%Client{}

iex> get_client(456)
nil
@spec list_client_ids() :: [Teiserver.user_id()]

Returns the list of client ids.

Examples

iex> list_client_ids()
[123, ...]
@spec login_user(Teiserver.Account.User.t()) :: Teiserver.Connections.Client.t()

Given a user, log them in. If the user already exists as a client then no new login process is performed but the client details are still returned.