@@ -12,7 +12,7 @@ class Mail extends \PleskX\Api\Operator
12
12
* @param string $forwardAddress
13
13
* @return Struct\Info
14
14
*/
15
- public function create (string $ name , int $ siteId , string $ forwardAddress )
15
+ public function create (string $ name , int $ siteId , string $ forwardAddress ): Struct \ Info
16
16
{
17
17
$ packet = $ this ->_client ->getPacket ();
18
18
$ info = $ packet ->addChild ($ this ->_wrapperTag )->addChild ('create ' );
@@ -31,20 +31,37 @@ public function create(string $name, int $siteId, string $forwardAddress)
31
31
return new Struct \Info ($ response ->mailname );
32
32
}
33
33
34
+ /**
35
+ * @param int $siteId
36
+ * @return \PleskX\Api\XmlResponse
37
+ */
38
+ public function get (int $ siteId )
39
+ {
40
+ $ packet = $ this ->_client ->getPacket ();
41
+ $ info = $ packet ->addChild ($ this ->_wrapperTag )->addChild ('get_info ' );
42
+ $ filter = $ info ->addChild ('filter ' );
43
+ $ filter ->addChild ('site_id ' , $ siteId );
44
+ $ filter ->addChild ('forwarding ' , 'true ' );
45
+
46
+ $ response = $ this ->_client ->request ($ packet );
47
+
48
+ return $ response ;
49
+ }
50
+
34
51
/**
35
52
* @param string $field
36
53
* @param integer|string $value
37
54
* @param integer $siteId
38
55
* @return bool
39
56
*/
40
- public function delete ($ field , $ value , $ siteId )
57
+ public function delete ($ field , $ value , $ siteId ): bool
41
58
{
42
59
$ packet = $ this ->_client ->getPacket ();
43
60
$ filter = $ packet ->addChild ($ this ->_wrapperTag )->addChild ('remove ' )->addChild ('filter ' );
44
61
$ filter ->addChild ('site-id ' , $ siteId );
45
62
$ filter ->addChild ($ field , $ value );
46
63
$ response = $ this ->_client ->request ($ packet );
64
+
47
65
return 'ok ' === (string )$ response ->status ;
48
66
}
49
-
50
67
}
0 commit comments