ejira

package module
v0.0.0-...-5247eb1 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2023 License: MIT Imports: 12 Imported by: 0

README

Jira API组件使用指南

Jira Server REST API https://docs.atlassian.com/software/jira/docs/api/REST/8.8.0

安装

私有化部署下载地址:https://www.atlassian.com/software/jira/download 安装过程:https://confluence.atlassian.com/adminjiraserver071/installing-jira-applications-on-linux-from-archive-file-855475657.html

常见问题

  1. BasicAuth认证失败,提示Basic Authentication Failure - Reason : AUTHENTICATION_DENIED 答:去系统管理界面将 Maximum Authentication Attempts Allowed 改大一点

组件

快速上手

使用样例可参考 example

Documentation

Index

Constants

View Source
const (
	// APIGetUserInfo https://docs.atlassian.com/software/jira/docs/api/REST/8.8.0/#api/2/user-getUser
	APIGetUserInfo = "/rest/api/2/user?username=%s"
	// APIFindUsers https://docs.atlassian.com/software/jira/docs/api/REST/8.8.0/#api/2/user-findUsers
	APIFindUsers = "/rest/api/2/user/search"

	// APIGetAllProjects https://docs.atlassian.com/software/jira/docs/api/REST/8.8.0/#api/2/project-getAllProjects
	APIGetAllProjects = "/rest/api/2/project"
	// APIProject https://docs.atlassian.com/software/jira/docs/api/REST/8.8.0/#api/2/project
	APIProject = "/rest/api/2/project/%s"

	// APIGetVersions https://docs.atlassian.com/software/jira/docs/api/REST/8.8.0/#api/2/version-getVersion
	APIGetVersions = "/rest/api/2/project/%s/versions"
	// APICreateVersion https://docs.atlassian.com/software/jira/docs/api/REST/8.8.0/#api/2/version-createVersion
	APICreateVersion = "/rest/api/2/version"
	// APIVersion https://docs.atlassian.com/software/jira/docs/api/REST/8.8.0/#api/2/version
	APIVersion = "/rest/api/2/version/%s"

	// APIGetComponents https://docs.atlassian.com/software/jira/docs/api/REST/8.8.0/#api/2/component
	APIGetComponents = "/rest/api/2/project/%s/components"
	// APICreateComponent https://docs.atlassian.com/software/jira/docs/api/REST/8.8.0/#api/2/version-createComponent
	APICreateComponent = "/rest/api/2/component"
	// APIComponent https://docs.atlassian.com/software/jira/docs/api/REST/8.8.0/#api/2/component
	APIComponent = "/rest/api/2/component/%s"

	// APIGetPriorities https://docs.atlassian.com/software/jira/docs/api/REST/8.8.0/#api/2/priority
	APIGetPriorities = "/rest/api/2/priority"

	// APIGetResolutions https://docs.atlassian.com/software/jira/docs/api/REST/8.8.0/#api/2/resolution
	APIGetResolutions = "/rest/api/2/resolution"

	// APISearch https://docs.atlassian.com/software/jira/docs/api/REST/8.8.0/#api/2/search-search
	APISearch = "/rest/api/2/search"
	// APICreateIssue https://docs.atlassian.com/software/jira/docs/api/REST/8.8.0/#api/2/issue-createIssue
	APICreateIssue = "/rest/api/2/issue"

	// APIGetIssueLinkTypes https://docs.atlassian.com/software/jira/docs/api/REST/8.8.0/#api/2/issueLinkType
	APIGetIssueLinkTypes = "/rest/api/2/issueLinkType"

	// APIGetIssueTypes https://docs.atlassian.com/software/jira/docs/api/REST/8.8.0/#api/2/issuetype-getIssueAllTypes
	APIGetIssueTypes = "/rest/api/2/issuetype"

	// APIGetAllProjectStatuses https://docs.atlassian.com/software/jira/docs/api/REST/8.8.0/#api/2/project-getAllStatuses
	APIGetProjectStatuses = "/rest/api/2/project/%s/statuses"
)
View Source
const PackageName = "component.ejira"

PackageName 包名

Variables

