Documentation
¶
Overview ¶
Package cli wires loby's command tree using Kong. Every command receives a *Globals via the Kong context and produces its output through an *output.Writer constructed from the globals.
Index ¶
- func Run(ctx context.Context, args []string, stdout, stderr io.Writer) int
- type AccountCmd
- type AddressCreateCmd
- type AddressDeleteCmd
- type AddressGetCmd
- type AddressListCmd
- type AddressesCmd
- type AuthCmd
- type AuthListCmd
- type AuthLoginCmd
- type AuthLogoutCmd
- type AuthStatusCmd
- type BankAccountCreateCmd
- type BankAccountDeleteCmd
- type BankAccountGetCmd
- type BankAccountListCmd
- type BankAccountVerifyCmd
- type BankAccountsCmd
- type BillingGroupCreateCmd
- type BillingGroupGetCmd
- type BillingGroupListCmd
- type BillingGroupUpdateCmd
- type BillingGroupsCmd
- type BookletCreateCmd
- type BookletDeleteCmd
- type BookletGetCmd
- type BookletListCmd
- type BookletsCmd
- type BuckslipCreateCmd
- type BuckslipDeleteCmd
- type BuckslipGetCmd
- type BuckslipListCmd
- type BuckslipsCmd
- type BulkCmd
- type BulkIntlCmd
- type BulkUSCmd
- type CampaignCreateCmd
- type CampaignDeleteCmd
- type CampaignGetCmd
- type CampaignListCmd
- type CampaignSendCmd
- type CampaignsCmd
- type CardCreateCmd
- type CardDeleteCmd
- type CardGetCmd
- type CardListCmd
- type CardsCmd
- type CheckCancelCmd
- type CheckCreateCmd
- type CheckGetCmd
- type CheckListCmd
- type ChecksCmd
- type CompletionCmd
- type CreativeCreateCmd
- type CreativesCmd
- type DomainCreateCmd
- type DomainDeleteCmd
- type DomainGetCmd
- type DomainListCmd
- type DomainsCmd
- type EventGetCmd
- type EventListCmd
- type EventTailCmd
- type EventsCmd
- type ExitCodesCmd
- type Flag
- type GeoCmd
- type GeoReverseCmd
- type Globals
- type IdentityCmd
- type IdentityVerifyCmd
- type InformedDeliveryCmd
- type InformedDeliveryCreateCmd
- type InformedDeliveryGetCmd
- type InformedDeliveryListCmd
- type LetterCancelCmd
- type LetterCreateCmd
- type LetterGetCmd
- type LetterListCmd
- type LettersCmd
- type LinkCreateCmd
- type LinkDeleteCmd
- type LinkGetCmd
- type LinkListCmd
- type LinksCmd
- type PostcardCreateCmd
- type PostcardGetCmd
- type PostcardListCmd
- type PostcardsCmd
- type QRCodeListCmd
- type QRCodesCmd
- type ResourceProofGetCmd
- type ResourceProofsCmd
- type Root
- type Schema
- type SchemaCmd
- type SelfMailerCreateCmd
- type SelfMailerGetCmd
- type SelfMailerListCmd
- type SelfMailersCmd
- type SnapPackCancelCmd
- type SnapPackCreateCmd
- type SnapPackGetCmd
- type SnapPackListCmd
- type SnapPacksCmd
- type Status
- type TemplateCreateCmd
- type TemplateDeleteCmd
- type TemplateGetCmd
- type TemplateListCmd
- type TemplateUpdateCmd
- type TemplateVersionCreateCmd
- type TemplateVersionDeleteCmd
- type TemplateVersionGetCmd
- type TemplateVersionListCmd
- type TemplateVersionUpdateCmd
- type TemplateVersionsCmd
- type TemplatesCmd
- type USAutocompleteCmd
- type USVerifyCmd
- type UploadCreateCmd
- type UploadDeleteCmd
- type UploadExportCreateCmd
- type UploadExportGetCmd
- type UploadExportsCmd
- type UploadFileCmd
- type UploadGetCmd
- type UploadListCmd
- type UploadReportCmd
- type UploadsCmd
- type VerifyCmd
- type VerifyIntlCmd
- type VerifyUSCmd
- type VersionCmd
- type ZipCmd
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AccountCmd ¶
type AccountCmd struct{}
AccountCmd implements GET /v1/accounts/credits_balance — the active account's remaining Lob Credits. Useful for agents verifying credentials and checking pre-paid balance before mailing.
type AddressCreateCmd ¶
type AddressCreateCmd struct {
Description string `help:"Internal description (≤255 chars)."`
Name string `help:"Recipient name (required if Company is blank)."`
Company string `help:"Recipient company (required if Name is blank)."`
Email string `help:"Recipient email."`
Phone string `help:"Recipient phone."`
Line1 string `help:"Street line 1." required:"" name:"line1"`
Line2 string `help:"Street line 2." name:"line2"`
City string `help:"City."`
State string `help:"State (two-letter US code or full name)."`
Zip string `help:"ZIP code or international postal code."`
Country string `help:"Two-letter ISO country code." default:"US"`
Metadata map[string]string `help:"Metadata key=value pairs (repeatable)."`
}
AddressCreateCmd implements POST /v1/addresses.
func (*AddressCreateCmd) Run ¶
func (c *AddressCreateCmd) Run(g *Globals) error
Run sends the request.
type AddressDeleteCmd ¶
type AddressDeleteCmd struct {
ID string `arg:"" help:"Address ID (adr_…)."`
Confirm bool `help:"Required for destructive operations." xor:"destructive"`
Force bool `help:"Alias for --confirm." xor:"destructive"`
}
AddressDeleteCmd implements DELETE /v1/addresses/:id.
func (*AddressDeleteCmd) Run ¶
func (c *AddressDeleteCmd) Run(g *Globals) error
Run sends the request.
type AddressGetCmd ¶
type AddressGetCmd struct {
ID string `arg:"" help:"Address ID (adr_…)."`
}
AddressGetCmd implements GET /v1/addresses/:id.
type AddressListCmd ¶
type AddressListCmd struct {
Limit int `help:"Max results per page (1-100)." default:"10"`
Before string `help:"Pagination cursor: items before this ID."`
After string `help:"Pagination cursor: items after this ID."`
IncludeTotal bool `help:"Include total count in response." name:"include-total"`
}
AddressListCmd implements GET /v1/addresses.
func (*AddressListCmd) Run ¶
func (c *AddressListCmd) Run(g *Globals) error
Run sends the request and emits NDJSON when listing more than the limit.
type AddressesCmd ¶
type AddressesCmd struct {
Create AddressCreateCmd `cmd:"" help:"Save an address to the Lob address book."`
Get AddressGetCmd `cmd:"" help:"Retrieve a saved address by ID."`
List AddressListCmd `cmd:"" help:"List saved addresses."`
Delete AddressDeleteCmd `cmd:"" help:"Delete a saved address."`
Verify USVerifyCmd `cmd:"" help:"Verify a US address (shortcut for 'verify us')."`
Autocomplete USAutocompleteCmd `cmd:"" help:"Autocomplete a US address prefix."`
}
AddressesCmd groups address CRUD plus the verify/autocomplete/zip helpers.
type AuthCmd ¶
type AuthCmd struct {
Login AuthLoginCmd `cmd:"" help:"Store a Lob API key in the OS keychain under a profile."`
Logout AuthLogoutCmd `cmd:"" help:"Remove a stored API key."`
Status AuthStatusCmd `cmd:"" help:"Print the active auth profile and key prefix."`
List AuthListCmd `cmd:"" help:"List configured profiles."`
}
AuthCmd groups credential commands.
type AuthListCmd ¶
type AuthListCmd struct{}
AuthListCmd lists known profiles.
func (*AuthListCmd) Run ¶
func (c *AuthListCmd) Run(g *Globals) error
Run enumerates keyring profiles.
type AuthLoginCmd ¶
type AuthLoginCmd struct {
Key string `help:"API key to store under the active profile. Required when --no-input is set."`
}
AuthLoginCmd stores an API key under the active profile.
func (*AuthLoginCmd) Run ¶
func (c *AuthLoginCmd) Run(g *Globals) error
Run prompts for the key (unless --key or stdin is non-TTY) and stores it.
type AuthLogoutCmd ¶
type AuthLogoutCmd struct{}
AuthLogoutCmd removes a stored API key.
func (*AuthLogoutCmd) Run ¶
func (c *AuthLogoutCmd) Run(g *Globals) error
Run removes the profile's key from the keyring.
type AuthStatusCmd ¶
type AuthStatusCmd struct{}
AuthStatusCmd reports the active profile + key prefix without exposing secrets.
func (*AuthStatusCmd) Run ¶
func (c *AuthStatusCmd) Run(g *Globals) error
Run inspects the credential precedence chain and reports the result.
type BankAccountCreateCmd ¶
type BankAccountCreateCmd struct {
Description string `help:"Internal description."`
RoutingNumber string `help:"9-digit routing number." required:"" name:"routing-number"`
AccountNumber string `help:"Account number." required:"" name:"account-number"`
AccountType string `help:"Account type." enum:"individual,company" required:"" name:"account-type"`
Signatory string `help:"Full name of signatory." required:""`
Metadata map[string]string `help:"Metadata key=value pairs."`
}
BankAccountCreateCmd posts to /v1/bank_accounts.
func (*BankAccountCreateCmd) Run ¶
func (c *BankAccountCreateCmd) Run(g *Globals) error
Run sends the request.
type BankAccountDeleteCmd ¶
type BankAccountDeleteCmd struct {
ID string `arg:"" help:"Bank account ID."`
Confirm bool `help:"Required for destructive operations." xor:"destructive"`
Force bool `help:"Alias for --confirm." xor:"destructive"`
}
BankAccountDeleteCmd implements DELETE /v1/bank_accounts/:id.
func (*BankAccountDeleteCmd) Run ¶
func (c *BankAccountDeleteCmd) Run(g *Globals) error
Run sends the request.
type BankAccountGetCmd ¶
type BankAccountGetCmd struct {
ID string `arg:"" help:"Bank account ID (bank_…)."`
}
BankAccountGetCmd implements GET /v1/bank_accounts/:id.
func (*BankAccountGetCmd) Run ¶
func (c *BankAccountGetCmd) Run(g *Globals) error
Run sends the request.
type BankAccountListCmd ¶
type BankAccountListCmd struct {
Limit int `help:"Max results." default:"10"`
Before string `help:"Pagination cursor before."`
After string `help:"Pagination cursor after."`
IncludeTotal bool `help:"Include total count." name:"include-total"`
}
BankAccountListCmd implements GET /v1/bank_accounts.
func (*BankAccountListCmd) Run ¶
func (c *BankAccountListCmd) Run(g *Globals) error
Run sends the request.
type BankAccountVerifyCmd ¶
type BankAccountVerifyCmd struct {
ID string `arg:"" help:"Bank account ID."`
Amounts []int `help:"Two test-deposit amounts in cents (e.g. --amounts 11,35)." required:""`
}
BankAccountVerifyCmd implements POST /v1/bank_accounts/:id/verify.
func (*BankAccountVerifyCmd) Run ¶
func (c *BankAccountVerifyCmd) Run(g *Globals) error
Run sends the request.
type BankAccountsCmd ¶
type BankAccountsCmd struct {
Create BankAccountCreateCmd `cmd:"" help:"Add a bank account."`
Get BankAccountGetCmd `cmd:"" help:"Retrieve a bank account."`
List BankAccountListCmd `cmd:"" help:"List bank accounts."`
Delete BankAccountDeleteCmd `cmd:"" help:"Delete a bank account."`
Verify BankAccountVerifyCmd `cmd:"" help:"Verify a bank account with the test deposits."`
}
BankAccountsCmd implements /v1/bank_accounts.
type BillingGroupCreateCmd ¶
type BillingGroupCreateCmd struct {
Name string `help:"Group name." required:""`
Description string `help:"Group description."`
Metadata map[string]string `help:"Metadata key=value pairs."`
}
BillingGroupCreateCmd posts to /v1/billing_groups.
func (*BillingGroupCreateCmd) Run ¶
func (c *BillingGroupCreateCmd) Run(g *Globals) error
Run sends the request.
type BillingGroupGetCmd ¶
type BillingGroupGetCmd struct {
ID string `arg:"" help:"Billing group ID."`
}
BillingGroupGetCmd implements GET /v1/billing_groups/:id.
func (*BillingGroupGetCmd) Run ¶
func (c *BillingGroupGetCmd) Run(g *Globals) error
Run sends the request.
type BillingGroupListCmd ¶
type BillingGroupListCmd struct {
Limit int `help:"Max results." default:"10"`
Before string `help:"Pagination cursor before."`
After string `help:"Pagination cursor after."`
IncludeTotal bool `help:"Include total count." name:"include-total"`
}
BillingGroupListCmd implements GET /v1/billing_groups.
func (*BillingGroupListCmd) Run ¶
func (c *BillingGroupListCmd) Run(g *Globals) error
Run sends the request.
type BillingGroupUpdateCmd ¶
type BillingGroupUpdateCmd struct {
ID string `arg:"" help:"Billing group ID."`
Name string `help:"New name."`
Description string `help:"New description."`
Metadata map[string]string `help:"Replace metadata."`
}
BillingGroupUpdateCmd implements POST /v1/billing_groups/:id.
func (*BillingGroupUpdateCmd) Run ¶
func (c *BillingGroupUpdateCmd) Run(g *Globals) error
Run sends the request.
type BillingGroupsCmd ¶
type BillingGroupsCmd struct {
Create BillingGroupCreateCmd `cmd:"" help:"Create a billing group."`
Get BillingGroupGetCmd `cmd:"" help:"Retrieve a billing group."`
List BillingGroupListCmd `cmd:"" help:"List billing groups."`
Update BillingGroupUpdateCmd `cmd:"" help:"Update a billing group."`
}
BillingGroupsCmd implements /v1/billing_groups.
type BookletCreateCmd ¶
type BookletCreateCmd struct {
Description string `help:"Internal description."`
Cover string `help:"Cover artwork (HTML/URL/template/@file)." required:""`
Inside string `help:"Inside artwork (multi-page PDF/HTML, or @file)." required:""`
Size string `help:"Booklet size." enum:"8.5x11" default:"8.5x11"`
Metadata map[string]string `help:"Metadata key=value pairs."`
}
BookletCreateCmd posts to /v1/booklets.
func (*BookletCreateCmd) Run ¶
func (c *BookletCreateCmd) Run(g *Globals) error
Run sends the request.
type BookletDeleteCmd ¶
type BookletDeleteCmd struct {
ID string `arg:"" help:"Booklet ID."`
Confirm bool `help:"Required for destructive operations." xor:"destructive"`
Force bool `help:"Alias for --confirm." xor:"destructive"`
}
BookletDeleteCmd implements DELETE /v1/booklets/:id.
func (*BookletDeleteCmd) Run ¶
func (c *BookletDeleteCmd) Run(g *Globals) error
Run sends the request.
type BookletGetCmd ¶
type BookletGetCmd struct {
ID string `arg:"" help:"Booklet ID."`
}
BookletGetCmd implements GET /v1/booklets/:id.
type BookletListCmd ¶
type BookletListCmd struct {
Limit int `help:"Max results." default:"10"`
Before string `help:"Pagination cursor before."`
After string `help:"Pagination cursor after."`
IncludeTotal bool `help:"Include total count." name:"include-total"`
}
BookletListCmd implements GET /v1/booklets.
type BookletsCmd ¶
type BookletsCmd struct {
Create BookletCreateCmd `cmd:"" help:"Create a booklet."`
Get BookletGetCmd `cmd:"" help:"Retrieve a booklet."`
List BookletListCmd `cmd:"" help:"List booklets."`
Delete BookletDeleteCmd `cmd:"" help:"Delete a booklet."`
}
BookletsCmd implements /v1/booklets.
type BuckslipCreateCmd ¶
type BuckslipCreateCmd struct {
Description string `help:"Internal description."`
Front string `help:"Front artwork (HTML/URL/template/@file)." required:""`
Back string `help:"Back artwork (HTML/URL/template/@file)."`
Size string `help:"Buckslip size." enum:"8.75x3.75" default:"8.75x3.75"`
Stock string `help:"Stock type."`
AutoReorder bool `help:"Auto-reorder when low." name:"auto-reorder"`
ReorderQuantity int `help:"Quantity per reorder." name:"reorder-quantity"`
Metadata map[string]string `help:"Metadata key=value pairs."`
}
BuckslipCreateCmd posts to /v1/buckslips.
func (*BuckslipCreateCmd) Run ¶
func (c *BuckslipCreateCmd) Run(g *Globals) error
Run sends the request.
type BuckslipDeleteCmd ¶
type BuckslipDeleteCmd struct {
ID string `arg:"" help:"Buckslip ID."`
Confirm bool `help:"Required for destructive operations." xor:"destructive"`
Force bool `help:"Alias for --confirm." xor:"destructive"`
}
BuckslipDeleteCmd implements DELETE /v1/buckslips/:id.
func (*BuckslipDeleteCmd) Run ¶
func (c *BuckslipDeleteCmd) Run(g *Globals) error
Run sends the request.
type BuckslipGetCmd ¶
type BuckslipGetCmd struct {
ID string `arg:"" help:"Buckslip ID."`
}
BuckslipGetCmd implements GET /v1/buckslips/:id.
type BuckslipListCmd ¶
type BuckslipListCmd struct {
Limit int `help:"Max results." default:"10"`
Before string `help:"Pagination cursor before."`
After string `help:"Pagination cursor after."`
IncludeTotal bool `help:"Include total count." name:"include-total"`
}
BuckslipListCmd implements GET /v1/buckslips.
func (*BuckslipListCmd) Run ¶
func (c *BuckslipListCmd) Run(g *Globals) error
Run sends the request.
type BuckslipsCmd ¶
type BuckslipsCmd struct {
Create BuckslipCreateCmd `cmd:"" help:"Create a buckslip."`
Get BuckslipGetCmd `cmd:"" help:"Retrieve a buckslip."`
List BuckslipListCmd `cmd:"" help:"List buckslips."`
Delete BuckslipDeleteCmd `cmd:"" help:"Delete a buckslip."`
}
BuckslipsCmd implements /v1/buckslips.
type BulkCmd ¶
type BulkCmd struct {
US BulkUSCmd `cmd:"" help:"Bulk US address verifications (synchronous, ≤100 addresses)."`
Intl BulkIntlCmd `cmd:"" help:"Bulk international address verifications (synchronous, ≤100 addresses)."`
}
BulkCmd implements Lob's two documented bulk-verification endpoints. Lob does not currently expose a public async-CSV verification API — the historical `us_csv_verifications` resource is unlisted in `lob-api-public.yml`. If/when Lob re-publishes it, add a `csv` subcommand here.
type BulkIntlCmd ¶
type BulkIntlCmd struct {
Addresses string `help:"JSON array of address objects (or @file.json)." required:""`
}
BulkIntlCmd posts up to 100 addresses to POST /bulk/intl_verifications.
type BulkUSCmd ¶
type BulkUSCmd struct {
Addresses string `help:"JSON array of address objects (or @file.json)." required:""`
Case string `help:"Case transformation." enum:"upper,proper,default" default:"default"`
}
BulkUSCmd posts up to 100 addresses to POST /bulk/us_verifications.
type CampaignCreateCmd ¶
type CampaignCreateCmd struct {
Name string `help:"Campaign name." required:""`
Description string `help:"Internal description."`
ScheduleType string `help:"Schedule type." enum:"immediate,in_future" default:"immediate" name:"schedule-type"`
SendDate string `help:"Send date (RFC3339, required for schedule-type=in_future)." name:"send-date"`
BillingGroup string `help:"Billing group ID." name:"billing-group-id"`
Metadata map[string]string `help:"Metadata key=value pairs."`
UseType string `help:"Use type." enum:"marketing,operational" default:"marketing" name:"use-type"`
}
CampaignCreateCmd posts to /v1/campaigns.
func (*CampaignCreateCmd) Run ¶
func (c *CampaignCreateCmd) Run(g *Globals) error
Run sends the request.
type CampaignDeleteCmd ¶
type CampaignDeleteCmd struct {
ID string `arg:"" help:"Campaign ID."`
Confirm bool `help:"Required for destructive operations." xor:"destructive"`
Force bool `help:"Alias for --confirm." xor:"destructive"`
}
CampaignDeleteCmd implements DELETE /v1/campaigns/:id.
func (*CampaignDeleteCmd) Run ¶
func (c *CampaignDeleteCmd) Run(g *Globals) error
Run sends the request.
type CampaignGetCmd ¶
type CampaignGetCmd struct {
ID string `arg:"" help:"Campaign ID (cmp_…)."`
}
CampaignGetCmd implements GET /v1/campaigns/:id.
type CampaignListCmd ¶
type CampaignListCmd struct {
Limit int `help:"Max results." default:"10"`
Before string `help:"Pagination cursor before."`
After string `help:"Pagination cursor after."`
IncludeTotal bool `help:"Include total count." name:"include-total"`
}
CampaignListCmd implements GET /v1/campaigns.
func (*CampaignListCmd) Run ¶
func (c *CampaignListCmd) Run(g *Globals) error
Run sends the request.
type CampaignSendCmd ¶
type CampaignSendCmd struct {
ID string `arg:"" help:"Campaign ID."`
Confirm bool `help:"Required to send (campaign cannot be edited after)." xor:"destructive"`
Force bool `help:"Alias for --confirm." xor:"destructive"`
}
CampaignSendCmd implements POST /v1/campaigns/:id/send.
func (*CampaignSendCmd) Run ¶
func (c *CampaignSendCmd) Run(g *Globals) error
Run sends the request.
type CampaignsCmd ¶
type CampaignsCmd struct {
Create CampaignCreateCmd `cmd:"" help:"Create a campaign."`
Get CampaignGetCmd `cmd:"" help:"Retrieve a campaign."`
List CampaignListCmd `cmd:"" help:"List campaigns."`
Delete CampaignDeleteCmd `cmd:"" help:"Delete a campaign."`
Send CampaignSendCmd `cmd:"" help:"Submit a campaign for processing (no longer editable)."`
}
CampaignsCmd implements /v1/campaigns. Lob exposes no update endpoint — campaign settings are write-once at create-time.
type CardCreateCmd ¶
type CardCreateCmd struct {
Description string `help:"Internal description."`
Front string `help:"Front artwork (HTML/URL/template/@file)." required:""`
Back string `help:"Back artwork (HTML/URL/template/@file)."`
Size string `help:"Card size." enum:"2.125x3.375,2.5x2.5,2.75x2.75,2x3.5,3.5x2,3.5x4,3.5x5,4x6,5x5,5x7,6x9,8.5x11" default:"3.5x2"`
Stock string `help:"Stock type." enum:"14PT_AQ,14PT_AQ_DULL,14PT_UV,14PT_MATTE,16PT_AQ,16PT_UV,${none}" default:"${none}"`
AutoReorder bool `help:"Auto-reorder when low." name:"auto-reorder"`
ReorderQuantity int `help:"Quantity per reorder." name:"reorder-quantity"`
Metadata map[string]string `help:"Metadata key=value pairs."`
}
CardCreateCmd posts to /v1/cards.
type CardDeleteCmd ¶
type CardDeleteCmd struct {
ID string `arg:"" help:"Card ID."`
Confirm bool `help:"Required for destructive operations." xor:"destructive"`
Force bool `help:"Alias for --confirm." xor:"destructive"`
}
CardDeleteCmd implements DELETE /v1/cards/:id.
type CardGetCmd ¶
type CardGetCmd struct {
ID string `arg:"" help:"Card ID (card_…)."`
}
CardGetCmd implements GET /v1/cards/:id.
type CardListCmd ¶
type CardListCmd struct {
Limit int `help:"Max results." default:"10"`
Before string `help:"Pagination cursor before."`
After string `help:"Pagination cursor after."`
IncludeTotal bool `help:"Include total count." name:"include-total"`
}
CardListCmd implements GET /v1/cards.
type CardsCmd ¶
type CardsCmd struct {
Create CardCreateCmd `cmd:"" help:"Create a card."`
Get CardGetCmd `cmd:"" help:"Retrieve a card."`
List CardListCmd `cmd:"" help:"List cards."`
Delete CardDeleteCmd `cmd:"" help:"Delete a card."`
}
CardsCmd implements /v1/cards (printed card stock for campaigns).
type CheckCancelCmd ¶
type CheckCancelCmd struct {
ID string `arg:"" help:"Check ID (chk_…)."`
Confirm bool `help:"Required for destructive operations." xor:"destructive"`
Force bool `help:"Alias for --confirm." xor:"destructive"`
}
CheckCancelCmd implements POST /v1/checks/:id/cancel.
type CheckCreateCmd ¶
type CheckCreateCmd struct {
Description string `help:"Internal description."`
To string `help:"Recipient address ID or JSON." required:""`
From string `help:"Sender address ID or JSON."`
BankAccount string `help:"Bank account ID (bank_…)." required:"" name:"bank-account"`
Amount float64 `help:"Amount in dollars (max $9,999,999.99)." required:""`
Memo string `help:"Memo line (≤40 chars)."`
Message string `help:"Inset message printed below the check."`
CheckNumber int `help:"Specific check number (default: next sequential)." name:"check-number"`
Logo string `help:"Logo: URL, ID, or @file.png."`
Attachment string `help:"Single-page attachment (PDF/HTML/URL/template, or @file)."`
MailingDate string `help:"Scheduled mailing date." name:"mailing-date"`
MailType string `help:"Delivery class." enum:"usps_first_class,usps_standard" default:"usps_first_class" name:"mail-type"`
UseType string `help:"Use type." enum:"marketing,operational" default:"operational" name:"use-type"`
MergeVariables string `help:"JSON object of template variables (or @file.json)."`
Metadata map[string]string `help:"Metadata key=value pairs."`
}
CheckCreateCmd posts to /v1/checks.
type CheckGetCmd ¶
type CheckGetCmd struct {
ID string `arg:"" help:"Check ID (chk_…)."`
}
CheckGetCmd implements GET /v1/checks/:id.
type CheckListCmd ¶
type CheckListCmd struct {
Limit int `help:"Max results (1-100)." default:"10"`
Before string `help:"Pagination cursor before."`
After string `help:"Pagination cursor after."`
IncludeTotal bool `help:"Include total count." name:"include-total"`
}
CheckListCmd implements GET /v1/checks.
type ChecksCmd ¶
type ChecksCmd struct {
Create CheckCreateCmd `cmd:"" help:"Mail a check."`
Get CheckGetCmd `cmd:"" help:"Retrieve a check by ID."`
List CheckListCmd `cmd:"" help:"List checks."`
Cancel CheckCancelCmd `cmd:"" help:"Cancel a check before mailing."`
}
ChecksCmd implements /v1/checks.
type CompletionCmd ¶
type CompletionCmd struct {
Shell string `arg:"" help:"Shell to generate completions for." enum:"bash,zsh,fish,powershell"`
}
CompletionCmd emits a shell completion script. Sourced into the user's shell, it turns `loby <TAB>` into a working completion experience. The script is generated from the current Kong model so command additions stay in sync.
type CreativeCreateCmd ¶
type CreativeCreateCmd struct {
CampaignID string `help:"Parent campaign ID (cmp_…)." required:"" name:"campaign-id"`
Description string `help:"Internal description."`
ResourceType string `help:"Mail piece kind." enum:"postcard,letter,self_mailer,snap_pack,booklet,card,buckslip" required:"" name:"resource-type"`
From string `help:"Sender address ID, inline JSON, or @file.json."`
Front string `help:"Front artwork: HTML string, URL, tmpl_id, or @file (postcard, self_mailer, snap_pack, buckslip)."`
Back string `help:"Back artwork: HTML string, URL, tmpl_id, or @file (postcard, self_mailer, snap_pack, buckslip)."`
Inside string `help:"Inside artwork: HTML string, URL, tmpl_id, or @file (self_mailer, snap_pack)."`
Outside string `help:"Outside artwork: HTML string, URL, tmpl_id, or @file (self_mailer, snap_pack)."`
Cover string `help:"Cover artwork (booklet, card)."`
File string `help:"File body for letters (HTML, URL, tmpl_id, or @file)."`
Size string `help:"Mail piece size (e.g. 4x6, 6x11, 6x18 — varies by resource_type)."`
MailType string `help:"Postage class (usps_first_class, usps_standard, usps_standard_class)." name:"mail-type"`
Color bool `help:"Color print for letters (defaults true on Lob's side)."`
DoubleSided bool `help:"Letters double-sided." name:"double-sided"`
AddressPlacement string `help:"Letter address placement (top_first_page, insert_blank_page)." name:"address-placement"`
ExtraService string `help:"Extra letter service (certified, registered, certified_return_receipt)." name:"extra-service"`
Details string `help:"Override the details object (JSON or @file.json) — escape hatch for fields not exposed as flags."`
Metadata map[string]string `help:"Metadata key=value pairs."`
}
CreativeCreateCmd posts to /v1/creatives. The shape Lob accepts is resource-type dependent (postcards take front/back, letters take file + extra_service, etc.) so the flags expose the union and the request builder only sends what's set.
func (*CreativeCreateCmd) Run ¶
func (c *CreativeCreateCmd) Run(g *Globals) error
Run sends the request.
type CreativesCmd ¶
type CreativesCmd struct {
Create CreativeCreateCmd `cmd:"" help:"Create a creative for a campaign."`
}
CreativesCmd implements /v1/creatives. Lob exposes only POST — creatives are write-once at create-time; the campaign drives delivery.
type DomainCreateCmd ¶ added in v0.1.2
type DomainCreateCmd struct {
Domain string `help:"Domain (e.g. links.example.com)." required:""`
Description string `help:"Internal description."`
Metadata map[string]string `help:"Metadata key=value pairs."`
}
DomainCreateCmd posts to /v1/domains.
func (*DomainCreateCmd) Run ¶ added in v0.1.2
func (c *DomainCreateCmd) Run(g *Globals) error
Run sends the request.
type DomainDeleteCmd ¶ added in v0.1.2
type DomainDeleteCmd struct {
ID string `arg:"" help:"Domain ID."`
Confirm bool `help:"Required for destructive operations." xor:"destructive"`
Force bool `help:"Alias for --confirm." xor:"destructive"`
}
DomainDeleteCmd implements DELETE /v1/domains/:id.
func (*DomainDeleteCmd) Run ¶ added in v0.1.2
func (c *DomainDeleteCmd) Run(g *Globals) error
Run sends the request.
type DomainGetCmd ¶ added in v0.1.2
type DomainGetCmd struct {
ID string `arg:"" help:"Domain ID."`
}
DomainGetCmd implements GET /v1/domains/:id.
func (*DomainGetCmd) Run ¶ added in v0.1.2
func (c *DomainGetCmd) Run(g *Globals) error
Run sends the request.
type DomainListCmd ¶ added in v0.1.2
type DomainListCmd struct {
Limit int `help:"Max results." default:"10"`
Before string `help:"Pagination cursor before."`
After string `help:"Pagination cursor after."`
IncludeTotal bool `help:"Include total count." name:"include-total"`
}
DomainListCmd implements GET /v1/domains.
func (*DomainListCmd) Run ¶ added in v0.1.2
func (c *DomainListCmd) Run(g *Globals) error
Run sends the request.
type DomainsCmd ¶ added in v0.1.2
type DomainsCmd struct {
Create DomainCreateCmd `cmd:"" help:"Register a custom domain for use with the URL shortener."`
Get DomainGetCmd `cmd:"" help:"Retrieve a domain."`
List DomainListCmd `cmd:"" help:"List domains."`
Delete DomainDeleteCmd `cmd:"" help:"Delete a domain."`
}
DomainsCmd implements /v1/domains — custom short-link domains. Use the returned domain ID with `loby links create --domain-id` to root your short URLs on your own domain instead of Lob's.
type EventGetCmd ¶
type EventGetCmd struct {
ID string `arg:"" help:"Event ID (evt_…)."`
}
EventGetCmd implements GET /v1/events/:id.
type EventListCmd ¶
type EventListCmd struct {
Limit int `help:"Max results (1-100)." default:"10"`
Before string `help:"Pagination cursor before."`
After string `help:"Pagination cursor after."`
EventType string `help:"Filter by event type (e.g. postcard.created, letter.delivered)." name:"event-type"`
DateCreated string `help:"Filter on date_created (RFC3339 range, e.g. 'gte:2026-01-01,lt:2026-02-01')." name:"date-created"`
}
EventListCmd implements GET /v1/events. Lob's API only filters by event_type (and date_created) server-side — there is no resource_type query param. Use --event-type postcard.created / .delivered / etc.
type EventTailCmd ¶
type EventTailCmd struct {
Interval time.Duration `help:"Poll interval." default:"5s"`
EventType string `help:"Filter by event type (e.g. postcard.created)." name:"event-type"`
}
EventTailCmd polls the event log and streams new events as NDJSON. Designed for agents that need a long-running tail without webhooks. Lob only supports filtering by event_type server-side — pass a comma-separated list to --event-type to narrow by resource.
func (*EventTailCmd) Run ¶
func (c *EventTailCmd) Run(g *Globals) error
Run polls events until the context is canceled.
type EventsCmd ¶
type EventsCmd struct {
List EventListCmd `cmd:"" help:"List events."`
Tail EventTailCmd `cmd:"" help:"Stream events as NDJSON (poll every 5s)."`
Get EventGetCmd `cmd:"" help:"Retrieve a single event by ID."`
}
EventsCmd implements /v1/events.
type ExitCodesCmd ¶
type ExitCodesCmd struct{}
ExitCodesCmd implements `loby exit-codes`.
func (*ExitCodesCmd) Run ¶
func (c *ExitCodesCmd) Run(g *Globals) error
Run dumps the canonical exit-code taxonomy.
type Flag ¶
type Flag struct {
Name string `json:"name"`
Short string `json:"short,omitempty"`
Help string `json:"help,omitempty"`
Type string `json:"type,omitempty"`
Default string `json:"default,omitempty"`
Env []string `json:"env,omitempty"`
Required bool `json:"required,omitempty"`
Enum []string `json:"enum,omitempty"`
}
Flag describes one flag or positional argument in JSON-friendly form.
type GeoCmd ¶
type GeoCmd struct {
Reverse GeoReverseCmd `cmd:"" help:"Reverse-geocode lat/lng to ZIP codes."`
}
GeoCmd implements /v1/reverse_geocode_lookups.
type GeoReverseCmd ¶
type GeoReverseCmd struct {
Latitude float64 `help:"Latitude (e.g. 37.7749)." required:"" name:"lat"`
Longitude float64 `help:"Longitude (e.g. -122.4194)." required:"" name:"lng"`
}
GeoReverseCmd posts to /v1/reverse_geocode_lookups. Coordinates use flags (not positionals) so negative values like --lng=-122.4194 don't get interpreted as flag short-names by the parser.
type Globals ¶
type Globals struct {
JSON bool `short:"j" help:"Emit JSON to stdout." env:"LOBY_JSON"`
Plain bool `short:"p" help:"Emit tab-separated values to stdout." env:"LOBY_PLAIN"`
ResultsOnly bool ` help:"Strip the metadata envelope; emit data only."`
Select string ` help:"Project output to a subset of fields (comma-separated, dot-paths). e.g. --select id,to.city"`
NoColor bool ` help:"Disable ANSI color in human output." env:"NO_COLOR"`
Quiet bool `short:"q" help:"Suppress stderr hints; emit bare values."`
NoInput bool ` help:"Fail rather than prompt for input. Implied when stdin is not a TTY."`
APIKey string ` help:"Lob API key (overrides keyring + env)." env:"LOB_API_KEY"`
Profile string ` help:"Named auth profile." env:"LOB_PROFILE" default:"default"`
DryRun bool `short:"n" help:"Preview the request body as JSON; do not execute mutations."`
IdempotencyKey string ` help:"Override the auto-generated Idempotency-Key for create operations."`
Debug bool ` help:"Verbose logging to stderr." env:"LOBY_DEBUG"`
// Injected at runtime, not parsed from the command line.
Stdout io.Writer `kong:"-"`
Stderr io.Writer `kong:"-"`
Stdin io.Reader `kong:"-"`
Ctx context.Context `kong:"-"`
}
Globals holds the flags every command observes. They sit at the root level of the Kong struct and propagate to subcommands via inheritance.
func (*Globals) LobClient ¶
LobClient builds an authenticated Lob client from the active globals. Auth resolution follows --api-key > LOB_API_KEY > keyring(profile).
Keyring open failures are surfaced unless flag/env satisfy auth on their own — a broken keychain should not silently masquerade as "no API key configured" because the recovery path is different (fix the keychain vs. run `auth login`).
type IdentityCmd ¶
type IdentityCmd struct {
Verify IdentityVerifyCmd `cmd:"" help:"Verify the identity of a recipient."`
}
IdentityCmd implements /v1/identity_validation. Lob only exposes the POST; validations are not addressable by ID after creation.
type IdentityVerifyCmd ¶
type IdentityVerifyCmd struct {
Recipient string `help:"Recipient full name (required if --company is not set)."`
Company string `help:"Company name (required if --recipient is not set)."`
PrimaryLine string `help:"Primary address line (street)." required:"" name:"primary-line"`
Secondary string `help:"Secondary line (apt/suite)." name:"secondary-line"`
City string `help:"City."`
State string `help:"State."`
Zip string `help:"ZIP code."`
}
IdentityVerifyCmd posts to /v1/identity_validation. Lob expects a single `recipient` name (or `company`) plus a US address as flat fields.
func (*IdentityVerifyCmd) Run ¶
func (c *IdentityVerifyCmd) Run(g *Globals) error
Run sends the request.
type InformedDeliveryCmd ¶
type InformedDeliveryCmd struct {
Create InformedDeliveryCreateCmd `cmd:"" help:"Create an informed delivery campaign."`
Get InformedDeliveryGetCmd `cmd:"" help:"Retrieve an informed delivery campaign."`
List InformedDeliveryListCmd `cmd:"" help:"List informed delivery campaigns."`
}
InformedDeliveryCmd implements /v1/informed_delivery_campaigns. Per Lob's public spec, create takes multipart/form-data with a JPG ride-along image.
type InformedDeliveryCreateCmd ¶
type InformedDeliveryCreateCmd struct {
RideAlongURL string `help:"Click-through URL the ride-along image links to (https://, ≤255 chars)." required:"" name:"ride-along-url"`
RideAlongImage string `help:"Path to ride-along JPG (@file.jpg or absolute path; ≤200KB, ≤300x200)." required:"" name:"ride-along-image"`
Quantity int `help:"Number of mail pieces (USPS IMB sequence)." required:""`
StartDate string `help:"First hand-off date (YYYY-MM-DD, ≥2 days from now)." required:"" name:"start-date"`
Status string `help:"Initial status." enum:"approved,pending_approval" default:"approved"`
BrandName string `help:"Brand name for the campaign." name:"brand-name"`
RepresentativeImage string `help:"Optional representative JPG (same constraints as ride-along)." name:"representative-image"`
}
InformedDeliveryCreateCmd posts a multipart/form-data request to /v1/informed_delivery_campaigns. Lob requires ride_along_url + ride_along_image (JPG, ≤200KB, ≤300x200) + quantity + start_date.
func (*InformedDeliveryCreateCmd) Run ¶
func (c *InformedDeliveryCreateCmd) Run(g *Globals) error
Run sends the multipart request.
type InformedDeliveryGetCmd ¶
type InformedDeliveryGetCmd struct {
ID string `arg:"" help:"Informed delivery campaign ID."`
}
InformedDeliveryGetCmd implements GET /v1/informed_delivery_campaigns/:id.
func (*InformedDeliveryGetCmd) Run ¶
func (c *InformedDeliveryGetCmd) Run(g *Globals) error
Run sends the request.
type InformedDeliveryListCmd ¶
type InformedDeliveryListCmd struct {
Limit int `help:"Max results." default:"10"`
Before string `help:"Pagination cursor before."`
After string `help:"Pagination cursor after."`
IncludeTotal bool `help:"Include total count." name:"include-total"`
}
InformedDeliveryListCmd implements GET /v1/informed_delivery_campaigns.
func (*InformedDeliveryListCmd) Run ¶
func (c *InformedDeliveryListCmd) Run(g *Globals) error
Run sends the request.
type LetterCancelCmd ¶
type LetterCancelCmd struct {
ID string `arg:"" help:"Letter ID."`
Confirm bool `help:"Required for destructive operations." xor:"destructive"`
Force bool `help:"Alias for --confirm." xor:"destructive"`
}
LetterCancelCmd implements POST /v1/letters/:id/cancel.
func (*LetterCancelCmd) Run ¶
func (c *LetterCancelCmd) Run(g *Globals) error
Run sends the request.
type LetterCreateCmd ¶
type LetterCreateCmd struct {
Description string `help:"Internal description."`
To string `help:"Recipient address ID or JSON." required:""`
From string `help:"Sender address ID or JSON." required:""`
File string `help:"PDF, HTML, URL, or template ID. Use @file.pdf for a local file." required:""`
Color bool `help:"Print in color."`
DoubleSided bool `help:"Double-sided printing." name:"double-sided" default:"true"`
AddressPlacement string `help:"Address placement." enum:"top_first_page,insert_blank_page" default:"top_first_page" name:"address-placement"`
MailingDate string `help:"Scheduled mailing date." name:"mailing-date"`
MailType string `help:"Delivery class." enum:"usps_first_class,usps_standard" default:"usps_first_class" name:"mail-type"`
UseType string `help:"Use type." enum:"marketing,operational" default:"operational" name:"use-type"`
ExtraService string `` /* 135-byte string literal not displayed */
PerforatedPage int `help:"Page index to perforate (1-based)." name:"perforated-page"`
ReturnEnvelope string `help:"Return envelope ID."`
CustomEnvelope string `help:"Custom envelope ID."`
MergeVariables string `help:"JSON object of template variables (or @file.json)."`
Metadata map[string]string `help:"Metadata key=value pairs."`
}
LetterCreateCmd posts to /v1/letters.
func (*LetterCreateCmd) Run ¶
func (c *LetterCreateCmd) Run(g *Globals) error
Run sends the request.
type LetterGetCmd ¶
type LetterGetCmd struct {
ID string `arg:"" help:"Letter ID (ltr_…)."`
}
LetterGetCmd implements GET /v1/letters/:id.
type LetterListCmd ¶
type LetterListCmd struct {
Limit int `help:"Max results (1-100)." default:"10"`
Before string `help:"Pagination cursor before."`
After string `help:"Pagination cursor after."`
IncludeTotal bool `help:"Include total count." name:"include-total"`
}
LetterListCmd implements GET /v1/letters.
type LettersCmd ¶
type LettersCmd struct {
Create LetterCreateCmd `cmd:"" help:"Send a letter."`
Get LetterGetCmd `cmd:"" help:"Retrieve a letter by ID."`
List LetterListCmd `cmd:"" help:"List letters."`
Cancel LetterCancelCmd `cmd:"" help:"Cancel a letter before mailing."`
}
LettersCmd implements /v1/letters.
type LinkCreateCmd ¶ added in v0.1.2
type LinkCreateCmd struct {
RedirectURL string `help:"Long URL the short link redirects to." required:"" name:"redirect-link"`
DomainID string `help:"Optional custom domain ID (defaults to Lob's short domain)." name:"domain-id"`
Description string `help:"Internal description."`
Metadata map[string]string `help:"Metadata key=value pairs."`
}
LinkCreateCmd posts to /v1/links.
func (*LinkCreateCmd) Run ¶ added in v0.1.2
func (c *LinkCreateCmd) Run(g *Globals) error
Run sends the request.
type LinkDeleteCmd ¶ added in v0.1.2
type LinkDeleteCmd struct {
ID string `arg:"" help:"Link ID."`
Confirm bool `help:"Required for destructive operations." xor:"destructive"`
Force bool `help:"Alias for --confirm." xor:"destructive"`
}
LinkDeleteCmd implements DELETE /v1/links/:id.
func (*LinkDeleteCmd) Run ¶ added in v0.1.2
func (c *LinkDeleteCmd) Run(g *Globals) error
Run sends the request.
type LinkGetCmd ¶ added in v0.1.2
type LinkGetCmd struct {
ID string `arg:"" help:"Link ID."`
}
LinkGetCmd implements GET /v1/links/:id.
func (*LinkGetCmd) Run ¶ added in v0.1.2
func (c *LinkGetCmd) Run(g *Globals) error
Run sends the request.
type LinkListCmd ¶ added in v0.1.2
type LinkListCmd struct {
Limit int `help:"Max results." default:"10"`
Before string `help:"Pagination cursor before."`
After string `help:"Pagination cursor after."`
IncludeTotal bool `help:"Include total count." name:"include-total"`
}
LinkListCmd implements GET /v1/links.
func (*LinkListCmd) Run ¶ added in v0.1.2
func (c *LinkListCmd) Run(g *Globals) error
Run sends the request.
type LinksCmd ¶ added in v0.1.2
type LinksCmd struct {
Create LinkCreateCmd `cmd:"" help:"Create a short link."`
Get LinkGetCmd `cmd:"" help:"Retrieve a short link."`
List LinkListCmd `cmd:"" help:"List short links."`
Delete LinkDeleteCmd `cmd:"" help:"Delete a short link."`
}
LinksCmd implements /v1/links — Lob's URL shortener. Links are short URLs (optionally rooted on a custom domain, see DomainsCmd) that redirect to a long URL and track clicks.
type PostcardCreateCmd ¶
type PostcardCreateCmd struct {
Description string `help:"Internal description (≤255 chars)."`
To string `help:"Recipient address ID (adr_…) or JSON object." required:""`
From string `help:"Sender address ID (adr_…) or JSON object."`
Front string `help:"HTML, URL, template ID (tmpl_…), or @file.html for the front." required:""`
Back string `help:"HTML, URL, template ID (tmpl_…), or @file.html for the back."`
Size string `help:"Postcard size." enum:"4x6,6x9,6x11" default:"4x6"`
MailingDate string `help:"Scheduled mailing date (YYYY-MM-DD or RFC3339)." name:"mailing-date"`
MailType string `help:"Delivery class." enum:"usps_first_class,usps_standard" default:"usps_first_class" name:"mail-type"`
UseType string `help:"Use type." enum:"marketing,operational" default:"marketing" name:"use-type"`
MergeVariables string `help:"JSON object of template variables (or @file.json)."`
Metadata map[string]string `help:"Metadata key=value pairs (repeatable)."`
}
PostcardCreateCmd is the full create form. To/From accept address IDs (adr_…) or inline JSON objects via --to-json / --from-json.
func (*PostcardCreateCmd) Run ¶
func (c *PostcardCreateCmd) Run(g *Globals) error
Run builds the request body and posts to /postcards.
type PostcardGetCmd ¶
type PostcardGetCmd struct {
ID string `arg:"" help:"Postcard ID (psc_…)."`
}
PostcardGetCmd implements GET /v1/postcards/:id.
type PostcardListCmd ¶
type PostcardListCmd struct {
Limit int `help:"Max results (1-100)." default:"10"`
Before string `help:"Pagination cursor before."`
After string `help:"Pagination cursor after."`
IncludeTotal bool `help:"Include total count." name:"include-total"`
}
PostcardListCmd implements GET /v1/postcards.
func (*PostcardListCmd) Run ¶
func (c *PostcardListCmd) Run(g *Globals) error
Run sends the request.
type PostcardsCmd ¶
type PostcardsCmd struct {
Create PostcardCreateCmd `cmd:"" help:"Send a postcard."`
Get PostcardGetCmd `cmd:"" help:"Retrieve a postcard by ID."`
List PostcardListCmd `cmd:"" help:"List postcards."`
}
PostcardsCmd implements /v1/postcards. Lob does not expose a cancel/delete endpoint for postcards — they enter the USPS pipeline immediately on create.
type QRCodeListCmd ¶
type QRCodeListCmd struct {
Limit int `help:"Max results." default:"10"`
Offset int `help:"Pagination offset."`
Scanned bool `help:"Only QR codes with at least one scan event."`
IncludeTotal bool `help:"Include total count." name:"include-total"`
}
QRCodeListCmd implements GET /v1/qr_code_analytics.
type QRCodesCmd ¶
type QRCodesCmd struct {
List QRCodeListCmd `cmd:"" help:"List QR codes (with scan analytics)."`
}
QRCodesCmd implements /v1/qr_code_analytics — Lob's QR code analytics endpoint. QR codes themselves are created by embedding Lob's QR snippet in a mailer's HTML; the API only surfaces scan analytics for the resulting codes.
type ResourceProofGetCmd ¶
type ResourceProofGetCmd struct {
ID string `arg:"" help:"Resource proof ID."`
}
ResourceProofGetCmd implements GET /v1/resource_proofs/:id.
func (*ResourceProofGetCmd) Run ¶
func (c *ResourceProofGetCmd) Run(g *Globals) error
Run sends the request.
type ResourceProofsCmd ¶
type ResourceProofsCmd struct {
Get ResourceProofGetCmd `cmd:"" help:"Retrieve a resource proof (PDF preview of a printed asset)."`
}
ResourceProofsCmd implements /v1/resource_proofs.
type Root ¶
type Root struct {
Globals
// Introspection / meta
Version VersionCmd `cmd:"" help:"Print build information."`
Schema SchemaCmd `cmd:"" help:"Print the CLI command tree as JSON (agent introspection)."`
ExitCodes ExitCodesCmd `cmd:"" help:"Print the canonical exit-code table." aliases:"exitcodes,exit"`
Completion CompletionCmd `cmd:"" help:"Generate shell completion (bash, zsh, fish, powershell)."`
Auth AuthCmd `cmd:"" help:"Manage Lob API credentials."`
Account AccountCmd `cmd:"" help:"Show the active Lob account profile and balance."`
// Address & verification
Addresses AddressesCmd `cmd:"" help:"Manage saved addresses, verify, autocomplete."`
Verify VerifyCmd `cmd:"" help:"Verify US or international addresses."`
Zip ZipCmd `cmd:"" help:"Look up city/state for a US ZIP code."`
Geo GeoCmd `cmd:"" help:"Reverse-geocode lat/lng to ZIP codes."`
Identity IdentityCmd `cmd:"" help:"Verify an individual's identity at an address."`
Bulk BulkCmd `cmd:"" help:"Bulk verification operations (sync arrays and async CSV jobs)."`
// Mail creation
Postcards PostcardsCmd `cmd:"" help:"Create, retrieve, list, and cancel postcards."`
Letters LettersCmd `cmd:"" help:"Create, retrieve, list, and cancel letters."`
Checks ChecksCmd `cmd:"" help:"Create, retrieve, list, and cancel checks."`
SelfMailers SelfMailersCmd `cmd:"" help:"Create, retrieve, list, and cancel self-mailers." name:"self-mailers"`
SnapPacks SnapPacksCmd `cmd:"" help:"Create, retrieve, list, and cancel snap packs." name:"snap-packs"`
// Print assets (campaign artwork)
Cards CardsCmd `cmd:"" help:"Manage card stock artwork."`
Booklets BookletsCmd `cmd:"" help:"Manage booklet artwork."`
Buckslips BuckslipsCmd `cmd:"" help:"Manage buckslip artwork."`
// Campaigns
Campaigns CampaignsCmd `cmd:"" help:"Manage direct-mail campaigns."`
InformedDelivery InformedDeliveryCmd `cmd:"" help:"Manage USPS Informed Delivery campaigns." name:"informed-delivery"`
Creatives CreativesCmd `cmd:"" help:"Manage campaign creatives."`
Uploads UploadsCmd `cmd:"" help:"Manage campaign CSV uploads."`
// Templates
Templates TemplatesCmd `cmd:"" help:"Manage reusable HTML templates."`
// Bank accounts & billing
BankAccounts BankAccountsCmd `cmd:"" help:"Manage bank accounts for check mailing." name:"bank-accounts"`
BillingGroups BillingGroupsCmd `cmd:"" help:"Manage billing groups." name:"billing-groups"`
// QR analytics, URL shortener, events, proofs
QRCodes QRCodesCmd `cmd:"" help:"List QR code scan analytics." name:"qr-codes"`
Links LinksCmd `cmd:"" help:"Manage short links (Lob's URL shortener)."`
Domains DomainsCmd `cmd:"" help:"Manage custom short-link domains."`
Events EventsCmd `cmd:"" help:"List and tail Lob events."`
ResourceProofs ResourceProofsCmd `cmd:"" help:"Retrieve resource proof previews." name:"resource-proofs"`
}
Root is the top-level Kong CLI definition. Each *Cmd field becomes a subcommand; new resource groups are added by appending a field here and dropping a Kong struct alongside.
type Schema ¶
type Schema struct {
Name string `json:"name"`
Help string `json:"help,omitempty"`
Aliases []string `json:"aliases,omitempty"`
Flags []Flag `json:"flags,omitempty"`
Positional []Flag `json:"positional,omitempty"`
Subcommands []Schema `json:"subcommands,omitempty"`
}
Schema is the JSON shape returned by `loby schema --json`.
type SchemaCmd ¶
type SchemaCmd struct {
Path []string `arg:"" optional:"" help:"Optional command path (e.g. 'postcards create') to scope output."`
}
SchemaCmd implements `loby schema`. It walks the Kong AST so the output always matches the actual command tree — no drift between docs and binary.
type SelfMailerCreateCmd ¶
type SelfMailerCreateCmd struct {
Description string `help:"Internal description."`
To string `help:"Recipient address ID or JSON." required:""`
From string `help:"Sender address ID or JSON."`
Outside string `help:"Outside artwork: HTML/URL/template ID/@file." required:""`
Inside string `help:"Inside artwork: HTML/URL/template ID/@file." required:""`
Size string `help:"Self-mailer size." enum:"6x18_bifold,12x9_bifold,11x9_bifold" default:"6x18_bifold"`
MailingDate string `help:"Scheduled mailing date." name:"mailing-date"`
MailType string `help:"Delivery class." enum:"usps_first_class,usps_standard" default:"usps_first_class" name:"mail-type"`
UseType string `help:"Use type." enum:"marketing,operational" default:"marketing" name:"use-type"`
MergeVariables string `help:"JSON object of template variables (or @file.json)."`
Metadata map[string]string `help:"Metadata key=value pairs."`
}
SelfMailerCreateCmd posts to /v1/self_mailers.
func (*SelfMailerCreateCmd) Run ¶
func (c *SelfMailerCreateCmd) Run(g *Globals) error
Run sends the request.
type SelfMailerGetCmd ¶
type SelfMailerGetCmd struct {
ID string `arg:"" help:"Self-mailer ID (sfm_…)."`
}
SelfMailerGetCmd implements GET /v1/self_mailers/:id.
func (*SelfMailerGetCmd) Run ¶
func (c *SelfMailerGetCmd) Run(g *Globals) error
Run sends the request.
type SelfMailerListCmd ¶
type SelfMailerListCmd struct {
Limit int `help:"Max results (1-100)." default:"10"`
Before string `help:"Pagination cursor before."`
After string `help:"Pagination cursor after."`
IncludeTotal bool `help:"Include total count." name:"include-total"`
}
SelfMailerListCmd implements GET /v1/self_mailers.
func (*SelfMailerListCmd) Run ¶
func (c *SelfMailerListCmd) Run(g *Globals) error
Run sends the request.
type SelfMailersCmd ¶
type SelfMailersCmd struct {
Create SelfMailerCreateCmd `cmd:"" help:"Send a self-mailer."`
Get SelfMailerGetCmd `cmd:"" help:"Retrieve a self-mailer by ID."`
List SelfMailerListCmd `cmd:"" help:"List self-mailers."`
}
SelfMailersCmd implements /v1/self_mailers. Like postcards, self-mailers do not expose a cancel/delete endpoint — they enter the USPS pipeline on create.
type SnapPackCancelCmd ¶
type SnapPackCancelCmd struct {
ID string `arg:"" help:"Snap pack ID."`
Confirm bool `help:"Required for destructive operations." xor:"destructive"`
Force bool `help:"Alias for --confirm." xor:"destructive"`
}
SnapPackCancelCmd implements POST /v1/snap_packs/:id/cancel.
func (*SnapPackCancelCmd) Run ¶
func (c *SnapPackCancelCmd) Run(g *Globals) error
Run sends the request.
type SnapPackCreateCmd ¶
type SnapPackCreateCmd struct {
Description string `help:"Internal description."`
To string `help:"Recipient address ID or JSON." required:""`
From string `help:"Sender address ID or JSON."`
Outside string `help:"Outside artwork (HTML/URL/template/@file)." required:""`
Inside string `help:"Inside artwork (HTML/URL/template/@file)." required:""`
Size string `help:"Snap pack size." enum:"8.5x11" default:"8.5x11"`
Color bool `help:"Print in color." default:"true"`
MailingDate string `help:"Scheduled mailing date." name:"mailing-date"`
MailType string `help:"Delivery class." enum:"usps_first_class" default:"usps_first_class" name:"mail-type"`
UseType string `help:"Use type." enum:"marketing,operational" default:"operational" name:"use-type"`
MergeVariables string `help:"JSON object of template variables."`
Metadata map[string]string `help:"Metadata key=value pairs."`
}
SnapPackCreateCmd posts to /v1/snap_packs.
func (*SnapPackCreateCmd) Run ¶
func (c *SnapPackCreateCmd) Run(g *Globals) error
Run sends the request.
type SnapPackGetCmd ¶
type SnapPackGetCmd struct {
ID string `arg:"" help:"Snap pack ID."`
}
SnapPackGetCmd implements GET /v1/snap_packs/:id.
type SnapPackListCmd ¶
type SnapPackListCmd struct {
Limit int `help:"Max results (1-100)." default:"10"`
Before string `help:"Pagination cursor before."`
After string `help:"Pagination cursor after."`
IncludeTotal bool `help:"Include total count." name:"include-total"`
}
SnapPackListCmd implements GET /v1/snap_packs.
func (*SnapPackListCmd) Run ¶
func (c *SnapPackListCmd) Run(g *Globals) error
Run sends the request.
type SnapPacksCmd ¶
type SnapPacksCmd struct {
Create SnapPackCreateCmd `cmd:"" help:"Send a snap pack."`
Get SnapPackGetCmd `cmd:"" help:"Retrieve a snap pack by ID."`
List SnapPackListCmd `cmd:"" help:"List snap packs."`
Cancel SnapPackCancelCmd `cmd:"" help:"Cancel a snap pack before mailing."`
}
SnapPacksCmd implements /v1/snap_packs.
type Status ¶
type Status struct {
Profile string `json:"profile"`
Source string `json:"source"`
Environment string `json:"environment,omitempty"`
KeyPrefix string `json:"key_prefix,omitempty"`
Configured bool `json:"configured"`
}
Status is the JSON shape of `loby auth status --json`.
type TemplateCreateCmd ¶
type TemplateCreateCmd struct {
Description string `help:"Internal description."`
HTML string `help:"HTML body (or @file.html)." required:"" name:"html"`
Engine string `help:"Template engine." enum:"legacy,handlebars" default:"handlebars"`
Metadata map[string]string `help:"Metadata key=value pairs."`
}
TemplateCreateCmd posts to /v1/templates.
func (*TemplateCreateCmd) Run ¶
func (c *TemplateCreateCmd) Run(g *Globals) error
Run sends the request.
type TemplateDeleteCmd ¶
type TemplateDeleteCmd struct {
ID string `arg:"" help:"Template ID."`
Confirm bool `help:"Required for destructive operations." xor:"destructive"`
Force bool `help:"Alias for --confirm." xor:"destructive"`
}
TemplateDeleteCmd implements DELETE /v1/templates/:id.
func (*TemplateDeleteCmd) Run ¶
func (c *TemplateDeleteCmd) Run(g *Globals) error
Run sends the request.
type TemplateGetCmd ¶
type TemplateGetCmd struct {
ID string `arg:"" help:"Template ID (tmpl_…)."`
}
TemplateGetCmd implements GET /v1/templates/:id.
type TemplateListCmd ¶
type TemplateListCmd struct {
Limit int `help:"Max results." default:"10"`
Before string `help:"Pagination cursor before."`
After string `help:"Pagination cursor after."`
IncludeTotal bool `help:"Include total count." name:"include-total"`
}
TemplateListCmd implements GET /v1/templates.
func (*TemplateListCmd) Run ¶
func (c *TemplateListCmd) Run(g *Globals) error
Run sends the request.
type TemplateUpdateCmd ¶
type TemplateUpdateCmd struct {
ID string `arg:"" help:"Template ID."`
Description string `help:"New description."`
PublishedVersion string `help:"ID of the version to mark as published." name:"published-version"`
Metadata map[string]string `help:"Replace metadata."`
}
TemplateUpdateCmd implements POST /v1/templates/:id.
func (*TemplateUpdateCmd) Run ¶
func (c *TemplateUpdateCmd) Run(g *Globals) error
Run sends the request.
type TemplateVersionCreateCmd ¶
type TemplateVersionCreateCmd struct {
TemplateID string `arg:"" help:"Parent template ID (tmpl_…)."`
Description string `help:"Version description."`
HTML string `help:"HTML body (or @file.html)." required:""`
Engine string `help:"Template engine." enum:"legacy,handlebars" default:"handlebars"`
}
TemplateVersionCreateCmd posts to /v1/templates/:tmpl_id/versions.
func (*TemplateVersionCreateCmd) Run ¶
func (c *TemplateVersionCreateCmd) Run(g *Globals) error
Run sends the request.
type TemplateVersionDeleteCmd ¶
type TemplateVersionDeleteCmd struct {
TemplateID string `arg:"" help:"Parent template ID."`
VersionID string `arg:"" help:"Version ID."`
Confirm bool `help:"Required for destructive operations." xor:"destructive"`
Force bool `help:"Alias for --confirm." xor:"destructive"`
}
TemplateVersionDeleteCmd implements DELETE /v1/templates/:tmpl_id/versions/:id.
func (*TemplateVersionDeleteCmd) Run ¶
func (c *TemplateVersionDeleteCmd) Run(g *Globals) error
Run sends the request.
type TemplateVersionGetCmd ¶
type TemplateVersionGetCmd struct {
TemplateID string `arg:"" help:"Parent template ID."`
VersionID string `arg:"" help:"Version ID (vrsn_…)."`
}
TemplateVersionGetCmd implements GET /v1/templates/:tmpl_id/versions/:id.
func (*TemplateVersionGetCmd) Run ¶
func (c *TemplateVersionGetCmd) Run(g *Globals) error
Run sends the request.
type TemplateVersionListCmd ¶
type TemplateVersionListCmd struct {
TemplateID string `arg:"" help:"Parent template ID."`
Limit int `help:"Max results." default:"10"`
Before string `help:"Pagination cursor before."`
After string `help:"Pagination cursor after."`
IncludeTotal bool `help:"Include total count." name:"include-total"`
}
TemplateVersionListCmd implements GET /v1/templates/:tmpl_id/versions.
func (*TemplateVersionListCmd) Run ¶
func (c *TemplateVersionListCmd) Run(g *Globals) error
Run sends the request.
type TemplateVersionUpdateCmd ¶
type TemplateVersionUpdateCmd struct {
TemplateID string `arg:"" help:"Parent template ID."`
VersionID string `arg:"" help:"Version ID."`
Description string `help:"New description." required:""`
}
TemplateVersionUpdateCmd implements POST /v1/templates/:tmpl_id/versions/:id.
func (*TemplateVersionUpdateCmd) Run ¶
func (c *TemplateVersionUpdateCmd) Run(g *Globals) error
Run sends the request.
type TemplateVersionsCmd ¶
type TemplateVersionsCmd struct {
Create TemplateVersionCreateCmd `cmd:"" help:"Create a new template version (publishes HTML)."`
Get TemplateVersionGetCmd `cmd:"" help:"Retrieve a template version."`
List TemplateVersionListCmd `cmd:"" help:"List template versions."`
Update TemplateVersionUpdateCmd `cmd:"" help:"Update a template version's description."`
Delete TemplateVersionDeleteCmd `cmd:"" help:"Delete a template version."`
}
TemplateVersionsCmd groups template-version operations.
type TemplatesCmd ¶
type TemplatesCmd struct {
Create TemplateCreateCmd `cmd:"" help:"Create a template (HTML stored at Lob with merge variables)."`
Get TemplateGetCmd `cmd:"" help:"Retrieve a template."`
List TemplateListCmd `cmd:"" help:"List templates."`
Update TemplateUpdateCmd `cmd:"" help:"Update a template's description or metadata."`
Delete TemplateDeleteCmd `cmd:"" help:"Delete a template."`
Versions TemplateVersionsCmd `cmd:"" help:"Manage template versions."`
}
TemplatesCmd implements /v1/templates.
type USAutocompleteCmd ¶
type USAutocompleteCmd struct {
Prefix []string `arg:"" help:"Partial street address prefix."`
City string `help:"Optional city filter."`
State string `help:"Optional state filter."`
Zip string `help:"Optional ZIP filter."`
GeoIPSort bool `help:"Bias suggestions by client IP."`
Case string `help:"Case transformation." enum:"upper,proper,default" default:"default"`
}
USAutocompleteCmd suggests completions for a partial US address.
func (*USAutocompleteCmd) Run ¶
func (c *USAutocompleteCmd) Run(g *Globals) error
Run sends the request.
type USVerifyCmd ¶
type USVerifyCmd struct {
Address []string `arg:"" optional:"" help:"Single-line address (e.g. \"185 Berry St, San Francisco, CA 94107\")."`
Recipient string `help:"Recipient name."`
Primary string `help:"Primary line (street)."`
Secondary string `help:"Secondary line (apt/suite)."`
City string `help:"City."`
State string `help:"State."`
Zip string `help:"ZIP code."`
Case string `help:"Case transformation." enum:"upper,proper,default" default:"default"`
}
USVerifyCmd verifies a US address. Accepts either a single-line address positional or structured flags.
type UploadCreateCmd ¶
type UploadCreateCmd struct {
CampaignID string `help:"Campaign ID (cmp_…)." required:"" name:"campaign-id"`
ColumnMapping string `help:"Column mapping JSON (or @file.json)." name:"column-mapping"`
Metadata map[string]string `help:"Metadata key=value pairs."`
RequiredAddressColumn string `help:"Required address column name." name:"required-address-column"`
}
UploadCreateCmd posts to /v1/uploads.
func (*UploadCreateCmd) Run ¶
func (c *UploadCreateCmd) Run(g *Globals) error
Run sends the request.
type UploadDeleteCmd ¶
type UploadDeleteCmd struct {
ID string `arg:"" help:"Upload ID."`
Confirm bool `help:"Required for destructive operations." xor:"destructive"`
Force bool `help:"Alias for --confirm." xor:"destructive"`
}
UploadDeleteCmd implements DELETE /v1/uploads/:id.
func (*UploadDeleteCmd) Run ¶
func (c *UploadDeleteCmd) Run(g *Globals) error
Run sends the request.
type UploadExportCreateCmd ¶
type UploadExportCreateCmd struct {
ID string `arg:"" help:"Upload ID."`
Type string `help:"Export type." enum:"failures,all" default:"failures"`
}
UploadExportCreateCmd implements POST /v1/uploads/:id/exports.
func (*UploadExportCreateCmd) Run ¶
func (c *UploadExportCreateCmd) Run(g *Globals) error
Run sends the request.
type UploadExportGetCmd ¶
type UploadExportGetCmd struct {
ID string `arg:"" help:"Upload ID."`
ExportID string `arg:"" help:"Export job ID."`
}
UploadExportGetCmd implements GET /v1/uploads/:id/exports/:ex_id.
func (*UploadExportGetCmd) Run ¶
func (c *UploadExportGetCmd) Run(g *Globals) error
Run sends the request.
type UploadExportsCmd ¶
type UploadExportsCmd struct {
Create UploadExportCreateCmd `cmd:"" help:"Create an export job for an upload."`
Get UploadExportGetCmd `cmd:"" help:"Retrieve a specific export job."`
}
UploadExportsCmd manages export jobs that produce row-by-row error reports. Lob exposes only create + get on this sub-resource; no list endpoint exists.
type UploadFileCmd ¶
type UploadFileCmd struct {
ID string `arg:"" help:"Upload ID."`
Path string `arg:"" help:"Path to CSV file."`
}
UploadFileCmd posts a CSV file to POST /v1/uploads/:id/file (multipart).
func (*UploadFileCmd) Run ¶
func (c *UploadFileCmd) Run(g *Globals) error
Run sends the multipart request.
type UploadGetCmd ¶
type UploadGetCmd struct {
ID string `arg:"" help:"Upload ID."`
}
UploadGetCmd implements GET /v1/uploads/:id. The response includes the processing status as a field; agents should poll Get rather than relying on a separate /status endpoint (Lob does not expose one).
type UploadListCmd ¶
type UploadListCmd struct {
CampaignID string `help:"Filter by campaign ID." name:"campaign-id"`
}
UploadListCmd implements GET /v1/uploads. The endpoint only accepts a campaignId filter — Lob rejects pagination params with HTTP 400.
func (*UploadListCmd) Run ¶
func (c *UploadListCmd) Run(g *Globals) error
Run sends the request. Note: /uploads returns a bare JSON array, not Lob's usual {data:[…]} envelope — hence the []map[string]any rather than List.
type UploadReportCmd ¶
type UploadReportCmd struct {
ID string `arg:"" help:"Upload ID."`
Status string `help:"Filter by line-item status." enum:"Validated,Failed,Processing,${none}" default:"${none}"`
Limit int `help:"Max rows (1-100)." default:"100"`
Offset int `help:"Pagination offset."`
}
UploadReportCmd implements GET /v1/uploads/:id/report. The endpoint is feature-flagged by Lob — agents may see 404 until enabled on their account.
func (*UploadReportCmd) Run ¶
func (c *UploadReportCmd) Run(g *Globals) error
Run sends the request.
type UploadsCmd ¶
type UploadsCmd struct {
Create UploadCreateCmd `cmd:"" help:"Create an upload metadata record for a campaign."`
File UploadFileCmd `cmd:"" help:"Upload a CSV file to an existing upload record."`
Get UploadGetCmd `cmd:"" help:"Retrieve an upload (status is in the response body)."`
List UploadListCmd `cmd:"" help:"List uploads."`
Delete UploadDeleteCmd `cmd:"" help:"Delete an upload."`
Exports UploadExportsCmd `cmd:"" help:"Manage upload export jobs (failed-row reports)."`
Report UploadReportCmd `cmd:"" help:"Retrieve the line-item report for an upload (feature-flagged)."`
}
UploadsCmd implements /v1/uploads — CSV file uploads for campaigns plus the exports/report sub-resources that surface row-level processing results.
type VerifyCmd ¶
type VerifyCmd struct {
US VerifyUSCmd `cmd:"" help:"Verify a US address."`
Intl VerifyIntlCmd `cmd:"" help:"Verify an international address."`
}
VerifyCmd is the top-level verification namespace. Mirrors `loby addresses verify` for discoverability but accepts country routing via subcommands.
type VerifyIntlCmd ¶
type VerifyIntlCmd struct {
Address []string `arg:"" optional:"" help:"Single-line address."`
Recipient string `help:"Recipient name."`
Primary string `help:"Primary line."`
Secondary string `help:"Secondary line."`
City string `help:"City."`
State string `help:"State / province / region."`
Postal string `help:"Postal code."`
Country string `help:"Two-letter ISO country code." required:""`
}
VerifyIntlCmd verifies an international address.
type VerifyUSCmd ¶
type VerifyUSCmd struct {
USVerifyCmd
}
VerifyUSCmd is the longer form of `loby addresses verify`.
func (*VerifyUSCmd) Run ¶
func (c *VerifyUSCmd) Run(g *Globals) error
Run delegates to the addresses verify implementation.
type VersionCmd ¶
type VersionCmd struct{}
VersionCmd implements `loby version`.
func (*VersionCmd) Run ¶
func (c *VersionCmd) Run(g *Globals) error
Run prints the build info, either as a one-line summary (human) or as JSON.
Source Files
¶
- accounts.go
- addresses.go
- arg_parsers.go
- auth.go
- bank_accounts.go
- billing_groups.go
- booklets.go
- buckslips.go
- bulk.go
- campaigns.go
- cards.go
- checks.go
- client.go
- completion.go
- creatives.go
- crud.go
- errors.go
- events.go
- exit_codes.go
- globals.go
- letters.go
- multipart.go
- postcards.go
- root.go
- run.go
- schema.go
- self_mailers.go
- snap_packs.go
- stream.go
- templates.go
- uploads.go
- util_misc.go
- utilities.go
- verify.go
- version.go