sidechat.js 2.3.8 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/classes/SidechatAPIClient.d.ts +15 -1
- package/dist/classes/SidechatAPIClient.d.ts.map +1 -1
- package/dist/index.cjs +95 -91
- package/dist/index.mjs +95 -91
- package/docs/sidechat.js/2.4.0/SidechatAPIClient.html +3 -0
- package/docs/sidechat.js/{2.3.8 → 2.4.0}/classes_SidechatAPIClient.js.html +95 -91
- package/docs/sidechat.js/2.4.0/data/search.json +1 -0
- package/package.json +1 -1
- package/src/classes/SidechatAPIClient.js +95 -91
- package/src/tests/postTest.js +2 -1
- package/docs/sidechat.js/2.3.8/SidechatAPIClient.html +0 -3
- package/docs/sidechat.js/2.3.8/data/search.json +0 -1
- /package/docs/sidechat.js/{2.3.8 → 2.4.0}/SidechatAPIError.html +0 -0
- /package/docs/sidechat.js/{2.3.8 → 2.4.0}/SidechatColorList.html +0 -0
- /package/docs/sidechat.js/{2.3.8 → 2.4.0}/classes_SidechatAPIError.js.html +0 -0
- /package/docs/sidechat.js/{2.3.8 → 2.4.0}/classes_SidechatColorList.js.html +0 -0
- /package/docs/sidechat.js/{2.3.8 → 2.4.0}/fonts/Inconsolata-Regular.ttf +0 -0
- /package/docs/sidechat.js/{2.3.8 → 2.4.0}/fonts/OpenSans-Regular.ttf +0 -0
- /package/docs/sidechat.js/{2.3.8 → 2.4.0}/fonts/WorkSans-Bold.ttf +0 -0
- /package/docs/sidechat.js/{2.3.8 → 2.4.0}/global.html +0 -0
- /package/docs/sidechat.js/{2.3.8 → 2.4.0}/index.html +0 -0
- /package/docs/sidechat.js/{2.3.8 → 2.4.0}/scripts/core.js +0 -0
- /package/docs/sidechat.js/{2.3.8 → 2.4.0}/scripts/core.min.js +0 -0
- /package/docs/sidechat.js/{2.3.8 → 2.4.0}/scripts/resize.js +0 -0
- /package/docs/sidechat.js/{2.3.8 → 2.4.0}/scripts/search.js +0 -0
- /package/docs/sidechat.js/{2.3.8 → 2.4.0}/scripts/search.min.js +0 -0
- /package/docs/sidechat.js/{2.3.8 → 2.4.0}/scripts/third-party/Apache-License-2.0.txt +0 -0
- /package/docs/sidechat.js/{2.3.8 → 2.4.0}/scripts/third-party/fuse.js +0 -0
- /package/docs/sidechat.js/{2.3.8 → 2.4.0}/scripts/third-party/hljs-line-num-original.js +0 -0
- /package/docs/sidechat.js/{2.3.8 → 2.4.0}/scripts/third-party/hljs-line-num.js +0 -0
- /package/docs/sidechat.js/{2.3.8 → 2.4.0}/scripts/third-party/hljs-original.js +0 -0
- /package/docs/sidechat.js/{2.3.8 → 2.4.0}/scripts/third-party/hljs.js +0 -0
- /package/docs/sidechat.js/{2.3.8 → 2.4.0}/scripts/third-party/popper.js +0 -0
- /package/docs/sidechat.js/{2.3.8 → 2.4.0}/scripts/third-party/tippy.js +0 -0
- /package/docs/sidechat.js/{2.3.8 → 2.4.0}/scripts/third-party/tocbot.js +0 -0
- /package/docs/sidechat.js/{2.3.8 → 2.4.0}/scripts/third-party/tocbot.min.js +0 -0
- /package/docs/sidechat.js/{2.3.8 → 2.4.0}/styles/clean-jsdoc-theme-base.css +0 -0
- /package/docs/sidechat.js/{2.3.8 → 2.4.0}/styles/clean-jsdoc-theme-dark.css +0 -0
- /package/docs/sidechat.js/{2.3.8 → 2.4.0}/styles/clean-jsdoc-theme-light.css +0 -0
- /package/docs/sidechat.js/{2.3.8 → 2.4.0}/styles/clean-jsdoc-theme.min.css +0 -0
- /package/docs/sidechat.js/{2.3.8 → 2.4.0}/tutorial-Authentication.html +0 -0
- /package/docs/sidechat.js/{2.3.8 → 2.4.0}/tutorial-Email Registration.html +0 -0
- /package/docs/sidechat.js/{2.3.8 → 2.4.0}/types_SidechatTypes.js.html +0 -0
|
@@ -8,8 +8,9 @@ declare class SidechatAPIClient {
|
|
|
8
8
|
/**
|
|
9
9
|
* Create a new instance of the API client
|
|
10
10
|
* @param {SidechatAuthToken} [token] - user bearer token
|
|
11
|
+
* @param {String} rootUrl - custom API root URL for mocking or using other server
|
|
11
12
|
*/
|
|
12
|
-
constructor(token?: SidechatAuthToken);
|
|
13
|
+
constructor(token?: SidechatAuthToken, rootUrl?: string);
|
|
13
14
|
/**
|
|
14
15
|
* User bearer token
|
|
15
16
|
* @type {SidechatAuthToken}
|
|
@@ -22,12 +23,25 @@ declare class SidechatAPIClient {
|
|
|
22
23
|
* @constant
|
|
23
24
|
*/
|
|
24
25
|
defaultHeaders: any;
|
|
26
|
+
/**
|
|
27
|
+
* Root URL for every API request
|
|
28
|
+
* @type {String}
|
|
29
|
+
* @default "https://api.sidechat.lol"
|
|
30
|
+
*/
|
|
31
|
+
apiRoot: string;
|
|
25
32
|
/**
|
|
26
33
|
* Manually set the currently signed in user's token. Generally try to avoid this and instead either pass a token to the constructor or login automatically through the auth functions
|
|
27
34
|
* @method
|
|
28
35
|
* @param {SidechatAuthToken} token - user bearer token
|
|
29
36
|
*/
|
|
30
37
|
setToken: (token: SidechatAuthToken) => void;
|
|
38
|
+
/**
|
|
39
|
+
* Manually set the root URL for all API requests. This can be used for mocking requests or redirecting them to a different server
|
|
40
|
+
* @method
|
|
41
|
+
* @param {String} url - new root URL to set
|
|
42
|
+
* @since 2.3.9
|
|
43
|
+
*/
|
|
44
|
+
setAPIRoot: (url: string) => void;
|
|
31
45
|
/**
|
|
32
46
|
* Initiate the login process with a phone number. Should be followed up with verifySMSCode().
|
|
33
47
|
* @method
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SidechatAPIClient.d.ts","sourceRoot":"","sources":["../../src/classes/SidechatAPIClient.js"],"names":[],"mappings":";AAGA;;;;GAIG;AACH;
|
|
1
|
+
{"version":3,"file":"SidechatAPIClient.d.ts","sourceRoot":"","sources":["../../src/classes/SidechatAPIClient.js"],"names":[],"mappings":";AAGA;;;;GAIG;AACH;IA2BE;;;;OAIG;IACH,yDAOC;IAtCD;;;SAGK;IACL,6BAAU;IAEV;;;;;OAKG;IACH,oBAKE;IAEF;;;;OAIG;IACH,gBAAqC;IAgBrC;;;;OAIG;IACH,6CAEE;IAEF;;;;;OAKG;IACH,kCAEE;IAEF;;;;;OAKG;IACH,mDAgBE;IAEF;;;;;;OAMG;IACH,mEAmBE;IAEF;;;;;;OAMG;IACH,8DAsBE;IAEF;;;;;;OAMG;IACH,+CAwBE;IAEF;;;;OAIG;IACH,2CAsBE;IAEF;;;;;OAKG;IACH,6CAwBE;IAEF;;;;;;OAMG;IACH,oDAGE;IAEF;;;;;OAKG;IACH,+CAqBE;IAEF;;;;;;;;OAQG;IACH,4CAJW,KAAK,GAAC,QAAQ,GAAC,KAAK,2DA2B7B;IAEF;;;;;;OAMG;IACH,sEAsBE;IAEF;;;;;;;OAOG;IACH,6EAqBE;IAEF;;;;;;OAMG;IACH,8BAHW,OAAO,GAAC,UAAU,KAChB,uBAAuB,CAyBlC;IAEF;;;;;;OAMG;IACH,qCAFa,uBAAuB,CAqElC;IAEF;;;;;;OAMG;IACH,2CAFa,eAAe,CAqB1B;IAEF;;;;;OAKG;IACH,uBAFa,sBAAsB,CAoBjC;IAEF;;;;;OAKG;IACH,0CAkBE;IAEF;;;;;;OAMG;IACH,sDAkBE;IAEF;;;;;;OAMG;IACH,yEAwBE;IAEF;;;;;;;;;;;OAWG;IACH,0GAJW,qBAAqB,iDAsC9B;IAEF;;;;;;;;;;;OAWG;IACH,wDANW,qBAAqB,iGAyC9B;IAEF;;;;;OAKG;IACH,+DAqBE;IAEF;;;;;;;;OAQG;IACH,2GA2BE;IAEF;;;;;;OAMG;IACH,6CAwBE;IAEF;;;;;;OAMG;IACH,gEAqBE;IAEF;;;;;OAKG;IACH,mDAqBE;IAEF;;;;OAIG;IACH,kCAkBE;IAEF;;;;OAIG;IACH,wHAiCE;CACH"}
|
package/dist/index.cjs
CHANGED
|
@@ -25,6 +25,7 @@ class SidechatAPIClient {
|
|
|
25
25
|
* @type {SidechatAuthToken}
|
|
26
26
|
* */
|
|
27
27
|
userToken;
|
|
28
|
+
|
|
28
29
|
/**
|
|
29
30
|
* Default headers for every API request
|
|
30
31
|
* @type {Object}
|
|
@@ -38,14 +39,25 @@ class SidechatAPIClient {
|
|
|
38
39
|
Dnt: 1,
|
|
39
40
|
};
|
|
40
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Root URL for every API request
|
|
44
|
+
* @type {String}
|
|
45
|
+
* @default "https://api.sidechat.lol"
|
|
46
|
+
*/
|
|
47
|
+
apiRoot = "https://api.sidechat.lol";
|
|
48
|
+
|
|
41
49
|
/**
|
|
42
50
|
* Create a new instance of the API client
|
|
43
51
|
* @param {SidechatAuthToken} [token] - user bearer token
|
|
52
|
+
* @param {String} rootUrl - custom API root URL for mocking or using other server
|
|
44
53
|
*/
|
|
45
|
-
constructor(token = "") {
|
|
54
|
+
constructor(token = "", rootUrl = "") {
|
|
46
55
|
if (token) {
|
|
47
56
|
this.userToken = token;
|
|
48
57
|
}
|
|
58
|
+
if (rootUrl) {
|
|
59
|
+
this.apiRoot = rootUrl;
|
|
60
|
+
}
|
|
49
61
|
}
|
|
50
62
|
|
|
51
63
|
/**
|
|
@@ -57,6 +69,16 @@ class SidechatAPIClient {
|
|
|
57
69
|
this.userToken = token;
|
|
58
70
|
};
|
|
59
71
|
|
|
72
|
+
/**
|
|
73
|
+
* Manually set the root URL for all API requests. This can be used for mocking requests or redirecting them to a different server
|
|
74
|
+
* @method
|
|
75
|
+
* @param {String} url - new root URL to set
|
|
76
|
+
* @since 2.3.9
|
|
77
|
+
*/
|
|
78
|
+
setAPIRoot = (url) => {
|
|
79
|
+
this.apiRoot = url;
|
|
80
|
+
};
|
|
81
|
+
|
|
60
82
|
/**
|
|
61
83
|
* Initiate the login process with a phone number. Should be followed up with verifySMSCode().
|
|
62
84
|
* @method
|
|
@@ -65,7 +87,7 @@ class SidechatAPIClient {
|
|
|
65
87
|
*/
|
|
66
88
|
loginViaSMS = async (phoneNumber) => {
|
|
67
89
|
try {
|
|
68
|
-
const res = await fetch(
|
|
90
|
+
const res = await fetch(`${this.apiRoot}/v1/login_register`, {
|
|
69
91
|
method: "POST",
|
|
70
92
|
headers: this.defaultHeaders,
|
|
71
93
|
body: JSON.stringify({
|
|
@@ -90,17 +112,14 @@ class SidechatAPIClient {
|
|
|
90
112
|
*/
|
|
91
113
|
verifySMSCode = async (phoneNumber, code) => {
|
|
92
114
|
try {
|
|
93
|
-
const res = await fetch(
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}),
|
|
102
|
-
}
|
|
103
|
-
);
|
|
115
|
+
const res = await fetch(`${this.apiRoot}/v1/verify_phone_number`, {
|
|
116
|
+
method: "POST",
|
|
117
|
+
headers: this.defaultHeaders,
|
|
118
|
+
body: JSON.stringify({
|
|
119
|
+
phone_number: `+1${phoneNumber}`,
|
|
120
|
+
code: code.toUpperCase(),
|
|
121
|
+
}),
|
|
122
|
+
});
|
|
104
123
|
const json = await res.json();
|
|
105
124
|
if (json?.logged_in_user?.token) {
|
|
106
125
|
this.userToken = json.logged_in_user.token;
|
|
@@ -124,17 +143,14 @@ class SidechatAPIClient {
|
|
|
124
143
|
throw new SidechatAPIError("You're too young to use Offsides.");
|
|
125
144
|
}
|
|
126
145
|
try {
|
|
127
|
-
const res = await fetch(
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}),
|
|
136
|
-
}
|
|
137
|
-
);
|
|
146
|
+
const res = await fetch(`${this.apiRoot}/v1/complete_registration`, {
|
|
147
|
+
method: "POST",
|
|
148
|
+
headers: this.defaultHeaders,
|
|
149
|
+
body: JSON.stringify({
|
|
150
|
+
age: Number(age),
|
|
151
|
+
registration_id: registrationID,
|
|
152
|
+
}),
|
|
153
|
+
});
|
|
138
154
|
const json = await res.json();
|
|
139
155
|
if (json.token) {
|
|
140
156
|
this.userToken = json.token;
|
|
@@ -158,19 +174,16 @@ class SidechatAPIClient {
|
|
|
158
174
|
throw new SidechatAPIError("User is not authenticated.");
|
|
159
175
|
}
|
|
160
176
|
try {
|
|
161
|
-
const res = await fetch(
|
|
162
|
-
|
|
163
|
-
{
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}),
|
|
172
|
-
}
|
|
173
|
-
);
|
|
177
|
+
const res = await fetch(`${this.apiRoot}/v2/users/register_email`, {
|
|
178
|
+
method: "POST",
|
|
179
|
+
headers: {
|
|
180
|
+
...this.defaultHeaders,
|
|
181
|
+
Authorization: `Bearer ${this.userToken}`,
|
|
182
|
+
},
|
|
183
|
+
body: JSON.stringify({
|
|
184
|
+
email: email,
|
|
185
|
+
}),
|
|
186
|
+
});
|
|
174
187
|
const json = await res.json();
|
|
175
188
|
if (json.message) {
|
|
176
189
|
throw new SidechatAPIError(json.message);
|
|
@@ -192,16 +205,13 @@ class SidechatAPIClient {
|
|
|
192
205
|
throw new SidechatAPIError("User is not authenticated.");
|
|
193
206
|
}
|
|
194
207
|
try {
|
|
195
|
-
const res = await fetch(
|
|
196
|
-
|
|
197
|
-
{
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
},
|
|
203
|
-
}
|
|
204
|
-
);
|
|
208
|
+
const res = await fetch(`${this.apiRoot}/v1/users/check_email_verified`, {
|
|
209
|
+
method: "GET",
|
|
210
|
+
headers: {
|
|
211
|
+
...this.defaultHeaders,
|
|
212
|
+
Authorization: `Bearer ${this.userToken}`,
|
|
213
|
+
},
|
|
214
|
+
});
|
|
205
215
|
const json = await res.json();
|
|
206
216
|
if (json.verified_email_updates_response) {
|
|
207
217
|
return json.verified_email_updates_response;
|
|
@@ -225,21 +235,18 @@ class SidechatAPIClient {
|
|
|
225
235
|
throw new SidechatAPIError("User is not authenticated.");
|
|
226
236
|
}
|
|
227
237
|
try {
|
|
228
|
-
const res = await fetch(
|
|
229
|
-
|
|
230
|
-
{
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
}),
|
|
241
|
-
}
|
|
242
|
-
);
|
|
238
|
+
const res = await fetch(`${this.apiRoot}/v1/register_device_token`, {
|
|
239
|
+
method: "POST",
|
|
240
|
+
headers: {
|
|
241
|
+
...this.defaultHeaders,
|
|
242
|
+
Authorization: `Bearer ${this.userToken}`,
|
|
243
|
+
},
|
|
244
|
+
body: JSON.stringify({
|
|
245
|
+
build_type: "release",
|
|
246
|
+
bundle_id: "com.flowerave.sidechat",
|
|
247
|
+
device_token: deviceID,
|
|
248
|
+
}),
|
|
249
|
+
});
|
|
243
250
|
const json = await res.json();
|
|
244
251
|
await AsyncStorage.setItem("deviceID", deviceID);
|
|
245
252
|
return json;
|
|
@@ -273,7 +280,7 @@ class SidechatAPIClient {
|
|
|
273
280
|
}
|
|
274
281
|
try {
|
|
275
282
|
const res = await fetch(
|
|
276
|
-
|
|
283
|
+
`${this.apiRoot}/v1/updates?group_id=${groupID}`,
|
|
277
284
|
{
|
|
278
285
|
method: "GET",
|
|
279
286
|
headers: {
|
|
@@ -305,7 +312,7 @@ class SidechatAPIClient {
|
|
|
305
312
|
}
|
|
306
313
|
try {
|
|
307
314
|
const res = await fetch(
|
|
308
|
-
|
|
315
|
+
`${this.apiRoot}/v1/posts?group_id=${groupID}&type=${category}${
|
|
309
316
|
cursor ? "&cursor=" + cursor : ""
|
|
310
317
|
}`,
|
|
311
318
|
{
|
|
@@ -336,7 +343,7 @@ class SidechatAPIClient {
|
|
|
336
343
|
throw new SidechatAPIError("User is not authenticated.");
|
|
337
344
|
}
|
|
338
345
|
try {
|
|
339
|
-
const res = await fetch(
|
|
346
|
+
const res = await fetch(`${this.apiRoot}/v1/posts/set_vote`, {
|
|
340
347
|
method: "POST",
|
|
341
348
|
headers: {
|
|
342
349
|
...this.defaultHeaders,
|
|
@@ -369,7 +376,7 @@ class SidechatAPIClient {
|
|
|
369
376
|
}
|
|
370
377
|
try {
|
|
371
378
|
const res = await fetch(
|
|
372
|
-
|
|
379
|
+
`${this.apiRoot}/v1/posts/get?include_deleted=${includeDeleted}&post_id=${postID}`,
|
|
373
380
|
{
|
|
374
381
|
method: "GET",
|
|
375
382
|
headers: {
|
|
@@ -403,16 +410,13 @@ class SidechatAPIClient {
|
|
|
403
410
|
contentType = "my_comments";
|
|
404
411
|
}
|
|
405
412
|
try {
|
|
406
|
-
const res = await fetch(
|
|
407
|
-
|
|
408
|
-
{
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
},
|
|
414
|
-
}
|
|
415
|
-
);
|
|
413
|
+
const res = await fetch(`${this.apiRoot}/v1/posts&type=${contentType}`, {
|
|
414
|
+
method: "GET",
|
|
415
|
+
headers: {
|
|
416
|
+
...this.defaultHeaders,
|
|
417
|
+
Authorization: `Bearer ${this.userToken}`,
|
|
418
|
+
},
|
|
419
|
+
});
|
|
416
420
|
const json = await res.json();
|
|
417
421
|
return json.posts;
|
|
418
422
|
} catch (err) {
|
|
@@ -434,7 +438,7 @@ class SidechatAPIClient {
|
|
|
434
438
|
}
|
|
435
439
|
try {
|
|
436
440
|
const res = await fetch(
|
|
437
|
-
|
|
441
|
+
`${this.apiRoot}/v1/posts/comments/?post_id=${postID}`,
|
|
438
442
|
{
|
|
439
443
|
method: "GET",
|
|
440
444
|
headers: {
|
|
@@ -509,7 +513,7 @@ class SidechatAPIClient {
|
|
|
509
513
|
throw new SidechatAPIError("User is not authenticated.");
|
|
510
514
|
}
|
|
511
515
|
try {
|
|
512
|
-
const res = await fetch(
|
|
516
|
+
const res = await fetch(`${this.apiRoot}/v1/groups/explore`, {
|
|
513
517
|
method: "GET",
|
|
514
518
|
headers: {
|
|
515
519
|
...this.defaultHeaders,
|
|
@@ -536,7 +540,7 @@ class SidechatAPIClient {
|
|
|
536
540
|
throw new SidechatAPIError("User is not authenticated.");
|
|
537
541
|
}
|
|
538
542
|
try {
|
|
539
|
-
const res = await fetch(
|
|
543
|
+
const res = await fetch(`${this.apiRoot}/v1/assets/library`, {
|
|
540
544
|
method: "GET",
|
|
541
545
|
headers: {
|
|
542
546
|
...this.defaultHeaders,
|
|
@@ -562,7 +566,7 @@ class SidechatAPIClient {
|
|
|
562
566
|
throw new SidechatAPIError("User is not authenticated.");
|
|
563
567
|
}
|
|
564
568
|
try {
|
|
565
|
-
const res = await fetch(
|
|
569
|
+
const res = await fetch(`${this.apiRoot}/v1/users/me`, {
|
|
566
570
|
method: "GET",
|
|
567
571
|
headers: {
|
|
568
572
|
...this.defaultHeaders,
|
|
@@ -589,7 +593,7 @@ class SidechatAPIClient {
|
|
|
589
593
|
throw new SidechatAPIError("User is not authenticated.");
|
|
590
594
|
}
|
|
591
595
|
try {
|
|
592
|
-
const res = await fetch(
|
|
596
|
+
const res = await fetch(`${this.apiRoot}/v1/groups/${groupID}`, {
|
|
593
597
|
method: "GET",
|
|
594
598
|
headers: {
|
|
595
599
|
...this.defaultHeaders,
|
|
@@ -617,7 +621,7 @@ class SidechatAPIClient {
|
|
|
617
621
|
}
|
|
618
622
|
try {
|
|
619
623
|
const res = await fetch(
|
|
620
|
-
|
|
624
|
+
`${this.apiRoot}/v1/groups/${isMember ? "join" : "leave"}`,
|
|
621
625
|
{
|
|
622
626
|
method: "POST",
|
|
623
627
|
headers: {
|
|
@@ -661,7 +665,7 @@ class SidechatAPIClient {
|
|
|
661
665
|
throw new SidechatAPIError("User is not authenticated.");
|
|
662
666
|
}
|
|
663
667
|
try {
|
|
664
|
-
const res = await fetch(
|
|
668
|
+
const res = await fetch(`${this.apiRoot}/v1/posts`, {
|
|
665
669
|
method: "POST",
|
|
666
670
|
headers: {
|
|
667
671
|
...this.defaultHeaders,
|
|
@@ -709,7 +713,7 @@ class SidechatAPIClient {
|
|
|
709
713
|
throw new SidechatAPIError("User is not authenticated.");
|
|
710
714
|
}
|
|
711
715
|
try {
|
|
712
|
-
const res = await fetch(
|
|
716
|
+
const res = await fetch(`${this.apiRoot}/v1/posts`, {
|
|
713
717
|
method: "POST",
|
|
714
718
|
headers: {
|
|
715
719
|
...this.defaultHeaders,
|
|
@@ -745,7 +749,7 @@ class SidechatAPIClient {
|
|
|
745
749
|
throw new SidechatAPIError("User is not authenticated.");
|
|
746
750
|
}
|
|
747
751
|
try {
|
|
748
|
-
const res = await fetch(
|
|
752
|
+
const res = await fetch(`${this.apiRoot}/v1/posts/delete`, {
|
|
749
753
|
method: "POST",
|
|
750
754
|
headers: {
|
|
751
755
|
...this.defaultHeaders,
|
|
@@ -777,7 +781,7 @@ class SidechatAPIClient {
|
|
|
777
781
|
throw new SidechatAPIError("User is not authenticated.");
|
|
778
782
|
}
|
|
779
783
|
try {
|
|
780
|
-
const res = await fetch(
|
|
784
|
+
const res = await fetch(`${this.apiRoot}/v1/users/${userID}`, {
|
|
781
785
|
method: "PATCH",
|
|
782
786
|
headers: {
|
|
783
787
|
...this.defaultHeaders,
|
|
@@ -814,7 +818,7 @@ class SidechatAPIClient {
|
|
|
814
818
|
}
|
|
815
819
|
try {
|
|
816
820
|
const res = await fetch(
|
|
817
|
-
|
|
821
|
+
`${this.apiRoot}/v1/users/username?username=${username}`,
|
|
818
822
|
{
|
|
819
823
|
method: "GET",
|
|
820
824
|
headers: {
|
|
@@ -846,7 +850,7 @@ class SidechatAPIClient {
|
|
|
846
850
|
throw new SidechatAPIError("User is not authenticated.");
|
|
847
851
|
}
|
|
848
852
|
try {
|
|
849
|
-
const res = await fetch(
|
|
853
|
+
const res = await fetch(`${this.apiRoot}/v1/users/${userID}`, {
|
|
850
854
|
method: "PATCH",
|
|
851
855
|
headers: {
|
|
852
856
|
...this.defaultHeaders,
|
|
@@ -875,7 +879,7 @@ class SidechatAPIClient {
|
|
|
875
879
|
throw new SidechatAPIError("User is not authenticated.");
|
|
876
880
|
}
|
|
877
881
|
try {
|
|
878
|
-
const res = await fetch(
|
|
882
|
+
const res = await fetch(`${this.apiRoot}/v1/activity/seen`, {
|
|
879
883
|
method: "POST",
|
|
880
884
|
headers: {
|
|
881
885
|
...this.defaultHeaders,
|
|
@@ -903,7 +907,7 @@ class SidechatAPIClient {
|
|
|
903
907
|
throw new SidechatAPIError("User is not authenticated.");
|
|
904
908
|
}
|
|
905
909
|
try {
|
|
906
|
-
const res = await fetch(
|
|
910
|
+
const res = await fetch(`${this.apiRoot}/v1/chats/explore`, {
|
|
907
911
|
method: "GET",
|
|
908
912
|
headers: {
|
|
909
913
|
...this.defaultHeaders,
|
|
@@ -934,7 +938,7 @@ class SidechatAPIClient {
|
|
|
934
938
|
throw new SidechatAPIError("User is not authenticated.");
|
|
935
939
|
}
|
|
936
940
|
try {
|
|
937
|
-
const res = await fetch(
|
|
941
|
+
const res = await fetch(`${this.apiRoot}/v1/chats/groups/join`, {
|
|
938
942
|
method: "GET",
|
|
939
943
|
headers: {
|
|
940
944
|
...this.defaultHeaders,
|