Skip to content

Commit

Permalink
Changed GetCreateMeta method to not require a projectKey. When a user…
Browse files Browse the repository at this point in the history
… passes in an empty string, it will retrieve the metadata for all projects.

Also changed "Subtasks" to "Subtask" to match Jira's data structure.
  • Loading branch information
nguyen970 committed Feb 28, 2018
1 parent e04b453 commit 72b0266
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions metaissue.go
Expand Up @@ -36,15 +36,22 @@ type MetaIssueType struct {
Description string `json:"description,omitempty"`
IconUrl string `json:"iconurl,omitempty"`
Name string `json:"name,omitempty"`
Subtasks bool `json:"subtask,omitempty"`
Subtask bool `json:"subtask,omitempty"`
Expand string `json:"expand,omitempty"`
Fields tcontainer.MarshalMap `json:"fields,omitempty"`
}

// GetCreateMeta makes the api call to get the meta information required to create a ticket
func (s *IssueService) GetCreateMeta(projectkey string) (*CreateMetaInfo, *Response, error) {

apiEndpoint := fmt.Sprintf("rest/api/2/issue/createmeta?projectKeys=%s&expand=projects.issuetypes.fields", projectkey)
apiEndpoint := ""
if len(projectkey) > 0 {
apiEndpoint = fmt.Sprintf("rest/api/2/issue/createmeta?projectKeys=%s&expand=projects.issuetypes.fields", projectkey)
}else {
apiEndpoint = fmt.Sprintf("rest/api/2/issue/createmeta?expand=projects.issuetypes.fields")
}

fmt.Println(apiEndpoint)

req, err := s.client.NewRequest("GET", apiEndpoint, nil)
if err != nil {
Expand Down

0 comments on commit 72b0266

Please sign in to comment.