How to use the @google-cloud/paginator.paginator.extend function in @google-cloud/paginator

To help you get started, we’ve selected a few @google-cloud/paginator examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github googleapis / nodejs-dns / src / zone.ts View on Github external
* //-
   * // If you anticipate many results, you can end a stream early to prevent
   * // unnecessary processing and API requests.
   * //-
   * zone.getRecordsStream()
   *   .on('data', function(change) {
   *     this.end();
   *   });
   */
  Zone.prototype.getRecordsStream = paginator.streamify('getRecords');

  /*! Developer Documentation
   *
   * These methods can be auto-paginated.
   */
  paginator.extend(Zone, ['getChanges', 'getRecords']);

  /*! Developer Documentation
   *
   * All async methods (except for streams) will return a Promise in the event
   * that a callback is omitted.
   */
  promisifyAll(Zone, {
    exclude: ['change', 'record'],
  });

  /**
   * Reference to the {@link Zone} class.
   * @name module:@google-cloud/dns.Zone
   * @see Zone
   */
  export {Zone};
github googleapis / nodejs-pubsub / src / topic.ts View on Github external
*
 * //-
 * // If you anticipate many results, you can end a stream early to prevent
 * // unnecessary processing and API requests.
 * //-
 * topic.getSubscriptionsStream()
 *   .on('data', function(subscription) {
 *     this.end();
 *   });
 */

/*! Developer Documentation
 *
 * These methods can be agto-paginated.
 */
paginator.extend(Topic, ['getSubscriptions']);

/*! Developer Documentation
 *
 * All async methods (except for streams) will return a Promise in the event
 * that a callback is omitted.
 */
promisifyAll(Topic, {
  exclude: ['publisher', 'subscription'],
});
github googleapis / nodejs-compute / src / index.js View on Github external
* //-
 * // If you anticipate many results, you can end a stream early to prevent
 * // unnecessary processing and API requests.
 * //-
 * gce.getZonesStream()
 *   .on('data', function(zone) {
 *     this.end();
 *   });
 */
Compute.prototype.getZonesStream = paginator.streamify('getZones');

/*! Developer Documentation
 *
 * These methods can be auto-paginated.
 */
