Last active
June 28, 2018 16:52
-
-
Save projectxcappe/3428aa421226456b13c260d1435ecc9a to your computer and use it in GitHub Desktop.
This file contains 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
URL_STRING = "https://lineopener2.herokuapp.com/api" | |
///////////////SignUp/////////////// | |
ENDPOINT: "URL_STRING/register" | |
REQUEST: | |
signupRequest(email:String, password:String) | |
let stripe_version = STPSDKVersion | |
request.httpMethod = "POST" | |
request.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type") | |
let data = String(format:"email=%@&password=%@&stripe_version=%@", email, password, stripe_version) | |
request.httpBody = data | |
RESPONSE: | |
struct SignUpData: Decodable { | |
var token: String | |
var email: String? | |
} | |
///////////////Forgot Password/////////////// | |
ENDPOINT: "URL_STRING/register" | |
REQUEST: | |
forgotPasswordRequest(email:String) | |
request.httpMethod = "POST" | |
request.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type") | |
let data = String(format:"email=%d", email) | |
request.httpBody = data | |
RESPONSE: | |
///////////////Get Home Venue Data/////////////// | |
ENDPOINT: "URL_STRING/venues" | |
REQUEST: | |
signupRequest(email:String, password:String) | |
request.httpMethod = "GET" | |
RESPONSE: | |
Result<[Venue]> | |
///////////////Get Places Within Venue/////////////// | |
ENDPOINT: "URL_STRING/places/\(place_id)" | |
REQUEST: | |
getPlacesWithinVenueRequest(place_id:Int) | |
request.httpMethod = "GET" | |
RESPONSE: | |
Result<[Place]> | |
///////////////Get Past Orders/////////////// | |
ENDPOINT: "URL_STRING/order" | |
REQUEST: | |
getPlacesWithinVenueRequest(place_id:Int) | |
request.httpMethod = "GET" | |
request.addValue("Token \(token!)", forHTTPHeaderField: "Authorization") | |
RESPONSE: | |
struct PastOrders: Codable { | |
let completed:[Order] | |
} | |
struct Order: Codable { | |
let code: Int | |
let description: String | |
let id: Int | |
let place: String | |
let price_after_tax: String | |
let created_at: String | |
} | |
///////////////Get Past Orders/////////////// | |
ENDPOINT: "URL_STRING/order" | |
REQUEST: | |
getPlacesWithinVenueRequest(place_id:Int) | |
request.httpMethod = "GET" | |
request.addValue("Token \(token!)", forHTTPHeaderField: "Authorization") | |
RESPONSE: | |
struct PastOrders: Codable { | |
let completed:[Order] | |
} | |
struct Order: Codable { | |
let code: Int | |
let description: String | |
let id: Int | |
let place: String | |
let price_after_tax: String | |
let created_at: String | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment