Repository: google/go-github
Pull request #1798 (2021-02-11 14:23:42)

Add missing fields to MarketplacePlan and MarketplacePurchase structs
Hello,

As described in issue #1775, I've added missing fields to MarketplacePlan and MarketplacePurchase structs.

Thanks,
Alex

gmlewis: And in the future (also listed in our CONTRIBUTING.md file - search for # 7)... please do not use force push on PRs for this repo, as it makes the reviews much more difficult for the reviewers to keep track of changes.

Obviously, for this PR, it doesn't matter, but just please keep this in mind for future contributions.

Thank you.

Patch:
diff --git a/github/apps_marketplace.go b/github/apps_marketplace.go
index 9cc258e1..3107bc8d 100644
--- a/github/apps_marketplace.go
+++ b/github/apps_marketplace.go
@@ -30,6 +30,7 @@ type MarketplacePlan struct {
 	URL                 *string `json:"url,omitempty"`
 	AccountsURL         *string `json:"accounts_url,omitempty"`
 	ID                  *int64  `json:"id,omitempty"`
+	Number              *int    `json:"number,omitempty"`
 	Name                *string `json:"name,omitempty"`
 	Description         *string `json:"description,omitempty"`
 	MonthlyPriceInCents *int    `json:"monthly_price_in_cents,omitempty"`
@@ -53,6 +54,7 @@ type MarketplacePurchase struct {
 	Account         *MarketplacePlanAccount `json:"account,omitempty"`
 	OnFreeTrial     *bool                   `json:"on_free_trial,omitempty"`
 	FreeTrialEndsOn *Timestamp              `json:"free_trial_ends_on,omitempty"`
+	UpdatedAt       *Timestamp              `json:"updated_at,omitempty"`
 }
 
 // MarketplacePendingChange represents a pending change to a GitHub Apps Marketplace Plan.
diff --git a/github/github-accessors.go b/github/github-accessors.go
index b9160192..40b52d17 100644
--- a/github/github-accessors.go
+++ b/github/github-accessors.go
@@ -6084,6 +6084,14 @@ func (m *MarketplacePlan) GetName() string {
 	return *m.Name
 }
 
+// GetNumber returns the Number field if it's non-nil, zero value otherwise.
+func (m *MarketplacePlan) GetNumber() int {
+	if m == nil || m.Number == nil {
+		return 0
+	}
+	return *m.Number
+}
+
 // GetPriceModel returns the PriceModel field if it's non-nil, zero value otherwise.
 func (m *MarketplacePlan) GetPriceModel() string {
 	if m == nil || m.PriceModel == nil {
@@ -6252,6 +6260,14 @@ func (m *MarketplacePurchase) GetUnitCount() int {
 	return *m.UnitCount
 }
 
+// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.
+func (m *MarketplacePurchase) GetUpdatedAt() Timestamp {
+	if m == nil || m.UpdatedAt == nil {
+		return Timestamp{}
+	}
+	return *m.UpdatedAt
+}
+
 // GetAction returns the Action field if it's non-nil, zero value otherwise.
 func (m *MarketplacePurchaseEvent) GetAction() string {
 	if m == nil || m.Action == nil {


Test patch:
diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go
index e7a22dca..bdcfa107 100644
--- a/github/github-accessors_test.go
+++ b/github/github-accessors_test.go
@@ -7129,6 +7129,16 @@ func TestMarketplacePlan_GetName(tt *testing.T) {
 	m.GetName()
 }
 
+func TestMarketplacePlan_GetNumber(tt *testing.T) {
+	var zeroValue int
+	m := &MarketplacePlan{Number: &zeroValue}
+	m.GetNumber()
+	m = &MarketplacePlan{}
+	m.GetNumber()
+	m = nil
+	m.GetNumber()
+}
+
 func TestMarketplacePlan_GetPriceModel(tt *testing.T) {
 	var zeroValue string
 	m := &MarketplacePlan{PriceModel: &zeroValue}
@@ -7327,6 +7337,16 @@ func TestMarketplacePurchase_GetUnitCount(tt *testing.T) {
 	m.GetUnitCount()
 }
 
+func TestMarketplacePurchase_GetUpdatedAt(tt *testing.T) {
+	var zeroValue Timestamp
+	m := &MarketplacePurchase{UpdatedAt: &zeroValue}
+	m.GetUpdatedAt()
+	m = &MarketplacePurchase{}
+	m.GetUpdatedAt()
+	m = nil
+	m.GetUpdatedAt()
+}
+
 func TestMarketplacePurchaseEvent_GetAction(tt *testing.T) {
 	var zeroValue string
 	m := &MarketplacePurchaseEvent{Action: &zeroValue}