lemmy-js-client 0.19.0-alpha.15 → 0.19.0-alpha.17

Sign up to get free protection for your applications and to get access to all the features.
package/dist/http.d.ts CHANGED
@@ -713,11 +713,11 @@ export declare class LemmyHttp {
713
713
  /**
714
714
  * Upload an image to the server.
715
715
  */
716
- uploadImage({ image, auth, }: UploadImage): Promise<UploadImageResponse>;
716
+ uploadImage({ image }: UploadImage): Promise<UploadImageResponse>;
717
717
  /**
718
718
  * Delete a pictrs image
719
719
  */
720
- deleteImage({ token, filename, auth }: DeleteImage): Promise<any>;
720
+ deleteImage({ token, filename }: DeleteImage): Promise<any>;
721
721
  /**
722
722
  * Set the headers (can be used to set the auth header)
723
723
  */
package/dist/http.js CHANGED
@@ -815,22 +815,15 @@ class LemmyHttp {
815
815
  /**
816
816
  * Upload an image to the server.
817
817
  */
818
- uploadImage({ image, auth, }) {
819
- var _a, _b, _c, _d;
818
+ uploadImage({ image }) {
820
819
  return __awaiter(this, void 0, void 0, function* () {
821
820
  const formData = createFormData(image);
822
- // If auth cookie not already set by browser, set it with passed in auth
823
- const headers = {};
824
- if (!((_b = (_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) === null || _a === void 0 ? void 0 : _a.cookie) === null || _b === void 0 ? void 0 : _b.includes("auth=")) &&
825
- !((_d = (_c = __classPrivateFieldGet(this, _LemmyHttp_headers, "f")) === null || _c === void 0 ? void 0 : _c.Cookie) === null || _d === void 0 ? void 0 : _d.includes("auth="))) {
826
- headers.Cookie = `auth=${auth}`;
827
- }
828
821
  let url = undefined;
829
822
  let delete_url = undefined;
830
823
  const response = yield __classPrivateFieldGet(this, _LemmyHttp_fetchFunction, "f").call(this, __classPrivateFieldGet(this, _LemmyHttp_pictrsUrl, "f"), {
831
824
  method: HttpType.Post,
832
825
  body: formData,
833
- headers: Object.assign(Object.assign({}, __classPrivateFieldGet(this, _LemmyHttp_headers, "f")), headers),
826
+ headers: __classPrivateFieldGet(this, _LemmyHttp_headers, "f"),
834
827
  });
835
828
  if (response.status === 413) {
836
829
  return { msg: "too_large" };
@@ -848,19 +841,12 @@ class LemmyHttp {
848
841
  /**
849
842
  * Delete a pictrs image
850
843
  */
851
- deleteImage({ token, filename, auth }) {
852
- var _a, _b, _c, _d;
844
+ deleteImage({ token, filename }) {
853
845
  return __awaiter(this, void 0, void 0, function* () {
854
- // If auth cookie not already set by browser, set it with passed in auth
855
- const headers = {};
856
- if (!((_b = (_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) === null || _a === void 0 ? void 0 : _a.cookie) === null || _b === void 0 ? void 0 : _b.includes("auth=")) &&
857
- !((_d = (_c = __classPrivateFieldGet(this, _LemmyHttp_headers, "f")) === null || _c === void 0 ? void 0 : _c.Cookie) === null || _d === void 0 ? void 0 : _d.includes("auth="))) {
858
- headers.Cookie = `auth=${auth}`;
859
- }
860
846
  const deleteUrl = `${__classPrivateFieldGet(this, _LemmyHttp_pictrsUrl, "f")}/delete/${token}/${filename}`;
861
847
  const response = yield __classPrivateFieldGet(this, _LemmyHttp_fetchFunction, "f").call(this, deleteUrl, {
862
848
  method: HttpType.Get,
863
- headers: Object.assign(Object.assign({}, __classPrivateFieldGet(this, _LemmyHttp_headers, "f")), headers),
849
+ headers: __classPrivateFieldGet(this, _LemmyHttp_headers, "f"),
864
850
  });
865
851
  return yield response.json();
866
852
  });
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from "./http";
2
+ export { ActivityId } from "./types/ActivityId";
2
3
  export { AddAdmin } from "./types/AddAdmin";
3
4
  export { AddAdminResponse } from "./types/AddAdminResponse";
4
5
  export { AddModToCommunity } from "./types/AddModToCommunity";
@@ -41,7 +42,6 @@ export { CommentSortType } from "./types/CommentSortType";
41
42
  export { CommentView } from "./types/CommentView";
42
43
  export { Community } from "./types/Community";
43
44
  export { CommunityAggregates } from "./types/CommunityAggregates";
44
- export { CommunityBlockId } from "./types/CommunityBlockId";
45
45
  export { CommunityBlockView } from "./types/CommunityBlockView";
46
46
  export { CommunityFollowerView } from "./types/CommunityFollowerView";
47
47
  export { CommunityId } from "./types/CommunityId";
@@ -110,10 +110,10 @@ export { GetUnreadCountResponse } from "./types/GetUnreadCountResponse";
110
110
  export { GetUnreadRegistrationApplicationCountResponse } from "./types/GetUnreadRegistrationApplicationCountResponse";
111
111
  export { HideCommunity } from "./types/HideCommunity";
112
112
  export { ImageUpload } from "./types/ImageUpload";
113
- export { ImageUploadId } from "./types/ImageUploadId";
114
113
  export { Instance } from "./types/Instance";
115
114
  export { InstanceBlockView } from "./types/InstanceBlockView";
116
115
  export { InstanceId } from "./types/InstanceId";
116
+ export { InstanceWithFederationState } from "./types/InstanceWithFederationState";
117
117
  export { Language } from "./types/Language";
118
118
  export { LanguageId } from "./types/LanguageId";
119
119
  export { LemmyErrorType } from "./types/LemmyErrorType";
@@ -204,6 +204,7 @@ export { PurgeComment } from "./types/PurgeComment";
204
204
  export { PurgeCommunity } from "./types/PurgeCommunity";
205
205
  export { PurgePerson } from "./types/PurgePerson";
206
206
  export { PurgePost } from "./types/PurgePost";
207
+ export { ReadableFederationState } from "./types/ReadableFederationState";
207
208
  export { Register } from "./types/Register";
208
209
  export { RegistrationApplication } from "./types/RegistrationApplication";
209
210
  export { RegistrationApplicationResponse } from "./types/RegistrationApplicationResponse";
@@ -2,10 +2,6 @@
2
2
  export declare const VERSION = "v3";
3
3
  export interface UploadImage {
4
4
  image: File | Buffer;
5
- /**
6
- * Optional if cookie with jwt set is already present. Otherwise, auth is required.
7
- */
8
- auth?: string;
9
5
  }
10
6
  export interface UploadImageResponse {
11
7
  /**
@@ -23,8 +19,4 @@ export interface ImageFile {
23
19
  export interface DeleteImage {
24
20
  token: string;
25
21
  filename: string;
26
- /**
27
- * Optional if cookie with jwt set is already present. Otherwise, auth is required.
28
- */
29
- auth?: string;
30
22
  }
@@ -0,0 +1 @@
1
+ export type ActivityId = number;
@@ -1,6 +1,5 @@
1
1
  import type { CommentId } from "./CommentId";
2
2
  export interface CommentAggregates {
3
- id: number;
4
3
  comment_id: CommentId;
5
4
  score: number;
6
5
  upvotes: number;
@@ -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;
@@ -1,6 +1,5 @@
1
1
  import type { CommunityId } from "./CommunityId";
2
2
  export interface CommunityAggregates {
3
- id: number;
4
3
  community_id: CommunityId;
5
4
  subscribers: number;
6
5
  posts: number;
@@ -1,6 +1,5 @@
1
1
  import type { CustomEmojiId } from "./CustomEmojiId";
2
2
  export interface CustomEmojiKeyword {
3
- id: number;
4
3
  custom_emoji_id: CustomEmojiId;
5
4
  keyword: string;
6
5
  }
@@ -1,6 +1,6 @@
1
- import type { Instance } from "./Instance";
1
+ import type { InstanceWithFederationState } from "./InstanceWithFederationState";
2
2
  export interface FederatedInstances {
3
- linked: Array<Instance>;
4
- allowed: Array<Instance>;
5
- blocked: Array<Instance>;
3
+ linked: Array<InstanceWithFederationState>;
4
+ allowed: Array<InstanceWithFederationState>;
5
+ blocked: Array<InstanceWithFederationState>;
6
6
  }
@@ -1,7 +1,5 @@
1
- import type { ImageUploadId } from "./ImageUploadId";
2
1
  import type { LocalUserId } from "./LocalUserId";
3
2
  export interface ImageUpload {
4
- id: ImageUploadId;
5
3
  local_user_id: LocalUserId;
6
4
  pictrs_alias: string;
7
5
  pictrs_delete_token: string;
@@ -0,0 +1,11 @@
1
+ import type { InstanceId } from "./InstanceId";
2
+ import type { ReadableFederationState } from "./ReadableFederationState";
3
+ export interface InstanceWithFederationState {
4
+ id: InstanceId;
5
+ domain: string;
6
+ published: string;
7
+ updated?: string;
8
+ software?: string;
9
+ version?: string;
10
+ federation_state?: ReadableFederationState;
11
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -68,6 +68,10 @@ export type LemmyErrorType = {
68
68
  error: "couldnt_find_person";
69
69
  } | {
70
70
  error: "person_is_blocked";
71
+ } | {
72
+ error: "community_is_blocked";
73
+ } | {
74
+ error: "instance_is_blocked";
71
75
  } | {
72
76
  error: "downvotes_are_disabled";
73
77
  } | {
@@ -26,4 +26,5 @@ export interface LocalSite {
26
26
  updated?: string;
27
27
  registration_mode: RegistrationMode;
28
28
  reports_email_admins: boolean;
29
+ federation_signed_fetch: boolean;
29
30
  }
@@ -1,6 +1,5 @@
1
1
  import type { LocalSiteId } from "./LocalSiteId";
2
2
  export interface LocalSiteRateLimit {
3
- id: number;
4
3
  local_site_id: LocalSiteId;
5
4
  message: number;
6
5
  message_per_second: number;
@@ -28,4 +28,5 @@ export interface LocalUser {
28
28
  totp_2fa_enabled: boolean;
29
29
  enable_keyboard_navigation: boolean;
30
30
  enable_animated_images: boolean;
31
+ collapse_bot_comments: boolean;
31
32
  }
@@ -1,6 +1,5 @@
1
1
  import type { LocalUserId } from "./LocalUserId";
2
2
  export interface LoginToken {
3
- id: number;
4
3
  user_id: LocalUserId;
5
4
  published: string;
6
5
  ip?: string;
@@ -1,6 +1,5 @@
1
1
  import type { PersonId } from "./PersonId";
2
2
  export interface PersonAggregates {
3
- id: number;
4
3
  person_id: PersonId;
5
4
  post_count: number;
6
5
  comment_count: number;
@@ -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;
@@ -1,6 +1,5 @@
1
1
  import type { PostId } from "./PostId";
2
2
  export interface PostAggregates {
3
- id: number;
4
3
  post_id: PostId;
5
4
  comments: number;
6
5
  score: number;
@@ -0,0 +1,10 @@
1
+ import type { ActivityId } from "./ActivityId";
2
+ import type { InstanceId } from "./InstanceId";
3
+ export interface ReadableFederationState {
4
+ instance_id: InstanceId;
5
+ last_successful_id?: ActivityId;
6
+ last_successful_published_time?: string;
7
+ fail_count: number;
8
+ last_retry?: string;
9
+ next_retry?: string;
10
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -29,4 +29,5 @@ export interface SaveUserSettings {
29
29
  post_listing_mode?: PostListingMode;
30
30
  enable_keyboard_navigation?: boolean;
31
31
  enable_animated_images?: boolean;
32
+ collapse_bot_comments?: boolean;
32
33
  }
@@ -1,6 +1,5 @@
1
1
  import type { SiteId } from "./SiteId";
2
2
  export interface SiteAggregates {
3
- id: number;
4
3
  site_id: SiteId;
5
4
  users: number;
6
5
  posts: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lemmy-js-client",
3
- "version": "0.19.0-alpha.15",
3
+ "version": "0.19.0-alpha.17",
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 CommunityBlockId = number;
@@ -1 +0,0 @@
1
- export type ImageUploadId = number;
@@ -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 });