diff --git a/github/github-accessors.go b/github/github-accessors.go index 7f6499fe23a..ad06c78c9fa 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -21062,6 +21062,14 @@ func (r *ReleaseAsset) GetCreatedAt() Timestamp { return *r.CreatedAt } +// GetDigest returns the Digest field if it's non-nil, zero value otherwise. +func (r *ReleaseAsset) GetDigest() string { + if r == nil || r.Digest == nil { + return "" + } + return *r.Digest +} + // GetDownloadCount returns the DownloadCount field if it's non-nil, zero value otherwise. func (r *ReleaseAsset) GetDownloadCount() int { if r == nil || r.DownloadCount == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 980688ae0ee..0abd03fe319 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -27138,6 +27138,17 @@ func TestReleaseAsset_GetCreatedAt(tt *testing.T) { r.GetCreatedAt() } +func TestReleaseAsset_GetDigest(tt *testing.T) { + tt.Parallel() + var zeroValue string + r := &ReleaseAsset{Digest: &zeroValue} + r.GetDigest() + r = &ReleaseAsset{} + r.GetDigest() + r = nil + r.GetDigest() +} + func TestReleaseAsset_GetDownloadCount(tt *testing.T) { tt.Parallel() var zeroValue int diff --git a/github/github-stringify_test.go b/github/github-stringify_test.go index 4563959967e..603bf87dc07 100644 --- a/github/github-stringify_test.go +++ b/github/github-stringify_test.go @@ -1661,8 +1661,9 @@ func TestReleaseAsset_String(t *testing.T) { BrowserDownloadURL: Ptr(""), Uploader: &User{}, NodeID: Ptr(""), + Digest: Ptr(""), } - want := `github.ReleaseAsset{ID:0, URL:"", Name:"", Label:"", State:"", ContentType:"", Size:0, DownloadCount:0, CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, BrowserDownloadURL:"", Uploader:github.User{}, NodeID:""}` + want := `github.ReleaseAsset{ID:0, URL:"", Name:"", Label:"", State:"", ContentType:"", Size:0, DownloadCount:0, CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, BrowserDownloadURL:"", Uploader:github.User{}, NodeID:"", Digest:""}` if got := v.String(); got != want { t.Errorf("ReleaseAsset.String = %v, want %v", got, want) } diff --git a/github/repos_releases.go b/github/repos_releases.go index d4b4591bfbb..fb90c0fd240 100644 --- a/github/repos_releases.go +++ b/github/repos_releases.go @@ -79,6 +79,7 @@ type ReleaseAsset struct { BrowserDownloadURL *string `json:"browser_download_url,omitempty"` Uploader *User `json:"uploader,omitempty"` NodeID *string `json:"node_id,omitempty"` + Digest *string `json:"digest,omitempty"` } func (r ReleaseAsset) String() string {