export type BulkImportRecipientsSchema = {emails: Array}; export type CreateApiApiV3TeamsTeamIdExternalRecipientsArgs = {team_id: string, body: BulkImportRecipientsSchema}; export type CreateApiApiV3TeamsTeamIdExternalRecipientsOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Register external build notification recipients * * POST /api/v3/teams/{team_id}/external-recipients */ export const createApiApiV3TeamsTeamIdExternalRecipients = async (args: CreateApiApiV3TeamsTeamIdExternalRecipientsArgs, options?: CreateApiApiV3TeamsTeamIdExternalRecipientsOptions) => { const {baseUrl = "https://codemagic.io", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (apiKey !== undefined) headers.set("x-auth-token", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/api/v3/teams/${encodeURIComponent(String(args.team_id))}/external-recipients${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 };