Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/speakeasy-sdks/hex-go-sdk
Hex Go SDK
https://github.com/speakeasy-sdks/hex-go-sdk
analytics api data go sdk
Last synced: 2 days ago
JSON representation
Hex Go SDK
- Host: GitHub
- URL: https://github.com/speakeasy-sdks/hex-go-sdk
- Owner: speakeasy-sdks
- License: mit
- Created: 2023-02-15T23:39:56.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-04-02T21:12:47.000Z (7 months ago)
- Last Synced: 2024-06-21T06:30:10.955Z (5 months ago)
- Topics: analytics, api, data, go, sdk
- Language: Go
- Homepage:
- Size: 46.9 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Hex Go SDK
## SDK Installation
```bash
go get github.com/speakeasy-sdks/hex-go-sdk
```## Authentication
API Requests are authenticated using Oauth 2.0 Bearer Tokens in the header of the HTTP request. The token is always bound to a single Hex user's account and requests are executed as that Hex user, meaning the user can only execute requests against projects that are in line with the current permissions for that project.
### Token creation
![](https://learn.hex.tech/assets/images/api-tokens-3e39d4aea5ed40b3aeff4d583c80a41d.png)
Personal access tokens can be created from the API keys section of the User settings page.
A new token can be created by selecting the New Token button, then inputting a description and an expiration time frame. An existing token can be regenerated at any time by selecting the three-dot menu to the right of the token, and selecting Regenerate.
## SDK Example Usage
```go
package mainimport (
"log"
"github.com/speakeasy-sdks/hex-go-sdk"
"github.com/speakeasy-sdks/hex-go-sdk/pkg/models/shared"
"github.com/speakeasy-sdks/hex-go-sdk/pkg/models/operations"
)func main() {
opts := []hex.SDKOption{
hex.WithSecurity(
shared.Security{
BearerAuth: shared.SchemeBearerAuth{
Authorization: "Bearer YOUR_BEARER_TOKEN_HERE",
},
}
),
}s := hex.New(opts...)
req := operations.CancelRunRequest{
PathParams: operations.CancelRunPathParams{
ProjectID: "unde",
RunID: "deserunt",
},
}
res, err := s.CancelRun(ctx, req)
if err != nil {
log.Fatal(err)
}if res.StatusCode == http.StatusOK {
// handle response
}
```## SDK Available Operations
### Hex SDK
* `CancelRun` - Cancel a project run.
* `GetProjectRuns` - Get the status of the API-triggered runs of a project.
* `GetRunStatus` - Get the status of a project run.
* `RunProject` - Trigger a run of the latest published version of a project.### SDK Generated by [Speakeasy](https://docs.speakeasyapi.dev/docs/using-speakeasy/client-sdks)