api

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package api implements the Jira Cloud REST API v3 client.

Index

Constants

View Source
const SprintBoardTypes = "scrum,simple"

SprintBoardTypes lists the board types that can carry sprints.

A company-managed Scrum board reports "scrum"; a team-managed one reports "simple" while carrying sprints exactly the same way. Filtering on "scrum" alone makes every sprint feature invisible on team-managed projects, which are the default project type in Jira Cloud.

Variables

This section is empty.

Functions

func IsSprintBoardType

func IsSprintBoardType(boardType string) bool

IsSprintBoardType reports whether a board type can carry sprints.

func ResolveUser

func ResolveUser(ctx context.Context, client *Client, input string) (string, error)

ResolveUser resolves a user input string to a Jira account ID.

Resolution rules:

  • "@me" → calls GET /myself and returns the current user's account ID
  • Matches ^[0-9a-f]{24}$ → treated as an account ID and returned as-is (no API call)
  • Anything else → calls GET /user/search?query={input}: exactly 1 result → returns that user's account ID 0 results → CLIError(NOT_FOUND) 2+ results → CLIError(AMBIGUOUS_USER) with match details

Types

type Board

type Board struct {
	ID       int            `json:"id"`
	Name     string         `json:"name"`
	Type     string         `json:"type"` // "scrum", "kanban", or "simple" (team-managed)
	Location *BoardLocation `json:"location,omitempty"`
}

Board represents a Jira Software board.

type BoardLocation

type BoardLocation struct {
	ProjectID   int    `json:"projectId"`
	ProjectKey  string `json:"projectKey"`
	DisplayName string `json:"displayName"`
}

BoardLocation identifies the project a board belongs to.

type Client

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

Client is the Jira Cloud REST API v3 HTTP client.

func NewClient

func NewClient(creds *auth.Credentials, opts ...ClientOption) *Client

NewClient creates a Client authenticated with the given credentials. The transport chain is: retryablehttp → authTransport → http.DefaultTransport.

func (*Client) AddComment

func (c *Client) AddComment(ctx context.Context, issueKey string, body interface{}) (*Comment, error)

AddComment posts a new comment on an issue. Expects HTTP 201. body should be an ADF document node (the result of markdown-to-ADF conversion).

func (*Client) AddIssuesToSprint

func (c *Client) AddIssuesToSprint(ctx context.Context, sprintID int, issueKeys []string) error

AddIssuesToSprint moves issues into a sprint.

POST /rest/agile/1.0/sprint/{sprintId}/issue, which returns 204 with no body. Jira caps this at 50 issues per call.

func (*Client) AssignIssue

func (c *Client) AssignIssue(ctx context.Context, keyOrID string, accountID *string) error

AssignIssue sets the assignee of an issue. Pass a non-nil accountID to assign, or nil to unassign.

func (*Client) BrowseURL

func (c *Client) BrowseURL(issueKey string) string

BrowseURL constructs a browser-navigable URL for a Jira issue key.

func (*Client) CreateIssue

func (c *Client) CreateIssue(ctx context.Context, input *CreateIssueInput) (*CreatedIssue, error)

CreateIssue creates a new issue and returns the created issue reference. Expects HTTP 201 from the API.

func (c *Client) CreateIssueLink(ctx context.Context, input *CreateIssueLinkInput) error

CreateIssueLink creates a link between two issues. POST /issueLink — expects HTTP 201.

func (*Client) DeleteComment

func (c *Client) DeleteComment(ctx context.Context, issueKey, commentID string) error

DeleteComment removes a comment from an issue. Expects HTTP 204.

func (*Client) DeleteIssue

func (c *Client) DeleteIssue(ctx context.Context, keyOrID string, deleteSubtasks bool) error

DeleteIssue deletes an issue by key or ID. The deleteSubtasks parameter controls whether subtasks should also be deleted (true to delete).

func (*Client) Do

func (c *Client) Do(ctx context.Context, method, path string, body interface{}, out interface{}) error

Do sends an HTTP request to the Jira REST API v3 and decodes the JSON response.

method: HTTP verb (GET, POST, PUT, DELETE). path: API path appended to base URL (e.g. "issue/PROJ-123"). body: request body to marshal as JSON (nil for no body). out: pointer to decode response JSON into (nil to skip decode; required for 204).

Successful status codes: 200, 201, 204. On 204 (No Content), body decode is skipped regardless of out.

func (*Client) DoAgile

func (c *Client) DoAgile(ctx context.Context, method, path string, body interface{}, out interface{}) error

DoAgile sends an HTTP request to the Jira Agile REST API and decodes the JSON response. Same contract as Do, but uses the /rest/agile/1.0 base URL.

func (*Client) DoTransition

func (c *Client) DoTransition(ctx context.Context, keyOrID string, input *DoTransitionInput) error

DoTransition performs a workflow transition on an issue.

func (*Client) EditIssue

func (c *Client) EditIssue(ctx context.Context, keyOrID string, input *EditIssueInput) error

EditIssue updates an existing issue. Expects HTTP 204 (no response body).

func (*Client) GetActiveSprint

func (c *Client) GetActiveSprint(ctx context.Context, projectKey string) (*Sprint, error)

GetActiveSprint returns the active sprint for the first sprint-capable board in a project. Returns nil, nil when: no sprint-capable boards or no active sprint. Returns nil, err only on API/network failure.

func (*Client) GetBoardsForProject

func (c *Client) GetBoardsForProject(ctx context.Context, projectKey string) ([]Board, error)

GetBoardsForProject returns all boards associated with a project key. Returns an empty slice (not an error) when the project has no boards.

func (*Client) GetComment

func (c *Client) GetComment(ctx context.Context, issueKey, commentID string) (*Comment, error)

GetComment fetches a single comment by ID on the given issue.

func (*Client) GetCreateMeta

func (c *Client) GetCreateMeta(ctx context.Context, projectKeyOrID string) (*CreateMetaIssueTypes, error)

GetCreateMeta returns the available issue types for creating issues in a project.

func (*Client) GetIssue

func (c *Client) GetIssue(ctx context.Context, keyOrID string, opts *GetIssueOptions) (*Issue, error)

GetIssue fetches a single issue by key or ID. opts controls which fields and expansions to request via query params.

func (*Client) GetMyself

func (c *Client) GetMyself(ctx context.Context) (*User, error)

GetMyself returns the currently authenticated user via GET /myself.

func (*Client) GetProject

func (c *Client) GetProject(ctx context.Context, keyOrID string) (*ProjectDetail, error)

GetProject fetches a single project by key or numeric ID. GET /project/{keyOrId} On 404, wraps the error with the project key in context.

func (*Client) GetProjectStatuses

func (c *Client) GetProjectStatuses(ctx context.Context, keyOrID string) ([]IssueTypeStatuses, error)

GetProjectStatuses returns the statuses available for each issue type in a project. GET /project/{keyOrId}/statuses

func (*Client) GetSprintsForBoard

func (c *Client) GetSprintsForBoard(ctx context.Context, boardID int, state string) ([]Sprint, error)

GetSprintsForBoard returns sprints for a board, optionally filtered by state. state: "active", "future", "closed", or "" for all.

func (*Client) GetTransitions

func (c *Client) GetTransitions(ctx context.Context, keyOrID string) ([]Transition, error)

GetTransitions returns the available workflow transitions for an issue.

func (*Client) Instance

func (c *Client) Instance() string

Instance returns the Jira instance hostname (e.g. "mysite.atlassian.net").

func (*Client) ListComments

func (c *Client) ListComments(ctx context.Context, issueKey string, opts OffsetPaginationOptions) (*CommentPage, error)

ListComments fetches comments on an issue, ordered by most recent first. Uses offset-based pagination via startAt and maxResults.

func (*Client) ListFields

func (c *Client) ListFields(ctx context.Context) ([]Field, error)

ListFields returns all field definitions. GET /field — returns a plain JSON array.

func (*Client) ListIssueTypes

func (c *Client) ListIssueTypes(ctx context.Context) ([]IssueType, error)

ListIssueTypes returns all issue types globally. GET /issuetype — returns a plain JSON array.

func (*Client) ListIssueTypesForProject

func (c *Client) ListIssueTypesForProject(ctx context.Context, projectID string) ([]IssueType, error)

ListIssueTypesForProject returns issue types scoped to a project. GET /issuetype/project?projectId={id} — requires numeric project ID.

func (*Client) ListLabels

func (c *Client) ListLabels(ctx context.Context, opts OffsetPaginationOptions) (*LabelPage, error)

ListLabels returns labels with offset-based pagination. GET /label — returns PageBeanString with 'values' array.

func (*Client) ListPriorities

func (c *Client) ListPriorities(ctx context.Context) ([]Priority, error)

ListPriorities returns all issue priorities. GET /priority — returns a plain JSON array.

func (*Client) ListProjects

func (c *Client) ListProjects(ctx context.Context, opts OffsetPaginationOptions) (*ProjectSearchResult, error)

ListProjects searches for projects using offset-based pagination. GET /project/search — returns PageBeanProject with 'values' array.

func (*Client) ListStatuses

func (c *Client) ListStatuses(ctx context.Context) ([]StatusDetail, error)

ListStatuses returns all workflow statuses. GET /status — returns a plain JSON array.

func (*Client) SearchIssues

func (c *Client) SearchIssues(ctx context.Context, opts *SearchOptions) (*SearchResults, error)

SearchIssues executes a JQL search via POST /search/jql. Always sends an explicit "fields" parameter — Jira defaults to returning only the "id" field if fields is not specified.

func (*Client) SearchUsers

func (c *Client) SearchUsers(ctx context.Context, query string, startAt, maxResults int) ([]User, error)

SearchUsers finds users by display name or email via GET /user/search. The Jira API returns a plain []User array (not an envelope). startAt and maxResults control offset-based pagination.

func (*Client) UpdateComment

func (c *Client) UpdateComment(ctx context.Context, issueKey, commentID string, body interface{}) (*Comment, error)

UpdateComment updates an existing comment. Expects HTTP 200. body should be an ADF document node (the result of markdown-to-ADF conversion).

func (*Client) VerifyCredentials

func (c *Client) VerifyCredentials(ctx context.Context) error

VerifyCredentials checks that the current credentials are valid by calling GET /myself. Returns nil if credentials are valid. On failure, returns the underlying error from GetMyself — callers must check the error code to distinguish AUTH_ERROR from transient failures (network, rate limit, 5xx). This is useful because some Jira endpoints (e.g. POST /search/jql) return HTTP 200 with empty results for unauthenticated requests instead of 401.

type ClientOption

type ClientOption func(*Client)

ClientOption configures optional Client behaviour.

func WithAgileBaseURL

func WithAgileBaseURL(url string) ClientOption

WithAgileBaseURL overrides the Agile API base URL (used by tests).

func WithBaseURL

func WithBaseURL(url string) ClientOption

WithBaseURL overrides the base URL. Exported for cross-package test helpers.

func WithTimeout

func WithTimeout(d time.Duration) ClientOption

WithTimeout overrides the default 30-second request timeout.

type Comment

type Comment struct {
	ID      string          `json:"id"`
	Author  *User           `json:"author"`
	Body    json.RawMessage `json:"body"` // ADF document
	Created string          `json:"created"`
	Updated string          `json:"updated"`
}

Comment represents a single issue comment.

type CommentPage

