jira

package module
v1.14.2 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2020 License: MIT Imports: 20 Imported by: 0

README

go-jira

GoDoc Build Status Go Report Card

Go client library for Atlassian JIRA.

Go client library for Atlassian JIRA

Features

  • Authentication (HTTP Basic, OAuth, Session Cookie)
  • Create and retrieve issues
  • Create and retrieve issue transitions (status updates)
  • Call every API endpoint of the JIRA, even if it is not directly implemented in this library

This package is not JIRA API complete (yet), but you can call every API endpoint you want. See Call a not implemented API endpoint how to do this. For all possible API endpoints of JIRA have a look at latest JIRA REST API documentation.

Requirements

  • Go >= 1.8
  • JIRA v6.3.4 & v7.1.2.

Installation

It is go gettable

go get github.com/andygrunwald/go-jira

For stable versions you can use one of our tags with gopkg.in. E.g.

package main

import (
	jira "gopkg.in/andygrunwald/go-jira.v1"
)
...

(optional) to run unit / example tests:

cd $GOPATH/src/github.com/andygrunwald/go-jira
go test -v ./...

API

Please have a look at the GoDoc documentation for a detailed API description.

The latest JIRA REST API documentation was the base document for this package.

Examples

Further a few examples how the API can be used. A few more examples are available in the GoDoc examples section.

Get a single issue

Lets retrieve MESOS-3325 from the Apache Mesos project.

package main

import (
	"fmt"
	"github.com/andygrunwald/go-jira"
)

func main() {
	jiraClient, _ := jira.NewClient(nil, "https://issues.apache.org/jira/")
	issue, _, _ := jiraClient.Issue.Get("MESOS-3325", nil)

	fmt.Printf("%s: %+v\n", issue.Key, issue.Fields.Summary)
	fmt.Printf("Type: %s\n", issue.Fields.Type.Name)
	fmt.Printf("Priority: %s\n", issue.Fields.Priority.Name)

	// MESOS-3325: Running mesos-slave@0.23 in a container causes slave to be lost after a restart
	// Type: Bug
	// Priority: Critical
}
Authentication

The go-jira library does not handle most authentication directly. Instead, authentication should be handled within an http.Client. That client can then be passed into the NewClient function when creating a jira client.

For convenience, capability for basic and cookie-based authentication is included in the main library.

Basic auth example

A more thorough, runnable example is provided in the examples directory. It's worth noting that using passwords in basic auth is now deprecated and will be removed. Jira gives you the ability to create tokens now.

func main() {
	tp := jira.BasicAuthTransport{
		Username: "username",
		Password: "token",
	}

	client, err := jira.NewClient(tp.Client(), "https://my.jira.com")

	u, _, err := client.User.Get("some_user")

	fmt.Printf("\nEmail: %v\nSuccess!\n", u.EmailAddress)
}

JIRA deprecated this authentication method. It's not longer available for use.

Authenticate with OAuth

If you want to connect via OAuth to your JIRA Cloud instance checkout the example of using OAuth authentication with JIRA in Go by @Lupus.

For more details have a look at the issue #56.

Create an issue

Example how to create an issue.

package main

import (
	"fmt"
	"github.com/andygrunwald/go-jira"
)

func main() {
	base := "https://my.jira.com"
	tp := jira.BasicAuthTransport{
		Username: "username",
		Password: "token",
	}

	jiraClient, err := jira.NewClient(tp.Client(), base)
	if err != nil {
		panic(err)
	}

	i := jira.Issue{
		Fields: &jira.IssueFields{
			Assignee: &jira.User{
				Name: "myuser",
			},
			Reporter: &jira.User{
				Name: "youruser",
			},
			Description: "Test Issue",
			Type: jira.IssueType{
				Name: "Bug",
			},
			Project: jira.Project{
				Key: "PROJ1",
			},
			Summary: "Just a demo issue",
		},
	}
	issue, _, err := jiraClient.Issue.Create(&i)
	if err != nil {
		panic(err)
	}

	fmt.Printf("%s: %+v\n", issue.Key, issue.Fields.Summary)
}
Call a not implemented API endpoint

Not all API endpoints of the JIRA API are implemented into go-jira. But you can call them anyway: Lets get all public projects of Atlassian`s JIRA instance.

package main

import (
	"fmt"
	"github.com/andygrunwald/go-jira"
)

func main() {
	base := "https://my.jira.com"
	tp := jira.BasicAuthTransport{
		Username: "username",
		Password: "token",
	}

	jiraClient, err := jira.NewClient(tp.Client(), base)
	req, _ := jiraClient.NewRequest("GET", "rest/api/2/project", nil)

	projects := new([]jira.Project)
	_, err = jiraClient.Do(req, projects)
	if err != nil {
		panic(err)
	}

	for _, project := range *projects {
		fmt.Printf("%s: %s\n", project.Key, project.Name)
	}

	// ...
	// BAM: Bamboo
	// BAMJ: Bamboo JIRA Plugin
	// CLOV: Clover
	// CONF: Confluence
	// ...
}

Implementations

Code structure

The code structure of this package was inspired by google/go-github.

There is one main part (the client). Based on this main client the other endpoints, like Issues or Authentication are extracted in services. E.g. IssueService or AuthenticationService. These services own a responsibility of the single endpoints / usecases of JIRA.

Contribution

We ❤️ PR's

Contribution, in any kind of way, is highly welcome! It doesn't matter if you are not able to write code. Creating issues or holding talks and help other people to use go-jira is contribution, too! A few examples:

  • Correct typos in the README / documentation
  • Reporting bugs
  • Implement a new feature or endpoint
  • Sharing the love of go-jira and help people to get use to it

If you are new to pull requests, checkout Collaborating on projects using issues and pull requests / Creating a pull request.

Dependency management

go-jira uses go modules for dependency management. After cloning the repo, it's easy to make sure you have the correct dependencies by running go mod tidy.

For adding new dependencies, updating dependencies, and other operations, the Daily workflow is a good place to start.

Sandbox environment for testing

Jira offers sandbox test environments at http://go.atlassian.com/cloud-dev.

You can read more about them at https://developer.atlassian.com/blog/2016/04/cloud-ecosystem-dev-env/.

Releasing

Install standard-version

npm i -g standard-version
standard-version
git push --tags

Manually copy/paste text from changelog (for this new version) into the release on Github.com. E.g.

https://github.com/andygrunwald/go-jira/releases/edit/v1.11.0

License

This project is released under the terms of the MIT license.

Documentation

Index

Constants

View Source
const (
	Doc  = "doc"
	Text = "text"
)
View Source
const (
	StatusCategoryComplete   = "done"
	StatusCategoryInProgress = "indeterminate"
	StatusCategoryToDo       = "new"
	StatusCategoryUndefined  = "undefined"
)

These constants are the keys of the default JIRA status categories

View Source
const (
	// AssigneeAutomatic represents the value of the "Assignee: Automatic" of JIRA
	AssigneeAutomatic = "-1"
)

Variables

This section is empty.

Functions

func CheckResponse

func CheckResponse(r *http.Response) error

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).

func NewJiraError added in v1.1.0

func NewJiraError(resp *Response, httpError error) error

NewJiraError creates a new jira Error

func WithActive added in v1.6.0

func WithActive(active bool) userSearchF

WithActive sets the active users lookup

func WithInactive added in v1.6.0

func WithInactive(inactive bool) userSearchF

WithInactive sets the inactive users lookup

func WithMaxResults added in v1.6.0

func WithMaxResults(maxResults int) userSearchF

WithMaxResults sets the max results to return

func WithQueryOptions added in v1.14.2

func WithQueryOptions(options interface{}) func(*http.Request) error

Applies query options to http request. This helper is meant to be used with all "QueryOptions" structs.

func WithStartAt added in v1.6.0

func WithStartAt(startAt int) userSearchF

WithStartAt set the start pager

Types

type Actor added in v1.8.0

type Actor struct {
	ID          int        `json:"id" structs:"id"`
	DisplayName string     `json:"displayName" structs:"displayName"`
	Type        string     `json:"type" structs:"type"`
	Name        string     `json:"name" structs:"name"`
	AvatarURL   string     `json:"avatarUrl" structs:"avatarUrl"`
	ActorUser   *ActorUser `json:"actorUser" structs:"actoruser"`
}

Actor represents a JIRA actor

type ActorUser added in v1.8.0

type ActorUser struct {
	AccountID string `json:"accountId" structs:"accountId"`
}

ActorUser contains the account id of the actor/user

type AddWorklogQueryOptions added in v1.14.2

type AddWorklogQueryOptions struct {
	NotifyUsers          bool   `url:"notifyUsers,omitempty"`
	AdjustEstimate       string `url:"adjustEstimate,omitempty"`
	NewEstimate          string `url:"newEstimate,omitempty"`
	ReduceBy             string `url:"reduceBy,omitempty"`
	Expand               string `url:"expand,omitempty"`
	OverrideEditableFlag bool   `url:"overrideEditableFlag,omitempty"`
}

type AffectsVersion added in v1.7.0

type AffectsVersion Version

AffectsVersion represents a software release which is affected by an issue.

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 deprecated

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

Deprecated: Use CookieAuthTransport instead

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 deprecated

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

Deprecated: Use CookieAuthTransport to create base client. Logging out is as simple as not using the client anymore

func (*AuthenticationService) SetBasicAuth deprecated

func (s *AuthenticationService) SetBasicAuth(username, password string)

SetBasicAuth sets username and password for the basic auth against the JIRA instance.

Deprecated: Use BasicAuthTransport instead

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 BasicAuthTransport added in v1.1.0

type BasicAuthTransport struct {
	Username string
	Password string

	// Transport is the underlying HTTP transport to use when making requests.
	// It will default to http.DefaultTransport if nil.
	Transport http.RoundTripper
}

BasicAuthTransport is an http.RoundTripper that authenticates all requests using HTTP Basic Authentication with the provided username and password.

func (*BasicAuthTransport) Client added in v1.1.0

func (t *BasicAuthTransport) Client() *http.Client

Client returns an *http.Client that makes requests that are authenticated using HTTP Basic Authentication. This is a nice little bit of sugar so we can just get the client instead of creating the client in the calling code. If it's necessary to send more information on client init, the calling code can always skip this and set the transport itself.

func (*BasicAuthTransport) RoundTrip added in v1.1.0

func (t *BasicAuthTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements the RoundTripper interface. We just add the basic auth and return the RoundTripper for this transport type.

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 BoardConfiguration added in v1.14.2

type BoardConfiguration struct {
	ID           int                            `json:"id"`
	Name         string                         `json:"name"`
	Self         string                         `json:"self"`
	Location     BoardConfigurationLocation     `json:"location"`
	Filter       BoardConfigurationFilter       `json:"filter"`
	SubQuery     BoardConfigurationSubQuery     `json:"subQuery"`
	ColumnConfig BoardConfigurationColumnConfig `json:"columnConfig"`
}

BoardConfiguration represents a boardConfiguration of a jira board

type BoardConfigurationColumn added in v1.14.2

type BoardConfigurationColumn struct {
	Name   string                           `json:"name"`
	Status []BoardConfigurationColumnStatus `json:"statuses"`
}

BoardConfigurationColumn lists the name of the board with the statuses that maps to a particular column

type BoardConfigurationColumnConfig added in v1.14.2

type BoardConfigurationColumnConfig struct {
	Columns        []BoardConfigurationColumn `json:"columns"`
	ConstraintType string                     `json:"constraintType"`
}

BoardConfigurationColumnConfig lists the columns for a given board in the order defined in the column configuration with constrainttype (none, issueCount, issueCountExclSubs)

type BoardConfigurationColumnStatus added in v1.14.2

type BoardConfigurationColumnStatus struct {
	ID   string `json:"id"`
	Self string `json:"self"`
}

BoardConfigurationColumnStatus represents a status in the column configuration

type BoardConfigurationFilter added in v1.14.2

type BoardConfigurationFilter struct {
	ID   string `json:"id"`
	Self string `json:"self"`
}

BoardConfigurationFilter reference to the filter used by the given board.

type BoardConfigurationLocation added in v1.14.2

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

BoardConfigurationLocation reference to the container that the board is located in

type BoardConfigurationSubQuery added in v1.14.2

type BoardConfigurationSubQuery struct {
	Query string `json:"query"`
}

BoardConfigurationSubQuery (Kanban only) - JQL subquery used by the given board.

type BoardListOptions

type BoardListOptions struct {
	// BoardType filters results to boards of the specified type.
	// Valid values: scrum, kanban.
	BoardType string `url:"type,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 return 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) GetAllSprintsWithOptions added in v1.4.0

func (s *BoardService) GetAllSprintsWithOptions(boardID int, options *GetAllSprintsOptions) (*SprintsList, *Response, error)

GetAllSprintsWithOptions will return sprints from a board, for a given board Id and filtering options 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

func (*BoardService) GetBoardConfiguration added in v1.14.2

func (s *BoardService) GetBoardConfiguration(boardID int) (*BoardConfiguration, *Response, error)

GetBoardConfiguration will return a board configuration for a given board Id Jira API docs:https://developer.atlassian.com/cloud/jira/software/rest/#api-rest-agile-1-0-board-boardId-configuration-get

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

func (ChangelogHistory) CreatedTime added in v1.6.0

func (c ChangelogHistory) CreatedTime() (time.Time, error)

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
	Version          *VersionService
	Priority         *PriorityService
	Field            *FieldService
	Component        *ComponentService
	Resolution       *ResolutionService
	StatusCategory   *StatusCategoryService
	Filter           *FilterService
	Role             *RoleService
	PermissionScheme *PermissionSchemeService
	Status           *StatusService
	IssueLinkType    *IssueLinkTypeService
	// contains filtered or unexported fields
}

A Client manages communication with the JIRA API.

func NewClient

func NewClient(httpClient httpClient, baseURL string) (*Client, error)

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

func (c *Client) Do(req *http.Request, v interface{}) (*Response, error)

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

func (c *Client) GetBaseURL() url.URL

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. If specified, the value pointed to by buf is a multipart form.

func (*Client) NewRawRequest

func (c *Client) NewRawRequest(method, urlStr string, body io.Reader) (*http.Request, error)

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. Allows using an optional native io.Reader for sourcing the request body.

func (*Client) NewRequest

func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error)

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. 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 ComponentService added in v1.5.0

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

ComponentService handles components for the JIRA instance / API.

JIRA API docs: https://docs.atlassian.com/software/jira/docs/api/REST/7.10.1/#api/2/component

func (*ComponentService) Create added in v1.5.0

Create creates a new JIRA component based on the given options.

type Content added in v1.14.2

type Content struct {
	Type    string     `json:"type,omitempty"`
	Text    string     `json:"text,omitempty"`
	Content ContentSet `json:"content,omitempty"`
}

func (Content) String added in v1.14.2

func (c Content) String() string

type ContentSet added in v1.14.2

type ContentSet []Content

func (ContentSet) String added in v1.14.2

func (c ContentSet) String() string

type CookieAuthTransport added in v1.1.0

type CookieAuthTransport struct {
	Username string
	Password string
	AuthURL  string

	// SessionObject is the authenticated cookie string.s
	// It's passed in each call to prove the client is authenticated.
	SessionObject []*http.Cookie

	// Transport is the underlying HTTP transport to use when making requests.
	// It will default to http.DefaultTransport if nil.
	Transport http.RoundTripper
}

CookieAuthTransport is an http.RoundTripper that authenticates all requests using Jira's cookie-based authentication.

Note that it is generally preferable 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 (*CookieAuthTransport) Client added in v1.1.0

func (t *CookieAuthTransport) Client() *http.Client

Client returns an *http.Client that makes requests that are authenticated using cookie authentication

func (*CookieAuthTransport) RoundTrip added in v1.1.0

func (t *CookieAuthTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip adds the session object to the request.

type CreateComponentOptions added in v1.5.0

type CreateComponentOptions struct {
	Name         string `json:"name,omitempty" structs:"name,omitempty"`
	Description  string `json:"description,omitempty" structs:"description,omitempty"`
	Lead         *User  `json:"lead,omitempty" structs:"lead,omitempty"`
	LeadUserName string `json:"leadUserName,omitempty" structs:"leadUserName,omitempty"`
	AssigneeType string `json:"assigneeType,omitempty" structs:"assigneeType,omitempty"`
	Assignee     *User  `json:"assignee,omitempty" structs:"assignee,omitempty"`
	Project      string `json:"project,omitempty" structs:"project,omitempty"`
	ProjectID    int    `json:"projectId,omitempty" structs:"projectId,omitempty"`
}

CreateComponentOptions are passed to the ComponentService.Create function to create a new JIRA component

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"`
	Fields     TransitionPayloadFields `json:"fields" structs:"fields"`
}

CreateTransitionPayload is used for creating new issue transitions

type CustomFields

type CustomFields map[string]string

CustomFields represents custom fields of JIRA This can heavily differ between JIRA instances

type Date added in v1.1.0

type Date time.Time

Date represents the Date definition of JIRA as a time.Time of go

func (Date) MarshalJSON added in v1.1.0

func (t Date) MarshalJSON() ([]byte, error)

MarshalJSON will transform the Date object into a short date string as JIRA expects during the creation of a JIRA request

func (*Date) UnmarshalJSON added in v1.1.0

func (t *Date) UnmarshalJSON(b []byte) error

UnmarshalJSON will transform the JIRA date into a time.Time during the transformation of the JIRA JSON response

type Document added in v1.14.2

type Document struct {
	Version int        `json:"version,omitempty"`
	Type    string     `json:"type,omitempty"`
	Content ContentSet `json:"content,omitempty"`
}

func (*Document) UnmarshalJSON added in v1.14.2

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

type EntityProperty added in v1.14.2

type EntityProperty struct {
	Key   string      `json:"key"`
	Value interface{} `json:"value"`
}

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 Error added in v1.1.0

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

Error message from JIRA See https://docs.atlassian.com/jira/REST/cloud/#error-responses

func (*Error) Error added in v1.1.0

func (e *Error) Error() string

Error is a short string representing the error

func (*Error) LongError added in v1.1.0

func (e *Error) LongError() string

LongError is a full representation of the error as a string

type Field added in v1.4.0

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

Field represents a field of a JIRA issue.

type FieldSchema added in v1.4.0

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

type FieldService added in v1.4.0

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

FieldService handles fields for the JIRA instance / API.

JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/#api-Field

func (*FieldService) GetList added in v1.4.0

func (s *FieldService) GetList() ([]Field, *Response, error)

GetList gets all fields from JIRA

JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/#api-api-2-field-get

type Filter added in v1.6.0

type Filter struct {
	Self             string        `json:"self"`
	ID               string        `json:"id"`
	Name             string        `json:"name"`
	Description      string        `json:"description"`
	Owner            User          `json:"owner"`
	Jql              string        `json:"jql"`
	ViewURL          string        `json:"viewUrl"`
	SearchURL        string        `json:"searchUrl"`
	Favourite        bool          `json:"favourite"`
	FavouritedCount  int           `json:"favouritedCount"`
	SharePermissions []interface{} `json:"sharePermissions"`
	Subscriptions    struct {
		Size       int           `json:"size"`
		Items      []interface{} `json:"items"`
		MaxResults int           `json:"max-results"`
		StartIndex int           `json:"start-index"`
		EndIndex   int           `json:"end-index"`
	} `json:"subscriptions"`
}

Filter represents a Filter in Jira

type FilterSearchOptions added in v1.14.2

type FilterSearchOptions struct {
	// String used to perform a case-insensitive partial match with name.
	FilterName string `url:"filterName,omitempty"`

	// User account ID used to return filters with the matching owner.accountId. This parameter cannot be used with owner.
	AccountID string `url:"accountId,omitempty"`

	// Group name used to returns filters that are shared with a group that matches sharePermissions.group.groupname.
	GroupName string `url:"groupname,omitempty"`

	// Project ID used to returns filters that are shared with a project that matches sharePermissions.project.id.
	// Format: int64
	ProjectID int64 `url:"projectId,omitempty"`

	// Orders the results using one of these filter properties.
	//   - `description` Orders by filter `description`. Note that this ordering works independently of whether the expand to display the description field is in use.
	//   - `favourite_count` Orders by `favouritedCount`.
	//   - `is_favourite` Orders by `favourite`.
	//   - `id` Orders by filter `id`.
	//   - `name` Orders by filter `name`.
	//   - `owner` Orders by `owner.accountId`.
	//
	// Default: `name`
	//
	// Valid values: id, name, description, owner, favorite_count, is_favorite, -id, -name, -description, -owner, -favorite_count, -is_favorite
	OrderBy string `url:"orderBy,omitempty"`

	// The index of the first item to return in a page of results (page offset).
	// Default: 0, Format: int64
	StartAt int64 `url:"startAt,omitempty"`

	// The maximum number of items to return per page. The maximum is 100.
	// Default: 50, Format: int32
	MaxResults int32 `url:"maxResults,omitempty"`

	// Use expand to include additional information about filter in the response. This parameter accepts multiple values separated by a comma:
	// - description Returns the description of the filter.
	// - favourite Returns an indicator of whether the user has set the filter as a favorite.
	// - favouritedCount Returns a count of how many users have set this filter as a favorite.
	// - jql Returns the JQL query that the filter uses.
	// - owner Returns the owner of the filter.
	// - searchUrl Returns a URL to perform the filter's JQL query.
	// - sharePermissions Returns the share permissions defined for the filter.
	// - subscriptions Returns the users that are subscribed to the filter.
	// - viewUrl Returns a URL to view the filter.
	Expand string `url:"expand,omitempty"`
}

FilterSearchOptions specifies the optional parameters for the Search method https://developer.atlassian.com/cloud/jira/platform/rest/v3/#api-rest-api-3-filter-search-get

type FilterService added in v1.6.0

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

FilterService handles fields for the JIRA instance / API.

JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/v3/#api-group-Filter

func (*FilterService) Get added in v1.6.0

func (fs *FilterService) Get(filterID int) (*Filter, *Response, error)

Get retrieves a single Filter from Jira

func (*FilterService) GetFavouriteList added in v1.7.0

func (fs *FilterService) GetFavouriteList() ([]*Filter, *Response, error)

GetFavouriteList retrieves the user's favourited filters from Jira

func (*FilterService) GetList added in v1.6.0

func (fs *FilterService) GetList() ([]*Filter, *Response, error)

GetList retrieves all filters from Jira

func (*FilterService) GetMyFilters added in v1.14.2

func (fs *FilterService) GetMyFilters(opts *GetMyFiltersQueryOptions) ([]*Filter, *Response, error)

GetMyFilters retrieves the my Filters.

https://developer.atlassian.com/cloud/jira/platform/rest/v3/#api-rest-api-3-filter-my-get

func (*FilterService) Search added in v1.14.2

Search will search for filter according to the search options

JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/v3/#api-rest-api-3-filter-search-get

type FiltersList added in v1.14.2

type FiltersList 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     []FiltersListItem `json:"values" structs:"values"`
}

FiltersList reflects a list of filters

type FiltersListItem added in v1.14.2

type FiltersListItem struct {
	Self             string        `json:"self"`
	ID               string        `json:"id"`
	Name             string        `json:"name"`
	Description      string        `json:"description"`
	Owner            User          `json:"owner"`
	Jql              string        `json:"jql"`
	ViewURL          string        `json:"viewUrl"`
	SearchURL        string        `json:"searchUrl"`
	Favourite        bool          `json:"favourite"`
	FavouritedCount  int           `json:"favouritedCount"`
	SharePermissions []interface{} `json:"sharePermissions"`
	Subscriptions    []struct {
		ID   int  `json:"id"`
		User User `json:"user"`
	} `json:"subscriptions"`
}

FiltersListItem represents a Filter of FiltersList in Jira

type FixVersion

type FixVersion 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"`
	Description     string `json:"description,omitempty" structs:"description,omitempty"`
	Archived        *bool  `json:"archived,omitempty" structs:"archived,omitempty"`
	Released        *bool  `json:"released,omitempty" structs:"released,omitempty"`
	ReleaseDate     string `json:"releaseDate,omitempty" structs:"releaseDate,omitempty"`
	UserReleaseDate string `json:"userReleaseDate,omitempty" structs:"userReleaseDate,omitempty"`
	ProjectID       int    `json:"projectId,omitempty" structs:"projectId,omitempty"` // Unlike other IDs, this is returned as a number
	StartDate       string `json:"startDate,omitempty" structs:"startDate,omitempty"`
}

FixVersion represents a software release in which an issue is fixed.

type GetAllSprintsOptions added in v1.4.0

type GetAllSprintsOptions struct {
	// State filters results to sprints in the specified states, comma-separate list
	State string `url:"state,omitempty"`

	SearchOptions
}

GetAllSprintsOptions specifies the optional parameters to the BoardService.GetList

type GetMyFiltersQueryOptions added in v1.14.2

type GetMyFiltersQueryOptions struct {
	IncludeFavourites bool   `url:"includeFavourites,omitempty"`
	Expand            string `url:"expand,omitempty"`
}

GetMyFiltersQueryOptions specifies the optional parameters for the Get My Filters method

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"`
	ProjectKeys   string `url:"projectKeys,omitempty"`
}

GetQueryOptions specifies the optional parameters for the Get Issue methods

type GetWorklogsQueryOptions added in v1.14.2

type GetWorklogsQueryOptions struct {
	StartAt    int64  `url:"startAt,omitempty"`
	MaxResults int32  `url:"maxResults,omitempty"`
	Expand     string `url:"expand,omitempty"`
}

GetWorklogsQueryOptions specifies the optional parameters for the Get Worklogs method

type Group added in v1.1.0

type Group struct {
	ID                   string          `json:"id"`
	Title                string          `json:"title"`
	Type                 string          `json:"type"`
	Properties           groupProperties `json:"properties"`
	AdditionalProperties bool            `json:"additionalProperties"`
}

Group represents a JIRA group

type GroupMember

