Skip to content

Commit 7914aef

Browse files
committed
Splitting API page into separate pages per endpoint and changing the navigation tree for API
1 parent 32489bf commit 7914aef

File tree

17 files changed

+1772
-5
lines changed

17 files changed

+1772
-5
lines changed

Diff for: src/app/v5/api/auth/page.mdx

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Authentication
2+
3+
## `GET /auth`
4+
5+
#### Description:
6+
7+
Redirects the user to the authorization URI of the specified authentication provider.
8+
9+
#### Query Parameters:
10+
11+
- `providerId` `string`: The ID of the authentication provider.
12+
13+
#### Example Request (URL):
14+
15+
```
16+
GET /auth?providerId=google
17+
18+
```
19+
20+
#### Example Response (Redirect):
21+
22+
This will redirect the user to the authorization URI of the specified provider (e.g., Google OAuth2 authorization page).
23+
24+
```http
25+
HTTP/1.1 302 Found
26+
Location: https://accounts.google.com/o/oauth2/auth?client_id=...&redirect_uri=...&response_type=code&scope=...
27+
28+
```
29+
30+
## `GET /auth/callback2`
31+
32+
#### Description:
33+
34+
Callback endpoint for authentication providers after user authorization. It exchanges the authorization code or token
35+
for an access token.
36+
37+
#### Query Parameters:
38+
39+
- `state` `string`: The provider ID passed in the initial authentication request, used to identify the provider.
40+
41+
#### Example Request (URL):
42+
43+
```
44+
GET /auth/callback2?state=google&code=authorizationCodeHere
45+
46+
```
47+
48+
#### Example Response (Redirect):
49+
50+
Upon success, redirects to the login success page.
51+
52+
```http
53+
HTTP/1.1 302 Found
54+
Location: /loginsuccess?provider=google
55+
56+
```
57+
58+
#### Example Response (Error):
59+
60+
If the `state` parameter is invalid or missing, returns an error response.
61+
62+
```json
63+
{
64+
"error": "Invalid provider id in state"
65+
}
66+
67+
```
68+
69+
If the authentication fails (e.g., invalid token exchange or an OAuth error), the response will be:
70+
71+
```json
72+
{
73+
"error": "Authentication failed"
74+
}
75+
76+
```

Diff for: src/app/v5/api/counters/page.mdx

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# Counters API
2+
3+
## `Get /counters`
4+
5+
#### Description:
6+
7+
Fetches all available counters.
8+
9+
#### Example Request:
10+
11+
```
12+
GET /counters
13+
14+
```
15+
16+
#### Example Response:
17+
18+
```json
19+
[
20+
{
21+
"id": "counter1",
22+
"name": "Counter 1",
23+
"value": 10
24+
},
25+
{
26+
"id": "counter2",
27+
"name": "Counter 2",
28+
"value": 15
29+
}
30+
]
31+
32+
```
33+
34+
----------
35+
36+
## `Get /counters/:counterId`
37+
38+
#### Description:
39+
40+
Fetches a specific counter by its `counterId`.
41+
42+
#### Request Parameters:
43+
44+
- `counterId`: The unique identifier of the counter.
45+
46+
#### Example Request:
47+
48+
```
49+
GET /counters/counter1
50+
51+
```
52+
53+
#### Example Response:
54+
55+
```json
56+
{
57+
"id": "counter1",
58+
"name": "Counter 1",
59+
"value": 10
60+
}
61+
62+
```
63+
64+
----------
65+
66+
## `Post /counters/:counterId`
67+
68+
#### Description:
69+
70+
Updates the value of an existing counter. Optionally, you can override the current value.
71+
72+
#### Request Parameters:
73+
74+
- `counterId`: The unique identifier of the counter to be updated.
75+
76+
#### Request Body:
77+
78+
- `value`: The new value to set for the counter (required).
79+
- `override`: A boolean indicating whether to override the counter's current value (optional, defaults to `false`).
80+
81+
#### Example Request:
82+
83+
```json
84+
{
85+
"value": 20,
86+
"override": true
87+
}
88+
89+
```
90+
91+
#### Example Response:
92+
93+
```json
94+
{
95+
"oldValue": 10,
96+
"newValue": 20
97+
}
98+
99+
```

Diff for: src/app/v5/api/currency/page.mdx

+161
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
# Currency API
2+
3+
## `Get /currencies/:currencyName?`
4+
5+
#### Description:
6+
7+
Fetches currency data for a specific currency or all currencies if no currency name is provided.
8+
9+
- If `currencyName` is specified, it will return data for the specified currency.
10+
- If `currencyName` is not provided, it will return a list of all currencies.
11+
12+
#### Example Request (for a specific currency):
13+
14+
```
15+
GET /currencies/coin
16+
17+
```
18+
19+
#### Example Response (for a specific currency):
20+
21+
```json
22+
{
23+
"d073da00-a726-11e9-a874-7de9c8544807": {
24+
"id": "d073da00-a726-11e9-a874-7de9c8544807",
25+
"name": "coin",
26+
"active": true,
27+
"payout": 5,
28+
"interval": 5,
29+
"limit": 1000000,
30+
"transfer": "Allow",
31+
"bonus": {},
32+
"offline": 5,
33+
"$$hashKey": "object:35427"
34+
}
35+
}
36+
37+
```
38+
39+
#### Example Request (for all currencies):
40+
41+
```
42+
GET /currencies
43+
44+
```
45+
46+
#### Example Response (for all currencies):
47+
48+
```json
49+
[
50+
{
51+
"d073da00-a726-11e9-a874-7de9c8544807": {
52+
"id": "d073da00-a726-11e9-a874-7de9c8544807",
53+
"name": "coin",
54+
"active": true,
55+
"payout": 5,
56+
"interval": 5,
57+
"limit": 1000000,
58+
"transfer": "Allow",
59+
"bonus": {},
60+
"offline": 5,
61+
"$$hashKey": "object:35427"
62+
}
63+
},
64+
{
65+
"d073da00-a726-11e9-a874-7de9c8544807": {
66+
"id": "d073da00-a726-11e9-a874-7de9c8544807",
67+
"name": "pups",
68+
"active": true,
69+
"payout": 5,
70+
"interval": 5,
71+
"limit": 1000000,
72+
"transfer": "Allow",
73+
"bonus": {},
74+
"offline": 5,
75+
"$$hashKey": "object:35427"
76+
}
77+
}
78+
]
79+
80+
```
81+
82+
----------
83+
84+
## `Get /currencies/:currencyName/topHolders`
85+
86+
#### Description:
87+
88+
Fetches the top holders of a specific currency. By default, it will return the top 10 holders, but you can specify a
89+
`count` query parameter to change the number of top holders returned.
90+
91+
#### Request Parameters:
92+
93+
- `currencyName`: The name of the currency (e.g., "coin", "pups").
94+
- `count`: (Optional) The number of top holders to return. If not specified, defaults to 10.
95+
96+
#### Example Request (with `count` query parameter):
97+
98+
```
99+
GET /currencies/pups/topHolders?count=2
100+
101+
```
102+
103+
#### Example Response:
104+
105+
```json
106+
[
107+
{
108+
"username": "fluffypanda",
109+
"displayName": "FluffyPanda",
110+
"currency": {
111+
"d073da00-a726-11e9-a874-7de9c8544807": 281272,
112+
"3eba5d80-4297-11ee-86eb-d7d7d2938882": 103665
113+
},
114+
"_id": "90448736"
115+
},
116+
{
117+
"username": "sparklenova",
118+
"displayName": "SparkleNova",
119+
"currency": {
120+
"d073da00-a726-11e9-a874-7de9c8544807": 281272,
121+
"3eba5d80-4297-11ee-86eb-d7d7d2938882": 103665
122+
},
123+
"_id": "90448726"
124+
}
125+
]
126+
127+
```
128+
129+
#### Example Request (default 10 top holders):
130+
131+
```
132+
GET /currencies/coin/topHolders
133+
134+
```
135+
136+
#### Example Response (default top 10 holders):
137+
138+
```json
139+
[
140+
{
141+
"username": "fluffypanda",
142+
"displayName": "FluffyPanda",
143+
"currency": {
144+
"d073da00-a726-11e9-a874-7de9c8544807": 281272,
145+
"3eba5d80-4297-11ee-86eb-d7d7d2938882": 103665
146+
},
147+
"_id": "90448736"
148+
},
149+
{
150+
"username": "sparklenova",
151+
"displayName": "SparkleNova",
152+
"currency": {
153+
"d073da00-a726-11e9-a874-7de9c8544807": 281272,
154+
"3eba5d80-4297-11ee-86eb-d7d7d2938882": 103665
155+
},
156+
"_id": "90448726"
157+
},
158+
// More users...
159+
]
160+
161+
```

0 commit comments

Comments
 (0)