This section is empty.

Functions

func Bool

func Bool(v bool) *bool

Bool return bool pointer

func DefaultConfig

func DefaultConfig() *config

DefaultConfig 返回默认配置

Types

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"`
	ID        string `json:"id,omitempty"`
	Filename  string `json:"filename,omitempty"`
	Author    *User  `json:"author,omitempty"`
	Created   string `json:"created,omitempty"`
	Size      int    `json:"size,omitempty"`
	MimeType  string `json:"mimeType,omitempty"`
	Content   string `json:"content,omitempty"`
	Thumbnail string `json:"thumbnail,omitempty"`
}

Attachment represents a Jira attachment

type AvatarUrls

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

AvatarUrls represents different dimensions of avatars / images

type Changelog

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

Changelog is the change log of an issue

type ChangelogHistory

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

ChangelogHistory is one single changelog history entry

type ChangelogItems

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

ChangelogItems is one single changelog item of a history item

type Comment

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

Comment represents a comment by a person to an issue in Jira.

type CommentVisibility

type CommentVisibility struct {
	Type  string `json:"type,omitempty"`
	Value string `json:"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"`
}

Comments represents a list of Comment.

type Component

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

Component Component

func (*Component) CreateComponent

func (c *Component) CreateComponent(component *JiraComponent) (*JiraComponent, error)

CreateComponent create project component

func (*Component) CreateIssue

func (c *Component) CreateIssue(issue *Issue) (*Issue, error)

CreateIssue create issue

func (*Component) CreateVersion

func (c *Component) CreateVersion(version *Version) (*Version, error)

CreateVersion create project version

func (*Component) DeleteComponent

func (c *Component) DeleteComponent(componentID string) error

DeleteComponent delete project component

func (*Component) DeleteVersion

func (c *Component) DeleteVersion(versionID string) error

DeleteVersion delete project version

func (*Component) FindIssues

func (c *Component) FindIssues(jql string, options *SearchOptions) (*SearchResult, error)

FindIssues 查找issues Jira API docs: https://docs.atlassian.com/software/jira/docs/api/REST/8.8.0/#api/2/search

func (*Component) FindUsers

func (c *Component) FindUsers(options *UserSearchOption) (*[]User, error)

FindUsers 查找用户 Jira API docs: https://docs.atlassian.com/software/jira/docs/api/REST/8.8.0/#api/2/user-findUsers

func (*Component) GetAllIssueTypes

func (c *Component) GetAllIssueTypes() (*IssueTypes, error)

GetAllIssueTypes 获取所有issue类型 Jira API docs: https://docs.atlassian.com/software/jira/docs/api/REST/8.8.0/#api/2/issuetype-getIssueAllTypes

func (*Component) GetAllProjects

func (c *Component) GetAllProjects(options *ProjectGetQueryOption) (*ProjectList, error)

GetAllProjects get all projects

func (*Component) GetComponents

func (c *Component) GetComponents(projectID string) (*[]JiraComponent, error)

GetComponents get project all components

func (*Component) GetIssueLinkTypes

func (c *Component) GetIssueLinkTypes() (*[]IssueLinkType, error)

GetIssueLinkTypes get project all issue link types

func (*Component) GetPriorities

func (c *Component) GetPriorities() (*[]Priority, error)

GetPriorities get project all priorities

func (*Component) GetProject

func (c *Component) GetProject(projectKey string, options *ProjectGetQueryOption) (*Project, error)

GetProject get single project info

func (*Component) GetProjectIssueTypes

func (c *Component) GetProjectIssueTypes(projectKey string) (*IssueTypes, error)

GetProjectIssueTypes get issue types of a project

func (*Component) GetResolutions

func (c *Component) GetResolutions() (*[]Resolution, error)

GetResolutions get project all resolutions

func (*Component) GetUserInfoByUsername

func (c *Component) GetUserInfoByUsername(username string) (*User, error)

GetUserInfoByUsername 获取用户信息 Jira api docs:https://docs.atlassian.com/software/jira/docs/api/REST/8.8.0/#api/2/user-getUser

func (*Component) GetVersions

