type Trello = {
key: string;
token: string;
};
/**
* Get an Enterprise
* Get an enterprise by its ID.
*/
export async function main(
auth: Trello,
id: string,
fields: string | undefined,
members: string | undefined,
member_fields: string | undefined,
member_filter: string | undefined,
member_sort: string | undefined,
member_sortBy: string | undefined,
member_sortOrder: string | undefined,
member_startIndex: string | undefined,
member_count: string | undefined,
organizations: string | undefined,
organization_fields: string | undefined,
organization_paid_accounts: string | undefined,
organization_memberships: string | undefined
) {
const url = new URL(`https://api.trello.com/1/enterprises/${id}`);
for (const [k, v] of [
["fields", fields],
["members", members],
["member_fields", member_fields],
["member_filter", member_filter],
["member_sort", member_sort],
["member_sortBy", member_sortBy],
["member_sortOrder", member_sortOrder],
["member_startIndex", member_startIndex],
["member_count", member_count],
["organizations", organizations],
["organization_fields", organization_fields],
["organization_paid_accounts", organization_paid_accounts],
["organization_memberships", organization_memberships],
["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 an Enterprise
* Get an enterprise by its ID.
*/
export async function main(
auth: Trello,
id: string,
fields: string | undefined,
members: string | undefined,
member_fields: string | undefined,
member_filter: string | undefined,
member_sort: string | undefined,
member_sortBy: string | undefined,
member_sortOrder: string | undefined,
member_startIndex: string | undefined,
member_count: string | undefined,
organizations: string | undefined,
organization_fields: string | undefined,
organization_paid_accounts: string | undefined,
organization_memberships: string | undefined
) {
const url = new URL(`https://api.trello.com/1/enterprises/${id}`);
for (const [k, v] of [
["fields", fields],
["members", members],
["member_fields", member_fields],
["member_filter", member_filter],
["member_sort", member_sort],
["member_sortBy", member_sortBy],
["member_sortOrder", member_sortOrder],
["member_startIndex", member_startIndex],
["member_count", member_count],
["organizations", organizations],
["organization_fields", organization_fields],
["organization_paid_accounts", organization_paid_accounts],
["organization_memberships", organization_memberships],
["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