🏗️ Hide Response structure because it is not publicly used anywhere
This commit is contained in:
parent
fa8b7ccd77
commit
f02b706066
|
@ -10,17 +10,17 @@ import (
|
||||||
http "github.com/valyala/fasthttp"
|
http "github.com/valyala/fasthttp"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Response represents a response from the Telegram API with the result stored raw. If ok equals true,
|
// response represents a response from the Telegram API with the result stored raw. If ok equals true,
|
||||||
// the request was successful, and the result of the query can be found in the result field. In case of
|
// the request was successful, and the result of the query can be found in the result field. In case of
|
||||||
// an unsuccessful request, ok equals false, and the error is explained in the error field (e.g.
|
// an unsuccessful request, ok equals false, and the error is explained in the error field (e.g.
|
||||||
// SHORT_NAME_REQUIRED).
|
// SHORT_NAME_REQUIRED).
|
||||||
type Response struct {
|
type response struct {
|
||||||
Ok bool `json:"ok"`
|
Ok bool `json:"ok"`
|
||||||
Error string `json:"error"`
|
Error string `json:"error"`
|
||||||
Result *gojson.RawMessage `json:"result"`
|
Result *gojson.RawMessage `json:"result"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func request(method, path string, args *http.Args) (*Response, error) {
|
func request(method, path string, args *http.Args) (*response, error) {
|
||||||
requestURI := &url.URL{
|
requestURI := &url.URL{
|
||||||
Scheme: "https",
|
Scheme: "https",
|
||||||
Host: "api.telegra.ph",
|
Host: "api.telegra.ph",
|
||||||
|
@ -36,7 +36,7 @@ func request(method, path string, args *http.Args) (*Response, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var resp Response
|
var resp response
|
||||||
if err := json.Unmarshal(body, &resp); err != nil {
|
if err := json.Unmarshal(body, &resp); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue