feat: add playlist track resource

This commit is contained in:
paranarimasu
2022-10-24 23:07:55 -05:00
committed by Maniload
parent 99b3b7a906
commit 77f20fb595
12 changed files with 416 additions and 39 deletions
+13
View File
@@ -215,6 +215,19 @@ export default {
{ text: 'Update', link: '/playlist/update/' },
]
},
{
text: 'Playlist Track',
collapsible: true,
items: [
{ text: 'Resource', link: '/playlisttrack/' },
{ text: 'Destroy', link: '/playlisttrack/destroy/' },
{ text: 'Force Delete', link: '/playlisttrack/forceDelete/' },
{ text: 'Index', link: '/playlisttrack/index/' },
{ text: 'Show', link: '/playlisttrack/show/' },
{ text: 'Store', link: '/playlisttrack/store/' },
{ text: 'Update', link: '/playlisttrack/update/' },
]
},
{
text: 'Resource',
collapsible: true,
+1 -1
View File
@@ -35,5 +35,5 @@ None
## Example
```bash
curl -X DELETE -H "Authorization: Bearer {token}" https://api.animethemes.moe/forceDelete/playlist/bakemonogatari
curl -X DELETE -H "Authorization: Bearer {token}" https://api.animethemes.moe/forceDelete/playlist/1
```
+2 -2
View File
@@ -1,8 +1,8 @@
---
title: Anime Update
title: Playlist Update
---
# Anime Update Endpoint
# Playlist Update Endpoint
The playlist update endpoint updates a playlist and returns the updated playlist resource.
+44
View File
@@ -0,0 +1,44 @@
---
title: Playlist Track Destroy
---
# Playlist Track Destroy Endpoint
The playlist track destroy endpoint soft deletes a playlist track and returns the deleted playlist track resource.
For example, the `/playlist/1/playlisttrack/1` endpoint will soft delete the playlist track of id `1` and return the deleted playlist track resource.
## URL
```sh
DELETE /playlist/{id}/playlisttrack/{id}
```
## Authentication
**Required Permission**: delete playlist track
**Other Requirements**: User must own playlist
## Parameters
None
## Response
```json
{
playlisttrack: {
id: id,
created_at: "created_at",
updated_at: "updated_at",
deleted_at: "deleted_at"
}
}
```
## Example
```bash
curl -X DELETE -H "Authorization: Bearer {token}" https://api.animethemes.moe/playlist/1/playlisttrack/1
```
+39
View File
@@ -0,0 +1,39 @@
---
title: Playlist Track Force Delete
---
# Playlist Track Force Delete Endpoint
The playlist track force delete endpoint hard deletes a playlist track and returns a confirmation message.
For example, the `/forceDelete/playlist/1/playlisttrack/1` endpoint will hard delete the playlist track of id `1` and return a confirmation message.
## URL
```sh
DELETE /forceDelete/playlist/{id}/playlisttrack{id}
```
## Authentication
**Required Permission**: force delete playlist
**Roles with Permission**: Admin
## Parameters
None
## Response
```json
{
message: "The Playlist Track '1' was deleted.",
}
```
## Example
```bash
curl -X DELETE -H "Authorization: Bearer {token}" https://api.animethemes.moe/forceDelete/playlist/1/playlisttrack/1
```
+53
View File
@@ -0,0 +1,53 @@
---
title: Playlist Track
---
# Playlist Track
---
A playlist track API resource represents an entry in a playlist.
For example, a "/r/anime's Best OPs and EDs of 2022" playlist may contain a track for the ParipiKoumei-OP1.webm video.
### Fields
| Name | Type | Nullable | Description |
| :--------: | :-----: | :------: | :------------------------------------------- |
| id | Integer | No | The primary key of the resource |
| created_at | Date | No | The date that the resource was created |
| updated_at | Date | No | The date that the resource was last modified |
| deleted_at | Date | Yes | The date that the resource was deleted |
### Allowed Include Paths
* next
* playlist
* previous
* video
### Endpoints
**[Playlist Track Destroy](/playlisttrack/destroy/)**
The playlist track destroy endpoint soft deletes a playlist track and returns the deleted playlist track resource.
**[Playlist Track Force Delete](/playlisttrack/forceDelete/)**
The playlist track force delete endpoint hard deletes a playlist track and returns a confirmation message.
**[Playlist Track Index](/playlisttrack/index/)**
The playlist track index endpoint displays a listing of playlist track resources.
**[Playlist Track Show](/playlisttrack/show/)**
The playlist track show endpoint returns a playlist track resource.
**[Playlist Track Store](/playlisttrack/store/)**
The playlist track store endpoint creates a new playlist track and returns the new playlist track resource.
**[Playlist Track Update](/playlisttrack/update/)**
The playlist track update endpoint updates a playlist track and returns the updated playlist track resource.
+86
View File
@@ -0,0 +1,86 @@
---
title: Playlist Index
---
# Playlist Index Endpoint
The playlist index endpoint returns a listing of tracks for the playlist.
## URL
```sh
GET /playlist/{id}/playlisttrack
```
## Authentication
**Required Permission**: view playlist track
**Other Requirements**: If the playlist is private, the user must own the playlist
## Parameters
| Name | Required | Description |
| :----------: | :------: | :------------------------------------------------------------------------------- |
| fields | No | Sparse fieldsets for resource types |
| filter | No | Filters for playlist resources & constraining the inclusion of related resources |
| include | No | Inclusion of related resources |
| page[number] | No | The page of playlist resources to display |
| page[size] | No | The number of playlist resources to display for the current page |
| sort | No | The list of fields to sort the resources |
## Allowed Sort Fields
| Name | Description |
| :--------: | :------------------------------------------------------------------ |
| id | Sort resources on the primary key |
| created_at | Sort resources on the resource creation date |
| updated_at | Sort resources on the resource last modified date |
| deleted_at | Sort resources on the resource deletion date |
| random | Sort resources randomly. Ignored if other sort fields are provided. |
## Filters
| Name | Description |
| :--------: | :----------------------------------------------------------------- |
| id | Filter resources on the primary key |
| created_at | Filter resources on the resource creation date |
| updated_at | Filter resources on the resource last modified date |
| deleted_at | Filter resources on the resource deletion date |
| trashed | Filter resources on trashed (deleted) status [With, Without, Only] |
| has | Filter resources on relations within allowed include paths |
## Response
```json
{
playlisttracks: [
{
id: id,
created_at: "created_at",
updated_at: "updated_at",
deleted_at: "deleted_at"
},
...
],
links: {
first: "first",
last: "last",
prev: "prev",
next: "next"
},
meta: {
current_page: current_page,
from: from,
path: "path",
per_page: per_page,
to: to
}
}
```
## Example
```bash
curl https://api.animethemes.moe/playlist/1/playlisttrack
```
+47
View File
@@ -0,0 +1,47 @@
---
title: Playlist Track Show
---
# Playlist Track Show Endpoint
The playlist track show endpoint returns a playlist track resource.
## URL
```sh
GET /playlist/{id}/playlisttrack/{id}
```
## Authentication
**Required Permission**: view playlist track
**Other Requirements**: If the playlist is private, the user must own the playlist
## Parameters
| Name | Required | Description |
| :-----: | :------: | :------------------------------------------------------ |
| fields | No | Sparse fieldsets for resource types |
| filter | No | Filters to constrain the inclusion of related resources |
| include | No | Inclusion of related resources |
| sort | No | Sort related resources |
## Response
```json
{
playlisttrack: {
id: id,
created_at: "created_at",
updated_at: "updated_at",
deleted_at: "deleted_at"
}
}
```
## Example
```bash
curl https://api.animethemes.moe/playlist/1/playlisttrack/1
```
+47
View File
@@ -0,0 +1,47 @@
---
title: Playlist Track Store
---
# Playlist Track Store Endpoint
The playlist track store endpoint creates a new playlist track and returns the new playlist track resource.
For example, the `/playlist/1/playlisttrack?video_id=2712` endpoint will create a new playlist track for the Bakemonogatari-OP1.webm video and return the new playlist track resource.
## URL
```sh
POST /playlist/{id}/playlisttrack
```
## Authentication
**Required Permission**: create playlist track
**Other Requirements**: The user must own the playlist
## Parameters
| Name | Required | Rules |
| :--------: | :------: | :-------------- |
| name | Yes | string, max:192 |
| video_id | Yes | Video ID Exists |
## Response
```json
{
playlisttrack: {
id: id,
created_at: "created_at",
updated_at: "updated_at",
deleted_at: "deleted_at"
}
}
```
## Example
```bash
curl -X POST -H "Authorization: Bearer {token}" https://api.animethemes.moe/playlist/1/playlisttrack
```
+48
View File
@@ -0,0 +1,48 @@
---
title: Playlist Track Update
---
# Playlist Track Update Endpoint
The playlist track update endpoint updates a playlist track and returns the updated playlist track resource.
For example, the `/playlist/1/playlisttrack/1?next_id=2` endpoint will update the playlist track of id `1` next_id attribute and return the updated playlist track resource.
## URL
```sh
PUT|PATCH /playlist/{id}/playlisttrack/{id}
```
## Authentication
**Required Permission**: update playlist track
**Other Requirements**: User must own playlist
## Parameters
| Name | Required | Rules |
| :---------: | :------: | :------------------------------------------ |
| next_id | No | Track ID exists & Track Playlist ID matches |
| previous_id | No | Track ID exists & Track Playlist ID matches |
| video_id | No | Video ID Exists |
## Response
```json
{
playlisttrack: {
id: id,
created_at: "created_at",
updated_at: "updated_at",
deleted_at: "deleted_at"
}
}
```
## Example
```bash
curl -X PATCH -H "Authorization: Bearer {token}" https://api.animethemes.moe/playlist/1/playlisttrack/1
```
+35 -35
View File
@@ -10,7 +10,7 @@
"license": "MIT",
"dependencies": {
"dotenv": "^16.0.3",
"vitepress": "^1.0.0-alpha.21",
"vitepress": "^1.0.0-alpha.22",
"vue": "^3.2.41"
}
},
@@ -155,9 +155,9 @@
}
},
"node_modules/@babel/parser": {
"version": "7.19.4",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.19.4.tgz",
"integrity": "sha512-qpVT7gtuOLjWeDTKLkJ6sryqLliBaFpAtGeqw5cs5giLldvh+Ch0plqnUMKoVAUS6ZEueQQiZV+p5pxtPitEsA==",
"version": "7.19.6",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.19.6.tgz",
"integrity": "sha512-h1IUp81s2JYJ3mRkdxJgs4UvmSsRvDrx5ICSJbPvtWYv5i1nTBGcBpnog+89rAFMwvvru6E5NUHdBe01UeSzYA==",
"bin": {
"parser": "bin/babel-parser.js"
},
@@ -166,27 +166,27 @@
}
},
"node_modules/@docsearch/css": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/@docsearch/css/-/css-3.2.1.tgz",
"integrity": "sha512-gaP6TxxwQC+K8D6TRx5WULUWKrcbzECOPA2KCVMuI+6C7dNiGUk5yXXzVhc5sld79XKYLnO9DRTI4mjXDYkh+g=="
"version": "3.2.2",
"resolved": "https://registry.npmjs.org/@docsearch/css/-/css-3.2.2.tgz",
"integrity": "sha512-VB0Evx4ikS1ZlW1YVUw+vI9b3H/UXMCo4W/ZWy+n56Sho4KOqyCHcINVays91TJt7HTV/CKO3FCbm2VJg5Wipw=="
},
"node_modules/@docsearch/js": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/@docsearch/js/-/js-3.2.1.tgz",
"integrity": "sha512-H1PekEtSeS0msetR2YGGey2w7jQ2wAKfGODJvQTygSwMgUZ+2DHpzUgeDyEBIXRIfaBcoQneqrzsljM62pm6Xg==",
"version": "3.2.2",
"resolved": "https://registry.npmjs.org/@docsearch/js/-/js-3.2.2.tgz",
"integrity": "sha512-YQQFsrKdvLjI9yvDBh7EuxnrLDElY5SofK1pvyHPvnGE5iB75uIXHC7w7I2zUL5Kj5Crv2L7jVq5j1TwX6Ho5A==",
"dependencies": {
"@docsearch/react": "3.2.1",
"@docsearch/react": "3.2.2",
"preact": "^10.0.0"
}
},
"node_modules/@docsearch/react": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/@docsearch/react/-/react-3.2.1.tgz",
"integrity": "sha512-EzTQ/y82s14IQC5XVestiK/kFFMe2aagoYFuTAIfIb/e+4FU7kSMKonRtLwsCiLQHmjvNQq+HO+33giJ5YVtaQ==",
"version": "3.2.2",
"resolved": "https://registry.npmjs.org/@docsearch/react/-/react-3.2.2.tgz",
"integrity": "sha512-1Hn2SNQUFVPrzqvaj+vxXZfsfn3rnW8CoyGAJ1LqXMY9py8GbxK8VfmJ5Z6z4LwG9849tGru/N6dp0cQO6r9Ag==",
"dependencies": {
"@algolia/autocomplete-core": "1.7.1",
"@algolia/autocomplete-preset-algolia": "1.7.1",
"@docsearch/css": "3.2.1",
"@docsearch/css": "3.2.2",
"algoliasearch": "^4.0.0"
},
"peerDependencies": {
@@ -1042,9 +1042,9 @@
}
},
"node_modules/vitepress": {
"version": "1.0.0-alpha.21",
"resolved": "https://registry.npmjs.org/vitepress/-/vitepress-1.0.0-alpha.21.tgz",
"integrity": "sha512-D/tkoDW16uUZ9pnWd28Kk1vX26zNiTml3m9oGbfx2pAfYg99PHd1GceZyEm4jZsJU0+n9S++1ctFxoQvsq376A==",
"version": "1.0.0-alpha.22",
"resolved": "https://registry.npmjs.org/vitepress/-/vitepress-1.0.0-alpha.22.tgz",
"integrity": "sha512-IWqnAxMDNaiyl6Bz+/79l40Ho6xsjrqxRp/WZw0+5BXR0BTZbmHyhGtI3XrH6oSn8MisLPjCccikaj3mcmCoWg==",
"dependencies": {
"@docsearch/css": "^3.2.1",
"@docsearch/js": "^3.2.1",
@@ -1221,32 +1221,32 @@
}
},
"@babel/parser": {
"version": "7.19.4",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.19.4.tgz",
"integrity": "sha512-qpVT7gtuOLjWeDTKLkJ6sryqLliBaFpAtGeqw5cs5giLldvh+Ch0plqnUMKoVAUS6ZEueQQiZV+p5pxtPitEsA=="
"version": "7.19.6",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.19.6.tgz",
"integrity": "sha512-h1IUp81s2JYJ3mRkdxJgs4UvmSsRvDrx5ICSJbPvtWYv5i1nTBGcBpnog+89rAFMwvvru6E5NUHdBe01UeSzYA=="
},
"@docsearch/css": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/@docsearch/css/-/css-3.2.1.tgz",
"integrity": "sha512-gaP6TxxwQC+K8D6TRx5WULUWKrcbzECOPA2KCVMuI+6C7dNiGUk5yXXzVhc5sld79XKYLnO9DRTI4mjXDYkh+g=="
"version": "3.2.2",
"resolved": "https://registry.npmjs.org/@docsearch/css/-/css-3.2.2.tgz",
"integrity": "sha512-VB0Evx4ikS1ZlW1YVUw+vI9b3H/UXMCo4W/ZWy+n56Sho4KOqyCHcINVays91TJt7HTV/CKO3FCbm2VJg5Wipw=="
},
"@docsearch/js": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/@docsearch/js/-/js-3.2.1.tgz",
"integrity": "sha512-H1PekEtSeS0msetR2YGGey2w7jQ2wAKfGODJvQTygSwMgUZ+2DHpzUgeDyEBIXRIfaBcoQneqrzsljM62pm6Xg==",
"version": "3.2.2",
"resolved": "https://registry.npmjs.org/@docsearch/js/-/js-3.2.2.tgz",
"integrity": "sha512-YQQFsrKdvLjI9yvDBh7EuxnrLDElY5SofK1pvyHPvnGE5iB75uIXHC7w7I2zUL5Kj5Crv2L7jVq5j1TwX6Ho5A==",
"requires": {
"@docsearch/react": "3.2.1",
"@docsearch/react": "3.2.2",
"preact": "^10.0.0"
}
},
"@docsearch/react": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/@docsearch/react/-/react-3.2.1.tgz",
"integrity": "sha512-EzTQ/y82s14IQC5XVestiK/kFFMe2aagoYFuTAIfIb/e+4FU7kSMKonRtLwsCiLQHmjvNQq+HO+33giJ5YVtaQ==",
"version": "3.2.2",
"resolved": "https://registry.npmjs.org/@docsearch/react/-/react-3.2.2.tgz",
"integrity": "sha512-1Hn2SNQUFVPrzqvaj+vxXZfsfn3rnW8CoyGAJ1LqXMY9py8GbxK8VfmJ5Z6z4LwG9849tGru/N6dp0cQO6r9Ag==",
"requires": {
"@algolia/autocomplete-core": "1.7.1",
"@algolia/autocomplete-preset-algolia": "1.7.1",
"@docsearch/css": "3.2.1",
"@docsearch/css": "3.2.2",
"algoliasearch": "^4.0.0"
}
},
@@ -1738,9 +1738,9 @@
}
},
"vitepress": {
"version": "1.0.0-alpha.21",
"resolved": "https://registry.npmjs.org/vitepress/-/vitepress-1.0.0-alpha.21.tgz",
"integrity": "sha512-D/tkoDW16uUZ9pnWd28Kk1vX26zNiTml3m9oGbfx2pAfYg99PHd1GceZyEm4jZsJU0+n9S++1ctFxoQvsq376A==",
"version": "1.0.0-alpha.22",
"resolved": "https://registry.npmjs.org/vitepress/-/vitepress-1.0.0-alpha.22.tgz",
"integrity": "sha512-IWqnAxMDNaiyl6Bz+/79l40Ho6xsjrqxRp/WZw0+5BXR0BTZbmHyhGtI3XrH6oSn8MisLPjCccikaj3mcmCoWg==",
"requires": {
"@docsearch/css": "^3.2.1",
"@docsearch/js": "^3.2.1",
+1 -1
View File
@@ -16,7 +16,7 @@
"license": "MIT",
"dependencies": {
"dotenv": "^16.0.3",
"vitepress": "^1.0.0-alpha.21",
"vitepress": "^1.0.0-alpha.22",
"vue": "^3.2.41"
}
}