This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let user = User() | |
| user.id = "233" | |
| APICaller.sharedInstance.performCallToEndpoint("/users", using: "POST", | |
| body: user, responseType:User.self) { (error, serverError, response) -> () in | |
| if let response = response { | |
| print(response) | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class User : Transmittable { | |
| var id:String? | |
| } | |
| // Turning a user into JSON data | |
| let user = User() | |
| user.id = "123" | |
| let data = user.encode() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Foundation | |
| final class APICaller { | |
| private let baseUrl:String = "http://localhost:8080/" | |
| static let sharedInstance = APICaller() | |
| private init() {} | |
| func performCallToEndpoint<T : Transmittable>(_ endpoint:String, using method:String, body:Transmittable?, responseType: T.Type, completion: @escaping (_ error:Error?, _ serverError:ServerError?, _ response:T?) -> Void) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Foundation | |
| protocol Transmittable : Codable { | |
| } | |
| extension Transmittable { | |
| func encode() -> Data { | |
| var data:Data = Data() | |
| try? data = JSONEncoder().encode(self) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module.exports = function(app, express) { | |
| var router = express.Router(); // get an instance of the express Router | |
| // middleware to use for all requests | |
| router.use(function(req, res, next) { | |
| console.log('Incoming request'); | |
| console.log('Body:'); | |
| console.log(req.body); | |
| console.log('Url:'); | |
| console.log(req.url); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Valid and working as of 04/21/2014 | |
| # Xcode 5.0.1, XCode Server | |
| # | |
| #Settings | |
| API_TOKEN="This can be found here: https://rink.hockeyapp.net/manage/auth_tokens" | |
| DISTRIBUTION_LISTS="This is a comma seperated list of tags found under App -> Users -> " | |
| PROVISIONING_PROFILE="You will have to manually copy your profile to /Library/Server/Xcode/Data/ProvisioningProfiles/<profile>.mobileprovision" | |
| #EXAMPLE:"/Library/Server/Xcode/Data/ProvisioningProfiles/DocLink_InHouse_2013.mobileprovision" | |
| NOTIFY="1" |
NewerOlder