Skip to content

Commit

Permalink
bigquery: doc fixes for autoPaginate (googleapis#2220)
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenplusplus authored Apr 13, 2017
1 parent 057695e commit 833e953
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 35 deletions.
7 changes: 3 additions & 4 deletions packages/bigquery/src/dataset.js
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,6 @@ Dataset.prototype.delete = function(options, callback) {
* @param {?error} callback.err - An error returned while making this request
* @param {module:bigquery/table[]} callback.tables - The list of tables from
* your Dataset.
* @param {object} callback.apiResponse - The full API response.
*
* @example
* dataset.getTables(function(err, tables) {
Expand All @@ -368,16 +367,16 @@ Dataset.prototype.delete = function(options, callback) {
* // To control how many API requests are made and page through the results
* // manually, set `autoPaginate` to `false`.
* //-
* function callback(err, tables, nextQuery, apiResponse) {
* function manualPaginationCallback(err, tables, nextQuery, apiResponse) {
* if (nextQuery) {
* // More results exist.
* dataset.getTables(nextQuery, callback);
* dataset.getTables(nextQuery, manualPaginationCallback);
* }
* }
*
* dataset.getTables({
* autoPaginate: false
* }, callback);
* }, manualPaginationCallback);
*
* //-
* // If the callback is omitted, we'll return a Promise.
Expand Down
33 changes: 15 additions & 18 deletions packages/bigquery/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,6 @@ BigQuery.prototype.dataset = function(id) {
* @param {?error} callback.err - An error returned while making this request
* @param {module:bigquery/dataset[]} callback.datasets - The list of datasets
* in your project.
* @param {object} callback.apiResponse - The full API response.
*
* @example
* bigquery.getDatasets(function(err, datasets) {
Expand All @@ -468,16 +467,16 @@ BigQuery.prototype.dataset = function(id) {
* // To control how many API requests are made and page through the results
* // manually, set `autoPaginate` to `false`.
* //-
* var callback = function(err, datasets, nextQuery, apiResponse) {
* function manualPaginationCallback(err, datasets, nextQuery, apiResponse) {
* if (nextQuery) {
* // More results exist.
* bigquery.getDatasets(nextQuery, callback);
* bigquery.getDatasets(nextQuery, manualPaginationCallback);
* }
* };
* }
*
* bigquery.getDatasets({
* autoPaginate: false
* }, callback);
* }, manualPaginationCallback);
*
* //-
* // If the callback is omitted, we'll return a Promise.
Expand Down Expand Up @@ -575,7 +574,6 @@ BigQuery.prototype.getDatasetsStream =
* @param {?error} callback.err - An error returned while making this request
* @param {module:bigquery/job[]} callback.jobs - The list of jobs in your
* project.
* @param {object} callback.apiResponse - The full API response.
*
* @example
* bigquery.getJobs(function(err, jobs) {
Expand All @@ -588,16 +586,16 @@ BigQuery.prototype.getDatasetsStream =
* // To control how many API requests are made and page through the results
* // manually, set `autoPaginate` to `false`.
* //-
* var callback = function(err, jobs, nextQuery, apiRespose) {
* function manualPaginationCallback(err, jobs, nextQuery, apiRespose) {
* if (nextQuery) {
* // More results exist.
* bigquery.getJobs(nextQuery, callback);
* bigquery.getJobs(nextQuery, manualPaginationCallback);
* }
* };
* }
*
* bigquery.getJobs({
* autoPaginate: false
* }, callback);
* }, manualPaginationCallback);
*
* //-
* // If the callback is omitted, we'll return a Promise.
Expand Down Expand Up @@ -713,14 +711,13 @@ BigQuery.prototype.job = function(id) {
* @param {function} callback - The callback function.
* @param {?error} callback.err - An error returned while making this request
* @param {array} callback.rows - The list of results from your query.
* @param {object} callback.apiResponse - The full API response.
*
* @example
* var query = 'SELECT url FROM [publicdata:samples.github_nested] LIMIT 100';
*
* bigquery.query(query, function(err, rows) {
* if (!err) {
* // Handle results here.
* // rows is an array of results.
* }
* });
*
Expand All @@ -737,7 +734,7 @@ BigQuery.prototype.job = function(id) {
* params: [
* 'google'
* ]
* }, callback);
* }, function(err, rows) {});
*
* //-
* // Or if you prefer to name them, that's also supported.
Expand All @@ -752,7 +749,7 @@ BigQuery.prototype.job = function(id) {
* params: {
* owner: 'google'
* }
* }, callback);
* }, function(err, rows) {});
*
* //-
* // If you need to use a `DATE`, `DATETIME`, `TIME`, or `TIMESTAMP` type in
Expand All @@ -764,16 +761,16 @@ BigQuery.prototype.job = function(id) {
* // 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) {
* function manualPaginationCallback(err, rows, nextQuery, apiResponse) {
* if (nextQuery) {
* bigquery.query(nextQuery, callback);
* bigquery.query(nextQuery, manualPaginationCallback);
* }
* };
* }
*
* bigquery.query({
* query: query,
* autoPaginate: false
* }, callback);
* }, manualPaginationCallback);
*
* //-
* // If the callback is omitted, we'll return a Promise.
Expand Down
11 changes: 4 additions & 7 deletions packages/bigquery/src/job.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,6 @@ Job.prototype.cancel = function(callback) {
* do not pass a callback.
* @param {?error} callback.err - An error returned while making this request
* @param {array} callback.rows - The results of a job.
* @param {?object} callback.nextQuery - If present, query with this object to
* check for more results.
* @param {object} callback.apiResponse - The full API response.
*
* @example
* //-
Expand All @@ -250,16 +247,16 @@ Job.prototype.cancel = function(callback) {
* // 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) {
* function manualPaginationCallback(err, rows, nextQuery, apiResponse) {
* if (nextQuery) {
* // More results exist.
* job.getQueryResults(nextQuery, callback);
* job.getQueryResults(nextQuery, manualPaginationCallback);
* }
* };
* }
*
* job.getQueryResults({
* autoPaginate: false
* }, callback);
* }, manualPaginationCallback);
*
* //-
* // If the callback is omitted, we'll return a Promise.
Expand Down
11 changes: 5 additions & 6 deletions packages/bigquery/src/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -711,29 +711,28 @@ Table.prototype.export = function(destination, options, callback) {
* @param {function} callback - The callback function.
* @param {?error} callback.err - An error returned while making this request
* @param {array} callback.rows - The table data from specified set of rows.
* @param {object} callback.apiResponse - The full API response.
*
* @example
* table.getRows(function(err, rows) {
* if (!err) {
* // Handle results here.
* // rows is an array of results.
* }
* });
*
* //-
* // 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) {
* function manualPaginationCallback(err, rows, nextQuery, apiResponse) {
* if (nextQuery) {
* // More results exist.
* table.getRows(nextQuery, callback);
* table.getRows(nextQuery, manualPaginationCallback);
* }
* };
* }
*
* table.getRows({
* autoPaginate: false
* }, callback);
* }, manualPaginationCallback);
*
* //-
* // If the callback is omitted, we'll return a Promise.
Expand Down

0 comments on commit 833e953

Please sign in to comment.