Usage
To manipulate workspaces, access the workspaces object on the SDK. Through that, you can invoke all workspace methods mentioned, like this:
const memberships = await sdk.workspaces.memberships(userId)
Read methods
Fetch a workspace
Fetches a specific workspace using its ID. Returns the full workspace object.
async deleteWorkspaceAvatar(workspaceId: string): Promise<void>
Fetch user's workspaces
Fetches all workspaces a user has access to.
async workspaces(userId: string): Promise<Array<Workspace>>
Fetch user's memberships
Fetches all memberships a user is part of. Each membership contains workspace and user role.
async memberships(userId: string): Promise<Array<Membership>>
Fetch workspace user memberships
Fetches all users that are part of a specific workspace. Each user contains their role as well.
async userMemberships(workspaceId: string): Promise<Array<UserMembership>>
Fetch subscription product features
Fetches subscription product features.
async subscriptionProductFeatures(): Promise<SubscriptionProductFeatures>
Fetch access control lists
Fetches access control lists.
async acls(): Promise<Acl>
Validate workspace handle availability
Validates if a given handle is available for use.
async validateIsWorkspaceHandleAvailable(handle: string): Promise<boolean>
Fetch workspace onboarding status
Fetches workspace onboarding status using its ID.
async workspaceOnboarding(workspaceId: string): Promise<WorkspaceOnboarding>
Fetch workspace IP whitelist settings
Fetches workspace IP whitelist settings using its ID.
async workspaceIPWhitelistSettings(workspaceId: string): Promise<WorkspaceIPWhitelistSettings | null>
Fetch workspace npm registry settings
Fetches workspace npm registry settings using its ID.
async workspaceNPMRegistrySettings(workspaceId: string): Promise<WorkspaceNPMRegistrySettings | null>
Fetch workspace SSO settings
Fetches workspace Single Sign-On (SSO) settings using its ID.
async workspaceSSOSettings(workspaceId: string): Promise<WorkspaceSSOSettingsUpdateModel | null>
Fetch workspace invitations
Fetches all invitations that are part of a specific workspace.
async workspaceInvitations(workspaceId: string): Promise<Array<WorkspaceInvitation>>
Create/update methods
Create a workspace
Creates a new workspace. The user who creates the workspace becomes its owner.
async createWorkspace(name: string, handle?: string): Promise<Workspace>
Update workspace profile
Updates workspace profile for a specific workspace.
async updateWorkspaceProfile(workspaceId: string, update: WorkspaceProfileUpdateModel): Promise<void>
Test IP whitelist settings
Tests the accessibility of IP allowlist settings for a workspace.
async testIpWhitelistSettings(workspaceId: string, ipWhitelistSettings: WorkspaceIPWhitelistSettingsUpdateModel): Promise<{ accessible: boolean }>
Update workspace onboarding
Updates workspace onboarding state for a specific workspace.
async updateWorkspaceOnboarding(workspaceId: string, update: WorkspaceOnboardingUpdateModel): Promise<void>
Update workspace avatar
Updates workspace avatar for a specific workspace.
async updateWorkspaceAvatar(workspaceId: string, avatar: File): Promise<void>
Update workspace SSO settings
Updates workspace Single Sign-On (SSO) settings for a specific workspace.
async updateWorkspaceSSOSettings(workspaceId: string, update: WorkspaceSSOSettingsUpdateModel): Promise<void>
Update workspace IP whitelist settings
Updates workspace IP whitelist settings for a specific workspace.
updateWorkspaceIPWhitelistSettings(workspaceId: string, ipWhitelistSettings: WorkspaceIPWhitelistSettingsUpdateModel): Promise<void>
Update workspace npm registry settings
Updates workspace npm registry settings for a specific workspace.
async updateWorkspaceNPMRegistrySettings(workspaceId: string, npmRegistrySettings: WorkspaceNPMRegistrySettingsUpdateModel): Promise<void>
Delete methods
Delete a workspace
Deletes a specific workspace. This action is irreversible and can only be performed by the workspace owner.
async deleteWorkspace(workspaceId: string): Promise<void>
Delete workspace avatar
Deletes the avatar of a specific workspace. This action is irreversible.
async deleteWorkspaceAvatar(workspaceId: string): Promise<void>
Delete workspace npm registry settings
Deletes the npm registry settings for a specific workspace.
async deleteWorkspaceNPMRegistrySettings(workspaceId: string): Promise<void>