Skip to content

Latest commit

 

History

History
908 lines (694 loc) · 48.4 KB

File metadata and controls

908 lines (694 loc) · 48.4 KB

Workspaces

(Workspaces)

Overview

REST APIs for managing Workspaces (speakeasy tenancy)

Available Operations

Create

Creates a workspace

Example Usage

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
    }
}

Parameters

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.

Response

*operations.CreateWorkspaceResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.Error 4XX application/json
sdkerrors.SDKError 5XX */*

CreateToken

Create a token for a particular workspace

Example Usage

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
    }
}

Parameters

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.

Response

*operations.CreateWorkspaceTokenResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.Error 4XX application/json
sdkerrors.SDKError 5XX */*

DeleteToken

Delete a token for a particular workspace

Example Usage

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
    }
}

Parameters

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.

Response

*operations.DeleteWorkspaceTokenResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.Error 4XX application/json
sdkerrors.SDKError 5XX */*

Get

Get information about a particular workspace by context.

Example Usage

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
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
opts []operations.Option The options for this request.

Response

*operations.GetWorkspaceByContextResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.Error 4XX application/json
sdkerrors.SDKError 5XX */*

GetAll

Returns a list of workspaces a user has access too

Example Usage

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
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
opts []operations.Option The options for this request.

Response

*operations.GetWorkspacesResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.Error 4XX application/json
sdkerrors.SDKError 5XX */*

GetByID

Get information about a particular workspace.

Example Usage

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
    }
}

Parameters

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.

Response

*operations.GetWorkspaceResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.Error 4XX application/json
sdkerrors.SDKError 5XX */*

GetFeatureFlags

Get workspace feature flags

Example Usage

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
    }
}

Parameters

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.

Response

*operations.GetWorkspaceFeatureFlagsResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.Error 5XX application/json
sdkerrors.SDKError 4XX */*

GetSettings

Get settings about a particular workspace.

Example Usage

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
    }
}

Parameters

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.

Response

*operations.GetWorkspaceSettingsResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.Error 4XX application/json
sdkerrors.SDKError 5XX */*

GetTeam

Get team members for a particular workspace

Example Usage

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
    }
}

Parameters

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.

Response

*operations.GetWorkspaceTeamResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.Error 4XX application/json
sdkerrors.SDKError 5XX */*

GetTokens

Get tokens for a particular workspace

Example Usage

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
    }
}

Parameters

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.

Response

*operations.GetWorkspaceTokensResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.Error 4XX application/json
sdkerrors.SDKError 5XX */*

GrantAccess

Grant a user access to a particular workspace

Example Usage

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
    }
}

Parameters

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.

Response

*operations.GrantUserAccessToWorkspaceResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.Error 4XX application/json
sdkerrors.SDKError 5XX */*

RevokeAccess

Revoke a user's access to a particular workspace

Example Usage

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
    }
}

Parameters

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.

Response

*operations.RevokeUserAccessToWorkspaceResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.Error 4XX application/json
sdkerrors.SDKError 5XX */*

SetFeatureFlags

Set workspace feature flags

Example Usage

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
    }
}

Parameters

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.

Response

*operations.SetWorkspaceFeatureFlagsResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.Error 5XX application/json
sdkerrors.SDKError 4XX */*

Update

Update information about a particular workspace.

Example Usage

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
    }
}

Parameters

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.

Response

*operations.UpdateWorkspaceDetailsResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.Error 4XX application/json
sdkerrors.SDKError 5XX */*

UpdateSettings

Update settings about a particular workspace.

Example Usage

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
    }
}

Parameters

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.

Response

*operations.UpdateWorkspaceSettingsResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.Error 4XX application/json
sdkerrors.SDKError 5XX */*