{"action":"created","issue":{"url":"https://api.github.com/repos/nylas/nylas-nodejs/issues/7","labels_url":"https://api.github.com/repos/nylas/nylas-nodejs/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/nylas/nylas-nodejs/issues/7/comments","events_url":"https://api.github.com/repos/nylas/nylas-nodejs/issues/7/events","html_url":"https://github.com/nylas/nylas-nodejs/pull/7","id":91115747,"number":7,"title":"Add delta streaming API support","user":{"login":"ericyhwang","id":6915076,"avatar_url":"https://avatars.githubusercontent.com/u/6915076?v=3","gravatar_id":"","url":"https://api.github.com/users/ericyhwang","html_url":"https://github.com/ericyhwang","followers_url":"https://api.github.com/users/ericyhwang/followers","following_url":"https://api.github.com/users/ericyhwang/following{/other_user}","gists_url":"https://api.github.com/users/ericyhwang/gists{/gist_id}","starred_url":"https://api.github.com/users/ericyhwang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericyhwang/subscriptions","organizations_url":"https://api.github.com/users/ericyhwang/orgs","repos_url":"https://api.github.com/users/ericyhwang/repos","events_url":"https://api.github.com/users/ericyhwang/events{/privacy}","received_events_url":"https://api.github.com/users/ericyhwang/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-06-26T00:49:33Z","updated_at":"2015-06-29T21:53:50Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/nylas/nylas-nodejs/pulls/7","html_url":"https://github.com/nylas/nylas-nodejs/pull/7","diff_url":"https://github.com/nylas/nylas-nodejs/pull/7.diff","patch_url":"https://github.com/nylas/nylas-nodejs/pull/7.patch"},"body":"@bengotow \r\n\r\n- New `namespace.delta` to expose delta API\r\n  - `namespace.delta.generateCursor(timestampMs, [callback])` to get a Nylas delta cursor from a C-like timestamp\r\n  - `namespace.delta.startStream(cursor, excludeTypes = [])` to initiate a delta streaming API connection. It returns a `DeltaStream` which emits `response`, `delta`, and `error` events.\r\n- Jasmine tests for delta streaming, covering:\r\n  - Starting and closing a stream\r\n  - Parsing the streaming response into JSON objects\r\n  - Handling JSON objects broken into multiple data packets\r\n  - Automatically restarting the connection after a timeout not receiving any data (normally the Nylas server sends a heartbeat every second on the streaming connection)\r\n- NylasConnection updates\r\n  - NylasConnection now clones the passed-in options and adds the standard Nylas options on the clone, instead of modifying the original passed-in object in-place.\r\n  - Moved said option-modification to new `NylasConnection.requestOptions(opts)` method to build an option object suitable for passing to `request`.\r\n"},"comment":{"url":"https://api.github.com/repos/nylas/nylas-nodejs/issues/comments/116858481","html_url":"https://github.com/nylas/nylas-nodejs/pull/7#issuecomment-116858481","issue_url":"https://api.github.com/repos/nylas/nylas-nodejs/issues/7","id":116858481,"user":{"login":"bengotow","id":1037212,"avatar_url":"https://avatars.githubusercontent.com/u/1037212?v=3","gravatar_id":"","url":"https://api.github.com/users/bengotow","html_url":"https://github.com/bengotow","followers_url":"https://api.github.com/users/bengotow/followers","following_url":"https://api.github.com/users/bengotow/following{/other_user}","gists_url":"https://api.github.com/users/bengotow/gists{/gist_id}","starred_url":"https://api.github.com/users/bengotow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bengotow/subscriptions","organizations_url":"https://api.github.com/users/bengotow/orgs","repos_url":"https://api.github.com/users/bengotow/repos","events_url":"https://api.github.com/users/bengotow/events{/privacy}","received_events_url":"https://api.github.com/users/bengotow/received_events","type":"User","site_admin":false},"created_at":"2015-06-29T21:53:50Z","updated_at":"2015-06-29T21:53:50Z","body":"Hey Eric—this looks great. Thanks for writing the exponential backoff logic into the `DeltaStream`. The tests look great as well. If you haven't already, can you sign the contributor license agreement (https://nylas.com/cla)? Then we can get this merged!\r\n\r\nI think it'd be great to get a few examples in the README but it sounds like you're on top of that.\r\n\r\nOne minor nit: could we change the `delta` object to be `deltas`?\r\n\r\n```\r\nnamespace.deltas.generateCursor(timestamp)\r\nnamespace.deltas.startStream(cursor, excludeTypes = [])\r\n```\r\n\r\nI think that'd make it match the work going on in our other SDKs a bit better."}}