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

requests

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2019 License: Apache-2.0 Imports: 14 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

	// Generally needed to make requests
	Method  string
	Profile profile.Profile

	// Data and Version are exposed publicly so that `trigger` can use this struct
	Data    []string
	Version string

	// SuppressOutput is used by `trigger` to hide output
	SuppressOutput bool
	// contains filtered or unexported fields
}

Base does stuff

func (*Base) InitFlags

func (rb *Base) InitFlags()

InitFlags initialize shared flags for all requests commands

func (*Base) MakeRequest

func (rb *Base) MakeRequest(path string, baseURL string, secretKey string) ([]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    profile.Profile
	APIUrl     string
	APIVersion string
	SecretKey  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 WebhookEndpoint

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

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