export type InviteByEmailPayload = {email: string}; export type CreateApiOpsSalesAgentsInviteEmailArgs = {body: InviteByEmailPayload}; export type CreateApiOpsSalesAgentsInviteEmailOptions = {baseUrl?: string | undefined, OAuth2TopiHeaderAuthorization?: string | undefined, fetch?: typeof fetch | undefined}; /** * Invite a user by email * * POST /ops/sales-agents/invite-email */ export const createApiOpsSalesAgentsInviteEmail = async (args: CreateApiOpsSalesAgentsInviteEmailArgs, options?: CreateApiOpsSalesAgentsInviteEmailOptions) => { const {baseUrl = "https://api.topi-staging.eu", fetch: fetchFn = fetch, OAuth2TopiHeaderAuthorization} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (OAuth2TopiHeaderAuthorization !== undefined) headers.set('authorization', `Bearer ${OAuth2TopiHeaderAuthorization}`) const url = `${baseUrl.replace(/\/+$/, '')}/ops/sales-agents/invite-email${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 };