docs(api): designed account (de)activation

This commit is contained in:
antifallobst 2023-08-18 23:49:41 +02:00
parent f6fc479f5b
commit e8e25883e4
Signed by: antifallobst
GPG Key ID: 2B4F402172791BAF
14 changed files with 170 additions and 54 deletions

View File

@ -13,7 +13,7 @@ The token for this can be aquired using the `/account/authenticate` endpoint.
- [X] `/tokens` - [X] `/tokens`
- [ ] `/follows` - [ ] `/follows`
- [ ] `/followers` - [ ] `/followers`
- `/user/{username}` - `/user/`
- [ ] `/info` - [ ] `/info`
- [ ] `/follow` - [ ] `/follow`
- [ ] `/follows` - [ ] `/follows`
@ -21,14 +21,12 @@ The token for this can be aquired using the `/account/authenticate` endpoint.
- [ ] `/projects` - [ ] `/projects`
- `/project` - `/project`
- [ ] `/create` - [ ] `/create`
- `/{projectname}` - [ ] `/info`
- [ ] `/info` - [ ] `/join`
- [ ] `/join`
## TODO ## TODO
- Password checking on registration - Password checking on registration
- usage examples - usage examples
- anonymized account deletion reason - anonymized account deletion reason
- account deactivation
- account bound rate limit - account bound rate limit
- id support for user and project specific calls - return role in /user/projects

17
docs/account/activate.md Normal file
View File

@ -0,0 +1,17 @@
# `/account/activate` - POST
Activates the account if it was deactivated.
## HTTP Headers
| Header | Content |
|---------------|--------------------|
| Authorization | `Bearer {token}` |
## Responses
### 200 - Success
The account was activated.
### 208 - Already Reported
The account is already activated.
### 401 - Error: Unauthorized
The provided auth token doesn't allow you to perform this operation.
### 403 - Error: Forbidden
Blocked for security reasons.

View File

@ -1,5 +1,7 @@
# `/user/{username}/follow` - POST # `/account/deactivate` - POST
Let the authenticated account follow the user. Deactivates the account.
By that the account isn't existing in the public,
until you reactivate it.
## HTTP Headers ## HTTP Headers
| Header | Content | | Header | Content |
@ -8,12 +10,10 @@ Let the authenticated account follow the user.
## Responses ## Responses
### 200 - Success ### 200 - Success
Successfully followed the user. The account was deactivated.
### 208 - Already Reported ### 208 - Already Reported
You already follow the user. The account is already deactivated.
### 401 - Error: Unauthorized ### 401 - Error: Unauthorized
The provided auth token doesn't allow you to perform this operation. The provided auth token doesn't allow you to perform this operation.
### 403 - Error: Forbidden ### 403 - Error: Forbidden
Blocked for security reasons. Blocked for security reasons.
### 404 - Error: Not Found
The user wasn't found.

View File

@ -19,6 +19,8 @@ __Content - JSON:__
| Field | Description | | Field | Description |
|-------|---------------------------------| |-------|---------------------------------|
| id | The created projects unique id. | | id | The created projects unique id. |
### 400 - Error: Bad Request
The request was malformed.
### 403 - Error: Forbidden ### 403 - Error: Forbidden
Blocked for security reasons. Blocked for security reasons.
### 409 - Error: Conflict ### 409 - Error: Conflict

View File

@ -1,6 +1,14 @@
# `/project/{projectname}/info` - GET # `/project/info` - GET
Returns the list of public projects the user is part of. Returns the list of public projects the user is part of.
## Urlencoded Parameters
You have to set one parameter.
Setting none or two parameters will result in a _400 Bad Request_ Response.
| Parameter | Description |
|-----------|-----------------------------------------------------------------------|
| name | The projectname of the user on which the operation will be performed. |
| id | The projectid of the user on which the operation will be performed. |
## Responses ## Responses
### 200 - Success ### 200 - Success
__Content - JSON:__ __Content - JSON:__
@ -11,6 +19,8 @@ __Content - JSON:__
| description | The projects description. | | description | The projects description. |
| created | The datetime when the project was created. Represented as UNIX timestamp. | | created | The datetime when the project was created. Represented as UNIX timestamp. |
| members | A list of (username, userid) pairs. | | members | A list of (username, userid) pairs. |
### 400 - Error: Bad Request
The request was malformed.
### 403 - Error: Forbidden ### 403 - Error: Forbidden
Blocked for security reasons. Blocked for security reasons.
### 404 - Error: Not Found ### 404 - Error: Not Found

View File

@ -1,6 +1,14 @@
# `/project/{projectname}/join` - POST # `/project/join` - POST
Lets the authenticated account join the project. Lets the authenticated account join the project.
## Urlencoded Parameters
You have to set one parameter.
Setting none or two parameters will result in a _400 Bad Request_ Response.
| Parameter | Description |
|-----------|-----------------------------------------------------------------------|
| name | The projectname of the user on which the operation will be performed. |
| id | The projectid of the user on which the operation will be performed. |
## HTTP Headers ## HTTP Headers
| Header | Content | | Header | Content |
|---------------|--------------------| |---------------|--------------------|
@ -17,6 +25,8 @@ Lets the authenticated account join the project.
Your request will be reviewed. Your request will be reviewed.
### 208 - Already Reported ### 208 - Already Reported
You already joined the project. You already joined the project.
### 400 - Error: Bad Request
The request was malformed.
### 403 - Error: Forbidden ### 403 - Error: Forbidden
Blocked for security reasons. Blocked for security reasons.
### 404 - Error: Not Found ### 404 - Error: Not Found

31
docs/user/follow.md Normal file
View File

@ -0,0 +1,31 @@
# `/user/follow` - POST
Let the authenticated account follow the user.
## Urlencoded Parameters
You have to set one parameter.
Setting none or two parameters will result in a _400 Bad Request_ Response.
| Parameter | Description |
|-----------|--------------------------------------------------------------------|
| name | The username of the user on which the operation will be performed. |
| id | The userid of the user on which the operation will be performed. |
## HTTP Headers
| Header | Content |
|---------------|--------------------|
| Authorization | `Bearer {token}` |
## Responses
### 200 - Success
Successfully followed the user.
### 208 - Already Reported
You already follow the user.
### 400 - Error: Bad Request
The request was malformed.
### 401 - Error: Unauthorized
The provided auth token doesn't allow you to perform this operation.
### 403 - Error: Forbidden
Blocked for security reasons.
### 404 - Error: Not Found
The user wasn't found.

25
docs/user/followers.md Normal file
View File

@ -0,0 +1,25 @@
# `/user/followers` - GET
Returns the list of accounts following the user.
## Urlencoded Parameters
You have to set one parameter.
Setting none or two parameters will result in a _400 Bad Request_ Response.
| Parameter | Description |
|-----------|--------------------------------------------------------------------|
| name | The username of the user on which the operation will be performed. |
| id | The userid of the user on which the operation will be performed. |
## Responses
### 200 - Success
__Content - JSON:__
| Field | Description |
|----------|-------------------------------------|
| accounts | A list of (username, userid) pairs. |
### 400 - Error: Bad Request
The request was malformed.
### 403 - Error: Forbidden
Blocked for security reasons.
### 404 - Error: Not Found
The user wasn't found.

25
docs/user/follows.md Normal file
View File

@ -0,0 +1,25 @@
# `/user/follows` - GET
Returns the list of accounts the user is following.
## Urlencoded Parameters
You have to set one parameter.
Setting none or two parameters will result in a _400 Bad Request_ Response.
| Parameter | Description |
|-----------|--------------------------------------------------------------------|
| name | The username of the user on which the operation will be performed. |
| id | The userid of the user on which the operation will be performed. |
## Responses
### 200 - Success
__Content - JSON:__
| Field | Description |
|----------|-------------------------------------|
| accounts | A list of (username, userid) pairs. |
### 400 - Error: Bad Request
The request was malformed.
### 403 - Error: Forbidden
Blocked for security reasons.
### 404 - Error: Not Found
The user wasn't found.

View File

@ -1,6 +1,16 @@
# `/user/{username}/info` - GET # `/user/info` - GET
Returns information about the project. Returns information about the project.
## Urlencoded Parameters
You have to set one parameter.
Setting none or two parameters will result in a _400 Bad Request_ Response.
| Parameter | Description |
|-----------|--------------------------------------------------------------------|
| name | The username of the user on which the operation will be performed. |
| id | The userid of the user on which the operation will be performed. |
## Responses ## Responses
### 200 - Success ### 200 - Success
__Content - JSON:__ __Content - JSON:__
@ -10,6 +20,8 @@ __Content - JSON:__
| name | The users unique username. | | name | The users unique username. |
| joined | The datetime when the user joined. Represented as UNIX timestamp. | | joined | The datetime when the user joined. Represented as UNIX timestamp. |
| is_admin | A boolean if the user is an admin. | | is_admin | A boolean if the user is an admin. |
### 400 - Error: Bad Request
The request was malformed.
### 403 - Error: Forbidden ### 403 - Error: Forbidden
Blocked for security reasons. Blocked for security reasons.
### 404 - Error: Not Found ### 404 - Error: Not Found

25
docs/user/projects.md Normal file
View File

@ -0,0 +1,25 @@
# `/user/projects` - GET
Returns the list of public projects the user is part of.
## Urlencoded Parameters
You have to set one parameter.
Setting none or two parameters will result in a _400 Bad Request_ Response.
| Parameter | Description |
|-----------|--------------------------------------------------------------------|
| name | The username of the user on which the operation will be performed. |
| id | The userid of the user on which the operation will be performed. |
## Responses
### 200 - Success
__Content - JSON:__
| Field | Description |
|----------|-------------------------------------------|
| projects | A list of (projectname, projectid) pairs. |
### 400 - Error: Bad Request
The request was malformed.
### 403 - Error: Forbidden
Blocked for security reasons.
### 404 - Error: Not Found
The user wasn't found.

View File

@ -1,13 +0,0 @@
# `/user/{username}/followers` - GET
Returns the list of accounts following the user.
## Responses
### 200 - Success
__Content - JSON:__
| Field | Description |
|----------|-------------------------------------|
| accounts | A list of (username, userid) pairs. |
### 403 - Error: Forbidden
Blocked for security reasons.
### 404 - Error: Not Found
The user wasn't found.

View File

@ -1,13 +0,0 @@
# `/user/{username}/follows` - GET
Returns the list of accounts the user is following.
## Responses
### 200 - Success
__Content - JSON:__
| Field | Description |
|----------|-------------------------------------|
| accounts | A list of (username, userid) pairs. |
### 403 - Error: Forbidden
Blocked for security reasons.
### 404 - Error: Not Found
The user wasn't found.

View File

@ -1,13 +0,0 @@
# `/user/{username}/projects` - GET
Returns the list of public projects the user is part of.
## Responses
### 200 - Success
__Content - JSON:__
| Field | Description |
|----------|-------------------------------------------|
| projects | A list of (projectname, projectid) pairs. |
### 403 - Error: Forbidden
Blocked for security reasons.
### 404 - Error: Not Found
The user wasn't found.