{"action":"created","issue":{"url":"https://api.github.com/repos/Moya/Moya/issues/238","labels_url":"https://api.github.com/repos/Moya/Moya/issues/238/labels{/name}","comments_url":"https://api.github.com/repos/Moya/Moya/issues/238/comments","events_url":"https://api.github.com/repos/Moya/Moya/issues/238/events","html_url":"https://github.com/Moya/Moya/pull/238","id":109474354,"number":238,"title":"Plugins","user":{"login":"aschuch","id":1506193,"avatar_url":"https://avatars.githubusercontent.com/u/1506193?v=3","gravatar_id":"","url":"https://api.github.com/users/aschuch","html_url":"https://github.com/aschuch","followers_url":"https://api.github.com/users/aschuch/followers","following_url":"https://api.github.com/users/aschuch/following{/other_user}","gists_url":"https://api.github.com/users/aschuch/gists{/gist_id}","starred_url":"https://api.github.com/users/aschuch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aschuch/subscriptions","organizations_url":"https://api.github.com/users/aschuch/orgs","repos_url":"https://api.github.com/users/aschuch/repos","events_url":"https://api.github.com/users/aschuch/events{/privacy}","received_events_url":"https://api.github.com/users/aschuch/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Moya/Moya/labels/breaking%20change","name":"breaking change","color":"000000"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-10-02T11:23:31Z","updated_at":"2015-10-03T14:41:46Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/Moya/Moya/pulls/238","html_url":"https://github.com/Moya/Moya/pull/238","diff_url":"https://github.com/Moya/Moya/pull/238.diff","patch_url":"https://github.com/Moya/Moya/pull/238.patch"},"body":"I would like to propose a plugin system for Moya.\r\n`MoyaProvider` can now be initialized with a set of `Plugin`s.  A `Plugin` receives callbacks to perform side effects wherever a request is sent or received.\r\n\r\nFor example, a plugin may be used to\r\n * log network requests\r\n * hide and show a network avtivity indicator\r\n * inject additional information into a request\r\n\r\nThis kind of tackles #144 as well, as the number of additional closures is now much lower and can be initialized with an arbitrary number of plugins\r\n\r\nI have also added plugins for the existing `CredentialClosure` and `NetworkActivityClosure` to make it easy for everyone to adopt this change. Maybe we should also try to build a plugin from the Logger in #235?\r\n\r\nWould love to get some feedback on the idea or how to make this even more generic for everyone to use (I'm not super happy with the subclassing approach). :heart: \r\n\r\n\r\nFixes #144."},"comment":{"url":"https://api.github.com/repos/Moya/Moya/issues/comments/145253974","html_url":"https://github.com/Moya/Moya/pull/238#issuecomment-145253974","issue_url":"https://api.github.com/repos/Moya/Moya/issues/238","id":145253974,"user":{"login":"aschuch","id":1506193,"avatar_url":"https://avatars.githubusercontent.com/u/1506193?v=3","gravatar_id":"","url":"https://api.github.com/users/aschuch","html_url":"https://github.com/aschuch","followers_url":"https://api.github.com/users/aschuch/followers","following_url":"https://api.github.com/users/aschuch/following{/other_user}","gists_url":"https://api.github.com/users/aschuch/gists{/gist_id}","starred_url":"https://api.github.com/users/aschuch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aschuch/subscriptions","organizations_url":"https://api.github.com/users/aschuch/orgs","repos_url":"https://api.github.com/users/aschuch/repos","events_url":"https://api.github.com/users/aschuch/events{/privacy}","received_events_url":"https://api.github.com/users/aschuch/received_events","type":"User","site_admin":false},"created_at":"2015-10-03T14:41:46Z","updated_at":"2015-10-03T14:41:46Z","body":"Any opinions towards keeping the subclass vs. the protocol approach?"}}