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

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

21 5
export type IOperation = instanceAdmin.longrunning.IOperation;
22 5

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

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

37 5
export type RequestCallback<T, R = void> = R extends void
38 5
  ? NormalCallback<T>
39 5
  : PagedCallback<T, R>;
40 5

41 5
export interface NormalCallback<TResponse> {
42 5
  (err: grpc.ServiceError | null, res?: TResponse | null): void;
43 5
}
44 5

45 5
export interface PagedCallback<Item, Response> {
46 5
  (
47 5
    err: grpc.ServiceError | null,
48 5
    results?: Item[] | null,
49 5
    nextQuery?: {} | null,
50 5
    response?: Response | null
51 5
  ): void;
52 5
}
53 5

54 5
export interface LongRunningCallback<Resource> {
55 5
  (
56 5
    err: grpc.ServiceError | null,
57 5
    resource?: Resource | null,
58 5
    operation?: GaxOperation | null,
59 5
    apiResponse?: IOperation
60 5
  ): void;
61 5
}
62 5

63 5
export interface PagedOptions {
64 5
  pageSize?: number;
65 5
  pageToken?: string;
66 5
  gaxOptions?: CallOptions;
67 5
}
68 5

69 5
export interface PagedOptionsWithFilter extends PagedOptions {
70 5
  filter?: string;
71 5
}
72 5

73 5
/*!
74 5
 * HTTP header for the resource prefix to improve routing
75 5
 * by the backend.
76 5
 */
77 5
export const CLOUD_RESOURCE_HEADER = 'google-cloud-resource-prefix';

Read our documentation on viewing source code .

Loading