client

package
v2.6.20 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2022 License: MIT Imports: 8 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,
	email string,
	username string,
	accountType mdb.AccountType,
	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) Identify added in v2.6.0

func (c *Client) Identify(
	ctx context.Context,
	key thread.PubKey,
	accountType mdb.AccountType,
	active bool,
	email string,
	properties map[string]string,
)

Identify creates or updates the user traits

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) TrackEvent added in v2.6.0

func (c *Client) TrackEvent(
	ctx context.Context,
	key thread.PubKey,
	accountType mdb.AccountType,
	active bool,
	event analytics.Event,
	properties map[string]string,
)

TrackEvent records a new event

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 WithParent added in v2.1.7

func WithParent(key thread.PubKey, email string, accountType mdb.AccountType) Option

WithParent 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