Skip to content

Commit

Permalink
feat: Rename the Notification sending func
Browse files Browse the repository at this point in the history
Close #573

Signed-off-by: weichou <[email protected]>
  • Loading branch information
weichou1229 committed May 31, 2021
1 parent ee842a9 commit e64eb79
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 31 deletions.
4 changes: 2 additions & 2 deletions v2/clients/http/notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ func NewNotificationClient(baseUrl string) interfaces.NotificationClient {
}
}

// Add adds new notifications.
func (client *NotificationClient) Add(ctx context.Context, reqs []requests.AddNotificationRequest) (res []common.BaseWithIdResponse, err errors.EdgeX) {
// SendNotification sends new notifications.
func (client *NotificationClient) SendNotification(ctx context.Context, reqs []requests.AddNotificationRequest) (res []common.BaseWithIdResponse, err errors.EdgeX) {
err = utils.PostRequestWithRawData(ctx, &res, client.baseUrl+v2.ApiNotificationRoute, reqs)
if err != nil {
return res, errors.NewCommonEdgeXWrapper(err)
Expand Down
4 changes: 2 additions & 2 deletions v2/clients/http/notification_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ func addNotificationRequest() requests.AddNotificationRequest {
)
}

func TestNotificationClient_Add(t *testing.T) {
func TestNotificationClient_SendNotification(t *testing.T) {
ts := newTestServer(http.MethodPost, v2.ApiNotificationRoute, []common.BaseWithIdResponse{})
defer ts.Close()
client := NewNotificationClient(ts.URL)
res, err := client.Add(context.Background(), []requests.AddNotificationRequest{addNotificationRequest()})
res, err := client.SendNotification(context.Background(), []requests.AddNotificationRequest{addNotificationRequest()})
require.NoError(t, err)
require.IsType(t, []common.BaseWithIdResponse{}, res)
}
Expand Down
50 changes: 25 additions & 25 deletions v2/clients/interfaces/mocks/NotificationClient.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions v2/clients/interfaces/notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import (

// NotificationClient defines the interface for interactions with the Notification endpoint on the EdgeX Foundry support-notifications service.
type NotificationClient interface {
// Add adds new notifications.
Add(ctx context.Context, reqs []requests.AddNotificationRequest) ([]common.BaseWithIdResponse, errors.EdgeX)
// SendNotification sends new notifications.
SendNotification(ctx context.Context, reqs []requests.AddNotificationRequest) ([]common.BaseWithIdResponse, errors.EdgeX)
// NotificationById query notification by id.
NotificationById(ctx context.Context, id string) (responses.NotificationResponse, errors.EdgeX)
// DeleteNotificationById deletes a notification by id.
Expand Down

0 comments on commit e64eb79

Please sign in to comment.