@bzr/bazaar
Version:
The Bazaar SDK. Conveniently use Bazaar with your app in the browser.
28 lines (27 loc) • 1.14 kB
TypeScript
import { CollectionOptions, ContextOptions, Doc } from "../types";
import { CollectionAPI } from "./collection";
import { CollectionsAPI } from "./collections";
import { PermissionsAPI } from "./permissions";
import { API } from "./raw";
/**
* The primary class of the Bazaar JS SDK to help you more easily build web apps with Bazaar.
*/
export declare class BazaarContext {
private api;
private contextOptions;
/**
* Access to the collections API
*/
collections: CollectionsAPI;
/**
* Access to the permissions API
*/
permissions: PermissionsAPI;
constructor(api: API, bazaarUri: string, contextOptions: ContextOptions);
/**
* Gets a collection interface (API access to the specified collection)
* @param collectionName - The name of the collection to create the interface for.
* @param collectionOptions - An optional object for specifying an onCreate hook. The onCreate hook sets up a collection when it is created (e.g., to set up permissions)
*/
collection<T extends Doc>(collectionName: string, collectionOptions?: CollectionOptions): CollectionAPI<T>;
}