jira

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AtlassianTime

type AtlassianTime struct {
	time.Time
}

AtlassianTime is a custom time type that handles multiple timestamp formats from Atlassian APIs

func (AtlassianTime) IsZero

func (at AtlassianTime) IsZero() bool

IsZero returns true if the time is the zero value

func (AtlassianTime) MarshalJSON

func (at AtlassianTime) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface

func (AtlassianTime) String

func (at AtlassianTime) String() string

String returns the string representation of the time

func (*AtlassianTime) UnmarshalJSON

func (at *AtlassianTime) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler interface

type Attachment

type Attachment struct {
	ID        string        `json:"id"`
	Self      string        `json:"self,omitempty"`
	Filename  string        `json:"filename"`
	Author    *User         `json:"author,omitempty"`
	Created   AtlassianTime `json:"created,omitempty"`
	Size      int64         `json:"size,omitempty"`
	MimeType  string        `json:"mimeType,omitempty"`
	Content   string        `json:"content,omitempty"`
	Thumbnail string        `json:"thumbnail,omitempty"`
}

Attachment represents an issue attachment

type AvatarUrls

type AvatarUrls struct {
	Size48 string `json:"48x48,omitempty"`
	Size24 string `json:"24x24,omitempty"`
	Size16 string `json:"16x16,omitempty"`
	Size32 string `json:"32x32,omitempty"`
}

AvatarUrls represents avatar URLs

type BatchCreateIssuesRequest

type BatchCreateIssuesRequest struct {
	IssueUpdates []CreateIssueRequest `json:"issueUpdates"`
}

BatchCreateIssuesRequest represents a batch create request

type BatchCreateIssuesResponse

type BatchCreateIssuesResponse struct {
	Issues []Issue      `json:"issues,omitempty"`
	Errors []BatchError `json:"errors,omitempty"`
}

BatchCreateIssuesResponse represents a batch create response

type BatchError

type BatchError struct {
	Status        int            `json:"status,omitempty"`
	ElementErrors *ErrorResponse `json:"elementErrors,omitempty"`
	FailedElement int            `json:"failedElementNumber,omitempty"`
}

BatchError represents an error in a batch operation

type Board

type Board struct {
	ID       int       `json:"id"`
	Self     string    `json:"self,omitempty"`
	Name     string    `json:"name"`
	Type     string    `json:"type"` // scrum, kanban, simple
	Location *Location `json:"location,omitempty"`
}

Board represents an agile board

type Changelog

type Changelog struct {
	ID      string          `json:"id"`
	Author  *User           `json:"author,omitempty"`
	Created AtlassianTime   `json:"created"`
	Items   []ChangelogItem `json:"items"`
}

Changelog represents issue changelog

type ChangelogItem

type ChangelogItem struct {
	Field      string `json:"field"`
	FieldType  string `json:"fieldtype"`
	From       string `json:"from,omitempty"`
	FromString string `json:"fromString,omitempty"`
	To         string `json:"to,omitempty"`
	ToString   string `json:"toString,omitempty"`
}

ChangelogItem represents a single changelog item

type Client

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

Client is a Jira API client

func NewClient

func NewClient(cfg *Config) (*Client, error)

NewClient creates a new Jira client

func (*Client) AddAttachment

func (c *Client) AddAttachment(ctx context.Context, issueKey string, filename string, content []byte) (*Attachment, error)

AddAttachment adds an attachment to an issue

func (*Client) AddComment

func (c *Client) AddComment(ctx context.Context, issueKey string, body string, visibility *Visibility) (*Comment, error)

AddComment adds a comment to an issue

func (*Client) AddWorklog

func (c *Client) AddWorklog(ctx context.Context, issueKey string, req *CreateWorklogRequest) (*Worklog, error)

AddWorklog adds a worklog entry to an issue

func (*Client) ArchiveVersion

func (c *Client) ArchiveVersion(ctx context.Context, versionID string) (*Version, error)

ArchiveVersion marks a version as archived

func (*Client) AssignIssue

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

AssignIssue assigns an issue to a user

func (*Client) BatchCreateIssues

func (c *Client) BatchCreateIssues(ctx context.Context, issuesFields []map[string]interface{}) (*BatchCreateIssuesResponse, error)

BatchCreateIssues creates multiple issues in a single request

func (*Client) BatchCreateVersions

func (c *Client) BatchCreateVersions(ctx context.Context, versions []*CreateVersionRequest) ([]Version, error)

BatchCreateVersions creates multiple versions in a single request

func (*Client) BatchGetChangelogs

func (c *Client) BatchGetChangelogs(ctx context.Context, issueKeys []string) (map[string][]Changelog, error)

BatchGetChangelogs retrieves changelogs for multiple issues (Cloud only)

func (*Client) CloseSprint

func (c *Client) CloseSprint(ctx context.Context, sprintID int) (*Sprint, error)

CloseSprint closes a sprint

func (*Client) CreateIssue

func (c *Client) CreateIssue(ctx context.Context, fields map[string]interface{}) (*Issue, error)

CreateIssue creates a new issue

func (c *Client) CreateIssueLink(ctx context.Context, linkType IssueLinkType, inwardIssue, outwardIssue string, comment *Comment) (*IssueLink, error)

CreateIssueLink creates a link between two issues

func (*Client) CreateIssueLinkByName

func (c *Client) CreateIssueLinkByName(ctx context.Context, linkTypeName, inwardIssue, outwardIssue string, comment *Comment) (*IssueLink, error)

CreateIssueLinkByName creates a link using the link type name

func (c *Client) CreateRemoteLink(ctx context.Context, issueKey string, link *RemoteLink) (*RemoteLink, error)

CreateRemoteLink creates a remote link to an issue

func (*Client) CreateSprint

func (c *Client) CreateSprint(ctx context.Context, req *CreateSprintRequest) (*Sprint, error)

CreateSprint creates a new sprint

func (*Client) CreateVersion

func (c *Client) CreateVersion(ctx context.Context, req *CreateVersionRequest) (*Version, error)

CreateVersion creates a new version

func (*Client) DeleteAttachment

func (c *Client) DeleteAttachment(ctx context.Context, attachmentID string) error

DeleteAttachment deletes an attachment

func (*Client) DeleteComment

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

DeleteComment deletes a comment

func (*Client) DeleteIssue

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

DeleteIssue deletes an issue

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

DeleteIssueLink deletes an issue link

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

DeleteRemoteLink deletes a remote link

func (*Client) DeleteSprint

func (c *Client) DeleteSprint(ctx context.Context, sprintID int) error

DeleteSprint deletes a sprint

func (*Client) DeleteVersion

func (c *Client) DeleteVersion(ctx context.Context, versionID string, moveFixIssuesTo, moveAffectedIssuesTo string) error

DeleteVersion deletes a version

func (*Client) DeleteWorklog

func (c *Client) DeleteWorklog(ctx context.Context, issueKey string, worklogID string) error

DeleteWorklog deletes a worklog

func (*Client) DownloadAttachment

func (c *Client) DownloadAttachment(ctx context.Context, attachmentURL string) ([]byte, error)

DownloadAttachment downloads an attachment

func (*Client) DownloadAttachmentContent

func (c *Client) DownloadAttachmentContent(ctx context.Context, attachment *Attachment) ([]byte, error)

DownloadAttachmentContent downloads the content of an attachment

func (*Client) FindAssignableUsers

func (c *Client) FindAssignableUsers(ctx context.Context, project, issueKey, query string, maxResults int) ([]User, error)

FindAssignableUsers searches for users that can be assigned to issues

func (*Client) GetAllFields

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

GetAllFields retrieves all fields (standard and custom)

func (*Client) GetAllProjects

func (c *Client) GetAllProjects(ctx context.Context, opts *GetProjectsOptions) ([]Project, error)

GetAllProjects retrieves all accessible projects

func (*Client) GetAttachment

func (c *Client) GetAttachment(ctx context.Context, attachmentID string) (*Attachment, error)

GetAttachment retrieves a specific attachment by ID

func (*Client) GetAttachmentMetadata

func (c *Client) GetAttachmentMetadata(ctx context.Context, attachmentID string) (*Attachment, error)

GetAttachmentMetadata retrieves metadata for an attachment

func (*Client) GetAttachments

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

GetAttachments retrieves all attachments for an issue

func (*Client) GetBacklogIssues

func (c *Client) GetBacklogIssues(ctx context.Context, boardID int, opts *SearchOptions) (*SearchResult, error)

