feat: adding artist member endpoints (#73)

This commit is contained in:
paranarimasu
2023-03-06 13:20:58 -06:00
committed by Maniload
parent a7da7a188d
commit 97013a056c
8 changed files with 312 additions and 0 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 Member', link: '/wiki/artistmember/' },
{ text: 'Artist Resource', link: '/wiki/artistresource/' },
{ text: 'Artist Song', link: '/wiki/artistsong/' },
{ text: 'Audio', link: '/wiki/audio/' },
@@ -401,6 +402,18 @@ export default {
{ text: 'Store', link: '/wiki/artistimage/store/' }
]
},
{
text: 'Artist Member',
collapsible: true,
items: [
{ text: 'Resource', link: '/wiki/artistmember/' },
{ text: 'Destroy', link: '/wiki/artistmember/destroy/' },
{ text: 'Index', link: '/wiki/artistmember/index/' },
{ text: 'Show', link: '/wiki/artistmember/show/' },
{ text: 'Store', link: '/wiki/artistmember/store/' },
{ text: 'Update', link: '/wiki/artistmember/update/' }
]
},
{
text: 'Artist Resource',
collapsible: true,
+39
View File
@@ -0,0 +1,39 @@
---
title: Artist Member Destroy
---
# Artist Member Destroy Endpoint
The artist member destroy endpoint deletes an artist member and returns the deleted artist member resource.
For example, the `/artistmember/ms/pile` endpoint will delete the association between the μ's group and the Pile member.
## URL
```sh
DELETE /artistmember/{artist:slug}/{artist:slug}
```
## Authentication
**Required Permission**: delete artist
**Roles with Permission**: Wiki Editor, Admin
## Parameters
None
## Response
```json
{
message: "Member 'Pile' has been detached from Artist 'μ's'.",
}
```
## Example
```bash
curl -X DELETE -H "Authorization: Bearer {token}" https://api.animethemes.moe/artistmember/ms/pile
```
+44
View File
@@ -0,0 +1,44 @@
---
title: Artist Member
---
# Artist Member
---
An artist member API resource represents the association of an artist and a group/unit.
## 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 membership by alias or character |
## Allowed Include Paths
* artist
* member
## Endpoints
**[Artist Member Destroy](/wiki/artistmember/destroy/)**
The artist member destroy endpoint deletes an artist member and returns the deleted artist member resource.
**[Artist Member Index](/wiki/artistmember/index/)**
The artist member index endpoint displays a listing of artist member resources.
**[Artist Member Show](/wiki/artistmember/show/)**
The artist member show endpoint returns an artist member resource.
**[Artist Member Store](/wiki/artistmember/store/)**
The artist member store endpoint creates a new artist member and returns the new artist member resource.
**[Artist Member Update](/wiki/artistmember/update/)**
The artist member update endpoint updates an artist member and returns the updated artist member resource.
+79
View File
@@ -0,0 +1,79 @@
---
title: Artist Member Index
---
# Artist Member Index Endpoint
The artist member index endpoint returns a listing of artist member resources.
## URL
```sh
GET /artistmember/
```
## Authentication
None
## Parameters
| Name | Required | Description |
| :----------: | :------: | :------------------------------------------------------------------------------------ |
| fields | No | Sparse fieldsets for resource types |
| filter | No | Filters for artist member resources & constraining the inclusion of related resources |
| include | No | Inclusion of related resources |
| page[number] | No | The page of artist member resources to display |
| page[size] | No | The number of artist member 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 alias or character |
## 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 alias or character |
## Response
```json
{
artistmembers: [
{
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/artistmember/
```
+41
View File
@@ -0,0 +1,41 @@
---
title: Artist Member Show
---
# Artist Member Show Endpoint
The artist member show endpoint returns an artist member resource.
For example, the `/artistmember/ms/pile` endpoint will return the artist member resource for the association between the association between the μ's group and the Pile member.
## URL
```sh
GET /artistmember/{artist:slug}/{artist:slug}
```
## Authentication
None
## Parameters
None
## Response
```json
{
artistmember: {
created_at: "created_at",
updated_at: "updated_at",
as: "as"
}
}
```
## Example
```bash
curl https://api.animethemes.moe/artistmember/ms/pile
```
+47
View File
@@ -0,0 +1,47 @@
---
title: Artist Member Store
---
# Artist Member Store Endpoint
The artist member store endpoint creates a new artist member and returns the new artist member resource.
For example, the `/artistmember?artist_id=410&member_id=191` endpoint will create a new association between the μ's group and the Pile member.
## URL
```sh
POST /artistmember
```
## Authentication
**Required Permission**: create artist
**Roles with Permission**: Wiki Editor, Admin
## Parameters
| Name | Required | Rules |
| :-------: | :------: | :------------------------ |
| artist_id | Yes | integer, Artist ID exists |
| member_id | Yes | integer, Artist ID exists |
| as | No | string, max:192 |
## Response
```json
{
artistmember: {
created_at: "created_at",
updated_at: "updated_at",
as: "as"
}
}
```
## Example
```bash
curl -X POST -H "Authorization: Bearer {token}" https://api.animethemes.moe/artistmember/
```
+45
View File
@@ -0,0 +1,45 @@
---
title: Artist Member Update
---
# Artist Member Update Endpoint
The artist member update endpoint updates an artist member and returns the updated artist member resource.
For example, the `/artistmember/ms/pile?as=updated+label` endpoint will update the association between the μ's group and the Pile member.
## URL
```sh
PUT|PATCH /artistmember/{artist:slug}/{artist:slug}
```
## Authentication
**Required Permission**: update artist
**Roles with Permission**: Wiki Editor, Admin
## Parameters
| Name | Required | Rules |
| :---------: | :------: | :-------------- |
| as | No | string, max:192 |
## Response
```json
{
artistmember: {
created_at: "created_at",
updated_at: "updated_at",
as: "as"
}
}
```
## Example
```bash
curl -X PATCH -H "Authorization: Bearer {token}" https://api.animethemes.moe/artistmember/
```
+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 Member](/wiki/artistmember/)**
An artist member API resource represents the association of an artist and a group/unit.
**[Artist Resource](/wiki/artistresource/)**
An artist resource API resource represents the association between an artist and an external resource.