1 0
/*!
2 0
 * Copyright 2017 Google Inc. All Rights Reserved.
3 0
 *
4 0
 * Licensed under the Apache License, Version 2.0 (the "License");
5 0
 * you may not use this file except in compliance with the License.
6 0
 * You may obtain a copy of the License at
7 0
 *
8 0
 *      http://www.apache.org/licenses/LICENSE-2.0
9 0
 *
10 0
 * Unless required by applicable law or agreed to in writing, software
11 0
 * distributed under the License is distributed on an "AS IS" BASIS,
12 0
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 0
 * See the License for the specific language governing permissions and
14 0
 * limitations under the License.
15 0
 */
16 0

17 0
import {ServiceError, CallOptions} from 'grpc';
18 0
import {Operation as GaxOperation} from 'google-gax';
19 0
import {google as instanceAdmin} from '../protos/protos';
20 0
import {google as databaseAdmin} from '../protos/protos';
21 0

22 0
export type IOperation = instanceAdmin.longrunning.IOperation;
23 0

24 0
export type Schema =
25 0
  | string
26 0
  | string[]
27 0
  | databaseAdmin.spanner.admin.database.v1.IUpdateDatabaseDdlRequest;
28 0

29 0
export interface ResourceCallback<Resource, Response> {
30 0
  (
31 0
    err: ServiceError | null,
32 0
    resource?: Resource | null,
33 0
    response?: Response
34 0
  ): void;
35 0
}
36 0
export type PagedResponse<Item, Response> =
37 0
  | [Item[]]
38 0
  | [Item[], {} | null, Response];
39 0

40 0
export type RequestCallback<T, R = void> = R extends void
41 0
  ? NormalCallback<T>
42 0
  : PagedCallback<T, R>;
43 0

44 0
export interface NormalCallback<TResponse> {
45 0
  (err: ServiceError | null, res?: TResponse | null): void;
46 0
}
47 0

48 0
export interface PagedCallback<Item, Response> {
49 0
  (
50 0
    err: ServiceError | null,
51 0
    results?: Item[] | null,
52 0
    nextQuery?: {} | null,
53 0
    response?: Response | null
54 0
  ): void;
55 0
}
56 0

57 0
export interface LongRunningCallback<Resource> {
58 0
  (
59 0
    err: ServiceError | null,
60 0
    resource?: Resource | null,
61 0
    operation?: GaxOperation | null,
62 0
    apiResponse?: IOperation
63 0
  ): void;
64 0
}
65 0

66 0
export type PagedRequest<P> = P & {
67 0
  autoPaginate?: boolean;
68 0
  maxApiCalls?: number;
69 0
  gaxOptions?: CallOptions;
70 0
};

Read our documentation on viewing source code .

Loading