UNPKG

3.66 kBTypeScriptView Raw
1import { BaseCollection, CursorPaginatedCollection, CursorPaginatedCollectionProp, DefaultElements, ISO8601Timestamp, Link, MakeRequest, MakeRequestPayload } from '../common-types';
2import { AsyncActionProcessingOptions } from '../methods/action';
3import { ReleaseActionProps } from './release-action';
4/** Entity types supported by the Release API */
5declare type Entity = 'Entry' | 'Asset';
6export interface ReleaseQueryOptions {
7 /** Find releases filtered by the Entity type (Asset, Entry) */
8 'entities.sys.linkType'?: string;
9 /** Find releases containing the specified, comma-separated entities. Requires `entities.sys.linkType` */
10 'entities.sys.id[in]'?: string;
11 /** Find releases by using a comma-separated list of Ids */
12 'sys.id[in]'?: string;
13 /** Find releases using full text phrase and term matching */
14 'title[match]'?: string;
15 /** If present, will return results based on a pagination cursor */
16 pageNext?: string;
17 /**
18 * Limit how many records are returned in the result
19 * @default 100
20 * */
21 limit?: number;
22 /**
23 * Order releases by
24 * @default -sys.updatedAt
25 * */
26 order?: string;
27 /**
28 * Filters by creator of release
29 */
30 'sys.createdBy.sys.id[in]'?: string;
31}
32export declare type ReleaseSysProps = {
33 id: string;
34 type: 'Release';
35 version: number;
36 space: Link<'Space'>;
37 environment: Link<'Environment'>;
38 createdBy: Link<'User'> | Link<'AppDefinition'>;
39 updatedBy: Link<'User'> | Link<'AppDefinition'>;
40 createdAt: ISO8601Timestamp;
41 updatedAt: ISO8601Timestamp;
42 lastAction?: Link<'ReleaseAction'>;
43};
44/** The object returned by the Releases API */
45export interface ReleaseProps {
46 title: string;
47 sys: ReleaseSysProps;
48 entities: BaseCollection<Link<Entity>>;
49}
50export interface ReleasePayload extends MakeRequestPayload {
51 title: string;
52 entities: BaseCollection<Link<Entity>>;
53}
54export interface ReleaseValidatePayload {
55 action?: 'publish';
56}
57export interface ReleaseValidateOptions {
58 payload?: ReleaseValidatePayload;
59 processingOptions?: AsyncActionProcessingOptions;
60}
61export interface ReleaseApiMethods {
62 /** Updates a Release and returns the updated Release object */
63 update(payload: ReleasePayload): Promise<Release>;
64 /** Deletes a Release and all ReleaseActions linked to it (non-reversible) */
65 delete(): Promise<void>;
66 /** Publishes a Release and waits until the asynchronous action is completed */
67 publish(options?: AsyncActionProcessingOptions): Promise<ReleaseActionProps<'publish'>>;
68 /** Unpublishes a Release and waits until the asynchronous action is completed */
69 unpublish(options?: AsyncActionProcessingOptions): Promise<ReleaseActionProps<'unpublish'>>;
70 /** Validates a Release and waits until the asynchronous action is completed */
71 validate({ payload, options, }?: {
72 payload?: ReleaseValidatePayload;
73 options?: AsyncActionProcessingOptions;
74 }): Promise<ReleaseActionProps<'validate'>>;
75}
76export interface Release extends ReleaseProps, ReleaseApiMethods, DefaultElements<ReleaseProps> {
77}
78/**
79 * Return a Release object enhanced with its own API helper functions.
80 * @private
81 * @param makeRequest - function to make requests via an adapter
82 * @param data - Raw Release data
83 * @return Wrapped Release data
84 */
85export declare function wrapRelease(makeRequest: MakeRequest, data: ReleaseProps): Release;
86/**
87 * @private
88 */
89export declare const wrapReleaseCollection: (makeRequest: MakeRequest, data: CursorPaginatedCollectionProp<ReleaseProps>) => CursorPaginatedCollection<Release, ReleaseProps>;
90export {};