feat: adding playlist resource & enabling editLink theme component

This commit is contained in:
paranarimasu
2022-10-19 23:43:43 -05:00
committed by Maniload
parent a1fa3a0103
commit 99b3b7a906
10 changed files with 796 additions and 413 deletions
+16
View File
@@ -7,6 +7,9 @@ export default {
title: 'AnimeThemes',
description: 'AnimeThemes API Documentation',
themeConfig: {
editLink: {
pattern: 'https://github.com/AnimeThemes/animethemes-api-docs/edit/main/docs/:path'
},
logo: {
light: '/logo.svg',
dark: '/logo-dark.svg',
@@ -199,6 +202,19 @@ export default {
{ text: 'Update', link: '/page/update/' },
]
},
{
text: 'Playlist',
collapsible: true,
items: [
{ text: 'Resource', link: '/playlist/' },
{ text: 'Destroy', link: '/playlist/destroy/' },
{ text: 'Force Delete', link: '/playlist/forceDelete/' },
{ text: 'Index', link: '/playlist/index/' },
{ text: 'Show', link: '/playlist/show/' },
{ text: 'Store', link: '/playlist/store/' },
{ text: 'Update', link: '/playlist/update/' },
]
},
{
text: 'Resource',
collapsible: true,
+46
View File
@@ -0,0 +1,46 @@
---
title: Playlist Destroy
---
# Playlist Destroy Endpoint
The playlist destroy endpoint soft deletes a playlist and returns the deleted playlist resource.
For example, the `/playlist/1` endpoint will soft delete the playlist of id `1` and return the deleted playlist resource.
## URL
```sh
DELETE /playlist/{id}
```
## Authentication
**Required Permission**: delete playlist
**Other Requirements**: User must own playlist
## Parameters
None
## Response
```json
{
playlist: {
id: id,
name: "name",
visibility: "visibility",
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
```
+39
View File
@@ -0,0 +1,39 @@
---
title: Playlist Force Delete
---
# Playlist Force Delete Endpoint
The playlist force delete endpoint hard deletes a playlist and returns a confirmation message.
For example, the `/forceDelete/playlist/1` endpoint will hard delete the playlist of id `1` and return a confirmation message.
## URL
```sh
DELETE /forceDelete/playlist/{id}
```
## Authentication
**Required Permission**: force delete playlist
**Roles with Permission**: Admin
## Parameters
None
## Response
```json
{
message: "The Playlist 'Name' was deleted.",
}
```
## Example
```bash
curl -X DELETE -H "Authorization: Bearer {token}" https://api.animethemes.moe/forceDelete/playlist/bakemonogatari
```
+56
View File
@@ -0,0 +1,56 @@
---
title: Playlist
---
# Playlist
---
A playlist API resource represents a list of ordered tracks intended for continuous playback.
For example, a "/r/anime's Best OPs and EDs of 2022" playlist may contain a collection of tracks allowing the continuous playback of Best OP and ED nominations for the /r/anime Awards.
### Fields
| Name | Type | Nullable | Description |
| :--------: | :-----: | :------: | :---------------------------------------------------------------- |
| id | Integer | No | The primary key of the resource |
| name | String | No | The title of the playlist |
| visibility | Enum | Yes | The state of who can see the playlist [Private, Unlisted, Public] |
| 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
* first
* images
* last
* tracks
* user
### Endpoints
**[Playlist Destroy](/playlist/destroy/)**
The playlist destroy endpoint soft deletes a playlist and returns the deleted playlist resource.
**[Playlist Force Delete](/playlist/forceDelete/)**
The playlist force delete endpoint hard deletes a playlist and returns a confirmation message.
**[Playlist Index](/playlist/index/)**
The playlist index endpoint displays a listing of playlist resources.
**[Playlist Show](/playlist/show/)**
The playlist show endpoint returns a playlist resource.
**[Playlist Store](/playlist/store/)**
The playlist store endpoint creates a new playlist and returns the new playlist resource.
**[Playlist Update](/playlist/update/)**
The playlist update endpoint updates a playlist and returns the updated playlist resource.
+91
View File
@@ -0,0 +1,91 @@
---
title: Playlist Index
---
# Playlist Index Endpoint
The playlist index endpoint returns a listing of public playlist resources.
## URL
```sh
GET /playlist/
```
## Authentication
**Required Permission**: view 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 |
| q | No | The query to search for matching playlist resources |
| sort | No | The list of fields to sort the resources |
## Allowed Sort Fields
| Name | Description |
| :--------: | :------------------------------------------------------------------ |
| id | Sort resources on the primary key |
| name | Sort resources on the title of the playlist |
| visibility | Sort resources on the visibility state of the playlist |
| 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 |
| name | Filter resources on the title of the playlist |
| visibility | Filter resources on the visibility state of the playlist [Public, Private, Unlisted] |
| 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
{
playlists: [
{
id: id,
name: "name",
visibility: "visibility",
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/
```
+49
View File
@@ -0,0 +1,49 @@
---
title: Playlist Show
---
# Playlist Show Endpoint
The playlist show endpoint returns a playlist resource.
## URL
```sh
GET /playlist/{id}
```
## Authentication
**Required Permission**: view playlist
**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
{
playlist: {
id: id,
name: "name",
visibility: "visibility",
created_at: "created_at",
updated_at: "updated_at",
deleted_at: "deleted_at"
}
}
```
## Example
```bash
curl https://api.animethemes.moe/playlist/1
```
+47
View File
@@ -0,0 +1,47 @@
---
title: Playlist Store
---
# Playlist Store Endpoint
The playlist store endpoint creates a new playlist and returns the new playlist resource.
For example, the `/playlist?name=Best+OPs` endpoint will create a new playlist and return the new playlist resource.
## URL
```sh
POST /playlist
```
## Authentication
**Required Permission**: create playlist
## Parameters
| Name | Required | Rules |
| :--------: | :------: | :------------------------------------ |
| name | Yes | string, max:192 |
| visibility | Yes | EnumValue [Public, Private, Unlisted] |
## Response
```json
{
playlist: {
id: id,
name: "name",
visibility: "visibility",
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/
```
+51
View File
@@ -0,0 +1,51 @@
---
title: Anime Update
---
# Anime Update Endpoint
The playlist update endpoint updates a playlist and returns the updated playlist resource.
For example, the `/playlist/1?visibility=public` endpoint will update the playlist of id `1` visibility attribute and return the updated playlist resource.
## URL
```sh
PUT|PATCH /playlist/{id}
```
## Authentication
**Required Permission**: update playlist
**Other Requirements**: User must own playlist
## Parameters
| Name | Required | Rules |
| :--------: | :------: | :------------------------------------------ |
| first_id | No | Track ID exists & Track Playlist ID matches |
| last_id | No | Track ID exists & Track Playlist ID matches |
| name | No | string, max:192 |
| visibility | No | EnumValue [Public, Private, Unlisted] |
## Response
```json
{
playlist: {
id: id,
name: "name",
visibility: "visibility",
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
```
+398 -410
View File
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -15,8 +15,8 @@
},
"license": "MIT",
"dependencies": {
"dotenv": "^16.0.2",
"vitepress": "^1.0.0-alpha.15",
"vue": "^3.2.39"
"dotenv": "^16.0.3",
"vitepress": "^1.0.0-alpha.21",
"vue": "^3.2.41"
}
}