lemmy-js-client 0.18.3-rc.3 → 0.19.0-alpha.10
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/http.d.ts +61 -20
- package/dist/http.js +87 -31
- package/dist/index.d.ts +13 -18
- package/dist/types/AddAdmin.d.ts +0 -1
- package/dist/types/AddModToCommunity.d.ts +0 -1
- package/dist/types/ApproveRegistrationApplication.d.ts +0 -1
- package/dist/types/BanFromCommunity.d.ts +0 -1
- package/dist/types/BanPerson.d.ts +0 -1
- package/dist/types/BlockCommunity.d.ts +0 -1
- package/dist/types/BlockInstance.d.ts +5 -0
- package/dist/types/BlockInstanceResponse.d.ts +3 -0
- package/dist/types/BlockPerson.d.ts +0 -1
- package/dist/types/ChangePassword.d.ts +0 -1
- package/dist/types/CommentAggregates.d.ts +0 -1
- package/dist/types/CommentResponse.d.ts +0 -1
- package/dist/types/CommentSortType.d.ts +1 -1
- package/dist/types/Community.d.ts +0 -2
- package/dist/types/CommunityAggregates.d.ts +0 -1
- package/dist/types/CreateComment.d.ts +0 -2
- package/dist/types/CreateCommentLike.d.ts +0 -1
- package/dist/types/CreateCommentReport.d.ts +0 -1
- package/dist/types/CreateCommunity.d.ts +0 -1
- package/dist/types/CreateCustomEmoji.d.ts +0 -1
- package/dist/types/CreatePost.d.ts +0 -1
- package/dist/types/CreatePostLike.d.ts +0 -1
- package/dist/types/CreatePostReport.d.ts +0 -1
- package/dist/types/CreatePrivateMessage.d.ts +0 -1
- package/dist/types/CreatePrivateMessageReport.d.ts +0 -1
- package/dist/types/CreateSite.d.ts +0 -1
- package/dist/types/DeleteAccount.d.ts +1 -1
- package/dist/types/DeleteAccountResponse.d.ts +1 -1
- package/dist/types/DeleteComment.d.ts +0 -1
- package/dist/types/DeleteCommunity.d.ts +0 -1
- package/dist/types/DeleteCustomEmoji.d.ts +0 -1
- package/dist/types/DeletePost.d.ts +0 -1
- package/dist/types/DeletePrivateMessage.d.ts +0 -1
- package/dist/types/DistinguishComment.d.ts +0 -1
- package/dist/types/EditComment.d.ts +0 -2
- package/dist/types/EditCommunity.d.ts +0 -1
- package/dist/types/EditCustomEmoji.d.ts +0 -1
- package/dist/types/EditPost.d.ts +0 -1
- package/dist/types/EditPrivateMessage.d.ts +0 -1
- package/dist/types/EditSite.d.ts +0 -1
- package/dist/types/FeaturePost.d.ts +0 -1
- package/dist/types/FollowCommunity.d.ts +0 -1
- package/dist/types/GenerateTotpSecretResponse.d.ts +3 -0
- package/dist/types/GetComment.d.ts +0 -1
- package/dist/types/GetComments.d.ts +2 -1
- package/dist/types/GetCommunity.d.ts +0 -1
- package/dist/types/GetModlog.d.ts +0 -1
- package/dist/types/GetPersonDetails.d.ts +0 -1
- package/dist/types/GetPersonMentions.d.ts +0 -1
- package/dist/types/GetPost.d.ts +0 -1
- package/dist/types/GetPosts.d.ts +4 -2
- package/dist/types/GetPostsResponse.d.ts +2 -0
- package/dist/types/GetPrivateMessages.d.ts +2 -1
- package/dist/types/GetPrivateMessages.js +0 -1
- package/dist/types/GetReplies.d.ts +0 -1
- package/dist/types/GetReportCount.d.ts +0 -1
- package/dist/types/HideCommunity.d.ts +0 -1
- package/dist/types/ImageUpload.d.ts +9 -0
- package/dist/types/ImageUploadId.d.ts +1 -0
- package/dist/types/InstanceBlockView.d.ts +8 -0
- package/dist/types/ListCommentReports.d.ts +0 -1
- package/dist/types/ListCommunities.d.ts +0 -1
- package/dist/types/ListPostReports.d.ts +0 -1
- package/dist/types/ListPrivateMessageReports.d.ts +0 -1
- package/dist/types/ListRegistrationApplications.d.ts +0 -1
- package/dist/types/ListingType.d.ts +1 -1
- package/dist/types/LocalSiteRateLimit.d.ts +2 -0
- package/dist/types/LocalUser.d.ts +8 -5
- package/dist/types/LockPost.d.ts +0 -1
- package/dist/types/MarkCommentReplyAsRead.d.ts +0 -1
- package/dist/types/MarkPersonMentionAsRead.d.ts +0 -1
- package/dist/types/MarkPostAsRead.d.ts +1 -1
- package/dist/types/MarkPrivateMessageAsRead.d.ts +0 -1
- package/dist/types/MyUserInfo.d.ts +2 -0
- package/dist/types/PaginationCursor.d.ts +1 -0
- package/dist/types/PasswordResetResponse.d.ts +1 -1
- package/dist/types/Person.d.ts +0 -2
- package/dist/types/PersonSortType.d.ts +1 -0
- package/dist/types/PostAggregates.d.ts +0 -6
- package/dist/types/PostListingMode.d.ts +1 -0
- package/dist/types/PurgeComment.d.ts +0 -1
- package/dist/types/PurgeCommunity.d.ts +0 -1
- package/dist/types/PurgePerson.d.ts +0 -1
- package/dist/types/PurgePost.d.ts +0 -1
- package/dist/types/RemoveComment.d.ts +0 -1
- package/dist/types/RemoveCommunity.d.ts +0 -1
- package/dist/types/RemovePost.d.ts +0 -1
- package/dist/types/ResolveCommentReport.d.ts +0 -1
- package/dist/types/ResolveObject.d.ts +0 -1
- package/dist/types/ResolvePostReport.d.ts +0 -1
- package/dist/types/ResolvePrivateMessageReport.d.ts +0 -1
- package/dist/types/SaveComment.d.ts +0 -1
- package/dist/types/SavePost.d.ts +0 -1
- package/dist/types/SaveUserSettings.d.ts +2 -2
- package/dist/types/Search.d.ts +0 -1
- package/dist/types/SortType.d.ts +1 -1
- package/dist/types/SuccessResponse.d.ts +3 -0
- package/dist/types/TransferCommunity.d.ts +0 -1
- package/dist/types/UpdateTotp.d.ts +4 -0
- package/dist/types/UpdateTotpResponse.d.ts +3 -0
- package/dist/types/VerifyEmailResponse.d.ts +1 -1
- package/dist/types/others.d.ts +8 -0
- package/package.json +1 -1
- package/dist/types/CommunityJoin.d.ts +0 -4
- package/dist/types/CommunityJoinResponse.d.ts +0 -3
- package/dist/types/GetBannedPersons.d.ts +0 -3
- package/dist/types/GetCaptcha.d.ts +0 -3
- package/dist/types/GetFederatedInstances.d.ts +0 -3
- package/dist/types/GetSite.d.ts +0 -3
- package/dist/types/GetUnreadCount.d.ts +0 -3
- package/dist/types/GetUnreadRegistrationApplicationCount.d.ts +0 -3
- package/dist/types/LeaveAdmin.d.ts +0 -3
- package/dist/types/MarkAllAsRead.d.ts +0 -3
- package/dist/types/ModJoin.d.ts +0 -4
- package/dist/types/ModJoinResponse.d.ts +0 -3
- package/dist/types/ModJoinResponse.js +0 -3
- package/dist/types/PostJoin.d.ts +0 -4
- package/dist/types/PostJoinResponse.d.ts +0 -3
- package/dist/types/PostJoinResponse.js +0 -3
- package/dist/types/PostOrCommentId.d.ts +0 -7
- package/dist/types/PostOrCommentId.js +0 -2
- package/dist/types/UserJoin.d.ts +0 -3
- package/dist/types/UserJoin.js +0 -3
- package/dist/types/UserJoinResponse.d.ts +0 -3
- package/dist/types/UserJoinResponse.js +0 -3
- /package/dist/types/{CommunityJoin.js → BlockInstance.js} +0 -0
- /package/dist/types/{CommunityJoinResponse.js → BlockInstanceResponse.js} +0 -0
- /package/dist/types/{GetBannedPersons.js → GenerateTotpSecretResponse.js} +0 -0
- /package/dist/types/{ModJoin.js → ImageUpload.js} +0 -0
- /package/dist/types/{GetCaptcha.js → ImageUploadId.js} +0 -0
- /package/dist/types/{PostJoin.js → InstanceBlockView.js} +0 -0
- /package/dist/types/{GetFederatedInstances.js → PaginationCursor.js} +0 -0
- /package/dist/types/{GetSite.js → PersonSortType.js} +0 -0
- /package/dist/types/{GetUnreadCount.js → PostListingMode.js} +0 -0
- /package/dist/types/{GetUnreadRegistrationApplicationCount.js → SuccessResponse.js} +0 -0
- /package/dist/types/{LeaveAdmin.js → UpdateTotp.js} +0 -0
- /package/dist/types/{MarkAllAsRead.js → UpdateTotpResponse.js} +0 -0
package/dist/http.d.ts
CHANGED
@@ -31,6 +31,7 @@ import { CreatePrivateMessageReport } from "./types/CreatePrivateMessageReport";
|
|
31
31
|
import { CreateSite } from "./types/CreateSite";
|
32
32
|
import { CustomEmojiResponse } from "./types/CustomEmojiResponse";
|
33
33
|
import { DeleteAccount } from "./types/DeleteAccount";
|
34
|
+
import { DeleteAccountResponse } from "./types/DeleteAccountResponse";
|
34
35
|
import { DeleteComment } from "./types/DeleteComment";
|
35
36
|
import { DeleteCommunity } from "./types/DeleteCommunity";
|
36
37
|
import { DeleteCustomEmoji } from "./types/DeleteCustomEmoji";
|
@@ -46,15 +47,12 @@ import { EditPrivateMessage } from "./types/EditPrivateMessage";
|
|
46
47
|
import { EditSite } from "./types/EditSite";
|
47
48
|
import { FeaturePost } from "./types/FeaturePost";
|
48
49
|
import { FollowCommunity } from "./types/FollowCommunity";
|
49
|
-
import { GetBannedPersons } from "./types/GetBannedPersons";
|
50
|
-
import { GetCaptcha } from "./types/GetCaptcha";
|
51
50
|
import { GetCaptchaResponse } from "./types/GetCaptchaResponse";
|
52
51
|
import { GetComment } from "./types/GetComment";
|
53
52
|
import { GetComments } from "./types/GetComments";
|
54
53
|
import { GetCommentsResponse } from "./types/GetCommentsResponse";
|
55
54
|
import { GetCommunity } from "./types/GetCommunity";
|
56
55
|
import { GetCommunityResponse } from "./types/GetCommunityResponse";
|
57
|
-
import { GetFederatedInstances } from "./types/GetFederatedInstances";
|
58
56
|
import { GetFederatedInstancesResponse } from "./types/GetFederatedInstancesResponse";
|
59
57
|
import { GetModlog } from "./types/GetModlog";
|
60
58
|
import { GetModlogResponse } from "./types/GetModlogResponse";
|
@@ -71,15 +69,11 @@ import { GetReplies } from "./types/GetReplies";
|
|
71
69
|
import { GetRepliesResponse } from "./types/GetRepliesResponse";
|
72
70
|
import { GetReportCount } from "./types/GetReportCount";
|
73
71
|
import { GetReportCountResponse } from "./types/GetReportCountResponse";
|
74
|
-
import { GetSite } from "./types/GetSite";
|
75
72
|
import { GetSiteMetadata } from "./types/GetSiteMetadata";
|
76
73
|
import { GetSiteMetadataResponse } from "./types/GetSiteMetadataResponse";
|
77
74
|
import { GetSiteResponse } from "./types/GetSiteResponse";
|
78
|
-
import { GetUnreadCount } from "./types/GetUnreadCount";
|
79
75
|
import { GetUnreadCountResponse } from "./types/GetUnreadCountResponse";
|
80
|
-
import { GetUnreadRegistrationApplicationCount } from "./types/GetUnreadRegistrationApplicationCount";
|
81
76
|
import { GetUnreadRegistrationApplicationCountResponse } from "./types/GetUnreadRegistrationApplicationCountResponse";
|
82
|
-
import { LeaveAdmin } from "./types/LeaveAdmin";
|
83
77
|
import { ListCommentReports } from "./types/ListCommentReports";
|
84
78
|
import { ListCommentReportsResponse } from "./types/ListCommentReportsResponse";
|
85
79
|
import { ListCommunities } from "./types/ListCommunities";
|
@@ -93,13 +87,13 @@ import { ListRegistrationApplicationsResponse } from "./types/ListRegistrationAp
|
|
93
87
|
import { LockPost } from "./types/LockPost";
|
94
88
|
import { Login } from "./types/Login";
|
95
89
|
import { LoginResponse } from "./types/LoginResponse";
|
96
|
-
import { MarkAllAsRead } from "./types/MarkAllAsRead";
|
97
90
|
import { MarkCommentReplyAsRead } from "./types/MarkCommentReplyAsRead";
|
98
91
|
import { MarkPersonMentionAsRead } from "./types/MarkPersonMentionAsRead";
|
99
92
|
import { MarkPostAsRead } from "./types/MarkPostAsRead";
|
100
93
|
import { MarkPrivateMessageAsRead } from "./types/MarkPrivateMessageAsRead";
|
101
94
|
import { PasswordChangeAfterReset } from "./types/PasswordChangeAfterReset";
|
102
95
|
import { PasswordReset } from "./types/PasswordReset";
|
96
|
+
import { PasswordResetResponse } from "./types/PasswordResetResponse";
|
103
97
|
import { PersonMentionResponse } from "./types/PersonMentionResponse";
|
104
98
|
import { PostReportResponse } from "./types/PostReportResponse";
|
105
99
|
import { PostResponse } from "./types/PostResponse";
|
@@ -129,7 +123,14 @@ import { SearchResponse } from "./types/SearchResponse";
|
|
129
123
|
import { SiteResponse } from "./types/SiteResponse";
|
130
124
|
import { TransferCommunity } from "./types/TransferCommunity";
|
131
125
|
import { VerifyEmail } from "./types/VerifyEmail";
|
132
|
-
import {
|
126
|
+
import { VerifyEmailResponse } from "./types/VerifyEmailResponse";
|
127
|
+
import { DeleteImage, UploadImage, UploadImageResponse } from "./types/others";
|
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";
|
133
134
|
/**
|
134
135
|
* Helps build lemmy HTTP requests.
|
135
136
|
*/
|
@@ -151,7 +152,7 @@ export declare class LemmyHttp {
|
|
151
152
|
*
|
152
153
|
* `HTTP.GET /site`
|
153
154
|
*/
|
154
|
-
getSite(
|
155
|
+
getSite(): Promise<GetSiteResponse>;
|
155
156
|
/**
|
156
157
|
* Create your site.
|
157
158
|
*
|
@@ -169,7 +170,25 @@ export declare class LemmyHttp {
|
|
169
170
|
*
|
170
171
|
* `HTTP.POST /user/leave_admin`
|
171
172
|
*/
|
172
|
-
leaveAdmin(
|
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>;
|
173
192
|
/**
|
174
193
|
* Get the modlog.
|
175
194
|
*
|
@@ -230,6 +249,12 @@ export declare class LemmyHttp {
|
|
230
249
|
* `HTTP.POST /community/delete`
|
231
250
|
*/
|
232
251
|
deleteCommunity(form: DeleteCommunity): Promise<CommunityResponse>;
|
252
|
+
/**
|
253
|
+
* Hide a community from public view.
|
254
|
+
*
|
255
|
+
* `HTTP.PUT /community/hide`
|
256
|
+
*/
|
257
|
+
hideCommunity(form: HideCommunity): Promise<CommunityResponse>;
|
233
258
|
/**
|
234
259
|
* A moderator remove for a community.
|
235
260
|
*
|
@@ -517,7 +542,7 @@ export declare class LemmyHttp {
|
|
517
542
|
*
|
518
543
|
* `HTTP.GET /user/banned`
|
519
544
|
*/
|
520
|
-
getBannedPersons(
|
545
|
+
getBannedPersons(): Promise<BannedPersonsResponse>;
|
521
546
|
/**
|
522
547
|
* Block a person.
|
523
548
|
*
|
@@ -529,19 +554,19 @@ export declare class LemmyHttp {
|
|
529
554
|
*
|
530
555
|
* `HTTP.GET /user/get_captcha`
|
531
556
|
*/
|
532
|
-
getCaptcha(
|
557
|
+
getCaptcha(): Promise<GetCaptchaResponse>;
|
533
558
|
/**
|
534
559
|
* Delete your account.
|
535
560
|
*
|
536
561
|
* `HTTP.POST /user/delete_account`
|
537
562
|
*/
|
538
|
-
deleteAccount(form: DeleteAccount): Promise<
|
563
|
+
deleteAccount(form: DeleteAccount): Promise<DeleteAccountResponse>;
|
539
564
|
/**
|
540
565
|
* Reset your password.
|
541
566
|
*
|
542
567
|
* `HTTP.POST /user/password_reset`
|
543
568
|
*/
|
544
|
-
passwordReset(form: PasswordReset): Promise<
|
569
|
+
passwordReset(form: PasswordReset): Promise<PasswordResetResponse>;
|
545
570
|
/**
|
546
571
|
* Change your password from an email / token based reset.
|
547
572
|
*
|
@@ -553,7 +578,7 @@ export declare class LemmyHttp {
|
|
553
578
|
*
|
554
579
|
* `HTTP.POST /user/mark_all_as_read`
|
555
580
|
*/
|
556
|
-
markAllAsRead(
|
581
|
+
markAllAsRead(): Promise<GetRepliesResponse>;
|
557
582
|
/**
|
558
583
|
* Save your user settings.
|
559
584
|
*
|
@@ -577,13 +602,13 @@ export declare class LemmyHttp {
|
|
577
602
|
*
|
578
603
|
* `HTTP.GET /user/unread_count`
|
579
604
|
*/
|
580
|
-
getUnreadCount(
|
605
|
+
getUnreadCount(): Promise<GetUnreadCountResponse>;
|
581
606
|
/**
|
582
607
|
* Verify your email
|
583
608
|
*
|
584
609
|
* `HTTP.POST /user/verify_email`
|
585
610
|
*/
|
586
|
-
verifyEmail(form: VerifyEmail): Promise<
|
611
|
+
verifyEmail(form: VerifyEmail): Promise<VerifyEmailResponse>;
|
587
612
|
/**
|
588
613
|
* Add an admin to your site.
|
589
614
|
*
|
@@ -595,7 +620,7 @@ export declare class LemmyHttp {
|
|
595
620
|
*
|
596
621
|
* `HTTP.GET /admin/registration_application/count`
|
597
622
|
*/
|
598
|
-
getUnreadRegistrationApplicationCount(
|
623
|
+
getUnreadRegistrationApplicationCount(): Promise<GetUnreadRegistrationApplicationCountResponse>;
|
599
624
|
/**
|
600
625
|
* List the registration applications.
|
601
626
|
*
|
@@ -655,9 +680,25 @@ export declare class LemmyHttp {
|
|
655
680
|
*
|
656
681
|
* `HTTP.Get /federated_instances`
|
657
682
|
*/
|
658
|
-
getFederatedInstances(
|
683
|
+
getFederatedInstances(): Promise<GetFederatedInstancesResponse>;
|
684
|
+
/**
|
685
|
+
* Block an instance.
|
686
|
+
*
|
687
|
+
* `HTTP.Post /site/block`
|
688
|
+
*/
|
689
|
+
blockInstance(form: BlockInstance): Promise<BlockInstanceResponse>;
|
659
690
|
/**
|
660
691
|
* Upload an image to the server.
|
661
692
|
*/
|
662
693
|
uploadImage({ image, auth, }: UploadImage): Promise<UploadImageResponse>;
|
694
|
+
/**
|
695
|
+
* Delete a pictrs image
|
696
|
+
*/
|
697
|
+
deleteImage({ token, filename, auth }: DeleteImage): Promise<any>;
|
698
|
+
/**
|
699
|
+
* Set the headers (can be used to set the auth header)
|
700
|
+
*/
|
701
|
+
setHeaders(headers: {
|
702
|
+
[key: string]: string;
|
703
|
+
}): void;
|
663
704
|
}
|
package/dist/http.js
CHANGED
@@ -63,8 +63,8 @@ class LemmyHttp {
|
|
63
63
|
*
|
64
64
|
* `HTTP.GET /site`
|
65
65
|
*/
|
66
|
-
getSite(
|
67
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/site",
|
66
|
+
getSite() {
|
67
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/site", {});
|
68
68
|
}
|
69
69
|
/**
|
70
70
|
* Create your site.
|
@@ -87,8 +87,30 @@ class LemmyHttp {
|
|
87
87
|
*
|
88
88
|
* `HTTP.POST /user/leave_admin`
|
89
89
|
*/
|
90
|
-
leaveAdmin(
|
91
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/user/leave_admin",
|
90
|
+
leaveAdmin() {
|
91
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/user/leave_admin", {});
|
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);
|
92
114
|
}
|
93
115
|
/**
|
94
116
|
* Get the modlog.
|
@@ -170,6 +192,14 @@ class LemmyHttp {
|
|
170
192
|
deleteCommunity(form) {
|
171
193
|
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/community/delete", form);
|
172
194
|
}
|
195
|
+
/**
|
196
|
+
* Hide a community from public view.
|
197
|
+
*
|
198
|
+
* `HTTP.PUT /community/hide`
|
199
|
+
*/
|
200
|
+
hideCommunity(form) {
|
201
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Put, "/community/hide", form);
|
202
|
+
}
|
173
203
|
/**
|
174
204
|
* A moderator remove for a community.
|
175
205
|
*
|
@@ -551,8 +581,8 @@ class LemmyHttp {
|
|
551
581
|
*
|
552
582
|
* `HTTP.GET /user/banned`
|
553
583
|
*/
|
554
|
-
getBannedPersons(
|
555
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/user/banned",
|
584
|
+
getBannedPersons() {
|
585
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/user/banned", {});
|
556
586
|
}
|
557
587
|
/**
|
558
588
|
* Block a person.
|
@@ -567,8 +597,8 @@ class LemmyHttp {
|
|
567
597
|
*
|
568
598
|
* `HTTP.GET /user/get_captcha`
|
569
599
|
*/
|
570
|
-
getCaptcha(
|
571
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/user/get_captcha",
|
600
|
+
getCaptcha() {
|
601
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/user/get_captcha", {});
|
572
602
|
}
|
573
603
|
/**
|
574
604
|
* Delete your account.
|
@@ -599,8 +629,8 @@ class LemmyHttp {
|
|
599
629
|
*
|
600
630
|
* `HTTP.POST /user/mark_all_as_read`
|
601
631
|
*/
|
602
|
-
markAllAsRead(
|
603
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/user/mark_all_as_read",
|
632
|
+
markAllAsRead() {
|
633
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/user/mark_all_as_read", {});
|
604
634
|
}
|
605
635
|
/**
|
606
636
|
* Save your user settings.
|
@@ -631,8 +661,8 @@ class LemmyHttp {
|
|
631
661
|
*
|
632
662
|
* `HTTP.GET /user/unread_count`
|
633
663
|
*/
|
634
|
-
getUnreadCount(
|
635
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/user/unread_count",
|
664
|
+
getUnreadCount() {
|
665
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/user/unread_count", {});
|
636
666
|
}
|
637
667
|
/**
|
638
668
|
* Verify your email
|
@@ -655,8 +685,8 @@ class LemmyHttp {
|
|
655
685
|
*
|
656
686
|
* `HTTP.GET /admin/registration_application/count`
|
657
687
|
*/
|
658
|
-
getUnreadRegistrationApplicationCount(
|
659
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/admin/registration_application/count",
|
688
|
+
getUnreadRegistrationApplicationCount() {
|
689
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/admin/registration_application/count", {});
|
660
690
|
}
|
661
691
|
/**
|
662
692
|
* List the registration applications.
|
@@ -712,9 +742,7 @@ class LemmyHttp {
|
|
712
742
|
* `HTTP.POST /custom_emoji`
|
713
743
|
*/
|
714
744
|
createCustomEmoji(form) {
|
715
|
-
return
|
716
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/custom_emoji", form);
|
717
|
-
});
|
745
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/custom_emoji", form);
|
718
746
|
}
|
719
747
|
/**
|
720
748
|
* Edit an existing custom emoji
|
@@ -722,9 +750,7 @@ class LemmyHttp {
|
|
722
750
|
* `HTTP.PUT /custom_emoji`
|
723
751
|
*/
|
724
752
|
editCustomEmoji(form) {
|
725
|
-
return
|
726
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Put, "/custom_emoji", form);
|
727
|
-
});
|
753
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Put, "/custom_emoji", form);
|
728
754
|
}
|
729
755
|
/**
|
730
756
|
* Delete a custom emoji
|
@@ -732,19 +758,23 @@ class LemmyHttp {
|
|
732
758
|
* `HTTP.Post /custom_emoji/delete`
|
733
759
|
*/
|
734
760
|
deleteCustomEmoji(form) {
|
735
|
-
return
|
736
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/custom_emoji/delete", form);
|
737
|
-
});
|
761
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/custom_emoji/delete", form);
|
738
762
|
}
|
739
763
|
/**
|
740
764
|
* Fetch federated instances.
|
741
765
|
*
|
742
766
|
* `HTTP.Get /federated_instances`
|
743
767
|
*/
|
744
|
-
getFederatedInstances(
|
745
|
-
return
|
746
|
-
|
747
|
-
|
768
|
+
getFederatedInstances() {
|
769
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/federated_instances", {});
|
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);
|
748
778
|
}
|
749
779
|
/**
|
750
780
|
* Upload an image to the server.
|
@@ -753,11 +783,11 @@ class LemmyHttp {
|
|
753
783
|
var _a, _b, _c, _d;
|
754
784
|
return __awaiter(this, void 0, void 0, function* () {
|
755
785
|
const formData = createFormData(image);
|
756
|
-
// If
|
786
|
+
// If auth cookie not already set by browser, set it with passed in auth
|
757
787
|
const headers = {};
|
758
|
-
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("
|
759
|
-
!((_d = (_c = __classPrivateFieldGet(this, _LemmyHttp_headers, "f")) === null || _c === void 0 ? void 0 : _c.Cookie) === null || _d === void 0 ? void 0 : _d.includes("
|
760
|
-
headers.Cookie = `
|
788
|
+
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=")) &&
|
789
|
+
!((_d = (_c = __classPrivateFieldGet(this, _LemmyHttp_headers, "f")) === null || _c === void 0 ? void 0 : _c.Cookie) === null || _d === void 0 ? void 0 : _d.includes("auth="))) {
|
790
|
+
headers.Cookie = `auth=${auth}`;
|
761
791
|
}
|
762
792
|
let url = undefined;
|
763
793
|
let delete_url = undefined;
|
@@ -779,6 +809,32 @@ class LemmyHttp {
|
|
779
809
|
delete_url });
|
780
810
|
});
|
781
811
|
}
|
812
|
+
/**
|
813
|
+
* Delete a pictrs image
|
814
|
+
*/
|
815
|
+
deleteImage({ token, filename, auth }) {
|
816
|
+
var _a, _b, _c, _d;
|
817
|
+
return __awaiter(this, void 0, void 0, function* () {
|
818
|
+
// If auth cookie not already set by browser, set it with passed in auth
|
819
|
+
const headers = {};
|
820
|
+
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=")) &&
|
821
|
+
!((_d = (_c = __classPrivateFieldGet(this, _LemmyHttp_headers, "f")) === null || _c === void 0 ? void 0 : _c.Cookie) === null || _d === void 0 ? void 0 : _d.includes("auth="))) {
|
822
|
+
headers.Cookie = `auth=${auth}`;
|
823
|
+
}
|
824
|
+
const deleteUrl = `${__classPrivateFieldGet(this, _LemmyHttp_pictrsUrl, "f")}/delete/${token}/${filename}`;
|
825
|
+
const response = yield __classPrivateFieldGet(this, _LemmyHttp_fetchFunction, "f").call(this, deleteUrl, {
|
826
|
+
method: HttpType.Get,
|
827
|
+
headers: Object.assign(Object.assign({}, __classPrivateFieldGet(this, _LemmyHttp_headers, "f")), headers),
|
828
|
+
});
|
829
|
+
return yield response.json();
|
830
|
+
});
|
831
|
+
}
|
832
|
+
/**
|
833
|
+
* Set the headers (can be used to set the auth header)
|
834
|
+
*/
|
835
|
+
setHeaders(headers) {
|
836
|
+
__classPrivateFieldSet(this, _LemmyHttp_headers, headers, "f");
|
837
|
+
}
|
782
838
|
}
|
783
839
|
exports.LemmyHttp = LemmyHttp;
|
784
840
|
_LemmyHttp_apiUrl = new WeakMap(), _LemmyHttp_headers = new WeakMap(), _LemmyHttp_pictrsUrl = new WeakMap(), _LemmyHttp_fetchFunction = new WeakMap(), _LemmyHttp_instances = new WeakSet(), _LemmyHttp_buildFullUrl = function _LemmyHttp_buildFullUrl(endpoint) {
|
package/dist/index.d.ts
CHANGED
@@ -19,6 +19,8 @@ export { BanPersonResponse } from "./types/BanPersonResponse";
|
|
19
19
|
export { BannedPersonsResponse } from "./types/BannedPersonsResponse";
|
20
20
|
export { BlockCommunity } from "./types/BlockCommunity";
|
21
21
|
export { BlockCommunityResponse } from "./types/BlockCommunityResponse";
|
22
|
+
export { BlockInstance } from "./types/BlockInstance";
|
23
|
+
export { BlockInstanceResponse } from "./types/BlockInstanceResponse";
|
22
24
|
export { BlockPerson } from "./types/BlockPerson";
|
23
25
|
export { BlockPersonResponse } from "./types/BlockPersonResponse";
|
24
26
|
export { CaptchaResponse } from "./types/CaptchaResponse";
|
@@ -43,8 +45,6 @@ export { CommunityBlockId } from "./types/CommunityBlockId";
|
|
43
45
|
export { CommunityBlockView } from "./types/CommunityBlockView";
|
44
46
|
export { CommunityFollowerView } from "./types/CommunityFollowerView";
|
45
47
|
export { CommunityId } from "./types/CommunityId";
|
46
|
-
export { CommunityJoin } from "./types/CommunityJoin";
|
47
|
-
export { CommunityJoinResponse } from "./types/CommunityJoinResponse";
|
48
48
|
export { CommunityModeratorView } from "./types/CommunityModeratorView";
|
49
49
|
export { CommunityResponse } from "./types/CommunityResponse";
|
50
50
|
export { CommunityView } from "./types/CommunityView";
|
@@ -82,15 +82,13 @@ 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 {
|
86
|
-
export { GetCaptcha } from "./types/GetCaptcha";
|
85
|
+
export { GenerateTotpSecretResponse } from "./types/GenerateTotpSecretResponse";
|
87
86
|
export { GetCaptchaResponse } from "./types/GetCaptchaResponse";
|
88
87
|
export { GetComment } from "./types/GetComment";
|
89
88
|
export { GetComments } from "./types/GetComments";
|
90
89
|
export { GetCommentsResponse } from "./types/GetCommentsResponse";
|
91
90
|
export { GetCommunity } from "./types/GetCommunity";
|
92
91
|
export { GetCommunityResponse } from "./types/GetCommunityResponse";
|
93
|
-
export { GetFederatedInstances } from "./types/GetFederatedInstances";
|
94
92
|
export { GetFederatedInstancesResponse } from "./types/GetFederatedInstancesResponse";
|
95
93
|
export { GetModlog } from "./types/GetModlog";
|
96
94
|
export { GetModlogResponse } from "./types/GetModlogResponse";
|
@@ -107,20 +105,19 @@ export { GetReplies } from "./types/GetReplies";
|
|
107
105
|
export { GetRepliesResponse } from "./types/GetRepliesResponse";
|
108
106
|
export { GetReportCount } from "./types/GetReportCount";
|
109
107
|
export { GetReportCountResponse } from "./types/GetReportCountResponse";
|
110
|
-
export { GetSite } from "./types/GetSite";
|
111
108
|
export { GetSiteMetadata } from "./types/GetSiteMetadata";
|
112
109
|
export { GetSiteMetadataResponse } from "./types/GetSiteMetadataResponse";
|
113
110
|
export { GetSiteResponse } from "./types/GetSiteResponse";
|
114
|
-
export { GetUnreadCount } from "./types/GetUnreadCount";
|
115
111
|
export { GetUnreadCountResponse } from "./types/GetUnreadCountResponse";
|
116
|
-
export { GetUnreadRegistrationApplicationCount } from "./types/GetUnreadRegistrationApplicationCount";
|
117
112
|
export { GetUnreadRegistrationApplicationCountResponse } from "./types/GetUnreadRegistrationApplicationCountResponse";
|
118
113
|
export { HideCommunity } from "./types/HideCommunity";
|
114
|
+
export { ImageUpload } from "./types/ImageUpload";
|
115
|
+
export { ImageUploadId } from "./types/ImageUploadId";
|
119
116
|
export { Instance } from "./types/Instance";
|
117
|
+
export { InstanceBlockView } from "./types/InstanceBlockView";
|
120
118
|
export { InstanceId } from "./types/InstanceId";
|
121
119
|
export { Language } from "./types/Language";
|
122
120
|
export { LanguageId } from "./types/LanguageId";
|
123
|
-
export { LeaveAdmin } from "./types/LeaveAdmin";
|
124
121
|
export { LemmyErrorType } from "./types/LemmyErrorType";
|
125
122
|
export { ListCommentReports } from "./types/ListCommentReports";
|
126
123
|
export { ListCommentReportsResponse } from "./types/ListCommentReportsResponse";
|
@@ -142,7 +139,6 @@ export { LocalUserView } from "./types/LocalUserView";
|
|
142
139
|
export { LockPost } from "./types/LockPost";
|
143
140
|
export { Login } from "./types/Login";
|
144
141
|
export { LoginResponse } from "./types/LoginResponse";
|
145
|
-
export { MarkAllAsRead } from "./types/MarkAllAsRead";
|
146
142
|
export { MarkCommentReplyAsRead } from "./types/MarkCommentReplyAsRead";
|
147
143
|
export { MarkPersonMentionAsRead } from "./types/MarkPersonMentionAsRead";
|
148
144
|
export { MarkPostAsRead } from "./types/MarkPostAsRead";
|
@@ -159,8 +155,6 @@ export { ModFeaturePost } from "./types/ModFeaturePost";
|
|
159
155
|
export { ModFeaturePostView } from "./types/ModFeaturePostView";
|
160
156
|
export { ModHideCommunity } from "./types/ModHideCommunity";
|
161
157
|
export { ModHideCommunityView } from "./types/ModHideCommunityView";
|
162
|
-
export { ModJoin } from "./types/ModJoin";
|
163
|
-
export { ModJoinResponse } from "./types/ModJoinResponse";
|
164
158
|
export { ModLockPost } from "./types/ModLockPost";
|
165
159
|
export { ModLockPostView } from "./types/ModLockPostView";
|
166
160
|
export { ModRemoveComment } from "./types/ModRemoveComment";
|
@@ -174,6 +168,7 @@ export { ModTransferCommunityView } from "./types/ModTransferCommunityView";
|
|
174
168
|
export { ModlogActionType } from "./types/ModlogActionType";
|
175
169
|
export { ModlogListParams } from "./types/ModlogListParams";
|
176
170
|
export { MyUserInfo } from "./types/MyUserInfo";
|
171
|
+
export { PaginationCursor } from "./types/PaginationCursor";
|
177
172
|
export { PasswordChangeAfterReset } from "./types/PasswordChangeAfterReset";
|
178
173
|
export { PasswordReset } from "./types/PasswordReset";
|
179
174
|
export { PasswordResetResponse } from "./types/PasswordResetResponse";
|
@@ -186,14 +181,13 @@ export { PersonMention } from "./types/PersonMention";
|
|
186
181
|
export { PersonMentionId } from "./types/PersonMentionId";
|
187
182
|
export { PersonMentionResponse } from "./types/PersonMentionResponse";
|
188
183
|
export { PersonMentionView } from "./types/PersonMentionView";
|
184
|
+
export { PersonSortType } from "./types/PersonSortType";
|
189
185
|
export { PersonView } from "./types/PersonView";
|
190
186
|
export { Post } from "./types/Post";
|
191
187
|
export { PostAggregates } from "./types/PostAggregates";
|
192
188
|
export { PostFeatureType } from "./types/PostFeatureType";
|
193
189
|
export { PostId } from "./types/PostId";
|
194
|
-
export {
|
195
|
-
export { PostJoinResponse } from "./types/PostJoinResponse";
|
196
|
-
export { PostOrCommentId } from "./types/PostOrCommentId";
|
190
|
+
export { PostListingMode } from "./types/PostListingMode";
|
197
191
|
export { PostReport } from "./types/PostReport";
|
198
192
|
export { PostReportId } from "./types/PostReportId";
|
199
193
|
export { PostReportResponse } from "./types/PostReportResponse";
|
@@ -241,10 +235,11 @@ export { SiteResponse } from "./types/SiteResponse";
|
|
241
235
|
export { SiteView } from "./types/SiteView";
|
242
236
|
export { SortType } from "./types/SortType";
|
243
237
|
export { SubscribedType } from "./types/SubscribedType";
|
238
|
+
export { SuccessResponse } from "./types/SuccessResponse";
|
244
239
|
export { Tagline } from "./types/Tagline";
|
245
240
|
export { TransferCommunity } from "./types/TransferCommunity";
|
246
|
-
export {
|
247
|
-
export {
|
241
|
+
export { UpdateTotp } from "./types/UpdateTotp";
|
242
|
+
export { UpdateTotpResponse } from "./types/UpdateTotpResponse";
|
248
243
|
export { VerifyEmail } from "./types/VerifyEmail";
|
249
244
|
export { VerifyEmailResponse } from "./types/VerifyEmailResponse";
|
250
|
-
export { UploadImage, UploadImageResponse, ImageFile } from "./types/others";
|
245
|
+
export { UploadImage, UploadImageResponse, ImageFile, DeleteImage, } from "./types/others";
|
package/dist/types/AddAdmin.d.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export type CommentSortType = "Hot" | "Top" | "New" | "Old";
|
1
|
+
export type CommentSortType = "Hot" | "Top" | "New" | "Old" | "Controversial";
|