{"action":"opened","issue":{"url":"https://api.github.com/repos/yelouafi/redux-saga/issues/267","repository_url":"https://api.github.com/repos/yelouafi/redux-saga","labels_url":"https://api.github.com/repos/yelouafi/redux-saga/issues/267/labels{/name}","comments_url":"https://api.github.com/repos/yelouafi/redux-saga/issues/267/comments","events_url":"https://api.github.com/repos/yelouafi/redux-saga/issues/267/events","html_url":"https://github.com/yelouafi/redux-saga/issues/267","id":149869932,"number":267,"title":"Fluent interfaces / method chaining inside sagas","user":{"login":"braco","id":2449172,"avatar_url":"https://avatars.githubusercontent.com/u/2449172?v=3","gravatar_id":"","url":"https://api.github.com/users/braco","html_url":"https://github.com/braco","followers_url":"https://api.github.com/users/braco/followers","following_url":"https://api.github.com/users/braco/following{/other_user}","gists_url":"https://api.github.com/users/braco/gists{/gist_id}","starred_url":"https://api.github.com/users/braco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/braco/subscriptions","organizations_url":"https://api.github.com/users/braco/orgs","repos_url":"https://api.github.com/users/braco/repos","events_url":"https://api.github.com/users/braco/events{/privacy}","received_events_url":"https://api.github.com/users/braco/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-04-20T19:58:33Z","updated_at":"2016-04-20T19:58:33Z","closed_at":null,"body":"Let's say you have an API interface that supports method chaining:\r\n```\r\nAPI.thing().thing2().thing3().get()\r\n```\r\nWhere each thing() method alters _this_ to setup the eventual request at _get()_.\r\n\r\nget() uses _this_ to configure the network request, and then returns a promise.\r\n\r\nThe problem with this inside of saga, is that call() methods seem to change the binding:\r\n\r\n```\r\nAPI......get()\r\n```\r\n\r\nthe get method will have this === null, which ruins the previous chaining.\r\n\r\nI see that there's apply(context, fn), but that means the chaining would have to look like this:\r\n\r\n```\r\ncontext = API.thing().thing2().thing3()\r\napply(context, context.get)\r\n```\r\n\r\nIs that the only way to accomplish what I'm describing?\r\n"}}