mirror of
https://github.com/interviewstreet/go-jira.git
synced 2025-01-03 22:52:17 +02:00
feat: Add get all priorities
This commit is contained in:
parent
98ede9f81c
commit
1c63e25a25
9
issue.go
9
issue.go
@ -235,15 +235,6 @@ type Resolution struct {
|
||||
Name string `json:"name" structs:"name"`
|
||||
}
|
||||
|
||||
// Priority represents a priority of a JIRA issue.
|
||||
// Typical types are "Normal", "Moderate", "Urgent", ...
|
||||
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"`
|
||||
}
|
||||
|
||||
// Watches represents a type of how many and which user are "observing" a JIRA issue to track the status / updates.
|
||||
type Watches struct {
|
||||
Self string `json:"self,omitempty" structs:"self,omitempty"`
|
||||
|
37
priority.go
Normal file
37
priority.go
Normal file
@ -0,0 +1,37 @@
|
||||
package jira
|
||||
|
||||
// PriorityService handles priorities for the JIRA instance / API.
|
||||
//
|
||||
// JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/#api-Priority
|
||||
type PriorityService struct {
|
||||
client *Client
|
||||
}
|
||||
|
||||
// Priority represents a priority of a JIRA issue.
|
||||
// Typical types are "Normal", "Moderate", "Urgent", ...
|
||||
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"`
|
||||
}
|
||||
|
||||
// GetList gets all priorities from JIRA
|
||||
//
|
||||
// JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/#api-api-2-priority-get
|
||||
func (s *PriorityService) GetList() ([]Priority, *Response, error) {
|
||||
apiEndpoint := "rest/api/2/priority"
|
||||
req, err := s.client.NewRequest("GET", apiEndpoint, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
priorityList := []Priority{}
|
||||
resp, err := s.client.Do(req, priorityList)
|
||||
if err != nil {
|
||||
return nil, resp, NewJiraError(resp, err)
|
||||
}
|
||||
return priorityList, resp, nil
|
||||
}
|
Loading…
Reference in New Issue
Block a user