//native
type Smartsheet = {
token: string;
baseUrl: string;
};
/**
* Create Proof Request
* Creates a proof request.
*/
export async function main(
auth: Smartsheet,
sheetId: string,
proofId: string,
body: {
ccMe?: false | true;
message?: string;
sendTo?: { email?: string } | { groupId?: number }[];
subject?: string;
} & { isDownloadable?: false | true },
) {
const url = new URL(
`${auth.baseUrl}/sheets/${sheetId}/proofs/${proofId}/requests`,
);
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