5 // Created by Marcus Rohrmoser on 21.02.20.
6 // Copyright © 2020-2022 Marcus Rohrmoser mobile Software http://mro.name/me. All rights reserved.
8 // This program is free software: you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation, either version 3 of the License, or
11 // (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program. If not, see <http://www.gnu.org/licenses/>.
24 /** Contact to a Microblog Server
28 let credential : URLCredential? // optional additional HTTP Basic
30 let timeout : TimeInterval
31 let privateDefault : Bool
32 let timezone : TimeZone?
33 let tagsDefault : String
35 var endpointAnon : URL {
36 guard var uc = URLComponents(url:endpoint, resolvingAgainstBaseURL:true)
37 else {return URLEmpty}
40 return uc.url ?? URLEmpty
44 internal let timeoutMinimumValue : TimeInterval = 0.2
45 internal let timeoutMaximumValue : TimeInterval = 15.0
46 internal let timeoutDefaultValue : TimeInterval = 4.0
48 internal func timeoutFromDouble(_ raw : Double) -> TimeInterval {
51 : raw <= timeoutMinimumValue
53 : raw >= timeoutMaximumValue