Documentation
¶
Index ¶
- func IsAPIKeyExpiredError(err error) bool
- type Base
- func (rb *Base) Confirm() (bool, error)
- func (rb *Base) InitFlags()
- func (rb *Base) MakeMultiPartRequest(ctx context.Context, apiKey, path string, params *RequestParameters, ...) ([]byte, error)
- func (rb *Base) MakeRequest(ctx context.Context, apiKey, path string, params *RequestParameters, ...) ([]byte, error)
- func (rb *Base) RunRequestsCmd(cmd *cobra.Command, args []string) error
- type RequestError
- type RequestParameters
- type WebhookEndpoint
- type WebhookEndpointList
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsAPIKeyExpiredError ¶ added in v1.7.9
IsAPIKeyExpiredError returns true if the provided error was caused by a request returning an `api_key_expired` error code.
Types ¶
type Base ¶
type Base struct { Cmd *cobra.Command Method string Profile *config.Profile Parameters RequestParameters // SuppressOutput is used by `trigger` to hide output SuppressOutput bool DarkStyle bool APIBaseURL string Livemode bool // contains filtered or unexported fields }
Base encapsulates the required information needed to make requests to the API
func (*Base) Confirm ¶ added in v1.5.6
Confirm calls the confirmCommand() function, triggering the confirmation process
func (*Base) InitFlags ¶
func (rb *Base) InitFlags()
InitFlags initialize shared flags for all requests commands
func (*Base) MakeMultiPartRequest ¶ added in v1.7.9
func (rb *Base) MakeMultiPartRequest(ctx context.Context, apiKey, path string, params *RequestParameters, errOnStatus bool) ([]byte, error)
MakeMultiPartRequest will make a multipart/form-data request to the Stripe API with the specific variables given to it. Similar to making a multipart request using curl, add the local filepath to params arg with @ prefix. e.g. params.AppendData([]string{"photo=@/path/to/local/file.png"})
func (*Base) MakeRequest ¶
func (rb *Base) MakeRequest(ctx context.Context, apiKey, path string, params *RequestParameters, errOnStatus bool) ([]byte, error)
MakeRequest will make a request to the Stripe API with the specific variables given to it
type RequestError ¶ added in v1.5.9
type RequestError struct { StatusCode int ErrorType string ErrorCode string Body interface{} // the raw response body // contains filtered or unexported fields }
RequestError captures the response of the request that resulted in an error
func (RequestError) Error ¶ added in v1.5.9
func (e RequestError) Error() string
type RequestParameters ¶ added in v0.2.1
type RequestParameters struct {
// contains filtered or unexported fields
}
RequestParameters captures the structure of the parameters that can be sent to Stripe
func (*RequestParameters) AppendData ¶ added in v0.5.0
func (r *RequestParameters) AppendData(data []string)
AppendData appends data to the request parameters.
func (*RequestParameters) AppendExpand ¶ added in v1.6.0
func (r *RequestParameters) AppendExpand(fields []string)
AppendExpand appends fields to the expand parameter.
func (*RequestParameters) SetIdempotency ¶ added in v1.6.0
func (r *RequestParameters) SetIdempotency(value string)
SetIdempotency sets the value for the `Idempotency-Key` header.
func (*RequestParameters) SetStripeAccount ¶ added in v1.3.1
func (r *RequestParameters) SetStripeAccount(value string)
SetStripeAccount sets the value for the `Stripe-Account` header.
func (*RequestParameters) SetVersion ¶ added in v1.6.0
func (r *RequestParameters) SetVersion(value string)
SetVersion sets the value for the `Stripe-Version` header.
type WebhookEndpoint ¶
type WebhookEndpoint struct { Application string `json:"application"` EnabledEvents []string `json:"enabled_events"` URL string `json:"url"` Status string `json:"status"` }
WebhookEndpoint contains the data for each webhook endpoint
type WebhookEndpointList ¶
type WebhookEndpointList struct {
Data []WebhookEndpoint `json:"data"`
}
WebhookEndpointList contains the list of webhook endpoints for the account
func WebhookEndpointsList ¶ added in v0.9.0
func WebhookEndpointsList(ctx context.Context, baseURL, apiVersion, apiKey string, profile *config.Profile) WebhookEndpointList
WebhookEndpointsList returns all the webhook endpoints on a users' account