//native
type Clickup = {
token: string;
};
/**
* Get Filtered Team Tasks
* View the tasks that meet specific criteria from a Workspace. Responses are limited to 100 tasks per page. \
\
You can only view task information of tasks you can access. \
\
Our Try It modal currently supports filtering by two or more Lists, Folders, or Spaces. To filter by a single List, Folder, or Space, we recommend using a free app like [Postman](https://www.postman.com/) to test our public API.
*/
export async function main(
auth: Clickup,
team_Id: string,
page: string | undefined,
order_by: string | undefined,
reverse: string | undefined,
subtasks: string | undefined,
space_ids: string | undefined,
project_ids: string | undefined,
list_ids__: string | undefined,
statuses: string | undefined,
include_closed: string | undefined,
assignees: string | undefined,
tags: string | undefined,
due_date_gt: string | undefined,
due_date_lt: string | undefined,
date_created_gt: string | undefined,
date_created_lt: string | undefined,
date_updated_gt: string | undefined,
date_updated_lt: string | undefined,
date_done_gt: string | undefined,
date_done_lt: string | undefined,
custom_fields: string | undefined,
custom_task_ids: string | undefined,
team_id: string | undefined,
parent: string | undefined,
include_markdown_description: string | undefined,
custom_items: string | undefined,
) {
const url = new URL(`https://api.clickup.com/api/v2/team/${team_Id}/task`);
for (const [k, v] of [
["page", page],
["order_by", order_by],
["reverse", reverse],
["subtasks", subtasks],
["space_ids", space_ids],
["project_ids", project_ids],
["list_ids[]", list_ids__],
["statuses", statuses],
["include_closed", include_closed],
["assignees", assignees],
["tags", tags],
["due_date_gt", due_date_gt],
["due_date_lt", due_date_lt],
["date_created_gt", date_created_gt],
["date_created_lt", date_created_lt],
["date_updated_gt", date_updated_gt],
["date_updated_lt", date_updated_lt],
["date_done_gt", date_done_gt],
["date_done_lt", date_done_lt],
["custom_fields", custom_fields],
["custom_task_ids", custom_task_ids],
["team_id", team_id],
["parent", parent],
["include_markdown_description", include_markdown_description],
["custom_items", custom_items],
]) {
if (v !== undefined && v !== "" && k !== undefined) {
url.searchParams.append(k, v);
}
}
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: auth.token,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 235 days ago