onpremise

package
v0.0.0-...-d78007f Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 21 Imported by: 0

README

Jira: On-Premise client

The API client library for self-hosted Jira instances.

For further information, please switch to the README.md in the root folder.

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"
)
View Source
const (
	ClientVersion = "2.0.0"
)

Variables

This section is empty.

Functions

func Bool

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

func NewJiraError(resp *Response, httpError error) error

NewJiraError creates a new jira Error

func WithAccountId

func WithAccountId(accountId string) userSearchF

WithAccountId sets the account id to search

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func WithActive

func WithActive(active bool) userSearchF

WithActive sets the active users lookup

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func WithInactive

func WithInactive(inactive bool) userSearchF

WithInactive sets the inactive users lookup

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func WithMaxResults

func WithMaxResults(maxResults int) userSearchF

WithMaxResults sets the max results to return

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func WithProperty

func WithProperty(property string) userSearchF

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func WithQueryOptions

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.

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func WithStartAt

func WithStartAt(startAt int) userSearchF

WithStartAt set the start pager

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func WithUsername

func WithUsername(username string) userSearchF

WithUsername sets the username to search

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

Types

type Actor

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

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

ActorUser contains the account id of the actor/user

type AddWorklogQueryOptions

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

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(ctx context.Context, username, password string) (bool, error)

AcquireSessionCookie creates a new session for a user in Jira. Once a session has been successfully created it can be used to access any of Jira's remote APIs and also the web UI by passing the appropriate HTTP Cookie header. The header will by automatically applied to every API request. Note that it is generally preferrable to use HTTP BASIC authentication with the REST API. However, this resource may be used to mimic the behaviour of Jira's log-in page (e.g. to display log-in errors to a user).

Jira API docs: https://docs.atlassian.com/jira/REST/latest/#auth/1/session

Deprecated: Use CookieAuthTransport instead

func (*AuthenticationService) Authenticated

func (s *AuthenticationService) Authenticated() bool

Authenticated reports if the current Client has authentication details for Jira

func (*AuthenticationService) GetCurrentUser

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

GetCurrentUser gets the details of the current user.

Jira API docs: https://docs.atlassian.com/jira/REST/latest/#auth/1/session

func (*AuthenticationService) Logout deprecated

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

Logout logs out the current user that has been authenticated and the session in the client is destroyed.

Jira API docs: https://docs.atlassian.com/jira/REST/latest/#auth/1/session

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

func (*AuthenticationService) SetBasicAuth deprecated

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

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

Deprecated: Use BasicAuthTransport instead

type AvatarUrls

type AvatarUrls struct {
	Four8X48  string `json:"48x48,omitempty" structs:"48x48,omitempty"`
	Two4X24   string `json:"24x24,omitempty" structs:"24x24,omitempty"`
	One6X16   string `json:"16x16,omitempty" structs:"16x16,omitempty"`
	Three2X32 string `json:"32x32,omitempty" structs:"32x32,omitempty"`
}

AvatarUrls represents different dimensions of avatars / images

type BasicAuthTransport

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

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

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

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

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

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

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

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

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

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

BoardConfigurationColumnStatus represents a status in the column configuration

type BoardConfigurationFilter

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

BoardConfigurationFilter reference to the filter used by the given board.

type BoardConfigurationLocation

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

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 service

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(ctx context.Context, board *Board) (*Board, *Response, error)

CreateBoard creates a new board. Board name, type and filter Id is required. name - Must be less than 255 characters. type - Valid values: scrum, kanban filterId - Id of a filter that the user has permissions to view. Note, if the user does not have the 'Create shared objects' permission and tries to create a shared board, a private board will be created instead (remember that board sharing depends on the filter sharing).

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*BoardService) DeleteBoard

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

DeleteBoard will delete an agile board.

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*BoardService) GetAllBoards

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

GetAllBoards will returns all boards. This only includes boards that the user has permission to view.

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*BoardService) GetAllSprints

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

GetAllSprints returns all sprints from a board, for a given board ID. This only includes sprints that the user has permission to view.

