@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.
@@ -874,6 +874,18 @@ decoders.MuteResponse = (input) => {
874
874
  };
875
875
  return decode(typeMappings, input);
876
876
  };
877
+ decoders.NotificationFeedUpdatedEvent = (input) => {
878
+ const typeMappings = {
879
+ created_at: { type: 'DatetimeType', isSingle: true },
880
+ received_at: { type: 'DatetimeType', isSingle: true },
881
+ aggregated_activities: {
882
+ type: 'AggregatedActivityResponse',
883
+ isSingle: false,
884
+ },
885
+ notification_status: { type: 'NotificationStatusResponse', isSingle: true },
886
+ };
887
+ return decode(typeMappings, input);
888
+ };
877
889
  decoders.NotificationStatusResponse = (input) => {
878
890
  const typeMappings = {
879
891
  last_seen_at: { type: 'DatetimeType', isSingle: true },
@@ -1973,6 +1985,18 @@ class FeedsApi {
1973
1985
  decoders.RejectFeedMemberInviteResponse?.(response.body);
1974
1986
  return { ...response.body, metadata: response.metadata };
1975
1987
  }
1988
+ async stopWatchingFeed(request) {
1989
+ const queryParams = {
1990
+ connection_id: request?.connection_id,
1991
+ };
1992
+ const pathParams = {
1993
+ feed_group_id: request?.feed_group_id,
1994
+ feed_id: request?.feed_id,
1995
+ };
1996
+ const response = await this.apiClient.sendRequest('DELETE', '/api/v2/feeds/feed_groups/{feed_group_id}/feeds/{feed_id}/watch', pathParams, queryParams);
1997
+ decoders.Response?.(response.body);
1998
+ return { ...response.body, metadata: response.metadata };
1999
+ }
1976
2000
  async getFollowSuggestions(request) {
1977
2001
  const queryParams = {
1978
2002
  limit: request?.limit,
@@ -2337,7 +2361,6 @@ class FeedsApi {
2337
2361
  }
2338
2362
  async updateLiveLocation(request) {
2339
2363
  const body = {
2340
- created_by_device_id: request?.created_by_device_id,
2341
2364
  message_id: request?.message_id,
2342
2365
  end_at: request?.end_at,
2343
2366
  latitude: request?.latitude,
@@ -3702,6 +3725,7 @@ const eventDecoderMapping = {
3702
3725
  'feeds.follow.created': (data) => decoders.FollowCreatedEvent(data),
3703
3726
  'feeds.follow.deleted': (data) => decoders.FollowDeletedEvent(data),
3704
3727
  'feeds.follow.updated': (data) => decoders.FollowUpdatedEvent(data),
3728
+ 'feeds.notification_feed.updated': (data) => decoders.NotificationFeedUpdatedEvent(data),
3705
3729
  'feeds.poll.closed': (data) => decoders.PollClosedFeedEvent(data),
3706
3730
  'feeds.poll.deleted': (data) => decoders.PollDeletedFeedEvent(data),
3707
3731
  'feeds.poll.updated': (data) => decoders.PollUpdatedFeedEvent(data),
@@ -3803,6 +3827,13 @@ class FeedApi {
3803
3827
  ...request,
3804
3828
  });
3805
3829
  }
3830
+ stopWatching(request) {
3831
+ return this.feedsApi.stopWatchingFeed({
3832
+ feed_id: this.id,
3833
+ feed_group_id: this.group,
3834
+ ...request,
3835
+ });
3836
+ }
3806
3837
  }
3807
3838
 
3808
3839
  const addActivitiesToState = (newActivities, activities, position) => {
@@ -4320,6 +4351,10 @@ class Feed extends FeedApi {
4320
4351
  return newState ?? currentState;
4321
4352
  });
4322
4353
  },
4354
+ 'feeds.notification_feed.updated': (event) => {
4355
+ console.info('notification feed updated', event);
4356
+ // TODO: handle notification feed updates
4357
+ },
4323
4358
  // the poll events should be removed from here
4324
4359
  'feeds.poll.closed': Feed.noop,
4325
4360
  'feeds.poll.deleted': Feed.noop,