paginator.extend(Compute, [
  'getAddresses',
  'getAutoscalers',
  'getDisks',
  'getFirewalls',
  'getImages',
  'getHealthChecks',
  'getInstanceGroups',
  'getMachineTypes',
  'getNetworks',
  'getOperations',
  'getRegions',
  'getRules',
  'getServices',
  'getSnapshots',
  'getSubnetworks',
  'getVMs',
github googleapis / nodejs-compute / src / region.js View on Github external
* //-
 * // If you anticipate many results, you can end a stream early to prevent
 * // unnecessary processing and API requests.
 * //-
 * region.getSubnetworksStream()
 *   .on('data', function(subnetwork) {
 *     this.end();
 *   });
 */
Region.prototype.getSubnetworksStream = paginator.streamify('getSubnetworks');

/*! Developer Documentation
 *
 * These methods can be auto-paginated.
 */
paginator.extend(Region, [
  'getAddresses',
  'getOperations',
  'getRules',
  'getSubnetworks',
]);

/*! Developer Documentation
 *
 * All async methods (except for streams) will return a Promise in the event
 * that a callback is omitted.
 */
promisifyAll(Region, {
  exclude: ['address', 'operation', 'rule', 'subnetwork'],
});

/**
github googleapis / nodejs-bigtable / src / instance.ts View on Github external
* //-
 * // If you anticipate many results, you can end a stream early to prevent
 * // unnecessary processing and API requests.
 * //-
 * instance.getTablesStream()
 *   .on('data', function(table) {
 *     this.end();
 *   });
 */
Instance.prototype.getTablesStream = paginator.streamify('getTables');

/*! Developer Documentation
 *
 * These methods can be auto-paginated.
 */
paginator.extend(Instance, ['getTables']);

/*! Developer Documentation
 *
 * All async methods (except for streams) will return a Promise in the event
 * that a callback is omitted.
 */
promisifyAll(Instance, {
  exclude: ['appProfile', 'cluster', 'table'],
});

/**
 * Reference to the {@link Instance} class.
 * @name module:@google-cloud/bigtable.Instance
 * @see Instance
 */
github googleapis / nodejs-compute / src / instance-group.js View on Github external
* //-
 * // If you anticipate many results, you can end a stream early to prevent
 * // unnecessary processing and API requests.
 * //-
 * instanceGroup.getVMsStream()
 *   .on('data', function(vm) {
 *     this.end();
 *   });
 */
InstanceGroup.prototype.getVMsStream = paginator.streamify('getVMs');

/*! Developer Documentation
 *
 * These methods can be auto-paginated.
 */
paginator.extend(InstanceGroup, ['getVMs']);

/*! Developer Documentation
 *
 * All async methods (except for streams) will return a Promise in the event
 * that a callback is omitted.
 */
promisifyAll(InstanceGroup);

module.exports = InstanceGroup;
github googleapis / nodejs-bigquery / src / index.ts View on Github external
/**
 * This method will be called by `createQueryStream()`. It is required to
 * properly set the `autoPaginate` option value.
 *
 * @private
 */
BigQuery.prototype.queryAsStream_ = function(query, callback) {
  this.query(query, {autoPaginate: false}, callback);
};

/*! Developer Documentation
 *
 * These methods can be auto-paginated.
 */
paginator.extend(BigQuery, ['getDatasets', 'getJobs']);

/*! Developer Documentation
 *
 * All async methods (except for streams) will return a Promise in the event
 * that a callback is omitted.
 */
promisifyAll(BigQuery, {
  exclude: ['dataset', 'date', 'datetime', 'job', 'time', 'timestamp'],
});

/**
 * {@link Dataset} class.
 *
 * @name BigQuery.Dataset
 * @see Dataset
 * @type {constructor}
github googleapis / nodejs-logging / src / index.js View on Github external
return;
        }
        const baseUrl = 'pubsub.googleapis.com';
        const topicName = topic.name;
        config.destination = `${baseUrl}/${topicName}`;
        self.createSink(name, config, callback);
      });
    });
  }
}

/*! Developer Documentation
 *
 * These methods can be auto-paginated.
 */
paginator.extend(Logging, ['getEntries', 'getSinks']);

/*! Developer Documentation
 *
 * All async methods (except for streams) will return a Promise in the event
 * that a callback is omitted.
 */
promisifyAll(Logging, {
  exclude: ['entry', 'log', 'request', 'sink'],
});

/**
 * {@link Entry} class.
 *
 * @name Logging.Entry
 * @see Entry
 * @type {Constructor}
github googleapis / nodejs-bigquery / src / table.ts View on Github external
* table.setMetadata(metadata).then((data) => {
   *   const metadata = data[0];
   *   const apiResponse = data[1];
   * });
   */
  setMetadata(metadata, callback) {
    const body = Table.formatMetadata_(metadata);
    super.setMetadata(body, callback);
  }
}

/*! Developer Documentation
 *
 * These methods can be auto-paginated.
 */
paginator.extend(Table, ['getRows']);

/*! Developer Documentation
 *
 * All async methods (except for streams) will return a Promise in the event
 * that a callback is omitted.
 */
promisifyAll(Table);

/**
 * Reference to the {@link Table} class.
 * @name module:@google-cloud/bigquery.Table
 * @see Table
 */
export {Table};
github googleapis / nodejs-bigquery / src / dataset.ts View on Github external
options = extend(
      {
        location: this.location,
      },
      options
    );

    return new Table(this, id, options);
  }
}

/*! Developer Documentation
 *
 * These methods can be auto-paginated.
 */
paginator.extend(Dataset, ['getTables']);

/*! Developer Documentation
 *
 * All async methods (except for streams) will return a Promise in the event
 * that a callback is omitted.
 */
promisifyAll(Dataset, {
  exclude: ['table'],
});

/**
 * Reference to the {@link Dataset} class.
 * @name module:@google-cloud/bigquery.Dataset
 * @see Dataset
 */
export {Dataset};

@google-cloud/paginator

A result paging utility used by Google node.js modules

Apache-2.0
Latest version published 8 months ago

Package Health Score

84 / 100
Full package analysis