From d84383fadeb011f3488bf6f1f6390686e0f696ec Mon Sep 17 00:00:00 2001 From: Ronan Pelliard Date: Wed, 4 Aug 2021 15:25:51 +0200 Subject: [PATCH] Add Slug field to AppConfig --- github/apps_manifest.go | 1 + github/apps_manifest_test.go | 2 ++ github/github-accessors.go | 8 ++++++++ github/github-accessors_test.go | 10 ++++++++++ 4 files changed, 21 insertions(+) diff --git a/github/apps_manifest.go b/github/apps_manifest.go index defd6c0a0bf..164f4939995 100644 --- a/github/apps_manifest.go +++ b/github/apps_manifest.go @@ -13,6 +13,7 @@ import ( // AppConfig describes the configuration of a GitHub App. type AppConfig struct { ID *int64 `json:"id,omitempty"` + Slug *string `json:"slug,omitempty"` NodeID *string `json:"node_id,omitempty"` Owner *User `json:"owner,omitempty"` Name *string `json:"name,omitempty"` diff --git a/github/apps_manifest_test.go b/github/apps_manifest_test.go index a5d230d048a..833982e4850 100644 --- a/github/apps_manifest_test.go +++ b/github/apps_manifest_test.go @@ -72,6 +72,7 @@ func TestAppConfig_Marshal(t *testing.T) { u := &AppConfig{ ID: Int64(1), + Slug: String("s"), NodeID: String("nid"), Owner: &User{ Login: String("l"), @@ -107,6 +108,7 @@ func TestAppConfig_Marshal(t *testing.T) { want := `{ "id": 1, + "slug": "s", "node_id": "nid", "owner": { "login": "l", diff --git a/github/github-accessors.go b/github/github-accessors.go index 6671ddbc0cf..3fa1e018840 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -460,6 +460,14 @@ func (a *AppConfig) GetPEM() string { return *a.PEM } +// GetSlug returns the Slug field if it's non-nil, zero value otherwise. +func (a *AppConfig) GetSlug() string { + if a == nil || a.Slug == nil { + return "" + } + return *a.Slug +} + // GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. func (a *AppConfig) GetUpdatedAt() Timestamp { if a == nil || a.UpdatedAt == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index efd85f772a4..b3ef053f46b 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -519,6 +519,16 @@ func TestAppConfig_GetPEM(tt *testing.T) { a.GetPEM() } +func TestAppConfig_GetSlug(tt *testing.T) { + var zeroValue string + a := &AppConfig{Slug: &zeroValue} + a.GetSlug() + a = &AppConfig{} + a.GetSlug() + a = nil + a.GetSlug() +} + func TestAppConfig_GetUpdatedAt(tt *testing.T) { var zeroValue Timestamp a := &AppConfig{UpdatedAt: &zeroValue}