0

List Proof Discussions

by
Published Oct 17, 2025

Gets a list of all discussions that are in the proof.

Script smartsheet Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Smartsheet = {
3
  token: string;
4
  baseUrl: string;
5
};
6
/**
7
 * List Proof Discussions
8
 * Gets a list of all discussions that are in the proof.
9

10
 */
11
export async function main(
12
  auth: Smartsheet,
13
  sheetId: string,
14
  proofId: string,
15
  include: "attachments" | "comments" | undefined,
16
  page: string | undefined,
17
  pageSize: string | undefined,
18
  includeAll: string | undefined,
19
) {
20
  const url = new URL(
21
    `${auth.baseUrl}/sheets/${sheetId}/proofs/${proofId}/discussions`,
22
  );
23
  for (const [k, v] of [
24
    ["include", include],
25
    ["page", page],
26
    ["pageSize", pageSize],
27
    ["includeAll", includeAll],
28
  ]) {
29
    if (v !== undefined && v !== "" && k !== undefined) {
30
      url.searchParams.append(k, v);
31
    }
32
  }
33
  const response = await fetch(url, {
34
    method: "GET",
35
    headers: {
36
      Authorization: "Bearer " + auth.token,
37
    },
38
    body: undefined,
39
  });
40
  if (!response.ok) {
41
    const text = await response.text();
42
    throw new Error(`${response.status} ${text}`);
43
  }
44
  return await response.json();
45
}
46