UNPKG

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