{"id":11365,"date":"2015-05-29T10:09:51","date_gmt":"2015-05-29T14:09:51","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=11365"},"modified":"2015-05-29T10:10:26","modified_gmt":"2015-05-29T14:10:26","slug":"network-request-templating","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2015\/05\/29\/network-request-templating\/","title":{"rendered":"Network Request Templating"},"content":{"rendered":"<p><a href=\"http:\/\/khanlou.com\/2015\/05\/templating\/\">Soroush Khanlou<\/a>:<\/p>\n<blockquote cite=\"http:\/\/khanlou.com\/2015\/05\/templating\/\">\n<p>This way, all the logic tied to a particular endpoint is located in one class, and any class using it gets fully baked objects in their completion block.<\/p>\n<p>[&#8230;]<\/p>\n<p>One of the big benefits to separating request building and response handling into their own objects is that users can inject whatever request builder they want. If their data comes back in MessagePack format, you can bring your own response handler when needed. The <code>NSURLSession<\/code> could also easily be injected.<\/p>\n<\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Soroush Khanlou: This way, all the logic tied to a particular endpoint is located in one class, and any class using it gets fully baked objects in their completion block. [&#8230;] One of the big benefits to separating request building and response handling into their own objects is that users can inject whatever request builder [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"","apple_news_api_id":"","apple_news_api_modified_at":"","apple_news_api_revision":"","apple_news_api_share_url":"","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[69,27,830,31,507,30,476,54,71],"class_list":["post-11365","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-cocoa","tag-craft","tag-dependency-injection","tag-ios","tag-json","tag-mac","tag-networking","tag-objective-c","tag-programming"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/11365","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=11365"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/11365\/revisions"}],"predecessor-version":[{"id":11366,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/11365\/revisions\/11366"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=11365"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=11365"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=11365"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}