type Trello = {
key: string;
token: string;
};
/**
* Get the Card a Notification is on
* Get the card a notification is associated with
*/
export async function main(
auth: Trello,
id: string,
fields:
| "id"
| "address"
| "badges"
| "checkItemStates"
| "closed"
| "coordinates"
| "creationMethod"
| "dueComplete"
| "dateLastActivity"
| "desc"
| "descData"
| "due"
| "dueReminder"
| "email"
| "idBoard"
| "idChecklists"
| "idLabels"
| "idList"
| "idMembers"
| "idMembersVoted"
| "idShort"
| "idAttachmentCover"
| "labels"
| "limits"
| "locationName"
| "manualCoverAttachment"
| "name"
| "pos"
| "shortLink"
| "shortUrl"
| "subscribed"
| "url"
| "cover"
| "isTemplate"
| undefined
) {
const url = new URL(`https://api.trello.com/1/notifications/${id}/card`);
for (const [k, v] of [
["fields", fields],
["key", auth.key],
["token", auth.token],
]) {
if (v !== undefined && v !== "") {
url.searchParams.append(k, v);
}
}
const response = await fetch(url, {
method: "GET",
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;
};
/**
* Get the Card a Notification is on
* Get the card a notification is associated with
*/
export async function main(
auth: Trello,
id: string,
fields:
| "id"
| "address"
| "badges"
| "checkItemStates"
| "closed"
| "coordinates"
| "creationMethod"
| "dueComplete"
| "dateLastActivity"
| "desc"
| "descData"
| "due"
| "dueReminder"
| "email"
| "idBoard"
| "idChecklists"
| "idLabels"
| "idList"
| "idMembers"
| "idMembersVoted"
| "idShort"
| "idAttachmentCover"
| "labels"
| "limits"
| "locationName"
| "manualCoverAttachment"
| "name"
| "pos"
| "shortLink"
| "shortUrl"
| "subscribed"
| "url"
| "cover"
| "isTemplate"
| undefined
) {
const url = new URL(`https://api.trello.com/1/notifications/${id}/card`);
for (const [k, v] of [
["fields", fields],
["key", auth.key],
["token", auth.token],
]) {
if (v !== undefined && v !== "") {
url.searchParams.append(k, v);
}
}
const response = await fetch(url, {
method: "GET",
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