Documentation
¶
Index ¶
- type API
- func (api API) CheckUser(userSign string) (*http.Response, error)
- func (api API) Do(request *http.Request) (response *http.Response, err error)
- func (api *API) EnableCompression(b bool)
- func (api API) GET(uri string, payload Payload) (*http.Response, error)
- func (api *API) GetToken(domain, login, password string) (err error)
- func (api API) POST(uri string, payload Payload) (*http.Response, error)
- func (api API) SaveToken(filename string) error
- func (api *API) SetHTTPClient(c *http.Client)
- type Payload
- type Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API - Структура объекта API v1
func (*API) EnableCompression ¶ added in v1.3.3
EnableCompression - добавлять заголово "Accept-Encoding: gzip", http.Response.Body будет автоматически обработан
func (*API) SetHTTPClient ¶ added in v1.3.3
SetHTTPClient - установить свой http.Client для API
type Payload ¶ added in v1.3.3
type Payload map[string]interface{}
Payload - параметры запроса. url.Values в удобной обертке
type Response ¶ added in v1.3.1
type Response struct {
Status struct {
Code string `json:"code"`
Message string `json:"message"`
} `json:"status"`
Data interface{} `json:"data"`
}
Response - структура стандартного ответа API
func ExpectedResponse ¶ added in v1.3.1
func ExpectedResponse(data interface{}) *Response
ExpectedResponse - оборачивает ожидаемый ответ в стандартную структуру. Ожидаемый интерфейс будет находиться в поле Response.Data. После обработки необходимо сделать assert вложенного интерфейса к ожидаемому (см. примеры)
Click to show internal directories.
Click to hide internal directories.