Fix to not return *Pagination

This commit is contained in:
178inaba 2017-05-06 23:03:19 +09:00
parent dd0b467062
commit 134128cb56
11 changed files with 136 additions and 138 deletions

View file

@ -17,19 +17,19 @@ type Notification struct {
}
// GetNotifications return notifications.
func (c *Client) GetNotifications(ctx context.Context, pg *Pagination) ([]*Notification, *Pagination, error) {
func (c *Client) GetNotifications(ctx context.Context, pg *Pagination) ([]*Notification, error) {
var notifications []*Notification
retPG, err := c.doAPI(ctx, http.MethodGet, "/api/v1/notifications", nil, &notifications, pg)
err := c.doAPI(ctx, http.MethodGet, "/api/v1/notifications", nil, &notifications, pg)
if err != nil {
return nil, nil, err
return nil, err
}
return notifications, retPG, nil
return notifications, nil
}
// GetNotification return notification.
func (c *Client) GetNotification(ctx context.Context, id int64) (*Notification, error) {
var notification Notification
_, err := c.doAPI(ctx, http.MethodGet, fmt.Sprintf("/api/v1/notifications/%d", id), nil, &notification, nil)
err := c.doAPI(ctx, http.MethodGet, fmt.Sprintf("/api/v1/notifications/%d", id), nil, &notification, nil)
if err != nil {
return nil, err
}
@ -38,6 +38,5 @@ func (c *Client) GetNotification(ctx context.Context, id int64) (*Notification,
// ClearNotifications clear notifications.
func (c *Client) ClearNotifications(ctx context.Context) error {
_, err := c.doAPI(ctx, http.MethodPost, "/api/v1/notifications/clear", nil, nil, nil)
return err
return c.doAPI(ctx, http.MethodPost, "/api/v1/notifications/clear", nil, nil, nil)
}