Documentation ¶
Index ¶
- Constants
- func IsIssueTypeEstimable(issueTypeName string) bool
- type API
- type Client
- func (c *Client) AddComment(issueKeyOrID, body string) (*jiralib.Comment, error)
- func (c *Client) AddRemoteLinkToIssue(issueKeyOrID, globalID, title, url string) error
- func (c *Client) CreateIssue(issueType, summary, description, epicKey string, components []string, ...) (*jiralib.Issue, error)
- func (c *Client) CreateSprint(name string, goal string, startDate, endDate *time.Time) (*jiralib.Sprint, error)
- func (c *Client) CreateVersion(name, description string, projectID int, released, archived bool, ...) (*Version, error)
- func (c *Client) GetCustomFieldID(name string) string
- func (c *Client) GetIssueEstimate(issueKeyOrID string) (float32, error)
- func (c *Client) GetIssueFromGithubID(ghIssueID int64) (*jiralib.Issue, error)
- func (c *Client) GetIssueRemoteLinks(issueKeyOrID string) ([]RemoteLink, error)
- func (c *Client) GetProjectID() (int, error)
- func (c *Client) GetProjectVersions() ([]*Version, error)
- func (c *Client) Init() error
- func (c *Client) ListSprints(ctx context.Context) ([]jiralib.Sprint, error)
- func (c *Client) MoveToBacklog(issuesKeys []string) error
- func (c *Client) TransitionIssue(issueKeyOrID, transitionName string) error
- func (c *Client) UpdateComment(issueKeyOrID, commentID, body string) (*jiralib.Comment, error)
- func (c *Client) UpdateIssue(issue *jiralib.Issue) (*jiralib.Issue, error)
- func (c *Client) UpdateIssueEstimate(issueKeyOrID string, estimate float32) error
- func (c *Client) UpdateIssueFixVersion(issueKeyOrID string, versionsIDs []string) error
- func (c *Client) UpdateSprint(sprint *jiralib.Sprint) (*jiralib.Sprint, error)
- func (c *Client) UpdateVersion(version *Version) (*Version, error)
- type RemoteLink
- type RemoteLinkObject
- type Version
Constants ¶
const ( CFNameGitHubID = "GitHub ID" CFNameGitHubNumber = "GitHub Number" CFNameGitHubLabels = "GitHub Labels" CFNameGitHubStatus = "GitHub Status" CFNameGitHubReporter = "GitHub Reporter" CFNameGitHubLastIssueSync = "Last Issue-Sync Update" CFNameEpicName = "Epic Name" CFNameEpicLink = "Epic Link" CFNameSprint = "Sprint" CFNameStatus = "Status" )
Variables ¶
This section is empty.
Functions ¶
func IsIssueTypeEstimable ¶
IsIssueTypeEstimable checks if issue type support estimation through Story Points custom field
Currently only "User story" support estimate
Types ¶
type API ¶
type API interface { // ListSprints will return all sprints from the associated 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-rest-agile-1-0-board-boardId-sprint-get ListSprints(ctx context.Context) ([]jiralib.Sprint, error) // CreateSprint will create a given sprint. // // JIRA API docs: https://developer.atlassian.com/cloud/jira/software/rest/#api-rest-agile-1-0-sprint-post CreateSprint(name string, goal string, startDate, endDate *time.Time) (*jiralib.Sprint, error) // UpdateSprint will update a given sprint. // // JIRA API docs: https://developer.atlassian.com/cloud/jira/software/rest/#api-rest-agile-1-0-sprint-sprintId-put UpdateSprint(sprint *jiralib.Sprint) (*jiralib.Sprint, error) // GetProjectVersions returns all versions of the associated Jira project GetProjectVersions() ([]*Version, error) // Create creates a version in JIRA. // // JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/v3/?utm_source=%2Fcloud%2Fjira%2Fplatform%2Frest%2F&utm_medium=302#api-api-3-version-post CreateVersion(name, description string, projectID int, released, archived bool, startDate, dueDate, releaseDate *time.Time) (*Version, error) // UpdateVersion will update a given version. // // JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/v3/?utm_source=/cloud/jira/platform/rest/&utm_medium=302#api-api-3-version-id-put UpdateVersion(version *Version) (*Version, error) // GetProjectID GetProjectID() (int, error) // GetIssueFromGithubID retrieves a Jira Issue that have a 'GitHub ID' custom field matching the given github issue id. // // The returned issue may be nil if none was found. GetIssueFromGithubID(ghIssueID int64) (*jiralib.Issue, error) // UpdateIssue will update a given issue. // // JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/v3/?utm_source=/cloud/jira/platform/rest/&utm_medium=302#api-api-3-version-id-put UpdateIssue(issue *jiralib.Issue) (*jiralib.Issue, error) // UpdateIssueFixVersion will set the fixVersion to the given list of version ids. // // JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/v3/?utm_source=/cloud/jira/platform/rest/&utm_medium=302#api-api-3-version-id-put UpdateIssueFixVersion(issueKeyOrID string, versionsIDs []string) error // CreateIssue creates an issue or a sub-task from a JSON representation. // // JIRA API docs: https://docs.atlassian.com/jira/REST/latest/#api/2/issue-createIssues CreateIssue(issueType, summary, description, epicKey string, components []string, sprint *int, githubID int64, githubNumber int, githubLabels []string, githubStatus string) (*jiralib.Issue, error) // GetCustomFieldID returns a custom field ID based on its name. If not found an empty string is returned. GetCustomFieldID(name string) string // MoveToBacklog moves a list of issues identified by there issue keys to the backlog. // This operation is equivalent to remove future and active sprints from a given set of issues. // // JIRA API docs: https://docs.atlassian.com/jira-software/REST/7.0.4/#agile/1.0/backlog-moveIssuesToBacklog MoveToBacklog(issuesKeys []string) error // UpdateIssueEstimate estimate for the given issue key or ID // // JIRA API docs: https://developer.atlassian.com/cloud/jira/software/rest/#api-rest-agile-1-0-issue-issueIdOrKey-estimation-put UpdateIssueEstimate(issueKeyOrID string, estimate float32) error // GetIssueEstimate get the estimate for the given issue key or ID // // JIRA API docs: https://developer.atlassian.com/cloud/jira/software/rest/#api-rest-agile-1-0-issue-issueIdOrKey-estimation-get GetIssueEstimate(issueKeyOrID string) (float32, error) // AddRemoteLinkToIssue adds a link to an issue // // JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/v3/?utm_source=/cloud/jira/platform/rest/&utm_medium=302#api-rest-api-3-issue-issueIdOrKey-remotelink-post AddRemoteLinkToIssue(issueKeyOrID, globalID, title, url string) error // GetIssueRemoteLinks get the list of remote links for a given issue // // JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/v3/?utm_source=/cloud/jira/platform/rest/&utm_medium=302#api-rest-api-3-issue-issueIdOrKey-remotelink-get GetIssueRemoteLinks(issueKeyOrID string) ([]RemoteLink, error) // TransitionIssue execute transition identified by the given name to the issue TransitionIssue(issueKeyOrID, transitionName string) error // AddComment adds a new comment to issueID. // // JIRA API docs: https://docs.atlassian.com/jira/REST/latest/#api/2/issue-addComment AddComment(issueKeyOrID, body string) (*jiralib.Comment, error) // UpdateComment updates the body of a comment, identified by commentID, on the issueID. // // JIRA API docs: https://docs.atlassian.com/jira/REST/cloud/#api/2/issue/{issueIdOrKey}/comment-updateComment UpdateComment(issueKeyOrID, commentID, body string) (*jiralib.Comment, error) }
API abstracts JIRA API to things needed by this project This is useful for mocking.
type Client ¶
type Client struct { JiraClient *jiralib.Client ProjectKey string BoardID int // contains filtered or unexported fields }
Client manages communication with the Jira API.
func (*Client) AddComment ¶
AddComment adds a new comment to issueID.
JIRA API docs: https://docs.atlassian.com/jira/REST/latest/#api/2/issue-addComment
func (*Client) AddRemoteLinkToIssue ¶
AddRemoteLinkToIssue adds a link to an issue
func (*Client) CreateIssue ¶
func (c *Client) CreateIssue(issueType, summary, description, epicKey string, components []string, sprint *int, githubID int64, githubNumber int, githubLabels []string, githubStatus string) (*jiralib.Issue, error)
CreateIssue creates an issue or a sub-task from a JSON representation.
JIRA API docs: https://docs.atlassian.com/jira/REST/latest/#api/2/issue-createIssues
func (*Client) CreateSprint ¶
func (c *Client) CreateSprint(name string, goal string, startDate, endDate *time.Time) (*jiralib.Sprint, error)
CreateSprint will create a given sprint.
JIRA API docs: https://developer.atlassian.com/cloud/jira/software/rest/#api-rest-agile-1-0-sprint-post
func (*Client) CreateVersion ¶
func (c *Client) CreateVersion(name, description string, projectID int, released, archived bool, startDate, dueDate, releaseDate *time.Time) (*Version, error)
CreateVersion creates a version in JIRA.
func (*Client) GetCustomFieldID ¶
GetCustomFieldID returns a custom field ID based on its name. If not found an empty string is returned.
func (*Client) GetIssueEstimate ¶
GetIssueEstimate get the estimate for the given issue key or ID
func (*Client) GetIssueFromGithubID ¶
GetIssueFromGithubID retrieves a Jira Issue that have a 'GitHub ID' custom field matching the given github issue id.
The returned issue may be nil if none was found.
func (*Client) GetIssueRemoteLinks ¶
func (c *Client) GetIssueRemoteLinks(issueKeyOrID string) ([]RemoteLink, error)
GetIssueRemoteLinks get the list of remote links for a given issue
func (*Client) GetProjectID ¶
func (*Client) GetProjectVersions ¶
GetProjectVersions returns all versions of the associated Jira project
func (*Client) Init ¶
Init initialize the client by getting some instance specific IDs
Call to this function is required before using it to synchronize ZenHub and Jira
func (*Client) ListSprints ¶
ListSprints will return all sprints from the associated 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-rest-agile-1-0-board-boardId-sprint-get
func (*Client) MoveToBacklog ¶
MoveToBacklog moves a list of issues identified by there issue keys to the backlog. This operation is equivalent to remove future and active sprints from a given set of issues.
JIRA API docs: https://docs.atlassian.com/jira-software/REST/7.0.4/#agile/1.0/backlog-moveIssuesToBacklog
func (*Client) TransitionIssue ¶
TransitionIssue execute transition identified by the given name to the issue
func (*Client) UpdateComment ¶
UpdateComment updates the body of a comment, identified by commentID, on the issueID.
JIRA API docs: https://docs.atlassian.com/jira/REST/cloud/#api/2/issue/{issueIdOrKey}/comment-updateComment
func (*Client) UpdateIssue ¶
UpdateIssue will update a given issue.
func (*Client) UpdateIssueEstimate ¶
UpdateIssueEstimate estimate for the given issue key or ID
func (*Client) UpdateIssueFixVersion ¶
UpdateIssueFixVersion will set the fixVersion to the given list of version ids.
func (*Client) UpdateSprint ¶
UpdateSprint will update a given sprint.
JIRA API docs: https://developer.atlassian.com/cloud/jira/software/rest/#api-rest-agile-1-0-sprint-sprintId-put
func (*Client) UpdateVersion ¶
UpdateVersion will update a given version.
type RemoteLink ¶
type RemoteLink struct { GlobalID string `json:"global_id,omitempty"` Object RemoteLinkObject `json:"object,omitempty"` }
RemoteLink is an issue remote link
type RemoteLinkObject ¶
type RemoteLinkObject struct { Title string `json:"title,omitempty"` URL string `json:"url,omitempty"` }
RemoteLinkObject is an issue remote link content