cmd

package
v0.0.0-...-be5d136 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2025 License: GPL-3.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute()

func WrapCommandWithResources

func WrapCommandWithResources(fn func(cmd *cobra.Command, args []string), resourceConfig ResourceConfig) func(cmd *cobra.Command, args []string)

It takes a command function and resource configuration, then returns a new function that: 1. Initializes required resources (currently supports Amazon SP-API) 2. Sets up authentication and services based on the provided configuration 3. Creates an application context with initialized resources 4. Injects the context into the command before executing the original function

The wrapper will exit early if required Amazon credentials are not set in the configuration.

Types

type Amazon

type Amazon struct {
	Client *sp_api.Client
	Token  string
}

type AppCtx

type AppCtx struct {
	Amazon Amazon
	DB     *sql.DB
	Query  *db.Queries
	Ctx    context.Context
}

func GetApp

func GetApp(cmd *cobra.Command) AppCtx

GetApp retrieves the application context (AppCtx) from a Cobra command's context. It expects the context to contain an AppCtx value stored with internal.APP_CONTEXT key. The function performs a type assertion to convert the context value to AppCtx.

Panics if the context value cannot be type-asserted to AppCtx

type BuildInventoryConfig

type BuildInventoryConfig struct {
	ForceRebuild bool
}

type FBAProduct

type FBAProduct struct {
	SKU   string
	Title string
}

type FTSTitleQuantityRow

type FTSTitleQuantityRow struct {
	Title                    string
	TotalQuantity            int
	FulfillableQuantity      int
	InboundReceivingQuantity int
	InboundShippedQuantity   int
	UPC                      string
}

type InventoryFilter

type InventoryFilter struct {
	Keyword        string
	QuantityFilter string
	MinQuantityStr string
	MaxQuantityStr string
	MinQuantity    int
	MaxQuantity    int
	OutputFormat   string
	ShowPreview    bool
	SortBy         string
	SortOrder      string
}

type ItemRequirements

type ItemRequirements struct {
	// PrepOwner indicates the entity responsible for preparing the item for shipment.
	PrepOwner fba_inbound.PrepOwner `json:"prep_owner"`

	// LabelOwner indicates the entity responsible for labeling the item for shipment.
	LabelOwner fba_inbound.LabelOwner `json:"label_owner"`
}

ItemRequirements defines the ownership requirements for item preparation and labeling. It specifies which entities are responsible for preparing and labeling items in a shipment.

type PrepRequirements

type PrepRequirements map[string]ItemRequirements

PrepRequirements is a mapping from preparation ID to the items required for that preparation. It defines the requirements needed for different preparation processes in a shipment.

type QueryInventoryConfig

type QueryInventoryConfig struct {
	Keyword string
	Output  string
}

type ResourceConfig

type ResourceConfig struct {
	Resources []ResourceType
	Services  []ServiceType
}

type ResourceType

type ResourceType int
const (
	ResourceAmazon ResourceType = iota
	ResourceDB
)

type ServiceType

type ServiceType int
const (
	ServiceCatalog ServiceType = iota
	ServiceListings
	ServiceFBAInbound
	ServiceFBAInventory
	ServiceProductTypeDefinitions
	ServiceFeeds
)

Jump to

Keyboard shortcuts

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