Documentation
¶
Index ¶
- Constants
- type APIError
- type HTTPError
- type JSONRPCClient
- type JSONRPCRequest
- type JSONRPCResponse
- type Session
- type Transport
- func (t *Transport) Call(ctx context.Context, method string, params map[string]interface{}) (map[string]interface{}, error)
- func (t *Transport) Login(ctx context.Context, username, password string) error
- func (t *Transport) Logout(ctx context.Context) error
- func (t *Transport) SetEndpoint(endpoint string)
- func (t *Transport) SetHTTPClient(client *http.Client)
- func (t *Transport) SetTimeout(timeout time.Duration)
- func (t *Transport) SetUserAgent(userAgent string)
- type XMLRPCClient
- type XMLRPCMember
- type XMLRPCMethodCall
- type XMLRPCMethodResponse
- type XMLRPCParam
- type XMLRPCParams
- type XMLRPCStruct
- type XMLRPCValue
Constants ¶
View Source
const ( // DefaultTimeout is the default HTTP client timeout DefaultTimeout = 30 * time.Second // DefaultMaxRetries is the default number of retry attempts for API calls DefaultMaxRetries = 3 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIError ¶
type APIError struct {
Code int `json:"code"`
Message string `json:"msg"`
ReasonCode string `json:"reasonCode,omitempty"`
Reason string `json:"reason,omitempty"`
}
func NewAPIError ¶
func NewAPIErrorWithReason ¶
type HTTPError ¶ added in v0.9.5
HTTPError represents an HTTP-level error (non-200 status code)
func NewHTTPError ¶ added in v0.9.5
func (*HTTPError) IsRateLimitError ¶ added in v0.9.5
IsRateLimitError returns true if this is an HTTP 429 rate limit error
type JSONRPCClient ¶
type JSONRPCClient struct {
// contains filtered or unexported fields
}
func NewJSONRPCClient ¶
func NewJSONRPCClient(client *http.Client, session *Session) *JSONRPCClient
func (*JSONRPCClient) SetEndpoint ¶
func (c *JSONRPCClient) SetEndpoint(endpoint string)
func (*JSONRPCClient) SetHTTPClient ¶
func (c *JSONRPCClient) SetHTTPClient(client *http.Client)
type JSONRPCRequest ¶
type JSONRPCResponse ¶
type JSONRPCResponse struct {
Result interface{} `json:"result"`
Error interface{} `json:"error"`
ID int `json:"id"`
}
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
func NewSession ¶
func NewSession() *Session
func (*Session) GetCookies ¶
func (*Session) StoreCookies ¶
type Transport ¶
type Transport struct {
// contains filtered or unexported fields
}
func NewTransport ¶
func (*Transport) SetEndpoint ¶
func (*Transport) SetHTTPClient ¶
func (*Transport) SetTimeout ¶
func (*Transport) SetUserAgent ¶
type XMLRPCClient ¶
type XMLRPCClient struct {
// contains filtered or unexported fields
}
func NewXMLRPCClient ¶
func NewXMLRPCClient(client *http.Client, session *Session) *XMLRPCClient
func (*XMLRPCClient) SetEndpoint ¶
func (c *XMLRPCClient) SetEndpoint(endpoint string)
func (*XMLRPCClient) SetHTTPClient ¶
func (c *XMLRPCClient) SetHTTPClient(client *http.Client)
type XMLRPCMember ¶
type XMLRPCMember struct {
Name string `xml:"name"`
Value XMLRPCValue `xml:"value"`
}
type XMLRPCMethodCall ¶
type XMLRPCMethodCall struct {
XMLName xml.Name `xml:"methodCall"`
Method string `xml:"methodName"`
Params XMLRPCParams `xml:"params"`
}
type XMLRPCMethodResponse ¶
type XMLRPCMethodResponse struct {
XMLName xml.Name `xml:"methodResponse"`
Params XMLRPCParams `xml:"params"`
}
type XMLRPCParam ¶
type XMLRPCParam struct {
Value XMLRPCValue `xml:"value"`
}
type XMLRPCParams ¶
type XMLRPCParams struct {
Param []XMLRPCParam `xml:"param"`
}
type XMLRPCStruct ¶
type XMLRPCStruct struct {
Member []XMLRPCMember `xml:"member"`
}
type XMLRPCValue ¶
type XMLRPCValue struct {
Struct XMLRPCStruct `xml:"struct,omitempty"`
String string `xml:"string,omitempty"`
Int int `xml:"int,omitempty"`
Bool bool `xml:"boolean,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.