diff --git a/src/StreamFeedsClient.ts b/src/StreamFeedsClient.ts index 3ca92be..a8fb456 100644 --- a/src/StreamFeedsClient.ts +++ b/src/StreamFeedsClient.ts @@ -1,5 +1,10 @@ import { FeedsApi } from './gen/feeds/FeedsApi'; -import { AddReactionRequest, QueryFeedsRequest } from './gen/models'; +import { + AddReactionRequest, + FollowBatchRequest, + QueryFeedsRequest, + UnfollowBatchRequest, +} from './gen/models'; import { StreamFeed } from './StreamFeed'; export class StreamFeedsClient extends FeedsApi { @@ -17,4 +22,18 @@ export class StreamFeedsClient extends FeedsApi { addReaction = (request: AddReactionRequest & { activity_id: string }) => { return super.addActivityReaction(request); }; + + /** + * @deprecated use `getOrCreateFollows` instead + */ + followBatch = (request: FollowBatchRequest) => { + return super.followBatch(request); + }; + + /** + * @deprecated use `getOrCreateUnfollows` instead + */ + followUnbatch = (request: UnfollowBatchRequest) => { + return super.unfollowBatch(request); + }; } diff --git a/src/gen/feeds/FeedsApi.ts b/src/gen/feeds/FeedsApi.ts index c743c38..6cd8dab 100644 --- a/src/gen/feeds/FeedsApi.ts +++ b/src/gen/feeds/FeedsApi.ts @@ -43,6 +43,8 @@ import { DeleteFeedUserDataRequest, DeleteFeedUserDataResponse, DeleteFeedViewResponse, + DeleteFeedsBatchRequest, + DeleteFeedsBatchResponse, ExportFeedUserDataResponse, FollowBatchRequest, FollowBatchResponse, @@ -66,8 +68,8 @@ import { ListFeedViewsResponse, ListFeedVisibilitiesResponse, MarkActivityRequest, - OwnCapabilitiesBatchRequest, - OwnCapabilitiesBatchResponse, + OwnBatchRequest, + OwnBatchResponse, PinActivityRequest, PinActivityResponse, PollVoteResponse, @@ -1237,6 +1239,7 @@ export class FeedsApi { view: request?.view, watch: request?.watch, data: request?.data, + enrichment_options: request?.enrichment_options, external_ranking: request?.external_ranking, filter: request?.filter, followers_pagination: request?.followers_pagination, @@ -1849,27 +1852,52 @@ export class FeedsApi { return { ...response.body, metadata: response.metadata }; } - async ownCapabilitiesBatch( - request: OwnCapabilitiesBatchRequest, - ): Promise> { + async deleteFeedsBatch( + request: DeleteFeedsBatchRequest, + ): Promise> { + const body = { + feeds: request?.feeds, + hard_delete: request?.hard_delete, + }; + + const response = await this.apiClient.sendRequest< + StreamResponse + >( + 'POST', + '/api/v2/feeds/feeds/delete', + undefined, + undefined, + body, + 'application/json', + ); + + decoders.DeleteFeedsBatchResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + } + + async ownBatch( + request: OwnBatchRequest, + ): Promise> { const body = { feeds: request?.feeds, user_id: request?.user_id, + fields: request?.fields, user: request?.user, }; const response = await this.apiClient.sendRequest< - StreamResponse + StreamResponse >( 'POST', - '/api/v2/feeds/feeds/own_capabilities/batch', + '/api/v2/feeds/feeds/own/batch', undefined, undefined, body, 'application/json', ); - decoders.OwnCapabilitiesBatchResponse?.(response.body); + decoders.OwnBatchResponse?.(response.body); return { ...response.body, metadata: response.metadata }; } @@ -2031,6 +2059,29 @@ export class FeedsApi { return { ...response.body, metadata: response.metadata }; } + async getOrCreateFollows( + request: FollowBatchRequest, + ): Promise> { + const body = { + follows: request?.follows, + }; + + const response = await this.apiClient.sendRequest< + StreamResponse + >( + 'POST', + '/api/v2/feeds/follows/batch/upsert', + undefined, + undefined, + body, + 'application/json', + ); + + decoders.FollowBatchResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + } + async queryFollows( request?: QueryFollowsRequest, ): Promise> { @@ -2256,6 +2307,29 @@ export class FeedsApi { return { ...response.body, metadata: response.metadata }; } + async getOrCreateUnfollows( + request: UnfollowBatchRequest, + ): Promise> { + const body = { + follows: request?.follows, + }; + + const response = await this.apiClient.sendRequest< + StreamResponse + >( + 'POST', + '/api/v2/feeds/unfollow/batch/upsert', + undefined, + undefined, + body, + 'application/json', + ); + + decoders.UnfollowBatchResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + } + async deleteFeedUserData( request: DeleteFeedUserDataRequest & { user_id: string }, ): Promise> { diff --git a/src/gen/model-decoders/decoders.ts b/src/gen/model-decoders/decoders.ts index 3d1bbf5..34842d7 100644 --- a/src/gen/model-decoders/decoders.ts +++ b/src/gen/model-decoders/decoders.ts @@ -2094,6 +2094,15 @@ decoders.FeedMemberUpdatedEvent = (input?: Record) => { return decode(typeMappings, input); }; +decoders.FeedOwnData = (input?: Record) => { + const typeMappings: TypeMapping = { + own_follows: { type: 'FollowResponse', isSingle: false }, + + own_membership: { type: 'FeedMemberResponse', isSingle: true }, + }; + return decode(typeMappings, input); +}; + decoders.FeedResponse = (input?: Record) => { const typeMappings: TypeMapping = { created_at: { type: 'DatetimeType', isSingle: true }, @@ -2195,6 +2204,8 @@ decoders.FlagUpdatedEvent = (input?: Record) => { decoders.FollowBatchResponse = (input?: Record) => { const typeMappings: TypeMapping = { + created: { type: 'FollowResponse', isSingle: false }, + follows: { type: 'FollowResponse', isSingle: false }, }; return decode(typeMappings, input); @@ -3164,6 +3175,13 @@ decoders.NotificationStatusResponse = (input?: Record) => { return decode(typeMappings, input); }; +decoders.OwnBatchResponse = (input?: Record) => { + const typeMappings: TypeMapping = { + data: { type: 'FeedOwnData', isSingle: false }, + }; + return decode(typeMappings, input); +}; + decoders.OwnUser = (input?: Record) => { const typeMappings: TypeMapping = { created_at: { type: 'DatetimeType', isSingle: true }, @@ -3490,6 +3508,21 @@ decoders.QueryCallSessionParticipantStatsTimelineResponse = ( return decode(typeMappings, input); }; +decoders.QueryCallStatsMapResponse = (input?: Record) => { + const typeMappings: TypeMapping = { + call_ended_at: { type: 'DatetimeType', isSingle: true }, + + call_started_at: { type: 'DatetimeType', isSingle: true }, + + end_time: { type: 'DatetimeType', isSingle: true }, + + generated_at: { type: 'DatetimeType', isSingle: true }, + + start_time: { type: 'DatetimeType', isSingle: true }, + }; + return decode(typeMappings, input); +}; + decoders.QueryCallStatsResponse = (input?: Record) => { const typeMappings: TypeMapping = { reports: { type: 'CallStatsReportSummaryResponse', isSingle: false }, diff --git a/src/gen/models/index.ts b/src/gen/models/index.ts index 6be3717..c553b50 100644 --- a/src/gen/models/index.ts +++ b/src/gen/models/index.ts @@ -2384,6 +2384,56 @@ export interface CallStatsLocation { subdivision?: string; } +export interface CallStatsMapLocation { + count: number; + + live_count: number; + + location?: CallStatsLocation; +} + +export interface CallStatsMapPublisher { + is_live: boolean; + + user_id: string; + + user_session_id: string; + + published_tracks: PublishedTrackFlags; + + name?: string; + + publisher_type?: string; + + location?: CallStatsLocation; +} + +export interface CallStatsMapPublishers { + publishers: CallStatsMapPublisher[]; +} + +export interface CallStatsMapSFUs { + locations: SFULocationResponse[]; +} + +export interface CallStatsMapSubscriber { + is_live: boolean; + + user_id: string; + + user_session_id: string; + + name?: string; + + location?: CallStatsLocation; +} + +export interface CallStatsMapSubscribers { + locations: CallStatsMapLocation[]; + + participants?: CallStatsMapSubscriber[]; +} + export interface CallStatsParticipant { user_id: string; @@ -4039,6 +4089,12 @@ export interface ContentCountRuleParameters { time_window?: string; } +export interface Coordinates { + latitude: number; + + longitude: number; +} + export interface CountByMinuteResponse { count: number; @@ -4786,6 +4842,18 @@ export interface DeleteFeedViewResponse { duration: string; } +export interface DeleteFeedsBatchRequest { + feeds: string[]; + + hard_delete?: boolean; +} + +export interface DeleteFeedsBatchResponse { + duration: string; + + task_id: string; +} + export interface DeleteMessageRequest { hard_delete?: boolean; @@ -5140,6 +5208,42 @@ export interface EnrichedReaction { user?: Data; } +export interface EnrichmentOptions { + skip_activity?: boolean; + + skip_activity_collections?: boolean; + + skip_activity_comments?: boolean; + + skip_activity_current_feed?: boolean; + + skip_activity_mentioned_users?: boolean; + + skip_activity_own_bookmarks?: boolean; + + skip_activity_parents?: boolean; + + skip_activity_poll?: boolean; + + skip_activity_reactions?: boolean; + + skip_activity_refresh_image_urls?: boolean; + + skip_all?: boolean; + + skip_feed_member_user?: boolean; + + skip_followers?: boolean; + + skip_following?: boolean; + + skip_own_capabilities?: boolean; + + skip_own_follows?: boolean; + + skip_pins?: boolean; +} + export interface EntityCreatorResponse { ban_count: number; @@ -5614,6 +5718,14 @@ export const FeedOwnCapability = { export type FeedOwnCapability = (typeof FeedOwnCapability)[keyof typeof FeedOwnCapability]; +export interface FeedOwnData { + own_capabilities?: FeedOwnCapability[]; + + own_follows?: FollowResponse[]; + + own_membership?: FeedMemberResponse; +} + export interface FeedRequest { feed_group_id: string; @@ -5635,6 +5747,8 @@ export interface FeedRequest { } export interface FeedResponse { + activity_count: number; + created_at: Date; description: string; @@ -5675,6 +5789,8 @@ export interface FeedResponse { } export interface FeedSuggestionResponse { + activity_count: number; + created_at: Date; description: string; @@ -5989,6 +6105,8 @@ export interface FollowBatchRequest { export interface FollowBatchResponse { duration: string; + created: FollowResponse[]; + follows: FollowResponse[]; } @@ -6630,6 +6748,8 @@ export interface GetOrCreateFeedRequest { data?: FeedInput; + enrichment_options?: EnrichmentOptions; + external_ranking?: Record; filter?: Record; @@ -7330,6 +7450,14 @@ export interface ListTranscriptionsResponse { transcriptions: CallTranscription[]; } +export interface Location { + continent_code: string; + + country_iso_code: string; + + subdivision_iso_code: string; +} + export interface MarkActivityRequest { mark_all_read?: boolean; @@ -8584,18 +8712,20 @@ export interface OverviewDashboardConfig { visible_charts?: string[]; } -export interface OwnCapabilitiesBatchRequest { +export interface OwnBatchRequest { feeds: string[]; user_id?: string; + fields?: string[]; + user?: UserRequest; } -export interface OwnCapabilitiesBatchResponse { +export interface OwnBatchResponse { duration: string; - capabilities: Record; + data: Record; } export const OwnCapability = { @@ -9722,6 +9852,36 @@ export interface QueryCallSessionParticipantStatsTimelineResponse { events: CallParticipantTimeline[]; } +export interface QueryCallStatsMapResponse { + call_id: string; + + call_session_id: string; + + call_type: string; + + duration: string; + + counts: CallStatsParticipantCounts; + + call_ended_at?: Date; + + call_started_at?: Date; + + data_source?: string; + + end_time?: Date; + + generated_at?: Date; + + start_time?: Date; + + publishers?: CallStatsMapPublishers; + + sfus?: CallStatsMapSFUs; + + subscribers?: CallStatsMapSubscribers; +} + export interface QueryCallStatsRequest { limit?: number; @@ -11150,6 +11310,18 @@ export interface SDKUsageReportResponse { daily: DailyAggregateSDKUsageReportResponse[]; } +export interface SFULocationResponse { + datacenter: string; + + id: string; + + coordinates: Coordinates; + + location: Location; + + count?: number; +} + export interface SIPCallConfigsRequest { custom_data?: Record; } diff --git a/src/gen/video/VideoApi.ts b/src/gen/video/VideoApi.ts index a19ec9d..a1dc9d4 100644 --- a/src/gen/video/VideoApi.ts +++ b/src/gen/video/VideoApi.ts @@ -44,6 +44,7 @@ import { QueryCallParticipantsResponse, QueryCallSessionParticipantStatsResponse, QueryCallSessionParticipantStatsTimelineResponse, + QueryCallStatsMapResponse, QueryCallStatsRequest, QueryCallStatsResponse, QueryCallsRequest, @@ -1256,6 +1257,43 @@ export class VideoApi { return { ...response.body, metadata: response.metadata }; } + async getCallStatsMap(request: { + call_type: string; + call_id: string; + session: string; + start_time?: Date; + end_time?: Date; + exclude_publishers?: boolean; + exclude_subscribers?: boolean; + exclude_sfus?: boolean; + }): Promise> { + const queryParams = { + start_time: request?.start_time, + end_time: request?.end_time, + exclude_publishers: request?.exclude_publishers, + exclude_subscribers: request?.exclude_subscribers, + exclude_sfus: request?.exclude_sfus, + }; + const pathParams = { + call_type: request?.call_type, + call_id: request?.call_id, + session: request?.session, + }; + + const response = await this.apiClient.sendRequest< + StreamResponse + >( + 'GET', + '/api/v2/video/call_stats/{call_type}/{call_id}/{session}/map', + pathParams, + queryParams, + ); + + decoders.QueryCallStatsMapResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + } + async getCallSessionParticipantStatsDetails(request: { call_type: string; call_id: string;