func (c *Component) GetVersions(projectID string) (*[]Version, error)

GetVersions get project all versions

func (*Component) UpdateComponent

func (c *Component) UpdateComponent(component *JiraComponentUpdateReq) (*JiraComponent, error)

UpdateComponent update project component

func (*Component) UpdateVersion

func (c *Component) UpdateVersion(version *VersionUpdateReq) (*Version, error)

UpdateVersion update project version

type Container

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

Container ...

func DefaultContainer

func DefaultContainer() *Container

DefaultContainer ...

func Load

func Load(key string) *Container

Load ...

func (*Container) Build

func (c *Container) Build(options ...Option) *Component

Build ...

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 EntityProperty

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

EntityProperty represents one key-value entity

type Epic

type Epic struct {
	ID      int    `json:"id"`
	Key     string `json:"key"`
	Self    string `json:"self"`
	Name    string `json:"name"`
	Summary string `json:"summary"`
	Done    bool   `json:"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 {
	ErrorMessages []string          `json:"errorMessages"`
	Errors        map[string]string `json:"errors"`
}

Error message from Jira See https://developer.atlassian.com/cloud/jira/platform/rest/v2/intro/#status-codes

func (*Error) LongError

func (e *Error) LongError() string

LongError is a full representation of the error as a string

type FixVersion

type FixVersion struct {
	Self            string `json:"self,omitempty"`
	ID              string `json:"id,omitempty"`
	Name            string `json:"name,omitempty"`
	Description     string `json:"description,omitempty"`
	Archived        *bool  `json:"archived,omitempty"`
	Released        *bool  `json:"released,omitempty"`
	ReleaseDate     string `json:"releaseDate,omitempty"`
	UserReleaseDate string `json:"userReleaseDate,omitempty"`
	ProjectID       int    `json:"projectId,omitempty"` // Unlike other IDs, this is returned as a number
	StartDate       string `json:"startDate,omitempty"`
}

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

type Issue

type Issue struct {
	Expand         string               `json:"expand,omitempty"`
	ID             string               `json:"id,omitempty"`
	Self           string               `json:"self,omitempty"`
	Key            string               `json:"key,omitempty"`
	Fields         *IssueFields         `json:"fields,omitempty"`
	RenderedFields *IssueRenderedFields `json:"renderedFields,omitempty"`
	Changelog      *Changelog           `json:"changelog,omitempty"`
	Transitions    []Transition         `json:"transitions,omitempty"`
	Names          map[string]string    `json:"names,omitempty"`
}

Issue represents a Jira issue.

type IssueFields

type IssueFields struct {
	Expand                        string            `json:"expand,omitempty"`
	Type                          IssueType         `json:"issuetype,omitempty"`
	Project                       Project           `json:"project,omitempty"`
	Resolution                    *Resolution       `json:"resolution,omitempty"`
	Priority                      *Priority         `json:"priority,omitempty"`
	Resolutiondate                Time              `json:"resolutiondate,omitempty"`
	Created                       Time              `json:"created,omitempty"`
	Duedate                       Date              `json:"duedate,omitempty"`
	Watches                       *Watches          `json:"watches,omitempty"`
	Assignee                      *User             `json:"assignee,omitempty"`
	Updated                       Time              `json:"updated,omitempty"`
	Description                   string            `json:"description,omitempty"`
	Summary                       string            `json:"summary,omitempty"`
	Creator                       *User             `json:"Creator,omitempty"`
	Reporter                      *User             `json:"reporter,omitempty"`
	Components                    []*Component      `json:"components,omitempty"`
	Status                        *Status           `json:"status,omitempty"`
	Progress                      *Progress         `json:"progress,omitempty"`
	AggregateProgress             *Progress         `json:"aggregateprogress,omitempty"`
	TimeTracking                  *TimeTracking     `json:"timetracking,omitempty"`
	TimeSpent                     int               `json:"timespent,omitempty"`
	TimeEstimate                  int               `json:"timeestimate,omitempty"`
	TimeOriginalEstimate          int               `json:"timeoriginalestimate,omitempty"`
	Worklog                       *Worklog          `json:"worklog,omitempty"`
	IssueLinks                    []*IssueLink      `json:"issuelinks,omitempty"`
	Comments                      *Comments         `json:"comment,omitempty"`
	FixVersions                   []*FixVersion     `json:"fixVersions,omitempty"`
	AffectsVersions               []*AffectsVersion `json:"versions,omitempty"`
	Labels                        []string          `json:"labels,omitempty"`
	Subtasks                      []*Subtasks       `json:"subtasks,omitempty"`
	Attachments                   []*Attachment     `json:"attachment,omitempty"`
	Epic                          *Epic             `json:"epic,omitempty"`
	Parent                        *Parent           `json:"parent,omitempty"`
	AggregateTimeOriginalEstimate int               `json:"aggregatetimeoriginalestimate,omitempty"`
	AggregateTimeSpent            int               `json:"aggregatetimespent,omitempty"`
	AggregateTimeEstimate         int               `json:"aggregatetimeestimate,omitempty"`
	Unknowns                      tcontainer.MarshalMap
}

IssueFields represents single fields of a Jira issue. Every Jira issue has several fields attached.

type IssueLink struct {
	ID           string        `json:"id,omitempty"`
	Self         string        `json:"self,omitempty"`
	Type         IssueLinkType `json:"type"`
	OutwardIssue *Issue        `json:"outwardIssue"`
	InwardIssue  *Issue        `json:"inwardIssue"`
	Comment      *Comment      `json:"comment,omitempty"`
}

IssueLink represents a link between two issues in Jira.

type IssueLinkType

type IssueLinkType struct {
	ID      string `json:"id,omitempty"`
	Self    string `json:"self,omitempty"`
	Name    string `json:"name"`
	Inward  string `json:"inward"`
	Outward string `json:"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 IssueLinkTypes

type IssueLinkTypes struct {
	IssueLinkTypes []IssueLinkType `json:"issueLinkTypes,omitempty"`
}

IssueLinkTypes represents

type IssueRenderedFields

type IssueRenderedFields struct {
	Resolutiondate string    `json:"resolutiondate,omitempty"`
	Created        string    `json:"created,omitempty"`
	Duedate        string    `json:"duedate,omitempty"`
	Updated        string    `json:"updated,omitempty"`
	Comments       *Comments `json:"comment,omitempty"`
	Description    string    `json:"description,omitempty"`
}

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

type IssueType

type IssueType 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"`
	Subtask     bool      `json:"subtask,omitempty"`
	AvatarID    int       `json:"avatarId,omitempty"`
	Statuses    []*Status `json:"statuses,omitempty"`
}

