/**
 * @fileoverview AUTOMATICALLY GENERATED service for API.Client.FileDownloadApi.
 * Do not edit this file by hand or your changes will be lost next time it is
 * generated.
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 * Version: v1
* Generator version: 7.13.0
 * Generated by: org.openapitools.codegen.languages.JavascriptClosureAngularClientCodegen
 */
/**
 * @license MIT License
 * https://github.com/api-bricks/api-bricks-sdk/blob/master/LICENSE
 */

goog.provide('API.Client.FileDownloadApi');

goog.require('API.Client.Mvc.ProblemDetails');
goog.require('API.Client.Mvc.ValidationProblemDetails');

/**
 * @constructor
 * @param {!angular.$http} $http
 * @param {!Object} $httpParamSerializer
 * @param {!angular.$injector} $injector
 * @struct
 */
API.Client.FileDownloadApi = function($http, $httpParamSerializer, $injector) {
  /** @private {!string} */
  this.basePath_ = $injector.has('FileDownloadApiBasePath') ?
                   /** @type {!string} */ ($injector.get('FileDownloadApiBasePath')) :
                   'https://api.sec.finfeedapi.com';

  /** @private {!Object<string, string>} */
  this.defaultHeaders_ = $injector.has('FileDownloadApiDefaultHeaders') ?
                   /** @type {!Object<string, string>} */ (
                       $injector.get('FileDownloadApiDefaultHeaders')) :
                   {};

  /** @private {!angular.$http} */
  this.http_ = $http;

  /** @package {!Object} */
  this.httpParamSerializer = $injector.get('$httpParamSerializer');
}
API.Client.FileDownloadApi.$inject = ['$http', '$httpParamSerializer', '$injector'];

/**
 * 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: &#x60;d123456d10k.htm&#x60;, &#x60;d789012d8k.htm&#x60; - XBRL files: &#x60;d123456d10k_htm.xml&#x60;, &#x60;FilingSummary.xml&#x60; - Exhibits: &#x60;d123456dexhibit99.htm&#x60;, &#x60;d123456dex101.htm&#x60;  ### 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 &#x60;/v1/filings&#x60; 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 {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
 * @return {!angular.$q.Promise}
 */
API.Client.FileDownloadApi.prototype.v1DownloadGet = function(accessionNo, fileName, opt_extraHttpRequestParams) {
  /** @const {string} */
  var path = this.basePath_ + '/v1/download';

  /** @type {!Object} */
  var queryParameters = {};

  /** @type {!Object} */
  var headerParams = angular.extend({}, this.defaultHeaders_);
  // verify required parameter 'accessionNo' is set
  if (!accessionNo) {
    throw new Error('Missing required parameter accessionNo when calling v1DownloadGet');
  }
  // verify required parameter 'fileName' is set
  if (!fileName) {
    throw new Error('Missing required parameter fileName when calling v1DownloadGet');
  }
  if (accessionNo !== undefined) {
    queryParameters['accession_no'] = accessionNo;
  }

  if (fileName !== undefined) {
    queryParameters['file_name'] = fileName;
  }

  /** @type {!Object} */
  var httpRequestParams = {
    method: 'GET',
    url: path,
    json: true,
            params: queryParameters,
    headers: headerParams
  };

  if (opt_extraHttpRequestParams) {
    httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
  }

  return (/** @type {?} */ (this.http_))(httpRequestParams);
}
