jira

package
v0.0.0-...-b05eb88 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2016 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LibraryVersion = "0.0.1"

	DefaultMaxPendingRequests = 10
)

Variables

This section is empty.

Functions

func NewOAuthClient

func NewOAuthClient(
	jiraBaseURL *url.URL,
	consumerKey string,
	privateKey *rsa.PrivateKey,
	accessToken string,
) *http.Client

Types

type AvatarURLs

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

type ChangeLog

type ChangeLog struct {
	StartAt    int        `json:"startAt,omitempty"`
	MaxResults int        `json:"maxResults,omitempty"`
	Total      int        `json:"total,omitempty"`
	Histories  []*History `json:"histories,omitempty"`
}

type Client

type Client struct {

	// Base URL of the Jira API that is to be used to form API requests.
	BaseURL *url.URL

	// User-Agent header to be set for every request.
	UserAgent string

	// Me service.
	Myself *MyselfService

	// Project service.
	Projects *ProjectService

	// Issue service.
	Issues *IssueService

	// Remote Issue Link service.
	RemoteIssueLinks *RemoteIssueLinkService

	// Version service.
	Versions *VersionService
	// contains filtered or unexported fields
}

func NewClient

func NewClient(baseURL *url.URL, httpClient *http.Client, options ...func(*Client)) *Client

func (*Client) Do

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

func (*Client) NewRequest

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

func (*Client) SetOptMaxPendingRequests

func (c *Client) SetOptMaxPendingRequests(limit int)

SetOptMaxPendingRequests can be used to set a custom queue size for the requests that are to be sent to JIRA.

It only makes sense to call this method from an option function. Calling it later on will have no effect whatsoever.

type Component

type Component struct {
	Self string `json:"self,omitempty"`
	Id   string `json:"id,omitempty"`
	Name string `json:"name,omitempty"`
}

type ErrAPI

type ErrAPI struct {
	Response *http.Response
	Err      *Error
}

func (*ErrAPI) Error

func (err *ErrAPI) Error() string

type ErrFieldNotSet

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

func (*ErrFieldNotSet) Error

func (err *ErrFieldNotSet) Error() string

type Error

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

type History

type History struct {
	Id      string  `json:"id,omitempty"`
	Author  *User   `json:"author,omitempty"`
	Created string  `json:"created,omitempty"`
	Items   []*Item `json:"items,omitempty"`
}

type Issue

type Issue struct {
	Id     string `json:"id,omitempty"`
	Self   string `json:"self,omitempty"`
	Key    string `json:"key,omitempty"`
	Fields struct {
		Summary   string `json:"summary,omitempty"`
		IssueType struct {
			Id          string `json:"id,omitempty"`
			Self        string `json:"self,omitempty"`
			Name        string `json:"name,omitempty"`
			Description string `json:"description,omitempty"`
			Subtask     bool   `json:"subtask,omitempty"`
			IconURL     string `json:"iconUrl,omitempty"`
		} `json:"issuetype,omitempty"`
		Parent         *Issue           `json:"parent,omitempty"`
		Subtasks       []*Issue         `json:"subtasks,omitempty"`
		Assignee       *User            `json:"assignee,omitempty"`
		FixVersions    []*Version       `json:"fixVersions,omitempty"`
		Labels         []string         `json:"labels,omitempty"`
		Status         *IssueStatus     `json:"status,omitempty"`
		Resolution     *IssueResolution `json:"resolution,omitempty"`
		Created        string           `json:"created,omitempty"`
		Updated        string           `json:"updated,omitempty"`
		Creator        *User            `json:"creator,omitempty"`
		Reporter       *User            `json:"reporter,omitempty"`
		ResolutionDate string           `json:"resolutiondate,omitempty"`
		Project        *Project         `json:"project,omitempty"`
		Priority       struct {
			Self    string `json:"self,omitempty"`
			IconURL string `json:"iconUrl,omitempty"`
			Name    string `json:"name,omitempty"`
			Id      string `json:"id,omitempty"`
		} `json:"priority,omitempty"`
		Components []*Component `json:"components,omitempty"`
	} `json:"fields,omitempty"`
	ChangeLog *ChangeLog `json:"changelog,omitempty"`
}

Issue represents the issue resource as produces by the REST API.

type IssueList

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

IssueList represents a list of issues, what a surprise.

type IssueResolution

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

IssueResolution represents an issue resolution, e.g. "Cannot Reproduce".

type IssueService

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

func (*IssueService) Get

func (service *IssueService) Get(issueIdOrKey string) (*Issue, *http.Response, error)

Get returns the chosen issue.

func (*IssueService) GetTransitions

func (service *IssueService) GetTransitions(issueIdOrKey string) (*TransitionsInfo, *http.Response, error)

GetTransitions returns list of the transitions possible for this issue by the current user.

func (*IssueService) PerformTransition

func (service *IssueService) PerformTransition(
	issueIdOrKey string,
	transition interface{},
) (*http.Response, error)

PerformTransition performs the requested transition for the chosen issue.

func (*IssueService) Search

func (service *IssueService) Search(opts *SearchOptions) ([]*Issue, *http.Response, error)

func (*IssueService) Update

func (service *IssueService) Update(issueIdOrKey string, body interface{}) (*http.Response, error)

Update updates the chosen issue.

type IssueStatus

type IssueStatus struct {
	Id          string `json:"id,omitempty"`
	Self        string `json:"self,omitempty"`
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
	IconURL     string `json:"iconUrl,omitempty"`
}

IssueStatus represents an issue status, e.g. "Scheduled".

type Item

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

type L

type L []interface{}

type M

type M map[string]interface{}

type MyselfService

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

func (*MyselfService) Get