GetBacklogIssues retrieves backlog issues for a board

func (*Client) GetBoard

func (c *Client) GetBoard(ctx context.Context, boardID int) (*Board, error)

GetBoard retrieves a specific board by ID

func (*Client) GetBoardIssues

func (c *Client) GetBoardIssues(ctx context.Context, boardID int, opts *SearchOptions) (*SearchResult, error)

GetBoardIssues retrieves issues for a board

func (*Client) GetBoardSprints

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

GetBoardSprints retrieves sprints for a board

func (*Client) GetBoards

func (c *Client) GetBoards(ctx context.Context, opts *GetBoardsOptions) ([]Board, error)

GetBoards retrieves all boards

func (*Client) GetChangelogs

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

GetChangelogs retrieves the changelog for an issue

func (*Client) GetComment

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

GetComment retrieves a specific comment by ID

func (*Client) GetComments

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

GetComments retrieves all comments for an issue

func (*Client) GetCurrentUser

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

GetCurrentUser retrieves the currently authenticated user

func (*Client) GetCustomFields

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

GetCustomFields retrieves only custom fields

func (*Client) GetDeploymentType

func (c *Client) GetDeploymentType() DeploymentType

GetDeploymentType returns the deployment type

func (*Client) GetEpicLinkField

func (c *Client) GetEpicLinkField(ctx context.Context) (*Field, error)

GetEpicLinkField attempts to find the Epic Link field

func (*Client) GetEssentialFields

func (c *Client) GetEssentialFields() []string

GetEssentialFields returns a list of essential field IDs

func (*Client) GetFieldByKey

func (c *Client) GetFieldByKey(ctx context.Context, key string) (*Field, error)

GetFieldByKey retrieves a field by its key or ID

func (*Client) GetFieldByName

func (c *Client) GetFieldByName(ctx context.Context, name string) (*Field, error)

GetFieldByName retrieves a field by its exact name

func (*Client) GetIssue

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

GetIssue retrieves an issue by key or ID

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

GetIssueLink retrieves an issue link by ID

func (*Client) GetIssueLinkTypes

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

GetIssueLinkTypes retrieves all available issue link types

func (*Client) GetProject

func (c *Client) GetProject(ctx context.Context, projectKey string, expand []string) (*Project, error)

GetProject retrieves a project by key or ID

func (*Client) GetProjectComponents

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

GetProjectComponents retrieves all components for a project

func (*Client) GetProjectIssueTypes

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

GetProjectIssueTypes retrieves all issue types for a project

func (*Client) GetProjectIssues

func (c *Client) GetProjectIssues(ctx context.Context, projectKey string, opts *SearchOptions) (*SearchResult, error)

GetProjectIssues retrieves all issues for a project

func (*Client) GetProjectVersions

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

GetProjectVersions retrieves all versions for a project

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

GetRemoteLinks retrieves all remote links for an issue

func (*Client) GetSprint

func (c *Client) GetSprint(ctx context.Context, sprintID int) (*Sprint, error)

GetSprint retrieves a specific sprint by ID

func (*Client) GetSprintIssues

func (c *Client) GetSprintIssues(ctx context.Context, sprintID int, opts *SearchOptions) (*SearchResult, error)

GetSprintIssues retrieves issues for a sprint

func (*Client) GetStoryPointsField

func (c *Client) GetStoryPointsField(ctx context.Context) (*Field, error)

GetStoryPointsField attempts to find the Story Points field

func (*Client) GetTransitionByName

func (c *Client) GetTransitionByName(ctx context.Context, issueKey string, transitionName string) (*Transition, error)

GetTransitionByName retrieves a specific transition by name

func (*Client) GetTransitions

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

GetTransitions retrieves available transitions for an issue

func (*Client) GetUser

func (c *Client) GetUser(ctx context.Context, accountIDOrUsername string) (*User, error)

GetUser retrieves a user by account ID (Cloud) or username (Server/DC)

func (*Client) GetUserGroups

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

GetUserGroups retrieves groups for a user

func (*Client) GetVersion

func (c *Client) GetVersion(ctx context.Context, versionID string) (*Version, error)

GetVersion retrieves a version by ID

func (*Client) GetWorklog

func (c *Client) GetWorklog(ctx context.Context, issueKey string, worklogID string) (*Worklog, error)

GetWorklog retrieves a specific worklog by ID

func (*Client) GetWorklogs

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

GetWorklogs retrieves all worklogs for an issue

func (*Client) IsCloud

func (c *Client) IsCloud() bool

IsCloud returns true if the Jira instance is Cloud

func (*Client) IsServer

func (c *Client) IsServer() bool

IsServer returns true if the Jira instance is Server/Data Center

func (*Client) LinkToEpic

func (c *Client) LinkToEpic(ctx context.Context, issueKey, epicKey string) error

LinkToEpic links an issue to an epic

func (*Client) MoveIssuesToSprint

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

MoveIssuesToSprint moves issues to a sprint

func (*Client) ParseFieldList

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

ParseFieldList parses a field list string and returns the appropriate fields "*all" returns all fields, otherwise returns the specified fields

func (*Client) ReleaseVersion

func (c *Client) ReleaseVersion(ctx context.Context, versionID string, releaseDate string) (*Version, error)

ReleaseVersion marks a version as released

func (*Client) SearchFields

func (c *Client) SearchFields(ctx context.Context, query string) ([]Field, error)

SearchFields searches for fields by name or key (fuzzy search)

func (*Client) SearchIssues

func (c *Client) SearchIssues(ctx context.Context, jql string, opts *SearchOptions) (*SearchResult, error)

SearchIssues searches for issues using JQL

func (*Client) SearchProjects

func (c *Client) SearchProjects(ctx context.Context, query string, maxResults int) ([]Project, error)

SearchProjects searches for projects using a query string

func (*Client) SearchUsers

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

SearchUsers searches for users

func (*Client) StartSprint

func (c *Client) StartSprint(ctx context.Context, sprintID int) (*Sprint, error)

StartSprint starts a sprint

func (*Client) TransitionIssue

func (c *Client) TransitionIssue(ctx context.Context, issueKey string, transitionID string, fields map[string]interface{}) error

TransitionIssue transitions an issue to a new status

func (*Client) TransitionIssueByName

func (c *Client) TransitionIssueByName(ctx context.Context, issueKey string, transitionName string, fields map[string]interface{}) error

TransitionIssueByName transitions an issue using the transition name instead of ID

func (*Client) UpdateComment

func (c *Client) UpdateComment(ctx context.Context, issueKey string, commentID string, body string, visibility *Visibility) (*Comment, error)

UpdateComment updates an existing comment

func (*Client) UpdateIssue

func (c *Client) UpdateIssue(ctx context.Context, issueKey string, fields map[string]interface{}, update map[string]interface{}) error

UpdateIssue updates an issue

func (*Client) UpdateSprint

func (c *Client) UpdateSprint(ctx context.Context, sprintID int, req *UpdateSprintRequest) (*Sprint, error)

UpdateSprint updates an existing sprint

func (*Client) UpdateVersion

func (c *Client) UpdateVersion(ctx context.Context, versionID string, req *CreateVersionRequest) (*Version, error)

UpdateVersion updates an existing version

func (*Client) UpdateWorklog

func (c *Client) UpdateWorklog(ctx context.Context, issueKey string, worklogID string, req *CreateWorklogRequest) (*Worklog, error)

UpdateWorklog updates an existing worklog

func (*Client) UploadAttachment

func (c *Client) UploadAttachment(ctx context.Context, issueKey string, filename string, content io.Reader) (*Attachment, error)

UploadAttachment uploads a file attachment to an issue

type Comment

type Comment struct {
	ID           string        `json:"id"`
	Self         string        `json:"self,omitempty"`
	Author       *User         `json:"author,omitempty"`
	Body         string        `json:"body"`
	UpdateAuthor *User         `json:"updateAuthor,omitempty"`
	Created      AtlassianTime `json:"created,omitempty"`
	Updated      AtlassianTime `json:"updated,omitempty"`
	Visibility   *Visibility   `json:"visibility,omitempty"`
}

Comment represents an issue comment

type Comments

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

Comments represents a list of comments

type Component

type Component struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	Self        string `json:"self,omitempty"`
	Lead        *User  `json:"lead,omitempty"`
}

Component represents a project component

type Config

type Config struct {
	BaseURL       string
	Auth          auth.Provider
	CustomHeaders map[string]string
	SSLVerify     bool
	HTTPProxy     string
	HTTPSProxy    string
	SOCKSProxy    string
	NoProxy       string
}

