//native
/**
* Create a new dashboard for an organization
* Create a new dashboard for the given Organization
*/
export async function main(auth: RT.Sentry, body: Body) {
const url = new URL(
`https://${auth.region}.sentry.io/api/0/organizations/${auth.organizationSlug}/dashboards/`
)
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()
}
/* eslint-disable */
/**
* This file was automatically generated by json-schema-to-typescript.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run json-schema-to-typescript to regenerate this file.
*/
/**
* Allows parameters to be defined in snake case, but passed as camel case.
*
* Errors are output in camel case.
*/
export interface Body {
/**
* The user defined title for this dashboard.
*/
title: string
/**
* A dashboard's unique id.
*/
id?: string
/**
* A json list of widgets saved in this dashboard.
*/
widgets?: {
id?: string
title?: string
description?: string
thresholds?: {
[k: string]: unknown
}
/**
* * `line`
* * `area`
* * `stacked_area`
* * `bar`
* * `table`
* * `big_number`
* * `top_n`
*/
display_type?: 'line' | 'area' | 'stacked_area' | 'bar' | 'table' | 'big_number' | 'top_n'
interval?: string
queries?: {
id?: string
fields?: string[]
aggregates?: string[]
columns?: string[]
field_aliases?: string[]
name?: string
conditions?: string
orderby?: string
is_hidden?: boolean
/**
* Allows parameters to be defined in snake case, but passed as camel case.
*
* Errors are output in camel case.
*/
on_demand_extraction?: {
extraction_state?: string
enabled?: boolean
[k: string]: unknown
}
on_demand_extraction_disabled?: boolean
selected_aggregate?: number
[k: string]: unknown
}[]
/**
* * `discover`
* * `issue`
* * `metrics`
* * `error-events`
* * `transaction-like`
* * `spans`
* * `logs`
*/
widget_type?:
| 'discover'
| 'issue'
| 'metrics'
| 'error-events'
| 'transaction-like'
| 'spans'
| 'logs'
limit?: number
layout?: {
[k: string]: unknown
}
[k: string]: unknown
}[]
/**
* The saved projects filter for this dashboard.
*/
projects?: number[]
/**
* The saved environment filter for this dashboard.
*/
environment?: string[]
/**
* The saved time range period for this dashboard.
*/
period?: string
/**
* The saved start time for this dashboard.
*/
start?: string
/**
* The saved end time for this dashboard.
*/
end?: string
/**
* The saved filters for this dashboard.
*/
filters?: {
[k: string]: unknown
}
/**
* Setting that lets you display saved time range for this dashboard in UTC.
*/
utc?: boolean
/**
* Permissions that restrict users from editing dashboards
*/
permissions?: {
/**
* Whether the dashboard is editable by everyone.
*/
is_editable_by_everyone: boolean
/**
* List of team IDs that have edit access to a dashboard.
*/
teams_with_edit_access?: number[]
[k: string]: unknown
}
/**
* Favorite the dashboard automatically for the request user
*/
is_favorited?: boolean
[k: string]: unknown
}
Submitted by hugo697 235 days ago