//native
type Smartsheet = {
token: string;
baseUrl: string;
};
/**
* Set Sheet Publish Status
* Sets the publish status of the sheet and returns the new status, including the URLs of any enabled publishings.
*/
export async function main(
auth: Smartsheet,
sheetId: string,
body: {
icalEnabled?: false | true;
readOnlyFullAccessibleBy?: "ALL" | "ORG" | "SHARED";
readOnlyFullDefaultView?: "CALENDAR" | "CARD" | "GRID";
readOnlyFullEnabled?: false | true;
readOnlyFullShowToolbar?: false | true;
readOnlyLiteEnabled?: false | true;
readWriteAccessibleBy?: "ALL" | "ORG" | "SHARED";
readWriteDefaultView?: "CALENDAR" | "CARD" | "GRID";
readWriteEnabled?: false | true;
readWriteShowToolbar?: false | true;
},
) {
const url = new URL(`${auth.baseUrl}/sheets/${sheetId}/publish`);
const response = await fetch(url, {
method: "PUT",
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