diff --git a/lib/bigquery/job.js b/lib/bigquery/job.js index 0ab579ea6d5..752b35377e8 100644 --- a/lib/bigquery/job.js +++ b/lib/bigquery/job.js @@ -115,34 +115,36 @@ Job.prototype.getMetadata = function(callback) { * @param {object} callback.apiResponse - The full API response. * * @example - * var callback = function(err, rows, nextQuery, apiResponse) { - * if (nextQuery) { - * // More results exist. - * job.getQueryResults(nextQuery, callback); - * } - * }; - * * //- - * // Use the default options to get the results of a query. + * // Get all of the results of a query. * //- - * job.getQueryResults(callback); + * job.getQueryResults(function(err, rows) { + * if (!err) { + * // rows is an array of results. + * } + * }); * * //- * // Customize the results you want to fetch. * //- * job.getQueryResults({ * maxResults: 100 - * }, callback); + * }, function(err, rows) {}); * * //- - * // To have pagination handled for you, set `autoPaginate`. Note the changed - * // callback parameters. + * // To control how many API requests are made and page through the results + * // manually, set `autoPaginate` to `false`. * //- + * var callback = function(err, rows, nextQuery, apiResponse) { + * if (nextQuery) { + * // More results exist. + * job.getQueryResults(nextQuery, callback); + * } + * }; + * * job.getQueryResults({ - * autoPaginate: true - * }, function(err, rows) { - * // Called after all rows have been retrieved. - * }); + * autoPaginate: false + * }, callback); * * //- * // Consume the results from the query as a readable object stream. diff --git a/lib/pubsub/index.js b/lib/pubsub/index.js index 57db7cff075..26e1f584106 100644 --- a/lib/pubsub/index.js +++ b/lib/pubsub/index.js @@ -119,26 +119,33 @@ function PubSub(options) { * service. * * @example - * // Get all topics. - * pubsub.getTopics(function(err, topics, nextQuery, apiResponse) { - * // If `nextQuery` is non-null, there may be more results to fetch. To do - * // so, run `pubsub.getTopics(nextQuery, callback);`. + * pubsub.getTopics(function(err, topics) { + * if (!err) { + * // topics is an array of Topic objects. + * } * }); * + * //- * // Customize the query. + * //- * pubsub.getTopics({ * pageSize: 3 - * }, function(err, topics, nextQuery, apiResponse) {}); + * }, function(err, topics) {}); * * //- - * // To have pagination handled for you, set `autoPaginate`. Note the changed - * // callback parameters. + * // To control how many API requests are made and page through the results + * // manually, set `autoPaginate` to `false`. * //- + * var callback = function(err, rows, nextQuery, apiResponse) { + * if (nextQuery) { + * // More results exist. + * pubsub.getTopics(nextQuery, callback); + * } + * }; + * * pubsub.getTopics({ - * autoPaginate: true - * }, function(err, topics) { - * // Called after all topics have been retrieved. - * }); + * autoPaginate: false + * }, callback); * * //- * // Get the topics as a readable object stream. @@ -421,20 +428,10 @@ PubSub.prototype.topic = function(name) { * }; * * pubsub.getSubscriptions({ - * autoPaginate: false, + * autoPaginate: false * }, callback); * * //- - * // To have pagination handled for you, set `autoPaginate`. Note the changed - * // callback parameters. - * //- - * pubsub.getSubscriptions({ - * autoPaginate: true - * }, function(err, subscriptions) { - * // Called after all subscriptions have been retrieved. - * }); - * - * //- * // Get the subscriptions as a readable object stream. * //- * pubsub.getSubscriptions()