type Trello = {
key: string;
token: string;
};
/**
* Get a Card
* Get a card by its ID
*/
export async function main(
auth: Trello,
id: string,
fields: string | undefined,
actions: string | undefined,
attachments: string | undefined,
attachment_fields: string | undefined,
members: string | undefined,
member_fields: string | undefined,
membersVoted: string | undefined,
memberVoted_fields: string | undefined,
checkItemStates: string | undefined,
checklists: string | undefined,
checklist_fields: string | undefined,
board: string | undefined,
board_fields: string | undefined,
list: string | undefined,
pluginData: string | undefined,
stickers: string | undefined,
sticker_fields: string | undefined,
customFieldItems: string | undefined
) {
const url = new URL(`https://api.trello.com/1/cards/${id}`);
for (const [k, v] of [
["fields", fields],
["actions", actions],
["attachments", attachments],
["attachment_fields", attachment_fields],
["members", members],
["member_fields", member_fields],
["membersVoted", membersVoted],
["memberVoted_fields", memberVoted_fields],
["checkItemStates", checkItemStates],
["checklists", checklists],
["checklist_fields", checklist_fields],
["board", board],
["board_fields", board_fields],
["list", list],
["pluginData", pluginData],
["stickers", stickers],
["sticker_fields", sticker_fields],
["customFieldItems", customFieldItems],
["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 399 days ago
type Trello = {
key: string;
token: string;
};
/**
* Get a Card
* Get a card by its ID
*/
export async function main(
auth: Trello,
id: string,
fields: string | undefined,
actions: string | undefined,
attachments: string | undefined,
attachment_fields: string | undefined,
members: string | undefined,
member_fields: string | undefined,
membersVoted: string | undefined,
memberVoted_fields: string | undefined,
checkItemStates: string | undefined,
checklists: string | undefined,
checklist_fields: string | undefined,
board: string | undefined,
board_fields: string | undefined,
list: string | undefined,
pluginData: string | undefined,
stickers: string | undefined,
sticker_fields: string | undefined,
customFieldItems: string | undefined
) {
const url = new URL(`https://api.trello.com/1/cards/${id}`);
for (const [k, v] of [
["fields", fields],
["actions", actions],
["attachments", attachments],
["attachment_fields", attachment_fields],
["members", members],
["member_fields", member_fields],
["membersVoted", membersVoted],
["memberVoted_fields", memberVoted_fields],
["checkItemStates", checkItemStates],
["checklists", checklists],
["checklist_fields", checklist_fields],
["board", board],
["board_fields", board_fields],
["list", list],
["pluginData", pluginData],
["stickers", stickers],
["sticker_fields", sticker_fields],
["customFieldItems", customFieldItems],
["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