ExBifrost.Api.Session (ex_bifrost v0.1.0)

Copy Markdown View Source

API calls for all endpoints tagged Session.

Summary

Functions

Check if authentication is enabled Returns whether authentication is enabled and if the current token is valid.

Issue WebSocket ticket Issues a short-lived ticket for authenticating WebSocket connections. The ticket can be used as a query parameter when upgrading to WebSocket.

Login Authenticates a user and returns a session token. Sets a cookie with the session token for subsequent requests.

Logout Logs out the current user and invalidates the session token.

Functions

is_auth_enabled(connection, opts \\ [])

@spec is_auth_enabled(
  Tesla.Env.client(),
  keyword()
) ::
  {:ok, ExBifrost.Model.IsAuthEnabledResponse.t()}
  | {:ok, ExBifrost.Model.BifrostError.t()}
  | {:error, Tesla.Env.t()}

Check if authentication is enabled Returns whether authentication is enabled and if the current token is valid.

Parameters

  • connection (ExBifrost.Connection): Connection to server
  • opts (keyword): Optional parameters

Returns

  • {:ok, ExBifrost.Model.IsAuthEnabledResponse.t} on success
  • {:error, Tesla.Env.t} on failure

issue_ws_ticket(connection, opts \\ [])

@spec issue_ws_ticket(
  Tesla.Env.client(),
  keyword()
) ::
  {:ok, ExBifrost.Model.IssueWsTicket200Response.t()}
  | {:ok, ExBifrost.Model.BifrostError.t()}
  | {:error, Tesla.Env.t()}

Issue WebSocket ticket Issues a short-lived ticket for authenticating WebSocket connections. The ticket can be used as a query parameter when upgrading to WebSocket.

Parameters

  • connection (ExBifrost.Connection): Connection to server
  • opts (keyword): Optional parameters

Returns

  • {:ok, ExBifrost.Model.IssueWsTicket200Response.t} on success
  • {:error, Tesla.Env.t} on failure

login(connection, login_request, opts \\ [])

Login Authenticates a user and returns a session token. Sets a cookie with the session token for subsequent requests.

Parameters

  • connection (ExBifrost.Connection): Connection to server
  • login_request (LoginRequest):
  • opts (keyword): Optional parameters

Returns

  • {:ok, ExBifrost.Model.LoginResponse.t} on success
  • {:error, Tesla.Env.t} on failure

logout(connection, opts \\ [])

Logout Logs out the current user and invalidates the session token.

Parameters

  • connection (ExBifrost.Connection): Connection to server
  • opts (keyword): Optional parameters

Returns

  • {:ok, ExBifrost.Model.Logout200Response.t} on success
  • {:error, Tesla.Env.t} on failure