Documentation
¶
Index ¶
- func OptionDebug(b bool) func(*Client)
- func OptionDisableStrictMode() func(*Client)
- func OptionHTTPClient(client HTTPClient) func(*Client)
- type ApiErr
- type CategoryType
- type Client
- type DeviceType
- type EntityType
- type ErrorType
- type HTTPClient
- type Option
- type RequestParam
- type Stack
- type UnsupportedTypeError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OptionDebug ¶
OptionDebug enable debugging for the client.
func OptionDisableStrictMode ¶ added in v0.3.0
func OptionDisableStrictMode() func(*Client)
OptionDisableStrictMode stops custom UnmarshalText on well-known types. Will not cause client to error if userstack API returns a type that cannot be expressed as a typed string constant.
func OptionHTTPClient ¶
func OptionHTTPClient(client HTTPClient) func(*Client)
OptionHTTPClient - provide a custom http client to the client.
Types ¶
type ApiErr ¶
type ApiErr struct { // Most unfortunate this "success" is also not returned in the successful state. Success *bool `json:"success"` Err struct { Code int `json:"code,omitempty"` Type ErrorType `json:"type,omitempty"` Info string `json:"info,omitempty"` } `json:"error,omitempty"` }
ApiErr is a well formatted error returned by the userstack API.
type CategoryType ¶
type CategoryType string
const ( CategoryUnknown CategoryType = "unknown" CategorySearchEngine CategoryType = "search-engine" CategoryMonitoring CategoryType = "monitoring" CategoryScreenshotService CategoryType = "screenshot-service" CategoryScraper CategoryType = "scraper" CategorySecurityScanner CategoryType = "security-scanner" )
func (CategoryType) String ¶
func (c CategoryType) String() string
func (*CategoryType) UnmarshalText ¶
func (c *CategoryType) UnmarshalText(text []byte) error
UnmarshalText satisfies TextUnmarshaler
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
type DeviceType ¶
type DeviceType string
const ( DeviceUnknown DeviceType = "unknown" DeviceDesktop DeviceType = "desktop" DeviceTablet DeviceType = "tablet" DeviceSmartPhone DeviceType = "smartphone" DeviceConsole DeviceType = "console" DeviceSmartTV DeviceType = "smarttv" DeviceWearable DeviceType = "wearable" )
func (DeviceType) String ¶
func (d DeviceType) String() string
func (*DeviceType) UnmarshalText ¶
func (d *DeviceType) UnmarshalText(text []byte) error
UnmarshalText satisfies TextUnmarshaler
type EntityType ¶
type EntityType string
const ( EntityUnknown EntityType = "unknown" EntityBrowser EntityType = "browser" EntityMobileBrowser EntityType = "mobile-browser" EntityEmailClient EntityType = "email-client" EntityApp EntityType = "app" EntityFeedReader EntityType = "feed-reader" EntityCrawler EntityType = "crawler" EntityOfflineBrowser EntityType = "offline-browser" )
func (EntityType) String ¶
func (e EntityType) String() string
func (*EntityType) UnmarshalText ¶
func (e *EntityType) UnmarshalText(text []byte) error
UnmarshalText satisfies TextUnmarshaler
type ErrorType ¶
type ErrorType string
ErrorType represents common userstack API errors.
const ( ErrNotFound ErrorType = "404_not_found" ErrMissingAccessKey ErrorType = "missing_access_key" ErrInvalidAccessKey ErrorType = "invalid_access_key" ErrInactiveUser ErrorType = "inactive_user" ErrInvalidAPIFunction ErrorType = "invalid_api_function" ErrUsageLimitReached ErrorType = "usage_limit_reached" ErrFunctionAccessRestricted ErrorType = "function_access_restricted" ErrHTTPSAccessRestricted ErrorType = "https_access_restricted" ErrMissingUserAgent ErrorType = "missing_user_agent" ErrInvalidFields ErrorType = "invalid_fields" ErrTooManyUserAgents ErrorType = "too_many_user_agents" ErrBatchNotSupportedOnPlan ErrorType = "batch_not_supported_on_plan" )
func (*ErrorType) UnmarshalText ¶
UnmarshalText satisfies TextUnmarshaler
type HTTPClient ¶
HTTPClient is the interface used to send HTTP requests. Users can provide their own implementation.
type Option ¶
type Option func(*Client)
Option is a functional option to modify the underlying Client.
type RequestParam ¶ added in v0.3.1
type RequestParam struct { // Set to your preferred output field(s). Follow docs to compose this. Fields string }
type Stack ¶
type Stack struct { Ua string `json:"ua,omitempty"` Type EntityType `json:"type,omitempty"` Brand string `json:"brand,omitempty"` // Is this device.brand ? Name string `json:"name,omitempty"` // Is this device.name ? URL string `json:"url,omitempty"` Os struct { Name string `json:"name,omitempty"` Code string `json:"code,omitempty"` URL string `json:"url,omitempty"` Family string `json:"family,omitempty"` FamilyCode string `json:"family_code,omitempty"` FamilyVendor string `json:"family_vendor,omitempty"` Icon string `json:"icon,omitempty"` IconLarge string `json:"icon_large,omitempty"` } `json:"os"` Device struct { IsMobileDevice bool `json:"is_mobile_device,omitempty"` Type DeviceType `json:"type,omitempty"` Brand string `json:"brand,omitempty"` BrandCode string `json:"brand_code,omitempty"` BrandURL string `json:"brand_url,omitempty"` Name string `json:"name,omitempty"` } `json:"device"` Browser struct { Name string `json:"name,omitempty"` Version string `json:"version,omitempty"` VersionMajor string `json:"version_major,omitempty"` Engine string `json:"engine,omitempty"` } `json:"browser"` Crawler struct { IsCrawler bool `json:"is_crawler,omitempty"` Category CategoryType `json:"category,omitempty"` LastSeen string `json:"last_seen,omitempty"` // "2019-09-15 20:35:33" } `json:"crawler"` }
type UnsupportedTypeError ¶ added in v0.3.0
type UnsupportedTypeError struct {
// contains filtered or unexported fields
}
UnsupportedTypeError describes an unmarshal error when encountering an unknown type.
NOTE: only returned when running client in strict mode. See Options for more info.
func (*UnsupportedTypeError) Error ¶ added in v0.3.0
func (e *UnsupportedTypeError) Error() string