Skip to content

Commit 1acf631

Browse files
authored
Create api-usage.md
1 parent da2f43e commit 1acf631

File tree

1 file changed

+200
-0
lines changed

1 file changed

+200
-0
lines changed

Doc/api-usage.md

Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
# API Usage
2+
3+
This document provides detailed examples of how to use the API endpoints for various functionalities.
4+
5+
## Addon
6+
7+
### Compile Source Code
8+
9+
Compiles the provided source code.
10+
11+
**Endpoint:** `POST /addon/compile`
12+
13+
**Request Body:**
14+
15+
```plaintext
16+
Rawbody:
17+
18+
<source code>
19+
20+
Headers:
21+
22+
Content-Type: text/plain
23+
title: [Some title]
24+
standar: [c2a, c++11, c++14, c++17]
25+
o: [1, 2, 3]
26+
flags: [-Wall, etc.]
27+
data: ["name" 23 args]
28+
bot: [1]
29+
curl: ["on", "off"]
30+
Example:
31+
32+
```
33+
34+
35+
```javascript
36+
await axios.post(`${API_BASE_URL}/addon/compile`, source_code, {
37+
headers: {
38+
"Content-Type": "text/plain",
39+
title: 'mi_file',
40+
standar: "c++17",
41+
o: "1",
42+
flags: "-Wall",
43+
data: "10 kevin",
44+
},
45+
});
46+
```
47+
48+
Download Source Code
49+
Downloads the provided source code.
50+
51+
Endpoint: POST /addon/download
52+
53+
Request Body:
54+
55+
```plaintext
56+
Rawbody:
57+
<source code>
58+
Headers:
59+
60+
Content-Type: text/plain
61+
title: [Some title]
62+
```
63+
64+
Example:
65+
66+
```javascript
67+
Copy code
68+
await axios.post(`${API_BASE_URL}/addon/download`, source_code, {
69+
headers: {
70+
"Content-Type": "text/plain",
71+
title: 'Some title',
72+
},
73+
});
74+
```
75+
Generate Assembly Code
76+
Generates assembly code for the provided source code.
77+
78+
Endpoint: POST /addon/assembly
79+
80+
Request Body:
81+
82+
```plaintext
83+
Copy code
84+
<source code>
85+
Headers:
86+
87+
Content-Type: text/plain
88+
title: [Some title]
89+
standar: [2a, 11, 14, 17]
90+
o: [1, 2, 3]
91+
flags: [-Wall, etc.]
92+
```
93+
Example:
94+
95+
```javascript
96+
Copy code
97+
await axios.post(`${API_BASE_URL}/addon/assembly`, source_code, {
98+
headers: {
99+
"Content-Type": "text/plain",
100+
title: 'some title',
101+
standar: "c++17",
102+
o: "1",
103+
flags: "-Wall",
104+
},
105+
});
106+
```
107+
108+
Notes
109+
Create a New Note
110+
Creates a new note.
111+
112+
Endpoint: POST /notes/new
113+
114+
Request Body:
115+
116+
```json
117+
Copy code
118+
{
119+
"nombre": "some name",
120+
"conten": "some content",
121+
"autor": "optional author"
122+
}
123+
```
124+
Example:
125+
126+
```javascript
127+
Copy code
128+
await axios.post(`${API_BASE_URL}/notes/new`, {
129+
"nombre": "some name",
130+
"conten": "some content",
131+
"autor": "kevin"
132+
});
133+
```
134+
Retrieve Notes
135+
Retrieves the notes.
136+
137+
Endpoint: GET /notes/recollector
138+
139+
Example:
140+
141+
```javascript
142+
Copy code
143+
await axios.get(`${API_BASE_URL}/notes/recollector`);
144+
```
145+
146+
Add Items to a Note
147+
Adds items to a note.
148+
149+
Endpoint: POST /notes/items
150+
151+
Example:
152+
153+
```javascript
154+
Copy code
155+
await axios.post(`${API_BASE_URL}/notes/items`);
156+
```
157+
Delete a Note
158+
Deletes a note by ID.
159+
160+
Endpoint: DELETE /notes/delete?id=[note_id]
161+
162+
Example:
163+
164+
```javascript
165+
Copy code
166+
await axios.delete(`${API_BASE_URL}/notes/delete?id=61205b1f4968e20016bc4be6`);
167+
```
168+
Retrieve a Note
169+
Retrieves a note by ID.
170+
171+
Endpoint: GET /notes/show?id=[note_id]
172+
173+
Example:
174+
175+
```javascript
176+
await axios.get(`${API_BASE_URL}/notes/show?id=61205b1f4968e20016bc4be6`);
177+
```
178+
179+
Retrieve the Last Note
180+
Retrieves the last note.
181+
182+
Endpoint: GET /notes/last
183+
184+
Example:
185+
186+
```javascript
187+
await axios.get(`${API_BASE_URL}/notes/last`);
188+
```
189+
190+
Crypto
191+
Generate SHA256 Hash
192+
Generates the SHA256 hash of the provided text.
193+
194+
Endpoint: GET /crypto/sha256?plain=[text]&dg=[hex or base64]
195+
196+
Example:
197+
198+
```javascript
199+
await axios.get(`${API_BASE_URL}/crypto/sha256?plain=SOME TEXT&dg=hex`);
200+
```

0 commit comments

Comments
 (0)