Files
orca/mobile/src/tasks/linear-mobile-issue-read.ts
T
2026-06-03 11:06:43 -07:00

40 lines
1.0 KiB
TypeScript

export type LinearMobileIssue = {
id: string
workspaceId?: string
workspaceName?: string
identifier: string
title: string
description?: string
url: string
state: { name: string; type: string; color: string }
team: { id: string; name: string; key: string }
project?: { id: string; name: string; url?: string; color?: string }
subIssues?: Array<{ id: string; identifier: string; title: string; url: string }>
labels: string[]
labelIds?: string[]
assignee?: { id?: string; displayName: string }
estimate?: number | null
priority: number
updatedAt: string
}
type LinearIssueReadEnvelope = {
items?: unknown
}
export function extractLinearIssueReadItems(result: unknown): LinearMobileIssue[] {
if (Array.isArray(result)) {
return result as LinearMobileIssue[]
}
if (
result &&
typeof result === 'object' &&
Array.isArray((result as LinearIssueReadEnvelope).items)
) {
return (result as { items: LinearMobileIssue[] }).items
}
throw new Error('Unexpected Linear tasks response')
}