1 | import { Database, Databases } from "./client/Database";
|
2 | import { Offer, Offers } from "./client/Offer";
|
3 | import { CosmosClientOptions } from "./CosmosClientOptions";
|
4 | import { DatabaseAccount } from "./documents";
|
5 | import { RequestOptions, ResourceResponse } from "./request";
|
6 | /**
|
7 | * Provides a client-side logical representation of the Azure Cosmos DB database account.
|
8 | * This client is used to configure and execute requests in the Azure Cosmos DB database service.
|
9 | * @example Instantiate a client and create a new database
|
10 | * ```typescript
|
11 | * const client = new CosmosClient({endpoint: "<URL HERE>", auth: {masterKey: "<KEY HERE>"}});
|
12 | * await client.databases.create({id: "<datbase name here>"});
|
13 | * ```
|
14 | * @example Instantiate a client with custom Connection Policy
|
15 | * ```typescript
|
16 | * const connectionPolicy = new ConnectionPolicy();
|
17 | * connectionPolicy.RequestTimeout = 10000;
|
18 | * const client = new CosmosClient({
|
19 | * endpoint: "<URL HERE>",
|
20 | * auth: {masterKey: "<KEY HERE>"},
|
21 | * connectionPolicy
|
22 | * });
|
23 | * ```
|
24 | */
|
25 | export declare class CosmosClient {
|
26 | /**
|
27 | * Used for creating new databases, or querying/reading all databases.
|
28 | *
|
29 | * Use `.database(id)` to read, replace, or delete a specific, existing database by id.
|
30 | *
|
31 | * @example Create a new database
|
32 | * ```typescript
|
33 | * const {resource: databaseDefinition, database} = await client.databases.create({id: "<name here>"});
|
34 | * ```
|
35 | */
|
36 | readonly databases: Databases;
|
37 | /**
|
38 | * Used for querying & reading all offers.
|
39 | *
|
40 | * Use `.offer(id)` to read, or replace existing offers.
|
41 | */
|
42 | readonly offers: Offers;
|
43 | private clientContext;
|
44 | private endpointRefresher;
|
45 | /**
|
46 | * Creates a new {@link CosmosClient} object from a connection string. Your database connection string can be found in the Azure Portal
|
47 | */
|
48 | constructor(connectionString: string);
|
49 | /**
|
50 | * Creates a new {for more details on what options you can use.
CosmosClient} object. See { CosmosClientOptions} |
51 | * require at least endpoint and auth to be configured
options - bag of options; |
52 | */
|
53 | constructor(options: CosmosClientOptions);
|
54 | /**
|
55 | * Get information about the current { DatabaseAccount} (including which regions are supported, etc.)
|
56 | */
|
57 | getDatabaseAccount(options?: RequestOptions): Promise<ResourceResponse<DatabaseAccount>>;
|
58 | /**
|
59 | * Gets the currently used write endpoint url. Useful for troubleshooting purposes.
|
60 | *
|
61 | * The url may contain a region suffix (e.g. "-eastus") if we're using location specific endpoints.
|
62 | */
|
63 | getWriteEndpoint(): Promise<string>;
|
64 | /**
|
65 | * Gets the currently used read endpoint. Useful for troubleshooting purposes.
|
66 | *
|
67 | * The url may contain a region suffix (e.g. "-eastus") if we're using location specific endpoints.
|
68 | */
|
69 | getReadEndpoint(): Promise<string>;
|
70 | /**
|
71 | * Gets the known write endpoints. Useful for troubleshooting purposes.
|
72 | *
|
73 | * The urls may contain a region suffix (e.g. "-eastus") if we're using location specific endpoints.
|
74 | */
|
75 | getWriteEndpoints(): Promise<readonly string[]>;
|
76 | /**
|
77 | * Gets the currently used read endpoint. Useful for troubleshooting purposes.
|
78 | *
|
79 | * The url may contain a region suffix (e.g. "-eastus") if we're using location specific endpoints.
|
80 | */
|
81 | getReadEndpoints(): Promise<readonly string[]>;
|
82 | /**
|
83 | * Used for reading, updating, or deleting a existing database by id or accessing containers belonging to that database.
|
84 | *
|
85 | * This does not make a network call. Use `.read` to get info about the database after getting the {@link Database} object.
|
86 | *
|
87 | * @param id - The id of the database.
|
88 | * @example Create a new container off of an existing database
|
89 | * ```typescript
|
90 | * const container = client.database("<database id>").containers.create("<container id>");
|
91 | * ```
|
92 | *
|
93 | * @example Delete an existing database
|
94 | * ```typescript
|
95 | * await client.database("<id here>").delete();
|
96 | * ```
|
97 | */
|
98 | database(id: string): Database;
|
99 | /**
|
100 | * Used for reading, or updating a existing offer by id.
|
101 | * @param id - The id of the offer.
|
102 | */
|
103 | offer(id: string): Offer;
|
104 | /**
|
105 | * Clears background endpoint refresher. Use client.dispose() when destroying the CosmosClient within another process.
|
106 | */
|
107 | dispose(): void;
|
108 | private backgroundRefreshEndpointList;
|
109 | }
|
110 | //# sourceMappingURL=CosmosClient.d.ts.map |
\ | No newline at end of file |