docs(api): designed a bunch of endpoints
This commit is contained in:
parent
9076a2761a
commit
c444f561b3
195
API.md
195
API.md
|
@ -159,3 +159,198 @@ __Content - JSON:__
|
||||||
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.
|
||||||
|
|
||||||
|
|
||||||
|
### `/account/follows` - GET
|
||||||
|
Lists all acccounts that the authenticated account follows.
|
||||||
|
|
||||||
|
#### HTTP Headers
|
||||||
|
| Header | Content |
|
||||||
|
|---------------|--------------------|
|
||||||
|
| Authorization | `Bearer {token}` |
|
||||||
|
|
||||||
|
#### Responses
|
||||||
|
##### 200 - Success
|
||||||
|
__Content - JSON:__
|
||||||
|
| Field | Description |
|
||||||
|
|----------|-------------------------------------|
|
||||||
|
| accounts | A list of (username, userid) pairs. |
|
||||||
|
##### 401 - Error: Unauthorized
|
||||||
|
The provided auth token doesn't allow you to perform this operation.
|
||||||
|
##### 403 - Error: Forbidden
|
||||||
|
Blocked for security reasons.
|
||||||
|
|
||||||
|
|
||||||
|
### `/account/followers` - GET
|
||||||
|
Lists all acccounts that are following the authenticated account.
|
||||||
|
|
||||||
|
#### HTTP Headers
|
||||||
|
| Header | Content |
|
||||||
|
|---------------|--------------------|
|
||||||
|
| Authorization | `Bearer {token}` |
|
||||||
|
|
||||||
|
#### Responses
|
||||||
|
##### 200 - Success
|
||||||
|
__Content - JSON:__
|
||||||
|
| Field | Description |
|
||||||
|
|----------|-------------------------------------|
|
||||||
|
| accounts | A list of (username, userid) pairs. |
|
||||||
|
##### 401 - Error: Unauthorized
|
||||||
|
The provided auth token doesn't allow you to perform this operation.
|
||||||
|
##### 403 - Error: Forbidden
|
||||||
|
Blocked for security reasons.
|
||||||
|
|
||||||
|
|
||||||
|
### `/user/{username}/info` - GET
|
||||||
|
Returns information about the user.
|
||||||
|
|
||||||
|
#### Responses
|
||||||
|
##### 200 - Success
|
||||||
|
__Content - JSON:__
|
||||||
|
| Field | Description |
|
||||||
|
|----------|-------------------------------------------------------------------|
|
||||||
|
| id | The users unique id. |
|
||||||
|
| name | The users unique username. |
|
||||||
|
| joined | The datetime when the user joined. Represented as UNIX timestamp. |
|
||||||
|
| is_admin | A boolean if the user is an admin. |
|
||||||
|
##### 403 - Error: Forbidden
|
||||||
|
Blocked for security reasons.
|
||||||
|
##### 404 - Error: Not Found
|
||||||
|
The user wasn't found.
|
||||||
|
|
||||||
|
|
||||||
|
### `/user/{username}/follow` - POST
|
||||||
|
Let the authenticated account follow the user.
|
||||||
|
|
||||||
|
#### HTTP Headers
|
||||||
|
| Header | Content |
|
||||||
|
|---------------|--------------------|
|
||||||
|
| Authorization | `Bearer {token}` |
|
||||||
|
|
||||||
|
#### Responses
|
||||||
|
##### 200 - Success
|
||||||
|
Successfully followed the user.
|
||||||
|
##### 208 - Already Reported
|
||||||
|
You already follow the user.
|
||||||
|
##### 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.
|
||||||
|
|
||||||
|
|
||||||
|
### `/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.
|
||||||
|
|
||||||
|
|
||||||
|
### `/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.
|
||||||
|
|
||||||
|
|
||||||
|
### `/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.
|
||||||
|
|
||||||
|
|
||||||
|
### `/project/create` - POST
|
||||||
|
Creates a new project.
|
||||||
|
|
||||||
|
#### HTTP Headers
|
||||||
|
| Header | Content |
|
||||||
|
|---------------|--------------------|
|
||||||
|
| Authorization | `Bearer {token}` |
|
||||||
|
| Content-Type | `application/json` |
|
||||||
|
|
||||||
|
#### Content - JSON
|
||||||
|
| Field | Description |
|
||||||
|
|-------------|-----------------------------------------------|
|
||||||
|
| name | The name of the project to be created. |
|
||||||
|
| description | The description of the project to be created. |
|
||||||
|
|
||||||
|
#### Responses
|
||||||
|
##### 200 - Success
|
||||||
|
__Content - JSON:__
|
||||||
|
| Field | Description |
|
||||||
|
|-------|---------------------------------|
|
||||||
|
| id | The created projects unique id. |
|
||||||
|
##### 403 - Error: Forbidden
|
||||||
|
Blocked for security reasons.
|
||||||
|
##### 409 - Error: Conflict
|
||||||
|
The requested project name is already taken.
|
||||||
|
|
||||||
|
|
||||||
|
### `/project/{projectname}/info` - GET
|
||||||
|
Returns the list of public projects the user is part of.
|
||||||
|
|
||||||
|
#### Responses
|
||||||
|
##### 200 - Success
|
||||||
|
__Content - JSON:__
|
||||||
|
| Field | Description |
|
||||||
|
|-------------|---------------------------------------------------------------------------|
|
||||||
|
| id | The projects unique id. |
|
||||||
|
| name | The projects unique name. |
|
||||||
|
| description | The projects description. |
|
||||||
|
| created | The datetime when the project was created. Represented as UNIX timestamp. |
|
||||||
|
| members | A list of (username, userid) pairs. |
|
||||||
|
##### 403 - Error: Forbidden
|
||||||
|
Blocked for security reasons.
|
||||||
|
##### 404 - Error: Not Found
|
||||||
|
The project wasn't found.
|
||||||
|
|
||||||
|
|
||||||
|
### `/project/{projectname}/join` - POST
|
||||||
|
Returns the list of public projects the user is part of.
|
||||||
|
|
||||||
|
#### HTTP Headers
|
||||||
|
| Header | Content |
|
||||||
|
|---------------|--------------------|
|
||||||
|
| Authorization | `Bearer {token}` |
|
||||||
|
| Content-Type | `application/json` |
|
||||||
|
|
||||||
|
#### Content - JSON
|
||||||
|
| Field | Description |
|
||||||
|
|---------|-----------------------------------------------------------|
|
||||||
|
| message | The request message the projects maintainers will review. |
|
||||||
|
|
||||||
|
#### Responses
|
||||||
|
##### 200 - Success
|
||||||
|
Your request will be reviewed.
|
||||||
|
##### 208 - Already Reported
|
||||||
|
You already joined the project.
|
||||||
|
##### 403 - Error: Forbidden
|
||||||
|
Blocked for security reasons.
|
||||||
|
##### 404 - Error: Not Found
|
||||||
|
The project wasn't found.
|
18
README.md
18
README.md
|
@ -21,12 +21,16 @@ export SMTP_PASSWORD=password
|
||||||
- [X] `/delete` - DELETE
|
- [X] `/delete` - DELETE
|
||||||
- [X] `/tokens` - DELETE
|
- [X] `/tokens` - DELETE
|
||||||
- [X] `/tokens` - GET
|
- [X] `/tokens` - GET
|
||||||
- [ ] `/follow` - DELETE (not designed yet)
|
- [ ] `/follows` - GET
|
||||||
- [ ] `/info` - GET (not designed yet)
|
- [ ] `/followers` - GET
|
||||||
- `/user/{username}`
|
- `/user/{username}`
|
||||||
- [ ] `/info` - GET (not designed yet)
|
- [ ] `/info` - GET
|
||||||
- [ ] `/follow` - POST (not designed yet)
|
- [ ] `/follow` - POST
|
||||||
|
- [ ] `/follows` - GET
|
||||||
|
- [ ] `/followers` - GET
|
||||||
|
- [ ] `/projects` - GET
|
||||||
- `/project`
|
- `/project`
|
||||||
- [ ] `/create` - POST (not designed yet)
|
- [ ] `/create` - POST
|
||||||
- [ ] `/info` - GET (not designed yet)
|
- `/{projectname}`
|
||||||
- [ ] `/join` - POST (not designed yet)
|
- [ ] `/info` - GET
|
||||||
|
- [ ] `/join` - POST
|
Loading…
Reference in New Issue