Created
May 3, 2017 15:06
-
-
Save popochess/ccebbe9a1a8d5bf8612f067f5bee3648 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
// | |
// Endpoint.swift | |
// | |
// Created by ben | |
// Copyright © 2017年 popochess. All rights reserved. | |
// | |
import UIKit | |
import Alamofire | |
class Endpoint: NSObject { | |
public static let baseURL: String = "https://www.xxxx.com" | |
public enum Api { | |
case GetItemList(String) | |
public var method: HTTPMethod { | |
switch self { | |
case .GetItemList(let type): | |
return .get | |
} | |
} | |
public var path: String { | |
switch self { | |
case .GetItemList(let type): | |
return "\(baseURL)/item/list" | |
} | |
} | |
public var parameters: [String : AnyObject]? { | |
var parameters :[String: AnyObject]? = nil | |
switch self { | |
case .GetItemList(let type): | |
parameters = ["id": type as AnyObject] | |
break | |
} | |
return parameters | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment