//native
type Miro = {
token: string;
};
/**
* Retrieve content change logs of board items
* Retrieves content changes for board items within your organization.
*/
export async function main(
auth: Miro,
org_id: string,
board_ids: string | undefined,
emails: string | undefined,
from: string | undefined,
to: string | undefined,
cursor: string | undefined,
limit: string | undefined,
sorting: "asc" | "desc" | undefined,
) {
const url = new URL(
`https://api.miro.com//v2/orgs/${org_id}/content-logs/items`,
);
for (const [k, v] of [
["board_ids", board_ids],
["emails", emails],
["from", from],
["to", to],
["cursor", cursor],
["limit", limit],
["sorting", sorting],
]) {
if (v !== undefined && v !== "" && k !== undefined) {
url.searchParams.append(k, v);
}
}
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: "Bearer " + auth.token,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 235 days ago