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

Sign up to get free protection for your applications and to get access to all the features.
package/dist/http.d.ts CHANGED
@@ -119,7 +119,7 @@ import { SearchResponse } from "./types/SearchResponse";
119
119
  import { SiteResponse } from "./types/SiteResponse";
120
120
  import { TransferCommunity } from "./types/TransferCommunity";
121
121
  import { VerifyEmail } from "./types/VerifyEmail";
122
- import { DeleteImage, UploadImage, UploadImageResponse } from "./types/others";
122
+ import { DeleteImage, UploadImage, UploadImageResponse } from "./other_types";
123
123
  import { HideCommunity } from "./types/HideCommunity";
124
124
  import { BlockInstance } from "./types/BlockInstance";
125
125
  import { BlockInstanceResponse } from "./types/BlockInstanceResponse";
@@ -529,6 +529,7 @@ export declare class LemmyHttp {
529
529
  * `HTTP.POST /user/login`
530
530
  */
531
531
  login(form: Login): Promise<LoginResponse>;
532
+ logout(): Promise<SuccessResponse>;
532
533
  /**
533
534
  * Get the details for a person.
534
535
  *
package/dist/http.js CHANGED
@@ -27,7 +27,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
27
27
  exports.LemmyHttp = void 0;
28
28
  const cross_fetch_1 = __importDefault(require("cross-fetch"));
29
29
  const form_data_1 = __importDefault(require("form-data"));
30
- const others_1 = require("./types/others");
30
+ const other_types_1 = require("./other_types");
31
31
  var HttpType;
32
32
  (function (HttpType) {
33
33
  HttpType["Get"] = "GET";
@@ -49,7 +49,7 @@ class LemmyHttp {
49
49
  _LemmyHttp_headers.set(this, {});
50
50
  _LemmyHttp_pictrsUrl.set(this, void 0);
51
51
  _LemmyHttp_fetchFunction.set(this, cross_fetch_1.default);
52
- __classPrivateFieldSet(this, _LemmyHttp_apiUrl, `${baseUrl.replace(/\/+$/, "")}/api/${others_1.VERSION}`, "f");
52
+ __classPrivateFieldSet(this, _LemmyHttp_apiUrl, `${baseUrl.replace(/\/+$/, "")}/api/${other_types_1.VERSION}`, "f");
53
53
  __classPrivateFieldSet(this, _LemmyHttp_pictrsUrl, `${baseUrl}/pictrs/image`, "f");
54
54
  if (options === null || options === void 0 ? void 0 : options.headers) {
55
55
  __classPrivateFieldSet(this, _LemmyHttp_headers, options.headers, "f");
@@ -569,6 +569,9 @@ class LemmyHttp {
569
569
  login(form) {
570
570
  return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/user/login", form);
571
571
  }
572
+ logout() {
573
+ return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/user/logout", {});
574
+ }
572
575
  /**
573
576
  * Get the details for a person.
574
577
  *
@@ -895,10 +898,10 @@ _LemmyHttp_apiUrl = new WeakMap(), _LemmyHttp_headers = new WeakMap(), _LemmyHtt
895
898
  json = yield response.json();
896
899
  }
897
900
  catch (error) {
898
- throw response.statusText;
901
+ throw new Error(response.statusText);
899
902
  }
900
903
  if (!response.ok) {
901
- throw (_a = json["error"]) !== null && _a !== void 0 ? _a : response.statusText;
904
+ throw new Error((_a = json["error"]) !== null && _a !== void 0 ? _a : response.statusText);
902
905
  }
903
906
  else {
904
907
  return json;
package/dist/index.d.ts CHANGED
@@ -179,7 +179,6 @@ export { PersonMention } from "./types/PersonMention";
179
179
  export { PersonMentionId } from "./types/PersonMentionId";
180
180
  export { PersonMentionResponse } from "./types/PersonMentionResponse";
181
181
  export { PersonMentionView } from "./types/PersonMentionView";
182
- export { PersonSortType } from "./types/PersonSortType";
183
182
  export { PersonView } from "./types/PersonView";
184
183
  export { Post } from "./types/Post";
185
184
  export { PostAggregates } from "./types/PostAggregates";
@@ -238,4 +237,4 @@ export { TransferCommunity } from "./types/TransferCommunity";
238
237
  export { UpdateTotp } from "./types/UpdateTotp";
239
238
  export { UpdateTotpResponse } from "./types/UpdateTotpResponse";
240
239
  export { VerifyEmail } from "./types/VerifyEmail";
241
- export { UploadImage, UploadImageResponse, ImageFile, DeleteImage, } from "./types/others";
240
+ export { UploadImage, UploadImageResponse, ImageFile, DeleteImage, } from "./other_types";
@@ -14,6 +14,7 @@ export interface CommentReplyView {
14
14
  recipient: Person;
15
15
  counts: CommentAggregates;
16
16
  creator_banned_from_community: boolean;
17
+ creator_is_moderator: boolean;
17
18
  subscribed: SubscribedType;
18
19
  saved: boolean;
19
20
  creator_blocked: boolean;
@@ -11,6 +11,7 @@ export interface CommentView {
11
11
  community: Community;
12
12
  counts: CommentAggregates;
13
13
  creator_banned_from_community: boolean;
14
+ creator_is_moderator: boolean;
14
15
  subscribed: SubscribedType;
15
16
  saved: boolean;
16
17
  creator_blocked: boolean;
@@ -298,6 +298,8 @@ export type LemmyErrorType = {
298
298
  error: "ban_expiration_in_past";
299
299
  } | {
300
300
  error: "invalid_unix_time";
301
+ } | {
302
+ error: "invalid_bot_action";
301
303
  } | {
302
304
  error: "unknown";
303
305
  message: string;
@@ -3,7 +3,5 @@ export interface PersonAggregates {
3
3
  id: number;
4
4
  person_id: PersonId;
5
5
  post_count: number;
6
- post_score: number;
7
6
  comment_count: number;
8
- comment_score: number;
9
7
  }
@@ -14,6 +14,7 @@ export interface PersonMentionView {
14
14
  recipient: Person;
15
15
  counts: CommentAggregates;
16
16
  creator_banned_from_community: boolean;
17
+ creator_is_moderator: boolean;
17
18
  subscribed: SubscribedType;
18
19
  saved: boolean;
19
20
  creator_blocked: boolean;
@@ -8,6 +8,7 @@ export interface PostView {
8
8
  creator: Person;
9
9
  community: Community;
10
10
  creator_banned_from_community: boolean;
11
+ creator_is_moderator: boolean;
11
12
  counts: PostAggregates;
12
13
  subscribed: SubscribedType;
13
14
  saved: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lemmy-js-client",
3
- "version": "0.19.0-alpha.14",
3
+ "version": "0.19.0-alpha.16",
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",
@@ -1 +0,0 @@
1
- export type PersonSortType = "New" | "Old" | "MostComments" | "CommentScore" | "PostScore" | "PostCount";
@@ -1,3 +0,0 @@
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/dist/utils.d.ts DELETED
File without changes
package/dist/utils.js DELETED
File without changes
File without changes
File without changes