Documentation
¶
Index ¶
- Constants
- Variables
- func NewFakeLob() *fakeLob
- func NewLob(baseAPI, apiKey, userAgent string) *lob
- type Address
- type BankAccount
- type CancelCheckResponse
- type Check
- type CreateBankAccountRequest
- type CreateCheckRequest
- type Error
- type ListAddressesResponse
- type ListBankAccountsResponse
- type ListChecksResponse
- type Lob
- type NamedObject
- type NamedObjectList
- type Tracking
- type USAddressComponents
- type USAddressDeliverabilityAnalysis
- type USAddressVerificationRequest
- type USAddressVerificationResponse
Constants ¶
const ( MailTypeUspsFirstClass = "usps_first_class" MailTypeUpsNextDayAir = "ups_next_day_air" )
Mail types that lob supports.
const ( BaseAPI = "https://api.lob.com/v1/" APIVersion = "2019-06-01" )
Base URL and API version for Lob.
Variables ¶
var Non200Error = errors.New("Non-200 Status code returned")
Functions ¶
func NewFakeLob ¶
func NewFakeLob() *fakeLob
Types ¶
type Address ¶
type Address struct { Error *Error `json:"error"` AddressCity *string `json:"address_city"` AddressCountry *string `json:"address_country"` AddressLine1 string `json:"address_line1"` AddressLine2 *string `json:"address_line2"` AddressState *string `json:"address_state"` AddressZip *string `json:"address_zip"` Company *string `json:"company"` DateCreated string `json:"date_created"` DateModified string `json:"date_modified"` Deleted *bool `json:"deleted"` Description *string `json:"description"` Email *string `json:"email"` ID string `json:"id"` Metadata map[string]string `json:"metadata"` Name *string `json:"name"` Object string `json:"object"` Phone *string `json:"phone"` }
Address represents an address stored in the Lob's system.
type BankAccount ¶
type BankAccount struct { Error *Error `json:"error"` AccountNumber string `json:"account_number"` BankName string `json:"bank_name"` DateCreated string `json:"date_created"` DateModified string `json:"date_modified"` Description *string `json:"description"` ID string `json:"id"` Metadata map[string]string `json:"metadata"` Object string `json:"object"` RoutingNumber string `json:"routing_number"` Signatory string `json:"signatory"` Verified bool `json:"verified"` }
BankAccount represents a bank account in lob's system.
type CancelCheckResponse ¶
type Check ¶
type Check struct { Error *Error `json:"error"` Amount float64 `json:"amount"` BankAccount *BankAccount `json:"bank_account"` CheckBottom *string `json:"check_bottom"` CheckNumber int `json:"check_number"` Data map[string]string `json:"data"` DateCreated string `json:"date_created"` DateModified string `json:"date_modified"` Description string `json:"description"` ExpectedDeliveryDate string `json:"expected_delivery_date"` SendDate time.Time `json:"send_date"` From *Address `json:"from"` ID string `json:"id"` Logo *string `json:"logo"` MailType *string `json:"mail_type"` Memo string `json:"memo"` Message *string `json:"message"` Metadata map[string]string `json:"metadata"` Name string `json:"name"` Object string `json:"object"` Thumbnails []map[string]string `json:"thumbnails"` To *Address `json:"to"` Tracking *Tracking `json:"tracking"` URL string `json:"url"` }
Check represents a printed check in Lob's system.
type CreateBankAccountRequest ¶
type CreateBankAccountRequest struct { Description *string `json:"description"` RoutingNumber string `json:"routing_number"` AccountNumber string `json:"account_number"` Signatory string `json:"signatory"` AccountType string `json:"account_type"` Metadata map[string]string `json:"metadata"` }
CreateBankAccountRequest request has the parameters needed to submit a bank account creation request to Lob.
type CreateCheckRequest ¶
type CreateCheckRequest struct { Amount float64 `json:"amount"` BankAccountID string `json:"bank_account"` CheckBottom *string `json:"check_bottom"` // 400 chars, at bottom (cannot use with message) CheckNumber *string `json:"check_number"` Data map[string]string `json:"data"` Description *string `json:"description"` FromAddressID string `json:"from"` Logo *string `json:"logo"` // url or multiform. Square, RGB / CMYK, >= 100x100, transparent bg, PNG or JPEG, and will be grayscaled MailType *string `json:"mail_type"` Memo *string `json:"memo"` // 40 chars in memo line Message *string `json:"message"` // 400 chars, at top (cannot use with check_bottom) ToAddressID string `json:"to"` }
CreateCheckRequest specifies options for creating a check.
type ListAddressesResponse ¶
type ListAddressesResponse struct { Data []Address `json:"data"` Object string `json:"object"` NextURL string `json:"next_url"` PreviousURL string `json:"previous_url"` Count int `json:"count"` }
ListAddressesResponse gives the results for listing all addresses for our account.
type ListBankAccountsResponse ¶
type ListBankAccountsResponse struct { Data []BankAccount `json:"data"` Object string `json:"object"` NextURL string `json:"next_url"` PreviousURL string `json:"previous_url"` Count int `json:"count"` }
ListBankAccountsResponse gives the results for listing all addresses for our account.
type ListChecksResponse ¶
type ListChecksResponse struct { Data []Check `json:"data"` Object string `json:"object"` NextURL string `json:"next_url"` PreviousURL string `json:"previous_url"` Count int `json:"count"` }
ListChecksResponse details all of the checks we've ever mailed and printed.
type Lob ¶
type Lob interface { // Checks CreateCheck(*CreateCheckRequest) (*Check, error) GetCheck(string) (*Check, error) CancelCheck(string) (*CancelCheckResponse, error) ListChecks(int) (*ListChecksResponse, error) // Addresses CreateAddress(*Address) (*Address, error) GetAddress(string) (*Address, error) DeleteAddress(string) error ListAddresses(int) (*ListAddressesResponse, error) VerifyUSAddress(*Address) (*USAddressVerificationResponse, error) // NamedObject GetStates() (*NamedObjectList, error) GetCountries() (*NamedObjectList, error) // Bank Accounts CreateBankAccount(*CreateBankAccountRequest) (*BankAccount, error) GetBankAccount(string) (*BankAccount, error) ListBankAccounts(int) (*ListBankAccountsResponse, error) }
type NamedObject ¶
type NamedObject struct { ID string `json:"id"` Name string `json:"name"` ShortName string `json:"short_name"` Object string `json:"object"` }
NamedObject is a datum that contains a name and short name for a state or country.
type NamedObjectList ¶
type NamedObjectList struct { Object string `json:"object"` Data []NamedObject `json:"data"` }
NamedObjectList is used to return the list of countries and states.
type Tracking ¶
type Tracking struct { Carrier string `json:"carrier"` Events []interface{} `json:"events"` ID string `json:"id"` Link *string `json:"link"` Object string `json:"object"` TrackingNumber string `json:"tracking_number"` }
Tracking provides information on shipment tracking for a check.
type USAddressComponents ¶
type USAddressComponents struct { PrimaryNumber string `json:"primary_number"` StreetPredirection string `json:"street_predirection"` StreetName string `json:"street_name"` StreetSuffix string `json:"street_suffix"` StreetPostdirection string `json:"street_postdirection"` SecondaryDesignator string `json:"secondary_designator"` SecondaryNumber string `json:"secondary_number"` PmbDesignator string `json:"pmb_designator"` PmbNumber string `json:"pmb_number"` ExtraSecondary_designator string `json:"extra_secondary_designator"` ExtraSecondary_number string `json:"extra_secondary_number"` City string `json:"city"` State string `json:"state"` ZipCode string `json:"zip_code"` ZipCodePlus_4 string `json:"zip_code_plus_4"` ZipCodeType string `json:"zip_code_type"` DeliveryPoint_barcode string `json:"delivery_point_barcode"` AddressType string `json:"address_type"` RecordType string `json:"record_type"` DefaultBuildingAddress bool `json:"default_building_address"` County string `json:"county"` CountyFips string `json:"county_fips"` CarrierRoute string `json:"carrier_route"` CarrierRouteType string `json:"carrier_route_type"` Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` }
type USAddressDeliverabilityAnalysis ¶
type USAddressDeliverabilityAnalysis struct { DpvConfirmation string `json:"dpv_confirmation"` DpvCmra string `json:"dpv_cmra"` DpvVacant string `json:"dpv_vacant"` DpvFootnotes []string `json:"dpv_footnotes"` EwsMatch bool `json:"ews_match"` LacsIndicator string `json:"lacs_indicator"` LacsReturnCode string `json:"lacs_return_code"` SuiteReturnCode string `json:"suite_return_code"` }
type USAddressVerificationRequest ¶
type USAddressVerificationRequest struct { Recipient *string `json:"recipient"` AddressLine1 *string `json:"primary_line"` AddressLine2 *string `json:"secondary_line"` AddressCity *string `json:"city"` AddressState *string `json:"state"` AddressZip *string `json:"zip_code"` }
AddressVerificationRequest validates the given subset of info from an address.
type USAddressVerificationResponse ¶
type USAddressVerificationResponse struct { Id string `json:"id"` Recipient string `json:"recipient"` PrimaryLine string `json:"primary_line"` SecondaryLine string `json:"secondary_line"` Urbanization string `json:"urbanization,omitempty"` LastLine string `json:"last_line"` Deliverability string `json:"deliverability"` Components USAddressComponents `json:"components"` DeliverabilityAnalysis USAddressDeliverabilityAnalysis `json:"deliverability_analysis"` Object string `json:"object"` }
USAddressVerificationResponse gives the response from attempting to verify a US address.