lemmy-js-client 0.20.0-instance-blocks.5 → 0.20.0-modlog-combined.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/http.d.ts +164 -60
- package/dist/http.js +261 -114
- package/dist/index.d.ts +39 -8
- 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/AdminBlockInstanceId.js +3 -0
- package/dist/types/AdminPurgeComment.d.ts +2 -1
- package/dist/types/AdminPurgeCommentId.d.ts +1 -0
- package/dist/types/AdminPurgeCommentId.js +3 -0
- package/dist/types/AdminPurgeCommunity.d.ts +2 -1
- package/dist/types/AdminPurgeCommunityId.d.ts +1 -0
- package/dist/types/AdminPurgeCommunityId.js +3 -0
- package/dist/types/AdminPurgePerson.d.ts +2 -1
- package/dist/types/AdminPurgePersonId.d.ts +1 -0
- package/dist/types/AdminPurgePersonId.js +3 -0
- package/dist/types/AdminPurgePost.d.ts +2 -1
- package/dist/types/AdminPurgePostId.d.ts +1 -0
- package/dist/types/AdminPurgePostId.js +3 -0
- package/dist/types/AuthenticateWithOauth.d.ts +1 -0
- package/dist/types/CommentAggregates.d.ts +2 -0
- package/dist/types/CreateOAuthProvider.d.ts +1 -0
- package/dist/types/CreatePost.d.ts +2 -0
- package/dist/types/CreateSite.d.ts +0 -2
- package/dist/types/DeleteImageParams.d.ts +4 -0
- package/dist/types/DeleteImageParams.js +3 -0
- package/dist/types/EditCommunity.d.ts +0 -8
- package/dist/types/EditOAuthProvider.d.ts +1 -0
- package/dist/types/EditPost.d.ts +2 -0
- package/dist/types/EditSite.d.ts +0 -8
- package/dist/types/GetComments.d.ts +0 -1
- package/dist/types/GetModlog.d.ts +4 -3
- 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 +2 -0
- package/dist/types/GetReportCountResponse.d.ts +1 -5
- package/dist/types/GetReportCountResponse.js +1 -0
- package/dist/types/GetSiteResponse.d.ts +1 -10
- 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/LemmyErrorType.d.ts +6 -2
- 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/{ListCommentReports.d.ts → ListReports.d.ts} +5 -6
- package/dist/types/ListReportsResponse.d.ts +7 -0
- package/dist/types/ModAdd.d.ts +2 -1
- package/dist/types/ModAddCommunity.d.ts +2 -1
- package/dist/types/ModAddCommunityId.d.ts +1 -0
- package/dist/types/ModAddCommunityId.js +3 -0
- package/dist/types/ModAddId.d.ts +1 -0
- package/dist/types/ModAddId.js +3 -0
- package/dist/types/ModBan.d.ts +2 -1
- package/dist/types/ModBanFromCommunity.d.ts +2 -1
- 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 +2 -1
- 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 +2 -1
- package/dist/types/ModHideCommunityId.d.ts +1 -0
- package/dist/types/ModHideCommunityId.js +3 -0
- package/dist/types/ModLockPost.d.ts +2 -1
- 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 +2 -1
- 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 +2 -1
- package/dist/types/ModRemoveCommunityId.d.ts +1 -0
- package/dist/types/ModRemoveCommunityId.js +3 -0
- package/dist/types/ModRemovePost.d.ts +2 -1
- 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 +2 -1
- package/dist/types/ModTransferCommunityId.d.ts +1 -0
- package/dist/types/ModTransferCommunityId.js +3 -0
- 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/ModlogCombinedView.js +2 -0
- package/dist/types/OAuthProvider.d.ts +4 -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/PersonSavedCombinedPaginationCursor.d.ts +4 -0
- package/dist/types/PersonSavedCombinedPaginationCursor.js +3 -0
- package/dist/types/PostAggregates.d.ts +2 -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/ReportCombinedPaginationCursor.d.ts +4 -0
- package/dist/types/ReportCombinedPaginationCursor.js +3 -0
- package/dist/types/ReportCombinedView.d.ts +10 -0
- package/dist/types/ReportCombinedView.js +2 -0
- package/dist/types/SaveUserSettings.d.ts +0 -8
- package/dist/types/Search.d.ts +0 -1
- 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 +5 -0
- package/dist/types/UploadImageResponse.js +3 -0
- package/package.json +3 -3
- package/dist/types/ListCommentReportsResponse.d.ts +0 -7
- package/dist/types/ListPostReports.d.ts +0 -18
- package/dist/types/ListPostReportsResponse.d.ts +0 -7
- package/dist/types/ListPrivateMessageReports.d.ts +0 -11
- package/dist/types/ListPrivateMessageReportsResponse.d.ts +0 -7
- package/dist/types/ModlogListParams.d.ts +0 -17
- /package/dist/types/{ListPrivateMessageReports.js → AdminAllowInstanceId.js} +0 -0
- /package/dist/types/{ListCommentReports.js → ListPersonContent.js} +0 -0
- /package/dist/types/{ListCommentReportsResponse.js → ListPersonContentResponse.js} +0 -0
- /package/dist/types/{ListPostReports.js → ListPersonSaved.js} +0 -0
- /package/dist/types/{ListPostReportsResponse.js → ListPersonSavedResponse.js} +0 -0
- /package/dist/types/{ListPrivateMessageReportsResponse.js → ListReports.js} +0 -0
- /package/dist/types/{ModlogListParams.js → ListReportsResponse.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
|
*
|
@@ -414,14 +429,6 @@ class LemmyHttp {
|
|
414
429
|
resolvePostReport(form, options) {
|
415
430
|
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Put, "/post/report/resolve", form, options);
|
416
431
|
}
|
417
|
-
/**
|
418
|
-
* List post reports.
|
419
|
-
*
|
420
|
-
* `HTTP.GET /post/report/list`
|
421
|
-
*/
|
422
|
-
listPostReports(form, options) {
|
423
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/post/report/list", form, options);
|
424
|
-
}
|
425
432
|
/**
|
426
433
|
* Fetch metadata for any given site.
|
427
434
|
*
|
@@ -534,14 +541,6 @@ class LemmyHttp {
|
|
534
541
|
resolveCommentReport(form, options) {
|
535
542
|
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Put, "/comment/report/resolve", form, options);
|
536
543
|
}
|
537
|
-
/**
|
538
|
-
* List comment reports.
|
539
|
-
*
|
540
|
-
* `HTTP.GET /comment/report/list`
|
541
|
-
*/
|
542
|
-
listCommentReports(form, options) {
|
543
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/comment/report/list", form, options);
|
544
|
-
}
|
545
544
|
/**
|
546
545
|
* Get / fetch private messages.
|
547
546
|
*
|
@@ -598,173 +597,189 @@ class LemmyHttp {
|
|
598
597
|
resolvePrivateMessageReport(form, options) {
|
599
598
|
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Put, "/private_message/report/resolve", form, options);
|
600
599
|
}
|
601
|
-
/**
|
602
|
-
* List private message reports.
|
603
|
-
*
|
604
|
-
* `HTTP.GET /private_message/report/list`
|
605
|
-
*/
|
606
|
-
listPrivateMessageReports(form, options) {
|
607
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/private_message/report/list", form, options);
|
608
|
-
}
|
609
600
|
/**
|
610
601
|
* Register a new user.
|
611
602
|
*
|
612
|
-
* `HTTP.POST /
|
603
|
+
* `HTTP.POST /account/auth/register`
|
613
604
|
*/
|
614
605
|
register(form, options) {
|
615
|
-
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/register", form, options);
|
616
607
|
}
|
617
608
|
/**
|
618
609
|
* Log into lemmy.
|
619
610
|
*
|
620
|
-
* `HTTP.POST /
|
611
|
+
* `HTTP.POST /account/auth/login`
|
621
612
|
*/
|
622
613
|
login(form, options) {
|
623
|
-
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/login", form, options);
|
624
615
|
}
|
625
616
|
/**
|
626
617
|
* Invalidate the currently used auth token.
|
627
618
|
*
|
628
|
-
* `HTTP.POST /
|
619
|
+
* `HTTP.POST /account/auth/logout`
|
629
620
|
*/
|
630
621
|
logout(options) {
|
631
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/
|
622
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/account/auth/logout", {}, options);
|
632
623
|
}
|
633
624
|
/**
|
634
625
|
* Get the details for a person.
|
635
626
|
*
|
636
|
-
* `HTTP.GET /
|
627
|
+
* `HTTP.GET /person`
|
637
628
|
*/
|
638
629
|
getPersonDetails(form = {}, options) {
|
639
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/
|
630
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/person", form, options);
|
631
|
+
}
|
632
|
+
/**
|
633
|
+
* List the content for a person.
|
634
|
+
*
|
635
|
+
* `HTTP.GET /person/content`
|
636
|
+
*/
|
637
|
+
listPersonContent(form = {}, options) {
|
638
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/person/content", form, options);
|
640
639
|
}
|
641
640
|
/**
|
642
641
|
* Get mentions for your user.
|
643
642
|
*
|
644
|
-
* `HTTP.GET /
|
643
|
+
* `HTTP.GET /account/mention`
|
645
644
|
*/
|
646
645
|
getPersonMentions(form, options) {
|
647
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/
|
646
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/account/mention", form, options);
|
648
647
|
}
|
649
648
|
/**
|
650
649
|
* Mark a person mention as read.
|
651
650
|
*
|
652
|
-
* `HTTP.POST /
|
651
|
+
* `HTTP.POST /account/mention/mark_as_read`
|
653
652
|
*/
|
654
653
|
markPersonMentionAsRead(form, options) {
|
655
|
-
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, "/account/mention/mark_as_read", form, options);
|
655
|
+
}
|
656
|
+
/**
|
657
|
+
* Mark a person mention as read.
|
658
|
+
*
|
659
|
+
* `HTTP.POST /account/mention/mark_as_read`
|
660
|
+
*/
|
661
|
+
markPersonAllMentionAsRead(options) {
|
662
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/account/mention/mark_as_read", {}, options);
|
656
663
|
}
|
657
664
|
/**
|
658
665
|
* Get comment replies.
|
659
666
|
*
|
660
|
-
* `HTTP.GET /
|
667
|
+
* `HTTP.GET /account/replies`
|
661
668
|
*/
|
662
669
|
getReplies(form, options) {
|
663
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/
|
670
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/account/replies", form, options);
|
664
671
|
}
|
665
672
|
/**
|
666
673
|
* Ban a person from your site.
|
667
674
|
*
|
668
|
-
* `HTTP.POST /
|
675
|
+
* `HTTP.POST /admin/ban`
|
669
676
|
*/
|
670
677
|
banPerson(form, options) {
|
671
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/
|
678
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/admin/ban", form, options);
|
672
679
|
}
|
673
680
|
/**
|
674
681
|
* Get a list of banned users
|
675
682
|
*
|
676
|
-
* `HTTP.GET /
|
683
|
+
* `HTTP.GET /admin/banned`
|
677
684
|
*/
|
678
685
|
getBannedPersons(options) {
|
679
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/
|
686
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/admin/banned", {}, options);
|
680
687
|
}
|
681
688
|
/**
|
682
689
|
* Block a person.
|
683
690
|
*
|
684
|
-
* `HTTP.POST /
|
691
|
+
* `HTTP.POST /account/block/person`
|
685
692
|
*/
|
686
693
|
blockPerson(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/block/person", form, options);
|
688
695
|
}
|
689
696
|
/**
|
690
697
|
* Fetch a Captcha.
|
691
698
|
*
|
692
|
-
* `HTTP.GET /
|
699
|
+
* `HTTP.GET /account/auth/get_captcha`
|
693
700
|
*/
|
694
701
|
getCaptcha(options) {
|
695
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/
|
702
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/account/auth/get_captcha", {}, options);
|
696
703
|
}
|
697
704
|
/**
|
698
705
|
* Delete your account.
|
699
706
|
*
|
700
|
-
* `HTTP.POST /
|
707
|
+
* `HTTP.POST /account/delete`
|
701
708
|
*/
|
702
709
|
deleteAccount(form, options) {
|
703
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/
|
710
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/account/delete", form, options);
|
704
711
|
}
|
705
712
|
/**
|
706
713
|
* Reset your password.
|
707
714
|
*
|
708
|
-
* `HTTP.POST /
|
715
|
+
* `HTTP.POST /account/auth/password_reset`
|
709
716
|
*/
|
710
717
|
passwordReset(form, options) {
|
711
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/
|
718
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/account/auth/password_reset", form, options);
|
712
719
|
}
|
713
720
|
/**
|
714
721
|
* Change your password from an email / token based reset.
|
715
722
|
*
|
716
|
-
* `HTTP.POST /
|
723
|
+
* `HTTP.POST /account/auth/password_change`
|
717
724
|
*/
|
718
725
|
passwordChangeAfterReset(form, options) {
|
719
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/
|
726
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/account/auth/password_change", form, options);
|
720
727
|
}
|
721
728
|
/**
|
722
729
|
* Mark all replies as read.
|
723
730
|
*
|
724
|
-
* `HTTP.POST /
|
731
|
+
* `HTTP.POST /account/mention/mark_as_read/all`
|
725
732
|
*/
|
726
733
|
markAllAsRead(options) {
|
727
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/
|
734
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/account/mention/mark_as_read/all", {}, options);
|
728
735
|
}
|
729
736
|
/**
|
730
737
|
* Save your user settings.
|
731
738
|
*
|
732
|
-
* `HTTP.PUT /
|
739
|
+
* `HTTP.PUT /account/settings/save`
|
733
740
|
*/
|
734
741
|
saveUserSettings(form, options) {
|
735
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Put, "/
|
742
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Put, "/account/settings/save", form, options);
|
736
743
|
}
|
737
744
|
/**
|
738
745
|
* Change your user password.
|
739
746
|
*
|
740
|
-
* `HTTP.PUT /
|
747
|
+
* `HTTP.PUT /account/auth/change_password`
|
741
748
|
*/
|
742
749
|
changePassword(form, options) {
|
743
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Put, "/
|
750
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Put, "/account/auth/change_password", form, options);
|
744
751
|
}
|
745
752
|
/**
|
746
753
|
* Get counts for your reports
|
747
754
|
*
|
748
|
-
* `HTTP.GET /
|
755
|
+
* `HTTP.GET /account/report_count`
|
749
756
|
*/
|
750
757
|
getReportCount(form, options) {
|
751
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/
|
758
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/account/report_count", form, options);
|
752
759
|
}
|
753
760
|
/**
|
754
761
|
* Get your unread counts
|
755
762
|
*
|
756
|
-
* `HTTP.GET /
|
763
|
+
* `HTTP.GET /account/unread_count`
|
757
764
|
*/
|
758
765
|
getUnreadCount(options) {
|
759
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/
|
766
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/account/unread_count", {}, options);
|
760
767
|
}
|
761
768
|
/**
|
762
769
|
* Verify your email
|
763
770
|
*
|
764
|
-
* `HTTP.POST /
|
771
|
+
* `HTTP.POST /account/auth/verify_email`
|
765
772
|
*/
|
766
773
|
verifyEmail(form, options) {
|
767
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/
|
774
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/account/auth/verify_email", form, options);
|
775
|
+
}
|
776
|
+
/**
|
777
|
+
* List your saved content.
|
778
|
+
*
|
779
|
+
* `HTTP.GET /account/auth/saved`
|
780
|
+
*/
|
781
|
+
listPersonSaved(form, options) {
|
782
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/account/auth/saved", form, options);
|
768
783
|
}
|
769
784
|
/**
|
770
785
|
* Add an admin to your site.
|
@@ -942,60 +957,186 @@ class LemmyHttp {
|
|
942
957
|
getFederatedInstances(options) {
|
943
958
|
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/federated_instances", {}, options);
|
944
959
|
}
|
960
|
+
/**
|
961
|
+
* List user reports.
|
962
|
+
*
|
963
|
+
* `HTTP.GET /report/list`
|
964
|
+
*/
|
965
|
+
listReports(form, options) {
|
966
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/report/list", form, options);
|
967
|
+
}
|
945
968
|
/**
|
946
969
|
* Block an instance as user.
|
947
970
|
*
|
948
|
-
* `HTTP.Post /
|
971
|
+
* `HTTP.Post /account/block/instance`
|
949
972
|
*/
|
950
973
|
userBlockInstance(form, options) {
|
951
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/
|
974
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/account/block/instance", form, options);
|
952
975
|
}
|
953
976
|
/**
|
954
977
|
* Globally block an instance as admin.
|
955
978
|
*
|
956
|
-
* `HTTP.Post /admin/
|
979
|
+
* `HTTP.Post /admin/instance/block`
|
957
980
|
*/
|
958
981
|
adminBlockInstance(form, options) {
|
959
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/admin/
|
982
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/admin/instance/block", form, options);
|
960
983
|
}
|
961
984
|
/**
|
962
985
|
* Globally allow an instance as admin.
|
963
986
|
*
|
964
|
-
* `HTTP.Post /admin/
|
987
|
+
* `HTTP.Post /admin/instance/allow`
|
965
988
|
*/
|
966
989
|
adminAllowInstance(form, options) {
|
967
|
-
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/admin/
|
990
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/admin/instance/allow", form, options);
|
991
|
+
}
|
992
|
+
/**
|
993
|
+
* Upload new user avatar.
|
994
|
+
*
|
995
|
+
* `HTTP.Post /account/avatar`
|
996
|
+
*/
|
997
|
+
uploadUserAvatar(image, options) {
|
998
|
+
return __awaiter(this, void 0, void 0, function* () {
|
999
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_upload).call(this, "/account/avatar", image, options);
|
1000
|
+
});
|
1001
|
+
}
|
1002
|
+
/**
|
1003
|
+
* Delete the user avatar.
|
1004
|
+
*
|
1005
|
+
* `HTTP.Delete /account/avatar`
|
1006
|
+
*/
|
1007
|
+
deleteUserAvatar(options) {
|
1008
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1009
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Delete, "/account/avatar", {}, options);
|
1010
|
+
});
|
1011
|
+
}
|
1012
|
+
/**
|
1013
|
+
* Upload new user banner.
|
1014
|
+
*
|
1015
|
+
* `HTTP.Post /account/banner`
|
1016
|
+
*/
|
1017
|
+
uploadUserBanner(image, options) {
|
1018
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1019
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_upload).call(this, "/account/banner", image, options);
|
1020
|
+
});
|
1021
|
+
}
|
1022
|
+
/**
|
1023
|
+
* Delete the user banner.
|
1024
|
+
*
|
1025
|
+
* `HTTP.Delete /account/banner`
|
1026
|
+
*/
|
1027
|
+
deleteUserBanner(options) {
|
1028
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1029
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Delete, "/account/banner", {}, options);
|
1030
|
+
});
|
1031
|
+
}
|
1032
|
+
/**
|
1033
|
+
* Upload new community icon.
|
1034
|
+
*
|
1035
|
+
* `HTTP.Post /community/icon`
|
1036
|
+
*/
|
1037
|
+
uploadCommunityIcon(image, options) {
|
1038
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1039
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_upload).call(this, "/community/icon", image, options);
|
1040
|
+
});
|
1041
|
+
}
|
1042
|
+
/**
|
1043
|
+
* Delete the community icon.
|
1044
|
+
*
|
1045
|
+
* `HTTP.Delete /community/icon`
|
1046
|
+
*/
|
1047
|
+
deleteCommunityIcon(options) {
|
1048
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1049
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Delete, "/community/icon", {}, options);
|
1050
|
+
});
|
1051
|
+
}
|
1052
|
+
/**
|
1053
|
+
* Upload new community banner.
|
1054
|
+
*
|
1055
|
+
* `HTTP.Post /community/banner`
|
1056
|
+
*/
|
1057
|
+
uploadCommunityBanner(image, options) {
|
1058
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1059
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_upload).call(this, "/community/banner", image, options);
|
1060
|
+
});
|
1061
|
+
}
|
1062
|
+
/**
|
1063
|
+
* Delete the community banner.
|
1064
|
+
*
|
1065
|
+
* `HTTP.Delete /community/banner`
|
1066
|
+
*/
|
1067
|
+
deleteCommunityBanner(options) {
|
1068
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1069
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Delete, "/community/banner", {}, options);
|
1070
|
+
});
|
1071
|
+
}
|
1072
|
+
/**
|
1073
|
+
* Upload new site icon.
|
1074
|
+
*
|
1075
|
+
* `HTTP.Post /site/icon`
|
1076
|
+
*/
|
1077
|
+
uploadSiteIcon(image, options) {
|
1078
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1079
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_upload).call(this, "/site/icon", image, options);
|
1080
|
+
});
|
1081
|
+
}
|
1082
|
+
/**
|
1083
|
+
* Delete the site icon.
|
1084
|
+
*
|
1085
|
+
* `HTTP.Delete /site/icon`
|
1086
|
+
*/
|
1087
|
+
deleteSiteIcon(options) {
|
1088
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1089
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Delete, "/site/icon", {}, options);
|
1090
|
+
});
|
1091
|
+
}
|
1092
|
+
/**
|
1093
|
+
* Upload new site banner.
|
1094
|
+
*
|
1095
|
+
* `HTTP.Post /site/banner`
|
1096
|
+
*/
|
1097
|
+
uploadSiteBanner(image, options) {
|
1098
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1099
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_upload).call(this, "/site/banner", image, options);
|
1100
|
+
});
|
1101
|
+
}
|
1102
|
+
/**
|
1103
|
+
* Delete the site banner.
|
1104
|
+
*
|
1105
|
+
* `HTTP.Delete /site/banner`
|
1106
|
+
*/
|
1107
|
+
deleteSiteBanner(options) {
|
1108
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1109
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Delete, "/site/banner", {}, options);
|
1110
|
+
});
|
968
1111
|
}
|
969
1112
|
/**
|
970
1113
|
* Upload an image to the server.
|
1114
|
+
*
|
1115
|
+
* `HTTP.Post /image`
|
971
1116
|
*/
|
972
|
-
uploadImage(
|
973
|
-
return __awaiter(this,
|
974
|
-
|
975
|
-
let url = undefined;
|
976
|
-
let delete_url = undefined;
|
977
|
-
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") }));
|
978
|
-
if (response.status === 413) {
|
979
|
-
return { msg: "too_large" };
|
980
|
-
}
|
981
|
-
const responseJson = yield response.json();
|
982
|
-
if (responseJson.msg === "ok") {
|
983
|
-
const { file: hash, delete_token: deleteToken } = responseJson.files[0];
|
984
|
-
delete_url = `${__classPrivateFieldGet(this, _LemmyHttp_pictrsUrl, "f")}/delete/${deleteToken}/${hash}`;
|
985
|
-
url = `${__classPrivateFieldGet(this, _LemmyHttp_pictrsUrl, "f")}/${hash}`;
|
986
|
-
}
|
987
|
-
return Object.assign(Object.assign({}, responseJson), { url,
|
988
|
-
delete_url });
|
1117
|
+
uploadImage(image, options) {
|
1118
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1119
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_upload).call(this, "/image", image, options);
|
989
1120
|
});
|
990
1121
|
}
|
991
1122
|
/**
|
992
1123
|
* Delete a pictrs image
|
1124
|
+
*
|
1125
|
+
* `HTTP.Delete /image`
|
993
1126
|
*/
|
994
|
-
deleteImage(
|
995
|
-
return __awaiter(this,
|
996
|
-
|
997
|
-
|
998
|
-
|
1127
|
+
deleteImage(form, options) {
|
1128
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1129
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Delete, "/image", form, options);
|
1130
|
+
});
|
1131
|
+
}
|
1132
|
+
/**
|
1133
|
+
* Health check for image functionality
|
1134
|
+
*
|
1135
|
+
* `HTTP.Get /image/health`
|
1136
|
+
*/
|
1137
|
+
imageHealth(options) {
|
1138
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1139
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/image/health", {}, options);
|
999
1140
|
});
|
1000
1141
|
}
|
1001
1142
|
/**
|
@@ -1006,8 +1147,14 @@ class LemmyHttp {
|
|
1006
1147
|
}
|
1007
1148
|
}
|
1008
1149
|
exports.LemmyHttp = LemmyHttp;
|
1009
|
-
_LemmyHttp_apiUrl = new WeakMap(), _LemmyHttp_headers = new WeakMap(),
|
1150
|
+
_LemmyHttp_apiUrl = new WeakMap(), _LemmyHttp_headers = new WeakMap(), _LemmyHttp_fetchFunction = new WeakMap(), _LemmyHttp_instances = new WeakSet(), _LemmyHttp_buildFullUrl = function _LemmyHttp_buildFullUrl(endpoint) {
|
1010
1151
|
return `${__classPrivateFieldGet(this, _LemmyHttp_apiUrl, "f")}${endpoint}`;
|
1152
|
+
}, _LemmyHttp_upload = function _LemmyHttp_upload(path_1, _a, options_1) {
|
1153
|
+
return __awaiter(this, arguments, void 0, function* (path, { image }, options) {
|
1154
|
+
const formData = createFormData(image);
|
1155
|
+
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") }));
|
1156
|
+
return response.json();
|
1157
|
+
});
|
1011
1158
|
}, _LemmyHttp_wrapper = function _LemmyHttp_wrapper(type_, endpoint, form, options) {
|
1012
1159
|
return __awaiter(this, void 0, void 0, function* () {
|
1013
1160
|
var _a;
|