Skip to content

Commit be6512a

Browse files
docs: properly document autoPaginate
1 parent f5f09ad commit be6512a

File tree

2 files changed

+35
-9
lines changed

2 files changed

+35
-9
lines changed

packages/bigquery/src/dataset.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,11 +360,26 @@ Dataset.prototype.delete = function(options, callback) {
360360
* @param {object} callback.apiResponse - The full API response.
361361
*
362362
* @example
363-
* dataset.getTables(function(err, tables, nextQuery, apiResponse) {
364-
* // If `nextQuery` is non-null, there are more results to fetch.
363+
* dataset.getTables(function(err, tables) {
364+
* // tables is an array of `Table` objects.
365365
* });
366366
*
367367
* //-
368+
* // To control how many API requests are made and page through the results
369+
* // manually, set `autoPaginate` to `false`.
370+
* //-
371+
* function callback(err, tables, nextQuery, apiResponse) {
372+
* if (nextQuery) {
373+
* // More results exist.
374+
* dataset.getTables(nextQuery, callback);
375+
* }
376+
* }
377+
*
378+
* dataset.getTables({
379+
* autoPaginate: false
380+
* }, callback);
381+
*
382+
* //-
368383
* // If the callback is omitted, we'll return a Promise.
369384
* //-
370385
* dataset.getTables().then(function(data) {

packages/pubsub/src/topic.js

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -278,20 +278,31 @@ Topic.formatName_ = function(projectId, name) {
278278
* @param {function} callback - The callback function.
279279
*
280280
* @example
281-
* var callback = function(err, subscriptions, nextQuery, apiResponse) {
282-
* // If `nextQuery` is non-null, there may be more results to fetch. To do
283-
* // so, run `topic.getSubscriptions(nextQuery, callback);`.
284-
* };
285-
*
286-
* // Get all subscriptions for this topic.
287-
* topic.getSubscriptions(callback);
281+
* topic.getSubscriptions(function(err, subscriptions) {
282+
* // subscriptions is an array of `Subscription` objects.
283+
* });
288284
*
289285
* // Customize the query.
290286
* topic.getSubscriptions({
291287
* pageSize: 3
292288
* }, callback);
293289
*
294290
* //-
291+
* // To control how many API requests are made and page through the results
292+
* // manually, set `autoPaginate` to `false`.
293+
* //-
294+
* function callback(err, subscriptions, nextQuery, apiResponse) {
295+
* if (nextQuery) {
296+
* // More results exist.
297+
* topic.getSubscriptions(nextQuery, callback);
298+
* }
299+
* }
300+
*
301+
* topic.getSubscriptions({
302+
* autoPaginate: false
303+
* }, callback);
304+
*
305+
* //-
295306
* // If the callback is omitted, we'll return a Promise.
296307
* //-
297308
* topic.getSubscriptions().then(function(data) {

0 commit comments

Comments
 (0)