{"id":21455528,"url":"https://github.com/hookdeck/hookdeck-go-sdk","last_synced_at":"2025-07-14T23:32:45.100Z","repository":{"id":188317001,"uuid":"662197420","full_name":"hookdeck/hookdeck-go-sdk","owner":"hookdeck","description":"Go SDK for the Hookdeck API","archived":false,"fork":false,"pushed_at":"2024-08-21T18:48:01.000Z","size":681,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-08-21T21:12:37.873Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hookdeck.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-04T15:06:04.000Z","updated_at":"2024-08-21T18:46:31.000Z","dependencies_parsed_at":"2024-01-25T17:55:27.792Z","dependency_job_id":"30a3eafd-3ca9-4501-ad54-21b9296ff525","html_url":"https://github.com/hookdeck/hookdeck-go-sdk","commit_stats":null,"previous_names":["hookdeck/hookdeck-go-sdk","fern-hookdeck/hookdeck-go"],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hookdeck%2Fhookdeck-go-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hookdeck%2Fhookdeck-go-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hookdeck%2Fhookdeck-go-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hookdeck%2Fhookdeck-go-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hookdeck","download_url":"https://codeload.github.com/hookdeck/hookdeck-go-sdk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226002997,"owners_count":17558157,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-23T05:12:31.948Z","updated_at":"2025-07-14T23:32:45.092Z","avatar_url":"https://github.com/hookdeck.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HookDeck Go Library\n\nThe HookDeck Go library provides convenient access to the HookDeck API from Go.\n\n[![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-SDK%20generated%20by%20Fern-brightgreen)](https://github.com/fern-api/fern)\n[![go shield](https://img.shields.io/badge/go-docs-blue)](https://pkg.go.dev/github.com/hookdeck/hookdeck-go-sdk)\n\n## Requirements\n\nThis module requires Go version \u003e= 1.19.\n\n## Installation\n\nRun the following command to use the HookDeck Go library in your Go module:\n\n```sh\ngo get github.com/hookdeck/hookdeck-go-sdk\n```\n\nThis module requires Go version \u003e= 1.19.\n\n## Instantiation\n\n```go\nimport (\n  hookdeckclient \"github.com/hookdeck/hookdeck-go-sdk/client\"\n  hookdeckoption \"github.com/hookdeck/hookdeck-go-sdk/option\"\n)\n\nclient := hookdeckclient.NewClient(\n  hookdeckoption.WithToken(\"\u003cYOUR_AUTH_TOKEN\u003e\"),\n)\n```\n\n## Usage\n\n```go\npackage main\n\nimport (\n  \"context\"\n  \"fmt\"\n\n  hookdeck \"github.com/hookdeck/hookdeck-go-sdk\"\n  hookdeckclient \"github.com/hookdeck/hookdeck-go-sdk/client\"\n  hookdeckoption \"github.com/hookdeck/hookdeck-go-sdk/option\"\n)\n\nclient := hookdeckclient.NewClient(\n  hookdeckoption.WithToken(\"\u003cYOUR_AUTH_TOKEN\u003e\"),\n)\nattempts, err := client.Attempts().GetAttempts(\n  context.TODO(),\n  \u0026hookdeck.GetAttemptsRequest{\n    EventId: hookdeck.String(\"\u003cEVENT_ID\u003e\"),\n  },\n)\nif err != nil {\n  return err\n}\nfmt.Printf(\"Got %d attempts\\n\", *attempts.Count)\n```\n\n## Timeouts\n\nSetting a timeout for each individual request is as simple as using the standard\n`context` library. Setting a one second timeout for an individual API call looks\nlike the following:\n\n```go\nctx, cancel := context.WithTimeout(context.TODO(), time.Second)\ndefer cancel()\nattempts, err := client.Attempts().GetAttempts(\n  context.TODO(),\n  \u0026hookdeck.GetAttemptsRequest{\n    EventId: hookdeck.String(\"\u003cEVENT_ID\u003e\"),\n  },\n)\nif err != nil {\n  return err\n}\n```\n\n## Client Options\n\nA variety of client options are included to adapt the behavior of the library, which includes\nconfiguring authorization tokens to be sent on every request, or providing your own instrumented\n`*http.Client`. Both of these options are shown below:\n\n```go\nclient := hookdeckclient.NewClient(\n  hookdeckclient.ClientWithAuthToken(\"\u003cYOUR_AUTH_TOKEN\u003e\"),\n  hookdeckclient.ClientWithHTTPClient(\n    \u0026http.Client{\n      Timeout: 5 * time.Second,\n    },\n  ),\n)\n```\n\n\u003e Providing your own `*http.Client` is recommended. Otherwise, the `http.DefaultClient` will be used,\n\u003e and your client will wait indefinitely for a response (unless the per-request, context-based timeout\n\u003e is used).\n\n## Errors\n\nStructured error types are returned from API calls that return non-success status codes. For example,\nyou can check if the error was due to a bad request (i.e. status code 400) with the following:\n\n```go\nattempts, err := client.Attempts().GetAttempts(\n  context.TODO(),\n  \u0026hookdeck.GetAttemptsRequest{\n    EventId: hookdeck.String(\"\u003cEVENT_ID\u003e\"),\n  },\n)\nif err != nil {\n  if badRequestErr, ok := err.(*hookdeck.BadRequestError);\n    // Do something with the bad request ...\n  }\n  return err\n}\n```\n\nThese errors are also compatible with the `errors.Is` and `errors.As` APIs, so you can access the error\nlike so:\n\n```go\nattempts, err := client.Attempts().GetAttempts(\n  context.TODO(),\n  \u0026hookdeck.GetAttemptsRequest{\n    EventId: hookdeck.String(\"\u003cEVENT_ID\u003e\"),\n  },\n)\nif err != nil {\n  var badRequestErr *hookdeck.BadRequestError\n  if errors.As(err, badRequestErr); ok {\n    // Do something with the bad request ...\n  }\n  return err\n}\n```\n\nIf you'd like to wrap the errors with additional information and still retain the ability to access the type\nwith `errors.Is` and `errors.As`, you can use the `%w` directive:\n\n```go\nattempts, err := client.Attempts().GetAttempts(\n  context.TODO(),\n  \u0026hookdeck.GetAttemptsRequest{\n    EventId: hookdeck.String(\"\u003cEVENT_ID\u003e\"),\n  },\n)\nif err != nil {\n  return fmt.Errorf(\"failed to get attempts: %w\", err)\n}\n```\n\n## Beta status\n\nThis SDK is in beta, and there may be breaking changes between versions without a major version update.\nTherefore, we recommend pinning the package version to a specific version in your `go.mod` file. This way,\nyou can install the same version each time without breaking changes unless you are intentionally looking\nfor the latest version.\n\n## Contributing\n\nWhile we value open-source contributions to this SDK, this library is generated programmatically. Additions\nmade directly to this library would have to be moved over to our generation code, otherwise they would be\noverwritten upon the next generated release. Feel free to open a PR as a proof of concept, but know that we\nwill not be able to merge it as-is. We suggest opening an issue first to discuss with us!\n\nOn the other hand, contributions to the README are always very welcome!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhookdeck%2Fhookdeck-go-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhookdeck%2Fhookdeck-go-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhookdeck%2Fhookdeck-go-sdk/lists"}