UNPKG

documentdb-typescript

Version:
25 lines (24 loc) 1.3 kB
import * as _DocumentDB from "./_DocumentDB"; import { Client } from "./Client"; import { Collection } from "./Collection"; /** Represents a DocumentDB database */ export declare class Database { /** Refer to a database by name, using given client */ constructor(id: string, client: Client); /** Refer to a database by name, using given URL and master key (implicitly creates a new client instance) */ constructor(id: string, url?: string, masterKey?: string); /** The name of the database that this instance refers to */ readonly id: string; /** The client used for all operations */ readonly client: Client; /** The partial resource URI for this database, i.e. `"/dbs/..."` */ readonly path: string; /** Open and validate the connection, check that this database exists */ openAsync(maxRetries?: number): Promise<this>; /** Open and validate connection, find or create database resource */ openOrCreateAsync(maxRetries?: number): Promise<this>; /** Get a list of Collection instances for this database */ listCollectionsAsync(maxRetries?: number, options?: _DocumentDB.FeedOptions): Promise<Collection[]>; /** Delete this database */ deleteAsync(maxRetries?: number, options?: _DocumentDB.RequestOptions): Promise<void>; }