type Trello = {
key: string;
token: string;
};
/**
* Get a Board
* Request a single board.
*/
export async function main(
auth: Trello,
id: string,
actions: string | undefined,
boardStars: string | undefined,
cards: string | undefined,
card_pluginData: string | undefined,
checklists: string | undefined,
customFields: string | undefined,
fields: string | undefined,
labels: string | undefined,
lists: string | undefined,
members: string | undefined,
memberships: string | undefined,
pluginData: string | undefined,
organization: string | undefined,
organization_pluginData: string | undefined,
myPrefs: string | undefined,
tags: string | undefined
) {
const url = new URL(`https://api.trello.com/1/boards/${id}`);
for (const [k, v] of [
["actions", actions],
["boardStars", boardStars],
["cards", cards],
["card_pluginData", card_pluginData],
["checklists", checklists],
["customFields", customFields],
["fields", fields],
["labels", labels],
["lists", lists],
["members", members],
["memberships", memberships],
["pluginData", pluginData],
["organization", organization],
["organization_pluginData", organization_pluginData],
["myPrefs", myPrefs],
["tags", tags],
["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 Board
* Request a single board.
*/
export async function main(
auth: Trello,
id: string,
actions: string | undefined,
boardStars: string | undefined,
cards: string | undefined,
card_pluginData: string | undefined,
checklists: string | undefined,
customFields: string | undefined,
fields: string | undefined,
labels: string | undefined,
lists: string | undefined,
members: string | undefined,
memberships: string | undefined,
pluginData: string | undefined,
organization: string | undefined,
organization_pluginData: string | undefined,
myPrefs: string | undefined,
tags: string | undefined
) {
const url = new URL(`https://api.trello.com/1/boards/${id}`);
for (const [k, v] of [
["actions", actions],
["boardStars", boardStars],
["cards", cards],
["card_pluginData", card_pluginData],
["checklists", checklists],
["customFields", customFields],
["fields", fields],
["labels", labels],
["lists", lists],
["members", members],
["memberships", memberships],
["pluginData", pluginData],
["organization", organization],
["organization_pluginData", organization_pluginData],
["myPrefs", myPrefs],
["tags", tags],
["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