street

package
v1.29.0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2026 License: Apache-2.0 Imports: 8 Imported by: 4

Documentation

Index

Constants

View Source
const (
	MatchStrict   = MatchStrategy("strict")
	MatchInvalid  = MatchStrategy("invalid")
	MatchEnhanced = MatchStrategy("enhanced")
)
View Source
const (
	FormatDefault    = OutputFormat("default")
	FormatProjectUSA = OutputFormat("project-usa")
)
View Source
const (
	PostalCounty     = CountySource("postal")
	GeographicCounty = CountySource("geographic")
)
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
	Components        ComponentAnalysis `json:"components,omitempty"`
}

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"`
	SmartyKey            string     `json:"smarty_key,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) SendBatchWithContextAndAuth added in v1.28.0

func (c *Client) SendBatchWithContextAndAuth(ctx context.Context, batch *Batch, authID, authToken string) error

SendBatchWithContextAndAuth sends a batch of lookups with the provided context and per-request credentials. If authID and authToken are both non-empty, they will be used for this request instead of the client-level credentials. This is useful for multi-tenant scenarios where different requests require different credentials.

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 ComponentAnalysis added in v1.26.0

type ComponentAnalysis struct {
	PrimaryNumber            MatchInfo `json:"primary_number,omitempty"`
	StreetPredirection       MatchInfo `json:"street_predirection,omitempty"`
	StreetName               MatchInfo `json:"street_name,omitempty"`
	StreetPostdirection      MatchInfo `json:"street_postdirection,omitempty"`
	StreetSuffix             MatchInfo `json:"street_suffix,omitempty"`
	SecondaryNumber          MatchInfo `json:"secondary_number,omitempty"`
	SecondaryDesignator      MatchInfo `json:"secondary_designator,omitempty"`
	ExtraSecondaryNumber     MatchInfo `json:"extra_secondary_number,omitempty"`
	ExtraSecondaryDesignator MatchInfo `json:"extra_secondary_designator,omitempty"`
	CityName                 MatchInfo `json:"city_name,omitempty"`
	StateAbbreviation        MatchInfo `json:"state_abbreviation,omitempty"`
	ZIPCode                  MatchInfo `json:"zipcode,omitempty"`
	Plus4Code                MatchInfo `json:"plus4_code,omitempty"`
	Urbanization             MatchInfo `json:"urbanization,omitempty"`
}

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 CountySource added in v1.21.0

type CountySource string

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"`
	OutputFormat     OutputFormat      `json:"format,omitempty"`
	CountySource     CountySource      `json:"county_source,omitempty"`
	CustomParameters map[string]string `json:"custom_parameters,omitempty"`

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

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

func (*Lookup) AddCustomParameter added in v1.24.0

func (l *Lookup) AddCustomParameter(name, value string)

type MatchInfo added in v1.26.0

type MatchInfo struct {
	Status string   `json:"status,omitempty"`
	Change []string `json:"change,omitempty"`
}

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

type OutputFormat added in v1.17.2

type OutputFormat string

Jump to

Keyboard shortcuts

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