{"action":"created","issue":{"url":"https://api.github.com/repos/googleapis/gax-nodejs/issues/35","repository_url":"https://api.github.com/repos/googleapis/gax-nodejs","labels_url":"https://api.github.com/repos/googleapis/gax-nodejs/issues/35/labels{/name}","comments_url":"https://api.github.com/repos/googleapis/gax-nodejs/issues/35/comments","events_url":"https://api.github.com/repos/googleapis/gax-nodejs/issues/35/events","html_url":"https://github.com/googleapis/gax-nodejs/issues/35","id":174861602,"number":35,"title":"Reconsider the interface to suppress page-streaming for an invocation","user":{"login":"jmuk","id":816093,"avatar_url":"https://avatars.githubusercontent.com/u/816093?v=3","gravatar_id":"","url":"https://api.github.com/users/jmuk","html_url":"https://github.com/jmuk","followers_url":"https://api.github.com/users/jmuk/followers","following_url":"https://api.github.com/users/jmuk/following{/other_user}","gists_url":"https://api.github.com/users/jmuk/gists{/gist_id}","starred_url":"https://api.github.com/users/jmuk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmuk/subscriptions","organizations_url":"https://api.github.com/users/jmuk/orgs","repos_url":"https://api.github.com/users/jmuk/repos","events_url":"https://api.github.com/users/jmuk/events{/privacy}","received_events_url":"https://api.github.com/users/jmuk/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-09-02T22:50:34Z","updated_at":"2016-09-08T23:47:02Z","closed_at":null,"body":"Right now, the paged responses will be unrolled into a single stream (i.e. page-streaming), but we allow to suppress this by specifying `page_token` into the call options (for the first page, specify `FIRST_PAGE` object).\r\n\r\nThe sample usage would be:\r\n```javascript\r\napi.listLogEntries([projectId], new gax.CallOptions({page_token: gax.FIRST_PAGE})).on('data', function(resp) {\r\n   // resp is a listLogEntriesResponse.\r\n});\r\n```\r\n\r\nSome random ideas:\r\n- probably better to avoid creating gax.CallOptions instance. Instead, simply passing an object would be better.\r\n   - the current design can come with a complication, because the generated class will notice about `gax.CallOptions` instance through `arguejs`, and `arguejs` could fail to recognize an argument if multiple installations of `gax` exists in the user environment.\r\n- instead of having `gax.FIRST_PAGE`, accepting both `autoPaginate` boolean flag and `pageToken` flag might be more JS-ish?\r\n- could it be a normal callback style instead of a stream of response object?\r\n   - it was, but I switched to this design because changing the response type upon the argument style might not be good."},"comment":{"url":"https://api.github.com/repos/googleapis/gax-nodejs/issues/comments/245777130","html_url":"https://github.com/googleapis/gax-nodejs/issues/35#issuecomment-245777130","issue_url":"https://api.github.com/repos/googleapis/gax-nodejs/issues/35","id":245777130,"user":{"login":"jmuk","id":816093,"avatar_url":"https://avatars.githubusercontent.com/u/816093?v=3","gravatar_id":"","url":"https://api.github.com/users/jmuk","html_url":"https://github.com/jmuk","followers_url":"https://api.github.com/users/jmuk/followers","following_url":"https://api.github.com/users/jmuk/following{/other_user}","gists_url":"https://api.github.com/users/jmuk/gists{/gist_id}","starred_url":"https://api.github.com/users/jmuk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmuk/subscriptions","organizations_url":"https://api.github.com/users/jmuk/orgs","repos_url":"https://api.github.com/users/jmuk/repos","events_url":"https://api.github.com/users/jmuk/events{/privacy}","received_events_url":"https://api.github.com/users/jmuk/received_events","type":"User","site_admin":false},"created_at":"2016-09-08T23:47:02Z","updated_at":"2016-09-08T23:47:02Z","body":"Hey @stephenplusplus, I've been working with this. Currently, the change will look like this https://github.com/GoogleCloudPlatform/google-cloud-node/compare/master...jmuk:update_pubsub\r\n\r\nwith some changes on GAX side. I chose `flattenPages` instead of `autoPaginate` which is consistent with others, but basically it will be\r\n```javascript\r\n// normal streaming\r\npublisher.listTopicSubscriptions(topic).on('data', function(subscription) {\r\n  console.log(subscription);\r\n});\r\n\r\n// Single response object.\r\npublisher.listTopicSubscriptions(topic, function(err, response) {\r\n  console.log(response);\r\n});\r\n\r\n// Same, explicitly suppress it with the optional parameters.\r\npublisher.listTopicSubscriptions(topic, {flattenPages: false}, function(err, response) {\r\n   ... // same\r\n});\r\n\r\n// Other usage of optional parameters.\r\npublisher.listTopicSubscriptions(topic, {pageSize: 10, flattenPages: false}, function(err, response) {\r\n   ... // same\r\n});\r\n```\r\n\r\nDoes this look good?  If so I'm gonna make a series of PRs."}}
{"actor":{"display_login":"jmuk"}}