feat: adding anime series endpoints (#66)

This commit is contained in:
paranarimasu
2023-03-04 13:48:31 -06:00
committed by Maniload
parent 2ecd2fbbdb
commit 5c8c68122f
7 changed files with 262 additions and 0 deletions
+12
View File
@@ -94,6 +94,7 @@ export default {
{ text: 'Anime', link: '/wiki/anime/' },
{ text: 'Anime Image', link: '/wiki/animeimage/' },
{ text: 'Anime Resource', link: '/wiki/animeresource/' },
{ text: 'Anime Series', link: '/wiki/animeseries/' },
{ text: 'Anime Synonym', link: '/wiki/animesynonym/' },
{ text: 'Anime Theme', link: '/wiki/animetheme/' },
{ text: 'Anime Theme Entry', link: '/wiki/animethemeentry/' },
@@ -305,6 +306,17 @@ export default {
{ text: 'Update', link: '/wiki/animeresource/update/' }
]
},
{
text: 'Anime Series',
collapsible: true,
items: [
{ text: 'Resource', link: '/wiki/animeseries/' },
{ text: 'Destroy', link: '/wiki/animeseries/destroy/' },
{ text: 'Index', link: '/wiki/animeseries/index/' },
{ text: 'Show', link: '/wiki/animeseries/show/' },
{ text: 'Store', link: '/wiki/animeseries/store/' }
]
},
{
text: 'Anime Synonym',
collapsible: true,
+42
View File
@@ -0,0 +1,42 @@
---
title: Anime Series Destroy
---
# Anime Series Destroy Endpoint
The anime series destroy endpoint deletes an anime series and returns the deleted anime series resource.
For example, the `/animeseries/bakemonogatari/monogatari` endpoint will delete the association between the Bakemonogatari anime and the Monogatari series.
## URL
```sh
DELETE /animeseries/{anime:slug}/{series:slug}
```
## Authentication
**Required Permission**: delete anime, delete series
**Roles with Permission**: Wiki Editor, Admin
## Parameters
None
## Response
```json
{
animeseries: {
created_at: "created_at",
updated_at: "updated_at"
}
}
```
## Example
```bash
curl -X DELETE -H "Authorization: Bearer {token}" https://api.animethemes.moe/animeseries/bakemonogatari/monogatari
```
+39
View File
@@ -0,0 +1,39 @@
---
title: Anime Series
---
# Anime Series
---
An anime series API resource represents the association between an anime and a series.
## 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
* anime
* series
## Endpoints
**[Anime Series Destroy](/wiki/animeseries/destroy/)**
The anime series destroy endpoint deletes an anime series and returns the deleted anime series resource.
**[Anime Series Index](/wiki/animeseries/index/)**
The anime series index endpoint displays a listing of anime series resources.
**[Anime Series Show](/wiki/animeseries/show/)**
The anime series show endpoint returns an anime series resource.
**[Anime Series Store](/wiki/animeseries/store/)**
The anime series store endpoint creates a new anime series and returns the new anime series resource.
+76
View File
@@ -0,0 +1,76 @@
---
title: Anime Series Index
---
# Anime Series Index Endpoint
The anime series index endpoint returns a listing of anime series resources.
## URL
```sh
GET /animeseries/
```
## Authentication
None
## Parameters
| Name | Required | Description |
| :----------: | :------: | :----------------------------------------------------------------------------------- |
| fields | No | Sparse fieldsets for resource types |
| filter | No | Filters for anime series resources & constraining the inclusion of related resources |
| include | No | Inclusion of related resources |
| page[number] | No | The page of anime series resources to display |
| page[size] | No | The number of anime series 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
{
animeseries: [
{
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.animethemes.moe/animeseries/
```
+40
View File
@@ -0,0 +1,40 @@
---
title: Anime Series Show
---
# Anime Series Show Endpoint
The anime series show endpoint returns an anime series resource.
For example, the `/animeseries/bakemonogatari/monogatari` endpoint will return the anime series resource for the association between the Bakemonogatari anime and the Monogatari series.
## URL
```sh
GET /animeseries/{anime:slug}/{series:slug}
```
## Authentication
None
## Parameters
None
## Response
```json
{
animeseries: {
created_at: "created_at",
updated_at: "updated_at"
}
}
```
## Example
```bash
curl https://api.animethemes.moe/animeseries/bakemonogatari/monogatari
```
+45
View File
@@ -0,0 +1,45 @@
---
title: Anime Series Store
---
# Anime Series Store Endpoint
The anime series store endpoint creates a new anime series and returns the new anime series resource.
For example, the `/animeseries?anime_id=218&series_id=116` endpoint will create a new association between the Bakemonogatari anime and the Monogatari series.
## URL
```sh
POST /animeseries
```
## Authentication
**Required Permission**: create anime, create series
**Roles with Permission**: Wiki Editor, Admin
## Parameters
| Name | Required | Rules |
| :-------: | :------: | :------------------------ |
| anime_id | Yes | integer, Anime ID exists |
| series_id | Yes | integer, Series ID exists |
## Response
```json
{
animeseries: {
created_at: "created_at",
updated_at: "updated_at"
}
}
```
## Example
```bash
curl -X POST -H "Authorization: Bearer {token}" https://api.animethemes.moe/animeseries/
```
+8
View File
@@ -18,6 +18,14 @@ An anime API resource represents a production with at least one opening or endin
An anime image API resource represents the association between an anime and an image.
**[Anime Resource](/wiki/animeresource/)**
An anime resource API resource represents the association between an anime and an external resource.
**[Anime Series](/wiki/animeseries/)**
An anime series API resource represents the association between an anime and a series.
**[Anime Synonym](/wiki/animesynonym/)**
An anime synonym API resource represents an alternate title or common abbreviation for an anime.