42 lines
1.4 KiB
Swift
42 lines
1.4 KiB
Swift
//
|
|
// CommonEnvironment.swift
|
|
//
|
|
//
|
|
// Created by Juraldinio on 04.08.2022.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
public struct CommonEnvironment: NetworkEnvironment {
|
|
|
|
public let configuration: URLSessionConfiguration?
|
|
public let usernames: NetworkStaticAPIRecord
|
|
public let hyperion: NetworkDynamicAPIRecord
|
|
public let backend: NetworkStaticAPIRecord
|
|
public let node: NetworkDynamicAPIRecord
|
|
|
|
public init(usernames: NetworkStaticAPIRecord,
|
|
backend: NetworkStaticAPIRecord,
|
|
hyperion: NetworkDynamicAPIRecord,
|
|
node: NetworkDynamicAPIRecord) {
|
|
self.configuration = nil
|
|
self.usernames = usernames
|
|
self.backend = backend
|
|
self.hyperion = hyperion
|
|
self.node = node
|
|
}
|
|
|
|
public init(usernames: URL,
|
|
backend: URL,
|
|
hyperion: @escaping NetworkDynamicAPIRecord.Dynamic,
|
|
node: @escaping NetworkDynamicAPIRecord.Dynamic,
|
|
headers: [String: String] = [:]) {
|
|
let userRecord = NetworkStaticAPIRecord(url: usernames, headers: headers)
|
|
let backendRecord = NetworkStaticAPIRecord(url: backend, headers: headers)
|
|
let hyperionRecord = NetworkDynamicAPIRecord(url: hyperion, headers: headers)
|
|
let nodeRecord = NetworkDynamicAPIRecord(url: node, headers: headers)
|
|
|
|
self.init(usernames: userRecord, backend: backendRecord, hyperion: hyperionRecord, node: nodeRecord)
|
|
}
|
|
}
|