{"action":"created","issue":{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/issues/692","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/issues/692/labels{/name}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/issues/692/comments","events_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/issues/692/events","html_url":"https://github.com/GoogleCloudPlatform/gcloud-node/pull/692","id":91047224,"number":692,"title":"streamrouter: implement across library","user":{"login":"stephenplusplus","id":723048,"avatar_url":"https://avatars.githubusercontent.com/u/723048?v=3","gravatar_id":"","url":"https://api.github.com/users/stephenplusplus","html_url":"https://github.com/stephenplusplus","followers_url":"https://api.github.com/users/stephenplusplus/followers","following_url":"https://api.github.com/users/stephenplusplus/following{/other_user}","gists_url":"https://api.github.com/users/stephenplusplus/gists{/gist_id}","starred_url":"https://api.github.com/users/stephenplusplus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephenplusplus/subscriptions","organizations_url":"https://api.github.com/users/stephenplusplus/orgs","repos_url":"https://api.github.com/users/stephenplusplus/repos","events_url":"https://api.github.com/users/stephenplusplus/events{/privacy}","received_events_url":"https://api.github.com/users/stephenplusplus/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/labels/cla:%20yes","name":"cla: yes","color":"009800"},{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/labels/core","name":"core","color":"f7c6c7"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-06-25T18:57:39Z","updated_at":"2015-07-13T18:56:42Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/pulls/692","html_url":"https://github.com/GoogleCloudPlatform/gcloud-node/pull/692","diff_url":"https://github.com/GoogleCloudPlatform/gcloud-node/pull/692.diff","patch_url":"https://github.com/GoogleCloudPlatform/gcloud-node/pull/692.patch"},"body":"Fixes #640\r\nFixes #673 \r\n\r\nThis allows all methods with a `nextQuery` to be used two additional ways:\r\n\r\n1. As a readable object stream.\r\n   ```js\r\nbucket.getFiles().on('data', function(file) {});\r\n   ```\r\n\r\n1. With `autoPaginate: true` to avoid the `nextQuery` dance.\r\n   ```js\r\nbucket.getFiles({ autoPaginate: true }, function(err, files) {\r\n    // No `nextQuery`! This is called once after all results have been found.\r\n});\r\n   ```\r\n\r\nDocs: http://stephenplusplus.github.io/gcloud-node/#/docs/master\r\n## Changes\r\n\r\n1. A stream is now stopped after a user-defined `query.maxResults` or `query.limitVal` (datastore) amount of results is reached.\r\n\r\n  Considering this example:\r\n  ```js\r\nbucket.getFiles({ maxResults: 3 }).on('data', function(file) {});\r\n  ```\r\n\r\n  What used to happen:\r\n\r\n  1. Makes API request to get only 3 results\r\n  2. Results are emitted to the stream\r\n  3. A `nextQuery` exists, so it calls it and gets 3 more results.\r\n  4. Results are emitted to the stream\r\n  5. ...3 & 4 repeat until no nextQuery exists...\r\n  6. The stream is ended\r\n\r\n  Now what will happen:\r\n\r\n  1. Makes API request to get only 3 results\r\n  2. Results are emitted to the stream\r\n  3. The stream is ended\r\n\r\n1. `dataset.runQuery` now uses a `nextQuery` object instead of an `endCursor`.\r\n\r\n## To Dos\r\n\r\n- [x] BigQuery\r\n  - [x] bigquery.getDatasets ([docs](http://stephenplusplus.github.io/gcloud-node/#/docs/master/bigquery?method=getDatasets))\r\n  - [x] bigquery.getJobs ([docs](http://stephenplusplus.github.io/gcloud-node/#/docs/master/bigquery?method=getJobs))\r\n  - [x] bigquery.query ([docs](http://stephenplusplus.github.io/gcloud-node/#/docs/master/bigquery?method=query))\r\n  - [x] table.getRows ([docs](http://stephenplusplus.github.io/gcloud-node/#/docs/master/bigquery/table?method=getRows))\r\n- [x] Datastore\r\n  - [x] dataset.runQuery ([docs](http://stephenplusplus.github.io/gcloud-node/#/docs/master/datastore/dataset?method=runQuery))\r\n- [x] PubSub\r\n  - [x] pubsub.getSubscriptions ([docs](http://stephenplusplus.github.io/gcloud-node/#/docs/master/pubsub?method=getSubscriptions))\r\n  - [x] pubsub.getTopics ([docs](http://stephenplusplus.github.io/gcloud-node/#/docs/master/pubsub?method=getTopics))\r\n- [x] Search (stream-router previously implemented in #648)\r\n  - [x] search.getIndexes ([docs](http://stephenplusplus.github.io/gcloud-node/#/docs/master/search?method=getIndexes))\r\n  - [x] index.getDocuments ([docs](http://stephenplusplus.github.io/gcloud-node/#/docs/master/search/index?method=getDocuments))\r\n  - [x] index.search ([docs](http://stephenplusplus.github.io/gcloud-node/#/docs/master/search/index?method=search))\r\n- [x] Storage\r\n  - [x] storage.getBuckets ([docs](http://stephenplusplus.github.io/gcloud-node/#/docs/master/storage?method=getBuckets))\r\n  - [x] bucket.getFiles ([docs](http://stephenplusplus.github.io/gcloud-node/#/docs/master/storage/bucket?method=getFiles))"},"comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/issues/comments/121022588","html_url":"https://github.com/GoogleCloudPlatform/gcloud-node/pull/692#issuecomment-121022588","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/issues/692","id":121022588,"user":{"login":"stephenplusplus","id":723048,"avatar_url":"https://avatars.githubusercontent.com/u/723048?v=3","gravatar_id":"","url":"https://api.github.com/users/stephenplusplus","html_url":"https://github.com/stephenplusplus","followers_url":"https://api.github.com/users/stephenplusplus/followers","following_url":"https://api.github.com/users/stephenplusplus/following{/other_user}","gists_url":"https://api.github.com/users/stephenplusplus/gists{/gist_id}","starred_url":"https://api.github.com/users/stephenplusplus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephenplusplus/subscriptions","organizations_url":"https://api.github.com/users/stephenplusplus/orgs","repos_url":"https://api.github.com/users/stephenplusplus/repos","events_url":"https://api.github.com/users/stephenplusplus/events{/privacy}","received_events_url":"https://api.github.com/users/stephenplusplus/received_events","type":"User","site_admin":false},"created_at":"2015-07-13T18:56:42Z","updated_at":"2015-07-13T18:56:42Z","body":"I'm so happy."}}