# Packages
# README
github.com/speakeasy-sdks/preset-sdk-go
SDK Installation
go get github.com/speakeasy-sdks/preset-sdk-go
SDK Example Usage
package main
import (
"context"
presetsdkgo "github.com/speakeasy-sdks/preset-sdk-go"
"github.com/speakeasy-sdks/preset-sdk-go/pkg/models/operations"
"github.com/speakeasy-sdks/preset-sdk-go/pkg/models/shared"
"log"
)
func main() {
s := presetsdkgo.New(
presetsdkgo.WithSecurity(""),
)
ctx := context.Background()
res, err := s.SupersetAPIsOpenSourceGreaterThanAnnotationLayers.DeleteAPIV1AnnotationLayer(ctx, operations.DeleteAPIV1AnnotationLayerRequest{})
if err != nil {
log.Fatal(err)
}
if res.StatusCode == http.StatusOK {
// handle response
}
}
Available Resources and Operations
SupersetAPIsOpenSourceGreaterThanAnnotationLayers
- DeleteAPIV1AnnotationLayer - Delete multiple Annotations Layers
- DeleteAPIV1AnnotationLayerAnnotationLayerID - Delete an Annotation Layer
- DeleteAPIV1AnnotationLayerAnnotationLayerIDAnnotation - Delete multiple Annotations from an Annotation Layer
- DeleteAPIV1AnnotationLayerAnnotationLayerIDAnnotationAnnotationID - Delete an Annotation from an Annotation Layer
- GetAPIV1AnnotationLayer - Get all Annotation Layers from a Workspace
- GetAPIV1AnnotationLayerAnnotationLayerID - Get an Annotation Layer
- GetAPIV1AnnotationLayerAnnotationLayerIDAnnotation - Get all Annotations from an Annotation Layer
- GetAPIV1AnnotationLayerAnnotationLayerIDAnnotationAnnotationID - Get an Annotation from an Annotation Layer
- PostAPIV1AnnotationLayer - Create an Annotation Layer
- PostAPIV1AnnotationLayerAnnotationLayerIDAnnotation - Create an Annotation in an Annotation Layer
- PutAPIV1AnnotationLayerAnnotationLayerID - Update an Annotation Layer
- PutAPIV1AnnotationLayerAnnotationLayerIDAnnotationAnnotationID - Update an Annotation from an Annotation Layer
SupersetAPIsOpenSourceGreaterThanAssets
- GetAPIV1AssetsExport - Export Assets
- PostAPIV1AssetsImport - Import Assets
SupersetAPIsOpenSourceGreaterThanCharts
- DeleteAPIV1ChartChartID - Delete a Chart
- GetAPIV1Chart - Get all Charts from a Workspace
- GetAPIV1ChartExport - Export Charts
- GetAPIV1ChartRelatedOwners - Get all possible Chart Owners
- GetAPIV1ChartChartID - Get a Chart
- GetAPIV1ChartChartIDCacheScreenshot - Get Chart Screenshot
- GetAPIV1ChartChartIDData - Get Chart's Data
- PostAPIV1Chart - Create a Chart
- PostAPIV1ChartData - Refresh a Chart
- PostAPIV1ChartImport - Import a Chart
- PutAPIV1ChartChartID - Update a Chart
SupersetAPIsOpenSourceGreaterThanDashboards
- DeleteAPIV1DashboardDashboardID - Delete Dashboard
- GetAPIV1Dashboard - Get all Dashboards From a Workspace
- GetAPIV1DashboardInfo - Get Dashboard Info
- GetAPIV1DashboardExport - Export Dashboards
- GetAPIV1DashboardDashboardID - Get a Dashboard
- GetAPIV1DashboardDashboardIDCharts - Get Charts from a Dashboard
- GetAPIV1DashboardDashboardIDDatasets - Get Datasets from a Dashboard
- PostAPIV1Dashboard - Create a Dashboard
- PostAPIV1DashboardImport - Import a Dashboard
- PostAPIV1DashboardDashboardIDPermalink - Create a Permalink to a Dashboard
- PutAPIV1DashboardDashboardID - Update a Dashboard
SupersetAPIsOpenSourceGreaterThanDatabases
- CreateDatabaseUsingSSH - Create a Database Connection using SSH
- GetAPIV1Database - Get all Database Connections from a Workspace
- GetAPIV1DatabaseExport - Export Database Connections
- GetAPIV1DatabaseDatabaseID - Get a Database Connection
- GetAPIV1DatabaseDatabaseIDConnection - Get a Database Connection Parameters
- PostAPIV1Database - Create a Database Connection
- PostAPIV1DatabaseImport - Import a Database Connection
- PutAPIV1DatabaseDatabaseID - Update a Database Connection
SupersetAPIsOpenSourceGreaterThanDatasets
- DeleteAPIV1DatasetDatasetID - Delete a Dataset
- GetAPIV1Dataset - Get all Datasets from a Workspace
- GetAPIV1DatasetExport - Export Datasets
- GetAPIV1DatasetRelatedOwners - Get all possible Dataset Owners
- GetAPIV1DatasetDatasetID - Get a Dataset
- PostAPIV1Dataset - Create a Virtual Dataset
- PostAPIV1DatasetImport - Import a Dataset
- PutAPIV1DatasetDatasetID - Update a Virtual Dataset
- PutAPIV1DatasetDatasetIDRefresh - Refresh a Dataset
SupersetAPIsOpenSourceGreaterThanQueries
- GetAPIV1Query - Get All Workspace Queries
SupersetAPIsOpenSourceGreaterThanAlertsAndReports
- GetAPIV1Report - Get all Reports from a Workspace
- GetAPIV1ReportInfo - Get Alerts & Reports API metadata Info
- GetAPIV1ReportAlertIDORReportID - Get an Alert/Report
- PostAPIV1Report - Create a Dashboard Alert
- PutAPIV1ReportAlertIDORReportID - Disable an Alert/Report
SupersetAPIsOpenSourceGreaterThanSQLLab
- PostAPIV1SqllabExecute - Execute a SQL Query
PresetManagerAPIsGreaterThanEmbedded
- PostAPIV1TeamsTeamSlugWorkspacesWorkspaceSlugGuestToken - Create a new Guest Token
Authentication
- PostV1Auth - Get a JWT Token
PresetManagerAPIsGreaterThanTeams
- DeleteV1TeamsTeamSlugInvitesInviteID - Delete Pending Invite
- DeleteV1TeamsTeamSlugMembershipsUserID - Delete a Team Member
- GetV1Teams - Get Preset Teams
- GetV1TeamsTeamSlugInvites - Get Pending Team Invites
- GetV1TeamsTeamSlugMemberships - Get Team Members
- PatchV1TeamsTeamSlugMembershipsUserID - Change User Role
- PostV1TeamsTeamSlugInvites - Create a Team Invite
- PostV1TeamsTeamSlugInvitesMany - Create Multiple Team Invites
- PostV1TeamsTeamSlugInvitesResendInviteID - Resend Invite
- PutV1TeamsTeamSlug - Update Team Title
PresetManagerAPIsGreaterThanPermissions
- DeleteV1TeamsTeamSlugPermissionsPermissionName - Delete Row Level Security
- DeleteV1TeamsTeamSlugPermissionsPermissionNameGrantees - Delete Grantee from existing Permission
- GetV1TeamsTeamSlugPermissions - Get Permissions
- GetV1TeamsTeamSlugPermissionsResources - Get Resources
- PatchV1TeamsTeamSlugPermissionsPermissionName - Update Row Level Security
- PostV1TeamsTeamSlugPermissions - Create Row Level Security
- PostV1TeamsTeamSlugPermissionsPermissionNameGrantees - Add Grantees to existing Permission
PresetManagerAPIsGreaterThanWorkspaces
- GetV1TeamsTeamSlugWorkspaces - Get Workspaces from a Team
- GetV1TeamsTeamSlugWorkspacesWorkspaceIDMemberships - Get Workspace Users and Roles
- PostV1TeamsTeamSlugWorkspaces - Create Workspace for a Team
- PutV1TeamsTeamSlugWorkspacesWorkspaceIDMembership - Change Workspace Role
Pagination
Some of the endpoints in this SDK support pagination. To use pagination, you make your SDK calls as usual, but the
returned response object will have a Next
method that can be called to pull down the next group of results. If the
return value of Next
is nil
, then there are no more pages to be fetched.
Here's an example of one such pagination call:
Error Handling
Handling errors in this SDK should largely match your expectations. All operations return a response object or an error, they will never return both. When specified by the OpenAPI spec document, the SDK will return the appropriate subclass.
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 400-600 | / |
Example
package main
import (
"context"
presetsdkgo "github.com/speakeasy-sdks/preset-sdk-go"
"github.com/speakeasy-sdks/preset-sdk-go/pkg/models/operations"
"github.com/speakeasy-sdks/preset-sdk-go/pkg/models/shared"
"log"
)
func main() {
s := presetsdkgo.New(
presetsdkgo.WithSecurity(""),
)
ctx := context.Background()
res, err := s.SupersetAPIsOpenSourceGreaterThanAnnotationLayers.DeleteAPIV1AnnotationLayer(ctx, operations.DeleteAPIV1AnnotationLayerRequest{})
if err != nil {
var e *sdkerrors.SDKError
if errors.As(err, &e) {
// handle error
log.Fatal(e.Error())
}
}
}
Server Selection
Select Server by Index
You can override the default server globally using the WithServerIndex
option when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers:
# | Server | Variables |
---|---|---|
0 | https://api.app.preset.io | None |
1 | https://manage.app.preset.io | None |
2 | https://{{workspaceslug}}.{{workspaceregion}}.app.preset.io | None |
3 | http://{{workspaceslug}}.{{workspaceregion}}.app.preset.io | None |
For example:
package main
import (
"context"
presetsdkgo "github.com/speakeasy-sdks/preset-sdk-go"
"github.com/speakeasy-sdks/preset-sdk-go/pkg/models/operations"
"github.com/speakeasy-sdks/preset-sdk-go/pkg/models/shared"
"log"
)
func main() {
s := presetsdkgo.New(
presetsdkgo.WithServerIndex(3),
presetsdkgo.WithSecurity(""),
)
ctx := context.Background()
res, err := s.SupersetAPIsOpenSourceGreaterThanAnnotationLayers.DeleteAPIV1AnnotationLayer(ctx, operations.DeleteAPIV1AnnotationLayerRequest{})
if err != nil {
log.Fatal(err)
}
if res.StatusCode == http.StatusOK {
// handle response
}
}
Override Server URL Per-Client
The default server can also be overridden globally using the WithServerURL
option when initializing the SDK client instance. For example:
package main
import (
"context"
presetsdkgo "github.com/speakeasy-sdks/preset-sdk-go"
"github.com/speakeasy-sdks/preset-sdk-go/pkg/models/operations"
"github.com/speakeasy-sdks/preset-sdk-go/pkg/models/shared"
"log"
)
func main() {
s := presetsdkgo.New(
presetsdkgo.WithServerURL("https://api.app.preset.io"),
presetsdkgo.WithSecurity(""),
)
ctx := context.Background()
res, err := s.SupersetAPIsOpenSourceGreaterThanAnnotationLayers.DeleteAPIV1AnnotationLayer(ctx, operations.DeleteAPIV1AnnotationLayerRequest{})
if err != nil {
log.Fatal(err)
}
if res.StatusCode == http.StatusOK {
// handle response
}
}
Custom HTTP Client
The Go SDK makes API calls that wrap an internal HTTP client. The requirements for the HTTP client are very simple. It must match this interface:
type HTTPClient interface {
Do(req *http.Request) (*http.Response, error)
}
The built-in net/http
client satisfies this interface and a default client based on the built-in is provided by default. To replace this default with a client of your own, you can implement this interface yourself or provide your own client configured as desired. Here's a simple example, which adds a client with a 30 second timeout.
import (
"net/http"
"time"
"github.com/myorg/your-go-sdk"
)
var (
httpClient = &http.Client{Timeout: 30 * time.Second}
sdkClient = sdk.New(sdk.WithClient(httpClient))
)
This can be a convenient way to configure timeouts, cookies, proxies, custom headers, and other low-level configuration.
Authentication
Per-Client Security Schemes
This SDK supports the following security scheme globally:
Name | Type | Scheme |
---|---|---|
BearerAuth | http | HTTP Bearer |
You can configure it using the WithSecurity
option when initializing the SDK client instance. For example:
package main
import (
"context"
presetsdkgo "github.com/speakeasy-sdks/preset-sdk-go"
"github.com/speakeasy-sdks/preset-sdk-go/pkg/models/operations"
"github.com/speakeasy-sdks/preset-sdk-go/pkg/models/shared"
"log"
)
func main() {
s := presetsdkgo.New(
presetsdkgo.WithSecurity(""),
)
ctx := context.Background()
res, err := s.SupersetAPIsOpenSourceGreaterThanAnnotationLayers.DeleteAPIV1AnnotationLayer(ctx, operations.DeleteAPIV1AnnotationLayerRequest{})
if err != nil {
log.Fatal(err)
}
if res.StatusCode == http.StatusOK {
// handle response
}
}
Maturity
This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally looking for the latest version.
Contributions
While we value open-source contributions to this SDK, this library is generated programmatically. Feel free to open a PR or a Github issue as a proof of concept and we'll do our best to include it in a future release!