export type CoreInviteUserRequest = {Company?: string | undefined, Email?: string | undefined, FirstName?: string | undefined, Groups?: Array | undefined, LastName?: string | undefined}; export type CreateApiV1OrgsOrgIdInviteArgs = {org_id: string, body: CoreInviteUserRequest}; export type CreateApiV1OrgsOrgIdInviteOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * send invite email to provided user and create necessary access. * * POST /v1/orgs/{org_id}/invite */ export const createApiV1OrgsOrgIdInvite = async (args: CreateApiV1OrgsOrgIdInviteArgs, options?: CreateApiV1OrgsOrgIdInviteOptions) => { const {baseUrl = "https://api.edgedelta.com", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (ApiKeyAuth !== undefined) headers.set("X-ED-API-Token", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/v1/orgs/${encodeURIComponent(String(args.org_id))}/invite${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 };