diff --git a/issue_test.go b/issue_test.go index a050015..b493ee9 100644 --- a/issue_test.go +++ b/issue_test.go @@ -1739,8 +1739,8 @@ func TestIssueService_Get_Fields_AffectsVersions(t *testing.T) { Name: "2.1.0-rc3", Self: "http://www.example.com/jira/rest/api/2/version/10705", ReleaseDate: "2018-09-30", - Released: false, - Archived: false, + Released: Bool(false), + Archived: Bool(false), Description: "test description", }, }) { diff --git a/types.go b/types.go new file mode 100644 index 0000000..b99fc1c --- /dev/null +++ b/types.go @@ -0,0 +1,9 @@ +package jira + +// Bool is a helper routine that allocates a new bool value +// to store v and returns a pointer to it. +func Bool(v bool) *bool { + p := new(bool) + *p = v + return p +} diff --git a/version.go b/version.go index 757c25b..6ab9fa7 100644 --- a/version.go +++ b/version.go @@ -20,8 +20,8 @@ type Version struct { ID string `json:"id,omitempty" structs:"id,omitempty"` Name string `json:"name,omitempty" structs:"name,omitempty"` Description string `json:"description,omitempty" structs:"description,omitempty"` - Archived bool `json:"archived,omitempty" structs:"archived,omitempty"` - Released bool `json:"released,omitempty" structs:"released,omitempty"` + Archived *bool `json:"archived,omitempty" structs:"archived,omitempty"` + Released *bool `json:"released,omitempty" structs:"released,omitempty"` ReleaseDate string `json:"releaseDate,omitempty" structs:"releaseDate,omitempty"` UserReleaseDate string `json:"userReleaseDate,omitempty" structs:"userReleaseDate,omitempty"` ProjectID int `json:"projectId,omitempty" structs:"projectId,omitempty"` // Unlike other IDs, this is returned as a number diff --git a/version_test.go b/version_test.go index c77097d..e00d69e 100644 --- a/version_test.go +++ b/version_test.go @@ -61,7 +61,8 @@ func TestVersionService_Create(t *testing.T) { Name: "New Version 1", Description: "An excellent version", ProjectID: 10000, - Released: true, + Released: Bool(true), + Archived: Bool(false), ReleaseDate: "2010-07-06", UserReleaseDate: "6/Jul/2010", StartDate: "2018-07-01",