From c6a1c8238de0d615f924544c5aba19528364b338 Mon Sep 17 00:00:00 2001 From: Zita Szupera Date: Fri, 4 Oct 2024 13:37:08 -0500 Subject: [PATCH 1/2] feat: update open api --- __tests__/call.test.ts | 29 + __tests__/create-test-client.ts | 4 +- src/gen/chat/ChatApi.ts | 221 ++++++ src/gen/model-decoders/index.ts | 447 ++++++++---- src/gen/models/index.ts | 1015 +++++++++++++++++++++------ src/gen/moderation/ModerationApi.ts | 43 ++ src/gen/video/CallApi.ts | 14 + src/gen/video/VideoApi.ts | 48 ++ 8 files changed, 1481 insertions(+), 340 deletions(-) diff --git a/__tests__/call.test.ts b/__tests__/call.test.ts index c2cdd9a..03104a4 100644 --- a/__tests__/call.test.ts +++ b/__tests__/call.test.ts @@ -253,6 +253,35 @@ describe('call API', () => { }); }); + it('closed caption settings', async () => { + const response = await call.update({ + settings_override: { + transcription: { + mode: 'available', + closed_caption_mode: 'disabled', + }, + }, + }); + + expect(response.call.settings.transcription.mode).toBe('available'); + expect(response.call.settings.transcription.closed_caption_mode).toBe( + 'disabled', + ); + expect(response.call.captioning).toBe(false); + }); + + it('should start-stop closed captions', async () => { + // somewhat dummy test, we should do a proper test in the future where we join a call and start recording + await expect(() => call.startClosedCaptions()).rejects.toThrowError( + 'Stream error code 4: StartClosedCaptions failed with error: "there is no active session"', + ); + + // somewhat dummy test, we should do a proper test in the future where we join a call and start recording + await expect(() => call.stopClosedCaptions()).rejects.toThrowError( + 'Stream error code 4: StopClosedCaptions failed with error: "call is not being transcribed"', + ); + }); + it('delete call', async () => { try { await call.delete({ hard: true }); diff --git a/__tests__/create-test-client.ts b/__tests__/create-test-client.ts index 62382df..237a88c 100644 --- a/__tests__/create-test-client.ts +++ b/__tests__/create-test-client.ts @@ -5,5 +5,7 @@ const apiKey = process.env.STREAM_API_KEY!; const secret = process.env.STREAM_SECRET!; export const createTestClient = () => { - return new StreamClient(apiKey, secret, { timeout: 10000 }); + return new StreamClient(apiKey, secret, { + timeout: 10000, + }); }; diff --git a/src/gen/chat/ChatApi.ts b/src/gen/chat/ChatApi.ts index 50fa091..dda192a 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> => { @@ -1758,6 +1848,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 }; + }; + + controllerNameQuerySegmentTargets = 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> => { diff --git a/src/gen/model-decoders/index.ts b/src/gen/model-decoders/index.ts index a944289..2016047 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: 'User', isSingle: true }, - created_by: { type: 'UserObject', isSingle: true }, - - truncated_by: { type: 'UserObject', isSingle: true }, + truncated_by: { type: 'User', isSingle: true }, }; return decode(typeMappings, input); }; @@ -297,7 +325,7 @@ decoders.ChannelMember = (input?: Record) => { invite_rejected_at: { type: 'DatetimeType', isSingle: true }, - user: { type: 'UserObject', isSingle: true }, + user: { type: 'UserResponse', isSingle: true }, }; return decode(typeMappings, input); }; @@ -331,7 +359,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 +384,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 +399,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 +424,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 }, @@ -548,6 +576,53 @@ 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 }, + + 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 +632,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 +647,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,8 +685,6 @@ decoders.FullUserResponse = (input?: Record) => { channel_mutes: { type: 'ChannelMute', isSingle: false }, - devices: { type: 'Device', isSingle: false }, - mutes: { type: 'UserMuteResponse', isSingle: false }, deactivated_at: { type: 'DatetimeType', isSingle: true }, @@ -658,6 +742,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 +794,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 +831,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); }; @@ -827,13 +925,6 @@ decoders.ListCommandsResponse = (input?: Record) => { return decode(typeMappings, input); }; -decoders.ListDevicesResponse = (input?: Record) => { - const typeMappings: TypeMapping = { - devices: { type: 'Device', isSingle: false }, - }; - return decode(typeMappings, input); -}; - decoders.ListImportsResponse = (input?: Record) => { const typeMappings: TypeMapping = { import_tasks: { type: 'ImportTask', isSingle: false }, @@ -904,7 +995,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 +1009,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 +1071,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 +1102,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,17 +1139,30 @@ 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 }, }; return decode(typeMappings, input); }; +decoders.ModerationConfig = (input?: Record) => { + const typeMappings: TypeMapping = { + created_at: { type: 'DatetimeType', isSingle: true }, + + updated_at: { type: 'DatetimeType', isSingle: true }, + + velocity_filter_config: { type: 'VelocityFilterConfig', isSingle: true }, + }; + return decode(typeMappings, input); +}; + 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 +1213,39 @@ 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 }, + + 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 +1267,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 +1285,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 +1300,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 +1401,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,6 +1447,13 @@ decoders.QueryMessageHistoryResponse = (input?: Record) => { return decode(typeMappings, input); }; +decoders.QueryModerationConfigsResponse = (input?: Record) => { + const typeMappings: TypeMapping = { + configs: { type: 'ModerationConfig', isSingle: false }, + }; + return decode(typeMappings, input); +}; + decoders.QueryModerationLogsResponse = (input?: Record) => { const typeMappings: TypeMapping = { l_og_s: { type: 'ActionLogResponse', isSingle: false }, @@ -1329,7 +1477,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 +1523,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 +1564,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 +1589,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 +1600,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 +1649,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 +1665,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: 'PollResponseData', isSingle: true }, - poll: { type: 'Poll', isSingle: true }, + quoted_message: { type: 'MessageResponse', isSingle: true }, - quoted_message: { type: 'Message', 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); +}; - user: { type: 'UserObject', isSingle: true }, +decoders.SegmentTargetResponse = (input?: Record) => { + const typeMappings: TypeMapping = { + created_at: { type: 'DatetimeType', isSingle: true }, }; return decode(typeMappings, input); }; @@ -1516,6 +1725,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 +1756,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 +1775,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 +1794,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 +1802,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 +1886,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 +1916,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 +1965,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 +2003,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,35 +2025,12 @@ 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 }, - ban_expires: { type: 'DatetimeType', isSingle: true }, deactivated_at: { type: 'DatetimeType', isSingle: true }, @@ -1860,7 +2051,7 @@ decoders.UserResponse = (input?: Record) => { decoders.VelocityFilterConfig = (input?: Record) => { const typeMappings: TypeMapping = { - rule: { type: 'VelocityFilterConfigRule', isSingle: false }, + rules: { type: 'VelocityFilterConfigRule', isSingle: false }, }; return decode(typeMappings, input); }; @@ -1878,23 +2069,23 @@ decoders.WSEvent = (input?: Record) => { 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..5e4334b 100644 --- a/src/gen/models/index.ts +++ b/src/gen/models/index.ts @@ -67,15 +67,17 @@ export interface APNS { } export interface AWSRekognitionConfig { - enabled?: boolean; + enabled: boolean; - rules?: AWSRekognitionRule[]; + rules: AWSRekognitionRule[]; } export interface AWSRekognitionRule { action: 'flag' | 'shadow' | 'remove'; label: string; + + min_confidence: number; } export interface Action { @@ -97,6 +99,8 @@ export interface ActionLog { reason: string; + reporter_type: string; + review_queue_item_id: string; target_user_id: string; @@ -107,9 +111,9 @@ export interface ActionLog { review_queue_item?: ReviewQueueItem; - target_user?: UserObject; + target_user?: User; - user?: UserObject; + user?: User; } export interface ActionLogResponse { @@ -121,6 +125,8 @@ export interface ActionLogResponse { type: string; + user_id: string; + custom: Record; review_queue_item?: ReviewQueueItem; @@ -345,9 +351,9 @@ export interface AutomodDetails { } export interface AutomodPlatformCircumventionConfig { - enabled?: boolean; + enabled: boolean; - rules?: AutomodRule[]; + rules: AutomodRule[]; } export interface AutomodRule { @@ -359,9 +365,9 @@ export interface AutomodRule { } export interface AutomodSemanticFiltersConfig { - enabled?: boolean; + enabled: boolean; - rules?: AutomodSemanticFiltersRule[]; + rules: AutomodSemanticFiltersRule[]; } export interface AutomodSemanticFiltersRule { @@ -373,9 +379,9 @@ export interface AutomodSemanticFiltersRule { } export interface AutomodToxicityConfig { - enabled?: boolean; + enabled: boolean; - rules?: AutomodRule[]; + rules: AutomodRule[]; } export interface AzureRequest { @@ -417,14 +423,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 +475,9 @@ export interface BanResponse { } export interface BlockListConfig { - enabled?: boolean; + enabled: boolean; - rules?: BlockListRule[]; + rules: BlockListRule[]; } export interface BlockListOptions { @@ -535,19 +543,21 @@ export interface BlockedUserResponse { } export interface BodyguardConfig { - enabled?: boolean; + enabled: boolean; - profile?: string; + profile: string; - rules?: BodyguardRule[]; + rules: BodyguardRule[]; - severity_rules?: BodyguardSeverityRule[]; + severity_rules: BodyguardSeverityRule[]; } export interface BodyguardRule { action: 'flag' | 'shadow' | 'remove'; label: string; + + severity_rules: BodyguardSeverityRule[]; } export interface BodyguardSeverityRule { @@ -585,15 +595,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 +657,8 @@ export interface CallRequest { export interface CallResponse { backstage: boolean; + captioning: boolean; + cid: string; created_at: Date; @@ -852,6 +870,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 { + pr_og_ress: 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 +989,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 { @@ -953,6 +1045,10 @@ export interface ChannelConfig { blocklist_behavior?: 'flag' | 'block' | 'shadow_block'; + partition_size?: number; + + partition_ttl?: string; + allowed_flag_reasons?: string[]; blocklists?: BlockListOptions[]; @@ -1011,7 +1107,7 @@ export interface ChannelConfigWithInfo { partition_size?: number; - partition_ttl?: number; + partition_ttl?: string; allowed_flag_reasons?: string[]; @@ -1103,11 +1199,13 @@ export interface ChannelMember { is_moderator?: boolean; + role?: 'member' | 'moderator' | 'admin' | 'owner'; + status?: string; user_id?: string; - user?: UserObject; + user?: UserResponse; } export interface ChannelMemberResponse { @@ -1155,9 +1253,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 +1344,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 +1362,7 @@ export interface ChannelStateResponse { pinned_messages: MessageResponse[]; - threads: ThreadState[]; + threads: ThreadStateResponse[]; hidden?: boolean; @@ -1247,7 +1388,7 @@ export interface ChannelStateResponseFields { pinned_messages: MessageResponse[]; - threads: ThreadState[]; + threads: ThreadStateResponse[]; hidden?: boolean; @@ -1321,7 +1462,7 @@ export interface ChannelTypeConfig { partition_size?: number; - partition_ttl?: number; + partition_ttl?: string; allowed_flag_reasons?: string[]; @@ -1381,6 +1522,8 @@ export interface CheckRequest { entity_type: string; + test_mode?: boolean; + user_id?: string; moderation_payload?: ModerationPayload; @@ -1482,6 +1625,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; @@ -1589,7 +1756,7 @@ export interface CreateChannelTypeRequest { mark_messages_pending?: boolean; - message_retention?: string; + message_retention?: 'infinite' | 'numeric'; mutes?: boolean; @@ -1681,7 +1848,7 @@ export interface CreateChannelTypeResponse { partition_size?: number; - partition_ttl?: number; + partition_ttl?: string; allowed_flag_reasons?: string[]; @@ -1972,6 +2139,10 @@ export interface DeleteMessageResponse { message: MessageResponse; } +export interface DeleteModerationConfigResponse { + duration: string; +} + export interface DeleteModerationTemplateResponse { duration: string; } @@ -1984,6 +2155,10 @@ export interface DeleteRecordingResponse { duration: string; } +export interface DeleteSegmentTargetsRequest { + target_ids: string[]; +} + export interface DeleteTranscriptionResponse { duration: string; } @@ -1991,6 +2166,8 @@ export interface DeleteTranscriptionResponse { export interface DeleteUserRequest { delete_conversation_channels?: boolean; + delete_feeds_content?: boolean; + hard_delete?: boolean; mark_messages_deleted?: boolean; @@ -2023,7 +2200,7 @@ export interface Device { id: string; - push_provider: string; + push_provider: 'firebase' | 'apn' | 'huawei' | 'xiaomi'; user_id: string; @@ -2148,6 +2325,98 @@ export interface EnrichedReaction { user?: Data; } +export interface EntityCreator { + ban_count: number; + + banned: boolean; + + deleted_content_count: number; + + 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 EntityCreatorResponse { + ban_count: number; + + banned: boolean; + + created_at: Date; + + deleted_content_count: number; + + id: string; + + invisible: boolean; + + language: string; + + online: boolean; + + role: string; + + shadow_banned: boolean; + + updated_at: Date; + + blocked_user_ids: string[]; + + devices: ResponseForDevice[]; + + 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; @@ -2211,9 +2480,9 @@ export interface ExportChannelsResult { export interface ExportUserResponse { duration: string; - messages?: Message[]; + messages?: MessageResponse[]; - reactions?: Reaction[]; + reactions?: ReactionResponse[]; user?: UserResponse; } @@ -2333,7 +2602,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 { @@ -2417,7 +2716,7 @@ export interface FullUserResponse { channel_mutes: ChannelMute[]; - devices: Device[]; + devices: ResponseForDevice[]; mutes: UserMuteResponse[]; @@ -2566,6 +2865,12 @@ export interface GetCallTypeResponse { external_storage?: string; } +export interface GetCampaignResponse { + duration: string; + + campaign?: CampaignResponse; +} + export interface GetChannelTypeResponse { automod: 'disabled' | 'simple' | 'AI'; @@ -2623,7 +2928,7 @@ export interface GetChannelTypeResponse { partition_size?: number; - partition_ttl?: number; + partition_ttl?: string; allowed_flag_reasons?: string[]; @@ -2697,7 +3002,7 @@ export interface GetImportResponse { export interface GetManyMessagesResponse { duration: string; - messages: Message[]; + messages: MessageResponse[]; } export interface GetMessageResponse { @@ -2807,9 +3112,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 { @@ -2865,7 +3176,7 @@ export interface GoLiveResponse { } export interface GoogleVisionConfig { - enabled?: boolean; + enabled: boolean; } export interface HLSSettings { @@ -3105,7 +3416,7 @@ export interface ListCommandsResponse { export interface ListDevicesResponse { duration: string; - devices: Device[]; + devices: ResponseForDevice[]; } export interface ListExternalStorageResponse { @@ -3158,16 +3469,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 +3493,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 +3570,7 @@ export interface Message { text: string; - type: 'regular' | 'ephemeral' | 'error' | 'reply' | 'system' | 'deleted'; + type: string; updated_at: Date; @@ -3271,7 +3578,7 @@ export interface Message { latest_reactions: Reaction[]; - mentioned_users: UserObject[]; + mentioned_users: User[]; own_reactions: Reaction[]; @@ -3305,19 +3612,19 @@ export interface Message { show_in_channel?: boolean; - thread_participants?: UserObject[]; + thread_participants?: User[]; i18n?: Record; image_labels?: Record; - pinned_by?: UserObject; + pinned_by?: User; poll?: Poll; quoted_message?: Message; - user?: UserObject; + user?: User; } export interface MessageActionRequest { @@ -3437,7 +3744,7 @@ export interface MessageReadEvent { thread?: ThreadResponse; - user?: UserObject; + user?: UserResponse; } export interface MessageRequest { @@ -3499,7 +3806,7 @@ export interface MessageResponse { text: string; - type: string; + type: 'regular' | 'ephemeral' | 'error' | 'reply' | 'system' | 'deleted'; updated_at: Date; @@ -3547,9 +3854,9 @@ export interface MessageResponse { pinned_by?: UserResponse; - poll?: Poll; + poll?: PollResponseData; - quoted_message?: Message; + quoted_message?: MessageResponse; reaction_groups?: Record; } @@ -3581,7 +3888,7 @@ export interface MessageWithChannelResponse { text: string; - type: string; + type: 'regular' | 'ephemeral' | 'error' | 'reply' | 'system' | 'deleted'; updated_at: Date; @@ -3631,9 +3938,9 @@ export interface MessageWithChannelResponse { pinned_by?: UserResponse; - poll?: Poll; + poll?: PollResponseData; - quoted_message?: Message; + quoted_message?: MessageResponse; reaction_groups?: Record; } @@ -3652,6 +3959,32 @@ export interface ModerationActionConfig { custom: Record; } +export interface ModerationConfig { + async: boolean; + + created_at: Date; + + key: string; + + updated_at: Date; + + 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; +} + export interface ModerationPayload { images?: string[]; @@ -3673,13 +4006,19 @@ export interface ModerationResponse { } export interface ModerationUsageStats { - bucket: string; + app_pk: number; - metric: string; + id: number; + + organization_id: number; + + reference_date: Date; updated_at: Date; - value: number; + usage_amount: number; + + usage_type: string; } export interface ModeratorStats { @@ -3810,9 +4149,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 +4204,8 @@ export interface OwnUser { last_active?: Date; + last_engaged_at?: Date; + blocked_user_ids?: string[]; latest_hidden_channels?: string[]; @@ -3874,6 +4217,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: ResponseForDevice[]; + + 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 +4394,7 @@ export interface Poll { voting_visibility?: string; - created_by?: UserObject; + created_by?: User; } export interface PollOption { @@ -4065,6 +4464,8 @@ export interface PollResponseData { voting_visibility: string; + latest_answers: PollVoteResponseData[]; + options: PollOptionResponseData[]; own_votes: PollVoteResponseData[]; @@ -4099,7 +4500,7 @@ export interface PollVote { user_id?: string; - user?: UserObject; + user?: User; } export interface PollVoteResponse { @@ -4408,6 +4809,28 @@ export interface QueryCallsResponse { prev?: string; } +export interface QueryCampaignsRequest { + limit?: number; + + next?: string; + + prev?: string; + + sort?: SortParamRequest[]; + + filter?: Record; +} + +export interface QueryCampaignsResponse { + duration: string; + + campaigns: CampaignResponse[]; + + next?: string; + + prev?: string; +} + export interface QueryChannelsRequest { limit?: number; @@ -4479,7 +4902,7 @@ export interface QueryMessageFlagsPayload { user_id?: string; - sort?: SortParam[]; + sort?: SortParamRequest[]; filter_conditions?: Record; @@ -4514,6 +4937,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: ModerationConfig[]; + + next?: string; + + prev?: string; +} + export interface QueryModerationLogsRequest { limit?: number; @@ -4625,7 +5074,7 @@ export interface QueryReviewQueueRequest { export interface QueryReviewQueueResponse { duration: string; - items: ReviewQueueItem[]; + items: ReviewQueueItemResponse[]; action_config: Record>; @@ -4636,6 +5085,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 +5300,7 @@ export interface Reaction { user_id?: string; - user?: UserObject; + user?: User; } export interface ReactionGroupResponse { @@ -4892,22 +5385,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,12 +5404,12 @@ export interface ReadStateResponse { } export interface RecordSettings { - audio_only: boolean; - mode: string; quality: string; + audio_only?: boolean; + layout?: LayoutSettings; } @@ -4964,6 +5447,24 @@ export interface Response { duration: string; } +export interface ResponseForDevice { + created_at: Date; + + id: string; + + push_provider: string; + + user_id: string; + + disabled?: boolean; + + disabled_reason?: string; + + push_provider_name?: string; + + voip?: boolean; +} + export interface RestoreActionRequest {} export interface RestoreUsersRequest { @@ -5011,9 +5512,9 @@ export interface ReviewQueueItem { reviewed_at: NullTime; - assigned_to?: UserObject; + assigned_to?: User; - entity_creator?: UserObject; + entity_creator?: EntityCreator; feeds_v2_activity?: EnrichedActivity; @@ -5024,6 +5525,48 @@ 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; + + status: string; + + updated_at: Date; + + actions: ActionLogResponse[]; + + bans: Ban[]; + + flags: Flag2Response[]; + + 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 +5704,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 +5738,7 @@ export interface SearchResultMessage { show_in_channel?: boolean; - thread_participants?: UserObject[]; + thread_participants?: UserResponse[]; channel?: ChannelResponse; @@ -5205,13 +5746,13 @@ export interface SearchResultMessage { image_labels?: Record; - pinned_by?: UserObject; + pinned_by?: UserResponse; - poll?: Poll; + poll?: PollResponseData; - quoted_message?: Message; + quoted_message?: MessageResponse; - user?: UserObject; + reaction_groups?: Record; } export interface SearchWarning { @@ -5224,6 +5765,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 +5895,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,6 +5957,14 @@ export interface StopAllRTMPBroadcastsResponse { duration: string; } +export interface StopCampaignRequest {} + +export interface StopClosedCaptionsRequest {} + +export interface StopClosedCaptionsResponse { + duration: string; +} + export interface StopHLSBroadcastingRequest {} export interface StopHLSBroadcastingResponse { @@ -5405,6 +6026,8 @@ export interface SubmitActionRequest { delete_user?: DeleteUserRequest; + mark_reviewed?: MarkReviewedRequest; + unban?: UnbanActionRequest; user?: UserRequest; @@ -5459,7 +6082,7 @@ export interface ThreadParticipant { user_id?: string; - user?: UserObject; + user?: UserResponse; } export interface ThreadResponse { @@ -5491,45 +6114,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 +6146,7 @@ export interface ThreadStateResponse { reply_count?: number; - read?: Read[]; + read?: ReadStateResponse[]; thread_participants?: ThreadParticipant[]; @@ -5567,7 +6154,7 @@ export interface ThreadStateResponse { created_by?: UserResponse; - parent_message?: Message; + parent_message?: MessageResponse; } export interface Thresholds { @@ -5603,7 +6190,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 +6200,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'; @@ -5708,11 +6295,11 @@ export interface TruncateChannelResponse { } export interface TypingIndicators { - enabled?: boolean; + enabled: boolean; } export interface TypingIndicatorsResponse { - enabled: boolean; + enabled?: boolean; } export interface UnbanActionRequest {} @@ -6042,7 +6629,7 @@ export interface UpdateChannelResponse { channel?: ChannelResponse; - message?: Message; + message?: MessageResponse; } export interface UpdateChannelTypeRequest { @@ -6160,7 +6747,7 @@ export interface UpdateChannelTypeResponse { partition_size?: number; - partition_ttl?: number; + partition_ttl?: string; allowed_flag_reasons?: string[]; @@ -6236,7 +6823,7 @@ export interface UpdateMessagePartialRequest { export interface UpdateMessagePartialResponse { duration: string; - message?: Message; + message?: MessageResponse; pending_message_metadata?: Record; } @@ -6250,7 +6837,7 @@ export interface UpdateMessageRequest { export interface UpdateMessageResponse { duration: string; - message: Message; + message: MessageResponse; pending_message_metadata?: Record; } @@ -6413,6 +7000,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; @@ -6444,9 +7069,9 @@ export interface UserMute { expires?: Date; - target?: UserObject; + target?: User; - user?: UserObject; + user?: User; } export interface UserMuteResponse { @@ -6461,42 +7086,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 +7103,7 @@ export interface UserRequest { custom?: Record; - privacy_settings?: PrivacySettings; + privacy_settings?: PrivacySettingsResponse; push_notifications?: PushNotificationSettingsInput; } @@ -6540,7 +7129,7 @@ export interface UserResponse { blocked_user_ids: string[]; - devices: Device[]; + devices: ResponseForDevice[]; teams: string[]; @@ -6568,6 +7157,8 @@ export interface UserResponse { export interface UserSessionStats { freeze_duration_seconds: number; + group: string; + max_freeze_fraction: number; max_freezes_duration_seconds: number; @@ -6654,16 +7245,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,17 +7269,23 @@ export interface UserStats { } export interface VelocityFilterConfig { - enabled?: boolean; + cascading_actions: boolean; - rule?: VelocityFilterConfigRule[]; + enabled: boolean; + + rules: VelocityFilterConfigRule[]; } export interface VelocityFilterConfigRule { action: 'flag' | 'shadow' | 'remove' | 'ban'; - ip_ban?: boolean; + cascading_action: 'flag' | 'shadow' | 'remove' | 'ban'; + + cascading_threshold: number; - shadow_ban?: boolean; + ip_ban: boolean; + + shadow_ban: boolean; timeout?: Date; } @@ -6750,7 +7343,7 @@ export interface VoteData { option_id?: string; - option?: PollOption; + option?: PollOptionResponseData; } export interface WSEvent { @@ -6786,25 +7379,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..0a596d5 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, @@ -116,6 +120,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 +155,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> => { @@ -367,6 +409,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..1dc6660 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,6 +33,7 @@ import { StartTranscriptionRequest, StartTranscriptionResponse, StopAllRTMPBroadcastsResponse, + StopClosedCaptionsResponse, StopHLSBroadcastingResponse, StopLiveResponse, StopRTMPBroadcastsRequest, @@ -199,6 +201,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,6 +243,12 @@ export class CallApi { return this.videoApi.stopHLSBroadcasting({ id: this.id, type: this.type }); }; + stopClosedCaptions = (): Promise< + StreamResponse + > => { + return this.videoApi.stopClosedCaptions({ id: this.id, type: this.type }); + }; + stopLive = (): Promise> => { return this.videoApi.stopLive({ id: this.id, type: this.type }); }; diff --git a/src/gen/video/VideoApi.ts b/src/gen/video/VideoApi.ts index 8e8e5ba..73f754b 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,6 +45,7 @@ import { StartTranscriptionRequest, StartTranscriptionResponse, StopAllRTMPBroadcastsResponse, + StopClosedCaptionsResponse, StopHLSBroadcastingResponse, StopLiveResponse, StopRTMPBroadcastsRequest, @@ -558,6 +560,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,6 +683,29 @@ export class VideoApi extends BaseApi { return { ...response.body, metadata: response.metadata }; }; + stopClosedCaptions = 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}/stop_closed_captions', + pathParams, + undefined, + ); + + decoders.StopClosedCaptionsResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + stopLive = async (request: { type: string; id: string; From 7a55bbbd3918d57b5f3ecadbd0806ebb1bf62152 Mon Sep 17 00:00:00 2001 From: Zita Szupera Date: Wed, 13 Nov 2024 09:43:43 +0100 Subject: [PATCH 2/2] Update to v135.3.1 --- src/gen/chat/ChatApi.ts | 6 +- src/gen/model-decoders/index.ts | 53 ++++---- src/gen/models/index.ts | 180 +++++++++++++++++----------- src/gen/moderation/ModerationApi.ts | 9 +- 4 files changed, 143 insertions(+), 105 deletions(-) diff --git a/src/gen/chat/ChatApi.ts b/src/gen/chat/ChatApi.ts index dda192a..74a54f3 100644 --- a/src/gen/chat/ChatApi.ts +++ b/src/gen/chat/ChatApi.ts @@ -802,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, @@ -881,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, @@ -2004,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 2016047..273eda8 100644 --- a/src/gen/model-decoders/index.ts +++ b/src/gen/model-decoders/index.ts @@ -473,8 +473,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); }; @@ -569,6 +567,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 }, @@ -605,6 +610,8 @@ decoders.EntityCreatorResponse = (input?: Record) => { updated_at: { type: 'DatetimeType', isSingle: true }, + devices: { type: 'DeviceResponse', isSingle: false }, + ban_expires: { type: 'DatetimeType', isSingle: true }, deactivated_at: { type: 'DatetimeType', isSingle: true }, @@ -685,6 +692,8 @@ decoders.FullUserResponse = (input?: Record) => { channel_mutes: { type: 'ChannelMute', isSingle: false }, + devices: { type: 'DeviceResponse', isSingle: false }, + mutes: { type: 'UserMuteResponse', isSingle: false }, deactivated_at: { type: 'DatetimeType', isSingle: true }, @@ -925,6 +934,13 @@ decoders.ListCommandsResponse = (input?: Record) => { return decode(typeMappings, input); }; +decoders.ListDevicesResponse = (input?: Record) => { + const typeMappings: TypeMapping = { + devices: { type: 'DeviceResponse', isSingle: false }, + }; + return decode(typeMappings, input); +}; + decoders.ListImportsResponse = (input?: Record) => { const typeMappings: TypeMapping = { import_tasks: { type: 'ImportTask', isSingle: false }, @@ -1148,17 +1164,6 @@ decoders.MessageWithChannelResponse = (input?: Record) => { return decode(typeMappings, input); }; -decoders.ModerationConfig = (input?: Record) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - velocity_filter_config: { type: 'VelocityFilterConfig', isSingle: true }, - }; - return decode(typeMappings, input); -}; - decoders.ModerationUsageStats = (input?: Record) => { const typeMappings: TypeMapping = { reference_date: { type: 'DatetimeType', isSingle: true }, @@ -1228,6 +1233,8 @@ decoders.OwnUserResponse = (input?: Record) => { channel_mutes: { type: 'ChannelMute', isSingle: false }, + devices: { type: 'DeviceResponse', isSingle: false }, + mutes: { type: 'UserMuteResponse', isSingle: false }, deactivated_at: { type: 'DatetimeType', isSingle: true }, @@ -1449,14 +1456,14 @@ decoders.QueryMessageHistoryResponse = (input?: Record) => { decoders.QueryModerationConfigsResponse = (input?: Record) => { const typeMappings: TypeMapping = { - configs: { type: 'ModerationConfig', isSingle: false }, + 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); }; @@ -2031,6 +2038,8 @@ decoders.UserResponse = (input?: Record) => { updated_at: { type: 'DatetimeType', isSingle: true }, + devices: { type: 'DeviceResponse', isSingle: false }, + ban_expires: { type: 'DatetimeType', isSingle: true }, deactivated_at: { type: 'DatetimeType', isSingle: true }, @@ -2049,20 +2058,6 @@ decoders.UserResponse = (input?: Record) => { return decode(typeMappings, input); }; -decoders.VelocityFilterConfig = (input?: Record) => { - const typeMappings: TypeMapping = { - rules: { 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 }, diff --git a/src/gen/models/index.ts b/src/gen/models/index.ts index 5e4334b..5e6a85e 100644 --- a/src/gen/models/index.ts +++ b/src/gen/models/index.ts @@ -70,6 +70,8 @@ export interface AWSRekognitionConfig { enabled: boolean; rules: AWSRekognitionRule[]; + + async?: boolean; } export interface AWSRekognitionRule { @@ -123,6 +125,8 @@ export interface ActionLogResponse { reason: string; + target_user_id: string; + type: string; user_id: string; @@ -265,6 +269,10 @@ export interface Attachment { image_url?: string; + latitude?: number; + + longitude?: number; + og_scrape_url?: string; original_height?: number; @@ -273,6 +281,8 @@ export interface Attachment { pretext?: string; + stopped_sharing?: boolean; + text?: string; thumb_url?: string; @@ -354,6 +364,8 @@ export interface AutomodPlatformCircumventionConfig { enabled: boolean; rules: AutomodRule[]; + + async?: boolean; } export interface AutomodRule { @@ -368,6 +380,8 @@ export interface AutomodSemanticFiltersConfig { enabled: boolean; rules: AutomodSemanticFiltersRule[]; + + async?: boolean; } export interface AutomodSemanticFiltersRule { @@ -382,6 +396,8 @@ export interface AutomodToxicityConfig { enabled: boolean; rules: AutomodRule[]; + + async?: boolean; } export interface AzureRequest { @@ -478,6 +494,8 @@ export interface BlockListConfig { enabled: boolean; rules: BlockListRule[]; + + async?: boolean; } export interface BlockListOptions { @@ -550,6 +568,8 @@ export interface BodyguardConfig { rules: BodyguardRule[]; severity_rules: BodyguardSeverityRule[]; + + async?: boolean; } export interface BodyguardRule { @@ -933,7 +953,7 @@ export interface CampaignResponse { } export interface CampaignStatsResponse { - pr_og_ress: number; + progress: number; stats_channels_created: number; @@ -1031,6 +1051,8 @@ export interface ChannelConfig { search: boolean; + skip_last_msg_update_for_system_msgs: boolean; + typing_events: boolean; updated_at: Date; @@ -1091,6 +1113,8 @@ export interface ChannelConfigWithInfo { search: boolean; + skip_last_msg_update_for_system_msgs: boolean; + typing_events: boolean; updated_at: Date; @@ -1442,6 +1466,8 @@ export interface ChannelTypeConfig { search: boolean; + skip_last_msg_update_for_system_msgs: boolean; + typing_events: boolean; updated_at: Date; @@ -1664,13 +1690,13 @@ export interface ConfigResponse { automod_toxicity_config?: AutomodToxicityConfig; - aws_rek_og_nition_config?: AWSRekognitionConfig; + aws_rekognition_config?: AWSRekognitionConfig; block_list_config?: BlockListConfig; bodyguard_config?: BodyguardConfig; - go_og_le_vision_config?: GoogleVisionConfig; + google_vision_config?: GoogleVisionConfig; velocity_filter_config?: VelocityFilterConfig; } @@ -1682,7 +1708,7 @@ export interface Coordinates { } export interface Count { - app_roximate: boolean; + approximate: boolean; value: number; } @@ -1776,6 +1802,8 @@ export interface CreateChannelTypeRequest { search?: boolean; + skip_last_msg_update_for_system_msgs?: boolean; + typing_events?: boolean; uploads?: boolean; @@ -1828,6 +1856,8 @@ export interface CreateChannelTypeResponse { search: boolean; + skip_last_msg_update_for_system_msgs: boolean; + typing_events: boolean; updated_at: Date; @@ -2221,6 +2251,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; @@ -2260,7 +2308,7 @@ export interface EgressRTMPResponse { export interface EgressResponse { broadcasting: boolean; - rtmp_s: EgressRTMPResponse[]; + rtmps: EgressRTMPResponse[]; hls?: EgressHLSResponse; } @@ -2392,7 +2440,7 @@ export interface EntityCreatorResponse { blocked_user_ids: string[]; - devices: ResponseForDevice[]; + devices: DeviceResponse[]; teams: string[]; @@ -2716,7 +2764,7 @@ export interface FullUserResponse { channel_mutes: ChannelMute[]; - devices: ResponseForDevice[]; + devices: DeviceResponse[]; mutes: UserMuteResponse[]; @@ -2908,6 +2956,8 @@ export interface GetChannelTypeResponse { search: boolean; + skip_last_msg_update_for_system_msgs: boolean; + typing_events: boolean; updated_at: Date; @@ -3036,6 +3086,10 @@ export interface GetOGResponse { image_url?: string; + latitude?: number; + + longitude?: number; + og_scrape_url?: string; original_height?: number; @@ -3044,6 +3098,8 @@ export interface GetOGResponse { pretext?: string; + stopped_sharing?: boolean; + text?: string; thumb_url?: string; @@ -3114,7 +3170,7 @@ export interface GetReviewQueueItemResponse { history: ReviewQueueItemResponse[]; - item: ReviewQueueItemResponse; + item?: ReviewQueueItemResponse; } export interface GetSegmentResponse { @@ -3416,7 +3472,7 @@ export interface ListCommandsResponse { export interface ListDevicesResponse { duration: string; - devices: ResponseForDevice[]; + devices: DeviceResponse[]; } export interface ListExternalStorageResponse { @@ -3959,32 +4015,6 @@ export interface ModerationActionConfig { custom: Record; } -export interface ModerationConfig { - async: boolean; - - created_at: Date; - - key: string; - - updated_at: Date; - - 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; -} - export interface ModerationPayload { images?: string[]; @@ -4244,7 +4274,7 @@ export interface OwnUserResponse { channel_mutes: ChannelMute[]; - devices: ResponseForDevice[]; + devices: DeviceResponse[]; mutes: UserMuteResponse[]; @@ -4956,7 +4986,7 @@ export interface QueryModerationConfigsRequest { export interface QueryModerationConfigsResponse { duration: string; - configs: ModerationConfig[]; + configs: ConfigResponse[]; next?: string; @@ -4982,7 +5012,7 @@ export interface QueryModerationLogsRequest { export interface QueryModerationLogsResponse { duration: string; - l_og_s: ActionLogResponse[]; + logs: ActionLogResponse[]; next?: string; @@ -5052,9 +5082,11 @@ export interface QueryReactionsResponse { export interface QueryReviewQueueRequest { limit?: number; - lock_moderator_duration?: number; + lock_count?: number; - lock_moderator_id?: string; + lock_duration?: number; + + lock_items?: boolean; next?: string; @@ -5406,10 +5438,10 @@ export interface ReadStateResponse { export interface RecordSettings { mode: string; - quality: string; - audio_only?: boolean; + quality?: string; + layout?: LayoutSettings; } @@ -5447,24 +5479,6 @@ export interface Response { duration: string; } -export interface ResponseForDevice { - created_at: Date; - - id: string; - - push_provider: string; - - user_id: string; - - disabled?: boolean; - - disabled_reason?: string; - - push_provider_name?: string; - - voip?: boolean; -} - export interface RestoreActionRequest {} export interface RestoreUsersRequest { @@ -5538,6 +5552,8 @@ export interface ReviewQueueItemResponse { reviewed_by: string; + severity: number; + status: string; updated_at: Date; @@ -5548,6 +5564,8 @@ export interface ReviewQueueItemResponse { flags: Flag2Response[]; + languages: string[]; + completed_at?: Date; entity_creator_id?: string; @@ -6671,6 +6689,8 @@ export interface UpdateChannelTypeRequest { search?: boolean; + skip_last_msg_update_for_system_msgs?: boolean; + typing_events?: boolean; uploads?: boolean; @@ -6727,6 +6747,8 @@ export interface UpdateChannelTypeResponse { search: boolean; + skip_last_msg_update_for_system_msgs: boolean; + typing_events: boolean; updated_at: Date; @@ -6955,13 +6977,13 @@ export interface UpsertConfigRequest { automod_toxicity_config?: AutomodToxicityConfig; - aws_rek_og_nition_config?: AWSRekognitionConfig; + aws_rekognition_config?: AWSRekognitionConfig; block_list_config?: BlockListConfig; bodyguard_config?: BodyguardConfig; - go_og_le_vision_config?: GoogleVisionConfig; + google_vision_config?: GoogleVisionConfig; velocity_filter_config?: VelocityFilterConfig; } @@ -7053,6 +7075,8 @@ export interface UserCustomEventRequest { } export interface UserInfoResponse { + id: string; + image: string; name: string; @@ -7129,7 +7153,7 @@ export interface UserResponse { blocked_user_ids: string[]; - devices: ResponseForDevice[]; + devices: DeviceResponse[]; teams: string[]; @@ -7181,7 +7205,7 @@ export interface UserSessionStats { total_pixels_out: number; - bro_ws_er?: string; + browser?: string; browser_version?: string; @@ -7273,35 +7297,51 @@ export interface VelocityFilterConfig { enabled: boolean; + first_message_only: boolean; + rules: VelocityFilterConfigRule[]; + + async?: boolean; } export interface VelocityFilterConfigRule { action: 'flag' | 'shadow' | 'remove' | 'ban'; + ban_duration: number; + cascading_action: 'flag' | 'shadow' | 'remove' | 'ban'; cascading_threshold: number; + check_message_context: boolean; + + fast_spam_threshold: number; + + fast_spam_ttl: number; + ip_ban: boolean; shadow_ban: boolean; - timeout?: Date; -} + slow_spam_threshold: number; -export interface VideoQuality { - usage_type?: string; + 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; diff --git a/src/gen/moderation/ModerationApi.ts b/src/gen/moderation/ModerationApi.ts index 0a596d5..0d7a2dc 100644 --- a/src/gen/moderation/ModerationApi.ts +++ b/src/gen/moderation/ModerationApi.ts @@ -104,10 +104,10 @@ export class ModerationApi extends BaseApi { 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, }; @@ -360,8 +360,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,