street

package
v1.13.8 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2021 License: Apache-2.0 Imports: 8 Imported by: 2

Documentation

Index

Constants

View Source
const (
	MatchStrict   = MatchStrategy("strict")
	MatchRange    = MatchStrategy("range") // Deprecated
	MatchInvalid  = MatchStrategy("invalid")
	MatchEnhanced = MatchStrategy("enhanced")
)
View Source
const MaxBatchSize = 100

Variables

This section is empty.

Functions

This section is empty.

Types

type Analysis

type Analysis struct {
	DPVMatchCode      string `json:"dpv_match_code,omitempty"`
	DPVFootnotes      string `json:"dpv_footnotes,omitempty"`
	DPVCMRACode       string `json:"dpv_cmra,omitempty"`
	DPVVacantCode     string `json:"dpv_vacant,omitempty"`
	DPVNoStat         string `json:"dpv_no_stat,omitempty"`
	Active            string `json:"active,omitempty"`
	Footnotes         string `json:"footnotes,omitempty"` // https://smartystreets.com/docs/us-street-api#footnotes
	LACSLinkCode      string `json:"lacslink_code,omitempty"`
	LACSLinkIndicator string `json:"lacslink_indicator,omitempty"`
	SuiteLinkMatch    bool   `json:"suitelink_match,omitempty"`
	EWSMatch          bool   `json:"ews_match,omitempty"`      // deprecated
	EnhancedMatch     string `json:"enhanced_match,omitempty"` //v2 integration
}

Analysis contains all output fields defined here: https://smartystreets.com/docs/us-street-api#analysis

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 NewBatch

func NewBatch() *Batch

NewBatch creates a new, empty batch.

func (*Batch) Append

func (b *Batch) Append(record *Lookup) bool

Append includes the record in the collection to be sent if there is still room (max: 100).

func (*Batch) Clear

func (b *Batch) Clear()

Clear clears the internal collection.

func (*Batch) IsFull

func (b *Batch) IsFull() bool

IsFull returns true when the batch has 100 lookups, false in every other case.

func (*Batch) Length

func (b *Batch) Length() int

Length returns

func (*Batch) Records

func (b *Batch) Records() []*Lookup

Records returns the internal records collection.

type Candidate

type Candidate struct {
	InputID              string     `json:"input_id,omitempty"`
	InputIndex           int        `json:"input_index"`
	CandidateIndex       int        `json:"candidate_index"`
	Addressee            string     `json:"addressee,omitempty"`
	DeliveryLine1        string     `json:"delivery_line_1,omitempty"`
	DeliveryLine2        string     `json:"delivery_line_2,omitempty"`
	LastLine             string     `json:"last_line,omitempty"`
	DeliveryPointBarcode string     `json:"delivery_point_barcode,omitempty"`
	Components           Components `json:"components,omitempty"`
	Metadata             Metadata   `json:"metadata,omitempty"`
	Analysis             Analysis   `json:"analysis,omitempty"`
}

Candidate contains all output fields defined here: https://smartystreets.com/docs/us-street-api#http-response-output

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is responsible for sending batches of addresses to the us-street-api.

func NewClient

func NewClient(sender sdk.RequestSender) *Client

NewClient creates a client with the provided sender.

func (*Client) SendBatch

func (c *Client) SendBatch(batch *Batch) error

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 (c *Client) SendBatchWithContext(ctx context.Context, batch *Batch) error

func (*Client) SendFromChannel

func (c *Client) SendFromChannel(input, output chan *Lookup) error

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

func (c *Client) SendLookups(lookups ...*Lookup) error

SendLookups is a high-level convenience function that leverages an internal reusable Batch to send all lookups provided in serial, blocking fashion.

type Components

type Components struct {
	PrimaryNumber            string `json:"primary_number,omitempty"`
	StreetPredirection       string `json:"street_predirection,omitempty"`
	StreetName               string `json:"street_name,omitempty"`
	StreetPostdirection      string `json:"street_postdirection,omitempty"`
	StreetSuffix             string `json:"street_suffix,omitempty"`
	SecondaryNumber          string `json:"secondary_number,omitempty"`
	SecondaryDesignator      string `json:"secondary_designator,omitempty"`
	ExtraSecondaryNumber     string `json:"extra_secondary_number,omitempty"`
	ExtraSecondaryDesignator string `json:"extra_secondary_designator,omitempty"`
	PMBNumber                string `json:"pmb_number,omitempty"`
	PMBDesignator            string `json:"pmb_designator,omitempty"`
	CityName                 string `json:"city_name,omitempty"`
	DefaultCityName          string `json:"default_city_name,omitempty"`
	StateAbbreviation        string `json:"state_abbreviation,omitempty"`
	ZIPCode                  string `json:"zipcode,omitempty"`
	Plus4Code                string `json:"plus4_code,omitempty"`
	DeliveryPoint            string `json:"delivery_point,omitempty"`
	DeliveryPointCheckDigit  string `json:"delivery_point_check_digit,omitempty"`
	Urbanization             string `json:"urbanization,omitempty"`
}

Components contains all output fields defined here: https://smartystreets.com/docs/us-street-api#components

type Lookup

type Lookup struct {
	Street        string        `json:"street,omitempty"`
	Street2       string        `json:"street2,omitempty"`
	Secondary     string        `json:"secondary,omitempty"`
	City          string        `json:"city,omitempty"`
	State         string        `json:"state,omitempty"`
	ZIPCode       string        `json:"zipcode,omitempty"`
	LastLine      string        `json:"lastline,omitempty"`
	Addressee     string        `json:"addressee,omitempty"`
	Urbanization  string        `json:"urbanization,omitempty"`
	InputID       string        `json:"input_id,omitempty"`
	MaxCandidates int           `json:"candidates,omitempty"` // Default value: 1
	MatchStrategy MatchStrategy `json:"match,omitempty"`

	Results []*Candidate `json:"results,omitempty"`
}

Lookup contains all input fields defined here: https://smartystreets.com/docs/us-street-api#input-fields

type MatchStrategy

type MatchStrategy string

type Metadata

type Metadata struct {
	RecordType               string                `json:"record_type,omitempty"`
	ZIPType                  string                `json:"zip_type,omitempty"`
	CountyFIPS               string                `json:"county_fips,omitempty"`
	CountyName               string                `json:"county_name,omitempty"`
	CarrierRoute             string                `json:"carrier_route,omitempty"`
	CongressionalDistrict    string                `json:"congressional_district,omitempty"`
	BuildingDefaultIndicator string                `json:"building_default_indicator,omitempty"`
	RDI                      string                `json:"rdi,omitempty"`
	ELOTSequence             string                `json:"elot_sequence,omitempty"`
	ELOTSort                 string                `json:"elot_sort,omitempty"`
	Latitude                 float64               `json:"latitude,omitempty"`
	Longitude                float64               `json:"longitude,omitempty"`
	CoordinateLicense        sdk.CoordinateLicense `json:"coordinate_license,omitempty"`
	Precision                string                `json:"precision,omitempty"`
	TimeZone                 string                `json:"time_zone,omitempty"`
	UTCOffset                float32               `json:"utc_offset,omitempty"`
	DST                      bool                  `json:"dst,omitempty"`
	EWSMatch                 bool                  `json:"ews_match,omitempty"`
}

Metadata contains all output fields defined here: https://smartystreets.com/docs/us-street-api#metadata

Jump to

Keyboard shortcuts

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