1 <?php
2 /**
3 * This file is part of the kerio-api-php.
4 *
5 * Copyright (c) Kerio Technologies s.r.o.
6 *
7 * For the full copyright and license information, please view
8 * the file license.txt that was distributed with this source code
9 * or visit Developer Zone. (http://www.kerio.com/developers)
10 *
11 * Do not modify this source code.
12 * Any changes may be overwritten by a new version.
13 */
14
15 require_once(dirname(__FILE__) . '/class/KerioApi.php');
16
17 /**
18 * Administration API for Kerio Directory.
19 * STATUS: In progress, might change in the future
20 *
21 * This class implements product-specific methods and properties and currently is under development.
22 * Class is not intended for stable use yet.
23 * Functionality might not be fully verified, documented, or even supported.
24 *
25 * Please note that changes can be made without further notice.
26 *
27 * Example:
28 * <code>
29 * <?php
30 * require_once(dirname(__FILE__) . '/src/KerioDirectory.php');
31 *
32 * $api = new KerioDirectory('Sample application', 'Company Ltd.', '1.0');
33 *
34 * try {
35 * $api->login('directory.company.tld', 'admin', 'SecretPassword');
36 * $api->sendRequest('...');
37 * $api->logout();
38 * } catch (KerioApiException $error) {
39 * print $error->getMessage();
40 * }
41 * ?>
42 * </code>
43 *
44 * @copyright Copyright © 2012-2012 Kerio Technologies s.r.o.
45 * @license http://www.kerio.com/developers/license/sdk-agreement
46 * @version 1.4.0.234
47 */
48 class KerioDirectoryApi extends KerioApi {
49
50 /**
51 * Defines product-specific JSON-RPC settings
52 * @var array
53 */
54 protected $jsonRpc = array(
55 'version' => '2.0',
56 'port' => 4101,
57 'api' => '/admin/jsonrpc/'
58 );
59
60 /**
61 * Class constructor.
62 *
63 * @param string Application name
64 * @param string Application vendor
65 * @param string Application version
66 * @return void
67 * @throws KerioApiException
68 */
69 public function __construct($name, $vendor, $version) {
70 parent::__construct($name, $vendor, $version);
71 }
72
73 /**
74 * Get constants defined by product.
75 *
76 * @param void
77 * @return array Array of constants
78 */
79 public function getConstants() {
80 $response = $this->sendRequest('Server.getInfo');
81 return $response['serverInfo'];
82 }
83 }
84