type GroupMember struct {
	Self         string `json:"self,omitempty"`
	Name         string `json:"name,omitempty"`
	Key          string `json:"key,omitempty"`
	AccountID    string `json:"accountId,omitempty"`
	EmailAddress string `json:"emailAddress,omitempty"`
	DisplayName  string `json:"displayName,omitempty"`
	Active       bool   `json:"active,omitempty"`
	TimeZone     string `json:"timeZone,omitempty"`
	AccountType  string `json:"accountType,omitempty"`
}

GroupMember reflects a single member of a group

type GroupSearchOptions added in v1.2.0

type GroupSearchOptions struct {
	StartAt              int
	MaxResults           int
	IncludeInactiveUsers bool
}

GroupSearchOptions specifies the optional parameters for the Get Group methods

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) Add added in v1.1.0

func (s *GroupService) Add(groupname string, username string) (*Group, *Response, error)

Add adds user to group

JIRA API docs: https://docs.atlassian.com/jira/REST/cloud/#api/2/group-addUserToGroup

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

WARNING: This API only returns the first page of group members

func (*GroupService) GetWithOptions added in v1.2.0

func (s *GroupService) GetWithOptions(name string, options *GroupSearchOptions) ([]GroupMember, *Response, error)

GetWithOptions returns a paginated list of 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

func (*GroupService) Remove added in v1.1.0

func (s *GroupService) Remove(groupname string, username string) (*Response, error)

Remove removes user from group

JIRA API docs: https://docs.atlassian.com/jira/REST/cloud/#api/2/group-removeUserFromGroup

type Holder added in v1.8.0

type Holder struct {
	Type      string `json:"type" structs:"type"`
	Parameter string `json:"parameter" structs:"parameter"`
	Expand    string `json:"expand" structs:"expand"`
}

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"`
	RenderedFields *IssueRenderedFields `json:"renderedFields,omitempty" structs:"renderedFields,omitempty"`
	Changelog      *Changelog           `json:"changelog,omitempty" structs:"changelog,omitempty"`
	Transitions    []Transition         `json:"transitions,omitempty" structs:"transitions,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
	//      * "workratio": -1,
	//      * "lastViewed": null,
	//      * "environment": null,
	Expand                        string            `json:"expand,omitempty" structs:"expand,omitempty"`
	Type                          IssueType         `json:"issuetype,omitempty" structs:"issuetype,omitempty"`
	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                Time              `json:"resolutiondate,omitempty" structs:"resolutiondate,omitempty"`
	Created                       Time              `json:"created,omitempty" structs:"created,omitempty"`
	Duedate                       Date              `json:"duedate,omitempty" structs:"duedate,omitempty"`
	Watches                       *Watches          `json:"watches,omitempty" structs:"watches,omitempty"`
	Assignee                      *User             `json:"assignee,omitempty" structs:"assignee,omitempty"`
	Updated                       Time              `json:"updated,omitempty" structs:"updated,omitempty"`
	Description                   Document          `json:"description,omitempty" structs:"description,omitempty"`
	Summary                       string            `json:"summary,omitempty" structs:"summary,omitempty"`
	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"`
	AffectsVersions               []*AffectsVersion `json:"versions,omitempty" structs:"versions,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"`
	Sprint                        *Sprint           `json:"sprint,omitempty" structs:"sprint,omitempty"`
	Parent                        *Parent           `json:"parent,omitempty" structs:"parent,omitempty"`
	AggregateTimeOriginalEstimate int               `json:"aggregatetimeoriginalestimate,omitempty" structs:"aggregatetimeoriginalestimate,omitempty"`
	AggregateTimeSpent            int               `json:"aggregatetimespent,omitempty" structs:"aggregatetimespent,omitempty"`
	AggregateTimeEstimate         int               `json:"aggregatetimeestimate,omitempty" structs:"aggregatetimeestimate,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 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 IssueLinkTypeService added in v1.14.2

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

IssueLinkTypeService handles issue link types for the JIRA instance / API.

JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-group-Issue-link-types

func (*IssueLinkTypeService) Create added in v1.14.2

func (s *IssueLinkTypeService) Create(linkType *IssueLinkType) (*IssueLinkType, *Response, error)

Create creates an issue link type in JIRA.

JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-issueLinkType-post

func (*IssueLinkTypeService) Delete added in v1.14.2

func (s *IssueLinkTypeService) Delete(ID string) (*Response, error)

Delete deletes an issue link type based on provided ID.

JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-issueLinkType-issueLinkTypeId-delete

func (*IssueLinkTypeService) Get added in v1.14.2

Get gets info of a specific issue link type from JIRA.

JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-issueLinkType-issueLinkTypeId-get

func (*IssueLinkTypeService) GetList added in v1.14.2

func (s *IssueLinkTypeService) GetList() ([]IssueLinkType, *Response, error)

GetList gets all of the issue link types from JIRA.

JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-issueLinkType-get

func (*IssueLinkTypeService) Update added in v1.14.2

func (s *IssueLinkTypeService) Update(linkType *IssueLinkType) (*IssueLinkType, *Response, error)

Update updates an issue link type. The issue is found by key.

JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-issueLinkType-issueLinkTypeId-put

type IssueRenderedFields added in v1.4.0

type IssueRenderedFields struct {
	// TODO Missing fields
	//      * "aggregatetimespent": null,
	//      * "workratio": -1,
	//      * "lastViewed": null,
	//      * "aggregatetimeoriginalestimate": null,
	//      * "aggregatetimeestimate": null,
	//      * "environment": null,
	Resolutiondate string    `json:"resolutiondate,omitempty" structs:"resolutiondate,omitempty"`
	Created        string    `json:"created,omitempty" structs:"created,omitempty"`
	Duedate        string    `json:"duedate,omitempty" structs:"duedate,omitempty"`
	Updated        string    `json:"updated,omitempty" structs:"updated,omitempty"`
	Comments       *Comments `json:"comment,omitempty" structs:"comment,omitempty"`
	Description    string    `json:"description,omitempty" structs:"description,omitempty"`
}

IssueRenderedFields represents rendered fields of a JIRA issue. Not all IssueFields are rendered.

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

func (s *IssueService) AddComment(issueID string, comment *Comment) (*Comment, *Response, error)

AddComment adds a new comment to issueID.

JIRA API docs: https://docs.atlassian.com/jira/REST/latest/#api/2/issue-addComment

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) AddWatcher added in v1.1.0

func (s *IssueService) AddWatcher(issueID string, userName string) (*Response, error)

AddWatcher adds watcher to the given issue

JIRA API docs: https://docs.atlassian.com/software/jira/docs/api/REST/latest/#api/2/issue-addWatcher

func (*IssueService) AddWorklogRecord added in v1.1.0

func (s *IssueService) AddWorklogRecord(issueID string, record *WorklogRecord, options ...func(*http.Request) error) (*WorklogRecord, *Response, error)

AddWorklogRecord adds a new worklog record to issueID.

https://developer.atlassian.com/cloud/jira/platform/rest/#api-api-2-issue-issueIdOrKey-worklog-post

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) DeleteAttachment added in v1.14.2

func (s *IssueService) DeleteAttachment(attachmentID string) (*Response, error)

DeleteAttachment deletes an attachment of a given attachmentID

func (*IssueService) DeleteComment added in v1.6.0

func (s *IssueService) DeleteComment(issueID, commentID string) error

DeleteComment Deletes a comment from an issueID.

JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/v3/#api-api-3-issue-issueIdOrKey-comment-id-delete

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(projectkeys string) (*CreateMetaInfo, *Response, error)

GetCreateMeta makes the api call to get the meta information required to create a ticket

func (*IssueService) GetCreateMetaWithOptions added in v1.1.0

func (s *IssueService) GetCreateMetaWithOptions(options *GetQueryOptions) (*CreateMetaInfo, *Response, error)

GetCreateMetaWithOptions makes the api call to get the meta information without requiring to have a projectKey

func (*IssueService) GetCustomFields

func (s *IssueService) GetCustomFields(issueID string) (CustomFields, *Response, error)

GetCustomFields returns a map of customfield_* keys with string values

func (s *IssueService) GetRemoteLinks(id string) (*[]RemoteLink, *Response, error)

GetRemoteLinks gets remote issue links on the issue.

JIRA API docs: https://docs.atlassian.com/jira/REST/latest/#api/2/issue-getRemoteIssueLinks

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) GetWatchers added in v1.1.0

func (s *IssueService) GetWatchers(issueID string) (*[]User, *Response, error)

GetWatchers wil return all the users watching/observing the given issue

JIRA API docs: https://docs.atlassian.com/software/jira/docs/api/REST/latest/#api/2/issue-getIssueWatchers

func (*IssueService) GetWorklogs added in v1.1.0

func (s *IssueService) GetWorklogs(issueID string, options ...func(*http.Request) error) (*Worklog, *Response, error)

GetWorklogs gets all the worklogs for an issue. This method is especially important if you need to read all the worklogs, not just the first page.

https://docs.atlassian.com/jira/REST/cloud/#api/2/issue/{issueIdOrKey}/worklog-getIssueWorklog

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) RemoveWatcher added in v1.1.0

func (s *IssueService) RemoveWatcher(issueID string, userName string) (*Response, error)

RemoveWatcher removes given user from given issue

JIRA API docs: https://docs.atlassian.com/software/jira/docs/api/REST/latest/#api/2/issue-removeWatcher

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) SearchPages added in v1.1.0

func (s *IssueService) SearchPages(jql string, options *SearchOptions, f func(Issue) error) error

SearchPages will get issues from all pages in a search

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) UpdateAssignee added in v1.6.0

func (s *IssueService) UpdateAssignee(issueID string, assignee *User) (*Response, error)

UpdateAssignee updates the user assigned to work on the given issue

JIRA API docs: https://docs.atlassian.com/software/jira/docs/api/REST/7.10.2/#api/2/issue-assign

func (*IssueService) UpdateComment added in v1.1.0

func (s *IssueService) UpdateComment(issueID string, comment *Comment) (*Comment, *Response, error)

UpdateComment updates the body of a comment, identified by comment.ID, on the issueID.

JIRA API docs: https://docs.atlassian.com/jira/REST/cloud/#api/2/issue/{issueIdOrKey}/comment-updateComment

func (*IssueService) UpdateIssue

func (s *IssueService) UpdateIssue(jiraID string, data map[string]interface{}) (*Response, error)

UpdateIssue 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

func (*IssueService) UpdateWithOptions added in v1.7.0

func (s *IssueService) UpdateWithOptions(issue *Issue, opts *UpdateQueryOptions) (*Issue, *Response, error)

UpdateWithOptions updates an issue from a JSON representation, while also specifiying query params. The issue is found by key.

JIRA API docs: https://docs.atlassian.com/jira/REST/cloud/#api/2/issue-editIssue

func (*IssueService) UpdateWorklogRecord added in v1.14.2

func (s *IssueService) UpdateWorklogRecord(issueID, worklogID string, record *WorklogRecord, options ...func(*http.Request) error) (*WorklogRecord, *Response, error)

UpdateWorklogRecord updates a worklog record.

https://docs.atlassian.com/software/jira/docs/api/REST/7.1.2/#api/2/issue-updateWorklog

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 JWTAuthTransport added in v1.14.2

type JWTAuthTransport struct {
	Secret []byte
	Issuer string

	// Transport is the underlying HTTP transport to use when making requests.
	// It will default to http.DefaultTransport if nil.
	Transport http.RoundTripper
}

JWTAuthTransport is an http.RoundTripper that authenticates all requests using Jira's JWT based authentication.

NOTE: this form of auth should be used by add-ons installed from the Atlassian marketplace.

JIRA docs: https://developer.atlassian.com/cloud/jira/platform/understanding-jwt Examples in other languages:

https://bitbucket.org/atlassian/atlassian-jwt-ruby/src/d44a8e7a4649e4f23edaa784402655fda7c816ea/lib/atlassian/jwt.rb
https://bitbucket.org/atlassian/atlassian-jwt-py/src/master/atlassian_jwt/url_utils.py

func (*JWTAuthTransport) Client added in v1.14.2

func (t *JWTAuthTransport) Client() *http.Client

func (*JWTAuthTransport) RoundTrip added in v1.14.2

func (t *JWTAuthTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip adds the session object to the request.

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 Permission added in v1.8.0

type Permission struct {
	ID     int    `json:"id" structs:"id"`
	Self   string `json:"expand" structs:"expand"`
	Holder Holder `json:"holder" structs:"holder"`
	Name   string `json:"permission" structs:"permission"`
}

type PermissionScheme added in v1.3.0

type PermissionScheme struct {
	Expand      string       `json:"expand" structs:"expand,omitempty"`
	Self        string       `json:"self" structs:"self,omitempty"`
	ID          int          `json:"id" structs:"id,omitempty"`
	Name        string       `json:"name" structs:"name,omitempty"`
	Description string       `json:"description" structs:"description,omitempty"`
	Permissions []Permission `json:"permissions" structs:"permissions,omitempty"`
}

PermissionScheme represents the permission scheme for the project

type PermissionSchemeService added in v1.8.0

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

PermissionSchemeService handles permissionschemes for the JIRA instance / API.

JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/v3/#api-group-Permissionscheme

func (*PermissionSchemeService) Get added in v1.8.0

Get returns a full representation of the permission scheme for the schemeID

JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/v3/#api-api-3-permissionscheme-schemeId-get

func (*PermissionSchemeService) GetList added in v1.8.0

GetList returns a list of all permission schemes

JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/v3/#api-api-3-permissionscheme-get

type PermissionSchemes added in v1.8.0

type PermissionSchemes struct {
	PermissionSchemes []PermissionScheme `json:"permissionSchemes" structs:"permissionSchemes"`
}

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"`
	StatusColor string `json:"statusColor,omitempty" structs:"statusColor,omitempty"`
	Description string `json:"description,omitempty" structs:"description,omitempty"`
}

