Skip to content

Commit

Permalink
chore: trends api (#697)
Browse files Browse the repository at this point in the history
* 📚 add doc for the trends API.
---------
* 📚 添加 trends api 相关文档


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Documentation**
- Added sections for `[Token]` and `[Trend]` in the Registry API
documentation.
- Introduced a new endpoint `GET /downloads/range/:start::end/:pkgName`
for fetching package download trends.
	- Included sample response data for the `Trend` endpoint.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
elrrrrrrr committed Jun 3, 2024
1 parent 317e24d commit 038736d
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions docs/registry-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* [Package](/docs/registry-api.md#package)
* [User](/docs/registry-api.md#user)
* [Search](/docs/registry-api.md#search)
* [Token](/docs/registry-api.md#token)
* [Trend](/docs/registry-api.md#trend)

[![Run in Postman](https://run.pstmn.io/button.svg)](https://app.getpostman.com/run-collection/f6c8cb46358039bcd689#?env%5BRegistry%5D=W3sia2V5IjoicmVnaXN0cnkiLCJ0eXBlIjoidGV4dCIsInZhbHVlIjoiaHR0cHM6Ly9yZWdpc3RyeS5ucG0udGFvYmFvLm9yZyIsImVuYWJsZWQiOnRydWV9LHsia2V5IjoicGFja2FnZSIsInZhbHVlIjoiY25wbSIsInR5cGUiOiJ0ZXh0IiwiZW5hYmxlZCI6dHJ1ZX1d)

Expand Down Expand Up @@ -1036,3 +1038,32 @@ GET /-/npm/v1/tokens/token/:UUID
```
#### Response 204
## Trend
### get download trends for a package
```
GET /downloads/range/:start::end/:pkgName
```
#### Response 200
```json
HTTP/1.1 200 OK

// /downloads/range/2024-01-01:2024-12-31/cnpmcore
{
"downloads": [
// ...
{ "day": "2024-01-03", "downloads": 2 },
{ "day": "2024-05-30", "downloads": 16 }
],
"versions": {
// ...
"3.61.1": [{ "day": "2024-05-30", "downloads": 5 }],
"3.61.2": [{ "day": "2024-05-30", "downloads": 5 }],
"3.61.3": [{ "day": "2024-05-30", "downloads": 6 }]
}
}
```

0 comments on commit 038736d

Please sign in to comment.