-
Notifications
You must be signed in to change notification settings - Fork 4
/
AppRemoteAPIConst.swift
137 lines (114 loc) · 4.58 KB
/
AppRemoteAPIConst.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
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
137
//
// AppRemoteAPIConst.swift
// FoodAnytime
//
// Created by Pushan Mitra on 21/09/18.
// Copyright © 2018 Pushan Mitra. All rights reserved.
//
import Foundation
/**
* Remote/Local URL
*/
let DEV_URL: String = "https://api-dev-invasivesbc.apps.silver.devops.gov.bc.ca/api"
let LOCAL_URL: String = "http://localhost:7070/api"
let TEST_URL: String = "https://api-test-invasivesbc.apps.silver.devops.gov.bc.ca/api"
let PROD_URL: String = "https://api-invasivesbc.apps.silver.devops.gov.bc.ca/api"
/**
* KeyCloak URL
*/
let KC_DEV_URL: String = "https://dev.loginproxy.gov.bc.ca"
let KC_TEST_URL: String = "https://test.loginproxy.gov.bc.ca"
let KC_PROD_URL: String = "https://loginproxy.gov.bc.ca"
enum RemoteEnv: String {
case local, dev, test, prod
var remoteURL: String {
switch self {
case .local:
return LOCAL_URL
case .dev:
return DEV_URL
case .test:
return TEST_URL
case .prod:
return PROD_URL
}
}
var keyCloakURL: String {
switch self {
case .local,.dev:
return KC_DEV_URL
case .test:
return KC_TEST_URL
case .prod:
return KC_PROD_URL
}
}
}
class RemoteURLManager {
var env: RemoteEnv = .dev
static var `default` = {
// Here We Can use Target Flag to customize
// Switch Env
return RemoteURLManager(.dev)
}()
init(_ env: RemoteEnv) {
self.env = env
}
var remoteURL: String {
return self.env.remoteURL
}
var keyCloakURL: URL {
return URL(string: self.env.keyCloakURL)!
}
}
/**
* Diffirent EndPoints
*/
enum EndPoints: String {
case none = ""
case workflow = "/mussels/workflow"
case watercraftAssessment = "/mussels/wra"
case waterBody = "/mussels/water-body"
case codes = "/mussels/codes"
case accessRequest = "/request-access"
case user = "/account/me"
case uploads = "/uploads/report-issue"
case majorCities = "/mussels/major-cities"
case blowBys = "/mussels/blow-bys"
}
/**
* API
*/
struct APIURL {
static var baseURL: String = RemoteURLManager.default.remoteURL
static let workflow: String = {
return Self.baseURL + EndPoints.workflow.rawValue
}()
static let watercraftRiskAssessment: String = {
return Self.baseURL + EndPoints.watercraftAssessment.rawValue
}()
static let waterBody: String = {
return Self.baseURL + EndPoints.waterBody.rawValue
}()
static let majorCities: String = {
return Self.baseURL + EndPoints.majorCities.rawValue
}()
static let codes: String = {
return Self.baseURL + EndPoints.codes.rawValue
}()
static let assessRequest: String = {
return Self.baseURL + EndPoints.accessRequest.rawValue
}()
static let user: String = {
return Self.baseURL + EndPoints.user.rawValue
}()
static let uploads: String = {
return Self.baseURL + EndPoints.uploads.rawValue
}()
static let blowBys: String = {
return Self.baseURL + EndPoints.blowBys.rawValue
}()
}
let TestToken: String = """
eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJRMFJ5N2UxUmhmRkxMTWFsS0trdmg4dGJqdTZyemJzNTliZVhLWUlzUkxvIn0.eyJqdGkiOiIzZDQxMDRlOC1lMjRiLTRlZDQtYmNjMS1kZjk5MjFiMDI0MWMiLCJleHAiOjE1ODE2MjA3MTYsIm5iZiI6MCwiaWF0IjoxNTgxNjIwNDE2LCJpc3MiOiJodHRwczovL3Nzby1kZXYucGF0aGZpbmRlci5nb3YuYmMuY2EvYXV0aC9yZWFsbXMvZGZtbGNnN3oiLCJhdWQiOiJhY2NvdW50Iiwic3ViIjoiOTMxZjYyNWItMjU3MS00NGQ0LWI5ZDEtOTM0ODgwNzQ4OGU4IiwidHlwIjoiQm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