IssueType is a type of a Jira issue. Typical types are "Bug", "Story", ...

type IssueTypes

type IssueTypes []*IssueType

type JiraComponent

type JiraComponent struct {
	Self             string `json:"self,omitempty"`
	ID               string `json:"id,omitempty"`
	Name             string `json:"name,omitempty"`
	Description      string `json:"description,omitempty"`
	Lead             *User  `json:"lead,omitempty"`
	LeadUserName     string `json:"leadUserName,omitempty"`
	AssigneeType     string `json:"assigneeType,omitempty"`
	Assignee         *User  `json:"assignee,omitempty"`
	RealAssigneeType string `json:"realAssigneeType,omitempty"`
	RealAssignee     *User  `json:"realAssignee,omitempty"`
	Project          string `json:"project,omitempty"`
	ProjectID        int    `json:"projectId,omitempty"`
}

JiraComponent represents a single component of a project

type JiraComponentUpdateReq

type JiraComponentUpdateReq struct {
	ID           string  `json:"id,omitempty"`
	Name         *string `json:"name,omitempty"`
	Description  *string `json:"description,omitempty"`
	LeadUserName *string `json:"leadUserName,omitempty"`
	AssigneeType *string `json:"assigneeType,omitempty"`
}

JiraComponentUpdateReq ...

func NewJiraComponentUpdateReq

func NewJiraComponentUpdateReq(componentID string) *JiraComponentUpdateReq

NewJiraComponentUpdateReq ...

func (*JiraComponentUpdateReq) SetAssigneeType

func (j *JiraComponentUpdateReq) SetAssigneeType(assigneeType string) *JiraComponentUpdateReq

SetAssigneeType ...

func (*JiraComponentUpdateReq) SetDescription

func (j *JiraComponentUpdateReq) SetDescription(description string) *JiraComponentUpdateReq

SetDescription ...

func (*JiraComponentUpdateReq) SetLeadUserName

func (j *JiraComponentUpdateReq) SetLeadUserName(leadUserName string) *JiraComponentUpdateReq

SetLeadUserName ...

func (*JiraComponentUpdateReq) SetName

SetName ...

type Option

type Option func(c *Container)

Option ...

func WithAddr

func WithAddr(addr string) Option

func WithPassword

func WithPassword(password string) Option

func WithUsername

func WithUsername(username string) Option

type Parent

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

Parent represents the parent of a Jira issue, to be used with subtask issue types.

type Priority

type Priority struct {
	Self        string `json:"self,omitempty"`
	IconURL     string `json:"iconUrl,omitempty"`
	Name        string `json:"name,omitempty"`
	ID          string `json:"id,omitempty"`
	StatusColor string `json:"statusColor,omitempty"`
	Description string `json:"description,omitempty"`
}

Priority is a priority of a Jira issue. Typical types are "Normal", "Moderate", "Urgent", ...

type Progress

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

Progress represents the progress of a Jira issue.

type Project

type Project struct {
	Expand          string             `json:"expand,omitempty"`
	Self            string             `json:"self,omitempty"`
	ID              string             `json:"id,omitempty"`
	Key             string             `json:"key,omitempty"`
	Description     string             `json:"description,omitempty"`
	Lead            User               `json:"lead,omitempty"`
	Components      []ProjectComponent `json:"components,omitempty"`
	IssueTypes      []IssueType        `json:"issueTypes,omitempty"`
	URL             string             `json:"url,omitempty"`
	Email           string             `json:"email,omitempty"`
	AssigneeType    string             `json:"assigneeType,omitempty"`
	Versions        []Version          `json:"versions,omitempty"`
	Name            string             `json:"name,omitempty"`
	Roles           map[string]string  `json:"roles,omitempty"`
	AvatarUrls      AvatarUrls         `json:"avatarUrls,omitempty"`
	ProjectCategory ProjectCategory    `json:"projectCategory,omitempty"`
}

Project jira project info

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 ProjectGetQueryOption

type ProjectGetQueryOption struct {
	Expand          string `url:"expand,omitempty"` // 可选参数:description,lead,url,projectKeys
	Recent          int    `url:"recent,omitempty"`
	IncludeArchived string `url:"includeArchived,omitempty"`
	BrowseArchive   string `url:"browseArchive,omitempty"`
}

ProjectGetQueryOption ...

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 Resolution

type Resolution struct {
	Self        string `json:"self"`
	ID          string `json:"id"`
	Description string `json:"description"`
	Name        string `json:"name"`
}

Resolution is a resolution of a Jira issue. Typical types are "Fixed", "Suspended", "Won't Fix", ...

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

type SearchResult

type SearchResult struct {
	Issues     []Issue `json:"issues"`
	StartAt    int     `json:"startAt"`
	MaxResults int     `json:"maxResults"`
	Total      int     `json:"total"`
}

searchResult is only a small wrapper around the Search (with JQL) method to be able to parse the results

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 Subtasks

type Subtasks struct {
	ID     string      `json:"id"`
	Key    string      `json:"key"`
	Self   string      `json:"self"`
	Fields IssueFields `json:"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

Equal ...

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"`
	RemainingEstimate        string `json:"remainingEstimate,omitempty"`
	TimeSpent                string `json:"timeSpent,omitempty"`
	OriginalEstimateSeconds  int    `json:"originalEstimateSeconds,omitempty"`
	RemainingEstimateSeconds int    `json:"remainingEstimateSeconds,omitempty"`
	TimeSpentSeconds         int    `json:"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"`
}

Transition represents an issue transition in Jira

type User

