From 124ad52ea0f8975a05f67ce95dbf738554571d6d Mon Sep 17 00:00:00 2001 From: paranarimasu <33796518+paranarimasu@users.noreply.github.com> Date: Thu, 26 May 2022 13:52:49 -0500 Subject: [PATCH] feat: adding series write endpoints (#22) --- docs/.vuepress/config.js | 20 +++++++++-- docs/series/README.md | 20 +++++++++-- docs/series/destroy/README.md | 54 +++++++++++++++++++++++++++++ docs/series/forceDelete/README.md | 47 +++++++++++++++++++++++++ docs/series/store/README.md | 57 +++++++++++++++++++++++++++++++ docs/series/update/README.md | 57 +++++++++++++++++++++++++++++++ 6 files changed, 251 insertions(+), 4 deletions(-) create mode 100644 docs/series/destroy/README.md create mode 100644 docs/series/forceDelete/README.md create mode 100644 docs/series/store/README.md create mode 100644 docs/series/update/README.md diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index 7198f67..7e67a5a 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -233,12 +233,28 @@ module.exports = { to: '/series', children: [ { - title: 'Show', - to: '/series/show/', + title: 'Destroy', + to: '/series/destroy/' + }, + { + title: 'Force Delete', + to: '/series/forceDelete/' }, { title: 'Index', to: '/series/index/' + }, + { + title: 'Show', + to: '/series/show/', + }, + { + title: 'Store', + to: '/series/store/', + }, + { + title: 'Update', + to: '/series/update/', } ] }, diff --git a/docs/series/README.md b/docs/series/README.md index 2ced7a7..4695903 100644 --- a/docs/series/README.md +++ b/docs/series/README.md @@ -27,10 +27,26 @@ For example, the Monogatari series is the collection of the Bakemonogatari anime ### Endpoints +**[Series Destroy](/series/destroy/)** + +The series destroy endpoint soft deletes a series and returns the deleted series resource. + +**[Series Force Delete](/series/forceDelete/)** + +The series force delete endpoint hard deletes a series and returns a confirmation message. + +**[Series Index](/series/index/)** + +The series index endpoint displays a listing of series resources. + **[Series Show](/series/show/)** The series show endpoint returns a series resource. -**[Series Index](/series/index/)** +**[Series Store](/series/store/)** -The series index endpoint displays a listing of series resources. \ No newline at end of file +The series store endpoint creates a new series and returns the new series resource. + +**[Series Update](/series/update/)** + +The series update endpoint updates a series and returns the updated series resource. \ No newline at end of file diff --git a/docs/series/destroy/README.md b/docs/series/destroy/README.md new file mode 100644 index 0000000..5793ba4 --- /dev/null +++ b/docs/series/destroy/README.md @@ -0,0 +1,54 @@ +--- +title: Series Destroy +--- + + + +# Series Destroy Endpoint + +The series destroy endpoint soft deletes a series and returns the deleted series resource. + +For example, the `/api/series/monogatari` endpoint will soft delete the Monogatari series and return the deleted Monogatari resource. + +## URL + +```sh +DELETE /api/series/{slug} +``` + +## Authentication + +**Required Permission**: delete series + +**Roles with Permission**: Wiki Editor, Admin + +## Parameters + +None + +## Response + +```json +{ + series: { + id: id, + name: "name", + slug: "slug", + created_at: "created_at", + updated_at: "updated_at", + deleted_at: "deleted_at" + } +} +``` + + + + +```bash +curl -X DELETE -H "Authorization: Bearer {token}" https://staging.animethemes.moe/api/series/monogatari +``` + + + + + \ No newline at end of file diff --git a/docs/series/forceDelete/README.md b/docs/series/forceDelete/README.md new file mode 100644 index 0000000..2932cfd --- /dev/null +++ b/docs/series/forceDelete/README.md @@ -0,0 +1,47 @@ +--- +title: Series Force Delete +--- + + + +# Series Force Delete Endpoint + +The series force delete endpoint hard deletes a series and returns a confirmation message. + +For example, the `/api/forceDelete/series/monogatari` endpoint will hard delete the Monogatari series and return a confirmation message. + +## URL + +```sh +DELETE /api/forceDelete/series/{slug} +``` + +## Authentication + +**Required Permission**: force delete series + +**Roles with Permission**: Admin + +## Parameters + +None + +## Response + +```json +{ + message: "The Series 'Monogatari' was deleted.", +} +``` + + + + +```bash +curl -X DELETE -H "Authorization: Bearer {token}" https://staging.animethemes.moe/api/forceDelete/series/monogatari +``` + + + + + \ No newline at end of file diff --git a/docs/series/store/README.md b/docs/series/store/README.md new file mode 100644 index 0000000..cc6782a --- /dev/null +++ b/docs/series/store/README.md @@ -0,0 +1,57 @@ +--- +title: Series Store +--- + + + +# Series Store Endpoint + +The series store endpoint creates a new series and returns the new series resource. + +For example, the `/api/series?name=Monogatari&slug=monogatari` endpoint will create a new Monogatari series and return the new Monogatari resource. + +## URL + +```sh +POST /api/series +``` + +## Authentication + +**Required Permission**: create series + +**Roles with Permission**: Wiki Editor, Admin + +## Parameters + +| Name | Required | Rules | +| :------: | :------: | :---------------------------------- | +| name | Yes | string, max:192 | +| slug | Yes | string, max:192, alpha_dash, unique | + +## Response + +```json +{ + series: { + id: id, + name: "name", + slug: "slug", + created_at: "created_at", + updated_at: "updated_at", + deleted_at: "deleted_at" + } +} +``` + + + + +```bash +curl -X POST -H "Authorization: Bearer {token}" https://staging.animethemes.moe/api/series/ +``` + + + + + \ No newline at end of file diff --git a/docs/series/update/README.md b/docs/series/update/README.md new file mode 100644 index 0000000..311beaf --- /dev/null +++ b/docs/series/update/README.md @@ -0,0 +1,57 @@ +--- +title: Series Update +--- + + + +# Series Update Endpoint + +The series update endpoint updates a series and returns the updated series resource. + +For example, the `/api/series/monogatari?name=Monogatari` endpoint will update the Monogatari series name attribute and return the updated Monogatari resource. + +## URL + +```sh +PUT|PATCH /api/series/{slug} +``` + +## Authentication + +**Required Permission**: update series + +**Roles with Permission**: Wiki Editor, Admin + +## Parameters + +| Name | Required | Rules | +| :------: | :------: | :---------------------------------- | +| name | Yes | string, max:192 | +| slug | Yes | string, max:192, alpha_dash, unique | + +## Response + +```json +{ + series: { + id: id, + name: "name", + slug: "slug", + created_at: "created_at", + updated_at: "updated_at", + deleted_at: "deleted_at" + } +} +``` + + + + +```bash +curl -X PATCH -H "Authorization: Bearer {token}" https://staging.animethemes.moe/api/series/monogatari +``` + + + + + \ No newline at end of file