jira

package
v0.1.19 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package jira is a minimal Jira Cloud client scoped to what whodar ingests: issues and the people on them. Credentials are held only in memory, never serialized, and never logged.

Index

Constants

This section is empty.

Variables

View Source
var ErrRateLimited = errors.New("jira: rate limited")

ErrRateLimited indicates the API rate limit was exhausted.

View Source
var ErrStatus = errors.New("jira: unexpected status")

ErrStatus indicates an unexpected HTTP status.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client calls the Jira Cloud REST API.

func New

func New(baseURL, email, token string, opts ...Option) *Client

New returns a Client for the site, authenticating with an email and API token. It panics if any argument is empty.

func (*Client) Search

func (c *Client) Search(ctx context.Context, jql string, max int) ([]Issue, error)

Search returns up to max issues matching jql, paginating in pages of 100. A non-positive max returns all matches.

type Component

type Component struct {
	// Name is the component name.
	Name string `json:"name"`
}

Component is an issue component.

type Doer

type Doer interface {
	// Do performs the request and returns the response.
	Do(req *http.Request) (*http.Response, error)
}

Doer performs an HTTP request. *http.Client satisfies it; tests inject a stub.

type Issue

type Issue struct {
	// Key is the issue key, for example PROJ-12.
	Key string `json:"key"`
	// Fields holds the issue fields.
	Fields struct {
		// Summary is the issue title.
		Summary string `json:"summary"`
		// Assignee is the assigned user, if any.
		Assignee *User `json:"assignee"`
		// Reporter is the reporting user, if any.
		Reporter *User `json:"reporter"`
		// Components are the issue components.
		Components []Component `json:"components"`
		// Labels are the issue labels.
		Labels []string `json:"labels"`
		// Project is the issue's project.
		Project struct {
			// Key is the project key.
			Key string `json:"key"`
			// Name is the project name.
			Name string `json:"name"`
		} `json:"project"`
		// IssueType is the issue type.
		IssueType struct {
			// Name is the issue type name.
			Name string `json:"name"`
		} `json:"issuetype"`
		// Updated is the last update time in Jira's ISO 8601 format.
		Updated string `json:"updated"`
	} `json:"fields"`
}

Issue is the subset of an issue whodar reads.

type Option

type Option func(*Client)

Option configures a Client.

func WithHTTPClient

func WithHTTPClient(d Doer) Option

WithHTTPClient sets the HTTP doer.

type User

type User struct {
	// AccountID is the stable account identifier.
	AccountID string `json:"accountId"`
	// DisplayName is the user's display name.
	DisplayName string `json:"displayName"`
	// EmailAddress is the user's email, present when visible to the token.
	EmailAddress string `json:"emailAddress"`
}

User is the subset of a Jira user whodar reads.

Jump to

Keyboard shortcuts

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