1
1
package monta
2
2
3
3
import (
4
+ "bytes"
4
5
"context"
6
+ "encoding/json"
5
7
"net/url"
6
8
)
7
9
@@ -21,3 +23,36 @@ func (c *clientImpl) GetWebhookConfig(ctx context.Context) (*GetWebhookConfigRes
21
23
query := url.Values {}
22
24
return doGet [GetWebhookConfigResponse ](ctx , c , path , query )
23
25
}
26
+
27
+ // UpdateWebhookConfigRequest is the request input to the [Client.UpdateWebhookConfig] method.
28
+ type UpdateWebhookConfigRequest struct {
29
+ // A HTTPS URL to send the webhook payload to when an event occurs.
30
+ WebhookURL string `json:"webhookUrl"`
31
+ // A cryptoghrapic secret used to sign the webhook payload.
32
+ WebhookSecret string `json:"webhookSecret"`
33
+ // A list of event type to subscribe to. Use ["*"] to subscribe to all.
34
+ EventTypes []* WebhookEventType `json:"eventTypes"`
35
+ }
36
+
37
+ // UpdateWebhookConfigResponse is the response output from the [Client.UpdateWebhookConfig] method.
38
+ type UpdateWebhookConfigResponse struct {
39
+ // A HTTPS URL to send the webhook payload to when an event occurs.
40
+ WebhookURL string `json:"webhookUrl"`
41
+ // A cryptoghrapic secret used to sign the webhook payload.
42
+ WebhookSecret string `json:"webhookSecret"`
43
+ // A list of event type to subscribe to. Use of ["*"] means subscribe to all.
44
+ EventTypes []* string `json:"eventTypes"`
45
+ }
46
+
47
+ // UpdateWebhookConfig to update your webhook config.
48
+ func (c * clientImpl ) UpdateWebhookConfig (
49
+ ctx context.Context ,
50
+ request * UpdateWebhookConfigRequest ,
51
+ ) (* UpdateWebhookConfigResponse , error ) {
52
+ path := "/v1/webhooks/config"
53
+ var requestBody bytes.Buffer
54
+ if err := json .NewEncoder (& requestBody ).Encode (& request ); err != nil {
55
+ return nil , err
56
+ }
57
+ return doPut [UpdateWebhookConfigResponse ](ctx , c , path , & requestBody )
58
+ }
0 commit comments