Documentation
¶
Index ¶
- Constants
- func PromptForCard() (card stripe.CardParams, err error)
- type Card
- type Client
- func (c *Client) AddCard(token, cardToken string) error
- func (c *Client) AddFeedback(token, message string) error
- func (c *Client) AddInvite(token, email string) error
- func (c *Client) AddPlan(token, product, interval, coupon string) error
- func (c *Client) AddTeam(token, id, name string) error
- func (c *Client) GetAccessToken(email, team, code string) (key string, err error)
- func (c *Client) GetCards(token string) (cards []Card, err error)
- func (c *Client) GetCoupon(id string) (coupon *Coupon, err error)
- func (c *Client) GetPlans(token string) (plans []Plan, err error)
- func (c *Client) GetTeam(token string) (*Team, error)
- func (c *Client) Login(email, team string) (code string, err error)
- func (c *Client) LoginWithToken(token, email, team string) (code string, err error)
- func (c *Client) PollAccessToken(ctx context.Context, email, team, code string) (key string, err error)
- func (c *Client) RemoveCard(token, id string) error
- func (c *Client) RemoveMember(token, email string) error
- func (c *Client) RemovePlan(token, product string) error
- type Coupon
- type CouponDuration
- type Discount
- type Error
- type Plan
- type Team
- type User
Constants ¶
const ( Forever CouponDuration = "forever" Once = "once" Repeating = "repeating" )
Durations.
Variables ¶
This section is empty.
Functions ¶
func PromptForCard ¶
func PromptForCard() (card stripe.CardParams, err error)
PromptForCard displays an interactive form for the user to provide CC details.
Types ¶
type Card ¶
type Card struct { ID string `json:"id"` Brand string `json:"brand"` LastFour string `json:"last_four"` }
Card model.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implementation.
func (*Client) AddFeedback ¶
AddFeedback sends customer feedback.
func (*Client) GetAccessToken ¶
GetAccessToken with the given email, team, and code.
func (*Client) LoginWithToken ¶
LoginWithToken signs in with the given email by sending a verification email and returning a code which can be exchanged for an access key.
When an auth token is provided the user is already authenticated, so this can be used to switch to another team, if the user is a member or owner.
The team id is optional, and may only be used when the user's email has been invited to the team.
func (*Client) PollAccessToken ¶
func (c *Client) PollAccessToken(ctx context.Context, email, team, code string) (key string, err error)
PollAccessToken polls for an access token.
func (*Client) RemoveCard ¶
RemoveCard removes a user's card by id.
func (*Client) RemoveMember ¶
RemoveMember removes a team member or invitation if present.
func (*Client) RemovePlan ¶
RemovePlan unsubscribes from a plan.
type Coupon ¶
type Coupon struct { ID string `json:"id"` Amount int `json:"amount"` Percent int `json:"percent"` Duration CouponDuration `json:"duration"` DurationPeriod int `json:"duration_period"` }
Coupon model.
func (*Coupon) Description ¶
Description returns a humanized description of the savings.
type Plan ¶
type Plan struct { ID string `json:"id"` Name string `json:"name"` Product string `json:"product"` Plan string `json:"plan"` Amount int `json:"amount"` Interval string `json:"interval"` Status string `json:"status"` Canceled bool `json:"canceled"` Discount *Discount `json:"discount"` CreatedAt time.Time `json:"created_at"` CanceledAt time.Time `json:"canceled_at"` }
Plan model.
type Team ¶
type Team struct { ID string `json:"id"` Name string `json:"name"` Owner string `json:"owner"` Type string `json:"type"` Card *Card `json:"card"` Members []User `json:"members"` Invites []string `json:"invites"` UpdatedAt time.Time `json:"updated_at"` CreatedAt time.Time `json:"created_at"` }
Team model.