type Asana = {
token: string;
};
/**
* Get multiple tasks
* Returns the compact task records for some filtered set of tasks. Use one or more of the parameters provided to filter the tasks returned. You must specify a `project` or `tag` if you do not specify `assignee` and `workspace`.
For more complex task retrieval, use workspaces/{workspace_gid}/tasks/search.
*/
export async function main(
auth: Asana,
opt_pretty: string | undefined,
opt_fields: string | undefined,
limit: string | undefined,
offset: string | undefined,
assignee: string | undefined,
project: string | undefined,
section: string | undefined,
workspace: string | undefined,
completed_since: string | undefined,
modified_since: string | undefined
) {
const url = new URL(`https://app.asana.com/api/1.0/tasks`);
for (const [k, v] of [
["opt_pretty", opt_pretty],
["opt_fields", opt_fields],
["limit", limit],
["offset", offset],
["assignee", assignee],
["project", project],
["section", section],
["workspace", workspace],
["completed_since", completed_since],
["modified_since", modified_since],
]) {
if (v !== undefined && v !== "") {
url.searchParams.append(k, v);
}
}
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: "Bearer " + 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 383 days ago
type Asana = {
token: string;
};
/**
* Get multiple tasks
* Returns the compact task records for some filtered set of tasks. Use one or more of the parameters provided to filter the tasks returned. You must specify a `project` or `tag` if you do not specify `assignee` and `workspace`.
For more complex task retrieval, use workspaces/{workspace_gid}/tasks/search.
*/
export async function main(
auth: Asana,
opt_pretty: string | undefined,
opt_fields: string | undefined,
limit: string | undefined,
offset: string | undefined,
assignee: string | undefined,
project: string | undefined,
section: string | undefined,
workspace: string | undefined,
completed_since: string | undefined,
modified_since: string | undefined
) {
const url = new URL(`https://app.asana.com/api/1.0/tasks`);
for (const [k, v] of [
["opt_pretty", opt_pretty],
["opt_fields", opt_fields],
["limit", limit],
["offset", offset],
["assignee", assignee],
["project", project],
["section", section],
["workspace", workspace],
["completed_since", completed_since],
["modified_since", modified_since],
]) {
if (v !== undefined && v !== "") {
url.searchParams.append(k, v);
}
}
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: "Bearer " + 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 810 days ago
type Asana = {
token: string;
};
/**
* Get multiple tasks
* Returns the compact task records for some filtered set of tasks. Use one or more of the parameters provided to filter the tasks returned. You must specify a `project` or `tag` if you do not specify `assignee` and `workspace`.
For more complex task retrieval, use [workspaces/{workspace_gid}/tasks/search](/docs/search-tasks-in-a-workspace).
*/
export async function main(
auth: Asana,
opt_pretty: string | undefined,
opt_fields: string | undefined,
limit: string | undefined,
offset: string | undefined,
assignee: string | undefined,
project: string | undefined,
section: string | undefined,
workspace: string | undefined,
completed_since: string | undefined,
modified_since: string | undefined
) {
const url = new URL(`https://app.asana.com/api/1.0/tasks`);
for (const [k, v] of [
["opt_pretty", opt_pretty],
["opt_fields", opt_fields],
["limit", limit],
["offset", offset],
["assignee", assignee],
["project", project],
["section", section],
["workspace", workspace],
["completed_since", completed_since],
["modified_since", modified_since],
]) {
if (v !== undefined && v !== "") {
url.searchParams.append(k, v);
}
}
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: "Bearer " + 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 937 days ago