lemmy-js-client 0.17.0-rc.13 → 0.17.0-rc.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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.
@@ -143,45 +144,12 @@ export declare enum SearchType {
143
144
  Users = "Users",
144
145
  Url = "Url"
145
146
  }
146
- /**
147
- * A websocket response. Includes the return type.
148
- * Can be used like:
149
- *
150
- * ```ts
151
- * if (op == UserOperation.Search) {
152
- * let data = wsJsonToRes<SearchResponse>(msg).data;
153
- * }
154
- * ```
155
- */
156
- export interface WebSocketResponse<ResponseType> {
157
- op: UserOperation;
158
- /**
159
- * This contains the data for a websocket response.
160
- *
161
- * The correct response type if given is in [[LemmyHttp]].
162
- */
163
- data: ResponseType;
164
- }
165
- /**
166
- * A websocket JSON response that includes the errors.
167
- */
168
- export interface WebSocketJsonResponse<ResponseType> {
169
- op?: string;
170
- /**
171
- * This contains the data for a websocket response.
172
- *
173
- * The correct response type if given is in [[LemmyHttp]].
174
- */
175
- data?: ResponseType;
176
- error?: string;
177
- reconnect?: boolean;
178
- }
179
147
  /**
180
148
  * A holder for a site's metadata ( such as opengraph tags ), used for post links.
181
149
  */
