// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../../core/resource'; import { APIPromise } from '../../../core/api-promise'; import { buildHeaders } from '../../../internal/headers'; import { RequestOptions } from '../../../internal/request-options'; export class Crawler extends APIResource { /** * Receives asynchronous status callbacks from DPO after a domain-ingestion * dispatch has been processed. */ dpoCallback( params: CrawlerDpoCallbackParams, options?: RequestOptions, ): APIPromise { const { 'Accept-Language': acceptLanguage, 'X-Error-Format': xErrorFormat, ...body } = params; return this._client.post('/api/v1/crawler/dpo-callback', { body, ...options, headers: buildHeaders([ { ...(acceptLanguage != null ? { 'Accept-Language': acceptLanguage } : undefined), ...(xErrorFormat != null ? { 'X-Error-Format': xErrorFormat } : undefined), }, options?.headers, ]), }); } } /** * 202 Accepted body returned after a DPO webhook callback is accepted. */ export interface CrawlerDpoCallbackResponse { domain_ingestion_request_id: string; status?: 'accepted'; } export interface CrawlerDpoCallbackParams { /** * Body param */ domain_ingestion_request_id: string; /** * Body param: DPO domain ingestion request status (GET + stored state vocabulary). */ request_status: 'pending' | 'success' | 'failed' | 'partial_success'; /** * Body param */ covered_end_datetime?: string | null; /** * Body param */ covered_start_datetime?: string | null; /** * Body param */ created_at?: string | null; /** * Body param */ domain?: string | null; /** * Body param */ event_timestamp?: string | null; /** * Body param */ knowledge_base_id?: string | null; /** * Body param */ pending_tasks?: number; /** * Body param */ queries?: string | null; /** * Body param */ total_failed_tasks?: number; /** * Body param */ total_succeeded_tasks?: number; /** * Body param */ total_tasks?: number; /** * Body param */ updated_at?: string | null; /** * Header param */ 'Accept-Language'?: string; /** * Header param: Set to `structured` to receive errors in the structured envelope. * Omit it to keep the legacy error body. */ 'X-Error-Format'?: string; } export declare namespace Crawler { export { type CrawlerDpoCallbackResponse as CrawlerDpoCallbackResponse, type CrawlerDpoCallbackParams as CrawlerDpoCallbackParams, }; }