Skip to content

Commit 41c5ff7

Browse files
committed
webhook log
1 parent 68083dc commit 41c5ff7

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

webhook_logs.go

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ func (s RequestStatus) String() string {
4343
}
4444
}
4545

46-
// Log - stination defines where particular request was going with
47-
// output ID and additional stats
46+
// Log - received webhook event
4847
type Log struct {
4948
ID string `json:"id"`
5049
CreatedAt time.Time `json:"created_at"`
@@ -174,3 +173,27 @@ func (api *API) GetWebhookLog(id string) (*Log, error) {
174173

175174
return &webhookLog, nil
176175
}
176+
177+
// WebhookLogsUpdateRequest is used to update Webhook Relay request if used
178+
// for example with WebSocket transponder (it becomes client's responsibility
179+
// to do this action). Response information must be sent within 10 seconds
180+
// of receiving the webhook.
181+
type WebhookLogsUpdateRequest struct {
182+
ID string `json:"id"`
183+
StatusCode int `json:"status_code"`
184+
ResponseBody []byte `json:"response_body"`
185+
ResponseHeaders Headers `json:"response_headers" `
186+
Status RequestStatus `json:"status"`
187+
Retries int `json:"retries"`
188+
}
189+
190+
// UpdateWebhookLog - update webhook log response body, headers and status code.
191+
func (api *API) UpdateWebhookLog(updateRequest *WebhookLogsUpdateRequest) error {
192+
193+
_, err := api.makeRequest(http.MethodPut, "/logs/"+updateRequest.ID, updateRequest)
194+
if err != nil {
195+
return errors.Wrap(err, errMakeRequestError)
196+
}
197+
198+
return nil
199+
}

0 commit comments

Comments
 (0)