-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Support updates to Marketplace APIs and webhook payload #1042
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 7 commits
4605745
d22b3e8
1b6735e
e6f44f3
7b6b1e8
b6effa4
a3b5461
f4d85c7
3869a58
d5be1fc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ package github | |
import ( | ||
"context" | ||
"fmt" | ||
"time" | ||
) | ||
|
||
// MarketplaceService handles communication with the marketplace related | ||
|
@@ -27,36 +28,51 @@ 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"` | ||
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"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should probably be a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated. |
||
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"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should probably be a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated. |
||
} | ||
|
||
// MarketplacePendingChange represents a pending change to a GitHub Apps Marketplace Plan. | ||
type MarketplacePendingChange struct { | ||
EffectiveDate *time.Time `json:"effective_date,omitempty"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated. |
||
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. | ||
|
@@ -155,7 +171,6 @@ func (s *MarketplaceService) ListMarketplacePurchasesForUser(ctx context.Context | |
if err != nil { | ||
return nil, resp, err | ||
} | ||
|
||
return purchases, resp, nil | ||
} | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are the possible values of
State
? Can you please add a comment toState
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only found sparse description for the possible values here. Seems like it can take either "draft" or "published". https://developer.github.com/marketplace/listing-on-github-marketplace/setting-a-github-marketplace-listing-s-pricing-plan/#creating-pricing-plans