-
-
Notifications
You must be signed in to change notification settings - Fork 119
/
Copy pathTeam.php
183 lines (166 loc) · 5.25 KB
/
Team.php
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
<?php
/**
* Modified: 2020-05-26T22:12:31+00:00
*/
namespace Office365\Teams;
use Office365\Directory\DirectoryObject;
use Office365\Directory\Users\User;
use Office365\Entity;
use Office365\EntityCollection;
use Office365\Runtime\Actions\InvokePostMethodQuery;
use Office365\Runtime\Http\RequestOptions;
use Office365\Runtime\ResourcePath;
/**
* "A team in Microsoft Teams is a collection of channels. "
*/
class Team extends Entity
{
/**
* A hyperlink that will go to the team in the Microsoft Teams client. This is the URL that you get when you right-click a team in the Microsoft Teams client and select **Get link to team**. This URL should be treated as an opaque blob, and not parsed.
* @return string
*/
public function getWebUrl()
{
return $this->getProperty("WebUrl");
}
/**
* A hyperlink that will go to the team in the Microsoft Teams client. This is the URL that you get when you right-click a team in the Microsoft Teams client and select **Get link to team**. This URL should be treated as an opaque blob, and not parsed.
*
* @return self
* @var string
*/
public function setWebUrl($value)
{
return $this->setProperty("WebUrl", $value, true);
}
/**
* Whether this team is in read-only mode.
* @return bool
*/
public function getIsArchived()
{
return $this->getProperty("IsArchived");
}
/**
* Whether this team is in read-only mode.
*
* @return self
* @var bool
*/
public function setIsArchived($value)
{
return $this->setProperty("IsArchived", $value, true);
}
/**
* Settings to configure whether members can perform certain actions, for example, create channels and add bots, in the team.
* @return TeamMemberSettings
*/
public function getMemberSettings()
{
return $this->getProperty("MemberSettings", new TeamMemberSettings());
}
/**
* Settings to configure whether members can perform certain actions, for example, create channels and add bots, in the team.
*
* @return self
* @var TeamMemberSettings
*/
public function setMemberSettings($value)
{
return $this->setProperty("MemberSettings", $value, true);
}
/**
* Settings to configure whether guests can create, update, or delete channels in the team.
* @return TeamGuestSettings
*/
public function getGuestSettings()
{
return $this->getProperty("GuestSettings", new TeamGuestSettings());
}
/**
* Settings to configure whether guests can create, update, or delete channels in the team.
*
* @return self
* @var TeamGuestSettings
*/
public function setGuestSettings($value)
{
return $this->setProperty("GuestSettings", $value, true);
}
/**
* Settings to configure messaging and mentions in the team.
* @return TeamMessagingSettings
*/
public function getMessagingSettings()
{
return $this->getProperty("MessagingSettings", new TeamMessagingSettings());
}
/**
* Settings to configure messaging and mentions in the team.
*
* @return self
* @var TeamMessagingSettings
*/
public function setMessagingSettings($value)
{
return $this->setProperty("MessagingSettings", $value, true);
}
/**
* Settings to configure use of Giphy, memes, and stickers in the team.
* @return TeamFunSettings
*/
public function getFunSettings()
{
return $this->getProperty("FunSettings", new TeamFunSettings());
}
/**
* Settings to configure use of Giphy, memes, and stickers in the team.
*
* @return self
* @var TeamFunSettings
*/
public function setFunSettings($value)
{
return $this->setProperty("FunSettings", $value, true);
}
/**
* @return EntityCollection
*/
public function getMembers()
{
return $this->getProperty("Members",
new EntityCollection($this->getContext(),
new ResourcePath("Members",$this->getResourcePath()),DirectoryObject::class));
}
/**
* @param User $user
* @param string[] $roles
* @return Entity
*/
public function addMember($user, $roles){
$returnType = new Entity($this->getContext());
$this->getMembers()->addChild($returnType);
$user->ensureProperty("Id",function () use ($user, $returnType, $roles){
$payload = array(
"@odata.type" => "#microsoft.graph.aadUserConversationMember",
"roles" => $roles,
"[email protected]" => "https://graph.microsoft.com/v1.0/users('{$user->getId()}')"
);
$qry = new InvokePostMethodQuery($this->getMembers(),null,null,null,$payload);
$this->getContext()->addQueryAndResultObject($qry, $returnType);
});
return $returnType;
}
/**
* Deletes a Team
* @return self
*/
public function deleteObject()
{
parent::deleteObject();
$this->getContext()->getPendingRequest()->beforeExecuteRequestOnce(function (RequestOptions $request){
$request->Url = str_replace ( "teams" , "groups", $request->Url );
});
return $this;
}
}