type CommentPage struct {
	Comments   []Comment `json:"comments"`
	MaxResults int       `json:"maxResults"`
	Total      int       `json:"total"`
	StartAt    int       `json:"startAt"`
}

CommentPage represents a paginated comment response embedded in issue fields.

type CreateIssueInput

type CreateIssueInput struct {
	Fields map[string]interface{}     `json:"fields"`
	Update map[string]json.RawMessage `json:"update,omitempty"`
}

CreateIssueInput is the request body for POST /issue.

type CreateIssueLinkInput

type CreateIssueLinkInput struct {
	Type         IssueLinkTypeRef `json:"type"`
	InwardIssue  LinkedIssueRef   `json:"inwardIssue"`
	OutwardIssue LinkedIssueRef   `json:"outwardIssue"`
}

CreateIssueLinkInput is the request body for POST /issueLink.

type CreateMetaIssueTypes

type CreateMetaIssueTypes struct {
	IssueTypes []IssueTypeCreateMeta `json:"issueTypes"`
}

CreateMetaIssueTypes is the response from GET /issue/createmeta/{projectIdOrKey}/issuetypes.

type CreatedIssue

type CreatedIssue struct {
	ID   string `json:"id"`
	Key  string `json:"key"`
	Self string `json:"self"`
}

CreatedIssue is the response from POST /issue. Note: Self is the REST API URL, NOT the browser URL. Browse URL must be constructed client-side via Client.BrowseURL(key).

type DoTransitionInput

type DoTransitionInput struct {
	Transition TransitionRef              `json:"transition"`
	Update     map[string]json.RawMessage `json:"update,omitempty"`
	Fields     map[string]interface{}     `json:"fields,omitempty"`
}

DoTransitionInput is the request body for POST /issue/{key}/transitions.

type EditIssueInput

type EditIssueInput struct {
	Fields map[string]interface{}     `json:"fields,omitempty"`
	Update map[string]json.RawMessage `json:"update,omitempty"`
}

EditIssueInput is the request body for PUT /issue/{key}.

type ErrorCollection

type ErrorCollection struct {
	ErrorMessages []string          `json:"errorMessages"`
	Errors        map[string]string `json:"errors"`
}

ErrorCollection mirrors the Jira REST API error response shape. Jira returns {"errorMessages": [...], "errors": {"field": "msg", ...}}.

func (*ErrorCollection) Summary

func (ec *ErrorCollection) Summary() string

Summary returns a single-string summary of all errors.

type Field

type Field struct {
	ID     string      `json:"id"`
	Key    string      `json:"key"`
	Name   string      `json:"name"`
	Schema FieldSchema `json:"schema"`
	Custom bool        `json:"custom"`
}

Field represents a Jira field definition from GET /field.

type FieldSchema

type FieldSchema struct {
	Type   string `json:"type"`
	Items  string `json:"items,omitempty"`  // for array fields
	Custom string `json:"custom,omitempty"` // custom field type URI
	System string `json:"system,omitempty"` // system field name
}

FieldSchema describes the data type of a Jira field.

type GetIssueOptions

type GetIssueOptions struct {
	Fields []string
	Expand []string
}

GetIssueOptions controls which fields/expansions to request for GET /issue/{key}.

type Issue

type Issue struct {
	ID     string      `json:"id"`
	Key    string      `json:"key"`
	Self   string      `json:"self"`
	Fields IssueFields `json:"fields"`
}

Issue represents a full Jira issue (GET /issue/{key}).

type IssueFields

type IssueFields struct {
	Summary     string          `json:"summary"`
	Description json.RawMessage `json:"description"` // ADF document
	Status      *Status         `json:"status"`
	IssueType   *IssueType      `json:"issuetype"`
	Priority    *Priority       `json:"priority"`
	Assignee    *User           `json:"assignee"`
	Reporter    *User           `json:"reporter"`
	Project     *Project        `json:"project"`
	Parent      *IssueParent    `json:"parent"`
	Labels      []string        `json:"labels"`
	Created     string          `json:"created"`
	Updated     string          `json:"updated"`
	Resolution  *Resolution     `json:"resolution"`
	SubTasks    []Issue         `json:"subtasks"`
	IssueLinks  []IssueLink     `json:"issuelinks"`
	Comment     *CommentPage    `json:"comment"`

	// CustomFields captures any field not covered above.
	// It is populated via custom UnmarshalJSON logic.
	CustomFields map[string]json.RawMessage `json:"-"`
}

IssueFields holds the typed known fields plus a catch-all for custom fields. NOTE: "subtasks" is the standard Jira convention but is NOT defined in the OpenAPI spec (IssueBean.fields is additionalProperties). Verify against live API response during integration testing.

func (*IssueFields) UnmarshalJSON

func (f *IssueFields) UnmarshalJSON(data []byte) error

UnmarshalJSON implements custom JSON decoding for IssueFields. Known fields are decoded into their typed struct members; everything else goes into CustomFields as json.RawMessage.

type IssueLink struct {
	ID           string         `json:"id"`
	Type         *IssueLinkType `json:"type"`
	InwardIssue  *LinkedIssue   `json:"inwardIssue"`
	OutwardIssue *LinkedIssue   `json:"outwardIssue"`
}

IssueLink represents a link between two issues.

type IssueLinkType

type IssueLinkType struct {
	ID      string `json:"id"`
	Name    string `json:"name"`
	Inward  string `json:"inward"`
	Outward string `json:"outward"`
}

IssueLinkType describes the relationship between linked issues.

type IssueLinkTypeRef

type IssueLinkTypeRef struct {
	Name string `json:"name"`
}

IssueLinkTypeRef identifies a link type by name.

type IssueParent

type IssueParent struct {
	ID     string        `json:"id"`
	Key    string        `json:"key"`
	Fields *ParentFields `json:"fields"`
}

IssueParent represents the parent of a subtask.

type IssueType

type IssueType struct {
	ID             string          `json:"id"`
	Name           string          `json:"name"`
	Description    string          `json:"description"`
	Subtask        bool            `json:"subtask"`
	IconURL        string          `json:"iconUrl"`
	HierarchyLevel *int            `json:"hierarchyLevel,omitempty"`
	Scope          json.RawMessage `json:"scope,omitempty"`
}

IssueType represents a Jira issue type (Bug, Story, Task, etc.).

type IssueTypeCreateMeta

type IssueTypeCreateMeta struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Subtask     bool   `json:"subtask"`
	IconURL     string `json:"iconUrl"`
}

IssueTypeCreateMeta holds issue-type info returned by the createmeta endpoint.

type IssueTypeStatuses

type IssueTypeStatuses struct {
	ID       string         `json:"id"`
	Name     string         `json:"name"`
	Subtask  bool           `json:"subtask"`
	Statuses []StatusDetail `json:"statuses"`
}

IssueTypeStatuses groups an issue type with its available workflow statuses. Returned by GET /project/{key}/statuses.

type LabelPage

type LabelPage struct {
	Values     []string `json:"values"`
	StartAt    int      `json:"startAt"`
	MaxResults int      `json:"maxResults"`
	Total      int      `json:"total"`
	IsLast     bool     `json:"isLast"`
}

LabelPage is the response from GET /label (PageBeanString shape).

type LinkedIssue

type LinkedIssue struct {
	ID     string             `json:"id"`
	Key    string             `json:"key"`
	Self   string             `json:"self"`
	Fields *LinkedIssueFields `json:"fields"`
}

LinkedIssue is a minimal issue representation inside an IssueLink.

type LinkedIssueFields

type LinkedIssueFields struct {
	Summary   string     `json:"summary"`
	Status    *Status    `json:"status"`
	IssueType *IssueType `json:"issuetype"`
	Priority  *Priority  `json:"priority"`
}

