lemmy-js-client 0.17.2-rc.10 → 0.17.2-rc.12

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
@@ -42,12 +42,14 @@ import { EditSite } from "./types/EditSite";
42
42
  import { FeaturePost } from "./types/FeaturePost";
43
43
  import { FollowCommunity } from "./types/FollowCommunity";
44
44
  import { GetBannedPersons } from "./types/GetBannedPersons";
45
+ import { GetCaptcha } from "./types/GetCaptcha";
45
46
  import { GetCaptchaResponse } from "./types/GetCaptchaResponse";
46
47
  import { GetComment } from "./types/GetComment";
47
48
  import { GetComments } from "./types/GetComments";
48
49
  import { GetCommentsResponse } from "./types/GetCommentsResponse";
49
50
  import { GetCommunity } from "./types/GetCommunity";
50
51
  import { GetCommunityResponse } from "./types/GetCommunityResponse";
52
+ import { GetFederatedInstances } from "./types/GetFederatedInstances";
51
53
  import { GetModlog } from "./types/GetModlog";
52
54
  import { GetModlogResponse } from "./types/GetModlogResponse";
53
55
  import { GetPersonDetails } from "./types/GetPersonDetails";
@@ -514,7 +516,7 @@ export declare class LemmyHttp {
514
516
  *
515
517
  * `HTTP.GET /user/get_captcha`
516
518
  */
517
- getCaptcha(): Promise<GetCaptchaResponse>;
519
+ getCaptcha(form: GetCaptcha): Promise<GetCaptchaResponse>;
518
520
  /**
519
521
  * Delete your account.
520
522
  *
@@ -635,6 +637,12 @@ export declare class LemmyHttp {
635
637
  * `HTTP.Post /custom_emoji/delete`
636
638
  */
637
639
  deleteCustomEmoji(form: DeleteCustomEmoji): Promise<unknown>;
640
+ /**
641
+ * Fetch federated instances.
642
+ *
643
+ * `HTTP.Get /federated_instances`
644
+ */
645
+ getFederatedInstances(form: GetFederatedInstances): Promise<unknown>;
638
646
  /**
639
647
  * Upload an image to the server.
640
648
  */
package/dist/http.js CHANGED
@@ -578,8 +578,8 @@ var LemmyHttp = /** @class */ (function () {
578
578
  *
579
579
  * `HTTP.GET /user/get_captcha`
580
580
  */
581
- LemmyHttp.prototype.getCaptcha = function () {
582
- return this.wrapper(HttpType.Get, "/user/get_captcha", {});
581
+ LemmyHttp.prototype.getCaptcha = function (form) {
582
+ return this.wrapper(HttpType.Get, "/user/get_captcha", form);
583
583
  };
584
584
  /**
585
585
  * Delete your account.
@@ -753,6 +753,18 @@ var LemmyHttp = /** @class */ (function () {
753
753
  });
754
754
  });
755
755
  };
756
+ /**
757
+ * Fetch federated instances.
758
+ *
759
+ * `HTTP.Get /federated_instances`
760
+ */
761
+ LemmyHttp.prototype.getFederatedInstances = function (form) {
762
+ return __awaiter(this, void 0, void 0, function () {
763
+ return __generator(this, function (_a) {
764
+ return [2 /*return*/, this.wrapper(HttpType.Get, "/federated_instances", form)];
765
+ });
766
+ });
767
+ };
756
768
  /**
757
769
  * Upload an image to the server.
758
770
  */
@@ -828,19 +840,10 @@ var LemmyHttp = /** @class */ (function () {
828
840
  }());
829
841
  exports.LemmyHttp = LemmyHttp;
830
842
  function encodeGetParams(p) {
831
- // console.log(JSON.stringify(p));
832
- // console.log(new URLSearchParams(JSON.stringify(p)).toString());
833
- // return new URLSearchParams(JSON.stringify(p)).toString();
834
- return (Object.entries(p)
843
+ return Object.entries(p)
835
844
  .filter(function (kv) { return !!kv[1]; })
836
- .map(function (kv) {
837
- return kv
838
- .map(function (e) { return JSON.stringify(e); })
839
- .map(encodeURIComponent)
840
- .join("=");
841
- })
842
- // .map(kv => (kv.0 + '=' + JSON.stringify(kv.1)))
843
- .join("&"));
845
+ .map(function (kv) { return kv.map(encodeURIComponent).join("="); })
846
+ .join("&");
844
847
  }
845
848
  function createFormData(image) {
846
849
  var formData = new form_data_1.default();
@@ -1 +1,3 @@
1
- export type GetCaptcha = null;
1
+ export interface GetCaptcha {
2
+ auth?: string;
3
+ }
@@ -1 +1,3 @@
1
- export type GetFederatedInstances = null;
1
+ export interface GetFederatedInstances {
2
+ auth?: string;
3
+ }
@@ -1,5 +1,7 @@
1
- import type { PostOrCommentId } from "./PostOrCommentId";
1
+ import type { CommentId } from "./CommentId";
2
+ import type { PostId } from "./PostId";
2
3
  export interface GetPost {
3
- id: PostOrCommentId;
4
+ id?: PostId;
5
+ comment_id?: CommentId;
4
6
  auth?: string;
5
7
  }
@@ -89,7 +89,8 @@ export declare enum UserOperation {
89
89
  VerifyEmail = 82,
90
90
  CreateCustomEmoji = 83,
91
91
  EditCustomEmoji = 84,
92
- DeleteCustomEmoji = 85
92
+ DeleteCustomEmoji = 85,
93
+ GetFederatedInstances = 86
93
94
  }
94
95
  export interface UploadImage {
95
96
  image: File | Buffer;
@@ -93,4 +93,5 @@ var UserOperation;
93
93
  UserOperation[UserOperation["CreateCustomEmoji"] = 83] = "CreateCustomEmoji";
94
94
  UserOperation[UserOperation["EditCustomEmoji"] = 84] = "EditCustomEmoji";
95
95
  UserOperation[UserOperation["DeleteCustomEmoji"] = 85] = "DeleteCustomEmoji";
96
+ UserOperation[UserOperation["GetFederatedInstances"] = 86] = "GetFederatedInstances";
96
97
  })(UserOperation = exports.UserOperation || (exports.UserOperation = {}));
@@ -33,9 +33,11 @@ import { EditSite } from "./types/EditSite";
33
33
  import { FeaturePost } from "./types/FeaturePost";
34
34
  import { FollowCommunity } from "./types/FollowCommunity";
35
35
  import { GetBannedPersons } from "./types/GetBannedPersons";
36
+ import { GetCaptcha } from "./types/GetCaptcha";
36
37
  import { GetComment } from "./types/GetComment";
37
38
  import { GetComments } from "./types/GetComments";
38
39
  import { GetCommunity } from "./types/GetCommunity";
40
+ import { GetFederatedInstances } from "./types/GetFederatedInstances";
39
41
  import { GetModlog } from "./types/GetModlog";
40
42
  import { GetPersonDetails } from "./types/GetPersonDetails";
41
43
  import { GetPersonMentions } from "./types/GetPersonMentions";
@@ -124,7 +126,7 @@ export declare class LemmyWebsocket {
124
126
  /**
125
127
  * Fetch a Captcha.
126
128
  */
127
- getCaptcha(): string;
129
+ getCaptcha(form: GetCaptcha): string;
128
130
  /**
129
131
  * Create a new community.
130
132
  */
@@ -445,6 +447,10 @@ export declare class LemmyWebsocket {
445
447
  * Delete a custom emoji
446
448
  */
447
449
  deleteCustomEmoji(form: DeleteCustomEmoji): string;
450
+ /**
451
+ * Fetch federated instances.
452
+ */
453
+ getFederatedInstances(form: GetFederatedInstances): string;
448
454
  }
449
455
  export declare function wsUserOp(msg: any): UserOperation;
450
456
  /**
package/dist/websocket.js CHANGED
@@ -53,8 +53,8 @@ var LemmyWebsocket = /** @class */ (function () {
53
53
  /**
54
54
  * Fetch a Captcha.
55
55
  */
56
- LemmyWebsocket.prototype.getCaptcha = function () {
57
- return wrapper(others_1.UserOperation.GetCaptcha, {});
56
+ LemmyWebsocket.prototype.getCaptcha = function (form) {
57
+ return wrapper(others_1.UserOperation.GetCaptcha, form);
58
58
  };
59
59
  /**
60
60
  * Create a new community.
@@ -536,6 +536,12 @@ var LemmyWebsocket = /** @class */ (function () {
536
536
  LemmyWebsocket.prototype.deleteCustomEmoji = function (form) {
537
537
  return wrapper(others_1.UserOperation.DeleteCustomEmoji, form);
538
538
  };
539
+ /**
540
+ * Fetch federated instances.
541
+ */
542
+ LemmyWebsocket.prototype.getFederatedInstances = function (form) {
543
+ return wrapper(others_1.UserOperation.GetFederatedInstances, form);
544
+ };
539
545
  return LemmyWebsocket;
540
546
  }());
541
547
  exports.LemmyWebsocket = LemmyWebsocket;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lemmy-js-client",
3
- "version": "0.17.2-rc.10",
3
+ "version": "0.17.2-rc.12",
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",