//native
type Clickup = {
token: string;
};
/**
* Create List View
* Add a List, Board, Calendar, Table, Timeline, Workload, Activity, Map, Chat, or Gantt view to a List.
*/
export async function main(
auth: Clickup,
list_id: string,
body: {
name: string;
type: string;
grouping: {
field: string;
dir: number;
collapsed: string[];
ignore: false | true;
};
divide: { field?: null; dir?: null; collapsed: false | true };
sorting: { fields: string[] };
filters: {
op: string;
fields: string[];
search: string;
show_closed: false | true;
};
columns: { fields: string[] };
team_sidebar: {
assignees: string[];
assigned_comments: false | true;
unassigned_tasks: false | true;
};
settings: {
show_task_locations: false | true;
show_subtasks: number;
show_subtask_parent_names: false | true;
show_closed_subtasks: false | true;
show_assignees: false | true;
show_images: false | true;
collapse_empty_columns: string;
me_comments: false | true;
me_subtasks: false | true;
me_checklists: false | true;
};
},
) {
const url = new URL(`https://api.clickup.com/api/v2/list/${list_id}/view`);
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: auth.token,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 168 days ago