Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: make request optional in all cases #901

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions protos/google/bigtable/admin/v2/bigtable_table_admin.proto
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ service BigtableTableAdmin {
}

// Create a new table by restoring from a completed backup. The new table
// must be in the same instance as the instance containing the backup. The
// must be in the same project as the instance containing the backup. The
// returned table [long-running operation][google.longrunning.Operation] can
// be used to track the progress of the operation, and to cancel it. The
// [metadata][google.longrunning.Operation.metadata] field type is
Expand Down Expand Up @@ -335,8 +335,8 @@ service BigtableTableAdmin {
// [RestoreTable][google.bigtable.admin.v2.BigtableTableAdmin.RestoreTable].
message RestoreTableRequest {
// Required. The name of the instance in which to create the restored
// table. This instance must be the parent of the source backup. Values are
// of the form `projects/<project>/instances/<instance>`.
// table. This instance must be in the same project as the source backup.
// Values are of the form `projects/<project>/instances/<instance>`.
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
Expand Down
33 changes: 10 additions & 23 deletions src/v2/bigtable_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
/* global window */
import * as gax from 'google-gax';
import {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax';
import * as path from 'path';

import * as protos from '../../protos/protos';
import jsonProtos = require('../../protos/protos.json');
/**
* Client JSON configuration object, loaded from
* `src/v2/bigtable_client_config.json`.
Expand Down Expand Up @@ -131,27 +131,14 @@ export class BigtableClient {
}
if (!opts.fallback) {
clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
} else if (opts.fallback === 'rest') {
clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
}
if (opts.libName && opts.libVersion) {
clientHeader.push(`${opts.libName}/${opts.libVersion}`);
}
// Load the applicable protos.
// For Node.js, pass the path to JSON proto file.
// For browsers, pass the JSON content.

const nodejsProtoPath = path.join(
__dirname,
'..',
'..',
'protos',
'protos.json'
);
this._protos = this._gaxGrpc.loadProto(
opts.fallback
? // eslint-disable-next-line @typescript-eslint/no-var-requires
require('../../protos/protos.json')
: nodejsProtoPath
);
this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos);

// This API contains "path templates"; forward-slash-separated
// identifiers to uniquely identify resources within the API.
Expand Down Expand Up @@ -318,7 +305,7 @@ export class BigtableClient {
// -- Service calls --
// -------------------
mutateRow(
request: protos.google.bigtable.v2.IMutateRowRequest,
request?: protos.google.bigtable.v2.IMutateRowRequest,
options?: CallOptions
): Promise<
[
Expand Down Expand Up @@ -374,7 +361,7 @@ export class BigtableClient {
* const [response] = await client.mutateRow(request);
*/
mutateRow(
request: protos.google.bigtable.v2.IMutateRowRequest,
request?: protos.google.bigtable.v2.IMutateRowRequest,
optionsOrCallback?:
| CallOptions
| Callback<
Expand Down Expand Up @@ -413,7 +400,7 @@ export class BigtableClient {
return this.innerApiCalls.mutateRow(request, options, callback);
}
checkAndMutateRow(
request: protos.google.bigtable.v2.ICheckAndMutateRowRequest,
request?: protos.google.bigtable.v2.ICheckAndMutateRowRequest,
options?: CallOptions
): Promise<
[
Expand Down Expand Up @@ -482,7 +469,7 @@ export class BigtableClient {
* const [response] = await client.checkAndMutateRow(request);
*/
checkAndMutateRow(
request: protos.google.bigtable.v2.ICheckAndMutateRowRequest,
request?: protos.google.bigtable.v2.ICheckAndMutateRowRequest,
optionsOrCallback?:
| CallOptions
| Callback<
Expand Down Expand Up @@ -523,7 +510,7 @@ export class BigtableClient {
return this.innerApiCalls.checkAndMutateRow(request, options, callback);
}
readModifyWriteRow(
request: protos.google.bigtable.v2.IReadModifyWriteRowRequest,
request?: protos.google.bigtable.v2.IReadModifyWriteRowRequest,
options?: CallOptions
): Promise<
[
Expand Down Expand Up @@ -583,7 +570,7 @@ export class BigtableClient {
* const [response] = await client.readModifyWriteRow(request);
*/
readModifyWriteRow(
request: protos.google.bigtable.v2.IReadModifyWriteRowRequest,
request?: protos.google.bigtable.v2.IReadModifyWriteRowRequest,
optionsOrCallback?:
| CallOptions
| Callback<
Expand Down
Loading