feat: adding artist image endpoints (#68)

* feat: adding artist image endpoints

* fix: pivot destroy endpoints return a confirmation message
This commit is contained in:
paranarimasu
2023-03-04 15:44:47 -06:00
committed by Maniload
parent 5f260994db
commit 6858c8fd5d
17 changed files with 271 additions and 25 deletions
+12
View File
@@ -100,6 +100,7 @@ export default {
{ text: 'Anime Theme', link: '/wiki/animetheme/' },
{ text: 'Anime Theme Entry', link: '/wiki/animethemeentry/' },
{ text: 'Artist', link: '/wiki/artist/' },
{ text: 'Artist Image', link: '/wiki/artistimage/' },
{ text: 'Audio', link: '/wiki/audio/' },
{ text: 'Image', link: '/wiki/image/' },
{ text: 'Resource', link: '/wiki/resource/' },
@@ -385,6 +386,17 @@ export default {
{ text: 'Update', link: '/wiki/artist/update/' }
]
},
{
text: 'Artist Image',
collapsible: true,
items: [
{ text: 'Resource', link: '/wiki/artistimage/' },
{ text: 'Destroy', link: '/wiki/artistimage/destroy/' },
{ text: 'Index', link: '/wiki/artistimage/index/' },
{ text: 'Show', link: '/wiki/artistimage/show/' },
{ text: 'Store', link: '/wiki/artistimage/store/' }
]
},
{
text: 'Audio',
collapsible: true,
+1 -4
View File
@@ -28,10 +28,7 @@ None
```json
{
animeimage: {
created_at: "created_at",
updated_at: "updated_at"
}
message: "Image 'OoMI35OjrpjORDlWJvFAZzQOD0vIH1oBQClClSIU.png' has been detached from Anime 'Bakemonogatari'.",
}
```
+1 -4
View File
@@ -28,10 +28,7 @@ None
```json
{
animeseries: {
created_at: "created_at",
updated_at: "updated_at"
}
message: "Anime 'Bakemonogatari' has been detached from Series 'Monogatari'.",
}
```
+1 -4
View File
@@ -28,10 +28,7 @@ None
```json
{
animestudio: {
created_at: "created_at",
updated_at: "updated_at"
}
message: "Anime 'Bakemonogatari' has been detached from Studio 'Shaft'.",
}
```
+2 -2
View File
@@ -6,7 +6,7 @@ title: Artist Destroy
The artist destroy endpoint soft deletes an artist and returns the deleted artist resource.
For example, the `/artist/chiwa_saito` endpoint will soft delete the Chiwa Saito artist and return the deleted Chiwa Saito resource.
For example, the `/artist/chiwa_saitou` endpoint will soft delete the Chiwa Saitou artist and return the deleted Chiwa Saitou resource.
## URL
@@ -44,5 +44,5 @@ None
## Example
```bash
curl -X DELETE -H "Authorization: Bearer {token}" https://api.animethemes.moe/artist/chiwa_saito
curl -X DELETE -H "Authorization: Bearer {token}" https://api.animethemes.moe/artist/chiwa_saitou
```
+3 -3
View File
@@ -6,7 +6,7 @@ title: Artist Force Delete
The artist force delete endpoint hard deletes an artist and returns a confirmation message.
For example, the `/forceDelete/artist/chiwa_saito` endpoint will hard delete the Chiwa Saito artist and return a confirmation message.
For example, the `/forceDelete/artist/chiwa_saitou` endpoint will hard delete the Chiwa Saitou artist and return a confirmation message.
## URL
@@ -28,12 +28,12 @@ None
```json
{
message: "The Artist 'Chiwa Saito' was deleted.",
message: "The Artist 'Chiwa Saitou' was deleted.",
}
```
## Example
```bash
curl -X DELETE -H "Authorization: Bearer {token}" https://api.animethemes.moe/forceDelete/artist/chiwa_saito
curl -X DELETE -H "Authorization: Bearer {token}" https://api.animethemes.moe/forceDelete/artist/chiwa_saitou
```
+1 -1
View File
@@ -8,7 +8,7 @@ title: Artist
An artist API resource represents a musical performer of anime sequences.
For example, Chiwa Saito is the musical performer of the Bakemonogatari OP1 theme, among many others.
For example, Chiwa Saitou is the musical performer of the Bakemonogatari OP1 theme, among many others.
## Fields
+2 -2
View File
@@ -6,7 +6,7 @@ title: Artist Restore
The artist restore endpoint restores a soft deleted artist and returns the restored artist resource.
For example, the `/restore/artist/chiwa_saito` endpoint will restore the soft deleted Chiwa Saito artist and return the restored Chiwa Saito resource.
For example, the `/restore/artist/chiwa_saitou` endpoint will restore the soft deleted Chiwa Saitou artist and return the restored Chiwa Saitou resource.
## URL
@@ -44,5 +44,5 @@ None
## Example
```bash
curl -X PATCH -H "Authorization: Bearer {token}" https://api.animethemes.moe/restore/artist/chiwa_saito
curl -X PATCH -H "Authorization: Bearer {token}" https://api.animethemes.moe/restore/artist/chiwa_saitou
```
+2 -2
View File
@@ -6,7 +6,7 @@ title: Artist Show
The artist show endpoint returns an artist resource.
For example, the `/artist/chiwa_saito` endpoint will return the artist resource for the artist Chiwa Saito.
For example, the `/artist/chiwa_saitou` endpoint will return the artist resource for the artist Chiwa Saitou.
## URL
@@ -45,5 +45,5 @@ None
## Example
```bash
curl https://api.animethemes.moe/artist/chiwa_saito
curl https://api.animethemes.moe/artist/chiwa_saitou
```
+1 -1
View File
@@ -6,7 +6,7 @@ title: Artist Store
The artist store endpoint creates a new artist and returns the new artist resource.
For example, the `/artist?name=Chiwa+Saito&slug=chiwa_saito` endpoint will create a new Chiwa Saito artist and return the new Chiwa Saito resource.
For example, the `/artist?name=Chiwa+Saito&slug=chiwa_saitou` endpoint will create a new Chiwa Saitou artist and return the new Chiwa Saitou resource.
## URL
+2 -2
View File
@@ -6,7 +6,7 @@ title: Artist Update
The artist update endpoint updates an artist and returns the updated artist resource.
For example, the `/artist/chiwa_saito?name=Chiwa+Saito` endpoint will update the Chiwa Saito artist name attribute and return the updated Chiwa Saito resource.
For example, the `/artist/chiwa_saitou?name=Chiwa+Saito` endpoint will update the Chiwa Saitou artist name attribute and return the updated Chiwa Saitou resource.
## URL
@@ -47,5 +47,5 @@ PUT|PATCH /artist/{slug}
## Example
```bash
curl -X PATCH -H "Authorization: Bearer {token}" https://api.animethemes.moe/artist/chiwa_saito
curl -X PATCH -H "Authorization: Bearer {token}" https://api.animethemes.moe/artist/chiwa_saitou
```
+39
View File
@@ -0,0 +1,39 @@
---
title: Artist Image Destroy
---
# Artist Image Destroy Endpoint
The artist image destroy endpoint deletes an artist image and returns the deleted artist image resource.
For example, the `/artistimage/chiwa_saitou/6703` endpoint will delete the association between the Chiwa Saitou artist and the large cover image of id 6703.
## URL
```sh
DELETE /artistimage/{artist:slug}/{image:id}
```
## Authentication
**Required Permission**: delete artist, delete image
**Roles with Permission**: Wiki Editor, Admin
## Parameters
None
## Response
```json
{
message: "Image 'KXWxcUb0dF3Kb1SmWP2GRcd72Nv6a0OEjj33pDmP.png' has been detached from Artist 'Chiwa Saitou'.",
}
```
## Example
```bash
curl -X DELETE -H "Authorization: Bearer {token}" https://api.artistthemes.moe/artistimage/chiwa_saitou/6703
```
+39
View File
@@ -0,0 +1,39 @@
---
title: Artist Image
---
# Artist Image
---
An artist image API resource represents the association between an artist and an image.
## 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 |
## Allowed Include Paths
* artist
* image
## Endpoints
**[Artist Image Destroy](/wiki/artistimage/destroy/)**
The artist image destroy endpoint deletes an artist image and returns the deleted artist image resource.
**[Artist Image Index](/wiki/artistimage/index/)**
The artist image index endpoint displays a listing of artist image resources.
**[Artist Image Show](/wiki/artistimage/show/)**
The artist image show endpoint returns an artist image resource.
**[Artist Image Store](/wiki/artistimage/store/)**
The artist image store endpoint creates a new artist image and returns the new artist image resource.
+76
View File
@@ -0,0 +1,76 @@
---
title: Artist Image Index
---
# Artist Image Index Endpoint
The artist image index endpoint returns a listing of artist image resources.
## URL
```sh
GET /artistimage/
```
## Authentication
None
## Parameters
| Name | Required | Description |
| :----------: | :------: | :----------------------------------------------------------------------------------- |
| fields | No | Sparse fieldsets for resource types |
| filter | No | Filters for artist image resources & constraining the inclusion of related resources |
| include | No | Inclusion of related resources |
| page[number] | No | The page of artist image resources to display |
| page[size] | No | The number of artist image 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 |
## 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 |
## Response
```json
{
artistimages: [
{
created_at: "created_at",
updated_at: "updated_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 https://api.artistthemes.moe/artistimage/
```
+40
View File
@@ -0,0 +1,40 @@
---
title: Artist Image Show
---
# Artist Image Show Endpoint
The artist image show endpoint returns an artist image resource.
For example, the `/artistimage/chiwa_saitou/6703` endpoint will return the artist image resource for the association between the Chiwa Saitou artist and the large cover image of id 6703.
## URL
```sh
GET /artistimage/{artist:slug}/{image:id}
```
## Authentication
None
## Parameters
None
## Response
```json
{
artistimage: {
created_at: "created_at",
updated_at: "updated_at"
}
}
```
## Example
```bash
curl https://api.artistthemes.moe/artistimage/chiwa_saitou/6703
```
+45
View File
@@ -0,0 +1,45 @@
---
title: Artist Image Store
---
# Artist Image Store Endpoint
The artist image store endpoint creates a new artist image and returns the new artist image resource.
For example, the `/artistimage?artist_id=53&image_id=6703` endpoint will create a new association between the Chiwa Saitou artist and the large cover image of id 6703.
## URL
```sh
POST /artistimage
```
## Authentication
**Required Permission**: create artist, create image
**Roles with Permission**: Wiki Editor, Admin
## Parameters
| Name | Required | Rules |
| :-------: | :------: | :------------------------ |
| artist_id | Yes | integer, Artist ID exists |
| image_id | Yes | integer, Image ID exists |
## Response
```json
{
artistimage: {
created_at: "created_at",
updated_at: "updated_at"
}
}
```
## Example
```bash
curl -X POST -H "Authorization: Bearer {token}" https://api.artistthemes.moe/artistimage/
```
+4
View File
@@ -46,6 +46,10 @@ An anime theme entry API resource represents a version of an anime theme.
An artist API resource represents a musical performer of anime sequences.
**[Artist Image](/wiki/artistimage/)**
An artist image API resource represents the association between an artist and an image.
**[Audio](/wiki/audio/)**
An audio API resource represents the audio track of a video.