From d314b6cf7b43bf54a6ce652dff34211c03dfb7d6 Mon Sep 17 00:00:00 2001 From: Zita Szupera Date: Fri, 6 Dec 2024 11:33:45 +0100 Subject: [PATCH 1/3] chore: add tests for all external storage providers --- __tests__/external-storage.test.ts | 39 ++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/__tests__/external-storage.test.ts b/__tests__/external-storage.test.ts index d2c4750..b6c4882 100644 --- a/__tests__/external-storage.test.ts +++ b/__tests__/external-storage.test.ts @@ -39,6 +39,45 @@ describe('external storage CRUD API', () => { expect(response.bucket).toBe('new bucket'); }); + it('docs snippets', async () => { + await client.createExternalStorage({ + name: 'streamnodetest-my-s3', + storage_type: 's3', + bucket: 'my-bucket', + path: 'directory_name/', + aws_s3: { + s3_api_key: 'us-east-1', + s3_region: 'my-access-key', + s3_secret: 'my-secret', + }, + }); + + await client.createExternalStorage({ + bucket: 'my-bucket', + name: 'streamnodetest-my-gcs', + storage_type: 'gcs', + path: 'directory_name/', + gcs_credentials: 'content of the service account file', + }); + + await client.createExternalStorage({ + name: 'streamnodetest-my-abs', + storage_type: 'abs', + bucket: 'my-bucket', + path: 'directory_name/', + azure_blob: { + abs_account_name: '...', + abs_client_id: '...', + abs_client_secret: '...', + abs_tenant_id: '...', + }, + }); + + await client.deleteExternalStorage({ name: 'streamnodetest-my-s3' }); + await client.deleteExternalStorage({ name: 'streamnodetest-my-gcs' }); + await client.deleteExternalStorage({ name: 'streamnodetest-my-abs' }); + }); + it('delete', async () => { const response = await client.deleteExternalStorage({ name: storageName }); From a322eec1efaedee631a5f4d06720363673818266 Mon Sep 17 00:00:00 2001 From: Zita Szupera Date: Fri, 6 Dec 2024 12:16:21 +0100 Subject: [PATCH 2/3] feat: update API spec to v138.16.2-1-g3d2e50909e --- src/gen/chat/ChatApi.ts | 227 ++++- src/gen/model-decoders/index.ts | 466 +++++++--- src/gen/models/index.ts | 1300 +++++++++++++++++++++------ src/gen/moderation/ModerationApi.ts | 56 +- src/gen/video/CallApi.ts | 21 +- src/gen/video/VideoApi.ts | 59 +- 6 files changed, 1689 insertions(+), 440 deletions(-) diff --git a/src/gen/chat/ChatApi.ts b/src/gen/chat/ChatApi.ts index 50fa091..c902e85 100644 --- a/src/gen/chat/ChatApi.ts +++ b/src/gen/chat/ChatApi.ts @@ -1,6 +1,7 @@ import { BaseApi } from '../../BaseApi'; import { StreamResponse } from '../../types'; import { + CampaignResponse, CastPollVoteRequest, ChannelGetOrCreateRequest, ChannelStateResponse, @@ -16,11 +17,13 @@ import { DeleteChannelsResponse, DeleteCommandResponse, DeleteMessageResponse, + DeleteSegmentTargetsRequest, EventResponse, ExportChannelsRequest, ExportChannelsResponse, FileUploadRequest, FileUploadResponse, + GetCampaignResponse, GetChannelTypeResponse, GetCommandResponse, GetExportChannelsStatusResponse, @@ -28,6 +31,7 @@ import { GetMessageResponse, GetReactionsResponse, GetRepliesResponse, + GetSegmentResponse, GetThreadResponse, HideChannelRequest, HideChannelResponse, @@ -50,6 +54,8 @@ import { PollVotesResponse, QueryBannedUsersPayload, QueryBannedUsersResponse, + QueryCampaignsRequest, + QueryCampaignsResponse, QueryChannelsRequest, QueryChannelsResponse, QueryMembersPayload, @@ -62,6 +68,10 @@ import { QueryPollsResponse, QueryReactionsRequest, QueryReactionsResponse, + QuerySegmentTargetsRequest, + QuerySegmentTargetsResponse, + QuerySegmentsRequest, + QuerySegmentsResponse, QueryThreadsRequest, QueryThreadsResponse, ReactionRemovalResponse, @@ -77,6 +87,9 @@ import { ShowChannelRequest, ShowChannelResponse, SortParamRequest, + StartCampaignRequest, + StartCampaignResponse, + StopCampaignRequest, TranslateMessageRequest, TruncateChannelRequest, TruncateChannelResponse, @@ -108,6 +121,83 @@ import { import { decoders } from '../model-decoders'; export class ChatApi extends BaseApi { + queryCampaigns = async ( + request?: QueryCampaignsRequest, + ): Promise> => { + const body = { + limit: request?.limit, + next: request?.next, + prev: request?.prev, + sort: request?.sort, + filter: request?.filter, + }; + + const response = await this.sendRequest< + StreamResponse + >('POST', '/api/v2/chat/campaigns/query', undefined, undefined, body); + + decoders.QueryCampaignsResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + getCampaign = async (request: { + id: string; + }): Promise> => { + const pathParams = { + id: request?.id, + }; + + const response = await this.sendRequest< + StreamResponse + >('GET', '/api/v2/chat/campaigns/{id}', pathParams, undefined); + + decoders.GetCampaignResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + startCampaign = async ( + request: StartCampaignRequest & { id: string }, + ): Promise> => { + const pathParams = { + id: request?.id, + }; + const body = { + scheduled_for: request?.scheduled_for, + stop_at: request?.stop_at, + }; + + const response = await this.sendRequest< + StreamResponse + >('POST', '/api/v2/chat/campaigns/{id}/start', pathParams, undefined, body); + + decoders.StartCampaignResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + scheduleCampaign = async ( + request: StopCampaignRequest & { id: string }, + ): Promise> => { + const pathParams = { + id: request?.id, + }; + const body = {}; + + const response = await this.sendRequest>( + 'POST', + '/api/v2/chat/campaigns/{id}/stop', + pathParams, + undefined, + body, + ); + + decoders.CampaignResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + queryChannels = async ( request?: QueryChannelsRequest, ): Promise> => { @@ -712,6 +802,8 @@ export class ChatApi extends BaseApi { read_events: request?.read_events, replies: request?.replies, search: request?.search, + skip_last_msg_update_for_system_msgs: + request?.skip_last_msg_update_for_system_msgs, typing_events: request?.typing_events, uploads: request?.uploads, url_enrichment: request?.url_enrichment, @@ -791,6 +883,8 @@ export class ChatApi extends BaseApi { reminders: request?.reminders, replies: request?.replies, search: request?.search, + skip_last_msg_update_for_system_msgs: + request?.skip_last_msg_update_for_system_msgs, typing_events: request?.typing_events, uploads: request?.uploads, url_enrichment: request?.url_enrichment, @@ -1758,6 +1852,137 @@ export class ChatApi extends BaseApi { return { ...response.body, metadata: response.metadata }; }; + querySegments = async ( + request: QuerySegmentsRequest, + ): Promise> => { + const body = { + filter: request?.filter, + limit: request?.limit, + next: request?.next, + prev: request?.prev, + sort: request?.sort, + }; + + const response = await this.sendRequest< + StreamResponse + >('POST', '/api/v2/chat/segments/query', undefined, undefined, body); + + decoders.QuerySegmentsResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + deleteSegment = async (request: { + id: string; + }): Promise> => { + const pathParams = { + id: request?.id, + }; + + const response = await this.sendRequest>( + 'DELETE', + '/api/v2/chat/segments/{id}', + pathParams, + undefined, + ); + + decoders.Response?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + getSegment = async (request: { + id: string; + }): Promise> => { + const pathParams = { + id: request?.id, + }; + + const response = await this.sendRequest>( + 'GET', + '/api/v2/chat/segments/{id}', + pathParams, + undefined, + ); + + decoders.GetSegmentResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + deleteSegmentTargets = async ( + request: DeleteSegmentTargetsRequest & { id: string }, + ): Promise> => { + const pathParams = { + id: request?.id, + }; + const body = { + target_ids: request?.target_ids, + }; + + const response = await this.sendRequest>( + 'POST', + '/api/v2/chat/segments/{id}/deletetargets', + pathParams, + undefined, + body, + ); + + decoders.Response?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + segmentTargetExists = async (request: { + id: string; + target_id: string; + }): Promise> => { + const pathParams = { + id: request?.id, + target_id: request?.target_id, + }; + + const response = await this.sendRequest>( + 'GET', + '/api/v2/chat/segments/{id}/target/{target_id}', + pathParams, + undefined, + ); + + decoders.Response?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + querySegmentTargets = async ( + request: QuerySegmentTargetsRequest & { id: string }, + ): Promise> => { + const pathParams = { + id: request?.id, + }; + const body = { + limit: request?.limit, + next: request?.next, + prev: request?.prev, + sort: request?.sort, + filter: request?.filter, + }; + + const response = await this.sendRequest< + StreamResponse + >( + 'POST', + '/api/v2/chat/segments/{id}/targets/query', + pathParams, + undefined, + body, + ); + + decoders.QuerySegmentTargetsResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + queryThreads = async ( request?: QueryThreadsRequest, ): Promise> => { @@ -1783,13 +2008,11 @@ export class ChatApi extends BaseApi { getThread = async (request: { message_id: string; - connection_id?: string; reply_limit?: number; participant_limit?: number; member_limit?: number; }): Promise> => { const queryParams = { - connection_id: request?.connection_id, reply_limit: request?.reply_limit, participant_limit: request?.participant_limit, member_limit: request?.member_limit, diff --git a/src/gen/model-decoders/index.ts b/src/gen/model-decoders/index.ts index a944289..fd029c4 100644 --- a/src/gen/model-decoders/index.ts +++ b/src/gen/model-decoders/index.ts @@ -38,9 +38,9 @@ decoders.ActionLog = (input?: Record) => { review_queue_item: { type: 'ReviewQueueItem', isSingle: true }, - target_user: { type: 'UserObject', isSingle: true }, + target_user: { type: 'User', isSingle: true }, - user: { type: 'UserObject', isSingle: true }, + user: { type: 'User', isSingle: true }, }; return decode(typeMappings, input); }; @@ -86,9 +86,9 @@ decoders.Ban = (input?: Record) => { channel: { type: 'Channel', isSingle: true }, - created_by: { type: 'UserObject', isSingle: true }, + created_by: { type: 'User', isSingle: true }, - target: { type: 'UserObject', isSingle: true }, + target: { type: 'User', isSingle: true }, }; return decode(typeMappings, input); }; @@ -238,6 +238,36 @@ decoders.CallTypeResponse = (input?: Record) => { return decode(typeMappings, input); }; +decoders.CampaignResponse = (input?: Record) => { + const typeMappings: TypeMapping = { + created_at: { type: 'DatetimeType', isSingle: true }, + + updated_at: { type: 'DatetimeType', isSingle: true }, + + segments: { type: 'Segment', isSingle: false }, + + users: { type: 'UserResponse', isSingle: false }, + + stats: { type: 'CampaignStatsResponse', isSingle: true }, + + scheduled_for: { type: 'DatetimeType', isSingle: true }, + + stop_at: { type: 'DatetimeType', isSingle: true }, + + sender: { type: 'UserResponse', isSingle: true }, + }; + return decode(typeMappings, input); +}; + +decoders.CampaignStatsResponse = (input?: Record) => { + const typeMappings: TypeMapping = { + stats_completed_at: { type: 'DatetimeType', isSingle: true }, + + stats_started_at: { type: 'DatetimeType', isSingle: true }, + }; + return decode(typeMappings, input); +}; + decoders.Channel = (input?: Record) => { const typeMappings: TypeMapping = { created_at: { type: 'DatetimeType', isSingle: true }, @@ -254,11 +284,9 @@ decoders.Channel = (input?: Record) => { config: { type: 'ChannelConfig', isSingle: true }, - config_overrides: { type: 'ChannelConfig', isSingle: true }, - - created_by: { type: 'UserObject', isSingle: true }, + created_by: { type: 'User', isSingle: true }, - truncated_by: { type: 'UserObject', isSingle: true }, + truncated_by: { type: 'User', isSingle: true }, }; return decode(typeMappings, input); }; @@ -289,6 +317,8 @@ decoders.ChannelMember = (input?: Record) => { updated_at: { type: 'DatetimeType', isSingle: true }, + archived_at: { type: 'DatetimeType', isSingle: true }, + ban_expires: { type: 'DatetimeType', isSingle: true }, deleted_at: { type: 'DatetimeType', isSingle: true }, @@ -297,7 +327,9 @@ decoders.ChannelMember = (input?: Record) => { invite_rejected_at: { type: 'DatetimeType', isSingle: true }, - user: { type: 'UserObject', isSingle: true }, + pinned_at: { type: 'DatetimeType', isSingle: true }, + + user: { type: 'UserResponse', isSingle: true }, }; return decode(typeMappings, input); }; @@ -308,6 +340,8 @@ decoders.ChannelMemberResponse = (input?: Record) => { updated_at: { type: 'DatetimeType', isSingle: true }, + archived_at: { type: 'DatetimeType', isSingle: true }, + ban_expires: { type: 'DatetimeType', isSingle: true }, deleted_at: { type: 'DatetimeType', isSingle: true }, @@ -316,6 +350,8 @@ decoders.ChannelMemberResponse = (input?: Record) => { invite_rejected_at: { type: 'DatetimeType', isSingle: true }, + pinned_at: { type: 'DatetimeType', isSingle: true }, + user: { type: 'UserResponse', isSingle: true }, }; return decode(typeMappings, input); @@ -331,7 +367,7 @@ decoders.ChannelMute = (input?: Record) => { channel: { type: 'ChannelResponse', isSingle: true }, - user: { type: 'UserObject', isSingle: true }, + user: { type: 'UserResponse', isSingle: true }, }; return decode(typeMappings, input); }; @@ -356,9 +392,9 @@ decoders.ChannelResponse = (input?: Record) => { config: { type: 'ChannelConfigWithInfo', isSingle: true }, - created_by: { type: 'UserObject', isSingle: true }, + created_by: { type: 'UserResponse', isSingle: true }, - truncated_by: { type: 'UserObject', isSingle: true }, + truncated_by: { type: 'UserResponse', isSingle: true }, }; return decode(typeMappings, input); }; @@ -371,7 +407,7 @@ decoders.ChannelStateResponse = (input?: Record) => { pinned_messages: { type: 'MessageResponse', isSingle: false }, - threads: { type: 'ThreadState', isSingle: false }, + threads: { type: 'ThreadStateResponse', isSingle: false }, hide_messages_before: { type: 'DatetimeType', isSingle: true }, @@ -396,7 +432,7 @@ decoders.ChannelStateResponseFields = (input?: Record) => { pinned_messages: { type: 'MessageResponse', isSingle: false }, - threads: { type: 'ThreadState', isSingle: false }, + threads: { type: 'ThreadStateResponse', isSingle: false }, hide_messages_before: { type: 'DatetimeType', isSingle: true }, @@ -445,8 +481,6 @@ decoders.ConfigResponse = (input?: Record) => { created_at: { type: 'DatetimeType', isSingle: true }, updated_at: { type: 'DatetimeType', isSingle: true }, - - velocity_filter_config: { type: 'VelocityFilterConfig', isSingle: true }, }; return decode(typeMappings, input); }; @@ -541,6 +575,13 @@ decoders.Device = (input?: Record) => { return decode(typeMappings, input); }; +decoders.DeviceResponse = (input?: Record) => { + const typeMappings: TypeMapping = { + created_at: { type: 'DatetimeType', isSingle: true }, + }; + return decode(typeMappings, input); +}; + decoders.EgressRTMPResponse = (input?: Record) => { const typeMappings: TypeMapping = { started_at: { type: 'DatetimeType', isSingle: true }, @@ -548,6 +589,55 @@ decoders.EgressRTMPResponse = (input?: Record) => { return decode(typeMappings, input); }; +decoders.EntityCreator = (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 }, + + push_notifications: { type: 'PushNotificationSettings', isSingle: true }, + }; + return decode(typeMappings, input); +}; + +decoders.EntityCreatorResponse = (input?: Record) => { + const typeMappings: TypeMapping = { + created_at: { type: 'DatetimeType', isSingle: true }, + + updated_at: { type: 'DatetimeType', isSingle: true }, + + devices: { type: 'DeviceResponse', isSingle: false }, + + ban_expires: { type: 'DatetimeType', isSingle: true }, + + deactivated_at: { type: 'DatetimeType', isSingle: true }, + + deleted_at: { type: 'DatetimeType', isSingle: true }, + + last_active: { type: 'DatetimeType', isSingle: true }, + + revoke_tokens_issued_before: { type: 'DatetimeType', isSingle: true }, + + push_notifications: { + type: 'PushNotificationSettingsResponse', + isSingle: true, + }, + }; + return decode(typeMappings, input); +}; + decoders.EventResponse = (input?: Record) => { const typeMappings: TypeMapping = { event: { type: 'WSEvent', isSingle: true }, @@ -557,9 +647,9 @@ decoders.EventResponse = (input?: Record) => { decoders.ExportUserResponse = (input?: Record) => { const typeMappings: TypeMapping = { - messages: { type: 'Message', isSingle: false }, + messages: { type: 'MessageResponse', isSingle: false }, - reactions: { type: 'Reaction', isSingle: false }, + reactions: { type: 'ReactionResponse', isSingle: false }, user: { type: 'UserResponse', isSingle: true }, }; @@ -572,7 +662,18 @@ decoders.Flag2 = (input?: Record) => { updated_at: { type: 'DatetimeType', isSingle: true }, - user: { type: 'UserObject', isSingle: true }, + user: { type: 'User', isSingle: true }, + }; + return decode(typeMappings, input); +}; + +decoders.Flag2Response = (input?: Record) => { + const typeMappings: TypeMapping = { + created_at: { type: 'DatetimeType', isSingle: true }, + + updated_at: { type: 'DatetimeType', isSingle: true }, + + user: { type: 'UserResponse', isSingle: true }, }; return decode(typeMappings, input); }; @@ -599,7 +700,7 @@ decoders.FullUserResponse = (input?: Record) => { channel_mutes: { type: 'ChannelMute', isSingle: false }, - devices: { type: 'Device', isSingle: false }, + devices: { type: 'DeviceResponse', isSingle: false }, mutes: { type: 'UserMuteResponse', isSingle: false }, @@ -658,6 +759,13 @@ decoders.GetCallTypeResponse = (input?: Record) => { return decode(typeMappings, input); }; +decoders.GetCampaignResponse = (input?: Record) => { + const typeMappings: TypeMapping = { + campaign: { type: 'CampaignResponse', isSingle: true }, + }; + return decode(typeMappings, input); +}; + decoders.GetChannelTypeResponse = (input?: Record) => { const typeMappings: TypeMapping = { created_at: { type: 'DatetimeType', isSingle: true }, @@ -703,7 +811,7 @@ decoders.GetImportResponse = (input?: Record) => { decoders.GetManyMessagesResponse = (input?: Record) => { const typeMappings: TypeMapping = { - messages: { type: 'Message', isSingle: false }, + messages: { type: 'MessageResponse', isSingle: false }, }; return decode(typeMappings, input); }; @@ -740,9 +848,16 @@ decoders.GetRepliesResponse = (input?: Record) => { decoders.GetReviewQueueItemResponse = (input?: Record) => { const typeMappings: TypeMapping = { - history: { type: 'ReviewQueueItem', isSingle: false }, + history: { type: 'ReviewQueueItemResponse', isSingle: false }, - item: { type: 'ReviewQueueItem', isSingle: true }, + item: { type: 'ReviewQueueItemResponse', isSingle: true }, + }; + return decode(typeMappings, input); +}; + +decoders.GetSegmentResponse = (input?: Record) => { + const typeMappings: TypeMapping = { + segment: { type: 'SegmentResponse', isSingle: true }, }; return decode(typeMappings, input); }; @@ -829,7 +944,7 @@ decoders.ListCommandsResponse = (input?: Record) => { decoders.ListDevicesResponse = (input?: Record) => { const typeMappings: TypeMapping = { - devices: { type: 'Device', isSingle: false }, + devices: { type: 'DeviceResponse', isSingle: false }, }; return decode(typeMappings, input); }; @@ -904,7 +1019,7 @@ decoders.Message = (input?: Record) => { latest_reactions: { type: 'Reaction', isSingle: false }, - mentioned_users: { type: 'UserObject', isSingle: false }, + mentioned_users: { type: 'User', isSingle: false }, own_reactions: { type: 'Reaction', isSingle: false }, @@ -918,15 +1033,15 @@ decoders.Message = (input?: Record) => { pinned_at: { type: 'DatetimeType', isSingle: true }, - thread_participants: { type: 'UserObject', isSingle: false }, + thread_participants: { type: 'User', isSingle: false }, - pinned_by: { type: 'UserObject', isSingle: true }, + pinned_by: { type: 'User', isSingle: true }, poll: { type: 'Poll', isSingle: true }, quoted_message: { type: 'Message', isSingle: true }, - user: { type: 'UserObject', isSingle: true }, + user: { type: 'User', isSingle: true }, }; return decode(typeMappings, input); }; @@ -980,7 +1095,7 @@ decoders.MessageReadEvent = (input?: Record) => { thread: { type: 'ThreadResponse', isSingle: true }, - user: { type: 'UserObject', isSingle: true }, + user: { type: 'UserResponse', isSingle: true }, }; return decode(typeMappings, input); }; @@ -1011,9 +1126,9 @@ decoders.MessageResponse = (input?: Record) => { pinned_by: { type: 'UserResponse', isSingle: true }, - poll: { type: 'Poll', isSingle: true }, + poll: { type: 'PollResponseData', isSingle: true }, - quoted_message: { type: 'Message', isSingle: true }, + quoted_message: { type: 'MessageResponse', isSingle: true }, reaction_groups: { type: 'ReactionGroupResponse', isSingle: false }, }; @@ -1048,9 +1163,9 @@ decoders.MessageWithChannelResponse = (input?: Record) => { pinned_by: { type: 'UserResponse', isSingle: true }, - poll: { type: 'Poll', isSingle: true }, + poll: { type: 'PollResponseData', isSingle: true }, - quoted_message: { type: 'Message', isSingle: true }, + quoted_message: { type: 'MessageResponse', isSingle: true }, reaction_groups: { type: 'ReactionGroupResponse', isSingle: false }, }; @@ -1059,6 +1174,8 @@ decoders.MessageWithChannelResponse = (input?: Record) => { decoders.ModerationUsageStats = (input?: Record) => { const typeMappings: TypeMapping = { + reference_date: { type: 'DatetimeType', isSingle: true }, + updated_at: { type: 'DatetimeType', isSingle: true }, }; return decode(typeMappings, input); @@ -1109,11 +1226,41 @@ decoders.OwnUser = (input?: Record) => { last_active: { type: 'DatetimeType', isSingle: true }, + last_engaged_at: { type: 'DatetimeType', isSingle: true }, + push_notifications: { type: 'PushNotificationSettings', isSingle: true }, }; return decode(typeMappings, input); }; +decoders.OwnUserResponse = (input?: Record) => { + const typeMappings: TypeMapping = { + created_at: { type: 'DatetimeType', isSingle: true }, + + updated_at: { type: 'DatetimeType', isSingle: true }, + + channel_mutes: { type: 'ChannelMute', isSingle: false }, + + devices: { type: 'DeviceResponse', isSingle: false }, + + mutes: { type: 'UserMuteResponse', isSingle: false }, + + deactivated_at: { type: 'DatetimeType', isSingle: true }, + + deleted_at: { type: 'DatetimeType', isSingle: true }, + + last_active: { type: 'DatetimeType', isSingle: true }, + + revoke_tokens_issued_before: { type: 'DatetimeType', isSingle: true }, + + push_notifications: { + type: 'PushNotificationSettingsResponse', + isSingle: true, + }, + }; + return decode(typeMappings, input); +}; + decoders.PendingMessageResponse = (input?: Record) => { const typeMappings: TypeMapping = { channel: { type: 'ChannelResponse', isSingle: true }, @@ -1135,7 +1282,7 @@ decoders.Poll = (input?: Record) => { own_votes: { type: 'PollVote', isSingle: false }, - created_by: { type: 'UserObject', isSingle: true }, + created_by: { type: 'User', isSingle: true }, }; return decode(typeMappings, input); }; @@ -1153,6 +1300,8 @@ decoders.PollResponseData = (input?: Record) => { updated_at: { type: 'DatetimeType', isSingle: true }, + latest_answers: { type: 'PollVoteResponseData', isSingle: false }, + own_votes: { type: 'PollVoteResponseData', isSingle: false }, created_by: { type: 'UserResponse', isSingle: true }, @@ -1166,7 +1315,7 @@ decoders.PollVote = (input?: Record) => { updated_at: { type: 'DatetimeType', isSingle: true }, - user: { type: 'UserObject', isSingle: true }, + user: { type: 'User', isSingle: true }, }; return decode(typeMappings, input); }; @@ -1267,6 +1416,13 @@ decoders.QueryCallsResponse = (input?: Record) => { return decode(typeMappings, input); }; +decoders.QueryCampaignsResponse = (input?: Record) => { + const typeMappings: TypeMapping = { + campaigns: { type: 'CampaignResponse', isSingle: false }, + }; + return decode(typeMappings, input); +}; + decoders.QueryChannelsResponse = (input?: Record) => { const typeMappings: TypeMapping = { channels: { type: 'ChannelStateResponseFields', isSingle: false }, @@ -1306,9 +1462,16 @@ decoders.QueryMessageHistoryResponse = (input?: Record) => { return decode(typeMappings, input); }; +decoders.QueryModerationConfigsResponse = (input?: Record) => { + const typeMappings: TypeMapping = { + configs: { type: 'ConfigResponse', isSingle: false }, + }; + return decode(typeMappings, input); +}; + decoders.QueryModerationLogsResponse = (input?: Record) => { const typeMappings: TypeMapping = { - l_og_s: { type: 'ActionLogResponse', isSingle: false }, + logs: { type: 'ActionLogResponse', isSingle: false }, }; return decode(typeMappings, input); }; @@ -1329,7 +1492,21 @@ decoders.QueryReactionsResponse = (input?: Record) => { decoders.QueryReviewQueueResponse = (input?: Record) => { const typeMappings: TypeMapping = { - items: { type: 'ReviewQueueItem', isSingle: false }, + items: { type: 'ReviewQueueItemResponse', isSingle: false }, + }; + return decode(typeMappings, input); +}; + +decoders.QuerySegmentTargetsResponse = (input?: Record) => { + const typeMappings: TypeMapping = { + targets: { type: 'SegmentTargetResponse', isSingle: false }, + }; + return decode(typeMappings, input); +}; + +decoders.QuerySegmentsResponse = (input?: Record) => { + const typeMappings: TypeMapping = { + segments: { type: 'SegmentResponse', isSingle: false }, }; return decode(typeMappings, input); }; @@ -1361,7 +1538,7 @@ decoders.Reaction = (input?: Record) => { updated_at: { type: 'DatetimeType', isSingle: true }, - user: { type: 'UserObject', isSingle: true }, + user: { type: 'User', isSingle: true }, }; return decode(typeMappings, input); }; @@ -1402,15 +1579,6 @@ decoders.ReactivateUserResponse = (input?: Record) => { return decode(typeMappings, input); }; -decoders.Read = (input?: Record) => { - const typeMappings: TypeMapping = { - last_read: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserObject', isSingle: true }, - }; - return decode(typeMappings, input); -}; - decoders.ReadStateResponse = (input?: Record) => { const typeMappings: TypeMapping = { last_read: { type: 'DatetimeType', isSingle: true }, @@ -1436,9 +1604,9 @@ decoders.ReviewQueueItem = (input?: Record) => { reviewed_at: { type: 'NullTime', isSingle: true }, - assigned_to: { type: 'UserObject', isSingle: true }, + assigned_to: { type: 'User', isSingle: true }, - entity_creator: { type: 'UserObject', isSingle: true }, + entity_creator: { type: 'EntityCreator', isSingle: true }, feeds_v2_reaction: { type: 'Reaction', isSingle: true }, @@ -1447,6 +1615,33 @@ decoders.ReviewQueueItem = (input?: Record) => { return decode(typeMappings, input); }; +decoders.ReviewQueueItemResponse = (input?: Record) => { + const typeMappings: TypeMapping = { + created_at: { type: 'DatetimeType', isSingle: true }, + + updated_at: { type: 'DatetimeType', isSingle: true }, + + actions: { type: 'ActionLogResponse', isSingle: false }, + + bans: { type: 'Ban', isSingle: false }, + + flags: { type: 'Flag2Response', isSingle: false }, + + completed_at: { type: 'DatetimeType', isSingle: true }, + + reviewed_at: { type: 'DatetimeType', isSingle: true }, + + assigned_to: { type: 'UserResponse', isSingle: true }, + + entity_creator: { type: 'EntityCreatorResponse', isSingle: true }, + + feeds_v2_reaction: { type: 'Reaction', isSingle: true }, + + message: { type: 'MessageResponse', isSingle: true }, + }; + return decode(typeMappings, input); +}; + decoders.Role = (input?: Record) => { const typeMappings: TypeMapping = { created_at: { type: 'DatetimeType', isSingle: true }, @@ -1469,13 +1664,13 @@ decoders.SearchResultMessage = (input?: Record) => { updated_at: { type: 'DatetimeType', isSingle: true }, - latest_reactions: { type: 'Reaction', isSingle: false }, + latest_reactions: { type: 'ReactionResponse', isSingle: false }, - mentioned_users: { type: 'UserObject', isSingle: false }, + mentioned_users: { type: 'UserResponse', isSingle: false }, - own_reactions: { type: 'Reaction', isSingle: false }, + own_reactions: { type: 'ReactionResponse', isSingle: false }, - reaction_groups: { type: 'ReactionGroupResponse', isSingle: false }, + user: { type: 'UserResponse', isSingle: true }, deleted_at: { type: 'DatetimeType', isSingle: true }, @@ -1485,17 +1680,46 @@ decoders.SearchResultMessage = (input?: Record) => { pinned_at: { type: 'DatetimeType', isSingle: true }, - thread_participants: { type: 'UserObject', isSingle: false }, + thread_participants: { type: 'UserResponse', isSingle: false }, channel: { type: 'ChannelResponse', isSingle: true }, - pinned_by: { type: 'UserObject', isSingle: true }, + pinned_by: { type: 'UserResponse', isSingle: true }, - poll: { type: 'Poll', isSingle: true }, + poll: { type: 'PollResponseData', isSingle: true }, - quoted_message: { type: 'Message', isSingle: true }, + quoted_message: { type: 'MessageResponse', isSingle: true }, - user: { type: 'UserObject', isSingle: true }, + reaction_groups: { type: 'ReactionGroupResponse', isSingle: false }, + }; + return decode(typeMappings, input); +}; + +decoders.Segment = (input?: Record) => { + const typeMappings: TypeMapping = { + created_at: { type: 'DatetimeType', isSingle: true }, + + updated_at: { type: 'DatetimeType', isSingle: true }, + + deleted_at: { type: 'DatetimeType', isSingle: true }, + }; + return decode(typeMappings, input); +}; + +decoders.SegmentResponse = (input?: Record) => { + const typeMappings: TypeMapping = { + created_at: { type: 'DatetimeType', isSingle: true }, + + deleted_at: { type: 'DatetimeType', isSingle: true }, + + updated_at: { type: 'DatetimeType', isSingle: true }, + }; + return decode(typeMappings, input); +}; + +decoders.SegmentTargetResponse = (input?: Record) => { + const typeMappings: TypeMapping = { + created_at: { type: 'DatetimeType', isSingle: true }, }; return decode(typeMappings, input); }; @@ -1516,6 +1740,13 @@ decoders.SendReactionResponse = (input?: Record) => { return decode(typeMappings, input); }; +decoders.StartCampaignResponse = (input?: Record) => { + const typeMappings: TypeMapping = { + campaign: { type: 'CampaignResponse', isSingle: true }, + }; + return decode(typeMappings, input); +}; + decoders.StopLiveResponse = (input?: Record) => { const typeMappings: TypeMapping = { call: { type: 'CallResponse', isSingle: true }, @@ -1540,7 +1771,7 @@ decoders.ThreadParticipant = (input?: Record) => { left_thread_at: { type: 'DatetimeType', isSingle: true }, - user: { type: 'UserObject', isSingle: true }, + user: { type: 'UserResponse', isSingle: true }, }; return decode(typeMappings, input); }; @@ -1559,34 +1790,9 @@ decoders.ThreadResponse = (input?: Record) => { channel: { type: 'ChannelResponse', isSingle: true }, - created_by: { type: 'UserObject', isSingle: true }, - - parent_message: { type: 'Message', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders.ThreadState = (input?: Record) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - latest_replies: { type: 'Message', isSingle: false }, - - deleted_at: { type: 'DatetimeType', isSingle: true }, - - last_message_at: { type: 'DatetimeType', isSingle: true }, - - read: { type: 'Read', isSingle: false }, - - thread_participants: { type: 'ThreadParticipant', isSingle: false }, - - channel: { type: 'Channel', isSingle: true }, - - created_by: { type: 'UserObject', isSingle: true }, + created_by: { type: 'UserResponse', isSingle: true }, - parent_message: { type: 'Message', isSingle: true }, + parent_message: { type: 'MessageResponse', isSingle: true }, }; return decode(typeMappings, input); }; @@ -1603,7 +1809,7 @@ decoders.ThreadStateResponse = (input?: Record) => { last_message_at: { type: 'DatetimeType', isSingle: true }, - read: { type: 'Read', isSingle: false }, + read: { type: 'ReadStateResponse', isSingle: false }, thread_participants: { type: 'ThreadParticipant', isSingle: false }, @@ -1611,7 +1817,7 @@ decoders.ThreadStateResponse = (input?: Record) => { created_by: { type: 'UserResponse', isSingle: true }, - parent_message: { type: 'Message', isSingle: true }, + parent_message: { type: 'MessageResponse', isSingle: true }, }; return decode(typeMappings, input); }; @@ -1695,7 +1901,7 @@ decoders.UpdateChannelResponse = (input?: Record) => { channel: { type: 'ChannelResponse', isSingle: true }, - message: { type: 'Message', isSingle: true }, + message: { type: 'MessageResponse', isSingle: true }, }; return decode(typeMappings, input); }; @@ -1725,14 +1931,14 @@ decoders.UpdateMemberPartialResponse = (input?: Record) => { decoders.UpdateMessagePartialResponse = (input?: Record) => { const typeMappings: TypeMapping = { - message: { type: 'Message', isSingle: true }, + message: { type: 'MessageResponse', isSingle: true }, }; return decode(typeMappings, input); }; decoders.UpdateMessageResponse = (input?: Record) => { const typeMappings: TypeMapping = { - message: { type: 'Message', isSingle: true }, + message: { type: 'MessageResponse', isSingle: true }, }; return decode(typeMappings, input); }; @@ -1774,6 +1980,29 @@ decoders.UpsertPushProviderResponse = (input?: Record) => { return decode(typeMappings, input); }; +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 }, + + push_notifications: { type: 'PushNotificationSettings', isSingle: true }, + }; + return decode(typeMappings, input); +}; + decoders.UserBlock = (input?: Record) => { const typeMappings: TypeMapping = { created_at: { type: 'DatetimeType', isSingle: true }, @@ -1789,9 +2018,9 @@ decoders.UserMute = (input?: Record) => { expires: { type: 'DatetimeType', isSingle: true }, - target: { type: 'UserObject', isSingle: true }, + target: { type: 'User', isSingle: true }, - user: { type: 'UserObject', isSingle: true }, + user: { type: 'User', isSingle: true }, }; return decode(typeMappings, input); }; @@ -1811,34 +2040,13 @@ decoders.UserMuteResponse = (input?: Record) => { return decode(typeMappings, input); }; -decoders.UserObject = (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 }, - - revoke_tokens_issued_before: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - push_notifications: { type: 'PushNotificationSettings', isSingle: true }, - }; - return decode(typeMappings, input); -}; - decoders.UserResponse = (input?: Record) => { const typeMappings: TypeMapping = { created_at: { type: 'DatetimeType', isSingle: true }, updated_at: { type: 'DatetimeType', isSingle: true }, - devices: { type: 'Device', isSingle: false }, + devices: { type: 'DeviceResponse', isSingle: false }, ban_expires: { type: 'DatetimeType', isSingle: true }, @@ -1858,43 +2066,29 @@ decoders.UserResponse = (input?: Record) => { return decode(typeMappings, input); }; -decoders.VelocityFilterConfig = (input?: Record) => { - const typeMappings: TypeMapping = { - rule: { type: 'VelocityFilterConfigRule', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders.VelocityFilterConfigRule = (input?: Record) => { - const typeMappings: TypeMapping = { - timeout: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - decoders.WSEvent = (input?: Record) => { const typeMappings: TypeMapping = { created_at: { type: 'DatetimeType', isSingle: true }, channel: { type: 'ChannelResponse', isSingle: true }, - created_by: { type: 'UserObject', isSingle: true }, + created_by: { type: 'UserResponse', isSingle: true }, - me: { type: 'OwnUser', isSingle: true }, + me: { type: 'OwnUserResponse', isSingle: true }, member: { type: 'ChannelMember', isSingle: true }, - message: { type: 'Message', isSingle: true }, + message: { type: 'MessageResponse', isSingle: true }, - poll: { type: 'Poll', isSingle: true }, + poll: { type: 'PollResponseData', isSingle: true }, - poll_vote: { type: 'PollVote', isSingle: true }, + poll_vote: { type: 'PollVoteResponseData', isSingle: true }, - reaction: { type: 'Reaction', isSingle: true }, + reaction: { type: 'ReactionResponse', isSingle: true }, thread: { type: 'ThreadResponse', isSingle: true }, - user: { type: 'UserObject', isSingle: true }, + user: { type: 'UserResponse', isSingle: true }, }; return decode(typeMappings, input); }; diff --git a/src/gen/models/index.ts b/src/gen/models/index.ts index 2f42e7a..caa52b8 100644 --- a/src/gen/models/index.ts +++ b/src/gen/models/index.ts @@ -1,3 +1,23 @@ +export interface AIImageConfig { + enabled: boolean; + + rules: AWSRekognitionRule[]; + + async?: boolean; +} + +export interface AITextConfig { + enabled: boolean; + + profile: string; + + rules: BodyguardRule[]; + + severity_rules: BodyguardSeverityRule[]; + + async?: boolean; +} + export interface APIError { code: number; @@ -66,16 +86,18 @@ export interface APNS { title: string; } -export interface AWSRekognitionConfig { - enabled?: boolean; - - rules?: AWSRekognitionRule[]; -} - export interface AWSRekognitionRule { - action: 'flag' | 'shadow' | 'remove'; + action: + | 'flag' + | 'shadow' + | 'remove' + | 'bounce' + | 'bounce_flag' + | 'bounce_remove'; label: string; + + min_confidence: number; } export interface Action { @@ -97,6 +119,8 @@ export interface ActionLog { reason: string; + reporter_type: string; + review_queue_item_id: string; target_user_id: string; @@ -107,9 +131,9 @@ export interface ActionLog { review_queue_item?: ReviewQueueItem; - target_user?: UserObject; + target_user?: User; - user?: UserObject; + user?: User; } export interface ActionLogResponse { @@ -119,8 +143,12 @@ export interface ActionLogResponse { reason: string; + target_user_id: string; + type: string; + user_id: string; + custom: Record; review_queue_item?: ReviewQueueItem; @@ -259,6 +287,10 @@ export interface Attachment { image_url?: string; + latitude?: number; + + longitude?: number; + og_scrape_url?: string; original_height?: number; @@ -267,6 +299,8 @@ export interface Attachment { pretext?: string; + stopped_sharing?: boolean; + text?: string; thumb_url?: string; @@ -345,13 +379,21 @@ export interface AutomodDetails { } export interface AutomodPlatformCircumventionConfig { - enabled?: boolean; + enabled: boolean; - rules?: AutomodRule[]; + rules: AutomodRule[]; + + async?: boolean; } export interface AutomodRule { - action: 'flag' | 'shadow' | 'remove'; + action: + | 'flag' + | 'shadow' + | 'remove' + | 'bounce' + | 'bounce_flag' + | 'bounce_remove'; label: string; @@ -359,9 +401,11 @@ export interface AutomodRule { } export interface AutomodSemanticFiltersConfig { - enabled?: boolean; + enabled: boolean; + + rules: AutomodSemanticFiltersRule[]; - rules?: AutomodSemanticFiltersRule[]; + async?: boolean; } export interface AutomodSemanticFiltersRule { @@ -373,9 +417,11 @@ export interface AutomodSemanticFiltersRule { } export interface AutomodToxicityConfig { - enabled?: boolean; + enabled: boolean; + + rules: AutomodRule[]; - rules?: AutomodRule[]; + async?: boolean; } export interface AzureRequest { @@ -417,14 +463,16 @@ export interface Ban { channel?: Channel; - created_by?: UserObject; + created_by?: User; - target?: UserObject; + target?: User; } export interface BanActionRequest { channel_ban_only?: boolean; + ip_ban?: boolean; + reason?: string; shadow?: boolean; @@ -467,9 +515,11 @@ export interface BanResponse { } export interface BlockListConfig { - enabled?: boolean; + enabled: boolean; + + rules: BlockListRule[]; - rules?: BlockListRule[]; + async?: boolean; } export interface BlockListOptions { @@ -491,7 +541,13 @@ export interface BlockListResponse { } export interface BlockListRule { - action: 'flag' | 'shadow' | 'remove'; + action: + | 'flag' + | 'shadow' + | 'remove' + | 'bounce' + | 'bounce_flag' + | 'bounce_remove'; name: string; } @@ -534,24 +590,28 @@ export interface BlockedUserResponse { user: UserResponse; } -export interface BodyguardConfig { - enabled?: boolean; - - profile?: string; - - rules?: BodyguardRule[]; - - severity_rules?: BodyguardSeverityRule[]; -} - export interface BodyguardRule { - action: 'flag' | 'shadow' | 'remove'; + action: + | 'flag' + | 'shadow' + | 'remove' + | 'bounce' + | 'bounce_flag' + | 'bounce_remove'; label: string; + + severity_rules: BodyguardSeverityRule[]; } export interface BodyguardSeverityRule { - action: 'flag' | 'shadow' | 'remove'; + action: + | 'flag' + | 'shadow' + | 'remove' + | 'bounce' + | 'bounce_flag' + | 'bounce_remove'; severity: 'low' | 'medium' | 'high' | 'critical'; } @@ -585,15 +645,21 @@ export interface CallEvent { end_timestamp: number; + internal: boolean; + + kind: string; + severity: number; timestamp: number; type: string; + category?: string; + component?: string; - additional?: Record; + issue_tags?: string[]; } export interface CallIngressResponse { @@ -641,6 +707,8 @@ export interface CallRequest { export interface CallResponse { backstage: boolean; + captioning: boolean; + cid: string; created_at: Date; @@ -852,6 +920,80 @@ export interface CallTypeResponse { external_storage?: string; } +export interface CampaignChannelTemplate { + type: string; + + custom: Record; + + id?: string; + + members?: string[]; +} + +export interface CampaignMessageTemplate { + poll_id: string; + + text: string; + + attachments: Attachment[]; + + custom: Record; +} + +export interface CampaignResponse { + create_channels: boolean; + + created_at: Date; + + description: string; + + id: string; + + name: string; + + sender_id: string; + + skip_push: boolean; + + skip_webhook: boolean; + + status: string; + + updated_at: Date; + + segment_ids: string[]; + + segments: Segment[]; + + user_ids: string[]; + + users: UserResponse[]; + + stats: CampaignStatsResponse; + + scheduled_for?: Date; + + stop_at?: Date; + + channel_template?: CampaignChannelTemplate; + + message_template?: CampaignMessageTemplate; + + sender?: UserResponse; +} + +export interface CampaignStatsResponse { + progress: number; + + stats_channels_created: number; + + stats_completed_at: Date; + + stats_messages_sent: number; + + stats_started_at: Date; +} + export interface CastPollVoteRequest { user_id?: string; @@ -897,11 +1039,11 @@ export interface Channel { config?: ChannelConfig; - config_overrides?: ChannelConfig; + config_overrides?: ConfigOverrides; - created_by?: UserObject; + created_by?: User; - truncated_by?: UserObject; + truncated_by?: User; } export interface ChannelConfig { @@ -939,6 +1081,8 @@ export interface ChannelConfig { search: boolean; + skip_last_msg_update_for_system_msgs: boolean; + typing_events: boolean; updated_at: Date; @@ -953,6 +1097,10 @@ export interface ChannelConfig { blocklist_behavior?: 'flag' | 'block' | 'shadow_block'; + partition_size?: number; + + partition_ttl?: string; + allowed_flag_reasons?: string[]; blocklists?: BlockListOptions[]; @@ -995,6 +1143,8 @@ export interface ChannelConfigWithInfo { search: boolean; + skip_last_msg_update_for_system_msgs: boolean; + typing_events: boolean; updated_at: Date; @@ -1011,7 +1161,7 @@ export interface ChannelConfigWithInfo { partition_size?: number; - partition_ttl?: number; + partition_ttl?: string; allowed_flag_reasons?: string[]; @@ -1091,6 +1241,8 @@ export interface ChannelMember { custom: Record; + archived_at?: Date; + ban_expires?: Date; deleted_at?: Date; @@ -1103,11 +1255,15 @@ export interface ChannelMember { is_moderator?: boolean; + pinned_at?: Date; + + role?: 'member' | 'moderator' | 'admin' | 'owner'; + status?: string; user_id?: string; - user?: UserObject; + user?: UserResponse; } export interface ChannelMemberResponse { @@ -1125,6 +1281,8 @@ export interface ChannelMemberResponse { custom: Record; + archived_at?: Date; + ban_expires?: Date; deleted_at?: Date; @@ -1137,6 +1295,8 @@ export interface ChannelMemberResponse { is_moderator?: boolean; + pinned_at?: Date; + role?: 'member' | 'moderator' | 'admin' | 'owner'; status?: string; @@ -1155,9 +1315,52 @@ export interface ChannelMute { channel?: ChannelResponse; - user?: UserObject; + user?: UserResponse; } +export const ChannelOwnCapability = { + BAN_CHANNEL_MEMBERS: 'ban-channel-members', + CAST_POLL_VOTE: 'cast-poll-vote', + CONNECT_EVENTS: 'connect-events', + CREATE_ATTACHMENT: 'create-attachment', + CREATE_CALL: 'create-call', + DELETE_ANY_MESSAGE: 'delete-any-message', + DELETE_CHANNEL: 'delete-channel', + DELETE_OWN_MESSAGE: 'delete-own-message', + FLAG_MESSAGE: 'flag-message', + FREEZE_CHANNEL: 'freeze-channel', + JOIN_CALL: 'join-call', + JOIN_CHANNEL: 'join-channel', + LEAVE_CHANNEL: 'leave-channel', + MUTE_CHANNEL: 'mute-channel', + PIN_MESSAGE: 'pin-message', + QUERY_POLL_VOTES: 'query-poll-votes', + QUOTE_MESSAGE: 'quote-message', + READ_EVENTS: 'read-events', + SEARCH_MESSAGES: 'search-messages', + SEND_CUSTOM_EVENTS: 'send-custom-events', + SEND_LINKS: 'send-links', + SEND_MESSAGE: 'send-message', + SEND_POLL: 'send-poll', + SEND_REACTION: 'send-reaction', + SEND_REPLY: 'send-reply', + SEND_TYPING_EVENTS: 'send-typing-events', + SET_CHANNEL_COOLDOWN: 'set-channel-cooldown', + SKIP_SLOW_MODE: 'skip-slow-mode', + SLOW_MODE: 'slow-mode', + TYPING_EVENTS: 'typing-events', + UPDATE_ANY_MESSAGE: 'update-any-message', + UPDATE_CHANNEL: 'update-channel', + UPDATE_CHANNEL_MEMBERS: 'update-channel-members', + UPDATE_OWN_MESSAGE: 'update-own-message', + UPDATE_THREAD: 'update-thread', + UPLOAD_FILE: 'upload-file', +} as const; + +// eslint-disable-next-line @typescript-eslint/no-redeclare +export type ChannelOwnCapability = + (typeof ChannelOwnCapability)[keyof typeof ChannelOwnCapability]; + export interface ChannelResponse { cid: string; @@ -1203,13 +1406,13 @@ export interface ChannelResponse { members?: ChannelMember[]; - own_capabilities?: string[]; + own_capabilities?: ChannelOwnCapability[]; config?: ChannelConfigWithInfo; - created_by?: UserObject; + created_by?: UserResponse; - truncated_by?: UserObject; + truncated_by?: UserResponse; } export interface ChannelStateResponse { @@ -1221,7 +1424,7 @@ export interface ChannelStateResponse { pinned_messages: MessageResponse[]; - threads: ThreadState[]; + threads: ThreadStateResponse[]; hidden?: boolean; @@ -1247,7 +1450,7 @@ export interface ChannelStateResponseFields { pinned_messages: MessageResponse[]; - threads: ThreadState[]; + threads: ThreadStateResponse[]; hidden?: boolean; @@ -1301,6 +1504,8 @@ export interface ChannelTypeConfig { search: boolean; + skip_last_msg_update_for_system_msgs: boolean; + typing_events: boolean; updated_at: Date; @@ -1321,7 +1526,7 @@ export interface ChannelTypeConfig { partition_size?: number; - partition_ttl?: number; + partition_ttl?: string; allowed_flag_reasons?: string[]; @@ -1381,6 +1586,8 @@ export interface CheckRequest { entity_type: string; + test_mode?: boolean; + user_id?: string; moderation_payload?: ModerationPayload; @@ -1482,6 +1689,30 @@ export interface Config { role_map?: Record; } +export interface ConfigOverrides { + commands: string[]; + + grants: Record; + + blocklist?: string; + + blocklist_behavior?: 'flag' | 'block'; + + max_message_length?: number; + + quotes?: boolean; + + reactions?: boolean; + + replies?: boolean; + + typing_events?: boolean; + + uploads?: boolean; + + url_enrichment?: boolean; +} + export interface ConfigResponse { async: boolean; @@ -1491,20 +1722,18 @@ export interface ConfigResponse { updated_at: Date; + ai_image_config?: AIImageConfig; + + ai_text_config?: AITextConfig; + automod_platform_circumvention_config?: AutomodPlatformCircumventionConfig; automod_semantic_filters_config?: AutomodSemanticFiltersConfig; automod_toxicity_config?: AutomodToxicityConfig; - aws_rek_og_nition_config?: AWSRekognitionConfig; - block_list_config?: BlockListConfig; - bodyguard_config?: BodyguardConfig; - - go_og_le_vision_config?: GoogleVisionConfig; - velocity_filter_config?: VelocityFilterConfig; } @@ -1515,7 +1744,7 @@ export interface Coordinates { } export interface Count { - app_roximate: boolean; + approximate: boolean; value: number; } @@ -1589,7 +1818,7 @@ export interface CreateChannelTypeRequest { mark_messages_pending?: boolean; - message_retention?: string; + message_retention?: 'infinite' | 'numeric'; mutes?: boolean; @@ -1609,6 +1838,8 @@ export interface CreateChannelTypeRequest { search?: boolean; + skip_last_msg_update_for_system_msgs?: boolean; + typing_events?: boolean; uploads?: boolean; @@ -1661,6 +1892,8 @@ export interface CreateChannelTypeResponse { search: boolean; + skip_last_msg_update_for_system_msgs: boolean; + typing_events: boolean; updated_at: Date; @@ -1681,7 +1914,7 @@ export interface CreateChannelTypeResponse { partition_size?: number; - partition_ttl?: number; + partition_ttl?: string; allowed_flag_reasons?: string[]; @@ -1972,6 +2205,10 @@ export interface DeleteMessageResponse { message: MessageResponse; } +export interface DeleteModerationConfigResponse { + duration: string; +} + export interface DeleteModerationTemplateResponse { duration: string; } @@ -1984,6 +2221,10 @@ export interface DeleteRecordingResponse { duration: string; } +export interface DeleteSegmentTargetsRequest { + target_ids: string[]; +} + export interface DeleteTranscriptionResponse { duration: string; } @@ -1991,6 +2232,8 @@ export interface DeleteTranscriptionResponse { export interface DeleteUserRequest { delete_conversation_channels?: boolean; + delete_feeds_content?: boolean; + hard_delete?: boolean; mark_messages_deleted?: boolean; @@ -2023,7 +2266,7 @@ export interface Device { id: string; - push_provider: string; + push_provider: 'firebase' | 'apn' | 'huawei' | 'xiaomi'; user_id: string; @@ -2044,6 +2287,24 @@ export interface DeviceErrorInfo { provider_name: string; } +export interface DeviceResponse { + created_at: Date; + + id: string; + + push_provider: string; + + user_id: string; + + disabled?: boolean; + + disabled_reason?: string; + + push_provider_name?: string; + + voip?: boolean; +} + export interface EdgeResponse { continent_code: string; @@ -2083,7 +2344,7 @@ export interface EgressRTMPResponse { export interface EgressResponse { broadcasting: boolean; - rtmp_s: EgressRTMPResponse[]; + rtmps: EgressRTMPResponse[]; hls?: EgressHLSResponse; } @@ -2148,72 +2409,164 @@ export interface EnrichedReaction { user?: Data; } -export interface ErrorResult { - type: string; +export interface EntityCreator { + ban_count: number; - stacktrace?: string; + banned: boolean; - version?: string; -} + deleted_content_count: number; -export interface EventNotificationSettings { - enabled: boolean; + id: string; - apns: APNS; -} + online: boolean; -export interface EventRequest { - type: string; + role: string; - parent_id?: string; + custom: Record; - user_id?: string; + ban_expires?: Date; - custom?: Record; + created_at?: Date; - user?: UserRequest; -} + deactivated_at?: Date; -export interface EventResponse { - duration: string; + deleted_at?: Date; - event: WSEvent; -} + invisible?: boolean; -export interface ExportChannelsRequest { - channels: ChannelExport[]; + language?: string; - clear_deleted_message_text?: boolean; + last_active?: Date; - export_users?: boolean; + last_engaged_at?: Date; - include_soft_deleted_channels?: boolean; + revoke_tokens_issued_before?: Date; - include_truncated_messages?: boolean; + updated_at?: Date; - version?: string; -} + teams?: string[]; -export interface ExportChannelsResponse { - duration: string; + privacy_settings?: PrivacySettings; - task_id: string; + push_notifications?: PushNotificationSettings; } -export interface ExportChannelsResult { - url: string; +export interface EntityCreatorResponse { + ban_count: number; - path?: string; + banned: boolean; - s3_bucket_name?: string; -} + created_at: Date; -export interface ExportUserResponse { - duration: string; + deleted_content_count: number; - messages?: Message[]; + id: string; - reactions?: Reaction[]; + invisible: boolean; + + language: string; + + online: boolean; + + role: string; + + shadow_banned: boolean; + + updated_at: Date; + + blocked_user_ids: string[]; + + devices: DeviceResponse[]; + + teams: string[]; + + custom: Record; + + ban_expires?: Date; + + deactivated_at?: Date; + + deleted_at?: Date; + + image?: string; + + last_active?: Date; + + name?: string; + + revoke_tokens_issued_before?: Date; + + privacy_settings?: PrivacySettingsResponse; + + push_notifications?: PushNotificationSettingsResponse; +} + +export interface ErrorResult { + type: string; + + stacktrace?: string; + + version?: string; +} + +export interface EventNotificationSettings { + enabled: boolean; + + apns: APNS; +} + +export interface EventRequest { + type: string; + + parent_id?: string; + + user_id?: string; + + custom?: Record; + + user?: UserRequest; +} + +export interface EventResponse { + duration: string; + + event: WSEvent; +} + +export interface ExportChannelsRequest { + channels: ChannelExport[]; + + clear_deleted_message_text?: boolean; + + export_users?: boolean; + + include_soft_deleted_channels?: boolean; + + include_truncated_messages?: boolean; + + version?: string; +} + +export interface ExportChannelsResponse { + duration: string; + + task_id: string; +} + +export interface ExportChannelsResult { + url: string; + + path?: string; + + s3_bucket_name?: string; +} + +export interface ExportUserResponse { + duration: string; + + messages?: MessageResponse[]; + + reactions?: ReactionResponse[]; user?: UserResponse; } @@ -2333,7 +2686,37 @@ export interface Flag2 { moderation_payload?: ModerationPayload; - user?: UserObject; + user?: User; +} + +export interface Flag2Response { + created_at: Date; + + entity_id: string; + + entity_type: string; + + updated_at: Date; + + user_id: string; + + result: Array>; + + entity_creator_id?: string; + + reason?: string; + + review_queue_item_id?: string; + + type?: string; + + labels?: string[]; + + custom?: Record; + + moderation_payload?: ModerationPayload; + + user?: UserResponse; } export interface FlagDetails { @@ -2367,10 +2750,10 @@ export interface FlagRequest { entity_type: string; - reason: string; - entity_creator_id?: string; + reason?: string; + user_id?: string; custom?: Record; @@ -2417,7 +2800,7 @@ export interface FullUserResponse { channel_mutes: ChannelMute[]; - devices: Device[]; + devices: DeviceResponse[]; mutes: UserMuteResponse[]; @@ -2566,6 +2949,12 @@ export interface GetCallTypeResponse { external_storage?: string; } +export interface GetCampaignResponse { + duration: string; + + campaign?: CampaignResponse; +} + export interface GetChannelTypeResponse { automod: 'disabled' | 'simple' | 'AI'; @@ -2603,6 +2992,8 @@ export interface GetChannelTypeResponse { search: boolean; + skip_last_msg_update_for_system_msgs: boolean; + typing_events: boolean; updated_at: Date; @@ -2623,7 +3014,7 @@ export interface GetChannelTypeResponse { partition_size?: number; - partition_ttl?: number; + partition_ttl?: string; allowed_flag_reasons?: string[]; @@ -2697,7 +3088,7 @@ export interface GetImportResponse { export interface GetManyMessagesResponse { duration: string; - messages: Message[]; + messages: MessageResponse[]; } export interface GetMessageResponse { @@ -2731,6 +3122,10 @@ export interface GetOGResponse { image_url?: string; + latitude?: number; + + longitude?: number; + og_scrape_url?: string; original_height?: number; @@ -2739,6 +3134,8 @@ export interface GetOGResponse { pretext?: string; + stopped_sharing?: boolean; + text?: string; thumb_url?: string; @@ -2807,9 +3204,15 @@ export interface GetRepliesResponse { export interface GetReviewQueueItemResponse { duration: string; - history: ReviewQueueItem[]; + history: ReviewQueueItemResponse[]; - item?: ReviewQueueItem; + item?: ReviewQueueItemResponse; +} + +export interface GetSegmentResponse { + duration: string; + + segment?: SegmentResponse; } export interface GetTaskResponse { @@ -3029,12 +3432,16 @@ export interface LayoutSettings { name: 'spotlight' | 'grid' | 'single-participant' | 'mobile' | 'custom'; + detect_orientation?: boolean; + options?: Record; } export interface LayoutSettingsRequest { name: 'spotlight' | 'grid' | 'single-participant' | 'mobile' | 'custom'; + detect_orientation?: boolean; + external_app_url?: string; external_css_url?: string; @@ -3049,6 +3456,8 @@ export interface LayoutSettingsResponse { name: 'spotlight' | 'grid' | 'single-participant' | 'mobile' | 'custom'; + detect_orientation?: boolean; + options?: Record; } @@ -3105,7 +3514,7 @@ export interface ListCommandsResponse { export interface ListDevicesResponse { duration: string; - devices: Device[]; + devices: DeviceResponse[]; } export interface ListExternalStorageResponse { @@ -3158,16 +3567,6 @@ export interface Location { subdivision_iso_code: string; } -export interface MOSStats { - average_score: number; - - max_score: number; - - min_score: number; - - hist_og_ram_duration_seconds: number[]; -} - export interface MarkChannelsReadRequest { user_id?: string; @@ -3192,6 +3591,12 @@ export interface MarkReadResponse { event?: MessageReadEvent; } +export interface MarkReviewedRequest { + content_to_mark_as_reviewed_limit?: number; + + disable_marking_content_as_reviewed?: boolean; +} + export interface MarkUnreadRequest { message_id?: string; @@ -3263,7 +3668,7 @@ export interface Message { text: string; - type: 'regular' | 'ephemeral' | 'error' | 'reply' | 'system' | 'deleted'; + type: string; updated_at: Date; @@ -3271,7 +3676,7 @@ export interface Message { latest_reactions: Reaction[]; - mentioned_users: UserObject[]; + mentioned_users: User[]; own_reactions: Reaction[]; @@ -3305,19 +3710,21 @@ export interface Message { show_in_channel?: boolean; - thread_participants?: UserObject[]; + thread_participants?: User[]; i18n?: Record; image_labels?: Record; - pinned_by?: UserObject; + moderation?: ModerationV2Response; + + pinned_by?: User; poll?: Poll; quoted_message?: Message; - user?: UserObject; + user?: User; } export interface MessageActionRequest { @@ -3437,7 +3844,7 @@ export interface MessageReadEvent { thread?: ThreadResponse; - user?: UserObject; + user?: UserResponse; } export interface MessageRequest { @@ -3499,7 +3906,7 @@ export interface MessageResponse { text: string; - type: string; + type: 'regular' | 'ephemeral' | 'error' | 'reply' | 'system' | 'deleted'; updated_at: Date; @@ -3545,11 +3952,13 @@ export interface MessageResponse { image_labels?: Record; + moderation?: ModerationV2Response; + pinned_by?: UserResponse; - poll?: Poll; + poll?: PollResponseData; - quoted_message?: Message; + quoted_message?: MessageResponse; reaction_groups?: Record; } @@ -3581,7 +3990,7 @@ export interface MessageWithChannelResponse { text: string; - type: string; + type: 'regular' | 'ephemeral' | 'error' | 'reply' | 'system' | 'deleted'; updated_at: Date; @@ -3629,11 +4038,13 @@ export interface MessageWithChannelResponse { image_labels?: Record; + moderation?: ModerationV2Response; + pinned_by?: UserResponse; - poll?: Poll; + poll?: PollResponseData; - quoted_message?: Message; + quoted_message?: MessageResponse; reaction_groups?: Record; } @@ -3673,13 +4084,35 @@ export interface ModerationResponse { } export interface ModerationUsageStats { - bucket: string; + app_pk: number; + + id: number; - metric: string; + organization_id: number; + + reference_date: Date; updated_at: Date; - value: number; + usage_amount: number; + + usage_type: string; +} + +export interface ModerationV2Response { + action: string; + + original_text: string; + + blocklist_matched?: string; + + platform_circumvented?: boolean; + + semantic_filter_matched?: string; + + image_harms?: string[]; + + text_harms?: string[]; } export interface ModeratorStats { @@ -3810,9 +4243,11 @@ export const OwnCapability = { SEND_AUDIO: 'send-audio', SEND_VIDEO: 'send-video', START_BROADCAST_CALL: 'start-broadcast-call', + START_CLOSED_CAPTIONS_CALL: 'start-closed-captions-call', START_RECORD_CALL: 'start-record-call', START_TRANSCRIPTION_CALL: 'start-transcription-call', STOP_BROADCAST_CALL: 'stop-broadcast-call', + STOP_CLOSED_CAPTIONS_CALL: 'stop-closed-captions-call', STOP_RECORD_CALL: 'stop-record-call', STOP_TRANSCRIPTION_CALL: 'stop-transcription-call', UPDATE_CALL: 'update-call', @@ -3863,6 +4298,8 @@ export interface OwnUser { last_active?: Date; + last_engaged_at?: Date; + blocked_user_ids?: string[]; latest_hidden_channels?: string[]; @@ -3874,6 +4311,62 @@ export interface OwnUser { push_notifications?: PushNotificationSettings; } +export interface OwnUserResponse { + banned: boolean; + + created_at: Date; + + id: string; + + invisible: boolean; + + language: string; + + online: boolean; + + role: string; + + total_unread_count: number; + + unread_channels: number; + + unread_count: number; + + unread_threads: number; + + updated_at: Date; + + channel_mutes: ChannelMute[]; + + devices: DeviceResponse[]; + + mutes: UserMuteResponse[]; + + teams: string[]; + + custom: Record; + + deactivated_at?: Date; + + deleted_at?: Date; + + image?: string; + + last_active?: Date; + + name?: string; + + revoke_tokens_issued_before?: Date; + + blocked_user_ids?: string[]; + + latest_hidden_channels?: string[]; + + privacy_settings?: PrivacySettingsResponse; + + push_notifications?: PushNotificationSettingsResponse; +} + export interface PaginationParams { limit?: number; @@ -3995,7 +4488,7 @@ export interface Poll { voting_visibility?: string; - created_by?: UserObject; + created_by?: User; } export interface PollOption { @@ -4065,6 +4558,8 @@ export interface PollResponseData { voting_visibility: string; + latest_answers: PollVoteResponseData[]; + options: PollOptionResponseData[]; own_votes: PollVoteResponseData[]; @@ -4099,7 +4594,7 @@ export interface PollVote { user_id?: string; - user?: UserObject; + user?: User; } export interface PollVoteResponse { @@ -4408,14 +4903,36 @@ export interface QueryCallsResponse { prev?: string; } -export interface QueryChannelsRequest { +export interface QueryCampaignsRequest { limit?: number; - member_limit?: number; + next?: string; - message_limit?: number; + prev?: string; - offset?: number; + sort?: SortParamRequest[]; + + filter?: Record; +} + +export interface QueryCampaignsResponse { + duration: string; + + campaigns: CampaignResponse[]; + + next?: string; + + prev?: string; +} + +export interface QueryChannelsRequest { + limit?: number; + + member_limit?: number; + + message_limit?: number; + + offset?: number; state?: boolean; @@ -4479,7 +4996,7 @@ export interface QueryMessageFlagsPayload { user_id?: string; - sort?: SortParam[]; + sort?: SortParamRequest[]; filter_conditions?: Record; @@ -4514,6 +5031,32 @@ export interface QueryMessageHistoryResponse { prev?: string; } +export interface QueryModerationConfigsRequest { + limit?: number; + + next?: string; + + prev?: string; + + user_id?: string; + + sort?: SortParamRequest[]; + + filter?: Record; + + user?: UserRequest; +} + +export interface QueryModerationConfigsResponse { + duration: string; + + configs: ConfigResponse[]; + + next?: string; + + prev?: string; +} + export interface QueryModerationLogsRequest { limit?: number; @@ -4533,7 +5076,7 @@ export interface QueryModerationLogsRequest { export interface QueryModerationLogsResponse { duration: string; - l_og_s: ActionLogResponse[]; + logs: ActionLogResponse[]; next?: string; @@ -4603,9 +5146,11 @@ export interface QueryReactionsResponse { export interface QueryReviewQueueRequest { limit?: number; - lock_moderator_duration?: number; + lock_count?: number; + + lock_duration?: number; - lock_moderator_id?: string; + lock_items?: boolean; next?: string; @@ -4625,7 +5170,7 @@ export interface QueryReviewQueueRequest { export interface QueryReviewQueueResponse { duration: string; - items: ReviewQueueItem[]; + items: ReviewQueueItemResponse[]; action_config: Record>; @@ -4636,6 +5181,50 @@ export interface QueryReviewQueueResponse { prev?: string; } +export interface QuerySegmentTargetsRequest { + limit?: number; + + next?: string; + + prev?: string; + + sort?: SortParamRequest[]; + + filter?: Record; +} + +export interface QuerySegmentTargetsResponse { + duration: string; + + targets: SegmentTargetResponse[]; + + next?: string; + + prev?: string; +} + +export interface QuerySegmentsRequest { + filter: Record; + + limit?: number; + + next?: string; + + prev?: string; + + sort?: SortParamRequest[]; +} + +export interface QuerySegmentsResponse { + duration: string; + + segments: SegmentResponse[]; + + next?: string; + + prev?: string; +} + export interface QueryThreadsRequest { limit?: number; @@ -4807,7 +5396,7 @@ export interface Reaction { user_id?: string; - user?: UserObject; + user?: User; } export interface ReactionGroupResponse { @@ -4892,22 +5481,12 @@ export interface ReactivateUsersResponse { task_id: string; } -export interface Read { - last_read: Date; - - unread_messages: number; - - last_read_message_id?: string; - - user?: UserObject; -} - export interface ReadReceipts { - enabled?: boolean; + enabled: boolean; } export interface ReadReceiptsResponse { - enabled: boolean; + enabled?: boolean; } export interface ReadStateResponse { @@ -4921,11 +5500,11 @@ export interface ReadStateResponse { } export interface RecordSettings { - audio_only: boolean; - mode: string; - quality: string; + audio_only?: boolean; + + quality?: string; layout?: LayoutSettings; } @@ -5007,13 +5586,15 @@ export interface ReviewQueueItem { languages: string[]; + teams: string[]; + completed_at: NullTime; reviewed_at: NullTime; - assigned_to?: UserObject; + assigned_to?: User; - entity_creator?: UserObject; + entity_creator?: EntityCreator; feeds_v2_activity?: EnrichedActivity; @@ -5024,6 +5605,52 @@ export interface ReviewQueueItem { moderation_payload?: ModerationPayload; } +export interface ReviewQueueItemResponse { + created_at: Date; + + entity_id: string; + + entity_type: string; + + id: string; + + recommended_action: string; + + reviewed_by: string; + + severity: number; + + status: string; + + updated_at: Date; + + actions: ActionLogResponse[]; + + bans: Ban[]; + + flags: Flag2Response[]; + + languages: string[]; + + completed_at?: Date; + + entity_creator_id?: string; + + reviewed_at?: Date; + + assigned_to?: UserResponse; + + entity_creator?: EntityCreatorResponse; + + feeds_v2_activity?: EnrichedActivity; + + feeds_v2_reaction?: Reaction; + + message?: MessageResponse; + + moderation_payload?: ModerationPayload; +} + export interface RingSettings { auto_cancel_timeout_ms: number; @@ -5161,21 +5788,19 @@ export interface SearchResultMessage { attachments: Attachment[]; - latest_reactions: Reaction[]; + latest_reactions: ReactionResponse[]; - mentioned_users: UserObject[]; + mentioned_users: UserResponse[]; - own_reactions: Reaction[]; + own_reactions: ReactionResponse[]; custom: Record; reaction_counts: Record; - reaction_groups: Record; - reaction_scores: Record; - before_message_send_failed?: boolean; + user: UserResponse; command?: string; @@ -5197,7 +5822,7 @@ export interface SearchResultMessage { show_in_channel?: boolean; - thread_participants?: UserObject[]; + thread_participants?: UserResponse[]; channel?: ChannelResponse; @@ -5205,13 +5830,15 @@ export interface SearchResultMessage { image_labels?: Record; - pinned_by?: UserObject; + moderation?: ModerationV2Response; - poll?: Poll; + pinned_by?: UserResponse; - quoted_message?: Message; + poll?: PollResponseData; + + quoted_message?: MessageResponse; - user?: UserObject; + reaction_groups?: Record; } export interface SearchWarning { @@ -5224,6 +5851,66 @@ export interface SearchWarning { channel_search_cids?: string[]; } +export interface Segment { + all_sender_channels: boolean; + + all_users: boolean; + + created_at: Date; + + id: string; + + name: string; + + size: number; + + type: string; + + updated_at: Date; + + deleted_at?: Date; + + description?: string; + + task_id?: string; + + filter?: Record; +} + +export interface SegmentResponse { + all_sender_channels: boolean; + + all_users: boolean; + + created_at: Date; + + deleted_at: Date; + + description: string; + + id: string; + + name: string; + + size: number; + + type: string; + + updated_at: Date; + + filter: Record; +} + +export interface SegmentTargetResponse { + app_pk: number; + + created_at: Date; + + segment_id: string; + + target_id: string; +} + export interface SendCallEventRequest { user_id?: string; @@ -5294,16 +5981,28 @@ export interface ShowChannelResponse { duration: string; } -export interface SortParam { +export interface SortParamRequest { direction?: number; field?: string; } -export interface SortParamRequest { - direction?: number; +export interface StartCampaignRequest { + scheduled_for?: Date; - field?: string; + stop_at?: Date; +} + +export interface StartCampaignResponse { + duration: string; + + campaign?: CampaignResponse; +} + +export interface StartClosedCaptionsRequest {} + +export interface StartClosedCaptionsResponse { + duration: string; } export interface StartHLSBroadcastingRequest {} @@ -5344,13 +6043,29 @@ export interface StopAllRTMPBroadcastsResponse { duration: string; } +export interface StopCampaignRequest {} + +export interface StopClosedCaptionsRequest {} + +export interface StopClosedCaptionsResponse { + duration: string; +} + export interface StopHLSBroadcastingRequest {} export interface StopHLSBroadcastingResponse { duration: string; } -export interface StopLiveRequest {} +export interface StopLiveRequest { + continue_hls?: boolean; + + continue_recording?: boolean; + + continue_rtmp_broadcast?: boolean; + + continue_transcription?: boolean; +} export interface StopLiveResponse { duration: string; @@ -5405,6 +6120,8 @@ export interface SubmitActionRequest { delete_user?: DeleteUserRequest; + mark_reviewed?: MarkReviewedRequest; + unban?: UnbanActionRequest; user?: UserRequest; @@ -5459,7 +6176,7 @@ export interface ThreadParticipant { user_id?: string; - user?: UserObject; + user?: UserResponse; } export interface ThreadResponse { @@ -5491,45 +6208,9 @@ export interface ThreadResponse { channel?: ChannelResponse; - created_by?: UserObject; - - parent_message?: Message; -} - -export interface ThreadState { - channel_cid: string; - - created_at: Date; - - parent_message_id: string; - - title: string; - - updated_at: Date; - - latest_replies: Message[]; - - custom: Record; - - active_participant_count?: number; - - deleted_at?: Date; - - last_message_at?: Date; - - participant_count?: number; - - reply_count?: number; - - read?: Read[]; - - thread_participants?: ThreadParticipant[]; - - channel?: Channel; - - created_by?: UserObject; + created_by?: UserResponse; - parent_message?: Message; + parent_message?: MessageResponse; } export interface ThreadStateResponse { @@ -5559,7 +6240,7 @@ export interface ThreadStateResponse { reply_count?: number; - read?: Read[]; + read?: ReadStateResponse[]; thread_participants?: ThreadParticipant[]; @@ -5567,7 +6248,7 @@ export interface ThreadStateResponse { created_by?: UserResponse; - parent_message?: Message; + parent_message?: MessageResponse; } export interface Thresholds { @@ -5603,7 +6284,7 @@ export interface TimeStats { } export interface TranscriptionSettings { - closed_caption_mode: string; + closed_caption_mode: 'available' | 'disabled' | 'auto-on'; mode: 'available' | 'disabled' | 'auto-on'; @@ -5613,13 +6294,13 @@ export interface TranscriptionSettings { export interface TranscriptionSettingsRequest { mode: 'available' | 'disabled' | 'auto-on'; - closed_caption_mode?: string; + closed_caption_mode?: 'available' | 'disabled' | 'auto-on'; languages?: string[]; } export interface TranscriptionSettingsResponse { - closed_caption_mode: string; + closed_caption_mode: 'available' | 'disabled' | 'auto-on'; mode: 'available' | 'disabled' | 'auto-on'; @@ -5682,7 +6363,8 @@ export interface TranslateMessageRequest { | 'tr' | 'uk' | 'ur' - | 'vi'; + | 'vi' + | 'lt'; } export interface TruncateChannelRequest { @@ -5708,11 +6390,11 @@ export interface TruncateChannelResponse { } export interface TypingIndicators { - enabled?: boolean; + enabled: boolean; } export interface TypingIndicatorsResponse { - enabled: boolean; + enabled?: boolean; } export interface UnbanActionRequest {} @@ -6042,7 +6724,7 @@ export interface UpdateChannelResponse { channel?: ChannelResponse; - message?: Message; + message?: MessageResponse; } export interface UpdateChannelTypeRequest { @@ -6084,6 +6766,8 @@ export interface UpdateChannelTypeRequest { search?: boolean; + skip_last_msg_update_for_system_msgs?: boolean; + typing_events?: boolean; uploads?: boolean; @@ -6140,6 +6824,8 @@ export interface UpdateChannelTypeResponse { search: boolean; + skip_last_msg_update_for_system_msgs: boolean; + typing_events: boolean; updated_at: Date; @@ -6160,7 +6846,7 @@ export interface UpdateChannelTypeResponse { partition_size?: number; - partition_ttl?: number; + partition_ttl?: string; allowed_flag_reasons?: string[]; @@ -6236,7 +6922,7 @@ export interface UpdateMessagePartialRequest { export interface UpdateMessagePartialResponse { duration: string; - message?: Message; + message?: MessageResponse; pending_message_metadata?: Record; } @@ -6250,7 +6936,7 @@ export interface UpdateMessageRequest { export interface UpdateMessageResponse { duration: string; - message: Message; + message: MessageResponse; pending_message_metadata?: Record; } @@ -6362,19 +7048,23 @@ export interface UpsertConfigRequest { async?: boolean; + ai_image_config?: AIImageConfig; + + ai_text_config?: AITextConfig; + automod_platform_circumvention_config?: AutomodPlatformCircumventionConfig; automod_semantic_filters_config?: AutomodSemanticFiltersConfig; automod_toxicity_config?: AutomodToxicityConfig; - aws_rek_og_nition_config?: AWSRekognitionConfig; + aws_rekognition_config?: AIImageConfig; block_list_config?: BlockListConfig; - bodyguard_config?: BodyguardConfig; + bodyguard_config?: AITextConfig; - go_og_le_vision_config?: GoogleVisionConfig; + google_vision_config?: GoogleVisionConfig; velocity_filter_config?: VelocityFilterConfig; } @@ -6413,6 +7103,44 @@ export interface UpsertPushProviderResponse { push_provider: PushProviderResponse; } +export interface User { + banned: boolean; + + id: string; + + online: boolean; + + role: string; + + custom: Record; + + ban_expires?: Date; + + created_at?: Date; + + deactivated_at?: Date; + + deleted_at?: Date; + + invisible?: boolean; + + language?: string; + + last_active?: Date; + + last_engaged_at?: Date; + + revoke_tokens_issued_before?: Date; + + updated_at?: Date; + + teams?: string[]; + + privacy_settings?: PrivacySettings; + + push_notifications?: PushNotificationSettings; +} + export interface UserBlock { blocked_by_user_id: string; @@ -6428,6 +7156,8 @@ export interface UserCustomEventRequest { } export interface UserInfoResponse { + id: string; + image: string; name: string; @@ -6444,9 +7174,9 @@ export interface UserMute { expires?: Date; - target?: UserObject; + target?: User; - user?: UserObject; + user?: User; } export interface UserMuteResponse { @@ -6461,42 +7191,6 @@ export interface UserMuteResponse { user?: UserResponse; } -export interface UserObject { - banned: boolean; - - id: string; - - online: boolean; - - role: string; - - custom: Record; - - ban_expires?: Date; - - created_at?: Date; - - deactivated_at?: Date; - - deleted_at?: Date; - - invisible?: boolean; - - language?: string; - - last_active?: Date; - - revoke_tokens_issued_before?: Date; - - updated_at?: Date; - - teams?: string[]; - - privacy_settings?: PrivacySettings; - - push_notifications?: PushNotificationSettings; -} - export interface UserRequest { id: string; @@ -6514,7 +7208,7 @@ export interface UserRequest { custom?: Record; - privacy_settings?: PrivacySettings; + privacy_settings?: PrivacySettingsResponse; push_notifications?: PushNotificationSettingsInput; } @@ -6540,7 +7234,7 @@ export interface UserResponse { blocked_user_ids: string[]; - devices: Device[]; + devices: DeviceResponse[]; teams: string[]; @@ -6568,6 +7262,8 @@ export interface UserResponse { export interface UserSessionStats { freeze_duration_seconds: number; + group: string; + max_freeze_fraction: number; max_freezes_duration_seconds: number; @@ -6590,7 +7286,7 @@ export interface UserSessionStats { total_pixels_out: number; - bro_ws_er?: string; + browser?: string; browser_version?: string; @@ -6654,16 +7350,12 @@ export interface UserSessionStats { pub_sub_hints?: MediaPubSubHint; - publisher_audio_mos?: MOSStats; - publisher_jitter?: TimeStats; publisher_latency?: TimeStats; publisher_video_quality_limitation_duration_seconds?: Record; - subscriber_audio_mos?: MOSStats; - subscriber_jitter?: TimeStats; subscriber_latency?: TimeStats; @@ -6682,33 +7374,55 @@ export interface UserStats { } export interface VelocityFilterConfig { - enabled?: boolean; + cascading_actions: boolean; + + enabled: boolean; + + first_message_only: boolean; - rule?: VelocityFilterConfigRule[]; + rules: VelocityFilterConfigRule[]; + + async?: boolean; } export interface VelocityFilterConfigRule { action: 'flag' | 'shadow' | 'remove' | 'ban'; - ip_ban?: boolean; + ban_duration: number; - shadow_ban?: boolean; + cascading_action: 'flag' | 'shadow' | 'remove' | 'ban'; - timeout?: Date; -} + cascading_threshold: number; -export interface VideoQuality { - usage_type?: string; + check_message_context: boolean; + + fast_spam_threshold: number; + + fast_spam_ttl: number; + + ip_ban: boolean; + + shadow_ban: boolean; + + slow_spam_threshold: number; + + slow_spam_ttl: number; - resolution?: VideoResolution; + slow_spam_ban_duration?: number; } -export interface VideoResolution { +export interface VideoDimension { height: number; width: number; } +export interface VideoQuality { + usage_type?: string; + + resolution?: VideoDimension; +} + export interface VideoSettings { access_request_enabled: boolean; @@ -6750,7 +7464,7 @@ export interface VoteData { option_id?: string; - option?: PollOption; + option?: PollOptionResponseData; } export interface WSEvent { @@ -6786,25 +7500,25 @@ export interface WSEvent { channel?: ChannelResponse; - created_by?: UserObject; + created_by?: UserResponse; - me?: OwnUser; + me?: OwnUserResponse; member?: ChannelMember; - message?: Message; + message?: MessageResponse; message_update?: MessageUpdate; - poll?: Poll; + poll?: PollResponseData; - poll_vote?: PollVote; + poll_vote?: PollVoteResponseData; - reaction?: Reaction; + reaction?: ReactionResponse; thread?: ThreadResponse; - user?: UserObject; + user?: UserResponse; } export interface WrappedUnreadCountsResponse { diff --git a/src/gen/moderation/ModerationApi.ts b/src/gen/moderation/ModerationApi.ts index b388b7a..616c56b 100644 --- a/src/gen/moderation/ModerationApi.ts +++ b/src/gen/moderation/ModerationApi.ts @@ -7,6 +7,7 @@ import { CheckResponse, CustomCheckRequest, CustomCheckResponse, + DeleteModerationConfigResponse, DeleteModerationTemplateResponse, FlagRequest, FlagResponse, @@ -17,6 +18,8 @@ import { MuteRequest, MuteResponse, QueryFeedModerationTemplatesResponse, + QueryModerationConfigsRequest, + QueryModerationConfigsResponse, QueryModerationLogsRequest, QueryModerationLogsResponse, QueryReviewQueueRequest, @@ -71,6 +74,7 @@ export class ModerationApi extends BaseApi { entity_creator_id: request?.entity_creator_id, entity_id: request?.entity_id, entity_type: request?.entity_type, + test_mode: request?.test_mode, user_id: request?.user_id, moderation_payload: request?.moderation_payload, options: request?.options, @@ -96,14 +100,16 @@ export class ModerationApi extends BaseApi { const body = { key: request?.key, async: request?.async, + ai_image_config: request?.ai_image_config, + ai_text_config: request?.ai_text_config, automod_platform_circumvention_config: request?.automod_platform_circumvention_config, automod_semantic_filters_config: request?.automod_semantic_filters_config, automod_toxicity_config: request?.automod_toxicity_config, - aws_rek_og_nition_config: request?.aws_rek_og_nition_config, + aws_rekognition_config: request?.aws_rekognition_config, block_list_config: request?.block_list_config, bodyguard_config: request?.bodyguard_config, - go_og_le_vision_config: request?.go_og_le_vision_config, + google_vision_config: request?.google_vision_config, velocity_filter_config: request?.velocity_filter_config, }; @@ -116,6 +122,22 @@ export class ModerationApi extends BaseApi { return { ...response.body, metadata: response.metadata }; }; + deleteConfig = async (request: { + key: string; + }): Promise> => { + const pathParams = { + key: request?.key, + }; + + const response = await this.sendRequest< + StreamResponse + >('DELETE', '/api/v2/moderation/config/{key}', pathParams, undefined); + + decoders.DeleteModerationConfigResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + getConfig = async (request: { key: string; }): Promise> => { @@ -135,6 +157,28 @@ export class ModerationApi extends BaseApi { return { ...response.body, metadata: response.metadata }; }; + queryModerationConfigs = async ( + request?: QueryModerationConfigsRequest, + ): Promise> => { + const body = { + limit: request?.limit, + next: request?.next, + prev: request?.prev, + user_id: request?.user_id, + sort: request?.sort, + filter: request?.filter, + user: request?.user, + }; + + const response = await this.sendRequest< + StreamResponse + >('POST', '/api/v2/moderation/configs', undefined, undefined, body); + + decoders.QueryModerationConfigsResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + customCheck = async ( request: CustomCheckRequest, ): Promise> => { @@ -222,8 +266,8 @@ export class ModerationApi extends BaseApi { const body = { entity_id: request?.entity_id, entity_type: request?.entity_type, - reason: request?.reason, entity_creator_id: request?.entity_creator_id, + reason: request?.reason, user_id: request?.user_id, custom: request?.custom, moderation_payload: request?.moderation_payload, @@ -318,8 +362,9 @@ export class ModerationApi extends BaseApi { ): Promise> => { const body = { limit: request?.limit, - lock_moderator_duration: request?.lock_moderator_duration, - lock_moderator_id: request?.lock_moderator_id, + lock_count: request?.lock_count, + lock_duration: request?.lock_duration, + lock_items: request?.lock_items, next: request?.next, prev: request?.prev, stats_only: request?.stats_only, @@ -367,6 +412,7 @@ export class ModerationApi extends BaseApi { delete_message: request?.delete_message, delete_reaction: request?.delete_reaction, delete_user: request?.delete_user, + mark_reviewed: request?.mark_reviewed, unban: request?.unban, user: request?.user, }; diff --git a/src/gen/video/CallApi.ts b/src/gen/video/CallApi.ts index a221d41..6a05d68 100644 --- a/src/gen/video/CallApi.ts +++ b/src/gen/video/CallApi.ts @@ -24,6 +24,7 @@ import { PinResponse, SendCallEventRequest, SendCallEventResponse, + StartClosedCaptionsResponse, StartHLSBroadcastingResponse, StartRTMPBroadcastsRequest, StartRTMPBroadcastsResponse, @@ -32,7 +33,9 @@ import { StartTranscriptionRequest, StartTranscriptionResponse, StopAllRTMPBroadcastsResponse, + StopClosedCaptionsResponse, StopHLSBroadcastingResponse, + StopLiveRequest, StopLiveResponse, StopRTMPBroadcastsRequest, StopRTMPBroadcastsResponse, @@ -199,6 +202,12 @@ export class CallApi { return this.videoApi.startHLSBroadcasting({ id: this.id, type: this.type }); }; + startClosedCaptions = (): Promise< + StreamResponse + > => { + return this.videoApi.startClosedCaptions({ id: this.id, type: this.type }); + }; + startRecording = ( request?: StartRecordingRequest, ): Promise> => { @@ -235,8 +244,16 @@ export class CallApi { return this.videoApi.stopHLSBroadcasting({ id: this.id, type: this.type }); }; - stopLive = (): Promise> => { - return this.videoApi.stopLive({ id: this.id, type: this.type }); + stopClosedCaptions = (): Promise< + StreamResponse + > => { + return this.videoApi.stopClosedCaptions({ id: this.id, type: this.type }); + }; + + stopLive = ( + request?: StopLiveRequest, + ): Promise> => { + return this.videoApi.stopLive({ id: this.id, type: this.type, ...request }); }; stopRecording = (): Promise> => { diff --git a/src/gen/video/VideoApi.ts b/src/gen/video/VideoApi.ts index 8e8e5ba..2e5b05c 100644 --- a/src/gen/video/VideoApi.ts +++ b/src/gen/video/VideoApi.ts @@ -36,6 +36,7 @@ import { Response, SendCallEventRequest, SendCallEventResponse, + StartClosedCaptionsResponse, StartHLSBroadcastingResponse, StartRTMPBroadcastsRequest, StartRTMPBroadcastsResponse, @@ -44,7 +45,9 @@ import { StartTranscriptionRequest, StartTranscriptionResponse, StopAllRTMPBroadcastsResponse, + StopClosedCaptionsResponse, StopHLSBroadcastingResponse, + StopLiveRequest, StopLiveResponse, StopRTMPBroadcastsRequest, StopRTMPBroadcastsResponse, @@ -558,6 +561,29 @@ export class VideoApi extends BaseApi { return { ...response.body, metadata: response.metadata }; }; + startClosedCaptions = async (request: { + type: string; + id: string; + }): Promise> => { + const pathParams = { + type: request?.type, + id: request?.id, + }; + + const response = await this.sendRequest< + StreamResponse + >( + 'POST', + '/api/v2/video/call/{type}/{id}/start_closed_captions', + pathParams, + undefined, + ); + + decoders.StartClosedCaptionsResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + startRecording = async ( request: StartRecordingRequest & { type: string; id: string }, ): Promise> => { @@ -658,20 +684,49 @@ export class VideoApi extends BaseApi { return { ...response.body, metadata: response.metadata }; }; - stopLive = async (request: { + stopClosedCaptions = async (request: { type: string; id: string; - }): Promise> => { + }): Promise> => { const pathParams = { type: request?.type, id: request?.id, }; + const response = await this.sendRequest< + StreamResponse + >( + 'POST', + '/api/v2/video/call/{type}/{id}/stop_closed_captions', + pathParams, + undefined, + ); + + decoders.StopClosedCaptionsResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + stopLive = async ( + request: StopLiveRequest & { type: string; id: string }, + ): Promise> => { + const pathParams = { + type: request?.type, + id: request?.id, + }; + const body = { + continue_hls: request?.continue_hls, + continue_recording: request?.continue_recording, + continue_rtmp_broadcast: request?.continue_rtmp_broadcast, + continue_transcription: request?.continue_transcription, + }; + const response = await this.sendRequest>( 'POST', '/api/v2/video/call/{type}/{id}/stop_live', pathParams, undefined, + body, ); decoders.StopLiveResponse?.(response.body); From 82a153e168226cd7ce892f0ac7cfba3ffaebef17 Mon Sep 17 00:00:00 2001 From: Zita Szupera Date: Fri, 6 Dec 2024 12:50:27 +0100 Subject: [PATCH 3/3] chore: ensure parallel test runs --- __tests__/external-storage.test.ts | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/__tests__/external-storage.test.ts b/__tests__/external-storage.test.ts index b6c4882..c40f676 100644 --- a/__tests__/external-storage.test.ts +++ b/__tests__/external-storage.test.ts @@ -39,9 +39,16 @@ describe('external storage CRUD API', () => { expect(response.bucket).toBe('new bucket'); }); + it('delete', async () => { + const response = await client.deleteExternalStorage({ name: storageName }); + + expect(response).toBeDefined(); + }); + it('docs snippets', async () => { + const s3name = `streamnodetest-${uuidv4()}`; await client.createExternalStorage({ - name: 'streamnodetest-my-s3', + name: s3name, storage_type: 's3', bucket: 'my-bucket', path: 'directory_name/', @@ -52,16 +59,22 @@ describe('external storage CRUD API', () => { }, }); + await client.deleteExternalStorage({ name: s3name }); + + const gcsName = `streamnodetest-${uuidv4()}`; await client.createExternalStorage({ bucket: 'my-bucket', - name: 'streamnodetest-my-gcs', + name: gcsName, storage_type: 'gcs', path: 'directory_name/', gcs_credentials: 'content of the service account file', }); + await client.deleteExternalStorage({ name: gcsName }); + + const azureName = `streamnodetest-${uuidv4()}`; await client.createExternalStorage({ - name: 'streamnodetest-my-abs', + name: azureName, storage_type: 'abs', bucket: 'my-bucket', path: 'directory_name/', @@ -73,14 +86,6 @@ describe('external storage CRUD API', () => { }, }); - await client.deleteExternalStorage({ name: 'streamnodetest-my-s3' }); - await client.deleteExternalStorage({ name: 'streamnodetest-my-gcs' }); - await client.deleteExternalStorage({ name: 'streamnodetest-my-abs' }); - }); - - it('delete', async () => { - const response = await client.deleteExternalStorage({ name: storageName }); - - expect(response).toBeDefined(); + await client.deleteExternalStorage({ name: azureName }); }); });