Skip to content

Commit

Permalink
Pass the entire optional parameters to createStub
Browse files Browse the repository at this point in the history
To allow additional grpc parameters for constructing Client.
Fix googleapis/gax-nodejs#107
  • Loading branch information
jmuk committed Feb 21, 2017
1 parent caf63b7 commit b576ed1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 20 deletions.
19 changes: 9 additions & 10 deletions src/main/resources/com/google/api/codegen/nodejs/main.snip
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@
opts = opts || {};
var servicePath = opts.servicePath || SERVICE_ADDRESS;
var port = opts.port || DEFAULT_SERVICE_PORT;
var sslCreds = opts.sslCreds || null;
var clientConfig = opts.clientConfig || {};

var googleApiClient = [
Expand Down Expand Up @@ -280,17 +279,17 @@

@if longrunningMethods

var lroOpts = {};
Object.keys(opts).forEach(function(key) {
lroOpts[key] = opts[key];
});
lroOpts.servicePath = servicePath;
lroOpts.port = port;
lroOpts.clientConfig = clientConfig;
this.operationsClient = new gax.lro({
auth: gaxGrpc.auth,
grpc: gaxGrpc.grpc
}).operationsClient({
servicePath: servicePath,
port: port,
sslCreds: sslCreds,
clientConfig: clientConfig,
libName: opts.libName,
libVersion: opts.libVersion
});
}).operationsClient(lroOpts);

this.longrunningDescriptors = {
@join method : longrunningMethods on {@", "}.add(BREAK)
Expand All @@ -315,7 +314,7 @@
servicePath,
port,
grpcClients.{@stub.fullyQualifiedType},
{sslCreds: sslCreds});
opts);
var {@stub.stubMethodsArrayName} = [
@join method : {@stub.methodNames} on {@","}.add(BREAK)
'{@method}'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ function LibraryServiceClient(gaxGrpc, grpcClients, opts) {
opts = opts || {};
var servicePath = opts.servicePath || SERVICE_ADDRESS;
var port = opts.port || DEFAULT_SERVICE_PORT;
var sslCreds = opts.sslCreds || null;
var clientConfig = opts.clientConfig || {};

var googleApiClient = [
Expand Down Expand Up @@ -138,7 +137,7 @@ function LibraryServiceClient(gaxGrpc, grpcClients, opts) {
}).operationsClient({
servicePath: servicePath,
port: port,
sslCreds: sslCreds,
sslCreds: opts.sslCreds,
clientConfig: clientConfig,
libName: opts.libName,
libVersion: opts.libVersion
Expand Down Expand Up @@ -168,7 +167,7 @@ function LibraryServiceClient(gaxGrpc, grpcClients, opts) {
servicePath,
port,
grpcClients.google.example.library.v1.LibraryService,
{sslCreds: sslCreds});
opts);
var libraryServiceStubMethods = [
'createShelf',
'getShelf',
Expand Down Expand Up @@ -212,7 +211,7 @@ function LibraryServiceClient(gaxGrpc, grpcClients, opts) {
servicePath,
port,
grpcClients.google.tagger.v1.Labeler,
{sslCreds: sslCreds});
opts);
var labelerStubMethods = [
'addLabel'
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ function LibraryServiceClient(gaxGrpc, grpcClients, opts) {
opts = opts || {};
var servicePath = opts.servicePath || SERVICE_ADDRESS;
var port = opts.port || DEFAULT_SERVICE_PORT;
var sslCreds = opts.sslCreds || null;
var clientConfig = opts.clientConfig || {};

var googleApiClient = [
Expand Down Expand Up @@ -138,7 +137,7 @@ function LibraryServiceClient(gaxGrpc, grpcClients, opts) {
}).operationsClient({
servicePath: servicePath,
port: port,
sslCreds: sslCreds,
sslCreds: opts.sslCreds,
clientConfig: clientConfig,
libName: opts.libName,
libVersion: opts.libVersion
Expand Down Expand Up @@ -168,7 +167,7 @@ function LibraryServiceClient(gaxGrpc, grpcClients, opts) {
servicePath,
port,
grpcClients.google.example.library.v1.LibraryService,
{sslCreds: sslCreds});
opts);
var libraryServiceStubMethods = [
'createShelf',
'getShelf',
Expand Down Expand Up @@ -212,7 +211,7 @@ function LibraryServiceClient(gaxGrpc, grpcClients, opts) {
servicePath,
port,
grpcClients.google.tagger.v1.Labeler,
{sslCreds: sslCreds});
opts);
var labelerStubMethods = [
'addLabel'
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ function NoTemplatesAPIServiceClient(gaxGrpc, grpcClients, opts) {
opts = opts || {};
var servicePath = opts.servicePath || SERVICE_ADDRESS;
var port = opts.port || DEFAULT_SERVICE_PORT;
var sslCreds = opts.sslCreds || null;
var clientConfig = opts.clientConfig || {};

var googleApiClient = [
Expand Down Expand Up @@ -90,7 +89,7 @@ function NoTemplatesAPIServiceClient(gaxGrpc, grpcClients, opts) {
servicePath,
port,
grpcClients.google.cloud.example.v1.NoTemplatesAPIService,
{sslCreds: sslCreds});
opts);
var noTemplatesApiServiceStubMethods = [
'increment'
];
Expand Down

0 comments on commit b576ed1

Please sign in to comment.