@@ -19,7 +19,7 @@ type WebhookRead struct {
19
19
Description string `json:"description,omitempty"`
20
20
ClientUrl string `json:"client_url"`
21
21
EventTypes []string `json:"event_types,omitempty"`
22
- JobIds []string `json:"job_ids,omitempty "`
22
+ JobIds []string `json:"job_ids"`
23
23
Active bool `json:"active,omitempty"`
24
24
HmacSecret * string `json:"hmac_secret,omitempty"`
25
25
HttpStatusCode * string `json:"http_status_code,omitempty"`
@@ -32,12 +32,21 @@ type WebhookWrite struct {
32
32
Description string `json:"description,omitempty"`
33
33
ClientUrl string `json:"client_url"`
34
34
EventTypes []string `json:"event_types,omitempty"`
35
- JobIds []int `json:"job_ids,omitempty "`
35
+ JobIds []int `json:"job_ids"`
36
36
Active bool `json:"active,omitempty"`
37
37
}
38
38
39
39
func (c * Client ) GetWebhook (webhookID string ) (* WebhookRead , error ) {
40
- req , err := http .NewRequest ("GET" , fmt .Sprintf ("%s/v3/accounts/%s/webhooks/subscription/%s" , c .HostURL , strconv .Itoa (c .AccountID ), webhookID ), nil )
40
+ req , err := http .NewRequest (
41
+ "GET" ,
42
+ fmt .Sprintf (
43
+ "%s/v3/accounts/%s/webhooks/subscription/%s" ,
44
+ c .HostURL ,
45
+ strconv .Itoa (c .AccountID ),
46
+ webhookID ,
47
+ ),
48
+ nil ,
49
+ )
41
50
if err != nil {
42
51
return nil , err
43
52
}
@@ -81,7 +90,15 @@ func (c *Client) CreateWebhook(
81
90
return nil , err
82
91
}
83
92
84
- req , err := http .NewRequest ("POST" , fmt .Sprintf ("%s/v3/accounts/%s/webhooks/subscriptions" , c .HostURL , strconv .Itoa (c .AccountID )), strings .NewReader (string (newWebhookData )))
93
+ req , err := http .NewRequest (
94
+ "POST" ,
95
+ fmt .Sprintf (
96
+ "%s/v3/accounts/%s/webhooks/subscriptions" ,
97
+ c .HostURL ,
98
+ strconv .Itoa (c .AccountID ),
99
+ ),
100
+ strings .NewReader (string (newWebhookData )),
101
+ )
85
102
if err != nil {
86
103
return nil , err
87
104
}
@@ -106,7 +123,16 @@ func (c *Client) UpdateWebhook(webhookId string, webhook WebhookWrite) (*Webhook
106
123
return nil , err
107
124
}
108
125
109
- req , err := http .NewRequest ("PUT" , fmt .Sprintf ("%s/v3/accounts/%s/webhooks/subscription/%s" , c .HostURL , strconv .Itoa (c .AccountID ), webhookId ), strings .NewReader (string (webhookData )))
126
+ req , err := http .NewRequest (
127
+ "PUT" ,
128
+ fmt .Sprintf (
129
+ "%s/v3/accounts/%s/webhooks/subscription/%s" ,
130
+ c .HostURL ,
131
+ strconv .Itoa (c .AccountID ),
132
+ webhookId ,
133
+ ),
134
+ strings .NewReader (string (webhookData )),
135
+ )
110
136
if err != nil {
111
137
return nil , err
112
138
}
@@ -126,7 +152,16 @@ func (c *Client) UpdateWebhook(webhookId string, webhook WebhookWrite) (*Webhook
126
152
}
127
153
128
154
func (c * Client ) DeleteWebhook (webhookId string ) (string , error ) {
129
- req , err := http .NewRequest ("DELETE" , fmt .Sprintf ("%s/v3/accounts/%s/webhooks/subscription/%s" , c .HostURL , strconv .Itoa (c .AccountID ), webhookId ), nil )
155
+ req , err := http .NewRequest (
156
+ "DELETE" ,
157
+ fmt .Sprintf (
158
+ "%s/v3/accounts/%s/webhooks/subscription/%s" ,
159
+ c .HostURL ,
160
+ strconv .Itoa (c .AccountID ),
161
+ webhookId ,
162
+ ),
163
+ nil ,
164
+ )
130
165
if err != nil {
131
166
return "" , err
132
167
}
0 commit comments