jira

package module
v1.15.2 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2022 License: MIT Imports: 21 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.14
  • Jira v6.3.4 & v7.1.2.

Note that we also run our tests against 1.13, though only the last two versions of Go are officially supported.

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"
	jira "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.

Token (Jira on Atlassian Cloud)

Token-based authentication uses the basic authentication scheme, with a user-generated API token in place of a user's password. You can generate a token for your user here. Additional information about Atlassian Cloud API tokens can be found here.

A more thorough, runnable example is provided in the examples directory.

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)
}
Basic (self-hosted Jira)

Password-based API authentication works for self-hosted Jira only, and has been deprecated for users of Atlassian Cloud.

The above token authentication example may be used, substituting a user's password for a generated token.

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)
}
Change an issue status

This is how one can change an issue status. In this example, we change the issue from "To Do" to "In Progress."

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

	issue, _, _ := jiraClient.Issue.Get("FART-1", nil)
	currentStatus := issue.Fields.Status.Name
	fmt.Printf("Current status: %s\n", currentStatus)

	var transitionID string
	possibleTransitions, _, _ := jiraClient.Issue.GetTransitions("FART-1")
	for _, v := range possibleTransitions {
		if v.Name == "In Progress" {
			transitionID = v.ID
			break
		}
	}

	jiraClient.Issue.DoTransition("FART-1", transitionID)
	issue, _, _ = jiraClient.Issue.Get(testIssueID, nil)
	fmt.Printf("Status after transition: %+v\n", issue.Fields.Status.Name)
}
Get all the issues for JQL with Pagination

Jira API has limit on maxResults it can return. You may have a usecase where you need to get all issues for given JQL. This example shows reference implementation of GetAllIssues function which does pagination on Jira API to get all the issues for given JQL

please look at Pagination Example

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 (
	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 Bool added in v1.15.2

func Bool(v bool) *bool

Bool is a helper routine that allocates a new bool value to store v and returns a pointer to it.

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 WithAccountId added in v1.15.2

func WithAccountId(accountId string) userSearchF

WithAccountId sets the account id to search

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 WithProperty added in v1.15.2

func WithProperty(property string) userSearchF

WithProperty sets the property (Property keys are specified by path) to search

func WithQueryOptions added in v1.15.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

func WithUsername added in v1.15.2

func WithUsername(username string) userSearchF

WithUsername sets the username to search

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.15.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 wraps AcquireSessionCookieWithContext using the background context.

Deprecated: Use CookieAuthTransport instead

func (*AuthenticationService) AcquireSessionCookieWithContext deprecated added in v1.15.2

func (s *AuthenticationService) AcquireSessionCookieWithContext(ctx context.Context, username, password string) (bool, error)

AcquireSessionCookieWithContext 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 wraps GetCurrentUserWithContext using the background context.

func (*AuthenticationService) GetCurrentUserWithContext added in v1.15.2

func (s *AuthenticationService) GetCurrentUserWithContext(ctx context.Context) (*Session, error)

GetCurrentUserWithContext 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 wraps LogoutWithContext using the background context.

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

func (*AuthenticationService) LogoutWithContext deprecated added in v1.15.2

func (s *AuthenticationService) LogoutWithContext(ctx context.Context) error

LogoutWithContext 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 BearerAuthTransport added in v1.15.2

type BearerAuthTransport struct {
	Token string

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

BearerAuthTransport is a http.RoundTripper that authenticates all requests using Jira's bearer (oauth 2.0 (3lo)) based authentication.

func (*BearerAuthTransport) Client added in v1.15.2

func (t *BearerAuthTransport) 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 (*BearerAuthTransport) RoundTrip added in v1.15.2

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

RoundTrip implements the RoundTripper interface. We just add the bearer token 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.15.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.15.2

type BoardConfigurationColumn struct {
	Name   string                           `json:"name"`
	Status []BoardConfigurationColumnStatus `json:"statuses"`
	Min    int                              `json:"min,omitempty"`
	Max    int                              `json:"max,omitempty"`
}

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

type BoardConfigurationColumnConfig added in v1.15.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.15.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.15.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.15.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.15.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 wraps CreateBoardWithContext using the background context.

func (*BoardService) CreateBoardWithContext added in v1.15.2

func (s *BoardService) CreateBoardWithContext(ctx context.Context, board *Board) (*Board, *Response, error)

CreateBoardWithContext 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 wraps DeleteBoardWithContext using the background context. Caller must close resp.Body

func (*BoardService) DeleteBoardWithContext added in v1.15.2

func (s *BoardService) DeleteBoardWithContext(ctx context.Context, boardID int) (*Board, *Response, error)

DeleteBoardWithContext will delete an agile board.

Jira API docs: https://docs.atlassian.com/jira-software/REST/cloud/#agile/1.0/board-deleteBoard Caller must close resp.Body

func (*BoardService) GetAllBoards

func (s *BoardService) GetAllBoards(opt *BoardListOptions) (*BoardsList, *Response, error)

GetAllBoards wraps GetAllBoardsWithContext using the background context.

func (*BoardService) GetAllBoardsWithContext added in v1.15.2

func (s *BoardService) GetAllBoardsWithContext(ctx context.Context, opt *BoardListOptions) (*BoardsList, *Response, error)

GetAllBoardsWithContext 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 wraps GetAllSprintsWithContext using the background context.

func (*BoardService) GetAllSprintsWithContext added in v1.15.2

func (s *BoardService) GetAllSprintsWithContext(ctx context.Context, boardID string) ([]Sprint, *Response, error)

GetAllSprintsWithContext 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 wraps GetAllSprintsWithOptionsWithContext using the background context.

func (*BoardService) GetAllSprintsWithOptionsWithContext added in v1.15.2

func (s *BoardService) GetAllSprintsWithOptionsWithContext(ctx context.Context, boardID int, options *GetAllSprintsOptions) (*SprintsList, *Response, error)

GetAllSprintsWithOptionsWithContext 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 wraps GetBoardWithContext using the background context.

func (*BoardService) GetBoardConfiguration added in v1.15.2

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

GetBoardConfiguration wraps GetBoardConfigurationWithContext using the background context.

func (*BoardService) GetBoardConfigurationWithContext added in v1.15.2

func (s *BoardService) GetBoardConfigurationWithContext(ctx context.Context, boardID int) (*BoardConfiguration, *Response, error)

GetBoardConfigurationWithContext 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

func (*BoardService) GetBoardWithContext added in v1.15.2

func (s *BoardService) GetBoardWithContext(ctx context.Context, boardID int) (*Board, *Response, error)

GetBoardWithContext will returns the board for the given boardID. This board will only be returned if the user has permission to view it.

Jira API docs: https://docs.atlassian.com/jira-software/REST/cloud/#agile/1.0/board-getBoard

type BoardsList

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

BoardsList reflects a list of agile boards

type Changelog

type Changelog struct {
	Histories []ChangelogHistory `json:"histories,omitempty"`
}

Changelog reflects the change log of an issue

type ChangelogHistory

type ChangelogHistory struct {
	Id      string           `json:"id" structs:"id"`
	Author  User             `json:"author" structs:"author"`
	Created string           `json:"created" structs:"created"`
	Items   []ChangelogItems `json:"items" structs:"items"`
}

ChangelogHistory reflects one single changelog history entry

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
	Organization     *OrganizationService
	ServiceDesk      *ServiceDeskService
	Customer         *CustomerService
	Request          *RequestService
	// 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 wraps NewMultiPartRequestWithContext using the background context.

func (*Client) NewMultiPartRequestWithContext added in v1.15.2

func (c *Client) NewMultiPartRequestWithContext(ctx context.Context, method, urlStr string, buf *bytes.Buffer) (*http.Request, error)

NewMultiPartRequestWithContext 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 wraps NewRawRequestWithContext using the background context.

func (*Client) NewRawRequestWithContext added in v1.15.2

func (c *Client) NewRawRequestWithContext(ctx context.Context, method, urlStr string, body io.Reader) (*http.Request, error)

NewRawRequestWithContext 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 wraps NewRequestWithContext using the background context.

func (*Client) NewRequestWithContext added in v1.15.2

func (c *Client) NewRequestWithContext(ctx context.Context, method, urlStr string, body interface{}) (*http.Request, error)

NewRequestWithContext 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"`
	Description string `json:"description,omitempty" structs:"description,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 wraps CreateWithContext using the background context.

func (*ComponentService) CreateWithContext added in v1.15.2

func (s *ComponentService) CreateWithContext(ctx context.Context, options *CreateComponentOptions) (*ProjectComponent, *Response, error)

CreateWithContext creates a new Jira component based on the given options.

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 {
	Update     TransitionPayloadUpdate `json:"update,omitempty" structs:"update,omitempty"`
	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 Customer added in v1.15.2

type Customer struct {
	AccountID    string    `json:"accountId,omitempty" structs:"accountId,omitempty"`
	Name         string    `json:"name,omitempty" structs:"name,omitempty"`
	Key          string    `json:"key,omitempty" structs:"key,omitempty"`
	EmailAddress string    `json:"emailAddress,omitempty" structs:"emailAddress,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"`
	Links        *SelfLink `json:"_links,omitempty" structs:"_links,omitempty"`
}

Customer represents a ServiceDesk customer.

type CustomerList added in v1.15.2

type CustomerList struct {
	Values  []Customer `json:"values,omitempty" structs:"values,omitempty"`
	Start   int        `json:"start,omitempty" structs:"start,omitempty"`
	Limit   int        `json:"limit,omitempty" structs:"limit,omitempty"`
	IsLast  bool       `json:"isLastPage,omitempty" structs:"isLastPage,omitempty"`
	Expands []string   `json:"_expands,omitempty" structs:"_expands,omitempty"`
}

CustomerList is a page of customers.

type CustomerListOptions added in v1.15.2

type CustomerListOptions struct {
	Query string `url:"query,omitempty"`
	Start int    `url:"start,omitempty"`
	Limit int    `url:"limit,omitempty"`
}

CustomerListOptions is the query options for listing customers.

type CustomerService added in v1.15.2

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

CustomerService handles ServiceDesk customers for the Jira instance / API.

func (*CustomerService) Create added in v1.15.2

func (c *CustomerService) Create(email, displayName string) (*Customer, *Response, error)

Create wraps CreateWithContext using the background context.

func (*CustomerService) CreateWithContext added in v1.15.2

func (c *CustomerService) CreateWithContext(ctx context.Context, email, displayName string) (*Customer, *Response, error)

CreateWithContext creates a ServiceDesk customer.

https://developer.atlassian.com/cloud/jira/service-desk/rest/api-group-customer/#api-rest-servicedeskapi-customer-post

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 EditMetaInfo added in v1.15.2

type EditMetaInfo struct {
	Fields tcontainer.MarshalMap `json:"fields,omitempty"`
}

EditMetaInfo contains information about fields and their attributed to edit a ticket.

type EntityProperty added in v1.15.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"`
	Items    string `json:"items,omitempty" structs:"items,omitempty"`
	Custom   string `json:"custom,omitempty" structs:"custom,omitempty"`
	System   string `json:"system,omitempty" structs:"system,omitempty"`
	CustomID int64  `json:"customId,omitempty" structs:"customId,omitempty"`
}

FieldSchema represents a schema of a Jira field. Documentation: https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issue-fields/#api-rest-api-2-field-get

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 wraps GetListWithContext using the background context.

func (*FieldService) GetListWithContext added in v1.15.2

func (s *FieldService) GetListWithContext(ctx context.Context) ([]Field, *Response, error)

GetListWithContext 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.15.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 wraps GetWithContext using the background context.

func (*FilterService) GetFavouriteList added in v1.7.0

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

GetFavouriteList wraps GetFavouriteListWithContext using the background context.

func (*FilterService) GetFavouriteListWithContext added in v1.15.2

func (fs *FilterService) GetFavouriteListWithContext(ctx context.Context) ([]*Filter, *Response, error)

GetFavouriteListWithContext retrieves the user's favourited filters from Jira

func (*FilterService) GetList added in v1.6.0

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

GetList wraps GetListWithContext using the background context.

func (*FilterService) GetListWithContext added in v1.15.2

func (fs *FilterService) GetListWithContext(ctx context.Context) ([]*Filter, *Response, error)

GetListWithContext retrieves all filters from Jira

func (*FilterService) GetMyFilters added in v1.15.2

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

GetMyFilters wraps GetMyFiltersWithContext using the background context.

func (*FilterService) GetMyFiltersWithContext added in v1.15.2

func (fs *FilterService) GetMyFiltersWithContext(ctx context.Context, opts *GetMyFiltersQueryOptions) ([]*Filter, *Response, error)

GetMyFiltersWithContext retrieves the my Filters.

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

func (*FilterService) GetWithContext added in v1.15.2

func (fs *FilterService) GetWithContext(ctx context.Context, filterID int) (*Filter, *Response, error)

GetWithContext retrieves a single Filter from Jira

func (*FilterService) Search added in v1.15.2

Search wraps SearchWithContext using the background context.

func (*FilterService) SearchWithContext added in v1.15.2

func (fs *FilterService) SearchWithContext(ctx context.Context, opt *FilterSearchOptions) (*FiltersList, *Response, error)

SearchWithContext 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.15.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.15.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.15.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.15.2

type GetWorklogsQueryOptions struct {
	StartAt      int64  `url:"startAt,omitempty"`
	MaxResults   int32  `url:"maxResults,omitempty"`
	StartedAfter int64  `url:"startedAfter,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 wraps AddWithContext using the background context.

func (*GroupService) AddWithContext added in v1.15.2

func (s *GroupService) AddWithContext(ctx context.Context, groupname string, username string) (*Group, *Response, error)

AddWithContext 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 wraps GetWithContext using the background context.

func (*GroupService) GetWithContext added in v1.15.2

func (s *GroupService) GetWithContext(ctx context.Context, name string) ([]GroupMember, *Response, error)

GetWithContext 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 wraps GetWithOptionsWithContext using the background context.

func (*GroupService) GetWithOptionsWithContext added in v1.15.2

func (s *GroupService) GetWithOptionsWithContext(ctx context.Context, name string, options *GroupSearchOptions) ([]GroupMember, *Response, error)

GetWithOptionsWithContext 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 wraps RemoveWithContext using the background context. Caller must close resp.Body

func (*GroupService) RemoveWithContext added in v1.15.2

func (s *GroupService) RemoveWithContext(ctx context.Context, groupname string, username string) (*Response, error)

RemoveWithContext removes user from group

Jira API docs: https://docs.atlassian.com/jira/REST/cloud/#api/2/group-removeUserFromGroup Caller must close resp.Body

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"`
	Names          map[string]string    `json:"names,omitempty" structs:"names,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"`
	Environment                   string            `json:"environment,omitempty" structs:"environment,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                   string            `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.15.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.15.2

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

Create wraps CreateWithContext using the background context.

func (*IssueLinkTypeService) CreateWithContext added in v1.15.2

func (s *IssueLinkTypeService) CreateWithContext(ctx context.Context, linkType *IssueLinkType) (*IssueLinkType, *Response, error)

CreateWithContext 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.15.2

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

Delete wraps DeleteWithContext using the background context. Caller must close resp.Body

func (*IssueLinkTypeService) DeleteWithContext added in v1.15.2

func (s *IssueLinkTypeService) DeleteWithContext(ctx context.Context, ID string) (*Response, error)

DeleteWithContext 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 Caller must close resp.Body

func (*IssueLinkTypeService) Get added in v1.15.2

Get wraps GetWithContext using the background context.

func (*IssueLinkTypeService) GetList added in v1.15.2

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

GetList wraps GetListWithContext using the background context.

func (*IssueLinkTypeService) GetListWithContext added in v1.15.2

func (s *IssueLinkTypeService) GetListWithContext(ctx context.Context) ([]IssueLinkType, *Response, error)

GetListWithContext 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) GetWithContext added in v1.15.2

func (s *IssueLinkTypeService) GetWithContext(ctx context.Context, ID string) (*IssueLinkType, *Response, error)

GetWithContext 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) Update added in v1.15.2

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

Update wraps UpdateWithContext using the background context. Caller must close resp.Body

func (*IssueLinkTypeService) UpdateWithContext added in v1.15.2

func (s *IssueLinkTypeService) UpdateWithContext(ctx context.Context, linkType *IssueLinkType) (*IssueLinkType, *Response, error)

UpdateWithContext 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 Caller must close resp.Body

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 wraps AddCommentWithContext using the background context.

func (*IssueService) AddCommentWithContext added in v1.15.2

func (s *IssueService) AddCommentWithContext(ctx context.Context, issueID string, comment *Comment) (*Comment, *Response, error)

AddCommentWithContext 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 wraps AddLinkWithContext using the background context. Caller must close resp.Body

func (*IssueService) AddLinkWithContext added in v1.15.2

func (s *IssueService) AddLinkWithContext(ctx context.Context, issueLink *IssueLink) (*Response, error)

AddLinkWithContext adds a link between two issues.

Jira API docs: https://docs.atlassian.com/jira/REST/latest/#api/2/issueLink Caller must close resp.Body

func (s *IssueService) AddRemoteLink(issueID string, remotelink *RemoteLink) (*RemoteLink, *Response, error)

AddRemoteLink wraps AddRemoteLinkWithContext using the background context.

func (*IssueService) AddRemoteLinkWithContext added in v1.15.2

func (s *IssueService) AddRemoteLinkWithContext(ctx context.Context, issueID string, remotelink *RemoteLink) (*RemoteLink, *Response, error)

AddRemoteLinkWithContext adds a remote link to issueID.

Jira API docs: https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-issue-issueIdOrKey-remotelink-post

func (*IssueService) AddWatcher added in v1.1.0

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

AddWatcher wraps AddWatcherWithContext using the background context. Caller must close resp.Body

func (*IssueService) AddWatcherWithContext added in v1.15.2

func (s *IssueService) AddWatcherWithContext(ctx context.Context, issueID string, userName string) (*Response, error)

AddWatcherWithContext adds watcher to the given issue

Jira API docs: https://docs.atlassian.com/software/jira/docs/api/REST/latest/#api/2/issue-addWatcher Caller must close resp.Body

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 wraps AddWorklogRecordWithContext using the background context.

func (*IssueService) AddWorklogRecordWithContext added in v1.15.2

func (s *IssueService) AddWorklogRecordWithContext(ctx context.Context, issueID string, record *WorklogRecord, options ...func(*http.Request) error) (*WorklogRecord, *Response, error)

AddWorklogRecordWithContext 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 wraps CreateWithContext using the background context.

func (*IssueService) CreateWithContext added in v1.15.2

func (s *IssueService) CreateWithContext(ctx context.Context, issue *Issue) (*Issue, *Response, error)

CreateWithContext 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 wraps DeleteWithContext using the background context. Caller must close resp.Body

func (*IssueService) DeleteAttachment added in v1.15.2

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

DeleteAttachment wraps DeleteAttachmentWithContext using the background context. Caller must close resp.Body

func (*IssueService) DeleteAttachmentWithContext added in v1.15.2

func (s *IssueService) DeleteAttachmentWithContext(ctx context.Context, attachmentID string) (*Response, error)

DeleteAttachmentWithContext deletes an attachment of a given attachmentID Caller must close resp.Body

func (*IssueService) DeleteComment added in v1.6.0

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

DeleteComment wraps DeleteCommentWithContext using the background context.

func (*IssueService) DeleteCommentWithContext added in v1.15.2

func (s *IssueService) DeleteCommentWithContext(ctx context.Context, issueID, commentID string) error

DeleteCommentWithContext 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 (s *IssueService) DeleteLink(linkID string) (*Response, error)

DeleteLink wraps DeleteLinkWithContext using the background context. Caller must close resp.Body

func (*IssueService) DeleteLinkWithContext added in v1.15.2

func (s *IssueService) DeleteLinkWithContext(ctx context.Context, linkID string) (*Response, error)

DeleteLinkWithContext deletes a link of a given linkID Caller must close resp.Body

func (*IssueService) DeleteWithContext added in v1.15.2

func (s *IssueService) DeleteWithContext(ctx context.Context, issueID string) (*Response, error)

DeleteWithContext will delete a specified issue. Caller must close resp.Body

func (*IssueService) DoTransition

func (s *IssueService) DoTransition(ticketID, transitionID string) (*Response, error)

DoTransition wraps DoTransitionWithContext using the background context.

func (*IssueService) DoTransitionWithContext added in v1.15.2

func (s *IssueService) DoTransitionWithContext(ctx context.Context, ticketID, transitionID string) (*Response, error)

DoTransitionWithContext 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 wraps DoTransitionWithPayloadWithContext using the background context. Caller must close resp.Body

func (*IssueService) DoTransitionWithPayloadWithContext added in v1.15.2

func (s *IssueService) DoTransitionWithPayloadWithContext(ctx context.Context, ticketID, payload interface{}) (*Response, error)

DoTransitionWithPayloadWithContext 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 Caller must close resp.Body

func (*IssueService) DownloadAttachment

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

DownloadAttachment wraps DownloadAttachmentWithContext using the background context. Caller must close resp.Body

func (*IssueService) DownloadAttachmentWithContext added in v1.15.2

func (s *IssueService) DownloadAttachmentWithContext(ctx context.Context, attachmentID string) (*Response, error)

DownloadAttachmentWithContext 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. Caller must close resp.Body.

func (*IssueService) Get

func (s *IssueService) Get(issueID string, options *GetQueryOptions) (*Issue, *Response, error)

Get wraps GetWithContext using the background context.

func (*IssueService) GetCreateMeta

func (s *IssueService) GetCreateMeta(projectkeys string) (*CreateMetaInfo, *Response, error)

GetCreateMeta wraps GetCreateMetaWithContext using the background context.

func (*IssueService) GetCreateMetaWithContext added in v1.15.2

func (s *IssueService) GetCreateMetaWithContext(ctx context.Context, projectkeys string) (*CreateMetaInfo, *Response, error)

GetCreateMetaWithContext 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 wraps GetCreateMetaWithOptionsWithContext using the background context.

func (*IssueService) GetCreateMetaWithOptionsWithContext added in v1.15.2

func (s *IssueService) GetCreateMetaWithOptionsWithContext(ctx context.Context, options *GetQueryOptions) (*CreateMetaInfo, *Response, error)

GetCreateMetaWithOptionsWithContext 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 wraps GetCustomFieldsWithContext using the background context.

func (*IssueService) GetCustomFieldsWithContext added in v1.15.2

func (s *IssueService) GetCustomFieldsWithContext(ctx context.Context, issueID string) (CustomFields, *Response, error)

GetCustomFieldsWithContext returns a map of customfield_* keys with string values

func (*IssueService) GetEditMeta added in v1.15.2

func (s *IssueService) GetEditMeta(issue *Issue) (*EditMetaInfo, *Response, error)

GetEditMeta wraps GetEditMetaWithContext using the background context.

func (*IssueService) GetEditMetaWithContext added in v1.15.2

func (s *IssueService) GetEditMetaWithContext(ctx context.Context, issue *Issue) (*EditMetaInfo, *Response, error)

GetEditMetaWithContext makes the api call to get the edit meta information for an issue

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

GetRemoteLinks wraps GetRemoteLinksWithContext using the background context. Caller must close resp.Body

func (*IssueService) GetRemoteLinksWithContext added in v1.15.2

func (s *IssueService) GetRemoteLinksWithContext(ctx context.Context, id string) (*[]RemoteLink, *Response, error)

GetRemoteLinksWithContext 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 wraps GetTransitionsWithContext using the background context.

func (*IssueService) GetTransitionsWithContext added in v1.15.2

func (s *IssueService) GetTransitionsWithContext(ctx context.Context, id string) ([]Transition, *Response, error)

GetTransitionsWithContext 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 wraps GetWatchersWithContext using the background context.

func (*IssueService) GetWatchersWithContext added in v1.15.2

func (s *IssueService) GetWatchersWithContext(ctx context.Context, issueID string) (*[]User, *Response, error)

GetWatchersWithContext 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) GetWithContext added in v1.15.2

func (s *IssueService) GetWithContext(ctx context.Context, issueID string, options *GetQueryOptions) (*Issue, *Response, error)

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

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

GetWorklogs wraps GetWorklogsWithContext using the background context.

func (*IssueService) GetWorklogsWithContext added in v1.15.2

func (s *IssueService) GetWorklogsWithContext(ctx context.Context, issueID string, options ...func(*http.Request) error) (*Worklog, *Response, error)

GetWorklogsWithContext 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 wraps PostAttachmentWithContext using the background context.

func (*IssueService) PostAttachmentWithContext added in v1.15.2

func (s *IssueService) PostAttachmentWithContext(ctx context.Context, issueID string, r io.Reader, attachmentName string) (*[]Attachment, *Response, error)

PostAttachmentWithContext 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 wraps RemoveWatcherWithContext using the background context. Caller must close resp.Body

func (*IssueService) RemoveWatcherWithContext added in v1.15.2

func (s *IssueService) RemoveWatcherWithContext(ctx context.Context, issueID string, userName string) (*Response, error)

RemoveWatcherWithContext removes given user from given issue

Jira API docs: https://docs.atlassian.com/software/jira/docs/api/REST/latest/#api/2/issue-removeWatcher Caller must close resp.Body

func (*IssueService) Search

func (s *IssueService) Search(jql string, options *SearchOptions) ([]Issue, *Response, error)

Search wraps SearchWithContext using the background context.

func (*IssueService) SearchPages added in v1.1.0

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

SearchPages wraps SearchPagesWithContext using the background context.

func (*IssueService) SearchPagesWithContext added in v1.15.2

func (s *IssueService) SearchPagesWithContext(ctx context.Context, jql string, options *SearchOptions, f func(Issue) error) error

SearchPagesWithContext 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) SearchWithContext added in v1.15.2

func (s *IssueService) SearchWithContext(ctx context.Context, jql string, options *SearchOptions) ([]Issue, *Response, error)

SearchWithContext will search for tickets according to the jql

Jira API docs: https://developer.atlassian.com/jiradev/jira-apis/jira-rest-apis/jira-rest-api-tutorials/jira-rest-api-example-query-issues

func (*IssueService) Update

func (s *IssueService) Update(issue *Issue) (*Issue, *Response, error)

Update wraps UpdateWithContext using the background context.

func (*IssueService) UpdateAssignee added in v1.6.0

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

UpdateAssignee wraps UpdateAssigneeWithContext using the background context. Caller must close resp.Body

func (*IssueService) UpdateAssigneeWithContext added in v1.15.2

func (s *IssueService) UpdateAssigneeWithContext(ctx context.Context, issueID string, assignee *User) (*Response, error)

UpdateAssigneeWithContext 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 Caller must close resp.Body

func (*IssueService) UpdateComment added in v1.1.0

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

UpdateComment wraps UpdateCommentWithContext using the background context.

func (*IssueService) UpdateCommentWithContext added in v1.15.2

func (s *IssueService) UpdateCommentWithContext(ctx context.Context, issueID string, comment *Comment) (*Comment, *Response, error)

UpdateCommentWithContext 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 wraps UpdateIssueWithContext using the background context. Caller must close resp.Body

func (*IssueService) UpdateIssueWithContext added in v1.15.2

func (s *IssueService) UpdateIssueWithContext(ctx context.Context, jiraID string, data map[string]interface{}) (*Response, error)

UpdateIssueWithContext 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 Caller must close resp.Body

func (s *IssueService) UpdateRemoteLink(issueID string, linkID int, remotelink *RemoteLink) (*Response, error)

UpdateRemoteLink wraps UpdateRemoteLinkWithContext using the background context.

func (*IssueService) UpdateRemoteLinkWithContext added in v1.15.2

func (s *IssueService) UpdateRemoteLinkWithContext(ctx context.Context, issueID string, linkID int, remotelink *RemoteLink) (*Response, error)

UpdateRemoteLinkWithContext updates a remote issue link by linkID.

Jira API docs: https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issue-remote-links/#api-rest-api-2-issue-issueidorkey-remotelink-linkid-put

func (*IssueService) UpdateWithContext added in v1.15.2

func (s *IssueService) UpdateWithContext(ctx context.Context, issue *Issue) (*Issue, *Response, error)

UpdateWithContext 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) UpdateWithOptions added in v1.7.0

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

UpdateWithOptions wraps UpdateWithOptionsWithContext using the background context. Caller must close resp.Body

func (*IssueService) UpdateWithOptionsWithContext added in v1.15.2

func (s *IssueService) UpdateWithOptionsWithContext(ctx context.Context, issue *Issue, opts *UpdateQueryOptions) (*Issue, *Response, error)

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

Jira API docs: https://docs.atlassian.com/jira/REST/cloud/#api/2/issue-editIssue Caller must close resp.Body

func (*IssueService) UpdateWorklogRecord added in v1.15.2

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

UpdateWorklogRecord wraps UpdateWorklogRecordWithContext using the background context.

func (*IssueService) UpdateWorklogRecordWithContext added in v1.15.2

func (s *IssueService) UpdateWorklogRecordWithContext(ctx context.Context, issueID, worklogID string, record *WorklogRecord, options ...func(*http.Request) error) (*WorklogRecord, *Response, error)

UpdateWorklogRecordWithContext 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.15.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.15.2

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

func (*JWTAuthTransport) RoundTrip added in v1.15.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 Organization added in v1.15.2

type Organization struct {
	ID    string    `json:"id,omitempty" structs:"id,omitempty"`
	Name  string    `json:"name,omitempty" structs:"name,omitempty"`
	Links *SelfLink `json:"_links,omitempty" structs:"_links,omitempty"`
}

Organization contains Organization data

type OrganizationCreationDTO added in v1.15.2

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

OrganizationCreationDTO is DTO for creat organization API

type OrganizationService added in v1.15.2

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

OrganizationService handles Organizations for the Jira instance / API.

Jira API docs: https://developer.atlassian.com/cloud/jira/service-desk/rest/api-group-organization/

func (*OrganizationService) AddUsers added in v1.15.2

func (s *OrganizationService) AddUsers(organizationID int, users OrganizationUsersDTO) (*Response, error)

AddUsers wraps AddUsersWithContext using the background context. Caller must close resp.Body

func (*OrganizationService) AddUsersWithContext added in v1.15.2

func (s *OrganizationService) AddUsersWithContext(ctx context.Context, organizationID int, users OrganizationUsersDTO) (*Response, error)

AddUsersWithContext adds users to an organization.

https://developer.atlassian.com/cloud/jira/service-desk/rest/api-group-organization/#api-rest-servicedeskapi-organization-organizationid-user-post Caller must close resp.Body

func (*OrganizationService) CreateOrganization added in v1.15.2

func (s *OrganizationService) CreateOrganization(name string) (*Organization, *Response, error)

CreateOrganization wraps CreateOrganizationWithContext using the background context.

func (*OrganizationService) CreateOrganizationWithContext added in v1.15.2

func (s *OrganizationService) CreateOrganizationWithContext(ctx context.Context, name string) (*Organization, *Response, error)

CreateOrganizationWithContext creates an organization by passing the name of the organization.

Jira API docs: https://developer.atlassian.com/cloud/jira/service-desk/rest/api-group-organization/#api-rest-servicedeskapi-organization-post

func (*OrganizationService) DeleteOrganization added in v1.15.2

func (s *OrganizationService) DeleteOrganization(organizationID int) (*Response, error)

DeleteOrganization wraps DeleteOrganizationWithContext using the background context. Caller must close resp.Body

func (*OrganizationService) DeleteOrganizationWithContext added in v1.15.2

func (s *OrganizationService) DeleteOrganizationWithContext(ctx context.Context, organizationID int) (*Response, error)

DeleteOrganizationWithContext deletes an organization. Note that the organization is deleted regardless of other associations it may have. For example, associations with service desks.

Jira API docs: https://developer.atlassian.com/cloud/jira/service-desk/rest/api-group-organization/#api-rest-servicedeskapi-organization-organizationid-delete Caller must close resp.Body

func (*OrganizationService) DeleteProperty added in v1.15.2

func (s *OrganizationService) DeleteProperty(organizationID int, propertyKey string) (*Response, error)

DeleteProperty wraps DeletePropertyWithContext using the background context. Caller must close resp.Body

func (*OrganizationService) DeletePropertyWithContext added in v1.15.2

func (s *OrganizationService) DeletePropertyWithContext(ctx context.Context, organizationID int, propertyKey string) (*Response, error)

DeletePropertyWithContext removes a property from an organization.

https://developer.atlassian.com/cloud/jira/service-desk/rest/api-group-organization/#api-rest-servicedeskapi-organization-organizationid-property-propertykey-delete Caller must close resp.Body

func (*OrganizationService) GetAllOrganizations added in v1.15.2

func (s *OrganizationService) GetAllOrganizations(start int, limit int, accountID string) (*PagedDTO, *Response, error)

GetAllOrganizations wraps GetAllOrganizationsWithContext using the background context.

func (*OrganizationService) GetAllOrganizationsWithContext added in v1.15.2

func (s *OrganizationService) GetAllOrganizationsWithContext(ctx context.Context, start int, limit int, accountID string) (*PagedDTO, *Response, error)

GetAllOrganizationsWithContext returns a list of organizations in the Jira Service Management instance. Use this method when you want to present a list of organizations or want to locate an organization by name.

Jira API docs: https://developer.atlassian.com/cloud/jira/service-desk/rest/api-group-organization/#api-group-organization

func (*OrganizationService) GetOrganization added in v1.15.2

func (s *OrganizationService) GetOrganization(organizationID int) (*Organization, *Response, error)

GetOrganization wraps GetOrganizationWithContext using the background context.

func (*OrganizationService) GetOrganizationWithContext added in v1.15.2

func (s *OrganizationService) GetOrganizationWithContext(ctx context.Context, organizationID int) (*Organization, *Response, error)

GetOrganizationWithContext returns details of an organization. Use this method to get organization details whenever your application component is passed an organization ID but needs to display other organization details.

Jira API docs: https://developer.atlassian.com/cloud/jira/service-desk/rest/api-group-organization/#api-rest-servicedeskapi-organization-organizationid-get

func (*OrganizationService) GetPropertiesKeys added in v1.15.2

func (s *OrganizationService) GetPropertiesKeys(organizationID int) (*PropertyKeys, *Response, error)

GetPropertiesKeys wraps GetPropertiesKeysWithContext using the background context.

func (*OrganizationService) GetPropertiesKeysWithContext added in v1.15.2

func (s *OrganizationService) GetPropertiesKeysWithContext(ctx context.Context, organizationID int) (*PropertyKeys, *Response, error)

GetPropertiesKeysWithContext returns the keys of all properties for an organization. Use this resource when you need to find out what additional properties items have been added to an organization.

https://developer.atlassian.com/cloud/jira/service-desk/rest/api-group-organization/#api-rest-servicedeskapi-organization-organizationid-property-get

func (*OrganizationService) GetProperty added in v1.15.2

func (s *OrganizationService) GetProperty(organizationID int, propertyKey string) (*EntityProperty, *Response, error)

GetProperty wraps GetPropertyWithContext using the background context.

func (*OrganizationService) GetPropertyWithContext added in v1.15.2

func (s *OrganizationService) GetPropertyWithContext(ctx context.Context, organizationID int, propertyKey string) (*EntityProperty, *Response, error)

GetPropertyWithContext returns the value of a property from an organization. Use this method to obtain the JSON content for an organization's property.

https://developer.atlassian.com/cloud/jira/service-desk/rest/api-group-organization/#api-rest-servicedeskapi-organization-organizationid-property-propertykey-get

func (*OrganizationService) GetUsers added in v1.15.2

func (s *OrganizationService) GetUsers(organizationID int, start int, limit int) (*PagedDTO, *Response, error)

GetUsers wraps GetUsersWithContext using the background context.

func (*OrganizationService) GetUsersWithContext added in v1.15.2

func (s *OrganizationService) GetUsersWithContext(ctx context.Context, organizationID int, start int, limit int) (*PagedDTO, *Response, error)

GetUsersWithContext returns all the users associated with an organization. Use this method where you want to provide a list of users for an organization or determine if a user is associated with an organization.

https://developer.atlassian.com/cloud/jira/service-desk/rest/api-group-organization/#api-rest-servicedeskapi-organization-organizationid-user-get

func (*OrganizationService) RemoveUsers added in v1.15.2

func (s *OrganizationService) RemoveUsers(organizationID int, users OrganizationUsersDTO) (*Response, error)

RemoveUsers wraps RemoveUsersWithContext using the background context. Caller must close resp.Body

func (*OrganizationService) RemoveUsersWithContext added in v1.15.2

func (s *OrganizationService) RemoveUsersWithContext(ctx context.Context, organizationID int, users OrganizationUsersDTO) (*Response, error)

RemoveUsersWithContext removes users from an organization.

https://developer.atlassian.com/cloud/jira/service-desk/rest/api-group-organization/#api-rest-servicedeskapi-organization-organizationid-user-delete Caller must close resp.Body

func (*OrganizationService) SetProperty added in v1.15.2

func (s *OrganizationService) SetProperty(organizationID int, propertyKey string) (*Response, error)

SetProperty wraps SetPropertyWithContext using the background context. Caller must close resp.Body

func (*OrganizationService) SetPropertyWithContext added in v1.15.2

func (s *OrganizationService) SetPropertyWithContext(ctx context.Context, organizationID int, propertyKey string) (*Response, error)

SetPropertyWithContext sets the value of a property for an organization. Use this resource to store custom data against an organization.

https://developer.atlassian.com/cloud/jira/service-desk/rest/api-group-organization/#api-rest-servicedeskapi-organization-organizationid-property-propertykey-put Caller must close resp.Body

type OrganizationUsersDTO added in v1.15.2

type OrganizationUsersDTO struct {
	AccountIds []string `json:"accountIds,omitempty" structs:"accountIds,omitempty"`
}

OrganizationUsersDTO contains organization user ids

type PATAuthTransport added in v1.15.2

type PATAuthTransport struct {
	// Token is the key that was provided by Jira when creating the Personal Access Token.
	Token string

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

PATAuthTransport is an http.RoundTripper that authenticates all requests using the Personal Access Token specified. See here for more info: https://confluence.atlassian.com/enterprise/using-personal-access-tokens-1026032365.html

func (*PATAuthTransport) Client added in v1.15.2

func (t *PATAuthTransport) 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 (*PATAuthTransport) RoundTrip added in v1.15.2

func (t *PATAuthTransport) 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 PagedDTO added in v1.15.2

type PagedDTO struct {
	Size       int           `json:"size,omitempty" structs:"size,omitempty"`
	Start      int           `json:"start,omitempty" structs:"start,omitempty"`
	Limit      int           `limit:"size,omitempty" structs:"limit,omitempty"`
	IsLastPage bool          `json:"isLastPage,omitempty" structs:"isLastPage,omitempty"`
	Values     []interface{} `values:"isLastPage,omitempty" structs:"values,omitempty"`
	Expands    []string      `json:"_expands,omitempty" structs:"_expands,omitempty"`
}

PagedDTO is response of a paged list

type Parent

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

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 wraps GetWithContext using the background context.

func (*PermissionSchemeService) GetList added in v1.8.0

GetList wraps GetListWithContext using the background context.

func (*PermissionSchemeService) GetListWithContext added in v1.15.2

func (s *PermissionSchemeService) GetListWithContext(ctx context.Context) (*PermissionSchemes, *Response, error)

GetListWithContext returns a list of all permission schemes

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

func (*PermissionSchemeService) GetWithContext added in v1.15.2

func (s *PermissionSchemeService) GetWithContext(ctx context.Context, schemeID int) (*PermissionScheme, *Response, error)

GetWithContext 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

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 wraps GetListWithContext using the background context.

func (*PriorityService) GetListWithContext added in v1.15.2

func (s *PriorityService) GetListWithContext(ctx context.Context) ([]Priority, *Response, error)

GetListWithContext 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 wraps GetWithContext using the background context.

func (*ProjectService) GetList

func (s *ProjectService) GetList() (*ProjectList, *Response, error)

GetList wraps GetListWithContext using the background context.

func (*ProjectService) GetListWithContext added in v1.15.2

func (s *ProjectService) GetListWithContext(ctx context.Context) (*ProjectList, *Response, error)

GetListWithContext 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 wraps GetPermissionSchemeWithContext using the background context.

func (*ProjectService) GetPermissionSchemeWithContext added in v1.15.2

func (s *ProjectService) GetPermissionSchemeWithContext(ctx context.Context, projectID string) (*PermissionScheme, *Response, error)

GetPermissionSchemeWithContext 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) GetWithContext added in v1.15.2

func (s *ProjectService) GetWithContext(ctx context.Context, projectID string) (*Project, *Response, error)

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

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

ListWithOptions wraps ListWithOptionsWithContext using the background context.

func (*ProjectService) ListWithOptionsWithContext added in v1.15.2

func (s *ProjectService) ListWithOptionsWithContext(ctx context.Context, options *GetQueryOptions) (*ProjectList, *Response, error)

ListWithOptionsWithContext 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 PropertyKey added in v1.15.2

type PropertyKey struct {
	Self string `json:"self,omitempty" structs:"self,omitempty"`
	Key  string `json:"key,omitempty" structs:"key,omitempty"`
}

PropertyKey contains Property key details.

type PropertyKeys added in v1.15.2

type PropertyKeys struct {
	Keys []PropertyKey `json:"keys,omitempty" structs:"keys,omitempty"`
}

PropertyKeys contains an array of PropertyKey

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.15.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.15.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.15.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.15.2

type RemoteLinkStatus struct {
	Resolved bool            `json:"resolved,omitempty" structs:"resolved,omitempty"`
	Icon     *RemoteLinkIcon `json:"icon,omitempty" structs:"icon,omitempty"`
}

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

type Request added in v1.15.2

type Request struct {
	IssueID       string              `json:"issueId,omitempty" structs:"issueId,omitempty"`
	IssueKey      string              `json:"issueKey,omitempty" structs:"issueKey,omitempty"`
	TypeID        string              `json:"requestTypeId,omitempty" structs:"requestTypeId,omitempty"`
	ServiceDeskID string              `json:"serviceDeskId,omitempty" structs:"serviceDeskId,omitempty"`
	Reporter      *Customer           `json:"reporter,omitempty" structs:"reporter,omitempty"`
	FieldValues   []RequestFieldValue `json:"requestFieldValues,omitempty" structs:"requestFieldValues,omitempty"`
	Status        *RequestStatus      `json:"currentStatus,omitempty" structs:"currentStatus,omitempty"`
	Links         *SelfLink           `json:"_links,omitempty" structs:"_links,omitempty"`
	Expands       []string            `json:"_expands,omitempty" structs:"_expands,omitempty"`
}

Request represents a ServiceDesk customer request.

type RequestComment added in v1.15.2

