/**
 * @fileoverview AUTOMATICALLY GENERATED service for API.Client.CrxApi.
 * Do not edit this file by hand or your changes will be lost next time it is
 * generated.
 *
 * Swagger AEM is an OpenAPI specification for Adobe Experience Manager (AEM) API
 * Version: 3.2.0-pre.0
 * Generated by: org.openapitools.codegen.languages.JavascriptClosureAngularClientCodegen
 */
goog.provide('API.Client.CrxApi');

goog.require('API.Client.InstallStatus');

/**
 * @constructor
 * @param {!angular.$http} $http
 * @param {!Object} $httpParamSerializer
 * @param {!angular.$injector} $injector
 * @struct
 */
API.Client.CrxApi = function($http, $httpParamSerializer, $injector) {
  /** @private {!string} */
  this.basePath_ = $injector.has('CrxApiBasePath') ?
                   /** @type {!string} */ ($injector.get('CrxApiBasePath')) :
                   'http://localhost';

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

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

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

/**
 * 
 * 
 * @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
 * @return {!angular.$q.Promise<!string>}
 */
API.Client.CrxApi.prototype.getCrxdeStatus = function(opt_extraHttpRequestParams) {
  /** @const {string} */
  var path = this.basePath_ + '/crx/server/crx.default/jcr:root/.1.json';

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

  /** @type {!Object} */
  var headerParams = angular.extend({}, this.defaultHeaders_);
  /** @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);
}

/**
 * 
 * 
 * @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
 * @return {!angular.$q.Promise<!API.Client.InstallStatus>}
 */
API.Client.CrxApi.prototype.getInstallStatus = function(opt_extraHttpRequestParams) {
  /** @const {string} */
  var path = this.basePath_ + '/crx/packmgr/installstatus.jsp';

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

  /** @type {!Object} */
  var headerParams = angular.extend({}, this.defaultHeaders_);
  /** @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);
}

/**
 * 
 * 
 * @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
 * @return {!angular.$q.Promise}
 */
API.Client.CrxApi.prototype.getPackageManagerServlet = function(opt_extraHttpRequestParams) {
  /** @const {string} */
  var path = this.basePath_ + '/crx/packmgr/service/script.html';

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

  /** @type {!Object} */
  var headerParams = angular.extend({}, this.defaultHeaders_);
  /** @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);
}

/**
 * 
 * 
 * @param {!string} cmd 
 * @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
 * @return {!angular.$q.Promise<!string>}
 */
API.Client.CrxApi.prototype.postPackageService = function(cmd, opt_extraHttpRequestParams) {
  /** @const {string} */
  var path = this.basePath_ + '/crx/packmgr/service.jsp';

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

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

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

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

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

/**
 * 
 * 
 * @param {!string} path 
 * @param {!string} cmd 
 * @param {!string=} opt_groupName 
 * @param {!string=} opt_packageName 
 * @param {!string=} opt_packageVersion 
 * @param {!string=} opt_charset 
 * @param {!boolean=} opt_force 
 * @param {!boolean=} opt_recursive 
 * @param {!Object=} opt__package 
 * @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
 * @return {!angular.$q.Promise<!string>}
 */
API.Client.CrxApi.prototype.postPackageServiceJson = function(path, cmd, opt_groupName, opt_packageName, opt_packageVersion, opt_charset, opt_force, opt_recursive, opt__package, opt_extraHttpRequestParams) {
  /** @const {string} */
  var path = this.basePath_ + '/crx/packmgr/service/.json/{path}'
      .replace('{' + 'path' + '}', String(path));

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

  /** @type {!Object} */
  var headerParams = angular.extend({}, this.defaultHeaders_);
  /** @type {!Object} */
  var formParams = {};

  // verify required parameter 'path' is set
  if (!path) {
    throw new Error('Missing required parameter path when calling postPackageServiceJson');
  }
  // verify required parameter 'cmd' is set
  if (!cmd) {
    throw new Error('Missing required parameter cmd when calling postPackageServiceJson');
  }
  if (cmd !== undefined) {
    queryParameters['cmd'] = cmd;
  }

  if (opt_groupName !== undefined) {
    queryParameters['groupName'] = opt_groupName;
  }

  if (opt_packageName !== undefined) {
    queryParameters['packageName'] = opt_packageName;
  }

  if (opt_packageVersion !== undefined) {
    queryParameters['packageVersion'] = opt_packageVersion;
  }

  if (opt_charset !== undefined) {
    queryParameters['_charset_'] = opt_charset;
  }

  if (opt_force !== undefined) {
    queryParameters['force'] = opt_force;
  }

  if (opt_recursive !== undefined) {
    queryParameters['recursive'] = opt_recursive;
  }

  headerParams['Content-Type'] = 'application/x-www-form-urlencoded';

  formParams['package'] = opt__package;

  /** @type {!Object} */
  var httpRequestParams = {
    method: 'POST',
    url: path,
    json: false,
        data: this.httpParamSerializer(formParams),
    params: queryParameters,
    headers: headerParams
  };

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

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

/**
 * 
 * 
 * @param {!string} groupName 
 * @param {!string} packageName 
 * @param {!string} version 
 * @param {!string} path 
 * @param {!string=} opt_filter 
 * @param {!string=} opt_charset 
 * @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
 * @return {!angular.$q.Promise<!string>}
 */
API.Client.CrxApi.prototype.postPackageUpdate = function(groupName, packageName, version, path, opt_filter, opt_charset, opt_extraHttpRequestParams) {
  /** @const {string} */
  var path = this.basePath_ + '/crx/packmgr/update.jsp';

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

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

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

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

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

  if (opt_filter !== undefined) {
    queryParameters['filter'] = opt_filter;
  }

  if (opt_charset !== undefined) {
    queryParameters['_charset_'] = opt_charset;
  }

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

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

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

/**
 * 
 * 
 * @param {!string} old 
 * @param {!string} plain 
 * @param {!string} verify 
 * @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
 * @return {!angular.$q.Promise<!string>}
 */
API.Client.CrxApi.prototype.postSetPassword = function(old, plain, verify, opt_extraHttpRequestParams) {
  /** @const {string} */
  var path = this.basePath_ + '/crx/explorer/ui/setpassword.jsp';

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

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

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

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

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

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

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