From 9f22826ce1e6e434433b9e35b8ea62836ba4d589 Mon Sep 17 00:00:00 2001 From: R4vio <55717756+R4vio@users.noreply.github.com> Date: Wed, 25 Dec 2024 18:14:07 +0100 Subject: [PATCH 1/2] Update orgs_personal_access_tokens.go --- github/orgs_personal_access_tokens.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/github/orgs_personal_access_tokens.go b/github/orgs_personal_access_tokens.go index af083744e85..276fbbb4942 100644 --- a/github/orgs_personal_access_tokens.go +++ b/github/orgs_personal_access_tokens.go @@ -44,6 +44,12 @@ type PersonalAccessToken struct { // Date and time when the associated fine-grained personal access token expires. TokenExpiresAt *Timestamp `json:"token_expires_at"` + // TokenID + TokenID *int64 `json:"token_id"` + + // TokenName + TokenName *string `json:"token_name"` + // Date and time when the associated fine-grained personal access token was last used for authentication. TokenLastUsedAt *Timestamp `json:"token_last_used_at"` } From 02a38b5d9335d310c715fe30b745a788d48dcb35 Mon Sep 17 00:00:00 2001 From: R4vio Date: Wed, 25 Dec 2024 22:14:36 +0100 Subject: [PATCH 2/2] Add GetTokenID and GetTokenName methods to PersonalAccessToken --- github/github-accessors.go | 16 ++++++++++++++++ github/github-accessors_test.go | 22 ++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/github/github-accessors.go b/github/github-accessors.go index 0800c02c6c4..cf70ac59493 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -15342,6 +15342,14 @@ func (p *PersonalAccessToken) GetTokenExpiresAt() Timestamp { return *p.TokenExpiresAt } +// GetTokenID returns the TokenID field if it's non-nil, zero value otherwise. +func (p *PersonalAccessToken) GetTokenID() int64 { + if p == nil || p.TokenID == nil { + return 0 + } + return *p.TokenID +} + // GetTokenLastUsedAt returns the TokenLastUsedAt field if it's non-nil, zero value otherwise. func (p *PersonalAccessToken) GetTokenLastUsedAt() Timestamp { if p == nil || p.TokenLastUsedAt == nil { @@ -15350,6 +15358,14 @@ func (p *PersonalAccessToken) GetTokenLastUsedAt() Timestamp { return *p.TokenLastUsedAt } +// GetTokenName returns the TokenName field if it's non-nil, zero value otherwise. +func (p *PersonalAccessToken) GetTokenName() string { + if p == nil || p.TokenName == nil { + return "" + } + return *p.TokenName +} + // GetOrg returns the Org map if it's non-nil, an empty map otherwise. func (p *PersonalAccessTokenPermissions) GetOrg() map[string]string { if p == nil || p.Org == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 4b5c9dcb263..ff7530bcc0a 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -19849,6 +19849,17 @@ func TestPersonalAccessToken_GetTokenExpiresAt(tt *testing.T) { p.GetTokenExpiresAt() } +func TestPersonalAccessToken_GetTokenID(tt *testing.T) { + tt.Parallel() + var zeroValue int64 + p := &PersonalAccessToken{TokenID: &zeroValue} + p.GetTokenID() + p = &PersonalAccessToken{} + p.GetTokenID() + p = nil + p.GetTokenID() +} + func TestPersonalAccessToken_GetTokenLastUsedAt(tt *testing.T) { tt.Parallel() var zeroValue Timestamp @@ -19860,6 +19871,17 @@ func TestPersonalAccessToken_GetTokenLastUsedAt(tt *testing.T) { p.GetTokenLastUsedAt() } +func TestPersonalAccessToken_GetTokenName(tt *testing.T) { + tt.Parallel() + var zeroValue string + p := &PersonalAccessToken{TokenName: &zeroValue} + p.GetTokenName() + p = &PersonalAccessToken{} + p.GetTokenName() + p = nil + p.GetTokenName() +} + func TestPersonalAccessTokenPermissions_GetOrg(tt *testing.T) { tt.Parallel() zeroValue := map[string]string{}