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