moeralib 0.15.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.
Files changed (80) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +8 -0
  3. package/lib/naming/index.js +14 -0
  4. package/lib/naming/naming.js +203 -0
  5. package/lib/naming/schemas.mjs +184 -0
  6. package/lib/naming/types.js +2 -0
  7. package/lib/naming/validate.js +9 -0
  8. package/lib/naming/validators.js +2065 -0
  9. package/lib/node/caller.js +267 -0
  10. package/lib/node/cartes.js +55 -0
  11. package/lib/node/index.js +13 -0
  12. package/lib/node/node.js +1405 -0
  13. package/lib/node/schemas.mjs +4582 -0
  14. package/lib/node/types.js +3 -0
  15. package/lib/node/validate.js +9 -0
  16. package/lib/node/validators.js +60225 -0
  17. package/lib/schema.js +20 -0
  18. package/lib/schemas-compile.mjs +42 -0
  19. package/lib/universal-location.js +164 -0
  20. package/lib/util.js +42 -0
  21. package/nodejs-moera-api/nodejs-moera-api +4 -0
  22. package/nodejs-moera-api/nodejsmoeraapi.py +578 -0
  23. package/package.json +65 -0
  24. package/src/naming/index.ts +12 -0
  25. package/src/naming/naming.ts +234 -0
  26. package/src/naming/schemas.mjs +194 -0
  27. package/src/naming/types.ts +39 -0
  28. package/src/naming/validate.ts +6 -0
  29. package/src/naming/validators.d.ts +3 -0
  30. package/src/naming/validators.js +2084 -0
  31. package/src/node/caller.ts +311 -0
  32. package/src/node/cartes.ts +51 -0
  33. package/src/node/index.ts +3 -0
  34. package/src/node/node.ts +1285 -0
  35. package/src/node/schemas.mjs +4715 -0
  36. package/src/node/types.ts +1544 -0
  37. package/src/node/validate.ts +6 -0
  38. package/src/node/validators.d.ts +3 -0
  39. package/src/node/validators.js +60484 -0
  40. package/src/schema.ts +30 -0
  41. package/src/schemas-compile.mjs +51 -0
  42. package/src/universal-location.ts +212 -0
  43. package/src/util.ts +42 -0
  44. package/tsconfig.json +112 -0
  45. package/typings/naming/index.d.ts +2 -0
  46. package/typings/naming/index.d.ts.map +1 -0
  47. package/typings/naming/naming.d.ts +31 -0
  48. package/typings/naming/naming.d.ts.map +1 -0
  49. package/typings/naming/schemas.d.mts +271 -0
  50. package/typings/naming/schemas.d.mts.map +1 -0
  51. package/typings/naming/types.d.ts +35 -0
  52. package/typings/naming/types.d.ts.map +1 -0
  53. package/typings/naming/validate.d.ts +3 -0
  54. package/typings/naming/validate.d.ts.map +1 -0
  55. package/typings/naming/validators.d.ts +73 -0
  56. package/typings/naming/validators.d.ts.map +1 -0
  57. package/typings/node/caller.d.ts +52 -0
  58. package/typings/node/caller.d.ts.map +1 -0
  59. package/typings/node/cartes.d.ts +13 -0
  60. package/typings/node/cartes.d.ts.map +1 -0
  61. package/typings/node/index.d.ts +4 -0
  62. package/typings/node/index.d.ts.map +1 -0
  63. package/typings/node/node.d.ts +176 -0
  64. package/typings/node/node.d.ts.map +1 -0
  65. package/typings/node/schemas.d.mts +6205 -0
  66. package/typings/node/schemas.d.mts.map +1 -0
  67. package/typings/node/types.d.ts +1340 -0
  68. package/typings/node/types.d.ts.map +1 -0
  69. package/typings/node/validate.d.ts +3 -0
  70. package/typings/node/validate.d.ts.map +1 -0
  71. package/typings/node/validators.d.ts +920 -0
  72. package/typings/node/validators.d.ts.map +1 -0
  73. package/typings/schema.d.ts +18 -0
  74. package/typings/schema.d.ts.map +1 -0
  75. package/typings/schemas-compile.d.mts +2 -0
  76. package/typings/schemas-compile.d.mts.map +1 -0
  77. package/typings/universal-location.d.ts +25 -0
  78. package/typings/universal-location.d.ts.map +1 -0
  79. package/typings/util.d.ts +6 -0
  80. package/typings/util.d.ts.map +1 -0
@@ -0,0 +1,1285 @@
1
+ // This file is generated
2
+
3
+ import { Caller } from "./caller";
4
+ import * as API from "./types";
5
+ import { commaSeparatedFlags, ut } from "../util";
6
+
7
+ export class MoeraNode extends Caller {
8
+
9
+ constructor(nodeUrl: string | null = null) {
10
+ super();
11
+ if (nodeUrl != null) {
12
+ this.nodeUrl(nodeUrl);
13
+ }
14
+ }
15
+
16
+ async searchActivityReactions(filter: API.ActivityReactionFilter): Promise<API.ActivityReactionInfo[]> {
17
+ const location = "/activity/reactions/search";
18
+ return await this.call("searchActivityReactions", location, {
19
+ method: "POST", body: filter, schema: "ActivityReactionInfoArray"
20
+ }) as API.ActivityReactionInfo[];
21
+ }
22
+
23
+ async getRemotePostingVerificationStatus(id: string): Promise<API.RemotePostingVerificationInfo> {
24
+ const location = ut`/async-operations/remote-posting-verification/${id}`;
25
+ return await this.call("getRemotePostingVerificationStatus", location, {
26
+ method: "GET", schema: "RemotePostingVerificationInfo"
27
+ }) as API.RemotePostingVerificationInfo;
28
+ }
29
+
30
+ async getRemoteReactionVerificationStatus(id: string): Promise<API.RemoteReactionVerificationInfo> {
31
+ const location = ut`/async-operations/remote-reaction-verification/${id}`;
32
+ return await this.call("getRemoteReactionVerificationStatus", location, {
33
+ method: "GET", schema: "RemoteReactionVerificationInfo"
34
+ }) as API.RemoteReactionVerificationInfo;
35
+ }
36
+
37
+ async getAvatars(): Promise<API.AvatarInfo[]> {
38
+ const location = "/avatars";
39
+ return await this.call("getAvatars", location, {
40
+ method: "GET", schema: "AvatarInfoArray"
41
+ }) as API.AvatarInfo[];
42
+ }
43
+
44
+ async createAvatar(avatar: API.AvatarAttributes): Promise<API.AvatarInfo> {
45
+ const location = "/avatars";
46
+ return await this.call("createAvatar", location, {
47
+ method: "POST", body: avatar, schema: "AvatarInfo"
48
+ }) as API.AvatarInfo;
49
+ }
50
+
51
+ async getAvatar(id: string): Promise<API.AvatarInfo> {
52
+ const location = ut`/avatars/${id}`;
53
+ return await this.call("getAvatar", location, {
54
+ method: "GET", schema: "AvatarInfo"
55
+ }) as API.AvatarInfo;
56
+ }
57
+
58
+ async deleteAvatar(id: string): Promise<API.Result> {
59
+ const location = ut`/avatars/${id}`;
60
+ return await this.call("deleteAvatar", location, {
61
+ method: "DELETE", schema: "Result"
62
+ }) as API.Result;
63
+ }
64
+
65
+ async reorderAvatars(order: API.AvatarsOrdered): Promise<API.AvatarOrdinal[]> {
66
+ const location = "/avatars/reorder";
67
+ return await this.call("reorderAvatars", location, {
68
+ method: "POST", body: order, schema: "AvatarOrdinalArray"
69
+ }) as API.AvatarOrdinal[];
70
+ }
71
+
72
+ async blockInstant(instant: API.BlockedInstantAttributes): Promise<API.BlockedInstantInfo> {
73
+ const location = "/blocked-instants";
74
+ return await this.call("blockInstant", location, {
75
+ method: "POST", body: instant, schema: "BlockedInstantInfo"
76
+ }) as API.BlockedInstantInfo;
77
+ }
78
+
79
+ async getBlockedInstant(id: string): Promise<API.BlockedInstantInfo> {
80
+ const location = ut`/blocked-instants/${id}`;
81
+ return await this.call("getBlockedInstant", location, {
82
+ method: "GET", schema: "BlockedInstantInfo"
83
+ }) as API.BlockedInstantInfo;
84
+ }
85
+
86
+ async unblockInstant(id: string): Promise<API.Result> {
87
+ const location = ut`/blocked-instants/${id}`;
88
+ return await this.call("unblockInstant", location, {
89
+ method: "DELETE", schema: "Result"
90
+ }) as API.Result;
91
+ }
92
+
93
+ async searchBlockedInstants(filter: API.BlockedInstantFilter): Promise<API.BlockedInstantInfo[]> {
94
+ const location = "/blocked-instants/search";
95
+ return await this.call("searchBlockedInstants", location, {
96
+ method: "POST", body: filter, schema: "BlockedInstantInfoArray"
97
+ }) as API.BlockedInstantInfo[];
98
+ }
99
+
100
+ async blockUser(user: API.BlockedUserAttributes): Promise<API.BlockedUserInfo> {
101
+ const location = "/people/blocked-users";
102
+ return await this.call("blockUser", location, {
103
+ method: "POST", body: user, schema: "BlockedUserInfo"
104
+ }) as API.BlockedUserInfo;
105
+ }
106
+
107
+ async getBlockedUser(id: string): Promise<API.BlockedUserInfo> {
108
+ const location = ut`/people/blocked-users/${id}`;
109
+ return await this.call("getBlockedUser", location, {
110
+ method: "GET", schema: "BlockedUserInfo"
111
+ }) as API.BlockedUserInfo;
112
+ }
113
+
114
+ async unblockUser(id: string): Promise<API.Result> {
115
+ const location = ut`/people/blocked-users/${id}`;
116
+ return await this.call("unblockUser", location, {
117
+ method: "DELETE", schema: "Result"
118
+ }) as API.Result;
119
+ }
120
+
121
+ async searchBlockedUsers(filter: API.BlockedUserFilter): Promise<API.BlockedUserInfo[]> {
122
+ const location = "/people/blocked-users/search";
123
+ return await this.call("searchBlockedUsers", location, {
124
+ method: "POST", body: filter, schema: "BlockedUserInfoArray"
125
+ }) as API.BlockedUserInfo[];
126
+ }
127
+
128
+ async getBlockedUsersChecksums(): Promise<API.BlockedUsersChecksums> {
129
+ const location = "/people/blocked-users/checksums";
130
+ return await this.call("getBlockedUsersChecksums", location, {
131
+ method: "GET", schema: "BlockedUsersChecksums"
132
+ }) as API.BlockedUsersChecksums;
133
+ }
134
+
135
+ async getBlockedByUser(id: string): Promise<API.BlockedByUserInfo> {
136
+ const location = ut`/people/blocked-by-users/${id}`;
137
+ return await this.call("getBlockedByUser", location, {
138
+ method: "GET", schema: "BlockedByUserInfo"
139
+ }) as API.BlockedByUserInfo;
140
+ }
141
+
142
+ async searchBlockedByUsers(filter: API.BlockedByUserFilter): Promise<API.BlockedByUserInfo[]> {
143
+ const location = "/people/blocked-by-users/search";
144
+ return await this.call("searchBlockedByUsers", location, {
145
+ method: "POST", body: filter, schema: "BlockedByUserInfoArray"
146
+ }) as API.BlockedByUserInfo[];
147
+ }
148
+
149
+ async getCartes(limit: number | null = null): Promise<API.CarteSet> {
150
+ const location = ut`/cartes`;
151
+ const params = {limit};
152
+ return await this.call("getCartes", location, {
153
+ method: "GET", params, schema: "CarteSet"
154
+ }) as API.CarteSet;
155
+ }
156
+
157
+ async getCommentsSlice(
158
+ postingId: string, after: number | null = null, before: number | null = null, limit: number | null = null
159
+ ): Promise<API.CommentsSliceInfo> {
160
+ const location = ut`/postings/${postingId}/comments`;
161
+ const params = {after, before, limit};
162
+ return await this.call("getCommentsSlice", location, {
163
+ method: "GET", params, schema: "CommentsSliceInfo", bodies: true
164
+ }) as API.CommentsSliceInfo;
165
+ }
166
+
167
+ async createComment(postingId: string, comment: API.CommentText): Promise<API.CommentCreated> {
168
+ const location = ut`/postings/${postingId}/comments`;
169
+ return await this.call("createComment", location, {
170
+ method: "POST", body: comment, schema: "CommentCreated", bodies: true
171
+ }) as API.CommentCreated;
172
+ }
173
+
174
+ async getComment(postingId: string, commentId: string, withSource: boolean = false): Promise<API.CommentInfo> {
175
+ const include = commaSeparatedFlags({"source": withSource});
176
+ const location = ut`/postings/${postingId}/comments/${commentId}`;
177
+ const params = {include};
178
+ return await this.call("getComment", location, {
179
+ method: "GET", params, schema: "CommentInfo", bodies: true
180
+ }) as API.CommentInfo;
181
+ }
182
+
183
+ async updateAllComments(postingId: string, attributes: API.CommentMassAttributes): Promise<API.Result> {
184
+ const location = ut`/postings/${postingId}/comments`;
185
+ return await this.call("updateAllComments", location, {
186
+ method: "PUT", body: attributes, schema: "Result"
187
+ }) as API.Result;
188
+ }
189
+
190
+ async updateComment(postingId: string, commentId: string, comment: API.CommentText): Promise<API.CommentInfo> {
191
+ const location = ut`/postings/${postingId}/comments/${commentId}`;
192
+ return await this.call("updateComment", location, {
193
+ method: "PUT", body: comment, schema: "CommentInfo", bodies: true
194
+ }) as API.CommentInfo;
195
+ }
196
+
197
+ async deleteComment(postingId: string, commentId: string): Promise<API.CommentTotalInfo> {
198
+ const location = ut`/postings/${postingId}/comments/${commentId}`;
199
+ return await this.call("deleteComment", location, {
200
+ method: "DELETE", schema: "CommentTotalInfo"
201
+ }) as API.CommentTotalInfo;
202
+ }
203
+
204
+ async getPostingsAttachedToComment(postingId: string, commentId: string): Promise<API.PostingInfo[]> {
205
+ const location = ut`/postings/${postingId}/comments/${commentId}/attached`;
206
+ return await this.call("getPostingsAttachedToComment", location, {
207
+ method: "GET", schema: "PostingInfoArray", bodies: true
208
+ }) as API.PostingInfo[];
209
+ }
210
+
211
+ async getCommentRevisions(postingId: string, commentId: string): Promise<API.CommentRevisionInfo[]> {
212
+ const location = ut`/postings/${postingId}/comments/${commentId}/revisions`;
213
+ return await this.call("getCommentRevisions", location, {
214
+ method: "GET", schema: "CommentRevisionInfoArray", bodies: true
215
+ }) as API.CommentRevisionInfo[];
216
+ }
217
+
218
+ async getCommentRevision(postingId: string, commentId: string, id: string): Promise<API.CommentRevisionInfo> {
219
+ const location = ut`/postings/${postingId}/comments/${commentId}/revisions/${id}`;
220
+ return await this.call("getCommentRevision", location, {
221
+ method: "GET", schema: "CommentRevisionInfo", bodies: true
222
+ }) as API.CommentRevisionInfo;
223
+ }
224
+
225
+ async createCommentReaction(
226
+ postingId: string, commentId: string, reaction: API.ReactionDescription
227
+ ): Promise<API.ReactionCreated> {
228
+ const location = ut`/postings/${postingId}/comments/${commentId}/reactions`;
229
+ return await this.call("createCommentReaction", location, {
230
+ method: "POST", body: reaction, schema: "ReactionCreated"
231
+ }) as API.ReactionCreated;
232
+ }
233
+
234
+ async updateCommentReaction(
235
+ postingId: string, commentId: string, ownerName: string, reaction: API.ReactionOverride
236
+ ): Promise<API.ReactionInfo> {
237
+ const location = ut`/postings/${postingId}/comments/${commentId}/reactions/${ownerName}`;
238
+ return await this.call("updateCommentReaction", location, {
239
+ method: "PUT", body: reaction, schema: "ReactionInfo"
240
+ }) as API.ReactionInfo;
241
+ }
242
+
243
+ async getCommentReactionsSlice(
244
+ postingId: string, commentId: string, negative: boolean | null = null, emoji: number | null = null,
245
+ before: number | null = null, limit: number | null = null
246
+ ): Promise<API.ReactionsSliceInfo> {
247
+ const location = ut`/postings/${postingId}/comments/${commentId}/reactions`;
248
+ const params = {negative, emoji, before, limit};
249
+ return await this.call("getCommentReactionsSlice", location, {
250
+ method: "GET", params, schema: "ReactionsSliceInfo"
251
+ }) as API.ReactionsSliceInfo;
252
+ }
253
+
254
+ async getCommentReaction(postingId: string, commentId: string, ownerName: string): Promise<API.ReactionInfo> {
255
+ const location = ut`/postings/${postingId}/comments/${commentId}/reactions/${ownerName}`;
256
+ return await this.call("getCommentReaction", location, {
257
+ method: "GET", schema: "ReactionInfo"
258
+ }) as API.ReactionInfo;
259
+ }
260
+
261
+ async deleteAllCommentReactions(postingId: string, commentId: string): Promise<API.Result> {
262
+ const location = ut`/postings/${postingId}/comments/${commentId}/reactions`;
263
+ return await this.call("deleteAllCommentReactions", location, {
264
+ method: "DELETE", schema: "Result"
265
+ }) as API.Result;
266
+ }
267
+
268
+ async deleteCommentReaction(
269
+ postingId: string, commentId: string, ownerName: string
270
+ ): Promise<API.ReactionTotalsInfo> {
271
+ const location = ut`/postings/${postingId}/comments/${commentId}/reactions/${ownerName}`;
272
+ return await this.call("deleteCommentReaction", location, {
273
+ method: "DELETE", schema: "ReactionTotalsInfo"
274
+ }) as API.ReactionTotalsInfo;
275
+ }
276
+
277
+ async getCommentReactionTotals(postingId: string, commentId: string): Promise<API.ReactionTotalsInfo> {
278
+ const location = ut`/postings/${postingId}/comments/${commentId}/reaction-totals`;
279
+ return await this.call("getCommentReactionTotals", location, {
280
+ method: "GET", schema: "ReactionTotalsInfo"
281
+ }) as API.ReactionTotalsInfo;
282
+ }
283
+
284
+ async getContacts(query: string | null = null, limit: number | null = null): Promise<API.ContactInfo[]> {
285
+ const location = ut`/people/contacts`;
286
+ const params = {query, limit};
287
+ return await this.call("getContacts", location, {
288
+ method: "GET", params, schema: "ContactInfoArray"
289
+ }) as API.ContactInfo[];
290
+ }
291
+
292
+ async checkCredentials(): Promise<API.CredentialsCreated> {
293
+ const location = "/credentials";
294
+ return await this.call("checkCredentials", location, {
295
+ method: "GET", schema: "CredentialsCreated"
296
+ }) as API.CredentialsCreated;
297
+ }
298
+
299
+ async createCredentials(credentials: API.Credentials): Promise<API.Result> {
300
+ const location = "/credentials";
301
+ return await this.call("createCredentials", location, {
302
+ method: "POST", body: credentials, schema: "Result"
303
+ }) as API.Result;
304
+ }
305
+
306
+ async updateCredentials(credentials: API.CredentialsChange): Promise<API.Result> {
307
+ const location = "/credentials";
308
+ return await this.call("updateCredentials", location, {
309
+ method: "PUT", body: credentials, schema: "Result"
310
+ }) as API.Result;
311
+ }
312
+
313
+ async deleteCredentials(): Promise<API.Result> {
314
+ const location = "/credentials";
315
+ return await this.call("deleteCredentials", location, {
316
+ method: "DELETE", schema: "Result"
317
+ }) as API.Result;
318
+ }
319
+
320
+ async resetCredentials(): Promise<API.EmailHint> {
321
+ const location = "/credentials/reset";
322
+ return await this.call("resetCredentials", location, {
323
+ method: "POST", schema: "EmailHint"
324
+ }) as API.EmailHint;
325
+ }
326
+
327
+ async getDeletedPostings(page: number | null = null, limit: number | null = null): Promise<API.PostingInfo[]> {
328
+ const location = ut`/deleted-postings`;
329
+ const params = {page, limit};
330
+ return await this.call("getDeletedPostings", location, {
331
+ method: "GET", params, schema: "PostingInfoArray", bodies: true
332
+ }) as API.PostingInfo[];
333
+ }
334
+
335
+ async getDeletedPosting(id: string): Promise<API.PostingInfo> {
336
+ const location = ut`/deleted-postings/${id}`;
337
+ return await this.call("getDeletedPosting", location, {
338
+ method: "GET", schema: "PostingInfo", bodies: true
339
+ }) as API.PostingInfo;
340
+ }
341
+
342
+ async restoreDeletedPosting(id: string): Promise<API.PostingInfo> {
343
+ const location = ut`/deleted-postings/${id}/restore`;
344
+ return await this.call("restoreDeletedPosting", location, {
345
+ method: "POST", schema: "PostingInfo", bodies: true
346
+ }) as API.PostingInfo;
347
+ }
348
+
349
+ async getDeletePostingRevisions(
350
+ postingId: string, limit: number | null = null
351
+ ): Promise<API.PostingRevisionInfo[]> {
352
+ const location = ut`/deleted-postings/${postingId}/revisions`;
353
+ const params = {limit};
354
+ return await this.call("getDeletePostingRevisions", location, {
355
+ method: "GET", params, schema: "PostingRevisionInfoArray", bodies: true
356
+ }) as API.PostingRevisionInfo[];
357
+ }
358
+
359
+ async getDeletedPostingRevision(postingId: string, id: string): Promise<API.PostingRevisionInfo> {
360
+ const location = ut`/deleted-postings/${postingId}/revisions/${id}`;
361
+ return await this.call("getDeletedPostingRevision", location, {
362
+ method: "GET", schema: "PostingRevisionInfo", bodies: true
363
+ }) as API.PostingRevisionInfo;
364
+ }
365
+
366
+ async restoreDeletedPostingRevision(postingId: string, id: string): Promise<API.PostingRevisionInfo> {
367
+ const location = ut`/postings/${postingId}/revisions/${id}/restore`;
368
+ return await this.call("restoreDeletedPostingRevision", location, {
369
+ method: "POST", schema: "PostingRevisionInfo", bodies: true
370
+ }) as API.PostingRevisionInfo;
371
+ }
372
+
373
+ async getDomains(): Promise<API.DomainInfo[]> {
374
+ const location = "/domains";
375
+ return await this.call("getDomains", location, {
376
+ method: "GET", schema: "DomainInfoArray"
377
+ }) as API.DomainInfo[];
378
+ }
379
+
380
+ async getDomain(name: string): Promise<API.DomainInfo> {
381
+ const location = ut`/domains/${name}`;
382
+ return await this.call("getDomain", location, {
383
+ method: "GET", schema: "DomainInfo"
384
+ }) as API.DomainInfo;
385
+ }
386
+
387
+ async createDomain(domain: API.DomainAttributes): Promise<API.DomainInfo> {
388
+ const location = "/domains";
389
+ return await this.call("createDomain", location, {
390
+ method: "POST", body: domain, schema: "DomainInfo"
391
+ }) as API.DomainInfo;
392
+ }
393
+
394
+ async updateDomain(name: string, domain: API.DomainAttributes): Promise<API.DomainInfo> {
395
+ const location = ut`/domains/${name}`;
396
+ return await this.call("updateDomain", location, {
397
+ method: "PUT", body: domain, schema: "DomainInfo"
398
+ }) as API.DomainInfo;
399
+ }
400
+
401
+ async deleteDomain(name: string): Promise<API.Result> {
402
+ const location = ut`/domains/${name}`;
403
+ return await this.call("deleteDomain", location, {
404
+ method: "DELETE", schema: "Result"
405
+ }) as API.Result;
406
+ }
407
+
408
+ async isDomainAvailable(remoteNodeName: string): Promise<API.DomainAvailable> {
409
+ const location = ut`/domains/available`;
410
+ const params = {nodeName: remoteNodeName};
411
+ return await this.call("isDomainAvailable", location, {
412
+ method: "GET", params, schema: "DomainAvailable"
413
+ }) as API.DomainAvailable;
414
+ }
415
+
416
+ async getDrafts(
417
+ draftType: API.DraftType, remoteNodeName: string, postingId: string | null = null,
418
+ commentId: string | null = null, page: number | null = null, limit: number | null = null
419
+ ): Promise<API.DraftInfo[]> {
420
+ const location = ut`/drafts`;
421
+ const params = {draftType, nodeName: remoteNodeName, postingId, commentId, page, limit};
422
+ return await this.call("getDrafts", location, {
423
+ method: "GET", params, schema: "DraftInfoArray", bodies: true
424
+ }) as API.DraftInfo[];
425
+ }
426
+
427
+ async createDraft(draft: API.DraftText): Promise<API.DraftInfo> {
428
+ const location = "/drafts";
429
+ return await this.call("createDraft", location, {
430
+ method: "POST", body: draft, schema: "DraftInfo", bodies: true
431
+ }) as API.DraftInfo;
432
+ }
433
+
434
+ async getDraft(id: string): Promise<API.DraftInfo> {
435
+ const location = ut`/drafts/${id}`;
436
+ return await this.call("getDraft", location, {
437
+ method: "GET", schema: "DraftInfo", bodies: true
438
+ }) as API.DraftInfo;
439
+ }
440
+
441
+ async updateDraft(id: string, draft: API.DraftText): Promise<API.DraftInfo> {
442
+ const location = ut`/drafts/${id}`;
443
+ return await this.call("updateDraft", location, {
444
+ method: "PUT", body: draft, schema: "DraftInfo", bodies: true
445
+ }) as API.DraftInfo;
446
+ }
447
+
448
+ async deleteDraft(id: string): Promise<API.Result> {
449
+ const location = ut`/drafts/${id}`;
450
+ return await this.call("deleteDraft", location, {
451
+ method: "DELETE", schema: "Result"
452
+ }) as API.Result;
453
+ }
454
+
455
+ async getFeatures(): Promise<API.Features> {
456
+ const location = "/features";
457
+ return await this.call("getFeatures", location, {
458
+ method: "GET", schema: "Features"
459
+ }) as API.Features;
460
+ }
461
+
462
+ async getFeeds(): Promise<API.FeedInfo[]> {
463
+ const location = "/feeds";
464
+ return await this.call("getFeeds", location, {
465
+ method: "GET", schema: "FeedInfoArray"
466
+ }) as API.FeedInfo[];
467
+ }
468
+
469
+ async getFeedGeneral(feedName: string): Promise<API.FeedInfo> {
470
+ const location = ut`/feeds/${feedName}`;
471
+ return await this.call("getFeedGeneral", location, {
472
+ method: "GET", schema: "FeedInfo"
473
+ }) as API.FeedInfo;
474
+ }
475
+
476
+ async getFeedStatus(feedName: string): Promise<API.FeedStatus> {
477
+ const location = ut`/feeds/${feedName}/status`;
478
+ return await this.call("getFeedStatus", location, {
479
+ method: "GET", schema: "FeedStatus"
480
+ }) as API.FeedStatus;
481
+ }
482
+
483
+ async updateFeedStatus(feedName: string, change: API.FeedStatusChange): Promise<API.FeedStatus> {
484
+ const location = ut`/feeds/${feedName}/status`;
485
+ return await this.call("updateFeedStatus", location, {
486
+ method: "PUT", body: change, schema: "FeedStatus"
487
+ }) as API.FeedStatus;
488
+ }
489
+
490
+ async getFeedSlice(
491
+ feedName: string, after: number | null = null, before: number | null = null, limit: number | null = null
492
+ ): Promise<API.FeedSliceInfo> {
493
+ const location = ut`/feeds/${feedName}/stories`;
494
+ const params = {after, before, limit};
495
+ return await this.call("getFeedSlice", location, {
496
+ method: "GET", params, schema: "FeedSliceInfo", bodies: true
497
+ }) as API.FeedSliceInfo;
498
+ }
499
+
500
+ async getFriendGroups(): Promise<API.FriendGroupInfo[]> {
501
+ const location = "/people/friends/groups";
502
+ return await this.call("getFriendGroups", location, {
503
+ method: "GET", schema: "FriendGroupInfoArray"
504
+ }) as API.FriendGroupInfo[];
505
+ }
506
+
507
+ async getFriendGroup(id: string): Promise<API.FriendGroupInfo> {
508
+ const location = ut`/people/friends/groups/${id}`;
509
+ return await this.call("getFriendGroup", location, {
510
+ method: "GET", schema: "FriendGroupInfo"
511
+ }) as API.FriendGroupInfo;
512
+ }
513
+
514
+ async createFriendGroup(friendGroup: API.FriendGroupDescription): Promise<API.FriendGroupInfo> {
515
+ const location = "/people/friends/groups";
516
+ return await this.call("createFriendGroup", location, {
517
+ method: "POST", body: friendGroup, schema: "FriendGroupInfo"
518
+ }) as API.FriendGroupInfo;
519
+ }
520
+
521
+ async updateFriendGroup(id: string, friendGroup: API.FriendGroupDescription): Promise<API.FriendGroupInfo> {
522
+ const location = ut`/people/friends/groups/${id}`;
523
+ return await this.call("updateFriendGroup", location, {
524
+ method: "PUT", body: friendGroup, schema: "FriendGroupInfo"
525
+ }) as API.FriendGroupInfo;
526
+ }
527
+
528
+ async deleteFriendGroup(id: string): Promise<API.Result> {
529
+ const location = ut`/people/friends/groups/${id}`;
530
+ return await this.call("deleteFriendGroup", location, {
531
+ method: "DELETE", schema: "Result"
532
+ }) as API.Result;
533
+ }
534
+
535
+ async getFriends(groupId: string | null = null): Promise<API.FriendInfo[]> {
536
+ const location = ut`/people/friends`;
537
+ const params = {groupId};
538
+ return await this.call("getFriends", location, {
539
+ method: "GET", params, schema: "FriendInfoArray"
540
+ }) as API.FriendInfo[];
541
+ }
542
+
543
+ async getFriend(name: string): Promise<API.FriendInfo> {
544
+ const location = ut`/people/friends/${name}`;
545
+ return await this.call("getFriend", location, {
546
+ method: "GET", schema: "FriendInfo"
547
+ }) as API.FriendInfo;
548
+ }
549
+
550
+ async updateFriends(friends: API.FriendDescription[]): Promise<API.FriendInfo[]> {
551
+ const location = "/people/friends";
552
+ return await this.call("updateFriends", location, {
553
+ method: "PUT", body: friends, schema: "FriendInfoArray"
554
+ }) as API.FriendInfo[];
555
+ }
556
+
557
+ async getFriendOfs(): Promise<API.FriendOfInfo[]> {
558
+ const location = "/people/friend-ofs";
559
+ return await this.call("getFriendOfs", location, {
560
+ method: "GET", schema: "FriendOfInfoArray"
561
+ }) as API.FriendOfInfo[];
562
+ }
563
+
564
+ async getFriendOf(name: string): Promise<API.FriendOfInfo> {
565
+ const location = ut`/people/friend-ofs/${name}`;
566
+ return await this.call("getFriendOf", location, {
567
+ method: "GET", schema: "FriendOfInfo"
568
+ }) as API.FriendOfInfo;
569
+ }
570
+
571
+ async uploadPrivateMedia(body: Buffer): Promise<API.PrivateMediaFileInfo> {
572
+ const location = "/media/private";
573
+ return await this.call("uploadPrivateMedia", location, {
574
+ method: "POST", body, schema: "PrivateMediaFileInfo"
575
+ }) as API.PrivateMediaFileInfo;
576
+ }
577
+
578
+ async getPrivateMedia(id: string, width: number | null = null, download: boolean | null = null): Promise<Blob> {
579
+ const location = ut`/media/private/${id}/data`;
580
+ const params = {width, download};
581
+ return await this.call("getPrivateMedia", location, {
582
+ method: "GET", params, schema: "blob"
583
+ }) as Blob;
584
+ }
585
+
586
+ async getPrivateMediaInfo(id: string): Promise<API.PrivateMediaFileInfo> {
587
+ const location = ut`/media/private/${id}/info`;
588
+ return await this.call("getPrivateMediaInfo", location, {
589
+ method: "GET", schema: "PrivateMediaFileInfo"
590
+ }) as API.PrivateMediaFileInfo;
591
+ }
592
+
593
+ async getPrivateMediaParentEntry(id: string): Promise<API.EntryInfo[]> {
594
+ const location = ut`/media/private/${id}/parent`;
595
+ return await this.call("getPrivateMediaParentEntry", location, {
596
+ method: "GET", schema: "EntryInfoArray", bodies: true
597
+ }) as API.EntryInfo[];
598
+ }
599
+
600
+ async uploadPublicMedia(body: Buffer): Promise<API.PublicMediaFileInfo> {
601
+ const location = "/media/public";
602
+ return await this.call("uploadPublicMedia", location, {
603
+ method: "POST", body, schema: "PublicMediaFileInfo"
604
+ }) as API.PublicMediaFileInfo;
605
+ }
606
+
607
+ async getPublicMedia(id: string, width: number | null = null, download: boolean | null = null): Promise<Blob> {
608
+ const location = ut`/media/public/${id}/data`;
609
+ const params = {width, download};
610
+ return await this.call("getPublicMedia", location, {
611
+ method: "GET", params, schema: "blob"
612
+ }) as Blob;
613
+ }
614
+
615
+ async getPublicMediaInfo(id: string): Promise<API.PublicMediaFileInfo> {
616
+ const location = ut`/media/public/${id}/info`;
617
+ return await this.call("getPublicMediaInfo", location, {
618
+ method: "GET", schema: "PublicMediaFileInfo"
619
+ }) as API.PublicMediaFileInfo;
620
+ }
621
+
622
+ async getNodeName(): Promise<API.NodeNameInfo> {
623
+ const location = "/node-name";
624
+ return await this.call("getNodeName", location, {
625
+ method: "GET", schema: "NodeNameInfo"
626
+ }) as API.NodeNameInfo;
627
+ }
628
+
629
+ async createNodeName(nameToRegister: API.NameToRegister): Promise<API.RegisteredNameSecret> {
630
+ const location = "/node-name";
631
+ return await this.call("createNodeName", location, {
632
+ method: "POST", body: nameToRegister, schema: "RegisteredNameSecret"
633
+ }) as API.RegisteredNameSecret;
634
+ }
635
+
636
+ async updateNodeName(secret: API.RegisteredNameSecret): Promise<API.Result> {
637
+ const location = "/node-name";
638
+ return await this.call("updateNodeName", location, {
639
+ method: "PUT", body: secret, schema: "Result"
640
+ }) as API.Result;
641
+ }
642
+
643
+ async deleteNodeName(): Promise<API.Result> {
644
+ const location = "/node-name";
645
+ return await this.call("deleteNodeName", location, {
646
+ method: "DELETE", schema: "Result"
647
+ }) as API.Result;
648
+ }
649
+
650
+ async sendNotification(packet: API.NotificationPacket): Promise<API.Result> {
651
+ const location = "/notifications";
652
+ return await this.call("sendNotification", location, {
653
+ method: "POST", body: packet, schema: "Result"
654
+ }) as API.Result;
655
+ }
656
+
657
+ async getPeopleGeneral(): Promise<API.PeopleGeneralInfo> {
658
+ const location = "/people";
659
+ return await this.call("getPeopleGeneral", location, {
660
+ method: "GET", schema: "PeopleGeneralInfo"
661
+ }) as API.PeopleGeneralInfo;
662
+ }
663
+
664
+ async registerPlugin(plugin: API.PluginDescription): Promise<API.PluginInfo> {
665
+ const location = "/plugins";
666
+ return await this.call("registerPlugin", location, {
667
+ method: "POST", body: plugin, schema: "PluginInfo"
668
+ }) as API.PluginInfo;
669
+ }
670
+
671
+ async getPlugins(): Promise<API.PluginInfo[]> {
672
+ const location = "/plugins";
673
+ return await this.call("getPlugins", location, {
674
+ method: "GET", schema: "PluginInfoArray"
675
+ }) as API.PluginInfo[];
676
+ }
677
+
678
+ async getPlugin(pluginName: string): Promise<API.PluginInfo> {
679
+ const location = ut`/plugins/${pluginName}`;
680
+ return await this.call("getPlugin", location, {
681
+ method: "GET", schema: "PluginInfo"
682
+ }) as API.PluginInfo;
683
+ }
684
+
685
+ async unregisterPlugin(pluginName: string): Promise<API.Result> {
686
+ const location = ut`/plugins/${pluginName}`;
687
+ return await this.call("unregisterPlugin", location, {
688
+ method: "DELETE", schema: "Result"
689
+ }) as API.Result;
690
+ }
691
+
692
+ async createPosting(posting: API.PostingText): Promise<API.PostingInfo> {
693
+ const location = "/postings";
694
+ return await this.call("createPosting", location, {
695
+ method: "POST", body: posting, schema: "PostingInfo", bodies: true
696
+ }) as API.PostingInfo;
697
+ }
698
+
699
+ async updatePosting(id: string, posting: API.PostingText): Promise<API.PostingInfo> {
700
+ const location = ut`/postings/${id}`;
701
+ return await this.call("updatePosting", location, {
702
+ method: "PUT", body: posting, schema: "PostingInfo", bodies: true
703
+ }) as API.PostingInfo;
704
+ }
705
+
706
+ async getPosting(id: string, withSource: boolean = false): Promise<API.PostingInfo> {
707
+ const include = commaSeparatedFlags({"source": withSource});
708
+ const location = ut`/postings/${id}`;
709
+ const params = {include};
710
+ return await this.call("getPosting", location, {
711
+ method: "GET", params, schema: "PostingInfo", bodies: true
712
+ }) as API.PostingInfo;
713
+ }
714
+
715
+ async deletePosting(id: string): Promise<API.Result> {
716
+ const location = ut`/postings/${id}`;
717
+ return await this.call("deletePosting", location, {
718
+ method: "DELETE", schema: "Result"
719
+ }) as API.Result;
720
+ }
721
+
722
+ async getPostingsAttachedToPosting(id: string): Promise<API.PostingInfo[]> {
723
+ const location = ut`/postings/${id}/attached`;
724
+ return await this.call("getPostingsAttachedToPosting", location, {
725
+ method: "GET", schema: "PostingInfoArray", bodies: true
726
+ }) as API.PostingInfo[];
727
+ }
728
+
729
+ async getPostingRevisions(postingId: string, limit: number | null = null): Promise<API.PostingRevisionInfo[]> {
730
+ const location = ut`/postings/${postingId}/revisions`;
731
+ const params = {limit};
732
+ return await this.call("getPostingRevisions", location, {
733
+ method: "GET", params, schema: "PostingRevisionInfoArray", bodies: true
734
+ }) as API.PostingRevisionInfo[];
735
+ }
736
+
737
+ async getPostingRevision(postingId: string, id: string): Promise<API.PostingRevisionInfo> {
738
+ const location = ut`/postings/${postingId}/revisions/${id}`;
739
+ return await this.call("getPostingRevision", location, {
740
+ method: "GET", schema: "PostingRevisionInfo", bodies: true
741
+ }) as API.PostingRevisionInfo;
742
+ }
743
+
744
+ async restorePostingRevision(postingId: string, id: string): Promise<API.PostingRevisionInfo> {
745
+ const location = ut`/postings/${postingId}/revisions/${id}/restore`;
746
+ return await this.call("restorePostingRevision", location, {
747
+ method: "POST", schema: "PostingRevisionInfo", bodies: true
748
+ }) as API.PostingRevisionInfo;
749
+ }
750
+
751
+ async createPostingReaction(postingId: string, reaction: API.ReactionDescription): Promise<API.ReactionCreated> {
752
+ const location = ut`/postings/${postingId}/reactions`;
753
+ return await this.call("createPostingReaction", location, {
754
+ method: "POST", body: reaction, schema: "ReactionCreated"
755
+ }) as API.ReactionCreated;
756
+ }
757
+
758
+ async getPostingReactionsSlice(
759
+ postingId: string, negative: boolean | null = null, emoji: number | null = null, before: number | null = null,
760
+ limit: number | null = null
761
+ ): Promise<API.ReactionsSliceInfo> {
762
+ const location = ut`/postings/${postingId}/reactions`;
763
+ const params = {negative, emoji, before, limit};
764
+ return await this.call("getPostingReactionsSlice", location, {
765
+ method: "GET", params, schema: "ReactionsSliceInfo"
766
+ }) as API.ReactionsSliceInfo;
767
+ }
768
+
769
+ async updatePostingReaction(
770
+ postingId: string, ownerName: string, reaction: API.ReactionOverride
771
+ ): Promise<API.ReactionInfo> {
772
+ const location = ut`/postings/${postingId}/reactions/${ownerName}`;
773
+ return await this.call("updatePostingReaction", location, {
774
+ method: "PUT", body: reaction, schema: "ReactionInfo"
775
+ }) as API.ReactionInfo;
776
+ }
777
+
778
+ async getPostingReaction(postingId: string, ownerName: string): Promise<API.ReactionInfo> {
779
+ const location = ut`/postings/${postingId}/reactions/${ownerName}`;
780
+ return await this.call("getPostingReaction", location, {
781
+ method: "GET", schema: "ReactionInfo"
782
+ }) as API.ReactionInfo;
783
+ }
784
+
785
+ async deleteAllPostingReactions(postingId: string): Promise<API.Result> {
786
+ const location = ut`/postings/${postingId}/reactions`;
787
+ return await this.call("deleteAllPostingReactions", location, {
788
+ method: "DELETE", schema: "Result"
789
+ }) as API.Result;
790
+ }
791
+
792
+ async deletePostingReaction(postingId: string, ownerName: string): Promise<API.ReactionTotalsInfo> {
793
+ const location = ut`/postings/${postingId}/reactions/${ownerName}`;
794
+ return await this.call("deletePostingReaction", location, {
795
+ method: "DELETE", schema: "ReactionTotalsInfo"
796
+ }) as API.ReactionTotalsInfo;
797
+ }
798
+
799
+ async searchPostingReactions(filter: API.ReactionsFilter): Promise<API.ReactionInfo[]> {
800
+ const location = "/postings/reactions/search";
801
+ return await this.call("searchPostingReactions", location, {
802
+ method: "POST", body: filter, schema: "ReactionInfoArray"
803
+ }) as API.ReactionInfo[];
804
+ }
805
+
806
+ async getPostingReactionTotals(postingId: string): Promise<API.ReactionTotalsInfo> {
807
+ const location = ut`/postings/${postingId}/reaction-totals`;
808
+ return await this.call("getPostingReactionTotals", location, {
809
+ method: "GET", schema: "ReactionTotalsInfo"
810
+ }) as API.ReactionTotalsInfo;
811
+ }
812
+
813
+ async searchPostingReactionTotals(filter: API.ReactionTotalsFilter): Promise<API.ReactionTotalsInfo[]> {
814
+ const location = "/postings/reaction-totals/search";
815
+ return await this.call("searchPostingReactionTotals", location, {
816
+ method: "POST", body: filter, schema: "ReactionTotalsInfoArray"
817
+ }) as API.ReactionTotalsInfo[];
818
+ }
819
+
820
+ async getProfile(withSource: boolean = false): Promise<API.ProfileInfo> {
821
+ const include = commaSeparatedFlags({"source": withSource});
822
+ const location = ut`/profile`;
823
+ const params = {include};
824
+ return await this.call("getProfile", location, {
825
+ method: "GET", params, schema: "ProfileInfo"
826
+ }) as API.ProfileInfo;
827
+ }
828
+
829
+ async updateProfile(profile: API.ProfileAttributes): Promise<API.ProfileInfo> {
830
+ const location = "/profile";
831
+ return await this.call("updateProfile", location, {
832
+ method: "PUT", body: profile, schema: "ProfileInfo"
833
+ }) as API.ProfileInfo;
834
+ }
835
+
836
+ async getDeleteNodeRequestStatus(): Promise<API.DeleteNodeStatus> {
837
+ const location = "/provider/delete-node";
838
+ return await this.call("getDeleteNodeRequestStatus", location, {
839
+ method: "GET", schema: "DeleteNodeStatus"
840
+ }) as API.DeleteNodeStatus;
841
+ }
842
+
843
+ async sendDeleteNodeRequest(deleteNodeText: API.DeleteNodeText): Promise<API.DeleteNodeStatus> {
844
+ const location = "/provider/delete-node";
845
+ return await this.call("sendDeleteNodeRequest", location, {
846
+ method: "POST", body: deleteNodeText, schema: "DeleteNodeStatus"
847
+ }) as API.DeleteNodeStatus;
848
+ }
849
+
850
+ async cancelDeleteNodeRequest(): Promise<API.DeleteNodeStatus> {
851
+ const location = "/provider/delete-node";
852
+ return await this.call("cancelDeleteNodeRequest", location, {
853
+ method: "DELETE", schema: "DeleteNodeStatus"
854
+ }) as API.DeleteNodeStatus;
855
+ }
856
+
857
+ async proxyMedia(url: string): Promise<Blob> {
858
+ const location = ut`/proxy/media`;
859
+ const params = {url};
860
+ return await this.call("proxyMedia", location, {
861
+ method: "GET", params, schema: "blob"
862
+ }) as Blob;
863
+ }
864
+
865
+ async proxyLinkPreview(url: string): Promise<API.LinkPreviewInfo> {
866
+ const location = ut`/proxy/link-preview`;
867
+ const params = {url};
868
+ return await this.call("proxyLinkPreview", location, {
869
+ method: "GET", params, schema: "LinkPreviewInfo"
870
+ }) as API.LinkPreviewInfo;
871
+ }
872
+
873
+ async registerAtPushRelay(attributes: API.PushRelayClientAttributes): Promise<API.Result> {
874
+ const location = "/push-relay";
875
+ return await this.call("registerAtPushRelay", location, {
876
+ method: "POST", body: attributes, schema: "Result"
877
+ }) as API.Result;
878
+ }
879
+
880
+ async askRemoteNode(remoteNodeName: string, details: API.AskDescription): Promise<API.Result> {
881
+ const location = ut`/nodes/${remoteNodeName}/ask`;
882
+ return await this.call("askRemoteNode", location, {
883
+ method: "POST", body: details, schema: "Result"
884
+ }) as API.Result;
885
+ }
886
+
887
+ async createRemoteComment(
888
+ remoteNodeName: string, postingId: string, comment: API.CommentSourceText
889
+ ): Promise<API.Result> {
890
+ const location = ut`/nodes/${remoteNodeName}/postings/${postingId}/comments`;
891
+ return await this.call("createRemoteComment", location, {
892
+ method: "POST", body: comment, schema: "Result"
893
+ }) as API.Result;
894
+ }
895
+
896
+ async updateRemoteComment(
897
+ remoteNodeName: string, postingId: string, commentId: string, comment: API.CommentSourceText
898
+ ): Promise<API.Result> {
899
+ const location = ut`/nodes/${remoteNodeName}/postings/${postingId}/comments/${commentId}`;
900
+ return await this.call("updateRemoteComment", location, {
901
+ method: "PUT", body: comment, schema: "Result"
902
+ }) as API.Result;
903
+ }
904
+
905
+ async deleteRemoteComment(remoteNodeName: string, postingId: string, commentId: string): Promise<API.Result> {
906
+ const location = ut`/nodes/${remoteNodeName}/postings/${postingId}/comments/${commentId}`;
907
+ return await this.call("deleteRemoteComment", location, {
908
+ method: "DELETE", schema: "Result"
909
+ }) as API.Result;
910
+ }
911
+
912
+ async verifyRemoteComment(
913
+ remoteNodeName: string, postingId: string, commentId: string
914
+ ): Promise<API.AsyncOperationCreated> {
915
+ const location = ut`/nodes/${remoteNodeName}/postings/${postingId}/comments/${commentId}/verify`;
916
+ return await this.call("verifyRemoteComment", location, {
917
+ method: "POST", schema: "AsyncOperationCreated"
918
+ }) as API.AsyncOperationCreated;
919
+ }
920
+
921
+ async createRemoteCommentReaction(
922
+ remoteNodeName: string, postingId: string, commentId: string, reaction: API.ReactionAttributes
923
+ ): Promise<API.Result> {
924
+ const location = ut`/nodes/${remoteNodeName}/postings/${postingId}/comments/${commentId}/reactions`;
925
+ return await this.call("createRemoteCommentReaction", location, {
926
+ method: "POST", body: reaction, schema: "Result"
927
+ }) as API.Result;
928
+ }
929
+
930
+ async deleteRemoteCommentReaction(
931
+ remoteNodeName: string, postingId: string, commentId: string
932
+ ): Promise<API.Result> {
933
+ const location = ut`/nodes/${remoteNodeName}/postings/${postingId}/comments/${commentId}/reactions`;
934
+ return await this.call("deleteRemoteCommentReaction", location, {
935
+ method: "DELETE", schema: "Result"
936
+ }) as API.Result;
937
+ }
938
+
939
+ async verifyRemoteCommentReaction(
940
+ remoteNodeName: string, postingId: string, commentId: string, ownerName: string
941
+ ): Promise<API.AsyncOperationCreated> {
942
+ const location = ut`/nodes/${remoteNodeName}/postings/${postingId}/comments/${commentId}/reactions/${ownerName}/verify`;
943
+ return await this.call("verifyRemoteCommentReaction", location, {
944
+ method: "POST", schema: "AsyncOperationCreated"
945
+ }) as API.AsyncOperationCreated;
946
+ }
947
+
948
+ async createRemotePosting(remoteNodeName: string, posting: API.PostingSourceText): Promise<API.Result> {
949
+ const location = ut`/nodes/${remoteNodeName}/postings`;
950
+ return await this.call("createRemotePosting", location, {
951
+ method: "POST", body: posting, schema: "Result"
952
+ }) as API.Result;
953
+ }
954
+
955
+ async updateRemotePosting(
956
+ remoteNodeName: string, postingId: string, posting: API.PostingSourceText
957
+ ): Promise<API.Result> {
958
+ const location = ut`/nodes/${remoteNodeName}/postings/${postingId}`;
959
+ return await this.call("updateRemotePosting", location, {
960
+ method: "PUT", body: posting, schema: "Result"
961
+ }) as API.Result;
962
+ }
963
+
964
+ async deleteRemotePosting(remoteNodeName: string, postingId: string): Promise<API.Result> {
965
+ const location = ut`/nodes/${remoteNodeName}/postings/${postingId}`;
966
+ return await this.call("deleteRemotePosting", location, {
967
+ method: "DELETE", schema: "Result"
968
+ }) as API.Result;
969
+ }
970
+
971
+ async verifyRemotePosting(remoteNodeName: string, id: string): Promise<API.AsyncOperationCreated> {
972
+ const location = ut`/nodes/${remoteNodeName}/postings/${id}/verify`;
973
+ return await this.call("verifyRemotePosting", location, {
974
+ method: "POST", schema: "AsyncOperationCreated"
975
+ }) as API.AsyncOperationCreated;
976
+ }
977
+
978
+ async verifyRemotePostingRevision(
979
+ remoteNodeName: string, id: string, revisionId: string
980
+ ): Promise<API.AsyncOperationCreated> {
981
+ const location = ut`/nodes/${remoteNodeName}/postings/${id}/revisions/${revisionId}/verify`;
982
+ return await this.call("verifyRemotePostingRevision", location, {
983
+ method: "POST", schema: "AsyncOperationCreated"
984
+ }) as API.AsyncOperationCreated;
985
+ }
986
+
987
+ async createRemotePostingReaction(
988
+ remoteNodeName: string, postingId: string, reaction: API.ReactionAttributes
989
+ ): Promise<API.Result> {
990
+ const location = ut`/nodes/${remoteNodeName}/postings/${postingId}/reactions`;
991
+ return await this.call("createRemotePostingReaction", location, {
992
+ method: "POST", body: reaction, schema: "Result"
993
+ }) as API.Result;
994
+ }
995
+
996
+ async deleteRemotePostingReaction(remoteNodeName: string, postingId: string): Promise<API.Result> {
997
+ const location = ut`/nodes/${remoteNodeName}/postings/${postingId}/reactions`;
998
+ return await this.call("deleteRemotePostingReaction", location, {
999
+ method: "DELETE", schema: "Result"
1000
+ }) as API.Result;
1001
+ }
1002
+
1003
+ async verifyRemotePostingReaction(
1004
+ remoteNodeName: string, postingId: string, ownerName: string
1005
+ ): Promise<API.AsyncOperationCreated> {
1006
+ const location = ut`/nodes/${remoteNodeName}/postings/${postingId}/reactions/${ownerName}/verify`;
1007
+ return await this.call("verifyRemotePostingReaction", location, {
1008
+ method: "POST", schema: "AsyncOperationCreated"
1009
+ }) as API.AsyncOperationCreated;
1010
+ }
1011
+
1012
+ async createRemoteSheriffOrder(
1013
+ remoteNodeName: string, sheriffOrder: API.SheriffOrderAttributes
1014
+ ): Promise<API.Result> {
1015
+ const location = ut`/nodes/${remoteNodeName}/sheriff/orders`;
1016
+ return await this.call("createRemoteSheriffOrder", location, {
1017
+ method: "POST", body: sheriffOrder, schema: "Result"
1018
+ }) as API.Result;
1019
+ }
1020
+
1021
+ async getRemoteSheriffOrder(remoteNodeName: string, id: string): Promise<API.SheriffOrderInfo> {
1022
+ const location = ut`/nodes/${remoteNodeName}/sheriff/orders/${id}`;
1023
+ return await this.call("getRemoteSheriffOrder", location, {
1024
+ method: "GET", schema: "SheriffOrderInfo"
1025
+ }) as API.SheriffOrderInfo;
1026
+ }
1027
+
1028
+ async updateSettings(settings: API.SettingInfo[]): Promise<API.Result> {
1029
+ const location = "/settings";
1030
+ return await this.call("updateSettings", location, {
1031
+ method: "PUT", body: settings, schema: "Result"
1032
+ }) as API.Result;
1033
+ }
1034
+
1035
+ async getClientSettings(prefix: string | null = null): Promise<API.SettingInfo[]> {
1036
+ const location = ut`/settings/client`;
1037
+ const params = {prefix};
1038
+ return await this.call("getClientSettings", location, {
1039
+ method: "GET", params, schema: "SettingInfoArray"
1040
+ }) as API.SettingInfo[];
1041
+ }
1042
+
1043
+ async getNodeSettings(prefix: string | null = null): Promise<API.SettingInfo[]> {
1044
+ const location = ut`/settings/node`;
1045
+ const params = {prefix};
1046
+ return await this.call("getNodeSettings", location, {
1047
+ method: "GET", params, schema: "SettingInfoArray"
1048
+ }) as API.SettingInfo[];
1049
+ }
1050
+
1051
+ async getNodeSettingsMetadata(prefix: string | null = null): Promise<API.SettingMetaInfo[]> {
1052
+ const location = ut`/settings/node/metadata`;
1053
+ const params = {prefix};
1054
+ return await this.call("getNodeSettingsMetadata", location, {
1055
+ method: "GET", params, schema: "SettingMetaInfoArray"
1056
+ }) as API.SettingMetaInfo[];
1057
+ }
1058
+
1059
+ async updateNodeSettingsMetadata(metadata: API.SettingMetaAttributes[]): Promise<API.Result> {
1060
+ const location = "/settings/node/metadata";
1061
+ return await this.call("updateNodeSettingsMetadata", location, {
1062
+ method: "PUT", body: metadata, schema: "Result"
1063
+ }) as API.Result;
1064
+ }
1065
+
1066
+ async getSheriffComplaintGroupsSlice(
1067
+ after: number | null = null, before: number | null = null, limit: number | null = null,
1068
+ status: API.SheriffComplaintStatus | null = null
1069
+ ): Promise<API.SheriffComplaintGroupsSliceInfo> {
1070
+ const location = ut`/sheriff/complaints/groups`;
1071
+ const params = {after, before, limit, status};
1072
+ return await this.call("getSheriffComplaintGroupsSlice", location, {
1073
+ method: "GET", params, schema: "SheriffComplaintGroupsSliceInfo"
1074
+ }) as API.SheriffComplaintGroupsSliceInfo;
1075
+ }
1076
+
1077
+ async getSheriffComplaintGroup(id: string): Promise<API.SheriffComplaintGroupInfo> {
1078
+ const location = ut`/sheriff/complaints/groups/${id}`;
1079
+ return await this.call("getSheriffComplaintGroup", location, {
1080
+ method: "GET", schema: "SheriffComplaintGroupInfo"
1081
+ }) as API.SheriffComplaintGroupInfo;
1082
+ }
1083
+
1084
+ async getSheriffComplaintsByGroup(id: string): Promise<API.SheriffComplaintInfo[]> {
1085
+ const location = ut`/sheriff/complaints/groups/${id}/complaints`;
1086
+ return await this.call("getSheriffComplaintsByGroup", location, {
1087
+ method: "GET", schema: "SheriffComplaintInfoArray"
1088
+ }) as API.SheriffComplaintInfo[];
1089
+ }
1090
+
1091
+ async updateSheriffComplaintGroup(
1092
+ id: string, decision: API.SheriffComplaintDecisionText
1093
+ ): Promise<API.SheriffComplaintGroupInfo> {
1094
+ const location = ut`/sheriff/complaints/groups/${id}`;
1095
+ return await this.call("updateSheriffComplaintGroup", location, {
1096
+ method: "PUT", body: decision, schema: "SheriffComplaintGroupInfo"
1097
+ }) as API.SheriffComplaintGroupInfo;
1098
+ }
1099
+
1100
+ async createSheriffComplaint(complaint: API.SheriffComplaintText): Promise<API.SheriffComplaintInfo> {
1101
+ const location = "/sheriff/complaints";
1102
+ return await this.call("createSheriffComplaint", location, {
1103
+ method: "POST", body: complaint, schema: "SheriffComplaintInfo"
1104
+ }) as API.SheriffComplaintInfo;
1105
+ }
1106
+
1107
+ async createSheriffOrder(sheriffOrder: API.SheriffOrderDetails): Promise<API.Result> {
1108
+ const location = "/sheriff/orders";
1109
+ return await this.call("createSheriffOrder", location, {
1110
+ method: "POST", body: sheriffOrder, schema: "Result"
1111
+ }) as API.Result;
1112
+ }
1113
+
1114
+ async getStory(id: string): Promise<API.StoryInfo> {
1115
+ const location = ut`/stories/${id}`;
1116
+ return await this.call("getStory", location, {
1117
+ method: "GET", schema: "StoryInfo", bodies: true
1118
+ }) as API.StoryInfo;
1119
+ }
1120
+
1121
+ async updateStory(id: string, story: API.StoryAttributes): Promise<API.StoryInfo> {
1122
+ const location = ut`/stories/${id}`;
1123
+ return await this.call("updateStory", location, {
1124
+ method: "PUT", body: story, schema: "StoryInfo", bodies: true
1125
+ }) as API.StoryInfo;
1126
+ }
1127
+
1128
+ async getSubscribers(
1129
+ remoteNodeName: string | null = null, type: API.SubscriptionType | null = null, feedName: string | null = null,
1130
+ entryId: string | null = null
1131
+ ): Promise<API.SubscriberInfo[]> {
1132
+ const location = ut`/people/subscribers`;
1133
+ const params = {nodeName: remoteNodeName, type, feedName, entryId};
1134
+ return await this.call("getSubscribers", location, {
1135
+ method: "GET", params, schema: "SubscriberInfoArray"
1136
+ }) as API.SubscriberInfo[];
1137
+ }
1138
+
1139
+ async createSubscriber(subscriber: API.SubscriberDescription): Promise<API.SubscriberInfo> {
1140
+ const location = "/people/subscribers";
1141
+ return await this.call("createSubscriber", location, {
1142
+ method: "POST", body: subscriber, schema: "SubscriberInfo"
1143
+ }) as API.SubscriberInfo;
1144
+ }
1145
+
1146
+ async getSubscriber(id: string): Promise<API.SubscriberInfo> {
1147
+ const location = ut`/people/subscribers/${id}`;
1148
+ return await this.call("getSubscriber", location, {
1149
+ method: "GET", schema: "SubscriberInfo"
1150
+ }) as API.SubscriberInfo;
1151
+ }
1152
+
1153
+ async updateSubscriber(id: string, subscriber: API.SubscriberOverride): Promise<API.SubscriberInfo> {
1154
+ const location = ut`/people/subscribers/${id}`;
1155
+ return await this.call("updateSubscriber", location, {
1156
+ method: "PUT", body: subscriber, schema: "SubscriberInfo"
1157
+ }) as API.SubscriberInfo;
1158
+ }
1159
+
1160
+ async deleteSubscriber(id: string): Promise<API.ContactInfo> {
1161
+ const location = ut`/people/subscribers/${id}`;
1162
+ return await this.call("deleteSubscriber", location, {
1163
+ method: "DELETE", schema: "ContactInfo"
1164
+ }) as API.ContactInfo;
1165
+ }
1166
+
1167
+ async getSubscriptions(
1168
+ remoteNodeName: string | null = null, type: API.SubscriptionType | null = null
1169
+ ): Promise<API.SubscriptionInfo[]> {
1170
+ const location = ut`/people/subscriptions`;
1171
+ const params = {nodeName: remoteNodeName, type};
1172
+ return await this.call("getSubscriptions", location, {
1173
+ method: "GET", params, schema: "SubscriptionInfoArray"
1174
+ }) as API.SubscriptionInfo[];
1175
+ }
1176
+
1177
+ async createSubscription(subscription: API.SubscriptionDescription): Promise<API.SubscriptionInfo> {
1178
+ const location = "/people/subscriptions";
1179
+ return await this.call("createSubscription", location, {
1180
+ method: "POST", body: subscription, schema: "SubscriptionInfo"
1181
+ }) as API.SubscriptionInfo;
1182
+ }
1183
+
1184
+ async updateSubscription(id: string, subscription: API.SubscriptionOverride): Promise<API.SubscriptionInfo> {
1185
+ const location = ut`/people/subscriptions/${id}`;
1186
+ return await this.call("updateSubscription", location, {
1187
+ method: "PUT", body: subscription, schema: "SubscriptionInfo"
1188
+ }) as API.SubscriptionInfo;
1189
+ }
1190
+
1191
+ async deleteSubscription(id: string): Promise<API.ContactInfo> {
1192
+ const location = ut`/people/subscriptions/${id}`;
1193
+ return await this.call("deleteSubscription", location, {
1194
+ method: "DELETE", schema: "ContactInfo"
1195
+ }) as API.ContactInfo;
1196
+ }
1197
+
1198
+ async searchSubscriptions(filter: API.SubscriptionFilter): Promise<API.SubscriptionInfo[]> {
1199
+ const location = "/people/subscriptions/search";
1200
+ return await this.call("searchSubscriptions", location, {
1201
+ method: "POST", body: filter, schema: "SubscriptionInfoArray"
1202
+ }) as API.SubscriptionInfo[];
1203
+ }
1204
+
1205
+ async getTokens(): Promise<API.TokenInfo[]> {
1206
+ const location = "/tokens";
1207
+ return await this.call("getTokens", location, {
1208
+ method: "GET", schema: "TokenInfoArray"
1209
+ }) as API.TokenInfo[];
1210
+ }
1211
+
1212
+ async createToken(token: API.TokenAttributes): Promise<API.TokenInfo> {
1213
+ const location = "/tokens";
1214
+ return await this.call("createToken", location, {
1215
+ method: "POST", body: token, schema: "TokenInfo"
1216
+ }) as API.TokenInfo;
1217
+ }
1218
+
1219
+ async getTokenInfo(id: string): Promise<API.TokenInfo> {
1220
+ const location = ut`/tokens/${id}`;
1221
+ return await this.call("getTokenInfo", location, {
1222
+ method: "GET", schema: "TokenInfo"
1223
+ }) as API.TokenInfo;
1224
+ }
1225
+
1226
+ async updateToken(id: string, token: API.TokenName): Promise<API.TokenInfo> {
1227
+ const location = ut`/tokens/${id}`;
1228
+ return await this.call("updateToken", location, {
1229
+ method: "PUT", body: token, schema: "TokenInfo"
1230
+ }) as API.TokenInfo;
1231
+ }
1232
+
1233
+ async deleteToken(id: string): Promise<API.Result> {
1234
+ const location = ut`/tokens/${id}`;
1235
+ return await this.call("deleteToken", location, {
1236
+ method: "DELETE", schema: "Result"
1237
+ }) as API.Result;
1238
+ }
1239
+
1240
+ async getUserListGeneral(name: string): Promise<API.UserListInfo> {
1241
+ const location = ut`/user-lists/${name}`;
1242
+ return await this.call("getUserListGeneral", location, {
1243
+ method: "GET", schema: "UserListInfo"
1244
+ }) as API.UserListInfo;
1245
+ }
1246
+
1247
+ async getUserListSlice(
1248
+ name: string, after: number | null = null, before: number | null = null, limit: number | null = null
1249
+ ): Promise<API.UserListSliceInfo> {
1250
+ const location = ut`/user-lists/${name}/items`;
1251
+ const params = {after, before, limit};
1252
+ return await this.call("getUserListSlice", location, {
1253
+ method: "GET", params, schema: "UserListSliceInfo"
1254
+ }) as API.UserListSliceInfo;
1255
+ }
1256
+
1257
+ async getUserListItem(name: string, remoteNodeName: string): Promise<API.UserListItemInfo> {
1258
+ const location = ut`/user-lists/${name}/items/${remoteNodeName}`;
1259
+ return await this.call("getUserListItem", location, {
1260
+ method: "GET", schema: "UserListItemInfo"
1261
+ }) as API.UserListItemInfo;
1262
+ }
1263
+
1264
+ async createUserListItem(name: string, item: API.UserListItemAttributes): Promise<API.UserListItemInfo> {
1265
+ const location = ut`/user-lists/${name}/items`;
1266
+ return await this.call("createUserListItem", location, {
1267
+ method: "POST", body: item, schema: "UserListItemInfo"
1268
+ }) as API.UserListItemInfo;
1269
+ }
1270
+
1271
+ async deleteUserListItem(name: string, remoteNodeName: string): Promise<API.Result> {
1272
+ const location = ut`/user-lists/${name}/items/${remoteNodeName}`;
1273
+ return await this.call("deleteUserListItem", location, {
1274
+ method: "DELETE", schema: "Result"
1275
+ }) as API.Result;
1276
+ }
1277
+
1278
+ async whoAmI(): Promise<API.WhoAmI> {
1279
+ const location = "/whoami";
1280
+ return await this.call("whoAmI", location, {
1281
+ method: "GET", schema: "WhoAmI"
1282
+ }) as API.WhoAmI;
1283
+ }
1284
+
1285
+ }