Jira API docs: https://developer.atlassian.com/cloud/jira/software/rest/api-group-board/#api-rest-agile-1-0-board-boardid-sprint-get

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*BoardService) GetBoard

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

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

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*BoardService) GetBoardConfiguration

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

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

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

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

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 {

	// Base URL for API requests.
	// Should be set to a domain endpoint of the Jira instance.
	// BaseURL should always be specified with a trailing slash.
	BaseURL *url.URL

	// User agent used when communicating with the Jira API.
	UserAgent string

	// 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(baseURL string, httpClient *http.Client) (*Client, error)

NewClient returns a new Jira API client with provided base URL (often is your Jira hostname) If a nil httpClient is provided, a new http.Client will be used. To use API methods which require authentication, provide an http.Client that will perform the authentication for you (such as that provided by the golang.org/x/oauth2 library). baseURL is the HTTP endpoint of your Jira instance and should always be specified with a trailing slash.

func (*Client) Client

func (c *Client) Client() *http.Client

Client returns the http.Client used by this Jira client.

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

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

NewMultiPartRequest creates an API request including a multi-part file. A relative URL can be provided in urlStr, in which case it is resolved relative to the baseURL of the Client. If specified, the value pointed to by buf is a multipart form.

func (*Client) NewRawRequest

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

TODO Do we need it? NewRawRequest creates an API request. A relative URL can be provided in urlStr, in which case it is resolved relative to the baseURL of the Client. Allows using an optional native io.Reader for sourcing the request body.

func (*Client) NewRequest

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

NewRequest creates an API request. A relative URL can be provided in urlStr, in which case it is resolved relative to the BaseURL of the Client. If specified, the value pointed to by body is JSON encoded and included as the request body.

type Comment

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

	// A list of comment properties. Optional on create and update.
	Properties []EntityProperty `json:"properties,omitempty" structs:"properties,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

type ComponentService service

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

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

type CookieAuthTransport

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

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

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

func (*CookieAuthTransport) RoundTrip

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

RoundTrip adds the session object to the request.

type CreateComponentOptions

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.

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

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.

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

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

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

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

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

type CustomerService service

CustomerService handles ServiceDesk customers for the Jira instance / API.

func (*CustomerService) Create

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

Create creates a ServiceDesk customer.

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

type Date

type Date time.Time

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

func (Date) MarshalJSON

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

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

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

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

type EntityProperty

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

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

func (e *Error) Error() string

Error is a short string representing the error

func (*Error) LongError

func (e *Error) LongError() string

LongError is a full representation of the error as a string

type Field

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

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

type FieldService service

FieldService handles fields for the Jira instance / API.

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

func (*FieldService) GetList

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

GetList gets all fields from Jira

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

type Filter

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

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

type FilterService service

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

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

Get retrieves a single Filter from Jira

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*FilterService) GetFavouriteList

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

GetFavouriteList retrieves the user's favourited filters from Jira

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*FilterService) GetList

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

GetList retrieves all filters from Jira

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*FilterService) GetMyFilters

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

GetMyFilters retrieves the my Filters.

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*FilterService) Search

Search will search for filter according to the search options

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

type FiltersList

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

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

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

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

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

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

type GroupSearchOptions struct {
	StartAt              int
	MaxResults           int
	IncludeInactiveUsers bool
}

GroupSearchOptions specifies the optional parameters for the Get Group methods

type GroupService

type GroupService service

GroupService handles Groups for the Jira instance / API.

Jira API docs: https://docs.atlassian.com/jira/REST/server/#api/2/group

func (*GroupService) Add

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

Add adds user to group

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*GroupService) Get

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

Get 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

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*GroupService) Remove

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

Remove removes user from group

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

type Holder

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.

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

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

type IssueLinkTypeService service

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

Create creates an issue link type in Jira.

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*IssueLinkTypeService) Delete

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

Delete deletes an issue link type based on provided ID.

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*IssueLinkTypeService) Get

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

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*IssueLinkTypeService) GetList

GetList gets all of the issue link types from Jira.

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*IssueLinkTypeService) Update

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

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

type IssueRenderedFields

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 service

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(ctx context.Context, issueID string, comment *Comment) (*Comment, *Response, error)

AddComment adds a new comment to issueID.

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

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

AddLink adds a link between two issues.

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

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

AddRemoteLink 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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*IssueService) AddWatcher

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

AddWatcher adds watcher to the given issue

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*IssueService) AddWorklogRecord

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

AddWorklogRecord adds a new worklog record to issueID.

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*IssueService) Create

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

Create creates an issue or a sub-task from a JSON representation. Creating a sub-task is similar to creating a regular issue, with two important differences: The issueType field must correspond to a sub-task issue type and you must provide a parent field in the issue create request containing the id or key of the parent issue.

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*IssueService) Delete

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

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*IssueService) DeleteAttachment

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

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*IssueService) DeleteComment

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

DeleteComment Deletes a comment from an issueID.

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

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

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*IssueService) DoTransition

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

DoTransition performs a transition on an issue. When performing the transition you can update or set other issue fields.

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*IssueService) DoTransitionWithPayload

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

DoTransitionWithPayload performs a transition on an issue using any payload. When performing the transition you can update or set other issue fields.

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*IssueService) DownloadAttachment

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

DownloadAttachment returns a Response of an attachment for a given attachmentID. The attachment is in the Response.Body of the response. This is an io.ReadCloser. Caller must close resp.Body.

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*IssueService) Get

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

Get returns a full representation of the issue for the given issue key. Jira will attempt to identify the issue by the issueIdOrKey path parameter. This can be an issue id, or an issue key. If the issue cannot be found via an exact match, Jira will also look for the issue in a case-insensitive way, or by looking to see if the issue was moved.

The given options will be appended to the query string

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*IssueService) GetCreateMeta

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

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*IssueService) GetCustomFields

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

GetCustomFields returns a map of customfield_* keys with string values

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*IssueService) GetEditMeta

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

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

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

GetRemoteLinks gets remote issue links on the issue.

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*IssueService) GetTransitions

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

GetTransitions gets a list of the transitions possible for this issue by the current user, along with fields that are required and their types.

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*IssueService) GetWatchers

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

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

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*IssueService) GetWorklogs

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

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

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*IssueService) PostAttachment

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

PostAttachment uploads r (io.Reader) as an attachment to a given issueID

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*IssueService) RemoveWatcher

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

RemoveWatcher removes given user from given issue

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*IssueService) Search

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

Search will search for tickets according to the jql

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*IssueService) SearchPages

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

SearchPages will get issues from all pages in a search

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*IssueService) Update

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

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

Jira API docs: https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issues/#api-rest-api-2-issue-issueidorkey-put Caller must close resp.Body

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*IssueService) UpdateAssignee

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

UpdateAssignee updates the user assigned to work on the given issue

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*IssueService) UpdateComment

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

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

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*IssueService) UpdateIssue

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

UpdateIssue updates an issue from a JSON representation. The issue is found by key.

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

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

UpdateRemoteLink 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 Caller must close Response.Body

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*IssueService) UpdateWorklogRecord

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

UpdateWorklogRecord updates a worklog record.

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

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

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

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

func (*JWTAuthTransport) RoundTrip

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.

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

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.

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

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.

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

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

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

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

OrganizationCreationDTO is DTO for creat organization API

type OrganizationService

type OrganizationService service

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

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

AddUsers 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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*OrganizationService) CreateOrganization

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

CreateOrganization 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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*OrganizationService) DeleteOrganization

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

DeleteOrganization 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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*OrganizationService) DeleteProperty

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

DeleteProperty 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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*OrganizationService) GetAllOrganizations

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

GetAllOrganizations 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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*OrganizationService) GetOrganization

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

GetOrganization 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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*OrganizationService) GetPropertiesKeys

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

GetPropertiesKeys 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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*OrganizationService) GetProperty

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

GetProperty 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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*OrganizationService) GetUsers

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

GetUsers 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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*OrganizationService) RemoveUsers

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

RemoveUsers 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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*OrganizationService) SetProperty

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

SetProperty 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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

type OrganizationUsersDTO

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

OrganizationUsersDTO contains organization user ids

type PATAuthTransport

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

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

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

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

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

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

type PermissionSchemeService service

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

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

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*PermissionSchemeService) GetList

GetList returns a list of all permission schemes

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

type PermissionSchemes

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

type PriorityService service

PriorityService handles priorities for the Jira instance / API.

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

func (*PriorityService) GetList

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

GetList gets all priorities from Jira

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

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 service

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(ctx context.Context, projectID string) (*Project, *Response, error)

Get returns a full representation of the project for the given issue key. Jira will attempt to identify the project by the projectIdOrKey path parameter. This can be an project id, or an project key.

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*ProjectService) GetAll

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

GetAll returns 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://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-projects/#api-rest-api-2-project-get

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*ProjectService) GetPermissionScheme

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

GetPermissionScheme returns a full representation of the permission scheme for the project Jira will attempt to identify the project by the projectIdOrKey path parameter. This can be an project id, or an project key.

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

type PropertyKey

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

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

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

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

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

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

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

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

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

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

type RequestService service

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

func (*RequestService) Create

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

Create creates a new request.

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*RequestService) CreateComment

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

CreateComment 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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

type RequestStatus

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

type ResolutionService service

ResolutionService handles resolutions for the Jira instance / API.

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

func (*ResolutionService) GetList

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

GetList gets all resolutions from Jira

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

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

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

type RoleService service

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

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

Get retreives a single Role from Jira

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*RoleService) GetList

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

GetList returns a list of all available project roles

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

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

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

ServiceDeskOrganizationDTO is a DTO for ServiceDesk organizations

type ServiceDeskService

type ServiceDeskService service

ServiceDeskService handles ServiceDesk for the Jira instance / API.

func (*ServiceDeskService) AddCustomers

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

AddCustomers 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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*ServiceDeskService) AddOrganization

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

AddOrganization 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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*ServiceDeskService) GetOrganizations

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

GetOrganizations 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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*ServiceDeskService) ListCustomers

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

ListCustomers lists customers for a ServiceDesk.

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*ServiceDeskService) RemoveCustomers

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

RemoveCustomers 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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*ServiceDeskService) RemoveOrganization

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

RemoveOrganization 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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

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 service

SprintService handles sprints in Jira Agile API. See https://docs.atlassian.com/jira-software/REST/cloud/

func (*SprintService) GetIssue

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

GetIssue returns a full representation of the issue for the given issue key. Jira will attempt to identify the issue by the issueIdOrKey path parameter. This can be an issue id, or an issue key. If the issue cannot be found via an exact match, Jira will also look for the issue in a case-insensitive way, or by looking to see if the issue was moved.

The given options will be appended to the query string

Jira API docs: https://docs.atlassian.com/jira-software/REST/7.3.1/#agile/1.0/issue-getIssue

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*SprintService) GetIssuesForSprint

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

GetIssuesForSprint returns all issues in a sprint, for a given sprint Id. This only includes issues that the user has permission to view. By default, the returned issues are ordered by rank.

Jira API Docs: https://docs.atlassian.com/jira-software/REST/cloud/#agile/1.0/sprint-getIssuesForSprint

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*SprintService) MoveIssuesToSprint

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

MoveIssuesToSprint moves issues to a sprint, for a given sprint Id. Issues can only be moved to open or active sprints. The maximum number of issues that can be moved in one operation is 50.

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

type SprintsList

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

type StatusCategoryService service

StatusCategoryService handles status categories for the Jira instance / API.

Use it to obtain a list of all status categories and the details of a category. Status categories provided a mechanism for categorizing statuses.

Jira API docs: https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-workflow-status-categories/#api-group-workflow-status-categories

func (*StatusCategoryService) Get

func (s *StatusCategoryService) Get(ctx context.Context, statusCategoryID string) (*StatusCategory, *Response, error)

Get returns a full representation of the StatusCategory having the given id or key.

statusCategoryID represents the ID or key of the status category.

Jira API docs: https://docs.atlassian.com/software/jira/docs/api/REST/7.6.1/#api/2/statuscategory-getStatusCategory

func (*StatusCategoryService) GetList

GetList returns a list of all status categories.

Jira API docs: https://docs.atlassian.com/software/jira/docs/api/REST/7.6.1/#api/2/statuscategory-getStatusCategories

type StatusService

type StatusService service

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

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

GetAllStatuses returns a list of all statuses associated with workflows.

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

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

func (t Time) Equal(u Time) bool

func (Time) MarshalJSON

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

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

TransitionPayloadComment represents comment in Transition payload

type TransitionPayloadCommentBody

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

TransitionPayloadCommentBody represents body of comment in payload

type TransitionPayloadFields

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

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

TransitionPayloadUpdate represents the updates of Transition calls like DoTransition

type UpdateQueryOptions

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

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 service

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(ctx context.Context, user *User) (*User, *Response, error)

Create creates an user in Jira.

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*UserService) Delete

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

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

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*UserService) Find

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

Find 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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*UserService) Get

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

Get 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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*UserService) GetByAccountID

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

GetByAccountID 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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*UserService) GetGroups

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

GetGroups 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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*UserService) GetSelf

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

GetSelf 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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

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

type VersionService service

VersionService handles Versions for the Jira instance / API.

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

func (*VersionService) Create

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

Create creates a version in Jira.

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*VersionService) Get

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

Get gets version info from Jira

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

func (*VersionService) Update

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

Update updates a version from a JSON representation.

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

TODO Double check this method if this works as expected, is using the latest API and the response is complete This double check effort is done for v2 - Remove this two lines if this is completed.

type Watcher

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

Jump to

Keyboard shortcuts

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