import { WorkspaceId, UserId, ISODateString, ApplicationId, APIPayload } from '../../common/v2.js'; import { ApplicationLanguage } from './application.js'; import '../../utils.js'; /** * Workspace member permission tier. `owner` and `admin` have full management; * `maintain` adds operational access (commit, app actions, files, DNS, cache); * `manager` covers monitoring and lifecycle control; `view` is read-only. * @see https://docs.squarecloud.app/en/api-reference/endpoint/workspaces/info */ type WorkspaceMemberGroup = "owner" | "admin" | "maintain" | "manager" | "view"; declare const WorkspaceMemberGroup: { readonly Owner: "owner"; readonly Admin: "admin"; readonly Maintain: "maintain"; readonly Manager: "manager"; readonly View: "view"; }; /** * Groups that can be assigned via the invite/edit flow. `owner` is excluded * because ownership transfer is not exposed through the members API. * @see https://docs.squarecloud.app/en/api-reference/endpoint/workspaces/members */ type WorkspaceInviteGroup = Exclude; /** * @see https://docs.squarecloud.app/en/api-reference/endpoint/workspaces/info */ interface APIWorkspaceMember { id: UserId; name: string; group: WorkspaceMemberGroup; joinedAt: ISODateString; } /** * Application descriptor as embedded in a workspace listing. `desc` is always * present but may be `null` when no description is set. * @see https://docs.squarecloud.app/en/api-reference/endpoint/workspaces/info */ interface APIWorkspaceApp { id: ApplicationId; name: string; desc: string | null; /** Allocated memory in MB. */ ram: number; lang: ApplicationLanguage; domain: string | null; custom: string | null; } /** * @see https://docs.squarecloud.app/en/api-reference/endpoint/workspaces/info */ interface APIWorkspace { /** Workspace identifier — UUID v4 without hyphens (32 hex chars). */ id: WorkspaceId; name: string; owner: UserId; members: APIWorkspaceMember[]; applications: APIWorkspaceApp[]; createdAt: ISODateString; } type APIWorkspacePayload = APIPayload; type APIWorkspaceListPayload = APIPayload; /** * Response of `POST /v2/workspaces`. * @see https://docs.squarecloud.app/en/api-reference/endpoint/workspaces/create */ interface APIWorkspaceCreatedResponse { id: WorkspaceId; name: string; } type APIWorkspaceCreatedPayload = APIPayload; /** * Response of `GET /v2/workspaces/members/code`. The code is a UUID v4 without * hyphens (32 hex chars), valid for 5 minutes and **single-use** — it is * consumed by the first successful join. * @see https://docs.squarecloud.app/en/api-reference/endpoint/workspaces/members/code */ interface APIWorkspaceInviteCodeResponse { code: string; } type APIWorkspaceInviteCodePayload = APIPayload; export { type APIWorkspace, type APIWorkspaceApp, type APIWorkspaceCreatedPayload, type APIWorkspaceCreatedResponse, type APIWorkspaceInviteCodePayload, type APIWorkspaceInviteCodeResponse, type APIWorkspaceListPayload, type APIWorkspaceMember, type APIWorkspacePayload, type WorkspaceInviteGroup, WorkspaceMemberGroup };