diff --git a/src/gen/feeds/FeedsApi.ts b/src/gen/feeds/FeedsApi.ts index 3bde870..c513364 100644 --- a/src/gen/feeds/FeedsApi.ts +++ b/src/gen/feeds/FeedsApi.ts @@ -58,6 +58,7 @@ import { DeleteFeedsBatchResponse, DeleteFeedsRetentionPolicyRequest, DeleteFeedsRetentionPolicyResponse, + DeleteScheduledActivityResponse, DeleteUserInterestsResponse, ExportFeedUserDataResponse, FollowBatchRequest, @@ -85,6 +86,7 @@ import { GetOrCreateFollowResponse, GetOrCreateUnfollowRequest, GetOrCreateUnfollowResponse, + GetScheduledActivityResponse, GetUserInterestsResponse, ListFeedGroupsResponse, ListFeedViewsResponse, @@ -95,6 +97,7 @@ import { PinActivityRequest, PinActivityResponse, PollVoteResponse, + PublishScheduledActivityNowResponse, QueryActivitiesRequest, QueryActivitiesResponse, QueryActivityReactionsRequest, @@ -124,6 +127,8 @@ import { QueryPinnedActivitiesResponse, QueryRevisionHistoryRequest, QueryRevisionHistoryResponse, + QueryScheduledActivitiesRequest, + QueryScheduledActivitiesResponse, ReadCollectionsResponse, RejectFeedMemberInviteRequest, RejectFeedMemberInviteResponse, @@ -135,6 +140,8 @@ import { RestoreCommentRequest, RestoreCommentResponse, RestoreFeedGroupResponse, + ScheduleActivityRequest, + ScheduleActivityResponse, SetFeedsRetentionPolicyRequest, SetFeedsRetentionPolicyResponse, SingleFollowResponse, @@ -180,6 +187,8 @@ import { UpdateFollowResponse, UpdateMembershipLevelRequest, UpdateMembershipLevelResponse, + UpdateScheduledActivityRequest, + UpdateScheduledActivityResponse, UpsertActivitiesRequest, UpsertActivitiesResponse, UpsertCollectionsRequest, @@ -3060,6 +3069,160 @@ export class FeedsApi { return response; } + async scheduleActivity( + request: ScheduleActivityRequest, + ): Promise> { + const body = { + type: request?.type, + feeds: request?.feeds, + copy_custom_to_notification: request?.copy_custom_to_notification, + create_notification_activity: request?.create_notification_activity, + create_users: request?.create_users, + expires_at: request?.expires_at, + force_moderation: request?.force_moderation, + id: request?.id, + parent_id: request?.parent_id, + poll_id: request?.poll_id, + restrict_replies: request?.restrict_replies, + scheduled_at: request?.scheduled_at, + skip_enrich_url: request?.skip_enrich_url, + skip_push: request?.skip_push, + text: request?.text, + user_id: request?.user_id, + visibility: request?.visibility, + visibility_tag: request?.visibility_tag, + attachments: request?.attachments, + collection_refs: request?.collection_refs, + collections: request?.collections, + filter_tags: request?.filter_tags, + interest_tags: request?.interest_tags, + mentioned_user_ids: request?.mentioned_user_ids, + custom: request?.custom, + location: request?.location, + search_data: request?.search_data, + }; + + const response = await this.apiClient.sendRequest( + 'POST', + '/api/v2/feeds/scheduled_activities', + undefined, + undefined, + body, + ); + + decoders['ScheduleActivityResponse']?.(response); + + return response; + } + + async queryScheduledActivities( + request?: QueryScheduledActivitiesRequest, + ): Promise> { + const body = { + limit: request?.limit, + next: request?.next, + filter: request?.filter, + }; + + const response = + await this.apiClient.sendRequest( + 'POST', + '/api/v2/feeds/scheduled_activities/query', + undefined, + undefined, + body, + ); + + decoders['QueryScheduledActivitiesResponse']?.(response); + + return response; + } + + async deleteScheduledActivity(request: { + id: string; + }): Promise> { + const pathParams = { + id: request?.id, + }; + + const response = + await this.apiClient.sendRequest( + 'DELETE', + '/api/v2/feeds/scheduled_activities/{id}', + pathParams, + undefined, + ); + + decoders['DeleteScheduledActivityResponse']?.(response); + + return response; + } + + async getScheduledActivity(request: { + id: string; + }): Promise> { + const pathParams = { + id: request?.id, + }; + + const response = + await this.apiClient.sendRequest( + 'GET', + '/api/v2/feeds/scheduled_activities/{id}', + pathParams, + undefined, + ); + + decoders['GetScheduledActivityResponse']?.(response); + + return response; + } + + async updateScheduledActivity( + request: UpdateScheduledActivityRequest & { id: string }, + ): Promise> { + const pathParams = { + id: request?.id, + }; + const body = { + scheduled_at: request?.scheduled_at, + activity: request?.activity, + }; + + const response = + await this.apiClient.sendRequest( + 'PATCH', + '/api/v2/feeds/scheduled_activities/{id}', + pathParams, + undefined, + body, + ); + + decoders['UpdateScheduledActivityResponse']?.(response); + + return response; + } + + async publishScheduledActivityNow(request: { + id: string; + }): Promise> { + const pathParams = { + id: request?.id, + }; + + const response = + await this.apiClient.sendRequest( + 'POST', + '/api/v2/feeds/scheduled_activities/{id}/publish_now', + pathParams, + undefined, + ); + + decoders['PublishScheduledActivityNowResponse']?.(response); + + return response; + } + async queryFeedsUsageStats( request?: QueryFeedsUsageStatsRequest, ): Promise> { diff --git a/src/gen/model-decoders/decoders.ts b/src/gen/model-decoders/decoders.ts index 7366104..9a6490f 100644 --- a/src/gen/model-decoders/decoders.ts +++ b/src/gen/model-decoders/decoders.ts @@ -3291,6 +3291,13 @@ decoders['GetReviewQueueItemResponse'] = (input?: { [key: string]: any }) => { return decode(typeMappings, input); }; +decoders['GetScheduledActivityResponse'] = (input?: { [key: string]: any }) => { + const typeMappings: TypeMapping = { + scheduled_activity: { type: 'ScheduledActivityResponse', isSingle: true }, + }; + return decode(typeMappings, input); +}; + decoders['GetSegmentResponse'] = (input?: { [key: string]: any }) => { const typeMappings: TypeMapping = { segment: { type: 'SegmentResponse', isSingle: true }, @@ -4431,6 +4438,15 @@ decoders['PredefinedFilterStatsResponse'] = (input?: { return decode(typeMappings, input); }; +decoders['PublishScheduledActivityNowResponse'] = (input?: { + [key: string]: any; +}) => { + const typeMappings: TypeMapping = { + scheduled_activity: { type: 'ScheduledActivityResponse', isSingle: true }, + }; + return decode(typeMappings, input); +}; + decoders['PublishedTrackMetrics'] = (input?: { [key: string]: any }) => { const typeMappings: TypeMapping = { warnings: { type: 'SessionWarningResponse', isSingle: false }, @@ -4869,6 +4885,18 @@ decoders['QueryRevisionHistoryResponse'] = (input?: { [key: string]: any }) => { return decode(typeMappings, input); }; +decoders['QueryScheduledActivitiesResponse'] = (input?: { + [key: string]: any; +}) => { + const typeMappings: TypeMapping = { + scheduled_activities: { + type: 'ScheduledActivityResponse', + isSingle: false, + }, + }; + return decode(typeMappings, input); +}; + decoders['QueryScheduledMessagesResponse'] = (input?: { [key: string]: any; }) => { @@ -5317,6 +5345,61 @@ decoders['SIPTrunkResponse'] = (input?: { [key: string]: any }) => { return decode(typeMappings, input); }; +decoders['ScheduleActivityResponse'] = (input?: { [key: string]: any }) => { + const typeMappings: TypeMapping = { + scheduled_activity: { type: 'ScheduledActivityResponse', isSingle: true }, + }; + return decode(typeMappings, input); +}; + +decoders['ScheduledActivityFailedEvent'] = (input?: { [key: string]: any }) => { + const typeMappings: TypeMapping = { + created_at: { type: 'DatetimeType', isSingle: true }, + + scheduled_activity: { type: 'ScheduledActivityResponse', isSingle: true }, + + received_at: { type: 'DatetimeType', isSingle: true }, + + user: { type: 'UserResponseCommonFields', isSingle: true }, + }; + return decode(typeMappings, input); +}; + +decoders['ScheduledActivityPreview'] = (input?: { [key: string]: any }) => { + const typeMappings: TypeMapping = { + expires_at: { type: 'DatetimeType', isSingle: true }, + }; + return decode(typeMappings, input); +}; + +decoders['ScheduledActivityPublishedEvent'] = (input?: { + [key: string]: any; +}) => { + const typeMappings: TypeMapping = { + created_at: { type: 'DatetimeType', isSingle: true }, + + scheduled_activity: { type: 'ScheduledActivityResponse', isSingle: true }, + + received_at: { type: 'DatetimeType', isSingle: true }, + + user: { type: 'UserResponseCommonFields', isSingle: true }, + }; + return decode(typeMappings, input); +}; + +decoders['ScheduledActivityResponse'] = (input?: { [key: string]: any }) => { + const typeMappings: TypeMapping = { + created_at: { type: 'DatetimeType', isSingle: true }, + + scheduled_at: { type: 'DatetimeType', isSingle: true }, + + updated_at: { type: 'DatetimeType', isSingle: true }, + + activity: { type: 'ScheduledActivityPreview', isSingle: true }, + }; + return decode(typeMappings, input); +}; + decoders['ScheduledMessageContentResponse'] = (input?: { [key: string]: any; }) => { @@ -6087,6 +6170,15 @@ decoders['UpdateSIPTrunkResponse'] = (input?: { [key: string]: any }) => { return decode(typeMappings, input); }; +decoders['UpdateScheduledActivityResponse'] = (input?: { + [key: string]: any; +}) => { + const typeMappings: TypeMapping = { + scheduled_activity: { type: 'ScheduledActivityResponse', isSingle: true }, + }; + return decode(typeMappings, input); +}; + decoders['UpdateScheduledMessageResponse'] = (input?: { [key: string]: any; }) => { diff --git a/src/gen/models/index.ts b/src/gen/models/index.ts index 2c92276..8ab5b70 100644 --- a/src/gen/models/index.ts +++ b/src/gen/models/index.ts @@ -8286,6 +8286,10 @@ export interface DeleteSIPTrunkResponse { duration: string; } +export interface DeleteScheduledActivityResponse { + duration: string; +} + export interface DeleteScheduledMessageResponse { /** * Duration of the request in milliseconds @@ -11315,6 +11319,14 @@ export interface GetReviewQueueItemResponse { item?: ReviewQueueItemResponse; } +export interface GetScheduledActivityResponse { + duration: string; + /** + * An activity scheduled to be published at a future time + */ + scheduled_activity: ScheduledActivityResponse; +} + export interface GetSegmentResponse { /** * Duration of the request in milliseconds @@ -15687,6 +15699,14 @@ export interface PrivacySettingsResponse { typing_indicators?: TypingIndicatorsResponse; } +export interface PublishScheduledActivityNowResponse { + duration: string; + /** + * An activity scheduled to be published at a future time + */ + scheduled_activity: ScheduledActivityResponse; +} + export interface PublishedTrackFlags { audio: boolean; screenshare: boolean; @@ -17499,6 +17519,45 @@ export interface QueryRevisionHistoryResponse { prev?: string; } +export interface QueryScheduledActivitiesFilter { + /** + * Only activities scheduled for this feed + */ + fid?: string; + /** + * Only activities of this user. Server-side only; client-side requests always see their own. + */ + user_id?: string; + /** + * Only activities with one of these statuses: scheduled, publishing, failed + */ + status?: Array; +} + +export interface QueryScheduledActivitiesRequest { + /** + * Maximum number of scheduled activities to return. Default 25, maximum 100. + */ + limit?: number; + /** + * Cursor from a previous response to fetch the next page + */ + next?: string; + filter?: QueryScheduledActivitiesFilter; +} + +export interface QueryScheduledActivitiesResponse { + duration: string; + /** + * The scheduled activities, ordered by scheduled_at + */ + scheduled_activities: Array; + /** + * Cursor for the next page, absent on the last page + */ + next?: string; +} + export interface QueryScheduledMessagesRequest { /** * Page size, 1 to 100. Defaults to 20 @@ -19498,6 +19557,274 @@ export interface SRTIngress { address: string; } +export interface ScheduleActivityRequest { + /** + * Type of activity + */ + type: string; + /** + * List of feeds to add the activity to with a default max limit of 25 feeds + */ + feeds: Array; + /** + * @deprecated + * Whether to copy custom data to the notification activity (only applies when create_notification_activity is true) Deprecated: use notification_context.trigger.custom and notification_context.target.custom instead + */ + copy_custom_to_notification?: boolean; + /** + * Whether to create notification activities for mentioned users + */ + create_notification_activity?: boolean; + /** + * If true, creates the user referenced by user_id when it does not exist. Server-side only. + */ + create_users?: boolean; + /** + * Expiration time for the activity + */ + expires_at?: string; + /** + * If true, forces moderation to run at publish for server-side requests. By default, server-side requests skip moderation. Client-side requests always run moderation regardless of this field. + */ + force_moderation?: boolean; + /** + * Optional ID for the activity + */ + id?: string; + /** + * ID of parent activity for replies/comments + */ + parent_id?: string; + /** + * ID of a poll to attach to activity + */ + poll_id?: string; + /** + * Controls who can add comments/replies to this activity. One of: everyone, people_i_follow, nobody + */ + restrict_replies?: 'everyone' | 'people_i_follow' | 'nobody'; + /** + * When to publish the activity, an RFC 3339 time. A time less than a minute ahead or in the past is moved to one minute from now, and the time is rounded up to a whole minute. + */ + scheduled_at?: Date; + /** + * Whether to skip URL enrichment for the activity + */ + skip_enrich_url?: boolean; + /** + * Whether to skip push notifications + */ + skip_push?: boolean; + /** + * Text content of the activity + */ + text?: string; + /** + * ID of the user creating the activity + */ + user_id?: string; + /** + * Visibility setting for the activity. One of: public, private, tag + */ + visibility?: 'public' | 'private' | 'tag'; + /** + * If visibility is 'tag', this is the tag name and is required + */ + visibility_tag?: string; + /** + * List of attachments for the activity + */ + attachments?: Array; + /** + * Collections that this activity references + */ + collection_refs?: Array; + /** + * Collections to create or update as part of this request, so an activity and the collections it references can be written in one call. Their refs (name:id) are added to collection_refs automatically; you do not need to restate them, and they count toward the same per-activity collection-reference limit, which is the effective cap here. A collection that already exists has its custom data updated. Use collection_refs instead when the collection already exists and you are only referencing it, which requires no collection permissions. + */ + collections?: Array; + /** + * Tags for filtering activities + */ + filter_tags?: Array; + /** + * Tags for indicating user interests + */ + interest_tags?: Array; + /** + * List of users mentioned in the activity + */ + mentioned_user_ids?: Array; + /** + * Custom data for the activity + */ + custom?: Record; + location?: Location; + /** + * Additional data for search indexing + */ + search_data?: Record; +} + +export interface ScheduleActivityResponse { + duration: string; + /** + * An activity scheduled to be published at a future time + */ + scheduled_activity: ScheduledActivityResponse; +} + +export interface ScheduledActivityFailedEvent { + /** + * Date/time of creation + */ + created_at: Date; + /** + * Why the activity failed to publish + */ + failure_reason: string; + custom: Record; + /** + * An activity scheduled to be published at a future time + */ + scheduled_activity: ScheduledActivityResponse; + /** + * The type of event: "feeds.scheduled_activity.failed" in this case + */ + type: string; + received_at?: Date; + user?: UserResponseCommonFields; +} + +export interface ScheduledActivityPreview { + /** + * Type of activity + */ + type: string; + /** + * Feeds the activity will be added to + */ + feeds: Array; + /** + * When the published activity expires + */ + expires_at?: Date; + /** + * ID the activity gets when published + */ + id?: string; + /** + * ID of the parent activity + */ + parent_id?: string; + /** + * ID of the poll attached to the activity + */ + poll_id?: string; + /** + * Who may reply to the activity + */ + restrict_replies?: 'everyone' | 'people_i_follow' | 'nobody'; + /** + * Text content of the activity + */ + text?: string; + /** + * Visibility of the activity + */ + visibility?: 'public' | 'private' | 'tag'; + /** + * Visibility tag of the activity + */ + visibility_tag?: string; + /** + * Attachments of the activity + */ + attachments?: Array; + /** + * Collections referenced by the activity + */ + collection_refs?: Array; + /** + * Filter tags of the activity + */ + filter_tags?: Array; + /** + * Interest tags of the activity + */ + interest_tags?: Array; + /** + * Users mentioned in the activity + */ + mentioned_user_ids?: Array; + /** + * Custom data of the activity + */ + custom?: Record; + location?: Location; + /** + * Search data of the activity + */ + search_data?: Record; +} + +export interface ScheduledActivityPublishedEvent { + /** + * Date/time of creation + */ + created_at: Date; + custom: Record; + /** + * An activity scheduled to be published at a future time + */ + scheduled_activity: ScheduledActivityResponse; + /** + * The type of event: "feeds.scheduled_activity.published" in this case + */ + type: string; + received_at?: Date; + user?: UserResponseCommonFields; +} + +export interface ScheduledActivityResponse { + /** + * When the activity was scheduled + */ + created_at: Date; + /** + * ID of the scheduled activity, also the ID the activity gets when published + */ + id: string; + /** + * When the activity will be published + */ + scheduled_at: Date; + /** + * One of: scheduled, publishing, failed, canceled + */ + status: string; + /** + * When the scheduled activity was last changed + */ + updated_at: Date; + /** + * ID of the user the activity is published as + */ + user_id: string; + /** + * Feeds the activity will be added to + */ + feeds: Array; + /** + * The activity a scheduled activity will publish + */ + activity: ScheduledActivityPreview; + /** + * Why the publish failed; set only when status is failed + */ + failure_reason?: string; +} + export interface ScheduledMessageChannelResponse { /** * Channel CID (:) @@ -23311,6 +23638,22 @@ export interface UpdateSIPTrunkResponse { sip_trunk?: SIPTrunkResponse; } +export interface UpdateScheduledActivityRequest { + /** + * When to publish the activity, an RFC 3339 time. A time less than a minute ahead or in the past is moved to one minute from now, and the time is rounded up to a whole minute. + */ + scheduled_at?: Date; + activity?: ActivityRequest; +} + +export interface UpdateScheduledActivityResponse { + duration: string; + /** + * An activity scheduled to be published at a future time + */ + scheduled_activity: ScheduledActivityResponse; +} + export interface UpdateScheduledMessageRequest { /** * New send time (UTC). Must be at least 1 minute and at most the app's maximum lead time from now @@ -24836,6 +25179,10 @@ export type WHEvent = | ({ type: 'feeds.follow.deleted' } & FollowDeletedEvent) | ({ type: 'feeds.follow.updated' } & FollowUpdatedEvent) | ({ type: 'feeds.notification_feed.updated' } & NotificationFeedUpdatedEvent) + | ({ type: 'feeds.scheduled_activity.failed' } & ScheduledActivityFailedEvent) + | ({ + type: 'feeds.scheduled_activity.published'; + } & ScheduledActivityPublishedEvent) | ({ type: 'feeds.stories_feed.updated' } & StoriesFeedUpdatedEvent) | ({ type: 'flag.updated' } & FlagUpdatedEvent) | ({ type: 'import.error' } & AsyncImportErrorEvent)