type Trello = {
key: string;
token: string;
};
/**
* Get ClaimableOrganizations of an Enterprise
* Get the Workspaces that are claimable by the enterprise by ID. Can optionally query for workspaces based on activeness/ inactiveness.
*/
export async function main(
auth: Trello,
id: string,
limit: string | undefined,
cursor: string | undefined,
name: string | undefined,
activeSince: string | undefined,
inactiveSince: string | undefined
) {
const url = new URL(
`https://api.trello.com/1/enterprises/${id}/claimableOrganizations`
);
for (const [k, v] of [
["limit", limit],
["cursor", cursor],
["name", name],
["activeSince", activeSince],
["inactiveSince", inactiveSince],
["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 ClaimableOrganizations of an Enterprise
* Get the Workspaces that are claimable by the enterprise by ID. Can optionally query for workspaces based on activeness/ inactiveness.
*/
export async function main(
auth: Trello,
id: string,
limit: string | undefined,
cursor: string | undefined,
name: string | undefined,
activeSince: string | undefined,
inactiveSince: string | undefined
) {
const url = new URL(
`https://api.trello.com/1/enterprises/${id}/claimableOrganizations`
);
for (const [k, v] of [
["limit", limit],
["cursor", cursor],
["name", name],
["activeSince", activeSince],
["inactiveSince", inactiveSince],
["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