Documentation ¶
Index ¶
Constants ¶
View Source
const ( DefaultBaseURL = "https://api.vk.com/method" DefaultLang = "en" DefaultVersion = "5.103" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { BaseURL string Lang string Version string Token string HTTPClient httputil.RequestDoer }
Client manages communication with VK API.
func NewClientWithOptions ¶
NewClientWithOptions initializes a new VK API client with default values. It takes functors to modify values when creating it, like `NewClientWithOptions(WithToken(…))`.
func (*Client) CallMethod ¶
func (c *Client) CallMethod(method string, params RequestParams, response interface{}) error
CallMethod invokes the named method and stores the result in the value pointed to by response.
type MethodError ¶
type MethodError struct { Code int64 `json:"error_code"` Message string `json:"error_msg"` RequestParams []struct { Key string `json:"key"` Value string `json:"value"` } `json:"request_params"` }
MethodError represents a VK API method call error.
func (*MethodError) Error ¶
func (err *MethodError) Error() string
type Option ¶
Option is a configuration option to initialize a client.
func WithHTTPClient ¶
func WithHTTPClient(doer httputil.RequestDoer) Option
WithHTTPClient overrides the client http client with the specified one.
type RequestParams ¶
type RequestParams map[string]interface{}
RequestParams are the params for invoking methods.
Click to show internal directories.
Click to hide internal directories.