waterbase
Version:
SDK for waterbase-server
43 lines (42 loc) • 1.02 kB
TypeScript
import Client from '../Client';
import QueriedDocs from './QueriedDocs';
import Document from './Document';
declare class Collection {
#private;
constructor(client: Client, name: string);
/**
* Assigns the query to be ready before getting the docs
*
* @param query object
*
* @return self
*/
where: (query: any) => {
get: () => Promise<QueriedDocs>;
};
/**
* Adds a single doc to the collection
*
* @param doc object
*
* @return Promise<Document>
*/
add: (doc: object) => Promise<Document>;
/**
* Gets a single doc of the collection
*
* @param id string
*
* @return Promise<Document>
*/
doc: (id: string) => Promise<Document>;
/**
* Gets gets all the docs that the where got or all in general
*
* @param id string
*
* @return Promise<QueriedDocs>
*/
get: () => Promise<QueriedDocs>;
}
export = Collection;