From eb77fbd89a23007ffe4fff87914a904d25fae97f Mon Sep 17 00:00:00 2001 From: paranarimasu <33796518+paranarimasu@users.noreply.github.com> Date: Sun, 12 Jun 2022 19:14:32 -0500 Subject: [PATCH] feat: adding entry write endpoints (#35) --- docs/.vuepress/config.js | 20 ++++++- docs/animethemeentry/README.md | 32 ++++++++--- docs/animethemeentry/destroy/README.md | 57 +++++++++++++++++++ docs/animethemeentry/forceDelete/README.md | 47 ++++++++++++++++ docs/animethemeentry/index/README.md | 6 +- docs/animethemeentry/show/README.md | 8 +-- docs/animethemeentry/store/README.md | 64 ++++++++++++++++++++++ docs/animethemeentry/update/README.md | 64 ++++++++++++++++++++++ 8 files changed, 281 insertions(+), 17 deletions(-) create mode 100644 docs/animethemeentry/destroy/README.md create mode 100644 docs/animethemeentry/forceDelete/README.md create mode 100644 docs/animethemeentry/store/README.md create mode 100644 docs/animethemeentry/update/README.md diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index 0edf0a5..18f899a 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -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/', } ] }, diff --git a/docs/animethemeentry/README.md b/docs/animethemeentry/README.md index 60cc535..f55c069 100644 --- a/docs/animethemeentry/README.md +++ b/docs/animethemeentry/README.md @@ -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. \ No newline at end of file +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. \ No newline at end of file diff --git a/docs/animethemeentry/destroy/README.md b/docs/animethemeentry/destroy/README.md new file mode 100644 index 0000000..008e8eb --- /dev/null +++ b/docs/animethemeentry/destroy/README.md @@ -0,0 +1,57 @@ +--- +title: Anime Theme Entry Destroy +--- + + + +# 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" + } +} +``` + + + + +```bash +curl -X DELETE -H "Authorization: Bearer {token}" https://api.animethemes.moe/animethemeentry/3822 +``` + + + + + \ No newline at end of file diff --git a/docs/animethemeentry/forceDelete/README.md b/docs/animethemeentry/forceDelete/README.md new file mode 100644 index 0000000..503a174 --- /dev/null +++ b/docs/animethemeentry/forceDelete/README.md @@ -0,0 +1,47 @@ +--- +title: Anime Theme Entry Force Delete +--- + + + +# 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.", +} +``` + + + + +```bash +curl -X DELETE -H "Authorization: Bearer {token}" https://api.animethemes.moe/forceDelete/animethemeentry/3822 +``` + + + + + \ No newline at end of file diff --git a/docs/animethemeentry/index/README.md b/docs/animethemeentry/index/README.md index 36d0c7a..fb9e670 100644 --- a/docs/animethemeentry/index/README.md +++ b/docs/animethemeentry/index/README.md @@ -1,12 +1,12 @@ --- -title: AnimeThemeEntry Index +title: Anime Theme Entry Index --- -# 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 diff --git a/docs/animethemeentry/show/README.md b/docs/animethemeentry/show/README.md index de70fc4..ed34948 100644 --- a/docs/animethemeentry/show/README.md +++ b/docs/animethemeentry/show/README.md @@ -1,14 +1,14 @@ --- -title: AnimeThemeEntry Show +title: Anime Theme Entry Show --- -# 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 diff --git a/docs/animethemeentry/store/README.md b/docs/animethemeentry/store/README.md new file mode 100644 index 0000000..a0c8a58 --- /dev/null +++ b/docs/animethemeentry/store/README.md @@ -0,0 +1,64 @@ +--- +title: Anime Theme Entry Store +--- + + + +# 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" + } +} +``` + + + + +```bash +curl -X POST -H "Authorization: Bearer {token}" https://api.animethemes.moe/animethemeentry/ +``` + + + + + \ No newline at end of file diff --git a/docs/animethemeentry/update/README.md b/docs/animethemeentry/update/README.md new file mode 100644 index 0000000..28c9744 --- /dev/null +++ b/docs/animethemeentry/update/README.md @@ -0,0 +1,64 @@ +--- +title: Anime Theme Entry Update +--- + + + +# 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" + } +} +``` + + + + +```bash +curl -X PATCH -H "Authorization: Bearer {token}" https://api.animethemes.moe/animethemeentry/3822 +``` + + + + + \ No newline at end of file