client

package
v2.1.5 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client provides the client api.

func NewClient

func NewClient(target string, opts ...grpc.DialOption) (*Client, error)

NewClient starts the client.

func (*Client) CheckHealth

func (c *Client) CheckHealth(ctx context.Context) error

func (*Client) Close

func (c *Client) Close() error

Close closes the client's grpc connection and cancels any active requests.

func (*Client) CreateCustomer

func (c *Client) CreateCustomer(ctx context.Context, key thread.PubKey, opts ...Option) (string, error)

func (*Client) DeleteCustomer

func (c *Client) DeleteCustomer(ctx context.Context, key thread.PubKey) error

func (*Client) GetCustomer

func (c *Client) GetCustomer(ctx context.Context, key thread.PubKey) (*pb.GetCustomerResponse, error)

func (*Client) GetCustomerSession

func (c *Client) GetCustomerSession(ctx context.Context, key thread.PubKey) (*pb.GetCustomerSessionResponse, error)

func (*Client) GetCustomerUsage added in v2.1.5

func (c *Client) GetCustomerUsage(ctx context.Context, key thread.PubKey) (*pb.GetCustomerUsageResponse, error)

func (*Client) IncCustomerUsage

func (c *Client) IncCustomerUsage(
	ctx context.Context,
	key thread.PubKey,
	productUsage map[string]int64,
) (*pb.IncCustomerUsageResponse, error)

func (*Client) ListDependentCustomers

func (c *Client) ListDependentCustomers(ctx context.Context, key thread.PubKey, opts ...ListOption) (
	*pb.ListDependentCustomersResponse, error)

func (*Client) RecreateCustomerSubscription

func (c *Client) RecreateCustomerSubscription(ctx context.Context, key thread.PubKey) error

func (*Client) ReportCustomerUsage added in v2.1.5

func (c *Client) ReportCustomerUsage(ctx context.Context, key thread.PubKey) error

func (*Client) UpdateCustomer

func (c *Client) UpdateCustomer(
	ctx context.Context,
	customerID string,
	balance int64,
	billable,
	delinquent bool,
) error

func (*Client) UpdateCustomerSubscription

func (c *Client) UpdateCustomerSubscription(
	ctx context.Context,
	customerID string,
	status stripe.SubscriptionStatus,
	periodStart, periodEnd int64,
) error

type ListOption

type ListOption func(*listOptions)

func WithLimit

func WithLimit(limit int64) ListOption

WithLimit is used to set a page size when paginating.

func WithOffset

func WithOffset(offset int64) ListOption

WithOffset is used to fetch the next page when paginating.

type Option

type Option func(*options)

func WithAccountType added in v2.1.5

func WithAccountType(accountType mdb.AccountType) Option

WithAccountType attaches an account type to the new customer.

func WithEmail

func WithEmail(email string) Option

WithEmail attaches an email address to the new customer.

func WithParentKey

func WithParentKey(parentKey thread.PubKey) Option

WithParentKey is used to create a billing hierarchy between two customers.

Jump to

Keyboard shortcuts

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