func (service *MyselfService) Get() (*User, *http.Response, error)

type Project

type Project struct {
	Self       string      `json:"self"`
	Id         string      `json:"id"`
	Key        string      `json:"key"`
	Name       string      `json:"name"`
	AvatarURLs *AvatarURLs `json:"avatarUrls,omitempty"`
}

type ProjectService

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

func (*ProjectService) List

func (service *ProjectService) List() ([]*Project, *http.Response, error)

func (*ProjectService) ListVersions

func (service *ProjectService) ListVersions(projectIdOrKey string) ([]*Version, *http.Response, error)
type RemoteIssueLink struct {
	GlobalId     string `json:"globalId,omitempty"`
	Relationship string `json:"relationship,omitempty"`
	Object       struct {
		URL     string `json:"url,omitempty"`
		Title   string `json:"title,omitempty"`
		Summary string `json:"summary,omitempty"`
		Icon    struct {
			URL   string `json:"url16x16,omitempty"`
			Title string `json:"title,omitempty"`
		} `json:"icon,omitempty"`
		Status struct {
			Resolved bool `json:"resolved"`
			Icon     struct {
				URL   string `json:"url16x16,omitempty"`
				Title string `json:"title,omitempty"`
				Link  string `json:"link,omitempty"`
			} `json:"icon,omitempty"`
		} `json:"status,omitempty"`
	} `json:"object,omitempty"`
	Application struct {
		Name string `json:"name,omitempty"`
		Type string `json:"type,omitempty"`
	} `json:"application,omitempty"`
}

RemoteIssueLink represents a JIRA issue remote link.

type RemoteIssueLinkService

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

func (*RemoteIssueLinkService) Create

func (service *RemoteIssueLinkService) Create(
	issueIdOrKey string,
	link *RemoteIssueLink,
) (*http.Response, error)

Create creates a new remote issue link for the given issue. Global ID needs to be filled in if the remote issue link is to be updated in the future.

func (*RemoteIssueLinkService) Delete

func (service *RemoteIssueLinkService) Delete(
	issueIdOrKey string,
	globalId string,
) (*http.Response, error)

Delete deletes the remote issue link identified by the given issue ID or key and global ID.

func (*RemoteIssueLinkService) Get

func (service *RemoteIssueLinkService) Get(
	issueIdOrKey string,
	globalId string,
) (*RemoteIssueLink, *http.Response, error)

Get returns the remote issue link identified by the given issue ID or key and global ID.

func (*RemoteIssueLinkService) List

func (service *RemoteIssueLinkService) List(
	issueIdOrKey string,
) ([]*RemoteIssueLink, *http.Response, error)

List returns the remote issue links associated with the given issue.

func (*RemoteIssueLinkService) Update

func (service *RemoteIssueLinkService) Update(
	issueIdOrKey string,
	link *RemoteIssueLink,
) (*http.Response, error)

Update updates the remote issue link identified by the given issue ID. Global ID needs to be filled in for this API call to succeed.

type SearchOptions

type SearchOptions struct {
	JQL           string `url:"jql,omitempty"`
	StartAt       int    `url:"startAt,omitempty"`
	MaxResults    int    `url:"maxResults,omitempty"`
	ValidateQuery bool   `url:"validateQuery,omitempty"`
}

type Transition

type Transition struct {
	Id   string `json:"id,omitempty"`
	Name string `json:"name	,omitempty"`
	To   struct {
		Self           string `json:"self,omitempty"`
		Description    string `json:"description,omitempty"`
		IconUrl        string `json:"iconUrl,omitempty"`
		Name           string `json:"name,omitempty"`
		Id             string `json:"id,omitempty"`
		StatusCategory struct {
			Self      string `json:"self,omitempty"`
			Id        int    `json:"id,omitempty"`
			Key       string `json:"key,omitempty"`
			ColorName string `json:"colorName,omitempty"`
			Name      string `json:"name,omitempty"`
		}
	}
}

type TransitionsInfo

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

type User

type User struct {
	Self         string      `json:"self,omitempty"`
	Key          string      `json:"key,omitempty"`
	Name         string      `json:"name,omitempty"`
	EmailAddress string      `json:"emailAddress,omitempty"`
	AvatarURLs   *AvatarURLs `json:"avatarUrls,omitempty"`
	DisplayName  string      `json:"displayName,omitempty"`
	Active       bool        `json:"active,omitempty"`
	TimeZone     string      `json:"timeZone,omitempty"`
	Groups       struct {
		Size  int `json:"size,omitempty"`
		Items []struct {
			Name string `json:"name,omitempty"`
			Self string `json:"self,omitempty"`
		} `json:"items,omitempty"`
	} `json:"groups,omitempty"`
}

type Version

type Version struct {
	Id            string `json:"id,omitempty"`
	Self          string `json:"self,omitempty"`
	Name          string `json:"name,omitempty"`
	Description   string `json:"description,omitempty"`
	Project       string `json:"project,omitempty"`
	ProjectId     int    `json:"projectId,omitempty"`
	Released      bool   `json:"released,omitempty"`
	Archived      bool   `json:"archived,omitempty"`
	StartDate     string `json:"startDate,omitempty"`
	UserStartDate string `json:"userStartDate,omitempty"`
}

type VersionService

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

func (*VersionService) Create

func (service *VersionService) Create(version *Version) (*Version, *http.Response, error)

Create creates a new version.

func (*VersionService) Delete

func (service *VersionService) Delete(id string) (*http.Response, error)

Delete deleted the version with the specified ID.

func (*VersionService) Update

func (service *VersionService) Update(id string, change *Version) (*http.Response, error)

Update updates the version with the specified ID as specified in the change request.

Jump to

Keyboard shortcuts

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