@cumulus/api-client
Version:
API client for working with the Cumulus archive API
71 lines • 3.3 kB
TypeScript
import { ApiAsyncOperation } from '@cumulus/types/api/async_operations';
import { InvokeApiFunction, ApiGatewayLambdaHttpProxyResponse } from './types';
/**
* Get /asyncOperations/{asyncOperationId}
*
* @param {Object} params - params
* @param {string} params.prefix - the prefix configured for the stack
* @param {Object} params.asyncOperationId - the async operation id
* @param {Function} params.callback - async function to invoke the api lambda
* that takes a prefix / user payload. Defaults
* to cumulusApiClient.invokeApi
* @returns {Promise<ApiAsyncOperation>}
* async operation parsed from JSON response body from the callback
*/
export declare const getAsyncOperation: (params: {
prefix: string;
asyncOperationId: string;
callback?: InvokeApiFunction;
}) => Promise<ApiAsyncOperation>;
/**
* DELETE /asyncOperations/{asyncOperationId}
*
* @param {Object} params - params
* @param {string} params.prefix - the prefix configured for the stack
* @param {Object} params.asyncOperationId - the async operation id
* @param {Function} params.callback - async function to invoke the api lambda
* that takes a prefix / user payload. Defaults
* to cumulusApiClient.invokeApi
* @returns {Promise<Object>} - the response from the callback
*/
export declare const deleteAsyncOperation: (params: {
prefix: string;
asyncOperationId: string;
callback?: InvokeApiFunction;
}) => Promise<ApiGatewayLambdaHttpProxyResponse>;
/**
* Query async operations stored in cumulus
* GET /asyncOperations
* @param {Object} params - params
* @param {string} [params.query] - query to pass the API lambda
* @param {Function} params.callback - async function to invoke the api lambda
* that takes a prefix / user payload. Defaults
* to cumulusApiClient.invokeApifunction to invoke the
* api lambda
* @returns {Promise<Object>} - the response from the callback
*/
export declare const listAsyncOperations: (params: {
prefix: string;
query?: {
[key: string]: string | string[] | undefined;
fields?: string[] | undefined;
} | undefined;
callback?: InvokeApiFunction | undefined;
}) => Promise<ApiGatewayLambdaHttpProxyResponse>;
/**
* Create an async operation via the API
* POST /asyncOperations
*
* @param {Object} params - params
* @param {string} params.prefix - the prefix configured for the stack
* @param {Object} params.asyncOperation - asyncOperation object
* @param {Function} params.callback - function to invoke the api lambda
* that takes a prefix / user payload
* @returns {Promise<Object>} - promise that resolves to the output of the callback
*/
export declare const createAsyncOperation: (params: {
prefix: string;
asyncOperation: ApiAsyncOperation;
callback?: InvokeApiFunction;
}) => Promise<ApiGatewayLambdaHttpProxyResponse>;
//# sourceMappingURL=asyncOperations.d.ts.map