lemmy-js-client 0.19.0-alpha.12 → 0.19.0-alpha.14

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/http.d.ts CHANGED
@@ -1,13 +1,20 @@
1
1
  import fetch from "cross-fetch";
2
2
  import { AddAdmin } from "./types/AddAdmin";
3
+ import { AddAdminResponse } from "./types/AddAdminResponse";
3
4
  import { AddModToCommunity } from "./types/AddModToCommunity";
5
+ import { AddModToCommunityResponse } from "./types/AddModToCommunityResponse";
4
6
  import { ApproveRegistrationApplication } from "./types/ApproveRegistrationApplication";
5
7
  import { BanFromCommunity } from "./types/BanFromCommunity";
8
+ import { BanFromCommunityResponse } from "./types/BanFromCommunityResponse";
6
9
  import { BanPerson } from "./types/BanPerson";
10
+ import { BanPersonResponse } from "./types/BanPersonResponse";
7
11
  import { BannedPersonsResponse } from "./types/BannedPersonsResponse";
8
12
  import { BlockCommunity } from "./types/BlockCommunity";
13
+ import { BlockCommunityResponse } from "./types/BlockCommunityResponse";
9
14
  import { BlockPerson } from "./types/BlockPerson";
15
+ import { BlockPersonResponse } from "./types/BlockPersonResponse";
10
16
  import { ChangePassword } from "./types/ChangePassword";
17
+ import { CommentReplyResponse } from "./types/CommentReplyResponse";
11
18
  import { CommentReportResponse } from "./types/CommentReportResponse";
12
19
  import { CommentResponse } from "./types/CommentResponse";
13
20
  import { CommunityResponse } from "./types/CommunityResponse";
@@ -115,10 +122,12 @@ import { VerifyEmail } from "./types/VerifyEmail";
115
122
  import { DeleteImage, UploadImage, UploadImageResponse } from "./types/others";
116
123
  import { HideCommunity } from "./types/HideCommunity";
117
124
  import { BlockInstance } from "./types/BlockInstance";
125
+ import { BlockInstanceResponse } from "./types/BlockInstanceResponse";
118
126
  import { GenerateTotpSecretResponse } from "./types/GenerateTotpSecretResponse";
119
127
  import { UpdateTotp } from "./types/UpdateTotp";
120
128
  import { UpdateTotpResponse } from "./types/UpdateTotpResponse";
121
129
  import { SuccessResponse } from "./types/SuccessResponse";
130
+ import { LoginToken } from "./types/LoginToken";
122
131
  /**
123
132
  * Helps build lemmy HTTP requests.
124
133
  */
