-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Splitting API page into separate pages per endpoint and changing the …
…navigation tree for API
- Loading branch information
Showing
17 changed files
with
1,772 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# Authentication | ||
|
||
## `GET /auth` | ||
|
||
#### Description: | ||
|
||
Redirects the user to the authorization URI of the specified authentication provider. | ||
|
||
#### Query Parameters: | ||
|
||
- `providerId` `string`: The ID of the authentication provider. | ||
|
||
#### Example Request (URL): | ||
|
||
``` | ||
GET /auth?providerId=google | ||
``` | ||
|
||
#### Example Response (Redirect): | ||
|
||
This will redirect the user to the authorization URI of the specified provider (e.g., Google OAuth2 authorization page). | ||
|
||
```http | ||
HTTP/1.1 302 Found | ||
Location: https://accounts.google.com/o/oauth2/auth?client_id=...&redirect_uri=...&response_type=code&scope=... | ||
``` | ||
|
||
## `GET /auth/callback2` | ||
|
||
#### Description: | ||
|
||
Callback endpoint for authentication providers after user authorization. It exchanges the authorization code or token | ||
for an access token. | ||
|
||
#### Query Parameters: | ||
|
||
- `state` `string`: The provider ID passed in the initial authentication request, used to identify the provider. | ||
|
||
#### Example Request (URL): | ||
|
||
``` | ||
GET /auth/callback2?state=google&code=authorizationCodeHere | ||
``` | ||
|
||
#### Example Response (Redirect): | ||
|
||
Upon success, redirects to the login success page. | ||
|
||
```http | ||
HTTP/1.1 302 Found | ||
Location: /loginsuccess?provider=google | ||
``` | ||
|
||
#### Example Response (Error): | ||
|
||
If the `state` parameter is invalid or missing, returns an error response. | ||
|
||
```json | ||
{ | ||
"error": "Invalid provider id in state" | ||
} | ||
|
||
``` | ||
|
||
If the authentication fails (e.g., invalid token exchange or an OAuth error), the response will be: | ||
|
||
```json | ||
{ | ||
"error": "Authentication failed" | ||
} | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
# Counters API | ||
|
||
## `Get /counters` | ||
|
||
#### Description: | ||
|
||
Fetches all available counters. | ||
|
||
#### Example Request: | ||
|
||
``` | ||
GET /counters | ||
``` | ||
|
||
#### Example Response: | ||
|
||
```json | ||
[ | ||
{ | ||
"id": "counter1", | ||
"name": "Counter 1", | ||
"value": 10 | ||
}, | ||
{ | ||
"id": "counter2", | ||
"name": "Counter 2", | ||
"value": 15 | ||
} | ||
] | ||
|
||
``` | ||
|
||
---------- | ||
|
||
## `Get /counters/:counterId` | ||
|
||
#### Description: | ||
|
||
Fetches a specific counter by its `counterId`. | ||
|
||
#### Request Parameters: | ||
|
||
- `counterId`: The unique identifier of the counter. | ||
|
||
#### Example Request: | ||
|
||
``` | ||
GET /counters/counter1 | ||
``` | ||
|
||
#### Example Response: | ||
|
||
```json | ||
{ | ||
"id": "counter1", | ||
"name": "Counter 1", | ||
"value": 10 | ||
} | ||
|
||
``` | ||
|
||
---------- | ||
|
||
## `Post /counters/:counterId` | ||
|
||
#### Description: | ||
|
||
Updates the value of an existing counter. Optionally, you can override the current value. | ||
|
||
#### Request Parameters: | ||
|
||
- `counterId`: The unique identifier of the counter to be updated. | ||
|
||
#### Request Body: | ||
|
||
- `value`: The new value to set for the counter (required). | ||
- `override`: A boolean indicating whether to override the counter's current value (optional, defaults to `false`). | ||
|
||
#### Example Request: | ||
|
||
```json | ||
{ | ||
"value": 20, | ||
"override": true | ||
} | ||
|
||
``` | ||
|
||
#### Example Response: | ||
|
||
```json | ||
{ | ||
"oldValue": 10, | ||
"newValue": 20 | ||
} | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
# Currency API | ||
|
||
## `Get /currencies/:currencyName?` | ||
|
||
#### Description: | ||
|
||
Fetches currency data for a specific currency or all currencies if no currency name is provided. | ||
|
||
- If `currencyName` is specified, it will return data for the specified currency. | ||
- If `currencyName` is not provided, it will return a list of all currencies. | ||
|
||
#### Example Request (for a specific currency): | ||
|
||
``` | ||
GET /currencies/coin | ||
``` | ||
|
||
#### Example Response (for a specific currency): | ||
|
||
```json | ||
{ | ||
"d073da00-a726-11e9-a874-7de9c8544807": { | ||
"id": "d073da00-a726-11e9-a874-7de9c8544807", | ||
"name": "coin", | ||
"active": true, | ||
"payout": 5, | ||
"interval": 5, | ||
"limit": 1000000, | ||
"transfer": "Allow", | ||
"bonus": {}, | ||
"offline": 5, | ||
"$$hashKey": "object:35427" | ||
} | ||
} | ||
|
||
``` | ||
|
||
#### Example Request (for all currencies): | ||
|
||
``` | ||
GET /currencies | ||
``` | ||
|
||
#### Example Response (for all currencies): | ||
|
||
```json | ||
[ | ||
{ | ||
"d073da00-a726-11e9-a874-7de9c8544807": { | ||
"id": "d073da00-a726-11e9-a874-7de9c8544807", | ||
"name": "coin", | ||
"active": true, | ||
"payout": 5, | ||
"interval": 5, | ||
"limit": 1000000, | ||
"transfer": "Allow", | ||
"bonus": {}, | ||
"offline": 5, | ||
"$$hashKey": "object:35427" | ||
} | ||
}, | ||
{ | ||
"d073da00-a726-11e9-a874-7de9c8544807": { | ||
"id": "d073da00-a726-11e9-a874-7de9c8544807", | ||
"name": "pups", | ||
"active": true, | ||
"payout": 5, | ||
"interval": 5, | ||
"limit": 1000000, | ||
"transfer": "Allow", | ||
"bonus": {}, | ||
"offline": 5, | ||
"$$hashKey": "object:35427" | ||
} | ||
} | ||
] | ||
|
||
``` | ||
|
||
---------- | ||
|
||
## `Get /currencies/:currencyName/topHolders` | ||
|
||
#### Description: | ||
|
||
Fetches the top holders of a specific currency. By default, it will return the top 10 holders, but you can specify a | ||
`count` query parameter to change the number of top holders returned. | ||
|
||
#### Request Parameters: | ||
|
||
- `currencyName`: The name of the currency (e.g., "coin", "pups"). | ||
- `count`: (Optional) The number of top holders to return. If not specified, defaults to 10. | ||
|
||
#### Example Request (with `count` query parameter): | ||
|
||
``` | ||
GET /currencies/pups/topHolders?count=2 | ||
``` | ||
|
||
#### Example Response: | ||
|
||
```json | ||
[ | ||
{ | ||
"username": "fluffypanda", | ||
"displayName": "FluffyPanda", | ||
"currency": { | ||
"d073da00-a726-11e9-a874-7de9c8544807": 281272, | ||
"3eba5d80-4297-11ee-86eb-d7d7d2938882": 103665 | ||
}, | ||
"_id": "90448736" | ||
}, | ||
{ | ||
"username": "sparklenova", | ||
"displayName": "SparkleNova", | ||
"currency": { | ||
"d073da00-a726-11e9-a874-7de9c8544807": 281272, | ||
"3eba5d80-4297-11ee-86eb-d7d7d2938882": 103665 | ||
}, | ||
"_id": "90448726" | ||
} | ||
] | ||
|
||
``` | ||
|
||
#### Example Request (default 10 top holders): | ||
|
||
``` | ||
GET /currencies/coin/topHolders | ||
``` | ||
|
||
#### Example Response (default top 10 holders): | ||
|
||
```json | ||
[ | ||
{ | ||
"username": "fluffypanda", | ||
"displayName": "FluffyPanda", | ||
"currency": { | ||
"d073da00-a726-11e9-a874-7de9c8544807": 281272, | ||
"3eba5d80-4297-11ee-86eb-d7d7d2938882": 103665 | ||
}, | ||
"_id": "90448736" | ||
}, | ||
{ | ||
"username": "sparklenova", | ||
"displayName": "SparkleNova", | ||
"currency": { | ||
"d073da00-a726-11e9-a874-7de9c8544807": 281272, | ||
"3eba5d80-4297-11ee-86eb-d7d7d2938882": 103665 | ||
}, | ||
"_id": "90448726" | ||
}, | ||
// More users... | ||
] | ||
|
||
``` |
Oops, something went wrong.