Last active
February 12, 2025 06:47
-
-
Save KhayalSuleymani/7a95a8ab97a1cb396832f7b92ca13d2b 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
import Foundation | |
public protocol HomeNetworkServiceDelegate: NetworkServiceDelegate { | |
@discardableResult func requestUser(_ completion: @escaping Completion<UserEntity>) -> Self | |
@discardableResult func requestAccounts(id: String, _ completion: @escaping Completion<[AccountEntity]>) -> Self | |
@discardableResult func requestCards(id: String, _ completion: @escaping Completion<[CardEntity]>) -> Self | |
@discardableResult func requestOperations(id: String, _ completion: @escaping Completion<[OperationEntity]>) -> Self | |
@discardableResult func requestTemplates(id: String, _ completion: @escaping Completion<[TemplateEntity]>) -> Self | |
} | |
public class HomeNetworkService: NetworkService, HomeNetworkServiceDelegate { | |
public typealias EndPoint = HomeEndPoints | |
@discardableResult public func requestUser(_ completion: @escaping Completion<UserEntity>) -> Self { | |
manager.requestREST(endPoint: EndPoint.user, completion: completion) | |
return self | |
} | |
@discardableResult public func requestAccounts(id: String, _ completion: @escaping Completion<[AccountEntity]>) -> Self { | |
manager.requestXML(endPoint: EndPoint.accounts(id: id), completion: completion) | |
return self | |
} | |
@discardableResult public func requestCards(id: String, _ completion: @escaping Completion<[CardEntity]>) -> Self { | |
manager.requestSOAP(endPoint: EndPoint.cards(id: id), completion: completion) | |
return self | |
} | |
@discardableResult public func requestTemplates(id: String, _ completion: @escaping Completion<[TemplateEntity]>) -> Self { | |
manager.requestREST(endPoint: EndPoint.templates(id: id), completion: completion) | |
return self | |
} | |
@discardableResult public func requestOperations(id: String, _ completion: @escaping Completion<[OperationEntity]>) -> Self { | |
manager.requestREST(endPoint: EndPoint.operations(id: id), completion: completion) | |
return self | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment