import { TypeGuard } from 'generic-type-guard'; import { FilterQuery, UpdateQuery } from 'mongodb'; import { AppDBBulkDeleteResponse, AppDBBulkUpdateResponse, AppDBDocument, AppDBUpdatedDocument, Response } from 'src/models'; /** * SDK for interacting with documents in AppDB. * ### Example Usage * * ```js * import { AppDBClient } from '@domoinc/toolkit'; * * interface Context { * name: string; * age: number; * } * const appDbClient = new AppDBClient.DocumentsClient('collectionName'); * * const addRecord = async (name: string, age: number) => * appDbClient.create({ name, age }); * ``` */ export declare class DocumentsClient { private transportClient; private collection; private reCaptchaHeader; /** * Include if using arrays as document types * */ private typeguard?; constructor(collection: string, typeguard?: TypeGuard, reCaptchaToken?: string); /** * A helper method to retrieve the documents in the initialized collection * * @param query Used to determine which documents are included in the results */ get[]>(query?: FilterQuery, queryParams?: { [key: string]: string | number | string[] | undefined; groupby?: string[]; orderby?: string[]; avg?: string[]; sum?: string[]; max?: string[]; min?: string[]; count?: string; limit?: number; offset?: number; }): Promise>; /** * A helper method to create new documents in the collection */ create(documents: DocumentType | DocumentType[]): Promise>>; /** * A helper method to update all documents matching the given **query** with * the given **operation**. * * @param query Query used to determine which documents are affected by the update * @param operation mongodb UpdateQuery operation to be applied on the matching documents */ partialUpdate(query: FilterQuery, operation: UpdateQuery): Promise>; /** * A helper method to update one or more existing documents in the collection */ update(documents: AppDBUpdatedDocument): Promise>>; update(documents: AppDBUpdatedDocument[]): Promise>; /** * A helper method to remove one or more documents from the collection */ delete(documents: string): Promise>; delete(documents: string[]): Promise>; private isDocumentTypeArray; }