Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webhook & Message Stream bugs #36

Merged
merged 2 commits into from
Aug 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion message_streams.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const (
// InboundMessageStreamType indicates a message stream is for inbound messages.
InboundMessageStreamType MessageStreamType = "Inbound"
// BroadcastMessageStreamType indicates a message stream is for broadcast messages.
BroadcastMessageStreamType MessageStreamType = "Broadcast"
BroadcastMessageStreamType MessageStreamType = "Broadcasts"
// TransactionalMessageStreamType indicates a message stream is for transactional messages.
TransactionalMessageStreamType MessageStreamType = "Transactional"

Expand Down
7 changes: 6 additions & 1 deletion webhooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,17 @@ type Webhook struct {
// is empty it will return all webhooks for the server. A non-existent message
// stream will result in an error.
func (client *Client) ListWebhooks(ctx context.Context, messageStream string) ([]Webhook, error) {
msgStreamParam := ""
if messageStream != "" {
msgStreamParam = fmt.Sprintf("?MessageStream=%s", messageStream)
}

var res struct {
Webhooks []Webhook
}
err := client.doRequest(ctx, parameters{
Method: http.MethodGet,
Path: fmt.Sprintf("webhooks?MessageStream=%s", messageStream),
Path: "webhooks" + msgStreamParam,
TokenType: serverToken,
}, &res)
return res.Webhooks, err
Expand Down