type RequestComment struct {
	ID      string       `json:"id,omitempty" structs:"id,omitempty"`
	Body    string       `json:"body,omitempty" structs:"body,omitempty"`
	Public  bool         `json:"public" structs:"public"`
	Author  *Customer    `json:"author,omitempty" structs:"author,omitempty"`
	Created *RequestDate `json:"created,omitempty" structs:"created,omitempty"`
	Links   *SelfLink    `json:"_links,omitempty" structs:"_links,omitempty"`
	Expands []string     `json:"_expands,omitempty" structs:"_expands,omitempty"`
}

RequestComment is a comment for a request.

type RequestDate added in v1.15.2

type RequestDate struct {
	ISO8601  string `json:"iso8601,omitempty" structs:"iso8601,omitempty"`
	Jira     string `json:"jira,omitempty" structs:"jira,omitempty"`
	Friendly string `json:"friendly,omitempty" structs:"friendly,omitempty"`
	Epoch    int64  `json:"epoch,omitempty" structs:"epoch,omitempty"`
}

RequestDate is the date format used in requests.

type RequestFieldValue added in v1.15.2

type RequestFieldValue struct {
	FieldID string `json:"fieldId,omitempty" structs:"fieldId,omitempty"`
	Label   string `json:"label,omitempty" structs:"label,omitempty"`
	Value   string `json:"value,omitempty" structs:"value,omitempty"`
}

RequestFieldValue is a request field.

type RequestService added in v1.15.2

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

RequestService handles ServiceDesk customer requests for the Jira instance / API.

func (*RequestService) Create added in v1.15.2

func (r *RequestService) Create(requester string, participants []string, request *Request) (*Request, *Response, error)

Create wraps CreateWithContext using the background context.

func (*RequestService) CreateComment added in v1.15.2

func (r *RequestService) CreateComment(issueIDOrKey string, comment *RequestComment) (*RequestComment, *Response, error)

CreateComment wraps CreateCommentWithContext using the background context.

func (*RequestService) CreateCommentWithContext added in v1.15.2

func (r *RequestService) CreateCommentWithContext(ctx context.Context, issueIDOrKey string, comment *RequestComment) (*RequestComment, *Response, error)

CreateCommentWithContext creates a comment on a request.

https://developer.atlassian.com/cloud/jira/service-desk/rest/api-group-request/#api-rest-servicedeskapi-request-issueidorkey-comment-post

func (*RequestService) CreateWithContext added in v1.15.2

func (r *RequestService) CreateWithContext(ctx context.Context, requester string, participants []string, request *Request) (*Request, *Response, error)

CreateWithContext creates a new request.

https://developer.atlassian.com/cloud/jira/service-desk/rest/api-group-request/#api-rest-servicedeskapi-request-post

type RequestStatus added in v1.15.2

type RequestStatus struct {
	Status   string
	Category string
	Date     RequestDate
}

RequestStatus is the status for a request.

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 wraps GetListWithContext using the background context.

func (*ResolutionService) GetListWithContext added in v1.15.2

func (s *ResolutionService) GetListWithContext(ctx context.Context) ([]Resolution, *Response, error)

GetListWithContext 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 wraps GetWithContext using the background context.

func (*RoleService) GetList added in v1.8.0

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

GetList wraps GetListWithContext using the background context.

func (*RoleService) GetListWithContext added in v1.15.2

func (s *RoleService) GetListWithContext(ctx context.Context) (*[]Role, *Response, error)

GetListWithContext 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

func (*RoleService) GetWithContext added in v1.15.2

func (s *RoleService) GetWithContext(ctx context.Context, roleID int) (*Role, *Response, error)

GetWithContext retreives a single Role from Jira

Jira API docs: https://developer.atlassian.com/cloud/jira/platform/rest/v3/#api-api-3-role-id-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 SelfLink struct {
	Self string `json:"self,omitempty" structs:"self,omitempty"`
}

SelfLink Stores REST API URL to the organization.

type ServiceDeskOrganizationDTO added in v1.15.2

type ServiceDeskOrganizationDTO struct {
	OrganizationID int `json:"organizationId,omitempty" structs:"organizationId,omitempty"`
}

ServiceDeskOrganizationDTO is a DTO for ServiceDesk organizations

type ServiceDeskService added in v1.15.2

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

ServiceDeskService handles ServiceDesk for the Jira instance / API.

func (*ServiceDeskService) AddCustomers added in v1.15.2

func (s *ServiceDeskService) AddCustomers(serviceDeskID interface{}, acountIDs ...string) (*Response, error)

AddCustomers wraps AddCustomersWithContext using the background context.

func (*ServiceDeskService) AddCustomersWithContext added in v1.15.2

func (s *ServiceDeskService) AddCustomersWithContext(ctx context.Context, serviceDeskID interface{}, acountIDs ...string) (*Response, error)

AddCustomersWithContext adds customers to the given service desk.

https://developer.atlassian.com/cloud/jira/service-desk/rest/api-group-servicedesk/#api-rest-servicedeskapi-servicedesk-servicedeskid-customer-post

func (*ServiceDeskService) AddOrganization added in v1.15.2

func (s *ServiceDeskService) AddOrganization(serviceDeskID interface{}, organizationID int) (*Response, error)

AddOrganization wraps AddOrganizationWithContext using the background context. Caller must close resp.Body

func (*ServiceDeskService) AddOrganizationWithContext added in v1.15.2

func (s *ServiceDeskService) AddOrganizationWithContext(ctx context.Context, serviceDeskID interface{}, organizationID int) (*Response, error)

AddOrganizationWithContext adds an organization to a service desk. If the organization ID is already associated with the service desk, no change is made and the resource returns a 204 success code.

https://developer.atlassian.com/cloud/jira/service-desk/rest/api-group-organization/#api-rest-servicedeskapi-servicedesk-servicedeskid-organization-post Caller must close resp.Body

func (*ServiceDeskService) GetOrganizations added in v1.15.2

func (s *ServiceDeskService) GetOrganizations(serviceDeskID interface{}, start int, limit int, accountID string) (*PagedDTO, *Response, error)

GetOrganizations wraps GetOrganizationsWithContext using the background context.

func (*ServiceDeskService) GetOrganizationsWithContext added in v1.15.2

func (s *ServiceDeskService) GetOrganizationsWithContext(ctx context.Context, serviceDeskID interface{}, start int, limit int, accountID string) (*PagedDTO, *Response, error)

GetOrganizationsWithContext returns a list of all organizations associated with a service desk.

https://developer.atlassian.com/cloud/jira/service-desk/rest/api-group-organization/#api-rest-servicedeskapi-servicedesk-servicedeskid-organization-get

func (*ServiceDeskService) ListCustomers added in v1.15.2

func (s *ServiceDeskService) ListCustomers(serviceDeskID interface{}, options *CustomerListOptions) (*CustomerList, *Response, error)

ListCustomers wraps ListCustomersWithContext using the background context.

func (*ServiceDeskService) ListCustomersWithContext added in v1.15.2

func (s *ServiceDeskService) ListCustomersWithContext(ctx context.Context, serviceDeskID interface{}, options *CustomerListOptions) (*CustomerList, *Response, error)

ListCustomersWithContext lists customers for a ServiceDesk.

https://developer.atlassian.com/cloud/jira/service-desk/rest/api-group-servicedesk/#api-rest-servicedeskapi-servicedesk-servicedeskid-customer-get

func (*ServiceDeskService) RemoveCustomers added in v1.15.2

func (s *ServiceDeskService) RemoveCustomers(serviceDeskID interface{}, acountIDs ...string) (*Response, error)

RemoveCustomers wraps RemoveCustomersWithContext using the background context.

func (*ServiceDeskService) RemoveCustomersWithContext added in v1.15.2

func (s *ServiceDeskService) RemoveCustomersWithContext(ctx context.Context, serviceDeskID interface{}, acountIDs ...string) (*Response, error)

RemoveCustomersWithContext removes customers to the given service desk.

https://developer.atlassian.com/cloud/jira/service-desk/rest/api-group-servicedesk/#api-rest-servicedeskapi-servicedesk-servicedeskid-customer-delete

func (*ServiceDeskService) RemoveOrganization added in v1.15.2

func (s *ServiceDeskService) RemoveOrganization(serviceDeskID interface{}, organizationID int) (*Response, error)

RemoveOrganization wraps RemoveOrganizationWithContext using the background context. Caller must close resp.Body

func (*ServiceDeskService) RemoveOrganizationWithContext added in v1.15.2

func (s *ServiceDeskService) RemoveOrganizationWithContext(ctx context.Context, serviceDeskID interface{}, organizationID int) (*Response, error)

RemoveOrganizationWithContext removes an organization from a service desk. If the organization ID does not match an organization associated with the service desk, no change is made and the resource returns a 204 success code.

https://developer.atlassian.com/cloud/jira/service-desk/rest/api-group-organization/#api-rest-servicedeskapi-servicedesk-servicedeskid-organization-delete Caller must close resp.Body

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 wraps GetIssueWithContext using the background context.

func (*SprintService) GetIssueWithContext added in v1.15.2

func (s *SprintService) GetIssueWithContext(ctx context.Context, issueID string, options *GetQueryOptions) (*Issue, *Response, error)

GetIssueWithContext 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 wraps GetIssuesForSprintWithContext using the background context.

func (*SprintService) GetIssuesForSprintWithContext added in v1.15.2

func (s *SprintService) GetIssuesForSprintWithContext(ctx context.Context, sprintID int) ([]Issue, *Response, error)

GetIssuesForSprintWithContext 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 wraps MoveIssuesToSprintWithContext using the background context. Caller must close resp.Body

func (*SprintService) MoveIssuesToSprintWithContext added in v1.15.2

func (s *SprintService) MoveIssuesToSprintWithContext(ctx context.Context, sprintID int, issueIDs []string) (*Response, error)

MoveIssuesToSprintWithContext 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 Caller must close resp.Body

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 wraps GetListWithContext using the background context.

func (*StatusCategoryService) GetListWithContext added in v1.15.2

func (s *StatusCategoryService) GetListWithContext(ctx context.Context) ([]StatusCategory, *Response, error)

GetListWithContext 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.15.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.15.2

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

GetAllStatuses wraps GetAllStatusesWithContext using the background context.

func (*StatusService) GetAllStatusesWithContext added in v1.15.2

func (s *StatusService) GetAllStatusesWithContext(ctx context.Context) ([]Status, *Response, error)

GetAllStatusesWithContext 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.15.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 TransitionPayloadComment added in v1.15.2

type TransitionPayloadComment struct {
	Add TransitionPayloadCommentBody `json:"add,omitempty" structs:"add,omitempty"`
}

TransitionPayloadComment represents comment in Transition payload

type TransitionPayloadCommentBody added in v1.15.2

type TransitionPayloadCommentBody struct {
	Body string `json:"body,omitempty"`
}

TransitionPayloadCommentBody represents body of comment in payload

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 TransitionPayloadUpdate added in v1.15.2

type TransitionPayloadUpdate struct {
	Comment []TransitionPayloadComment `json:"comment,omitempty" structs:"comment,omitempty"`
}

TransitionPayloadUpdate represents the updates of Transition calls like DoTransition

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"`
	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://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-group-Users

func (*UserService) Create

func (s *UserService) Create(user *User) (*User, *Response, error)

Create wraps CreateWithContext using the background context.

func (*UserService) CreateWithContext added in v1.15.2

func (s *UserService) CreateWithContext(ctx context.Context, user *User) (*User, *Response, error)

CreateWithContext 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(accountId string) (*Response, error)

Delete wraps DeleteWithContext using the background context. Caller must close resp.Body

func (*UserService) DeleteWithContext added in v1.15.2

func (s *UserService) DeleteWithContext(ctx context.Context, accountId string) (*Response, error)

DeleteWithContext deletes an user from Jira. Returns http.StatusNoContent on success.

Jira API docs: https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-user-delete Caller must close resp.Body

func (*UserService) Find added in v1.1.0

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

Find wraps FindWithContext using the background context.

func (*UserService) FindWithContext added in v1.15.2

func (s *UserService) FindWithContext(ctx context.Context, property string, tweaks ...userSearchF) ([]User, *Response, error)

FindWithContext searches for user info from Jira: It can find users by email or display name using the query parameter

Jira API docs: https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-user-search-get

func (*UserService) Get

func (s *UserService) Get(accountId string) (*User, *Response, error)

Get wraps GetWithContext using the background context.

func (*UserService) GetByAccountID added in v1.15.2

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

GetByAccountID wraps GetByAccountIDWithContext using the background context.

func (*UserService) GetByAccountIDWithContext added in v1.15.2

func (s *UserService) GetByAccountIDWithContext(ctx context.Context, accountID string) (*User, *Response, error)

GetByAccountIDWithContext gets user info from Jira Searching by another parameter that is not accountId is deprecated, but this method is kept for backwards compatibility 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(accountId string) (*[]UserGroup, *Response, error)

GetGroups wraps GetGroupsWithContext using the background context.

func (*UserService) GetGroupsWithContext added in v1.15.2

func (s *UserService) GetGroupsWithContext(ctx context.Context, accountId string) (*[]UserGroup, *Response, error)

GetGroupsWithContext returns the groups which the user belongs to

Jira API docs: https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-user-groups-get

func (*UserService) GetSelf added in v1.5.0

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

GetSelf wraps GetSelfWithContext using the background context.

func (*UserService) GetSelfWithContext added in v1.15.2

func (s *UserService) GetSelfWithContext(ctx context.Context) (*User, *Response, error)

GetSelfWithContext information about the current logged-in user

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

func (*UserService) GetWithContext added in v1.15.2

func (s *UserService) GetWithContext(ctx context.Context, accountId string) (*User, *Response, error)

GetWithContext gets user info from Jira using its Account Id

Jira API docs: https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-user-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 wraps CreateWithContext using the background context.

func (*VersionService) CreateWithContext added in v1.15.2

func (s *VersionService) CreateWithContext(ctx context.Context, version *Version) (*Version, *Response, error)

CreateWithContext 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 wraps GetWithContext using the background context.

func (*VersionService) GetWithContext added in v1.15.2

func (s *VersionService) GetWithContext(ctx context.Context, versionID int) (*Version, *Response, error)

GetWithContext 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 wraps UpdateWithContext using the background context. Caller must close resp.Body

func (*VersionService) UpdateWithContext added in v1.15.2

func (s *VersionService) UpdateWithContext(ctx context.Context, version *Version) (*Version, *Response, error)

UpdateWithContext updates a version from a JSON representation.

Jira API docs: https://developer.atlassian.com/cloud/jira/platform/rest/#api-api-2-version-id-put Caller must close resp.Body

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
jql

Jump to

Keyboard shortcuts

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