// @flow
/* eslint-disable no-use-before-define */
/**
 * FinFeedAPI SEC REST API
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: v1
 * Contact: support@apibricks.io
 *
 * NOTE: This class is auto generated by OpenAPI-Generator
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


import * as url from "url";
import * as portableFetch from "portable-fetch";
import { Configuration } from "./configuration";

const BASE_PATH: string = "https://api.sec.finfeedapi.com".replace(/\/+$/, "");

/**
 *
 * @export
 */
export const COLLECTION_FORMATS = {
    csv: ",",
    ssv: " ",
    tsv: "\t",
    pipes: "|",
};

/**
 *
 * @export
 */
export type FetchAPI = {
    (url: string, init?: any): Promise<Response>;
}

/**
 *
 * @export
 */
export type FetchArgs = {
    url: string;
    options: {};
}

/**
 *
 * @export
 */
export type RequestOptions = {
    headers?: {};
    query?: {};
    body?: string | FormData;
}

/**
 * * @export
 * @class RequiredError
 * @extends {Error}
 */
export class RequiredError extends Error {
    name:string = "RequiredError"
    constructor(field: string, msg?: string) {
        super(msg);
    }
}

/**
 * 
 * @export
 * @enum {string}
 */
export type DTOExtractorType = 'text' | 'html';

/**
 * Represents the response for a single SEC filing metadata record. Maps fields from the edgar_submissions table.
 * @export
 */
export type DTOFilingMetadataDto = {
    /**
     * 
     * @type {number}
     * @memberof DTOFilingMetadataDto
     */
    cik?: number;
    /**
     * 
     * @type {string}
     * @memberof DTOFilingMetadataDto
     */
    accession_number?: string;
    /**
     * 
     * @type {Date}
     * @memberof DTOFilingMetadataDto
     */
    filing_date?: Date;
    /**
     * 
     * @type {Date}
     * @memberof DTOFilingMetadataDto
     */
    report_date?: Date;
    /**
     * 
     * @type {Date}
     * @memberof DTOFilingMetadataDto
     */
    acceptance_date_time?: Date;
    /**
     * 
     * @type {string}
     * @memberof DTOFilingMetadataDto
     */
    act?: string;
    /**
     * 
     * @type {string}
     * @memberof DTOFilingMetadataDto
     */
    form?: string;
    /**
     * 
     * @type {string}
     * @memberof DTOFilingMetadataDto
     */
    file_number?: string;
    /**
     * 
     * @type {string}
     * @memberof DTOFilingMetadataDto
     */
    film_number?: string;
    /**
     * 
     * @type {string}
     * @memberof DTOFilingMetadataDto
     */
    items?: string;
    /**
     * 
     * @type {string}
     * @memberof DTOFilingMetadataDto
     */
    core_type?: string;
    /**
     * 
     * @type {number}
     * @memberof DTOFilingMetadataDto
     */
    size?: number;
    /**
     * 
     * @type {boolean}
     * @memberof DTOFilingMetadataDto
     */
    is_xbrl?: boolean;
    /**
     * 
     * @type {boolean}
     * @memberof DTOFilingMetadataDto
     */
    is_inline_xbrl?: boolean;
    /**
     * 
     * @type {string}
     * @memberof DTOFilingMetadataDto
     */
    primary_document?: string;
    /**
     * 
     * @type {string}
     * @memberof DTOFilingMetadataDto
     */
    primary_doc_description?: string;
    /**
     * 
     * @type {string}
     * @memberof DTOFilingMetadataDto
     */
    source_file?: string;
}

/**
 * Defines sorting options for the filing query.
 * @export
 * @enum {string}
 */
export type DTOFilingSortBy = 'AccessionNumber' | 'FilingDate' | 'ReportDate' | 'AcceptanceDateTime' | 'Size';

/**
 * 
 * @export
 */
export type DTOSecFilingResultDto = {
    /**
     * 
     * @type {string}
     * @memberof DTOSecFilingResultDto
     */
    accession_number?: string;
    /**
     * 
     * @type {string}
     * @memberof DTOSecFilingResultDto
     */
    form_type?: string;
    /**
     * 
     * @type {Date}
     * @memberof DTOSecFilingResultDto
     */
    filing_date?: Date;
    /**
     * 
     * @type {string}
     * @memberof DTOSecFilingResultDto
     */
    company_name?: string;
    /**
     * 
     * @type {number}
     * @memberof DTOSecFilingResultDto
     */
    cik?: number;
    /**
     * 
     * @type {string}
     * @memberof DTOSecFilingResultDto
     */
    document_filename?: string;
    /**
     * 
     * @type {string}
     * @memberof DTOSecFilingResultDto
     */
    document_description?: string;
    /**
     * 
     * @type {string}
     * @memberof DTOSecFilingResultDto
     */
    source_file?: string;
}

