twilio

package
v0.4.10 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LookupEndpoint = "https://lookups.twilio.com/v1/PhoneNumbers/"
)

Variables

View Source
var (
	EnvTwilioAccountSid = "TWILIO_ACCOUNT_SID"
	EnvTwilioAuthToken  = "TWILIO_AUTH_TOKEN" // #nosec G101
)
View Source
var MultiLimit = 0 // test limit to gracefully exit process early.

Functions

This section is empty.

Types

type Carrier

type Carrier struct {
	MobileCountryCode string `json:"mobile_country_code,omitempty"`
	MobileNetworkCode string `json:"mobile_network_code,omitempty"`
	Name              string `json:"name,omitempty"`
	Type              string `json:"type,omitempty"`
	ErrorCode         string `json:"error_code,omitempty"`
}

func (*Carrier) Canonical added in v0.2.0

func (car *Carrier) Canonical() gophonenumbers.CarrierNumberInfo

type Client

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

func NewClient

func NewClient(accountSid, authToken string) (*Client, error)

func (*Client) Validate

func (c *Client) Validate(number string, opts *Params) (NumberInfo, error)

type MultiResults

type MultiResults struct {
	CountsByStatusCode map[string]int
	Responses          map[string]*NumberInfo
}

MultiResults is designed to handle large volumes of requests.

func GetWriteValidationMulti

func GetWriteValidationMulti(client *Client, requestNumbers, skipNumbers []string, filenameBase string, logAt, fileAt uint) MultiResults

func NewMultiResults

func NewMultiResults() MultiResults

func NewMultiResultsFiles

func NewMultiResultsFiles(dir string, rxPattern string) (MultiResults, error)

func (*MultiResults) AddResponses

func (mr *MultiResults) AddResponses(resps map[string]*NumberInfo)

func (*MultiResults) Canonical added in v0.2.0

func (mr *MultiResults) Canonical() (gophonenumbers.NumberSet, error)

func (*MultiResults) GetNumberInfo added in v0.0.2

func (mr *MultiResults) GetNumberInfo(e164Number string) (*NumberInfo, error)

func (*MultiResults) Inflate

func (mr *MultiResults) Inflate()

func (*MultiResults) NumbersSuccess

func (mr *MultiResults) NumbersSuccess() []string

func (*MultiResults) Write

func (mr *MultiResults) Write(filename string) error

type NumberInfo

type NumberInfo struct {
	CallerName      map[string]string         `json:"caller_name,omitempty"`
	CountryCode     string                    `json:"country_code,omitempty"`
	PhoneNumber     string                    `json:"phone_number,omitempty"`
	NationalFormat  string                    `json:"national_format,omitempty"`
	URL             string                    `json:"url,omitempty"`
	Carrier         Carrier                   `json:"carrier,omitempty"`
	APIResponseInfo httputilmore.ResponseInfo `json:"api_response_info,omitempty"`
}

func (*NumberInfo) Canonical added in v0.2.0

func (num *NumberInfo) Canonical() (gophonenumbers.Number, error)

type Params

type Params struct {
	CountryCode string
	Type        string
}

Params represents optional parameters. Use "Type=carrier" for carrier info and "Type=caller-name" for caller name.

func (*Params) Encode

func (p *Params) Encode() string

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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