Config holds the configuration for creating a Jira client

type CreateCommentRequest

type CreateCommentRequest struct {
	Body       string      `json:"body"`
	Visibility *Visibility `json:"visibility,omitempty"`
}

CreateCommentRequest represents a request to add a comment

type CreateIssueLinkRequest

type CreateIssueLinkRequest struct {
	Type         IssueLinkType `json:"type"`
	InwardIssue  LinkIssueRef  `json:"inwardIssue"`
	OutwardIssue LinkIssueRef  `json:"outwardIssue"`
	Comment      *Comment      `json:"comment,omitempty"`
}

CreateIssueLinkRequest represents a request to create an issue link

type CreateIssueRequest

type CreateIssueRequest struct {
	Fields map[string]interface{} `json:"fields"`
}

CreateIssueRequest represents a request to create an issue

type CreateSprintRequest

type CreateSprintRequest struct {
	Name          string `json:"name"`
	StartDate     string `json:"startDate,omitempty"`
	EndDate       string `json:"endDate,omitempty"`
	OriginBoardID int    `json:"originBoardId"`
	Goal          string `json:"goal,omitempty"`
}

CreateSprintRequest represents a request to create a sprint

type CreateVersionRequest

type CreateVersionRequest struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	ProjectID   int    `json:"projectId,omitempty"`
	Project     string `json:"project,omitempty"`
	ReleaseDate string `json:"releaseDate,omitempty"`
	Released    bool   `json:"released,omitempty"`
	Archived    bool   `json:"archived,omitempty"`
}

CreateVersionRequest represents a request to create a version

type CreateWorklogRequest

type CreateWorklogRequest struct {
	Comment          string      `json:"comment,omitempty"`
	Started          string      `json:"started"`
	TimeSpentSeconds int         `json:"timeSpentSeconds"`
	Visibility       *Visibility `json:"visibility,omitempty"`
}

CreateWorklogRequest represents a request to add a worklog

type DeploymentType

type DeploymentType string

DeploymentType represents the Jira deployment type

const (
	DeploymentCloud  DeploymentType = "cloud"
	DeploymentServer DeploymentType = "server"
)

type Description

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

Description represents a Jira description field that can be either plain text or ADF format.

Jira returns descriptions in different formats depending on the instance configuration:

  • Plain text: Older instances or when text-only format is configured
  • Atlassian Document Format (ADF): Modern Cloud instances and newer Server/DC versions

This type automatically detects the format during JSON unmarshaling and provides convenient methods to access the content:

  • String() returns the plain text representation (extracted from ADF if needed)
  • IsADF() returns true if the description is in ADF format
  • Raw() returns the raw JSON for advanced use cases

Example usage:

issue, err := client.GetIssue(ctx, "PROJ-123", nil)
if err != nil {
    return err
}
if issue.Fields.Description != nil {
    fmt.Println("Description:", issue.Fields.Description.String())
    if issue.Fields.Description.IsADF() {
        fmt.Println("(ADF format)")
    }
}

When creating or updating issues, pass description as a plain string in the fields map:

fields := map[string]interface{}{
    "description": "This is a plain text description",
    // ... other fields
}
Example (AdfFormat)

Example showing how to use the Description type with ADF format

jsonData := `{
		"summary": "Feature request",
		"description": {
			"version": 1,
			"type": "doc",
			"content": [
				{
					"type": "paragraph",
					"content": [
						{
							"type": "text",
							"text": "Add support for "
						},
						{
							"type": "text",
							"text": "OAuth 2.0",
							"marks": [
								{
									"type": "strong"
								}
							]
						}
					]
				},
				{
					"type": "paragraph",
					"content": [
						{
							"type": "text",
							"text": "This will improve security."
						}
					]
				}
			]
		}
	}`

var fields IssueFields
err := json.Unmarshal([]byte(jsonData), &fields)
if err != nil {
	panic(err)
}

fmt.Println("Summary:", fields.Summary)
if fields.Description != nil {
	fmt.Println("Description:", fields.Description.String())
	fmt.Println("Is ADF:", fields.Description.IsADF())
}
Output:
Summary: Feature request
Description: Add support for  OAuth 2.0
This will improve security.
Is ADF: true
Example (PlainText)

Example showing how to use the Description type with plain text

jsonData := `{
		"summary": "Bug in authentication",
		"description": "User cannot login after password reset"
	}`

var fields IssueFields
err := json.Unmarshal([]byte(jsonData), &fields)
if err != nil {
	panic(err)
}

fmt.Println("Summary:", fields.Summary)
if fields.Description != nil {
	fmt.Println("Description:", fields.Description.String())
	fmt.Println("Is ADF:", fields.Description.IsADF())
}
Output:
Summary: Bug in authentication
Description: User cannot login after password reset
Is ADF: false

func (*Description) IsADF

func (d *Description) IsADF() bool

IsADF returns true if the description is in ADF format

func (Description) MarshalJSON

func (d Description) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface

func (*Description) Raw

func (d *Description) Raw() json.RawMessage

Raw returns the raw JSON representation

func (*Description) String

func (d *Description) String() string

String returns the plain text representation of the description

func (*Description) UnmarshalJSON

func (d *Description) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler interface to handle both plain text and ADF format

type ErrorResponse

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

ErrorResponse represents a Jira error response

type Field

type Field struct {
	ID          string       `json:"id"`
	Key         string       `json:"key,omitempty"`
	Name        string       `json:"name"`
	Custom      bool         `json:"custom"`
	Orderable   bool         `json:"orderable,omitempty"`
	Navigable   bool         `json:"navigable,omitempty"`
	Searchable  bool         `json:"searchable,omitempty"`
	ClauseNames []string     `json:"clauseNames,omitempty"`
	Schema      *FieldSchema `json:"schema,omitempty"`
}

Field represents a Jira field (standard or custom)

type FieldMeta

type FieldMeta struct {
	Required bool   `json:"required"`
	Schema   Schema `json:"schema,omitempty"`
	Name     string `json:"name,omitempty"`
}

FieldMeta represents metadata about a field in a transition

type FieldSchema

type FieldSchema struct {
	Type     string `json:"type"`
	Items    string `json:"items,omitempty"`
	System   string `json:"system,omitempty"`
	Custom   string `json:"custom,omitempty"`
	CustomID int    `json:"customId,omitempty"`
}

FieldSchema represents the schema of a field

type GetBoardsOptions

type GetBoardsOptions struct {
	ProjectKeyOrID string
	BoardType      string // scrum, kanban, simple
	Name           string
	StartAt        int
	MaxResults     int
}

GetBoardsOptions contains options for getting boards

type GetIssueOptions

type GetIssueOptions struct {
	Fields     []string // Specific fields to retrieve, or "*all" for all fields
	Expand     []string // Resources to expand (e.g., "changelog", "renderedFields")
	Properties []string // Properties to retrieve
}

GetIssueOptions contains options for getting an issue

type GetProjectsOptions

type GetProjectsOptions struct {
	Expand     []string // Resources to expand (e.g., "description", "lead", "issueTypes")
	Recent     int      // Number of recent projects to return
	Properties []string // Project properties to return
}

GetProjectsOptions contains options for listing projects

type Issue

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

Issue represents a Jira issue

type IssueFields

type IssueFields struct {
	Summary     string        `json:"summary,omitempty"`
	Description *Description  `json:"description,omitempty"`
	IssueType   *IssueType    `json:"issuetype,omitempty"`
	Project     *Project      `json:"project,omitempty"`
	Reporter    *User         `json:"reporter,omitempty"`
	Assignee    *User         `json:"assignee,omitempty"`
	Priority    *Priority     `json:"priority,omitempty"`
	Status      *Status       `json:"status,omitempty"`
	Resolution  *Resolution   `json:"resolution,omitempty"`
	Labels      []string      `json:"labels,omitempty"`
	Components  []Component   `json:"components,omitempty"`
	FixVersions []Version     `json:"fixVersions,omitempty"`
	Versions    []Version     `json:"versions,omitempty"`
	Created     AtlassianTime `json:"created,omitempty"`
	Updated     AtlassianTime `json:"updated,omitempty"`
	DueDate     *string       `json:"duedate,omitempty"`
	Parent      *IssueParent  `json:"parent,omitempty"`
	Subtasks    []Issue       `json:"subtasks,omitempty"`
	IssueLinks  []IssueLink   `json:"issuelinks,omitempty"`
	Attachment  []Attachment  `json:"attachment,omitempty"`
	Comment     *Comments     `json:"comment,omitempty"`
	Worklog     *Worklogs     `json:"worklog,omitempty"`

	// Custom fields stored as raw JSON
	Unknowns map[string]interface{} `json:"-"`
}

