-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathServiceFacade.swift
43 lines (34 loc) · 1.1 KB
/
ServiceFacade.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//
// ServiceFacade.swift
// em3anos
//
// Created by Victor Franca on 30/08/18.
// Copyright © 2018 Victor Franca. All rights reserved.
//
import Foundation
class ServiceFacade{
var servicePath: String
init(servicePath: String){
self.servicePath = servicePath
}
func login(usuario: Usuario, _ completion: @escaping (inout String) -> Void){
HttpPostService.init(servicePath: "auth/login").invoke(usuario){token in
completion(&token)
}
}
func save(dto: DTO, _ completion: @escaping (inout String) -> Void){
HttpPostService.init(servicePath: servicePath).invoke(dto){token in
completion(&token)
}
}
func remove(uid: String, _ completion: @escaping (inout String) -> Void){
HttpDeleteService.init(servicePath: servicePath + uid).invoke(uid){token in
completion(&token)
}
}
func find(_ completion: @escaping (inout String) -> Void){
HttpGetService.init(servicePath: servicePath).invoke(){token in
completion(&token)
}
}
}