@stream-io/node-sdk 0.7.57 → 0.7.58

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.
@@ -1,5 +1,5 @@
1
1
  import { ApiClient, StreamResponse } from '../../gen-imports';
2
- import { AcceptFeedMemberInviteRequest, AcceptFeedMemberInviteResponse, AcceptFollowRequest, AcceptFollowResponse, ActivityFeedbackRequest, ActivityFeedbackResponse, AddActivityRequest, AddActivityResponse, AddBookmarkRequest, AddBookmarkResponse, AddCommentBookmarkRequest, AddCommentBookmarkResponse, AddCommentReactionRequest, AddCommentReactionResponse, AddCommentRequest, AddCommentResponse, AddCommentsBatchRequest, AddCommentsBatchResponse, AddReactionRequest, AddReactionResponse, CastPollVoteRequest, CreateCollectionsRequest, CreateCollectionsResponse, CreateFeedGroupRequest, CreateFeedGroupResponse, CreateFeedViewRequest, CreateFeedViewResponse, CreateFeedsBatchRequest, CreateFeedsBatchResponse, CreateMembershipLevelRequest, CreateMembershipLevelResponse, DeleteActivitiesRequest, DeleteActivitiesResponse, DeleteActivityReactionResponse, DeleteActivityResponse, DeleteBookmarkFolderResponse, DeleteBookmarkResponse, DeleteCollectionsResponse, DeleteCommentBookmarkResponse, DeleteCommentReactionResponse, DeleteCommentResponse, DeleteFeedGroupResponse, DeleteFeedResponse, DeleteFeedUserDataRequest, DeleteFeedUserDataResponse, DeleteFeedViewResponse, DeleteFeedsBatchRequest, DeleteFeedsBatchResponse, ExportFeedUserDataResponse, FollowBatchRequest, FollowBatchResponse, FollowRequest, GetActivityResponse, GetCommentRepliesResponse, GetCommentResponse, GetCommentsResponse, GetFeedGroupResponse, GetFeedViewResponse, GetFeedVisibilityResponse, GetFeedsRateLimitsResponse, GetFollowSuggestionsResponse, GetOrCreateFeedGroupRequest, GetOrCreateFeedGroupResponse, GetOrCreateFeedRequest, GetOrCreateFeedResponse, GetOrCreateFeedViewRequest, GetOrCreateFeedViewResponse, ListFeedGroupsResponse, ListFeedViewsResponse, ListFeedVisibilitiesResponse, MarkActivityRequest, OwnBatchRequest, OwnBatchResponse, PinActivityRequest, PinActivityResponse, PollVoteResponse, QueryActivitiesRequest, QueryActivitiesResponse, QueryActivityReactionsRequest, QueryActivityReactionsResponse, QueryBookmarkFoldersRequest, QueryBookmarkFoldersResponse, QueryBookmarksRequest, QueryBookmarksResponse, QueryCollectionsRequest, QueryCollectionsResponse, QueryCommentReactionsRequest, QueryCommentReactionsResponse, QueryCommentsRequest, QueryCommentsResponse, QueryFeedMembersRequest, QueryFeedMembersResponse, QueryFeedsRequest, QueryFeedsResponse, QueryFeedsUsageStatsRequest, QueryFeedsUsageStatsResponse, QueryFollowsRequest, QueryFollowsResponse, QueryMembershipLevelsRequest, QueryMembershipLevelsResponse, QueryPinnedActivitiesRequest, QueryPinnedActivitiesResponse, QueryRevisionHistoryRequest, QueryRevisionHistoryResponse, ReadCollectionsResponse, RejectFeedMemberInviteRequest, RejectFeedMemberInviteResponse, RejectFollowRequest, RejectFollowResponse, Response, RestoreActivityRequest, RestoreActivityResponse, RestoreCommentRequest, RestoreCommentResponse, RestoreFeedGroupResponse, SingleFollowResponse, TrackActivityMetricsRequest, TrackActivityMetricsResponse, UnfollowBatchRequest, UnfollowBatchResponse, UnfollowResponse, UnpinActivityResponse, UpdateActivitiesPartialBatchRequest, UpdateActivitiesPartialBatchResponse, UpdateActivityPartialRequest, UpdateActivityPartialResponse, UpdateActivityRequest, UpdateActivityResponse, UpdateBookmarkFolderRequest, UpdateBookmarkFolderResponse, UpdateBookmarkRequest, UpdateBookmarkResponse, UpdateCollectionsRequest, UpdateCollectionsResponse, UpdateCommentBookmarkRequest, UpdateCommentBookmarkResponse, UpdateCommentPartialRequest, UpdateCommentPartialResponse, UpdateCommentRequest, UpdateCommentResponse, UpdateFeedGroupRequest, UpdateFeedGroupResponse, UpdateFeedMembersRequest, UpdateFeedMembersResponse, UpdateFeedRequest, UpdateFeedResponse, UpdateFeedViewRequest, UpdateFeedViewResponse, UpdateFeedVisibilityRequest, UpdateFeedVisibilityResponse, UpdateFollowRequest, UpdateFollowResponse, UpdateMembershipLevelRequest, UpdateMembershipLevelResponse, UpsertActivitiesRequest, UpsertActivitiesResponse, UpsertCollectionsRequest, UpsertCollectionsResponse } from '../models';
2
+ import { AcceptFeedMemberInviteRequest, AcceptFeedMemberInviteResponse, AcceptFollowRequest, AcceptFollowResponse, ActivityFeedbackRequest, ActivityFeedbackResponse, AddActivityRequest, AddActivityResponse, AddBookmarkRequest, AddBookmarkResponse, AddCommentBookmarkRequest, AddCommentBookmarkResponse, AddCommentReactionRequest, AddCommentReactionResponse, AddCommentRequest, AddCommentResponse, AddCommentsBatchRequest, AddCommentsBatchResponse, AddReactionRequest, AddReactionResponse, CastPollVoteRequest, CreateCollectionsRequest, CreateCollectionsResponse, CreateFeedGroupRequest, CreateFeedGroupResponse, CreateFeedViewRequest, CreateFeedViewResponse, CreateFeedsBatchRequest, CreateFeedsBatchResponse, CreateMembershipLevelRequest, CreateMembershipLevelResponse, DeleteActivitiesRequest, DeleteActivitiesResponse, DeleteActivityReactionResponse, DeleteActivityResponse, DeleteBookmarkFolderResponse, DeleteBookmarkResponse, DeleteCollectionsResponse, DeleteCommentBookmarkResponse, DeleteCommentReactionResponse, DeleteCommentResponse, DeleteFeedGroupResponse, DeleteFeedResponse, DeleteFeedUserDataRequest, DeleteFeedUserDataResponse, DeleteFeedViewResponse, DeleteFeedsBatchRequest, DeleteFeedsBatchResponse, ExportFeedUserDataResponse, FollowBatchRequest, FollowBatchResponse, FollowRequest, GetActivityResponse, GetCommentRepliesResponse, GetCommentResponse, GetCommentsResponse, GetFeedGroupResponse, GetFeedViewResponse, GetFeedVisibilityResponse, GetFeedsRateLimitsResponse, GetFollowSuggestionsResponse, GetOrCreateFeedGroupRequest, GetOrCreateFeedGroupResponse, GetOrCreateFeedRequest, GetOrCreateFeedResponse, GetOrCreateFeedViewRequest, GetOrCreateFeedViewResponse, GetOrCreateFollowResponse, GetOrCreateUnfollowRequest, GetOrCreateUnfollowResponse, ListFeedGroupsResponse, ListFeedViewsResponse, ListFeedVisibilitiesResponse, MarkActivityRequest, OwnBatchRequest, OwnBatchResponse, PinActivityRequest, PinActivityResponse, PollVoteResponse, QueryActivitiesRequest, QueryActivitiesResponse, QueryActivityReactionsRequest, QueryActivityReactionsResponse, QueryBookmarkFoldersRequest, QueryBookmarkFoldersResponse, QueryBookmarksRequest, QueryBookmarksResponse, QueryCollectionsRequest, QueryCollectionsResponse, QueryCommentReactionsRequest, QueryCommentReactionsResponse, QueryCommentsRequest, QueryCommentsResponse, QueryFeedMembersRequest, QueryFeedMembersResponse, QueryFeedsRequest, QueryFeedsResponse, QueryFeedsUsageStatsRequest, QueryFeedsUsageStatsResponse, QueryFollowsRequest, QueryFollowsResponse, QueryMembershipLevelsRequest, QueryMembershipLevelsResponse, QueryPinnedActivitiesRequest, QueryPinnedActivitiesResponse, QueryRevisionHistoryRequest, QueryRevisionHistoryResponse, ReadCollectionsResponse, RejectFeedMemberInviteRequest, RejectFeedMemberInviteResponse, RejectFollowRequest, RejectFollowResponse, Response, RestoreActivityRequest, RestoreActivityResponse, RestoreCommentRequest, RestoreCommentResponse, RestoreFeedGroupResponse, SingleFollowResponse, TrackActivityMetricsRequest, TrackActivityMetricsResponse, UnfollowBatchRequest, UnfollowBatchResponse, UnfollowResponse, UnpinActivityResponse, UpdateActivitiesPartialBatchRequest, UpdateActivitiesPartialBatchResponse, UpdateActivityPartialRequest, UpdateActivityPartialResponse, UpdateActivityRequest, UpdateActivityResponse, UpdateBookmarkFolderRequest, UpdateBookmarkFolderResponse, UpdateBookmarkRequest, UpdateBookmarkResponse, UpdateCollectionsRequest, UpdateCollectionsResponse, UpdateCommentBookmarkRequest, UpdateCommentBookmarkResponse, UpdateCommentPartialRequest, UpdateCommentPartialResponse, UpdateCommentRequest, UpdateCommentResponse, UpdateFeedGroupRequest, UpdateFeedGroupResponse, UpdateFeedMembersRequest, UpdateFeedMembersResponse, UpdateFeedRequest, UpdateFeedResponse, UpdateFeedViewRequest, UpdateFeedViewResponse, UpdateFeedVisibilityRequest, UpdateFeedVisibilityResponse, UpdateFollowRequest, UpdateFollowResponse, UpdateMembershipLevelRequest, UpdateMembershipLevelResponse, UpsertActivitiesRequest, UpsertActivitiesResponse, UpsertCollectionsRequest, UpsertCollectionsResponse } from '../models';
3
3
  export declare class FeedsApi {
4
4
  readonly apiClient: ApiClient;
5
5
  constructor(apiClient: ApiClient);
@@ -267,6 +267,7 @@ export declare class FeedsApi {
267
267
  getOrCreateFollows(request: FollowBatchRequest): Promise<StreamResponse<FollowBatchResponse>>;
268
268
  queryFollows(request?: QueryFollowsRequest): Promise<StreamResponse<QueryFollowsResponse>>;
269
269
  rejectFollow(request: RejectFollowRequest): Promise<StreamResponse<RejectFollowResponse>>;
270
+ getOrCreateFollow(request: FollowRequest): Promise<StreamResponse<GetOrCreateFollowResponse>>;
270
271
  unfollow(request: {
271
272
  source: string;
272
273
  target: string;
@@ -286,6 +287,7 @@ export declare class FeedsApi {
286
287
  queryFeedsUsageStats(request?: QueryFeedsUsageStatsRequest): Promise<StreamResponse<QueryFeedsUsageStatsResponse>>;
287
288
  unfollowBatch(request: UnfollowBatchRequest): Promise<StreamResponse<UnfollowBatchResponse>>;
288
289
  getOrCreateUnfollows(request: UnfollowBatchRequest): Promise<StreamResponse<UnfollowBatchResponse>>;
290
+ getOrCreateUnfollow(request: GetOrCreateUnfollowRequest): Promise<StreamResponse<GetOrCreateUnfollowResponse>>;
289
291
  deleteFeedUserData(request: DeleteFeedUserDataRequest & {
290
292
  user_id: string;
291
293
  }): Promise<StreamResponse<DeleteFeedUserDataResponse>>;
@@ -7760,6 +7760,48 @@ export interface GetOrCreateFeedViewResponse {
7760
7760
  was_created: boolean;
7761
7761
  feed_view: FeedViewResponse;
7762
7762
  }
7763
+ export interface GetOrCreateFollowResponse {
7764
+ /**
7765
+ * True if the follow was newly created by this request; false if it already existed
7766
+ */
7767
+ created: boolean;
7768
+ duration: string;
7769
+ follow: FollowResponse;
7770
+ /**
7771
+ * Whether a notification activity was successfully created (only set when the follow was newly created)
7772
+ */
7773
+ notification_created?: boolean;
7774
+ }
7775
+ export interface GetOrCreateUnfollowRequest {
7776
+ /**
7777
+ * Fully qualified ID of the source feed
7778
+ */
7779
+ source: string;
7780
+ /**
7781
+ * Fully qualified ID of the target feed
7782
+ */
7783
+ target: string;
7784
+ /**
7785
+ * Whether to delete the corresponding notification activity (default: false)
7786
+ */
7787
+ delete_notification_activity?: boolean;
7788
+ /**
7789
+ * If true, enriches the follow's source_feed and target_feed with own_* fields (own_follows, own_followings, own_capabilities, own_membership). Defaults to false for performance.
7790
+ */
7791
+ enrich_own_fields?: boolean;
7792
+ /**
7793
+ * When true, activities from the unfollowed feed will remain in the source feed's timeline (default: false)
7794
+ */
7795
+ keep_history?: boolean;
7796
+ }
7797
+ export interface GetOrCreateUnfollowResponse {
7798
+ /**
7799
+ * True if a follow was found and removed by this request; false if no follow existed
7800
+ */
7801
+ deleted: boolean;
7802
+ duration: string;
7803
+ follow?: FollowResponse;
7804
+ }
7763
7805
  export interface GetPushTemplatesResponse {
7764
7806
  /**
7765
7807
  * Duration of the request in milliseconds
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stream-io/node-sdk",
3
- "version": "0.7.57",
3
+ "version": "0.7.58",
4
4
  "description": "",
5
5
  "exports": {
6
6
  ".": {
@@ -67,6 +67,9 @@ import {
67
67
  GetOrCreateFeedResponse,
68
68
  GetOrCreateFeedViewRequest,
69
69
  GetOrCreateFeedViewResponse,
70
+ GetOrCreateFollowResponse,
71
+ GetOrCreateUnfollowRequest,
72
+ GetOrCreateUnfollowResponse,
70
73
  ListFeedGroupsResponse,
71
74
  ListFeedViewsResponse,
72
75
  ListFeedVisibilitiesResponse,
@@ -2568,6 +2571,39 @@ export class FeedsApi {
2568
2571
  return { ...response.body, metadata: response.metadata };
2569
2572
  }
2570
2573
 
2574
+ async getOrCreateFollow(
2575
+ request: FollowRequest,
2576
+ ): Promise<StreamResponse<GetOrCreateFollowResponse>> {
2577
+ const body = {
2578
+ source: request?.source,
2579
+ target: request?.target,
2580
+ activity_copy_limit: request?.activity_copy_limit,
2581
+ copy_custom_to_notification: request?.copy_custom_to_notification,
2582
+ create_notification_activity: request?.create_notification_activity,
2583
+ create_users: request?.create_users,
2584
+ enrich_own_fields: request?.enrich_own_fields,
2585
+ push_preference: request?.push_preference,
2586
+ skip_push: request?.skip_push,
2587
+ status: request?.status,
2588
+ custom: request?.custom,
2589
+ };
2590
+
2591
+ const response = await this.apiClient.sendRequest<
2592
+ StreamResponse<GetOrCreateFollowResponse>
2593
+ >(
2594
+ 'POST',
2595
+ '/api/v2/feeds/follows/upsert',
2596
+ undefined,
2597
+ undefined,
2598
+ body,
2599
+ 'application/json',
2600
+ );
2601
+
2602
+ decoders.GetOrCreateFollowResponse?.(response.body);
2603
+
2604
+ return { ...response.body, metadata: response.metadata };
2605
+ }
2606
+
2571
2607
  async unfollow(request: {
2572
2608
  source: string;
2573
2609
  target: string;
@@ -2804,6 +2840,33 @@ export class FeedsApi {
2804
2840
  return { ...response.body, metadata: response.metadata };
2805
2841
  }
2806
2842
 
2843
+ async getOrCreateUnfollow(
2844
+ request: GetOrCreateUnfollowRequest,
2845
+ ): Promise<StreamResponse<GetOrCreateUnfollowResponse>> {
2846
+ const body = {
2847
+ source: request?.source,
2848
+ target: request?.target,
2849
+ delete_notification_activity: request?.delete_notification_activity,
2850
+ enrich_own_fields: request?.enrich_own_fields,
2851
+ keep_history: request?.keep_history,
2852
+ };
2853
+
2854
+ const response = await this.apiClient.sendRequest<
2855
+ StreamResponse<GetOrCreateUnfollowResponse>
2856
+ >(
2857
+ 'POST',
2858
+ '/api/v2/feeds/unfollow/upsert',
2859
+ undefined,
2860
+ undefined,
2861
+ body,
2862
+ 'application/json',
2863
+ );
2864
+
2865
+ decoders.GetOrCreateUnfollowResponse?.(response.body);
2866
+
2867
+ return { ...response.body, metadata: response.metadata };
2868
+ }
2869
+
2807
2870
  async deleteFeedUserData(
2808
2871
  request: DeleteFeedUserDataRequest & { user_id: string },
2809
2872
  ): Promise<StreamResponse<DeleteFeedUserDataResponse>> {
@@ -2767,6 +2767,20 @@ decoders.GetOrCreateFeedViewResponse = (input?: Record<string, any>) => {
2767
2767
  return decode(typeMappings, input);
2768
2768
  };
2769
2769
 
2770
+ decoders.GetOrCreateFollowResponse = (input?: Record<string, any>) => {
2771
+ const typeMappings: TypeMapping = {
2772
+ follow: { type: 'FollowResponse', isSingle: true },
2773
+ };
2774
+ return decode(typeMappings, input);
2775
+ };
2776
+
2777
+ decoders.GetOrCreateUnfollowResponse = (input?: Record<string, any>) => {
2778
+ const typeMappings: TypeMapping = {
2779
+ follow: { type: 'FollowResponse', isSingle: true },
2780
+ };
2781
+ return decode(typeMappings, input);
2782
+ };
2783
+
2770
2784
  decoders.GetPushTemplatesResponse = (input?: Record<string, any>) => {
2771
2785
  const typeMappings: TypeMapping = {
2772
2786
  templates: { type: 'PushTemplateResponse', isSingle: false },
@@ -11165,6 +11165,60 @@ export interface GetOrCreateFeedViewResponse {
11165
11165
  feed_view: FeedViewResponse;
11166
11166
  }
11167
11167
 
11168
+ export interface GetOrCreateFollowResponse {
11169
+ /**
11170
+ * True if the follow was newly created by this request; false if it already existed
11171
+ */
11172
+ created: boolean;
11173
+
11174
+ duration: string;
11175
+
11176
+ follow: FollowResponse;
11177
+
11178
+ /**
11179
+ * Whether a notification activity was successfully created (only set when the follow was newly created)
11180
+ */
11181
+ notification_created?: boolean;
11182
+ }
11183
+
11184
+ export interface GetOrCreateUnfollowRequest {
11185
+ /**
11186
+ * Fully qualified ID of the source feed
11187
+ */
11188
+ source: string;
11189
+
11190
+ /**
11191
+ * Fully qualified ID of the target feed
11192
+ */
11193
+ target: string;
11194
+
11195
+ /**
11196
+ * Whether to delete the corresponding notification activity (default: false)
11197
+ */
11198
+ delete_notification_activity?: boolean;
11199
+
11200
+ /**
11201
+ * If true, enriches the follow's source_feed and target_feed with own_* fields (own_follows, own_followings, own_capabilities, own_membership). Defaults to false for performance.
11202
+ */
11203
+ enrich_own_fields?: boolean;
11204
+
11205
+ /**
11206
+ * When true, activities from the unfollowed feed will remain in the source feed's timeline (default: false)
11207
+ */
11208
+ keep_history?: boolean;
11209
+ }
11210
+
11211
+ export interface GetOrCreateUnfollowResponse {
11212
+ /**
11213
+ * True if a follow was found and removed by this request; false if no follow existed
11214
+ */
11215
+ deleted: boolean;
11216
+
11217
+ duration: string;
11218
+
11219
+ follow?: FollowResponse;
11220
+ }
11221
+
11168
11222
  export interface GetPushTemplatesResponse {
11169
11223
  /**
11170
11224
  * Duration of the request in milliseconds