1 | |
2 | |
3 | * Bulk mutate a list of issues |
4 | * Bulk mutate various attributes on issues. |
5 | */ |
6 | export async function main( |
7 | auth: RT.Sentry, |
8 | project_id_or_slug: string, |
9 | body: Body, |
10 | id?: string | undefined, |
11 | status?: string | undefined |
12 | ) { |
13 | const url = new URL( |
14 | `https://${auth.region}.sentry.io/api/0/projects/${auth.organizationSlug}/${project_id_or_slug}/issues/` |
15 | ) |
16 | for (const [k, v] of [ |
17 | ['id', id], |
18 | ['status', status] |
19 | ]) { |
20 | if (v !== undefined && v !== '') { |
21 | url.searchParams.append(k, v) |
22 | } |
23 | } |
24 | const response = await fetch(url, { |
25 | method: 'PUT', |
26 | headers: { |
27 | 'Content-Type': 'application/json', |
28 | Authorization: 'Bearer ' + auth.token |
29 | }, |
30 | body: JSON.stringify(body) |
31 | }) |
32 | if (!response.ok) { |
33 | const text = await response.text() |
34 | throw new Error(`${response.status} ${text}`) |
35 | } |
36 | return await response.json() |
37 | } |
38 |
|
39 | |
40 | |
41 | * This file was automatically generated by json-schema-to-typescript. |
42 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, |
43 | * and run json-schema-to-typescript to regenerate this file. |
44 | */ |
45 |
|
46 | export interface Body { |
47 | |
48 | * The new status for the issues. Valid values are `"resolved"`, `"resolvedInNextRelease"`, `"unresolved"`, and `"ignored"`. |
49 | */ |
50 | status?: string |
51 | |
52 | * Additional details about the resolution. Valid values are `"inRelease"`, `"inNextRelease"`, `"inCommit"`, `"ignoreDuration"`, `"ignoreCount"`, `"ignoreWindow"`, `"ignoreUserCount"`, and `"ignoreUserWindow"`. |
53 | */ |
54 | statusDetails?: { |
55 | inRelease?: string |
56 | inNextRelease?: boolean |
57 | inCommit?: string |
58 | ignoreDuration?: number |
59 | ignoreCount?: number |
60 | ignoreWindow?: number |
61 | ignoreUserCount?: number |
62 | ignoreUserWindow?: number |
63 | [k: string]: unknown |
64 | } |
65 | |
66 | * The number of minutes to ignore this issue. |
67 | */ |
68 | ignoreDuration?: number |
69 | |
70 | * Sets the issue to public or private. |
71 | */ |
72 | isPublic?: boolean |
73 | |
74 | * Allows to merge or unmerge different issues. |
75 | */ |
76 | merge?: boolean |
77 | |
78 | * The actor ID (or username) of the user or team that should be assigned to this issue. |
79 | */ |
80 | assignedTo?: string |
81 | |
82 | * 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. |
83 | */ |
84 | hasSeen?: boolean |
85 | |
86 | * In case this API call is invoked with a user context this allows changing of the bookmark flag. |
87 | */ |
88 | isBookmarked?: boolean |
89 | [k: string]: unknown |
90 | } |
91 |
|