import { Headers } from 'got'; import { CMRResponseBody, CMRErrorResponseBody } from './types'; import { UmmMetadata } from './UmmUtils'; export interface CMRConstructorParams { clientId: string; password?: string; passwordSecretName?: string; provider: string; token?: string; username?: string; oauthProvider: string; } /** * A class to simplify requests to the CMR * * @typicalname cmrClient * * @example * const { CMR } = require('@cumulus/cmr-client'); * * const cmrClient = new CMR({ * provider: 'my-provider', * clientId: 'my-clientId', * username: 'my-username', * password: 'my-password' * }); * * or * * const cmrClient = new CMR({ * provider: 'my-provider', * clientId: 'my-clientId', * token: 'cmr_or_launchpad_token' * }); * TODO: this should be subclassed or refactored to a functional style * due to branch logic/complexity in token vs password/username handling */ export declare class CMR { clientId: string; provider: string; username?: string; oauthProvider: string; password?: string; passwordSecretName?: string; token?: string; /** * The constructor for the CMR class */ constructor(params: CMRConstructorParams); /** * Get the CMR password, from the AWS secret if set, else return the password * @returns {Promise.} - the CMR password */ getCmrPassword(): Promise; /** * The method for getting the token * * @returns {Promise.} the token */ getToken(): Promise; /** * Return object containing CMR request headers for PUT / POST / DELETE * * @param {Object} params * @param {string} [params.token] - CMR request token * @param {string} [params.ummgVersion] - UMMG metadata version string or null if echo10 metadata * @param {string} [params.cmrRevisionId] - CMR Revision ID * @returns {Object} CMR headers object */ getWriteHeaders(params?: { token?: string; ummgVersion?: string; cmrRevisionId?: string; }): Headers; /** * Return object containing CMR request headers for GETs * * @param {Object} params * @param {string} [params.token] - CMR request token * @returns {Object} CMR headers object */ getReadHeaders(params?: { token?: string; }): Headers; /** * Adds a collection record to the CMR * * @param {string} xml - the collection XML document * @returns {Promise.} the CMR response */ ingestCollection(xml: string): Promise; /** * Adds a granule record to the CMR * * @param {string} xml - the granule XML document * @param {string} cmrRevisionId - Optional CMR Revision ID * @returns {Promise.} the CMR response */ ingestGranule(xml: string, cmrRevisionId?: string): Promise; /** * Adds/Updates UMMG json metadata in the CMR * * @param {Object} ummgMetadata - UMMG metadata object * @param {string} cmrRevisionId - Optional CMR Revision ID * @returns {Promise} to the CMR response object. */ ingestUMMGranule(ummgMetadata: UmmMetadata, cmrRevisionId?: string): Promise; /** * Deletes a collection record from the CMR * * @param {string} datasetID - the collection unique id * @returns {Promise.} the CMR response */ deleteCollection(datasetID: string): Promise; /** * Deletes a granule record from the CMR * * @param {string} granuleUR - the granule unique id * @returns {Promise.} the CMR response */ deleteGranule(granuleUR: string): Promise; searchConcept(type: string, searchParams: URLSearchParams, format?: string, recursive?: boolean): Promise; /** * Search in collections * * @param {string} params - the search parameters * @param {string} [format=json] - format of the response * @returns {Promise.} the CMR response */ searchCollections(params: { [key: string]: string; }, format?: string): Promise; /** * Search in granules * * @param {string} params - the search parameters * @param {string} [format='json'] - format of the response * @returns {Promise.} the CMR response */ searchGranules(params: { [key: string]: string; }, format?: string): Promise; /** * Get the granule metadata from CMR using the cmrLink * * @param {string} cmrLink - URL to concept * @returns {Object} - metadata as a JS object, null if not found */ getGranuleMetadata(cmrLink: string): Promise; } //# sourceMappingURL=CMR.d.ts.map