accountseq

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package accountseq centralizes the accountSeq selection policy shared by REST operations and private WebSocket subscriptions.

Index

Constants

View Source
const (
	// APIName is the wire parameter name used by REST endpoints.
	APIName = "accountSeq"
	// FlagName is the CLI flag name used by endpoint commands.
	FlagName = "account-seq"
	// Main is the API's main sub-account sequence number.
	Main = 1
)

Variables

This section is empty.

Functions

func Ensure

func Ensure(params []cmdmeta.Param, values map[string]string, def string) (bool, error)

Ensure adds accountSeq to values when the command surface supports it and the caller did not supply it, resolving it through the standard precedence. The resolved value is written to values[APIName] — read it from there. The boolean reports whether the surface has an accountSeq parameter (false => nothing written).

func MainList

func MainList() []int

MainList returns a one-item accountSeqs list for private WebSocket subscriptions.

func MainString

func MainString() string

MainString returns the wire value for the main account.

func Param

func Param() cmdmeta.Param

Param returns the shared accountSeq command-surface parameter.

func ParseList

func ParseList(raw string, in Inputs) ([]int, error)

ParseList parses a comma-separated accountSeq selection (e.g. "1,2,3") into a validated, de-duplicated, order-preserving slice, each element checked through the shared Param (>= 1). A blank input returns (nil, nil) — the caller decides the default set. Order is preserved and duplicates are dropped keeping the first occurrence, because the first element is the one a multi-account session starts active on.

func Resolve

func Resolve(explicit string, in Inputs) (int, error)

Resolve selects and validates a single accountSeq (REST). Explicit is the user-supplied value ("" when omitted); precedence: explicit → default → Main.

func ResolveList

func ResolveList(explicit []int, in Inputs) ([]int, error)

ResolveList selects accountSeqs for WebSocket subscriptions. Explicit is the user-supplied list (nil/empty when omitted); when empty, it resolves through the standard single-account precedence and wraps the result as a one-element list.

func Supports

func Supports(params []cmdmeta.Param) (cmdmeta.Param, bool)

Supports reports whether params include accountSeq and returns that Param.

Types

type Inputs

type Inputs struct {
	Default string
	Param   cmdmeta.Param
	Label   string
}

Inputs are the shared resolution context for choosing an account sequence. Default is the caller's configured default (e.g. per-key metadata), when available. Empty values fall through to the main account.

Jump to

Keyboard shortcuts

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