text: /*
   * self-managed-osdu
   * Rest API Documentation for Self Managed OSDU
   *
   * OpenAPI spec version: 0.11.0
   *
   * NOTE: This class is auto generated by the swagger code generator program.
   * https://github.com/swagger-api/swagger-codegen.git
   *
   * Swagger Codegen version: 2.4.22
   *
   * Do not edit the class manually.
   *
   */
  
  (function(root, factory) {
    if (typeof define === 'function' && define.amd) {
      // AMD. Register as an anonymous module.
      define(['ApiClient', 'model/StorageBulkUpdateRecordsResponse', 'model/StorageDeleteRecordError', 'model/StorageErrorResponse', 'model/StorageMultiRecordIds', 'model/StorageQueryResponse', 'model/StorageRecord', 'model/StorageRecordBulkUpdateParam', 'model/StorageRecordData', 'model/StorageRecordVersions'], factory);
    } else if (typeof module === 'object' && module.exports) {
      // CommonJS-like environments that support module.exports, like Node.
      module.exports = factory(require('../ApiClient'), require('../model/StorageBulkUpdateRecordsResponse'), require('../model/StorageDeleteRecordError'), require('../model/StorageErrorResponse'), require('../model/StorageMultiRecordIds'), require('../model/StorageQueryResponse'), require('../model/StorageRecord'), require('../model/StorageRecordBulkUpdateParam'), require('../model/StorageRecordData'), require('../model/StorageRecordVersions'));
    } else {
      // Browser globals (root is window)
      if (!root.SelfManagedOsdu) {
        root.SelfManagedOsdu = {};
      }
      root.SelfManagedOsdu.StorageApi = factory(root.SelfManagedOsdu.ApiClient, root.SelfManagedOsdu.StorageBulkUpdateRecordsResponse, root.SelfManagedOsdu.StorageDeleteRecordError, root.SelfManagedOsdu.StorageErrorResponse, root.SelfManagedOsdu.StorageMultiRecordIds, root.SelfManagedOsdu.StorageQueryResponse, root.SelfManagedOsdu.StorageRecord, root.SelfManagedOsdu.StorageRecordBulkUpdateParam, root.SelfManagedOsdu.StorageRecordData, root.SelfManagedOsdu.StorageRecordVersions);
    }
  }(this, function(ApiClient, StorageBulkUpdateRecordsResponse, StorageDeleteRecordError, StorageErrorResponse, StorageMultiRecordIds, StorageQueryResponse, StorageRecord, StorageRecordBulkUpdateParam, StorageRecordData, StorageRecordVersions) {
    'use strict';
  
    /**
     * Storage service.
     * @module api/StorageApi
     * @version 0.11.0
     */
  
    /**
     * Constructs a new StorageApi. 
     * @alias module:api/StorageApi
     * @class
     * @param {module:ApiClient} [apiClient] Optional API client implementation to use,
     * default to {@link module:ApiClient#instance} if unspecified.
     */
    var exports = function(apiClient) {
      this.apiClient = apiClient || ApiClient.instance;
  
  
      /**
       * Callback function to receive the result of the createOrUpdateRecords operation.
       * @callback module:api/StorageApi~createOrUpdateRecordsCallback
       * @param {String} error Error message, if any.
       * @param {module:model/StorageRecord} data The data returned by the service call.
       * @param {String} response The complete HTTP response.
       */
  
      /**
       * Create or update records
       * The API represents the main injection mechanism into the Data Lake. It allows records creation and/or update. When no record id is provided or when the provided id is not already present in the Data Lake then a new record is created. If the id is related to an existing record in the Data Lake then an update operation takes place and a new version of the record is created. Allowed roles: service.storage.creator and service.storage.admin.
       * @param {String} oSDUAccountId Account ID is the active OSDU account (OSDU account or customer's account) which the users choose to use with the Search API.
       * @param {Object} opts Optional parameters
       * @param {Boolean} opts.skipdupes Skip duplicates when updating records with the same value. (default to true)
       * @param {Array.<module:model/StorageRecord>} opts.body 
       * @param {module:api/StorageApi~createOrUpdateRecordsCallback} callback The callback function, accepting three arguments: error, data, response
       * data is of type: {@link module:model/StorageRecord}
       */
      this.createOrUpdateRecords = function(oSDUAccountId, opts, callback) {
        opts = opts || {};
        var postBody = opts['body'];
  
        // verify the required parameter 'oSDUAccountId' is set
        if (oSDUAccountId === undefined || oSDUAccountId === null) {
          throw new Error("Missing the required parameter 'oSDUAccountId' when calling createOrUpdateRecords");
        }
  
  
        var pathParams = {
        };
        var queryParams = {
          'skipdupes': opts['skipdupes'],
        };
        var collectionQueryParams = {
        };
        var headerParams = {
          'OSDU-Account-Id': oSDUAccountId
        };
        var formParams = {
        };
  
        var authNames = ['Bearer'];
        var contentTypes = ['application/json'];
        var accepts = ['application/json'];
        var returnType = StorageRecord;
  
        return this.apiClient.callApi(
          '/api/storage/v2/records', 'PUT',
          pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
          authNames, contentTypes, accepts, returnType, callback
        );
      }
  
      /**
       * Callback function to receive the result of the deleteRecord operation.
       * @callback module:api/StorageApi~deleteRecordCallback
       * @param {String} error Error message, if any.
       * @param data This operation does not return a value.
       * @param {String} response The complete HTTP response.
       */
  
      /**
       * Delete record
       * The API performs a logical deletion of the given record. This operation can be reverted later. Allowed roles: service.storage.creator and service.storage.admin.
       * @param {String} id Record id
       * @param {String} oSDUAccountId Account ID is the active OSDU account (OSDU account or customer's account) which the users choose to use with the Search API.
       * @param {module:api/StorageApi~deleteRecordCallback} callback The callback function, accepting three arguments: error, data, response
       */
      this.deleteRecord = function(id, oSDUAccountId, callback) {
        var postBody = null;
  
        // verify the required parameter 'id' is set
        if (id === undefined || id === null) {
          throw new Error("Missing the required parameter 'id' when calling deleteRecord");
        }
  
        // verify the required parameter 'oSDUAccountId' is set
        if (oSDUAccountId === undefined || oSDUAccountId === null) {
          throw new Error("Missing the required parameter 'oSDUAccountId' when calling deleteRecord");
        }
  
  
        var pathParams = {
          'id': id
        };
        var queryParams = {
        };
        var collectionQueryParams = {
        };
        var headerParams = {
          'OSDU-Account-Id': oSDUAccountId
        };
        var formParams = {
        };
  
        var authNames = ['Bearer'];
        var contentTypes = ['application/json'];
        var accepts = ['application/json'];
        var returnType = null;
  
        return this.apiClient.callApi(
          '/api/records/{id}:delete', 'POST',
          pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
          authNames, contentTypes, accepts, returnType, callback
        );
      }
  
      /**
       * Callback function to receive the result of the deleteRecords operation.
       * @callback module:api/StorageApi~deleteRecordsCallback
       * @param {String} error Error message, if any.
       * @param data This operation does not return a value.
       * @param {String} response The complete HTTP response.
       */
  
      /**
       * Soft delete of multiple records
       * The API performs a soft deletion of the given list of records. Required roles: 'users.datalake.editors' or 'users.datalake.admins'.
       * @param {String} dataPartitionId Partition Id
       * @param {Array.<module:model/String>} partitionInfo partitionInfo
       * @param {module:api/StorageApi~deleteRecordsCallback} callback The callback function, accepting three arguments: error, data, response
       */
      this.deleteRecords = function(dataPartitionId, partitionInfo, callback) {
        var postBody = partitionInfo;
  
        // verify the required parameter 'dataPartitionId' is set
        if (dataPartitionId === undefined || dataPartitionId === null) {
          throw new Error("Missing the required parameter 'dataPartitionId' when calling deleteRecords");
        }
  
        // verify the required parameter 'partitionInfo' is set
        if (partitionInfo === undefined || partitionInfo === null) {
          throw new Error("Missing the required parameter 'partitionInfo' when calling deleteRecords");
        }
  
  
        var pathParams = {
        };
        var queryParams = {
        };
        var collectionQueryParams = {
        };
        var headerParams = {
          'data-partition-id': dataPartitionId
        };
        var formParams = {
        };
  
        var authNames = ['Bearer'];
        var contentTypes = [];
        var accepts = [];
        var returnType = null;
  
        return this.apiClient.callApi(
          '/api/storage/v2/records/delete', 'POST',
          pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
          authNames, contentTypes, accepts, returnType, callback
        );
      }
  
      /**
       * Callback function to receive the result of the fetchRecords operation.
       * @callback module:api/StorageApi~fetchRecordsCallback
       * @param {String} error Error message, if any.
       * @param {module:model/StorageMultiRecordIds} data The data returned by the service call.
       * @param {String} response The complete HTTP response.
       */
  
      /**
       * Fetch records
       * The API fetches multiple records at once. Allowed roles: service.storage.viewer, service.storage.creator and service.storage.admin.
       * @param {String} oSDUAccountId Account ID is the active OSDU account (OSDU account or customer's account) which the users choose to use with the Search API.
       * @param {Object} opts Optional parameters
       * @param {module:model/StorageMultiRecordIds} opts.body 
       * @param {module:api/StorageApi~fetchRecordsCallback} callback The callback function, accepting three arguments: error, data, response
       * data is of type: {@link module:model/StorageMultiRecordIds}
       */
      this.fetchRecords = function(oSDUAccountId, opts, callback) {
        opts = opts || {};
        var postBody = opts['body'];
  
        // verify the required parameter 'oSDUAccountId' is set
        if (oSDUAccountId === undefined || oSDUAccountId === null) {
          throw new Error("Missing the required parameter 'oSDUAccountId' when calling fetchRecords");
        }
  
  
        var pathParams = {
        };
        var queryParams = {
        };
        var collectionQueryParams = {
        };
        var headerParams = {
          'OSDU-Account-Id': oSDUAccountId
        };
        var formParams = {
        };
  
        var authNames = ['Bearer'];
        var contentTypes = ['application/json'];
        var accepts = ['application/json'];
        var returnType = StorageMultiRecordIds;
  
        return this.apiClient.callApi(
          '/api/storage/v2/query/records', 'POST',
          pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
          authNames, contentTypes, accepts, returnType, callback
        );
      }
  
      /**
       * Callback function to receive the result of the getAllKinds operation.
       * @callback module:api/StorageApi~getAllKindsCallback
       * @param {String} error Error message, if any.
       * @param {module:model/StorageQueryResponse} data The data returned by the service call.
       * @param {String} response The complete HTTP response.
       */
  
      /**
       * Get all kinds
       * The API returns a list of all kinds in the specific {Account-Id}. Allowed roles: service.storage.admin.
       * @param {String} oSDUAccountId Account ID is the active account account) which the users choose to use with the Search API.
       * @param {Object} opts Optional parameters
       * @param {String} opts.cursor Cursor
       * @param {Number} opts.limit Page Size (default to 10)
       * @param {module:api/StorageApi~getAllKindsCallback} callback The callback function, accepting three arguments: error, data, response
       * data is of type: {@link module:model/StorageQueryResponse}
       */
      this.getAllKinds = function(oSDUAccountId, opts, callback) {
        opts = opts || {};
        var postBody = null;
  
        // verify the required parameter 'oSDUAccountId' is set
        if (oSDUAccountId === undefined || oSDUAccountId === null) {
          throw new Error("Missing the required parameter 'oSDUAccountId' when calling getAllKinds");
        }
  
  
        var pathParams = {
        };
        var queryParams = {
          'cursor': opts['cursor'],
          'limit': opts['limit'],
        };
        var collectionQueryParams = {
        };
        var headerParams = {
          'OSDU-Account-Id': oSDUAccountId
        };
        var formParams = {
        };
  
        var authNames = ['Bearer'];
        var contentTypes = ['application/json'];
        var accepts = ['application/json'];
        var returnType = StorageQueryResponse;
  
        return this.apiClient.callApi(
          '/api/storage/v2/query/kinds', 'GET',
          pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
          authNames, contentTypes, accepts, returnType, callback
        );
      }
  
      /**
       * Callback function to receive the result of the getAllRecordFromKind operation.
       * @callback module:api/StorageApi~getAllRecordFromKindCallback
       * @param {String} error Error message, if any.
       * @param {module:model/StorageQueryResponse} data The data returned by the service call.
       * @param {String} response The complete HTTP response.
       */
  
      /**
       * Get all record from kind
       * The API returns a list of all record ids which belong to the specified kind. Allowed roles: service.storage.admin.
       * @param {String} oSDUAccountId Account ID is the active OSDU account (OSDU account or customer's account) which the users choose to use with the Search API.
       * @param {Object} opts Optional parameters
       * @param {String} opts.cursor Cursor
       * @param {Number} opts.limit Page Size (default to 10)
       * @param {String} opts.kind Filter Kind (default to tenant1:public:well:1.0.2)
       * @param {module:api/StorageApi~getAllRecordFromKindCallback} callback The callback function, accepting three arguments: error, data, response
       * data is of type: {@link module:model/StorageQueryResponse}
       */
      this.getAllRecordFromKind = function(oSDUAccountId, opts, callback) {
        opts = opts || {};
        var postBody = null;
  
        // verify the required parameter 'oSDUAccountId' is set
        if (oSDUAccountId === undefined || oSDUAccountId === null) {
          throw new Error("Missing the required parameter 'oSDUAccountId' when calling getAllRecordFromKind");
        }
  
  
        var pathParams = {
        };
        var queryParams = {
          'cursor': opts['cursor'],
          'limit': opts['limit'],
          'kind': opts['kind'],
        };
        var collectionQueryParams = {
        };
        var headerParams = {
          'OSDU-Account-Id': oSDUAccountId
        };
        var formParams = {
        };
  
        var authNames = ['Bearer'];
        var contentTypes = ['application/json'];
        var accepts = ['application/json'];
        var returnType = StorageQueryResponse;
  
        return this.apiClient.callApi(
          '/api/storage/v2/query/records', 'GET',
          pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
          authNames, contentTypes, accepts, returnType, callback
        );
      }
  
      /**
       * Callback function to receive the result of the getAllRecordVersions operation.
       * @callback module:api/StorageApi~getAllRecordVersionsCallback
       * @param {String} error Error message, if any.
       * @param {module:model/StorageRecordVersions} data The data returned by the service call.
       * @param {String} response The complete HTTP response.
       */
  
      /**
       * Get all record versions
       * The API returns a list containing all versions for the given record id. Allowed roles: service.storage.viewer, service.storage.creator and service.storage.admin.
       * @param {String} id Record id
       * @param {String} oSDUAccountId Account ID is the active OSDU account (OSDU account or customer's account) which the users choose to use with the Search API.
       * @param {module:api/StorageApi~getAllRecordVersionsCallback} callback The callback function, accepting three arguments: error, data, response
       * data is of type: {@link module:model/StorageRecordVersions}
       */
      this.getAllRecordVersions = function(id, oSDUAccountId, callback) {
        var postBody = null;
  
        // verify the required parameter 'id' is set
        if (id === undefined || id === null) {
          throw new Error("Missing the required parameter 'id' when calling getAllRecordVersions");
        }
  
        // verify the required parameter 'oSDUAccountId' is set
        if (oSDUAccountId === undefined || oSDUAccountId === null) {
          throw new Error("Missing the required parameter 'oSDUAccountId' when calling getAllRecordVersions");
        }
  
  
        var pathParams = {
          'id': id
        };
        var queryParams = {
        };
        var collectionQueryParams = {
        };
        var headerParams = {
          'OSDU-Account-Id': oSDUAccountId
        };
        var formParams = {
        };
  
        var authNames = ['Bearer'];
        var contentTypes = ['application/json'];
        var accepts = ['application/json'];
        var returnType = StorageRecordVersions;
  
        return this.apiClient.callApi(
          '/api/storage/v2/records/versions/{id}', 'GET',
          pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
          authNames, contentTypes, accepts, returnType, callback
        );
      }
  
      /**
       * Callback function to receive the result of the getRecord operation.
       * @callback module:api/StorageApi~getRecordCallback
       * @param {String} error Error message, if any.
       * @param {module:model/StorageRecordData} data The data returned by the service call.
       * @param {String} response The complete HTTP response.
       */
  
      /**
       * Get record
       * This API returns the latest version of the given record. Allowed roles: service.storage.viewer, service.storage.creator and service.storage.admin.
       * @param {String} id Record id
       * @param {String} oSDUAccountId Account ID is the active OSDU account (OSDU account or customer's account) which the users choose to use with the Search API.
       * @param {Object} opts Optional parameters
       * @param {Array.<String>} opts.attribute Filter attributes to restrict the returned fields of the record. Usage: data.{record-data-field-name}.
       * @param {module:api/StorageApi~getRecordCallback} callback The callback function, accepting three arguments: error, data, response
       * data is of type: {@link module:model/StorageRecordData}
       */
      this.getRecord = function(id, oSDUAccountId, opts, callback) {
        opts = opts || {};
        var postBody = null;
  
        // verify the required parameter 'id' is set
        if (id === undefined || id === null) {
          throw new Error("Missing the required parameter 'id' when calling getRecord");
        }
  
        // verify the required parameter 'oSDUAccountId' is set
        if (oSDUAccountId === undefined || oSDUAccountId === null) {
          throw new Error("Missing the required parameter 'oSDUAccountId' when calling getRecord");
        }
  
  
        var pathParams = {
          'id': id
        };
        var queryParams = {
        };
        var collectionQueryParams = {
          'attribute': {
            value: opts['attribute'],
            collectionFormat: 'multi'
          },
        };
        var headerParams = {
          'OSDU-Account-Id': oSDUAccountId
        };
        var formParams = {
        };
  
        var authNames = ['Bearer'];
        var contentTypes = ['application/json'];
        var accepts = ['application/json'];
        var returnType = StorageRecordData;
  
        return this.apiClient.callApi(
          '/api/storage/v2/records/{id}', 'GET',
          pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
          authNames, contentTypes, accepts, returnType, callback
        );
      }
  
      /**
       * Callback function to receive the result of the getRecordVersion operation.
       * @callback module:api/StorageApi~getRecordVersionCallback
       * @param {String} error Error message, if any.
       * @param {module:model/StorageRecordData} data The data returned by the service call.
       * @param {String} response The complete HTTP response.
       */
  
      /**
       * Get record version
       * The API retrieves the specific version of the given record. Allowed roles: service.storage.viewer, service.storage.creator and service.storage.admin.
       * @param {String} id Record id
       * @param {Number} version Record version
       * @param {String} oSDUAccountId Account ID is the active OSDU account (OSDU account or customer's account) which the users choose to use with the Search API.
       * @param {Object} opts Optional parameters
       * @param {Array.<String>} opts.attribute Filter attributes to restrict the returned fields of the record. Usage: data.{record-data-field-name}.
       * @param {module:api/StorageApi~getRecordVersionCallback} callback The callback function, accepting three arguments: error, data, response
       * data is of type: {@link module:model/StorageRecordData}
       */
      this.getRecordVersion = function(id, version, oSDUAccountId, opts, callback) {
        opts = opts || {};
        var postBody = null;
  
        // verify the required parameter 'id' is set
        if (id === undefined || id === null) {
          throw new Error("Missing the required parameter 'id' when calling getRecordVersion");
        }
  
        // verify the required parameter 'version' is set
        if (version === undefined || version === null) {
          throw new Error("Missing the required parameter 'version' when calling getRecordVersion");
        }
  
        // verify the required parameter 'oSDUAccountId' is set
        if (oSDUAccountId === undefined || oSDUAccountId === null) {
          throw new Error("Missing the required parameter 'oSDUAccountId' when calling getRecordVersion");
        }
  
  
        var pathParams = {
          'id': id,
          'version': version
        };
        var queryParams = {
        };
        var collectionQueryParams = {
          'attribute': {
            value: opts['attribute'],
            collectionFormat: 'multi'
          },
        };
        var headerParams = {
          'OSDU-Account-Id': oSDUAccountId
        };
        var formParams = {
        };
  
        var authNames = ['Bearer'];
        var contentTypes = ['application/json'];
        var accepts = ['application/json'];
        var returnType = StorageRecordData;
  
        return this.apiClient.callApi(
          '/api/storage/v2/records/{id}/{version}', 'GET',
          pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
          authNames, contentTypes, accepts, returnType, callback
        );
      }
  
      /**
       * Callback function to receive the result of the patchUpdateRecords operation.
       * @callback module:api/StorageApi~patchUpdateRecordsCallback
       * @param {String} error Error message, if any.
       * @param {module:model/StorageBulkUpdateRecordsResponse} data The data returned by the service call.
       * @param {String} response The complete HTTP response.
       */
  
      /**
       * Modify record metadata attributes using patch operations
       * The API represents the patch update mechanism for records. It allows updating multiple records in one request. The currently supported operations are replace, add, and remove for Legal Tags, ACLs, and Tags.  Required roles: 'users.datalake.editors' or 'users.datalake.admins'.
       * @param {String} oSDUAccountId Account ID is the active OSDU account (OSDU account or customer's account) which the users choose to use with the Search API.
       * @param {Object} opts Optional parameters
       * @param {Array.<module:model/StorageRecordBulkUpdateParam>} opts.body 
       * @param {module:api/StorageApi~patchUpdateRecordsCallback} callback The callback function, accepting three arguments: error, data, response
       * data is of type: {@link module:model/StorageBulkUpdateRecordsResponse}
       */
      this.patchUpdateRecords = function(oSDUAccountId, opts, callback) {
        opts = opts || {};
        var postBody = opts['body'];
  
        // verify the required parameter 'oSDUAccountId' is set
        if (oSDUAccountId === undefined || oSDUAccountId === null) {
          throw new Error("Missing the required parameter 'oSDUAccountId' when calling patchUpdateRecords");
        }
  
  
        var pathParams = {
        };
        var queryParams = {
        };
        var collectionQueryParams = {
        };
        var headerParams = {
          'OSDU-Account-Id': oSDUAccountId
        };
        var formParams = {
        };
  
        var authNames = ['Bearer'];
        var contentTypes = ['application/json'];
        var accepts = ['application/json'];
        var returnType = StorageBulkUpdateRecordsResponse;
  
        return this.apiClient.callApi(
          '/api/storage/v2/records', 'PATCH',
          pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
          authNames, contentTypes, accepts, returnType, callback
        );
      }
  
      /**
       * Callback function to receive the result of the purgeRecord operation.
       * @callback module:api/StorageApi~purgeRecordCallback
       * @param {String} error Error message, if any.
       * @param data This operation does not return a value.
       * @param {String} response The complete HTTP response.
       */
  
      /**
       * Purge record
       * The API performs the physical deletion of the given record and all of its versions. This operation cannot be undone. Allowed roles: service.storage.admin.
       * @param {String} id Record id
       * @param {String} oSDUAccountId Account ID is the active OSDU account (OSDU account or customer's account) which the users choose to use with the Search API.
       * @param {module:api/StorageApi~purgeRecordCallback} callback The callback function, accepting three arguments: error, data, response
       */
      this.purgeRecord = function(id, oSDUAccountId, callback) {
        var postBody = null;
  
        // verify the required parameter 'id' is set
        if (id === undefined || id === null) {
          throw new Error("Missing the required parameter 'id' when calling purgeRecord");
        }
  
        // verify the required parameter 'oSDUAccountId' is set
        if (oSDUAccountId === undefined || oSDUAccountId === null) {
          throw new Error("Missing the required parameter 'oSDUAccountId' when calling purgeRecord");
        }
  
  
        var pathParams = {
          'id': id
        };
        var queryParams = {
        };
        var collectionQueryParams = {
        };
        var headerParams = {
          'OSDU-Account-Id': oSDUAccountId
        };
        var formParams = {
        };
  
        var authNames = ['Bearer'];
        var contentTypes = ['application/json'];
        var accepts = ['application/json'];
        var returnType = null;
  
        return this.apiClient.callApi(
          '/api/storage/v2/records/{id}', 'DELETE',
          pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
          authNames, contentTypes, accepts, returnType, callback
        );
      }
    };
  
    return exports;
  }));
  