Documentation
¶
Index ¶
- func NewError(code, message string) error
- func NewResponseError(status int, code, message string) error
- type APIUsage
- type Client
- type ETag
- type Error
- type GeoLocation
- type GeoLocationOptions
- type IPCurrency
- type IPLanguage
- type IPLocation
- type IPSecurity
- type IPTimezone
- type Logger
- type Mail
- type MailMessage
- func (m *MailMessage) AddAttachment(fileName string)
- func (m *MailMessage) AddBcc(bcc ...string)
- func (m *MailMessage) AddCc(cc ...string)
- func (m *MailMessage) AddTag(tag string)
- func (m *MailMessage) SetClickTracking(flag bool)
- func (m *MailMessage) SetHTML(html string)
- func (m *MailMessage) SetOpenTracking(flag bool)
- func (m *MailMessage) SetPlainTextClickTracking(flag bool)
- func (m *MailMessage) SetReplyTo(recipient string)
- func (m *MailMessage) SetRequireTLS(flag bool)
- func (m *MailMessage) SetTestMode(flag bool)
- func (m *MailMessage) SetUnsubscribeTracking(flag bool)
- func (m *MailMessage) SetVerifyCertificate(flag bool)
- func (m *MailMessage) ToParameters() *Parameters
- type MailReceipt
- type Parameters
- type Response
- type Usage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewResponseError ¶
NewResponseError creates a new API response error.
Types ¶
type APIUsage ¶
type APIUsage struct {
GeoLocationRequests int `json:"geoip_requests,omitempty" xml:"geoip_requests,omitempty"`
MailRequests int `json:"mail_requests,omitempty" xml:"mail_requests,omitempty"`
}
APIUsage model
type Client ¶
type Client struct {
// Public properties
Logger Logger
RetryMax int
RetryWaitMin time.Duration
RetryWaitMax time.Duration
// Public APIs:
GeoLocation *GeoLocation
Mail *Mail
Usage *Usage
// contains filtered or unexported fields
}
Client encapsulates the api functions - must be created with NewClient()
func NewClient ¶
NewClient creates a new Client with the provided apiKey and an optional httpClient.
func (*Client) GetVersion ¶
GetVersion returns the client version string.
type Error ¶
type Error struct {
Status int `json:"status"`
Success bool `json:"success"`
Message string `json:"message"`
Code string `json:"code"`
}
Error for API requests
type GeoLocation ¶
type GeoLocation struct {
// contains filtered or unexported fields
}
GeoLocation api functions
func (*GeoLocation) Get ¶
func (c *GeoLocation) Get(ip string, options *GeoLocationOptions) (*IPLocation, error)
Get retrieves the geolocation for the given domain or IP address
func (*GeoLocation) GetBulk ¶
func (c *GeoLocation) GetBulk(iplist []string, options *GeoLocationOptions) ([]IPLocation, error)
GetBulk retrieves the geolocation for multiple domain names or IP addresses.
func (*GeoLocation) GetCurrent ¶
func (c *GeoLocation) GetCurrent(options *GeoLocationOptions) (*IPLocation, error)
GetCurrent retrieves the geolocation for the requester.
type GeoLocationOptions ¶
GeoLocationOptions model
type IPCurrency ¶
type IPCurrency struct {
Code string `json:"code,omitempty" xml:"code,omitempty"`
NumericCode string `json:"num_code,omitempty" xml:"num_code,omitempty"`
Name string `json:"name,omitempty" xml:"name,omitempty"`
PluralName string `json:"name_plural,omitempty" xml:"plural_name,omitempty"`
Symbol string `json:"symbol,omitempty" xml:"symbol,omitempty"`
NativeSymbol string `json:"symbol_native,omitempty" xml:"native_symbol,omitempty"`
DecimalDigits int `json:"decimal_digits,omitempty" xml:"decimal_digits,omitempty"`
}
IPCurrency model
type IPLanguage ¶
type IPLanguage struct {
Code string `json:"code,omitempty" xml:"code,omitempty"`
Code2 string `json:"code2,omitempty" xml:"code2,omitempty"`
Name string `json:"name,omitempty" xml:"name,omitempty"`
NativeName string `json:"native_name,omitempty" xml:"native_name,omitempty"`
RTL bool `json:"rtl" xml:"rtl"`
}
IPLanguage model
type IPLocation ¶
type IPLocation struct {
Index *int `json:"-" xml:"index,attr,omitempty"`
//---
IPAddress string `json:"ip,omitempty" xml:"ip,omitempty"`
Type string `json:"type,omitempty" xml:"type,omitempty"`
Hostname string `json:"hostname,omitempty" xml:"hostname,omitempty"`
Continent string `json:"continent_name,omitempty" xml:"continent_name,omitempty"`
ContinentCode string `json:"continent_code,omitempty" xml:"continent_code,omitempty"`
Country string `json:"country_name,omitempty" xml:"country_name,omitempty"`
CountryNative string `json:"country_name_native,omitempty" xml:"country_name_native,omitempty"`
CountryCode string `json:"country_code,omitempty" xml:"country_code,omitempty"`
CountryCode3 string `json:"country_code3,omitempty" xml:"country_code3,omitempty"`
Capital string `json:"capital,omitempty" xml:"capital,omitempty"`
Region string `json:"region_name,omitempty" xml:"region_name,omitempty"`
RegionCode string `json:"region_code,omitempty" xml:"region_code,omitempty"`
City string `json:"city,omitempty" xml:"city,omitempty"`
Postcode string `json:"postcode,omitempty" xml:"postcode,omitempty"`
Latitude float64 `json:"latitude,omitempty" xml:"latitude,omitempty"`
Longitude float64 `json:"longitude,omitempty" xml:"longitude,omitempty"`
PhonePrefix string `json:"phone_prefix,omitempty" xml:"phone_prefix,omitempty"`
Currencies []IPCurrency `json:"currencies,omitempty" xml:"currencies,omitempty"`
Languages []IPLanguage `json:"languages,omitempty" xml:"languages,omitempty"`
Flag string `json:"flag,omitempty" xml:"flag,omitempty"`
FlagEmoji string `json:"flag_emoji,omitempty" xml:"flag_emoji,omitempty"`
IsEU *bool `json:"is_eu,omitempty" xml:"is_eu,omitempty"`
TLD string `json:"internet_tld,omitempty" xml:"internet_tld,omitempty"`
ISP string `json:"isp,omitempty" xml:"isp,omitempty"`
Timezone *IPTimezone `json:"timezone,omitempty" xml:"timezone,omitempty"`
Security *IPSecurity `json:"security,omitempty" xml:"security,omitempty"`
}
IPLocation model
type IPSecurity ¶
type IPSecurity struct {
IsProxy bool `json:"is_proxy" xml:"is_proxy"`
ProxyType string `json:"proxy_type,omitempty" xml:"proxy_type,omitempty"`
IsCrawler bool `json:"is_crawler" xml:"is_crawler"`
CrawlerName string `json:"crawler_name,omitempty" xml:"crawler_name,omitempty"`
CrawlerType string `json:"crawler_type,omitempty" xml:"crawler_type,omitempty"`
IsTOR bool `json:"is_tor" xml:"is_tor"`
ThreatLevel string `json:"threat_level,omitempty" xml:"threat_level,omitempty"`
ThreatTypes []string `json:"threat_types,omitempty" xml:"threat_types,omitempty"`
}
IPSecurity model
type IPTimezone ¶
type IPTimezone struct {
ID string `json:"id,omitempty" xml:"id,omitempty"` // Name not ID?
LocalTime string `json:"localtime,omitempty" xml:"localtime,omitempty"`
GMTOffset int `json:"gmt_offset,omitempty" xml:"gmt_offset,omitempty"`
Code string `json:"code,omitempty" xml:"code,omitempty"`
DaylightSaving bool `json:"daylight_saving" xml:"daylight_saving"`
}
IPTimezone model
type Logger ¶
type Logger interface {
Printf(string, ...interface{})
}
Logger interface allows to use other loggers than standard log.Logger.
type Mail ¶
type Mail struct {
// contains filtered or unexported fields
}
Mail api functions
func (*Mail) Send ¶
func (c *Mail) Send(message *MailMessage) (*MailReceipt, error)
Send sends a mail message
type MailMessage ¶
type MailMessage struct {
Date time.Time `json:"date"`
From string `json:"from"`
FromName string `json:"from_name"`
ReplyTo string `json:"reply_to"`
To []string `json:"to"`
Cc []string `json:"cc"`
Bcc []string `json:"bcc"`
Subject string `json:"subject"`
Text string `json:"text"`
HTML string `json:"html"`
Attachments []string `json:"attachments"`
Tags []string `json:"tags"`
Charset string `json:"charset,omitempty"`
Encoding string `json:"encoding,omitempty"`
// Options:
RequireTLS *bool `json:"require_tls,omitempty"`
VerifyCertificate *bool `json:"verify_cert,omitempty"`
OpenTracking *bool `json:"open_tracking,omitempty"`
ClickTracking *bool `json:"click_tracking,omitempty"`
PlainTextClickTracking *bool `json:"text_click_tracking"`
UnsubscribeTracking *bool `json:"unsubscribe_tracking,omitempty"`
TestMode *bool `json:"test_mode,omitempty"`
}
MailMessage model
func NewMessage ¶
func NewMessage(from, subject, text string, to ...string) *MailMessage
NewMessage ...
func (*MailMessage) AddAttachment ¶
func (m *MailMessage) AddAttachment(fileName string)
AddAttachment ...
func (*MailMessage) SetClickTracking ¶
func (m *MailMessage) SetClickTracking(flag bool)
SetClickTracking ...
func (*MailMessage) SetOpenTracking ¶
func (m *MailMessage) SetOpenTracking(flag bool)
SetOpenTracking ...
func (*MailMessage) SetPlainTextClickTracking ¶
func (m *MailMessage) SetPlainTextClickTracking(flag bool)
SetPlainTextClickTracking ...
func (*MailMessage) SetRequireTLS ¶
func (m *MailMessage) SetRequireTLS(flag bool)
SetRequireTLS ...
func (*MailMessage) SetUnsubscribeTracking ¶
func (m *MailMessage) SetUnsubscribeTracking(flag bool)
SetUnsubscribeTracking ...
func (*MailMessage) SetVerifyCertificate ¶
func (m *MailMessage) SetVerifyCertificate(flag bool)
SetVerifyCertificate ...
func (*MailMessage) ToParameters ¶
func (m *MailMessage) ToParameters() *Parameters
ToParameters ...
type MailReceipt ¶
type MailReceipt struct {
ID string `json:"id" xml:"id"`
AcceptedRecipients int `json:"accepted_recipients" xml:"accepted_recipients"`
RejectedRecipients int `json:"rejected_recipients" xml:"rejected_recipients"`
}
MailReceipt model
type Parameters ¶
type Parameters struct {
// contains filtered or unexported fields
}
Parameters struct
func (*Parameters) Add ¶
func (p *Parameters) Add(key string, value interface{})
Add adds a new key/value pair to payload.
func (*Parameters) AddFile ¶
func (p *Parameters) AddFile(key, file string)
AddFile adds a new file to be uploaded
func (*Parameters) Encode ¶
func (p *Parameters) Encode() (*bytes.Buffer, error)
Encode marshalls the payload into JSON.
func (*Parameters) GetContentType ¶
func (p *Parameters) GetContentType() string
GetContentType returns the content type of the payload
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
geoip/advanced
command
|
|
|
geoip/bulk
command
|
|
|
geoip/requester
command
|
|
|
geoip/simple
command
|
|
|
mail/send
command
|