export type CreateApiOrganizationOrganizationIdAdminArgs = {organizationId: string, body: {userId?: string | undefined}}; export type CreateApiOrganizationOrganizationIdAdminOptions = {baseUrl?: string | undefined, OrganizationAPIKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Add User as Admin to Organization by userId * * POST /organization/{organizationId}/admin */ export const createApiOrganizationOrganizationIdAdmin = async (args: CreateApiOrganizationOrganizationIdAdminArgs, options?: CreateApiOrganizationOrganizationIdAdminOptions) => { const {baseUrl = "https://api.univid.io/api", fetch: fetchFn = fetch, OrganizationAPIKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (OrganizationAPIKey !== undefined) headers.set("x-api-key", OrganizationAPIKey) const url = `${baseUrl.replace(/\/+$/, '')}/organization/${encodeURIComponent(String(args.organizationId))}/admin${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 };