chore: add api docs (#1965)

This commit is contained in:
boojack
2023-07-15 23:30:20 +08:00
committed by GitHub
parent 01f4780655
commit 2effacd0a6
11 changed files with 808 additions and 1 deletions

107
docs/api/auth.md Normal file
View File

@@ -0,0 +1,107 @@
# Authentication APIs
## Sign In
```
POST /api/v1/auth/signin
```
**Request Body**
```json
{
"username": "john",
"password": "password123"
}
```
**Response**
```json
{
"id": 123,
"username": "john",
"nickname": "John"
// other user fields
}
```
**Status Codes**
- 200: Sign in success
- 400: Invalid request
- 401: Incorrect credentials
- 403: User banned
- 500: Internal server error
## SSO Sign In
```
POST /api/v1/auth/signin/sso
```
**Request Body**
```json
{
"identityProviderId": 123,
"code": "abc123",
"redirectUri": "https://example.com/callback"
}
```
**Response**
Same as **Sign In**
**Status Codes**
- 200: Success
- 400: Invalid request
- 401: Authentication failed
- 403: User banned
- 404: Identity provider not found
- 500: Internal server error
## Sign Up
```
POST /api/v1/auth/signup
```
**Request Body**
```json
{
"username": "mary",
"password": "password456"
}
```
**Response**
Same as **Sign In**
**Status Codes**
- 200: Sign up success
- 400: Invalid request
- 401: Sign up disabled
- 500: Internal server error
## Sign Out
```
POST /api/v1/auth/signout
```
**Response**
```
true
```
**Status Codes**
- 200: Success
- 500: Internal server error