Skip to content

Commit a7aebcf

Browse files
committed
add collection api doc
1 parent b95a247 commit a7aebcf

File tree

6 files changed

+366
-18
lines changed

6 files changed

+366
-18
lines changed

_sidebar.md

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
- [Episode](episode)
99
- [Bangumi](bangumi)
1010
- [Tag](tag)
11+
- Collection
12+
- [Loop Collection](loop-collection)
1113
- Authentication
1214
- [Account](account)
1315
- [Token](token)

loop-collection.md

+171
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
## Get one collection
2+
3+
**`GET /collection?id=value`** get one collection by id
4+
5+
**`GET /collection?name=value`** get one collection by name
6+
7+
Example request
8+
9+
```bash
10+
curl https://animeloop.org/api/v2/collection?id=1080
11+
curl https://animeloop.org/api/v2/collection?name=nichijou123
12+
```
13+
14+
Example response
15+
16+
```json
17+
{
18+
"status": "success",
19+
"code": 200,
20+
"message": "success",
21+
"data": [
22+
{
23+
"userid": 1002,
24+
"name": "nichijou123",
25+
"description": "animeloop collection for nichijou",
26+
"title": "Nichijou collection",
27+
"cid": 1080
28+
}
29+
]
30+
}
31+
```
32+
33+
## Get all collections from user
34+
35+
**`GET /collection?userid=value`**
36+
37+
Example request
38+
39+
```bash
40+
curl -d https://animeloop.org/api/v2/collection?userid=1002
41+
```
42+
43+
Example response
44+
45+
```json
46+
{
47+
"status": "success",
48+
"code": 200,
49+
"message": "success",
50+
"data": [
51+
{
52+
"userid": 1002,
53+
"name": "nichijou123",
54+
"description": "animeloop collection for nichijou",
55+
"title": "Nichijou Collection",
56+
"cid": 1080
57+
},
58+
{
59+
"userid": 1002,
60+
"name": "test_collection",
61+
"description": "test_collection_description",
62+
"title": "test_collection_title",
63+
"cid": 1081
64+
}
65+
]
66+
}
67+
```
68+
69+
## Create new collection
70+
71+
**`POST /collection/new`**
72+
73+
Request body
74+
75+
| KEY | EXAMPLE |
76+
| ----------- | --------------------------------- |
77+
| title | Nichijou Collection |
78+
| description | animeloop collection for nichijou |
79+
| name | nichijou123 |
80+
| token | TOKEN |
81+
82+
Example request
83+
84+
```bash
85+
curl -d "title=Nichijou Collection&description=animeloop collection for nichijou&name=nichijou123&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1aWQiOjQsInVzZXJuYW1lIjoic2hpbmN1cnJ5In0.qduQ3MKwUWMUbfZ5KVkij2DtDGQqagopA7ytHywvU8o" "https://animeloop.org/api/v2/collection/new"
86+
```
87+
88+
Example response
89+
90+
```json
91+
{
92+
"status": "success",
93+
"code": 200,
94+
"message": "create loop collection successfully.",
95+
"data": {
96+
"id": "5a6eb42d3ace8f06b2880fc6",
97+
"cid": 1080,
98+
"title": "Nichijou Collection",
99+
"description": "animeloop collection for nichijou"
100+
}
101+
}
102+
```
103+
104+
## Delele collection
105+
106+
**`POST /collection/delete`**
107+
108+
请求体
109+
110+
| KEY | EXAMPLE |
111+
| ----- | ------- |
112+
| id | 1080 |
113+
| token | TOKEN |
114+
115+
Example request
116+
117+
```bash
118+
curl -d "id=1080&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1aWQiOjQsInVzZXJuYW1lIjoic2hpbmN1cnJ5In0.qduQ3MKwUWMUbfZ5KVkij2DtDGQqagopA7ytHywvU8o" "https://animeloop.org/api/v2/collection/delete"
119+
```
120+
121+
Example response
122+
123+
```json
124+
{
125+
"status": "success",
126+
"code": 200,
127+
"message": "delete loop collection successfully.",
128+
"data": {}
129+
}
130+
```
131+
132+
## Add loops into or remove from collections
133+
134+
**`POST /collection/loop/add`** add loops
135+
136+
**`POST /collection/loop/delete`** remove loops
137+
138+
Request body
139+
140+
| KEY | EXAMPLE |
141+
| ------------ | ---------------------------------------- |
142+
| loopid | 591446445f6e5e51d937e111 / [" 591446445f6e5e51d937e111", " 591446445f6e5e51d937e112"] |
143+
| collectionid | 1080 |
144+
| token | TOKEN |
145+
146+
!> The loopid here can be a single MongoDB ObjectId type string, or a JSON array of multiple.
147+
148+
Example request
149+
150+
```bash
151+
curl -d "itemid=[\"591446445f6e5e51d937e111\",\"591446445f6e5e51d937e112\"]&collectionid=1080&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1aWQiOjQsInVzZXJuYW1lIjoic2hpbmN1cnJ5In0.qduQ3MKwUWMUbfZ5KVkij2DtDGQqagopA7ytHywvU8o" "https://animeloop.org/api/v2/collection/item/add"
152+
153+
curl -d "itemid=[\"591446445f6e5e51d937e111\",\"591446445f6e5e51d937e112\"]&collectionid=1080&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1aWQiOjQsInVzZXJuYW1lIjoic2hpbmN1cnJ5In0.qduQ3MKwUWMUbfZ5KVkij2DtDGQqagopA7ytHywvU8o" "https://animeloop.org/api/v2/collection/item/delete"
154+
```
155+
156+
Example response
157+
158+
```json
159+
{
160+
"status": "success",
161+
"code": 200,
162+
"message": "add item to collection successfully.",
163+
"data": {}
164+
}
165+
```
166+
167+
## Get loops from collection
168+
169+
**`GET /loop?collectionid=value&[key=value, ...]`**
170+
171+
Detailes at [Get a group of loops by querying](loop?id=get-a-group-of-loops-by-querying)

loop.md

+10-9
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,16 @@ Example response
7070

7171
Avaliable query keys
7272

73-
| KEY | VALUE TYPE | EXAMPLE | DESCRIPTION |
74-
| ----------- | ---------------- | ------------------------ | ---------------------------------------- |
75-
| seriesid | MongoDB ObjectId | 592a63088e46ce684784a6b3 | seriesid of loops |
76-
| episodeid | MongoDB ObjectId | 591b2b9268f9f00f82bf35ba | episodeid of loops |
77-
| duration | Number (Second) | 0,1 / 1.5,2.0 | range of duration of loops |
78-
| source_from | String | automator / upload | source of loops |
79-
| full | Boolean | true / false | Whether to return the full loops (including series and episode) (default is false) |
80-
| page | Number | 11 | loops on page N (default: first page) |
81-
| limit | Number | 20 | The number of bangumi per page(default 30, max 100) |
73+
| KEY | VALUE TYPE | EXAMPLE | DESCRIPTION |
74+
| ------------ | ---------------- | ------------------------ | ---------------------------------------- |
75+
| seriesid | MongoDB ObjectId | 592a63088e46ce684784a6b3 | seriesid of loops |
76+
| episodeid | MongoDB ObjectId | 591b2b9268f9f00f82bf35ba | episodeid of loops |
77+
| collectionid | Number | 1080 / 1111 | collectionid of loops |
78+
| duration | Number (Second) | 0,1 / 1.5,2.0 | range of duration of loops |
79+
| source_from | String | automator / upload | source of loops |
80+
| full | Boolean | true / false | Whether to return the full loops (including series and episode) (default is false) |
81+
| page | Number | 11 | loops on page N (default: first page) |
82+
| limit | Number | 20 | The number of bangumi per page(default 30, max 100) |
8283

8384
!> It should be
8485
noted that if you need series and episode filter conditions here, you

zh-cn/_sidebar.md

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
- [Episode](zh-cn/episode)
1010
- [Bangumi](zh-cn/bangumi)
1111
- [Tag](zh-cn/tag)
12+
- 合集
13+
- [Loop 合集](zh-cn/loop-collection)
1214
- 权限验证
1315
- [帐户](zh-cn/account)
1416
- [Token](zh-cn/token)

zh-cn/loop-collection.md

+171
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
## 获取单个合集
2+
3+
**`GET /collection?id=value`** 通过合集 id 获取
4+
5+
**`GET /collection?name=value`** 通过合集名称获取
6+
7+
示例请求
8+
9+
```bash
10+
curl https://animeloop.org/api/v2/collection?id=1080
11+
curl https://animeloop.org/api/v2/collection?name=nichijou123
12+
```
13+
14+
返回结果
15+
16+
```json
17+
{
18+
"status": "success",
19+
"code": 200,
20+
"message": "success",
21+
"data": [
22+
{
23+
"userid": 1002,
24+
"name": "nichijou123",
25+
"description": "animeloop collection for nichijou",
26+
"title": "Nichijou collection",
27+
"cid": 1080
28+
}
29+
]
30+
}
31+
```
32+
33+
## 获取某个用户创建的所有合集
34+
35+
**`GET /collection?userid=value`**
36+
37+
示例请求
38+
39+
```bash
40+
curl -d https://animeloop.org/api/v2/collection?userid=1002
41+
```
42+
43+
返回结果
44+
45+
```json
46+
{
47+
"status": "success",
48+
"code": 200,
49+
"message": "success",
50+
"data": [
51+
{
52+
"userid": 1002,
53+
"name": "nichijou123",
54+
"description": "animeloop collection for nichijou",
55+
"title": "Nichijou Collection",
56+
"cid": 1080
57+
},
58+
{
59+
"userid": 1002,
60+
"name": "test_collection",
61+
"description": "test_collection_description",
62+
"title": "test_collection_title",
63+
"cid": 1081
64+
}
65+
]
66+
}
67+
```
68+
69+
## 创建合集
70+
71+
**`POST /collection/new`**
72+
73+
请求体
74+
75+
| KEY | EXAMPLE |
76+
| ----------- | --------------------------------- |
77+
| title | Nichijou Collection |
78+
| description | animeloop collection for nichijou |
79+
| name | nichijou123 |
80+
| token | TOKEN |
81+
82+
示例请求
83+
84+
```bash
85+
curl -d "title=Nichijou Collection&description=animeloop collection for nichijou&name=nichijou123&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1aWQiOjQsInVzZXJuYW1lIjoic2hpbmN1cnJ5In0.qduQ3MKwUWMUbfZ5KVkij2DtDGQqagopA7ytHywvU8o" "https://animeloop.org/api/v2/collection/new"
86+
```
87+
88+
返回结果
89+
90+
```json
91+
{
92+
"status": "success",
93+
"code": 200,
94+
"message": "create loop collection successfully.",
95+
"data": {
96+
"id": "5a6eb42d3ace8f06b2880fc6",
97+
"cid": 1080,
98+
"title": "Nichijou Collection",
99+
"description": "animeloop collection for nichijou"
100+
}
101+
}
102+
```
103+
104+
## 删除合集
105+
106+
**`POST /collection/delete`**
107+
108+
请求体
109+
110+
| KEY | EXAMPLE |
111+
| ----- | ------- |
112+
| id | 1080 |
113+
| token | TOKEN |
114+
115+
示例请求
116+
117+
```bash
118+
curl -d "id=1080&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1aWQiOjQsInVzZXJuYW1lIjoic2hpbmN1cnJ5In0.qduQ3MKwUWMUbfZ5KVkij2DtDGQqagopA7ytHywvU8o" "https://animeloop.org/api/v2/collection/delete"
119+
```
120+
121+
返回结果
122+
123+
```json
124+
{
125+
"status": "success",
126+
"code": 200,
127+
"message": "delete loop collection successfully.",
128+
"data": {}
129+
}
130+
```
131+
132+
## 在合集中添加或删除 loops
133+
134+
**`POST /collection/loop/add`** 添加 loops
135+
136+
**`POST /collection/loop/delete`** 删除 loops
137+
138+
请求体
139+
140+
| KEY | EXAMPLE |
141+
| ------------ | ---------------------------------------- |
142+
| loopid | 591446445f6e5e51d937e111 / [" 591446445f6e5e51d937e111", " 591446445f6e5e51d937e112"] |
143+
| collectionid | 1080 |
144+
| token | TOKEN |
145+
146+
!> 这里的 loopid 可以是单个 MongoDB ObjectId 类型字符串,或者多个值组合而成的 JSON 数组。
147+
148+
示例请求
149+
150+
```bash
151+
curl -d "itemid=[\"591446445f6e5e51d937e111\",\"591446445f6e5e51d937e112\"]&collectionid=1080&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1aWQiOjQsInVzZXJuYW1lIjoic2hpbmN1cnJ5In0.qduQ3MKwUWMUbfZ5KVkij2DtDGQqagopA7ytHywvU8o" "https://animeloop.org/api/v2/collection/item/add"
152+
153+
curl -d "itemid=[\"591446445f6e5e51d937e111\",\"591446445f6e5e51d937e112\"]&collectionid=1080&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1aWQiOjQsInVzZXJuYW1lIjoic2hpbmN1cnJ5In0.qduQ3MKwUWMUbfZ5KVkij2DtDGQqagopA7ytHywvU8o" "https://animeloop.org/api/v2/collection/item/delete"
154+
```
155+
156+
返回结果
157+
158+
```json
159+
{
160+
"status": "success",
161+
"code": 200,
162+
"message": "add item to collection successfully.",
163+
"data": {}
164+
}
165+
```
166+
167+
## 获取某个合集中的 loops
168+
169+
**`GET /loop?collectionid=value&[key=value, ...]`**
170+
171+
详细参见 [通过 query 条件筛选获取一组 loops](zh-cn/loop?id=%e9%80%9a%e8%bf%87-query-%e6%9d%a1%e4%bb%b6%e7%ad%9b%e9%80%89%e8%8e%b7%e5%8f%96%e4%b8%80%e7%bb%84-loops)

0 commit comments

Comments
 (0)