feat: Add Response#Raw with raw json string

This commit is contained in:
ptrcnull 2022-03-05 19:14:17 +01:00
parent 4973770c80
commit bd47ce3567
Signed by: ptrcnull
GPG key ID: 411F7B30801DD9CA
2 changed files with 4 additions and 2 deletions

View file

@ -37,7 +37,7 @@ func (c *Client) Post(url string, data url.Values) ([]byte, error) {
func (c *Client) GetUpdates() (Response, error) {
var res Response
values := url.Values{}
values.Set("offset", strconv.FormatInt(c.Offset, 10))
values.Set("timeout", strconv.FormatInt(c.PollTimeout, 10))
@ -46,6 +46,7 @@ func (c *Client) GetUpdates() (Response, error) {
return res, err
}
res.Raw = string(body)
err = json.Unmarshal(body, &res)
if len(res.Result) > 0 {

View file

@ -3,6 +3,7 @@ package telegram
type Response struct {
Ok bool `json:"ok"`
Result []Update `json:"result"`
Raw string `json:""`
}
type Author struct {
@ -71,6 +72,6 @@ type Message struct {
}
type SendMessageResponse struct {
Ok bool `json:"ok"`
Ok bool `json:"ok"`
Result Message `json:"result"`
}