Help us shape the future of Go! Take the 2026 Go Developer Survey

requests

package
v0.5.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 28, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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

	APIBaseURL string
	// contains filtered or unexported fields
}

Base does stuff

func (*Base) InitFlags

func (rb *Base) InitFlags(includeData bool)

InitFlags initialize shared flags for all requests commands

func (*Base) MakeRequest

func (rb *Base) MakeRequest(secretKey, path string, params *RequestParameters) ([]byte, error)

MakeRequest will make a request to the Stripe API with the specific variables given to it

func (*Base) RunRequestsCmd

func (rb *Base) RunRequestsCmd(cmd *cobra.Command, args []string) error

RunRequestsCmd is the interface exposed for the CLI to run network requests through

type Examples

type Examples struct {
	Profile    config.Profile
	APIBaseURL string
	APIVersion string
	APIKey     string
}

Examples stores possible webhook test events to trigger for the CLI

func (*Examples) ChargeCaptured

func (ex *Examples) ChargeCaptured() error

ChargeCaptured first creates a charge that is not captured, then sends another request to specifically capture it to trigger the captured event

func (*Examples) ChargeFailed

func (ex *Examples) ChargeFailed() error

ChargeFailed fails to create a charge

func (*Examples) ChargeSucceeded

func (ex *Examples) ChargeSucceeded() error

ChargeSucceeded successfully creates a charge

func (*Examples) CustomerCreated

func (ex *Examples) CustomerCreated() error

CustomerCreated creates a new customer

func (*Examples) CustomerSourceCreated

func (ex *Examples) CustomerSourceCreated() error

CustomerSourceCreated creates a customer and a token then attaches the card to the customer

func (*Examples) CustomerSourceUpdated

func (ex *Examples) CustomerSourceUpdated() error

CustomerSourceUpdated creates a customer, adds a card, adds metadata to the card to trigger an update

func (*Examples) CustomerSubscriptionUpdated

func (ex *Examples) CustomerSubscriptionUpdated() error

CustomerSubscriptionUpdated creates a customer with a card, creates a plan, adds the customer to the plan, then updates the new subscription

func (*Examples) CustomerUpdated

func (ex *Examples) CustomerUpdated() error

CustomerUpdated creates a new customer and adds metadata to trigger an update event

func (*Examples) InvoiceCreated

func (ex *Examples) InvoiceCreated() error

InvoiceCreated first creates a customer, adds an invoice item, then creates an invoice.

func (*Examples) InvoiceFinalized

func (ex *Examples) InvoiceFinalized() error

InvoiceFinalized first creates a customer, adds an invoice item, creates an invoice, and then finalizes the invoice.

func (*Examples) InvoicePaymentSucceeded

func (ex *Examples) InvoicePaymentSucceeded() error

InvoicePaymentSucceeded first creates a customer, adds an invoice item, creates the invoice, and then pays the invoice

func (*Examples) InvoiceUpdated

func (ex *Examples) InvoiceUpdated() error

InvoiceUpdated first creates a customer, adds an invoice item, creates the invoice, then adds metadata to the invoice to trigger an update

func (*Examples) PaymentIntentCreated

func (ex *Examples) PaymentIntentCreated() error

PaymentIntentCreated creates a payment intent. Requires the data to be assigned to the payment intent

func (*Examples) PaymentIntentFailed

func (ex *Examples) PaymentIntentFailed() error

PaymentIntentFailed creates a failed payment intent

func (*Examples) PaymentIntentSucceeded

func (ex *Examples) PaymentIntentSucceeded() error

PaymentIntentSucceeded creates a successful payment intent

func (*Examples) PaymentMethodAttached

func (ex *Examples) PaymentMethodAttached() error

PaymentMethodAttached creates a customer and payment method, then attaches the customer to the payment method

func (*Examples) WebhookEndpointsList

func (ex *Examples) WebhookEndpointsList() WebhookEndpointList

WebhookEndpointsList returns all the webhook endpoints on a users' account

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.

type WebhookEndpoint

type WebhookEndpoint struct {
	Application   string   `json:"application"`
	EnabledEvents []string `json:"enabled_events"`
	URL           string   `json:"url"`
}

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL