feat: add playlist track adjacency endpoints (#60)

This commit is contained in:
paranarimasu
2022-12-11 17:20:09 -06:00
committed by Maniload
parent ccbbbef335
commit 40054d3523
13 changed files with 845 additions and 699 deletions
+1 -1
View File
@@ -18,7 +18,7 @@ Follow the Installation Guide in the README to ensure a functional local instanc
Set this repository as upstream to the forked repository.
`git remote add upstream https://github.com/AnimeThemes/animethemes-api-docs.git`
`git remote add upstream git@github.com:AnimeThemes/animethemes-api-docs.git`
Pull upstream changes so that the local main branch is even with the upstream main branch.
+3 -1
View File
@@ -233,7 +233,9 @@ export default {
{ text: 'Restore', link: '/list/playlist/track/restore/' },
{ text: 'Show', link: '/list/playlist/track/show/' },
{ text: 'Store', link: '/list/playlist/track/store/' },
{ text: 'Update', link: '/list/playlist/track/update/' }
{ text: 'Update', link: '/list/playlist/track/update/' },
{ text: 'Forward Index', link: '/list/playlist/track/forward/' },
{ text: 'Backward Index', link: '/list/playlist/track/backward/' }
]
}
],
@@ -0,0 +1,67 @@
---
title: Backward Index
---
# Backward Index Endpoint
The backward index endpoint returns a listing of tracks for the playlist in backward order.
## URL
```sh
GET /playlist/{id}/backward
```
## 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 |
| 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 |
## Allowed Include Paths
* video
## Response
```json
{
tracks: [
{
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/backward
```
+1 -1
View File
@@ -28,7 +28,7 @@ None
```json
{
playlisttrack: {
track: {
id: id,
created_at: "created_at",
updated_at: "updated_at",
+67
View File
@@ -0,0 +1,67 @@
---
title: Forward Index
---
# Forward Index Endpoint
The forward index endpoint returns a listing of tracks for the playlist in forward order.
## URL
```sh
GET /playlist/{id}/forward
```
## 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 |
| 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 |
## Allowed Include Paths
* video
## Response
```json
{
tracks: [
{
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/forward
```
+9 -1
View File
@@ -54,4 +54,12 @@ The playlist track store endpoint creates a new playlist track and returns the n
**[Playlist Track Update](/list/playlist/track/update/)**
The playlist track update endpoint updates a playlist track and returns the updated playlist track resource.
The playlist track update endpoint updates a playlist track and returns the updated playlist track resource.
**[Forward Index](/list/playlist/track/forward/)**
The forward index endpoint returns a listing of tracks for the playlist in forward order.
**[Backward Index](/list/playlist/track/backward/)**
The backward index endpoint returns a listing of tracks for the playlist in backward order.
+4 -4
View File
@@ -1,10 +1,10 @@
---
title: Playlist Index
title: Playlist Track Index
---
# Playlist Index Endpoint
# Playlist Track Index Endpoint
The playlist index endpoint returns a listing of tracks for the playlist.
The playlist track index endpoint returns a listing of tracks for the playlist.
## URL
@@ -54,7 +54,7 @@ GET /playlist/{id}/track
```json
{
playlisttracks: [
tracks: [
{
id: id,
created_at: "created_at",
+1 -1
View File
@@ -28,7 +28,7 @@ None
```json
{
playlisttrack: {
track: {
id: id,
created_at: "created_at",
updated_at: "updated_at",
+1 -1
View File
@@ -31,7 +31,7 @@ GET /playlist/{id}/track/{id}
```json
{
playlisttrack: {
track: {
id: id,
created_at: "created_at",
updated_at: "updated_at",
+1 -1
View File
@@ -31,7 +31,7 @@ POST /playlist/{id}/track
```json
{
playlisttrack: {
track: {
id: id,
created_at: "created_at",
updated_at: "updated_at",
+1 -1
View File
@@ -32,7 +32,7 @@ PUT|PATCH /playlist/{id}/track/{id}
```json
{
playlisttrack: {
track: {
id: id,
created_at: "created_at",
updated_at: "updated_at",
+687 -685
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -11,11 +11,11 @@
"scripts": {
"docs:dev": "vitepress dev docs",
"docs:build": "vitepress build docs",
"docs:serve": "vitepress serve docs"
"docs:preview": "vitepress preview docs"
},
"license": "MIT",
"dependencies": {
"dotenv": "^16.0.3",
"vitepress": "^1.0.0-alpha.28"
"vitepress": "^1.0.0-alpha.31"
}
}