Priority represents a priority of a JIRA issue. Typical types are "Normal", "Moderate", "Urgent", ...

type PriorityService added in v1.4.0

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

PriorityService handles priorities for the JIRA instance / API.

JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/#api-Priority

func (*PriorityService) GetList added in v1.4.0

func (s *PriorityService) GetList() ([]Priority, *Response, error)

GetList gets all priorities from JIRA

JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/#api-api-2-priority-get

type Progress

type Progress struct {
	Progress int `json:"progress" structs:"progress"`
	Total    int `json:"total" structs:"total"`
	Percent  int `json:"percent" structs:"percent"`
}

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           map[string]string  `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"`
	IssueTypes      []IssueType     `json:"issueTypes,omitempty" structs:"issueTypes,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

func (*ProjectService) GetPermissionScheme added in v1.3.0

func (s *ProjectService) GetPermissionScheme(projectID string) (*PermissionScheme, *Response, error)

GetPermissionScheme returns a full representation of the permission scheme for the project 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) ListWithOptions added in v1.1.0

func (s *ProjectService) ListWithOptions(options *GetQueryOptions) (*ProjectList, *Response, error)

ListWithOptions gets all projects form JIRA with optional query params, like &GetQueryOptions{Expand: "issueTypes"} to get a list of all projects and their supported issuetypes

JIRA API docs: https://docs.atlassian.com/jira/REST/latest/#api/2/project-getAllProjects

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

RemoteLink represents remote links which linked to issues

type RemoteLinkApplication added in v1.14.2

type RemoteLinkApplication struct {
	Type string `json:"type,omitempty" structs:"type,omitempty"`
	Name string `json:"name,omitempty" structs:"name,omitempty"`
}

RemoteLinkApplication represents remote links application

type RemoteLinkIcon added in v1.14.2

type RemoteLinkIcon struct {
	Url16x16 string `json:"url16x16,omitempty" structs:"url16x16,omitempty"`
	Title    string `json:"title,omitempty" structs:"title,omitempty"`
	Link     string `json:"link,omitempty" structs:"link,omitempty"`
}

RemoteLinkIcon represents icon displayed next to link

type RemoteLinkObject added in v1.14.2

type RemoteLinkObject struct {
	URL     string            `json:"url,omitempty" structs:"url,omitempty"`
	Title   string            `json:"title,omitempty" structs:"title,omitempty"`
	Summary string            `json:"summary,omitempty" structs:"summary,omitempty"`
	Icon    *RemoteLinkIcon   `json:"icon,omitempty" structs:"icon,omitempty"`
	Status  *RemoteLinkStatus `json:"status,omitempty" structs:"status,omitempty"`
}

RemoteLinkObject represents remote link object itself

type RemoteLinkStatus added in v1.14.2

type RemoteLinkStatus struct {
	Resolved bool
	Icon     *RemoteLinkIcon
}

RemoteLinkStatus if the link is a resolvable object (issue, epic) - the structure represent its status

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 ResolutionService added in v1.4.0

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

ResolutionService handles resolutions for the JIRA instance / API.

JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/#api-Resolution

func (*ResolutionService) GetList added in v1.4.0

func (s *ResolutionService) GetList() ([]Resolution, *Response, error)

GetList gets all resolutions from JIRA

JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/#api-api-2-resolution-get

type Response

type Response struct {
	*http.Response

	StartAt    int
	MaxResults int
	Total      int
}

Response represents JIRA API response. It wraps http.Response returned from API and provides information about paging.

type Role added in v1.8.0

type Role struct {
	Self        string   `json:"self" structs:"self"`
	Name        string   `json:"name" structs:"name"`
	ID          int      `json:"id" structs:"id"`
	Description string   `json:"description" structs:"description"`
	Actors      []*Actor `json:"actors" structs:"actors"`
}

Role represents a JIRA product role

type RoleService added in v1.8.0

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

RoleService handles roles for the JIRA instance / API.

JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/v3/#api-group-Role

func (*RoleService) Get added in v1.8.0

func (s *RoleService) Get(roleID int) (*Role, *Response, error)

Get retreives a single Role from Jira

JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/v3/#api-api-3-role-id-get

func (*RoleService) GetList added in v1.8.0

func (s *RoleService) GetList() (*[]Role, *Response, error)

GetList returns a list of all available project roles

JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/v3/#api-api-3-role-get

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
	// ValidateQuery: The validateQuery param offers control over whether to validate and how strictly to treat the validation. Default: strict.
	ValidateQuery string `url:"validateQuery,omitempty"`
}

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) GetIssue added in v1.2.0

func (s *SprintService) GetIssue(issueID string, options *GetQueryOptions) (*Issue, *Response, error)

GetIssue 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-software/REST/7.3.1/#agile/1.0/issue-getIssue

TODO: create agile service for holding all agile apis' implementation

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 SprintsList added in v1.4.0

type SprintsList 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     []Sprint `json:"values" structs:"values"`
}

SprintsList reflects a list of agile sprints

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 StatusCategoryService added in v1.4.0

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

StatusCategoryService handles status categories for the JIRA instance / API.

JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/#api-Statuscategory

func (*StatusCategoryService) GetList added in v1.4.0

func (s *StatusCategoryService) GetList() ([]StatusCategory, *Response, error)

GetList gets all status categories from JIRA

JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/#api-api-2-statuscategory-get

type StatusService added in v1.14.2

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

StatusService handles staties for the JIRA instance / API.

JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-group-Workflow-statuses

func (*StatusService) GetAllStatuses added in v1.14.2

func (s *StatusService) GetAllStatuses() ([]Status, *Response, error)

GetAllStatuses returns a list of all statuses associated with workflows.

JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-status-get

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

type Time time.Time

Time represents the Time definition of JIRA as a time.Time of go

func (Time) Equal added in v1.14.2

func (t Time) Equal(u Time) bool

func (Time) MarshalJSON added in v1.7.0

func (t Time) MarshalJSON() ([]byte, error)

MarshalJSON will transform the time.Time into a JIRA time during the creation of a JIRA request

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(b []byte) error

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"`
	To     Status                     `json:"to" structs:"status"`
	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 TransitionPayloadFields added in v1.1.0

type TransitionPayloadFields struct {
	Resolution *Resolution `json:"resolution,omitempty" structs:"resolution,omitempty"`
}

TransitionPayloadFields represents the fields that can be set when executing a transition

type UpdateQueryOptions added in v1.7.0

type UpdateQueryOptions struct {
	NotifyUsers            bool `url:"notifyUsers,omitempty"`
	OverrideScreenSecurity bool `url:"overrideScreenSecurity,omitempty"`
	OverrideEditableFlag   bool `url:"overrideEditableFlag,omitempty"`
}

UpdateQueryOptions specifies the optional parameters to the Edit issue

type User

type User struct {
	Self        string `json:"self,omitempty" structs:"self,omitempty"`
	AccountID   string `json:"accountId,omitempty" structs:"accountId,omitempty"`
	AccountType string `json:"accountType,omitempty" structs:"accountType,omitempty"`
	// TODO: name & key are deprecated, see:
	// https://developer.atlassian.com/cloud/jira/platform/api-changes-for-user-privacy-announcement/
	Name            string     `json:"name,omitempty" structs:"name,omitempty"`
	Key             string     `json:"key,omitempty" structs:"key,omitempty"`
	Password        string     `json:"-"`
	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"`
	Locale          string     `json:"locale,omitempty" structs:"locale,omitempty"`
	ApplicationKeys []string   `json:"applicationKeys,omitempty" structs:"applicationKeys,omitempty"`
}

User represents a JIRA user.

type UserGroup added in v1.1.0

type UserGroup struct {
	Self string `json:"self,omitempty" structs:"self,omitempty"`
	Name string `json:"name,omitempty" structs:"name,omitempty"`
}

UserGroup represents the group list

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) Delete added in v1.6.0

func (s *UserService) Delete(username string) (*Response, error)

Delete deletes an user from JIRA. Returns http.StatusNoContent on success.

JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/#api-api-2-user-delete

func (*UserService) Find added in v1.1.0

func (s *UserService) Find(property string, tweaks ...userSearchF) ([]User, *Response, error)

Find searches for user info from JIRA: It can find users by email, username or name

JIRA API docs: https://docs.atlassian.com/jira/REST/cloud/#api/2/user-findUsers

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

/!\ Deprecation notice: https://developer.atlassian.com/cloud/jira/platform/deprecation-notice-user-privacy-api-migration-guide/ By 29 April 2019, we will remove personal data from the API that is used to identify users, such as username and userKey, and instead use the Atlassian account ID (accountId).

func (*UserService) GetByAccountID added in v1.14.2

func (s *UserService) GetByAccountID(accountID string) (*User, *Response, error)

Get gets user info from JIRA

JIRA API docs: https://docs.atlassian.com/jira/REST/cloud/#api/2/user-getUser

func (*UserService) GetGroups added in v1.1.0

func (s *UserService) GetGroups(username string) (*[]UserGroup, *Response, error)

GetGroups returns the groups which the user belongs to

JIRA API docs: https://docs.atlassian.com/jira/REST/cloud/#api/2/user-getUserGroups

func (*UserService) GetSelf added in v1.5.0

func (s *UserService) GetSelf() (*User, *Response, error)

Get information about the current logged-in user

JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/#api-api-2-myself-get

type Version

type Version 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"`
	Description     string `json:"description,omitempty" structs:"description,omitempty"`
	Archived        bool   `json:"archived,omitempty" structs:"archived,omitempty"`
	Released        bool   `json:"released,omitempty" structs:"released,omitempty"`
	ReleaseDate     string `json:"releaseDate,omitempty" structs:"releaseDate,omitempty"`
	UserReleaseDate string `json:"userReleaseDate,omitempty" structs:"userReleaseDate,omitempty"`
	ProjectID       int    `json:"projectId,omitempty" structs:"projectId,omitempty"` // Unlike other IDs, this is returned as a number
	StartDate       string `json:"startDate,omitempty" structs:"startDate,omitempty"`
}

Version represents a single release version of a project

type VersionService added in v1.1.0

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

VersionService handles Versions for the JIRA instance / API.

JIRA API docs: https://docs.atlassian.com/jira/REST/latest/#api/2/version

func (*VersionService) Create added in v1.1.0

func (s *VersionService) Create(version *Version) (*Version, *Response, error)

Create creates a version in JIRA.

JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/#api-api-2-version-post

func (*VersionService) Get added in v1.1.0

func (s *VersionService) Get(versionID int) (*Version, *Response, error)

Get gets version info from JIRA

JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/#api-api-2-version-id-get

func (*VersionService) Update added in v1.1.0

func (s *VersionService) Update(version *Version) (*Version, *Response, error)

Update updates a version from a JSON representation.

JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/#api-api-2-version-id-put

type Watcher added in v1.1.0

type Watcher struct {
	Self        string `json:"self,omitempty" structs:"self,omitempty"`
	Name        string `json:"name,omitempty" structs:"name,omitempty"`
	AccountID   string `json:"accountId,omitempty" structs:"accountId,omitempty"`
	DisplayName string `json:"displayName,omitempty" structs:"displayName,omitempty"`
	Active      bool   `json:"active,omitempty" structs:"active,omitempty"`
}

Watcher represents a simplified user that "observes" the issue

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"`
	Watchers   []*Watcher `json:"watchers,omitempty" structs:"watchers,omitempty"`
}

Watches represents a type of how many and which 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,omitempty" structs:"self,omitempty"`
	Author           *User            `json:"author,omitempty" structs:"author,omitempty"`
	UpdateAuthor     *User            `json:"updateAuthor,omitempty" structs:"updateAuthor,omitempty"`
	Comment          string           `json:"comment,omitempty" structs:"comment,omitempty"`
	Created          *Time            `json:"created,omitempty" structs:"created,omitempty"`
	Updated          *Time            `json:"updated,omitempty" structs:"updated,omitempty"`
	Started          *Time            `json:"started,omitempty" structs:"started,omitempty"`
	TimeSpent        string           `json:"timeSpent,omitempty" structs:"timeSpent,omitempty"`
	TimeSpentSeconds int              `json:"timeSpentSeconds,omitempty" structs:"timeSpentSeconds,omitempty"`
	ID               string           `json:"id,omitempty" structs:"id,omitempty"`
	IssueID          string           `json:"issueId,omitempty" structs:"issueId,omitempty"`
	Properties       []EntityProperty `json:"properties,omitempty"`
}

WorklogRecord represents one entry of a Worklog

Directories

Path Synopsis
examples
do

Jump to

Keyboard shortcuts

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