View Source Squeeze.Fitbit.ClientBehaviour behaviour (OpenPace v0.0.1)

Behaviour module defining callbacks for Fitbit API client operations.

Link to this section Summary

Callbacks

Creates a subscription for a user's activities

Gets list of activities with optional parameters

Gets TCX data for a specific activity

Gets daily activity summary for a specific date

Gets the logged in user's profile information

Creates a new Tesla client from a Credential struct

Creates a new Tesla client from an access token and options

Sets the authorization header with a new access token

Link to this section Types

@type access_token() :: String.t()
@type activity_data() :: map()
@type client() :: Tesla.Client.t()
@type date() :: String.t()
@type log_id() :: String.t()
@type opts() :: keyword()
@type subscription_result() ::
  {:ok, :created} | {:ok, :exists} | {:error, :unauthorized | :unknown | any()}
@type user_data() :: map()
@type user_id() :: String.t()

Link to this section Callbacks

Link to this callback

create_subscription(client, user_id)

View Source
@callback create_subscription(client(), user_id()) :: subscription_result()

Creates a subscription for a user's activities

Link to this callback

get_activities(client, opts)

View Source
@callback get_activities(client(), opts()) :: {:ok, Tesla.Env.t()} | {:error, any()}

Gets list of activities with optional parameters

Link to this callback

get_activity_tcx(client, log_id)

View Source
@callback get_activity_tcx(client(), log_id()) :: {:ok, Tesla.Env.t()} | {:error, any()}

Gets TCX data for a specific activity

Link to this callback

get_daily_activity_summary(client, date)

View Source
@callback get_daily_activity_summary(client(), date()) ::
  {:ok, Tesla.Env.t()} | {:error, any()}

Gets daily activity summary for a specific date

Link to this callback

get_logged_in_user(client)

View Source
@callback get_logged_in_user(client()) ::
  {:ok, user_data()} | {:error, :unauthorized | any()}

Gets the logged in user's profile information

@callback new(Squeeze.Accounts.Credential.t()) :: client()

Creates a new Tesla client from a Credential struct

@callback new(access_token(), opts()) :: client()

Creates a new Tesla client from an access token and options

Link to this callback

set_authorization_header(t, access_token)

View Source
@callback set_authorization_header(Tesla.Env.t(), access_token()) :: Tesla.Env.t()

Sets the authorization header with a new access token