From 1fc10e0606784f745673ccc4d8d706c36f385a7a Mon Sep 17 00:00:00 2001 From: Luke Young Date: Sat, 2 May 2020 01:43:01 -0700 Subject: [PATCH] feat: Add Names support on Issue struct (#278) --- issue.go | 1 + sprint_test.go | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/issue.go b/issue.go index 5a5da64..520d819 100644 --- a/issue.go +++ b/issue.go @@ -47,6 +47,7 @@ type Issue struct { RenderedFields *IssueRenderedFields `json:"renderedFields,omitempty" structs:"renderedFields,omitempty"` Changelog *Changelog `json:"changelog,omitempty" structs:"changelog,omitempty"` Transitions []Transition `json:"transitions,omitempty" structs:"transitions,omitempty"` + Names map[string]string `json:"names,omitempty" structs:"names,omitempty"` } // ChangelogItems reflects one single changelog item of a history item diff --git a/sprint_test.go b/sprint_test.go index 6b5c5bd..ccd67f6 100644 --- a/sprint_test.go +++ b/sprint_test.go @@ -89,6 +89,23 @@ func TestSprintService_GetIssue(t *testing.T) { if len(issue.Fields.Comments.Comments) != 1 { t.Errorf("Expected one comment, %v found", len(issue.Fields.Comments.Comments)) } + if len(issue.Names) != 10 { + t.Errorf("Expected 10 names, %v found", len(issue.Names)) + } + if !reflect.DeepEqual(issue.Names, map[string]string{ + "watcher": "watcher", + "attachment": "attachment", + "sub-tasks": "sub-tasks", + "description": "description", + "project": "project", + "comment": "comment", + "issuelinks": "issuelinks", + "worklog": "worklog", + "updated": "updated", + "timetracking": "timetracking", + }) { + t.Error("Expected names for the returned issue") + } if err != nil { t.Errorf("Error given: %s", err) }