Documentation ¶
Index ¶
Constants ¶
const MaxBatchSize = 100
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Batch ¶
type Batch struct {
// contains filtered or unexported fields
}
Batch stores input records and settings related to a group of addresses to be verified in a batch.
func (*Batch) Append ¶
Append includes the record in the collection to be sent if there is still room (max: 100).
type CityState ¶
type CityState struct { City string `json:"city"` MailableCity bool `json:"mailable_city"` StateAbbreviation string `json:"state_abbreviation"` State string `json:"state"` }
CityState contains all output fields defined here: https://smartystreets.com/docs/us-zipcode-api#cities
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is responsible for sending batches of addresses to the us-zipcode-api.
func NewClient ¶
func NewClient(sender sdk.RequestSender) *Client
NewClient creates a client with the provided sender.
func (*Client) SendBatch ¶
SendBatch sends the batch of inputs, populating the output for each input if the batch was successful.
func (*Client) SendBatchWithContext ¶ added in v1.5.0
func (*Client) SendFromChannel ¶
SendFromChannel is a high-level convenience function that leverages an internal reusable Batch to send everything received from the provided input channel in serial, blocking fashion. The same lookups are sent on the output channel as they are processed. Whereas it is the caller's job to close the input channel when all inputs have been sent, the output channel will be closed for the caller.
func (*Client) SendLookups ¶
SendLookups is a high-level convenience function that leverages an internal reusable Batch to send all lookups provided in serial, blocking fashion.
type Lookup ¶
type Lookup struct { City string `json:"city,omitempty"` State string `json:"state,omitempty"` ZIPCode string `json:"zipcode,omitempty"` InputID string `json:"input_id,omitempty"` Result *Result `json:"-"` }
Lookup contains all input fields defined here: https://smartystreets.com/docs/us-zipcode-api#input-fields
type Result ¶
type Result struct { InputID string `json:"input_id,omitempty"` InputIndex int `json:"input_index"` Status string `json:"status"` Reason string `json:"reason"` CityStates []CityState `json:"city_states"` ZIPCodes []ZIPCode `json:"zipcodes"` }
Result contains all output fields defined here: https://smartystreets.com/docs/us-zipcode-api#http-response-output
type ZIPCode ¶
type ZIPCode struct { County ZIPCode string `json:"zipcode"` ZIPCodeType string `json:"zipcode_type"` DefaultCity string `json:"default_city"` Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` Precision string `json:"precision"` AlternateCounties []County `json:"alternate_counties"` }
ZIPCode contains all output fields defined here: https://smartystreets.com/docs/us-zipcode-api#zipcodes