|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
/** |
|
6
|
|
|
* @copyright 2020 Christoph Wurst <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* @author 2020 Christoph Wurst <[email protected]> |
|
9
|
|
|
* |
|
10
|
|
|
* @license GNU AGPL version 3 or any later version |
|
11
|
|
|
* |
|
12
|
|
|
* This program is free software: you can redistribute it and/or modify |
|
13
|
|
|
* it under the terms of the GNU Affero General Public License as |
|
14
|
|
|
* published by the Free Software Foundation, either version 3 of the |
|
15
|
|
|
* License, or (at your option) any later version. |
|
16
|
|
|
* |
|
17
|
|
|
* This program is distributed in the hope that it will be useful, |
|
18
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20
|
|
|
* GNU Affero General Public License for more details. |
|
21
|
|
|
* |
|
22
|
|
|
* You should have received a copy of the GNU Affero General Public License |
|
23
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
24
|
|
|
*/ |
|
25
|
|
|
|
|
26
|
|
|
namespace OCP\Contacts\Events; |
|
27
|
|
|
|
|
28
|
|
|
use OCP\EventDispatcher\Event; |
|
29
|
|
|
use OCP\IUser; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* An event that allows apps to notify other components about an interaction |
|
33
|
|
|
* between two users. This can be used to build better recommendations and |
|
34
|
|
|
* suggestions in user interfaces. |
|
35
|
|
|
* |
|
36
|
|
|
* Emitters should add at least one identifier (uid, email, federated cloud ID) |
|
37
|
|
|
* of the recipient of the interaction. |
|
38
|
|
|
* |
|
39
|
|
|
* @since 19.0.0 |
|
40
|
|
|
*/ |
|
41
|
|
|
class ContactInteractedWithEvent extends Event { |
|
42
|
|
|
|
|
43
|
|
|
/** @var IUser */ |
|
44
|
|
|
private $actor; |
|
45
|
|
|
|
|
46
|
|
|
/** @var string|null */ |
|
47
|
|
|
private $uid; |
|
48
|
|
|
|
|
49
|
|
|
/** @var string|null */ |
|
50
|
|
|
private $email; |
|
51
|
|
|
|
|
52
|
|
|
/** @var string|null */ |
|
53
|
|
|
private $federatedCloudId; |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* @param IUser $actor the user who started the interaction |
|
57
|
|
|
* |
|
58
|
|
|
* @since 19.0.0 |
|
59
|
|
|
*/ |
|
60
|
|
|
public function __construct(IUser $actor) { |
|
61
|
|
|
parent::__construct(); |
|
62
|
|
|
$this->actor = $actor; |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* @return IUser |
|
67
|
|
|
* @since 19.0.0 |
|
68
|
|
|
*/ |
|
69
|
|
|
public function getActor(): IUser { |
|
70
|
|
|
return $this->actor; |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* @return string|null |
|
75
|
|
|
* @since 19.0.0 |
|
76
|
|
|
*/ |
|
77
|
|
|
public function getUid(): ?string { |
|
78
|
|
|
return $this->uid; |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
/** |
|
82
|
|
|
* Set the uid of the person interacted with, if known |
|
83
|
|
|
* |
|
84
|
|
|
* @param string $uid |
|
85
|
|
|
* |
|
86
|
|
|
* @return self |
|
87
|
|
|
* @since 19.0.0 |
|
88
|
|
|
*/ |
|
89
|
|
|
public function setUid(string $uid): self { |
|
90
|
|
|
$this->uid = $uid; |
|
91
|
|
|
return $this; |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
/** |
|
95
|
|
|
* @return string|null |
|
96
|
|
|
* @since 19.0.0 |
|
97
|
|
|
*/ |
|
98
|
|
|
public function getEmail(): ?string { |
|
99
|
|
|
return $this->email; |
|
100
|
|
|
} |
|
101
|
|
|
|
|
102
|
|
|
/** |
|
103
|
|
|
* Set the email of the person interacted with, if known |
|
104
|
|
|
* |
|
105
|
|
|
* @param string $email |
|
106
|
|
|
* |
|
107
|
|
|
* @return self |
|
108
|
|
|
* @since 19.0.0 |
|
109
|
|
|
*/ |
|
110
|
|
|
public function setEmail(string $email): self { |
|
111
|
|
|
$this->email = $email; |
|
112
|
|
|
return $this; |
|
113
|
|
|
} |
|
114
|
|
|
|
|
115
|
|
|
/** |
|
116
|
|
|
* @return string|null |
|
117
|
|
|
* @since 19.0.0 |
|
118
|
|
|
*/ |
|
119
|
|
|
public function getFederatedCloudId(): ?string { |
|
120
|
|
|
return $this->federatedCloudId; |
|
121
|
|
|
} |
|
122
|
|
|
|
|
123
|
|
|
/** |
|
124
|
|
|
* Set the federated cloud of the person interacted with, if known |
|
125
|
|
|
* |
|
126
|
|
|
* @param string $federatedCloudId |
|
127
|
|
|
* |
|
128
|
|
|
* @return self |
|
129
|
|
|
* @since 19.0.0 |
|
130
|
|
|
*/ |
|
131
|
|
|
public function setFederatedCloudId(string $federatedCloudId): self { |
|
132
|
|
|
$this->federatedCloudId = $federatedCloudId; |
|
133
|
|
|
return $this; |
|
134
|
|
|
} |
|
135
|
|
|
|
|
136
|
|
|
} |
|
137
|
|
|
|