AMIVApiEvents.swift 1.01 KB
Newer Older
domenicw's avatar
domenicw committed
1
//
2
//  AMIVApiEvents.swift
domenicw's avatar
domenicw committed
3
4
5
6
7
8
9
10
//  Amiv
//
//  Created by Domenic Wüthrich on 23.09.18.
//  Copyright © 2018 Amiv an der ETH. All rights reserved.
//

import Foundation

11
public enum AMIVApiEvents {
domenicw's avatar
domenicw committed
12
13
    
    case events
domenicw's avatar
domenicw committed
14
    case media(_ path: String)
domenicw's avatar
domenicw committed
15
16
17
    
}

18
extension AMIVApiEvents: EndPointType {
domenicw's avatar
domenicw committed
19
20
21
22
    
    public var path: String {
        switch self {
        case .events:
domenicw's avatar
domenicw committed
23
24
25
            return "/events"
        case .media(let path):
            return path
domenicw's avatar
domenicw committed
26
27
28
29
30
        }
    }
    
    public var httpMethod: HTTPMethod {
        switch self {
domenicw's avatar
domenicw committed
31
        case .events, .media:
domenicw's avatar
domenicw committed
32
33
34
35
36
37
            return .get
        }
    }
    
    public var task: HTTPTask {
        switch self {
domenicw's avatar
domenicw committed
38
        case .events, .media:
domenicw's avatar
domenicw committed
39
40
41
42
43
44
            return .request
        }
    }
    
    public var headers: HTTPHeaders? {
        switch self {
domenicw's avatar
domenicw committed
45
        case .events, .media:
domenicw's avatar
domenicw committed
46
47
48
49
            return nil
        }
    }
    
50
51
    public var isAuthenticationRequired: Bool {
        switch self {
domenicw's avatar
domenicw committed
52
        case .events, .media:
53
54
55
56
            return false
        }
    }
    
domenicw's avatar
domenicw committed
57
}