Last active
October 17, 2016 16:37
-
-
Save s4cha/3fb0d867a556120589a5f16ef076b293 to your computer and use it in GitHub Desktop.
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 ws | |
import then // Needed to import Promise Type | |
import Arrow // Needed to import JSON Type | |
let api = Api() // Define global api | |
struct Api { | |
// Connect to the base URL | |
private let ws = WS("http://jsonplaceholder.typicode.com") | |
// Declare your route and what you want back, here some JSON | |
func getUsers() -> Promise<JSON> { | |
return ws.get("/users") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment