//native
type Clickup = {
token: string;
};
/**
* Get List Comments
* View the comments added to a List. \
\
If you do not include the `start` and `start_id` parameters, this endpoint will return the most recent 25 comments.\
\
Use the `start` and `start id` parameters of the oldest comment to retrieve the next 25 comments.
*/
export async function main(
auth: Clickup,
list_id: string,
start: string | undefined,
start_id: string | undefined,
) {
const url = new URL(`https://api.clickup.com/api/v2/list/${list_id}/comment`);
for (const [k, v] of [
["start", start],
["start_id", start_id],
]) {
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