Documentation ¶
Overview ¶
Package polynym is the unofficial golang implementation for the Polynym API
Example:
// Create a new client client, _ := polynym.NewClient(nil)
// Get address resp, _ := client.GetAddress("1mrz")
// What's the address? log.Println("address:", resp.Address)
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandCashConvert ¶ added in v0.3.0
HandCashConvert now converts $handle to paymail: handle@handcash.io or handle@beta.handcash.io
Example ¶
ExampleHandCashConvert example using HandCashConvert()
paymail := HandCashConvert("$mr-z", false) fmt.Println(paymail)
Output: mr-z@handcash.io
func RelayXConvert ¶ added in v0.4.3
RelayXConvert now converts 1handle to paymail: handle@relayx.io
Example ¶
ExampleHandCashConvert example using RelayXConvert()
paymail := RelayXConvert("1mr-z") fmt.Println(paymail)
Output: mr-z@relayx.io
Types ¶
type Client ¶
type Client struct { UserAgent string // (optional for changing user agents) // contains filtered or unexported fields }
Client is the parent struct that wraps the heimdall client
type GetAddressResponse ¶
type GetAddressResponse struct { Address string `json:"address"` ErrorMessage string `json:"error"` LastRequest *LastRequest `json:"-"` }
GetAddressResponse is what polynym returns (success or fail)
func GetAddress ¶ added in v0.3.0
func GetAddress(client Client, handleOrPaymail string) (response *GetAddressResponse, err error)
GetAddress returns the address of a given 1handle, $handcash, paymail, Twetch user id or BitcoinSV address
Example ¶
ExampleGetAddress example using GetAddress()
client := newMockClient(defaultUserAgent) resp, _ := GetAddress(client, "16ZqP5Tb22KJuvSAbjNkoiZs13mmRmexZA") fmt.Println(resp.Address)
Output: 16ZqP5Tb22KJuvSAbjNkoiZs13mmRmexZA
type LastRequest ¶
type LastRequest struct { Method string `json:"method"` // Method is the HTTP method used StatusCode int `json:"status_code"` // StatusCode is the last code from the request URL string `json:"url"` // URL is the url used for the request }
LastRequest is used to track what was submitted via the Request
type Options ¶ added in v0.2.0
type Options struct { BackOffExponentFactor float64 `json:"back_off_exponent_factor"` BackOffInitialTimeout time.Duration `json:"back_off_initial_timeout"` BackOffMaximumJitterInterval time.Duration `json:"back_off_maximum_jitter_interval"` BackOffMaxTimeout time.Duration `json:"back_off_max_timeout"` DialerKeepAlive time.Duration `json:"dialer_keep_alive"` DialerTimeout time.Duration `json:"dialer_timeout"` RequestRetryCount int `json:"request_retry_count"` RequestTimeout time.Duration `json:"request_timeout"` TransportExpectContinueTimeout time.Duration `json:"transport_expect_continue_timeout"` TransportIdleTimeout time.Duration `json:"transport_idle_timeout"` TransportMaxIdleConnections int `json:"transport_max_idle_connections"` TransportTLSHandshakeTimeout time.Duration `json:"transport_tls_handshake_timeout"` UserAgent string `json:"user_agent"` }
Options holds all the configuration for connection, dialer and transport
func ClientDefaultOptions ¶ added in v0.2.0
func ClientDefaultOptions() (clientOptions *Options)
ClientDefaultOptions will return an clientOptions struct with the default settings Useful for starting with the base defaults and then modifying as needed