mirror of
				https://github.com/interviewstreet/go-jira.git
				synced 2025-10-30 23:47:46 +02:00 
			
		
		
		
	move agile issue api to sprint, change name of GetByOption to GetWithOptions
This commit is contained in:
		
							
								
								
									
										2
									
								
								group.go
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								group.go
									
									
									
									
									
								
							| @@ -83,7 +83,7 @@ func (s *GroupService) Get(name string) ([]GroupMember, *Response, error) { | ||||
| // User of this resource is required to have sysadmin or admin permissions. | ||||
| // | ||||
| // JIRA API docs: https://docs.atlassian.com/jira/REST/server/#api/2/group-getUsersFromGroup | ||||
| func (s *GroupService) GetByOption(name string, options *GroupSearchOptions) ([]GroupMember, *Response, error) { | ||||
| func (s *GroupService) GetWithOptions(name string, options *GroupSearchOptions) ([]GroupMember, *Response, error) { | ||||
| 	var apiEndpoint string | ||||
| 	if options == nil { | ||||
| 		apiEndpoint = fmt.Sprintf("/rest/api/2/group/member?groupname=%s", url.QueryEscape(name)) | ||||
|   | ||||
| @@ -36,7 +36,7 @@ func TestGroupService_GetPage(t *testing.T) { | ||||
| 			t.Errorf("startAt %s", startAt) | ||||
| 		} | ||||
| 	}) | ||||
| 	if page, resp, err := testClient.Group.GetByOption("default", &GroupSearchOptions{ | ||||
| 	if page, resp, err := testClient.Group.GetWithOptions("default", &GroupSearchOptions{ | ||||
| 		StartAt:              0, | ||||
| 		MaxResults:           2, | ||||
| 		IncludeInactiveUsers: false, | ||||
| @@ -54,7 +54,7 @@ func TestGroupService_GetPage(t *testing.T) { | ||||
| 		if resp.Total != 4 { | ||||
| 			t.Errorf("Expect Result Total to be 4, but is %d", resp.Total) | ||||
| 		} | ||||
| 		if page, resp, err := testClient.Group.GetByOption("default", &GroupSearchOptions{ | ||||
| 		if page, resp, err := testClient.Group.GetWithOptions("default", &GroupSearchOptions{ | ||||
| 			StartAt:              2, | ||||
| 			MaxResults:           2, | ||||
| 			IncludeInactiveUsers: false, | ||||
|   | ||||
							
								
								
									
										38
									
								
								issue.go
									
									
									
									
									
								
							
							
						
						
									
										38
									
								
								issue.go
									
									
									
									
									
								
							| @@ -553,44 +553,6 @@ func (s *IssueService) Get(issueID string, options *GetQueryOptions) (*Issue, *R | ||||
| 	return issue, resp, nil | ||||
| } | ||||
|  | ||||
| // Get returns a full representation of the issue for the given issue key. | ||||
| // JIRA will attempt to identify the issue by the issueIdOrKey path parameter. | ||||
| // This can be an issue id, or an issue key. | ||||
| // If the issue cannot be found via an exact match, JIRA will also look for the issue in a case-insensitive way, or by looking to see if the issue was moved. | ||||
| // | ||||
| // The given options will be appended to the query string | ||||
| // | ||||
| // JIRA API docs: https://docs.atlassian.com/jira-software/REST/7.3.1/#agile/1.0/issue-getIssue | ||||
| // | ||||
| // TODO: create agile service for holding all agile apis' implementation | ||||
| func (s *IssueService) GetWithAgile(issueID string, options *GetQueryOptions) (*Issue, *Response, error) { | ||||
| 	apiEndpoint := fmt.Sprintf("rest/agile/1.0/issue/%s", issueID) | ||||
| 	if !s.client.Authentication.Authenticated() { | ||||
| 		return nil, nil, fmt.Errorf("agile endpoints need to be authenticated for testing") | ||||
| 	} | ||||
| 	req, err := s.client.NewRequest("GET", apiEndpoint, nil) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
|  | ||||
| 	if options != nil { | ||||
| 		q, err := query.Values(options) | ||||
| 		if err != nil { | ||||
| 			return nil, nil, err | ||||
| 		} | ||||
| 		req.URL.RawQuery = q.Encode() | ||||
| 	} | ||||
|  | ||||
| 	issue := new(Issue) | ||||
| 	resp, err := s.client.Do(req, issue) | ||||
| 	if err != nil { | ||||
| 		jerr := NewJiraError(resp, err) | ||||
| 		return nil, resp, jerr | ||||
| 	} | ||||
|  | ||||
| 	return issue, resp, nil | ||||
| } | ||||
|  | ||||
| // DownloadAttachment returns a Response of an attachment for a given attachmentID. | ||||
| // The attachment is in the Response.Body of the response. | ||||
| // This is an io.ReadCloser. | ||||
|   | ||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										39
									
								
								sprint.go
									
									
									
									
									
								
							
							
						
						
									
										39
									
								
								sprint.go
									
									
									
									
									
								
							| @@ -2,6 +2,7 @@ package jira | ||||
|  | ||||
| import ( | ||||
| 	"fmt" | ||||
| 	"github.com/google/go-querystring/query" | ||||
| ) | ||||
|  | ||||
| // SprintService handles sprints in JIRA Agile API. | ||||
| @@ -65,3 +66,41 @@ func (s *SprintService) GetIssuesForSprint(sprintID int) ([]Issue, *Response, er | ||||
|  | ||||
| 	return result.Issues, resp, err | ||||
| } | ||||
|  | ||||
| // Get returns a full representation of the issue for the given issue key. | ||||
| // JIRA will attempt to identify the issue by the issueIdOrKey path parameter. | ||||
| // This can be an issue id, or an issue key. | ||||
| // If the issue cannot be found via an exact match, JIRA will also look for the issue in a case-insensitive way, or by looking to see if the issue was moved. | ||||
| // | ||||
| // The given options will be appended to the query string | ||||
| // | ||||
| // JIRA API docs: https://docs.atlassian.com/jira-software/REST/7.3.1/#agile/1.0/issue-getIssue | ||||
| // | ||||
| // TODO: create agile service for holding all agile apis' implementation | ||||
| func (s *SprintService) GetIssue(issueID string, options *GetQueryOptions) (*Issue, *Response, error) { | ||||
| 	apiEndpoint := fmt.Sprintf("rest/agile/1.0/issue/%s", issueID) | ||||
|  | ||||
| 	req, err := s.client.NewRequest("GET", apiEndpoint, nil) | ||||
|  | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
|  | ||||
| 	if options != nil { | ||||
| 		q, err := query.Values(options) | ||||
| 		if err != nil { | ||||
| 			return nil, nil, err | ||||
| 		} | ||||
| 		req.URL.RawQuery = q.Encode() | ||||
| 	} | ||||
|  | ||||
| 	issue := new(Issue) | ||||
| 	resp, err := s.client.Do(req, issue) | ||||
|  | ||||
| 	if err != nil { | ||||
| 		jerr := NewJiraError(resp, err) | ||||
| 		return nil, resp, jerr | ||||
| 	} | ||||
|  | ||||
| 	return issue, resp, nil | ||||
| } | ||||
|   | ||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
		Reference in New Issue
	
	Block a user