export type CreateApiApiImWorkspaceInitGroupArgs = {body: {workspaceId: string, title: string, description?: string | undefined, users: Array<{userId?: string | undefined, displayName?: string | undefined}>, agents?: (Array<{name?: string | undefined, displayName?: string | undefined}>) | undefined}}; export type CreateApiApiImWorkspaceInitGroupOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Initialize group workspace * * POST /api/im/workspace/init-group */ export const createApiApiImWorkspaceInitGroup = async (args: CreateApiApiImWorkspaceInitGroupArgs, options?: CreateApiApiImWorkspaceInitGroupOptions) => { const {baseUrl = "https://prismer.cloud", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (apiKey !== undefined) headers.set('authorization', `Bearer ${apiKey}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/im/workspace/init-group${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", 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 };