20 KiB
\LinkAPI
All URIs are relative to https://api.hanzo.ai
| Method | HTTP request | Description |
|---|---|---|
| DeleteLinkById | Delete /v1/link/{id} | Logs out one account and stops the sessions it was running. |
| GetLink | Get /v1/link | Lists your linked accounts and the devices they sit on. |
| GetLinkById | Get /v1/link/{id} | Reads one linked account. |
| GetLinkDevicesByMachine | Get /v1/link/devices/{machine} | Shows one machine: its accounts, usage and live sessions. |
| GetLinkRoute | Get /v1/link/route | Gets the failover order across your linked accounts. |
| GetLinkUsage | Get /v1/link/usage | Shows one provider account's own usage dashboard. |
| GetLinkUsageAccounts | Get /v1/link/usage/accounts | Breaks down what the gateway routed through each of your accounts. |
| GetLinkUsageSummary | Get /v1/link/usage/summary | Shows plan consumption and Hanzo spend side by side. |
| PostLink | Post /v1/link | Registers a signed-in AI provider account on a machine. |
| PostLinkDevicesByMachineRevoke | Post /v1/link/devices/{machine}/revoke | Logs out every account on one machine and stops its sessions. |
| PostLinkUsage | Post /v1/link/usage | Reports usage samples from the device collector. |
DeleteLinkById
LinkRevokeResp DeleteLinkById(ctx, id).Execute()
Logs out one account and stops the sessions it was running.
Example
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/hanzoai/go-sdk/v8"
)
func main() {
id := "id_example" // string | ID is the link to act on, from the path. It is scoped to the caller, so another user's or org's id is a 404.
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.LinkAPI.DeleteLinkById(context.Background(), id).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `LinkAPI.DeleteLinkById``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `DeleteLinkById`: LinkRevokeResp
fmt.Fprintf(os.Stdout, "Response from `LinkAPI.DeleteLinkById`: %v\n", resp)
}
Path Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| id | string | ID is the link to act on, from the path. It is scoped to the caller, so another user's or org's id is a 404. |
Other Parameters
Other parameters are passed through a pointer to a apiDeleteLinkByIdRequest 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]
GetLink
LinkLinkList GetLink(ctx).Execute()
Lists your linked accounts and the devices they sit on.
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.LinkAPI.GetLink(context.Background()).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `LinkAPI.GetLink``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetLink`: LinkLinkList
fmt.Fprintf(os.Stdout, "Response from `LinkAPI.GetLink`: %v\n", resp)
}
Path Parameters
This endpoint does not need any parameter.
Other Parameters
Other parameters are passed through a pointer to a apiGetLinkRequest 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]
GetLinkById
LinkLinkView GetLinkById(ctx, id).Execute()
Reads one linked account.
Example
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/hanzoai/go-sdk/v8"
)
func main() {
id := "id_example" // string | ID is the link to act on, from the path. It is scoped to the caller, so another user's or org's id is a 404.
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.LinkAPI.GetLinkById(context.Background(), id).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `LinkAPI.GetLinkById``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetLinkById`: LinkLinkView
fmt.Fprintf(os.Stdout, "Response from `LinkAPI.GetLinkById`: %v\n", resp)
}
Path Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| id | string | ID is the link to act on, from the path. It is scoped to the caller, so another user's or org's id is a 404. |
Other Parameters
Other parameters are passed through a pointer to a apiGetLinkByIdRequest 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]
GetLinkDevicesByMachine
LinkDeviceView GetLinkDevicesByMachine(ctx, machine).Execute()
Shows one machine: its accounts, usage and live sessions.
Example
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/hanzoai/go-sdk/v8"
)
func main() {
machine := "machine_example" // string | Machine is the machine to act on, from the path. It is scoped to the caller, so a machine with none of the caller's accounts is a 404.
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.LinkAPI.GetLinkDevicesByMachine(context.Background(), machine).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `LinkAPI.GetLinkDevicesByMachine``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetLinkDevicesByMachine`: LinkDeviceView
fmt.Fprintf(os.Stdout, "Response from `LinkAPI.GetLinkDevicesByMachine`: %v\n", resp)
}
Path Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| machine | string | Machine is the machine to act on, from the path. It is scoped to the caller, so a machine with none of the caller's accounts is a 404. |
Other Parameters
Other parameters are passed through a pointer to a apiGetLinkDevicesByMachineRequest 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]
GetLinkRoute
LinkRoutePlan GetLinkRoute(ctx).Execute()
Gets the failover order across your linked accounts.
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.LinkAPI.GetLinkRoute(context.Background()).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `LinkAPI.GetLinkRoute``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetLinkRoute`: LinkRoutePlan
fmt.Fprintf(os.Stdout, "Response from `LinkAPI.GetLinkRoute`: %v\n", resp)
}
Path Parameters
This endpoint does not need any parameter.
Other Parameters
Other parameters are passed through a pointer to a apiGetLinkRouteRequest 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]
GetLinkUsage
LinkBoardResp GetLinkUsage(ctx).Provider(provider).Account(account).Window(window).Range_(range_).Execute()
Shows one provider account's own usage dashboard.
Example
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/hanzoai/go-sdk/v8"
)
func main() {
provider := "provider_example" // string | Provider is the provider whose meter to read. Required. (optional)
account := "account_example" // string | Account narrows to one account when a user has several with the provider. (optional)
window := "window_example" // string | Window selects a window class: 6h, day, week or month. Empty reads all. (optional)
range_ := "range__example" // string | Range is the period, one of 1h, 24h, 7d or 30d; empty means 24h, and an unknown label is 400, never a quiet fallback. (optional)
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.LinkAPI.GetLinkUsage(context.Background()).Provider(provider).Account(account).Window(window).Range_(range_).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `LinkAPI.GetLinkUsage``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetLinkUsage`: LinkBoardResp
fmt.Fprintf(os.Stdout, "Response from `LinkAPI.GetLinkUsage`: %v\n", resp)
}
Path Parameters
Other Parameters
Other parameters are passed through a pointer to a apiGetLinkUsageRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|---|---|---|
| provider | string | Provider is the provider whose meter to read. Required. | |
| account | string | Account narrows to one account when a user has several with the provider. | |
| window | string | Window selects a window class: 6h, day, week or month. Empty reads all. | |
| range_ | string | Range is the period, one of 1h, 24h, 7d or 30d; empty means 24h, and an unknown label is 400, never a quiet fallback. |
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]
GetLinkUsageAccounts
LinkAccountsUsage GetLinkUsageAccounts(ctx).Execute()
Breaks down what the gateway routed through each of your accounts.
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.LinkAPI.GetLinkUsageAccounts(context.Background()).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `LinkAPI.GetLinkUsageAccounts``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetLinkUsageAccounts`: LinkAccountsUsage
fmt.Fprintf(os.Stdout, "Response from `LinkAPI.GetLinkUsageAccounts`: %v\n", resp)
}
Path Parameters
This endpoint does not need any parameter.
Other Parameters
Other parameters are passed through a pointer to a apiGetLinkUsageAccountsRequest 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]
GetLinkUsageSummary
LinkSummaryResp GetLinkUsageSummary(ctx).Range_(range_).Execute()
Shows plan consumption and Hanzo spend side by side.
Example
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/hanzoai/go-sdk/v8"
)
func main() {
range_ := "range__example" // string | Range is the period, one of 1h, 24h, 7d or 30d; empty means 24h, and an unknown label is 400, never a silent substitution. (optional)
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.LinkAPI.GetLinkUsageSummary(context.Background()).Range_(range_).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `LinkAPI.GetLinkUsageSummary``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetLinkUsageSummary`: LinkSummaryResp
fmt.Fprintf(os.Stdout, "Response from `LinkAPI.GetLinkUsageSummary`: %v\n", resp)
}
Path Parameters
Other Parameters
Other parameters are passed through a pointer to a apiGetLinkUsageSummaryRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|---|---|---|
| range_ | string | Range is the period, one of 1h, 24h, 7d or 30d; empty means 24h, and an unknown label is 400, never a silent substitution. |
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]
PostLink
LinkLinkView PostLink(ctx).LinkEnrollReq(linkEnrollReq).Execute()
Registers a signed-in AI provider account on a machine.
Example
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/hanzoai/go-sdk/v8"
)
func main() {
linkEnrollReq := *openapiclient.NewLinkEnrollReq() // LinkEnrollReq |
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.LinkAPI.PostLink(context.Background()).LinkEnrollReq(linkEnrollReq).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `LinkAPI.PostLink``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `PostLink`: LinkLinkView
fmt.Fprintf(os.Stdout, "Response from `LinkAPI.PostLink`: %v\n", resp)
}
Path Parameters
Other Parameters
Other parameters are passed through a pointer to a apiPostLinkRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|---|---|---|
| linkEnrollReq | LinkEnrollReq |
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]
PostLinkDevicesByMachineRevoke
LinkRevokeResp PostLinkDevicesByMachineRevoke(ctx, machine).Execute()
Logs out every account on one machine and stops its sessions.
Example
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/hanzoai/go-sdk/v8"
)
func main() {
machine := "machine_example" // string | Machine is the machine to act on, from the path. It is scoped to the caller, so a machine with none of the caller's accounts is a 404.
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.LinkAPI.PostLinkDevicesByMachineRevoke(context.Background(), machine).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `LinkAPI.PostLinkDevicesByMachineRevoke``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `PostLinkDevicesByMachineRevoke`: LinkRevokeResp
fmt.Fprintf(os.Stdout, "Response from `LinkAPI.PostLinkDevicesByMachineRevoke`: %v\n", resp)
}
Path Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| machine | string | Machine is the machine to act on, from the path. It is scoped to the caller, so a machine with none of the caller's accounts is a 404. |
Other Parameters
Other parameters are passed through a pointer to a apiPostLinkDevicesByMachineRevokeRequest 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]
PostLinkUsage
LinkIngestResp PostLinkUsage(ctx).LinkIngestReq(linkIngestReq).Execute()
Reports usage samples from the device collector.
Example
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/hanzoai/go-sdk/v8"
)
func main() {
linkIngestReq := *openapiclient.NewLinkIngestReq() // LinkIngestReq |
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.LinkAPI.PostLinkUsage(context.Background()).LinkIngestReq(linkIngestReq).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `LinkAPI.PostLinkUsage``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `PostLinkUsage`: LinkIngestResp
fmt.Fprintf(os.Stdout, "Response from `LinkAPI.PostLinkUsage`: %v\n", resp)
}
Path Parameters
Other Parameters
Other parameters are passed through a pointer to a apiPostLinkUsageRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|---|---|---|
| linkIngestReq | LinkIngestReq |
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]