client

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package client wraps the /accounts/client API endpoints — currently just /accounts/client/list_sub_accounts.json, the paginated list of sub-accounts under the calling client_id (reseller / parent-account view).

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 wraps the api.Client for the /accounts/client endpoints.

func New

func New(c *api.Client) *Client

New initialises an accounts.client Client.

func (*Client) ListSubAccounts

func (s *Client) ListSubAccounts(ctx context.Context, request ListSubAccountsRequest) (response ListSubAccountsResponse, err error)

ListSubAccounts returns the paginated list of sub-accounts under the calling client_id, via /accounts/client/list_sub_accounts.json.

Useful for reseller / parent-account discovery — combined with info.NewClientWithDiscovery, callers can enumerate every customer they have visibility into without hardcoding IDs.

IncludeClosed defaults to false; closed accounts (those with a non-zero Closed date) are excluded unless explicitly requested.

type ListSubAccountsRequest

type ListSubAccountsRequest struct {
	// Name partial-matches against the sub-account display name.
	Name string
	// IncludeClosed includes sub-accounts whose Closed date is set.
	IncludeClosed bool
	// SortBy is the field name to sort by ("name", "joined", etc.).
	SortBy string
	// SortDir is "ASC" or "DESC".
	SortDir string
	// PageSize and PageNumber control pagination.
	PageSize   int
	PageNumber int
}

ListSubAccountsRequest selects + paginates the sub-accounts list. All fields are optional; zero values mean "no filter / API default".

type ListSubAccountsResponse

type ListSubAccountsResponse struct {
	Return struct {
		models.Pagination
		Accounts []SubAccount `json:"data"`
	} `json:"return"`
	models.APIResponse
}

ListSubAccountsResponse is the paginated return from /accounts/client/list_sub_accounts.json.

type SubAccount

type SubAccount struct {
	ClientID       string `json:"client_id"`
	Name           string `json:"name"`
	AccountBalance string `json:"account_balance"`
	Joined         string `json:"joined"`
	// Closed is "0000-00-00" for currently-open accounts; otherwise
	// the ISO date the account was closed.
	Closed      string `json:"closed"`
	AccountType string `json:"account_type"`
}

SubAccount describes one row returned by ListSubAccounts.

Jump to

Keyboard shortcuts

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