go get github.com/speakeasy-sdks/preset-sdk-go
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
}
}
- 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
- GetAPIV1AssetsExport - Export Assets
- PostAPIV1AssetsImport - Import Assets
- 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
- 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
- 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
- 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
- GetAPIV1Query - Get All Workspace Queries
- 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
- PostAPIV1SqllabExecute - Execute a SQL Query
- PostAPIV1TeamsTeamSlugWorkspacesWorkspaceSlugGuestToken - Create a new Guest Token
- PostV1Auth - Get a JWT Token
- 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
- 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
- GetV1TeamsTeamSlugWorkspaces - Get Workspaces from a Team
- GetV1TeamsTeamSlugWorkspacesWorkspaceIDMemberships - Get Workspace Users and Roles
- PostV1TeamsTeamSlugWorkspaces - Create Workspace for a Team
- PutV1TeamsTeamSlugWorkspacesWorkspaceIDMembership - Change Workspace Role
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:
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 | / |
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())
}
}
}
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
}
}
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
}
}
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.
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
}
}
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.
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!