lemmy-js-client 0.19.0-rc.11 → 0.19.0-rc.13

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
@@ -126,6 +126,11 @@ import { VerifyEmail } from "./types/VerifyEmail";
126
126
  import { VerifyEmailResponse } from "./types/VerifyEmailResponse";
127
127
  import { UploadImage, UploadImageResponse } from "./types/others";
128
128
  import { HideCommunity } from "./types/HideCommunity";
129
+ import { BlockInstance } from "./types/BlockInstance";
130
+ import { BlockInstanceResponse } from "./types/BlockInstanceResponse";
131
+ import { GenerateTotpSecretResponse } from "./types/GenerateTotpSecretResponse";
132
+ import { UpdateTotp } from "./types/UpdateTotp";
133
+ import { UpdateTotpResponse } from "./types/UpdateTotpResponse";
129
134
  /**
130
135
  * Helps build lemmy HTTP requests.
131
136
  */
@@ -166,6 +171,24 @@ export declare class LemmyHttp {
166
171
  * `HTTP.POST /user/leave_admin`
167
172
  */
168
173
  leaveAdmin(): Promise<GetSiteResponse>;
174
+ /**
175
+ * Generate a TOTP / two-factor secret.
176
+ *
177
+ * Afterwards you need to call `/user/totp/update` with a valid token to enable it.
178
+ *
179
+ * `HTTP.POST /user/totp/generate`
180
+ */
181
+ generateTotpSecret(): Promise<GenerateTotpSecretResponse>;
182
+ /**
183
+ * Enable / Disable TOTP / two-factor authentication.
184
+ *
185
+ * To enable, you need to first call `/user/totp/generate` and then pass a valid token to this.
186
+ *
187
+ * Disabling is only possible if 2FA was previously enabled. Again it is necessary to pass a valid token.
188
+ *
189
+ * `HTTP.POST /user/totp/update`
190
+ */
191
+ updateTotp(form: UpdateTotp): Promise<UpdateTotpResponse>;
169
192
  /**
170
193
  * Get the modlog.
171
194
  *
@@ -658,6 +681,12 @@ export declare class LemmyHttp {
658
681
  * `HTTP.Get /federated_instances`
659
682
  */
660
683
  getFederatedInstances(): Promise<GetFederatedInstancesResponse>;
684
+ /**
685
+ * Block an instance.
686
+ *
687
+ * `HTTP.Post /site/block`
688
+ */
689
+ blockInstance(form: BlockInstance): Promise<BlockInstanceResponse>;
661
690
  /**
662
691
  * Upload an image to the server.
663
692
  */
package/dist/http.js CHANGED
@@ -90,6 +90,28 @@ class LemmyHttp {
90
90
  leaveAdmin() {
91
91
  return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/user/leave_admin", {});
92
92
  }
93
+ /**
94
+ * Generate a TOTP / two-factor secret.
95
+ *
96
+ * Afterwards you need to call `/user/totp/update` with a valid token to enable it.
97
+ *
98
+ * `HTTP.POST /user/totp/generate`
99
+ */
100
+ generateTotpSecret() {
101
+ return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/user/totp/generate", {});
102
+ }
103
+ /**
104
+ * Enable / Disable TOTP / two-factor authentication.
105
+ *
106
+ * To enable, you need to first call `/user/totp/generate` and then pass a valid token to this.
107
+ *
108
+ * Disabling is only possible if 2FA was previously enabled. Again it is necessary to pass a valid token.
109
+ *
110
+ * `HTTP.POST /user/totp/update`
111
+ */
112
+ updateTotp(form) {
113
+ return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/user/totp/update", form);
114
+ }
93
115
  /**
94
116
  * Get the modlog.
95
117
  *
@@ -746,6 +768,14 @@ class LemmyHttp {
746
768
  getFederatedInstances() {
747
769
  return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/federated_instances", {});
748
770
  }
771
+ /**
772
+ * Block an instance.
773
+ *
774
+ * `HTTP.Post /site/block`
775
+ */
776
+ blockInstance(form) {
777
+ return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/site/block", form);
778
+ }
749
779
  /**
750
780
  * Upload an image to the server.
751
781
  */
package/dist/index.d.ts CHANGED
@@ -82,6 +82,7 @@ export { EditSite } from "./types/EditSite";
82
82
  export { FeaturePost } from "./types/FeaturePost";
83
83
  export { FederatedInstances } from "./types/FederatedInstances";
84
84
  export { FollowCommunity } from "./types/FollowCommunity";
85
+ export { GenerateTotpSecretResponse } from "./types/GenerateTotpSecretResponse";
85
86
  export { GetCaptchaResponse } from "./types/GetCaptchaResponse";
86
87
  export { GetComment } from "./types/GetComment";
87
88
  export { GetComments } from "./types/GetComments";
@@ -236,6 +237,8 @@ export { SortType } from "./types/SortType";
236
237
  export { SubscribedType } from "./types/SubscribedType";
237
238
  export { Tagline } from "./types/Tagline";
238
239
  export { TransferCommunity } from "./types/TransferCommunity";
240
+ export { UpdateTotp } from "./types/UpdateTotp";
241
+ export { UpdateTotpResponse } from "./types/UpdateTotpResponse";
239
242
  export { VerifyEmail } from "./types/VerifyEmail";
240
243
  export { VerifyEmailResponse } from "./types/VerifyEmailResponse";
241
244
  export { UploadImage, UploadImageResponse, ImageFile } from "./types/others";
@@ -2,5 +2,4 @@ import type { InstanceId } from "./InstanceId";
2
2
  export interface BlockInstance {
3
3
  instance_id: InstanceId;
4
4
  block: boolean;
5
- auth: string;
6
5
  }
@@ -0,0 +1,3 @@
1
+ export interface GenerateTotpSecretResponse {
2
+ totp_secret_url: string;
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 });
@@ -21,11 +21,11 @@ export interface LocalUser {
21
21
  show_new_post_notifs: boolean;
22
22
  email_verified: boolean;
23
23
  accepted_application: boolean;
24
- totp_2fa_url?: string;
25
24
  open_links_in_new_tab: boolean;
26
25
  blur_nsfw: boolean;
27
26
  auto_expand: boolean;
28
27
  infinite_scroll_enabled: boolean;
29
28
  admin: boolean;
30
29
  post_listing_mode: PostListingMode;
30
+ totp_2fa_enabled: boolean;
31
31
  }
@@ -23,7 +23,6 @@ export interface SaveUserSettings {
23
23
  show_read_posts?: boolean;
24
24
  show_new_post_notifs?: boolean;
25
25
  discussion_languages?: Array<LanguageId>;
26
- generate_totp_2fa?: boolean;
27
26
  open_links_in_new_tab?: boolean;
28
27
  infinite_scroll_enabled?: boolean;
29
28
  }
@@ -0,0 +1,4 @@
1
+ export interface UpdateTotp {
2
+ totp_token: string;
3
+ enabled: boolean;
4
+ }
@@ -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,3 @@
1
+ export interface UpdateTotpResponse {
2
+ enabled: 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 });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lemmy-js-client",
3
- "version": "0.19.0-rc.11",
3
+ "version": "0.19.0-rc.13",
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",