From 46057450abae766bd14c14991f3d051e290a6d31 Mon Sep 17 00:00:00 2001 From: Sridhar Date: Sun, 4 Nov 2018 11:12:11 -0800 Subject: [PATCH 01/10] Support marketplace pending changes - New API and json props --- github/apps_marketplace.go | 47 ++++++++++++++++++++++++++----- github/apps_marketplace_test.go | 50 +++++++++++++++++++++++++++++++++ github/event_types.go | 2 +- 3 files changed, 91 insertions(+), 8 deletions(-) diff --git a/github/apps_marketplace.go b/github/apps_marketplace.go index 3f35b915576..193514ea33d 100644 --- a/github/apps_marketplace.go +++ b/github/apps_marketplace.go @@ -37,6 +37,7 @@ type MarketplacePlan struct { PriceModel *string `json:"price_model,omitempty"` UnitName *string `json:"unit_name,omitempty"` Bullets *[]string `json:"bullets,omitempty"` + State *string `json:"state,omitempty"` } // MarketplacePurchase represents a GitHub Apps Marketplace Purchase. @@ -46,17 +47,28 @@ type MarketplacePurchase struct { UnitCount *int `json:"unit_count,omitempty"` Plan *MarketplacePlan `json:"plan,omitempty"` Account *MarketplacePlanAccount `json:"account,omitempty"` + OnFreeTrial *bool `json:"on_free_trial,omitempty"` + FreeTrialEndsOn *string `json:"free_trial_ends_on,omitempty"` +} + +// MarketplacePendingChange represents a pending change to a Github Apps Marketplace Plan +type MarketplacePendingChange struct { + EffectiveDate *string `json:"effective_date,omitempty"` + UnitCount *int `json:"unit_count,omitempty"` + ID *int64 `json:"id,omitempty"` + Plan *MarketplacePlan `json:"plan,omitempty"` } // MarketplacePlanAccount represents a GitHub Account (user or organization) on a specific plan. type MarketplacePlanAccount struct { - URL *string `json:"url,omitempty"` - Type *string `json:"type,omitempty"` - ID *int64 `json:"id,omitempty"` - Login *string `json:"login,omitempty"` - Email *string `json:"email,omitempty"` - OrganizationBillingEmail *string `json:"organization_billing_email,omitempty"` - MarketplacePurchase *MarketplacePurchase `json:"marketplace_purchase,omitempty"` + URL *string `json:"url,omitempty"` + Type *string `json:"type,omitempty"` + ID *int64 `json:"id,omitempty"` + Login *string `json:"login,omitempty"` + Email *string `json:"email,omitempty"` + OrganizationBillingEmail *string `json:"organization_billing_email,omitempty"` + MarketplacePurchase *MarketplacePurchase `json:"marketplace_purchase,omitempty"` + MarketplacePendingChange *MarketplacePendingChange `json:"marketplace_pending_change,omitempty"` } // ListPlans lists all plans for your Marketplace listing. @@ -159,6 +171,27 @@ func (s *MarketplaceService) ListMarketplacePurchasesForUser(ctx context.Context return purchases, resp, nil } +// GetAccountMarketplaceListingAssociation returns the Github Marketplace plan actively subscribed to by the specified account. +// +// Github API docs: https://developer.github.com/v3/apps/marketplace/#check-if-a-github-account-is-associated-with-any-marketplace-listing +func (s *MarketplaceService) GetAccountMarketplaceListingAssociation(ctx context.Context, accountID int64) (*MarketplacePlanAccount, *Response, error) { + uri := fmt.Sprintf("marketplace_listing/accounts/%v", accountID) + if s.Stubbed { + uri = fmt.Sprintf("marketplace_listing/stubbed/accounts/%v", accountID) + } + req, err := s.client.NewRequest("GET", uri, nil) + if err != nil { + return nil, nil, err + } + + account := new(MarketplacePlanAccount) + resp, err := s.client.Do(ctx, req, account) + if err != nil { + return nil, resp, err + } + return account, resp, nil +} + func (s *MarketplaceService) marketplaceURI(endpoint string) string { url := "marketplace_listing" if s.Stubbed { diff --git a/github/apps_marketplace_test.go b/github/apps_marketplace_test.go index 0c1f86c7c00..67dc549ce94 100644 --- a/github/apps_marketplace_test.go +++ b/github/apps_marketplace_test.go @@ -192,3 +192,53 @@ func TestMarketplaceService_Stubbed_ListMarketplacePurchasesForUser(t *testing.T t.Errorf("Marketplace.ListMarketplacePurchasesForUser returned %+v, want %+v", purchases, want) } } + +func TestMarketplaceService_GetAccountMarketplaceListingAssociation(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/marketplace_listing/accounts/1", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + fmt.Fprint(w, `{"marketplace_pending_change" : {"id": 77}}`) + }) + + client.Marketplace.Stubbed = false + account, _, err := client.Marketplace.GetAccountMarketplaceListingAssociation(context.Background(), 1) + if err != nil { + t.Errorf("Marketplace.GetAccountMarketplaceListingAssociation returned error: %v", err) + } + want := &MarketplacePlanAccount{ + MarketplacePendingChange: &MarketplacePendingChange{ + ID: Int64(77), + }, + } + + if !reflect.DeepEqual(account, want) { + t.Errorf("Marketplace.GetAccountMarketplaceListingAssociation returned %+v, want %+v", account, want) + } +} + +func TestMarketplaceService_Stubbed_GetAccountMarketplaceListingAssociation(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/marketplace_listing/stubbed/accounts/1", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + fmt.Fprint(w, `{"marketplace_pending_change": {"id" : 77}}`) + }) + + client.Marketplace.Stubbed = true + account, _, err := client.Marketplace.GetAccountMarketplaceListingAssociation(context.Background(), 1) + if err != nil { + t.Errorf("Marketplace.GetAccountMarketplaceListingAssociation returned error: %v", err) + } + want := &MarketplacePlanAccount{ + MarketplacePendingChange: &MarketplacePendingChange{ + ID: Int64(77), + }, + } + + if !reflect.DeepEqual(account, want) { + t.Errorf("Marketplace.GetAccountMarketplaceListingAssociation returned %+v, want %+v", account, want) + } +} diff --git a/github/event_types.go b/github/event_types.go index 1792f43c732..d3f7d332025 100644 --- a/github/event_types.go +++ b/github/event_types.go @@ -308,7 +308,7 @@ type LabelEvent struct { // Github API docs: https://developer.github.com/v3/activity/events/types/#marketplacepurchaseevent type MarketplacePurchaseEvent struct { // Action is the action that was performed. Possible values are: - // "purchased", "cancelled", "changed". + // "purchased", "cancelled", "pending_change", "pending_change_cancelled", "changed". Action *string `json:"action,omitempty"` // The following fields are only populated by Webhook events. From d22b3e8a5c3de1aef8221248943cca61840560f2 Mon Sep 17 00:00:00 2001 From: Sridhar Mocherla Date: Sun, 4 Nov 2018 11:24:12 -0800 Subject: [PATCH 02/10] Support marketplace pending changes - update to test, remove unnecessary changes --- github/apps_marketplace.go | 22 -------------- github/apps_marketplace_test.go | 54 ++------------------------------- 2 files changed, 2 insertions(+), 74 deletions(-) diff --git a/github/apps_marketplace.go b/github/apps_marketplace.go index 193514ea33d..c2e8c94a007 100644 --- a/github/apps_marketplace.go +++ b/github/apps_marketplace.go @@ -167,31 +167,9 @@ func (s *MarketplaceService) ListMarketplacePurchasesForUser(ctx context.Context if err != nil { return nil, resp, err } - return purchases, resp, nil } -// GetAccountMarketplaceListingAssociation returns the Github Marketplace plan actively subscribed to by the specified account. -// -// Github API docs: https://developer.github.com/v3/apps/marketplace/#check-if-a-github-account-is-associated-with-any-marketplace-listing -func (s *MarketplaceService) GetAccountMarketplaceListingAssociation(ctx context.Context, accountID int64) (*MarketplacePlanAccount, *Response, error) { - uri := fmt.Sprintf("marketplace_listing/accounts/%v", accountID) - if s.Stubbed { - uri = fmt.Sprintf("marketplace_listing/stubbed/accounts/%v", accountID) - } - req, err := s.client.NewRequest("GET", uri, nil) - if err != nil { - return nil, nil, err - } - - account := new(MarketplacePlanAccount) - resp, err := s.client.Do(ctx, req, account) - if err != nil { - return nil, resp, err - } - return account, resp, nil -} - func (s *MarketplaceService) marketplaceURI(endpoint string) string { url := "marketplace_listing" if s.Stubbed { diff --git a/github/apps_marketplace_test.go b/github/apps_marketplace_test.go index 67dc549ce94..e293c83a16d 100644 --- a/github/apps_marketplace_test.go +++ b/github/apps_marketplace_test.go @@ -111,7 +111,7 @@ func TestMarketplaceService_ListPlanAccountsForAccount(t *testing.T) { mux.HandleFunc("/marketplace_listing/accounts/1", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - fmt.Fprint(w, `[{"id":1}]`) + fmt.Fprint(w, `[{"id":1, "marketplace_pending_change": {"id": 77}}]`) }) opt := &ListOptions{Page: 1, PerPage: 2} @@ -121,7 +121,7 @@ func TestMarketplaceService_ListPlanAccountsForAccount(t *testing.T) { t.Errorf("Marketplace.ListPlanAccountsForAccount returned error: %v", err) } - want := []*MarketplacePlanAccount{{ID: Int64(1)}} + want := []*MarketplacePlanAccount{{ID: Int64(1), MarketplacePendingChange: &MarketplacePendingChange{ID: Int64(77)}}} if !reflect.DeepEqual(accounts, want) { t.Errorf("Marketplace.ListPlanAccountsForAccount returned %+v, want %+v", accounts, want) } @@ -192,53 +192,3 @@ func TestMarketplaceService_Stubbed_ListMarketplacePurchasesForUser(t *testing.T t.Errorf("Marketplace.ListMarketplacePurchasesForUser returned %+v, want %+v", purchases, want) } } - -func TestMarketplaceService_GetAccountMarketplaceListingAssociation(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() - - mux.HandleFunc("/marketplace_listing/accounts/1", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprint(w, `{"marketplace_pending_change" : {"id": 77}}`) - }) - - client.Marketplace.Stubbed = false - account, _, err := client.Marketplace.GetAccountMarketplaceListingAssociation(context.Background(), 1) - if err != nil { - t.Errorf("Marketplace.GetAccountMarketplaceListingAssociation returned error: %v", err) - } - want := &MarketplacePlanAccount{ - MarketplacePendingChange: &MarketplacePendingChange{ - ID: Int64(77), - }, - } - - if !reflect.DeepEqual(account, want) { - t.Errorf("Marketplace.GetAccountMarketplaceListingAssociation returned %+v, want %+v", account, want) - } -} - -func TestMarketplaceService_Stubbed_GetAccountMarketplaceListingAssociation(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() - - mux.HandleFunc("/marketplace_listing/stubbed/accounts/1", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprint(w, `{"marketplace_pending_change": {"id" : 77}}`) - }) - - client.Marketplace.Stubbed = true - account, _, err := client.Marketplace.GetAccountMarketplaceListingAssociation(context.Background(), 1) - if err != nil { - t.Errorf("Marketplace.GetAccountMarketplaceListingAssociation returned error: %v", err) - } - want := &MarketplacePlanAccount{ - MarketplacePendingChange: &MarketplacePendingChange{ - ID: Int64(77), - }, - } - - if !reflect.DeepEqual(account, want) { - t.Errorf("Marketplace.GetAccountMarketplaceListingAssociation returned %+v, want %+v", account, want) - } -} From 1b6735eaa245f764b017b8f73638d9dea7bb9aba Mon Sep 17 00:00:00 2001 From: Sridhar Mocherla Date: Sun, 4 Nov 2018 11:35:27 -0800 Subject: [PATCH 03/10] Add HasFreeTrial field. --- github/apps_marketplace.go | 1 + 1 file changed, 1 insertion(+) diff --git a/github/apps_marketplace.go b/github/apps_marketplace.go index c2e8c94a007..79424251f86 100644 --- a/github/apps_marketplace.go +++ b/github/apps_marketplace.go @@ -38,6 +38,7 @@ type MarketplacePlan struct { UnitName *string `json:"unit_name,omitempty"` Bullets *[]string `json:"bullets,omitempty"` State *string `json:"state,omitempty"` + HasFreeTrial *bool `json:"has_free_trial,omitempty"` } // MarketplacePurchase represents a GitHub Apps Marketplace Purchase. From e6f44f3338c189669f678a2ad9bbb60220032232 Mon Sep 17 00:00:00 2001 From: Sridhar Mocherla Date: Wed, 14 Nov 2018 23:15:56 -0800 Subject: [PATCH 04/10] update github_accessors.go --- github/github-accessors.go | 72 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/github/github-accessors.go b/github/github-accessors.go index 62573892958..f582c848842 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -4644,6 +4644,38 @@ func (l *ListCheckSuiteResults) GetTotal() int { return *l.Total } +// GetEffectiveDate returns the EffectiveDate field if it's non-nil, zero value otherwise. +func (m *MarketplacePendingChange) GetEffectiveDate() time.Time { + if m == nil || m.EffectiveDate == nil { + return time.Time{} + } + return *m.EffectiveDate +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (m *MarketplacePendingChange) GetID() int64 { + if m == nil || m.ID == nil { + return 0 + } + return *m.ID +} + +// GetPlan returns the Plan field. +func (m *MarketplacePendingChange) GetPlan() *MarketplacePlan { + if m == nil { + return nil + } + return m.Plan +} + +// GetUnitCount returns the UnitCount field if it's non-nil, zero value otherwise. +func (m *MarketplacePendingChange) GetUnitCount() int { + if m == nil || m.UnitCount == nil { + return 0 + } + return *m.UnitCount +} + // GetAccountsURL returns the AccountsURL field if it's non-nil, zero value otherwise. func (m *MarketplacePlan) GetAccountsURL() string { if m == nil || m.AccountsURL == nil { @@ -4668,6 +4700,14 @@ func (m *MarketplacePlan) GetDescription() string { return *m.Description } +// GetHasFreeTrial returns the HasFreeTrial field if it's non-nil, zero value otherwise. +func (m *MarketplacePlan) GetHasFreeTrial() bool { + if m == nil || m.HasFreeTrial == nil { + return false + } + return *m.HasFreeTrial +} + // GetID returns the ID field if it's non-nil, zero value otherwise. func (m *MarketplacePlan) GetID() int64 { if m == nil || m.ID == nil { @@ -4700,6 +4740,14 @@ func (m *MarketplacePlan) GetPriceModel() string { return *m.PriceModel } +// GetState returns the State field if it's non-nil, zero value otherwise. +func (m *MarketplacePlan) GetState() string { + if m == nil || m.State == nil { + return "" + } + return *m.State +} + // GetUnitName returns the UnitName field if it's non-nil, zero value otherwise. func (m *MarketplacePlan) GetUnitName() string { if m == nil || m.UnitName == nil { @@ -4748,6 +4796,14 @@ func (m *MarketplacePlanAccount) GetLogin() string { return *m.Login } +// GetMarketplacePendingChange returns the MarketplacePendingChange field. +func (m *MarketplacePlanAccount) GetMarketplacePendingChange() *MarketplacePendingChange { + if m == nil { + return nil + } + return m.MarketplacePendingChange +} + // GetMarketplacePurchase returns the MarketplacePurchase field. func (m *MarketplacePlanAccount) GetMarketplacePurchase() *MarketplacePurchase { if m == nil { @@ -4796,6 +4852,14 @@ func (m *MarketplacePurchase) GetBillingCycle() string { return *m.BillingCycle } +// GetFreeTrialEndsOn returns the FreeTrialEndsOn field if it's non-nil, zero value otherwise. +func (m *MarketplacePurchase) GetFreeTrialEndsOn() string { + if m == nil || m.FreeTrialEndsOn == nil { + return "" + } + return *m.FreeTrialEndsOn +} + // GetNextBillingDate returns the NextBillingDate field if it's non-nil, zero value otherwise. func (m *MarketplacePurchase) GetNextBillingDate() string { if m == nil || m.NextBillingDate == nil { @@ -4804,6 +4868,14 @@ func (m *MarketplacePurchase) GetNextBillingDate() string { return *m.NextBillingDate } +// GetOnFreeTrial returns the OnFreeTrial field if it's non-nil, zero value otherwise. +func (m *MarketplacePurchase) GetOnFreeTrial() bool { + if m == nil || m.OnFreeTrial == nil { + return false + } + return *m.OnFreeTrial +} + // GetPlan returns the Plan field. func (m *MarketplacePurchase) GetPlan() *MarketplacePlan { if m == nil { From 7b6b1e887808ac8a09d277c1792b98586066936f Mon Sep 17 00:00:00 2001 From: Sridhar Mocherla Date: Wed, 14 Nov 2018 23:16:10 -0800 Subject: [PATCH 05/10] change from string to timestamp --- github/apps_marketplace.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/github/apps_marketplace.go b/github/apps_marketplace.go index 79424251f86..7cb02037c7d 100644 --- a/github/apps_marketplace.go +++ b/github/apps_marketplace.go @@ -8,6 +8,7 @@ package github import ( "context" "fmt" + "time" ) // MarketplaceService handles communication with the marketplace related @@ -54,7 +55,7 @@ type MarketplacePurchase struct { // MarketplacePendingChange represents a pending change to a Github Apps Marketplace Plan type MarketplacePendingChange struct { - EffectiveDate *string `json:"effective_date,omitempty"` + EffectiveDate *time.Time `json:"effective_date,omitempty"` UnitCount *int `json:"unit_count,omitempty"` ID *int64 `json:"id,omitempty"` Plan *MarketplacePlan `json:"plan,omitempty"` From b6effa4f2977cdabed8eb8d0ad9705fad4fe262b Mon Sep 17 00:00:00 2001 From: Sridhar Mocherla Date: Wed, 14 Nov 2018 23:27:35 -0800 Subject: [PATCH 06/10] update comment for struct --- github/apps_marketplace.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/apps_marketplace.go b/github/apps_marketplace.go index 7cb02037c7d..c7dc797cb02 100644 --- a/github/apps_marketplace.go +++ b/github/apps_marketplace.go @@ -53,7 +53,7 @@ type MarketplacePurchase struct { FreeTrialEndsOn *string `json:"free_trial_ends_on,omitempty"` } -// MarketplacePendingChange represents a pending change to a Github Apps Marketplace Plan +// MarketplacePendingChange represents a pending change to a GitHub Apps Marketplace Plan. type MarketplacePendingChange struct { EffectiveDate *time.Time `json:"effective_date,omitempty"` UnitCount *int `json:"unit_count,omitempty"` From a3b546140237d5f60a9dcddf0084c6b447762e2b Mon Sep 17 00:00:00 2001 From: Sridhar Mocherla Date: Wed, 14 Nov 2018 23:46:36 -0800 Subject: [PATCH 07/10] add description for values for struct fields --- github/apps_marketplace.go | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/github/apps_marketplace.go b/github/apps_marketplace.go index c7dc797cb02..7e2699775cc 100644 --- a/github/apps_marketplace.go +++ b/github/apps_marketplace.go @@ -28,22 +28,24 @@ type MarketplaceService struct { // MarketplacePlan represents a GitHub Apps Marketplace Listing Plan. type MarketplacePlan struct { - URL *string `json:"url,omitempty"` - AccountsURL *string `json:"accounts_url,omitempty"` - ID *int64 `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - MonthlyPriceInCents *int `json:"monthly_price_in_cents,omitempty"` - YearlyPriceInCents *int `json:"yearly_price_in_cents,omitempty"` - PriceModel *string `json:"price_model,omitempty"` - UnitName *string `json:"unit_name,omitempty"` - Bullets *[]string `json:"bullets,omitempty"` - State *string `json:"state,omitempty"` - HasFreeTrial *bool `json:"has_free_trial,omitempty"` + URL *string `json:"url,omitempty"` + AccountsURL *string `json:"accounts_url,omitempty"` + ID *int64 `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Description *string `json:"description,omitempty"` + MonthlyPriceInCents *int `json:"monthly_price_in_cents,omitempty"` + YearlyPriceInCents *int `json:"yearly_price_in_cents,omitempty"` + // The pricing model for this listing. Can be one of "flat-rate", "per-unit", or "free". + PriceModel *string `json:"price_model,omitempty"` + UnitName *string `json:"unit_name,omitempty"` + Bullets *[]string `json:"bullets,omitempty"` + State *string `json:"state,omitempty"` + HasFreeTrial *bool `json:"has_free_trial,omitempty"` } // MarketplacePurchase represents a GitHub Apps Marketplace Purchase. type MarketplacePurchase struct { + // BillingCycle can be one of the values "yearly", "monthly" or nil. BillingCycle *string `json:"billing_cycle,omitempty"` NextBillingDate *string `json:"next_billing_date,omitempty"` UnitCount *int `json:"unit_count,omitempty"` From f4d85c7246a750018d6eec7fc8eb8bc72596eff4 Mon Sep 17 00:00:00 2001 From: Sridhar Mocherla Date: Thu, 15 Nov 2018 20:44:47 -0800 Subject: [PATCH 08/10] update to timestamp --- github/apps_marketplace.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/github/apps_marketplace.go b/github/apps_marketplace.go index 7e2699775cc..b1cfa8421a2 100644 --- a/github/apps_marketplace.go +++ b/github/apps_marketplace.go @@ -8,7 +8,6 @@ package github import ( "context" "fmt" - "time" ) // MarketplaceService handles communication with the marketplace related @@ -36,28 +35,29 @@ type MarketplacePlan struct { MonthlyPriceInCents *int `json:"monthly_price_in_cents,omitempty"` YearlyPriceInCents *int `json:"yearly_price_in_cents,omitempty"` // The pricing model for this listing. Can be one of "flat-rate", "per-unit", or "free". - PriceModel *string `json:"price_model,omitempty"` - UnitName *string `json:"unit_name,omitempty"` - Bullets *[]string `json:"bullets,omitempty"` - State *string `json:"state,omitempty"` - HasFreeTrial *bool `json:"has_free_trial,omitempty"` + PriceModel *string `json:"price_model,omitempty"` + UnitName *string `json:"unit_name,omitempty"` + Bullets *[]string `json:"bullets,omitempty"` + // State can be one of the values "draft" or "published" + State *string `json:"state,omitempty"` + HasFreeTrial *bool `json:"has_free_trial,omitempty"` } // MarketplacePurchase represents a GitHub Apps Marketplace Purchase. type MarketplacePurchase struct { // BillingCycle can be one of the values "yearly", "monthly" or nil. BillingCycle *string `json:"billing_cycle,omitempty"` - NextBillingDate *string `json:"next_billing_date,omitempty"` + NextBillingDate *Timestamp `json:"next_billing_date,omitempty"` UnitCount *int `json:"unit_count,omitempty"` Plan *MarketplacePlan `json:"plan,omitempty"` Account *MarketplacePlanAccount `json:"account,omitempty"` OnFreeTrial *bool `json:"on_free_trial,omitempty"` - FreeTrialEndsOn *string `json:"free_trial_ends_on,omitempty"` + FreeTrialEndsOn *Timestamp `json:"free_trial_ends_on,omitempty"` } // MarketplacePendingChange represents a pending change to a GitHub Apps Marketplace Plan. type MarketplacePendingChange struct { - EffectiveDate *time.Time `json:"effective_date,omitempty"` + EffectiveDate *Timestamp `json:"effective_date,omitempty"` UnitCount *int `json:"unit_count,omitempty"` ID *int64 `json:"id,omitempty"` Plan *MarketplacePlan `json:"plan,omitempty"` From 3869a58594b6a0510c5be1f66654146f17edc7b4 Mon Sep 17 00:00:00 2001 From: Sridhar Mocherla Date: Thu, 15 Nov 2018 20:44:58 -0800 Subject: [PATCH 09/10] updated accessors --- github/github-accessors.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/github/github-accessors.go b/github/github-accessors.go index f582c848842..4791098b0b3 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -4645,9 +4645,9 @@ func (l *ListCheckSuiteResults) GetTotal() int { } // GetEffectiveDate returns the EffectiveDate field if it's non-nil, zero value otherwise. -func (m *MarketplacePendingChange) GetEffectiveDate() time.Time { +func (m *MarketplacePendingChange) GetEffectiveDate() Timestamp { if m == nil || m.EffectiveDate == nil { - return time.Time{} + return Timestamp{} } return *m.EffectiveDate } @@ -4853,17 +4853,17 @@ func (m *MarketplacePurchase) GetBillingCycle() string { } // GetFreeTrialEndsOn returns the FreeTrialEndsOn field if it's non-nil, zero value otherwise. -func (m *MarketplacePurchase) GetFreeTrialEndsOn() string { +func (m *MarketplacePurchase) GetFreeTrialEndsOn() Timestamp { if m == nil || m.FreeTrialEndsOn == nil { - return "" + return Timestamp{} } return *m.FreeTrialEndsOn } // GetNextBillingDate returns the NextBillingDate field if it's non-nil, zero value otherwise. -func (m *MarketplacePurchase) GetNextBillingDate() string { +func (m *MarketplacePurchase) GetNextBillingDate() Timestamp { if m == nil || m.NextBillingDate == nil { - return "" + return Timestamp{} } return *m.NextBillingDate } From d5be1fc266cb79093255f72d3453495bd2eaa387 Mon Sep 17 00:00:00 2001 From: Sridhar Mocherla Date: Thu, 15 Nov 2018 20:51:36 -0800 Subject: [PATCH 10/10] add period --- github/apps_marketplace.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/apps_marketplace.go b/github/apps_marketplace.go index b1cfa8421a2..6dd568a2dc0 100644 --- a/github/apps_marketplace.go +++ b/github/apps_marketplace.go @@ -38,7 +38,7 @@ type MarketplacePlan struct { PriceModel *string `json:"price_model,omitempty"` UnitName *string `json:"unit_name,omitempty"` Bullets *[]string `json:"bullets,omitempty"` - // State can be one of the values "draft" or "published" + // State can be one of the values "draft" or "published". State *string `json:"state,omitempty"` HasFreeTrial *bool `json:"has_free_trial,omitempty"` }