1 个不稳定发布
0.1.0 | 2022 年 1 月 6 日 |
---|
#4 in #strava
340KB
5K SLoC
Rust API 客户端用于 Strava
Swagger Playground 是通过提交 HTTP 请求并观察响应来熟悉 Strava API 的最简单方法,在编写任何客户端代码之前。它将根据您从运动员那里收到的授权范围显示不同端点的响应外观。要使用 Playground,请访问 https://www.strava.com/settings/api 并将您的“授权回调域”更改为 developers.strava.com。请注意,我们仅支持 Swagger 2.0。存在一个问题,您一次只能选择一个范围。有关更多信息,请参阅 https://developers.strava.com/docs 中的“客户端代码”部分。
概述
此 API 客户端由 OpenAPI Generator 项目生成。通过使用来自远程服务器的 openapi-spec,您可以轻松生成 API 客户端。
- API 版本:3.0.0
- 包版本:3.0.0
- 构建包:
org.openapitools.codegen.languages.RustClientCodegen
docker run --rm -it \
-v "${PWD}:/host" \
openapitools/openapi-generator-cli \
"generate" \
"-i" "https://developers.strava.com/swagger/swagger.json" \
"-g" "rust" \
"-o" "/host/strava-client" \
"--additional-properties=supportMultipleResponses=true,useSingleRequestParameter=true,packageName=strava_client" \
"--skip-validate-spec"
安装
将包放在名为 strava_client
的目录下,并在 Cargo.toml
中的 [dependencies]
下添加以下内容:
strava_client = { path = "./strava_client" }
API 端点文档
所有 URI 都是相对于 https://www.strava.com/api/v3
类 | 方法 | HTTP 请求 | 描述 |
---|---|---|---|
ActivitiesApi | create_activity | POST /activities | 创建活动 |
ActivitiesApi | get_activity_by_id | GET /activities/{id} | 获取活动 |
ActivitiesApi | get_comments_by_activity_id | GET /activities/{id}/comments | 列出活动评论 |
ActivitiesApi | get_kudoers_by_activity_id | GET /activities/{id}/kudos | 列出活动赞者 |
ActivitiesApi | get_laps_by_activity_id | GET /activities/{id}/laps | 列出活动圈数 |
ActivitiesApi | get_logged_in_athlete_activities | GET /athlete/activities | 列出运动员活动 |
ActivitiesApi | get_zones_by_activity_id | GET /activities/{id}/zones | 获取活动区域 |
ActivitiesApi | update_activity_by_id | PUT /activities/{id} | 更新活动 |
AthletesApi | get_logged_in_athlete | GET /athlete | 获取认证运动员 |
AthletesApi | get_logged_in_athlete_zones | GET /athlete/zones | 获取区域 |
AthletesApi | get_stats | GET /athletes/{id}/stats | 获取运动员统计数据 |
AthletesApi | update_logged_in_athlete | PUT /athlete | 更新运动员 |
ClubsApi | get_club_activities_by_id | GET /clubs/{id}/activities | 列出俱乐部活动 |
ClubsApi | get_club_admins_by_id | GET /clubs/{id}/admins | 列出俱乐部管理员 |
ClubsApi | get_club_by_id | GET /clubs/{id} | 获取俱乐部 |
ClubsApi | get_club_members_by_id | GET /clubs/{id}/members | 列出俱乐部成员 |
ClubsApi | get_logged_in_athlete_clubs | GET /athlete/clubs | 列出运动员俱乐部 |
GearsApi | get_gear_by_id | GET /gear/{id} | 获取设备 |
RoutesApi | get_route_as_gpx | GET /routes/{id}/export_gpx | 导出路线GPX |
RoutesApi | get_route_as_tcx | GET /routes/{id}/export_tcx | 导出路线TCX |
RoutesApi | get_route_by_id | GET /routes/{id} | 获取路线 |
RoutesApi | get_routes_by_athlete_id | GET /athletes/{id}/routes | 列出运动员路线 |
SegmentEffortsApi | get_efforts_by_segment_id | GET /segment_efforts | 列出段落努力 |
SegmentEffortsApi | get_segment_effort_by_id | GET /segment_efforts/{id} | 获取段落努力 |
SegmentsApi | explore_segments | GET /segments/explore | 探索段落 |
SegmentsApi | get_logged_in_athlete_starred_segments | GET /segments/starred | 列出星标段落 |
SegmentsApi | get_segment_by_id | GET /segments/{id} | 获取段落 |
SegmentsApi | star_segment | PUT /segments/{id}/starred | 星标段落 |
StreamsApi | get_activity_streams | GET /activities/{id}/streams | 获取活动流 |
StreamsApi | get_route_streams | GET /routes/{id}/streams | 获取路线流 |
StreamsApi | get_segment_effort_streams | GET /segment_efforts/{id}/streams | 获取段落努力流 |
StreamsApi | get_segment_streams | GET /segments/{id}/streams | 获取段落流 |
UploadsApi | create_upload | POST /uploads | 上传活动 |
UploadsApi | get_upload_by_id | GET /uploads/{uploadId} | 获取上传 |
模型文档
- ActivityStats
- ActivityTotal
- ActivityType
- ActivityZone
- AltitudeStream
- AltitudeStreamAllOf
- BaseStream
- CadenceStream
- CadenceStreamAllOf
- Comment
- DetailedActivity
- DetailedActivityAllOf
- DetailedAthlete
- DetailedAthleteAllOf
- DetailedClub
- DetailedClubAllOf
- DetailedGear
- DetailedGearAllOf
- DetailedSegment
- DetailedSegmentAllOf
- DetailedSegmentEffort
- DetailedSegmentEffortAllOf
- DistanceStream
- DistanceStreamAllOf
- Error
- ExplorerResponse
- ExplorerSegment
- Fault
- HeartRateZoneRanges
- HeartrateStream
- HeartrateStreamAllOf
- Lap
- LatLngStream
- LatLngStreamAllOf
- MetaActivity
- MetaAthlete
- MetaClub
- MovingStream
- MovingStreamAllOf
- PhotosSummary
- PhotosSummaryPrimary
- PolylineMap
- PowerStream
- PowerStreamAllOf
- PowerZoneRanges
- Route
- SmoothGradeStream
- SmoothGradeStreamAllOf
- SmoothVelocityStream
- SmoothVelocityStreamAllOf
- Split
- StreamSet
- SummaryActivity
- SummaryActivityAllOf
- SummaryAthlete
- SummaryAthleteAllOf
- SummaryClub
- SummaryClubAllOf
- SummaryGear
- SummaryPrSegmentEffort
- SummarySegment
- SummarySegmentEffort
- TemperatureStream
- TemperatureStreamAllOf
- TimeStream
- TimeStreamAllOf
- TimedZoneRange
- TimedZoneRangeAllOf
- UpdatableActivity
- Upload
- ZoneRange
- Zones
要获取crate生成的文档,请使用
cargo doc --open
作者
依赖项
~4–19MB
~249K SLoC