Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

Awesome Lists containing this project

README

        

# Hex Go SDK


Programmatically run projects with the Hex API.




## 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 main

import (
"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)