/**
 * 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).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 *
 */


import ApiClient from "../ApiClient";
import MvcProblemDetails from '../model/MvcProblemDetails';
import MvcValidationProblemDetails from '../model/MvcValidationProblemDetails';

/**
* FileDownload service.
* @module api/FileDownloadApi
* @version v1
*/
export default class FileDownloadApi {

    /**
    * Constructs a new FileDownloadApi. 
    * @alias module:api/FileDownloadApi
    * @class
    * @param {module:ApiClient} [apiClient] Optional API client implementation to use,
    * default to {@link module:ApiClient#instance} if unspecified.
    */
    constructor(apiClient) {
        this.apiClient = apiClient || ApiClient.instance;
    }


    /**
     * Callback function to receive the result of the v1DownloadGet operation.
     * @callback module:api/FileDownloadApi~v1DownloadGetCallback
     * @param {String} error Error message, if any.
     * @param data This operation does not return a value.
     * @param {String} response The complete HTTP response.
     */

    /**
     * Download file from SEC EDGAR archive
     * 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. :::
     * @param {String} accessionNo SEC filing accession number in format: 0000000000-00-000000
     * @param {String} fileName Name of the file to download from the filing
     * @param {module:api/FileDownloadApi~v1DownloadGetCallback} callback The callback function, accepting three arguments: error, data, response
     */
    v1DownloadGet(accessionNo, fileName, callback) {
      let postBody = null;
      // verify the required parameter 'accessionNo' is set
      if (accessionNo === undefined || accessionNo === null) {
        throw new Error("Missing the required parameter 'accessionNo' when calling v1DownloadGet");
      }
      // verify the required parameter 'fileName' is set
      if (fileName === undefined || fileName === null) {
        throw new Error("Missing the required parameter 'fileName' when calling v1DownloadGet");
      }

      let pathParams = {
      };
      let queryParams = {
        'accession_no': accessionNo,
        'file_name': fileName
      };
      let headerParams = {
      };
      let formParams = {
      };

      let authNames = ['APIKey', 'JWT'];
      let contentTypes = [];
      let accepts = ['application/octet-stream', 'text/html', 'application/xml', 'text/plain', 'application/pdf', 'application/json'];
      let returnType = null;
      return this.apiClient.callApi(
        '/v1/download', 'GET',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, null, callback
      );
    }


}
