Kerio APIs Client Library for PHP 1.4.0.234
  • Namespace
  • Class
  • Tree
  • Deprecated

Namespaces

  • None
  • PHP

Classes

  • KerioApi
  • KerioApiSocket
  • KerioConnectApi
  • KerioControlApi
  • KerioDirectoryApi
  • KerioOperatorApi
  • KerioWorkspaceApi
  • SamepageApi

Interfaces

  • KerioApiInterface
  • KerioApiSocketInterface

Exceptions

  • KerioApiException
  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 Connect.
 19  *
 20  * This class implements product-specific methods and properties.
 21  *
 22  * Example:
 23  * <code>
 24  * <?php
 25  * require_once(dirname(__FILE__) . '/src/KerioConnectApi.php');
 26  *
 27  * $api = new KerioConnectApi('Sample application', 'Company Ltd.', '1.0');
 28  *
 29  * try {
 30  *     $api->login('mail.company.tld', 'admin', 'SecretPassword');
 31  *     $api->sendRequest('...');
 32  *     $api->logout();
 33  * } catch (KerioApiException $error) {
 34  *     print $error->getMessage();
 35  * }
 36  * ?>
 37  * </code>
 38  *
 39  * @copyright   Copyright &copy; 2012-2012 Kerio Technologies s.r.o.
 40  * @license     http://www.kerio.com/developers/license/sdk-agreement
 41  * @version     1.4.0.234
 42  */
 43 class KerioConnectApi extends KerioApi {
 44 
 45     /**
 46      * Defines default product-specific JSON-RPC settings.
 47      * @var array
 48      */
 49     protected $jsonRpc = array(
 50         'version'   => '2.0',
 51         'port'      => 4040,
 52         'api'       => '/admin/api/jsonrpc/'
 53     );
 54 
 55     /**
 56      * Class constructor.
 57      *
 58      * @param   string  Application name
 59      * @param   string  Application vendor
 60      * @param   string  Application version
 61      * @return  void
 62      * @throws  KerioApiException
 63      */
 64     public function __construct($name, $vendor, $version) {
 65         parent::__construct($name, $vendor, $version);
 66     }
 67 
 68     /**
 69      * Set component Web Administration.
 70      * 
 71      * @param   void
 72      * @return  void
 73      */
 74     public function setComponentAdmin() {
 75         $this->setJsonRpc('2.0', 4040, '/admin/api/jsonrpc/');
 76     }
 77 
 78     /**
 79      * Set component Client aka WebMail.
 80      * 
 81      * @param   void
 82      * @return  void
 83      */
 84     public function setComponentClient() {
 85         $this->setJsonRpc('2.0', 443, '/webmail/api/jsonrpc/');
 86     }
 87 
 88     /**
 89      * Set component WebMail.
 90      * 
 91      * @param   void
 92      * @return  void
 93      * @deprecated
 94      */
 95     public function setComponentWebmail() {
 96         trigger_error("Deprecated function setComponentMyphone(), use setComponentClient() instead", E_USER_NOTICE);
 97         $this->setComponentClient();
 98     }
 99 
100     /**
101      * Get constants defined by product.
102      *
103      * @param   void
104      * @return  array   Array of constants
105      */
106     public function getConstants() {
107         $response = $this->sendRequest('Server.getNamedConstantList');
108         $constantList = array();
109 
110         foreach ($response['constants'] as $index) {
111             $constantList[$index['name']] = $index['value'];
112         }
113 
114         return $constantList;
115     }
116 }
117 
Kerio APIs Client Library for PHP 1.4.0.234 API documentation generated by ApiGen 2.8.0