{"action":"created","issue":{"url":"https://api.github.com/repos/zalando-incubator/atlas-ios/issues/251","repository_url":"https://api.github.com/repos/zalando-incubator/atlas-ios","labels_url":"https://api.github.com/repos/zalando-incubator/atlas-ios/issues/251/labels{/name}","comments_url":"https://api.github.com/repos/zalando-incubator/atlas-ios/issues/251/comments","events_url":"https://api.github.com/repos/zalando-incubator/atlas-ios/issues/251/events","html_url":"https://github.com/zalando-incubator/atlas-ios/pull/251","id":176874805,"number":251,"title":"#39: Added parsing JSON array of models","user":{"login":"bonkey","id":39100,"avatar_url":"https://avatars.githubusercontent.com/u/39100?v=3","gravatar_id":"","url":"https://api.github.com/users/bonkey","html_url":"https://github.com/bonkey","followers_url":"https://api.github.com/users/bonkey/followers","following_url":"https://api.github.com/users/bonkey/following{/other_user}","gists_url":"https://api.github.com/users/bonkey/gists{/gist_id}","starred_url":"https://api.github.com/users/bonkey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bonkey/subscriptions","organizations_url":"https://api.github.com/users/bonkey/orgs","repos_url":"https://api.github.com/users/bonkey/repos","events_url":"https://api.github.com/users/bonkey/events{/privacy}","received_events_url":"https://api.github.com/users/bonkey/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"bonkey","id":39100,"avatar_url":"https://avatars.githubusercontent.com/u/39100?v=3","gravatar_id":"","url":"https://api.github.com/users/bonkey","html_url":"https://github.com/bonkey","followers_url":"https://api.github.com/users/bonkey/followers","following_url":"https://api.github.com/users/bonkey/following{/other_user}","gists_url":"https://api.github.com/users/bonkey/gists{/gist_id}","starred_url":"https://api.github.com/users/bonkey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bonkey/subscriptions","organizations_url":"https://api.github.com/users/bonkey/orgs","repos_url":"https://api.github.com/users/bonkey/repos","events_url":"https://api.github.com/users/bonkey/events{/privacy}","received_events_url":"https://api.github.com/users/bonkey/received_events","type":"User","site_admin":false},"assignees":[{"login":"bonkey","id":39100,"avatar_url":"https://avatars.githubusercontent.com/u/39100?v=3","gravatar_id":"","url":"https://api.github.com/users/bonkey","html_url":"https://github.com/bonkey","followers_url":"https://api.github.com/users/bonkey/followers","following_url":"https://api.github.com/users/bonkey/following{/other_user}","gists_url":"https://api.github.com/users/bonkey/gists{/gist_id}","starred_url":"https://api.github.com/users/bonkey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bonkey/subscriptions","organizations_url":"https://api.github.com/users/bonkey/orgs","repos_url":"https://api.github.com/users/bonkey/repos","events_url":"https://api.github.com/users/bonkey/events{/privacy}","received_events_url":"https://api.github.com/users/bonkey/received_events","type":"User","site_admin":false}],"milestone":null,"comments":2,"created_at":"2016-09-14T10:46:32Z","updated_at":"2016-09-14T11:30:08Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/zalando-incubator/atlas-ios/pulls/251","html_url":"https://github.com/zalando-incubator/atlas-ios/pull/251","diff_url":"https://github.com/zalando-incubator/atlas-ios/pull/251.diff","patch_url":"https://github.com/zalando-incubator/atlas-ios/pull/251.patch"},"body":"- Addtional fetch with [Model] argument\r\n- Removed AddressList"},"comment":{"url":"https://api.github.com/repos/zalando-incubator/atlas-ios/issues/comments/246984216","html_url":"https://github.com/zalando-incubator/atlas-ios/pull/251#issuecomment-246984216","issue_url":"https://api.github.com/repos/zalando-incubator/atlas-ios/issues/251","id":246984216,"user":{"login":"hani-ibrahim","id":5626418,"avatar_url":"https://avatars.githubusercontent.com/u/5626418?v=3","gravatar_id":"","url":"https://api.github.com/users/hani-ibrahim","html_url":"https://github.com/hani-ibrahim","followers_url":"https://api.github.com/users/hani-ibrahim/followers","following_url":"https://api.github.com/users/hani-ibrahim/following{/other_user}","gists_url":"https://api.github.com/users/hani-ibrahim/gists{/gist_id}","starred_url":"https://api.github.com/users/hani-ibrahim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hani-ibrahim/subscriptions","organizations_url":"https://api.github.com/users/hani-ibrahim/orgs","repos_url":"https://api.github.com/users/hani-ibrahim/repos","events_url":"https://api.github.com/users/hani-ibrahim/events{/privacy}","received_events_url":"https://api.github.com/users/hani-ibrahim/received_events","type":"User","site_admin":false},"created_at":"2016-09-14T11:30:08Z","updated_at":"2016-09-14T11:30:08Z","body":"this is what I thought of \r\n```\r\nfunc fetch<Model: JSONInitializable>(from endpoint: Endpoint,\r\n           modelCompletion: (AtlasResult<Model> -> Void)? = nil,\r\n           arrayCompletion: (AtlasResult<[Model]> -> Void)? = nil) {\r\n\r\n    self.requestBuilders.createBuilder(forEndpoint: endpoint, urlSession: urlSession).execute { result in\r\n        switch result {\r\n        case .failure(let error):\r\n            modelCompletion?(.failure(error))\r\n            arrayCompletion?(.failure(error))\r\n        case .success(let response):\r\n            if let model = Model(json: response.body) {\r\n                modelCompletion?(.success(model))\r\n            } else if let jsons = response.body.array.flatMap({ $0 }) {\r\n                let models = jsons.flatMap { Model(json: $0) }\r\n                arrayCompletion?(.success(models))\r\n            } else {\r\n                modelCompletion?(.failure(AtlasAPIError.invalidResponseFormat))\r\n                arrayCompletion?(.failure(AtlasAPIError.invalidResponseFormat))\r\n            }\r\n        }\r\n    }\r\n}\r\n```\r\nwhich I know is not good 😆 "}}
{"actor":{"display_login":"hani-ibrahim"}}