jiraclient

package
v0.15.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2026 License: MIT Imports: 21 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

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

func NewClient(httpClient *http.Client, baseURL string, email string, token string) *Client

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

func (c *Client) CreateIssue(ctx context.Context, body map[string]any) (*IssueResponse, error)

CreateIssue creates a new issue in Jira

func (c *Client) CreateIssueLink(ctx context.Context, linkType, inwardIssueKey, outwardIssueKey string) error

CreateIssueLink creates a link between two issues

func (c *Client) DeleteIssueLink(ctx context.Context, linkID string) error

DeleteIssueLink removes an issue link by ID.

func (*Client) Do

func (c *Client) Do(request *http.Request, responseTarget any) error

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

func (c *Client) GetIssueLinkTypes(ctx context.Context) ([]string, error)

GetIssueLinkTypes fetches all valid link types on the Jira instance

func (c *Client) GetIssueLinks(ctx context.Context, issueKey string) ([]IssueLink, error)

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 (c *Client) ListIssueLinks(ctx context.Context, issueKey string) ([]IssueLink, error)

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

func (c *Client) UpdateIssue(ctx context.Context, issueKey string, edit IssueUpdate) error

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.

func (i *Issue) Links() ([]IssueLink, error)

Links decodes the issue's issuelinks field, which must have been requested.

type IssueLink struct {
	ID           string
	Type         string
	InwardIssue  string
	OutwardIssue string
}

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

type IssueResponse struct {
	ID  string `json:"id"`
	Key string `json:"key"`
}

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL