diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..54c6511 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +v24 diff --git a/__tests__/ring-call.test.ts b/__tests__/ring-call.test.ts new file mode 100644 index 0000000..9eb4f9f --- /dev/null +++ b/__tests__/ring-call.test.ts @@ -0,0 +1,63 @@ +import { beforeAll, describe, expect, it } from 'vitest'; +import { createTestClient } from './create-test-client'; +import { StreamCall } from '../src/StreamCall'; +import { StreamClient } from '../src/StreamClient'; +import { v4 as uuidv4 } from 'uuid'; + +describe('ring call API', () => { + let client: StreamClient; + const callId = `call${uuidv4()}`; + let call: StreamCall; + + beforeAll(async () => { + client = createTestClient(); + + call = client.video.call('default', callId); + + await client.upsertUsers([ + { id: 'myself' }, + { id: 'my-friend' }, + { id: 'my-other-friend' }, + ]); + }); + + it(`create call without ringing`, async () => { + const response = await call.getOrCreate({ + ring: false, // set to false to avoid ringing the whole call + data: { + created_by_id: 'myself', + members: [{ user_id: 'myself' }, { user_id: 'my-friend' }], + }, + }); + + // Dummy expect + expect(response.call.id).toBe(callId); + }); + + it(`ring my-friend`, async () => { + const response = await call.ring({ members_ids: ['my-friend'] }); + expect(response.members_ids).toEqual(['my-friend']); + }); + + it(`ring my-other-friend`, async () => { + await call.updateCallMembers({ + update_members: [{ user_id: 'my-other-friend' }], + }); + const response = await call.ring({ members_ids: ['my-other-friend'] }); + expect(response.members_ids).toEqual(['my-other-friend']); + }); + + it('delete call', async () => { + try { + await call.delete({ hard: true }); + } catch (e) { + // the first request fails on backend sometimes + // retry it + await new Promise((resolve) => { + setTimeout(() => resolve(), 2000); + }); + + await call.delete({ hard: true }); + } + }); +}); diff --git a/src/gen/chat/ChatApi.ts b/src/gen/chat/ChatApi.ts index 7a77c93..1169663 100644 --- a/src/gen/chat/ChatApi.ts +++ b/src/gen/chat/ChatApi.ts @@ -36,6 +36,8 @@ import { ListChannelTypesResponse, ListCommandsResponse, MarkChannelsReadRequest, + MarkDeliveredRequest, + MarkDeliveredResponse, MarkReadRequest, MarkReadResponse, MarkUnreadRequest, @@ -278,6 +280,32 @@ export class ChatApi { return { ...response.body, metadata: response.metadata }; } + async markDelivered( + request?: MarkDeliveredRequest & { user_id?: string }, + ): Promise> { + const queryParams = { + user_id: request?.user_id, + }; + const body = { + latest_delivered_messages: request?.latest_delivered_messages, + }; + + const response = await this.apiClient.sendRequest< + StreamResponse + >( + 'POST', + '/api/v2/chat/channels/delivered', + undefined, + queryParams, + body, + 'application/json', + ); + + decoders.MarkDeliveredResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + } + async markChannelsRead( request?: MarkChannelsReadRequest, ): Promise> { @@ -398,14 +426,17 @@ export class ChatApi { accept_invite: request?.accept_invite, cooldown: request?.cooldown, hide_history: request?.hide_history, + hide_history_before: request?.hide_history_before, reject_invite: request?.reject_invite, skip_push: request?.skip_push, user_id: request?.user_id, + add_filter_tags: request?.add_filter_tags, add_members: request?.add_members, add_moderators: request?.add_moderators, assign_roles: request?.assign_roles, demote_moderators: request?.demote_moderators, invites: request?.invites, + remove_filter_tags: request?.remove_filter_tags, remove_members: request?.remove_members, data: request?.data, message: request?.message, @@ -875,6 +906,7 @@ export class ChatApi { }; const body = { message_id: request?.message_id, + message_timestamp: request?.message_timestamp, thread_id: request?.thread_id, user_id: request?.user_id, user: request?.user, @@ -2122,10 +2154,16 @@ export class ChatApi { return { ...response.body, metadata: response.metadata }; } - async unreadCounts(): Promise> { + async unreadCounts(request?: { + user_id?: string; + }): Promise> { + const queryParams = { + user_id: request?.user_id, + }; + const response = await this.apiClient.sendRequest< StreamResponse - >('GET', '/api/v2/chat/unread', undefined, undefined); + >('GET', '/api/v2/chat/unread', undefined, queryParams); decoders.WrappedUnreadCountsResponse?.(response.body); diff --git a/src/gen/model-decoders/decoders.ts b/src/gen/model-decoders/decoders.ts index 78432ea..ee1c141 100644 --- a/src/gen/model-decoders/decoders.ts +++ b/src/gen/model-decoders/decoders.ts @@ -533,6 +533,8 @@ decoders.BookmarkFolderResponse = (input?: Record) => { created_at: { type: 'DatetimeType', isSingle: true }, updated_at: { type: 'DatetimeType', isSingle: true }, + + user: { type: 'UserResponseCommonFields', isSingle: true }, }; return decode(typeMappings, input); }; @@ -558,7 +560,7 @@ decoders.BookmarkResponse = (input?: Record) => { activity: { type: 'ActivityResponse', isSingle: true }, - user: { type: 'UserResponse', isSingle: true }, + user: { type: 'UserResponseCommonFields', isSingle: true }, folder: { type: 'BookmarkFolderResponse', isSingle: true }, }; @@ -1258,14 +1260,12 @@ decoders.ChannelHiddenEvent = (input?: Record) => { decoders.ChannelMember = (input?: Record) => { const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - archived_at: { type: 'DatetimeType', isSingle: true }, ban_expires: { type: 'DatetimeType', isSingle: true }, + created_at: { type: 'DatetimeType', isSingle: true }, + deleted_at: { type: 'DatetimeType', isSingle: true }, invite_accepted_at: { type: 'DatetimeType', isSingle: true }, @@ -1274,6 +1274,8 @@ decoders.ChannelMember = (input?: Record) => { pinned_at: { type: 'DatetimeType', isSingle: true }, + updated_at: { type: 'DatetimeType', isSingle: true }, + user: { type: 'User', isSingle: true }, }; return decode(typeMappings, input); @@ -1335,7 +1337,7 @@ decoders.ChannelMutedEvent = (input?: Record) => { return decode(typeMappings, input); }; -decoders.ChannelPushPreferences = (input?: Record) => { +decoders.ChannelPushPreferencesResponse = (input?: Record) => { const typeMappings: TypeMapping = { disabled_until: { type: 'DatetimeType', isSingle: true }, }; @@ -1398,7 +1400,10 @@ decoders.ChannelStateResponse = (input?: Record) => { membership: { type: 'ChannelMemberResponse', isSingle: true }, - push_preferences: { type: 'ChannelPushPreferences', isSingle: true }, + push_preferences: { + type: 'ChannelPushPreferencesResponse', + isSingle: true, + }, }; return decode(typeMappings, input); }; @@ -1432,7 +1437,10 @@ decoders.ChannelStateResponseFields = (input?: Record) => { membership: { type: 'ChannelMemberResponse', isSingle: true }, - push_preferences: { type: 'ChannelPushPreferences', isSingle: true }, + push_preferences: { + type: 'ChannelPushPreferencesResponse', + isSingle: true, + }, }; return decode(typeMappings, input); }; @@ -1745,6 +1753,13 @@ decoders.CreateRoleResponse = (input?: Record) => { return decode(typeMappings, input); }; +decoders.CreateSIPTrunkResponse = (input?: Record) => { + const typeMappings: TypeMapping = { + sip_trunk: { type: 'SIPTrunkResponse', isSingle: true }, + }; + return decode(typeMappings, input); +}; + decoders.CustomCheckResponse = (input?: Record) => { const typeMappings: TypeMapping = { item: { type: 'ReviewQueueItemResponse', isSingle: true }, @@ -2460,7 +2475,7 @@ decoders.GetPushTemplatesResponse = (input?: Record) => { decoders.GetReactionsResponse = (input?: Record) => { const typeMappings: TypeMapping = { - reactions: { type: 'Reaction', isSingle: false }, + reactions: { type: 'ReactionResponse', isSingle: false }, }; return decode(typeMappings, input); }; @@ -2615,6 +2630,23 @@ decoders.ListRolesResponse = (input?: Record) => { return decode(typeMappings, input); }; +decoders.ListSIPInboundRoutingRuleResponse = (input?: Record) => { + const typeMappings: TypeMapping = { + sip_inbound_routing_rules: { + type: 'SIPInboundRoutingRuleResponse', + isSingle: false, + }, + }; + return decode(typeMappings, input); +}; + +decoders.ListSIPTrunksResponse = (input?: Record) => { + const typeMappings: TypeMapping = { + sip_trunks: { type: 'SIPTrunkResponse', isSingle: false }, + }; + return decode(typeMappings, input); +}; + decoders.ListTranscriptionsResponse = (input?: Record) => { const typeMappings: TypeMapping = { transcriptions: { type: 'CallTranscription', isSingle: false }, @@ -3151,7 +3183,7 @@ decoders.OwnUserResponse = (input?: Record) => { revoke_tokens_issued_before: { type: 'DatetimeType', isSingle: true }, - push_preferences: { type: 'PushPreferences', isSingle: true }, + push_preferences: { type: 'PushPreferencesResponse', isSingle: true }, }; return decode(typeMappings, input); }; @@ -3317,6 +3349,13 @@ decoders.PushPreferences = (input?: Record) => { return decode(typeMappings, input); }; +decoders.PushPreferencesResponse = (input?: Record) => { + const typeMappings: TypeMapping = { + disabled_until: { type: 'DatetimeType', isSingle: true }, + }; + return decode(typeMappings, input); +}; + decoders.PushProvider = (input?: Record) => { const typeMappings: TypeMapping = { created_at: { type: 'DatetimeType', isSingle: true }, @@ -3583,13 +3622,6 @@ decoders.QueryRemindersResponse = (input?: Record) => { return decode(typeMappings, input); }; -decoders.QueryReviewQueueResponse = (input?: Record) => { - const typeMappings: TypeMapping = { - items: { type: 'ReviewQueueItemResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - decoders.QuerySegmentTargetsResponse = (input?: Record) => { const typeMappings: TypeMapping = { targets: { type: 'SegmentTargetResponse', isSingle: false }, @@ -3774,9 +3806,9 @@ decoders.ReminderResponseData = (input?: Record) => { channel: { type: 'ChannelResponse', isSingle: true }, - message: { type: 'Message', isSingle: true }, + message: { type: 'MessageResponse', isSingle: true }, - user: { type: 'User', isSingle: true }, + user: { type: 'UserResponse', isSingle: true }, }; return decode(typeMappings, input); }; @@ -3792,6 +3824,15 @@ decoders.ReminderUpdatedEvent = (input?: Record) => { return decode(typeMappings, input); }; +decoders.ResolveSipInboundResponse = (input?: Record) => { + const typeMappings: TypeMapping = { + sip_routing_rule: { type: 'SIPInboundRoutingRuleResponse', isSingle: true }, + + sip_trunk: { type: 'SIPTrunkResponse', isSingle: true }, + }; + return decode(typeMappings, input); +}; + decoders.ReviewQueueItemNewEvent = (input?: Record) => { const typeMappings: TypeMapping = { created_at: { type: 'DatetimeType', isSingle: true }, @@ -3866,6 +3907,24 @@ decoders.Role = (input?: Record) => { return decode(typeMappings, input); }; +decoders.SIPInboundRoutingRuleResponse = (input?: Record) => { + const typeMappings: TypeMapping = { + created_at: { type: 'DatetimeType', isSingle: true }, + + updated_at: { type: 'DatetimeType', isSingle: true }, + }; + return decode(typeMappings, input); +}; + +decoders.SIPTrunkResponse = (input?: Record) => { + const typeMappings: TypeMapping = { + created_at: { type: 'DatetimeType', isSingle: true }, + + updated_at: { type: 'DatetimeType', isSingle: true }, + }; + return decode(typeMappings, input); +}; + decoders.SearchResult = (input?: Record) => { const typeMappings: TypeMapping = { message: { type: 'SearchResultMessage', isSingle: true }, @@ -3965,15 +4024,7 @@ decoders.SendReactionResponse = (input?: Record) => { decoders.SharedLocation = (input?: Record) => { const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - end_at: { type: 'DatetimeType', isSingle: true }, - - channel: { type: 'Channel', isSingle: true }, - - message: { type: 'Message', isSingle: true }, }; return decode(typeMappings, input); }; @@ -4405,6 +4456,25 @@ decoders.UpdateReminderResponse = (input?: Record) => { return decode(typeMappings, input); }; +decoders.UpdateSIPInboundRoutingRuleResponse = ( + input?: Record, +) => { + const typeMappings: TypeMapping = { + sip_inbound_routing_rule: { + type: 'SIPInboundRoutingRuleResponse', + isSingle: true, + }, + }; + return decode(typeMappings, input); +}; + +decoders.UpdateSIPTrunkResponse = (input?: Record) => { + const typeMappings: TypeMapping = { + sip_trunk: { type: 'SIPTrunkResponse', isSingle: true }, + }; + return decode(typeMappings, input); +}; + decoders.UpdateThreadPartialResponse = (input?: Record) => { const typeMappings: TypeMapping = { thread: { type: 'ThreadResponse', isSingle: true }, @@ -4490,19 +4560,7 @@ decoders.User = (input?: Record) => { const typeMappings: TypeMapping = { ban_expires: { type: 'DatetimeType', isSingle: true }, - created_at: { type: 'DatetimeType', isSingle: true }, - - deactivated_at: { type: 'DatetimeType', isSingle: true }, - - deleted_at: { type: 'DatetimeType', isSingle: true }, - - last_active: { type: 'DatetimeType', isSingle: true }, - - last_engaged_at: { type: 'DatetimeType', isSingle: true }, - revoke_tokens_issued_before: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, }; return decode(typeMappings, input); }; diff --git a/src/gen/models/index.ts b/src/gen/models/index.ts index 0eb8592..2658d31 100644 --- a/src/gen/models/index.ts +++ b/src/gen/models/index.ts @@ -1526,6 +1526,8 @@ export interface BookmarkFolderResponse { updated_at: Date; + user: UserResponseCommonFields; + custom?: Record; } @@ -1550,7 +1552,7 @@ export interface BookmarkResponse { activity: ActivityResponse; - user: UserResponse; + user: UserResponseCommonFields; custom?: Record; @@ -2360,6 +2362,8 @@ export interface CallStatsLocation { country?: string; + country_iso_code?: string; + latitude?: number; longitude?: number; @@ -2384,6 +2388,10 @@ export interface CallStatsParticipantCounts { participants: number; + peak_concurrent_sessions: number; + + peak_concurrent_users: number; + publishers: number; sessions: number; @@ -2410,6 +2418,8 @@ export interface CallStatsParticipantSession { ended_at?: Date; + os?: string; + publisher_type?: string; sdk?: string; @@ -2599,6 +2609,14 @@ export interface CallsPerDayReportResponse { daily: DailyAggregateCallsPerDayReportResponse[]; } +export interface CampaignChannelMember { + user_id: string; + + channel_role?: string; + + custom?: Record; +} + export interface CampaignChannelTemplate { type: string; @@ -2609,6 +2627,8 @@ export interface CampaignChannelTemplate { team?: string; members?: string[]; + + members_template?: CampaignChannelMember[]; } export interface CampaignCompletedEvent { @@ -2626,6 +2646,8 @@ export interface CampaignCompletedEvent { export interface CampaignMessageTemplate { poll_id: string; + searchable: boolean; + text: string; attachments: Attachment[]; @@ -2756,6 +2778,8 @@ export interface Channel { active_live_locations?: SharedLocation[]; + filter_tags?: string[]; + invites?: ChannelMember[]; members?: ChannelMember[]; @@ -2832,7 +2856,7 @@ export interface ChannelConfig { partition_size?: number; - partition_ttl?: number; + partition_ttl?: string; allowed_flag_reasons?: string[]; @@ -3012,6 +3036,8 @@ export interface ChannelInput { truncated_by_id?: string; + filter_tags?: string[]; + invites?: ChannelMemberRequest[]; members?: ChannelMemberRequest[]; @@ -3023,29 +3049,41 @@ export interface ChannelInput { custom?: Record; } -export interface ChannelMember { - banned: boolean; +export interface ChannelInputRequest { + auto_translation_enabled?: boolean; - channel_role: string; + auto_translation_language?: string; - created_at: Date; + disabled?: boolean; - is_global_banned: boolean; + frozen?: boolean; - notifications_muted: boolean; + team?: string; - shadow_banned: boolean; + invites?: ChannelMember[]; - updated_at: Date; + members?: ChannelMember[]; - custom: Record; + config_overrides?: ConfigOverrides; + + created_by?: User; + custom?: Record; +} + +export interface ChannelMember { archived_at?: Date; ban_expires?: Date; + banned?: boolean; + blocked?: boolean; + channel_role?: string; + + created_at?: Date; + deleted_at?: Date; hidden?: boolean; @@ -3056,18 +3094,28 @@ export interface ChannelMember { invited?: boolean; + is_global_banned?: boolean; + is_moderator?: boolean; + notifications_muted?: boolean; + pinned_at?: Date; + shadow_banned?: boolean; + status?: string; + updated_at?: Date; + user_id?: string; deleted_messages?: string[]; channel?: DenormalizedChannelFields; + custom?: Record; + user?: User; } @@ -3215,6 +3263,12 @@ export interface ChannelPushPreferences { disabled_until?: Date; } +export interface ChannelPushPreferencesResponse { + chat_level?: string; + + disabled_until?: Date; +} + export interface ChannelResponse { cid: string; @@ -3260,6 +3314,8 @@ export interface ChannelResponse { truncated_at?: Date; + filter_tags?: string[]; + members?: ChannelMemberResponse[]; own_capabilities?: ChannelOwnCapability[]; @@ -3302,7 +3358,7 @@ export interface ChannelStateResponse { membership?: ChannelMemberResponse; - push_preferences?: ChannelPushPreferences; + push_preferences?: ChannelPushPreferencesResponse; } export interface ChannelStateResponseFields { @@ -3334,7 +3390,7 @@ export interface ChannelStateResponseFields { membership?: ChannelMemberResponse; - push_preferences?: ChannelPushPreferences; + push_preferences?: ChannelPushPreferencesResponse; } export interface ChannelTruncatedEvent { @@ -3655,17 +3711,17 @@ export interface CollectionRequest { } export interface CollectionResponse { - created_at: Date; - id: string; name: string; - updated_at: Date; + created_at?: Date; - custom: Record; + updated_at?: Date; user_id?: string; + + custom?: Record; } export interface Command { @@ -3853,10 +3909,6 @@ export interface CommentUpdatedEvent { export interface CommitMessageRequest {} export interface ConfigOverrides { - commands: string[]; - - grants: Record; - blocklist?: string; blocklist_behavior?: 'flag' | 'block'; @@ -3880,6 +3932,10 @@ export interface ConfigOverrides { url_enrichment?: boolean; user_message_reminders?: boolean; + + commands?: string[]; + + grants?: Record; } export interface ConfigResponse { @@ -3939,7 +3995,13 @@ export interface CreateBlockListRequest { team?: string; - type?: 'regex' | 'domain' | 'domain_allowlist' | 'email' | 'word'; + type?: + | 'regex' + | 'domain' + | 'domain_allowlist' + | 'email' + | 'email_allowlist' + | 'word'; } export interface CreateBlockListResponse { @@ -4353,6 +4415,18 @@ export interface CreateRoleResponse { role: Role; } +export interface CreateSIPTrunkRequest { + name: string; + + numbers: string[]; +} + +export interface CreateSIPTrunkResponse { + duration: string; + + sip_trunk?: SIPTrunkResponse; +} + export interface CustomActionRequest { id?: string; @@ -4699,6 +4773,14 @@ export interface DeleteReminderResponse { duration: string; } +export interface DeleteSIPInboundRoutingRuleResponse { + duration: string; +} + +export interface DeleteSIPTrunkResponse { + duration: string; +} + export interface DeleteSegmentTargetsRequest { target_ids: string[]; } @@ -4743,8 +4825,14 @@ export interface DeleteUsersResponse { task_id: string; } +export interface DeliveredMessagePayload { + cid?: string; + + id?: string; +} + export interface DeliveryReceipts { - enabled: boolean; + enabled?: boolean; } export interface DeliveryReceiptsResponse { @@ -4950,19 +5038,19 @@ export interface EnrichedActivity { } export interface EnrichedCollectionResponse { - created_at: Date; - id: string; name: string; status: 'ok' | 'notfound'; - updated_at: Date; + created_at?: Date; - custom: Record; + updated_at?: Date; user_id?: string; + + custom?: Record; } export interface EnrichedReaction { @@ -5623,6 +5711,20 @@ export interface FeedsPreferences { custom_activity_types?: Record; } +export interface FeedsPreferencesResponse { + comment?: string; + + comment_reaction?: string; + + follow?: string; + + mention?: string; + + reaction?: string; + + custom_activity_types?: Record; +} + export interface FeedsReactionResponse { activity_id: string; @@ -5673,6 +5775,12 @@ export interface FileUploadResponse { thumb_url?: string; } +export interface FilterConfigResponse { + llm_labels: string[]; + + ai_text_labels?: string[]; +} + export interface FirebaseConfig { apn_template?: string; @@ -6531,7 +6639,7 @@ export interface GetRateLimitsResponse { export interface GetReactionsResponse { duration: string; - reactions: Reaction[]; + reactions: ReactionResponse[]; } export interface GetRepliesResponse { @@ -7129,6 +7237,18 @@ export interface ListRolesResponse { roles: Role[]; } +export interface ListSIPInboundRoutingRuleResponse { + duration: string; + + sip_inbound_routing_rules: SIPInboundRoutingRuleResponse[]; +} + +export interface ListSIPTrunksResponse { + duration: string; + + sip_trunks: SIPTrunkResponse[]; +} + export interface ListTranscriptionsResponse { duration: string; @@ -7159,6 +7279,14 @@ export interface MarkChannelsReadRequest { user?: UserRequest; } +export interface MarkDeliveredRequest { + latest_delivered_messages?: DeliveredMessagePayload[]; +} + +export interface MarkDeliveredResponse { + duration: string; +} + export interface MarkReadRequest { message_id?: string; @@ -7184,6 +7312,8 @@ export interface MarkReviewedRequest { export interface MarkUnreadRequest { message_id?: string; + message_timestamp?: Date; + thread_id?: string; user_id?: string; @@ -7903,6 +8033,14 @@ export interface MessageWithChannelResponse { shared_location?: SharedLocationResponseData; } +export interface MetricDescriptor { + label: string; + + description?: string; + + unit?: string; +} + export interface MetricThreshold { level: string; @@ -8520,7 +8658,7 @@ export interface OwnUserResponse { privacy_settings?: PrivacySettingsResponse; - push_preferences?: PushPreferences; + push_preferences?: PushPreferencesResponse; teams_role?: Record; @@ -8586,18 +8724,26 @@ export interface ParticipantReportResponse { } export interface ParticipantSeriesPublisherStats { + global_metrics_order?: string[]; + global?: Record; + global_meta?: Record; + global_thresholds?: Record; tracks?: Record; } export interface ParticipantSeriesSubscriberStats { + global_metrics_order?: string[]; + subscriptions?: ParticipantSeriesSubscriptionTrackMetrics[]; global?: Record; + global_meta?: Record; + global_thresholds?: Record; } @@ -8632,14 +8778,22 @@ export interface ParticipantSeriesTrackMetrics { track_type?: string; + metrics_order?: string[]; + metrics?: Record; + metrics_meta?: Record; + thresholds?: Record; } export interface ParticipantSeriesUserStats { + metrics_order?: string[]; + metrics?: Record; + metrics_meta?: Record; + thresholds?: Record; } @@ -9093,6 +9247,18 @@ export interface PushPreferences { feeds_preferences?: FeedsPreferences; } +export interface PushPreferencesResponse { + call_level?: string; + + chat_level?: string; + + disabled_until?: Date; + + feeds_level?: string; + + feeds_preferences?: FeedsPreferencesResponse; +} + export interface PushProvider { created_at: Date; @@ -10041,6 +10207,8 @@ export interface QueryReviewQueueResponse { next?: string; prev?: string; + + filter_config?: FilterConfigResponse; } export interface QuerySegmentTargetsRequest { @@ -10408,7 +10576,7 @@ export interface ReadCollectionsResponse { } export interface ReadReceipts { - enabled: boolean; + enabled?: boolean; } export interface ReadReceiptsResponse { @@ -10568,9 +10736,9 @@ export interface ReminderResponseData { channel?: ChannelResponse; - message?: Message; + message?: MessageResponse; - user?: User; + user?: UserResponse; } export interface ReminderUpdatedEvent { @@ -10623,6 +10791,26 @@ export interface ReportResponse { user_ratings: UserRatingReportResponse; } +export interface ResolveSipInboundRequest { + sip_caller_number: string; + + sip_trunk_number: string; + + challenge: SIPChallenge; + + sip_headers?: Record; +} + +export interface ResolveSipInboundResponse { + duration: string; + + credentials: SipInboundCredentials; + + sip_routing_rule?: SIPInboundRoutingRuleResponse; + + sip_trunk?: SIPTrunkResponse; +} + export interface Response { duration: string; } @@ -10731,6 +10919,18 @@ export interface ReviewQueueItemUpdatedEvent { review_queue_item?: ReviewQueueItemResponse; } +export interface RingCallRequest { + video?: boolean; + + members_ids?: string[]; +} + +export interface RingCallResponse { + duration: string; + + members_ids: string[]; +} + export interface RingSettings { auto_cancel_timeout_ms: number; @@ -10855,6 +11055,182 @@ export interface SDKUsageReportResponse { daily: DailyAggregateSDKUsageReportResponse[]; } +export interface SIPCallConfigsRequest { + custom_data?: Record; +} + +export interface SIPCallConfigsResponse { + custom_data: Record; +} + +export interface SIPCallerConfigsRequest { + id: string; + + custom_data?: Record; +} + +export interface SIPCallerConfigsResponse { + id: string; + + custom_data: Record; +} + +export interface SIPChallenge { + a1?: string; + + algorithm?: string; + + charset?: string; + + cnonce?: string; + + method?: string; + + nc?: string; + + nonce?: string; + + opaque?: string; + + realm?: string; + + response?: string; + + stale?: boolean; + + uri?: string; + + userhash?: boolean; + + username?: string; + + domain?: string[]; + + qop?: string[]; +} + +export interface SIPDirectRoutingRuleCallConfigsRequest { + call_id: string; + + call_type: string; +} + +export interface SIPDirectRoutingRuleCallConfigsResponse { + call_id: string; + + call_type: string; +} + +export interface SIPInboundRoutingRulePinConfigsRequest { + custom_webhook_url?: string; + + pin_failed_attempt_prompt?: string; + + pin_hangup_prompt?: string; + + pin_prompt?: string; + + pin_success_prompt?: string; +} + +export interface SIPInboundRoutingRulePinConfigsResponse { + custom_webhook_url?: string; + + pin_failed_attempt_prompt?: string; + + pin_hangup_prompt?: string; + + pin_prompt?: string; + + pin_success_prompt?: string; +} + +export interface SIPInboundRoutingRuleRequest { + name: string; + + trunk_ids: string[]; + + caller_configs: SIPCallerConfigsRequest; + + called_numbers?: string[]; + + caller_numbers?: string[]; + + call_configs?: SIPCallConfigsRequest; + + direct_routing_configs?: SIPDirectRoutingRuleCallConfigsRequest; + + pin_protection_configs?: SIPPinProtectionConfigsRequest; + + pin_routing_configs?: SIPInboundRoutingRulePinConfigsRequest; +} + +export interface SIPInboundRoutingRuleResponse { + created_at: Date; + + duration: string; + + id: string; + + name: string; + + updated_at: Date; + + called_numbers: string[]; + + trunk_ids: string[]; + + caller_numbers?: string[]; + + call_configs?: SIPCallConfigsResponse; + + caller_configs?: SIPCallerConfigsResponse; + + direct_routing_configs?: SIPDirectRoutingRuleCallConfigsResponse; + + pin_protection_configs?: SIPPinProtectionConfigsResponse; + + pin_routing_configs?: SIPInboundRoutingRulePinConfigsResponse; +} + +export interface SIPPinProtectionConfigsRequest { + default_pin?: string; + + enabled?: boolean; + + max_attempts?: number; + + required_pin_digits?: number; +} + +export interface SIPPinProtectionConfigsResponse { + enabled: boolean; + + default_pin?: string; + + max_attempts?: number; + + required_pin_digits?: number; +} + +export interface SIPTrunkResponse { + created_at: Date; + + id: string; + + name: string; + + password: string; + + updated_at: Date; + + uri: string; + + username: string; + + numbers: string[]; +} + export interface SRTIngress { address: string; } @@ -11180,27 +11556,13 @@ export interface ShadowBlockActionRequest { } export interface SharedLocation { - channel_cid: string; - - created_at: Date; - - created_by_device_id: string; - - message_id: string; + latitude: number; - updated_at: Date; + longitude: number; - user_id: string; + created_by_device_id?: string; end_at?: Date; - - latitude?: number; - - longitude?: number; - - channel?: Channel; - - message?: Message; } export interface SharedLocationResponse { @@ -11275,6 +11637,20 @@ export interface SingleFollowResponse { follow: FollowResponse; } +export interface SipInboundCredentials { + call_id: string; + + call_type: string; + + token: string; + + user_id: string; + + call_custom_data: Record; + + user_custom_data: Record; +} + export interface SortParam { direction?: number; @@ -12094,7 +12470,7 @@ export interface TruncateChannelResponse { } export interface TypingIndicators { - enabled: boolean; + enabled?: boolean; } export interface TypingIndicatorsResponse { @@ -12538,12 +12914,16 @@ export interface UpdateChannelRequest { hide_history?: boolean; + hide_history_before?: Date; + reject_invite?: boolean; skip_push?: boolean; user_id?: string; + add_filter_tags?: string[]; + add_members?: ChannelMemberRequest[]; add_moderators?: string[]; @@ -12554,9 +12934,11 @@ export interface UpdateChannelRequest { invites?: ChannelMemberRequest[]; + remove_filter_tags?: string[]; + remove_members?: string[]; - data?: ChannelInput; + data?: ChannelInputRequest; message?: MessageRequest; @@ -13048,6 +13430,44 @@ export interface UpdateReminderResponse { reminder: ReminderResponseData; } +export interface UpdateSIPInboundRoutingRuleRequest { + name: string; + + called_numbers: string[]; + + trunk_ids: string[]; + + caller_configs: SIPCallerConfigsRequest; + + caller_numbers?: string[]; + + call_configs?: SIPCallConfigsRequest; + + direct_routing_configs?: SIPDirectRoutingRuleCallConfigsRequest; + + pin_protection_configs?: SIPPinProtectionConfigsRequest; + + pin_routing_configs?: SIPInboundRoutingRulePinConfigsRequest; +} + +export interface UpdateSIPInboundRoutingRuleResponse { + duration: string; + + sip_inbound_routing_rule?: SIPInboundRoutingRuleResponse; +} + +export interface UpdateSIPTrunkRequest { + name: string; + + numbers: string[]; +} + +export interface UpdateSIPTrunkResponse { + duration: string; + + sip_trunk?: SIPTrunkResponse; +} + export interface UpdateThreadPartialRequest { user_id?: string; @@ -13316,43 +13736,27 @@ export interface UpsertPushTemplateResponse { } export interface User { - banned: boolean; - id: string; - online: boolean; - - role: string; - - custom: Record; - - teams_role: Record; - - avg_response_time?: number; - ban_expires?: Date; - created_at?: Date; - - deactivated_at?: Date; - - deleted_at?: Date; + banned?: boolean; invisible?: boolean; language?: string; - last_active?: Date; - - last_engaged_at?: Date; - revoke_tokens_issued_before?: Date; - updated_at?: Date; + role?: string; teams?: string[]; + custom?: Record; + privacy_settings?: PrivacySettings; + + teams_role?: Record; } export interface UserBannedEvent { diff --git a/src/gen/video/CallApi.ts b/src/gen/video/CallApi.ts index abc44b6..1ebb883 100644 --- a/src/gen/video/CallApi.ts +++ b/src/gen/video/CallApi.ts @@ -25,6 +25,8 @@ import { PinResponse, QueryCallParticipantsRequest, QueryCallParticipantsResponse, + RingCallRequest, + RingCallResponse, SendCallEventRequest, SendCallEventResponse, SendClosedCaptionRequest, @@ -212,6 +214,10 @@ export class CallApi { }); } + ring(request?: RingCallRequest): Promise> { + return this.videoApi.ringCall({ id: this.id, type: this.type, ...request }); + } + startRTMPBroadcasts( request: StartRTMPBroadcastsRequest, ): Promise> { diff --git a/src/gen/video/VideoApi.ts b/src/gen/video/VideoApi.ts index c293a9e..bf59376 100644 --- a/src/gen/video/VideoApi.ts +++ b/src/gen/video/VideoApi.ts @@ -6,9 +6,13 @@ import { CollectUserFeedbackResponse, CreateCallTypeRequest, CreateCallTypeResponse, + CreateSIPTrunkRequest, + CreateSIPTrunkResponse, DeleteCallRequest, DeleteCallResponse, DeleteRecordingResponse, + DeleteSIPInboundRoutingRuleResponse, + DeleteSIPTrunkResponse, DeleteTranscriptionResponse, EndCallResponse, GetActiveCallsStatusResponse, @@ -25,6 +29,8 @@ import { KickUserResponse, ListCallTypeResponse, ListRecordingsResponse, + ListSIPInboundRoutingRuleResponse, + ListSIPTrunksResponse, ListTranscriptionsResponse, MuteUsersRequest, MuteUsersResponse, @@ -44,7 +50,13 @@ import { QueryCallsResponse, QueryUserFeedbackRequest, QueryUserFeedbackResponse, + ResolveSipInboundRequest, + ResolveSipInboundResponse, Response, + RingCallRequest, + RingCallResponse, + SIPInboundRoutingRuleRequest, + SIPInboundRoutingRuleResponse, SendCallEventRequest, SendCallEventResponse, SendClosedCaptionRequest, @@ -83,6 +95,10 @@ import { UpdateCallResponse, UpdateCallTypeRequest, UpdateCallTypeResponse, + UpdateSIPInboundRoutingRuleRequest, + UpdateSIPInboundRoutingRuleResponse, + UpdateSIPTrunkRequest, + UpdateSIPTrunkResponse, UpdateUserPermissionsRequest, UpdateUserPermissionsResponse, } from '../models'; @@ -681,6 +697,34 @@ export class VideoApi { return { ...response.body, metadata: response.metadata }; } + async ringCall( + request: RingCallRequest & { type: string; id: string }, + ): Promise> { + const pathParams = { + type: request?.type, + id: request?.id, + }; + const body = { + video: request?.video, + members_ids: request?.members_ids, + }; + + const response = await this.apiClient.sendRequest< + StreamResponse + >( + 'POST', + '/api/v2/video/call/{type}/{id}/ring', + pathParams, + undefined, + body, + 'application/json', + ); + + decoders.RingCallResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + } + async startRTMPBroadcasts( request: StartRTMPBroadcastsRequest & { type: string; id: string }, ): Promise> { @@ -1457,6 +1501,202 @@ export class VideoApi { return { ...response.body, metadata: response.metadata }; } + async resolveSipInbound( + request: ResolveSipInboundRequest, + ): Promise> { + const body = { + sip_caller_number: request?.sip_caller_number, + sip_trunk_number: request?.sip_trunk_number, + challenge: request?.challenge, + sip_headers: request?.sip_headers, + }; + + const response = await this.apiClient.sendRequest< + StreamResponse + >( + 'POST', + '/api/v2/video/sip/resolve', + undefined, + undefined, + body, + 'application/json', + ); + + decoders.ResolveSipInboundResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + } + + async listSIPInboundRoutingRule(): Promise< + StreamResponse + > { + const response = await this.apiClient.sendRequest< + StreamResponse + >('GET', '/api/v2/video/sip/routing_rules', undefined, undefined); + + decoders.ListSIPInboundRoutingRuleResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + } + + async createSIPInboundRoutingRule( + request: SIPInboundRoutingRuleRequest, + ): Promise> { + const body = { + name: request?.name, + trunk_ids: request?.trunk_ids, + caller_configs: request?.caller_configs, + called_numbers: request?.called_numbers, + caller_numbers: request?.caller_numbers, + call_configs: request?.call_configs, + direct_routing_configs: request?.direct_routing_configs, + pin_protection_configs: request?.pin_protection_configs, + pin_routing_configs: request?.pin_routing_configs, + }; + + const response = await this.apiClient.sendRequest< + StreamResponse + >( + 'POST', + '/api/v2/video/sip/routing_rules', + undefined, + undefined, + body, + 'application/json', + ); + + decoders.SIPInboundRoutingRuleResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + } + + async deleteSIPInboundRoutingRule(request: { + id: string; + }): Promise> { + const pathParams = { + id: request?.id, + }; + + const response = await this.apiClient.sendRequest< + StreamResponse + >('DELETE', '/api/v2/video/sip/routing_rules/{id}', pathParams, undefined); + + decoders.DeleteSIPInboundRoutingRuleResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + } + + async updateSIPInboundRoutingRule( + request: UpdateSIPInboundRoutingRuleRequest & { id: string }, + ): Promise> { + const pathParams = { + id: request?.id, + }; + const body = { + name: request?.name, + called_numbers: request?.called_numbers, + trunk_ids: request?.trunk_ids, + caller_configs: request?.caller_configs, + caller_numbers: request?.caller_numbers, + call_configs: request?.call_configs, + direct_routing_configs: request?.direct_routing_configs, + pin_protection_configs: request?.pin_protection_configs, + pin_routing_configs: request?.pin_routing_configs, + }; + + const response = await this.apiClient.sendRequest< + StreamResponse + >( + 'PUT', + '/api/v2/video/sip/routing_rules/{id}', + pathParams, + undefined, + body, + 'application/json', + ); + + decoders.UpdateSIPInboundRoutingRuleResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + } + + async listSIPTrunks(): Promise> { + const response = await this.apiClient.sendRequest< + StreamResponse + >('GET', '/api/v2/video/sip/trunks', undefined, undefined); + + decoders.ListSIPTrunksResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + } + + async createSIPTrunk( + request: CreateSIPTrunkRequest, + ): Promise> { + const body = { + name: request?.name, + numbers: request?.numbers, + }; + + const response = await this.apiClient.sendRequest< + StreamResponse + >( + 'POST', + '/api/v2/video/sip/trunks', + undefined, + undefined, + body, + 'application/json', + ); + + decoders.CreateSIPTrunkResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + } + + async deleteSIPTrunk(request: { + id: string; + }): Promise> { + const pathParams = { + id: request?.id, + }; + + const response = await this.apiClient.sendRequest< + StreamResponse + >('DELETE', '/api/v2/video/sip/trunks/{id}', pathParams, undefined); + + decoders.DeleteSIPTrunkResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + } + + async updateSIPTrunk( + request: UpdateSIPTrunkRequest & { id: string }, + ): Promise> { + const pathParams = { + id: request?.id, + }; + const body = { + name: request?.name, + numbers: request?.numbers, + }; + + const response = await this.apiClient.sendRequest< + StreamResponse + >( + 'PUT', + '/api/v2/video/sip/trunks/{id}', + pathParams, + undefined, + body, + 'application/json', + ); + + decoders.UpdateSIPTrunkResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + } + async queryAggregateCallStats( request?: QueryAggregateCallStatsRequest, ): Promise> { diff --git a/yarn.lock b/yarn.lock index 68a3391..0c13b05 100644 --- a/yarn.lock +++ b/yarn.lock @@ -397,7 +397,7 @@ consola "^2.15.0" node-fetch "^2.6.1" -"@openai/realtime-api-beta@github:openai/openai-realtime-api-beta#a5cb94824f625423858ebacb9f769226ca98945f": +"@openai/realtime-api-beta@openai/openai-realtime-api-beta#a5cb94824f625423858ebacb9f769226ca98945f": version "0.0.0" resolved "https://codeload.github.com/openai/openai-realtime-api-beta/tar.gz/a5cb94824f625423858ebacb9f769226ca98945f" dependencies: