feat: adding artist song endpoints (#72)

This commit is contained in:
paranarimasu
2023-03-06 10:55:14 -06:00
committed by Maniload
parent 3cd96205d8
commit a7da7a188d
11 changed files with 315 additions and 3 deletions
+13
View File
@@ -102,6 +102,7 @@ export default {
{ text: 'Artist', link: '/wiki/artist/' },
{ text: 'Artist Image', link: '/wiki/artistimage/' },
{ text: 'Artist Resource', link: '/wiki/artistresource/' },
{ text: 'Artist Song', link: '/wiki/artistsong/' },
{ text: 'Audio', link: '/wiki/audio/' },
{ text: 'Image', link: '/wiki/image/' },
{ text: 'Resource', link: '/wiki/resource/' },
@@ -412,6 +413,18 @@ export default {
{ text: 'Update', link: '/wiki/artistresource/update/' }
]
},
{
text: 'Artist Song',
collapsible: true,
items: [
{ text: 'Resource', link: '/wiki/artistsong/' },
{ text: 'Destroy', link: '/wiki/artistsong/destroy/' },
{ text: 'Index', link: '/wiki/artistsong/index/' },
{ text: 'Show', link: '/wiki/artistsong/show/' },
{ text: 'Store', link: '/wiki/artistsong/store/' },
{ text: 'Update', link: '/wiki/artistsong/update/' }
]
},
{
text: 'Audio',
collapsible: true,
+1 -1
View File
@@ -41,4 +41,4 @@ The anime resource store endpoint creates a new anime resource and returns the n
**[Anime Resource Update](/wiki/animeresource/update/)**
The anime update endpoint updates an anime resource and returns the updated anime resource resource.
The anime resource update endpoint updates an anime resource and returns the updated anime resource resource.
+1 -1
View File
@@ -41,4 +41,4 @@ The artist resource store endpoint creates a new artist resource and returns the
**[Artist Resource Update](/wiki/artistresource/update/)**
The artist update endpoint updates an artist resource and returns the updated artist resource resource.
The artist resource update endpoint updates an artist resource and returns the updated artist resource resource.
+39
View File
@@ -0,0 +1,39 @@
---
title: Artist Song Destroy
---
# Artist Song Destroy Endpoint
The artist song destroy endpoint deletes an artist song and returns the deleted artist song resource.
For example, the `/artistsong/chiwa_saitou/3373` endpoint will delete the association between the Chiwa Saitou artist and the "staple stable" song.
## URL
```sh
DELETE /artistsong/{artist:slug}/{song:id}
```
## Authentication
**Required Permission**: delete artist, delete song
**Roles with Permission**: Wiki Editor, Admin
## Parameters
None
## Response
```json
{
message: "Song 'staple stable' has been detached from Artist 'Chiwa Saitou'.",
}
```
## Example
```bash
curl -X DELETE -H "Authorization: Bearer {token}" https://api.animethemes.moe/artistsong/chiwa_saitou/3373
```
+44
View File
@@ -0,0 +1,44 @@
---
title: Artist Song
---
# Artist Song
---
An artist song API resource represents the association between an artist and an song.
## Fields
| Name | Type | Nullable | Description |
| :--------: | :-----: | :------: | :------------------------------------------------------------- |
| created_at | Date | No | The date that the resource was created |
| updated_at | Date | No | The date that the resource was last modified |
| as | String | No | Used to distinguish a performance by alias, character or group |
## Allowed Include Paths
* artist
* song
## Endpoints
**[Artist Song Destroy](/wiki/artistsong/destroy/)**
The artist song destroy endpoint deletes an artist song and returns the deleted artist song resource.
**[Artist Song Index](/wiki/artistsong/index/)**
The artist song index endpoint displays a listing of artist song resources.
**[Artist Song Show](/wiki/artistsong/show/)**
The artist song show endpoint returns an artist song resource.
**[Artist Song Store](/wiki/artistsong/store/)**
The artist song store endpoint creates a new artist song and returns the new artist song resource.
**[Artist Song Update](/wiki/artistsong/update/)**
The artist song update endpoint updates an artist song and returns the updated artist song resource.
+79
View File
@@ -0,0 +1,79 @@
---
title: Artist Song Index
---
# Artist Song Index Endpoint
The artist song index endpoint returns a listing of artist song resources.
## URL
```sh
GET /artistsong/
```
## Authentication
None
## Parameters
| Name | Required | Description |
| :----------: | :------: | :---------------------------------------------------------------------------------- |
| fields | No | Sparse fieldsets for resource types |
| filter | No | Filters for artist song resources & constraining the inclusion of related resources |
| include | No | Inclusion of related resources |
| page[number] | No | The page of artist song resources to display |
| page[size] | No | The number of artist song 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 for performance by alias, character or group |
## Filters
| Name | Description |
| :--------: | :------------------------------------------------------------------------------------ |
| created_at | Filter resources on the resource creation date |
| updated_at | Filter resources on the resource last modified date |
| has | Filter resources on relations within allowed include paths |
| as | Filter resources on distinguishing label for performance by alias, character or group |
## Response
```json
{
artistsongs: [
{
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/artistsong/
```
+41
View File
@@ -0,0 +1,41 @@
---
title: Artist Song Show
---
# Artist Song Show Endpoint
The artist song show endpoint returns an artist song resource.
For example, the `/artistsong/chiwa_saitou/3373` endpoint will return the artist song resource for the association between the Chiwa Saitou artist and the "staple stable" song.
## URL
```sh
GET /artistsong/{artist:slug}/{song:id}
```
## Authentication
None
## Parameters
None
## Response
```json
{
artistsong: {
created_at: "created_at",
updated_at: "updated_at",
as: "as"
}
}
```
## Example
```bash
curl https://api.animethemes.moe/artistsong/chiwa_saitou/3373
```
+47
View File
@@ -0,0 +1,47 @@
---
title: Artist Song Store
---
# Artist Song Store Endpoint
The artist song store endpoint creates a new artist song and returns the new artist song resource.
For example, the `/artistsong?artist_id=53&song_id=3373` endpoint will create a new association between the Chiwa Saitou artist and the "staple stable" song.
## URL
```sh
POST /artistsong
```
## Authentication
**Required Permission**: create artist, create song
**Roles with Permission**: Wiki Editor, Admin
## Parameters
| Name | Required | Rules |
| :-------: | :------: | :------------------------ |
| artist_id | Yes | integer, Artist ID exists |
| song_id | Yes | integer, Song ID exists |
| as | No | string, max:192 |
## Response
```json
{
artistsong: {
created_at: "created_at",
updated_at: "updated_at",
as: "as"
}
}
```
## Example
```bash
curl -X POST -H "Authorization: Bearer {token}" https://api.animethemes.moe/artistsong/
```
+45
View File
@@ -0,0 +1,45 @@
---
title: Artist Song Update
---
# Artist Song Update Endpoint
The artist song update endpoint updates an artist song and returns the updated artist song resource.
For example, the `/artistsong/chiwa_saitou/3373?as=updated+label` endpoint will update the association between the Chiwa Saitou artist and the "staple stable" song.
## URL
```sh
PUT|PATCH /artistsong/{artist:slug}/{song:id}
```
## Authentication
**Required Permission**: update artist, update song
**Roles with Permission**: Wiki Editor, Admin
## Parameters
| Name | Required | Rules |
| :---------: | :------: | :-------------- |
| as | No | string, max:192 |
## Response
```json
{
artistsong: {
created_at: "created_at",
updated_at: "updated_at",
as: "as"
}
}
```
## Example
```bash
curl -X PATCH -H "Authorization: Bearer {token}" https://api.animethemes.moe/artistsong/
```
+4
View File
@@ -54,6 +54,10 @@ An artist image API resource represents the association between an artist and an
An artist resource API resource represents the association between an artist and an external resource.
**[Artist Song](/wiki/artistsong/)**
An artist song API resource represents the association between an artist and a song.
**[Audio](/wiki/audio/)**
An audio API resource represents the audio track of a video.
+1 -1
View File
@@ -41,4 +41,4 @@ The studio resource store endpoint creates a new studio resource and returns the
**[Studio Resource Update](/wiki/studioresource/update/)**
The studio update endpoint updates a studio resource and returns the updated studio resource resource.
The studio resource update endpoint updates a studio resource and returns the updated studio resource resource.