type Trello = {
key: string;
token: string;
};
/**
* Get auditlog data for an Enterprise
* Returns an array of Actions related to the Enterprise object. Used for populating data sent to Google Sheets from an Enterprise's audit log page: https://trello.com/e/{enterprise_name}/admin/auditlog. An Enterprise admin token is required for this route.
NOTE: For enterprises that have opted in to user management via AdminHub, the auditlog will will contain actions taken in AdminHub, but may not contain the source for those actions.
*/
export async function main(auth: Trello, id: string) {
const url = new URL(`https://api.trello.com/1/enterprises/${id}/auditlog`);
for (const [k, v] of [
["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 auditlog data for an Enterprise
* Returns an array of Actions related to the Enterprise object. Used for populating data sent to Google Sheets from an Enterprise's audit log page: https://trello.com/e/{enterprise_name}/admin/auditlog. An Enterprise admin token is required for this route.
NOTE: For enterprises that have opted in to user management via AdminHub, the auditlog will will contain actions taken in AdminHub, but may not contain the source for those actions.
*/
export async function main(auth: Trello, id: string) {
const url = new URL(`https://api.trello.com/1/enterprises/${id}/auditlog`);
for (const [k, v] of [
["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