@stream-io/feeds-client 0.1.6 → 0.1.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stream-io/feeds-client",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "packageManager": "yarn@3.2.4",
5
5
  "main": "./dist/index.node.js",
6
6
  "exports": {
package/src/Feed.ts CHANGED
@@ -501,6 +501,10 @@ export class Feed extends FeedApi {
501
501
  return newState ?? currentState;
502
502
  });
503
503
  },
504
+ 'feeds.notification_feed.updated': (event) => {
505
+ console.info('notification feed updated', event);
506
+ // TODO: handle notification feed updates
507
+ },
504
508
  // the poll events should be removed from here
505
509
  'feeds.poll.closed': Feed.noop,
506
510
  'feeds.poll.deleted': Feed.noop,
@@ -126,4 +126,14 @@ export class FeedApi {
126
126
  ...request,
127
127
  });
128
128
  }
129
+
130
+ stopWatching(request?: {
131
+ connection_id?: string;
132
+ }): Promise<StreamResponse<Response>> {
133
+ return this.feedsApi.stopWatchingFeed({
134
+ feed_id: this.id,
135
+ feed_group_id: this.group,
136
+ ...request,
137
+ });
138
+ }
129
139
  }
@@ -1415,6 +1415,31 @@ export class FeedsApi {
1415
1415
  return { ...response.body, metadata: response.metadata };
1416
1416
  }
1417
1417
 
1418
+ async stopWatchingFeed(request: {
1419
+ feed_group_id: string;
1420
+ feed_id: string;
1421
+ connection_id?: string;
1422
+ }): Promise<StreamResponse<Response>> {
1423
+ const queryParams = {
1424
+ connection_id: request?.connection_id,
1425
+ };
1426
+ const pathParams = {
1427
+ feed_group_id: request?.feed_group_id,
1428
+ feed_id: request?.feed_id,
1429
+ };
1430
+
1431
+ const response = await this.apiClient.sendRequest<StreamResponse<Response>>(
1432
+ 'DELETE',
1433
+ '/api/v2/feeds/feed_groups/{feed_group_id}/feeds/{feed_id}/watch',
1434
+ pathParams,
1435
+ queryParams,
1436
+ );
1437
+
1438
+ decoders.Response?.(response.body);
1439
+
1440
+ return { ...response.body, metadata: response.metadata };
1441
+ }
1442
+
1418
1443
  async getFollowSuggestions(request: {
1419
1444
  feed_group_id: string;
1420
1445
  limit?: number;
@@ -2200,7 +2225,6 @@ export class FeedsApi {
2200
2225
  request: UpdateLiveLocationRequest,
2201
2226
  ): Promise<StreamResponse<SharedLocationResponse>> {
2202
2227
  const body = {
2203
- created_by_device_id: request?.created_by_device_id,
2204
2228
  message_id: request?.message_id,
2205
2229
  end_at: request?.end_at,
2206
2230
  latitude: request?.latitude,
@@ -1226,6 +1226,22 @@ decoders.MuteResponse = (input?: Record<string, any>) => {
1226
1226
  return decode(typeMappings, input);
1227
1227
  };
1228
1228
 
1229
+ decoders.NotificationFeedUpdatedEvent = (input?: Record<string, any>) => {
1230
+ const typeMappings: TypeMapping = {
1231
+ created_at: { type: 'DatetimeType', isSingle: true },
1232
+
1233
+ received_at: { type: 'DatetimeType', isSingle: true },
1234
+
1235
+ aggregated_activities: {
1236
+ type: 'AggregatedActivityResponse',
1237
+ isSingle: false,
1238
+ },
1239
+
1240
+ notification_status: { type: 'NotificationStatusResponse', isSingle: true },
1241
+ };
1242
+ return decode(typeMappings, input);
1243
+ };
1244
+
1229
1245
  decoders.NotificationStatusResponse = (input?: Record<string, any>) => {
1230
1246
  const typeMappings: TypeMapping = {
1231
1247
  last_seen_at: { type: 'DatetimeType', isSingle: true },
@@ -103,6 +103,9 @@ const eventDecoderMapping: Record<
103
103
  'feeds.follow.updated': (data: Record<string, any>) =>
104
104
  decoders.FollowUpdatedEvent(data),
105
105
 
106
+ 'feeds.notification_feed.updated': (data: Record<string, any>) =>
107
+ decoders.NotificationFeedUpdatedEvent(data),
108
+
106
109
  'feeds.poll.closed': (data: Record<string, any>) =>
107
110
  decoders.PollClosedFeedEvent(data),
108
111
 
@@ -427,11 +427,11 @@ export interface ActivityResponse {
427
427
 
428
428
  moderation?: ModerationV2Response;
429
429
 
430
+ object?: Record<string, any>;
431
+
430
432
  parent?: ActivityResponse;
431
433
 
432
434
  poll?: PollResponseData;
433
-
434
- target?: Record<string, any>;
435
435
  }
436
436
 
437
437
  export interface ActivityUnpinnedEvent {
@@ -1182,6 +1182,8 @@ export interface CallParticipant {
1182
1182
 
1183
1183
  teams_role: Record<string, string>;
1184
1184
 
1185
+ avg_response_time?: number;
1186
+
1185
1187
  ban_expires?: Date;
1186
1188
 
1187
1189
  created_at?: Date;
@@ -2354,6 +2356,8 @@ export interface EntityCreator {
2354
2356
 
2355
2357
  teams_role: Record<string, string>;
2356
2358
 
2359
+ avg_response_time?: number;
2360
+
2357
2361
  ban_expires?: Date;
2358
2362
 
2359
2363
  created_at?: Date;
@@ -2406,6 +2410,8 @@ export interface EntityCreatorResponse {
2406
2410
 
2407
2411
  custom: Record<string, any>;
2408
2412
 
2413
+ avg_response_time?: number;
2414
+
2409
2415
  deactivated_at?: Date;
2410
2416
 
2411
2417
  deleted_at?: Date;
@@ -3010,6 +3016,8 @@ export interface FullUserResponse {
3010
3016
 
3011
3017
  custom: Record<string, any>;
3012
3018
 
3019
+ avg_response_time?: number;
3020
+
3013
3021
  ban_expires?: Date;
3014
3022
 
3015
3023
  deactivated_at?: Date;
@@ -3697,6 +3705,24 @@ export interface NotificationConfig {
3697
3705
  track_seen?: boolean;
3698
3706
  }
3699
3707
 
3708
+ export interface NotificationFeedUpdatedEvent {
3709
+ created_at: Date;
3710
+
3711
+ fid: string;
3712
+
3713
+ custom: Record<string, any>;
3714
+
3715
+ type: string;
3716
+
3717
+ received_at?: Date;
3718
+
3719
+ aggregated_activities?: AggregatedActivityResponse[];
3720
+
3721
+ notification_status?: NotificationStatusResponse;
3722
+
3723
+ user?: UserResponseCommonFields;
3724
+ }
3725
+
3700
3726
  export interface NotificationSettings {
3701
3727
  enabled: boolean;
3702
3728
 
@@ -3772,6 +3798,8 @@ export interface OwnUser {
3772
3798
 
3773
3799
  total_unread_count_by_team: Record<string, number>;
3774
3800
 
3801
+ avg_response_time?: number;
3802
+
3775
3803
  deactivated_at?: Date;
3776
3804
 
3777
3805
  deleted_at?: Date;
@@ -3830,6 +3858,8 @@ export interface OwnUserResponse {
3830
3858
 
3831
3859
  custom: Record<string, any>;
3832
3860
 
3861
+ avg_response_time?: number;
3862
+
3833
3863
  deactivated_at?: Date;
3834
3864
 
3835
3865
  deleted_at?: Date;
@@ -5475,8 +5505,6 @@ export interface UpdateFollowResponse {
5475
5505
  }
5476
5506
 
5477
5507
  export interface UpdateLiveLocationRequest {
5478
- created_by_device_id: string;
5479
-
5480
5508
  message_id: string;
5481
5509
 
5482
5510
  end_at?: Date;
@@ -5611,6 +5639,8 @@ export interface User {
5611
5639
 
5612
5640
  teams_role: Record<string, string>;
5613
5641
 
5642
+ avg_response_time?: number;
5643
+
5614
5644
  ban_expires?: Date;
5615
5645
 
5616
5646
  created_at?: Date;
@@ -5755,6 +5785,8 @@ export interface UserResponse {
5755
5785
 
5756
5786
  custom: Record<string, any>;
5757
5787
 
5788
+ avg_response_time?: number;
5789
+
5758
5790
  deactivated_at?: Date;
5759
5791
 
5760
5792
  deleted_at?: Date;
@@ -5791,6 +5823,8 @@ export interface UserResponseCommonFields {
5791
5823
 
5792
5824
  custom: Record<string, any>;
5793
5825
 
5826
+ avg_response_time?: number;
5827
+
5794
5828
  deactivated_at?: Date;
5795
5829
 
5796
5830
  deleted_at?: Date;
@@ -5827,6 +5861,8 @@ export interface UserResponsePrivacyFields {
5827
5861
 
5828
5862
  custom: Record<string, any>;
5829
5863
 
5864
+ avg_response_time?: number;
5865
+
5830
5866
  deactivated_at?: Date;
5831
5867
 
5832
5868
  deleted_at?: Date;
@@ -6006,6 +6042,7 @@ export type WSClientEvent =
6006
6042
  | ({ type: 'feeds.follow.created' } & FollowCreatedEvent)
6007
6043
  | ({ type: 'feeds.follow.deleted' } & FollowDeletedEvent)
6008
6044
  | ({ type: 'feeds.follow.updated' } & FollowUpdatedEvent)
6045
+ | ({ type: 'feeds.notification_feed.updated' } & NotificationFeedUpdatedEvent)
6009
6046
  | ({ type: 'feeds.poll.closed' } & PollClosedFeedEvent)
6010
6047
  | ({ type: 'feeds.poll.deleted' } & PollDeletedFeedEvent)
6011
6048
  | ({ type: 'feeds.poll.updated' } & PollUpdatedFeedEvent)
@@ -6051,6 +6088,7 @@ export type WSEvent =
6051
6088
  | ({ type: 'feeds.follow.created' } & FollowCreatedEvent)
6052
6089
  | ({ type: 'feeds.follow.deleted' } & FollowDeletedEvent)
6053
6090
  | ({ type: 'feeds.follow.updated' } & FollowUpdatedEvent)
6091
+ | ({ type: 'feeds.notification_feed.updated' } & NotificationFeedUpdatedEvent)
6054
6092
  | ({ type: 'feeds.poll.closed' } & PollClosedFeedEvent)
6055
6093
  | ({ type: 'feeds.poll.deleted' } & PollDeletedFeedEvent)
6056
6094
  | ({ type: 'feeds.poll.updated' } & PollUpdatedFeedEvent)