extract

package
v1.9.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is responsible for sending requests to the us-extract-api.

func NewClient

func NewClient(sender sdk.RequestSender) *Client

NewClient creates a client with the provided sender.

func (*Client) SendLookup

func (c *Client) SendLookup(lookup *Lookup) error

SendBatch sends the batch of inputs, populating the output for each input if the batch was successful.

func (*Client) SendLookupWithContext added in v1.5.0

func (c *Client) SendLookupWithContext(ctx context.Context, lookup *Lookup) error

type ExtractedAddress

type ExtractedAddress struct {
	Text      string             `json:"text"`
	Verified  bool               `json:"verified"`
	Line      int                `json:"line"`
	Start     int                `json:"start"`
	End       int                `json:"end"`
	APIOutput []street.Candidate `json:"api_output"`
}

type HTMLPayload

type HTMLPayload string
const (
	HTMLUnspecified HTMLPayload = ""      // Indicates that the server may decide if Lookup.Text is HTML or not.
	HTMLYes         HTMLPayload = "true"  // Indicates that the Lookup.Text is known to be HTML.
	HTMLNo          HTMLPayload = "false" // Indicates that the Lookup.Text is known to NOT be HTML.
)

type Lookup

type Lookup struct {
	Text string

	HTML                    HTMLPayload
	Aggressive              bool
	AddressesWithLineBreaks bool
	AddressesPerLine        int

	Result *Result
}

Lookup represents all input fields documented here: https://smartystreets.com/docs/cloud/us-extract-api#http-request-input-fields

type Metadata

type Metadata struct {
	Lines                   int  `json:"lines"`
	Characters              int  `json:"character_count"`
	Bytes                   int  `json:"bytes"`
	Addresses               int  `json:"address_count"`
	VerifiedAddresses       int  `json:"verified_count"`
	ContainsNonASCIIUnicode bool `json:"unicode"`
}

type Result

type Result struct {
	Metadata  Metadata           `json:"meta"`
	Addresses []ExtractedAddress `json:"addresses"`
}

Result, Metadata, and ExtractedAddress represent all output fields documented here: https://smartystreets.com/docs/cloud/us-extract-api#http-response

Jump to

Keyboard shortcuts

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