@stream-io/feeds-client 0.3.48 → 0.3.49
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.
- package/CHANGELOG.md +13 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/react-bindings.js +1 -1
- package/dist/es/index.mjs +2 -2
- package/dist/es/index.mjs.map +1 -1
- package/dist/es/react-bindings.mjs +1 -1
- package/dist/{feeds-client-D-EFo20w.mjs → feeds-client-B9b7zUcW.mjs} +102 -189
- package/dist/feeds-client-B9b7zUcW.mjs.map +1 -0
- package/dist/{feeds-client-DuJuJuEJ.js → feeds-client-BDvUG9yF.js} +102 -189
- package/dist/feeds-client-BDvUG9yF.js.map +1 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/types/common/Poll.d.ts +7 -3
- package/dist/types/common/Poll.d.ts.map +1 -1
- package/dist/types/common/real-time/StableWSConnection.d.ts +3 -3
- package/dist/types/common/real-time/StableWSConnection.d.ts.map +1 -1
- package/dist/types/feed/event-handlers/activity-updater.d.ts +1 -1
- package/dist/types/feed/event-handlers/comment/handle-comment-added.d.ts.map +1 -1
- package/dist/types/feed/feed.d.ts +2 -2
- package/dist/types/feed/feed.d.ts.map +1 -1
- package/dist/types/feeds-client/feeds-client.d.ts +7 -3
- package/dist/types/feeds-client/feeds-client.d.ts.map +1 -1
- package/dist/types/gen/feeds/FeedsApi.d.ts.map +1 -1
- package/dist/types/gen/model-decoders/event-decoder-mapping.d.ts.map +1 -1
- package/dist/types/gen/models/index.d.ts +196 -422
- package/dist/types/gen/models/index.d.ts.map +1 -1
- package/dist/types/gen/moderation/ModerationApi.d.ts.map +1 -1
- package/dist/types/types.d.ts +2 -2
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils/constants.d.ts +1 -1
- package/package.json +1 -1
- package/src/common/Poll.ts +16 -15
- package/src/feed/event-handlers/comment/handle-comment-added.ts +14 -2
- package/src/feed/feed.ts +24 -9
- package/src/feeds-client/feeds-client.ts +28 -1
- package/src/gen/feeds/FeedsApi.ts +1 -0
- package/src/gen/model-decoders/decoders.ts +40 -251
- package/src/gen/model-decoders/event-decoder-mapping.ts +3 -2
- package/src/gen/models/index.ts +310 -741
- package/src/gen/moderation/ModerationApi.ts +1 -0
- package/src/test-utils/response-generators.ts +3 -2
- package/src/types.ts +2 -2
- package/src/utils/constants.ts +1 -1
- package/dist/feeds-client-D-EFo20w.mjs.map +0 -1
- package/dist/feeds-client-DuJuJuEJ.js.map +0 -1
|
@@ -36,11 +36,23 @@ export function handleCommentAdded(
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
const newComments = entityState?.comments ? [...entityState.comments] : [];
|
|
39
|
+
const sort = entityState.pagination?.sort;
|
|
40
|
+
const hasMorePages = entityState.pagination?.next !== undefined;
|
|
41
|
+
const isFromCurrentUser = eventTriggeredByConnectedUser.call(this, payload);
|
|
39
42
|
|
|
40
|
-
if (
|
|
43
|
+
if (sort === 'last') {
|
|
41
44
|
newComments.unshift(comment);
|
|
45
|
+
} else if (sort === 'first') {
|
|
46
|
+
if (isFromCurrentUser) {
|
|
47
|
+
newComments.push(comment);
|
|
48
|
+
} else {
|
|
49
|
+
if (!hasMorePages) {
|
|
50
|
+
newComments.push(comment);
|
|
51
|
+
} else {
|
|
52
|
+
return currentState;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
42
55
|
} else {
|
|
43
|
-
// 'first' and other sort options
|
|
44
56
|
newComments.push(comment);
|
|
45
57
|
}
|
|
46
58
|
|
package/src/feed/feed.ts
CHANGED
|
@@ -216,11 +216,11 @@ export class Feed extends FeedApi {
|
|
|
216
216
|
'app.updated': Feed.noop,
|
|
217
217
|
'user.banned': Feed.noop,
|
|
218
218
|
'user.deactivated': Feed.noop,
|
|
219
|
-
'user.muted': Feed.noop,
|
|
220
219
|
'user.reactivated': Feed.noop,
|
|
221
220
|
'user.updated': Feed.noop,
|
|
222
221
|
'feeds.activity.feedback': handleActivityFeedback.bind(this),
|
|
223
222
|
'feeds.activity.restored': Feed.noop,
|
|
223
|
+
'user.unbanned': Feed.noop,
|
|
224
224
|
};
|
|
225
225
|
|
|
226
226
|
protected eventDispatcher: EventDispatcher<WSEvent['type'], WSEvent> =
|
|
@@ -295,7 +295,9 @@ export class Feed extends FeedApi {
|
|
|
295
295
|
const { last_get_or_create_request_config } = this.state.getLatestValue();
|
|
296
296
|
if (last_get_or_create_request_config?.watch) {
|
|
297
297
|
this.inProgressGetOrCreate = undefined;
|
|
298
|
-
await withRetry(() =>
|
|
298
|
+
await withRetry(() =>
|
|
299
|
+
this.getOrCreate(last_get_or_create_request_config),
|
|
300
|
+
);
|
|
299
301
|
}
|
|
300
302
|
}
|
|
301
303
|
|
|
@@ -509,6 +511,25 @@ export class Feed extends FeedApi {
|
|
|
509
511
|
);
|
|
510
512
|
|
|
511
513
|
const existingComments = newCommentsByEntityId[entityId]?.comments;
|
|
514
|
+
let comments: CommentResponse[] = existingComments
|
|
515
|
+
? uniqueArrayMerge(
|
|
516
|
+
existingComments,
|
|
517
|
+
newComments,
|
|
518
|
+
(comment) => comment.id,
|
|
519
|
+
)
|
|
520
|
+
: newComments;
|
|
521
|
+
// Only sort when merging pages (existing + new); initial load order comes from API
|
|
522
|
+
if (
|
|
523
|
+
data.sort === 'first' &&
|
|
524
|
+
existingComments &&
|
|
525
|
+
existingComments.length > 0
|
|
526
|
+
) {
|
|
527
|
+
comments = [...comments].sort(
|
|
528
|
+
(a, b) =>
|
|
529
|
+
new Date(a.created_at).getTime() -
|
|
530
|
+
new Date(b.created_at).getTime(),
|
|
531
|
+
);
|
|
532
|
+
}
|
|
512
533
|
|
|
513
534
|
newCommentsByEntityId[entityId] = {
|
|
514
535
|
...newCommentsByEntityId[entityId],
|
|
@@ -518,13 +539,7 @@ export class Feed extends FeedApi {
|
|
|
518
539
|
next: item.next,
|
|
519
540
|
sort: data.sort,
|
|
520
541
|
},
|
|
521
|
-
comments
|
|
522
|
-
? uniqueArrayMerge(
|
|
523
|
-
existingComments,
|
|
524
|
-
newComments,
|
|
525
|
-
(comment) => comment.id,
|
|
526
|
-
)
|
|
527
|
-
: newComments,
|
|
542
|
+
comments,
|
|
528
543
|
};
|
|
529
544
|
}
|
|
530
545
|
|
|
@@ -33,6 +33,8 @@ import type {
|
|
|
33
33
|
UpdateCommentRequest,
|
|
34
34
|
UpdateCommentResponse,
|
|
35
35
|
UpdateFollowRequest,
|
|
36
|
+
UpdatePollPartialRequest,
|
|
37
|
+
UpdatePollRequest,
|
|
36
38
|
UserRequest,
|
|
37
39
|
WSEvent,
|
|
38
40
|
} from '../gen/models';
|
|
@@ -452,15 +454,40 @@ export class FeedsClient extends FeedsApi {
|
|
|
452
454
|
return streamDevToken(userId);
|
|
453
455
|
};
|
|
454
456
|
|
|
457
|
+
updatePoll = async (request: UpdatePollRequest) => {
|
|
458
|
+
const poll = this.pollFromState(request.id);
|
|
459
|
+
const response = await super.updatePoll(request);
|
|
460
|
+
if (response.poll && poll) {
|
|
461
|
+
poll.handlePollUpdated({ poll: response.poll, created_at: new Date() });
|
|
462
|
+
}
|
|
463
|
+
return response;
|
|
464
|
+
};
|
|
465
|
+
|
|
466
|
+
updatePollPartial = async (
|
|
467
|
+
request: UpdatePollPartialRequest & { poll_id: string },
|
|
468
|
+
) => {
|
|
469
|
+
const poll = this.pollFromState(request.poll_id);
|
|
470
|
+
const response = await super.updatePollPartial(request);
|
|
471
|
+
if (response.poll && poll) {
|
|
472
|
+
poll.handlePollUpdated({ poll: response.poll, created_at: new Date() });
|
|
473
|
+
}
|
|
474
|
+
return response;
|
|
475
|
+
};
|
|
476
|
+
|
|
455
477
|
closePoll = async (request: {
|
|
456
478
|
poll_id: string;
|
|
457
479
|
}): Promise<StreamResponse<PollResponse>> => {
|
|
458
|
-
|
|
480
|
+
const poll = this.pollFromState(request.poll_id);
|
|
481
|
+
const response = await super.updatePollPartial({
|
|
459
482
|
poll_id: request.poll_id,
|
|
460
483
|
set: {
|
|
461
484
|
is_closed: true,
|
|
462
485
|
},
|
|
463
486
|
});
|
|
487
|
+
if (response.poll && poll) {
|
|
488
|
+
poll.handlePollClosed({ poll: response.poll, created_at: new Date() });
|
|
489
|
+
}
|
|
490
|
+
return response;
|
|
464
491
|
};
|
|
465
492
|
|
|
466
493
|
castPollVote = async (
|
|
@@ -193,7 +193,7 @@ decoders.ActivityResponse = (input?: Record<string, any>) => {
|
|
|
193
193
|
|
|
194
194
|
collections: { type: 'EnrichedCollectionResponse', isSingle: false },
|
|
195
195
|
|
|
196
|
-
reaction_groups: { type: '
|
|
196
|
+
reaction_groups: { type: 'FeedsReactionGroupResponse', isSingle: false },
|
|
197
197
|
|
|
198
198
|
user: { type: 'UserResponse', isSingle: true },
|
|
199
199
|
|
|
@@ -324,17 +324,15 @@ decoders.AppealItemResponse = (input?: Record<string, any>) => {
|
|
|
324
324
|
return decode(typeMappings, input);
|
|
325
325
|
};
|
|
326
326
|
|
|
327
|
-
decoders.
|
|
327
|
+
decoders.BanInfoResponse = (input?: Record<string, any>) => {
|
|
328
328
|
const typeMappings: TypeMapping = {
|
|
329
329
|
created_at: { type: 'DatetimeType', isSingle: true },
|
|
330
330
|
|
|
331
331
|
expires: { type: 'DatetimeType', isSingle: true },
|
|
332
332
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
created_by: { type: 'User', isSingle: true },
|
|
333
|
+
created_by: { type: 'UserResponse', isSingle: true },
|
|
336
334
|
|
|
337
|
-
|
|
335
|
+
user: { type: 'UserResponse', isSingle: true },
|
|
338
336
|
};
|
|
339
337
|
return decode(typeMappings, input);
|
|
340
338
|
};
|
|
@@ -496,44 +494,6 @@ decoders.CallSessionResponse = (input?: Record<string, any>) => {
|
|
|
496
494
|
return decode(typeMappings, input);
|
|
497
495
|
};
|
|
498
496
|
|
|
499
|
-
decoders.Channel = (input?: Record<string, any>) => {
|
|
500
|
-
const typeMappings: TypeMapping = {
|
|
501
|
-
created_at: { type: 'DatetimeType', isSingle: true },
|
|
502
|
-
|
|
503
|
-
updated_at: { type: 'DatetimeType', isSingle: true },
|
|
504
|
-
|
|
505
|
-
deleted_at: { type: 'DatetimeType', isSingle: true },
|
|
506
|
-
|
|
507
|
-
last_message_at: { type: 'DatetimeType', isSingle: true },
|
|
508
|
-
|
|
509
|
-
message_count_updated_at: { type: 'DatetimeType', isSingle: true },
|
|
510
|
-
|
|
511
|
-
active_live_locations: { type: 'SharedLocation', isSingle: false },
|
|
512
|
-
|
|
513
|
-
invites: { type: 'ChannelMember', isSingle: false },
|
|
514
|
-
|
|
515
|
-
members: { type: 'ChannelMember', isSingle: false },
|
|
516
|
-
|
|
517
|
-
config: { type: 'ChannelConfig', isSingle: true },
|
|
518
|
-
|
|
519
|
-
created_by: { type: 'User', isSingle: true },
|
|
520
|
-
|
|
521
|
-
members_lookup: { type: 'ChannelMemberLookup', isSingle: false },
|
|
522
|
-
|
|
523
|
-
truncated_by: { type: 'User', isSingle: true },
|
|
524
|
-
};
|
|
525
|
-
return decode(typeMappings, input);
|
|
526
|
-
};
|
|
527
|
-
|
|
528
|
-
decoders.ChannelConfig = (input?: Record<string, any>) => {
|
|
529
|
-
const typeMappings: TypeMapping = {
|
|
530
|
-
created_at: { type: 'DatetimeType', isSingle: true },
|
|
531
|
-
|
|
532
|
-
updated_at: { type: 'DatetimeType', isSingle: true },
|
|
533
|
-
};
|
|
534
|
-
return decode(typeMappings, input);
|
|
535
|
-
};
|
|
536
|
-
|
|
537
497
|
decoders.ChannelConfigWithInfo = (input?: Record<string, any>) => {
|
|
538
498
|
const typeMappings: TypeMapping = {
|
|
539
499
|
created_at: { type: 'DatetimeType', isSingle: true },
|
|
@@ -545,40 +505,6 @@ decoders.ChannelConfigWithInfo = (input?: Record<string, any>) => {
|
|
|
545
505
|
return decode(typeMappings, input);
|
|
546
506
|
};
|
|
547
507
|
|
|
548
|
-
decoders.ChannelMember = (input?: Record<string, any>) => {
|
|
549
|
-
const typeMappings: TypeMapping = {
|
|
550
|
-
created_at: { type: 'DatetimeType', isSingle: true },
|
|
551
|
-
|
|
552
|
-
updated_at: { type: 'DatetimeType', isSingle: true },
|
|
553
|
-
|
|
554
|
-
archived_at: { type: 'DatetimeType', isSingle: true },
|
|
555
|
-
|
|
556
|
-
ban_expires: { type: 'DatetimeType', isSingle: true },
|
|
557
|
-
|
|
558
|
-
deleted_at: { type: 'DatetimeType', isSingle: true },
|
|
559
|
-
|
|
560
|
-
invite_accepted_at: { type: 'DatetimeType', isSingle: true },
|
|
561
|
-
|
|
562
|
-
invite_rejected_at: { type: 'DatetimeType', isSingle: true },
|
|
563
|
-
|
|
564
|
-
pinned_at: { type: 'DatetimeType', isSingle: true },
|
|
565
|
-
|
|
566
|
-
user: { type: 'User', isSingle: true },
|
|
567
|
-
};
|
|
568
|
-
return decode(typeMappings, input);
|
|
569
|
-
};
|
|
570
|
-
|
|
571
|
-
decoders.ChannelMemberLookup = (input?: Record<string, any>) => {
|
|
572
|
-
const typeMappings: TypeMapping = {
|
|
573
|
-
archived_at: { type: 'DatetimeType', isSingle: true },
|
|
574
|
-
|
|
575
|
-
ban_expires: { type: 'DatetimeType', isSingle: true },
|
|
576
|
-
|
|
577
|
-
pinned_at: { type: 'DatetimeType', isSingle: true },
|
|
578
|
-
};
|
|
579
|
-
return decode(typeMappings, input);
|
|
580
|
-
};
|
|
581
|
-
|
|
582
508
|
decoders.ChannelMemberResponse = (input?: Record<string, any>) => {
|
|
583
509
|
const typeMappings: TypeMapping = {
|
|
584
510
|
created_at: { type: 'DatetimeType', isSingle: true },
|
|
@@ -747,7 +673,7 @@ decoders.CommentResponse = (input?: Record<string, any>) => {
|
|
|
747
673
|
|
|
748
674
|
latest_reactions: { type: 'FeedsReactionResponse', isSingle: false },
|
|
749
675
|
|
|
750
|
-
reaction_groups: { type: '
|
|
676
|
+
reaction_groups: { type: 'FeedsReactionGroupResponse', isSingle: false },
|
|
751
677
|
};
|
|
752
678
|
return decode(typeMappings, input);
|
|
753
679
|
};
|
|
@@ -834,13 +760,6 @@ decoders.DeleteCommentResponse = (input?: Record<string, any>) => {
|
|
|
834
760
|
return decode(typeMappings, input);
|
|
835
761
|
};
|
|
836
762
|
|
|
837
|
-
decoders.Device = (input?: Record<string, any>) => {
|
|
838
|
-
const typeMappings: TypeMapping = {
|
|
839
|
-
created_at: { type: 'DatetimeType', isSingle: true },
|
|
840
|
-
};
|
|
841
|
-
return decode(typeMappings, input);
|
|
842
|
-
};
|
|
843
|
-
|
|
844
763
|
decoders.DeviceResponse = (input?: Record<string, any>) => {
|
|
845
764
|
const typeMappings: TypeMapping = {
|
|
846
765
|
created_at: { type: 'DatetimeType', isSingle: true },
|
|
@@ -1051,6 +970,15 @@ decoders.FeedUpdatedEvent = (input?: Record<string, any>) => {
|
|
|
1051
970
|
return decode(typeMappings, input);
|
|
1052
971
|
};
|
|
1053
972
|
|
|
973
|
+
decoders.FeedsReactionGroupResponse = (input?: Record<string, any>) => {
|
|
974
|
+
const typeMappings: TypeMapping = {
|
|
975
|
+
first_reaction_at: { type: 'DatetimeType', isSingle: true },
|
|
976
|
+
|
|
977
|
+
last_reaction_at: { type: 'DatetimeType', isSingle: true },
|
|
978
|
+
};
|
|
979
|
+
return decode(typeMappings, input);
|
|
980
|
+
};
|
|
981
|
+
|
|
1054
982
|
decoders.FeedsReactionResponse = (input?: Record<string, any>) => {
|
|
1055
983
|
const typeMappings: TypeMapping = {
|
|
1056
984
|
created_at: { type: 'DatetimeType', isSingle: true },
|
|
@@ -1231,6 +1159,8 @@ decoders.HealthCheckEvent = (input?: Record<string, any>) => {
|
|
|
1231
1159
|
created_at: { type: 'DatetimeType', isSingle: true },
|
|
1232
1160
|
|
|
1233
1161
|
received_at: { type: 'DatetimeType', isSingle: true },
|
|
1162
|
+
|
|
1163
|
+
me: { type: 'OwnUserResponse', isSingle: true },
|
|
1234
1164
|
};
|
|
1235
1165
|
return decode(typeMappings, input);
|
|
1236
1166
|
};
|
|
@@ -1258,64 +1188,6 @@ decoders.MembershipLevelResponse = (input?: Record<string, any>) => {
|
|
|
1258
1188
|
return decode(typeMappings, input);
|
|
1259
1189
|
};
|
|
1260
1190
|
|
|
1261
|
-
decoders.Message = (input?: Record<string, any>) => {
|
|
1262
|
-
const typeMappings: TypeMapping = {
|
|
1263
|
-
created_at: { type: 'DatetimeType', isSingle: true },
|
|
1264
|
-
|
|
1265
|
-
updated_at: { type: 'DatetimeType', isSingle: true },
|
|
1266
|
-
|
|
1267
|
-
latest_reactions: { type: 'Reaction', isSingle: false },
|
|
1268
|
-
|
|
1269
|
-
mentioned_users: { type: 'User', isSingle: false },
|
|
1270
|
-
|
|
1271
|
-
own_reactions: { type: 'Reaction', isSingle: false },
|
|
1272
|
-
|
|
1273
|
-
reaction_groups: { type: 'ReactionGroupResponse', isSingle: false },
|
|
1274
|
-
|
|
1275
|
-
deleted_at: { type: 'DatetimeType', isSingle: true },
|
|
1276
|
-
|
|
1277
|
-
message_text_updated_at: { type: 'DatetimeType', isSingle: true },
|
|
1278
|
-
|
|
1279
|
-
pin_expires: { type: 'DatetimeType', isSingle: true },
|
|
1280
|
-
|
|
1281
|
-
pinned_at: { type: 'DatetimeType', isSingle: true },
|
|
1282
|
-
|
|
1283
|
-
thread_participants: { type: 'User', isSingle: false },
|
|
1284
|
-
|
|
1285
|
-
member: { type: 'ChannelMember', isSingle: true },
|
|
1286
|
-
|
|
1287
|
-
pinned_by: { type: 'User', isSingle: true },
|
|
1288
|
-
|
|
1289
|
-
poll: { type: 'Poll', isSingle: true },
|
|
1290
|
-
|
|
1291
|
-
quoted_message: { type: 'Message', isSingle: true },
|
|
1292
|
-
|
|
1293
|
-
reminder: { type: 'MessageReminder', isSingle: true },
|
|
1294
|
-
|
|
1295
|
-
shared_location: { type: 'SharedLocation', isSingle: true },
|
|
1296
|
-
|
|
1297
|
-
user: { type: 'User', isSingle: true },
|
|
1298
|
-
};
|
|
1299
|
-
return decode(typeMappings, input);
|
|
1300
|
-
};
|
|
1301
|
-
|
|
1302
|
-
decoders.MessageReminder = (input?: Record<string, any>) => {
|
|
1303
|
-
const typeMappings: TypeMapping = {
|
|
1304
|
-
created_at: { type: 'DatetimeType', isSingle: true },
|
|
1305
|
-
|
|
1306
|
-
updated_at: { type: 'DatetimeType', isSingle: true },
|
|
1307
|
-
|
|
1308
|
-
remind_at: { type: 'DatetimeType', isSingle: true },
|
|
1309
|
-
|
|
1310
|
-
channel: { type: 'Channel', isSingle: true },
|
|
1311
|
-
|
|
1312
|
-
message: { type: 'Message', isSingle: true },
|
|
1313
|
-
|
|
1314
|
-
user: { type: 'User', isSingle: true },
|
|
1315
|
-
};
|
|
1316
|
-
return decode(typeMappings, input);
|
|
1317
|
-
};
|
|
1318
|
-
|
|
1319
1191
|
decoders.MessageResponse = (input?: Record<string, any>) => {
|
|
1320
1192
|
const typeMappings: TypeMapping = {
|
|
1321
1193
|
created_at: { type: 'DatetimeType', isSingle: true },
|
|
@@ -1389,7 +1261,7 @@ decoders.ModerationFlaggedEvent = (input?: Record<string, any>) => {
|
|
|
1389
1261
|
const typeMappings: TypeMapping = {
|
|
1390
1262
|
created_at: { type: 'DatetimeType', isSingle: true },
|
|
1391
1263
|
|
|
1392
|
-
|
|
1264
|
+
received_at: { type: 'DatetimeType', isSingle: true },
|
|
1393
1265
|
};
|
|
1394
1266
|
return decode(typeMappings, input);
|
|
1395
1267
|
};
|
|
@@ -1409,9 +1281,9 @@ decoders.ModerationMarkReviewedEvent = (input?: Record<string, any>) => {
|
|
|
1409
1281
|
|
|
1410
1282
|
decoders.MuteResponse = (input?: Record<string, any>) => {
|
|
1411
1283
|
const typeMappings: TypeMapping = {
|
|
1412
|
-
mutes: { type: '
|
|
1284
|
+
mutes: { type: 'UserMuteResponse', isSingle: false },
|
|
1413
1285
|
|
|
1414
|
-
own_user: { type: '
|
|
1286
|
+
own_user: { type: 'OwnUserResponse', isSingle: true },
|
|
1415
1287
|
};
|
|
1416
1288
|
return decode(typeMappings, input);
|
|
1417
1289
|
};
|
|
@@ -1448,7 +1320,7 @@ decoders.OwnBatchResponse = (input?: Record<string, any>) => {
|
|
|
1448
1320
|
return decode(typeMappings, input);
|
|
1449
1321
|
};
|
|
1450
1322
|
|
|
1451
|
-
decoders.
|
|
1323
|
+
decoders.OwnUserResponse = (input?: Record<string, any>) => {
|
|
1452
1324
|
const typeMappings: TypeMapping = {
|
|
1453
1325
|
created_at: { type: 'DatetimeType', isSingle: true },
|
|
1454
1326
|
|
|
@@ -1456,9 +1328,9 @@ decoders.OwnUser = (input?: Record<string, any>) => {
|
|
|
1456
1328
|
|
|
1457
1329
|
channel_mutes: { type: 'ChannelMute', isSingle: false },
|
|
1458
1330
|
|
|
1459
|
-
devices: { type: '
|
|
1331
|
+
devices: { type: 'DeviceResponse', isSingle: false },
|
|
1460
1332
|
|
|
1461
|
-
mutes: { type: '
|
|
1333
|
+
mutes: { type: 'UserMuteResponse', isSingle: false },
|
|
1462
1334
|
|
|
1463
1335
|
deactivated_at: { type: 'DatetimeType', isSingle: true },
|
|
1464
1336
|
|
|
@@ -1466,9 +1338,9 @@ decoders.OwnUser = (input?: Record<string, any>) => {
|
|
|
1466
1338
|
|
|
1467
1339
|
last_active: { type: 'DatetimeType', isSingle: true },
|
|
1468
1340
|
|
|
1469
|
-
|
|
1341
|
+
revoke_tokens_issued_before: { type: 'DatetimeType', isSingle: true },
|
|
1470
1342
|
|
|
1471
|
-
push_preferences: { type: '
|
|
1343
|
+
push_preferences: { type: 'PushPreferencesResponse', isSingle: true },
|
|
1472
1344
|
};
|
|
1473
1345
|
return decode(typeMappings, input);
|
|
1474
1346
|
};
|
|
@@ -1482,21 +1354,6 @@ decoders.PinActivityResponse = (input?: Record<string, any>) => {
|
|
|
1482
1354
|
return decode(typeMappings, input);
|
|
1483
1355
|
};
|
|
1484
1356
|
|
|
1485
|
-
decoders.Poll = (input?: Record<string, any>) => {
|
|
1486
|
-
const typeMappings: TypeMapping = {
|
|
1487
|
-
created_at: { type: 'DatetimeType', isSingle: true },
|
|
1488
|
-
|
|
1489
|
-
updated_at: { type: 'DatetimeType', isSingle: true },
|
|
1490
|
-
|
|
1491
|
-
latest_answers: { type: 'PollVote', isSingle: false },
|
|
1492
|
-
|
|
1493
|
-
own_votes: { type: 'PollVote', isSingle: false },
|
|
1494
|
-
|
|
1495
|
-
created_by: { type: 'User', isSingle: true },
|
|
1496
|
-
};
|
|
1497
|
-
return decode(typeMappings, input);
|
|
1498
|
-
};
|
|
1499
|
-
|
|
1500
1357
|
decoders.PollClosedFeedEvent = (input?: Record<string, any>) => {
|
|
1501
1358
|
const typeMappings: TypeMapping = {
|
|
1502
1359
|
created_at: { type: 'DatetimeType', isSingle: true },
|
|
@@ -1552,17 +1409,6 @@ decoders.PollUpdatedFeedEvent = (input?: Record<string, any>) => {
|
|
|
1552
1409
|
return decode(typeMappings, input);
|
|
1553
1410
|
};
|
|
1554
1411
|
|
|
1555
|
-
decoders.PollVote = (input?: Record<string, any>) => {
|
|
1556
|
-
const typeMappings: TypeMapping = {
|
|
1557
|
-
created_at: { type: 'DatetimeType', isSingle: true },
|
|
1558
|
-
|
|
1559
|
-
updated_at: { type: 'DatetimeType', isSingle: true },
|
|
1560
|
-
|
|
1561
|
-
user: { type: 'User', isSingle: true },
|
|
1562
|
-
};
|
|
1563
|
-
return decode(typeMappings, input);
|
|
1564
|
-
};
|
|
1565
|
-
|
|
1566
1412
|
decoders.PollVoteCastedFeedEvent = (input?: Record<string, any>) => {
|
|
1567
1413
|
const typeMappings: TypeMapping = {
|
|
1568
1414
|
created_at: { type: 'DatetimeType', isSingle: true },
|
|
@@ -1629,7 +1475,7 @@ decoders.PollVotesResponse = (input?: Record<string, any>) => {
|
|
|
1629
1475
|
return decode(typeMappings, input);
|
|
1630
1476
|
};
|
|
1631
1477
|
|
|
1632
|
-
decoders.
|
|
1478
|
+
decoders.PushPreferencesResponse = (input?: Record<string, any>) => {
|
|
1633
1479
|
const typeMappings: TypeMapping = {
|
|
1634
1480
|
disabled_until: { type: 'DatetimeType', isSingle: true },
|
|
1635
1481
|
};
|
|
@@ -1741,8 +1587,6 @@ decoders.Reaction = (input?: Record<string, any>) => {
|
|
|
1741
1587
|
updated_at: { type: 'DatetimeType', isSingle: true },
|
|
1742
1588
|
|
|
1743
1589
|
deleted_at: { type: 'DatetimeType', isSingle: true },
|
|
1744
|
-
|
|
1745
|
-
user: { type: 'User', isSingle: true },
|
|
1746
1590
|
};
|
|
1747
1591
|
return decode(typeMappings, input);
|
|
1748
1592
|
};
|
|
@@ -1820,7 +1664,7 @@ decoders.ReviewQueueItemResponse = (input?: Record<string, any>) => {
|
|
|
1820
1664
|
|
|
1821
1665
|
actions: { type: 'ActionLogResponse', isSingle: false },
|
|
1822
1666
|
|
|
1823
|
-
bans: { type: '
|
|
1667
|
+
bans: { type: 'BanInfoResponse', isSingle: false },
|
|
1824
1668
|
|
|
1825
1669
|
flags: { type: 'ModerationFlagResponse', isSingle: false },
|
|
1826
1670
|
|
|
@@ -1849,21 +1693,6 @@ decoders.ReviewQueueItemResponse = (input?: Record<string, any>) => {
|
|
|
1849
1693
|
return decode(typeMappings, input);
|
|
1850
1694
|
};
|
|
1851
1695
|
|
|
1852
|
-
decoders.SharedLocation = (input?: Record<string, any>) => {
|
|
1853
|
-
const typeMappings: TypeMapping = {
|
|
1854
|
-
created_at: { type: 'DatetimeType', isSingle: true },
|
|
1855
|
-
|
|
1856
|
-
updated_at: { type: 'DatetimeType', isSingle: true },
|
|
1857
|
-
|
|
1858
|
-
end_at: { type: 'DatetimeType', isSingle: true },
|
|
1859
|
-
|
|
1860
|
-
channel: { type: 'Channel', isSingle: true },
|
|
1861
|
-
|
|
1862
|
-
message: { type: 'Message', isSingle: true },
|
|
1863
|
-
};
|
|
1864
|
-
return decode(typeMappings, input);
|
|
1865
|
-
};
|
|
1866
|
-
|
|
1867
1696
|
decoders.SharedLocationResponse = (input?: Record<string, any>) => {
|
|
1868
1697
|
const typeMappings: TypeMapping = {
|
|
1869
1698
|
created_at: { type: 'DatetimeType', isSingle: true },
|
|
@@ -1956,7 +1785,7 @@ decoders.ThreadedCommentResponse = (input?: Record<string, any>) => {
|
|
|
1956
1785
|
|
|
1957
1786
|
replies: { type: 'ThreadedCommentResponse', isSingle: false },
|
|
1958
1787
|
|
|
1959
|
-
reaction_groups: { type: '
|
|
1788
|
+
reaction_groups: { type: 'FeedsReactionGroupResponse', isSingle: false },
|
|
1960
1789
|
};
|
|
1961
1790
|
return decode(typeMappings, input);
|
|
1962
1791
|
};
|
|
@@ -2077,28 +1906,7 @@ decoders.UpsertConfigResponse = (input?: Record<string, any>) => {
|
|
|
2077
1906
|
|
|
2078
1907
|
decoders.UpsertPushPreferencesResponse = (input?: Record<string, any>) => {
|
|
2079
1908
|
const typeMappings: TypeMapping = {
|
|
2080
|
-
user_preferences: { type: '
|
|
2081
|
-
};
|
|
2082
|
-
return decode(typeMappings, input);
|
|
2083
|
-
};
|
|
2084
|
-
|
|
2085
|
-
decoders.User = (input?: Record<string, any>) => {
|
|
2086
|
-
const typeMappings: TypeMapping = {
|
|
2087
|
-
ban_expires: { type: 'DatetimeType', isSingle: true },
|
|
2088
|
-
|
|
2089
|
-
created_at: { type: 'DatetimeType', isSingle: true },
|
|
2090
|
-
|
|
2091
|
-
deactivated_at: { type: 'DatetimeType', isSingle: true },
|
|
2092
|
-
|
|
2093
|
-
deleted_at: { type: 'DatetimeType', isSingle: true },
|
|
2094
|
-
|
|
2095
|
-
last_active: { type: 'DatetimeType', isSingle: true },
|
|
2096
|
-
|
|
2097
|
-
last_engaged_at: { type: 'DatetimeType', isSingle: true },
|
|
2098
|
-
|
|
2099
|
-
revoke_tokens_issued_before: { type: 'DatetimeType', isSingle: true },
|
|
2100
|
-
|
|
2101
|
-
updated_at: { type: 'DatetimeType', isSingle: true },
|
|
1909
|
+
user_preferences: { type: 'PushPreferencesResponse', isSingle: false },
|
|
2102
1910
|
};
|
|
2103
1911
|
return decode(typeMappings, input);
|
|
2104
1912
|
};
|
|
@@ -2107,11 +1915,9 @@ decoders.UserBannedEvent = (input?: Record<string, any>) => {
|
|
|
2107
1915
|
const typeMappings: TypeMapping = {
|
|
2108
1916
|
created_at: { type: 'DatetimeType', isSingle: true },
|
|
2109
1917
|
|
|
2110
|
-
created_by: { type: 'User', isSingle: true },
|
|
2111
|
-
|
|
2112
1918
|
expiration: { type: 'DatetimeType', isSingle: true },
|
|
2113
1919
|
|
|
2114
|
-
|
|
1920
|
+
received_at: { type: 'DatetimeType', isSingle: true },
|
|
2115
1921
|
};
|
|
2116
1922
|
return decode(typeMappings, input);
|
|
2117
1923
|
};
|
|
@@ -2120,24 +1926,7 @@ decoders.UserDeactivatedEvent = (input?: Record<string, any>) => {
|
|
|
2120
1926
|
const typeMappings: TypeMapping = {
|
|
2121
1927
|
created_at: { type: 'DatetimeType', isSingle: true },
|
|
2122
1928
|
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
user: { type: 'User', isSingle: true },
|
|
2126
|
-
};
|
|
2127
|
-
return decode(typeMappings, input);
|
|
2128
|
-
};
|
|
2129
|
-
|
|
2130
|
-
decoders.UserMute = (input?: Record<string, any>) => {
|
|
2131
|
-
const typeMappings: TypeMapping = {
|
|
2132
|
-
created_at: { type: 'DatetimeType', isSingle: true },
|
|
2133
|
-
|
|
2134
|
-
updated_at: { type: 'DatetimeType', isSingle: true },
|
|
2135
|
-
|
|
2136
|
-
expires: { type: 'DatetimeType', isSingle: true },
|
|
2137
|
-
|
|
2138
|
-
target: { type: 'User', isSingle: true },
|
|
2139
|
-
|
|
2140
|
-
user: { type: 'User', isSingle: true },
|
|
1929
|
+
received_at: { type: 'DatetimeType', isSingle: true },
|
|
2141
1930
|
};
|
|
2142
1931
|
return decode(typeMappings, input);
|
|
2143
1932
|
};
|
|
@@ -2157,20 +1946,11 @@ decoders.UserMuteResponse = (input?: Record<string, any>) => {
|
|
|
2157
1946
|
return decode(typeMappings, input);
|
|
2158
1947
|
};
|
|
2159
1948
|
|
|
2160
|
-
decoders.UserMutedEvent = (input?: Record<string, any>) => {
|
|
2161
|
-
const typeMappings: TypeMapping = {
|
|
2162
|
-
created_at: { type: 'DatetimeType', isSingle: true },
|
|
2163
|
-
|
|
2164
|
-
user: { type: 'User', isSingle: true },
|
|
2165
|
-
};
|
|
2166
|
-
return decode(typeMappings, input);
|
|
2167
|
-
};
|
|
2168
|
-
|
|
2169
1949
|
decoders.UserReactivatedEvent = (input?: Record<string, any>) => {
|
|
2170
1950
|
const typeMappings: TypeMapping = {
|
|
2171
1951
|
created_at: { type: 'DatetimeType', isSingle: true },
|
|
2172
1952
|
|
|
2173
|
-
|
|
1953
|
+
received_at: { type: 'DatetimeType', isSingle: true },
|
|
2174
1954
|
};
|
|
2175
1955
|
return decode(typeMappings, input);
|
|
2176
1956
|
};
|
|
@@ -2192,6 +1972,15 @@ decoders.UserResponse = (input?: Record<string, any>) => {
|
|
|
2192
1972
|
return decode(typeMappings, input);
|
|
2193
1973
|
};
|
|
2194
1974
|
|
|
1975
|
+
decoders.UserUnbannedEvent = (input?: Record<string, any>) => {
|
|
1976
|
+
const typeMappings: TypeMapping = {
|
|
1977
|
+
created_at: { type: 'DatetimeType', isSingle: true },
|
|
1978
|
+
|
|
1979
|
+
received_at: { type: 'DatetimeType', isSingle: true },
|
|
1980
|
+
};
|
|
1981
|
+
return decode(typeMappings, input);
|
|
1982
|
+
};
|
|
1983
|
+
|
|
2195
1984
|
decoders.UserUpdatedEvent = (input?: Record<string, any>) => {
|
|
2196
1985
|
const typeMappings: TypeMapping = {
|
|
2197
1986
|
created_at: { type: 'DatetimeType', isSingle: true },
|
|
@@ -150,11 +150,12 @@ const eventDecoderMapping: Record<
|
|
|
150
150
|
'user.deactivated': (data: Record<string, any>) =>
|
|
151
151
|
decoders.UserDeactivatedEvent(data),
|
|
152
152
|
|
|
153
|
-
'user.muted': (data: Record<string, any>) => decoders.UserMutedEvent(data),
|
|
154
|
-
|
|
155
153
|
'user.reactivated': (data: Record<string, any>) =>
|
|
156
154
|
decoders.UserReactivatedEvent(data),
|
|
157
155
|
|
|
156
|
+
'user.unbanned': (data: Record<string, any>) =>
|
|
157
|
+
decoders.UserUnbannedEvent(data),
|
|
158
|
+
|
|
158
159
|
'user.updated': (data: Record<string, any>) =>
|
|
159
160
|
decoders.UserUpdatedEvent(data),
|
|
160
161
|
};
|