@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.
@@ -1145,6 +1145,18 @@ decoders.MuteResponse = (input) => {
1145
1145
  };
1146
1146
  return decode(typeMappings, input);
1147
1147
  };
1148
+ decoders.NotificationFeedUpdatedEvent = (input) => {
1149
+ const typeMappings = {
1150
+ created_at: { type: 'DatetimeType', isSingle: true },
1151
+ received_at: { type: 'DatetimeType', isSingle: true },
1152
+ aggregated_activities: {
1153
+ type: 'AggregatedActivityResponse',
1154
+ isSingle: false,
1155
+ },
1156
+ notification_status: { type: 'NotificationStatusResponse', isSingle: true },
1157
+ };
1158
+ return decode(typeMappings, input);
1159
+ };
1148
1160
  decoders.NotificationStatusResponse = (input) => {
1149
1161
  const typeMappings = {
1150
1162
  last_seen_at: { type: 'DatetimeType', isSingle: true },
@@ -2244,6 +2256,18 @@ class FeedsApi {
2244
2256
  decoders.RejectFeedMemberInviteResponse?.(response.body);
2245
2257
  return { ...response.body, metadata: response.metadata };
2246
2258
  }
2259
+ async stopWatchingFeed(request) {
2260
+ const queryParams = {
2261
+ connection_id: request?.connection_id,
2262
+ };
2263
+ const pathParams = {
2264
+ feed_group_id: request?.feed_group_id,
2265
+ feed_id: request?.feed_id,
2266
+ };
2267
+ const response = await this.apiClient.sendRequest('DELETE', '/api/v2/feeds/feed_groups/{feed_group_id}/feeds/{feed_id}/watch', pathParams, queryParams);
2268
+ decoders.Response?.(response.body);
2269
+ return { ...response.body, metadata: response.metadata };
2270
+ }
2247
2271
  async getFollowSuggestions(request) {
2248
2272
  const queryParams = {
2249
2273
  limit: request?.limit,
@@ -2608,7 +2632,6 @@ class FeedsApi {
2608
2632
  }
2609
2633
  async updateLiveLocation(request) {
2610
2634
  const body = {
2611
- created_by_device_id: request?.created_by_device_id,
2612
2635
  message_id: request?.message_id,
2613
2636
  end_at: request?.end_at,
2614
2637
  latitude: request?.latitude,
@@ -3692,6 +3715,7 @@ const eventDecoderMapping = {
3692
3715
  'feeds.follow.created': (data) => decoders.FollowCreatedEvent(data),
3693
3716
  'feeds.follow.deleted': (data) => decoders.FollowDeletedEvent(data),
3694
3717
  'feeds.follow.updated': (data) => decoders.FollowUpdatedEvent(data),
3718
+ 'feeds.notification_feed.updated': (data) => decoders.NotificationFeedUpdatedEvent(data),
3695
3719
  'feeds.poll.closed': (data) => decoders.PollClosedFeedEvent(data),
3696
3720
  'feeds.poll.deleted': (data) => decoders.PollDeletedFeedEvent(data),
3697
3721
  'feeds.poll.updated': (data) => decoders.PollUpdatedFeedEvent(data),
@@ -3793,6 +3817,13 @@ class FeedApi {
3793
3817
  ...request,
3794
3818
  });
3795
3819
  }
3820
+ stopWatching(request) {
3821
+ return this.feedsApi.stopWatchingFeed({
3822
+ feed_id: this.id,
3823
+ feed_group_id: this.group,
3824
+ ...request,
3825
+ });
3826
+ }
3796
3827
  }
3797
3828
 
3798
3829
  const addActivitiesToState = (newActivities, activities, position) => {
@@ -4303,6 +4334,10 @@ class Feed extends FeedApi {
4303
4334
  return newState ?? currentState;
4304
4335
  });
4305
4336
  },
4337
+ 'feeds.notification_feed.updated': (event) => {
4338
+ console.info('notification feed updated', event);
4339
+ // TODO: handle notification feed updates
4340
+ },
4306
4341
  // the poll events should be removed from here
4307
4342
  'feeds.poll.closed': Feed.noop,
4308
4343
  'feeds.poll.deleted': Feed.noop,