feat: add my playlists endpoint (#62)

This commit is contained in:
paranarimasu
2023-01-19 19:07:41 -06:00
committed by Maniload
parent 40054d3523
commit fa3090b5bd
5 changed files with 168 additions and 0 deletions
+25
View File
@@ -48,6 +48,14 @@ export default {
{ text: 'Dump', link: '/admin/dump/' }
],
},
{
text: 'Auth',
items: [
{ text: 'Index', link: '/auth/' },
{ text: 'Me', link: '/auth/user/me/' },
{ text: 'User', link: '/auth/user/' }
],
},
{
text: 'Billing',
items: [
@@ -131,6 +139,23 @@ export default {
]
}
],
'/auth/': [
{
text: 'Me',
collapsible: true,
items: [
{ text: 'Resource', link: '/auth/user/me/' },
{ text: 'Playlists', link: '/auth/user/me/playlist/' }
]
},
{
text: 'User',
collapsible: true,
items: [
{ text: 'Resource', link: '/auth/user/' }
]
}
],
'/billing/': [
{
text: 'Balance',
+15
View File
@@ -0,0 +1,15 @@
---
title: Auth
---
# Auth
---
Auth API resources pertain to the authorization of actions on the site.
## Resources
**[User](/auth/user/)**
A user API resource represents an account for the site.
+23
View File
@@ -0,0 +1,23 @@
---
title: User
---
# User
---
A user API resource represents an account for the site.
Under construction.
## Fields
Under construction.
## Allowed Include Paths
Under construction.
## Endpoints
Under construction.
+15
View File
@@ -0,0 +1,15 @@
---
title: Me
---
# Me
---
The "Me" namespace is a collection of endpoints that pertain to the currently authenticated user.
## Endpoints
**[My Playlists](/auth/user/me/playlist/)**
The my playlists endpoint returns a listing of playlist resources owned by the currently authenticated user.
+90
View File
@@ -0,0 +1,90 @@
---
title: My Playlists
---
# My Playlists Endpoint
The my playlists endpoint returns a listing of playlist resources owned by the currently authenticated user.
## URL
```sh
GET /me/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 |
| 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 -H "Authorization: Bearer {token}" https://api.animethemes.moe/me/playlist/
```