Documentation
¶
Index ¶
- func ADFDescription(description string, acceptanceCriteria []string, documentURL string) map[string]any
- type Client
- func (c *Client) CreateIssue(ctx context.Context, body map[string]any) (*IssueResponse, error)
- func (c *Client) CreateIssueLink(ctx context.Context, linkType, inwardIssueKey, outwardIssueKey string) error
- func (c *Client) DeleteIssueLink(ctx context.Context, linkID string) error
- func (c *Client) Do(request *http.Request, responseTarget any) error
- func (c *Client) GetIssue(ctx context.Context, issueKey string, fields []string, properties []string) (*Issue, error)
- func (c *Client) GetIssueLinkTypes(ctx context.Context) ([]string, error)
- func (c *Client) GetIssueLinks(ctx context.Context, issueKey string) ([]IssueLink, error)
- func (c *Client) GetIssueProperty(ctx context.Context, issueKey, propertyKey string) (string, error)
- func (c *Client) ListIssueLinks(ctx context.Context, issueKey string) ([]IssueLink, error)
- func (c *Client) NewRequest(ctx context.Context, method, path string, body any) (*http.Request, error)
- func (c *Client) SearchIssues(ctx context.Context, search IssueSearch) (*IssueSearchResult, error)
- func (c *Client) SearchJQL(ctx context.Context, jql string, maxResults int, nextPageToken string) (*SearchResult, error)
- func (c *Client) SetIssueProperty(ctx context.Context, issueKey, propertyKey string, value any) error
- func (c *Client) UpdateIssue(ctx context.Context, issueKey string, edit IssueUpdate) error
- type Issue
- type IssueLink
- type IssueResponse
- type IssueSearch
- type IssueSearchResult
- type IssueUpdate
- type SearchResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ADFDescription ¶
func ADFDescription(description string, acceptanceCriteria []string, documentURL string) map[string]any
adfDescription renders a work item as an Atlassian Document Format document. ADF has no Markdown fallback: a heading is a heading node and a bullet is a list node, so the same prose that renders on GitHub has to be translated rather than passed through.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client handles communication with Jira Rest API
func NewClient ¶
NewClient creates new Jira API client Accepts custom *http.Client, uses DefaultClient if nil [i.e base URL https://my-domain.atlassian.net and auth creds ]
func (*Client) CreateIssue ¶
CreateIssue creates a new issue in Jira
func (*Client) CreateIssueLink ¶
func (c *Client) CreateIssueLink(ctx context.Context, linkType, inwardIssueKey, outwardIssueKey string) error
CreateIssueLink creates a link between two issues
func (*Client) DeleteIssueLink ¶ added in v0.9.1
DeleteIssueLink removes an issue link by ID.
func (*Client) Do ¶
Do executes an API request and unmarshals the response body into responseTarget. A 429 or 5xx is sent again up to 5 times. Retry-After, a number of seconds, is the wait when Jira sends it. Otherwise the wait starts at one second and doubles up to 16 seconds. The wait uses the request context, so a canceled caller stops between attempts.
func (*Client) GetIssue ¶ added in v0.9.1
func (c *Client) GetIssue(ctx context.Context, issueKey string, fields []string, properties []string) (*Issue, error)
GetIssue fetches an issue with the named fields and issue properties, or with every navigable field when no fields are named.
func (*Client) GetIssueLinkTypes ¶
GetIssueLinkTypes fetches all valid link types on the Jira instance
func (*Client) GetIssueLinks ¶
GetIssueLinks returns the links on an issue whose other end is inward, such as its blockers.
func (*Client) GetIssueProperty ¶
func (c *Client) GetIssueProperty(ctx context.Context, issueKey, propertyKey string) (string, error)
GetIssueProperty retrieves the id stored in an issue property's value.
func (*Client) ListIssueLinks ¶ added in v0.9.1
ListIssueLinks returns every link on an issue, inward and outward, with the ID DeleteIssueLink needs.
func (*Client) NewRequest ¶
func (c *Client) NewRequest(ctx context.Context, method, path string, body any) (*http.Request, error)
NewRequest creates an API request A relative path can be provided, e.g. "/rest/api/3/issue"
func (*Client) SearchIssues ¶ added in v0.9.1
func (c *Client) SearchIssues(ctx context.Context, search IssueSearch) (*IssueSearchResult, error)
SearchIssues runs a JQL search and returns each issue with the requested fields and issue properties, so a caller reads a page of issues in one request.
func (*Client) SearchJQL ¶
func (c *Client) SearchJQL(ctx context.Context, jql string, maxResults int, nextPageToken string) (*SearchResult, error)
SearchJQL executes a JQL query and returns SearchResult
func (*Client) SetIssueProperty ¶ added in v0.9.1
func (c *Client) SetIssueProperty(ctx context.Context, issueKey, propertyKey string, value any) error
SetIssueProperty stores value under propertyKey on an issue, replacing any existing value.
func (*Client) UpdateIssue ¶ added in v0.9.1
UpdateIssue edits an issue. An empty update sends nothing.
type Issue ¶ added in v0.9.1
type Issue struct {
ID string `json:"id"`
Key string `json:"key"`
Fields map[string]json.RawMessage `json:"fields"`
Properties map[string]json.RawMessage `json:"properties"`
}
Issue is a fetched Jira issue. Fields and Properties hold each returned value undecoded, so callers decode only what they asked for.
type IssueLink ¶
IssueLink is an issue link seen from the issue it was listed on. Exactly one of InwardIssue and OutwardIssue names the other issue; for a "Blocks" link listed on the blocked issue, InwardIssue is the blocker.
type IssueResponse ¶
IssueResponse is a basic representation of a created / fetched Jira issue
type IssueSearch ¶ added in v0.9.1
type IssueSearch struct {
JQL string
Fields []string
Properties []string
MaxResults int
NextPageToken string
}
IssueSearch selects the issues SearchIssues returns and what each carries.
type IssueSearchResult ¶ added in v0.9.1
type IssueSearchResult struct {
Issues []Issue `json:"issues"`
NextPageToken string `json:"nextPageToken"`
IsLast bool `json:"isLast"`
}
IssueSearchResult is one page of SearchIssues results.
type IssueUpdate ¶ added in v0.9.1
type IssueUpdate struct {
// Fields replaces each named field's value.
Fields map[string]any
// Update applies Jira's per-field operations, such as {"labels": [{"add": "x"}]}.
Update map[string]any
// Properties sets each named issue property in the same request as the edit.
Properties map[string]any
}
IssueUpdate describes an edit to one issue.
type SearchResult ¶
type SearchResult struct {
Issues []IssueResponse `json:"issues"`
NextPageToken string
IsLast bool
}
SearchResult is a response from JQL search