export type Workspace = {type?: string | undefined, id?: string | undefined, attributes?: ({branch?: string | undefined, description?: string | undefined, folder?: string | undefined, locked?: boolean | undefined, name?: string | undefined, source?: string | undefined, terraformVersion?: string | undefined}) | undefined, relationships?: ({history?: ({id?: string | undefined, type?: 'history' | undefined}) | undefined, job?: ({id?: string | undefined, type?: 'job' | undefined}) | undefined, organization?: ({id?: string | undefined, type?: 'organization' | undefined}) | undefined, schedule?: ({id?: string | undefined, type?: 'schedule' | undefined}) | undefined, ssh?: ({id?: string | undefined, type?: 'ssh' | undefined}) | undefined, variable?: ({id?: string | undefined, type?: 'variable' | undefined}) | undefined, vcs?: ({id?: string | undefined, type?: 'vcs' | undefined}) | undefined}) | undefined}; export type PatchApiWorkspaceWorkspaceIdArgs = {body: {data?: Workspace | undefined}}; export type PatchApiWorkspaceWorkspaceIdOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Modifies an instance of type workspace * * PATCH /workspace/{workspaceId} */ export const patchApiWorkspaceWorkspaceId = async (args: PatchApiWorkspaceWorkspaceIdArgs, options: PatchApiWorkspaceWorkspaceIdOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/vnd.api+json") const url = `${baseUrl.replace(/\/+$/, '')}/workspace/${encodeURIComponent(String(args.workspaceId))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };