Restore an archived or trashed issue.
1
//native
2
3
/**
4
* Unarchive Issue
5
* Restore an archived or trashed issue.
6
*/
7
export async function main(auth: RT.Linear, issue_id: string) {
8
const response = await fetch("https://api.linear.app/graphql", {
9
method: "POST",
10
headers: {
11
Authorization: auth.apiKey,
12
"Content-Type": "application/json",
13
Accept: "application/json",
14
},
15
body: JSON.stringify({
16
query: `mutation ($id: String!) { issueUnarchive(id: $id) { success entity { id identifier archivedAt trashed } } }`,
17
variables: { id: issue_id },
18
}),
19
})
20
21
if (!response.ok) {
22
throw new Error(`${response.status} ${await response.text()}`)
23
}
24
25
const { data, errors } = await response.json()
26
if (errors) {
27
throw new Error(JSON.stringify(errors))
28
29
30
return data.issueUnarchive
31
32