feat: added song resource pivot and missing media_format attribute (#91)

This commit is contained in:
Kyrch
2023-11-01 00:15:19 -03:00
committed by Maniload
parent f9a9a470fe
commit e8031d96d1
11 changed files with 311 additions and 5 deletions
+6
View File
@@ -58,6 +58,7 @@ The AnimeThemes API Resource Object attributes are included as top-level members
slug: "slug",
year: year,
season: "season",
media_format: "media_format",
synopsis: "synopsis",
...
}
@@ -105,6 +106,7 @@ The AnimeThemes API Resource Object collections shall contain `links` and `meta`
slug: "slug",
year: year,
season: "season",
media_format: "media_format",
synopsis: "synopsis",
created_at: "created_at",
updated_at: "updated_at",
@@ -212,6 +214,7 @@ If inclusion of related resources is not specified, the AnimeThemes API shall **
slug: "slug",
year: year,
season: "season",
media_format: "media_format",
synopsis: "synopsis",
created_at: "created_at",
updated_at: "updated_at",
@@ -245,6 +248,7 @@ If the client does not specify the set of fields for a given resource type, the
slug: "slug",
year: year,
season: "season",
media_format: "media_format",
synopsis: "synopsis",
created_at: "created_at",
updated_at: "updated_at",
@@ -267,6 +271,7 @@ The AnimeThemes API supports sorting for every endpoint that returns a collectio
slug: "slug",
year: 1963,
season: "season",
media_format: "media_format",
synopsis: "synopsis",
created_at: "created_at",
updated_at: "updated_at",
@@ -304,6 +309,7 @@ The AnimeThemes API supports an offset pagination strategy for every endpoint th
slug: "slug",
year: year,
season: "season",
media_format: "media_format",
synopsis: "synopsis",
created_at: "created_at",
updated_at: "updated_at",
+1
View File
@@ -39,6 +39,7 @@ None
slug: "slug",
year: year,
season: "season",
media_format: "media_format",
synopsis: "synopsis",
created_at: "created_at",
updated_at: "updated_at",
+6 -5
View File
@@ -44,11 +44,12 @@ None
## Allowed Relation Sort Fields
| Name | Description |
| :----------: | :--------------------------------------------------------------------- |
| anime.season | Sort resources on the season of the anime that the resource belongs to |
| anime.year | Sort resources on the year of the anime that the resource belongs to |
| song.title | Sort resources on the title of the song that the resource belongs to |
| Name | Description |
| :----------------: | :--------------------------------------------------------------------------- |
| anime.season | Sort resources on the season of the anime that the resource belongs to |
| anime.media_format | Sort resources on the media_format of the anime that the resource belongs to |
| anime.year | Sort resources on the year of the anime that the resource belongs to |
| song.title | Sort resources on the title of the song that the resource belongs to |
## Filters
+4
View File
@@ -36,6 +36,7 @@ None
slug: "slug",
year: year,
season: "season",
media_format: "media_format",
synopsis: "synopsis",
created_at: "created_at",
updated_at: "updated_at",
@@ -50,6 +51,7 @@ None
slug: "slug",
year: year,
season: "season",
media_format: "media_format",
synopsis: "synopsis",
created_at: "created_at",
updated_at: "updated_at",
@@ -64,6 +66,7 @@ None
slug: "slug",
year: year,
season: "season",
media_format: "media_format",
synopsis: "synopsis",
created_at: "created_at",
updated_at: "updated_at",
@@ -78,6 +81,7 @@ None
slug: "slug",
year: year,
season: "season",
media_format: "media_format",
synopsis: "synopsis",
created_at: "created_at",
updated_at: "updated_at",
+1
View File
@@ -25,6 +25,7 @@ For example, Staple Stable is the song for the Bakemonogatari OP1 AnimeTheme.
* animethemes
* animethemes.anime
* artists
* resources
## Allowed Pivots
+39
View File
@@ -0,0 +1,39 @@
---
title: Song Resource Destroy
---
# Song Resource Destroy Endpoint
The song resource destroy endpoint deletes an song resource and returns the deleted song resource resource.
For example, the `/songresource/10535/30212` endpoint will delete the association between the Mijuku DREAMER song and the external resource of id 30212.
## URL
```sh
DELETE /songresource/{song:id}/{resource:id}
```
## Authentication
**Required Permission**: delete song, delete external resource
**Roles with Permission**: Wiki Editor, Admin
## Parameters
None
## Response
```json
{
message: "Resource 'https://open.spotify.com/track/6f9SU0JwNjVDjduReyFpAd?si=2719f3d5bd014f17' has been detached from Song 'Mijuku DREAMER'.",
}
```
## Example
```bash
curl -X DELETE -H "Authorization: Bearer {token}" https://api.animethemes.moe/songresource/10535/30212
```
+44
View File
@@ -0,0 +1,44 @@
---
title: Song Resource
---
# Song Resource
---
An song resource API resource represents the association between an song and an external resource.
## Fields
| Name | Type | Nullable | Default | Description |
| :--------: | :-----: | :------: | :-----: | :------------------------------------------------------- |
| created_at | Date | No | No | The date that the resource was created |
| updated_at | Date | No | No | The date that the resource was last modified |
| as | String | No | Yes | Used to distinguish resources that map to the same song |
## Allowed Include Paths
* song
* resource
## Endpoints
**[Song Resource Destroy](/wiki/songresource/destroy/)**
The song resource destroy endpoint deletes an song resource and returns the deleted song resource resource.
**[Song Resource Index](/wiki/songresource/index/)**
The song resource index endpoint displays a listing of song resource resources.
**[Song Resource Show](/wiki/songresource/show/)**
The song resource show endpoint returns an song resource resource.
**[Song Resource Store](/wiki/songresource/store/)**
The song resource store endpoint creates a new song resource and returns the new song resource resource.
**[Song Resource Update](/wiki/songresource/update/)**
The song resource update endpoint updates an song resource and returns the updated song resource resource.
+79
View File
@@ -0,0 +1,79 @@
---
title: Song Resource Index
---
# Song Resource Index Endpoint
The song resource index endpoint returns a listing of song resource resources.
## URL
```sh
GET /songresource/
```
## Authentication
None
## Parameters
| Name | Required | Description |
| :----------: | :------: | :---------------------------------------------------------------------------- |
| fields | No | Sparse fieldsets for resource types |
| filter | No | Filters for song resources & constraining the inclusion of related resources |
| include | No | Inclusion of related resources |
| page[number] | No | The page of song resource resources to display |
| page[size] | No | The number of song resource resources to display for the current page |
| sort | No | The list of fields to sort the resources |
## Allowed Sort Fields
| Name | Description |
| :--------: | :------------------------------------------------ |
| created_at | Sort resources on the resource creation date |
| updated_at | Sort resources on the resource last modified date |
| as | Sort resources on distinguishing label |
## Filters
| Name | Description |
| :--------: | :--------------------------------------------------------- |
| created_at | Filter resources on the resource creation date |
| updated_at | Filter resources on the resource last modified date |
| as | Filter resources on the resource distinguishing label |
| has | Filter resources on relations within allowed include paths |
## Response
```json
{
songresources: [
{
created_at: "created_at",
updated_at: "updated_at",
as: "as"
},
...
],
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/songresource/
```
+41
View File
@@ -0,0 +1,41 @@
---
title: Song Resource Show
---
# Song Resource Show Endpoint
The song resource show endpoint returns an song resource resource.
For example, the `/songresource/10535/30212` endpoint will return the song resource resource for the association between the Mijuku DREAMER song and the external resource of id 30212.
## URL
```sh
GET /songresource/{song:id}/{resource:id}
```
## Authentication
None
## Parameters
None
## Response
```json
{
songresource: {
created_at: "created_at",
updated_at: "updated_at",
as: "as"
}
}
```
## Example
```bash
curl https://api.animethemes.moe/songresource/10535/30212
```
+45
View File
@@ -0,0 +1,45 @@
---
title: Song Resource Store
---
# Song Resource Store Endpoint
The song resource store endpoint creates a new song resource and returns the new song resource resource.
For example, the `/songresource/10535/30212` endpoint will create a new association between the Mijuku DREAMER song and the external resource of id 30212.
## URL
```sh
POST /songresource/{song:id}/{resource:id}
```
## Authentication
**Required Permission**: create song, create external resource
**Roles with Permission**: Wiki Editor, Admin
## Parameters
| Name | Required | Rules |
| :--: | :------: | :-------------- |
| as | No | string, max:192 |
## Response
```json
{
songresource: {
created_at: "created_at",
updated_at: "updated_at",
as: "as"
}
}
```
## Example
```bash
curl -X POST -H "Authorization: Bearer {token}" https://api.animethemes.moe/songresource/10535/30212
```
+45
View File
@@ -0,0 +1,45 @@
---
title: Song Resource Update
---
# Song Resource Update Endpoint
The song resource store endpoint updates an song resource and returns the updated song resource resource.
For example, the `/songresource/10535/30212?as=updated+label` endpoint will update the association between the Mijuku DREAMER song and the external resource of id 30212.
## URL
```sh
PUT|PATCH /songresource/{song:id}/{resource:id}
```
## Authentication
**Required Permission**: update song, update external resource
**Roles with Permission**: Wiki Editor, Admin
## Parameters
| Name | Required | Rules |
| :---------: | :------: | :-------------- |
| as | No | string, max:192 |
## Response
```json
{
songresource: {
created_at: "created_at",
updated_at: "updated_at",
as: "as"
}
}
```
## Example
```bash
curl -X PATCH -H "Authorization: Bearer {token}" https://api.animethemes.moe/songresource/
```