//native
type Smartsheet = {
token: string;
baseUrl: string;
};
/**
* List Filtered Events
* Gets the events that are occurring in a Smartsheet organization account for resources to which the current user has access to.
*/
export async function main(
auth: Smartsheet,
body: {
sheetIds?: string[];
workspaceIds?: string[];
since?: string;
to?: string;
streamPosition?: string;
maxCount?: number;
numericDates?: false | true;
managedPlanId?: number;
},
) {
const url = new URL(`${auth.baseUrl}/filteredEvents`);
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + auth.token,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 235 days ago