Skip to content

Instantly share code, notes, and snippets.

@FitzAfful
Created April 2, 2020 18:13
Show Gist options
  • Save FitzAfful/ae474d41d9bc79e619961619a2e35566 to your computer and use it in GitHub Desktop.
Save FitzAfful/ae474d41d9bc79e619961619a2e35566 to your computer and use it in GitHub Desktop.
import Foundation
import Alamofire
public class APIManager {
private let manager: Session
init(manager: Session = Session.default) {
self.manager = manager
}
func getEmployees(completion:@escaping (DataResponse<EmployeesResponse, AFError>)->Void) {
manager.request(APIRouter.getEmployees).responseDecodable { (response) in
completion(response)
}
}
func getSingleEmployee(id: String, completion:@escaping (DataResponse<EmployeeResponse, AFError>)->Void) {
manager.request(APIRouter.getSingleEmployee(id: id)).responseDecodable { (response) in
completion(response)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment