You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.1 KiB

6 years ago
6 years ago
  1. //
  2. // BaseApi.swift
  3. // GMERemittance
  4. //
  5. // Created by gme_2 on 22/08/2018.
  6. // Copyright © 2018 Gobal Money Express Co. Ltd. All rights reserved.
  7. //
  8. import Foundation
  9. protocol ApiServiceType {
  10. var auth: RestApiMananger {get}
  11. var baseUrl: String {get}
  12. }
  13. extension ApiServiceType {
  14. var auth: RestApiMananger {return RestApiMananger.sharedInstance}
  15. var baseUrl: String {return UrlManager.sharedInstance.baseURL}
  16. }
  17. // repeated things in api
  18. //
  19. //if (response.errorCode ?? "") == "1" {
  20. // let error = NSError.init(domain: "Network", code: 0, userInfo: [NSLocalizedDescriptionKey : response.message ?? ""])
  21. // failure(error)
  22. //}else {
  23. // let model = response.data
  24. // success(model)
  25. //}
  26. //class UserContainer: Mappable {
  27. // var errorCode: String?
  28. // var message: String?
  29. // var id: String?
  30. // var data: User?
  31. //
  32. // required init?(map: Map) {
  33. //
  34. // }
  35. //
  36. // func mapping(map: Map) {
  37. // errorCode <- map["ErrorCode"]
  38. // message <- map["Msg"]
  39. // id <- map["Id"]
  40. // data <- map["Data"]
  41. // }
  42. //}