IssueFields represents all possible fields in a Jira issue

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

IssueLink represents a link between issues

type IssueLinkType

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

IssueLinkType represents the type of link between issues

type IssueParent

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

IssueParent represents the parent of a subtask

type IssueType

type IssueType struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	Self        string `json:"self,omitempty"`
	IconURL     string `json:"iconUrl,omitempty"`
	Subtask     bool   `json:"subtask,omitempty"`
}

IssueType represents a Jira issue type

type LinkApplication

type LinkApplication struct {
	Type string `json:"type"`
	Name string `json:"name"`
}

LinkApplication represents the application in a remote link

type LinkIcon

type LinkIcon struct {
	URL16x16 string `json:"url16x16,omitempty"`
	Title    string `json:"title,omitempty"`
}

LinkIcon represents an icon in a remote link

type LinkIssueRef

type LinkIssueRef struct {
	Key string `json:"key,omitempty"`
	ID  string `json:"id,omitempty"`
}

LinkIssueRef represents an issue reference in a link request

type LinkObject

type LinkObject struct {
	URL     string      `json:"url"`
	Title   string      `json:"title"`
	Summary string      `json:"summary,omitempty"`
	Icon    *LinkIcon   `json:"icon,omitempty"`
	Status  *LinkStatus `json:"status,omitempty"`
}

LinkObject represents the object in a remote link

type LinkStatus

type LinkStatus struct {
	Resolved bool      `json:"resolved,omitempty"`
	Icon     *LinkIcon `json:"icon,omitempty"`
}

LinkStatus represents status in a remote link

type LinkedIssue

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

LinkedIssue represents a linked issue

type Location

type Location struct {
	ProjectID   int    `json:"projectId,omitempty"`
	DisplayName string `json:"displayName,omitempty"`
	ProjectName string `json:"projectName,omitempty"`
	ProjectKey  string `json:"projectKey,omitempty"`
	ProjectType string `json:"projectTypeKey,omitempty"`
	AvatarURI   string `json:"avatarURI,omitempty"`
	Name        string `json:"name,omitempty"`
}

Location represents a board location

type Priority

type Priority struct {
	ID      string `json:"id"`
	Name    string `json:"name"`
	Self    string `json:"self,omitempty"`
	IconURL string `json:"iconUrl,omitempty"`
}

Priority represents issue priority

type Project

type Project struct {
	ID              string           `json:"id"`
	Key             string           `json:"key"`
	Name            string           `json:"name"`
	Self            string           `json:"self,omitempty"`
	ProjectTypeKey  string           `json:"projectTypeKey,omitempty"`
	AvatarUrls      *AvatarUrls      `json:"avatarUrls,omitempty"`
	Lead            *User            `json:"lead,omitempty"`
	Description     string           `json:"description,omitempty"`
	URL             string           `json:"url,omitempty"`
	IssueTypes      []IssueType      `json:"issueTypes,omitempty"`
	ProjectCategory *ProjectCategory `json:"projectCategory,omitempty"`
	Versions        []Version        `json:"versions,omitempty"`
	Components      []Component      `json:"components,omitempty"`
}

Project represents a Jira project

type ProjectCategory

type ProjectCategory struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	Self        string `json:"self,omitempty"`
}

ProjectCategory represents a project category

type RemoteLink struct {
	ID           string           `json:"id,omitempty"`
	Self         string           `json:"self,omitempty"`
	GlobalID     string           `json:"globalId,omitempty"`
	Application  *LinkApplication `json:"application,omitempty"`
	Relationship string           `json:"relationship,omitempty"`
	Object       *LinkObject      `json:"object,omitempty"`
}

RemoteLink represents a remote issue link

type Resolution

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

Resolution represents issue resolution

type Schema

type Schema struct {
	Type   string `json:"type"`
	System string `json:"system,omitempty"`
}

Schema represents a field schema

type SearchOptions

