import { Metadata, Task } from './entities'; import { EntryFieldAPI } from './field.types'; import { CollectionResponse, EntrySys, SearchQuery } from './utils'; type TaskState = 'active' | 'resolved'; export interface TaskInputData { assignedToId: string; assignedToType?: 'User' | 'Team'; body: string; status: TaskState; dueDate?: string; } /** Allows accessing the Task API for the current entry. */ export interface TaskAPI { getTask(id: string): Promise; getTasks(query?: SearchQuery): Promise>; createTask(data: TaskInputData): Promise; updateTask(task: Task): Promise; deleteTask(task: Task): Promise; } export type ReleaseEntrySys = EntrySys & { release: { sys: { id: string; }; }; }; export interface EntryAPI extends TaskAPI { /** Returns sys for an entry. */ getSys: () => EntrySys | ReleaseEntrySys; /** Publish the entry */ publish: (options?: { skipUiValidation?: boolean; }) => Promise; /** Unpublish the entry */ unpublish: () => Promise; /** Saves the current changes of the entry */ save: () => Promise; /** Calls the callback with sys every time that sys changes. */ onSysChanged: (callback: (sys: EntrySys) => void) => () => void; /** Allows to control the values of all other fields in the current entry. */ fields: { [key: string]: EntryFieldAPI; }; /** * Optional metadata on an entry * @deprecated */ metadata?: Metadata; getMetadata: () => Metadata | undefined; onMetadataChanged: (callback: (metadata?: Metadata) => void) => VoidFunction; } export {};