jira

package
v0.0.0-...-288b91b Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DoAssigneePathCloud     = "/rest/api/2/issue/%s/assignee"
	DoAssigneePathOnPremise = "/rest/api/2/issue/%s"
)
View Source
const (
	Authorization   = "Authorization"
	XAtlassianToken = "X-Atlassian-Token"
)
View Source
const (
	FindAllBoardsUrl          = "/rest/agile/1.0/board"
	FindBoardConfigurationUrl = "/rest/agile/1.0/board/%d/configuration"
)
View Source
const (
	FilterUrl             = "/rest/api/2/filter/%s"
	MyFilterUrl           = "/rest/api/2/filter/my"
	MyFilterUrlJiraServer = "/rest/api/2/filter/favourite"
)
View Source
const (
	LabelsForIssuePath   = "/rest/api/1.0/labels/%s/suggest"
	LabelsForProjectPath = "/rest/api/1.0/labels/suggest"
	DoLabelPath          = "/rest/api/2/issue/%s"
)
View Source
const (
	ProjectsJira      = "/rest/api/2/project"
	ProjectsByKeyJira = "/rest/api/2/project/%s"
)
View Source
const (
	SearchJira      = "/rest/api/2/search"
	JiraIssueRegexp = "^[a-zA-Z0-9]{1,10}-[0-9]{1,20}$"
)
View Source
const (
	DoCommentIssueRestPath = "/rest/api/2/issue/%s/comment"
)
View Source
const (
	FindUser = "/rest/api/2/user/assignable/search"
)
View Source
const (
	GetJiraIssuePath = "/rest/api/2/issue/%s"
)
View Source
const (
	GetProjectStatuses = "/rest/api/2/project/{project}/statuses"
)
View Source
const (
	GetTransitions = "/rest/api/2/issue/{issue}/transitions"
)

Variables

View Source
var (
	CannotPerformAssignmentErr = errors.New("invalid assignee data. Cannot perform do-assignment request")
)
View Source
var (
	ProjectNotFoundError = errors.New("Project not found.")
)
View Source
var SearchDeserializeErr = errors.New("Cannot deserialize jira search response.")
View Source
var UserSearchDeserializeErr = errors.New("Cannot deserialize jira user search response.")

Functions

This section is empty.

Types

type Api

type Api interface {
	Search(query string) ([]Issue, int32, error)
	SearchJql(query string) ([]Issue, error)
	SearchJqlPageable(query string, page int32, pageSize int32) ([]Issue, int32, int32, error)
	FindUsers(project string) ([]User, error)
	FindUsersWithQuery(project string, query string) ([]User, error)
	FindProjects() ([]Project, error)
	FindLabels(issue *Issue, query string) ([]string, error)
	AddLabel(issueId string, label string) error
	FindProject(projectKey string) (*Project, error)
	FindTransitions(issueId string) ([]IssueTransition, error)
	FindProjectStatuses(projectId string) ([]IssueStatus, error)
	DoTransition(issueId string, transition *IssueTransition) error
	DoAssignee(issueId string, user *User) error
	GetIssueDetailed(issueId string) (*Issue, error)
	DoComment(issueId string, commentBody string) error
	FindBoards(projectKeyOrId string) ([]BoardItem, error)
	GetBoardConfiguration(boardId int) (*BoardConfiguration, error)
	GetFilter(filterId string) (*Filter, error)
	GetMyFilters() ([]Filter, error)
	Close()
	GetApiUrl() string

	IsJiraServer() bool
}

func NewApi

func NewApi(apiUrl string, username string, token string, tokenType JiraTokenType) (Api, error)

func NewJiraApiMock

func NewJiraApiMock(handler func(w http.ResponseWriter, r *http.Request)) Api

func NewJiraApiMockWithTokenType

func NewJiraApiMockWithTokenType(handler func(w http.ResponseWriter, r *http.Request), tokenType JiraTokenType) Api

type ApiCredentials

type ApiCredentials struct {
	Host   string
	ApiKey string
}

type AuthType

type AuthType string
const (
	Basic  AuthType = "Basic"
	Bearer AuthType = "Bearer"
)

