Gets the sheet's 'Publish' settings.
1
//native
2
type Smartsheet = {
3
token: string;
4
baseUrl: string;
5
};
6
/**
7
* Get Sheet Publish Status
8
* Gets the sheet's 'Publish' settings.
9
10
*/
11
export async function main(
12
auth: Smartsheet,
13
sheetId: string,
14
) {
15
const url = new URL(`${auth.baseUrl}/sheets/${sheetId}/publish`);
16
17
const response = await fetch(url, {
18
method: "GET",
19
headers: {
20
Authorization: "Bearer " + auth.token,
21
},
22
body: undefined,
23
});
24
if (!response.ok) {
25
const text = await response.text();
26
throw new Error(`${response.status} ${text}`);
27
}
28
return await response.json();
29
30