-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check RocketChat response for errors
- Loading branch information
Showing
5 changed files
with
28 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,22 @@ | ||
package rocket | ||
|
||
import "errors" | ||
|
||
const ( | ||
postMessagePath = "api/v1/chat.postMessage" | ||
) | ||
|
||
func (message *MessageService) Post(payload MessagePayload) error { | ||
func (message *MessageService) Post(payload MessagePayload) (*MessageResponse, error) { | ||
|
||
var response MessageResponse | ||
_, err := message.resty.R(). | ||
SetBody(payload). | ||
SetResult(&response). | ||
Post(postMessagePath) | ||
|
||
return err | ||
if !response.Success { | ||
return nil, errors.New("Posting message failed") | ||
} | ||
|
||
return &response, err | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ import ( | |
) | ||
|
||
const ( | ||
version = "1.0.1" | ||
version = "1.0.2" | ||
) | ||
|
||
var rootCommand = &cobra.Command{ | ||
|