Documentation
¶
Index ¶
- Constants
- type Account
- type AccountAlias
- type CreateAccountOutput
- type CreateCustomerOutput
- type Customer
- type CustomerWithAccount
- type ListCustomersOutput
- type Namespace
- type Setting
- type SettingDataType
- type Status
- type TogaiClient
- func (c *TogaiClient) CreateAccount(customerId string, account Account) (*CreateAccountOutput, error)
- func (c *TogaiClient) CreateCustomer(customer CustomerWithAccount) (*CreateCustomerOutput, error)
- func (c *TogaiClient) DeleteAccount(customerId string, accountId string) error
- func (c *TogaiClient) DeleteCustomer(customerId string) error
- func (c *TogaiClient) GetCustomer(customerId string) (*Customer, error)
- func (c *TogaiClient) ListCustomers(nextToken string, pageSize int) (*ListCustomersOutput, error)
- func (c *TogaiClient) UpdateCustomer(customer UpdateCustomerInput) (*Customer, error)
- type UpdateCustomerInput
Constants ¶
const ( JSON_TYPE = "application/json" ACCEPT_HTTP_HEADER = "accept" CONTENT_TYPE_HTTP_HEADER = "content-type" AUTHORIZATION_HTTP_HEADER = "authorization" )
const ( NEXT_TOKEN_QUERY_PARAM = "nextToken" PAGE_SIZE_QUERY_PARAM = "pageSize" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct { // Identifier of the account Id string `json:"id"` // Name of the Account Name string `json:"name"` // Use [ISO 4217] currency code in which the account must be invoiced. // For example: AED is the currency code for United Arab Emirates dirham. // // [ISO 4217]: https://en.wikipedia.org/wiki/ISO_4217 InvoiceCurrency string `json:"invoiceCurrency,omitempty"` // Aliases are tags that are associated with an account. Multiple aliases are allowed for a single account. Aliases []string `json:"aliases"` // Account Settings Settings []Setting `json:"settings"` }
type AccountAlias ¶ added in v0.0.2
type CreateAccountOutput ¶ added in v0.0.2
type CreateAccountOutput struct { // Identifier of the account Id string `json:"id"` // Name of the Account Name string `json:"name"` // Status of the account Status string `json:"status"` // Use [ISO 4217] currency code in which the account must be invoiced. // For example: AED is the currency code for United Arab Emirates dirham. // // [ISO 4217]: https://en.wikipedia.org/wiki/ISO_4217 InvoiceCurrency string `json:"invoiceCurrency"` // Aliases are tags that are associated with an account. Multiple aliases are allowed for a single account. Aliases []AccountAlias `json:"aliases"` // Account Settings Settings []Setting `json:"settings"` }
type CreateCustomerOutput ¶ added in v0.0.2
type CreateCustomerOutput struct { // Customer identifier Id string `json:"id"` // Name of the Customer Name string `json:"name"` // Primary email of the customer PrimaryEmail string `json:"primaryEmail"` // Billing address of the customer BillingAddress string `json:"billingAddress"` // Customer Settings Settings []Setting `json:"settings"` // Payload to create [Account] Account CreateAccountOutput `json:"account"` }
type Customer ¶
type Customer struct { // Customer identifier Id string `json:"id"` // Name of the Customer Name string `json:"name"` // Primary email of the customer PrimaryEmail string `json:"primaryEmail"` // Billing address of the customer BillingAddress string `json:"billingAddress"` // Status of the customer Status string `json:"status"` // Time at which the customer was created CreatedAt time.Time `json:"createdAt"` // Time at which the customer was last updated UpdatedAt time.Time `json:"updatedAt"` }
type CustomerWithAccount ¶ added in v0.0.3
type CustomerWithAccount struct { // Customer identifier Id string `json:"id"` // Name of the Customer Name string `json:"name"` // Primary email of the customer PrimaryEmail string `json:"primaryEmail"` // Billing address of the customer BillingAddress string `json:"billingAddress"` // Customer Settings Settings []Setting `json:"settings"` // Payload to create [Account] Account Account `json:"account"` }
The primary use case of creating Customers and Accounts is to have the ability to track usage and revenue at the granular level.
The Customers and Accounts are parent and child relationships. By default, Togai creates an Account for every Customer you create with the Customer ID and Customer Name same for the Account. You can also define the Account ID and Account Name by passing to the respective fields as given in the body parameters.
You can use Customers and Accounts for Company and Users relationship, Customer and Multiple environments like staging, sandbox, and production, or any similar use case.
Learn more from Customer Management
type ListCustomersOutput ¶ added in v0.0.3
type Setting ¶
type Setting struct { Id string `json:"id"` Value string `json:"value"` Namespace Namespace `json:"namespace"` Name string `json:"name"` DataType SettingDataType `json:"dataType"` }
type SettingDataType ¶
type SettingDataType string
const ( StringSettingDataType SettingDataType = "STRING" NumericSettingDataType SettingDataType = "NUMERIC" JsonSettingDataType SettingDataType = "JSON" JsonLogicSettingDataType SettingDataType = "JSON_LOGIC" )
type TogaiClient ¶
type TogaiClient struct {
// contains filtered or unexported fields
}
func NewTogaiClient ¶
func NewTogaiClient(apiBaseUrl string, apiToken string) (*TogaiClient, error)
func (*TogaiClient) CreateAccount ¶ added in v0.0.3
func (c *TogaiClient) CreateAccount(customerId string, account Account) (*CreateAccountOutput, error)
CreateAccount creates the given account
func (*TogaiClient) CreateCustomer ¶
func (c *TogaiClient) CreateCustomer(customer CustomerWithAccount) (*CreateCustomerOutput, error)
CreateCustomer creates the given customer
func (*TogaiClient) DeleteAccount ¶ added in v0.0.3
func (c *TogaiClient) DeleteAccount(customerId string, accountId string) error
func (*TogaiClient) DeleteCustomer ¶ added in v0.0.3
func (c *TogaiClient) DeleteCustomer(customerId string) error
func (*TogaiClient) GetCustomer ¶ added in v0.0.3
func (c *TogaiClient) GetCustomer(customerId string) (*Customer, error)
func (*TogaiClient) ListCustomers ¶ added in v0.0.3
func (c *TogaiClient) ListCustomers(nextToken string, pageSize int) (*ListCustomersOutput, error)
func (*TogaiClient) UpdateCustomer ¶ added in v0.0.3
func (c *TogaiClient) UpdateCustomer(customer UpdateCustomerInput) (*Customer, error)
UpdateCustomer updates the given customer