LinkedIssueFields holds the summary and status of a linked issue.

type LinkedIssueRef

type LinkedIssueRef struct {
	Key string `json:"key"`
}

LinkedIssueRef identifies an issue by key for link creation.

type OffsetPageFetcher

type OffsetPageFetcher[T any] func(ctx context.Context, startAt, maxResults int) (*OffsetPageResult[T], error)

OffsetPageFetcher fetches a single page using startAt and maxResults.

type OffsetPageResult

type OffsetPageResult[T any] struct {
	Items   []T
	StartAt int
	Total   int
}

OffsetPageResult holds the response from a single offset-based API call.

type OffsetPaginationOptions

type OffsetPaginationOptions struct {
	StartAt    int
	MaxResults int
}

OffsetPaginationOptions controls offset-based pagination for comments, projects, and labels.

type PaginationMeta

type PaginationMeta struct {
	Offset      int  `json:"offset"`
	Limit       int  `json:"limit"`
	Total       *int `json:"total"` // nil for token-based pagination (total unknown)
	HasNextPage bool `json:"has_next_page"`
}

PaginationMeta describes the pagination state returned in list JSON envelopes.

func FetchOffsetPage

func FetchOffsetPage[T any](
	ctx context.Context,
	offset int,
	limit int,
	fetcher OffsetPageFetcher[T],
) ([]T, *PaginationMeta, error)

FetchOffsetPage retrieves a single page via offset-based pagination.

offset: the startAt value to pass to the API. limit: max results per page (maxResults). fetcher: callback that executes a single API request.

Returns the items, pagination metadata, and any error.

func FetchRawArrayPage

func FetchRawArrayPage[T any](
	ctx context.Context,
	offset int,
	limit int,
	fetcher RawArrayFetcher[T],
) ([]T, *PaginationMeta, error)

FetchRawArrayPage retrieves a single page from an endpoint that returns a plain JSON array (e.g. GET /user/search).

Heuristic: has_next_page is true if len(results) == maxResults. Total is always nil (not provided by the API).

func FetchTokenPage

func FetchTokenPage[T any](
	ctx context.Context,
	offset int,
	limit int,
	fetcher TokenPageFetcher[T],
	warnWriter io.Writer,
) ([]T, *PaginationMeta, error)

FetchTokenPage retrieves a single logical page via token-based pagination.

offset: number of leading results to skip (consume-and-discard). limit: max results to return to the caller. fetcher: callback that executes a single API request for one page. warnWriter: if non-nil, a warning is written when offset > 1000.

Returns the items, pagination metadata, and any error. For token-based endpoints, PaginationMeta.Total is always nil.

type PaginationOptions

type PaginationOptions struct {
	MaxResults    int
	NextPageToken string
}

PaginationOptions controls token-based pagination for search.

type ParentFields

type ParentFields struct {
	Summary   string     `json:"summary"`
	Status    *Status    `json:"status"`
	IssueType *IssueType `json:"issuetype"`
}

ParentFields are the fields returned inline on a parent reference.

type Priority

type Priority struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	IconURL     string `json:"iconUrl"`
	Description string `json:"description,omitempty"`
	StatusColor string `json:"statusColor,omitempty"`
	IsDefault   *bool  `json:"isDefault,omitempty"`
}

Priority represents a Jira issue priority.

type Project

type Project struct {
	ID   string `json:"id"`
	Key  string `json:"key"`
	Name string `json:"name"`
	Self string `json:"self"`
}

Project represents a Jira project.

type ProjectDetail

type ProjectDetail struct {
	ID             string      `json:"id"`
	Key            string      `json:"key"`
	Name           string      `json:"name"`
	Description    string      `json:"description"`
	Lead           *User       `json:"lead"`
	ProjectTypeKey string      `json:"projectTypeKey"`
	IssueTypes     []IssueType `json:"issueTypes"`
	URL            string      `json:"url"`
	Simplified     bool        `json:"simplified"`
	Style          string      `json:"style"`
}

