-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathServerConstants.swift
More file actions
136 lines (100 loc) · 2.82 KB
/
Copy pathServerConstants.swift
File metadata and controls
136 lines (100 loc) · 2.82 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
//
// ServerConstants.swift
// Requestum
//
// Created by Alex Kovalov on 3/28/18.
// Copyright © 2018 Requestum. All rights reserved.
//
import UIKit
enum ServerAPI {
enum Environment: String {
case development
case production
}
// MARK: - Auth
case authToken
case signUp
case convertToken
case user
case changePassword
case forgotPassword
// MARK: - Event
case events
case eventsDetails(eventId: String)
case eventsTweets(eventId: String)
case getGooglePlaceApiKey
var path: String {
switch self {
case .authToken:
return "auth/token"
case .signUp:
return "accounts/register"
case .convertToken:
return "auth/convert-token"
case .user:
return "accounts/user"
case .changePassword:
return "accounts/change-password"
case .forgotPassword:
return "accounts/forgot-password"
case .events:
return "events"
case .eventsDetails(let eventId):
return "events/" + eventId
default:
return ""
}
}
var fullURL: String {
let baseUrl = ServerAPI.serverAPIUrl
return baseUrl + path + "/"
}
static var environment: Environment {
guard let value = Bundle.main.object(forInfoDictionaryKey: "ServerEnvironment") as? String else {
return .production
}
return Environment(rawValue: value) ?? .production
}
// MARK: - Auth
struct Auth {
static var clientId: String {
switch ServerAPI.environment {
case .development:
return ""
case .production:
return ""
}
}
static var clientSecret: String {
switch ServerAPI.environment {
case .development:
return ""
case .production:
return ""
}
}
static let grantType = "password"
}
static var baseUrl: String {
switch ServerAPI.environment {
case .development:
return ""
case .production:
return ""
}
}
static var baseSoketUrl: URL {
switch ServerAPI.environment {
case .development:
return URL(string: "")!
case .production:
return URL(string: "")!
}
}
static let apiVer = "v1/"
static let serverAPIUrl = baseUrl + "api/" + apiVer
}
struct URLLinks {
static let terms = URL(string: "")!
static let privacy = URL(string: "")!
}