@@ -167,6 +176,31 @@ export declare class LemmyHttp {
167
176
  * `HTTP.POST /user/totp/generate`
168
177
  */
169
178
  generateTotpSecret(): Promise<GenerateTotpSecretResponse>;
179
+ /**
180
+ * Export a backup of your user settings, including your saved content,
181
+ * followed communities, and blocks.
182
+ *
183
+ * `HTTP.GET /user/export_settings`
184
+ */
185
+ exportSettings(): Promise<any>;
186
+ /**
187
+ * Import a backup of your user settings.
188
+ *
189
+ * `HTTP.POST /user/import_settings`
190
+ */
191
+ importSettings(form: any): Promise<SuccessResponse>;
192
+ /**
193
+ * List login tokens for your user
194
+ *
195
+ * `HTTP.GET /user/list_logins`
196
+ */
197
+ listLogins(): Promise<LoginToken[]>;
198
+ /**
199
+ * Returns an error message if your auth token is invalid
200
+ *
201
+ * `HTTP.GET /user/validate_auth`
202
+ */
203
+ validateAuth(): Promise<SuccessResponse>;
170
204
  /**
171
205
  * Enable / Disable TOTP / two-factor authentication.
172
206
  *
@@ -230,7 +264,7 @@ export declare class LemmyHttp {
230
264
  *
231
265
  * `HTTP.POST /community/block`
232
266
  */
233
- blockCommunity(form: BlockCommunity): Promise<SuccessResponse>;
267
+ blockCommunity(form: BlockCommunity): Promise<BlockCommunityResponse>;
234
268
  /**
235
269
  * Delete a community.
236
270
  *
@@ -238,11 +272,11 @@ export declare class LemmyHttp {
238
272
  */
239
273
  deleteCommunity(form: DeleteCommunity): Promise<CommunityResponse>;
240
274
  /**
241
- * Hide a community from public view.
275
+ * Hide a community from public / "All" view. Admins only.
242
276
  *
243
277
  * `HTTP.PUT /community/hide`
244
278
  */
245
- hideCommunity(form: HideCommunity): Promise<CommunityResponse>;
279
+ hideCommunity(form: HideCommunity): Promise<SuccessResponse>;
246
280
  /**
247
281
  * A moderator remove for a community.
248
282
  *
@@ -260,13 +294,13 @@ export declare class LemmyHttp {
260
294
  *
261
295
  * `HTTP.POST /community/ban_user`
262
296
  */
263
- banFromCommunity(form: BanFromCommunity): Promise<SuccessResponse>;
297
+ banFromCommunity(form: BanFromCommunity): Promise<BanFromCommunityResponse>;
264
298
  /**
265
299
  * Add a moderator to your community.
266
300
  *
267
301
  * `HTTP.POST /community/mod`
268
302
  */
269
- addModToCommunity(form: AddModToCommunity): Promise<SuccessResponse>;
303
+ addModToCommunity(form: AddModToCommunity): Promise<AddModToCommunityResponse>;
270
304
  /**
271
305
  * Create a post.
272
306
  *
@@ -302,7 +336,7 @@ export declare class LemmyHttp {
302
336
  *
303
337
  * `HTTP.POST /post/mark_as_read`
304
338
  */
305
- markPostAsRead(form: MarkPostAsRead): Promise<PostResponse>;
339
+ markPostAsRead(form: MarkPostAsRead): Promise<SuccessResponse>;
306
340
  /**
307
341
  * A moderator can lock a post ( IE disable new comments ).
308
342
  *
@@ -386,7 +420,7 @@ export declare class LemmyHttp {
386
420
  *
387
421
  * `HTTP.POST /comment/mark_as_read`
388
422
  */
389
- markCommentReplyAsRead(form: MarkCommentReplyAsRead): Promise<SuccessResponse>;
423
+ markCommentReplyAsRead(form: MarkCommentReplyAsRead): Promise<CommentReplyResponse>;
390
424
  /**
391
425
  * Like / vote on a comment.
392
426
  *
@@ -524,7 +558,7 @@ export declare class LemmyHttp {
524
558
  *
525
559
  * `HTTP.POST /user/ban`
526
560
  */
527
- banPerson(form: BanPerson): Promise<SuccessResponse>;
561
+ banPerson(form: BanPerson): Promise<BanPersonResponse>;
528
562
  /**
529
563
  * Get a list of banned users
530
564
  *
@@ -536,7 +570,7 @@ export declare class LemmyHttp {
536
570
  *
537
571
  * `HTTP.POST /user/block`
538
572
  */
539
- blockPerson(form: BlockPerson): Promise<SuccessResponse>;
573
+ blockPerson(form: BlockPerson): Promise<BlockPersonResponse>;
540
574
  /**
541
575
  * Fetch a Captcha.
542
576
  *
@@ -560,7 +594,7 @@ export declare class LemmyHttp {
560
594
  *
561
595
  * `HTTP.POST /user/password_change`
562
596
  */
563
- passwordChangeAfterReset(form: PasswordChangeAfterReset): Promise<LoginResponse>;
597
+ passwordChangeAfterReset(form: PasswordChangeAfterReset): Promise<SuccessResponse>;
564
598
  /**
565
599
  * Mark all replies as read.
566
600
  *
@@ -572,7 +606,7 @@ export declare class LemmyHttp {
572
606
  *
573
607
  * `HTTP.PUT /user/save_user_settings`
574
608
  */
575
- saveUserSettings(form: SaveUserSettings): Promise<LoginResponse>;
609
+ saveUserSettings(form: SaveUserSettings): Promise<SuccessResponse>;
576
610
  /**
577
611
  * Change your user password.
578
612
  *
@@ -602,7 +636,7 @@ export declare class LemmyHttp {
602
636
  *
603
637
  * `HTTP.POST /admin/add`
604
638
  */
605
- addAdmin(form: AddAdmin): Promise<SuccessResponse>;
639
+ addAdmin(form: AddAdmin): Promise<AddAdminResponse>;
606
640
  /**
607
641
  * Get the unread registration applications count.
608
642
  *
@@ -674,7 +708,7 @@ export declare class LemmyHttp {
674
708
  *
675
709
  * `HTTP.Post /site/block`
676
710
  */
677
- blockInstance(form: BlockInstance): Promise<SuccessResponse>;
711
+ blockInstance(form: BlockInstance): Promise<BlockInstanceResponse>;
678
712
  /**
679
713
  * Upload an image to the server.
680
714
  */
package/dist/http.js CHANGED
@@ -100,6 +100,39 @@ class LemmyHttp {
100
100
  generateTotpSecret() {
101
101
  return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/user/totp/generate", {});
102
102
  }
103
+ /**
104
+ * Export a backup of your user settings, including your saved content,
105
+ * followed communities, and blocks.
106
+ *
107
+ * `HTTP.GET /user/export_settings`
108
+ */
109
+ exportSettings() {
110
+ return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/user/export_settings", {});
111
+ }
112
+ /**
113
+ * Import a backup of your user settings.
114
+ *
115
+ * `HTTP.POST /user/import_settings`
116
+ */
117
+ importSettings(form) {
118
+ return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/user/import_settings", form);
119
+ }
120
+ /**
121
+ * List login tokens for your user
122
+ *
123
+ * `HTTP.GET /user/list_logins`
124
+ */
125
+ listLogins() {
126
+ return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/user/list_logins", {});
127
+ }
128
+ /**
129
+ * Returns an error message if your auth token is invalid
130
+ *
131
+ * `HTTP.GET /user/validate_auth`
132
+ */
133
+ validateAuth() {
134
+ return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/user/validate_auth", {});
135
+ }
103
136
  /**
104
137
  * Enable / Disable TOTP / two-factor authentication.
105
138
  *
@@ -193,7 +226,7 @@ class LemmyHttp {
193
226
  return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/community/delete", form);
194
227
  }
195
228
  /**
196
- * Hide a community from public view.
229
+ * Hide a community from public / "All" view. Admins only.
197
230
  *
198
231
  * `HTTP.PUT /community/hide`
199
232
  */
package/dist/index.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  export * from "./http";
2
2
  export { AddAdmin } from "./types/AddAdmin";
3
+ export { AddAdminResponse } from "./types/AddAdminResponse";
3
4
  export { AddModToCommunity } from "./types/AddModToCommunity";
5
+ export { AddModToCommunityResponse } from "./types/AddModToCommunityResponse";
4
6
  export { AdminPurgeComment } from "./types/AdminPurgeComment";
5
7
  export { AdminPurgeCommentView } from "./types/AdminPurgeCommentView";
6
8
  export { AdminPurgeCommunity } from "./types/AdminPurgeCommunity";
@@ -11,11 +13,16 @@ export { AdminPurgePost } from "./types/AdminPurgePost";
11
13
  export { AdminPurgePostView } from "./types/AdminPurgePostView";
12
14
  export { ApproveRegistrationApplication } from "./types/ApproveRegistrationApplication";
13
15
  export { BanFromCommunity } from "./types/BanFromCommunity";
16
+ export { BanFromCommunityResponse } from "./types/BanFromCommunityResponse";
14
17
  export { BanPerson } from "./types/BanPerson";
18
+ export { BanPersonResponse } from "./types/BanPersonResponse";
15
19
  export { BannedPersonsResponse } from "./types/BannedPersonsResponse";
16
20
  export { BlockCommunity } from "./types/BlockCommunity";
21
+ export { BlockCommunityResponse } from "./types/BlockCommunityResponse";
17
22
  export { BlockInstance } from "./types/BlockInstance";
23
+ export { BlockInstanceResponse } from "./types/BlockInstanceResponse";
18
24
  export { BlockPerson } from "./types/BlockPerson";
25
+ export { BlockPersonResponse } from "./types/BlockPersonResponse";
19
26
  export { CaptchaResponse } from "./types/CaptchaResponse";
20
27
  export { ChangePassword } from "./types/ChangePassword";
21
28
  export { Comment } from "./types/Comment";
@@ -23,6 +30,7 @@ export { CommentAggregates } from "./types/CommentAggregates";
23
30
  export { CommentId } from "./types/CommentId";
24
31
  export { CommentReply } from "./types/CommentReply";
25
32
  export { CommentReplyId } from "./types/CommentReplyId";
33
+ export { CommentReplyResponse } from "./types/CommentReplyResponse";
26
34
  export { CommentReplyView } from "./types/CommentReplyView";
27
35
  export { CommentReport } from "./types/CommentReport";
28
36
  export { CommentReportId } from "./types/CommentReportId";
@@ -129,6 +137,7 @@ export { LocalUserView } from "./types/LocalUserView";
129
137
  export { LockPost } from "./types/LockPost";
130
138
  export { Login } from "./types/Login";
131
139
  export { LoginResponse } from "./types/LoginResponse";
140
+ export { LoginToken } from "./types/LoginToken";
132
141
  export { MarkCommentReplyAsRead } from "./types/MarkCommentReplyAsRead";
133
142
  export { MarkPersonMentionAsRead } from "./types/MarkPersonMentionAsRead";
134
143
  export { MarkPostAsRead } from "./types/MarkPostAsRead";
@@ -170,6 +179,7 @@ export { PersonMention } from "./types/PersonMention";
170
179
  export { PersonMentionId } from "./types/PersonMentionId";
171
180
  export { PersonMentionResponse } from "./types/PersonMentionResponse";
172
181
  export { PersonMentionView } from "./types/PersonMentionView";
182
+ export { PersonSortType } from "./types/PersonSortType";
173
183
  export { PersonView } from "./types/PersonView";
174
184
  export { Post } from "./types/Post";
175
185
  export { PostAggregates } from "./types/PostAggregates";
@@ -0,0 +1,4 @@
1
+ import type { PersonView } from "./PersonView";
2
+ export interface AddAdminResponse {
3
+ admins: Array<PersonView>;
4
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ import type { CommunityModeratorView } from "./CommunityModeratorView";
2
+ export interface AddModToCommunityResponse {
3
+ moderators: Array<CommunityModeratorView>;
4
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ import type { PersonView } from "./PersonView";
2
+ export interface BanFromCommunityResponse {
3
+ person_view: PersonView;
4
+ banned: boolean;
5
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ import type { PersonView } from "./PersonView";
2
+ export interface BanPersonResponse {
3
+ person_view: PersonView;
4
+ banned: boolean;
5
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ import type { CommunityView } from "./CommunityView";
2
+ export interface BlockCommunityResponse {
3
+ community_view: CommunityView;
4
+ blocked: boolean;
5
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ export interface BlockInstanceResponse {
2
+ blocked: boolean;
3
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ import type { PersonView } from "./PersonView";
2
+ export interface BlockPersonResponse {
3
+ person_view: PersonView;
4
+ blocked: boolean;
5
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ import type { CommentReplyView } from "./CommentReplyView";
2
+ export interface CommentReplyResponse {
3
+ comment_reply_view: CommentReplyView;
4
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ import type { LocalUserId } from "./LocalUserId";
2
+ export interface LoginToken {
3
+ id: number;
4
+ user_id: LocalUserId;
5
+ published: string;
6
+ ip?: string;
7
+ user_agent?: string;
8
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +1,6 @@
1
1
  import type { PostId } from "./PostId";
2
2
  export interface MarkPostAsRead {
3
- post_id: PostId;
4
- post_ids: Array<PostId>;
3
+ post_id?: PostId;
4
+ post_ids?: Array<PostId>;
5
5
  read: boolean;
6
6
  }
@@ -0,0 +1 @@
1
+ export type PersonSortType = "New" | "Old" | "MostComments" | "CommentScore" | "PostScore" | "PostCount";
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lemmy-js-client",
3
- "version": "0.19.0-alpha.12",
3
+ "version": "0.19.0-alpha.14",
4
4
  "description": "A javascript / typescript client for Lemmy",
5
5
  "repository": "https://github.com/LemmyNet/lemmy-js-client",
6
6
  "license": "AGPL-3.0",