helpers

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Overview

Package helpers contains shared nvfleetctl command helpers.

Index

Constants

View Source
const (
	// MinPageSize is the smallest page size accepted by list commands
	MinPageSize = 1
	// MaxPageSize is the largest page size accepted by list commands
	MaxPageSize = 100
	// MaxPages bounds all-page pagination when the API keeps reporting more data
	MaxPages = 10000
)

Variables

This section is empty.

Functions

func ExtractRawItems

func ExtractRawItems(data []byte, itemKey string) ([]json.RawMessage, error)

Extracts raw array items from an API response object

func ParseCommaList

func ParseCommaList(raw string) ([]string, error)

Splits a comma-separated flag value into trimmed values

Types

type MergedJSONResult

type MergedJSONResult struct {
	Items      []json.RawMessage `json:"items"`
	Pagination MergedPagination  `json:"pagination"`
}

Represents normalized JSON for all-page output

func FetchAllRawPages

func FetchAllRawPages(itemKey string, startPage int, fetch func(page int) (RawPage, error)) (MergedJSONResult, error)

Fetches and merges raw API item payloads across pages

type MergedPagination

type MergedPagination struct {
	Page         int  `json:"page"`
	PageSize     int  `json:"pageSize"`
	Total        int  `json:"total"`
	HasMore      bool `json:"hasMore"`
	PagesFetched int  `json:"pagesFetched"`
}

Represents metadata for normalized all-page JSON

type RawPage

type RawPage struct {
	RawJSON  []byte
	Page     int
	PageSize int
	Total    int
	HasMore  *bool
}

Represents one paginated raw API response

Jump to

Keyboard shortcuts

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