type User struct {
	Self            string     `json:"self,omitempty"`
	AccountID       string     `json:"accountId,omitempty"`
	AccountType     string     `json:"accountType,omitempty"`
	Name            string     `json:"name,omitempty"`
	Key             string     `json:"key,omitempty"`
	Password        string     `json:"-"`
	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"`
	Locale          string     `json:"locale,omitempty"`
	ApplicationKeys []string   `json:"applicationKeys,omitempty"`
}

User represents a Jira user.

type UserSearchOption

type UserSearchOption struct {
	Username        string
	StartAt         int
	MaxResults      int
	IncludeActive   *bool
	IncludeInactive *bool
}

UserSearchOption 查询参数

type Version

type Version struct {
	Self            string `json:"self,omitempty"`
	ID              string `json:"id,omitempty"`
	Name            string `json:"name,omitempty"`
	Description     string `json:"description,omitempty"`
	Archived        *bool  `json:"archived,omitempty"`
	Released        *bool  `json:"released,omitempty"`
	ReleaseDate     string `json:"releaseDate,omitempty"`
	UserReleaseDate string `json:"userReleaseDate,omitempty"`
	Project         string `json:"project,omitempty"`
	ProjectID       int    `json:"projectId,omitempty"`
	StartDate       string `json:"startDate,omitempty"`
}

Version represents a single release version of a project

type VersionUpdateReq

type VersionUpdateReq struct {
	ID          string  `json:"id,omitempty"`
	Name        *string `json:"name,omitempty"`
	Description *string `json:"description,omitempty"`
	Archived    *bool   `json:"archived,omitempty"`
	Released    *bool   `json:"released,omitempty"`
	ReleaseDate *string `json:"releaseDate,omitempty"`
	ProjectID   *int    `json:"projectId,omitempty"`
	StartDate   *string `json:"startDate,omitempty"`
}

VersionUpdateReq version update request

func NewVersionUpdateReq

func NewVersionUpdateReq(versionID string) *VersionUpdateReq

NewVersionUpdateReq ...

func (*VersionUpdateReq) SetArchived

func (v *VersionUpdateReq) SetArchived(archived bool) *VersionUpdateReq

SetArchived ...

func (*VersionUpdateReq) SetDescription

func (v *VersionUpdateReq) SetDescription(description string) *VersionUpdateReq

SetDescription ...

func (*VersionUpdateReq) SetName

func (v *VersionUpdateReq) SetName(name string) *VersionUpdateReq

SetName ...

func (*VersionUpdateReq) SetProjectID

func (v *VersionUpdateReq) SetProjectID(projectID int) *VersionUpdateReq

SetProjectID ...

func (*VersionUpdateReq) SetReleased

func (v *VersionUpdateReq) SetReleased(released bool) *VersionUpdateReq

SetReleased ...

func (*VersionUpdateReq) SetStartDate

func (v *VersionUpdateReq) SetStartDate(startDate string) *VersionUpdateReq

SetStartDate ...

type Watcher

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

Watcher represents a simplified user that "observes" the issue

type Watches

type Watches struct {
	Self       string     `json:"self,omitempty"`
	WatchCount int        `json:"watchCount,omitempty"`
	IsWatching bool       `json:"isWatching,omitempty"`
	Watchers   []*Watcher `json:"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"`
	MaxResults int             `json:"maxResults"`
	Total      int             `json:"total"`
	Worklogs   []WorklogRecord `json:"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"`
	Author           *User            `json:"author,omitempty"`
	UpdateAuthor     *User            `json:"updateAuthor,omitempty"`
	Comment          string           `json:"comment,omitempty"`
	Created          *Time            `json:"created,omitempty"`
	Updated          *Time            `json:"updated,omitempty"`
	Started          *Time            `json:"started,omitempty"`
	TimeSpent        string           `json:"timeSpent,omitempty"`
	TimeSpentSeconds int              `json:"timeSpentSeconds,omitempty"`
	ID               string           `json:"id,omitempty"`
	IssueID          string           `json:"issueId,omitempty"`
	Properties       []EntityProperty `json:"properties,omitempty"`
}

WorklogRecord represents one entry of a Worklog

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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