1 | import type { DefaultElements, ISO8601Timestamp, MetaLinkProps, Link, MakeRequest, SysLink, ScheduledActionReferenceFilters, BasicCursorPaginationOptions, CollectionProp } from '../common-types';
|
2 |
|
3 |
|
4 |
|
5 | declare enum ScheduledActionStatus {
|
6 |
|
7 | scheduled = "scheduled",
|
8 |
|
9 | inProgress = "inProgress",
|
10 |
|
11 | succeeded = "succeeded",
|
12 |
|
13 | failed = "failed",
|
14 |
|
15 | canceled = "canceled"
|
16 | }
|
17 | type SchedulableEntityType = 'Entry' | 'Asset' | 'Release';
|
18 | type SchedulableActionType = 'publish' | 'unpublish';
|
19 | type ErrorDetail = {
|
20 | error: any;
|
21 | };
|
22 | interface ScheduledActionFailedError {
|
23 | sys: {
|
24 | type: 'Error';
|
25 | id: string;
|
26 | };
|
27 | message?: string;
|
28 | details?: {
|
29 | errors: ErrorDetail[];
|
30 | };
|
31 | }
|
32 | export interface CursorPaginatedCollectionProp<TObj> extends Omit<CollectionProp<TObj>, 'total' | 'skip'> {
|
33 | pages?: BasicCursorPaginationOptions;
|
34 | }
|
35 | export type ScheduledActionSysProps = {
|
36 | id: string;
|
37 | type: 'ScheduledAction';
|
38 | version: number;
|
39 | space: SysLink;
|
40 | status: ScheduledActionStatus;
|
41 | createdAt: ISO8601Timestamp;
|
42 | createdBy: Link<'User'> | Link<'AppDefinition'>;
|
43 |
|
44 | canceledAt?: ISO8601Timestamp;
|
45 | canceledBy?: Link<'User'> | Link<'AppDefinition'>;
|
46 |
|
47 | updatedAt: ISO8601Timestamp;
|
48 | updatedBy: Link<'User'> | Link<'AppDefinition'>;
|
49 | };
|
50 | export type ScheduledActionPayloadProps = {
|
51 | withReferences?: Record<ScheduledActionReferenceFilters, string[]>;
|
52 | };
|
53 | export type ScheduledActionProps = {
|
54 | sys: ScheduledActionSysProps;
|
55 | action: SchedulableActionType;
|
56 | entity: Link<SchedulableEntityType>;
|
57 | environment?: {
|
58 | sys: MetaLinkProps;
|
59 | };
|
60 | scheduledFor: {
|
61 | datetime: ISO8601Timestamp;
|
62 | |
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 | timezone?: string;
|
69 | };
|
70 | |
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 |
|
77 |
|
78 |
|
79 |
|
80 |
|
81 |
|
82 |
|
83 |
|
84 |
|
85 | error?: ScheduledActionFailedError;
|
86 | payload?: ScheduledActionPayloadProps;
|
87 | };
|
88 | export type CreateUpdateScheduledActionProps = Pick<ScheduledActionProps, 'action' | 'entity' | 'environment' | 'scheduledFor' | 'payload'>;
|
89 | export type ScheduledActionCollection = CursorPaginatedCollectionProp<ScheduledActionProps>;
|
90 | export interface ScheduledActionQueryOptions {
|
91 | 'environment.sys.id': string;
|
92 | [key: string]: any;
|
93 | limit?: number;
|
94 | next?: string;
|
95 | prev?: string;
|
96 | }
|
97 | export type ScheduledActionApi = {
|
98 | delete(): Promise<ScheduledAction>;
|
99 | update(): Promise<ScheduledAction>;
|
100 | };
|
101 | export interface ScheduledAction extends ScheduledActionProps, DefaultElements<ScheduledActionProps>, ScheduledActionApi {
|
102 | }
|
103 | export default function getInstanceMethods(makeRequest: MakeRequest): ScheduledActionApi;
|
104 |
|
105 |
|
106 |
|
107 | export declare function wrapScheduledAction(makeRequest: MakeRequest, data: ScheduledActionProps): ScheduledAction;
|
108 |
|
109 |
|
110 |
|
111 | export declare const wrapScheduledActionCollection: (makeRequest: MakeRequest, data: CollectionProp<ScheduledActionProps>) => import("../common-types").Collection<ScheduledAction, ScheduledActionProps>;
|
112 | export {};
|