feat: adding entry write endpoints (#35)

This commit is contained in:
paranarimasu
2022-06-12 19:14:32 -05:00
committed by GitHub
parent 118d30351c
commit eb77fbd89a
8 changed files with 281 additions and 17 deletions
+18 -2
View File
@@ -131,12 +131,28 @@ module.exports = {
to: '/animethemeentry',
children: [
{
title: 'Show',
to: '/animethemeentry/show/',
title: 'Destroy',
to: '/animethemeentry/destroy/'
},
{
title: 'Force Delete',
to: '/animethemeentry/forceDelete/'
},
{
title: 'Index',
to: '/animethemeentry/index/'
},
{
title: 'Show',
to: '/animethemeentry/show/',
},
{
title: 'Store',
to: '/animethemeentry/store/',
},
{
title: 'Update',
to: '/animethemeentry/update/',
}
]
},
+24 -8
View File
@@ -1,14 +1,14 @@
---
title: AnimeThemeEntry
title: Anime Theme Entry
---
# AnimeThemeEntry
# Anime Theme Entry
---
An AnimeThemeEntry API resource represents a version of an AnimeTheme.
An anime theme entry API resource represents a version of an anime theme.
For example, the Bakemonogatari ED theme has three AnimeThemeEntries to represent three versions.
For example, the ED theme of the Bakemonogatari anime has three anime theme entries to represent three versions.
### Fields
@@ -32,10 +32,26 @@ For example, the Bakemonogatari ED theme has three AnimeThemeEntries to represen
### Endpoints
**[AnimeThemeEntry Show](/animethemeentry/show/)**
**[Anime Theme Entry Destroy](/animethemeentry/destroy/)**
The AnimeThemeEntry show endpoint returns an AnimeThemeEntry resource.
The anime theme entry destroy endpoint soft deletes an anime theme entry and returns the deleted anime theme entry resource.
**[AnimeThemeEntry Index](/animethemeentry/index/)**
**[Anime Theme Entry Force Delete](/animethemeentry/forceDelete/)**
The AnimeThemeEntry index endpoint displays a listing of AnimeThemeEntry resources.
The anime theme entry force delete endpoint hard deletes an anime theme entry and returns a confirmation message.
**[Anime Theme Entry Index](/animethemeentry/index/)**
The anime theme entry index endpoint displays a listing of anime theme entry resources.
**[Anime Theme Entry Show](/animethemeentry/show/)**
The anime theme entry show endpoint returns an anime theme entry resource.
**[Anime Theme Entry Store](/animethemeentry/store/)**
The anime theme entry store endpoint creates a new anime theme entry and returns the new anime theme entry resource.
**[Anime Theme Entry Update](/animethemeentry/update/)**
The anime theme entry update endpoint updates an anime theme entry and returns the updated anime theme entry resource.
+57
View File
@@ -0,0 +1,57 @@
---
title: Anime Theme Entry Destroy
---
<Block>
# Anime Theme Entry Destroy Endpoint
The anime theme entry destroy endpoint soft deletes an anime theme entry and returns the deleted anime theme entry resource.
For example, the `/api/animethemeentry/3822` endpoint will soft delete the V2 entry for the ED1 theme of the Bakemonogatari anime and return the deleted anime theme entry resource.
## URL
```sh
DELETE /api/animethemeentry/{id}
```
## Authentication
**Required Permission**: delete anime theme entry
**Roles with Permission**: Wiki Editor, Admin
## Parameters
None
## Response
```json
{
animethemeentry: {
id: id,
version: version,
episodes: "episodes",
nsfw: nsfw,
spoiler: spoiler,
notes: "notes",
created_at: "created_at",
updated_at: "updated_at",
deleted_at: "deleted_at"
}
}
```
<Example>
<CURL>
```bash
curl -X DELETE -H "Authorization: Bearer {token}" https://api.animethemes.moe/animethemeentry/3822
```
</CURL>
</Example>
</Block>
@@ -0,0 +1,47 @@
---
title: Anime Theme Entry Force Delete
---
<Block>
# Anime Theme Entry Force Delete Endpoint
The anime theme entry force delete endpoint hard deletes an anime theme entry and returns a confirmation message.
For example, the `/api/forceDelete/animethemeentry/3822` endpoint will hard delete the V2 entry for the ED theme of the Bakemonogatari anime and return a confirmation message.
## URL
```sh
DELETE /api/forceDelete/animethemeentry/{id}
```
## Authentication
**Required Permission**: force delete anime theme entry
**Roles with Permission**: Admin
## Parameters
None
## Response
```json
{
message: "The AnimeThemeEntry 'Bakemonogatari ED V2' was deleted.",
}
```
<Example>
<CURL>
```bash
curl -X DELETE -H "Authorization: Bearer {token}" https://api.animethemes.moe/forceDelete/animethemeentry/3822
```
</CURL>
</Example>
</Block>
+3 -3
View File
@@ -1,12 +1,12 @@
---
title: AnimeThemeEntry Index
title: Anime Theme Entry Index
---
<Block>
# AnimeThemeEntry Index Endpoint
# Anime Theme Entry Index Endpoint
The AnimeThemeEntry index endpoint returns a listing of AnimeThemeEntry resources.
The anime theme entry index endpoint returns a listing of anime theme entry resources.
## URL
+4 -4
View File
@@ -1,14 +1,14 @@
---
title: AnimeThemeEntry Show
title: Anime Theme Entry Show
---
<Block>
# AnimeThemeEntry Show Endpoint
# Anime Theme Entry Show Endpoint
The AnimeThemeEntry show endpoint returns an AnimeThemeEntry resource.
The anime theme entry show endpoint returns an anime theme entry resource.
For example, the `/api/animethemeentry/3822` endpoint will return the second version of the Bakemonogatari ED AnimeTheme.
For example, the `/api/animethemeentry/3822` endpoint will return the V2 entry for the ED theme of the Bakemonogatari anime.
## URL
+64
View File
@@ -0,0 +1,64 @@
---
title: Anime Theme Entry Store
---
<Block>
# Anime Theme Entry Store Endpoint
The anime theme entry store endpoint creates a new anime theme entry and returns the new anime theme entry resource.
For example, the `/api/animethemeentry?theme_id=3378&version=2` endpoint will create a new V2 entry for the ED theme of the Bakemonogatari anime and return the new anime theme resource.
## URL
```sh
POST /api/animethemeentry
```
## Authentication
**Required Permission**: create anime theme entry
**Roles with Permission**: Wiki Editor, Admin
## Parameters
| Name | Required | Rules |
| :------: | :------: | :----------------------------- |
| theme_id | Yes | integer, Anime Theme ID exists |
| version | No | integer, min:0 |
| episodes | No | string, max:192 |
| nsfw | No | boolean |
| spoiler | No | boolean |
| notes | No | string, max:192 |
## Response
```json
{
animethemeentry: {
id: id,
version: version,
episodes: "episodes",
nsfw: nsfw,
spoiler: spoiler,
notes: "notes",
created_at: "created_at",
updated_at: "updated_at",
deleted_at: "deleted_at"
}
}
```
<Example>
<CURL>
```bash
curl -X POST -H "Authorization: Bearer {token}" https://api.animethemes.moe/animethemeentry/
```
</CURL>
</Example>
</Block>
+64
View File
@@ -0,0 +1,64 @@
---
title: Anime Theme Entry Update
---
<Block>
# Anime Theme Entry Update Endpoint
The anime theme entry update endpoint updates an anime theme entry and returns the updated anime theme entry resource.
For example, the `/api/animethemeentry/3822?episodes=11-14` endpoint will update the episodes attribute of the V2 entry for the ED theme of the Bakemonogatari anime and return the updated anime theme entry resource.
## URL
```sh
PUT|PATCH /api/animethemeentry/{id}
```
## Authentication
**Required Permission**: update anime theme entry
**Roles with Permission**: Wiki Editor, Admin
## Parameters
| Name | Required | Rules |
| :------: | :------: | :----------------------------- |
| theme_id | Yes | integer, Anime Theme ID exists |
| version | No | integer, min:0 |
| episodes | No | string, max:192 |
| nsfw | No | boolean |
| spoiler | No | boolean |
| notes | No | string, max:192 |
## Response
```json
{
animethemeentry: {
id: id,
version: version,
episodes: "episodes",
nsfw: nsfw,
spoiler: spoiler,
notes: "notes",
created_at: "created_at",
updated_at: "updated_at",
deleted_at: "deleted_at"
}
}
```
<Example>
<CURL>
```bash
curl -X PATCH -H "Authorization: Bearer {token}" https://api.animethemes.moe/animethemeentry/3822
```
</CURL>
</Example>
</Block>