1
0
mirror of https://github.com/interviewstreet/go-jira.git synced 2025-07-17 01:12:24 +02:00

Rename MetaIssueTypes to MetaIssueType

This commit is contained in:
Bidesh Thapaliya
2016-10-04 15:22:03 +02:00
parent e75e7750f2
commit ba52ec9209

View File

@ -20,7 +20,7 @@ type MetaProject struct {
Key string `json:"key,omitempty"` Key string `json:"key,omitempty"`
Name string `json:"name,omitempty"` Name string `json:"name,omitempty"`
// omitted avatarUrls // omitted avatarUrls
IssueTypes []*MetaIssueTypes `json:"issuetypes,omitempty"` IssueTypes []*MetaIssueType `json:"issuetypes,omitempty"`
} }
// metaIssueTypes represents the different issue types a project has. // metaIssueTypes represents the different issue types a project has.
@ -29,7 +29,7 @@ type MetaProject struct {
// have arbitraty keys related to customfields. It is not possible to // have arbitraty keys related to customfields. It is not possible to
// expect these for a general way. This will be returning a map. // expect these for a general way. This will be returning a map.
// Further processing must be done depending on what is required. // Further processing must be done depending on what is required.
type MetaIssueTypes struct { type MetaIssueType struct {
Self string `json:"expand,omitempty"` Self string `json:"expand,omitempty"`
Id string `json:"id,omitempty"` Id string `json:"id,omitempty"`
Description string `json:"description,omitempty"` Description string `json:"description,omitempty"`
@ -73,7 +73,7 @@ func (m *CreateMetaInfo) GetProjectWithName(name string) *MetaProject {
// GetIssueWithName returns an IssueType with name from a given MetaProject. If not found, this returns nil. // GetIssueWithName returns an IssueType with name from a given MetaProject. If not found, this returns nil.
// The comparision of the name is case insensitive // The comparision of the name is case insensitive
func (p *MetaProject) GetIssueTypeWithName(name string) *MetaIssueTypes { func (p *MetaProject) GetIssueTypeWithName(name string) *MetaIssueType {
for _, m := range p.IssueTypes { for _, m := range p.IssueTypes {
if strings.ToLower(m.Name) == strings.ToLower(name) { if strings.ToLower(m.Name) == strings.ToLower(name) {
return m return m
@ -99,7 +99,7 @@ func (p *MetaProject) GetIssueTypeWithName(name string) *MetaIssueTypes {
// } // }
// the returned map would have "Epic Link" as the key and "customfield_10806" as value. // the returned map would have "Epic Link" as the key and "customfield_10806" as value.
// This choice has been made so that the it is easier to generate the create api request later. // This choice has been made so that the it is easier to generate the create api request later.
func (t *MetaIssueTypes) GetMandatoryFields() (map[string]string, error) { func (t *MetaIssueType) GetMandatoryFields() (map[string]string, error) {
ret := make(map[string]string) ret := make(map[string]string)
for key, _ := range t.Fields { for key, _ := range t.Fields {
required, err := t.Fields.Bool(key + "/required") required, err := t.Fields.Bool(key + "/required")
@ -119,7 +119,7 @@ func (t *MetaIssueTypes) GetMandatoryFields() (map[string]string, error) {
// GetAllFields returns a map of all the fields for an IssueType. This includes all required and not required. // GetAllFields returns a map of all the fields for an IssueType. This includes all required and not required.
// The key of the returned map is what you see in the form and the value is how it is representated in the jira schema. // The key of the returned map is what you see in the form and the value is how it is representated in the jira schema.
func (t *MetaIssueTypes) GetAllFields() (map[string]string, error) { func (t *MetaIssueType) GetAllFields() (map[string]string, error) {
ret := make(map[string]string) ret := make(map[string]string)
for key, _ := range t.Fields { for key, _ := range t.Fields {