feat: adding video write endpoints (#26)

This commit is contained in:
paranarimasu authored and GitHub committed 2022-06-04 12:47:42 -05:00
1 parent d568e0d692
commit fb93633f8c
8 files changed
+309 -11

No files matched your search

+18 -2
View File
@@ -337,12 +337,28 @@ module.exports = {
to: '/video',
children: [
{
title: 'Show',
to: '/video/show/',
title: 'Destroy',
to: '/video/destroy/'
},
{
title: 'Force Delete',
to: '/video/forceDelete/'
},
{
title: 'Index',
to: '/video/index/'
},
{
title: 'Show',
to: '/video/show/',
},
{
title: 'Store',
to: '/video/store/',
},
{
title: 'Update',
to: '/video/update/',
}
]
},
+18 -2
View File
@@ -41,10 +41,26 @@ For example, the video Bakemonogatari-OP1.webm represents the WebM of the Bakemo
### Endpoints
**[Video Destroy](/video/destroy/)**
The video destroy endpoint soft deletes a video and returns the deleted video resource.
**[Video Force Delete](/video/forceDelete/)**
The video force delete endpoint hard deletes a video and returns a confirmation message.
**[Video Index](/video/index/)**
The video index endpoint displays a listing of video resources.
**[Video Show](/video/show/)**
The video show endpoint returns a video resource.
**[Video Index](/video/index/)**
**[Video Store](/video/store/)**
The video index endpoint displays a listing of video resources.
The video store endpoint creates a new video and returns the new video resource.
**[Video Update](/video/update/)**
The video update endpoint updates a video and returns the updated video resource.
+66
View File
@@ -0,0 +1,66 @@
---
title: Video Destroy
---
<Block>
# Video Destroy Endpoint
The video destroy endpoint soft deletes a video and returns the deleted video resource.
For example, the `/api/video/Bakemonogatari-OP1.webm` endpoint will soft delete the Bakemonogatari-OP1.webm video and return the deleted Bakemonogatari-OP1.webm resource.
## URL
```sh
DELETE /api/video/{basename}
```
## Authentication
**Required Permission**: delete video
**Roles with Permission**: Admin
## Parameters
None
## Response
```json
{
video: {
id: id,
basename: "basename",
filename: "filename",
path: "path",
size: size,
mimetype: "mimetype",
resolution: resolution,
nc: nc,
subbed: subbed,
lyrics: lyrics,
uncen: uncen,
source: "source",
overlap: "overlap",
created_at: "created_at",
updated_at: "updated_at",
deleted_at: "deleted_at",
tags: "tags",
link: "link"
}
}
```
<Example>
<CURL>
```bash
curl -X DELETE -H "Authorization: Bearer {token}" https://api.animethemes.moe/video/Bakemonogatari-OP1.webm
```
</CURL>
</Example>
</Block>
+47
View File
@@ -0,0 +1,47 @@
---
title: Video Force Delete
---
<Block>
# Video Force Delete Endpoint
The video force delete endpoint hard deletes a video and returns a confirmation message.
For example, the `/api/forceDelete/video/Bakemonogatari-OP1.webm` endpoint will hard delete the Bakemonogatari-OP1.webm video and return a confirmation message.
## URL
```sh
DELETE /api/forceDelete/video/{basename}
```
## Authentication
**Required Permission**: force delete video
**Roles with Permission**: Admin
## Parameters
None
## Response
```json
{
message: "The Video 'Bakemonogatari-OP1.webm' was deleted.",
}
```
<Example>
<CURL>
```bash
curl -X DELETE -H "Authorization: Bearer {token}" https://api.animethemes.moe/forceDelete/video/Bakemonogatari-OP1.webm
```
</CURL>
</Example>
</Block>
+1 -1
View File
@@ -8,7 +8,7 @@ title: Video Show
The video show endpoint returns a video resource.
For example, `/api/video/Bakemonogatari-OP1.webm` endpoint will return the video for the Bakemonogatari OP1 theme.
For example, `/api/video/Bakemonogatari-OP1.webm` endpoint will return the Bakemonogatari-OP1.webm video.
## URL
+79
View File
@@ -0,0 +1,79 @@
---
title: Video Store
---
<Block>
# Video Store Endpoint
The video store endpoint creates a new video and returns the new video resource.
For example, the `/api/video?basename=Bakemonogatari-OP1.webm&filename=Bakemonogatari-OP1&mimetype=video/webm&path=2009/Summer/Bakemonogatari-OP1.webm&size=50602649` endpoint will create a new Bakemonogatari-OP1.webm video and return the new Bakemonogatari-OP1.webm resource.
## URL
```sh
POST /api/video
```
## Authentication
**Required Permission**: create video
**Roles with Permission**: Admin
## Parameters
| Name | Required | Rules |
| :--------: | :------: | :------------------------------------- |
| basename | Yes | string, max:192 |
| filename | Yes | string, max:192 |
| path | Yes | string, max:192 |
| size | Yes | integer, min:0 |
| mimetype | Yes | string, max:192 |
| resolution | No | integer, min:360, max:1080 |
| nc | No | boolean |
| subbed | No | boolean |
| lyrics | No | boolean |
| uncen | No | boolean |
| overlap | No | EnumValue {None, Trans, Over} |
| source | No | EnumValue {Web, RAW, BD, DVD, VHS, LD} |
## Response
```json
{
video: {
id: id,
basename: "basename",
filename: "filename",
path: "path",
size: size,
mimetype: "mimetype",
resolution: resolution,
nc: nc,
subbed: subbed,
lyrics: lyrics,
uncen: uncen,
source: "source",
overlap: "overlap",
created_at: "created_at",
updated_at: "updated_at",
deleted_at: "deleted_at",
tags: "tags",
link: "link"
}
}
```
<Example>
<CURL>
```bash
curl -X POST -H "Authorization: Bearer {token}" https://api.animethemes.moe/video/
```
</CURL>
</Example>
</Block>
+74
View File
@@ -0,0 +1,74 @@
---
title: Video Update
---
<Block>
# Video Update Endpoint
The video update endpoint updates a video and returns the updated video resource.
For example, the `/api/video/Bakemonogatari-OP1.webm?resolution=1080` endpoint will update the Bakemonogatari-OP1.webm video resolution attribute and return the updated Bakemonogatari-OP1.webm resource.
## URL
```sh
PUT|PATCH /api/video/{basename}
```
## Authentication
**Required Permission**: update video
**Roles with Permission**: Wiki Editor, Admin
## Parameters
| Name | Required | Rules |
| :--------: | :------: | :------------------------------------- |
| resolution | No | integer, min:360, max:1080 |
| nc | No | boolean |
| subbed | No | boolean |
| lyrics | No | boolean |
| uncen | No | boolean |
| overlap | No | EnumValue {None, Trans, Over} |
| source | No | EnumValue {Web, RAW, BD, DVD, VHS, LD} |
## Response
```json
{
video: {
id: id,
basename: "basename",
filename: "filename",
path: "path",
size: size,
mimetype: "mimetype",
resolution: resolution,
nc: nc,
subbed: subbed,
lyrics: lyrics,
uncen: uncen,
source: "source",
overlap: "overlap",
created_at: "created_at",
updated_at: "updated_at",
deleted_at: "deleted_at",
tags: "tags",
link: "link"
}
}
```
<Example>
<CURL>
```bash
curl -X PATCH -H "Authorization: Bearer {token}" https://api.animethemes.moe/video/Bakemonogatari-OP1.webm
```
</CURL>
</Example>
</Block>
+6 -6
View File
@@ -5703,9 +5703,9 @@
"dev": true
},
"node_modules/electron-to-chromium": {
"version": "1.4.145",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.145.tgz",
"integrity": "sha512-g4VQCi61gA0t5fJHsalxAc8NpvxC/CEwLAGLfJ+DmkRXTEyntJA7H01771uVD6X6nnViv3GToPgb0QOVA8ivOQ==",
"version": "1.4.146",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.146.tgz",
"integrity": "sha512-4eWebzDLd+hYLm4csbyMU2EbBnqhwl8Oe9eF/7CBDPWcRxFmqzx4izxvHH+lofQxzieg8UbB8ZuzNTxeukzfTg==",
"dev": true
},
"node_modules/elliptic": {
@@ -19496,9 +19496,9 @@
"dev": true
},
"electron-to-chromium": {
"version": "1.4.145",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.145.tgz",
"integrity": "sha512-g4VQCi61gA0t5fJHsalxAc8NpvxC/CEwLAGLfJ+DmkRXTEyntJA7H01771uVD6X6nnViv3GToPgb0QOVA8ivOQ==",
"version": "1.4.146",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.146.tgz",
"integrity": "sha512-4eWebzDLd+hYLm4csbyMU2EbBnqhwl8Oe9eF/7CBDPWcRxFmqzx4izxvHH+lofQxzieg8UbB8ZuzNTxeukzfTg==",
"dev": true
},
"elliptic": {