API 参考读取 API
仓库区间统计
日 / 周 / 月粒度的区间统计,窗口内不补洞。
GET
/api/v1/repos/{id}/statsGET
日 / 周 / 月三种粒度的区间统计,默认最近 90 天。
两条必须知道的行为(§1.3 / §4.1):
- 不补洞:窗口内没有采集的那些天直接不出现,不是 0。
null的含义是「这个周期没有采集」,转成 0 会变成「采集到 0」。 end是该仓库最新已存周期,不 clamp 到今天。
Authorization
bearerAuth AuthorizationBearer <token>
Authorization: Bearer <key>。key 由控制台自助签发,或管理员在 /dashboard 代签
In: header
Path Parameters
id*string
repos.id(nanoid),或 owner/name——后者要 URL 编码成 owner%2Fname
Query Parameters
cadence?string
统计粒度
Default
"daily"Value in
- "daily"
- "weekly"
- "monthly"
start?string
区间起点,YYYY-MM-DD 或完整 ISO 8601 时间戳,按 Asia/Shanghai 日历解释。给日期时取当日 00:00 (+08:00)。缺省 end - 90d
end?string
区间终点,写法同 start。缺省该仓库最新已存周期
limit?integer
返回条数上限,缺省 500,最大 1000
Range
1 <= value <= 1000cursor?string
上一页响应里的 nextCursor
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
curl -X GET "https://example.com/api/v1/repos/string/stats"{ "repoId": "string", "fullName": "string", "cadence": "daily", "timezone": "Asia/Shanghai", "range": { "start": "2019-08-24T14:15:22Z", "end": "2019-08-24T14:15:22Z" }, "counts": { "periods": 0, "returned": 0, "hasMore": true }, "periods": [ { "period": "2019-08-24T14:15:22Z", "date": "string", "yearWeek": "string", "yearMonth": "string", "totalStars": 0, "deltaStars": 0, "deltaNewStars": 0, "totalWatchers": 0, "deltaWatchers": 0, "totalForks": 0, "deltaForks": 0, "totalOpenIssues": 0, "deltaOpenIssues": 0, "totalPullRequests": 0, "deltaPullRequests": 0, "totalReleases": 0, "deltaReleases": 0, "totalContributors": 0, "deltaContributors": 0, "totalCommits": 0, "deltaCommits": 0, "totalDownloads": 0, "deltaDownloads": 0 } ], "nextCursor": "string"}