16 KiB
\WebhookAPI
All URIs are relative to https://api.hanzo.ai
| Method | HTTP request | Description |
|---|---|---|
| DeleteWebhookById | Delete /v1/webhook/{id} | Removes one of the caller org's webhook endpoints and answers 204 with no body. |
| GetWebhook | Get /v1/webhook | Returns every webhook endpoint the caller's org has registered, newest first, each with its 7-day delivery and failure counts. |
| GetWebhookById | Get /v1/webhook/{id} | Returns one of the caller org's webhook endpoints with its 7-day delivery and failure counts, signing secret redacted. |
| GetWebhookByIdDeliveries | Get /v1/webhook/{id}/deliveries | Returns one endpoint's per-attempt delivery log, newest first — the record of what was sent, what the subscriber answered, and how long it took. |
| PostWebhook | Post /v1/webhook | Registers a new webhook subscription for the caller's org and answers 201 with the endpoint INCLUDING its freshly minted signing secret. |
| PostWebhookByIdSecret | Post /v1/webhook/{id}/secret | Mints a NEW HMAC signing secret for the endpoint and answers the endpoint WITH it — the only other response besides create that ever carries a secret. |
| PostWebhookByIdTest | Post /v1/webhook/{id}/test | Sends ONE signed test event to the endpoint right now and answers the outcome inline, so the console can show whether the subscriber is reachable without waiting for real traffic. |
| PutWebhookById | Put /v1/webhook/{id} | Replaces the editable fields of one of the caller org's endpoints — url, events, status and description — and answers the stored row with its secret redacted. |
DeleteWebhookById
DeleteWebhookById(ctx, id).Execute()
Removes one of the caller org's webhook endpoints and answers 204 with no body.
Example
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/hanzoai/go-sdk/v8"
)
func main() {
id := "wh_9f8c1d2e" // string |
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
r, err := apiClient.WebhookAPI.DeleteWebhookById(context.Background(), id).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `WebhookAPI.DeleteWebhookById``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
Path Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| id | string |
Other Parameters
Other parameters are passed through a pointer to a apiDeleteWebhookByIdRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|
Return type
(empty response body)
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/problem+json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
GetWebhook
WebhookEndpointList GetWebhook(ctx).Execute()
Returns every webhook endpoint the caller's org has registered, newest first, each with its 7-day delivery and failure counts.
Example
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/hanzoai/go-sdk/v8"
)
func main() {
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.WebhookAPI.GetWebhook(context.Background()).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `WebhookAPI.GetWebhook``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetWebhook`: WebhookEndpointList
fmt.Fprintf(os.Stdout, "Response from `WebhookAPI.GetWebhook`: %v\n", resp)
}
Path Parameters
This endpoint does not need any parameter.
Other Parameters
Other parameters are passed through a pointer to a apiGetWebhookRequest struct via the builder pattern
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json, application/problem+json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
GetWebhookById
WebhookEndpoint GetWebhookById(ctx, id).Execute()
Returns one of the caller org's webhook endpoints with its 7-day delivery and failure counts, signing secret redacted.
Example
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/hanzoai/go-sdk/v8"
)
func main() {
id := "wh_9f8c1d2e" // string |
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.WebhookAPI.GetWebhookById(context.Background(), id).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `WebhookAPI.GetWebhookById``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetWebhookById`: WebhookEndpoint
fmt.Fprintf(os.Stdout, "Response from `WebhookAPI.GetWebhookById`: %v\n", resp)
}
Path Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| id | string |
Other Parameters
Other parameters are passed through a pointer to a apiGetWebhookByIdRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json, application/problem+json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
GetWebhookByIdDeliveries
WebhookDeliveryList GetWebhookByIdDeliveries(ctx, id).Limit(limit).Status(status).Execute()
Returns one endpoint's per-attempt delivery log, newest first — the record of what was sent, what the subscriber answered, and how long it took.
Example
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/hanzoai/go-sdk/v8"
)
func main() {
id := "wh_9f8c1d2e" // string |
limit := int64(100) // int64 | Limit caps how many attempts come back: default 50, maximum 200. A value that is not a positive integer reads as the default. (optional)
status := "failed" // string | Status narrows the log to one outcome: \"ok\", \"retrying\" or \"failed\". Empty returns every attempt. (optional)
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.WebhookAPI.GetWebhookByIdDeliveries(context.Background(), id).Limit(limit).Status(status).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `WebhookAPI.GetWebhookByIdDeliveries``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetWebhookByIdDeliveries`: WebhookDeliveryList
fmt.Fprintf(os.Stdout, "Response from `WebhookAPI.GetWebhookByIdDeliveries`: %v\n", resp)
}
Path Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| id | string |
Other Parameters
Other parameters are passed through a pointer to a apiGetWebhookByIdDeliveriesRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|
limit | int64 | Limit caps how many attempts come back: default 50, maximum 200. A value that is not a positive integer reads as the default. | status | string | Status narrows the log to one outcome: "ok", "retrying" or "failed". Empty returns every attempt. |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json, application/problem+json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
PostWebhook
WebhookEndpoint PostWebhook(ctx).WebhookCreateEndpointIn(webhookCreateEndpointIn).Execute()
Registers a new webhook subscription for the caller's org and answers 201 with the endpoint INCLUDING its freshly minted signing secret.
Example
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/hanzoai/go-sdk/v8"
)
func main() {
webhookCreateEndpointIn := *openapiclient.NewWebhookCreateEndpointIn() // WebhookCreateEndpointIn |
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.WebhookAPI.PostWebhook(context.Background()).WebhookCreateEndpointIn(webhookCreateEndpointIn).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `WebhookAPI.PostWebhook``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `PostWebhook`: WebhookEndpoint
fmt.Fprintf(os.Stdout, "Response from `WebhookAPI.PostWebhook`: %v\n", resp)
}
Path Parameters
Other Parameters
Other parameters are passed through a pointer to a apiPostWebhookRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|---|---|---|
| webhookCreateEndpointIn | WebhookCreateEndpointIn |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json, application/problem+json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
PostWebhookByIdSecret
WebhookEndpoint PostWebhookByIdSecret(ctx, id).Execute()
Mints a NEW HMAC signing secret for the endpoint and answers the endpoint WITH it — the only other response besides create that ever carries a secret.
Example
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/hanzoai/go-sdk/v8"
)
func main() {
id := "wh_9f8c1d2e" // string |
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.WebhookAPI.PostWebhookByIdSecret(context.Background(), id).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `WebhookAPI.PostWebhookByIdSecret``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `PostWebhookByIdSecret`: WebhookEndpoint
fmt.Fprintf(os.Stdout, "Response from `WebhookAPI.PostWebhookByIdSecret`: %v\n", resp)
}
Path Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| id | string |
Other Parameters
Other parameters are passed through a pointer to a apiPostWebhookByIdSecretRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json, application/problem+json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
PostWebhookByIdTest
WebhookTestResult PostWebhookByIdTest(ctx, id).Execute()
Sends ONE signed test event to the endpoint right now and answers the outcome inline, so the console can show whether the subscriber is reachable without waiting for real traffic.
Example
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/hanzoai/go-sdk/v8"
)
func main() {
id := "wh_9f8c1d2e" // string |
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.WebhookAPI.PostWebhookByIdTest(context.Background(), id).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `WebhookAPI.PostWebhookByIdTest``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `PostWebhookByIdTest`: WebhookTestResult
fmt.Fprintf(os.Stdout, "Response from `WebhookAPI.PostWebhookByIdTest`: %v\n", resp)
}
Path Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| id | string |
Other Parameters
Other parameters are passed through a pointer to a apiPostWebhookByIdTestRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json, application/problem+json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
PutWebhookById
WebhookEndpoint PutWebhookById(ctx, id).WebhookUpdateEndpointIn(webhookUpdateEndpointIn).Execute()
Replaces the editable fields of one of the caller org's endpoints — url, events, status and description — and answers the stored row with its secret redacted.
Example
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/hanzoai/go-sdk/v8"
)
func main() {
id := "wh_9f8c1d2e" // string |
webhookUpdateEndpointIn := *openapiclient.NewWebhookUpdateEndpointIn() // WebhookUpdateEndpointIn |
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.WebhookAPI.PutWebhookById(context.Background(), id).WebhookUpdateEndpointIn(webhookUpdateEndpointIn).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `WebhookAPI.PutWebhookById``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `PutWebhookById`: WebhookEndpoint
fmt.Fprintf(os.Stdout, "Response from `WebhookAPI.PutWebhookById`: %v\n", resp)
}
Path Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| id | string |
Other Parameters
Other parameters are passed through a pointer to a apiPutWebhookByIdRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|
webhookUpdateEndpointIn | WebhookUpdateEndpointIn | |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json, application/problem+json
[Back to top] [Back to API list] [Back to Model list] [Back to README]