Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GetCurrentUserEndpoint ¶
type GetCurrentUserEndpoint struct{}
Returns the profile of the user the request is authenticated as.
This can be called before an account is selected, such as immediately after authentication. Unlike elsewhere, the `image_url` returned here is a short-lived signed link to the image itself, and it is only produced when the request targets an account; without one, no `image_url` is returned even for a user who has uploaded a photo.
func (*GetCurrentUserEndpoint) Materialize ¶
func (e *GetCurrentUserEndpoint) Materialize() *apiendpoint.APIEndpoint[*GetCurrentUserRequest, *apiresource.User]
type GetCurrentUserRequest ¶
type GetCurrentUserRequest struct{}
Request to retrieve the authenticated user's profile.
type GetTenancyEndpoint ¶
type GetTenancyEndpoint struct{}
Returns the authenticated user's tenancy context.
The tenancy describes which account the user is currently acting in and every other account they can switch to, including sandboxes. It can be called before an account is selected, such as immediately after authentication; when the request does not target an account, one is chosen automatically, preferring paid accounts and then the account the user most recently used.
Accounts where the user has been disabled or removed are left out, and sandboxes are only listed when the current account is a production account and the user is an administrator of it. A user who belongs to no usable account gets an empty tenancy, along with any registration they started but never finished.
func (*GetTenancyEndpoint) Materialize ¶
func (e *GetTenancyEndpoint) Materialize() *apiendpoint.APIEndpoint[*GetTenancyRequest, *apiresource.Tenancy]
type GetTenancyRequest ¶
type GetTenancyRequest struct{}
Request to retrieve the authenticated user's tenancy context.
type ListCustomerAccountsEndpoint ¶
type ListCustomerAccountsEndpoint struct{}
Returns the customer accounts of the given seller account that the authenticated user belongs to.
This is how a buyer with access to more than one of a seller's customer accounts chooses which one to act as. Only accounts where the user's membership is still active are returned. The paging and search parameters are ignored: every match comes back in a single page.
func (*ListCustomerAccountsEndpoint) Materialize ¶
func (e *ListCustomerAccountsEndpoint) Materialize() *apiendpoint.APIEndpoint[*ListCustomerAccountsRequest, *apiresource.List[apiresource.CustomerAccountSummary]]
type ListCustomerAccountsRequest ¶
type ListCustomerAccountsRequest struct {
// ID of the seller account whose customers to list.
VendorAccountID string `path:"vendor_account_id" validate:"required"`
apiresource.PaginationRequest
}
Request to list customer accounts accessible to the authenticated user under a seller account.
type SwitchAccountEndpoint ¶
type SwitchAccountEndpoint struct{}
Switches the authenticated user's active account and returns the updated tenancy context.
The user must have access to the requested account; switching to an account where the user is disabled or removed, or to a suspended or deactivated account, is rejected. Switching into a sandbox is also rejected when the user is disabled or removed on the production account that owns it.
A successful switch marks the account as the user's most recently used one, which Get Tenancy takes into account when it picks a current account for a request that does not target one.
func (*SwitchAccountEndpoint) Materialize ¶
func (e *SwitchAccountEndpoint) Materialize() *apiendpoint.APIEndpoint[*SwitchAccountRequest, *apiresource.Tenancy]
type SwitchAccountRequest ¶
type SwitchAccountRequest struct {
// ID of the account to switch to.
AccountID string `json:"account_id" validate:"required"`
}
Request to switch the authenticated user's active account.
func (*SwitchAccountRequest) SchemaExample ¶
func (*SwitchAccountRequest) SchemaExample() any
type TenancySvc ¶
type TenancySvc interface {
GetTenancy(ctx context.Context, req *GetTenancyRequest) (*apiresource.Tenancy, *apierror.APIError)
SwitchAccount(ctx context.Context, req *SwitchAccountRequest) (*apiresource.Tenancy, *apierror.APIError)
GetCurrentUser(ctx context.Context, req *GetCurrentUserRequest) (*apiresource.User, *apierror.APIError)
ListCustomerAccounts(ctx context.Context, req *ListCustomerAccountsRequest) (*apiresource.List[apiresource.CustomerAccountSummary], *apierror.APIError)
}
func NewTenancySvc ¶
func NewTenancySvc(config *TenancySvcConfig) TenancySvc
type TenancySvcConfig ¶
type TenancySvcConfig struct {
// CoreClient (required) is the core-service gRPC client.
CoreClient pb.CoreServiceClient
}