lemmy-js-client 0.17.0-rc.2 → 0.17.0-rc.20
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/http.d.ts +156 -4
- package/dist/http.js +255 -80
- package/dist/index.d.ts +1 -0
- package/dist/index.js +6 -1
- package/dist/interfaces/api/comment.d.ts +45 -38
- package/dist/interfaces/api/comment.js +313 -0
- package/dist/interfaces/api/community.d.ts +56 -52
- package/dist/interfaces/api/community.js +411 -0
- package/dist/interfaces/api/index.js +5 -1
- package/dist/interfaces/api/person.d.ts +120 -100
- package/dist/interfaces/api/person.js +854 -0
- package/dist/interfaces/api/post.d.ts +67 -51
- package/dist/interfaces/api/post.js +405 -0
- package/dist/interfaces/api/site.d.ts +99 -90
- package/dist/interfaces/api/site.js +824 -0
- package/dist/interfaces/index.js +5 -1
- package/dist/interfaces/others.d.ts +62 -92
- package/dist/interfaces/others.js +119 -55
- package/dist/interfaces/source.d.ts +79 -76
- package/dist/interfaces/source.js +747 -0
- package/dist/interfaces/views.d.ts +36 -37
- package/dist/interfaces/views.js +270 -0
- package/dist/utils.d.ts +5 -0
- package/dist/utils.js +10 -0
- package/dist/websocket.d.ts +16 -2
- package/dist/websocket.js +35 -3
- package/package.json +13 -11
package/dist/interfaces/index.js
CHANGED
@@ -1,7 +1,11 @@
|
|
1
1
|
"use strict";
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
3
|
if (k2 === undefined) k2 = k;
|
4
|
-
Object.
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
5
9
|
}) : (function(o, m, k, k2) {
|
6
10
|
if (k2 === undefined) k2 = k;
|
7
11
|
o[k2] = m[k];
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { Option } from "@sniptt/monads";
|
1
2
|
export declare const VERSION = "v3";
|
2
3
|
/**
|
3
4
|
* All of the websocket operations available.
|
@@ -25,60 +26,61 @@ export declare enum UserOperation {
|
|
25
26
|
RemovePost = 19,
|
26
27
|
LockPost = 20,
|
27
28
|
StickyPost = 21,
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
29
|
+
MarkPostAsRead = 22,
|
30
|
+
SavePost = 23,
|
31
|
+
EditCommunity = 24,
|
32
|
+
DeleteCommunity = 25,
|
33
|
+
RemoveCommunity = 26,
|
34
|
+
FollowCommunity = 27,
|
35
|
+
GetPersonDetails = 28,
|
36
|
+
GetReplies = 29,
|
37
|
+
GetPersonMentions = 30,
|
38
|
+
MarkPersonMentionAsRead = 31,
|
39
|
+
GetModlog = 32,
|
40
|
+
BanFromCommunity = 33,
|
41
|
+
AddModToCommunity = 34,
|
42
|
+
CreateSite = 35,
|
43
|
+
EditSite = 36,
|
44
|
+
GetSite = 37,
|
45
|
+
AddAdmin = 38,
|
46
|
+
GetUnreadRegistrationApplicationCount = 39,
|
47
|
+
ListRegistrationApplications = 40,
|
48
|
+
ApproveRegistrationApplication = 41,
|
49
|
+
BanPerson = 42,
|
50
|
+
GetBannedPersons = 43,
|
51
|
+
Search = 44,
|
52
|
+
ResolveObject = 45,
|
53
|
+
MarkAllAsRead = 46,
|
54
|
+
SaveUserSettings = 47,
|
55
|
+
TransferCommunity = 48,
|
56
|
+
LeaveAdmin = 49,
|
57
|
+
DeleteAccount = 50,
|
58
|
+
PasswordReset = 51,
|
59
|
+
PasswordChange = 52,
|
60
|
+
CreatePrivateMessage = 53,
|
61
|
+
EditPrivateMessage = 54,
|
62
|
+
DeletePrivateMessage = 55,
|
63
|
+
MarkPrivateMessageAsRead = 56,
|
64
|
+
GetPrivateMessages = 57,
|
65
|
+
UserJoin = 58,
|
66
|
+
GetComments = 59,
|
67
|
+
GetSiteConfig = 60,
|
68
|
+
SaveSiteConfig = 61,
|
69
|
+
PostJoin = 62,
|
70
|
+
CommunityJoin = 63,
|
71
|
+
ChangePassword = 64,
|
72
|
+
GetSiteMetadata = 65,
|
73
|
+
BlockCommunity = 66,
|
74
|
+
BlockPerson = 67,
|
75
|
+
CreateCommentReport = 68,
|
76
|
+
ResolveCommentReport = 69,
|
77
|
+
ListCommentReports = 70,
|
78
|
+
CreatePostReport = 71,
|
79
|
+
ResolvePostReport = 72,
|
80
|
+
ListPostReports = 73,
|
81
|
+
GetReportCount = 74,
|
82
|
+
GetUnreadCount = 75,
|
83
|
+
VerifyEmail = 76
|
82
84
|
}
|
83
85
|
/**
|
84
86
|
* Different sort types used in lemmy.
|
@@ -142,45 +144,13 @@ export declare enum SearchType {
|
|
142
144
|
Users = "Users",
|
143
145
|
Url = "Url"
|
144
146
|
}
|
145
|
-
/**
|
146
|
-
* A websocket response. Includes the return type.
|
147
|
-
* Can be used like:
|
148
|
-
*
|
149
|
-
* ```ts
|
150
|
-
* if (op == UserOperation.Search) {
|
151
|
-
* let data = wsJsonToRes<SearchResponse>(msg).data;
|
152
|
-
* }
|
153
|
-
* ```
|
154
|
-
*/
|
155
|
-
export interface WebSocketResponse<ResponseType> {
|
156
|
-
op: UserOperation;
|
157
|
-
/**
|
158
|
-
* This contains the data for a websocket response.
|
159
|
-
*
|
160
|
-
* The correct response type if given is in [[LemmyHttp]].
|
161
|
-
*/
|
162
|
-
data: ResponseType;
|
163
|
-
}
|
164
|
-
/**
|
165
|
-
* A websocket JSON response that includes the errors.
|
166
|
-
*/
|
167
|
-
export interface WebSocketJsonResponse<ResponseType> {
|
168
|
-
op?: string;
|
169
|
-
/**
|
170
|
-
* This contains the data for a websocket response.
|
171
|
-
*
|
172
|
-
* The correct response type if given is in [[LemmyHttp]].
|
173
|
-
*/
|
174
|
-
data?: ResponseType;
|
175
|
-
error?: string;
|
176
|
-
reconnect?: boolean;
|
177
|
-
}
|
178
147
|
/**
|
179
148
|
* A holder for a site's metadata ( such as opengraph tags ), used for post links.
|
180
149
|
*/
|
181
|
-
export
|
182
|
-
title
|
183
|
-
description
|
184
|
-
image
|
185
|
-
html
|
150
|
+
export declare class SiteMetadata {
|
151
|
+
title: Option<string>;
|
152
|
+
description: Option<string>;
|
153
|
+
image: Option<string>;
|
154
|
+
html: Option<string>;
|
155
|
+
constructor(init: SiteMetadata);
|
186
156
|
}
|
@@ -1,6 +1,15 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
+
};
|
2
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.SearchType = exports.ListingType = exports.SortType = exports.UserOperation = exports.VERSION = void 0;
|
9
|
+
exports.SiteMetadata = exports.SearchType = exports.ListingType = exports.SortType = exports.UserOperation = exports.VERSION = void 0;
|
10
|
+
var monads_1 = require("@sniptt/monads");
|
11
|
+
var class_transformer_1 = require("class-transformer");
|
12
|
+
var utils_1 = require("../utils");
|
4
13
|
exports.VERSION = "v3";
|
5
14
|
/**
|
6
15
|
* All of the websocket operations available.
|
@@ -29,60 +38,61 @@ var UserOperation;
|
|
29
38
|
UserOperation[UserOperation["RemovePost"] = 19] = "RemovePost";
|
30
39
|
UserOperation[UserOperation["LockPost"] = 20] = "LockPost";
|
31
40
|
UserOperation[UserOperation["StickyPost"] = 21] = "StickyPost";
|
32
|
-
UserOperation[UserOperation["
|
33
|
-
UserOperation[UserOperation["
|
34
|
-
UserOperation[UserOperation["
|
35
|
-
UserOperation[UserOperation["
|
36
|
-
UserOperation[UserOperation["
|
37
|
-
UserOperation[UserOperation["
|
38
|
-
UserOperation[UserOperation["
|
39
|
-
UserOperation[UserOperation["
|
40
|
-
UserOperation[UserOperation["
|
41
|
-
UserOperation[UserOperation["
|
42
|
-
UserOperation[UserOperation["
|
43
|
-
UserOperation[UserOperation["
|
44
|
-
UserOperation[UserOperation["
|
45
|
-
UserOperation[UserOperation["
|
46
|
-
UserOperation[UserOperation["
|
47
|
-
UserOperation[UserOperation["
|
48
|
-
UserOperation[UserOperation["
|
49
|
-
UserOperation[UserOperation["
|
50
|
-
UserOperation[UserOperation["
|
51
|
-
UserOperation[UserOperation["
|
52
|
-
UserOperation[UserOperation["
|
53
|
-
UserOperation[UserOperation["
|
54
|
-
UserOperation[UserOperation["
|
55
|
-
UserOperation[UserOperation["
|
56
|
-
UserOperation[UserOperation["
|
57
|
-
UserOperation[UserOperation["
|
58
|
-
UserOperation[UserOperation["
|
59
|
-
UserOperation[UserOperation["
|
60
|
-
UserOperation[UserOperation["
|
61
|
-
UserOperation[UserOperation["
|
62
|
-
UserOperation[UserOperation["
|
63
|
-
UserOperation[UserOperation["
|
64
|
-
UserOperation[UserOperation["
|
65
|
-
UserOperation[UserOperation["
|
66
|
-
UserOperation[UserOperation["
|
67
|
-
UserOperation[UserOperation["
|
68
|
-
UserOperation[UserOperation["
|
69
|
-
UserOperation[UserOperation["
|
70
|
-
UserOperation[UserOperation["
|
71
|
-
UserOperation[UserOperation["
|
72
|
-
UserOperation[UserOperation["
|
73
|
-
UserOperation[UserOperation["
|
74
|
-
UserOperation[UserOperation["
|
75
|
-
UserOperation[UserOperation["
|
76
|
-
UserOperation[UserOperation["
|
77
|
-
UserOperation[UserOperation["
|
78
|
-
UserOperation[UserOperation["
|
79
|
-
UserOperation[UserOperation["
|
80
|
-
UserOperation[UserOperation["
|
81
|
-
UserOperation[UserOperation["
|
82
|
-
UserOperation[UserOperation["
|
83
|
-
UserOperation[UserOperation["
|
84
|
-
UserOperation[UserOperation["
|
85
|
-
UserOperation[UserOperation["
|
41
|
+
UserOperation[UserOperation["MarkPostAsRead"] = 22] = "MarkPostAsRead";
|
42
|
+
UserOperation[UserOperation["SavePost"] = 23] = "SavePost";
|
43
|
+
UserOperation[UserOperation["EditCommunity"] = 24] = "EditCommunity";
|
44
|
+
UserOperation[UserOperation["DeleteCommunity"] = 25] = "DeleteCommunity";
|
45
|
+
UserOperation[UserOperation["RemoveCommunity"] = 26] = "RemoveCommunity";
|
46
|
+
UserOperation[UserOperation["FollowCommunity"] = 27] = "FollowCommunity";
|
47
|
+
UserOperation[UserOperation["GetPersonDetails"] = 28] = "GetPersonDetails";
|
48
|
+
UserOperation[UserOperation["GetReplies"] = 29] = "GetReplies";
|
49
|
+
UserOperation[UserOperation["GetPersonMentions"] = 30] = "GetPersonMentions";
|
50
|
+
UserOperation[UserOperation["MarkPersonMentionAsRead"] = 31] = "MarkPersonMentionAsRead";
|
51
|
+
UserOperation[UserOperation["GetModlog"] = 32] = "GetModlog";
|
52
|
+
UserOperation[UserOperation["BanFromCommunity"] = 33] = "BanFromCommunity";
|
53
|
+
UserOperation[UserOperation["AddModToCommunity"] = 34] = "AddModToCommunity";
|
54
|
+
UserOperation[UserOperation["CreateSite"] = 35] = "CreateSite";
|
55
|
+
UserOperation[UserOperation["EditSite"] = 36] = "EditSite";
|
56
|
+
UserOperation[UserOperation["GetSite"] = 37] = "GetSite";
|
57
|
+
UserOperation[UserOperation["AddAdmin"] = 38] = "AddAdmin";
|
58
|
+
UserOperation[UserOperation["GetUnreadRegistrationApplicationCount"] = 39] = "GetUnreadRegistrationApplicationCount";
|
59
|
+
UserOperation[UserOperation["ListRegistrationApplications"] = 40] = "ListRegistrationApplications";
|
60
|
+
UserOperation[UserOperation["ApproveRegistrationApplication"] = 41] = "ApproveRegistrationApplication";
|
61
|
+
UserOperation[UserOperation["BanPerson"] = 42] = "BanPerson";
|
62
|
+
UserOperation[UserOperation["GetBannedPersons"] = 43] = "GetBannedPersons";
|
63
|
+
UserOperation[UserOperation["Search"] = 44] = "Search";
|
64
|
+
UserOperation[UserOperation["ResolveObject"] = 45] = "ResolveObject";
|
65
|
+
UserOperation[UserOperation["MarkAllAsRead"] = 46] = "MarkAllAsRead";
|
66
|
+
UserOperation[UserOperation["SaveUserSettings"] = 47] = "SaveUserSettings";
|
67
|
+
UserOperation[UserOperation["TransferCommunity"] = 48] = "TransferCommunity";
|
68
|
+
UserOperation[UserOperation["LeaveAdmin"] = 49] = "LeaveAdmin";
|
69
|
+
UserOperation[UserOperation["DeleteAccount"] = 50] = "DeleteAccount";
|
70
|
+
UserOperation[UserOperation["PasswordReset"] = 51] = "PasswordReset";
|
71
|
+
UserOperation[UserOperation["PasswordChange"] = 52] = "PasswordChange";
|
72
|
+
UserOperation[UserOperation["CreatePrivateMessage"] = 53] = "CreatePrivateMessage";
|
73
|
+
UserOperation[UserOperation["EditPrivateMessage"] = 54] = "EditPrivateMessage";
|
74
|
+
UserOperation[UserOperation["DeletePrivateMessage"] = 55] = "DeletePrivateMessage";
|
75
|
+
UserOperation[UserOperation["MarkPrivateMessageAsRead"] = 56] = "MarkPrivateMessageAsRead";
|
76
|
+
UserOperation[UserOperation["GetPrivateMessages"] = 57] = "GetPrivateMessages";
|
77
|
+
UserOperation[UserOperation["UserJoin"] = 58] = "UserJoin";
|
78
|
+
UserOperation[UserOperation["GetComments"] = 59] = "GetComments";
|
79
|
+
UserOperation[UserOperation["GetSiteConfig"] = 60] = "GetSiteConfig";
|
80
|
+
UserOperation[UserOperation["SaveSiteConfig"] = 61] = "SaveSiteConfig";
|
81
|
+
UserOperation[UserOperation["PostJoin"] = 62] = "PostJoin";
|
82
|
+
UserOperation[UserOperation["CommunityJoin"] = 63] = "CommunityJoin";
|
83
|
+
UserOperation[UserOperation["ChangePassword"] = 64] = "ChangePassword";
|
84
|
+
UserOperation[UserOperation["GetSiteMetadata"] = 65] = "GetSiteMetadata";
|
85
|
+
UserOperation[UserOperation["BlockCommunity"] = 66] = "BlockCommunity";
|
86
|
+
UserOperation[UserOperation["BlockPerson"] = 67] = "BlockPerson";
|
87
|
+
UserOperation[UserOperation["CreateCommentReport"] = 68] = "CreateCommentReport";
|
88
|
+
UserOperation[UserOperation["ResolveCommentReport"] = 69] = "ResolveCommentReport";
|
89
|
+
UserOperation[UserOperation["ListCommentReports"] = 70] = "ListCommentReports";
|
90
|
+
UserOperation[UserOperation["CreatePostReport"] = 71] = "CreatePostReport";
|
91
|
+
UserOperation[UserOperation["ResolvePostReport"] = 72] = "ResolvePostReport";
|
92
|
+
UserOperation[UserOperation["ListPostReports"] = 73] = "ListPostReports";
|
93
|
+
UserOperation[UserOperation["GetReportCount"] = 74] = "GetReportCount";
|
94
|
+
UserOperation[UserOperation["GetUnreadCount"] = 75] = "GetUnreadCount";
|
95
|
+
UserOperation[UserOperation["VerifyEmail"] = 76] = "VerifyEmail";
|
86
96
|
})(UserOperation = exports.UserOperation || (exports.UserOperation = {}));
|
87
97
|
/**
|
88
98
|
* Different sort types used in lemmy.
|
@@ -149,3 +159,57 @@ var SearchType;
|
|
149
159
|
SearchType["Users"] = "Users";
|
150
160
|
SearchType["Url"] = "Url";
|
151
161
|
})(SearchType = exports.SearchType || (exports.SearchType = {}));
|
162
|
+
/**
|
163
|
+
* A holder for a site's metadata ( such as opengraph tags ), used for post links.
|
164
|
+
*/
|
165
|
+
var SiteMetadata = /** @class */ (function () {
|
166
|
+
function SiteMetadata(init) {
|
167
|
+
Object.assign(this, init);
|
168
|
+
}
|
169
|
+
__decorate([
|
170
|
+
(0, class_transformer_1.Transform)(function (_a) {
|
171
|
+
var value = _a.value;
|
172
|
+
return (0, monads_1.Some)(value);
|
173
|
+
}, { toClassOnly: true }),
|
174
|
+
(0, class_transformer_1.Transform)(function (_a) {
|
175
|
+
var value = _a.value;
|
176
|
+
return (0, utils_1.toUndefined)(value);
|
177
|
+
}, { toPlainOnly: true }),
|
178
|
+
(0, class_transformer_1.Expose)()
|
179
|
+
], SiteMetadata.prototype, "title", void 0);
|
180
|
+
__decorate([
|
181
|
+
(0, class_transformer_1.Transform)(function (_a) {
|
182
|
+
var value = _a.value;
|
183
|
+
return (0, monads_1.Some)(value);
|
184
|
+
}, { toClassOnly: true }),
|
185
|
+
(0, class_transformer_1.Transform)(function (_a) {
|
186
|
+
var value = _a.value;
|
187
|
+
return (0, utils_1.toUndefined)(value);
|
188
|
+
}, { toPlainOnly: true }),
|
189
|
+
(0, class_transformer_1.Expose)()
|
190
|
+
], SiteMetadata.prototype, "description", void 0);
|
191
|
+
__decorate([
|
192
|
+
(0, class_transformer_1.Transform)(function (_a) {
|
193
|
+
var value = _a.value;
|
194
|
+
return (0, monads_1.Some)(value);
|
195
|
+
}, { toClassOnly: true }),
|
196
|
+
(0, class_transformer_1.Transform)(function (_a) {
|
197
|
+
var value = _a.value;
|
198
|
+
return (0, utils_1.toUndefined)(value);
|
199
|
+
}, { toPlainOnly: true }),
|
200
|
+
(0, class_transformer_1.Expose)()
|
201
|
+
], SiteMetadata.prototype, "image", void 0);
|
202
|
+
__decorate([
|
203
|
+
(0, class_transformer_1.Transform)(function (_a) {
|
204
|
+
var value = _a.value;
|
205
|
+
return (0, monads_1.Some)(value);
|
206
|
+
}, { toClassOnly: true }),
|
207
|
+
(0, class_transformer_1.Transform)(function (_a) {
|
208
|
+
var value = _a.value;
|
209
|
+
return (0, utils_1.toUndefined)(value);
|
210
|
+
}, { toPlainOnly: true }),
|
211
|
+
(0, class_transformer_1.Expose)()
|
212
|
+
], SiteMetadata.prototype, "html", void 0);
|
213
|
+
return SiteMetadata;
|
214
|
+
}());
|
215
|
+
exports.SiteMetadata = SiteMetadata;
|