feat: adding page write endpoints (#31)

This commit is contained in:
paranarimasu authored and GitHub committed 2022-06-11 19:16:56 -05:00
1 parent 16aefdf447
commit d065c603bc
8 files changed
+261 -6

No files matched your search

+18 -2
View File
@@ -237,12 +237,28 @@ module.exports = {
to: '/page',
children: [
{
title: 'Show',
to: '/page/show/',
title: 'Destroy',
to: '/page/destroy/'
},
{
title: 'Force Delete',
to: '/page/forceDelete/'
},
{
title: 'Index',
to: '/page/index/'
},
{
title: 'Show',
to: '/page/show/',
},
{
title: 'Store',
to: '/page/store/',
},
{
title: 'Update',
to: '/page/update/',
}
]
},
+1 -1
View File
@@ -8,7 +8,7 @@ title: Announcement Store
The announcement store endpoint creates a new announcement and returns the new announcement resource.
For example, the `/api/announcement?content=The+Release+Has+Been+Deployed!` endpoint will create a new announcement and return the new announcement resource.
For example, the `/api/announcement?content=Lorem+Ipsum` endpoint will create a new announcement and return the new announcement resource.
## URL
+18 -2
View File
@@ -28,10 +28,26 @@ None
### Endpoints
**[Page Destroy](/page/destroy/)**
The page destroy endpoint soft deletes a page and returns the deleted page resource.
**[Page Force Delete](/page/forceDelete/)**
The page force delete endpoint hard deletes a page and returns a confirmation message.
**[Page Index](/page/index/)**
The page index endpoint displays a listing of page resources.
**[Page Show](/page/show/)**
The page show endpoint returns a page resource.
**[Page Index](/page/index/)**
**[Page Store](/page/store/)**
The page index endpoint displays a listing of page resources.
The page store endpoint creates a new page and returns the new page resource.
**[Page Update](/page/update/)**
The page update endpoint updates a page and returns the updated page resource.
+55
View File
@@ -0,0 +1,55 @@
---
title: Page Destroy
---
<Block>
# Page Destroy Endpoint
The page destroy endpoint soft deletes a page and returns the deleted page resource.
For example, the `/api/page/encoding` endpoint will soft delete the Encoding page and return the deleted Encoding resource.
## URL
```sh
DELETE /api/page/{slug}
```
## Authentication
**Required Permission**: delete page
**Roles with Permission**: Wiki Editor, Admin
## Parameters
None
## Response
```json
{
page: {
id: id,
name: "name",
slug: "slug",
body: "body",
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/page/encoding
```
</CURL>
</Example>
</Block>
+47
View File
@@ -0,0 +1,47 @@
---
title: Page Force Delete
---
<Block>
# Page Force Delete Endpoint
The page force delete endpoint hard deletes a page and returns a confirmation message.
For example, the `/api/forceDelete/page/encoding` endpoint will hard delete the Encoding page and return a confirmation message.
## URL
```sh
DELETE /api/forceDelete/page/{slug}
```
## Authentication
**Required Permission**: force delete page
**Roles with Permission**: Admin
## Parameters
None
## Response
```json
{
message: "The Page 'Encoding' was deleted.",
}
```
<Example>
<CURL>
```bash
curl -X DELETE -H "Authorization: Bearer {token}" https://api.animethemes.moe/forceDelete/page/encoding
```
</CURL>
</Example>
</Block>
+4 -1
View File
@@ -8,6 +8,8 @@ title: Page Show
The page show endpoint returns a page resource.
For example, the `/api/page/encoding` endpoint will return the Encoding page resource.
## URL
```sh
@@ -32,6 +34,7 @@ None
id: id,
name: "name",
slug: "slug",
body: "body",
created_at: "created_at",
updated_at: "updated_at",
deleted_at: "deleted_at"
@@ -43,7 +46,7 @@ None
<CURL>
```bash
curl https://api.animethemes.moe/page/encoding/audio_normalization
curl https://api.animethemes.moe/page/encoding
```
</CURL>
+59
View File
@@ -0,0 +1,59 @@
---
title: Page Store
---
<Block>
# Page Store Endpoint
The page store endpoint creates a new page and returns the new page resource.
For example, the `/api/page?name=Encoding&slug=encoding&body=Lorem+Ipsum` endpoint will create a new Encoding page and return the new Encoding resource.
## URL
```sh
POST /api/page
```
## Authentication
**Required Permission**: create page
**Roles with Permission**: Wiki Editor, Admin
## Parameters
| Name | Required | Rules |
| :------: | :------: | :--------------------------------------------------- |
| name | Yes | string, max:192 |
| slug | Yes | string, max:192, regex:/^[\pL\pM\pN\/_-]+$/u, unique |
| body | Yes | string, max:16777215 |
## Response
```json
{
page: {
id: id,
name: "name",
slug: "slug",
body: "body",
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/page/
```
</CURL>
</Example>
</Block>
+59
View File
@@ -0,0 +1,59 @@
---
title: Page Update
---
<Block>
# Page Update Endpoint
The page update endpoint updates a page and returns the updated page resource.
For example, the `/api/page/encoding?body=Lorem+Ipsum` endpoint will update the Encoding page body attribute and return the updated Encoding resource.
## URL
```sh
PUT|PATCH /api/page/{slug}
```
## Authentication
**Required Permission**: update page
**Roles with Permission**: Wiki Editor, Admin
## Parameters
| Name | Required | Rules |
| :------: | :------: | :--------------------------------------------------- |
| name | No | string, max:192 |
| slug | No | string, max:192, regex:/^[\pL\pM\pN\/_-]+$/u, unique |
| body | No | string, max:16777215 |
## Response
```json
{
page: {
id: id,
name: "name",
slug: "slug",
body: "body",
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/page/encoding
```
</CURL>
</Example>
</Block>