UNPKG

1.46 kBTypeScriptView Raw
1import type { BasicMetaSysProps, DefaultElements, GetEntryParams, GetTaskParams, Link, MakeRequest, SysLink } from '../common-types';
2export type TaskStatus = 'active' | 'resolved';
3export type TaskSysProps = Pick<BasicMetaSysProps, 'id' | 'version' | 'createdAt' | 'createdBy' | 'updatedAt' | 'updatedBy'> & {
4 type: 'Task';
5 space: SysLink;
6 environment: SysLink;
7 parentEntity: Link<'Entry'>;
8};
9export type TaskProps = {
10 sys: TaskSysProps;
11 body: string;
12 assignedTo: Link<'User' | 'Team'>;
13 status: TaskStatus;
14 dueDate?: string;
15};
16export type CreateTaskProps = Omit<TaskProps, 'sys'>;
17export type UpdateTaskProps = Omit<TaskProps, 'sys'> & {
18 sys: Pick<TaskSysProps, 'version'>;
19};
20export type CreateTaskParams = GetEntryParams;
21export type UpdateTaskParams = GetTaskParams;
22export type DeleteTaskParams = GetTaskParams & {
23 version: number;
24};
25type TaskApi = {
26 update(): Promise<Task>;
27 delete(): Promise<void>;
28};
29export interface Task extends TaskProps, DefaultElements<TaskProps>, TaskApi {
30}
31/**
32 * @private
33 */
34export default function createTaskApi(makeRequest: MakeRequest): TaskApi;
35/**
36 * @private
37 */
38export declare function wrapTask(makeRequest: MakeRequest, data: TaskProps): Task;
39/**
40 * @private
41 */
42export declare const wrapTaskCollection: (makeRequest: MakeRequest, data: import("../common-types").CollectionProp<TaskProps>) => import("../common-types").Collection<Task, TaskProps>;
43export {};