Strava v1.0.0 Strava.Segments View Source

API calls for all endpoints tagged Segments.

Link to this section Summary

Functions

Get Segment Returns the specified segment

Star Segment Stars/Unstars the given segment for the authenticated athlete

Link to this section Functions

Link to this function

explore_segments(client, bounds, opts \\ []) View Source
explore_segments(Tesla.Env.client(), [Float.t()], keyword()) ::
  {:ok, Strava.ExplorerResponse.t()} | {:error, Tesla.Env.t()}

Explore segments

Returns the top 10 segments matching a specified query.

Parameters

  • client (Strava.Client): Client to make authenticated requests
  • bounds ([float()]): The latitude and longitude for two points describing a rectangular boundary for the search: [southwest corner latitutde, southwest corner longitude, northeast corner latitude, northeast corner longitude]
  • opts (KeywordList): [optional] Optional parameters

    • :activity_type (String.t): Desired activity type.
    • :min_cat (integer()): The minimum climbing category.
    • :max_cat (integer()): The maximum climbing category.

Returns

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

Link to this function

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

Get Segment Leaderboard

Returns the specified segment leaderboard.

Parameters

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

    • :gender (String.t): Filter by gender.
    • :age_group (String.t): Summit Feature. Filter by age group.
    • :weight_class (String.t): Summit Feature. Filter by weight class.
    • :following (boolean()): Filter by friends of the authenticated athlete.
    • :club_id (integer()): Filter by club.
    • :date_range (String.t): Filter by date range.
    • :context_entries (integer()):
    • :page (integer()): Page number.
    • :per_page (integer()): Number of items per page. Defaults to 30.

Returns

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

Link to this function

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

List Starred Segments

List of the authenticated athlete's starred segments. Private segments are filtered out unless requested by a token with read_all scope.

Parameters

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

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

Returns

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

Link to this function

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

Get Segment Returns the specified segment.

read_all scope required in order to retrieve athlete-specific segment information, or to retrieve private segments.

Parameters

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

Returns

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

Link to this function

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

Star Segment Stars/Unstars the given segment for the authenticated athlete.

Requires profile:write scope.

Parameters

  • client (Strava.Client): Client to make authenticated requests
  • id (integer()): The identifier of the segment to star.
  • starred (boolean()): If true, star the segment; if false, unstar the segment.
  • opts (KeywordList): [optional] Optional parameters

Returns

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