|
16 | 16 |
|
17 | 17 | 'use strict'; |
18 | 18 |
|
19 | | -var common = require('@google-cloud/common'); |
| 19 | +const {replaceProjectIdToken} = require('@google-cloud/projectify'); |
| 20 | +const {paginator} = require('@google-cloud/paginator'); |
| 21 | +const {promisifyAll} = require('@google-cloud/promisify'); |
20 | 22 | var extend = require('extend'); |
21 | 23 | var {GoogleAuth} = require('google-auth-library'); |
22 | 24 | var gax = require('google-gax'); |
23 | | -var grpc = new gax.GrpcClient().grpc; |
| 25 | +var {grpc} = new gax.GrpcClient(); |
24 | 26 | var is = require('is'); |
25 | 27 |
|
26 | 28 | var PKG = require('../package.json'); |
@@ -97,7 +99,7 @@ function PubSub(options) { |
97 | 99 | return new PubSub(options); |
98 | 100 | } |
99 | 101 |
|
100 | | - options = common.util.normalizeArguments(this, options); |
| 102 | + options = options || {}; |
101 | 103 |
|
102 | 104 | // Determine what scopes are needed. |
103 | 105 | // It is the union of the scopes on both clients. |
@@ -483,9 +485,7 @@ PubSub.prototype.getSnapshots = function(options, callback) { |
483 | 485 | * this.end(); |
484 | 486 | * }); |
485 | 487 | */ |
486 | | -PubSub.prototype.getSnapshotsStream = common.paginator.streamify( |
487 | | - 'getSnapshots' |
488 | | -); |
| 488 | +PubSub.prototype.getSnapshotsStream = paginator.streamify('getSnapshots'); |
489 | 489 |
|
490 | 490 | /** |
491 | 491 | * Query object for listing subscriptions. |
@@ -629,7 +629,7 @@ PubSub.prototype.getSubscriptions = function(options, callback) { |
629 | 629 | * this.end(); |
630 | 630 | * }); |
631 | 631 | */ |
632 | | -PubSub.prototype.getSubscriptionsStream = common.paginator.streamify( |
| 632 | +PubSub.prototype.getSubscriptionsStream = paginator.streamify( |
633 | 633 | 'getSubscriptions' |
634 | 634 | ); |
635 | 635 |
|
@@ -768,7 +768,7 @@ PubSub.prototype.getTopics = function(options, callback) { |
768 | 768 | * this.end(); |
769 | 769 | * }); |
770 | 770 | */ |
771 | | -PubSub.prototype.getTopicsStream = common.paginator.streamify('getTopics'); |
| 771 | +PubSub.prototype.getTopicsStream = paginator.streamify('getTopics'); |
772 | 772 |
|
773 | 773 | /** |
774 | 774 | * Get the PubSub client object. |
@@ -832,7 +832,7 @@ PubSub.prototype.request = function(config, callback) { |
832 | 832 | } |
833 | 833 |
|
834 | 834 | var reqOpts = extend(true, {}, config.reqOpts); |
835 | | - reqOpts = common.util.replaceProjectIdToken(reqOpts, self.projectId); |
| 835 | + reqOpts = replaceProjectIdToken(reqOpts, self.projectId); |
836 | 836 |
|
837 | 837 | client[config.method](reqOpts, config.gaxOpts, callback); |
838 | 838 | }); |
@@ -933,18 +933,14 @@ PubSub.prototype.topic = function(name, options) { |
933 | 933 | * |
934 | 934 | * These methods can be agto-paginated. |
935 | 935 | */ |
936 | | -common.paginator.extend(PubSub, [ |
937 | | - 'getSnapshots', |
938 | | - 'getSubscriptions', |
939 | | - 'getTopics', |
940 | | -]); |
| 936 | +paginator.extend(PubSub, ['getSnapshots', 'getSubscriptions', 'getTopics']); |
941 | 937 |
|
942 | 938 | /*! Developer Documentation |
943 | 939 | * |
944 | 940 | * All async methods (except for streams) will return a Promise in the event |
945 | 941 | * that a callback is omitted. |
946 | 942 | */ |
947 | | -common.util.promisifyAll(PubSub, { |
| 943 | +promisifyAll(PubSub, { |
948 | 944 | exclude: ['request', 'snapshot', 'subscription', 'topic'], |
949 | 945 | }); |
950 | 946 |
|
|
0 commit comments