UNPKG

10 kBTypeScriptView Raw
1import * as gax from 'google-gax';
2import { Callback, CallOptions, Descriptors, ClientOptions } from 'google-gax';
3import * as protos from '../../protos/protos';
4/**
5 * Each RPC normalizes the partition IDs of the keys in its input entities,
6 * and always returns entities with keys with normalized partition IDs.
7 * This applies to all keys and entities, including those in values, except keys
8 * with both an empty path and an empty or unset partition ID. Normalization of
9 * input keys sets the project ID (if not already set) to the project ID from
10 * the request.
11 *
12 * @class
13 * @memberof v1
14 */
15export declare class DatastoreClient {
16 private _terminated;
17 private _opts;
18 private _providedCustomServicePath;
19 private _gaxModule;
20 private _gaxGrpc;
21 private _protos;
22 private _defaults;
23 auth: gax.GoogleAuth;
24 descriptors: Descriptors;
25 warn: (code: string, message: string, warnType?: string) => void;
26 innerApiCalls: {
27 [name: string]: Function;
28 };
29 datastoreStub?: Promise<{
30 [name: string]: Function;
31 }>;
32 /**
33 * Construct an instance of DatastoreClient.
34 *
35 * @param {object} [options] - The configuration object.
36 * The options accepted by the constructor are described in detail
37 * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance).
38 * The common options are:
39 * @param {object} [options.credentials] - Credentials object.
40 * @param {string} [options.credentials.client_email]
41 * @param {string} [options.credentials.private_key]
42 * @param {string} [options.email] - Account email address. Required when
43 * using a .pem or .p12 keyFilename.
44 * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or
45 * .p12 key downloaded from the Google Developers Console. If you provide
46 * a path to a JSON file, the projectId option below is not necessary.
47 * NOTE: .pem and .p12 require you to specify options.email as well.
48 * @param {number} [options.port] - The port on which to connect to
49 * the remote host.
50 * @param {string} [options.projectId] - The project ID from the Google
51 * Developer's Console, e.g. 'grape-spaceship-123'. We will also check
52 * the environment variable GCLOUD_PROJECT for your project ID. If your
53 * app is running in an environment which supports
54 * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials},
55 * your project ID will be detected automatically.
56 * @param {string} [options.apiEndpoint] - The domain name of the
57 * API remote host.
58 * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
59 * Follows the structure of {@link gapicConfig}.
60 * @param {boolean} [options.fallback] - Use HTTP fallback mode.
61 * In fallback mode, a special browser-compatible transport implementation is used
62 * instead of gRPC transport. In browser context (if the `window` object is defined)
63 * the fallback mode is enabled automatically; set `options.fallback` to `false`
64 * if you need to override this behavior.
65 */
66 constructor(opts?: ClientOptions);
67 /**
68 * Initialize the client.
69 * Performs asynchronous operations (such as authentication) and prepares the client.
70 * This function will be called automatically when any class method is called for the
71 * first time, but if you need to initialize it before calling an actual method,
72 * feel free to call initialize() directly.
73 *
74 * You can await on this method if you want to make sure the client is initialized.
75 *
76 * @returns {Promise} A promise that resolves to an authenticated service stub.
77 */
78 initialize(): Promise<{
79 [name: string]: Function;
80 }>;
81 /**
82 * The DNS address for this API service.
83 * @returns {string} The DNS address for this service.
84 */
85 static get servicePath(): string;
86 /**
87 * The DNS address for this API service - same as servicePath(),
88 * exists for compatibility reasons.
89 * @returns {string} The DNS address for this service.
90 */
91 static get apiEndpoint(): string;
92 /**
93 * The port for this API service.
94 * @returns {number} The default port for this service.
95 */
96 static get port(): number;
97 /**
98 * The scopes needed to make gRPC calls for every method defined
99 * in this service.
100 * @returns {string[]} List of default scopes.
101 */
102 static get scopes(): string[];
103 getProjectId(): Promise<string>;
104 getProjectId(callback: Callback<string, undefined, undefined>): void;
105 lookup(request?: protos.google.datastore.v1.ILookupRequest, options?: CallOptions): Promise<[protos.google.datastore.v1.ILookupResponse, protos.google.datastore.v1.ILookupRequest | undefined, {} | undefined]>;
106 lookup(request: protos.google.datastore.v1.ILookupRequest, options: CallOptions, callback: Callback<protos.google.datastore.v1.ILookupResponse, protos.google.datastore.v1.ILookupRequest | null | undefined, {} | null | undefined>): void;
107 lookup(request: protos.google.datastore.v1.ILookupRequest, callback: Callback<protos.google.datastore.v1.ILookupResponse, protos.google.datastore.v1.ILookupRequest | null | undefined, {} | null | undefined>): void;
108 runQuery(request?: protos.google.datastore.v1.IRunQueryRequest, options?: CallOptions): Promise<[protos.google.datastore.v1.IRunQueryResponse, protos.google.datastore.v1.IRunQueryRequest | undefined, {} | undefined]>;
109 runQuery(request: protos.google.datastore.v1.IRunQueryRequest, options: CallOptions, callback: Callback<protos.google.datastore.v1.IRunQueryResponse, protos.google.datastore.v1.IRunQueryRequest | null | undefined, {} | null | undefined>): void;
110 runQuery(request: protos.google.datastore.v1.IRunQueryRequest, callback: Callback<protos.google.datastore.v1.IRunQueryResponse, protos.google.datastore.v1.IRunQueryRequest | null | undefined, {} | null | undefined>): void;
111 beginTransaction(request?: protos.google.datastore.v1.IBeginTransactionRequest, options?: CallOptions): Promise<[protos.google.datastore.v1.IBeginTransactionResponse, protos.google.datastore.v1.IBeginTransactionRequest | undefined, {} | undefined]>;
112 beginTransaction(request: protos.google.datastore.v1.IBeginTransactionRequest, options: CallOptions, callback: Callback<protos.google.datastore.v1.IBeginTransactionResponse, protos.google.datastore.v1.IBeginTransactionRequest | null | undefined, {} | null | undefined>): void;
113 beginTransaction(request: protos.google.datastore.v1.IBeginTransactionRequest, callback: Callback<protos.google.datastore.v1.IBeginTransactionResponse, protos.google.datastore.v1.IBeginTransactionRequest | null | undefined, {} | null | undefined>): void;
114 commit(request?: protos.google.datastore.v1.ICommitRequest, options?: CallOptions): Promise<[protos.google.datastore.v1.ICommitResponse, protos.google.datastore.v1.ICommitRequest | undefined, {} | undefined]>;
115 commit(request: protos.google.datastore.v1.ICommitRequest, options: CallOptions, callback: Callback<protos.google.datastore.v1.ICommitResponse, protos.google.datastore.v1.ICommitRequest | null | undefined, {} | null | undefined>): void;
116 commit(request: protos.google.datastore.v1.ICommitRequest, callback: Callback<protos.google.datastore.v1.ICommitResponse, protos.google.datastore.v1.ICommitRequest | null | undefined, {} | null | undefined>): void;
117 rollback(request?: protos.google.datastore.v1.IRollbackRequest, options?: CallOptions): Promise<[protos.google.datastore.v1.IRollbackResponse, protos.google.datastore.v1.IRollbackRequest | undefined, {} | undefined]>;
118 rollback(request: protos.google.datastore.v1.IRollbackRequest, options: CallOptions, callback: Callback<protos.google.datastore.v1.IRollbackResponse, protos.google.datastore.v1.IRollbackRequest | null | undefined, {} | null | undefined>): void;
119 rollback(request: protos.google.datastore.v1.IRollbackRequest, callback: Callback<protos.google.datastore.v1.IRollbackResponse, protos.google.datastore.v1.IRollbackRequest | null | undefined, {} | null | undefined>): void;
120 allocateIds(request?: protos.google.datastore.v1.IAllocateIdsRequest, options?: CallOptions): Promise<[protos.google.datastore.v1.IAllocateIdsResponse, protos.google.datastore.v1.IAllocateIdsRequest | undefined, {} | undefined]>;
121 allocateIds(request: protos.google.datastore.v1.IAllocateIdsRequest, options: CallOptions, callback: Callback<protos.google.datastore.v1.IAllocateIdsResponse, protos.google.datastore.v1.IAllocateIdsRequest | null | undefined, {} | null | undefined>): void;
122 allocateIds(request: protos.google.datastore.v1.IAllocateIdsRequest, callback: Callback<protos.google.datastore.v1.IAllocateIdsResponse, protos.google.datastore.v1.IAllocateIdsRequest | null | undefined, {} | null | undefined>): void;
123 reserveIds(request?: protos.google.datastore.v1.IReserveIdsRequest, options?: CallOptions): Promise<[protos.google.datastore.v1.IReserveIdsResponse, protos.google.datastore.v1.IReserveIdsRequest | undefined, {} | undefined]>;
124 reserveIds(request: protos.google.datastore.v1.IReserveIdsRequest, options: CallOptions, callback: Callback<protos.google.datastore.v1.IReserveIdsResponse, protos.google.datastore.v1.IReserveIdsRequest | null | undefined, {} | null | undefined>): void;
125 reserveIds(request: protos.google.datastore.v1.IReserveIdsRequest, callback: Callback<protos.google.datastore.v1.IReserveIdsResponse, protos.google.datastore.v1.IReserveIdsRequest | null | undefined, {} | null | undefined>): void;
126 /**
127 * Terminate the gRPC channel and close the client.
128 *
129 * The client will no longer be usable and all future behavior is undefined.
130 * @returns {Promise} A promise that resolves when the client is closed.
131 */
132 close(): Promise<void>;
133}