Skip to content

Latest commit

 

History

History
274 lines (172 loc) · 6.79 KB

AthletesAPI.md

File metadata and controls

274 lines (172 loc) · 6.79 KB

\AthletesAPI

All URIs are relative to https://www.strava.com/api/v3

Method HTTP request Description
GetLoggedInAthlete Get /athlete Get Authenticated Athlete
GetLoggedInAthleteZones Get /athlete/zones Get Zones
GetStats Get /athletes/{id}/stats Get Athlete Stats
UpdateLoggedInAthlete Put /athlete Update Athlete

GetLoggedInAthlete

DetailedAthlete GetLoggedInAthlete(ctx).Execute()

Get Authenticated Athlete

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "github.com/stevenpelley/strava3golang"
)

func main() {

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.AthletesAPI.GetLoggedInAthlete(context.Background()).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `AthletesAPI.GetLoggedInAthlete``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetLoggedInAthlete`: DetailedAthlete
    fmt.Fprintf(os.Stdout, "Response from `AthletesAPI.GetLoggedInAthlete`: %v\n", resp)
}

Path Parameters

This endpoint does not need any parameter.

Other Parameters

Other parameters are passed through a pointer to a apiGetLoggedInAthleteRequest struct via the builder pattern

Return type

DetailedAthlete

Authorization

strava_oauth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetLoggedInAthleteZones

Zones GetLoggedInAthleteZones(ctx).Execute()

Get Zones

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "github.com/stevenpelley/strava3golang"
)

func main() {

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.AthletesAPI.GetLoggedInAthleteZones(context.Background()).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `AthletesAPI.GetLoggedInAthleteZones``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetLoggedInAthleteZones`: Zones
    fmt.Fprintf(os.Stdout, "Response from `AthletesAPI.GetLoggedInAthleteZones`: %v\n", resp)
}

Path Parameters

This endpoint does not need any parameter.

Other Parameters

Other parameters are passed through a pointer to a apiGetLoggedInAthleteZonesRequest struct via the builder pattern

Return type

Zones

Authorization

strava_oauth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetStats

ActivityStats GetStats(ctx, id).Execute()

Get Athlete Stats

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "github.com/stevenpelley/strava3golang"
)

func main() {
    id := int64(789) // int64 | The identifier of the athlete. Must match the authenticated athlete.

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.AthletesAPI.GetStats(context.Background(), id).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `AthletesAPI.GetStats``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetStats`: ActivityStats
    fmt.Fprintf(os.Stdout, "Response from `AthletesAPI.GetStats`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
id int64 The identifier of the athlete. Must match the authenticated athlete.

Other Parameters

Other parameters are passed through a pointer to a apiGetStatsRequest struct via the builder pattern

Name Type Description Notes

Return type

ActivityStats

Authorization

strava_oauth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

UpdateLoggedInAthlete

DetailedAthlete UpdateLoggedInAthlete(ctx, weight).Execute()

Update Athlete

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "github.com/stevenpelley/strava3golang"
)

func main() {
    weight := float32(3.4) // float32 | The weight of the athlete in kilograms.

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.AthletesAPI.UpdateLoggedInAthlete(context.Background(), weight).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `AthletesAPI.UpdateLoggedInAthlete``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `UpdateLoggedInAthlete`: DetailedAthlete
    fmt.Fprintf(os.Stdout, "Response from `AthletesAPI.UpdateLoggedInAthlete`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
weight float32 The weight of the athlete in kilograms.

Other Parameters

Other parameters are passed through a pointer to a apiUpdateLoggedInAthleteRequest struct via the builder pattern

Name Type Description Notes

Return type

DetailedAthlete

Authorization

strava_oauth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]