ProjectDetail is the detailed response from GET /project/{keyOrId}.

type ProjectSearchResult

type ProjectSearchResult struct {
	Values     []ProjectDetail `json:"values"`
	StartAt    int             `json:"startAt"`
	MaxResults int             `json:"maxResults"`
	Total      int             `json:"total"`
	IsLast     bool            `json:"isLast"`
}

ProjectSearchResult is the response from GET /project/search (PageBeanProject shape).

type RawArrayFetcher

type RawArrayFetcher[T any] func(ctx context.Context, startAt, maxResults int) ([]T, error)

RawArrayFetcher fetches a page from an endpoint returning a plain array. startAt and maxResults are passed as query parameters.

type Resolution

type Resolution struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

Resolution represents a Jira issue resolution (e.g. "Fixed", "Won't Do").

type SearchOptions

type SearchOptions struct {
	JQL           string
	Fields        []string
	MaxResults    int
	NextPageToken string
}

SearchOptions holds parameters for POST /search/jql.

type SearchResults

type SearchResults struct {
	Issues        []Issue `json:"issues"`
	NextPageToken string  `json:"nextPageToken"`
	IsLast        bool    `json:"isLast"`
}

SearchResults is the response from POST /search/jql. Uses token-based pagination (not legacy startAt/total).

type Sprint

type Sprint struct {
	ID            int    `json:"id"`
	Name          string `json:"name"`
	State         string `json:"state"` // "future", "active", "closed"
	StartDate     string `json:"startDate,omitempty"`
	EndDate       string `json:"endDate,omitempty"`
	CompleteDate  string `json:"completeDate,omitempty"`
	Goal          string `json:"goal,omitempty"`
	OriginBoardID int    `json:"originBoardId"`
}

Sprint represents a Jira Software sprint.

type Status

type Status struct {
	ID             string          `json:"id"`
	Name           string          `json:"name"`
	StatusCategory *StatusCategory `json:"statusCategory"`
}

Status represents a Jira workflow status.

type StatusCategory

type StatusCategory struct {
	ID        int    `json:"id"`
	Key       string `json:"key"`
	ColorName string `json:"colorName"`
	Name      string `json:"name"`
}

StatusCategory groups statuses into high-level buckets (e.g. "To Do", "In Progress", "Done").

type StatusDetail

type StatusDetail struct {
	ID             string          `json:"id"`
	Name           string          `json:"name"`
	StatusCategory *StatusCategory `json:"statusCategory"`
	Description    string          `json:"description,omitempty"`
	IconURL        string          `json:"iconUrl,omitempty"`
}

StatusDetail is a standalone type for GET /status responses. It does NOT embed Status to avoid JSON tag ambiguity.

type TokenPageFetcher

type TokenPageFetcher[T any] func(ctx context.Context, token string, maxResults int) (items []T, nextPageToken string, isLast bool, err error)

TokenPageFetcher fetches a single page using a nextPageToken. Returns the page items, the next-page token (empty string if last page), whether this is the last page, and any error.

type Transition

type Transition struct {
	ID   string  `json:"id"`
	Name string  `json:"name"`
	To   *Status `json:"to"`
}

Transition represents a Jira workflow transition.

type TransitionRef

type TransitionRef struct {
	ID string `json:"id"`
}

TransitionRef identifies a transition by ID.

type User

type User struct {
	AccountID    string            `json:"accountId"`
	DisplayName  string            `json:"displayName"`
	EmailAddress *string           `json:"emailAddress"`
	AvatarURLs   map[string]string `json:"avatarUrls"`
	Active       bool              `json:"active"`
	TimeZone     string            `json:"timeZone"`
}

User represents a Jira Cloud user. EmailAddress is nullable: Jira privacy settings may mask it.

Jump to

Keyboard shortcuts

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