UNPKG

2.34 kBTypeScriptView Raw
1import type { DefaultElements, ISO8601Timestamp, Link, MakeRequest } from '../common-types';
2import type { AsyncActionProcessingOptions } from '../methods/action';
3type ReleaseActionStatuses = 'created' | 'inProgress' | 'failed' | 'succeeded';
4export type ReleaseActionTypes = 'publish' | 'unpublish' | 'validate';
5export type ReleaseActionSysProps = {
6 id: string;
7 type: 'ReleaseAction';
8 space: Link<'Space'>;
9 environment: Link<'Environment'>;
10 release: Link<'Release'>;
11 status: ReleaseActionStatuses;
12 createdBy: Link<'User'>;
13 createdAt: ISO8601Timestamp;
14 updatedAt: ISO8601Timestamp;
15};
16/** The object returned by the Releases API */
17export interface ReleaseActionProps<T extends ReleaseActionTypes = any> {
18 action: T;
19 sys: ReleaseActionSysProps;
20}
21export interface ReleaseActionQueryOptions {
22 /** Find Release Actions by using a comma-separated list of Ids */
23 'sys.id[in]'?: string;
24 'sys.release.sys.id[in]'?: string;
25 'sys.status[in]'?: string;
26 'sys.status[nin]'?: string;
27 action?: ReleaseActionTypes;
28 /** Get unique results by this field. Currently supports `sys.release.sys.id` */
29 uniqueBy?: string;
30 /** @default -sys.updatedAt */
31 order?: string;
32 /**
33 * Limit of how many records are returned in the query result
34 * @default 100
35 * */
36 limit?: number;
37}
38export interface ReleaseActionApiMethods {
39 /** Performs a new GET request and returns the wrapper Release */
40 get(): ReleaseAction;
41 /** Waits until the Release Action has either succeeded or failed */
42 waitProcessing(options?: AsyncActionProcessingOptions): ReleaseAction;
43}
44export interface ReleaseAction<T extends ReleaseActionTypes = any> extends ReleaseActionProps<T>, ReleaseActionApiMethods, DefaultElements<ReleaseActionProps<T>> {
45}
46/**
47 * @private
48 * @param makeRequest - function to make requests via an adapter
49 * @param data - Raw Release data
50 * @return Wrapped Release data
51 */
52export declare function wrapReleaseAction(makeRequest: MakeRequest, data: ReleaseActionProps): ReleaseAction;
53/**
54 * @private
55 */
56export declare const wrapReleaseActionCollection: (makeRequest: MakeRequest, data: import("../common-types").CollectionProp<ReleaseActionProps<any>>) => import("../common-types").Collection<ReleaseAction<any>, ReleaseActionProps<any>>;
57export {};