From dc1b6a09e6b72bb8aa026ee3a09da70664c5056f Mon Sep 17 00:00:00 2001 From: paranarimasu <33796518+paranarimasu@users.noreply.github.com> Date: Sat, 11 Jun 2022 23:59:34 -0500 Subject: [PATCH] feat: adding synonym write endpoints (#33) --- docs/.vuepress/config.js | 20 ++++++++- docs/animesynonym/README.md | 24 +++++++++-- docs/animesynonym/destroy/README.md | 53 +++++++++++++++++++++++ docs/animesynonym/forceDelete/README.md | 47 +++++++++++++++++++++ docs/animesynonym/index/README.md | 6 +-- docs/animesynonym/show/README.md | 8 ++-- docs/animesynonym/store/README.md | 56 +++++++++++++++++++++++++ docs/animesynonym/update/README.md | 56 +++++++++++++++++++++++++ 8 files changed, 257 insertions(+), 13 deletions(-) create mode 100644 docs/animesynonym/destroy/README.md create mode 100644 docs/animesynonym/forceDelete/README.md create mode 100644 docs/animesynonym/store/README.md create mode 100644 docs/animesynonym/update/README.md diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index bfd04dc..c50eadc 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -71,12 +71,28 @@ module.exports = { to: '/animesynonym', children: [ { - title: 'Show', - to: '/animesynonym/show/', + title: 'Destroy', + to: '/animesynonym/destroy/' + }, + { + title: 'Force Delete', + to: '/animesynonym/forceDelete/' }, { title: 'Index', to: '/animesynonym/index/' + }, + { + title: 'Show', + to: '/animesynonym/show/', + }, + { + title: 'Store', + to: '/animesynonym/store/', + }, + { + title: 'Update', + to: '/animesynonym/update/', } ] }, diff --git a/docs/animesynonym/README.md b/docs/animesynonym/README.md index b6264db..eca5dd8 100644 --- a/docs/animesynonym/README.md +++ b/docs/animesynonym/README.md @@ -26,10 +26,26 @@ For example, the anime Bakemonogatari has the AnimeSynonym "Monstory". ### Endpoints -**[AnimeSynonym Show](/animesynonym/show/)** +**[Anime Synonym Destroy](/animesynonym/destroy/)** -The AnimeSynonym show endpoint returns an AnimeSynonym resource. +The anime synonym destroy endpoint soft deletes an anime synonym and returns the deleted anime synonym resource. -**[AnimeSynonym Index](/animesynonym/index/)** +**[Anime Synonym Force Delete](/animesynonym/forceDelete/)** -The AnimeSynonym index endpoint displays a listing of AnimeSynonym resources. \ No newline at end of file +The anime synonym force delete endpoint hard deletes an anime synonym and returns a confirmation message. + +**[Anime Synonym Index](/animesynonym/index/)** + +The anime synonym index endpoint displays a listing of anime synonym resources. + +**[Anime Synonym Show](/animesynonym/show/)** + +The anime synonym show endpoint returns an anime synonym resource. + +**[Anime Synonym Store](/animesynonym/store/)** + +The anime synonym store endpoint creates a new anime synonym and returns the new anime synonym resource. + +**[Anime Synonym Update](/animesynonym/update/)** + +The anime synonym update endpoint updates an anime synonym and returns the updated anime synonym resource. \ No newline at end of file diff --git a/docs/animesynonym/destroy/README.md b/docs/animesynonym/destroy/README.md new file mode 100644 index 0000000..9a1469f --- /dev/null +++ b/docs/animesynonym/destroy/README.md @@ -0,0 +1,53 @@ +--- +title: Anime Synonym Destroy +--- + + + +# Anime Synonym Destroy Endpoint + +The anime synonym destroy endpoint soft deletes an anime synonym and returns the deleted anime synonym resource. + +For example, the `/api/animesynonym/1523` endpoint will soft delete the Monstory synonym for the Bakemonogatari anime and return the deleted anime synonym resource. + +## URL + +```sh +DELETE /api/animesynonym/{id} +``` + +## Authentication + +**Required Permission**: delete anime synonym + +**Roles with Permission**: Wiki Editor, Admin + +## Parameters + +None + +## Response + +```json +{ + animesynonym: { + id: id, + text: "text", + created_at: "created_at", + updated_at: "updated_at", + deleted_at: "deleted_at" + } +} +``` + + + + +```bash +curl -X DELETE -H "Authorization: Bearer {token}" https://api.animethemes.moe/animesynonym/1523 +``` + + + + + \ No newline at end of file diff --git a/docs/animesynonym/forceDelete/README.md b/docs/animesynonym/forceDelete/README.md new file mode 100644 index 0000000..bffbb60 --- /dev/null +++ b/docs/animesynonym/forceDelete/README.md @@ -0,0 +1,47 @@ +--- +title: Anime Synonym Force Delete +--- + + + +# Anime Synonym Force Delete Endpoint + +The anime synonym force delete endpoint hard deletes an anime synonym and returns a confirmation message. + +For example, the `/api/forceDelete/animesynonym/1523` endpoint will hard delete the Monstory synonym for the Bakemonogatari anime and return a confirmation message. + +## URL + +```sh +DELETE /api/forceDelete/animesynonym/{id} +``` + +## Authentication + +**Required Permission**: force delete anime synonym + +**Roles with Permission**: Admin + +## Parameters + +None + +## Response + +```json +{ + message: "The AnimeSynonym 'Monstory' was deleted.", +} +``` + + + + +```bash +curl -X DELETE -H "Authorization: Bearer {token}" https://api.animethemes.moe/forceDelete/animesynonym/1523 +``` + + + + + \ No newline at end of file diff --git a/docs/animesynonym/index/README.md b/docs/animesynonym/index/README.md index 82748ee..7985e5e 100644 --- a/docs/animesynonym/index/README.md +++ b/docs/animesynonym/index/README.md @@ -1,12 +1,12 @@ --- -title: AnimeSynonym Index +title: Anime Synonym Index --- -# AnimeSynonym Index Endpoint +# Anime Synonym Index Endpoint -The AnimeSynonym index endpoint returns a listing of AnimeSynonym resources. +The anime synonym index endpoint returns a listing of anime synonym resources. ## URL diff --git a/docs/animesynonym/show/README.md b/docs/animesynonym/show/README.md index 8ebeb3b..e6bff94 100644 --- a/docs/animesynonym/show/README.md +++ b/docs/animesynonym/show/README.md @@ -1,14 +1,14 @@ --- -title: AnimeSynonym Show +title: Anime Synonym Show --- -# AnimeSynonym Show Endpoint +# Anime Synonym Show Endpoint -The AnimeSynonym show endpoint returns an AnimeSynonym resource. +The anime synonym show endpoint returns an anime synonym resource. -For example, the `/api/animesynonym/1523` endpoint will return the AnimeSynonym resource "Monstory" for the anime Bakemonogatari. +For example, the `/api/animesynonym/1523` endpoint will return the Monstory synonym for the anime Bakemonogatari. ## URL diff --git a/docs/animesynonym/store/README.md b/docs/animesynonym/store/README.md new file mode 100644 index 0000000..8606bec --- /dev/null +++ b/docs/animesynonym/store/README.md @@ -0,0 +1,56 @@ +--- +title: Anime Synonym Store +--- + + + +# Anime Synonym Store Endpoint + +The anime synonym store endpoint creates a new anime synonym and returns the new anime synonym resource. + +For example, the `/api/animesynonym?anime_id=218&text=Monstory` endpoint will create a new Monstory synonym for the Bakemonogatari anime and return the new anime synonym resource. + +## URL + +```sh +POST /api/animesynonym +``` + +## Authentication + +**Required Permission**: create anime synonym + +**Roles with Permission**: Wiki Editor, Admin + +## Parameters + +| Name | Required | Rules | +| :------: | :------: | :----------------------- | +| anime_id | Yes | integer, Anime ID exists | +| text | Yes | string, max:192 | + +## Response + +```json +{ + animesynonym: { + id: id, + text: "text", + created_at: "created_at", + updated_at: "updated_at", + deleted_at: "deleted_at" + } +} +``` + + + + +```bash +curl -X POST -H "Authorization: Bearer {token}" https://api.animethemes.moe/animesynonym/ +``` + + + + + \ No newline at end of file diff --git a/docs/animesynonym/update/README.md b/docs/animesynonym/update/README.md new file mode 100644 index 0000000..be65cae --- /dev/null +++ b/docs/animesynonym/update/README.md @@ -0,0 +1,56 @@ +--- +title: Anime Synonym Update +--- + + + +# Anime Synonym Update Endpoint + +The anime synonym update endpoint updates an anime synonym and returns the updated anime synonym resource. + +For example, the `/api/animesynonym/1523?text=Monstory` endpoint will update the Monstory anime synonym text attribute and return the updated anime synonym resource. + +## URL + +```sh +PUT|PATCH /api/animesynonym/{id} +``` + +## Authentication + +**Required Permission**: update anime synonym + +**Roles with Permission**: Wiki Editor, Admin + +## Parameters + +| Name | Required | Rules | +| :------: | :------: | :----------------------- | +| anime_id | No | integer, Anime ID exists | +| text | No | string, max:192 | + +## Response + +```json +{ + animesynonym: { + id: id, + text: "text", + created_at: "created_at", + updated_at: "updated_at", + deleted_at: "deleted_at" + } +} +``` + + + + +```bash +curl -X PATCH -H "Authorization: Bearer {token}" https://api.animethemes.moe/animesynonym/1523 +``` + + + + + \ No newline at end of file