export type CreateApiServicesUnifiedIntegrationsV1ConnectionsConnectionIdIngestionsArgs = {connectionId: string, body: string}; export type CreateApiServicesUnifiedIntegrationsV1ConnectionsConnectionIdIngestionsOptions = {baseUrl?: string | undefined, oAuth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Ingest data for a specific connection. * * POST /services/unified-integrations/v1/connections/{connectionId}/ingestions */ export const createApiServicesUnifiedIntegrationsV1ConnectionsConnectionIdIngestions = async (args: CreateApiServicesUnifiedIntegrationsV1ConnectionsConnectionIdIngestionsArgs, options?: CreateApiServicesUnifiedIntegrationsV1ConnectionsConnectionIdIngestionsOptions) => { const {baseUrl = "https://na12.api.project44.com", fetch: fetchFn = fetch, oAuth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (oAuth2 !== undefined) headers.set('authorization', `Bearer ${oAuth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/services/unified-integrations/v1/connections/${encodeURIComponent(String(args.connectionId))}/ingestions${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 };