// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../core/resource'; import * as CompanyAPI from '../company/company'; import * as QuartrAPI from './quartr'; import { APIPromise } from '../../core/api-promise'; import { buildHeaders } from '../../internal/headers'; import { RequestOptions } from '../../internal/request-options'; import { path } from '../../internal/utils/path'; /** * Direct access to Quartr events and IR documents by ID. */ export class Document extends APIResource { /** * Retrieve a Quartr IR document by its ID, including the parent company and the * associated event (if any). */ retrieve(documentID: number, options?: RequestOptions): APIPromise { return this._client.get(path`/quartr/document/${documentID}`, options); } /** * Download the rendered PDF version of a Quartr IR document. * * The response is served with indefinite cache headers since rendered PDFs are * immutable artifacts. */ downloadPdf(documentID: number, options?: RequestOptions): APIPromise { return this._client.get(path`/quartr/document/${documentID}/pdf`, { ...options, headers: buildHeaders([{ Accept: 'application/pdf' }, options?.headers]), __binaryResponse: true, }); } /** * Get the extracted plaintext of a Quartr IR document. * * Returns the document's text content reconstructed from parsed chunks, served * with indefinite cache headers since extracted text is an immutable artifact. */ getText(documentID: number, options?: RequestOptions): APIPromise { return this._client.get(path`/quartr/document/${documentID}/text`, { ...options, headers: buildHeaders([{ Accept: 'text/plain' }, options?.headers]), }); } } /** * An investor relations document from Quartr (e.g. transcript, slides, press * release). */ export interface QuartrDocument { /** * The unique Quartr document identifier. */ id: number; /** * The Quartr company ID associated with this document. */ company_id: number; /** * When the document was first added to Quartr. Note: this is the ingestion * timestamp, not the original publication date. */ created_at: string; /** * The publication date of the document, derived from the associated event's date. */ date_published: string; /** * The Quartr event ID associated with this document. */ event_id: number; /** * The URL of the original document file. */ file_url: string; /** * The total number of pages in the document. */ page_count: number; /** * The title of the document, if available. */ title: string | null; /** * The document type identifier (e.g. 1 for transcript, 2 for slides). Use the * `quartr_list_document_types` endpoint for the full mapping. */ type_id: number; /** * When the document record was last updated. */ updated_at: string; /** * The total number of words in the document. */ word_count: number; } /** * A Quartr document with its parent company and associated event. */ export interface DocumentRetrieveResponse extends QuartrDocument { /** * The company that published this document. */ company: CompanyAPI.QuartrCompanyResource; /** * The event associated with this document. */ event: QuartrAPI.QuartrEvent; } export type DocumentGetTextResponse = string; export declare namespace Document { export { type QuartrDocument as QuartrDocument, type DocumentRetrieveResponse as DocumentRetrieveResponse, type DocumentGetTextResponse as DocumentGetTextResponse, }; }