type SearchOptions struct {
	Fields        []string // Specific fields to retrieve
	Expand        []string // Resources to expand
	StartAt       int      // Index of the first issue to return (0-based)
	MaxResults    int      // Maximum number of issues to return (default 50, max 100 for Cloud, 1000 for Server)
	ValidateQuery bool     // Whether to validate the JQL query
}

SearchOptions contains options for searching issues

type SearchResult

type SearchResult struct {
	Expand     string  `json:"expand,omitempty"`
	StartAt    int     `json:"startAt"`
	MaxResults int     `json:"maxResults"`
	Total      int     `json:"total"`
	Issues     []Issue `json:"issues"`
}

SearchResult represents the result of a JQL search

type Sprint

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

Sprint represents a sprint

type Status

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

Status represents issue status

type StatusCategory

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

StatusCategory represents a status category

type Transition

type Transition struct {
	ID     string               `json:"id"`
	Name   string               `json:"name"`
	To     Status               `json:"to"`
	Fields map[string]FieldMeta `json:"fields,omitempty"`
}

Transition represents a status transition

type TransitionRequest

type TransitionRequest struct {
	Transition Transition             `json:"transition"`
	Fields     map[string]interface{} `json:"fields,omitempty"`
}

TransitionRequest represents a request to transition an issue

type TransitionsResponse

type TransitionsResponse struct {
	Expand      string       `json:"expand,omitempty"`
	Transitions []Transition `json:"transitions"`
}

TransitionsResponse represents the response from getting transitions

type UpdateIssueRequest

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

UpdateIssueRequest represents a request to update an issue

type UpdateSprintRequest

type UpdateSprintRequest struct {
	Name         string `json:"name,omitempty"`
	StartDate    string `json:"startDate,omitempty"`
	EndDate      string `json:"endDate,omitempty"`
	State        string `json:"state,omitempty"`
	Goal         string `json:"goal,omitempty"`
	CompleteDate string `json:"completeDate,omitempty"`
}

UpdateSprintRequest represents a request to update a sprint

type User

type User struct {
	Self         string      `json:"self,omitempty"`
	AccountID    string      `json:"accountId,omitempty"` // Cloud
	Name         string      `json:"name,omitempty"`      // Server/DC
	Key          string      `json:"key,omitempty"`       // Server/DC
	EmailAddress string      `json:"emailAddress,omitempty"`
	DisplayName  string      `json:"displayName,omitempty"`
	Active       bool        `json:"active,omitempty"`
	TimeZone     string      `json:"timeZone,omitempty"`
	AvatarUrls   *AvatarUrls `json:"avatarUrls,omitempty"`
}

User represents a Jira user

type Version

type Version struct {
	ID          string         `json:"id"`
	Name        string         `json:"name"`
	Description string         `json:"description,omitempty"`
	Self        string         `json:"self,omitempty"`
	Archived    bool           `json:"archived,omitempty"`
	Released    bool           `json:"released,omitempty"`
	ReleaseDate *AtlassianTime `json:"releaseDate,omitempty"`
	ProjectID   int            `json:"projectId,omitempty"`
}

Version represents a project version

type Visibility

type Visibility struct {
	Type  string `json:"type"`  // "group" or "role"
	Value string `json:"value"` // group name or role name
}

Visibility represents comment/worklog visibility

type Worklog

type Worklog struct {
	ID               string        `json:"id"`
	Self             string        `json:"self,omitempty"`
	Author           *User         `json:"author,omitempty"`
	UpdateAuthor     *User         `json:"updateAuthor,omitempty"`
	Comment          string        `json:"comment,omitempty"`
	Created          AtlassianTime `json:"created,omitempty"`
	Updated          AtlassianTime `json:"updated,omitempty"`
	Started          AtlassianTime `json:"started"`
	TimeSpent        string        `json:"timeSpent"`
	TimeSpentSeconds int           `json:"timeSpentSeconds"`
	Visibility       *Visibility   `json:"visibility,omitempty"`
}

Worklog represents a worklog entry

type Worklogs

type Worklogs struct {
	StartAt    int       `json:"startAt"`
	MaxResults int       `json:"maxResults"`
	Total      int       `json:"total"`
	Worklogs   []Worklog `json:"worklogs"`
}

Worklogs represents a list of worklogs

Jump to

Keyboard shortcuts

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