From 71f5d84523ad7a0ee515459ebb009e95d75a1d3d Mon Sep 17 00:00:00 2001 From: paranarimasu <33796518+paranarimasu@users.noreply.github.com> Date: Wed, 25 May 2022 19:54:48 -0500 Subject: [PATCH] feat: adding artist write endpoints (#21) --- docs/.vuepress/config.js | 20 +++++++++-- docs/anime/README.md | 2 +- docs/artist/README.md | 20 +++++++++-- docs/artist/destroy/README.md | 54 +++++++++++++++++++++++++++++ docs/artist/forceDelete/README.md | 47 +++++++++++++++++++++++++ docs/artist/store/README.md | 57 +++++++++++++++++++++++++++++++ docs/artist/update/README.md | 57 +++++++++++++++++++++++++++++++ 7 files changed, 252 insertions(+), 5 deletions(-) create mode 100644 docs/artist/destroy/README.md create mode 100644 docs/artist/forceDelete/README.md create mode 100644 docs/artist/store/README.md create mode 100644 docs/artist/update/README.md diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index ccc48ce..7198f67 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -127,12 +127,28 @@ module.exports = { to: '/artist', children: [ { - title: 'Show', - to: '/artist/show/', + title: 'Destroy', + to: '/artist/destroy/' + }, + { + title: 'Force Delete', + to: '/artist/forceDelete/' }, { title: 'Index', to: '/artist/index/' + }, + { + title: 'Show', + to: '/artist/show/', + }, + { + title: 'Store', + to: '/artist/store/', + }, + { + title: 'Update', + to: '/artist/update/', } ] }, diff --git a/docs/anime/README.md b/docs/anime/README.md index b5a32bb..d978a66 100644 --- a/docs/anime/README.md +++ b/docs/anime/README.md @@ -57,7 +57,7 @@ The anime show endpoint returns an anime resource. **[Anime Store](/anime/store/)** -The anime store endpoints create a new anime and returns the new anime resource. +The anime store endpoint creates a new anime and returns the new anime resource. **[Anime Update](/anime/update/)** diff --git a/docs/artist/README.md b/docs/artist/README.md index 1e5a840..de3bcd9 100644 --- a/docs/artist/README.md +++ b/docs/artist/README.md @@ -34,10 +34,26 @@ For example, Chiwa Saito is the musical performer of the Bakemonogatari OP1 them ### Endpoints +**[Artist Destroy](/artist/destroy/)** + +The artist destroy endpoint soft deletes an artist and returns the deleted artist resource. + +**[Artist Force Delete](/artist/forceDelete/)** + +The artist force delete endpoint hard deletes an artist and returns a confirmation message. + +**[Artist Index](/artist/index/)** + +The artist index endpoint displays a listing of artist resources. + **[Artist Show](/artist/show/)** The artist show endpoint returns an artist resource. -**[Artist Index](/artist/index/)** +**[Artist Store](/artist/store/)** -The artist index endpoint displays a listing of artist resources. \ No newline at end of file +The artist store endpoint creates a new artist and returns the new artist resource. + +**[Artist Update](/artist/update/)** + +The artist update endpoint updates an artist and returns the updated artist resource. \ No newline at end of file diff --git a/docs/artist/destroy/README.md b/docs/artist/destroy/README.md new file mode 100644 index 0000000..ae54585 --- /dev/null +++ b/docs/artist/destroy/README.md @@ -0,0 +1,54 @@ +--- +title: Artist Destroy +--- + + + +# Artist Destroy Endpoint + +The artist destroy endpoint soft deletes an artist and returns the deleted artist resource. + +For example, the `/api/artist/chiwa_saito` endpoint will soft delete the Chiwa Saito artist and return the deleted Chiwa Saito resource. + +## URL + +```sh +DELETE /api/artist/{slug} +``` + +## Authentication + +**Required Permission**: delete artist + +**Roles with Permission**: Wiki Editor, Admin + +## Parameters + +None + +## Response + +```json +{ + artist: { + 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/artist/chiwa_saito +``` + + + + + \ No newline at end of file diff --git a/docs/artist/forceDelete/README.md b/docs/artist/forceDelete/README.md new file mode 100644 index 0000000..37a81dd --- /dev/null +++ b/docs/artist/forceDelete/README.md @@ -0,0 +1,47 @@ +--- +title: Artist Force Delete +--- + + + +# Artist Force Delete Endpoint + +The artist force delete endpoint hard deletes an artist and returns a confirmation message. + +For example, the `/api/forceDelete/artist/chiwa_saito` endpoint will hard delete the Chiwa Saito artist and return a confirmation message. + +## URL + +```sh +DELETE /api/forceDelete/artist/{slug} +``` + +## Authentication + +**Required Permission**: force delete artist + +**Roles with Permission**: Admin + +## Parameters + +None + +## Response + +```json +{ + message: "The Artist 'Chiwa Saito' was deleted.", +} +``` + + + + +```bash +curl -X DELETE -H "Authorization: Bearer {token}" https://staging.animethemes.moe/api/forceDelete/artist/chiwa_saito +``` + + + + + \ No newline at end of file diff --git a/docs/artist/store/README.md b/docs/artist/store/README.md new file mode 100644 index 0000000..595cbc6 --- /dev/null +++ b/docs/artist/store/README.md @@ -0,0 +1,57 @@ +--- +title: Artist Store +--- + + + +# Artist Store Endpoint + +The artist store endpoint creates a new artist and returns the new artist resource. + +For example, the `/api/artist?name=Chiwa+Saito&slug=chiwa_saito` endpoint will create a new Chiwa Saito artist and return the new Chiwa Saito resource. + +## URL + +```sh +POST /api/artist +``` + +## Authentication + +**Required Permission**: create artist + +**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 +{ + artist: { + 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/artist/ +``` + + + + + \ No newline at end of file diff --git a/docs/artist/update/README.md b/docs/artist/update/README.md new file mode 100644 index 0000000..52ab65c --- /dev/null +++ b/docs/artist/update/README.md @@ -0,0 +1,57 @@ +--- +title: Artist Update +--- + + + +# Artist Update Endpoint + +The artist update endpoint updates an artist and returns the updated artist resource. + +For example, the `/api/artist/chiwa_saito?name=Chiwa+Saito` endpoint will update the Chiwa Saito artist name attribute and return the updated Chiwa Saito resource. + +## URL + +```sh +PUT|PATCH /api/artist/{slug} +``` + +## Authentication + +**Required Permission**: update artist + +**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 +{ + artist: { + 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/artist/chiwa_saito +``` + + + + + \ No newline at end of file