diff --git a/github/github-accessors.go b/github/github-accessors.go index 7c89cb60d0b..434cc938c62 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -4612,6 +4612,14 @@ func (i *IssueStats) GetTotalIssues() int { return *i.TotalIssues } +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (k *Key) GetCreatedAt() Timestamp { + if k == nil || k.CreatedAt == nil { + return Timestamp{} + } + return *k.CreatedAt +} + // GetID returns the ID field if it's non-nil, zero value otherwise. func (k *Key) GetID() int64 { if k == nil || k.ID == nil { diff --git a/github/github-stringify_test.go b/github/github-stringify_test.go index c91f7b5a277..2e7b285ea0e 100644 --- a/github/github-stringify_test.go +++ b/github/github-stringify_test.go @@ -623,13 +623,14 @@ func TestIssueStats_String(t *testing.T) { func TestKey_String(t *testing.T) { v := Key{ - ID: Int64(0), - Key: String(""), - URL: String(""), - Title: String(""), - ReadOnly: Bool(false), + ID: Int64(0), + Key: String(""), + URL: String(""), + Title: String(""), + ReadOnly: Bool(false), + CreatedAt: &Timestamp{}, } - want := `github.Key{ID:0, Key:"", URL:"", Title:"", ReadOnly:false}` + want := `github.Key{ID:0, Key:"", URL:"", Title:"", ReadOnly:false, CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}` if got := v.String(); got != want { t.Errorf("Key.String = %v, want %v", got, want) } diff --git a/github/users_keys.go b/github/users_keys.go index ddc832a1ece..39a4f54d6c2 100644 --- a/github/users_keys.go +++ b/github/users_keys.go @@ -12,11 +12,12 @@ import ( // Key represents a public SSH key used to authenticate a user or deploy script. type Key struct { - ID *int64 `json:"id,omitempty"` - Key *string `json:"key,omitempty"` - URL *string `json:"url,omitempty"` - Title *string `json:"title,omitempty"` - ReadOnly *bool `json:"read_only,omitempty"` + ID *int64 `json:"id,omitempty"` + Key *string `json:"key,omitempty"` + URL *string `json:"url,omitempty"` + Title *string `json:"title,omitempty"` + ReadOnly *bool `json:"read_only,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` } func (k Key) String() string {