182
- export interface SiteMetadata {
183
- title?: string;
184
- description?: string;
185
- image?: string;
186
- html?: string;
150
+ export declare class SiteMetadata {
151
+ title: Option<string>;
152
+ description: Option<string>;
153
+ image: Option<string>;
154
+ html: Option<string>;
187
155
  }
@@ -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.
@@ -150,3 +159,56 @@ var SearchType;
150
159
  SearchType["Users"] = "Users";
151
160
  SearchType["Url"] = "Url";
152
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() {
167
+ }
168
+ __decorate([
169
+ (0, class_transformer_1.Transform)(function (_a) {
170
+ var value = _a.value;
171
+ return (0, monads_1.Some)(value);
172
+ }, { toClassOnly: true }),
173
+ (0, class_transformer_1.Transform)(function (_a) {
174
+ var value = _a.value;
175
+ return (0, utils_1.toUndefined)(value);
176
+ }, { toPlainOnly: true }),
177
+ (0, class_transformer_1.Expose)()
178
+ ], SiteMetadata.prototype, "title", void 0);
179
+ __decorate([
180
+ (0, class_transformer_1.Transform)(function (_a) {
181
+ var value = _a.value;
182
+ return (0, monads_1.Some)(value);
183
+ }, { toClassOnly: true }),
184
+ (0, class_transformer_1.Transform)(function (_a) {
185
+ var value = _a.value;
186
+ return (0, utils_1.toUndefined)(value);
187
+ }, { toPlainOnly: true }),
188
+ (0, class_transformer_1.Expose)()
189
+ ], SiteMetadata.prototype, "description", void 0);
190
+ __decorate([
191
+ (0, class_transformer_1.Transform)(function (_a) {
192
+ var value = _a.value;
193
+ return (0, monads_1.Some)(value);
194
+ }, { toClassOnly: true }),
195
+ (0, class_transformer_1.Transform)(function (_a) {
196
+ var value = _a.value;
197
+ return (0, utils_1.toUndefined)(value);
198
+ }, { toPlainOnly: true }),
199
+ (0, class_transformer_1.Expose)()
200
+ ], SiteMetadata.prototype, "image", void 0);
201
+ __decorate([
202
+ (0, class_transformer_1.Transform)(function (_a) {
203
+ var value = _a.value;
204
+ return (0, monads_1.Some)(value);
205
+ }, { toClassOnly: true }),
206
+ (0, class_transformer_1.Transform)(function (_a) {
207
+ var value = _a.value;
208
+ return (0, utils_1.toUndefined)(value);
209
+ }, { toPlainOnly: true }),
210
+ (0, class_transformer_1.Expose)()
211
+ ], SiteMetadata.prototype, "html", void 0);
212
+ return SiteMetadata;
213
+ }());
214
+ exports.SiteMetadata = SiteMetadata;
@@ -1,8 +1,8 @@
1
- import { Option } from "@swan-io/boxed";
2
- export interface LocalUserSettings {
1
+ import { Option } from "@sniptt/monads";
2
+ export declare class LocalUserSettings {
3
3
  id: number;
4
4
  person_id: number;
5
- email?: string;
5
+ email: Option<string>;
6
6
  show_nsfw: boolean;
7
7
  theme: string;
8
8
  default_sort_type: number;
@@ -17,42 +17,42 @@ export interface LocalUserSettings {
17
17
  email_verified: boolean;
18
18
  accepted_application: boolean;
19
19
  }
20
- export interface PersonSafe {
20
+ export declare class PersonSafe {
21
21
  id: number;
22
22
  name: string;
23
- display_name?: string;
24
- avatar?: string;
23
+ display_name: Option<string>;
24
+ avatar: Option<string>;
25
25
  banned: boolean;
26
26
  published: string;
27
- updated?: string;
27
+ updated: Option<string>;
28
28
  actor_id: string;
29
- bio?: string;
29
+ bio: Option<string>;
30
30
  local: boolean;
31
- banner?: string;
31
+ banner: Option<string>;
32
32
  deleted: boolean;
33
33
  inbox_url: string;
34
34
  shared_inbox_url: string;
35
- matrix_user_id?: string;
35
+ matrix_user_id: Option<string>;
36
36
  admin: boolean;
37
37
  bot_account: boolean;
38
- ban_expires?: string;
38
+ ban_expires: Option<string>;
39
39
  }
40
- export interface Site {
40
+ export declare class Site {
41
41
  id: number;
42
42
  name: string;
43
43
  sidebar: Option<string>;
44
44
  published: string;
45
- updated?: string;
45
+ updated: Option<string>;
46
46
  enable_downvotes: boolean;
47
47
  open_registration: boolean;
48
48
  enable_nsfw: boolean;
49
- icon?: string;
50
- banner?: string;
51
- description?: string;
49
+ icon: Option<string>;
50
+ banner: Option<string>;
51
+ description: Option<string>;
52
52
  community_creation_admin_only: boolean;
53
53
  require_email_verification: boolean;
54
54
  require_application: boolean;
55
- application_question?: string;
55
+ application_question: Option<string>;
56
56
  private_instance: boolean;
57
57
  default_theme: string;
58
58
  default_post_listing_type: string;
@@ -60,9 +60,9 @@ export interface Site {
60
60
  last_refreshed_at: string;
61
61
  inbox_url: string;
62
62
  public_key: string;
63
- legal_information?: string;
63
+ legal_information: Option<string>;
64
64
  }
65
- export interface PrivateMessage {
65
+ export declare class PrivateMessage {
66
66
  id: number;
67
67
  creator_id: number;
68
68
  recipient_id: number;
@@ -70,184 +70,184 @@ export interface PrivateMessage {
70
70
  deleted: boolean;
71
71
  read: boolean;
72
72
  published: string;
73
- updated?: string;
73
+ updated: Option<string>;
74
74
  ap_id: string;
75
75
  local: boolean;
76
76
  }
77
- export interface PostReport {
77
+ export declare class PostReport {
78
78
  id: number;
79
79
  creator_id: number;
80
80
  post_id: number;
81
81
  original_post_name: string;
82
- original_post_url?: string;
83
- original_post_body?: string;
82
+ original_post_url: Option<string>;
83
+ original_post_body: Option<string>;
84
84
  reason: string;
85
85
  resolved: boolean;
86
- resolver_id?: number;
86
+ resolver_id: Option<number>;
87
87
  published: string;
88
- updated?: string;
88
+ updated: Option<string>;
89
89
  }
90
- export interface Post {
90
+ export declare class Post {
91
91
  id: number;
92
92
  name: string;
93
- url?: string;
94
- body?: string;
93
+ url: Option<string>;
94
+ body: Option<string>;
95
95
  creator_id: number;
96
96
  community_id: number;
97
97
  removed: boolean;
98
98
  locked: boolean;
99
99
  published: string;
100
- updated?: string;
100
+ updated: Option<string>;
101
101
  deleted: boolean;
102
102
  nsfw: boolean;
103
103
  stickied: boolean;
104
- embed_title?: string;
105
- embed_description?: string;
106
- embed_html?: string;
107
- thumbnail_url?: string;
104
+ embed_title: Option<string>;
105
+ embed_description: Option<string>;
106
+ embed_html: Option<string>;
107
+ thumbnail_url: Option<string>;
108
108
  ap_id: string;
109
109
  local: boolean;
110
110
  }
111
- export interface PasswordResetRequest {
111
+ export declare class PasswordResetRequest {
112
112
  id: number;
113
113
  local_user_id: number;
114
114
  token_encrypted: string;
115
115
  published: string;
116
116
  }
117
- export interface ModRemovePost {
117
+ export declare class ModRemovePost {
118
118
  id: number;
119
119
  mod_person_id: number;
120
120
  post_id: number;
121
- reason?: string;
122
- removed?: boolean;
121
+ reason: Option<string>;
122
+ removed: Option<boolean>;
123
123
  when_: string;
124
124
  }
125
- export interface ModLockPost {
125
+ export declare class ModLockPost {
126
126
  id: number;
127
127
  mod_person_id: number;
128
128
  post_id: number;
129
- locked?: boolean;
129
+ locked: Option<boolean>;
130
130
  when_: string;
131
131
  }
132
- export interface ModStickyPost {
132
+ export declare class ModStickyPost {
133
133
  id: number;
134
134
  mod_person_id: number;
135
135
  post_id: number;
136
- stickied?: boolean;
136
+ stickied: Option<boolean>;
137
137
  when_: string;
138
138
  }
139
- export interface ModRemoveComment {
139
+ export declare class ModRemoveComment {
140
140
  id: number;
141
141
  mod_person_id: number;
142
142
  comment_id: number;
143
- reason?: string;
144
- removed?: boolean;
143
+ reason: Option<string>;
144
+ removed: Option<boolean>;
145
145
  when_: string;
146
146
  }
147
- export interface ModRemoveCommunity {
147
+ export declare class ModRemoveCommunity {
148
148
  id: number;
149
149
  mod_person_id: number;
150
150
  community_id: number;
151
- reason?: string;
152
- removed?: boolean;
153
- expires?: string;
151
+ reason: Option<string>;
152
+ removed: Option<boolean>;
153
+ expires: Option<string>;
154
154
  when_: string;
155
155
  }
156
- export interface ModBanFromCommunity {
156
+ export declare class ModBanFromCommunity {
157
157
  id: number;
158
158
  mod_person_id: number;
159
159
  other_person_id: number;
160
160
  community_id: number;
161
- reason?: string;
162
- banned?: boolean;
163
- expires?: string;
161
+ reason: Option<string>;
162
+ banned: Option<boolean>;
163
+ expires: Option<string>;
164
164
  when_: string;
165
165
  }
166
- export interface ModBan {
166
+ export declare class ModBan {
167
167
  id: number;
168
168
  mod_person_id: number;
169
169
  other_person_id: number;
170
- reason?: string;
171
- banned?: boolean;
172
- expires?: string;
170
+ reason: Option<string>;
171
+ banned: Option<boolean>;
172
+ expires: Option<string>;
173
173
  when_: string;
174
174
  }
175
- export interface ModAddCommunity {
175
+ export declare class ModAddCommunity {
176
176
  id: number;
177
177
  mod_person_id: number;
178
178
  other_person_id: number;
179
179
  community_id: number;
180
- removed?: boolean;
180
+ removed: Option<boolean>;
181
181
  when_: string;
182
182
  }
183
- export interface ModTransferCommunity {
183
+ export declare class ModTransferCommunity {
184
184
  id: number;
185
185
  mod_person_id: number;
186
186
  other_person_id: number;
187
187
  community_id: number;
188
- removed?: boolean;
188
+ removed: Option<boolean>;
189
189
  when_: string;
190
190
  }
191
- export interface ModAdd {
191
+ export declare class ModAdd {
192
192
  id: number;
193
193
  mod_person_id: number;
194
194
  other_person_id: number;
195
- removed?: boolean;
195
+ removed: Option<boolean>;
196
196
  when_: string;
197
197
  }
198
- export interface CommunitySafe {
198
+ export declare class CommunitySafe {
199
199
  id: number;
200
200
  name: string;
201
201
  title: string;
202
- description?: string;
202
+ description: Option<string>;
203
203
  removed: boolean;
204
204
  published: string;
205
- updated?: string;
205
+ updated: Option<string>;
206
206
  deleted: boolean;
207
207
  nsfw: boolean;
208
208
  actor_id: string;
209
209
  local: boolean;
210
- icon?: string;
211
- banner?: string;
210
+ icon: Option<string>;
211
+ banner: Option<string>;
212
212
  posting_restricted_to_mods: boolean;
213
213
  }
214
- export interface CommentReport {
214
+ export declare class CommentReport {
215
215
  id: number;
216
216
  creator_id: number;
217
217
  comment_id: number;
218
218
  original_comment_text: string;
219
219
  reason: string;
220
220
  resolved: boolean;
221
- resolver_id?: number;
221
+ resolver_id: Option<number>;
222
222
  published: string;
223
- updated?: string;
223
+ updated: Option<string>;
224
224
  }
225
- export interface Comment {
225
+ export declare class Comment {
226
226
  id: number;
227
227
  creator_id: number;
228
228
  post_id: number;
229
- parent_id?: number;
229
+ parent_id: Option<number>;
230
230
  content: string;
231
231
  removed: boolean;
232
232
  read: boolean;
233
233
  published: string;
234
- updated?: string;
234
+ updated: Option<string>;
235
235
  deleted: boolean;
236
236
  ap_id: string;
237
237
  local: boolean;
238
238
  }
239
- export interface PersonMention {
239
+ export declare class PersonMention {
240
240
  id: number;
241
241
  recipient_id: number;
242
242
  comment_id: number;
243
243
  read: boolean;
244
244
  published: string;
245
245
  }
246
- export interface RegistrationApplication {
246
+ export declare class RegistrationApplication {
247
247
  id: number;
248
248
  local_user_id: number;
249
249
  answer: string;
250
- admin_id?: number;
251
- deny_reason?: string;
250
+ admin_id: Option<number>;
251
+ deny_reason: Option<string>;
252
252
  published: string;
253
253
  }