export type SubjectSetBody = {namespace: string, object: string, relation: string}; export type RelationshipWriteRequest = {namespace: string, object: string, relation: string, subject_id?: (string | null) | undefined, subject_set?: (SubjectSetBody | null) | undefined}; export type DeleteApiV1WorkspacesWorkspaceAccessControlRelationshipsArgs = {workspace: string, body: RelationshipWriteRequest}; export type DeleteApiV1WorkspacesWorkspaceAccessControlRelationshipsOptions = {baseUrl: string, HTTPBearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete Relationship * * DELETE /v1/workspaces/{workspace}/access-control/relationships */ export const deleteApiV1WorkspacesWorkspaceAccessControlRelationships = async (args: DeleteApiV1WorkspacesWorkspaceAccessControlRelationshipsArgs, options: DeleteApiV1WorkspacesWorkspaceAccessControlRelationshipsOptions) => { const {baseUrl, fetch: fetchFn = fetch, HTTPBearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (HTTPBearer !== undefined) headers.set('authorization', `Bearer ${HTTPBearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/workspaces/${encodeURIComponent(String(args.workspace))}/access-control/relationships${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", 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 };