/**
 * 
 * @export
 */
export type MvcProblemDetails = {
    [key: string]: AnyType | any;

    /**
     * 
     * @type {string}
     * @memberof MvcProblemDetails
     */
    type?: string;
    /**
     * 
     * @type {string}
     * @memberof MvcProblemDetails
     */
    title?: string;
    /**
     * 
     * @type {number}
     * @memberof MvcProblemDetails
     */
    status?: number;
    /**
     * 
     * @type {string}
     * @memberof MvcProblemDetails
     */
    detail?: string;
    /**
     * 
     * @type {string}
     * @memberof MvcProblemDetails
     */
    instance?: string;
}

/**
 * 
 * @export
 */
export type MvcValidationProblemDetails = {
    [key: string]: AnyType | any;

    /**
     * 
     * @type {string}
     * @memberof MvcValidationProblemDetails
     */
    type?: string;
    /**
     * 
     * @type {string}
     * @memberof MvcValidationProblemDetails
     */
    title?: string;
    /**
     * 
     * @type {number}
     * @memberof MvcValidationProblemDetails
     */
    status?: number;
    /**
     * 
     * @type {string}
     * @memberof MvcValidationProblemDetails
     */
    detail?: string;
    /**
     * 
     * @type {string}
     * @memberof MvcValidationProblemDetails
     */
    instance?: string;
    /**
     * 
     * @type {{ [key: string]: Array<string>; }}
     * @memberof MvcValidationProblemDetails
     */
    errors?: { [key: string]: Array<string>; };
}



/**
 * ContentExtractionApi - fetch parameter creator
 * @export
 */
export const ContentExtractionApiFetchParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * Retrieves filing content from the EDGAR database and intelligently classifies it according to form type and item categories.  ### Supported Form Types  Form Type | Description ----------|------------ 8-K      | Current report filing 10-K     | Annual report filing 10-Q     | Quarterly report filing  ### Content Classification - 8-K forms: Content classified by item numbers (e.g., 1.01, 2.01) - 10-K/10-Q forms: Items categorized by their respective part and item structure  :::note Both HTML and plain text documents are supported for content extraction. :::
         * @summary Extract and classify SEC filing content
         * @throws {RequiredError}
         */
        v1ExtractorGet(accessionNumber: string, type?: DTOExtractorType, options: RequestOptions): FetchArgs {
            // verify required parameter 'accessionNumber' is not null or undefined
            if (accessionNumber === null || accessionNumber === undefined) {
                throw new RequiredError('accessionNumber','Required parameter accessionNumber was null or undefined when calling v1ExtractorGet.');
            }
            const localVarPath = `/v1/extractor`;
            const localVarUrlObj = url.parse(localVarPath, true);
            const localVarRequestOptions: RequestOptions = Object.assign({}, { method: 'GET' }, options);
            const localVarHeaderParameter = {};
            const localVarQueryParameter = {};

            // authentication APIKey required
            if (configuration && configuration.apiKey) {
                const localVarApiKeyValue = typeof configuration.apiKey === 'function'
                    ? configuration.apiKey("Authorization")
                    : configuration.apiKey;
                localVarHeaderParameter["Authorization"] = localVarApiKeyValue;
            }

            // authentication JWT required

            if (accessionNumber !== undefined) {
                localVarQueryParameter['accession_number'] = ((accessionNumber:any):string);
            }

            if (type !== undefined) {
                localVarQueryParameter['type'] = ((type:any):string);
            }

            localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query);
            // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
            localVarUrlObj.search = null;
            localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);

            return {
                url: url.format(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Retrieves filing content from the EDGAR database and returns only the text content of the specified item number.  ### Item Number Format  Form Type | Item Format Examples -----------|------------------- 8-K       | 1.01, 2.01, 7.01 10-K      | 1, 2, 3 10-K/10-Q | PartI 1, PartII 2  :::tip For best results, ensure the item number matches exactly with the filing\'s structure. :::
         * @summary Extract specific item content from SEC filing
         * @throws {RequiredError}
         */
        v1ExtractorItemGet(accessionNumber: string, itemNumber: string, type?: DTOExtractorType, options: RequestOptions): FetchArgs {
            // verify required parameter 'accessionNumber' is not null or undefined
            if (accessionNumber === null || accessionNumber === undefined) {
                throw new RequiredError('accessionNumber','Required parameter accessionNumber was null or undefined when calling v1ExtractorItemGet.');
            }
            // verify required parameter 'itemNumber' is not null or undefined
            if (itemNumber === null || itemNumber === undefined) {
                throw new RequiredError('itemNumber','Required parameter itemNumber was null or undefined when calling v1ExtractorItemGet.');
            }
            const localVarPath = `/v1/extractor/item`;
            const localVarUrlObj = url.parse(localVarPath, true);
            const localVarRequestOptions: RequestOptions = Object.assign({}, { method: 'GET' }, options);
            const localVarHeaderParameter = {};
            const localVarQueryParameter = {};

            // authentication APIKey required
            if (configuration && configuration.apiKey) {
                const localVarApiKeyValue = typeof configuration.apiKey === 'function'
                    ? configuration.apiKey("Authorization")
                    : configuration.apiKey;
                localVarHeaderParameter["Authorization"] = localVarApiKeyValue;
            }

            // authentication JWT required

            if (accessionNumber !== undefined) {
                localVarQueryParameter['accession_number'] = ((accessionNumber:any):string);
            }

            if (itemNumber !== undefined) {
                localVarQueryParameter['item_number'] = ((itemNumber:any):string);
            }

            if (type !== undefined) {
                localVarQueryParameter['type'] = ((type:any):string);
            }

            localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query);
            // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
            localVarUrlObj.search = null;
            localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);

            return {
                url: url.format(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
    }
};

export type ContentExtractionApiType = { 
    v1ExtractorGet(accessionNumber: string, type?: DTOExtractorType, options?: RequestOptions): Promise<{ [key: string]: AnyType; }>,

    v1ExtractorItemGet(accessionNumber: string, itemNumber: string, type?: DTOExtractorType, options?: RequestOptions): Promise<string>,
}

/**
 * ContentExtractionApi - factory function to inject configuration 
 * @export
 */
export const ContentExtractionApi = function(configuration?: Configuration, fetch: FetchAPI = portableFetch): ContentExtractionApiType {
    const basePath: string = (configuration && configuration.basePath) || BASE_PATH;
    return {
        /**
         * Retrieves filing content from the EDGAR database and intelligently classifies it according to form type and item categories.  ### Supported Form Types  Form Type | Description ----------|------------ 8-K      | Current report filing 10-K     | Annual report filing 10-Q     | Quarterly report filing  ### Content Classification - 8-K forms: Content classified by item numbers (e.g., 1.01, 2.01) - 10-K/10-Q forms: Items categorized by their respective part and item structure  :::note Both HTML and plain text documents are supported for content extraction. :::
         * @summary Extract and classify SEC filing content
         * @throws {RequiredError}
         */
        v1ExtractorGet(accessionNumber: string, type?: DTOExtractorType, options?: RequestOptions = {}): Promise<{ [key: string]: AnyType; }> {
            const localVarFetchArgs = ContentExtractionApiFetchParamCreator(configuration).v1ExtractorGet(accessionNumber, type, options);
            return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => {
                if (response.status >= 200 && response.status < 300) {
                    return response.json();
                } else {
                    throw response;
                }
            });
        },
        /**
         * Retrieves filing content from the EDGAR database and returns only the text content of the specified item number.  ### Item Number Format  Form Type | Item Format Examples -----------|------------------- 8-K       | 1.01, 2.01, 7.01 10-K      | 1, 2, 3 10-K/10-Q | PartI 1, PartII 2  :::tip For best results, ensure the item number matches exactly with the filing\'s structure. :::
         * @summary Extract specific item content from SEC filing
         * @throws {RequiredError}
         */
        v1ExtractorItemGet(accessionNumber: string, itemNumber: string, type?: DTOExtractorType, options?: RequestOptions = {}): Promise<string> {
            const localVarFetchArgs = ContentExtractionApiFetchParamCreator(configuration).v1ExtractorItemGet(accessionNumber, itemNumber, type, options);
            return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => {
                if (response.status >= 200 && response.status < 300) {
                    return response.json();
                } else {
                    throw response;
                }
            });
        },
    }
};


/**
 * FileDownloadApi - fetch parameter creator
 * @export
 */
export const FileDownloadApiFetchParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * Downloads a specific file from the SEC EDGAR archive using the accession number and filename. The file is streamed directly from the SEC servers to the client.  ### Accession Number Format Accession numbers must be in the format: 0000000000-00-000000 (10 digits, dash, 2 digits, dash, 6 digits)  ### File Name Examples - Primary documents: `d123456d10k.htm`, `d789012d8k.htm` - XBRL files: `d123456d10k_htm.xml`, `FilingSummary.xml` - Exhibits: `d123456dexhibit99.htm`, `d123456dex101.htm`  ### File Types The endpoint supports downloading various file types from SEC filings: - HTML documents (.htm, .html) - XBRL files (.xml, .xsd) - Text files (.txt) - PDF files (.pdf) - Other document formats as submitted to SEC  :::tip You can find available filenames for a specific filing using the `/v1/filings` endpoint first :::  :::warning This endpoint streams files directly from the SEC. Large files may take longer to download. :::
         * @summary Download file from SEC EDGAR archive
         * @throws {RequiredError}
         */
        v1DownloadGet(accessionNo: string, fileName: string, options: RequestOptions): FetchArgs {
            // verify required parameter 'accessionNo' is not null or undefined
            if (accessionNo === null || accessionNo === undefined) {
                throw new RequiredError('accessionNo','Required parameter accessionNo was null or undefined when calling v1DownloadGet.');
            }
            // verify required parameter 'fileName' is not null or undefined
            if (fileName === null || fileName === undefined) {
                throw new RequiredError('fileName','Required parameter fileName was null or undefined when calling v1DownloadGet.');
            }
            const localVarPath = `/v1/download`;
            const localVarUrlObj = url.parse(localVarPath, true);
            const localVarRequestOptions: RequestOptions = Object.assign({}, { method: 'GET' }, options);
            const localVarHeaderParameter = {};
            const localVarQueryParameter = {};

            // authentication APIKey required
            if (configuration && configuration.apiKey) {
                const localVarApiKeyValue = typeof configuration.apiKey === 'function'
                    ? configuration.apiKey("Authorization")
                    : configuration.apiKey;
                localVarHeaderParameter["Authorization"] = localVarApiKeyValue;
            }

            // authentication JWT required

            if (accessionNo !== undefined) {
                localVarQueryParameter['accession_no'] = ((accessionNo:any):string);
            }

            if (fileName !== undefined) {
                localVarQueryParameter['file_name'] = ((fileName:any):string);
            }

            localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query);
            // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
            localVarUrlObj.search = null;
            localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);

            return {
                url: url.format(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
    }
};

export type FileDownloadApiType = { 
    v1DownloadGet(accessionNo: string, fileName: string, options?: RequestOptions): Promise<Response>,
}

/**
 * FileDownloadApi - factory function to inject configuration 
 * @export
 */
export const FileDownloadApi = function(configuration?: Configuration, fetch: FetchAPI = portableFetch): FileDownloadApiType {
    const basePath: string = (configuration && configuration.basePath) || BASE_PATH;
    return {
        /**
         * Downloads a specific file from the SEC EDGAR archive using the accession number and filename. The file is streamed directly from the SEC servers to the client.  ### Accession Number Format Accession numbers must be in the format: 0000000000-00-000000 (10 digits, dash, 2 digits, dash, 6 digits)  ### File Name Examples - Primary documents: `d123456d10k.htm`, `d789012d8k.htm` - XBRL files: `d123456d10k_htm.xml`, `FilingSummary.xml` - Exhibits: `d123456dexhibit99.htm`, `d123456dex101.htm`  ### File Types The endpoint supports downloading various file types from SEC filings: - HTML documents (.htm, .html) - XBRL files (.xml, .xsd) - Text files (.txt) - PDF files (.pdf) - Other document formats as submitted to SEC  :::tip You can find available filenames for a specific filing using the `/v1/filings` endpoint first :::  :::warning This endpoint streams files directly from the SEC. Large files may take longer to download. :::
         * @summary Download file from SEC EDGAR archive
         * @throws {RequiredError}
         */
        v1DownloadGet(accessionNo: string, fileName: string, options?: RequestOptions = {}): Promise<Response> {
            const localVarFetchArgs = FileDownloadApiFetchParamCreator(configuration).v1DownloadGet(accessionNo, fileName, options);
            return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => {
                if (response.status >= 200 && response.status < 300) {
                    return response;
                } else {
                    throw response;
                }
            });
        },
    }
};


/**
 * FilingMetadataApi - fetch parameter creator
 * @export
 */
export const FilingMetadataApiFetchParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * Retrieves metadata for SEC filings based on various filter criteria with pagination and sorting support.  ### Available Sort Fields  Field Name | Description -----------|------------- AccessionNumber | SEC filing accession number FilingDate | Date when filing was submitted AcceptanceDateTime | Date and time of filing acceptance ReportDate | Date of the report Size | Size of the filing document  ### Date Format All dates must be provided in YYYY-MM-DD format  ### Form Types Form types can be provided as comma-separated values, e.g.: \"10-K,8-K,10-Q\"  :::tip For optimal performance, use date ranges and form types to narrow down your search :::
         * @summary Query SEC filing metadata
         * @throws {RequiredError}
         */
        v1FilingsGet(cik?: number, ticker?: string, formType?: string, fillingDateStart?: string, fillingDateEnd?: string, reportDateStart?: string, reportDateEnd?: string, itemsContain?: string, pageSize?: number, pageNumber?: number, sortBy?: DTOFilingSortBy, sortOrder?: string, options: RequestOptions): FetchArgs {
            const localVarPath = `/v1/filings`;
            const localVarUrlObj = url.parse(localVarPath, true);
            const localVarRequestOptions: RequestOptions = Object.assign({}, { method: 'GET' }, options);
            const localVarHeaderParameter = {};
            const localVarQueryParameter = {};

            // authentication APIKey required
            if (configuration && configuration.apiKey) {
                const localVarApiKeyValue = typeof configuration.apiKey === 'function'
                    ? configuration.apiKey("Authorization")
                    : configuration.apiKey;
                localVarHeaderParameter["Authorization"] = localVarApiKeyValue;
            }

            // authentication JWT required

            if (cik !== undefined) {
                localVarQueryParameter['cik'] = ((cik:any):string);
            }

            if (ticker !== undefined) {
                localVarQueryParameter['ticker'] = ((ticker:any):string);
            }

            if (formType !== undefined) {
                localVarQueryParameter['form_type'] = ((formType:any):string);
            }

            if (fillingDateStart !== undefined) {
                localVarQueryParameter['filling_date_start'] = ((fillingDateStart:any):string);
            }

            if (fillingDateEnd !== undefined) {
                localVarQueryParameter['filling_date_end'] = ((fillingDateEnd:any):string);
            }

            if (reportDateStart !== undefined) {
                localVarQueryParameter['report_date_start'] = ((reportDateStart:any):string);
            }

            if (reportDateEnd !== undefined) {
                localVarQueryParameter['report_date_end'] = ((reportDateEnd:any):string);
            }

            if (itemsContain !== undefined) {
                localVarQueryParameter['items_contain'] = ((itemsContain:any):string);
            }

            if (pageSize !== undefined) {
                localVarQueryParameter['page_size'] = ((pageSize:any):string);
            }

            if (pageNumber !== undefined) {
                localVarQueryParameter['page_number'] = ((pageNumber:any):string);
            }

            if (sortBy !== undefined) {
                localVarQueryParameter['sort_by'] = ((sortBy:any):string);
            }

            if (sortOrder !== undefined) {
                localVarQueryParameter['sort_order'] = ((sortOrder:any):string);
            }

            localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query);
            // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
            localVarUrlObj.search = null;
            localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);

            return {
                url: url.format(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
    }
};

export type FilingMetadataApiType = { 
    v1FilingsGet(cik?: number, ticker?: string, formType?: string, fillingDateStart?: string, fillingDateEnd?: string, reportDateStart?: string, reportDateEnd?: string, itemsContain?: string, pageSize?: number, pageNumber?: number, sortBy?: DTOFilingSortBy, sortOrder?: string, options?: RequestOptions): Promise<Array<DTOFilingMetadataDto>>,
}

/**
 * FilingMetadataApi - factory function to inject configuration 
 * @export
 */
export const FilingMetadataApi = function(configuration?: Configuration, fetch: FetchAPI = portableFetch): FilingMetadataApiType {
    const basePath: string = (configuration && configuration.basePath) || BASE_PATH;
    return {
        /**
         * Retrieves metadata for SEC filings based on various filter criteria with pagination and sorting support.  ### Available Sort Fields  Field Name | Description -----------|------------- AccessionNumber | SEC filing accession number FilingDate | Date when filing was submitted AcceptanceDateTime | Date and time of filing acceptance ReportDate | Date of the report Size | Size of the filing document  ### Date Format All dates must be provided in YYYY-MM-DD format  ### Form Types Form types can be provided as comma-separated values, e.g.: \"10-K,8-K,10-Q\"  :::tip For optimal performance, use date ranges and form types to narrow down your search :::
         * @summary Query SEC filing metadata
         * @throws {RequiredError}
         */
        v1FilingsGet(cik?: number, ticker?: string, formType?: string, fillingDateStart?: string, fillingDateEnd?: string, reportDateStart?: string, reportDateEnd?: string, itemsContain?: string, pageSize?: number, pageNumber?: number, sortBy?: DTOFilingSortBy, sortOrder?: string, options?: RequestOptions = {}): Promise<Array<DTOFilingMetadataDto>> {
            const localVarFetchArgs = FilingMetadataApiFetchParamCreator(configuration).v1FilingsGet(cik, ticker, formType, fillingDateStart, fillingDateEnd, reportDateStart, reportDateEnd, itemsContain, pageSize, pageNumber, sortBy, sortOrder, options);
            return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => {
                if (response.status >= 200 && response.status < 300) {
                    return response.json();
                } else {
                    throw response;
                }
            });
        },
    }
};


/**
 * FullTextSearchApi - fetch parameter creator
 * @export
 */
export const FullTextSearchApiFetchParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * Search across SEC filing documents with advanced filtering and sorting capabilities.  ### Available Sort Fields  Field Name | Description -----------|------------- AccessionNumber | SEC filing accession number FormType | Type of the filing document FilingDate | Date when filing was submitted CompanyName | Name of the company CIK | Central Index Key DocumentFilename | Name of the filing document DocumentDescription | Description of the document  ### Search Options  Option | Description --------|------------- text_contains | Keywords that must appear in the document text_not_contain | Keywords that must not appear in the document  ### Date Format All dates must be provided in YYYY-MM-DD format  :::tip Use text_contains and text_not_contain with multiple keywords separated by commas for more precise searches :::  :::note The search is case-insensitive and supports partial word matches :::
         * @summary Full-text search of SEC filing documents
         * @throws {RequiredError}
         */
        v1FullTextGet(formType?: string, fillingDateStart?: string, fillingDateEnd?: string, textContains?: string, textNotContain?: string, pageSize?: number, pageNumber?: number, sortBy?: string, sortOrder?: string, options: RequestOptions): FetchArgs {
            const localVarPath = `/v1/full-text`;
            const localVarUrlObj = url.parse(localVarPath, true);
            const localVarRequestOptions: RequestOptions = Object.assign({}, { method: 'GET' }, options);
            const localVarHeaderParameter = {};
            const localVarQueryParameter = {};

            // authentication APIKey required
            if (configuration && configuration.apiKey) {
                const localVarApiKeyValue = typeof configuration.apiKey === 'function'
                    ? configuration.apiKey("Authorization")
                    : configuration.apiKey;
                localVarHeaderParameter["Authorization"] = localVarApiKeyValue;
            }

            // authentication JWT required

            if (formType !== undefined) {
                localVarQueryParameter['form_type'] = ((formType:any):string);
            }

            if (fillingDateStart !== undefined) {
                localVarQueryParameter['filling_date_start'] = ((fillingDateStart:any):string);
            }

            if (fillingDateEnd !== undefined) {
                localVarQueryParameter['filling_date_end'] = ((fillingDateEnd:any):string);
            }

            if (textContains !== undefined) {
                localVarQueryParameter['text_contains'] = ((textContains:any):string);
            }

            if (textNotContain !== undefined) {
                localVarQueryParameter['text_not_contain'] = ((textNotContain:any):string);
            }

            if (pageSize !== undefined) {
                localVarQueryParameter['page_size'] = ((pageSize:any):string);
            }

            if (pageNumber !== undefined) {
                localVarQueryParameter['page_number'] = ((pageNumber:any):string);
            }

            if (sortBy !== undefined) {
                localVarQueryParameter['sort_by'] = ((sortBy:any):string);
            }

            if (sortOrder !== undefined) {
                localVarQueryParameter['sort_order'] = ((sortOrder:any):string);
            }

            localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query);
            // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
            localVarUrlObj.search = null;
            localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);

            return {
                url: url.format(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
    }
};

export type FullTextSearchApiType = { 
    v1FullTextGet(formType?: string, fillingDateStart?: string, fillingDateEnd?: string, textContains?: string, textNotContain?: string, pageSize?: number, pageNumber?: number, sortBy?: string, sortOrder?: string, options?: RequestOptions): Promise<Array<DTOSecFilingResultDto>>,
}

/**
 * FullTextSearchApi - factory function to inject configuration 
 * @export
 */
export const FullTextSearchApi = function(configuration?: Configuration, fetch: FetchAPI = portableFetch): FullTextSearchApiType {
    const basePath: string = (configuration && configuration.basePath) || BASE_PATH;
    return {
        /**
         * Search across SEC filing documents with advanced filtering and sorting capabilities.  ### Available Sort Fields  Field Name | Description -----------|------------- AccessionNumber | SEC filing accession number FormType | Type of the filing document FilingDate | Date when filing was submitted CompanyName | Name of the company CIK | Central Index Key DocumentFilename | Name of the filing document DocumentDescription | Description of the document  ### Search Options  Option | Description --------|------------- text_contains | Keywords that must appear in the document text_not_contain | Keywords that must not appear in the document  ### Date Format All dates must be provided in YYYY-MM-DD format  :::tip Use text_contains and text_not_contain with multiple keywords separated by commas for more precise searches :::  :::note The search is case-insensitive and supports partial word matches :::
         * @summary Full-text search of SEC filing documents
         * @throws {RequiredError}
         */
        v1FullTextGet(formType?: string, fillingDateStart?: string, fillingDateEnd?: string, textContains?: string, textNotContain?: string, pageSize?: number, pageNumber?: number, sortBy?: string, sortOrder?: string, options?: RequestOptions = {}): Promise<Array<DTOSecFilingResultDto>> {
            const localVarFetchArgs = FullTextSearchApiFetchParamCreator(configuration).v1FullTextGet(formType, fillingDateStart, fillingDateEnd, textContains, textNotContain, pageSize, pageNumber, sortBy, sortOrder, options);
            return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => {
                if (response.status >= 200 && response.status < 300) {
                    return response.json();
                } else {
                    throw response;
                }
            });
        },
    }
};


/**
 * XBRLConversionApi - fetch parameter creator
 * @export
 */
export const XBRLConversionApiFetchParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * Converts XBRL data to JSON format using one of three possible input methods.  ### Input Methods  1. HTML URL (htm-url)    - URL of the filing ending with .htm or .html    - Both filing URLs and index page URLs are accepted    - Example: https://www.sec.gov/Archives/edgar/data/1318605/000156459021004599/tsla-10k_20201231.htm  2. XBRL URL (xbrl-url)    - URL of the XBRL file ending with .xml    - Can be found in the dataFiles array from Query API    - Example: https://www.sec.gov/Archives/edgar/data/1318605/000156459021004599/tsla-10k_20201231_htm.xml  3. Accession Number (accession-no)    - The SEC filing accession number    - Example: 0001564590-21-004599  :::note Only one of the three parameters should be provided. If multiple parameters are provided, the priority order is: 1. htm-url 2. xbrl-url 3. accession-no :::  ### Supported Filing Types  - Annual Reports (10-K) - Quarterly Reports (10-Q) - Current Reports (8-K) - Registration Statements (S-1, S-3) - Foreign Private Issuer Reports (20-F, 40-F)  ### Response Format  The API returns a JSON object containing: - Financial statements (Income Statement, Balance Sheet, Cash Flow Statement) - Accounting policies and footnotes - Company information - Filing metadata  ### Example Response ```json {   \"StatementsOfIncome\": {     \"RevenueFromContractWithCustomerExcludingAssessedTax\": [       {         \"decimals\": \"-6\",         \"unitRef\": \"U_USD\",         \"period\": {           \"startDate\": \"2023-07-01\",           \"endDate\": \"2024-06-30\"         },         \"value\": \"245122000000\"       }     ]   } } ```
         * @summary Convert XBRL data to JSON format
         * @throws {RequiredError}
         */
        v1XbrlConverterGet(htmUrl?: string, xbrlUrl?: string, accessionNo?: string, options: RequestOptions): FetchArgs {
            const localVarPath = `/v1/xbrl-converter`;
            const localVarUrlObj = url.parse(localVarPath, true);
            const localVarRequestOptions: RequestOptions = Object.assign({}, { method: 'GET' }, options);
            const localVarHeaderParameter = {};
            const localVarQueryParameter = {};

            // authentication APIKey required
            if (configuration && configuration.apiKey) {
                const localVarApiKeyValue = typeof configuration.apiKey === 'function'
                    ? configuration.apiKey("Authorization")
                    : configuration.apiKey;
                localVarHeaderParameter["Authorization"] = localVarApiKeyValue;
            }

            // authentication JWT required

            if (htmUrl !== undefined) {
                localVarQueryParameter['htm-url'] = ((htmUrl:any):string);
            }

            if (xbrlUrl !== undefined) {
                localVarQueryParameter['xbrl-url'] = ((xbrlUrl:any):string);
            }

            if (accessionNo !== undefined) {
                localVarQueryParameter['accession-no'] = ((accessionNo:any):string);
            }

            localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query);
            // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
            localVarUrlObj.search = null;
            localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);

            return {
                url: url.format(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
    }
};

