//native
/**
* Get View Issues
* List the issues matched by a saved custom view's filters, most recently updated first. Paginate with after = pageInfo.endCursor.
*/
export async function main(
auth: RT.Linear,
view_id: string,
first: number = 50,
after: string | undefined
) {
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: `query ($id: String!, $first: Int, $after: String) { customView(id: $id) { issues(first: $first, after: $after, orderBy: updatedAt) { nodes { id identifier title url priority dueDate createdAt updatedAt state { id name type } assignee { id name email } team { id key } labels { nodes { id name } } } pageInfo { hasNextPage endCursor } } } }`,
variables: { id: view_id, first, after: after || undefined },
}),
})
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.customView.issues
}
Submitted by hugo989 2 hours ago