Documentation ¶
Index ¶
- Constants
- func CheckResponse(r *http.Response) error
- type Attachment
- type AuthenticationService
- func (s *AuthenticationService) AcquireSessionCookie(username, password string) (bool, error)
- func (s *AuthenticationService) Authenticated() bool
- func (s *AuthenticationService) GetCurrentUser() (*Session, error)
- func (s *AuthenticationService) Logout() error
- func (s *AuthenticationService) SetBasicAuth(username, password string)
- type AvatarUrls
- type Board
- type BoardListOptions
- type BoardService
- func (s *BoardService) CreateBoard(board *Board) (*Board, *Response, error)
- func (s *BoardService) DeleteBoard(boardID int) (*Board, *Response, error)
- func (s *BoardService) GetAllBoards(opt *BoardListOptions) (*BoardsList, *Response, error)
- func (s *BoardService) GetAllSprints(boardID string) ([]Sprint, *Response, error)
- func (s *BoardService) GetBoard(boardID int) (*Board, *Response, error)
- type BoardsList
- type Changelog
- type ChangelogHistory
- type ChangelogItems
- type Client
- func (c *Client) Do(req *http.Request, v interface{}) (*Response, error)
- func (c *Client) GetBaseURL() url.URL
- func (c *Client) NewMultiPartRequest(method, urlStr string, buf *bytes.Buffer) (*http.Request, error)
- func (c *Client) NewRawRequest(method, urlStr string, body io.Reader) (*http.Request, error)
- func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error)
- type Comment
- type CommentVisibility
- type Comments
- type Component
- type CreateMetaInfo
- type CreateTransitionPayload
- type CustomFields
- type Epic
- type FixVersion
- type GetQueryOptions
- type GroupMember
- type GroupService
- type Issue
- type IssueFields
- type IssueLink
- type IssueLinkType
- type IssueService
- func (s *IssueService) AddComment(issueID string, comment *Comment) (*Comment, *Response, error)
- func (s *IssueService) AddLink(issueLink *IssueLink) (*Response, error)
- func (s *IssueService) Create(issue *Issue) (*Issue, *Response, error)
- func (s *IssueService) Delete(issueID string) (*Response, error)
- func (s *IssueService) DoTransition(ticketID, transitionID string) (*Response, error)
- func (s *IssueService) DoTransitionWithPayload(ticketID, payload interface{}) (*Response, error)
- func (s *IssueService) DownloadAttachment(attachmentID string) (*Response, error)
- func (s *IssueService) Get(issueID string, options *GetQueryOptions) (*Issue, *Response, error)
- func (s *IssueService) GetCreateMeta(projectkey string) (*CreateMetaInfo, *Response, error)
- func (s *IssueService) GetCustomFields(issueID string) (CustomFields, *Response, error)
- func (s *IssueService) GetTransitions(id string) ([]Transition, *Response, error)
- func (s *IssueService) PostAttachment(issueID string, r io.Reader, attachmentName string) (*[]Attachment, *Response, error)
- func (s *IssueService) Search(jql string, options *SearchOptions) ([]Issue, *Response, error)
- func (s *IssueService) Update(issue *Issue) (*Issue, *Response, error)
- func (s *IssueService) UpdateIssue(jiraId string, data map[string]interface{}) (*Response, error)
- type IssueType
- type IssuesInSprintResult
- type IssuesWrapper
- type MetaIssueType
- type MetaProject
- type Option
- type Parent
- type Priority
- type Progress
- type Project
- type ProjectCategory
- type ProjectComponent
- type ProjectList
- type ProjectService
- type Resolution
- type Response
- type SearchOptions
- type Session
- type Sprint
- type SprintService
- type Status
- type StatusCategory
- type Subtasks
- type Time
- type TimeTracking
- type Transition
- type TransitionField
- type TransitionPayload
- type User
- type UserService
- type Version
- type Watches
- type Worklog
- type WorklogRecord
Constants ¶
const (
// AssigneeAutomatic represents the value of the "Assignee: Automatic" of JIRA
AssigneeAutomatic = "-1"
)
Variables ¶
This section is empty.
Functions ¶
func CheckResponse ¶
CheckResponse checks the API response for errors, and returns them if present. A response is considered an error if it has a status code outside the 200 range. The caller is responsible to analyze the response body. The body can contain JSON (if the error is intended) or xml (sometimes JIRA just failes).
Types ¶
type Attachment ¶
type Attachment struct { Self string `json:"self,omitempty" structs:"self,omitempty"` ID string `json:"id,omitempty" structs:"id,omitempty"` Filename string `json:"filename,omitempty" structs:"filename,omitempty"` Author *User `json:"author,omitempty" structs:"author,omitempty"` Created string `json:"created,omitempty" structs:"created,omitempty"` Size int `json:"size,omitempty" structs:"size,omitempty"` MimeType string `json:"mimeType,omitempty" structs:"mimeType,omitempty"` Content string `json:"content,omitempty" structs:"content,omitempty"` Thumbnail string `json:"thumbnail,omitempty" structs:"thumbnail,omitempty"` }
Attachment represents a JIRA attachment
type AuthenticationService ¶
type AuthenticationService struct {
// contains filtered or unexported fields
}
AuthenticationService handles authentication for the JIRA instance / API.
JIRA API docs: https://docs.atlassian.com/jira/REST/latest/#authentication
func (*AuthenticationService) AcquireSessionCookie ¶
func (s *AuthenticationService) AcquireSessionCookie(username, password string) (bool, error)
AcquireSessionCookie creates a new session for a user in JIRA. Once a session has been successfully created it can be used to access any of JIRA's remote APIs and also the web UI by passing the appropriate HTTP Cookie header. The header will by automatically applied to every API request. Note that it is generally preferrable to use HTTP BASIC authentication with the REST API. However, this resource may be used to mimic the behaviour of JIRA's log-in page (e.g. to display log-in errors to a user).
JIRA API docs: https://docs.atlassian.com/jira/REST/latest/#auth/1/session
func (*AuthenticationService) Authenticated ¶
func (s *AuthenticationService) Authenticated() bool
Authenticated reports if the current Client has authentication details for JIRA
func (*AuthenticationService) GetCurrentUser ¶
func (s *AuthenticationService) GetCurrentUser() (*Session, error)
GetCurrentUser gets the details of the current user.
JIRA API docs: https://docs.atlassian.com/jira/REST/latest/#auth/1/session
func (*AuthenticationService) Logout ¶
func (s *AuthenticationService) Logout() error
Logout logs out the current user that has been authenticated and the session in the client is destroyed.
JIRA API docs: https://docs.atlassian.com/jira/REST/latest/#auth/1/session
func (*AuthenticationService) SetBasicAuth ¶
func (s *AuthenticationService) SetBasicAuth(username, password string)
SetBasicAuth sets username and password for the basic auth against the JIRA instance.
type AvatarUrls ¶
type AvatarUrls struct { Four8X48 string `json:"48x48,omitempty" structs:"48x48,omitempty"` Two4X24 string `json:"24x24,omitempty" structs:"24x24,omitempty"` One6X16 string `json:"16x16,omitempty" structs:"16x16,omitempty"` Three2X32 string `json:"32x32,omitempty" structs:"32x32,omitempty"` }
AvatarUrls represents different dimensions of avatars / images
type Board ¶
type Board struct { ID int `json:"id,omitempty" structs:"id,omitempty"` Self string `json:"self,omitempty" structs:"self,omitempty"` Name string `json:"name,omitempty" structs:"name,omitemtpy"` Type string `json:"type,omitempty" structs:"type,omitempty"` FilterID int `json:"filterId,omitempty" structs:"filterId,omitempty"` }
Board represents a JIRA agile board
type BoardListOptions ¶
type BoardListOptions struct { // BoardType filters results to boards of the specified type. // Valid values: scrum, kanban. BoardType string `url:"boardType,omitempty"` // Name filters results to boards that match or partially match the specified name. Name string `url:"name,omitempty"` // ProjectKeyOrID filters results to boards that are relevant to a project. // Relevance meaning that the JQL filter defined in board contains a reference to a project. ProjectKeyOrID string `url:"projectKeyOrId,omitempty"` SearchOptions }
BoardListOptions specifies the optional parameters to the BoardService.GetList
type BoardService ¶
type BoardService struct {
// contains filtered or unexported fields
}
BoardService handles Agile Boards for the JIRA instance / API.
JIRA API docs: https://docs.atlassian.com/jira-software/REST/server/
func (*BoardService) CreateBoard ¶
func (s *BoardService) CreateBoard(board *Board) (*Board, *Response, error)
CreateBoard creates a new board. Board name, type and filter Id is required. name - Must be less than 255 characters. type - Valid values: scrum, kanban filterId - Id of a filter that the user has permissions to view. Note, if the user does not have the 'Create shared objects' permission and tries to create a shared board, a private board will be created instead (remember that board sharing depends on the filter sharing).
JIRA API docs: https://docs.atlassian.com/jira-software/REST/cloud/#agile/1.0/board-createBoard
func (*BoardService) DeleteBoard ¶
func (s *BoardService) DeleteBoard(boardID int) (*Board, *Response, error)
DeleteBoard will delete an agile board.
JIRA API docs: https://docs.atlassian.com/jira-software/REST/cloud/#agile/1.0/board-deleteBoard
func (*BoardService) GetAllBoards ¶
func (s *BoardService) GetAllBoards(opt *BoardListOptions) (*BoardsList, *Response, error)
GetAllBoards will returns all boards. This only includes boards that the user has permission to view.
JIRA API docs: https://docs.atlassian.com/jira-software/REST/cloud/#agile/1.0/board-getAllBoards
func (*BoardService) GetAllSprints ¶
func (s *BoardService) GetAllSprints(boardID string) ([]Sprint, *Response, error)
GetAllSprints will returns all sprints from a board, for a given board Id. This only includes sprints that the user has permission to view.
JIRA API docs: https://docs.atlassian.com/jira-software/REST/cloud/#agile/1.0/board/{boardId}/sprint
func (*BoardService) GetBoard ¶
func (s *BoardService) GetBoard(boardID int) (*Board, *Response, error)
GetBoard will returns the board for the given boardID. This board will only be returned if the user has permission to view it.
JIRA API docs: https://docs.atlassian.com/jira-software/REST/cloud/#agile/1.0/board-getBoard
type BoardsList ¶
type BoardsList struct { MaxResults int `json:"maxResults" structs:"maxResults"` StartAt int `json:"startAt" structs:"startAt"` Total int `json:"total" structs:"total"` IsLast bool `json:"isLast" structs:"isLast"` Values []Board `json:"values" structs:"values"` }
BoardsList reflects a list of agile boards
type Changelog ¶
type Changelog struct {
Histories []ChangelogHistory `json:"histories,omitempty"`
}
Changelog reflects the change log of an issue
type ChangelogHistory ¶
type ChangelogHistory struct { Id string `json:"id" structs:"id"` Author User `json:"author" structs:"author"` Created string `json:"created" structs:"created"` Items []ChangelogItems `json:"items" structs:"items"` }
ChangelogHistory reflects one single changelog history entry
type ChangelogItems ¶
type ChangelogItems struct { Field string `json:"field" structs:"field"` FieldType string `json:"fieldtype" structs:"fieldtype"` From interface{} `json:"from" structs:"from"` FromString string `json:"fromString" structs:"fromString"` To interface{} `json:"to" structs:"to"` ToString string `json:"toString" structs:"toString"` }
ChangelogItems reflects one single changelog item of a history item
type Client ¶
type Client struct { // Services used for talking to different parts of the JIRA API. Authentication *AuthenticationService Issue *IssueService Project *ProjectService Board *BoardService Sprint *SprintService User *UserService Group *GroupService // contains filtered or unexported fields }
A Client manages communication with the JIRA API.
func NewClient ¶
NewClient returns a new JIRA API client. If a nil httpClient is provided, http.DefaultClient will be used. To use API methods which require authentication you can follow the preferred solution and provide an http.Client that will perform the authentication for you with OAuth and HTTP Basic (such as that provided by the golang.org/x/oauth2 library). As an alternative you can use Session Cookie based authentication provided by this package as well. See https://docs.atlassian.com/jira/REST/latest/#authentication baseURL is the HTTP endpoint of your JIRA instance and should always be specified with a trailing slash.
func (*Client) Do ¶
Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred.
func (*Client) GetBaseURL ¶
GetBaseURL will return you the Base URL. This is the same URL as in the NewClient constructor
func (*Client) NewMultiPartRequest ¶
func (c *Client) NewMultiPartRequest(method, urlStr string, buf *bytes.Buffer) (*http.Request, error)
NewMultiPartRequest creates an API request including a multi-part file. A relative URL can be provided in urlStr, in which case it is resolved relative to the baseURL of the Client. Relative URLs should always be specified without a preceding slash. If specified, the value pointed to by buf is a multipart form.
func (*Client) NewRawRequest ¶
NewRawRequest creates an API request. A relative URL can be provided in urlStr, in which case it is resolved relative to the baseURL of the Client. Relative URLs should always be specified without a preceding slash. Allows using an optional native io.Reader for sourcing the request body.
func (*Client) NewRequest ¶
NewRequest creates an API request. A relative URL can be provided in urlStr, in which case it is resolved relative to the baseURL of the Client. Relative URLs should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included as the request body.
type Comment ¶
type Comment struct { ID string `json:"id,omitempty" structs:"id,omitempty"` Self string `json:"self,omitempty" structs:"self,omitempty"` Name string `json:"name,omitempty" structs:"name,omitempty"` Author User `json:"author,omitempty" structs:"author,omitempty"` Body string `json:"body,omitempty" structs:"body,omitempty"` UpdateAuthor User `json:"updateAuthor,omitempty" structs:"updateAuthor,omitempty"` Updated string `json:"updated,omitempty" structs:"updated,omitempty"` Created string `json:"created,omitempty" structs:"created,omitempty"` Visibility CommentVisibility `json:"visibility,omitempty" structs:"visibility,omitempty"` }
Comment represents a comment by a person to an issue in JIRA.
type CommentVisibility ¶
type CommentVisibility struct { Type string `json:"type,omitempty" structs:"type,omitempty"` Value string `json:"value,omitempty" structs:"value,omitempty"` }
CommentVisibility represents he visibility of a comment. E.g. Type could be "role" and Value "Administrators"
type Comments ¶
type Comments struct {
Comments []*Comment `json:"comments,omitempty" structs:"comments,omitempty"`
}
Comments represents a list of Comment.
type Component ¶
type Component struct { Self string `json:"self,omitempty" structs:"self,omitempty"` ID string `json:"id,omitempty" structs:"id,omitempty"` Name string `json:"name,omitempty" structs:"name,omitempty"` }
Component represents a "component" of a JIRA issue. Components can be user defined in every JIRA instance.
type CreateMetaInfo ¶
type CreateMetaInfo struct { Expand string `json:"expand,omitempty"` Projects []*MetaProject `json:"projects,omitempty"` }
CreateMetaInfo contains information about fields and their attributed to create a ticket.
func (*CreateMetaInfo) GetProjectWithKey ¶
func (m *CreateMetaInfo) GetProjectWithKey(key string) *MetaProject
GetProjectWithKey returns a project with "name" from the meta information received. If not found, this returns nil. The comparison of the name is case insensitive.
func (*CreateMetaInfo) GetProjectWithName ¶
func (m *CreateMetaInfo) GetProjectWithName(name string) *MetaProject
GetProjectWithName returns a project with "name" from the meta information received. If not found, this returns nil. The comparison of the name is case insensitive.
type CreateTransitionPayload ¶
type CreateTransitionPayload struct {
Transition TransitionPayload `json:"transition" structs:"transition"`
}
CreateTransitionPayload is used for creating new issue transitions
type CustomFields ¶
CustomFields represents custom fields of JIRA This can heavily differ between JIRA instances
type Epic ¶
type Epic struct { ID int `json:"id" structs:"id"` Key string `json:"key" structs:"key"` Self string `json:"self" structs:"self"` Name string `json:"name" structs:"name"` Summary string `json:"summary" structs:"summary"` Done bool `json:"done" structs:"done"` }
Epic represents the epic to which an issue is associated Not that this struct does not process the returned "color" value
type FixVersion ¶
type FixVersion struct { Archived *bool `json:"archived,omitempty" structs:"archived,omitempty"` ID string `json:"id,omitempty" structs:"id,omitempty"` Name string `json:"name,omitempty" structs:"name,omitempty"` ProjectID int `json:"projectId,omitempty" structs:"projectId,omitempty"` ReleaseDate string `json:"releaseDate,omitempty" structs:"releaseDate,omitempty"` Released *bool `json:"released,omitempty" structs:"released,omitempty"` Self string `json:"self,omitempty" structs:"self,omitempty"` UserReleaseDate string `json:"userReleaseDate,omitempty" structs:"userReleaseDate,omitempty"` }
FixVersion represents a software release in which an issue is fixed.
type GetQueryOptions ¶
type GetQueryOptions struct { // Fields is the list of fields to return for the issue. By default, all fields are returned. Fields string `url:"fields,omitempty"` Expand string `url:"expand,omitempty"` // Properties is the list of properties to return for the issue. By default no properties are returned. Properties string `url:"properties,omitempty"` // FieldsByKeys if true then fields in issues will be referenced by keys instead of ids FieldsByKeys bool `url:"fieldsByKeys,omitempty"` UpdateHistory bool `url:"updateHistory,omitempty"` }
GetQueryOptions specifies the optional parameters for the Get Issue methods
type GroupMember ¶
type GroupMember struct { Self string `json:"self,omitempty"` Name string `json:"name,omitempty"` Key string `json:"key,omitempty"` EmailAddress string `json:"emailAddress,omitempty"` DisplayName string `json:"displayName,omitempty"` Active bool `json:"active,omitempty"` TimeZone string `json:"timeZone,omitempty"` }
GroupMember reflects a single member of a group
type GroupService ¶
type GroupService struct {
// contains filtered or unexported fields
}
GroupService handles Groups for the JIRA instance / API.
JIRA API docs: https://docs.atlassian.com/jira/REST/server/#api/2/group
func (*GroupService) Get ¶
func (s *GroupService) Get(name string) ([]GroupMember, *Response, error)
Get returns a paginated list of users who are members of the specified group and its subgroups. Users in the page are ordered by user names. User of this resource is required to have sysadmin or admin permissions.
JIRA API docs: https://docs.atlassian.com/jira/REST/server/#api/2/group-getUsersFromGroup
type Issue ¶
type Issue struct { Expand string `json:"expand,omitempty" structs:"expand,omitempty"` ID string `json:"id,omitempty" structs:"id,omitempty"` Self string `json:"self,omitempty" structs:"self,omitempty"` Key string `json:"key,omitempty" structs:"key,omitempty"` Fields *IssueFields `json:"fields,omitempty" structs:"fields,omitempty"` Changelog *Changelog `json:"changelog,omitempty" structs:"changelog,omitempty"` }
Issue represents a JIRA issue.
func InitIssueWithMetaAndFields ¶
func InitIssueWithMetaAndFields(metaProject *MetaProject, metaIssuetype *MetaIssueType, fieldsConfig map[string]string) (*Issue, error)
InitIssueWithMetaAndFields returns Issue with with values from fieldsConfig properly set.
- metaProject should contain metaInformation about the project where the issue should be created.
- metaIssuetype is the MetaInformation about the Issuetype that needs to be created.
- fieldsConfig is a key->value pair where key represents the name of the field as seen in the UI And value is the string value for that particular key.
Note: This method doesn't verify that the fieldsConfig is complete with mandatory fields. The fieldsConfig is
supposed to be already verified with MetaIssueType.CheckCompleteAndAvailable. It will however return error if the key is not found. All values will be packed into Unknowns. This is much convenient. If the struct fields needs to be configured as well, marshalling and unmarshalling will set the proper fields.
type IssueFields ¶
type IssueFields struct { // TODO Missing fields // * "aggregatetimespent": null, // * "workratio": -1, // * "lastViewed": null, // * "aggregatetimeoriginalestimate": null, // * "aggregatetimeestimate": null, // * "environment": null, Expand string `json:"expand,omitempty" structs:"expand,omitempty"` Type IssueType `json:"issuetype" structs:"issuetype"` Project Project `json:"project,omitempty" structs:"project,omitempty"` Resolution *Resolution `json:"resolution,omitempty" structs:"resolution,omitempty"` Priority *Priority `json:"priority,omitempty" structs:"priority,omitempty"` Resolutiondate string `json:"resolutiondate,omitempty" structs:"resolutiondate,omitempty"` Created string `json:"created,omitempty" structs:"created,omitempty"` Duedate string `json:"duedate,omitempty" structs:"duedate,omitempty"` Watches *Watches `json:"watches,omitempty" structs:"watches,omitempty"` Assignee *User `json:"assignee,omitempty" structs:"assignee,omitempty"` Updated string `json:"updated,omitempty" structs:"updated,omitempty"` Description string `json:"description,omitempty" structs:"description,omitempty"` Summary string `json:"summary" structs:"summary"` Creator *User `json:"Creator,omitempty" structs:"Creator,omitempty"` Reporter *User `json:"reporter,omitempty" structs:"reporter,omitempty"` Components []*Component `json:"components,omitempty" structs:"components,omitempty"` Status *Status `json:"status,omitempty" structs:"status,omitempty"` Progress *Progress `json:"progress,omitempty" structs:"progress,omitempty"` AggregateProgress *Progress `json:"aggregateprogress,omitempty" structs:"aggregateprogress,omitempty"` TimeTracking *TimeTracking `json:"timetracking,omitempty" structs:"timetracking,omitempty"` TimeSpent int `json:"timespent,omitempty" structs:"timespent,omitempty"` TimeEstimate int `json:"timeestimate,omitempty" structs:"timeestimate,omitempty"` TimeOriginalEstimate int `json:"timeoriginalestimate,omitempty" structs:"timeoriginalestimate,omitempty"` Worklog *Worklog `json:"worklog,omitempty" structs:"worklog,omitempty"` IssueLinks []*IssueLink `json:"issuelinks,omitempty" structs:"issuelinks,omitempty"` Comments *Comments `json:"comment,omitempty" structs:"comment,omitempty"` FixVersions []*FixVersion `json:"fixVersions,omitempty" structs:"fixVersions,omitempty"` Labels []string `json:"labels,omitempty" structs:"labels,omitempty"` Subtasks []*Subtasks `json:"subtasks,omitempty" structs:"subtasks,omitempty"` Attachments []*Attachment `json:"attachment,omitempty" structs:"attachment,omitempty"` Epic *Epic `json:"epic,omitempty" structs:"epic,omitempty"` Parent *Parent `json:"parent,omitempty" structs:"parent,omitempty"` Unknowns tcontainer.MarshalMap }
IssueFields represents single fields of a JIRA issue. Every JIRA issue has several fields attached.
func (*IssueFields) MarshalJSON ¶
func (i *IssueFields) MarshalJSON() ([]byte, error)
MarshalJSON is a custom JSON marshal function for the IssueFields structs. It handles JIRA custom fields and maps those from / to "Unknowns" key.
func (*IssueFields) UnmarshalJSON ¶
func (i *IssueFields) UnmarshalJSON(data []byte) error
UnmarshalJSON is a custom JSON marshal function for the IssueFields structs. It handles JIRA custom fields and maps those from / to "Unknowns" key.
type IssueLink ¶
type IssueLink struct { ID string `json:"id,omitempty" structs:"id,omitempty"` Self string `json:"self,omitempty" structs:"self,omitempty"` Type IssueLinkType `json:"type" structs:"type"` OutwardIssue *Issue `json:"outwardIssue" structs:"outwardIssue"` InwardIssue *Issue `json:"inwardIssue" structs:"inwardIssue"` Comment *Comment `json:"comment,omitempty" structs:"comment,omitempty"` }
IssueLink represents a link between two issues in JIRA.
type IssueLinkType ¶
type IssueLinkType struct { ID string `json:"id,omitempty" structs:"id,omitempty"` Self string `json:"self,omitempty" structs:"self,omitempty"` Name string `json:"name" structs:"name"` Inward string `json:"inward" structs:"inward"` Outward string `json:"outward" structs:"outward"` }
IssueLinkType represents a type of a link between to issues in JIRA. Typical issue link types are "Related to", "Duplicate", "Is blocked by", etc.
type IssueService ¶
type IssueService struct {
// contains filtered or unexported fields
}
IssueService handles Issues for the JIRA instance / API.
JIRA API docs: https://docs.atlassian.com/jira/REST/latest/#api/2/issue
func (*IssueService) AddComment ¶
AddComment adds a new comment to issueID.
JIRA API docs: https://docs.atlassian.com/jira/REST/latest/#api/2/issue-addComment
func (*IssueService) AddLink ¶
func (s *IssueService) AddLink(issueLink *IssueLink) (*Response, error)
AddLink adds a link between two issues.
JIRA API docs: https://docs.atlassian.com/jira/REST/latest/#api/2/issueLink
func (*IssueService) Create ¶
func (s *IssueService) Create(issue *Issue) (*Issue, *Response, error)
Create creates an issue or a sub-task from a JSON representation. Creating a sub-task is similar to creating a regular issue, with two important differences: The issueType field must correspond to a sub-task issue type and you must provide a parent field in the issue create request containing the id or key of the parent issue.
JIRA API docs: https://docs.atlassian.com/jira/REST/latest/#api/2/issue-createIssues
func (*IssueService) Delete ¶
func (s *IssueService) Delete(issueID string) (*Response, error)
Delete will delete a specified issue.
func (*IssueService) DoTransition ¶
func (s *IssueService) DoTransition(ticketID, transitionID string) (*Response, error)
DoTransition performs a transition on an issue. When performing the transition you can update or set other issue fields.
JIRA API docs: https://docs.atlassian.com/jira/REST/latest/#api/2/issue-doTransition
func (*IssueService) DoTransitionWithPayload ¶
func (s *IssueService) DoTransitionWithPayload(ticketID, payload interface{}) (*Response, error)
DoTransitionWithPayload performs a transition on an issue using any payload. When performing the transition you can update or set other issue fields.
JIRA API docs: https://docs.atlassian.com/jira/REST/latest/#api/2/issue-doTransition
func (*IssueService) DownloadAttachment ¶
func (s *IssueService) DownloadAttachment(attachmentID string) (*Response, error)
DownloadAttachment returns a Response of an attachment for a given attachmentID. The attachment is in the Response.Body of the response. This is an io.ReadCloser. The caller should close the resp.Body.
func (*IssueService) Get ¶
func (s *IssueService) Get(issueID string, options *GetQueryOptions) (*Issue, *Response, error)
Get returns a full representation of the issue for the given issue key. JIRA will attempt to identify the issue by the issueIdOrKey path parameter. This can be an issue id, or an issue key. If the issue cannot be found via an exact match, JIRA will also look for the issue in a case-insensitive way, or by looking to see if the issue was moved.
The given options will be appended to the query string ¶
JIRA API docs: https://docs.atlassian.com/jira/REST/latest/#api/2/issue-getIssue
func (*IssueService) GetCreateMeta ¶
func (s *IssueService) GetCreateMeta(projectkey string) (*CreateMetaInfo, *Response, error)
GetCreateMeta makes the api call to get the meta information required to create a ticket
func (*IssueService) GetCustomFields ¶
func (s *IssueService) GetCustomFields(issueID string) (CustomFields, *Response, error)
GetCustomFields returns a map of customfield_* keys with string values
func (*IssueService) GetTransitions ¶
func (s *IssueService) GetTransitions(id string) ([]Transition, *Response, error)
GetTransitions gets a list of the transitions possible for this issue by the current user, along with fields that are required and their types.
JIRA API docs: https://docs.atlassian.com/jira/REST/latest/#api/2/issue-getTransitions
func (*IssueService) PostAttachment ¶
func (s *IssueService) PostAttachment(issueID string, r io.Reader, attachmentName string) (*[]Attachment, *Response, error)
PostAttachment uploads r (io.Reader) as an attachment to a given issueID
func (*IssueService) Search ¶
func (s *IssueService) Search(jql string, options *SearchOptions) ([]Issue, *Response, error)
Search will search for tickets according to the jql
JIRA API docs: https://developer.atlassian.com/jiradev/jira-apis/jira-rest-apis/jira-rest-api-tutorials/jira-rest-api-example-query-issues
func (*IssueService) Update ¶
func (s *IssueService) Update(issue *Issue) (*Issue, *Response, error)
Update updates an issue from a JSON representation. The issue is found by key.
JIRA API docs: https://docs.atlassian.com/jira/REST/cloud/#api/2/issue-editIssue
func (*IssueService) UpdateIssue ¶
func (s *IssueService) UpdateIssue(jiraId string, data map[string]interface{}) (*Response, error)
Update updates an issue from a JSON representation. The issue is found by key.
https://docs.atlassian.com/jira/REST/7.4.0/#api/2/issue-editIssue
type IssueType ¶
type IssueType struct { Self string `json:"self,omitempty" structs:"self,omitempty"` ID string `json:"id,omitempty" structs:"id,omitempty"` Description string `json:"description,omitempty" structs:"description,omitempty"` IconURL string `json:"iconUrl,omitempty" structs:"iconUrl,omitempty"` Name string `json:"name,omitempty" structs:"name,omitempty"` Subtask bool `json:"subtask,omitempty" structs:"subtask,omitempty"` AvatarID int `json:"avatarId,omitempty" structs:"avatarId,omitempty"` }
IssueType represents a type of a JIRA issue. Typical types are "Request", "Bug", "Story", ...
type IssuesInSprintResult ¶
type IssuesInSprintResult struct {
Issues []Issue `json:"issues"`
}
IssuesInSprintResult represents a wrapper struct for search result
type IssuesWrapper ¶
type IssuesWrapper struct {
Issues []string `json:"issues"`
}
IssuesWrapper represents a wrapper struct for moving issues to sprint
type MetaIssueType ¶
type MetaIssueType struct { Self string `json:"self,omitempty"` Id string `json:"id,omitempty"` Description string `json:"description,omitempty"` IconUrl string `json:"iconurl,omitempty"` Name string `json:"name,omitempty"` Subtasks bool `json:"subtask,omitempty"` Expand string `json:"expand,omitempty"` Fields tcontainer.MarshalMap `json:"fields,omitempty"` }
MetaIssueType represents the different issue types a project has.
Note: Fields is interface because this is an object which can have arbitraty keys related to customfields. It is not possible to expect these for a general way. This will be returning a map. Further processing must be done depending on what is required.
func (*MetaIssueType) CheckCompleteAndAvailable ¶
func (t *MetaIssueType) CheckCompleteAndAvailable(config map[string]string) (bool, error)
CheckCompleteAndAvailable checks if the given fields satisfies the mandatory field required to create a issue for the given type And also if the given fields are available.
func (*MetaIssueType) GetAllFields ¶
func (t *MetaIssueType) GetAllFields() (map[string]string, error)
GetAllFields returns a map of all the fields for an IssueType. This includes all required and not required. The key of the returned map is what you see in the form and the value is how it is representated in the jira schema.
func (*MetaIssueType) GetMandatoryFields ¶
func (t *MetaIssueType) GetMandatoryFields() (map[string]string, error)
GetMandatoryFields returns a map of all the required fields from the MetaIssueTypes. if a field returned by the api was:
"customfield_10806": { "required": true, "schema": { "type": "any", "custom": "com.pyxis.greenhopper.jira:gh-epic-link", "customId": 10806 }, "name": "Epic Link", "hasDefaultValue": false, "operations": [ "set" ] }
the returned map would have "Epic Link" as the key and "customfield_10806" as value. This choice has been made so that the it is easier to generate the create api request later.
type MetaProject ¶
type MetaProject struct { Expand string `json:"expand,omitempty"` Self string `json:"self, omitempty"` Id string `json:"id,omitempty"` Key string `json:"key,omitempty"` Name string `json:"name,omitempty"` // omitted avatarUrls IssueTypes []*MetaIssueType `json:"issuetypes,omitempty"` }
MetaProject is the meta information about a project returned from createmeta api
func (*MetaProject) GetIssueTypeWithName ¶
func (p *MetaProject) GetIssueTypeWithName(name string) *MetaIssueType
GetIssueTypeWithName returns an IssueType with name from a given MetaProject. If not found, this returns nil. The comparison of the name is case insensitive
type Option ¶
type Option struct {
Value string `json:"value" structs:"value"`
}
Option represents an option value in a SelectList or MultiSelect custom issue field
type Parent ¶
type Parent struct { ID string `json:"id,omitempty" structs:"id"` Key string `json:"key,omitempty" structs:"key"` }
Parent represents the parent of a JIRA issue, to be used with subtask issue types.
type Priority ¶
type Priority struct { Self string `json:"self,omitempty" structs:"self,omitempty"` IconURL string `json:"iconUrl,omitempty" structs:"iconUrl,omitempty"` Name string `json:"name,omitempty" structs:"name,omitempty"` ID string `json:"id,omitempty" structs:"id,omitempty"` }
Priority represents a priority of a JIRA issue. Typical types are "Normal", "Moderate", "Urgent", ...
type Progress ¶
type Progress struct { Progress int `json:"progress" structs:"progress"` Total int `json:"total" structs:"total"` }
Progress represents the progress of a JIRA issue.
type Project ¶
type Project struct { Expand string `json:"expand,omitempty" structs:"expand,omitempty"` Self string `json:"self,omitempty" structs:"self,omitempty"` ID string `json:"id,omitempty" structs:"id,omitempty"` Key string `json:"key,omitempty" structs:"key,omitempty"` Description string `json:"description,omitempty" structs:"description,omitempty"` Lead User `json:"lead,omitempty" structs:"lead,omitempty"` Components []ProjectComponent `json:"components,omitempty" structs:"components,omitempty"` IssueTypes []IssueType `json:"issueTypes,omitempty" structs:"issueTypes,omitempty"` URL string `json:"url,omitempty" structs:"url,omitempty"` Email string `json:"email,omitempty" structs:"email,omitempty"` AssigneeType string `json:"assigneeType,omitempty" structs:"assigneeType,omitempty"` Versions []Version `json:"versions,omitempty" structs:"versions,omitempty"` Name string `json:"name,omitempty" structs:"name,omitempty"` Roles struct { Developers string `json:"Developers,omitempty" structs:"Developers,omitempty"` } `json:"roles,omitempty" structs:"roles,omitempty"` AvatarUrls AvatarUrls `json:"avatarUrls,omitempty" structs:"avatarUrls,omitempty"` ProjectCategory ProjectCategory `json:"projectCategory,omitempty" structs:"projectCategory,omitempty"` }
Project represents a JIRA Project.
type ProjectCategory ¶
type ProjectCategory struct { Self string `json:"self" structs:"self,omitempty"` ID string `json:"id" structs:"id,omitempty"` Name string `json:"name" structs:"name,omitempty"` Description string `json:"description" structs:"description,omitempty"` }
ProjectCategory represents a single project category
type ProjectComponent ¶
type ProjectComponent struct { Self string `json:"self" structs:"self,omitempty"` ID string `json:"id" structs:"id,omitempty"` Name string `json:"name" structs:"name,omitempty"` Description string `json:"description" structs:"description,omitempty"` Lead User `json:"lead,omitempty" structs:"lead,omitempty"` AssigneeType string `json:"assigneeType" structs:"assigneeType,omitempty"` Assignee User `json:"assignee" structs:"assignee,omitempty"` RealAssigneeType string `json:"realAssigneeType" structs:"realAssigneeType,omitempty"` RealAssignee User `json:"realAssignee" structs:"realAssignee,omitempty"` IsAssigneeTypeValid bool `json:"isAssigneeTypeValid" structs:"isAssigneeTypeValid,omitempty"` Project string `json:"project" structs:"project,omitempty"` ProjectID int `json:"projectId" structs:"projectId,omitempty"` }
ProjectComponent represents a single component of a project
type ProjectList ¶
type ProjectList []struct { Expand string `json:"expand" structs:"expand"` Self string `json:"self" structs:"self"` ID string `json:"id" structs:"id"` Key string `json:"key" structs:"key"` Name string `json:"name" structs:"name"` AvatarUrls AvatarUrls `json:"avatarUrls" structs:"avatarUrls"` ProjectTypeKey string `json:"projectTypeKey" structs:"projectTypeKey"` ProjectCategory ProjectCategory `json:"projectCategory,omitempty" structs:"projectsCategory,omitempty"` }
ProjectList represent a list of Projects
type ProjectService ¶
type ProjectService struct {
// contains filtered or unexported fields
}
ProjectService handles projects for the JIRA instance / API.
JIRA API docs: https://docs.atlassian.com/jira/REST/latest/#api/2/project
func (*ProjectService) Get ¶
func (s *ProjectService) Get(projectID string) (*Project, *Response, error)
Get returns a full representation of the project for the given issue key. JIRA will attempt to identify the project by the projectIdOrKey path parameter. This can be an project id, or an project key.
JIRA API docs: https://docs.atlassian.com/jira/REST/latest/#api/2/project-getProject
func (*ProjectService) GetList ¶
func (s *ProjectService) GetList() (*ProjectList, *Response, error)
GetList gets all projects form JIRA
JIRA API docs: https://docs.atlassian.com/jira/REST/latest/#api/2/project-getAllProjects
type Resolution ¶
type Resolution struct { Self string `json:"self" structs:"self"` ID string `json:"id" structs:"id"` Description string `json:"description" structs:"description"` Name string `json:"name" structs:"name"` }
Resolution represents a resolution of a JIRA issue. Typical types are "Fixed", "Suspended", "Won't Fix", ...
type Response ¶
Response represents JIRA API response. It wraps http.Response returned from API and provides information about paging.
type SearchOptions ¶
type SearchOptions struct { // StartAt: The starting index of the returned projects. Base index: 0. StartAt int `url:"startAt,omitempty"` // MaxResults: The maximum number of projects to return per page. Default: 50. MaxResults int `url:"maxResults,omitempty"` // Expand: Expand specific sections in the returned issues Expand string `url:"expand,omitempty"` Fields []string }
SearchOptions specifies the optional parameters to various List methods that support pagination. Pagination is used for the JIRA REST APIs to conserve server resources and limit response size for resources that return potentially large collection of items. A request to a pages API will result in a values array wrapped in a JSON object with some paging metadata Default Pagination options
type Session ¶
type Session struct { Self string `json:"self,omitempty"` Name string `json:"name,omitempty"` Session struct { Name string `json:"name"` Value string `json:"value"` } `json:"session,omitempty"` LoginInfo struct { FailedLoginCount int `json:"failedLoginCount"` LoginCount int `json:"loginCount"` LastFailedLoginTime string `json:"lastFailedLoginTime"` PreviousLoginTime string `json:"previousLoginTime"` } `json:"loginInfo"` Cookies []*http.Cookie }
Session represents a Session JSON response by the JIRA API.
type Sprint ¶
type Sprint struct { ID int `json:"id" structs:"id"` Name string `json:"name" structs:"name"` CompleteDate *time.Time `json:"completeDate" structs:"completeDate"` EndDate *time.Time `json:"endDate" structs:"endDate"` StartDate *time.Time `json:"startDate" structs:"startDate"` OriginBoardID int `json:"originBoardId" structs:"originBoardId"` Self string `json:"self" structs:"self"` State string `json:"state" structs:"state"` }
Sprint represents a sprint on JIRA agile board
type SprintService ¶
type SprintService struct {
// contains filtered or unexported fields
}
SprintService handles sprints in JIRA Agile API. See https://docs.atlassian.com/jira-software/REST/cloud/
func (*SprintService) GetIssuesForSprint ¶
func (s *SprintService) GetIssuesForSprint(sprintID int) ([]Issue, *Response, error)
GetIssuesForSprint returns all issues in a sprint, for a given sprint Id. This only includes issues that the user has permission to view. By default, the returned issues are ordered by rank.
JIRA API Docs: https://docs.atlassian.com/jira-software/REST/cloud/#agile/1.0/sprint-getIssuesForSprint
func (*SprintService) MoveIssuesToSprint ¶
func (s *SprintService) MoveIssuesToSprint(sprintID int, issueIDs []string) (*Response, error)
MoveIssuesToSprint moves issues to a sprint, for a given sprint Id. Issues can only be moved to open or active sprints. The maximum number of issues that can be moved in one operation is 50.
JIRA API docs: https://docs.atlassian.com/jira-software/REST/cloud/#agile/1.0/sprint-moveIssuesToSprint
type Status ¶
type Status struct { Self string `json:"self" structs:"self"` Description string `json:"description" structs:"description"` IconURL string `json:"iconUrl" structs:"iconUrl"` Name string `json:"name" structs:"name"` ID string `json:"id" structs:"id"` StatusCategory StatusCategory `json:"statusCategory" structs:"statusCategory"` }
Status represents the current status of a JIRA issue. Typical status are "Open", "In Progress", "Closed", ... Status can be user defined in every JIRA instance.
type StatusCategory ¶
type StatusCategory struct { Self string `json:"self" structs:"self"` ID int `json:"id" structs:"id"` Name string `json:"name" structs:"name"` Key string `json:"key" structs:"key"` ColorName string `json:"colorName" structs:"colorName"` }
StatusCategory represents the category a status belongs to. Those categories can be user defined in every JIRA instance.
type Subtasks ¶
type Subtasks struct { ID string `json:"id" structs:"id"` Key string `json:"key" structs:"key"` Self string `json:"self" structs:"self"` Fields IssueFields `json:"fields" structs:"fields"` }
Subtasks represents all issues of a parent issue.
type Time ¶
Time represents the Time definition of JIRA as a time.Time of go
func (*Time) UnmarshalJSON ¶
UnmarshalJSON will transform the JIRA time into a time.Time during the transformation of the JIRA JSON response
type TimeTracking ¶
type TimeTracking struct { OriginalEstimate string `json:"originalEstimate,omitempty" structs:"originalEstimate,omitempty"` RemainingEstimate string `json:"remainingEstimate,omitempty" structs:"remainingEstimate,omitempty"` TimeSpent string `json:"timeSpent,omitempty" structs:"timeSpent,omitempty"` OriginalEstimateSeconds int `json:"originalEstimateSeconds,omitempty" structs:"originalEstimateSeconds,omitempty"` RemainingEstimateSeconds int `json:"remainingEstimateSeconds,omitempty" structs:"remainingEstimateSeconds,omitempty"` TimeSpentSeconds int `json:"timeSpentSeconds,omitempty" structs:"timeSpentSeconds,omitempty"` }
TimeTracking represents the timetracking fields of a JIRA issue.
type Transition ¶
type Transition struct { ID string `json:"id" structs:"id"` Name string `json:"name" structs:"name"` Fields map[string]TransitionField `json:"fields" structs:"fields"` }
Transition represents an issue transition in JIRA
type TransitionField ¶
type TransitionField struct {
Required bool `json:"required" structs:"required"`
}
TransitionField represents the value of one Transition
type TransitionPayload ¶
type TransitionPayload struct {
ID string `json:"id" structs:"id"`
}
TransitionPayload represents the request payload of Transition calls like DoTransition
type User ¶
type User struct { Self string `json:"self,omitempty" structs:"self,omitempty"` Name string `json:"name,omitempty" structs:"name,omitempty"` Password string `json:"-"` Key string `json:"key,omitempty" structs:"key,omitempty"` EmailAddress string `json:"emailAddress,omitempty" structs:"emailAddress,omitempty"` AvatarUrls AvatarUrls `json:"avatarUrls,omitempty" structs:"avatarUrls,omitempty"` DisplayName string `json:"displayName,omitempty" structs:"displayName,omitempty"` Active bool `json:"active,omitempty" structs:"active,omitempty"` TimeZone string `json:"timeZone,omitempty" structs:"timeZone,omitempty"` ApplicationKeys []string `json:"applicationKeys,omitempty" structs:"applicationKeys,omitempty"` }
User represents a JIRA user.
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
UserService handles users for the JIRA instance / API.
JIRA API docs: https://docs.atlassian.com/jira/REST/cloud/#api/2/user
func (*UserService) Create ¶
func (s *UserService) Create(user *User) (*User, *Response, error)
Create creates an user in JIRA.
JIRA API docs: https://docs.atlassian.com/jira/REST/cloud/#api/2/user-createUser
func (*UserService) Get ¶
func (s *UserService) Get(username string) (*User, *Response, error)
Get gets user info from JIRA
JIRA API docs: https://docs.atlassian.com/jira/REST/cloud/#api/2/user-getUser
type Version ¶
type Version struct { Self string `json:"self" structs:"self,omitempty"` ID string `json:"id" structs:"id,omitempty"` Name string `json:"name" structs:"name,omitempty"` Archived bool `json:"archived" structs:"archived,omitempty"` Released bool `json:"released" structs:"released,omitempty"` ReleaseDate string `json:"releaseDate" structs:"releaseDate,omitempty"` UserReleaseDate string `json:"userReleaseDate" structs:"userReleaseDate,omitempty"` ProjectID int `json:"projectId" structs:"projectId,omitempty"` // Unlike other IDs, this is returned as a number }
Version represents a single release version of a project
type Watches ¶
type Watches struct { Self string `json:"self,omitempty" structs:"self,omitempty"` WatchCount int `json:"watchCount,omitempty" structs:"watchCount,omitempty"` IsWatching bool `json:"isWatching,omitempty" structs:"isWatching,omitempty"` }
Watches represents a type of how many user are "observing" a JIRA issue to track the status / updates.
type Worklog ¶
type Worklog struct { StartAt int `json:"startAt" structs:"startAt"` MaxResults int `json:"maxResults" structs:"maxResults"` Total int `json:"total" structs:"total"` Worklogs []WorklogRecord `json:"worklogs" structs:"worklogs"` }
Worklog represents the work log of a JIRA issue. One Worklog contains zero or n WorklogRecords JIRA Wiki: https://confluence.atlassian.com/jira/logging-work-on-an-issue-185729605.html
type WorklogRecord ¶
type WorklogRecord struct { Self string `json:"self" structs:"self"` Author User `json:"author" structs:"author"` UpdateAuthor User `json:"updateAuthor" structs:"updateAuthor"` Comment string `json:"comment" structs:"comment"` Created Time `json:"created" structs:"created"` Updated Time `json:"updated" structs:"updated"` Started Time `json:"started" structs:"started"` TimeSpent string `json:"timeSpent" structs:"timeSpent"` TimeSpentSeconds int `json:"timeSpentSeconds" structs:"timeSpentSeconds"` ID string `json:"id" structs:"id"` IssueID string `json:"issueId" structs:"issueId"` }
WorklogRecord represents one entry of a Worklog