Add marketplace CLI publishing helpers
This commit is contained in:
28
client.go
28
client.go
@@ -396,6 +396,34 @@ func (c *Client) SubmitLocalVaultForkEvidence(ctx context.Context, installationI
|
||||
return c.postObject(ctx, "/v2/local-vault/installations/"+url.PathEscape(installationID)+"/witness/checkpoints", M{"forkEvidence": forkEvidence}, idempotency(options))
|
||||
}
|
||||
|
||||
func (c *Client) GetMarketplaceItem(ctx context.Context, slug string) (M, error) {
|
||||
return c.getObject(ctx, "/v1/marketplace/items/"+url.PathEscape(slug), nil)
|
||||
}
|
||||
|
||||
func (c *Client) SubmitMarketplaceAsset(ctx context.Context, input MarketplaceAssetSubmitInput, options ...RequestOptions) (M, error) {
|
||||
return c.postObject(ctx, "/v1/marketplace/publisher/assets", M{
|
||||
"manifest": input.Manifest,
|
||||
"sourceRef": input.SourceRef,
|
||||
"visibility": input.Visibility,
|
||||
"pricingModel": input.PricingModel,
|
||||
"priceCents": input.PriceCents,
|
||||
}, idempotency(options))
|
||||
}
|
||||
|
||||
func (c *Client) ListMarketplaceReviewAssets(ctx context.Context, state string) ([]M, error) {
|
||||
values := url.Values{}
|
||||
if state != "" {
|
||||
values.Set("state", state)
|
||||
}
|
||||
var out []M
|
||||
err := c.requestJSON(ctx, http.MethodGet, "/v1/platform/marketplace/assets", values, nil, "", &out)
|
||||
return out, err
|
||||
}
|
||||
|
||||
func (c *Client) ApproveMarketplaceAsset(ctx context.Context, slug string, reason string, options ...RequestOptions) (M, error) {
|
||||
return c.postObject(ctx, "/v1/platform/marketplace/assets/"+url.PathEscape(slug)+"/approve", M{"reason": reason}, idempotency(options))
|
||||
}
|
||||
|
||||
func (c *Client) getObject(ctx context.Context, path string, values url.Values) (M, error) {
|
||||
var out M
|
||||
err := c.requestJSON(ctx, http.MethodGet, path, values, nil, "", &out)
|
||||
|
||||
Reference in New Issue
Block a user