-
Notifications
You must be signed in to change notification settings - Fork 1
/
PrivacyService.swift
60 lines (48 loc) · 1.24 KB
/
PrivacyService.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
/**
Class that acts as an interface to the web service API.
*/
public class PrivacyService {
/**
These options can be used to configure the behaviour of the service.
*/
public struct Options: OptionSet {
/**
A bit representing a single option.
*/
public let rawValue: Int
/**
Initialize a single option with a given value.
- parameters:
- rawValue: The bit representing the option.
*/
public init(rawValue: Int) {
self.rawValue = rawValue
}
/**
This option activates bad behaviour of the service. Every request
send to a service with activated bad behaviour is logged and
available in the visualization API.
- warning: Do not use this in production system. This is meant for
demonstration purposes only. Every reqeust will be logged on the
server, including the user's IP address.
*/
static let activateBadBehavior = Options(rawValue: 1 << 0)
}
/**
The base URL of the P-Service.
*/
let baseUrl: URL
/**
Options that configure the behaviour of
*/
let options: Options
/**
Initializes a `PrivacyService` instance.
- parameters:
- baseUrl: The base URL of the P-Service.
*/
public init(baseUrl: URL, options: Options = []) {
self.baseUrl = baseUrl
self.options = options
}
}