# linear

A workspace's issues over Linear's GraphQL API, from the back end, and its
webhooks checked and done once. The whole of it is
[docs/linear.md](../../docs/linear.md).

```text
use "pkg:linear/linear.mote"

let i = linearIssueCreate({team: teamId, title: "Fix the lamp", priority: 2}, "")?
let open = linearAllIssues({state: {type: {nin: ["completed", "canceled"]}}}, 500, "")?
fn linearIssueChanged(action: string, i: LinearIssue): bool      // the program's hook
```

Settings: `LINEAR_KEY` and `LINEAR_WEBHOOK_SECRET` (secrets); `LINEAR_WAIT`,
`LINEAR_API`.

| File | |
|---|---|
| `linear.mote` | The calls, the shapes, errors and the limit, the webhook route and its job. |
| `tests.mote` | Its tests: `use "pkg:linear/tests.mote"`, then `mote test` (tests/svc_work/unit.mote). |

**Covered:** issues listed with Linear's filters by cursor, got by id or
identifier, made and changed; comments made and read; teams, workflow
states, the viewer; any other query through `linearQuery`; errors as
failures with a kind; a spent limit held and waited out; the webhook's
signature and a minute's tolerance, each delivery once by its id, done in a
job, into `linearIssueChanged` and `linearEvent`.

**Left out on purpose:** projects, cycles and the rest beyond `linearQuery`,
attachments, relations, OAuth (each call takes a token). Its requests go
through [graphql](../graphql/): the program's `mote.toml` names both.

**Not yet run against Linear**: only against a stand-in
(`tests/all.sh real_svc_work`).
