mirror of
https://github.com/documize/community.git
synced 2025-07-19 05:09:42 +02:00
Moved from Dep to Go Modules
We have finally dropped go dep and moved over to go mod ! During the move, some dependencies have been bumped.
This commit is contained in:
parent
2c164a135a
commit
b826852137
164 changed files with 18268 additions and 10658 deletions
76
vendor/github.com/andygrunwald/go-jira/role.go
generated
vendored
Normal file
76
vendor/github.com/andygrunwald/go-jira/role.go
generated
vendored
Normal file
|
@ -0,0 +1,76 @@
|
|||
package jira
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// RoleService handles roles for the JIRA instance / API.
|
||||
//
|
||||
// JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/v3/#api-group-Role
|
||||
type RoleService struct {
|
||||
client *Client
|
||||
}
|
||||
|
||||
// Role represents a JIRA product role
|
||||
type Role struct {
|
||||
Self string `json:"self" structs:"self"`
|
||||
Name string `json:"name" structs:"name"`
|
||||
ID int `json:"id" structs:"id"`
|
||||
Description string `json:"description" structs:"description"`
|
||||
Actors []*Actor `json:"actors" structs:"actors"`
|
||||
}
|
||||
|
||||
// Actor represents a JIRA actor
|
||||
type Actor struct {
|
||||
ID int `json:"id" structs:"id"`
|
||||
DisplayName string `json:"displayName" structs:"displayName"`
|
||||
Type string `json:"type" structs:"type"`
|
||||
Name string `json:"name" structs:"name"`
|
||||
AvatarURL string `json:"avatarUrl" structs:"avatarUrl"`
|
||||
ActorUser *ActorUser `json:"actorUser" structs:"actoruser"`
|
||||
}
|
||||
|
||||
// ActorUser contains the account id of the actor/user
|
||||
type ActorUser struct {
|
||||
AccountID string `json:"accountId" structs:"accountId"`
|
||||
}
|
||||
|
||||
// GetList returns a list of all available project roles
|
||||
//
|
||||
// JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/v3/#api-api-3-role-get
|
||||
func (s *RoleService) GetList() (*[]Role, *Response, error) {
|
||||
apiEndpoint := "rest/api/3/role"
|
||||
req, err := s.client.NewRequest("GET", apiEndpoint, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
roles := new([]Role)
|
||||
resp, err := s.client.Do(req, roles)
|
||||
if err != nil {
|
||||
jerr := NewJiraError(resp, err)
|
||||
return nil, resp, jerr
|
||||
}
|
||||
return roles, resp, err
|
||||
}
|
||||
|
||||
// Get retreives a single Role from Jira
|
||||
//
|
||||
// JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/v3/#api-api-3-role-id-get
|
||||
func (s *RoleService) Get(roleID int) (*Role, *Response, error) {
|
||||
apiEndpoint := fmt.Sprintf("rest/api/3/role/%d", roleID)
|
||||
req, err := s.client.NewRequest("GET", apiEndpoint, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
role := new(Role)
|
||||
resp, err := s.client.Do(req, role)
|
||||
if err != nil {
|
||||
jerr := NewJiraError(resp, err)
|
||||
return nil, resp, jerr
|
||||
}
|
||||
if role.Self == "" {
|
||||
return nil, resp, fmt.Errorf("No role with ID %d found", roleID)
|
||||
}
|
||||
|
||||
return role, resp, err
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue