lemmy-js-client 0.20.0-reports-combined.2 → 0.20.0-search-combined.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/http.d.ts +161 -58
- package/dist/http.js +251 -104
- package/dist/index.d.ts +55 -16
- package/dist/other_types.d.ts +1 -18
- package/dist/other_types.js +1 -1
- package/dist/types/AdminAllowInstance.d.ts +3 -2
- package/dist/types/AdminAllowInstanceId.d.ts +1 -0
- package/dist/types/AdminAllowInstanceView.d.ts +1 -1
- package/dist/types/AdminBlockInstance.d.ts +3 -2
- package/dist/types/AdminBlockInstanceId.d.ts +1 -0
- package/dist/types/AdminPurgeComment.d.ts +3 -2
- package/dist/types/AdminPurgeCommentId.d.ts +1 -0
- package/dist/types/AdminPurgeCommentId.js +3 -0
- package/dist/types/AdminPurgeCommunity.d.ts +3 -2
- package/dist/types/AdminPurgeCommunityId.d.ts +1 -0
- package/dist/types/AdminPurgeCommunityId.js +3 -0
- package/dist/types/AdminPurgePerson.d.ts +3 -2
- package/dist/types/AdminPurgePersonId.d.ts +1 -0
- package/dist/types/AdminPurgePersonId.js +3 -0
- package/dist/types/AdminPurgePost.d.ts +3 -2
- package/dist/types/AdminPurgePostId.d.ts +1 -0
- package/dist/types/AdminPurgePostId.js +3 -0
- package/dist/types/CommunityAggregates.d.ts +2 -0
- package/dist/types/CommunityReport.d.ts +22 -0
- package/dist/types/CommunityReportId.d.ts +4 -0
- package/dist/types/CommunityReportId.js +3 -0
- package/dist/types/CommunityReportView.d.ts +16 -0
- package/dist/types/CreatePost.d.ts +2 -0
- package/dist/types/CreateSite.d.ts +1 -4
- package/dist/types/DeleteImageParams.d.ts +3 -0
- package/dist/types/DeleteImageParams.js +3 -0
- package/dist/types/EditCommunity.d.ts +0 -8
- package/dist/types/EditPost.d.ts +2 -0
- package/dist/types/EditSite.d.ts +5 -16
- package/dist/types/FederationError.d.ts +1 -1
- package/dist/types/GetComments.d.ts +0 -1
- package/dist/types/GetModlog.d.ts +3 -2
- package/dist/types/GetModlogResponse.d.ts +2 -34
- package/dist/types/GetPersonDetails.d.ts +0 -7
- package/dist/types/GetPersonDetailsResponse.d.ts +0 -4
- package/dist/types/GetPosts.d.ts +5 -0
- package/dist/types/GetRandomCommunity.d.ts +1 -0
- package/dist/types/GetSiteResponse.d.ts +1 -10
- package/dist/types/GetUnreadCountResponse.d.ts +2 -4
- package/dist/types/ImageGetParams.d.ts +4 -0
- package/dist/types/ImageGetParams.js +3 -0
- package/dist/types/ImageProxyParams.d.ts +5 -0
- package/dist/types/ImageProxyParams.js +3 -0
- package/dist/types/InboxCombinedPaginationCursor.d.ts +4 -0
- package/dist/types/InboxCombinedPaginationCursor.js +3 -0
- package/dist/types/InboxCombinedView.d.ts +13 -0
- package/dist/types/InboxDataType.d.ts +4 -0
- package/dist/types/InboxDataType.js +3 -0
- package/dist/types/LemmyErrorType.d.ts +5 -3
- package/dist/types/ListInbox.d.ts +11 -0
- package/dist/types/ListInboxResponse.d.ts +7 -0
- package/dist/types/ListPersonContent.d.ts +18 -0
- package/dist/types/ListPersonContentResponse.d.ts +7 -0
- package/dist/types/ListPersonSaved.d.ts +10 -0
- package/dist/types/ListPersonSavedResponse.d.ts +7 -0
- package/dist/types/LocalImage.d.ts +0 -1
- package/dist/types/LocalSite.d.ts +5 -0
- package/dist/types/LocalUser.d.ts +9 -0
- package/dist/types/MarkPersonCommentMentionAsRead.d.ts +8 -0
- package/dist/types/MarkPersonPostMentionAsRead.d.ts +8 -0
- package/dist/types/ModAdd.d.ts +3 -2
- package/dist/types/ModAddCommunity.d.ts +3 -2
- package/dist/types/ModAddCommunityId.d.ts +1 -0
- package/dist/types/ModAddCommunityId.js +3 -0
- package/dist/types/ModAddCommunityView.d.ts +1 -1
- package/dist/types/ModAddId.d.ts +1 -0
- package/dist/types/ModAddId.js +3 -0
- package/dist/types/ModAddView.d.ts +1 -1
- package/dist/types/ModBan.d.ts +3 -2
- package/dist/types/ModBanFromCommunity.d.ts +3 -2
- package/dist/types/ModBanFromCommunityId.d.ts +1 -0
- package/dist/types/ModBanFromCommunityId.js +3 -0
- package/dist/types/ModBanFromCommunityView.d.ts +1 -1
- package/dist/types/ModBanId.d.ts +1 -0
- package/dist/types/ModBanId.js +3 -0
- package/dist/types/ModBanView.d.ts +1 -1
- package/dist/types/ModFeaturePost.d.ts +3 -2
- package/dist/types/ModFeaturePostId.d.ts +1 -0
- package/dist/types/ModFeaturePostId.js +3 -0
- package/dist/types/ModFeaturePostView.d.ts +1 -0
- package/dist/types/ModHideCommunity.d.ts +3 -2
- package/dist/types/ModHideCommunityId.d.ts +1 -0
- package/dist/types/ModHideCommunityId.js +3 -0
- package/dist/types/ModLockPost.d.ts +3 -2
- package/dist/types/ModLockPostId.d.ts +1 -0
- package/dist/types/ModLockPostId.js +3 -0
- package/dist/types/ModLockPostView.d.ts +1 -0
- package/dist/types/ModRemoveComment.d.ts +3 -2
- package/dist/types/ModRemoveCommentId.d.ts +1 -0
- package/dist/types/ModRemoveCommentId.js +3 -0
- package/dist/types/ModRemoveCommentView.d.ts +1 -1
- package/dist/types/ModRemoveCommunity.d.ts +3 -2
- package/dist/types/ModRemoveCommunityId.d.ts +1 -0
- package/dist/types/ModRemoveCommunityId.js +3 -0
- package/dist/types/ModRemovePost.d.ts +3 -2
- package/dist/types/ModRemovePostId.d.ts +1 -0
- package/dist/types/ModRemovePostId.js +3 -0
- package/dist/types/ModRemovePostView.d.ts +1 -0
- package/dist/types/ModTransferCommunity.d.ts +3 -2
- package/dist/types/ModTransferCommunityId.d.ts +1 -0
- package/dist/types/ModTransferCommunityId.js +3 -0
- package/dist/types/ModTransferCommunityView.d.ts +1 -1
- package/dist/types/ModlogCombinedPaginationCursor.d.ts +4 -0
- package/dist/types/ModlogCombinedPaginationCursor.js +3 -0
- package/dist/types/ModlogCombinedView.d.ts +52 -0
- package/dist/types/{PersonMention.d.ts → PersonCommentMention.d.ts} +3 -3
- package/dist/types/PersonCommentMentionId.d.ts +4 -0
- package/dist/types/PersonCommentMentionId.js +3 -0
- package/dist/types/{PersonMentionView.d.ts → PersonCommentMentionView.d.ts} +4 -4
- package/dist/types/PersonCommentMentionView.js +2 -0
- package/dist/types/PersonContentCombinedPaginationCursor.d.ts +4 -0
- package/dist/types/PersonContentCombinedPaginationCursor.js +3 -0
- package/dist/types/PersonContentCombinedView.d.ts +7 -0
- package/dist/types/PersonContentCombinedView.js +2 -0
- package/dist/types/PersonContentType.d.ts +4 -0
- package/dist/types/PersonContentType.js +3 -0
- package/dist/types/PersonPostMention.d.ts +13 -0
- package/dist/types/PersonPostMention.js +2 -0
- package/dist/types/PersonPostMentionId.d.ts +4 -0
- package/dist/types/PersonPostMentionId.js +3 -0
- package/dist/types/PersonPostMentionView.d.ts +32 -0
- package/dist/types/PersonPostMentionView.js +2 -0
- package/dist/types/PersonSavedCombinedPaginationCursor.d.ts +4 -0
- package/dist/types/PersonSavedCombinedPaginationCursor.js +3 -0
- package/dist/types/PostTags.d.ts +7 -0
- package/dist/types/PostTags.js +2 -0
- package/dist/types/PostView.d.ts +2 -0
- package/dist/types/ReportCombinedView.d.ts +4 -1
- package/dist/types/SaveUserSettings.d.ts +4 -8
- package/dist/types/Search.d.ts +7 -7
- package/dist/types/SearchCombinedId.d.ts +4 -0
- package/dist/types/SearchCombinedId.js +3 -0
- package/dist/types/SearchCombinedPaginationCursor.d.ts +4 -0
- package/dist/types/SearchCombinedPaginationCursor.js +3 -0
- package/dist/types/SearchCombinedView.d.ts +13 -0
- package/dist/types/SearchCombinedView.js +2 -0
- package/dist/types/SearchResponse.d.ts +2 -10
- package/dist/types/SearchSortType.d.ts +4 -0
- package/dist/types/SearchSortType.js +3 -0
- package/dist/types/SiteResponse.d.ts +1 -1
- package/dist/types/Tag.d.ts +27 -0
- package/dist/types/Tag.js +2 -0
- package/dist/types/TagId.d.ts +4 -0
- package/dist/types/TagId.js +3 -0
- package/dist/types/UploadImageResponse.d.ts +4 -0
- package/dist/types/UploadImageResponse.js +3 -0
- package/package.json +2 -2
- package/dist/types/CommentReplyResponse.d.ts +0 -7
- package/dist/types/GetPersonMentions.d.ts +0 -10
- package/dist/types/GetPersonMentionsResponse.d.ts +0 -7
- package/dist/types/GetPrivateMessages.d.ts +0 -10
- package/dist/types/GetReplies.d.ts +0 -10
- package/dist/types/GetRepliesResponse.d.ts +0 -7
- package/dist/types/MarkPersonMentionAsRead.d.ts +0 -8
- package/dist/types/ModlogListParams.d.ts +0 -17
- package/dist/types/PersonMentionId.d.ts +0 -4
- package/dist/types/PersonMentionResponse.d.ts +0 -7
- package/dist/types/PrivateMessagesResponse.d.ts +0 -7
- package/dist/types/ReportCombined.d.ts +0 -14
- package/dist/types/ReportCombinedId.d.ts +0 -4
- /package/dist/types/{PersonMentionId.js → AdminAllowInstanceId.js} +0 -0
- /package/dist/types/{ReportCombinedId.js → AdminBlockInstanceId.js} +0 -0
- /package/dist/types/{CommentReplyResponse.js → CommunityReport.js} +0 -0
- /package/dist/types/{GetPersonMentions.js → CommunityReportView.js} +0 -0
- /package/dist/types/{GetPersonMentionsResponse.js → InboxCombinedView.js} +0 -0
- /package/dist/types/{GetPrivateMessages.js → ListInbox.js} +0 -0
- /package/dist/types/{GetReplies.js → ListInboxResponse.js} +0 -0
- /package/dist/types/{GetRepliesResponse.js → ListPersonContent.js} +0 -0
- /package/dist/types/{MarkPersonMentionAsRead.js → ListPersonContentResponse.js} +0 -0
- /package/dist/types/{ModlogListParams.js → ListPersonSaved.js} +0 -0
- /package/dist/types/{PersonMention.js → ListPersonSavedResponse.js} +0 -0
- /package/dist/types/{PersonMentionResponse.js → MarkPersonCommentMentionAsRead.js} +0 -0
- /package/dist/types/{PersonMentionView.js → MarkPersonPostMentionAsRead.js} +0 -0
- /package/dist/types/{PrivateMessagesResponse.js → ModlogCombinedView.js} +0 -0
- /package/dist/types/{ReportCombined.js → PersonCommentMention.js} +0 -0
package/dist/http.js
CHANGED
@@ -19,7 +19,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
19
19
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
20
20
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
21
21
|
};
|
22
|
-
var _LemmyHttp_instances, _LemmyHttp_apiUrl, _LemmyHttp_headers,
|
22
|
+
var _LemmyHttp_instances, _LemmyHttp_apiUrl, _LemmyHttp_headers, _LemmyHttp_fetchFunction, _LemmyHttp_buildFullUrl, _LemmyHttp_upload, _LemmyHttp_wrapper;
|
23
23
|
Object.defineProperty(exports, "__esModule", { value: true });
|
24
24
|
exports.LemmyHttp = void 0;
|
25
25
|
const other_types_1 = require("./other_types");
|
@@ -28,6 +28,7 @@ var HttpType;
|
|
28
28
|
HttpType["Get"] = "GET";
|
29
29
|
HttpType["Post"] = "POST";
|
30
30
|
HttpType["Put"] = "PUT";
|
31
|
+
HttpType["Delete"] = "DELETE";
|
31
32
|
})(HttpType || (HttpType = {}));
|
32
33
|
/**
|
33
34
|
* Helps build lemmy HTTP requests.
|
@@ -42,10 +43,8 @@ class LemmyHttp {
|
|
42
43
|
_LemmyHttp_instances.add(this);
|
43
44
|
_LemmyHttp_apiUrl.set(this, void 0);
|
44
45
|
_LemmyHttp_headers.set(this, {});
|
45
|
-
_LemmyHttp_pictrsUrl.set(this, void 0);
|
46
46
|
_LemmyHttp_fetchFunction.set(this, fetch.bind(globalThis));
|
47
47
|
__classPrivateFieldSet(this, _LemmyHttp_apiUrl, `${baseUrl.replace(/\/+$/, "")}/api/${other_types_1.VERSION}`, "f");
|
48
|
-
__classPrivateFieldSet(this, _LemmyHttp_pictrsUrl, `${baseUrl}/pictrs/image`, "f");
|
49
48
|
if (options === null || options === void 0 ? void 0 : options.headers) {
|
50
49
|
__classPrivateFieldSet(this, _LemmyHttp_headers, options.headers, "f");
|
51
50
|
}
|
@@ -80,53 +79,61 @@ class LemmyHttp {
|
|
80
79
|
/**
|
81
80
|
* Leave the Site admins.
|
82
81
|
*
|
83
|
-
* `HTTP.POST /
|
82
|
+
* `HTTP.POST /admin/leave`
|
84
83
|
*/
|
85
84
|
leaveAdmin(options) {
|
86
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/
|
85
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/admin/leave", {}, options);
|
87
86
|
}
|
88
87
|
/**
|
89
88
|
* Generate a TOTP / two-factor secret.
|
90
89
|
*
|
91
|
-
* Afterwards you need to call `/
|
90
|
+
* Afterwards you need to call `/account/auth/totp/update` with a valid token to enable it.
|
92
91
|
*
|
93
|
-
* `HTTP.POST /
|
92
|
+
* `HTTP.POST /account/auth/totp/generate`
|
94
93
|
*/
|
95
94
|
generateTotpSecret(options) {
|
96
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/
|
95
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/account/auth/totp/generate", {}, options);
|
96
|
+
}
|
97
|
+
/**
|
98
|
+
* Get data of current user.
|
99
|
+
*
|
100
|
+
* `HTTP.GET /account`
|
101
|
+
*/
|
102
|
+
getMyUser(options) {
|
103
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/account", {}, options);
|
97
104
|
}
|
98
105
|
/**
|
99
106
|
* Export a backup of your user settings, including your saved content,
|
100
107
|
* followed communities, and blocks.
|
101
108
|
*
|
102
|
-
* `HTTP.GET /
|
109
|
+
* `HTTP.GET /account/settings/export`
|
103
110
|
*/
|
104
111
|
exportSettings(options) {
|
105
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/
|
112
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/account/settings/export", {}, options);
|
106
113
|
}
|
107
114
|
/**
|
108
115
|
* Import a backup of your user settings.
|
109
116
|
*
|
110
|
-
* `HTTP.POST /
|
117
|
+
* `HTTP.POST /account/settings/import`
|
111
118
|
*/
|
112
119
|
importSettings(form, options) {
|
113
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/
|
120
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/account/settings/import", form, options);
|
114
121
|
}
|
115
122
|
/**
|
116
123
|
* List login tokens for your user
|
117
124
|
*
|
118
|
-
* `HTTP.GET /
|
125
|
+
* `HTTP.GET /account/list_logins`
|
119
126
|
*/
|
120
127
|
listLogins(options) {
|
121
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/
|
128
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/account/list_logins", {}, options);
|
122
129
|
}
|
123
130
|
/**
|
124
131
|
* Returns an error message if your auth token is invalid
|
125
132
|
*
|
126
|
-
* `HTTP.GET /
|
133
|
+
* `HTTP.GET /account/validate_auth`
|
127
134
|
*/
|
128
135
|
validateAuth(options) {
|
129
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/
|
136
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/account/validate_auth", {}, options);
|
130
137
|
}
|
131
138
|
/**
|
132
139
|
* List all the media for your user
|
@@ -147,14 +154,14 @@ class LemmyHttp {
|
|
147
154
|
/**
|
148
155
|
* Enable / Disable TOTP / two-factor authentication.
|
149
156
|
*
|
150
|
-
* To enable, you need to first call `/
|
157
|
+
* To enable, you need to first call `/account/auth/totp/generate` and then pass a valid token to this.
|
151
158
|
*
|
152
159
|
* Disabling is only possible if 2FA was previously enabled. Again it is necessary to pass a valid token.
|
153
160
|
*
|
154
|
-
* `HTTP.POST /
|
161
|
+
* `HTTP.POST /account/auth/totp/update`
|
155
162
|
*/
|
156
163
|
updateTotp(form, options) {
|
157
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/
|
164
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/account/auth/totp/update", form, options);
|
158
165
|
}
|
159
166
|
/**
|
160
167
|
* Get the modlog.
|
@@ -233,10 +240,10 @@ class LemmyHttp {
|
|
233
240
|
/**
|
234
241
|
* Block a community.
|
235
242
|
*
|
236
|
-
* `HTTP.POST /
|
243
|
+
* `HTTP.POST /account/block/community`
|
237
244
|
*/
|
238
245
|
blockCommunity(form, options) {
|
239
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/
|
246
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/account/block/community", form, options);
|
240
247
|
}
|
241
248
|
/**
|
242
249
|
* Delete a community.
|
@@ -342,6 +349,14 @@ class LemmyHttp {
|
|
342
349
|
markPostAsRead(form, options) {
|
343
350
|
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/post/mark_as_read", form, options);
|
344
351
|
}
|
352
|
+
/**
|
353
|
+
* Mark multiple posts as read.
|
354
|
+
*
|
355
|
+
* `HTTP.POST /post/mark_as_read/many`
|
356
|
+
*/
|
357
|
+
markManyPostAsRead(form, options) {
|
358
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/post/mark_as_read/many", form, options);
|
359
|
+
}
|
345
360
|
/**
|
346
361
|
* Hide a post from list views.
|
347
362
|
*
|
@@ -526,14 +541,6 @@ class LemmyHttp {
|
|
526
541
|
resolveCommentReport(form, options) {
|
527
542
|
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Put, "/comment/report/resolve", form, options);
|
528
543
|
}
|
529
|
-
/**
|
530
|
-
* Get / fetch private messages.
|
531
|
-
*
|
532
|
-
* `HTTP.GET /private_message/list`
|
533
|
-
*/
|
534
|
-
getPrivateMessages(form, options) {
|
535
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/private_message/list", form, options);
|
536
|
-
}
|
537
544
|
/**
|
538
545
|
* Create a private message.
|
539
546
|
*
|
@@ -585,162 +592,178 @@ class LemmyHttp {
|
|
585
592
|
/**
|
586
593
|
* Register a new user.
|
587
594
|
*
|
588
|
-
* `HTTP.POST /
|
595
|
+
* `HTTP.POST /account/auth/register`
|
589
596
|
*/
|
590
597
|
register(form, options) {
|
591
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/
|
598
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/account/auth/register", form, options);
|
592
599
|
}
|
593
600
|
/**
|
594
601
|
* Log into lemmy.
|
595
602
|
*
|
596
|
-
* `HTTP.POST /
|
603
|
+
* `HTTP.POST /account/auth/login`
|
597
604
|
*/
|
598
605
|
login(form, options) {
|
599
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/
|
606
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/account/auth/login", form, options);
|
600
607
|
}
|
601
608
|
/**
|
602
609
|
* Invalidate the currently used auth token.
|
603
610
|
*
|
604
|
-
* `HTTP.POST /
|
611
|
+
* `HTTP.POST /account/auth/logout`
|
605
612
|
*/
|
606
613
|
logout(options) {
|
607
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/
|
614
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/account/auth/logout", {}, options);
|
608
615
|
}
|
609
616
|
/**
|
610
617
|
* Get the details for a person.
|
611
618
|
*
|
612
|
-
* `HTTP.GET /
|
619
|
+
* `HTTP.GET /person`
|
613
620
|
*/
|
614
621
|
getPersonDetails(form = {}, options) {
|
615
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/
|
622
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/person", form, options);
|
616
623
|
}
|
617
624
|
/**
|
618
|
-
*
|
625
|
+
* List the content for a person.
|
619
626
|
*
|
620
|
-
* `HTTP.GET /
|
627
|
+
* `HTTP.GET /person/content`
|
621
628
|
*/
|
622
|
-
|
623
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/
|
629
|
+
listPersonContent(form = {}, options) {
|
630
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/person/content", form, options);
|
624
631
|
}
|
625
632
|
/**
|
626
633
|
* Mark a person mention as read.
|
627
634
|
*
|
628
|
-
* `HTTP.POST /
|
635
|
+
* `HTTP.POST /account/mention/comment/mark_as_read`
|
629
636
|
*/
|
630
|
-
|
631
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/
|
637
|
+
markCommentMentionAsRead(form, options) {
|
638
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/account/mention/comment/mark_as_read", form, options);
|
632
639
|
}
|
633
640
|
/**
|
634
|
-
*
|
641
|
+
* Mark a person post body mention as read.
|
635
642
|
*
|
636
|
-
* `HTTP.
|
643
|
+
* `HTTP.POST /account/mention/post/mark_as_read`
|
637
644
|
*/
|
638
|
-
|
639
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.
|
645
|
+
markPostMentionAsRead(form, options) {
|
646
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/account/mention/post/mark_as_read", form, options);
|
640
647
|
}
|
641
648
|
/**
|
642
649
|
* Ban a person from your site.
|
643
650
|
*
|
644
|
-
* `HTTP.POST /
|
651
|
+
* `HTTP.POST /admin/ban`
|
645
652
|
*/
|
646
653
|
banPerson(form, options) {
|
647
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/
|
654
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/admin/ban", form, options);
|
648
655
|
}
|
649
656
|
/**
|
650
657
|
* Get a list of banned users
|
651
658
|
*
|
652
|
-
* `HTTP.GET /
|
659
|
+
* `HTTP.GET /admin/banned`
|
653
660
|
*/
|
654
661
|
getBannedPersons(options) {
|
655
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/
|
662
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/admin/banned", {}, options);
|
656
663
|
}
|
657
664
|
/**
|
658
665
|
* Block a person.
|
659
666
|
*
|
660
|
-
* `HTTP.POST /
|
667
|
+
* `HTTP.POST /account/block/person`
|
661
668
|
*/
|
662
669
|
blockPerson(form, options) {
|
663
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/
|
670
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/account/block/person", form, options);
|
664
671
|
}
|
665
672
|
/**
|
666
673
|
* Fetch a Captcha.
|
667
674
|
*
|
668
|
-
* `HTTP.GET /
|
675
|
+
* `HTTP.GET /account/auth/get_captcha`
|
669
676
|
*/
|
670
677
|
getCaptcha(options) {
|
671
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/
|
678
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/account/auth/get_captcha", {}, options);
|
672
679
|
}
|
673
680
|
/**
|
674
681
|
* Delete your account.
|
675
682
|
*
|
676
|
-
* `HTTP.POST /
|
683
|
+
* `HTTP.POST /account/delete`
|
677
684
|
*/
|
678
685
|
deleteAccount(form, options) {
|
679
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/
|
686
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/account/delete", form, options);
|
680
687
|
}
|
681
688
|
/**
|
682
689
|
* Reset your password.
|
683
690
|
*
|
684
|
-
* `HTTP.POST /
|
691
|
+
* `HTTP.POST /account/auth/password_reset`
|
685
692
|
*/
|
686
693
|
passwordReset(form, options) {
|
687
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/
|
694
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/account/auth/password_reset", form, options);
|
688
695
|
}
|
689
696
|
/**
|
690
697
|
* Change your password from an email / token based reset.
|
691
698
|
*
|
692
|
-
* `HTTP.POST /
|
699
|
+
* `HTTP.POST /account/auth/password_change`
|
693
700
|
*/
|
694
701
|
passwordChangeAfterReset(form, options) {
|
695
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/
|
702
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/account/auth/password_change", form, options);
|
696
703
|
}
|
697
704
|
/**
|
698
705
|
* Mark all replies as read.
|
699
706
|
*
|
700
|
-
* `HTTP.POST /
|
707
|
+
* `HTTP.POST /account/mark_as_read/all`
|
701
708
|
*/
|
702
|
-
|
703
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/
|
709
|
+
markAllNotificationsAsRead(options) {
|
710
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/account/mark_as_read/all", {}, options);
|
704
711
|
}
|
705
712
|
/**
|
706
713
|
* Save your user settings.
|
707
714
|
*
|
708
|
-
* `HTTP.PUT /
|
715
|
+
* `HTTP.PUT /account/settings/save`
|
709
716
|
*/
|
710
717
|
saveUserSettings(form, options) {
|
711
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Put, "/
|
718
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Put, "/account/settings/save", form, options);
|
712
719
|
}
|
713
720
|
/**
|
714
721
|
* Change your user password.
|
715
722
|
*
|
716
|
-
* `HTTP.PUT /
|
723
|
+
* `HTTP.PUT /account/auth/change_password`
|
717
724
|
*/
|
718
725
|
changePassword(form, options) {
|
719
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Put, "/
|
726
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Put, "/account/auth/change_password", form, options);
|
720
727
|
}
|
721
728
|
/**
|
722
729
|
* Get counts for your reports
|
723
730
|
*
|
724
|
-
* `HTTP.GET /
|
731
|
+
* `HTTP.GET /account/report_count`
|
725
732
|
*/
|
726
733
|
getReportCount(form, options) {
|
727
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/
|
734
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/account/report_count", form, options);
|
728
735
|
}
|
729
736
|
/**
|
730
737
|
* Get your unread counts
|
731
738
|
*
|
732
|
-
* `HTTP.GET /
|
739
|
+
* `HTTP.GET /account/unread_count`
|
733
740
|
*/
|
734
741
|
getUnreadCount(options) {
|
735
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/
|
742
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/account/unread_count", {}, options);
|
743
|
+
}
|
744
|
+
/**
|
745
|
+
* Get your inbox (replies, comment mentions, post mentions, and messages)
|
746
|
+
*
|
747
|
+
* `HTTP.GET /account/inbox`
|
748
|
+
*/
|
749
|
+
listInbox(form, options) {
|
750
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/account/inbox", form, options);
|
736
751
|
}
|
737
752
|
/**
|
738
753
|
* Verify your email
|
739
754
|
*
|
740
|
-
* `HTTP.POST /
|
755
|
+
* `HTTP.POST /account/auth/verify_email`
|
741
756
|
*/
|
742
757
|
verifyEmail(form, options) {
|
743
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/
|
758
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/account/auth/verify_email", form, options);
|
759
|
+
}
|
760
|
+
/**
|
761
|
+
* List your saved content.
|
762
|
+
*
|
763
|
+
* `HTTP.GET /account/auth/saved`
|
764
|
+
*/
|
765
|
+
listPersonSaved(form, options) {
|
766
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/account/auth/saved", form, options);
|
744
767
|
}
|
745
768
|
/**
|
746
769
|
* Add an admin to your site.
|
@@ -929,57 +952,175 @@ class LemmyHttp {
|
|
929
952
|
/**
|
930
953
|
* Block an instance as user.
|
931
954
|
*
|
932
|
-
* `HTTP.Post /
|
955
|
+
* `HTTP.Post /account/block/instance`
|
933
956
|
*/
|
934
957
|
userBlockInstance(form, options) {
|
935
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/
|
958
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/account/block/instance", form, options);
|
936
959
|
}
|
937
960
|
/**
|
938
961
|
* Globally block an instance as admin.
|
939
962
|
*
|
940
|
-
* `HTTP.Post /admin/
|
963
|
+
* `HTTP.Post /admin/instance/block`
|
941
964
|
*/
|
942
965
|
adminBlockInstance(form, options) {
|
943
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/admin/
|
966
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/admin/instance/block", form, options);
|
944
967
|
}
|
945
968
|
/**
|
946
969
|
* Globally allow an instance as admin.
|
947
970
|
*
|
948
|
-
* `HTTP.Post /admin/
|
971
|
+
* `HTTP.Post /admin/instance/allow`
|
949
972
|
*/
|
950
973
|
adminAllowInstance(form, options) {
|
951
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/admin/
|
974
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/admin/instance/allow", form, options);
|
975
|
+
}
|
976
|
+
/**
|
977
|
+
* Upload new user avatar.
|
978
|
+
*
|
979
|
+
* `HTTP.Post /account/avatar`
|
980
|
+
*/
|
981
|
+
uploadUserAvatar(image, options) {
|
982
|
+
return __awaiter(this, void 0, void 0, function* () {
|
983
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_upload).call(this, "/account/avatar", image, options);
|
984
|
+
});
|
985
|
+
}
|
986
|
+
/**
|
987
|
+
* Delete the user avatar.
|
988
|
+
*
|
989
|
+
* `HTTP.Delete /account/avatar`
|
990
|
+
*/
|
991
|
+
deleteUserAvatar(options) {
|
992
|
+
return __awaiter(this, void 0, void 0, function* () {
|
993
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Delete, "/account/avatar", {}, options);
|
994
|
+
});
|
995
|
+
}
|
996
|
+
/**
|
997
|
+
* Upload new user banner.
|
998
|
+
*
|
999
|
+
* `HTTP.Post /account/banner`
|
1000
|
+
*/
|
1001
|
+
uploadUserBanner(image, options) {
|
1002
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1003
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_upload).call(this, "/account/banner", image, options);
|
1004
|
+
});
|
1005
|
+
}
|
1006
|
+
/**
|
1007
|
+
* Delete the user banner.
|
1008
|
+
*
|
1009
|
+
* `HTTP.Delete /account/banner`
|
1010
|
+
*/
|
1011
|
+
deleteUserBanner(options) {
|
1012
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1013
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Delete, "/account/banner", {}, options);
|
1014
|
+
});
|
1015
|
+
}
|
1016
|
+
/**
|
1017
|
+
* Upload new community icon.
|
1018
|
+
*
|
1019
|
+
* `HTTP.Post /community/icon`
|
1020
|
+
*/
|
1021
|
+
uploadCommunityIcon(image, options) {
|
1022
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1023
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_upload).call(this, "/community/icon", image, options);
|
1024
|
+
});
|
1025
|
+
}
|
1026
|
+
/**
|
1027
|
+
* Delete the community icon.
|
1028
|
+
*
|
1029
|
+
* `HTTP.Delete /community/icon`
|
1030
|
+
*/
|
1031
|
+
deleteCommunityIcon(options) {
|
1032
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1033
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Delete, "/community/icon", {}, options);
|
1034
|
+
});
|
1035
|
+
}
|
1036
|
+
/**
|
1037
|
+
* Upload new community banner.
|
1038
|
+
*
|
1039
|
+
* `HTTP.Post /community/banner`
|
1040
|
+
*/
|
1041
|
+
uploadCommunityBanner(image, options) {
|
1042
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1043
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_upload).call(this, "/community/banner", image, options);
|
1044
|
+
});
|
1045
|
+
}
|
1046
|
+
/**
|
1047
|
+
* Delete the community banner.
|
1048
|
+
*
|
1049
|
+
* `HTTP.Delete /community/banner`
|
1050
|
+
*/
|
1051
|
+
deleteCommunityBanner(options) {
|
1052
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1053
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Delete, "/community/banner", {}, options);
|
1054
|
+
});
|
1055
|
+
}
|
1056
|
+
/**
|
1057
|
+
* Upload new site icon.
|
1058
|
+
*
|
1059
|
+
* `HTTP.Post /site/icon`
|
1060
|
+
*/
|
1061
|
+
uploadSiteIcon(image, options) {
|
1062
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1063
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_upload).call(this, "/site/icon", image, options);
|
1064
|
+
});
|
1065
|
+
}
|
1066
|
+
/**
|
1067
|
+
* Delete the site icon.
|
1068
|
+
*
|
1069
|
+
* `HTTP.Delete /site/icon`
|
1070
|
+
*/
|
1071
|
+
deleteSiteIcon(options) {
|
1072
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1073
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Delete, "/site/icon", {}, options);
|
1074
|
+
});
|
1075
|
+
}
|
1076
|
+
/**
|
1077
|
+
* Upload new site banner.
|
1078
|
+
*
|
1079
|
+
* `HTTP.Post /site/banner`
|
1080
|
+
*/
|
1081
|
+
uploadSiteBanner(image, options) {
|
1082
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1083
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_upload).call(this, "/site/banner", image, options);
|
1084
|
+
});
|
1085
|
+
}
|
1086
|
+
/**
|
1087
|
+
* Delete the site banner.
|
1088
|
+
*
|
1089
|
+
* `HTTP.Delete /site/banner`
|
1090
|
+
*/
|
1091
|
+
deleteSiteBanner(options) {
|
1092
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1093
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Delete, "/site/banner", {}, options);
|
1094
|
+
});
|
952
1095
|
}
|
953
1096
|
/**
|
954
1097
|
* Upload an image to the server.
|
1098
|
+
*
|
1099
|
+
* `HTTP.Post /image`
|
955
1100
|
*/
|
956
|
-
uploadImage(
|
957
|
-
return __awaiter(this,
|
958
|
-
|
959
|
-
let url = undefined;
|
960
|
-
let delete_url = undefined;
|
961
|
-
const response = yield __classPrivateFieldGet(this, _LemmyHttp_fetchFunction, "f").call(this, __classPrivateFieldGet(this, _LemmyHttp_pictrsUrl, "f"), Object.assign(Object.assign({}, options), { method: HttpType.Post, body: formData, headers: __classPrivateFieldGet(this, _LemmyHttp_headers, "f") }));
|
962
|
-
if (response.status === 413) {
|
963
|
-
return { msg: "too_large" };
|
964
|
-
}
|
965
|
-
const responseJson = yield response.json();
|
966
|
-
if (responseJson.msg === "ok") {
|
967
|
-
const { file: hash, delete_token: deleteToken } = responseJson.files[0];
|
968
|
-
delete_url = `${__classPrivateFieldGet(this, _LemmyHttp_pictrsUrl, "f")}/delete/${deleteToken}/${hash}`;
|
969
|
-
url = `${__classPrivateFieldGet(this, _LemmyHttp_pictrsUrl, "f")}/${hash}`;
|
970
|
-
}
|
971
|
-
return Object.assign(Object.assign({}, responseJson), { url,
|
972
|
-
delete_url });
|
1101
|
+
uploadImage(image, options) {
|
1102
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1103
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_upload).call(this, "/image", image, options);
|
973
1104
|
});
|
974
1105
|
}
|
975
1106
|
/**
|
976
1107
|
* Delete a pictrs image
|
1108
|
+
*
|
1109
|
+
* `HTTP.Delete /image`
|
977
1110
|
*/
|
978
|
-
deleteImage(
|
979
|
-
return __awaiter(this,
|
980
|
-
|
981
|
-
|
982
|
-
|
1111
|
+
deleteImage(form, options) {
|
1112
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1113
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Delete, "/image", form, options);
|
1114
|
+
});
|
1115
|
+
}
|
1116
|
+
/**
|
1117
|
+
* Health check for image functionality
|
1118
|
+
*
|
1119
|
+
* `HTTP.Get /image/health`
|
1120
|
+
*/
|
1121
|
+
imageHealth(options) {
|
1122
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1123
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/image/health", {}, options);
|
983
1124
|
});
|
984
1125
|
}
|
985
1126
|
/**
|
@@ -990,8 +1131,14 @@ class LemmyHttp {
|
|
990
1131
|
}
|
991
1132
|
}
|
992
1133
|
exports.LemmyHttp = LemmyHttp;
|
993
|
-
_LemmyHttp_apiUrl = new WeakMap(), _LemmyHttp_headers = new WeakMap(),
|
1134
|
+
_LemmyHttp_apiUrl = new WeakMap(), _LemmyHttp_headers = new WeakMap(), _LemmyHttp_fetchFunction = new WeakMap(), _LemmyHttp_instances = new WeakSet(), _LemmyHttp_buildFullUrl = function _LemmyHttp_buildFullUrl(endpoint) {
|
994
1135
|
return `${__classPrivateFieldGet(this, _LemmyHttp_apiUrl, "f")}${endpoint}`;
|
1136
|
+
}, _LemmyHttp_upload = function _LemmyHttp_upload(path_1, _a, options_1) {
|
1137
|
+
return __awaiter(this, arguments, void 0, function* (path, { image }, options) {
|
1138
|
+
const formData = createFormData(image);
|
1139
|
+
const response = yield __classPrivateFieldGet(this, _LemmyHttp_fetchFunction, "f").call(this, __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_buildFullUrl).call(this, path), Object.assign(Object.assign({}, options), { method: HttpType.Post, body: formData, headers: __classPrivateFieldGet(this, _LemmyHttp_headers, "f") }));
|
1140
|
+
return response.json();
|
1141
|
+
});
|
995
1142
|
}, _LemmyHttp_wrapper = function _LemmyHttp_wrapper(type_, endpoint, form, options) {
|
996
1143
|
return __awaiter(this, void 0, void 0, function* () {
|
997
1144
|
var _a;
|