//native
/**
* Unarchive Issue
* Restore an archived or trashed issue.
*/
export async function main(auth: RT.Linear, issue_id: string) {
const response = await fetch("https://api.linear.app/graphql", {
method: "POST",
headers: {
Authorization: auth.apiKey,
"Content-Type": "application/json",
Accept: "application/json",
},
body: JSON.stringify({
query: `mutation ($id: String!) { issueUnarchive(id: $id) { success entity { id identifier archivedAt trashed } } }`,
variables: { id: issue_id },
}),
})
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`)
}
const { data, errors } = await response.json()
if (errors) {
throw new Error(JSON.stringify(errors))
}
return data.issueUnarchive
}
Submitted by hugo989 1 hour ago