Skip to content
This repository was archived by the owner on Feb 15, 2025. It is now read-only.

Commit f880f57

Browse files
📖 Update README.md
1 parent 6385657 commit f880f57

File tree

1 file changed

+137
-82
lines changed

1 file changed

+137
-82
lines changed

README.md

+137-82
Original file line numberDiff line numberDiff line change
@@ -8,106 +8,156 @@ The Following documentation is related on how to use said API if you are looking
88
### Base URL
99
`http://localhost:3000`
1010

11-
### Authentication
11+
## 1. Auth
1212

13-
#### Request Authentication
13+
### 1.1 Request Authentication
1414

15-
**Endpoint:** `POST /request-auth`
15+
**Endpoint**
1616

17-
**Description:** Sends an authentication request to the renderer process in Electron.
17+
`POST /request-auth`
1818

19-
**Request:**
20-
- **Headers:** `Content-Type: application/json`
21-
- **Body:**
22-
```json
23-
{
24-
"platform": "your-platform",
25-
"id": "your-id"
26-
}
27-
```
19+
**Request Body**
2820

29-
**Example `curl` Command:**
30-
```bash
21+
```json
22+
{
23+
"id": "Your ID",
24+
"platform": "Platform",
25+
"auth": ["note:add", "note:delete", "label:add"]
26+
}
27+
```
28+
29+
**Curl Example**
30+
31+
```sh
3132
curl --location 'http://localhost:3000/request-auth' \
3233
--header 'Content-Type: application/json' \
3334
--data '{
34-
"platform": "your-platform",
35-
"id": "your-id"
35+
"id": "Your ID",
36+
"platform": "Platform",
37+
"auth": ["note:add", "note:delete", "label:add"]
3638
}'
3739
```
3840

39-
#### Verify Authentication
41+
**Response**
42+
43+
Success: request sent!
44+
45+
:::info
46+
Remember that the user will ultimately be in charge of choosing what the app can and cannot do, so make sure to handle cases where one of the 3 auth options is not available.
47+
:::
48+
49+
### 1.2 Confirm Authentication
50+
51+
**Endpoint**
4052

41-
**Endpoint:** `GET /confirm-auth`
53+
`GET /confirm-auth`
4254

43-
**Description:** Verifies the authentication token.
55+
**Request Body**
4456

45-
**Request:**
46-
- **Headers:**
47-
- `Authorization: Bearer your-token`
48-
- `Content-Type: application/json`
57+
```json
58+
{
59+
"id": "Your ID",
60+
"platform": "Platform"
61+
}
62+
```
63+
64+
**Curl Example**
4965

50-
**Example `curl` Command:**
51-
```bash
66+
```sh
5267
curl --location --request GET 'http://localhost:3000/confirm-auth' \
5368
--header 'Authorization: Bearer your-token' \
5469
--header 'Content-Type: application/json' \
5570
--data '{
56-
"platform": "your-platform",
57-
"id": "your-id"
58-
}'
71+
"platform": "Platform",
72+
"id": "Your ID"
73+
}'
5974
```
6075

61-
### Notes Management
62-
63-
#### Add Note
64-
65-
**Endpoint:** `POST /add-note`
66-
67-
**Description:** Adds a new note and broadcasts it to all connected clients.
76+
**Response**
77+
78+
Success: passed
79+
80+
## 2. Create a New Note
81+
82+
**Endpoint**
83+
84+
`POST /add-note`
85+
86+
**Request Body**
87+
88+
```json
89+
{
90+
"id": "note.id",
91+
"title": "Your Title",
92+
"content": {
93+
"type": "doc",
94+
"content": [
95+
{
96+
"type": "paragraph",
97+
"content": [
98+
{
99+
"type": "text",
100+
"text": "This is a sample note content."
101+
}
102+
]
103+
}
104+
]
105+
},
106+
"labels": [],
107+
"isBookmarked": false,
108+
"isArchived": false
109+
}
110+
```
68111

69-
**Request:**
70-
- **Headers:**
71-
- `Authorization: Bearer your-token`
72-
- `Content-Type: application/json`
73-
- **Body:**
74-
```json
75-
{
76-
"title": "Sample Note",
77-
"content": "This is a sample note content."
78-
}
79-
```
112+
**Curl Example**
80113

81-
**Example `curl` Command:**
82-
```bash
114+
```sh
83115
curl --location 'http://localhost:3000/add-note' \
84116
--header 'Authorization: Bearer your-token' \
85117
--header 'Content-Type: application/json' \
86118
--data '{
119+
"id": "test1",
87120
"title": "Sample Note",
88-
"content": "This is a sample note content."
121+
"content": {
122+
"type": "doc",
123+
"content": [
124+
{
125+
"type": "paragraph",
126+
"content": [
127+
{
128+
"type": "text",
129+
"text": "This is a sample note content."
130+
}
131+
]
132+
}
133+
]
134+
},
135+
"isBookmarked": false,
136+
"isArchived": false
89137
}'
90138
```
91139

92-
#### Delete Note
140+
**Response**
93141

94-
**Endpoint:** `POST /delete-note`
142+
Success: Creating Note
95143

96-
**Description:** Deletes a note and broadcasts the deletion to all connected clients.
144+
## 3. Delete a Note
97145

98-
**Request:**
99-
- **Headers:**
100-
- `Authorization: Bearer your-token`
101-
- `Content-Type: application/json`
102-
- **Body:**
103-
```json
104-
{
105-
"id": "note-id"
106-
}
107-
```
146+
**Endpoint**
147+
148+
`POST /delete-note`
149+
150+
**Request Body**
151+
152+
```json
153+
{
154+
"id": "note-id"
155+
}
156+
```
157+
158+
**Curl Example**
108159

109-
**Example `curl` Command:**
110-
```bash
160+
```sh
111161
curl --location 'http://localhost:3000/delete-note' \
112162
--header 'Authorization: Bearer your-token' \
113163
--header 'Content-Type: application/json' \
@@ -116,32 +166,37 @@ curl --location 'http://localhost:3000/delete-note' \
116166
}'
117167
```
118168

119-
#### Add Label to Note
169+
**Response**
120170

121-
**Endpoint:** `POST /add-label`
171+
Success: Deleting Note
122172

123-
**Description:** Adds a label to a note and broadcasts the update to all connected clients.
173+
## 4. Add a Label
124174

125-
**Request:**
126-
- **Headers:**
127-
- `Authorization: Bearer your-token`
128-
- `Content-Type: application/json`
129-
- **Body:**
130-
```json
131-
{
132-
"id": "note-id",
133-
"labelId": "label-id"
134-
}
135-
```
175+
**Endpoint**
176+
177+
`POST /add-label`
136178

137-
**Example `curl` Command:**
138-
```bash
179+
**Request Body**
180+
181+
```json
182+
{
183+
"id": "note-id",
184+
"labelId": "label-content"
185+
}
186+
```
187+
188+
**Curl Example**
189+
190+
```sh
139191
curl --location 'http://localhost:3000/add-label' \
140192
--header 'Authorization: Bearer your-token' \
141193
--header 'Content-Type: application/json' \
142194
--data '{
143195
"id": "note-id",
144-
"labelId": "label-id"
196+
"labelId": "label-content"
145197
}'
146198
```
147199

200+
**Response**
201+
202+
Success: Adding Label

0 commit comments

Comments
 (0)