1
0
mirror of https://github.com/interviewstreet/go-jira.git synced 2025-03-29 21:47:06 +02:00

Fix GetQueryOptions in issue.go to use projectKeys instead of projectKey

This commit is contained in:
Tyler Cheek 2018-03-05 08:56:57 -05:00
parent 61dbee1c77
commit 4a727d9c52
2 changed files with 9 additions and 8 deletions

View File

@ -508,9 +508,9 @@ type GetQueryOptions struct {
// Properties is the list of properties to return for the issue. By default no properties are returned. // Properties is the list of properties to return for the issue. By default no properties are returned.
Properties string `url:"properties,omitempty"` Properties string `url:"properties,omitempty"`
// FieldsByKeys if true then fields in issues will be referenced by keys instead of ids // FieldsByKeys if true then fields in issues will be referenced by keys instead of ids
FieldsByKeys bool `url:"fieldsByKeys,omitempty"` FieldsByKeys bool `url:"fieldsByKeys,omitempty"`
UpdateHistory bool `url:"updateHistory,omitempty"` UpdateHistory bool `url:"updateHistory,omitempty"`
ProjectKey string `url:"projectKey,omitempty"` ProjectKeys string `url:"projectKeys,omitempty"`
} }
// CustomFields represents custom fields of JIRA // CustomFields represents custom fields of JIRA

View File

@ -4,8 +4,8 @@ import (
"fmt" "fmt"
"strings" "strings"
"github.com/trivago/tgo/tcontainer"
"github.com/google/go-querystring/query" "github.com/google/go-querystring/query"
"github.com/trivago/tgo/tcontainer"
) )
// CreateMetaInfo contains information about fields and their attributed to create a ticket. // CreateMetaInfo contains information about fields and their attributed to create a ticket.
@ -37,14 +37,14 @@ type MetaIssueType struct {
Description string `json:"description,omitempty"` Description string `json:"description,omitempty"`
IconUrl string `json:"iconurl,omitempty"` IconUrl string `json:"iconurl,omitempty"`
Name string `json:"name,omitempty"` Name string `json:"name,omitempty"`
Subtasks bool `json:"subtask,omitempty"` Subtasks bool `json:"subtask,omitempty"`
Expand string `json:"expand,omitempty"` Expand string `json:"expand,omitempty"`
Fields tcontainer.MarshalMap `json:"fields,omitempty"` Fields tcontainer.MarshalMap `json:"fields,omitempty"`
} }
// GetCreateMeta makes the api call to get the meta information required to create a ticket // GetCreateMeta makes the api call to get the meta information required to create a ticket
func (s *IssueService) GetCreateMeta(projectkey string) (*CreateMetaInfo, *Response, error) { func (s *IssueService) GetCreateMeta(projectkeys string) (*CreateMetaInfo, *Response, error) {
return s.GetCreateMetaWithOptions(&GetQueryOptions{ProjectKey: projectkey, Expand: "projects.issuetypes.fields"}) return s.GetCreateMetaWithOptions(&GetQueryOptions{ProjectKeys: projectkeys, Expand: "projects.issuetypes.fields"})
} }
// GetCreateMetaWithOptions makes the api call to get the meta information without requiring to have a projectKey // GetCreateMetaWithOptions makes the api call to get the meta information without requiring to have a projectKey
@ -58,7 +58,7 @@ func (s *IssueService) GetCreateMetaWithOptions(options *GetQueryOptions) (*Crea
if options != nil { if options != nil {
q, err := query.Values(options) q, err := query.Values(options)
if err != nil { if err != nil {
return nil, nil , err return nil, nil, err
} }
req.URL.RawQuery = q.Encode() req.URL.RawQuery = q.Encode()
} }
@ -72,6 +72,7 @@ func (s *IssueService) GetCreateMetaWithOptions(options *GetQueryOptions) (*Crea
return meta, resp, nil return meta, resp, nil
} }
// GetProjectWithName returns a project with "name" from the meta information received. If not found, this returns nil. // GetProjectWithName returns a project with "name" from the meta information received. If not found, this returns nil.
// The comparison of the name is case insensitive. // The comparison of the name is case insensitive.
func (m *CreateMetaInfo) GetProjectWithName(name string) *MetaProject { func (m *CreateMetaInfo) GetProjectWithName(name string) *MetaProject {