diff --git a/docs/.vitepress/config.js b/docs/.vitepress/config.js index 23d4aaa..bdfd6d7 100644 --- a/docs/.vitepress/config.js +++ b/docs/.vitepress/config.js @@ -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', diff --git a/docs/auth/index.md b/docs/auth/index.md new file mode 100644 index 0000000..9e5125f --- /dev/null +++ b/docs/auth/index.md @@ -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. \ No newline at end of file diff --git a/docs/auth/user/index.md b/docs/auth/user/index.md new file mode 100644 index 0000000..94fcbb3 --- /dev/null +++ b/docs/auth/user/index.md @@ -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. \ No newline at end of file diff --git a/docs/auth/user/me/index.md b/docs/auth/user/me/index.md new file mode 100644 index 0000000..5683535 --- /dev/null +++ b/docs/auth/user/me/index.md @@ -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. \ No newline at end of file diff --git a/docs/auth/user/me/playlist/index.md b/docs/auth/user/me/playlist/index.md new file mode 100644 index 0000000..28e95c1 --- /dev/null +++ b/docs/auth/user/me/playlist/index.md @@ -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/ +``` \ No newline at end of file