Skip to content

Commit

Permalink
docs for APIs updated to resonate with fusionauth docs (#72)
Browse files Browse the repository at this point in the history
* docs for APIs updated

* docs for other apis improved

* schema added in dto of req body

* flow diagrams added for remaining apis
  • Loading branch information
Ashu463 authored Oct 30, 2024
1 parent 0bbb94a commit a2bc389
Show file tree
Hide file tree
Showing 11 changed files with 766 additions and 553 deletions.
51 changes: 44 additions & 7 deletions docs/api/OTP.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,35 @@

The OTP (One-Time Password) Service is part of a NestJS application that handles the generation, sending, and validation of one-time passwords. It supports multiple delivery methods including email, SMS, and WhatsApp.

## Endpoints
## Sequence Diagram

### 1. SendOtp
- **Endpoint** : Post `/otp/send`
![Groups Sequence Diagram](../assets/sequence-diagrams/otp.jpeg)

## Send OTP
### Request
#### Generates and sends an OTP via specified channels.
`POST /otp/send`
- **Description** : Generates and sends an OTP via specified channels.
- **Parameters:**
- `type`: string[] - An array of delivery methods ('mail', 'sms', 'whatsapp')
- `to`: string - The recipient's address (email, phone number, etc.)
#### Request Parameters
- `type`: string[] - An array of delivery methods ('mail', 'sms', 'whatsapp')
- `to`: string - The recipient's address (email, phone number, etc.)

### Response

#### Response Codes

| Code | Description |
|------|-------------|
| 200 | The request was successful. The response will contain a JSON body. |
| 400 | The request was invalid and/or malformed. The response will contain an Errors JSON Object with the specific errors. This status will also be returned if a paid Auth Service license is required and is not present. |
| 401 | You did not supply a valid Authorization header. The header was omitted or your API key was not valid. The response will be empty
| 404 | The object you are trying to update doesn't exist. The response will be empty. |
| 500 | There was an internal error. A stack trace is provided and logged in the Auth Service log files. The response will be empty. |


- **Sample cURL**:
```sh
curl -X POST http://localhost:3000/otp/send \
Expand All @@ -25,11 +46,27 @@ The OTP (One-Time Password) Service is part of a NestJS application that handles
type:='["mail", "sms"]' \
to="[email protected]"
### 2. ValidateOtp
- **Endpoint** : Post `/otp/verify`
- **Description** : Validates a given OTP.
- **Parameters:**
## Validate OTP
### Request
#### Validates a given OTP.
`POST /otp/verify`
#### Request Parameters
- `otp`: string - The OTP to validate
### Response
#### Response Codes
| Code | Description |
|------|-------------|
| 200 | The request was successful. The response will contain a JSON body. |
| 400 | The request was invalid and/or malformed. The response will contain an Errors JSON Object with the specific errors. This status will also be returned if a paid Auth Service license is required and is not present. |
| 401 | You did not supply a valid Authorization header. The header was omitted or your API key was not valid. The response will be empty
| 404 | The object you are trying to update doesn't exist. The response will be empty. |
| 500 | There was an internal error. A stack trace is provided and logged in the Auth Service log files. The response will be empty. |
- **Sample cURL**:
```sh
curl -X POST http://localhost:3000/otp/verify \
Expand Down
54 changes: 27 additions & 27 deletions docs/api/applications.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ The ApplicationService is a crucial component of our NestJS application, respons
- authorization : `string` *Required*

### Request Body
- applicationData : `data (CreateApplicationDTO)`
- applicationData : `{"active" : boolean, "name" : string, "scopes" : string[], "roles" : string[], "oauthConfiguration" : OauthConfiguration }`

### Response

Expand All @@ -36,9 +36,9 @@ The ApplicationService is a crucial component of our NestJS application, respons
| Code | Description |
|------|-------------|
| 200 | The request was successful. The response will contain a JSON body. |
| 400 | The request was invalid and/or malformed. The response will contain an Errors JSON Object with the specific errors. This status will also be returned if a paid FusionAuth license is required and is not present. |
| 400 | The request was invalid and/or malformed. The response will contain an Errors JSON Object with the specific errors. This status will also be returned if a paid Auth Service license is required and is not present. |
| 401 | You did not supply a valid Authorization header. The header was omitted or your API key was not valid. The response will be empty.
| 500 | There was an internal error. A stack trace is provided and logged in the FusionAuth log files. The response will be empty. |
| 500 | There was an internal error. A stack trace is provided and logged in the Auth Service log files. The response will be empty. |

- **Sample cURL**:
```sh
Expand Down Expand Up @@ -76,7 +76,7 @@ The ApplicationService is a crucial component of our NestJS application, respons
- authorization : `string` *Required*
### Request Body
- applicationData : `data (UpdateApplicationDto)`
- applicationData : `{"active" ?: boolean, "name" ?: string, "oauthConfiguration" ?: OauthConfiguration, "jwtConfiguration" : JwtConfiguration }`
### Response
Expand All @@ -85,10 +85,10 @@ The ApplicationService is a crucial component of our NestJS application, respons
| Code | Description |
|------|-------------|
| 200 | The request was successful. The response will contain a JSON body. |
| 400 | The request was invalid and/or malformed. The response will contain an Errors JSON Object with the specific errors. This status will also be returned if a paid FusionAuth license is required and is not present. |
| 400 | The request was invalid and/or malformed. The response will contain an Errors JSON Object with the specific errors. This status will also be returned if a paid Auth Service license is required and is not present. |
| 401 | You did not supply a valid Authorization header. The header was omitted or your API key was not valid. The response will be empty
| 404 | The object you are trying to update doesn't exist. The response will be empty. |
| 500 | There was an internal error. A stack trace is provided and logged in the FusionAuth log files. The response will be empty. |
| 500 | There was an internal error. A stack trace is provided and logged in the Auth Service log files. The response will be empty. |
- **Sample cURL**:
```sh
Expand Down Expand Up @@ -134,10 +134,10 @@ The ApplicationService is a crucial component of our NestJS application, respons
| Code | Description |
|------|-------------|
| 200 | The request was successful. The response will contain a JSON body. |
| 400 | The request was invalid and/or malformed. The response will contain an Errors JSON Object with the specific errors. This status will also be returned if a paid FusionAuth license is required and is not present. |
| 400 | The request was invalid and/or malformed. The response will contain an Errors JSON Object with the specific errors. This status will also be returned if a paid Auth Service license is required and is not present. |
| 401 | You did not supply a valid Authorization header. The header was omitted or your API key was not valid. The response will be empty
| 404 | The object you are trying to update doesn't exist. The response will be empty. |
| 500 | There was an internal error. A stack trace is provided and logged in the FusionAuth log files. The response will be empty. |
| 500 | There was an internal error. A stack trace is provided and logged in the Auth Service log files. The response will be empty. |
- **Sample cURL**:
```sh
Expand Down Expand Up @@ -175,10 +175,10 @@ The ApplicationService is a crucial component of our NestJS application, respons
| Code | Description |
|------|-------------|
| 200 | The request was successful. The response will contain a JSON body. |
| 400 | The request was invalid and/or malformed. The response will contain an Errors JSON Object with the specific errors. This status will also be returned if a paid FusionAuth license is required and is not present. |
| 400 | The request was invalid and/or malformed. The response will contain an Errors JSON Object with the specific errors. This status will also be returned if a paid Auth Service license is required and is not present. |
| 401 | You did not supply a valid Authorization header. The header was omitted or your API key was not valid. The response will be empty
| 404 | The object you are trying to update doesn't exist. The response will be empty. |
| 500 | There was an internal error. A stack trace is provided and logged in the FusionAuth log files. The response will be empty. |
| 500 | There was an internal error. A stack trace is provided and logged in the Auth Service log files. The response will be empty. |
- **Sample cURL**:
```sh
Expand Down Expand Up @@ -217,10 +217,10 @@ The ApplicationService is a crucial component of our NestJS application, respons
| Code | Description |
|------|-------------|
| 200 | The request was successful. The response will contain a JSON body. |
| 400 | The request was invalid and/or malformed. The response will contain an Errors JSON Object with the specific errors. This status will also be returned if a paid FusionAuth license is required and is not present. |
| 400 | The request was invalid and/or malformed. The response will contain an Errors JSON Object with the specific errors. This status will also be returned if a paid Auth Service license is required and is not present. |
| 401 | You did not supply a valid Authorization header. The header was omitted or your API key was not valid. The response will be empty
| 404 | The object you are trying to update doesn't exist. The response will be empty. |
| 500 | There was an internal error. A stack trace is provided and logged in the FusionAuth log files. The response will be empty. |
| 500 | There was an internal error. A stack trace is provided and logged in the Auth Service log files. The response will be empty. |
- **Sample cURL**:
```sh
Expand Down Expand Up @@ -257,7 +257,7 @@ The ApplicationScopesService is a crucial component of our NestJS application, r
`POST /application/:applicationId/scope/:scopeId`
#### Request Parameters
- `data: ScopeDto` - Scope data
- data : `{"defaultConsentDetail": string, "defaultConsentMessage": string, "name" : string, "required" : boolean}`
- `applicationsId: string` - Application ID
- `scopeId: string` - Optional scope ID
Expand All @@ -273,10 +273,10 @@ The ApplicationScopesService is a crucial component of our NestJS application, r
| Code | Description |
|------|-------------|
| 200 | The request was successful. The response will contain a JSON body. |
| 400 | The request was invalid and/or malformed. The response will contain an Errors JSON Object with the specific errors. This status will also be returned if a paid FusionAuth license is required and is not present. |
| 400 | The request was invalid and/or malformed. The response will contain an Errors JSON Object with the specific errors. This status will also be returned if a paid Auth Service license is required and is not present. |
| 401 | You did not supply a valid Authorization header. The header was omitted or your API key was not valid. The response will be empty
| 404 | The object you are trying to update doesn't exist. The response will be empty. |
| 500 | There was an internal error. A stack trace is provided and logged in the FusionAuth log files. The response will be empty. |
| 500 | There was an internal error. A stack trace is provided and logged in the Auth Service log files. The response will be empty. |
- **Sample cURL**:
```sh
Expand Down Expand Up @@ -315,7 +315,7 @@ The ApplicationScopesService is a crucial component of our NestJS application, r
- authorization : `string`
#### Request Body
- `data: UpdateScopeDto` - Scope data
- data : `{"defaultConsentDetail"?: string, "defaultConsentMessage" ?: string, "name" ?: string, "required" ?: boolean}`
### Response
Expand All @@ -324,10 +324,10 @@ The ApplicationScopesService is a crucial component of our NestJS application, r
| Code | Description |
|------|-------------|
| 200 | The request was successful. The response will contain a JSON body. |
| 400 | The request was invalid and/or malformed. The response will contain an Errors JSON Object with the specific errors. This status will also be returned if a paid FusionAuth license is required and is not present. |
| 400 | The request was invalid and/or malformed. The response will contain an Errors JSON Object with the specific errors. This status will also be returned if a paid Auth Service license is required and is not present. |
| 401 | You did not supply a valid Authorization header. The header was omitted or your API key was not valid. The response will be empty
| 404 | The object you are trying to update doesn't exist. The response will be empty. |
| 500 | There was an internal error. A stack trace is provided and logged in the FusionAuth log files. The response will be empty. |
| 500 | There was an internal error. A stack trace is provided and logged in the Auth Service log files. The response will be empty. |
- **Sample cURL**:
```sh
Expand Down Expand Up @@ -372,10 +372,10 @@ The ApplicationScopesService is a crucial component of our NestJS application, r
| Code | Description |
|------|-------------|
| 200 | The request was successful. The response will contain a JSON body. |
| 400 | The request was invalid and/or malformed. The response will contain an Errors JSON Object with the specific errors. This status will also be returned if a paid FusionAuth license is required and is not present. |
| 400 | The request was invalid and/or malformed. The response will contain an Errors JSON Object with the specific errors. This status will also be returned if a paid Auth Service license is required and is not present. |
| 401 | You did not supply a valid Authorization header. The header was omitted or your API key was not valid. The response will be empty
| 404 | The object you are trying to update doesn't exist. The response will be empty. |
| 500 | There was an internal error. A stack trace is provided and logged in the FusionAuth log files. The response will be empty. |
| 500 | There was an internal error. A stack trace is provided and logged in the Auth Service log files. The response will be empty. |
- **Sample cURL**:
```sh
Expand Down Expand Up @@ -421,7 +421,7 @@ The ApplicationRolesService is a crucial component of our NestJS application, re
- authorization : `string`
#### Request Body
- `data: RoleDto` - Role data
- data : `{"description" : string, "isDefault" : boolean, "isSuperRole" : boolean, "name" : string}`
### Response
Expand All @@ -430,10 +430,10 @@ The ApplicationRolesService is a crucial component of our NestJS application, re
| Code | Description |
|------|-------------|
| 200 | The request was successful. The response will contain a JSON body. |
| 400 | The request was invalid and/or malformed. The response will contain an Errors JSON Object with the specific errors. This status will also be returned if a paid FusionAuth license is required and is not present. |
| 400 | The request was invalid and/or malformed. The response will contain an Errors JSON Object with the specific errors. This status will also be returned if a paid Auth Service license is required and is not present. |
| 401 | You did not supply a valid Authorization header. The header was omitted or your API key was not valid. The response will be empty
| 404 | The object you are trying to update doesn't exist. The response will be empty. |
| 500 | There was an internal error. A stack trace is provided and logged in the FusionAuth log files. The response will be empty. |
| 500 | There was an internal error. A stack trace is provided and logged in the Auth Service log files. The response will be empty. |
- **Sample cURL**:
Expand Down Expand Up @@ -481,10 +481,10 @@ The ApplicationRolesService is a crucial component of our NestJS application, re
| Code | Description |
|------|-------------|
| 200 | The request was successful. The response will contain a JSON body. |
| 400 | The request was invalid and/or malformed. The response will contain an Errors JSON Object with the specific errors. This status will also be returned if a paid FusionAuth license is required and is not present. |
| 400 | The request was invalid and/or malformed. The response will contain an Errors JSON Object with the specific errors. This status will also be returned if a paid Auth Service license is required and is not present. |
| 401 | You did not supply a valid Authorization header. The header was omitted or your API key was not valid. The response will be empty
| 404 | The object you are trying to update doesn't exist. The response will be empty. |
| 500 | There was an internal error. A stack trace is provided and logged in the FusionAuth log files. The response will be empty. |
| 500 | There was an internal error. A stack trace is provided and logged in the Auth Service log files. The response will be empty. |
- **Sample cURL**:
Expand Down Expand Up @@ -529,10 +529,10 @@ The ApplicationRolesService is a crucial component of our NestJS application, re
| Code | Description |
|------|-------------|
| 200 | The request was successful. The response will contain a JSON body. |
| 400 | The request was invalid and/or malformed. The response will contain an Errors JSON Object with the specific errors. This status will also be returned if a paid FusionAuth license is required and is not present. |
| 400 | The request was invalid and/or malformed. The response will contain an Errors JSON Object with the specific errors. This status will also be returned if a paid Auth Service license is required and is not present. |
| 401 | You did not supply a valid Authorization header. The header was omitted or your API key was not valid. The response will be empty
| 404 | The object you are trying to update doesn't exist. The response will be empty. |
| 500 | There was an internal error. A stack trace is provided and logged in the FusionAuth log files. The response will be empty. |
| 500 | There was an internal error. A stack trace is provided and logged in the Auth Service log files. The response will be empty. |
- **Sample cURL**:
Expand Down
Loading

0 comments on commit a2bc389

Please sign in to comment.