KerioDirectoryApi.php 2.1 KB

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