Workspaces hooks

Hand-written shim. Generated CRUD via ./workspaces.gen. The hooks below cover (a) the org-scoped handle lookup that composes two requests (`useGetWorkspaceByHandle`) and (b) the email-settings sub-resource (`useGetWorkspaceEmail`, `useUpdateWorkspaceEmail`) which the manifest pipeline doesn't model yet.

Hooks

useCreateWorkspace mutation

Create a workspace.

TypeScript
useCreateWorkspace(options?: MutationOpts<Workspace, CreateWorkspaceParams>)

Types: Workspace · CreateWorkspaceParams

useDeleteWorkspace mutation

Soft-delete a workspace.

TypeScript
useDeleteWorkspace(options?: MutationOpts<SuccessResponse, string>)

Types: SuccessResponse

useGetWorkspaceByHandle query

Resolve a workspace by its (org-scoped) handle. Used by path-based URL routing (/<orghandle>/<wshandle>/…).

Composes two requests: org by handle → workspace by org-id+handle. Both underlying queries are gated on (a) the matching handle being non-empty and (b) the caller's enabled option, so consumers like the global header can call this from non-workspace routes without firing 404s.

TypeScript
useGetWorkspaceByHandle(orgHandle: string, wsHandle: string, options?: QueryOpts<Workspace>)

Types: Workspace

useGetWorkspaceEmail query

Fetch workspace email settings (address, enabled, config).

TypeScript
useGetWorkspaceEmail(workspaceId: string, options?: QueryOpts<WorkspaceEmailSettings>)

Types: WorkspaceEmailSettings

TypeScript
const { data: email } = useGetWorkspaceEmail("wsp_abc123");

useListWorkspaces query

List workspaces.

TypeScript
useListWorkspaces(params?: Omit<ListWorkspacesParams, | > & { filter?: WorkspaceFilter; orderBy?: WorkspaceOrderBy[]; } & WorkspaceShorthands, options?: QueryOpts<Page<Workspace>>)

Types: ListWorkspacesParams · WorkspaceFilter · WorkspaceOrderBy · WorkspaceShorthands · Page · Workspace

usePurgeWorkspace composite

Permanently delete a soft-deleted workspace.

TypeScript
usePurgeWorkspace(options?: MutationOpts<SuccessResponse, PurgeWorkspaceParams>)

Types: SuccessResponse · PurgeWorkspaceParams

useRestoreWorkspace composite

Restore a soft-deleted workspace.

TypeScript
useRestoreWorkspace(options?: MutationOpts<Workspace, string>)

Types: Workspace

useRetrieveWorkspace query

Get a workspace by ID.

TypeScript
useRetrieveWorkspace(id: string, options?: QueryOpts<Workspace>)

Types: Workspace

useUpdateWorkspace mutation

Update a workspace.

TypeScript
useUpdateWorkspace(options?: MutationOpts<Workspace, UpdateWorkspaceParams>)

Types: Workspace · UpdateWorkspaceParams

useUpdateWorkspaceEmail mutation

Update workspace email settings. Auto-invalidates email cache on success.

TypeScript
useUpdateWorkspaceEmail(options?: MutationOpts<WorkspaceEmailSettings, UpdateWorkspaceEmailSettingsParams>)

Types: WorkspaceEmailSettings · UpdateWorkspaceEmailSettingsParams

TypeScript
const update = useUpdateWorkspaceEmail();
update.mutate({ workspaceId: "wsp_abc123", enabled: true });