Skip to content

Instantly share code, notes, and snippets.

{
"interval_data": {
"Ascending": [
{
"root":"A2",
"m2": "Bb2",
"M2": "B2",
"m3": "C3",
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")
POST /api/register
Register a user or login an existing user. Send along `email` and `password`. A new user won't be created if a user already has that email. You'll get back an `api_token` to use for requests that need authorization.
POST /api/stripe_token
For Stripe SDK to get the token it needs to approve a charge. Send along `stripe_version` and get back the JSON for the key or an error.
GET /api/venues
struct Venue: Codable, Equatable {
static func ==(lhs: Venue, rhs: Venue) -> Bool {
return
lhs.longitude == rhs.longitude &&
lhs.latitude == rhs.latitude &&
lhs.id == rhs.id &&
lhs.tax_rate == rhs.tax_rate &&
lhs.name == rhs.name &&
struct Venue: Codable, Equatable {
static func ==(lhs: Venue, rhs: Venue) -> Bool {
return
lhs.longitude == rhs.longitude &&
lhs.latitude == rhs.latitude &&
lhs.venue_id == rhs.venue_id &&
lhs.venue_tax_rate == rhs.venue_tax_rate &&
lhs.name == rhs.name &&
@projectxcappe
projectxcappe / API_Doc.swift
Last active June 28, 2018 16:52
API_Doc.swift
//Login
Login {
let email: String
let fb_id: String //when fb is implemented
let password: String
let password_reset_code: String
let phone_number: String
let user_id: String
}
struct PlacesData: Codable {
let data: [Place]
// let msg: String
// let status: Int
// let statuscode: Int
}
struct Place: Codable, Equatable {
static func ==(lhs: Place, rhs: Place) -> Bool {
return
struct PlacesData: Codable {
let data: [Place]
let msg: String
let status: Int
let statuscode: Int
}
struct VenueListData: Codable {
let data: [VenueList]
let msg: String
let status: Int
let statuscode: Int
}
struct VenueList: Codable {
let venue_id: String
let place_id: String
class func getHomeScreenPlaceList(completion: @escaping ((Result<VenueData>) -> Void)) {
guard let url = URL(string: "\(URL_STRING)/places") else { return }
let defaults = UserDefaults.standard
let token = defaults.object(forKey: "token") as? String
let tokenHeaderString = "Token \(token)"
var request = URLRequest(url: url)
request.httpMethod = "GET"
request.addValue("application/json", forHTTPHeaderField: "Content-Type")