mirror of
https://github.com/usememos/memos.git
synced 2024-11-16 19:56:11 +08:00
23 lines
415 B
Go
23 lines
415 B
Go
package telegram
|
|
|
|
import (
|
|
"context"
|
|
"net/url"
|
|
"strconv"
|
|
)
|
|
|
|
// GetUpdates make a getUpdates api request.
|
|
func (r *Robot) GetUpdates(ctx context.Context, offset int) ([]Update, error) {
|
|
formData := url.Values{
|
|
"timeout": {"60"},
|
|
"offset": {strconv.Itoa(offset)},
|
|
}
|
|
|
|
var result []Update
|
|
err := r.postForm(ctx, "/getUpdates", formData, &result)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return result, nil
|
|
}
|