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