feat: adding artist resource endpoints (#69)

This commit is contained in:
paranarimasu
2023-03-05 00:28:29 -06:00
committed by Maniload
parent 6858c8fd5d
commit bfa0216f94
12 changed files with 316 additions and 4 deletions
+13
View File
@@ -101,6 +101,7 @@ export default {
{ text: 'Anime Theme Entry', link: '/wiki/animethemeentry/' },
{ text: 'Artist', link: '/wiki/artist/' },
{ text: 'Artist Image', link: '/wiki/artistimage/' },
{ text: 'Artist Resource', link: '/wiki/artistresource/' },
{ text: 'Audio', link: '/wiki/audio/' },
{ text: 'Image', link: '/wiki/image/' },
{ text: 'Resource', link: '/wiki/resource/' },
@@ -397,6 +398,18 @@ export default {
{ text: 'Store', link: '/wiki/artistimage/store/' }
]
},
{
text: 'Artist Resource',
collapsible: true,
items: [
{ text: 'Resource', link: '/wiki/artistresource/' },
{ text: 'Destroy', link: '/wiki/artistresource/destroy/' },
{ text: 'Index', link: '/wiki/artistresource/index/' },
{ text: 'Show', link: '/wiki/artistresource/show/' },
{ text: 'Store', link: '/wiki/artistresource/store/' },
{ text: 'Update', link: '/wiki/artistresource/update/' }
]
},
{
text: 'Audio',
collapsible: true,
+1 -1
View File
@@ -35,5 +35,5 @@ None
## Example
```bash
curl -X DELETE -H "Authorization: Bearer {token}" https://api.artistthemes.moe/artistimage/chiwa_saitou/6703
curl -X DELETE -H "Authorization: Bearer {token}" https://api.animethemes.moe/artistimage/chiwa_saitou/6703
```
+1 -1
View File
@@ -72,5 +72,5 @@ None
## Example
```bash
curl https://api.artistthemes.moe/artistimage/
curl https://api.animethemes.moe/artistimage/
```
+1 -1
View File
@@ -36,5 +36,5 @@ None
## Example
```bash
curl https://api.artistthemes.moe/artistimage/chiwa_saitou/6703
curl https://api.animethemes.moe/artistimage/chiwa_saitou/6703
```
+1 -1
View File
@@ -41,5 +41,5 @@ POST /artistimage
## Example
```bash
curl -X POST -H "Authorization: Bearer {token}" https://api.artistthemes.moe/artistimage/
curl -X POST -H "Authorization: Bearer {token}" https://api.animethemes.moe/artistimage/
```
+39
View File
@@ -0,0 +1,39 @@
---
title: Artist Resource Destroy
---
# Artist Resource Destroy Endpoint
The artist resource destroy endpoint deletes an artist resource and returns the deleted artist resource resource.
For example, the `/artistresource/chiwa_saitou/3361` endpoint will delete the association between the Chiwa Saitou artist and the external resource of id 3361.
## URL
```sh
DELETE /artistresource/{artist:slug}/{resource:id}
```
## Authentication
**Required Permission**: delete artist, delete external resource
**Roles with Permission**: Wiki Editor, Admin
## Parameters
None
## Response
```json
{
message: "Resource 'https://myanimelist.net/people/61' has been detached from Artist 'Chiwa Saitou'.",
}
```
## Example
```bash
curl -X DELETE -H "Authorization: Bearer {token}" https://api.animethemes.moe/artistresource/chiwa_saitou/3361
```
+44
View File
@@ -0,0 +1,44 @@
---
title: Artist Resource
---
# Artist Resource
---
An artist resource API resource represents the association between an artist and an external resource.
## 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 resources that map to the same artist |
## Allowed Include Paths
* artist
* resource
## Endpoints
**[Artist Resource Destroy](/wiki/artistresource/destroy/)**
The artist resource destroy endpoint deletes an artist resource and returns the deleted artist resource resource.
**[Artist Resource Index](/wiki/artistresource/index/)**
The artist resource index endpoint displays a listing of artist resource resources.
**[Artist Resource Show](/wiki/artistresource/show/)**
The artist resource show endpoint returns an artist resource resource.
**[Artist Resource Store](/wiki/artistresource/store/)**
The artist resource store endpoint creates a new artist resource and returns the new artist resource resource.
**[Artist Resource Update](/wiki/artistresource/update/)**
The artist update endpoint updates an artist resource and returns the updated artist resource resource.
+79
View File
@@ -0,0 +1,79 @@
---
title: Artist Resource Index
---
# Artist Resource Index Endpoint
The artist resource index endpoint returns a listing of artist resource resources.
## URL
```sh
GET /artistresource/
```
## Authentication
None
## Parameters
| Name | Required | Description |
| :----------: | :------: | :----------------------------------------------------------------------------- |
| fields | No | Sparse fieldsets for resource types |
| filter | No | Filters for artist resources & constraining the inclusion of related resources |
| include | No | Inclusion of related resources |
| page[number] | No | The page of artist resource resources to display |
| page[size] | No | The number of artist 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
{
artistresources: [
{
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/artistresource/
```
+41
View File
@@ -0,0 +1,41 @@
---
title: Artist Resource Show
---
# Artist Resource Show Endpoint
The artist resource show endpoint returns an artist resource resource.
For example, the `/artistresource/chiwa_saitou/3361` endpoint will return the artist resource resource for the association between the Chiwa Saitou artist and the external resource of id 3361.
## URL
```sh
GET /artistresource/{artist:slug}/{resource:id}
```
## Authentication
None
## Parameters
None
## Response
```json
{
artistresource: {
created_at: "created_at",
updated_at: "updated_at",
as: "as"
}
}
```
## Example
```bash
curl https://api.animethemes.moe/artistresource/chiwa_saitou/3361
```
+47
View File
@@ -0,0 +1,47 @@
---
title: Artist Resource Store
---
# Artist Resource Store Endpoint
The artist resource store endpoint creates a new artist resource and returns the new artist resource resource.
For example, the `/artistresource?artist_id=53&resource_id=3361` endpoint will create a new association between the Chiwa Saitou artist and the external resource of id 3361.
## URL
```sh
POST /artistresource
```
## Authentication
**Required Permission**: create artist, create external resource
**Roles with Permission**: Wiki Editor, Admin
## Parameters
| Name | Required | Rules |
| :---------: | :------: | :-------------------------- |
| artist_id | Yes | integer, Artist ID exists |
| resource_id | Yes | integer, Resource ID exists |
| as | No | string, max:192 |
## Response
```json
{
artistresource: {
created_at: "created_at",
updated_at: "updated_at",
as: "as"
}
}
```
## Example
```bash
curl -X POST -H "Authorization: Bearer {token}" https://api.animethemes.moe/artistresource/
```
+45
View File
@@ -0,0 +1,45 @@
---
title: Artist Resource Update
---
# Artist Resource Update Endpoint
The artist resource store endpoint updates an artist resource and returns the updated artist resource resource.
For example, the `/artistresource/chiwa_saitou/3361?as=updated+label` endpoint will update the association between the Chiwa Saitou artist and the external resource of id 3361.
## URL
```sh
PUT|PATCH /artistresource/{artist:slug}/{resource:id}
```
## Authentication
**Required Permission**: update artist, update external resource
**Roles with Permission**: Wiki Editor, Admin
## Parameters
| Name | Required | Rules |
| :---------: | :------: | :-------------- |
| as | No | string, max:192 |
## Response
```json
{
artistresource: {
created_at: "created_at",
updated_at: "updated_at",
as: "as"
}
}
```
## Example
```bash
curl -X PATCH -H "Authorization: Bearer {token}" https://api.animethemes.moe/artistresource/
```
+4
View File
@@ -50,6 +50,10 @@ An artist API resource represents a musical performer of anime sequences.
An artist image API resource represents the association between an artist and an image.
**[Artist Resource](/wiki/artistresource/)**
An artist resource API resource represents the association between an artist and an external resource.
**[Audio](/wiki/audio/)**
An audio API resource represents the audio track of a video.