1 | |
2 | |
3 | * Edit an organizations custom dashboard |
4 | * Edit an organization's custom dashboard as well as any bulk |
5 | edits on widgets that may have been made. (For example, widgets |
6 | that have been rearranged, updated queries and fields, specific |
7 | display types, and so on.) |
8 | */ |
9 | export async function main(auth: RT.Sentry, dashboard_id: string, body: Body) { |
10 | const url = new URL( |
11 | `https://${auth.region}.sentry.io/api/0/organizations/${auth.organizationSlug}/dashboards/${dashboard_id}/` |
12 | ) |
13 |
|
14 | const response = await fetch(url, { |
15 | method: 'PUT', |
16 | headers: { |
17 | 'Content-Type': 'application/json', |
18 | Authorization: 'Bearer ' + auth.token |
19 | }, |
20 | body: JSON.stringify(body) |
21 | }) |
22 | if (!response.ok) { |
23 | const text = await response.text() |
24 | throw new Error(`${response.status} ${text}`) |
25 | } |
26 | return await response.json() |
27 | } |
28 |
|
29 | |
30 | |
31 | * This file was automatically generated by json-schema-to-typescript. |
32 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, |
33 | * and run json-schema-to-typescript to regenerate this file. |
34 | */ |
35 |
|
36 | |
37 | * Allows parameters to be defined in snake case, but passed as camel case. |
38 | * |
39 | * Errors are output in camel case. |
40 | */ |
41 | export interface Body { |
42 | |
43 | * A dashboard's unique id. |
44 | */ |
45 | id?: string |
46 | |
47 | * The user-defined dashboard title. |
48 | */ |
49 | title?: string |
50 | |
51 | * A json list of widgets saved in this dashboard. |
52 | */ |
53 | widgets?: { |
54 | id?: string |
55 | title?: string |
56 | description?: string |
57 | thresholds?: { |
58 | [k: string]: unknown |
59 | } |
60 | |
61 | * * `line` |
62 | * * `area` |
63 | * * `stacked_area` |
64 | * * `bar` |
65 | * * `table` |
66 | * * `big_number` |
67 | * * `top_n` |
68 | */ |
69 | display_type?: 'line' | 'area' | 'stacked_area' | 'bar' | 'table' | 'big_number' | 'top_n' |
70 | interval?: string |
71 | queries?: { |
72 | id?: string |
73 | fields?: string[] |
74 | aggregates?: string[] |
75 | columns?: string[] |
76 | field_aliases?: string[] |
77 | name?: string |
78 | conditions?: string |
79 | orderby?: string |
80 | is_hidden?: boolean |
81 | |
82 | * Allows parameters to be defined in snake case, but passed as camel case. |
83 | * |
84 | * Errors are output in camel case. |
85 | */ |
86 | on_demand_extraction?: { |
87 | extraction_state?: string |
88 | enabled?: boolean |
89 | [k: string]: unknown |
90 | } |
91 | on_demand_extraction_disabled?: boolean |
92 | selected_aggregate?: number |
93 | [k: string]: unknown |
94 | }[] |
95 | |
96 | * * `discover` |
97 | * * `issue` |
98 | * * `metrics` |
99 | * * `error-events` |
100 | * * `transaction-like` |
101 | * * `spans` |
102 | * * `logs` |
103 | */ |
104 | widget_type?: |
105 | | 'discover' |
106 | | 'issue' |
107 | | 'metrics' |
108 | | 'error-events' |
109 | | 'transaction-like' |
110 | | 'spans' |
111 | | 'logs' |
112 | limit?: number |
113 | layout?: { |
114 | [k: string]: unknown |
115 | } |
116 | [k: string]: unknown |
117 | }[] |
118 | |
119 | * The saved projects filter for this dashboard. |
120 | */ |
121 | projects?: number[] |
122 | |
123 | * The saved environment filter for this dashboard. |
124 | */ |
125 | environment?: string[] |
126 | |
127 | * The saved time range period for this dashboard. |
128 | */ |
129 | period?: string |
130 | |
131 | * The saved start time for this dashboard. |
132 | */ |
133 | start?: string |
134 | |
135 | * The saved end time for this dashboard. |
136 | */ |
137 | end?: string |
138 | |
139 | * The saved filters for this dashboard. |
140 | */ |
141 | filters?: { |
142 | [k: string]: unknown |
143 | } |
144 | |
145 | * Setting that lets you display saved time range for this dashboard in UTC. |
146 | */ |
147 | utc?: boolean |
148 | |
149 | * Permissions that restrict users from editing dashboards |
150 | */ |
151 | permissions?: { |
152 | |
153 | * Whether the dashboard is editable by everyone. |
154 | */ |
155 | is_editable_by_everyone: boolean |
156 | |
157 | * List of team IDs that have edit access to a dashboard. |
158 | */ |
159 | teams_with_edit_access?: number[] |
160 | [k: string]: unknown |
161 | } |
162 | [k: string]: unknown |
163 | } |
164 |
|