1+ <?php
2+ namespace Bitrix24 \Sonet ;
3+
4+ use Bitrix24 \Bitrix24Entity ;
5+ use Bitrix24 \Bitrix24Exception ;
6+
7+ class SonetGroup extends Bitrix24Entity
8+ {
9+ /**
10+ * @param $order
11+ * @param $filter
12+ * @link https://dev.1c-bitrix.ru/rest_help/socialnetwork/sonet_group/sonet_group_get.php
13+ * @throws Bitrix24Exception
14+ * @return array
15+ */
16+ public function Get ($ order , $ filter )
17+ {
18+ $ result = $ this ->client ->call ('sonet_group.get ' ,
19+ array (
20+ 'ORDER ' => $ order ,
21+ 'FILTER ' => $ filter ,
22+ ));
23+ return $ result ;
24+ }
25+
26+ /**
27+ * @param $name
28+ * @param $initiate_perms
29+ * @param $arFields
30+ * @link https://dev.1c-bitrix.ru/rest_help/socialnetwork/sonet_group/sonet_group_create.php
31+ * @throws Bitrix24Exception
32+ * @return array
33+ */
34+ public function Create ($ name , $ initiate_perms , $ arFields )
35+ {
36+ $ result = $ this ->client ->call ('sonet_group.create ' ,
37+ array_merge (
38+ array (
39+ 'NAME ' => $ name ,
40+ 'INITIATE_PERMS ' => $ initiate_perms
41+ ),
42+ $ arFields
43+ ));
44+ return $ result ;
45+ }
46+
47+ /**
48+ * @param $group_id
49+ * @param $arFields
50+ * @link https://dev.1c-bitrix.ru/api_help/socialnetwork/classes/CSocNetGroup/Update.php
51+ * @throws Bitrix24Exception
52+ * @return array
53+ */
54+ public function Update ($ group_id , $ arFields )
55+ {
56+ $ result = $ this ->client ->call ('sonet_group.update ' ,
57+ array_merge (
58+ array ('GROUP_ID ' => $ group_id ),
59+ $ arFields
60+ ));
61+ return $ result ;
62+ }
63+
64+ /**
65+ * @param $group_id
66+ * @link https://dev.1c-bitrix.ru/rest_help/socialnetwork/sonet_group/sonet_group_delete.php
67+ * @throws Bitrix24Exception
68+ * @return array
69+ */
70+ public function Delete ($ group_id )
71+ {
72+ $ result = $ this ->client ->call ('sonet_group.delete ' ,
73+ array (
74+ 'GROUP_ID ' => $ group_id
75+ ));
76+ return $ result ;
77+ }
78+
79+ /**
80+ * @param $group_id
81+ * @param $user_id
82+ * @link https://dev.1c-bitrix.ru/rest_help/socialnetwork/sonet_group/sonet_group_setowner.php
83+ * @throws Bitrix24Exception
84+ * @return array
85+ */
86+ public function SetOwner ($ group_id , $ user_id )
87+ {
88+ $ result = $ this ->client ->call ('sonet_group.setowner ' ,
89+ array (
90+ 'GROUP_ID ' => $ group_id ,
91+ 'USER_ID ' => $ user_id
92+ ));
93+ return $ result ;
94+ }
95+
96+ /**
97+ * @param $id
98+ * @link https://dev.1c-bitrix.ru/rest_help/socialnetwork/sonet_group/sonet_group_user_get.php
99+ * @throws Bitrix24Exception
100+ * @return array
101+ */
102+ public function UserGet ($ id )
103+ {
104+ $ result = $ this ->client ->call ('sonet_group.user.get ' ,
105+ array (
106+ 'ID ' => $ id
107+ )
108+ );
109+ return $ result ;
110+ }
111+
112+ /**
113+ * @param $group_id
114+ * @param $user_id
115+ * @param $message
116+ * @link https://dev.1c-bitrix.ru/rest_help/socialnetwork/sonet_group/sonet_group_user_invite.php
117+ * @throws Bitrix24Exception
118+ * @return array
119+ */
120+ public function Invate ($ group_id , $ user_id , $ message )
121+ {
122+ $ result = $ this ->client ->call ('sonet_group.user.invite ' ,
123+ array (
124+ 'GROUP_ID ' => $ group_id ,
125+ 'USER_ID ' => $ user_id ,
126+ 'MESSAGE ' => $ message
127+ )
128+ );
129+ return $ result ;
130+ }
131+
132+ /**
133+ * @param $group_id
134+ * @param $message
135+ * @link https://dev.1c-bitrix.ru/rest_help/socialnetwork/sonet_group/sonet_group_user_request.php
136+ * @throws Bitrix24Exception
137+ * @return array
138+ */
139+ public function Request ($ group_id , $ message )
140+ {
141+ $ result = $ this ->client ->call ('sonet_group.user.request ' ,
142+ array (
143+ 'GROUP_ID ' => $ group_id ,
144+ 'MESSAGE ' => $ message
145+ )
146+ );
147+ return $ result ;
148+ }
149+
150+ /**
151+ * @link https://dev.1c-bitrix.ru/rest_help/socialnetwork/sonet_group/sonet_group_user_groups.php
152+ * @throws Bitrix24Exception
153+ * @return array
154+ */
155+ public function UserGroups ()
156+ {
157+ $ result = $ this ->client ->call ('sonet_group.user.groups ' );
158+ return $ result ;
159+ }
160+
161+ /**
162+ * @param $group_id
163+ * @param $feature
164+ * @param $operation
165+ * @link https://dev.1c-bitrix.ru/rest_help/socialnetwork/sonet_group/sonet_group_feature_access.php
166+ * @throws Bitrix24Exception
167+ * @return array
168+ */
169+ public function FeatureAccess ($ group_id , $ feature , $ operation )
170+ {
171+ $ result = $ this ->client ->call ('sonet_group.feature.access ' ,
172+ array (
173+ 'GROUP_ID ' => $ group_id ,
174+ 'FEATURE ' => $ feature ,
175+ 'OPERATION ' => $ operation
176+ ));
177+ return $ result ;
178+ }
179+ }
0 commit comments