type BoardConfiguration

type BoardConfiguration struct {
	Id       int    `json:"id"`
	Name     string `json:"name"`
	Type     string `json:"type"`
	Self     string `json:"self"`
	Location struct {
		Type string `json:"type"`
		Key  string `json:"key"`
		Id   string `json:"id"`
		Self string `json:"self"`
		Name string `json:"name"`
	} `json:"location"`
	Filter struct {
		Id   string `json:"id"`
		Self string `json:"self"`
	} `json:"filter"`
	SubQuery struct {
		Query string `json:"query"`
	} `json:"subQuery"`
	ColumnConfig struct {
		Columns []struct {
			Name     string `json:"name"`
			Statuses []struct {
				Id   string `json:"id"`
				Self string `json:"self"`
			} `json:"statuses"`
		} `json:"columns"`
		ConstraintType string `json:"constraintType"`
	} `json:"columnConfig"`
	Ranking struct {
		RankCustomFieldId int `json:"rankCustomFieldId"`
	} `json:"ranking"`
}

type BoardItem

type BoardItem struct {
	Id   int    `json:"id"`
	Self string `json:"self"`
	Name string `json:"name"`
	Type string `json:"type"`
}

type BoardsResponse

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

type Comment

type Comment struct {
	Author  User   `json:"author"`
	Body    string `json:"body"`
	Created string `json:"created"`
}

type Filter

type Filter struct {
	Id        string `json:"id"`
	Name      string `json:"name"`
	JQL       string `json:"jql"`
	Favourite bool   `json:"favourite"`
}

type Issue

type Issue struct {
	Key    string      `json:"key"`
	Fields IssueFields `json:"Fields"`
	Id     string      `json:"id"`
}

type IssueFields

type IssueFields struct {
	Summary     string  `json:"summary"`
	Project     Project `json:"project"`
	Description string  `json:"description,omitempty"`
	Reporter    struct {
		AccountId   string `json:"accountId"`
		DisplayName string `json:"displayName"`
	} `json:"reporter"`
	Assignee struct {
		AccountId   string `json:"accountId"`
		DisplayName string `json:"displayName"`
	} `json:"assignee"`
	Type struct {
		Name string `json:"name"`
	} `json:"issuetype"`
	Status  Status
	Comment struct {
		Comments   []Comment `json:"comments"`
		MaxResults int32     `json:"maxResults"`
		Total      int32     `json:"total"`
		StartAt    int32     `json:"startAt"`
	} `json:"comment"`
	Labels []string `json:"labels"`
}

type IssueStatus

type IssueStatus struct {
	Id          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

type IssueTransition

type IssueTransition struct {
	Id   string `json:"id"`
	Name string `json:"name"`
	To   struct {
		StatusUrl string `json:"self"`
		StatusId  string `json:"id"`
		Name      string `json:"name"`
	} `json:"to"`
}

type IssueType

type IssueType struct {
	Name string `json:"name"`
}

type JiraTokenType

type JiraTokenType string
const (
	ApiToken      JiraTokenType = "api token"
	PersonalToken JiraTokenType = "personal token"
)

type LabelsSuggestionsResponseBody

type LabelsSuggestionsResponseBody struct {
	Token       string `json:"token"`
	Suggestions []struct {
		Label string `json:"label"`
		Html  string `json:"html"`
	} `json:"suggestions"`
}

type Project

type Project struct {
	Id   string `json:"id"`
	Name string `json:"name"`
	Key  string `json:"key"`
}

type Status

type Status struct {
	Id   string `json:"id"`
	Name string `json:"name"`
}

type User

type User struct {
	AccountId    string            `json:"accountId"`
	Active       bool              `json:"active"`
	AvatarUrls   map[string]string `json:"avatarUrls"`
	DisplayName  string            `json:"displayName"`
	EmailAddress string            `json:"emailAddress"`
	Locale       string            `json:"locale"`
	Self         string            `json:"self"`
	TimeZone     string            `json:"timeZone"`
	Key          string            `json:"key"`  // field used by on-premise installation
	Name         string            `json:"name"` // field used by on-premise installation
}

Jump to

Keyboard shortcuts

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