-
Notifications
You must be signed in to change notification settings - Fork 13
/
resend.go
39 lines (31 loc) · 983 Bytes
/
resend.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package tinkoff
import "context"
type ResendRequest struct {
BaseRequest
}
func (r *ResendRequest) GetValuesForToken() map[string]string {
return map[string]string{}
}
type ResendResponse struct {
BaseResponse
Count int `json:"Count"` // Количество сообщений, отправляемых повторно
}
// Resend requests to send unacknowledged notifications again
// Deprecated: use ResendWithContext instead
func (c *Client) Resend() (*ResendResponse, error) {
return c.ResendWithContext(context.Background())
}
// ResResendWithContextend requests to send unacknowledged notifications again
func (c *Client) ResendWithContext(ctx context.Context) (*ResendResponse, error) {
response, err := c.PostRequestWithContext(ctx, "/Resend", &ResendRequest{})
if err != nil {
return nil, err
}
defer response.Body.Close()
var res ResendResponse
err = c.decodeResponse(response, &res)
if err != nil {
return nil, err
}
return &res, res.Error()
}