(Workspaces)
REST APIs for managing Workspaces (speakeasy tenancy)
- Create - Create a workspace
- CreateToken - Create a token for a particular workspace
- DeleteToken - Delete a token for a particular workspace
- Get - Get workspace by context
- GetAll - Get workspaces for a user
- GetByID - Get workspace
- GetFeatureFlags - Get workspace feature flags
- GetSettings - Get workspace settings
- GetTeam - Get team members for a particular workspace
- GetTokens - Get tokens for a particular workspace
- GrantAccess - Grant a user access to a particular workspace
- RevokeAccess - Revoke a user's access to a particular workspace
- SetFeatureFlags - Set workspace feature flags
- Update - Update workspace details
- UpdateSettings - Update workspace settings
Creates a workspace
package main
import(
"context"
speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3"
"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared"
"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/types"
"log"
)
func main() {
ctx := context.Background()
s := speakeasyclientsdkgo.New(
speakeasyclientsdkgo.WithSecurity(shared.Security{
APIKey: speakeasyclientsdkgo.String("<YOUR_API_KEY_HERE>"),
}),
)
res, err := s.Workspaces.Create(ctx, shared.Workspace{
CreatedAt: types.MustTimeFromString("2024-06-17T07:14:55.338Z"),
ID: "<id>",
Name: "<value>",
OrganizationID: "<id>",
Slug: "<value>",
UpdatedAt: types.MustTimeFromString("2024-11-30T17:06:07.804Z"),
Verified: true,
})
if err != nil {
log.Fatal(err)
}
if res.Workspace != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
shared.Workspace | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.CreateWorkspaceResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.Error | 4XX | application/json |
sdkerrors.SDKError | 5XX | */* |
Create a token for a particular workspace
package main
import(
"context"
speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3"
"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared"
"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/types"
"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := speakeasyclientsdkgo.New(
speakeasyclientsdkgo.WithSecurity(shared.Security{
APIKey: speakeasyclientsdkgo.String("<YOUR_API_KEY_HERE>"),
}),
)
res, err := s.Workspaces.CreateToken(ctx, operations.CreateWorkspaceTokenRequest{
WorkspaceToken: shared.WorkspaceToken{
Alg: "<value>",
CreatedAt: types.MustTimeFromString("2023-08-16T02:33:00.784Z"),
ID: "<id>",
Key: "<key>",
Name: "<value>",
WorkspaceID: "<id>",
},
WorkspaceID: speakeasyclientsdkgo.String("<id>"),
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.CreateWorkspaceTokenRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.CreateWorkspaceTokenResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.Error | 4XX | application/json |
sdkerrors.SDKError | 5XX | */* |
Delete a token for a particular workspace
package main
import(
"context"
speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3"
"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared"
"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := speakeasyclientsdkgo.New(
speakeasyclientsdkgo.WithSecurity(shared.Security{
APIKey: speakeasyclientsdkgo.String("<YOUR_API_KEY_HERE>"),
}),
)
res, err := s.Workspaces.DeleteToken(ctx, operations.DeleteWorkspaceTokenRequest{
TokenID: "<id>",
WorkspaceID: speakeasyclientsdkgo.String("<id>"),
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.DeleteWorkspaceTokenRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.DeleteWorkspaceTokenResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.Error | 4XX | application/json |
sdkerrors.SDKError | 5XX | */* |
Get information about a particular workspace by context.
package main
import(
"context"
speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3"
"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared"
"log"
)
func main() {
ctx := context.Background()
s := speakeasyclientsdkgo.New(
speakeasyclientsdkgo.WithSecurity(shared.Security{
APIKey: speakeasyclientsdkgo.String("<YOUR_API_KEY_HERE>"),
}),
)
res, err := s.Workspaces.Get(ctx)
if err != nil {
log.Fatal(err)
}
if res.WorkspaceAndOrganization != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.GetWorkspaceByContextResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.Error | 4XX | application/json |
sdkerrors.SDKError | 5XX | */* |
Returns a list of workspaces a user has access too
package main
import(
"context"
speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3"
"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared"
"log"
)
func main() {
ctx := context.Background()
s := speakeasyclientsdkgo.New(
speakeasyclientsdkgo.WithSecurity(shared.Security{
APIKey: speakeasyclientsdkgo.String("<YOUR_API_KEY_HERE>"),
}),
)
res, err := s.Workspaces.GetAll(ctx)
if err != nil {
log.Fatal(err)
}
if res.Workspaces != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.GetWorkspacesResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.Error | 4XX | application/json |
sdkerrors.SDKError | 5XX | */* |
Get information about a particular workspace.
package main
import(
"context"
speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3"
"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared"
"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := speakeasyclientsdkgo.New(
speakeasyclientsdkgo.WithSecurity(shared.Security{
APIKey: speakeasyclientsdkgo.String("<YOUR_API_KEY_HERE>"),
}),
)
res, err := s.Workspaces.GetByID(ctx, operations.GetWorkspaceRequest{
WorkspaceID: speakeasyclientsdkgo.String("<id>"),
})
if err != nil {
log.Fatal(err)
}
if res.Workspace != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.GetWorkspaceRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.GetWorkspaceResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.Error | 4XX | application/json |
sdkerrors.SDKError | 5XX | */* |
Get workspace feature flags
package main
import(
"context"
speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3"
"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared"
"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := speakeasyclientsdkgo.New(
speakeasyclientsdkgo.WithSecurity(shared.Security{
APIKey: speakeasyclientsdkgo.String("<YOUR_API_KEY_HERE>"),
}),
)
res, err := s.Workspaces.GetFeatureFlags(ctx, operations.GetWorkspaceFeatureFlagsRequest{
WorkspaceID: speakeasyclientsdkgo.String("<id>"),
})
if err != nil {
log.Fatal(err)
}
if res.WorkspaceFeatureFlagResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.GetWorkspaceFeatureFlagsRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.GetWorkspaceFeatureFlagsResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.Error | 5XX | application/json |
sdkerrors.SDKError | 4XX | */* |
Get settings about a particular workspace.
package main
import(
"context"
speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3"
"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared"
"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := speakeasyclientsdkgo.New(
speakeasyclientsdkgo.WithSecurity(shared.Security{
APIKey: speakeasyclientsdkgo.String("<YOUR_API_KEY_HERE>"),
}),
)
res, err := s.Workspaces.GetSettings(ctx, operations.GetWorkspaceSettingsRequest{
WorkspaceID: speakeasyclientsdkgo.String("<id>"),
})
if err != nil {
log.Fatal(err)
}
if res.WorkspaceSettings != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.GetWorkspaceSettingsRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.GetWorkspaceSettingsResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.Error | 4XX | application/json |
sdkerrors.SDKError | 5XX | */* |
Get team members for a particular workspace
package main
import(
"context"
speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3"
"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared"
"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := speakeasyclientsdkgo.New(
speakeasyclientsdkgo.WithSecurity(shared.Security{
APIKey: speakeasyclientsdkgo.String("<YOUR_API_KEY_HERE>"),
}),
)
res, err := s.Workspaces.GetTeam(ctx, operations.GetWorkspaceTeamRequest{
WorkspaceID: speakeasyclientsdkgo.String("<id>"),
})
if err != nil {
log.Fatal(err)
}
if res.WorkspaceTeamResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.GetWorkspaceTeamRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.GetWorkspaceTeamResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.Error | 4XX | application/json |
sdkerrors.SDKError | 5XX | */* |
Get tokens for a particular workspace
package main
import(
"context"
speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3"
"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared"
"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := speakeasyclientsdkgo.New(
speakeasyclientsdkgo.WithSecurity(shared.Security{
APIKey: speakeasyclientsdkgo.String("<YOUR_API_KEY_HERE>"),
}),
)
res, err := s.Workspaces.GetTokens(ctx, operations.GetWorkspaceTokensRequest{
WorkspaceID: speakeasyclientsdkgo.String("<id>"),
})
if err != nil {
log.Fatal(err)
}
if res.Classes != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.GetWorkspaceTokensRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.GetWorkspaceTokensResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.Error | 4XX | application/json |
sdkerrors.SDKError | 5XX | */* |
Grant a user access to a particular workspace
package main
import(
"context"
speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3"
"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared"
"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := speakeasyclientsdkgo.New(
speakeasyclientsdkgo.WithSecurity(shared.Security{
APIKey: speakeasyclientsdkgo.String("<YOUR_API_KEY_HERE>"),
}),
)
res, err := s.Workspaces.GrantAccess(ctx, operations.GrantUserAccessToWorkspaceRequest{
Email: "[email protected]",
WorkspaceID: speakeasyclientsdkgo.String("<id>"),
})
if err != nil {
log.Fatal(err)
}
if res.WorkspaceInviteResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.GrantUserAccessToWorkspaceRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.GrantUserAccessToWorkspaceResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.Error | 4XX | application/json |
sdkerrors.SDKError | 5XX | */* |
Revoke a user's access to a particular workspace
package main
import(
"context"
speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3"
"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared"
"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := speakeasyclientsdkgo.New(
speakeasyclientsdkgo.WithSecurity(shared.Security{
APIKey: speakeasyclientsdkgo.String("<YOUR_API_KEY_HERE>"),
}),
)
res, err := s.Workspaces.RevokeAccess(ctx, operations.RevokeUserAccessToWorkspaceRequest{
UserID: "<id>",
WorkspaceID: speakeasyclientsdkgo.String("<id>"),
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.RevokeUserAccessToWorkspaceRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.RevokeUserAccessToWorkspaceResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.Error | 4XX | application/json |
sdkerrors.SDKError | 5XX | */* |
Set workspace feature flags
package main
import(
"context"
speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3"
"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared"
"log"
)
func main() {
ctx := context.Background()
s := speakeasyclientsdkgo.New(
speakeasyclientsdkgo.WithSecurity(shared.Security{
APIKey: speakeasyclientsdkgo.String("<YOUR_API_KEY_HERE>"),
}),
)
res, err := s.Workspaces.SetFeatureFlags(ctx, shared.WorkspaceFeatureFlagRequest{
FeatureFlags: []shared.WorkspaceFeatureFlag{
shared.WorkspaceFeatureFlagSkipSchemaRegistry,
shared.WorkspaceFeatureFlagWebhooks,
},
})
if err != nil {
log.Fatal(err)
}
if res.WorkspaceFeatureFlagResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
shared.WorkspaceFeatureFlagRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.SetWorkspaceFeatureFlagsResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.Error | 5XX | application/json |
sdkerrors.SDKError | 4XX | */* |
Update information about a particular workspace.
package main
import(
"context"
speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3"
"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared"
"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/types"
"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := speakeasyclientsdkgo.New(
speakeasyclientsdkgo.WithSecurity(shared.Security{
APIKey: speakeasyclientsdkgo.String("<YOUR_API_KEY_HERE>"),
}),
)
res, err := s.Workspaces.Update(ctx, operations.UpdateWorkspaceDetailsRequest{
Workspace: shared.Workspace{
CreatedAt: types.MustTimeFromString("2025-07-28T19:04:48.565Z"),
ID: "<id>",
Name: "<value>",
OrganizationID: "<id>",
Slug: "<value>",
UpdatedAt: types.MustTimeFromString("2024-10-16T10:52:42.015Z"),
Verified: true,
},
WorkspaceID: speakeasyclientsdkgo.String("<id>"),
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.UpdateWorkspaceDetailsRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.UpdateWorkspaceDetailsResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.Error | 4XX | application/json |
sdkerrors.SDKError | 5XX | */* |
Update settings about a particular workspace.
package main
import(
"context"
speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3"
"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared"
"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/types"
"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := speakeasyclientsdkgo.New(
speakeasyclientsdkgo.WithSecurity(shared.Security{
APIKey: speakeasyclientsdkgo.String("<YOUR_API_KEY_HERE>"),
}),
)
res, err := s.Workspaces.UpdateSettings(ctx, operations.UpdateWorkspaceSettingsRequest{
WorkspaceSettings: shared.WorkspaceSettings{
CreatedAt: types.MustTimeFromString("2023-07-05T11:43:28.305Z"),
UpdatedAt: types.MustTimeFromString("2024-05-14T05:39:21.874Z"),
WebhookURL: "https://grown-pharmacopoeia.net",
WorkspaceID: "<id>",
},
WorkspaceID: speakeasyclientsdkgo.String("<id>"),
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.UpdateWorkspaceSettingsRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.UpdateWorkspaceSettingsResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.Error | 4XX | application/json |
sdkerrors.SDKError | 5XX | */* |