diff --git a/src/gen/feeds/FeedsApi.ts b/src/gen/feeds/FeedsApi.ts index 876700f..f0f783b 100644 --- a/src/gen/feeds/FeedsApi.ts +++ b/src/gen/feeds/FeedsApi.ts @@ -59,6 +59,7 @@ import { DeleteFeedsBatchResponse, DeleteFeedsRetentionPolicyRequest, DeleteFeedsRetentionPolicyResponse, + DeleteScheduledActivityResponse, DeleteUserInterestsResponse, ExportFeedUserDataResponse, ExportFeedsAppRequest, @@ -91,6 +92,7 @@ import { GetOrCreateFollowResponse, GetOrCreateUnfollowRequest, GetOrCreateUnfollowResponse, + GetScheduledActivityResponse, GetUserInterestsResponse, ListFeedGroupsResponse, ListFeedViewsResponse, @@ -101,6 +103,7 @@ import { PinActivityRequest, PinActivityResponse, PollVoteResponse, + PublishScheduledActivityNowResponse, QueryActivitiesRequest, QueryActivitiesResponse, QueryActivityReactionsRequest, @@ -130,6 +133,8 @@ import { QueryPinnedActivitiesResponse, QueryRevisionHistoryRequest, QueryRevisionHistoryResponse, + QueryScheduledActivitiesRequest, + QueryScheduledActivitiesResponse, ReadCollectionsResponse, RejectFeedMemberInviteRequest, RejectFeedMemberInviteResponse, @@ -141,6 +146,8 @@ import { RestoreCommentRequest, RestoreCommentResponse, RestoreFeedGroupResponse, + ScheduleActivityRequest, + ScheduleActivityResponse, SetFeedsRetentionPolicyRequest, SetFeedsRetentionPolicyResponse, SingleFollowResponse, @@ -186,6 +193,8 @@ import { UpdateFollowResponse, UpdateMembershipLevelRequest, UpdateMembershipLevelResponse, + UpdateScheduledActivityRequest, + UpdateScheduledActivityResponse, UpsertActivitiesRequest, UpsertActivitiesResponse, UpsertCollectionsRequest, @@ -3163,6 +3172,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/models/index.ts b/src/gen/models/index.ts index ffcbf79..04f6097 100644 --- a/src/gen/models/index.ts +++ b/src/gen/models/index.ts @@ -8840,6 +8840,10 @@ export interface DeleteSIPTrunkResponse { duration: string; } +export interface DeleteScheduledActivityResponse { + duration: string; +} + export interface DeleteScheduledMessageResponse { /** * Duration of the request in milliseconds @@ -12209,6 +12213,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 @@ -16850,6 +16862,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; @@ -18737,6 +18757,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 @@ -20831,6 +20890,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: TimestampNS; + /** + * 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?: TimestampNS; + 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?: TimestampNS; + /** + * 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: TimestampNS; + 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?: TimestampNS; + user?: UserResponseCommonFields; +} + +export interface ScheduledActivityResponse { + /** + * When the activity was scheduled + */ + created_at: TimestampNS; + /** + * ID of the scheduled activity, also the ID the activity gets when published + */ + id: string; + /** + * When the activity will be published + */ + scheduled_at: TimestampNS; + /** + * One of: scheduled, publishing, failed, canceled + */ + status: string; + /** + * When the scheduled activity was last changed + */ + updated_at: TimestampNS; + /** + * 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 (:) @@ -24703,6 +25030,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 in the future and at most the app's maximum lead time from now. Rounded up to the first whole minute that is at least 1 minute from now, never earlier than requested. Resending the stored time leaves it unchanged @@ -26265,6 +26608,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)