Strava v1.0.0 Strava.Activities View Source

API calls for all endpoints tagged Activities.

Link to this section Summary

Functions

Create an Activity Creates a manual activity for an athlete, requires activity:write scope

Get Activity Returns the given activity that is owned by the authenticated athlete. Requires activity:read for Everyone and Followers activities. Requires activity:read_all for Only Me activities

List Activity Comments Returns the comments on the given activity. Requires activity:read for Everyone and Followers activities. Requires activity:read_all for Only Me activities

List Activity Kudoers Returns the athletes who kudoed an activity identified by an identifier. Requires activity:read for Everyone and Followers activities. Requires activity:read_all for Only Me activities

List Activity Laps Returns the laps of an activity identified by an identifier. Requires activity:read for Everyone and Followers activities. Requires activity:read_all for Only Me activities

List Athlete Activities Returns the activities of an athlete for a specific identifier. Requires activity:read. Only Me activities will be filtered out unless requested by a token with activity:read_all

Get Activity Zones Summit Feature. Returns the zones of a given activity. Requires activity:read for Everyone and Followers activities. Requires activity:read_all for Only Me activities

Update Activity Updates the given activity that is owned by the authenticated athlete. Requires activity:write. Also requires activity:read_all in order to update Only Me activities

Link to this section Functions

Link to this function

create_activity(client, name, type, start_date_local, elapsed_time, opts \\ []) View Source
create_activity(
  Tesla.Env.client(),
  String.t(),
  String.t(),
  Strava.Object.t(),
  integer(),
  keyword()
) :: {:ok, Strava.DetailedActivity.t()} | {:error, Tesla.Env.t()}

Create an Activity Creates a manual activity for an athlete, requires activity:write scope.

Parameters

  • client (Strava.Client): Client to make authenticated requests
  • name (String.t): The name of the activity.
  • type (String.t): Type of activity. For example - Run, Ride etc.
  • start_date_local (Object): ISO 8601 formatted date time.
  • elapsed_time (integer()): In seconds.
  • opts (KeywordList): [optional] Optional parameters

    • :description (String.t): Description of the activity.
    • :distance (float()): In meters.
    • :trainer (integer()): Set to 1 to mark as a trainer activity.
    • :photo_ids (Object): List of native photo ids to attach to the activity.
    • :commute (integer()): Set to 1 to mark as commute.

Returns

{:ok, %Strava.DetailedActivity{}} on success {:error, info} on failure

Link to this function

get_activity_by_id(client, id, opts \\ []) View Source
get_activity_by_id(Tesla.Env.client(), integer(), keyword()) ::
  {:ok, Strava.DetailedActivity.t()} | {:error, Tesla.Env.t()}

Get Activity Returns the given activity that is owned by the authenticated athlete. Requires activity:read for Everyone and Followers activities. Requires activity:read_all for Only Me activities.

Parameters

  • client (Strava.Client): Client to make authenticated requests
  • id (integer()): The identifier of the activity.
  • opts (KeywordList): [optional] Optional parameters

    • :include_all_efforts (boolean()): To include all segments efforts.

Returns

{:ok, %Strava.DetailedActivity{}} on success {:error, info} on failure

Link to this function

get_comments_by_activity_id(client, id, opts \\ []) View Source
get_comments_by_activity_id(Tesla.Env.client(), integer(), keyword()) ::
  {:ok, [Strava.Comment.t()]} | {:error, Tesla.Env.t()}

List Activity Comments Returns the comments on the given activity. Requires activity:read for Everyone and Followers activities. Requires activity:read_all for Only Me activities.

Parameters

  • client (Strava.Client): Client to make authenticated requests
  • id (integer()): The identifier of the activity.
  • opts (KeywordList): [optional] Optional parameters

    • :page (integer()): Page number.
    • :per_page (integer()): Number of items per page. Defaults to 30.

Returns

{:ok, [%Comment{}, ...]} on success {:error, info} on failure

Link to this function

get_kudoers_by_activity_id(client, id, opts \\ []) View Source
get_kudoers_by_activity_id(Tesla.Env.client(), integer(), keyword()) ::
  {:ok, [Strava.SummaryAthlete.t()]} | {:error, Tesla.Env.t()}

List Activity Kudoers Returns the athletes who kudoed an activity identified by an identifier. Requires activity:read for Everyone and Followers activities. Requires activity:read_all for Only Me activities.

Parameters

  • client (Strava.Client): Client to make authenticated requests
  • id (integer()): The identifier of the activity.
  • opts (KeywordList): [optional] Optional parameters

    • :page (integer()): Page number.
    • :per_page (integer()): Number of items per page. Defaults to 30.

Returns

{:ok, [%SummaryAthlete{}, ...]} on success {:error, info} on failure

Link to this function

get_laps_by_activity_id(client, id, opts \\ []) View Source
get_laps_by_activity_id(Tesla.Env.client(), integer(), keyword()) ::
  {:ok, [Strava.Lap.t()]} | {:error, Tesla.Env.t()}

List Activity Laps Returns the laps of an activity identified by an identifier. Requires activity:read for Everyone and Followers activities. Requires activity:read_all for Only Me activities.

Parameters

  • client (Strava.Client): Client to make authenticated requests
  • id (integer()): The identifier of the activity.
  • opts (KeywordList): [optional] Optional parameters

Returns

{:ok, [%Lap{}, ...]} on success {:error, info} on failure

Link to this function

get_logged_in_athlete_activities(client, opts \\ []) View Source
get_logged_in_athlete_activities(Tesla.Env.client(), keyword()) ::
  {:ok, [Strava.SummaryActivity.t()]} | {:error, Tesla.Env.t()}

List Athlete Activities Returns the activities of an athlete for a specific identifier. Requires activity:read. Only Me activities will be filtered out unless requested by a token with activity:read_all.

Parameters

  • client (Strava.Client): Client to make authenticated requests
  • opts (KeywordList): [optional] Optional parameters

    • :before (integer()): An epoch timestamp to use for filtering activities that have taken place before a certain time.
    • :after (integer()): An epoch timestamp to use for filtering activities that have taken place after a certain time.
    • :page (integer()): Page number.
    • :per_page (integer()): Number of items per page. Defaults to 30.

Returns

{:ok, [%SummaryActivity{}, ...]} on success {:error, info} on failure

Link to this function

get_zones_by_activity_id(client, id, opts \\ []) View Source
get_zones_by_activity_id(Tesla.Env.client(), integer(), keyword()) ::
  {:ok, [Strava.ActivityZone.t()]} | {:error, Tesla.Env.t()}

Get Activity Zones Summit Feature. Returns the zones of a given activity. Requires activity:read for Everyone and Followers activities. Requires activity:read_all for Only Me activities.

Parameters

  • client (Strava.Client): Client to make authenticated requests
  • id (integer()): The identifier of the activity.
  • opts (KeywordList): [optional] Optional parameters

Returns

{:ok, [%ActivityZone{}, ...]} on success {:error, info} on failure

Link to this function

update_activity_by_id(client, id, opts \\ []) View Source
update_activity_by_id(Tesla.Env.client(), integer(), keyword()) ::
  {:ok, Strava.DetailedActivity.t()} | {:error, Tesla.Env.t()}

Update Activity Updates the given activity that is owned by the authenticated athlete. Requires activity:write. Also requires activity:read_all in order to update Only Me activities

Parameters

  • client (Strava.Client): Client to make authenticated requests
  • id (integer()): The identifier of the activity.
  • opts (KeywordList): [optional] Optional parameters

    • :updatable_activity (UpdatableActivity):

Returns

{:ok, %Strava.DetailedActivity{}} on success {:error, info} on failure