export type XBRLConversionApiType = { 
    v1XbrlConverterGet(htmUrl?: string, xbrlUrl?: string, accessionNo?: string, options?: RequestOptions): Promise<{ [key: string]: AnyType; }>,
}

/**
 * XBRLConversionApi - factory function to inject configuration 
 * @export
 */
export const XBRLConversionApi = function(configuration?: Configuration, fetch: FetchAPI = portableFetch): XBRLConversionApiType {
    const basePath: string = (configuration && configuration.basePath) || BASE_PATH;
    return {
        /**
         * Converts XBRL data to JSON format using one of three possible input methods.  ### Input Methods  1. HTML URL (htm-url)    - URL of the filing ending with .htm or .html    - Both filing URLs and index page URLs are accepted    - Example: https://www.sec.gov/Archives/edgar/data/1318605/000156459021004599/tsla-10k_20201231.htm  2. XBRL URL (xbrl-url)    - URL of the XBRL file ending with .xml    - Can be found in the dataFiles array from Query API    - Example: https://www.sec.gov/Archives/edgar/data/1318605/000156459021004599/tsla-10k_20201231_htm.xml  3. Accession Number (accession-no)    - The SEC filing accession number    - Example: 0001564590-21-004599  :::note Only one of the three parameters should be provided. If multiple parameters are provided, the priority order is: 1. htm-url 2. xbrl-url 3. accession-no :::  ### Supported Filing Types  - Annual Reports (10-K) - Quarterly Reports (10-Q) - Current Reports (8-K) - Registration Statements (S-1, S-3) - Foreign Private Issuer Reports (20-F, 40-F)  ### Response Format  The API returns a JSON object containing: - Financial statements (Income Statement, Balance Sheet, Cash Flow Statement) - Accounting policies and footnotes - Company information - Filing metadata  ### Example Response ```json {   \"StatementsOfIncome\": {     \"RevenueFromContractWithCustomerExcludingAssessedTax\": [       {         \"decimals\": \"-6\",         \"unitRef\": \"U_USD\",         \"period\": {           \"startDate\": \"2023-07-01\",           \"endDate\": \"2024-06-30\"         },         \"value\": \"245122000000\"       }     ]   } } ```
         * @summary Convert XBRL data to JSON format
         * @throws {RequiredError}
         */
        v1XbrlConverterGet(htmUrl?: string, xbrlUrl?: string, accessionNo?: string, options?: RequestOptions = {}): Promise<{ [key: string]: AnyType; }> {
            const localVarFetchArgs = XBRLConversionApiFetchParamCreator(configuration).v1XbrlConverterGet(htmUrl, xbrlUrl, accessionNo, options);
            return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => {
                if (response.status >= 200 && response.status < 300) {
                    return response.json();
                } else {
                    throw response;
                }
            });
        },
    }
};


export type ApiTypes = { 
    ContentExtractionApi: ContentExtractionApiType,

    FileDownloadApi: FileDownloadApiType,

    FilingMetadataApi: FilingMetadataApiType,

    FullTextSearchApi: FullTextSearchApiType,

    XBRLConversionApi: XBRLConversionApiType,
 }
