type Trello = {
key: string;
token: string;
};
/**
* Mark all Notifications as read
* Mark all notifications as read
*/
export async function main(
auth: Trello,
read: string | undefined,
ids: string | undefined
) {
const url = new URL(`https://api.trello.com/1/notifications/all/read`);
for (const [k, v] of [
["read", read],
["ids", ids],
["key", auth.key],
["token", auth.token],
]) {
if (v !== undefined && v !== "") {
url.searchParams.append(k, v);
}
}
const response = await fetch(url, {
method: "POST",
headers: {
Authorization: undefined,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 398 days ago
type Trello = {
key: string;
token: string;
};
/**
* Mark all Notifications as read
* Mark all notifications as read
*/
export async function main(
auth: Trello,
read: string | undefined,
ids: string | undefined
) {
const url = new URL(`https://api.trello.com/1/notifications/all/read`);
for (const [k, v] of [
["read", read],
["ids", ids],
["key", auth.key],
["token", auth.token],
]) {
if (v !== undefined && v !== "") {
url.searchParams.append(k, v);
}
}
const response = await fetch(url, {
method: "POST",
headers: {
Authorization: undefined,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 953 days ago