Skip to content

Instantly share code, notes, and snippets.

@popochess
Created May 3, 2017 15:06
Show Gist options
  • Save popochess/ccebbe9a1a8d5bf8612f067f5bee3648 to your computer and use it in GitHub Desktop.
Save popochess/ccebbe9a1a8d5bf8612f067f5bee3648 to your computer and use it in GitHub Desktop.
//
// 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