Documentation
¶
Index ¶
Constants ¶
View Source
const (
// ContentTypeJSON http content type
ContentTypeJSON = "application/json"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Caller ¶
type Caller interface {
Call(url string, data *RequestData) (*Response, error)
}
Caller represents way to call API with request
type DefaultConstructor ¶
type DefaultConstructor struct{}
DefaultConstructor default implementation of RequestConstructor
func (DefaultConstructor) JSONRequest ¶
func (d DefaultConstructor) JSONRequest(parameters interface{}) (*RequestData, error)
JSONRequest is default implementation
func (DefaultConstructor) MultipartRequest ¶
func (d DefaultConstructor) MultipartRequest( parameters map[string]string, filesParameters map[string]*os.File) (*RequestData, error)
MultipartRequest is default implementation
type Error ¶
type Error struct { Description string `json:"description,omitempty"` ErrorCode int `json:"error_code,omitempty"` Parameters *ResponseParameters `json:"parameters,omitempty"` }
Error represents error from telegram API
type FasthttpAPICaller ¶
FasthttpAPICaller fasthttp implementation of Caller
func (FasthttpAPICaller) Call ¶
func (a FasthttpAPICaller) Call(url string, data *RequestData) (*Response, error)
Call is fasthttp implementation
type RequestConstructor ¶
type RequestConstructor interface { JSONRequest(parameters interface{}) (*RequestData, error) MultipartRequest(parameters map[string]string, filesParameters map[string]*os.File) (*RequestData, error) }
RequestConstructor represents way to construct API request
type RequestData ¶
RequestData represents data needed to execute request
type Response ¶
type Response struct { Ok bool `json:"ok"` Result stdJson.RawMessage `json:"result,omitempty"` *Error }
Response represents response returned by Telegram API
type ResponseParameters ¶
type ResponseParameters struct { // MigrateToChatID - Optional. The group has been migrated to a supergroup with the specified identifier. // This number may have more than 32 significant bits and some programming languages may have difficulty/silent // defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or // double-precision float type are safe for storing this identifier. MigrateToChatID int64 `json:"migrate_to_chat_id,omitempty"` // RetryAfter - Optional. In case of exceeding flood control, the number of seconds left to wait before the // request can be repeated RetryAfter int `json:"retry_after,omitempty"` }
ResponseParameters - Contains information about why a request was unsuccessful.
Click to show internal directories.
Click to hide internal directories.