import type { DefaultElements, ISO8601Timestamp, MetaLinkProps, Link, MakeRequest, SysLink, ScheduledActionReferenceFilters, BasicCursorPaginationOptions, CollectionProp } from '../common-types'; /** * Represents that state of the scheduled action */ declare enum ScheduledActionStatus { /** action is pending execution */ scheduled = "scheduled", /** action has been started and pending completion */ inProgress = "inProgress", /** action was completed successfully (terminal state) */ succeeded = "succeeded", /** action failed to complete (terminal state) */ failed = "failed", /** action was canceled by a user (terminal state) */ canceled = "canceled" } type SchedulableEntityType = 'Entry' | 'Asset' | 'Release'; type SchedulableActionType = 'publish' | 'unpublish'; type ErrorDetail = { error: any; }; interface ScheduledActionFailedError { sys: { type: 'Error'; id: string; }; message?: string; details?: { errors: ErrorDetail[]; }; } export interface CursorPaginatedCollectionProp extends Omit, 'total' | 'skip'> { pages?: BasicCursorPaginationOptions; } export type ScheduledActionSysProps = { id: string; type: 'ScheduledAction'; version: number; space: SysLink; status: ScheduledActionStatus; createdAt: ISO8601Timestamp; createdBy: Link<'User'> | Link<'AppDefinition'>; /** an ISO8601 date string representing when an action was moved to canceled */ canceledAt?: ISO8601Timestamp; canceledBy?: Link<'User'> | Link<'AppDefinition'>; /** an ISO8601 date string representing when an action was updated */ updatedAt: ISO8601Timestamp; updatedBy: Link<'User'> | Link<'AppDefinition'>; }; export type ScheduledActionPayloadProps = { withReferences?: Record; }; export type ScheduledActionProps = { sys: ScheduledActionSysProps; action: SchedulableActionType; entity: Link; environment?: { sys: MetaLinkProps; }; scheduledFor: { datetime: ISO8601Timestamp; /** * A valid IANA timezone Olson identifier * * @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones * @example 'Asia/Kolkata' */ timezone?: string; }; /** * The Contentful-style error that occurred during execution if sys.status is failed * * @example * { * sys: { * type: 'Error', * id: 'InvalidEntry' * }, * message: 'Entry is invalid', * details: { * errors: [...] * } * } */ error?: ScheduledActionFailedError; payload?: ScheduledActionPayloadProps; }; export type CreateUpdateScheduledActionProps = Pick; export type ScheduledActionCollection = CursorPaginatedCollectionProp; export interface ScheduledActionQueryOptions { 'environment.sys.id': string; [key: string]: any; limit?: number; next?: string; prev?: string; } export type ScheduledActionApi = { delete(): Promise; update(): Promise; }; export interface ScheduledAction extends ScheduledActionProps, DefaultElements, ScheduledActionApi { } export default function getInstanceMethods(makeRequest: MakeRequest): ScheduledActionApi; /** * @private */ export declare function wrapScheduledAction(makeRequest: MakeRequest, data: ScheduledActionProps): ScheduledAction; /** * @private */ export declare const wrapScheduledActionCollection: (makeRequest: MakeRequest, data: CollectionProp) => import("../common-types").Collection; export {};