Skip to content

Commit 87bf9a0

Browse files
authored
Merge pull request #15 from green-api/dev
Fixed ReceiveNotification
2 parents c96e7bc + 4c04d98 commit 87bf9a0

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

pkg/api/api.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ func (a GreenAPI) Request(method, APIMethod string, data map[string]interface{},
3333
return response.(map[string]interface{}), err
3434
}
3535

36+
func (a GreenAPI) RawRequest(method, APIMethod string, data map[string]interface{}, filePath string) (interface{}, error) {
37+
url := a.getURL(method, APIMethod, data)
38+
39+
return executeRequest(method, url, data, filePath)
40+
}
41+
3642
func (a GreenAPI) ArrayRequest(method, APIMethod string, data map[string]interface{}, filePath string) ([]interface{}, error) {
3743
url := a.getURL(method, APIMethod, data)
3844

pkg/categories/methods/base_category.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ package methods
22

33
type GreenAPIInterface interface {
44
Request(method, APIMethod string, data map[string]interface{}, filePath string) (map[string]interface{}, error)
5+
RawRequest(method, APIMethod string, data map[string]interface{}, filePath string) (interface{}, error)
56
ArrayRequest(method, APIMethod string, data map[string]interface{}, filePath string) ([]interface{}, error)
67
}

pkg/categories/methods/receiving.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@ type ReceivingCategory struct {
77
// ReceiveNotification is designed to receive a single incoming notification
88
// from the notification queue.
99
func (c ReceivingCategory) ReceiveNotification() (map[string]interface{}, error) {
10-
return c.GreenAPI.Request("GET", "receiveNotification", nil, "")
10+
response, err := c.GreenAPI.RawRequest("GET", "receiveNotification", nil, "")
11+
12+
if response != nil {
13+
return response.(map[string]interface{}), err
14+
}
15+
16+
return nil, err
1117
}
1218

1319
// DeleteNotification is designed to remove an incoming notification

0 commit comments

Comments
 (0)