Documentation
¶
Overview ¶
Package client provides an HTTP client for the Jira REST API v2 and the Jira Agile REST API (boards/sprints).
Authentication is performed using a Bearer token (Jira Cloud personal access token or Jira Server/Data Center personal access token).
The client automatically prefixes all requests with the configured server URL and the appropriate API base path:
- /rest/api/2 – core Jira API (v2)
- /rest/agile/1.0 – Jira Agile (boards, sprints)
Index ¶
- func FormatCustomField(raw json.RawMessage) string
- type ADFString
- type Attachment
- type Board
- type BoardList
- type BoardLocation
- type Client
- func (c *Client) AddAttachment(ctx context.Context, issueKey, filePath string) ([]Attachment, error)
- func (c *Client) AddComment(ctx context.Context, issueKey, body string) (*Comment, error)
- func (c *Client) AddVote(ctx context.Context, issueKey string) error
- func (c *Client) AddWatcher(ctx context.Context, issueKey, accountID string) error
- func (c *Client) AddWorklog(ctx context.Context, issueKey, timeSpent, started, comment string) (*Worklog, error)
- func (c *Client) AssignIssue(ctx context.Context, issueKey, accountID string) error
- func (c *Client) CreateComponent(ctx context.Context, projectKey, name, description string) (*Component, error)
- func (c *Client) CreateIssue(ctx context.Context, req *CreateIssueRequest) (*CreateIssueResponse, error)
- func (c *Client) CreateProject(ctx context.Context, req *CreateProjectRequest) (*Project, error)
- func (c *Client) CreateSprint(ctx context.Context, req *CreateSprintRequest) (*Sprint, error)
- func (c *Client) CreateVersion(ctx context.Context, projectKey, name, description, releaseDate string) (*Version, error)
- func (c *Client) DeleteAttachment(ctx context.Context, attachmentID string) error
- func (c *Client) DeleteComment(ctx context.Context, issueKey, commentID string) error
- func (c *Client) DeleteComponent(ctx context.Context, componentID string) error
- func (c *Client) DeleteIssue(ctx context.Context, issueKey string, deleteSubtasks bool) error
- func (c *Client) DeleteIssueLink(ctx context.Context, linkID string) error
- func (c *Client) DeleteProject(ctx context.Context, projectKey string) error
- func (c *Client) DeleteVersion(ctx context.Context, versionID string) error
- func (c *Client) DeleteWorklog(ctx context.Context, issueKey, worklogID string) error
- func (c *Client) GetBoards(ctx context.Context, projectKey string, maxResults int) (*BoardList, error)
- func (c *Client) GetComments(ctx context.Context, issueKey string) (*CommentList, error)
- func (c *Client) GetComponents(ctx context.Context, projectKey string) ([]Component, error)
- func (c *Client) GetConfiguration(ctx context.Context) (*Configuration, error)
- func (c *Client) GetCurrentUser(ctx context.Context) (*User, error)
- func (c *Client) GetEditMeta(ctx context.Context, issueKey string) (*EditMeta, error)
- func (c *Client) GetFieldContexts(ctx context.Context, fieldID string, opts FieldContextOptions) (*FieldContextPage, error)
- func (c *Client) GetFieldOptions(ctx context.Context, fieldID string, contextID string, onlyOptions bool, ...) (*FieldOptionPage, error)
- func (c *Client) GetFields(ctx context.Context) ([]Field, error)
- func (c *Client) GetIssue(ctx context.Context, issueKey string, fields []string) (*Issue, error)
- func (c *Client) GetIssueLinkTypes(ctx context.Context) (*IssueLinkTypeList, error)
- func (c *Client) GetIssueTypes(ctx context.Context) ([]IssueType, error)
- func (c *Client) GetPriorities(ctx context.Context) ([]Priority, error)
- func (c *Client) GetProject(ctx context.Context, projectKey string) (*Project, error)
- func (c *Client) GetProjectStatuses(ctx context.Context, projectKey string) ([]ProjectIssueTypeStatuses, error)
- func (c *Client) GetProjects(ctx context.Context) ([]Project, error)
- func (c *Client) GetResolutions(ctx context.Context) ([]Resolution, error)
- func (c *Client) GetServerInfo(ctx context.Context) (*ServerInfo, error)
- func (c *Client) GetSprintIssues(ctx context.Context, sprintID int) (*SearchResult, error)
- func (c *Client) GetSprints(ctx context.Context, boardID int, state string) (*SprintList, error)
- func (c *Client) GetStatuses(ctx context.Context) ([]Status, error)
- func (c *Client) GetTransitions(ctx context.Context, issueKey string) (*TransitionList, error)
- func (c *Client) GetUser(ctx context.Context, accountID string) (*User, error)
- func (c *Client) GetVersions(ctx context.Context, projectKey string) ([]Version, error)
- func (c *Client) GetVotes(ctx context.Context, issueKey string) (*Votes, error)
- func (c *Client) GetWatchers(ctx context.Context, issueKey string) (*WatcherList, error)
- func (c *Client) GetWorklogs(ctx context.Context, issueKey string) (*WorklogList, error)
- func (c *Client) LinkIssues(ctx context.Context, linkTypeName, inwardKey, outwardKey, comment string) error
- func (c *Client) RemoveVote(ctx context.Context, issueKey string) error
- func (c *Client) RemoveWatcher(ctx context.Context, issueKey, accountID string) error
- func (c *Client) SearchFields(ctx context.Context, opts FieldSearchOptions) (*FieldSearchPage, error)
- func (c *Client) SearchIssues(ctx context.Context, opts SearchOptions) (*SearchResult, error)
- func (c *Client) SearchUsers(ctx context.Context, query string, maxResults int) ([]User, error)
- func (c *Client) TransitionIssue(ctx context.Context, issueKey, transitionID string, ...) error
- func (c *Client) UpdateComment(ctx context.Context, issueKey, commentID, body string) (*Comment, error)
- func (c *Client) UpdateComponent(ctx context.Context, componentID string, fields map[string]interface{}) (*Component, error)
- func (c *Client) UpdateIssue(ctx context.Context, issueKey string, req *UpdateIssueRequest) error
- func (c *Client) UpdateProject(ctx context.Context, projectKey string, fields map[string]interface{}) (*Project, error)
- func (c *Client) UpdateSprint(ctx context.Context, sprintID int, fields map[string]interface{}) (*Sprint, error)
- func (c *Client) UpdateVersion(ctx context.Context, versionID string, fields map[string]interface{}) (*Version, error)
- type Comment
- type CommentList
- type Component
- type Configuration
- type CreateIssueFields
- type CreateIssueRequest
- type CreateIssueResponse
- type CreateProjectRequest
- type CreateSprintRequest
- type EditMeta
- type EditMetaAllowedValue
- type EditMetaField
- type Field
- type FieldContext
- type FieldContextOptions
- type FieldContextPage
- type FieldOption
- type FieldOptionPage
- type FieldSearchOptions
- type FieldSearchPage
- type FieldSearchResult
- type IDObj
- type Issue
- type IssueFields
- type IssueLinkType
- type IssueLinkTypeList
- type IssueRef
- type IssueType
- type NamedObj
- type Priority
- type Project
- type ProjectIssueTypeStatuses
- type ProjectShort
- type Resolution
- type SearchOptions
- type SearchResult
- type ServerInfo
- type Sprint
- type SprintList
- type Status
- type StatusCategory
- type TimeTracking
- type TimeTrackingConfiguration
- type Transition
- type TransitionList
- type UpdateIssueRequest
- type User
- type Version
- type Votes
- type WatcherList
- type Watches
- type Worklog
- type WorklogList
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatCustomField ¶
func FormatCustomField(raw json.RawMessage) string
FormatCustomField converts a raw JSON value from IssueFields.Extra into a human-readable string. It handles common Jira value shapes (plain strings, named objects, arrays) without requiring callers to know the field schema.
Types ¶
type ADFString ¶
type ADFString string
ADFString is a string value that may be unmarshaled from either a JSON string or an Atlassian Document Format object. In both cases the plain-text content is stored in the string value.
func (*ADFString) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler. It handles three cases:
- A JSON string — stored as-is.
- An ADF document object — plain text is extracted recursively.
- JSON null — left as empty string.
type Attachment ¶
type Attachment struct {
ID string `json:"id"`
Self string `json:"self"`
Filename string `json:"filename"`
Author *User `json:"author"`
Created string `json:"created"`
Size int64 `json:"size"`
MimeType string `json:"mimeType"`
Content string `json:"content"`
}
Attachment represents a file attached to a Jira issue.
type Board ¶
type Board struct {
ID int `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
Self string `json:"self"`
Location *BoardLocation `json:"location"`
}
Board represents a Jira Agile board.
type BoardList ¶
type BoardList struct {
MaxResults int `json:"maxResults"`
StartAt int `json:"startAt"`
Total int `json:"total"`
IsLast bool `json:"isLast"`
Values []Board `json:"values"`
}
BoardList is a paginated list of boards.
type BoardLocation ¶
type BoardLocation struct {
ProjectID int `json:"projectId"`
ProjectKey string `json:"projectKey"`
ProjectName string `json:"projectName"`
}
BoardLocation describes where a board is scoped.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a configured Jira API client.
func (*Client) AddAttachment ¶
func (c *Client) AddAttachment(ctx context.Context, issueKey, filePath string) ([]Attachment, error)
AddAttachment uploads a file as an attachment to an issue.
API: POST /rest/api/2/issue/{issueIdOrKey}/attachments
func (*Client) AddComment ¶
AddComment adds a comment to an issue.
API: POST /rest/api/2/issue/{issueIdOrKey}/comment
func (*Client) AddVote ¶
AddVote casts a vote for an issue.
API: POST /rest/api/2/issue/{issueIdOrKey}/votes
func (*Client) AddWatcher ¶
AddWatcher adds a user as a watcher on an issue.
API: POST /rest/api/2/issue/{issueIdOrKey}/watchers
func (*Client) AddWorklog ¶
func (c *Client) AddWorklog(ctx context.Context, issueKey, timeSpent, started, comment string) (*Worklog, error)
AddWorklog adds a worklog entry to an issue.
API: POST /rest/api/2/issue/{issueIdOrKey}/worklog
func (*Client) AssignIssue ¶
AssignIssue assigns an issue to a user. Pass an empty accountID to unassign.
API: PUT /rest/api/2/issue/{issueIdOrKey}/assignee
func (*Client) CreateComponent ¶
func (c *Client) CreateComponent(ctx context.Context, projectKey, name, description string) (*Component, error)
CreateComponent creates a new project component.
API: POST /rest/api/2/component
func (*Client) CreateIssue ¶
func (c *Client) CreateIssue(ctx context.Context, req *CreateIssueRequest) (*CreateIssueResponse, error)
CreateIssue creates a new Jira issue.
API: POST /rest/api/2/issue
func (*Client) CreateProject ¶
CreateProject creates a new Jira project.
API: POST /rest/api/2/project
func (*Client) CreateSprint ¶
CreateSprint creates a new sprint on a board.
API: POST /rest/agile/1.0/sprint
func (*Client) CreateVersion ¶
func (c *Client) CreateVersion(ctx context.Context, projectKey, name, description, releaseDate string) (*Version, error)
CreateVersion creates a new project version.
API: POST /rest/api/2/version
func (*Client) DeleteAttachment ¶
DeleteAttachment deletes an attachment by ID.
API: DELETE /rest/api/2/attachment/{id}
func (*Client) DeleteComment ¶
DeleteComment deletes a comment.
API: DELETE /rest/api/2/issue/{issueIdOrKey}/comment/{id}
func (*Client) DeleteComponent ¶
DeleteComponent deletes a project component.
API: DELETE /rest/api/2/component/{id}
func (*Client) DeleteIssue ¶
DeleteIssue deletes a Jira issue.
API: DELETE /rest/api/2/issue/{issueIdOrKey}
func (*Client) DeleteIssueLink ¶
DeleteIssueLink removes a link between issues.
API: DELETE /rest/api/2/issueLink/{linkId}
func (*Client) DeleteProject ¶
DeleteProject deletes a project.
API: DELETE /rest/api/2/project/{projectIdOrKey}
func (*Client) DeleteVersion ¶
DeleteVersion deletes a project version.
API: DELETE /rest/api/2/version/{id}
func (*Client) DeleteWorklog ¶
DeleteWorklog deletes a worklog entry.
API: DELETE /rest/api/2/issue/{issueIdOrKey}/worklog/{id}
func (*Client) GetBoards ¶
func (c *Client) GetBoards(ctx context.Context, projectKey string, maxResults int) (*BoardList, error)
GetBoards returns all boards visible to the current user.
API: GET /rest/agile/1.0/board
func (*Client) GetComments ¶
GetComments retrieves all comments for an issue.
API: GET /rest/api/2/issue/{issueIdOrKey}/comment
func (*Client) GetComponents ¶
GetComponents returns all components for a project.
API: GET /rest/api/2/project/{projectIdOrKey}/components
func (*Client) GetConfiguration ¶ added in v1.2.0
func (c *Client) GetConfiguration(ctx context.Context) (*Configuration, error)
GetConfiguration returns the instance-level configuration flags.
API: GET /rest/api/2/configuration Works on both Jira Cloud and Jira Server / Data Center.
func (*Client) GetCurrentUser ¶
GetCurrentUser returns the currently authenticated user.
API: GET /rest/api/2/myself
func (*Client) GetEditMeta ¶ added in v1.2.0
GetEditMeta returns the edit metadata for an existing issue, including the allowed values for each editable field.
API: GET /rest/api/2/issue/{issueKey}/editmeta Ref: https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issues/#api-rest-api-2-issue-issueidorkey-editmeta-get
func (*Client) GetFieldContexts ¶ added in v1.2.0
func (c *Client) GetFieldContexts(ctx context.Context, fieldID string, opts FieldContextOptions) (*FieldContextPage, error)
GetFieldContexts returns the contexts for a custom field.
API: GET /rest/api/2/field/{fieldId}/context
func (*Client) GetFieldOptions ¶ added in v1.2.0
func (c *Client) GetFieldOptions(ctx context.Context, fieldID string, contextID string, onlyOptions bool, startAt, maxResults int) (*FieldOptionPage, error)
GetFieldOptions returns the options (allowed values) for a custom field context.
API: GET /rest/api/2/field/{fieldId}/context/option
func (*Client) GetIssue ¶
GetIssue retrieves a single Jira issue by its key or ID.
API: GET /rest/api/2/issue/{issueIdOrKey}
func (*Client) GetIssueLinkTypes ¶
func (c *Client) GetIssueLinkTypes(ctx context.Context) (*IssueLinkTypeList, error)
GetIssueLinkTypes returns all available link types.
API: GET /rest/api/2/issueLinkType
func (*Client) GetIssueTypes ¶
GetIssueTypes returns all issue types.
API: GET /rest/api/2/issuetype
func (*Client) GetPriorities ¶
GetPriorities returns all issue priorities.
API: GET /rest/api/2/priority
func (*Client) GetProject ¶
GetProject returns a single project by key or ID.
API: GET /rest/api/2/project/{projectIdOrKey}
func (*Client) GetProjectStatuses ¶ added in v1.2.0
func (c *Client) GetProjectStatuses(ctx context.Context, projectKey string) ([]ProjectIssueTypeStatuses, error)
GetProjectStatuses returns the statuses available for each issue type in the given project.
API: GET /rest/api/2/project/{projectIdOrKey}/statuses Works on both Jira Cloud and Jira Server / Data Center.
func (*Client) GetProjects ¶
GetProjects returns all projects visible to the current user.
API: GET /rest/api/2/project
func (*Client) GetResolutions ¶ added in v1.2.0
func (c *Client) GetResolutions(ctx context.Context) ([]Resolution, error)
GetResolutions returns all resolutions defined on the Jira instance.
API: GET /rest/api/2/resolution Works on both Jira Cloud and Jira Server / Data Center.
func (*Client) GetServerInfo ¶ added in v1.2.0
func (c *Client) GetServerInfo(ctx context.Context) (*ServerInfo, error)
GetServerInfo returns build and runtime information about the Jira instance.
API: GET /rest/api/2/serverInfo Works on both Jira Cloud and Jira Server / Data Center.
func (*Client) GetSprintIssues ¶
GetSprintIssues returns all issues in a sprint.
API: GET /rest/agile/1.0/sprint/{sprintId}/issue
func (*Client) GetSprints ¶
GetSprints returns all sprints for a board.
API: GET /rest/agile/1.0/board/{boardId}/sprint
func (*Client) GetTransitions ¶
GetTransitions returns the available transitions for an issue.
API: GET /rest/api/2/issue/{issueIdOrKey}/transitions
func (*Client) GetUser ¶
GetUser retrieves a user by account ID.
API: GET /rest/api/2/user?accountId={accountId}
func (*Client) GetVersions ¶
GetVersions returns all versions for a project.
API: GET /rest/api/2/project/{projectIdOrKey}/versions
func (*Client) GetVotes ¶
GetVotes retrieves vote information for an issue.
API: GET /rest/api/2/issue/{issueIdOrKey}/votes
func (*Client) GetWatchers ¶
GetWatchers retrieves the watcher list for an issue.
API: GET /rest/api/2/issue/{issueIdOrKey}/watchers
func (*Client) GetWorklogs ¶
GetWorklogs retrieves worklogs for an issue.
API: GET /rest/api/2/issue/{issueIdOrKey}/worklog
func (*Client) LinkIssues ¶
func (c *Client) LinkIssues(ctx context.Context, linkTypeName, inwardKey, outwardKey, comment string) error
LinkIssues creates a link between two issues.
API: POST /rest/api/2/issueLink
func (*Client) RemoveVote ¶
RemoveVote removes the current user's vote from an issue.
API: DELETE /rest/api/2/issue/{issueIdOrKey}/votes
func (*Client) RemoveWatcher ¶
RemoveWatcher removes a watcher from an issue.
API: DELETE /rest/api/2/issue/{issueIdOrKey}/watchers?accountId={accountId}
func (*Client) SearchFields ¶ added in v1.2.0
func (c *Client) SearchFields(ctx context.Context, opts FieldSearchOptions) (*FieldSearchPage, error)
SearchFields returns a paginated list of field definitions.
API: GET /rest/api/2/field/search
func (*Client) SearchIssues ¶
func (c *Client) SearchIssues(ctx context.Context, opts SearchOptions) (*SearchResult, error)
SearchIssues executes a JQL search and returns matching issues.
API: GET /rest/api/2/search
func (*Client) SearchUsers ¶
SearchUsers searches for users.
API: GET /rest/api/2/user/search?query={query}
func (*Client) TransitionIssue ¶
func (c *Client) TransitionIssue(ctx context.Context, issueKey, transitionID string, fields map[string]interface{}) error
TransitionIssue moves an issue to a new state by transition ID.
API: POST /rest/api/2/issue/{issueIdOrKey}/transitions
func (*Client) UpdateComment ¶
func (c *Client) UpdateComment(ctx context.Context, issueKey, commentID, body string) (*Comment, error)
UpdateComment updates an existing comment.
API: PUT /rest/api/2/issue/{issueIdOrKey}/comment/{id}
func (*Client) UpdateComponent ¶
func (c *Client) UpdateComponent(ctx context.Context, componentID string, fields map[string]interface{}) (*Component, error)
UpdateComponent updates a project component.
API: PUT /rest/api/2/component/{id}
func (*Client) UpdateIssue ¶
UpdateIssue updates an existing Jira issue.
API: PUT /rest/api/2/issue/{issueIdOrKey}
func (*Client) UpdateProject ¶
func (c *Client) UpdateProject(ctx context.Context, projectKey string, fields map[string]interface{}) (*Project, error)
UpdateProject updates a project.
API: PUT /rest/api/2/project/{projectIdOrKey}
type Comment ¶
type Comment struct {
ID string `json:"id"`
Self string `json:"self"`
Author *User `json:"author"`
Body ADFString `json:"body"`
Created string `json:"created"`
Updated string `json:"updated"`
}
Comment represents a Jira issue comment.
type CommentList ¶
type CommentList struct {
Total int `json:"total"`
StartAt int `json:"startAt"`
MaxResults int `json:"maxResults"`
Comments []Comment `json:"comments"`
}
CommentList is the paginated list of comments returned by the API.
type Component ¶
type Component struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Lead *User `json:"lead"`
Project string `json:"project"`
}
Component represents a Jira project component.
type Configuration ¶ added in v1.2.0
type Configuration struct {
VotingEnabled bool `json:"votingEnabled"`
WatchingEnabled bool `json:"watchingEnabled"`
UnassignedIssuesAllowed bool `json:"unassignedIssuesAllowed"`
SubTasksEnabled bool `json:"subTasksEnabled"`
IssueLinkingEnabled bool `json:"issueLinkingEnabled"`
TimeTrackingEnabled bool `json:"timeTrackingEnabled"`
AttachmentsEnabled bool `json:"attachmentsEnabled"`
TimeTracking TimeTrackingConfiguration `json:"timeTrackingConfiguration"`
}
Configuration holds instance-level feature flags and settings.
type CreateIssueFields ¶
type CreateIssueFields struct {
Project IDObj `json:"project"`
Summary string `json:"summary"`
Description string `json:"description,omitempty"`
IssueType NamedObj `json:"issuetype"`
Priority *NamedObj `json:"priority,omitempty"`
Assignee *IDObj `json:"assignee,omitempty"`
Labels []string `json:"labels,omitempty"`
Components []IDObj `json:"components,omitempty"`
FixVersions []IDObj `json:"fixVersions,omitempty"`
DueDate string `json:"duedate,omitempty"`
Parent *IDObj `json:"parent,omitempty"`
}
CreateIssueFields contains the field values for issue creation.
type CreateIssueRequest ¶
type CreateIssueRequest struct {
Fields CreateIssueFields `json:"fields"`
}
CreateIssueRequest is the payload for creating a new issue.
type CreateIssueResponse ¶
type CreateIssueResponse struct {
ID string `json:"id"`
Key string `json:"key"`
Self string `json:"self"`
}
CreateIssueResponse is the response from creating a new issue.
type CreateProjectRequest ¶
type CreateProjectRequest struct {
Key string `json:"key"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
ProjectTypeKey string `json:"projectTypeKey"`
LeadAccountID string `json:"leadAccountId,omitempty"`
AssigneeType string `json:"assigneeType,omitempty"`
}
CreateProjectRequest is the payload for creating a project.
type CreateSprintRequest ¶
type CreateSprintRequest struct {
Name string `json:"name"`
Goal string `json:"goal,omitempty"`
StartDate string `json:"startDate,omitempty"`
EndDate string `json:"endDate,omitempty"`
OriginBoardID int `json:"originBoardId"`
}
CreateSprintRequest is the payload for creating a sprint.
type EditMeta ¶ added in v1.2.0
type EditMeta struct {
Fields map[string]EditMetaField `json:"fields"`
}
EditMeta is the response from GET /rest/api/2/issue/{issueKey}/editmeta.
type EditMetaAllowedValue ¶ added in v1.2.0
type EditMetaAllowedValue struct {
ID string `json:"id"`
Name string `json:"name"`
Value string `json:"value"`
Description string `json:"description"`
}
EditMetaAllowedValue is one entry in the allowedValues list for a field. Both select-style fields (value) and object-style fields (name, id) are covered by this struct.
type EditMetaField ¶ added in v1.2.0
type EditMetaField struct {
Required bool `json:"required"`
Schema map[string]interface{} `json:"schema"`
Name string `json:"name"`
AllowedValues []EditMetaAllowedValue `json:"allowedValues"`
}
EditMetaField describes a single field as returned by the editmeta endpoint.
type Field ¶
type Field struct {
ID string `json:"id"`
Key string `json:"key"`
Name string `json:"name"`
Custom bool `json:"custom"`
Orderable bool `json:"orderable"`
Searchable bool `json:"searchable"`
}
Field represents a Jira issue field definition.
type FieldContext ¶ added in v1.2.0
type FieldContext struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
IsGlobalContext bool `json:"isGlobalContext"`
IsAnyIssueType bool `json:"isAnyIssueType"`
}
FieldContext represents a custom field context.
type FieldContextOptions ¶ added in v1.2.0
type FieldContextOptions struct {
// IsAnyIssueType filters to contexts that apply to all issue types (true) or a subset (false).
// nil means no filter.
IsAnyIssueType *bool
// IsGlobalContext filters to global contexts (true) or project-scoped (false).
// nil means no filter.
IsGlobalContext *bool
// ContextIDs filters to specific context IDs.
ContextIDs []int
StartAt int
MaxResults int
}
FieldContextOptions configures the context list request.
type FieldContextPage ¶ added in v1.2.0
type FieldContextPage struct {
Total int `json:"total"`
StartAt int `json:"startAt"`
MaxResults int `json:"maxResults"`
IsLast bool `json:"isLast"`
Values []FieldContext `json:"values"`
}
FieldContextPage is the paginated response from GET /rest/api/2/field/{fieldId}/context.
type FieldOption ¶ added in v1.2.0
type FieldOption struct {
ID string `json:"id"`
Value string `json:"value"`
Disabled bool `json:"disabled"`
ContextID string `json:"contextId,omitempty"`
}
FieldOption represents an option (allowed value) for a custom field.
type FieldOptionPage ¶ added in v1.2.0
type FieldOptionPage struct {
Total int `json:"total"`
StartAt int `json:"startAt"`
MaxResults int `json:"maxResults"`
IsLast bool `json:"isLast"`
Values []FieldOption `json:"values"`
}
FieldOptionPage is the paginated response from the field options endpoint.
type FieldSearchOptions ¶ added in v1.2.0
type FieldSearchOptions struct {
// IDs filters to specific field IDs.
IDs []string
// Query filters by name/description substring.
Query string
// Type filters by field type: "system" or "custom".
Type string
// OrderBy orders results: "contextsCount", "lastUsed", "name", "screensCount", "projectsCount".
OrderBy string
// Expand includes additional data: "screensCount", "contextsCount", "lastUsed".
Expand string
// ProjectIDs filters to fields used in these projects.
ProjectIDs []int
StartAt int
MaxResults int
}
FieldSearchOptions configures the paginated field search.
type FieldSearchPage ¶ added in v1.2.0
type FieldSearchPage struct {
Total int `json:"total"`
StartAt int `json:"startAt"`
MaxResults int `json:"maxResults"`
IsLast bool `json:"isLast"`
Values []FieldSearchResult `json:"values"`
}
FieldSearchPage is the paginated response from GET /rest/api/2/field/search.
type FieldSearchResult ¶ added in v1.2.0
type FieldSearchResult struct {
ID string `json:"id"`
Key string `json:"key"`
Name string `json:"name"`
Description string `json:"description"`
Custom bool `json:"custom"`
Searchable bool `json:"searchable"`
Orderable bool `json:"orderable"`
IsLocked bool `json:"isLocked"`
SearcherKey string `json:"searcherKey"`
ScreensCount int `json:"screensCount"`
ContextsCount int `json:"contextsCount"`
ProjectsCount int `json:"projectsCount"`
Schema json.RawMessage `json:"schema"`
}
FieldSearchResult represents an individual field returned by the paginated field search endpoint, which includes additional metadata not available from the simple GET /field endpoint.
type Issue ¶
type Issue struct {
ID string `json:"id"`
Key string `json:"key"`
Self string `json:"self,omitempty"`
Fields IssueFields `json:"fields"`
// Raw stores the original JSON bytes received from the API.
// It is used by --all-fields to output the response without the
// omitempty suppression applied during normal typed marshaling.
Raw json.RawMessage `json:"-"`
}
Issue represents a Jira issue as returned by the API.
func (*Issue) UnmarshalJSON ¶
UnmarshalJSON decodes a Jira issue, capturing the raw bytes alongside the typed fields so that callers can round-trip the original payload when needed.
type IssueFields ¶
type IssueFields struct {
Summary string `json:"summary,omitempty"`
Description ADFString `json:"description,omitempty"`
Status NamedObj `json:"status,omitempty"`
Priority NamedObj `json:"priority,omitempty"`
Assignee *User `json:"assignee,omitempty"`
Reporter *User `json:"reporter,omitempty"`
IssueType NamedObj `json:"issuetype,omitempty"`
Project ProjectShort `json:"project,omitempty"`
Labels []string `json:"labels,omitempty"`
Components []NamedObj `json:"components,omitempty"`
FixVersions []NamedObj `json:"fixVersions,omitempty"`
Created string `json:"created,omitempty"`
Updated string `json:"updated,omitempty"`
DueDate string `json:"duedate,omitempty"`
Votes *Votes `json:"votes,omitempty"`
Watches *Watches `json:"watches,omitempty"`
Comment *CommentList `json:"comment,omitempty"`
TimeTracking *TimeTracking `json:"timetracking,omitempty"`
Parent *IssueRef `json:"parent,omitempty"`
// Extra holds any fields not explicitly modelled above (e.g. customfield_10001).
// Values are stored as raw JSON for lazy decoding; use FormatCustomField to render them.
Extra map[string]json.RawMessage `json:"-"`
}
IssueFields contains the field values of a Jira issue.
func (IssueFields) MarshalJSON ¶
func (f IssueFields) MarshalJSON() ([]byte, error)
MarshalJSON serialises IssueFields including any custom fields stored in Extra, so that --output json round-trips all field data back to the caller. It also manually omits zero-value struct fields (NamedObj, ProjectShort) that encoding/json's omitempty cannot handle — omitempty only suppresses pointers, strings, slices, maps, and numeric types, not struct values.
func (*IssueFields) UnmarshalJSON ¶
func (f *IssueFields) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes the Jira fields object. Known fields are decoded into their typed struct fields; unrecognised fields (e.g. custom fields) are stored verbatim in Extra.
type IssueLinkType ¶
type IssueLinkType struct {
ID string `json:"id"`
Name string `json:"name"`
Inward string `json:"inward"`
Outward string `json:"outward"`
}
IssueLinkType describes the type of an issue link.
type IssueLinkTypeList ¶
type IssueLinkTypeList struct {
IssueLinkTypes []IssueLinkType `json:"issueLinkTypes"`
}
IssueLinkTypeList is a list of issue link types.
type IssueType ¶
type IssueType struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Subtask bool `json:"subtask"`
}
IssueType represents a Jira issue type.
type NamedObj ¶
type NamedObj struct {
ID string `json:"id,omitempty"`
Name string `json:"name"`
Self string `json:"self,omitempty"`
}
NamedObj is a simple name-only sub-object used throughout the Jira API.
type Priority ¶
type Priority struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
}
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"`
Description string `json:"description"`
Lead *User `json:"lead"`
ProjectType string `json:"projectTypeKey"`
Style string `json:"style"`
IsPrivate bool `json:"isPrivate"`
}
Project represents a Jira project.
type ProjectIssueTypeStatuses ¶ added in v1.2.0
type ProjectIssueTypeStatuses struct {
ID string `json:"id"`
Name string `json:"name"`
Subtask bool `json:"subtask"`
Statuses []Status `json:"statuses"`
}
ProjectIssueTypeStatuses groups the workflow statuses available for one issue type within a project.
type ProjectShort ¶
type ProjectShort struct {
ID string `json:"id,omitempty"`
Key string `json:"key,omitempty"`
Name string `json:"name,omitempty"`
}
ProjectShort is a minimal project representation.
type Resolution ¶ added in v1.2.0
type Resolution struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
}
Resolution represents a Jira issue resolution.
type SearchOptions ¶
SearchOptions configures a JQL search.
type SearchResult ¶
type SearchResult struct {
Total int `json:"total"`
StartAt int `json:"startAt"`
MaxResults int `json:"maxResults"`
Issues []Issue `json:"issues"`
}
SearchResult is the response from the search endpoint.
type ServerInfo ¶ added in v1.2.0
type ServerInfo struct {
BaseURL string `json:"baseUrl"`
Version string `json:"version"`
DeploymentType string `json:"deploymentType"`
BuildNumber int `json:"buildNumber"`
BuildDate string `json:"buildDate"`
ServerTime string `json:"serverTime"`
ScmInfo string `json:"scmInfo"`
ServerTitle string `json:"serverTitle"`
}
ServerInfo contains build and runtime information about the Jira instance.
type Sprint ¶
type Sprint struct {
ID int `json:"id"`
Name string `json:"name"`
State string `json:"state"`
StartDate string `json:"startDate"`
EndDate string `json:"endDate"`
CompleteDate string `json:"completeDate"`
Goal string `json:"goal"`
OriginBoardID int `json:"originBoardId"`
}
Sprint represents a Jira Agile sprint.
type SprintList ¶
type SprintList struct {
MaxResults int `json:"maxResults"`
StartAt int `json:"startAt"`
Total int `json:"total"`
IsLast bool `json:"isLast"`
Values []Sprint `json:"values"`
}
SprintList is a paginated list of sprints.
type Status ¶
type Status struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Category StatusCategory `json:"statusCategory"`
}
Status represents a Jira issue status.
type StatusCategory ¶ added in v1.2.0
StatusCategory is the category of a Jira status. Its id field is a number in the REST API response (unlike most other id fields which are strings).
type TimeTracking ¶
type TimeTracking struct {
OriginalEstimate string `json:"originalEstimate,omitempty"`
RemainingEstimate string `json:"remainingEstimate,omitempty"`
TimeSpent string `json:"timeSpent,omitempty"`
OriginalEstimateSeconds int `json:"originalEstimateSeconds,omitempty"`
RemainingEstimateSeconds int `json:"remainingEstimateSeconds,omitempty"`
TimeSpentSeconds int `json:"timeSpentSeconds,omitempty"`
}
TimeTracking holds time estimate information.
type TimeTrackingConfiguration ¶ added in v1.2.0
type TimeTrackingConfiguration struct {
WorkingHoursPerDay float64 `json:"workingHoursPerDay"`
WorkingDaysPerWeek float64 `json:"workingDaysPerWeek"`
TimeFormat string `json:"timeFormat"`
DefaultUnit string `json:"defaultUnit"`
}
TimeTrackingConfiguration holds time-tracking settings.
type Transition ¶
Transition represents a Jira workflow transition.
type TransitionList ¶
type TransitionList struct {
Transitions []Transition `json:"transitions"`
}
TransitionList is the list of available transitions for an issue.
type UpdateIssueRequest ¶
type UpdateIssueRequest struct {
Fields map[string]interface{} `json:"fields"`
}
UpdateIssueRequest is the payload for updating an existing issue.
type User ¶
type User struct {
AccountID string `json:"accountId,omitempty"`
Name string `json:"name,omitempty"`
DisplayName string `json:"displayName,omitempty"`
EmailAddress string `json:"emailAddress,omitempty"`
Active bool `json:"active"`
Self string `json:"self,omitempty"`
}
User represents a Jira user.
type Version ¶
type Version struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Released bool `json:"released"`
Archived bool `json:"archived"`
ReleaseDate string `json:"releaseDate"`
ProjectID int `json:"projectId"`
}
Version represents a Jira project version (release).
type WatcherList ¶
type WatcherList struct {
Self string `json:"self"`
WatchCount int `json:"watchCount"`
IsWatching bool `json:"isWatching"`
Watchers []User `json:"watchers"`
}
WatcherList holds watcher information for an issue.
type Worklog ¶
type Worklog struct {
ID string `json:"id"`
Self string `json:"self"`
Author *User `json:"author"`
Comment ADFString `json:"comment"`
Started string `json:"started"`
TimeSpent string `json:"timeSpent"`
TimeSpentSeconds int `json:"timeSpentSeconds"`
}
Worklog represents a Jira worklog entry.