# stapel-atlassian

> Jira and Confluence Cloud for Stapel: a guarded client, two integration classes and an `atlassian` connection provider.

## Jira (`StapelJiraIntegration(client)`)
Read: `search(jql)`, `filter_issues(**filters, order_by=, limit=)`, `get_issue(key)`, `get_relatives(issue)`, `issues_by_keys(keys)`, `status_changes(key)`, `projects(query)`, `issue_types(project)`, `required_fields(project, issue_type, filled)`, `assignable_users(project, query)`, `comments(key)`, `attachments(key)`, `download_attachment(id)`, `link_types()`.
Write: `create_issue(project, summary, description=, issue_type=, parent_key=, labels=, priority=, assignee_account_id=, due_date=, fields=)`, `create_epic`, `create_subtask(parent_key, summary)`, `update_issue(key, …, preserve_media=True)`, `append_to_description`, `add_labels`, `remove_labels`, `transition(key, status)`, `add_comment`, `link_issues(source, target, relation)`, `add_remote_link`, `link_confluence_page`, `upload_attachment`.

## Confluence (`StapelConfluenceIntegration(client)`)
`find_pages(text, space_key=, under=, in_body=)`, `search_cql`, `parse_page_ref`, `get_page`, `get_page_markdown`, `create_page(parent, title, markdown=|storage=, space_id=, draft=, toc=)`, `update_page(page, …, expected_version=, discard_unsupported=)`, `append_to_page`, `children`, `spaces`, `attachments`, `upload_attachment`, `inline_comments`, `reply_to_comment`, `resolve_comment`, `delete_comment`.

## Rules
- Text goes in as Markdown. For text that is not Markdown (a transcript line) use `stpl_integrations_markdown.escape`.
- JQL: pass values to `filter_issues`; functions are objects (`currentUser()`), never strings.
- Never retry a write after `AtlassianUnknownOutcome`: look first.
- Before offering "create a task", call `required_fields`.
- Rewriting a page from Markdown is refused when it would lose comments, images or macros. Prefer `append_to_page`.
