//native
/**
* Bulk mutate a list of issues
* Bulk mutate various attributes on issues.
*/
export async function main(
auth: RT.Sentry,
project_id_or_slug: string,
body: Body,
id?: string | undefined,
status?: string | undefined
) {
const url = new URL(
`https://${auth.region}.sentry.io/api/0/projects/${auth.organizationSlug}/${project_id_or_slug}/issues/`
)
for (const [k, v] of [
['id', id],
['status', status]
]) {
if (v !== undefined && v !== '') {
url.searchParams.append(k, v)
}
}
const response = await fetch(url, {
method: 'PUT',
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.
*/
export interface Body {
/**
* The new status for the issues. Valid values are `"resolved"`, `"resolvedInNextRelease"`, `"unresolved"`, and `"ignored"`.
*/
status?: string
/**
* Additional details about the resolution. Valid values are `"inRelease"`, `"inNextRelease"`, `"inCommit"`, `"ignoreDuration"`, `"ignoreCount"`, `"ignoreWindow"`, `"ignoreUserCount"`, and `"ignoreUserWindow"`.
*/
statusDetails?: {
inRelease?: string
inNextRelease?: boolean
inCommit?: string
ignoreDuration?: number
ignoreCount?: number
ignoreWindow?: number
ignoreUserCount?: number
ignoreUserWindow?: number
[k: string]: unknown
}
/**
* The number of minutes to ignore this issue.
*/
ignoreDuration?: number
/**
* Sets the issue to public or private.
*/
isPublic?: boolean
/**
* Allows to merge or unmerge different issues.
*/
merge?: boolean
/**
* The actor ID (or username) of the user or team that should be assigned to this issue.
*/
assignedTo?: string
/**
* In case this API call is invoked with a user context this allows changing of the flag that indicates if the user has seen the event.
*/
hasSeen?: boolean
/**
* In case this API call is invoked with a user context this allows changing of the bookmark flag.
*/
isBookmarked?: boolean
[k: string]: unknown
}
Submitted by hugo697 235 days ago