1 | <?php |
||
46 | class WSClient |
||
47 | { |
||
48 | private $session = null; |
||
49 | |||
50 | public $modules = null; |
||
51 | public $entities = null; |
||
52 | |||
53 | const USE_ACCESSKEY = 1; |
||
54 | const USE_PASSWORD = 2; |
||
55 | |||
56 | /** |
||
57 | * Class constructor |
||
58 | * @param string $vtigerUrl The URL of the remote WebServices server |
||
59 | * @param string $username User name |
||
60 | * @param string $secret Access key token (shown on user's profile page) or password, depends on $loginMode |
||
61 | * @param integer [$loginMode = self::USE_ACCESSKEY|USE_PASSWORD] Login mode, defaults to username + accessKey |
||
62 | * @param string [$wsBaseURL = 'webservice.php'] WebServices base URL appended to vTiger root URL |
||
63 | * @param int Optional request timeout in seconds |
||
64 | */ |
||
65 | public function __construct($vtigerUrl, $username, $secret, $loginMode = self::USE_ACCESSKEY, $wsBaseURL = 'webservice.php', $requestTimeout = 0) |
||
93 | |||
94 | /** |
||
95 | * Invokes custom operation (defined in vtiger_ws_operation table) |
||
96 | * @access public |
||
97 | * @param string $operation Name of the webservice to invoke |
||
98 | * @param array [$params = null] Parameter values to operation |
||
99 | * @param string [$method = 'POST'] HTTP request method (GET, POST etc) |
||
100 | * @return array Result object |
||
101 | */ |
||
102 | public function invokeOperation($operation, array $params = null, $method = 'POST') |
||
114 | |||
115 | /** |
||
116 | * VTiger provides a simple query language for fetching data. |
||
117 | * This language is quite similar to select queries in SQL. |
||
118 | * There are limitations, the queries work on a single Module, |
||
119 | * embedded queries are not supported, and does not support joins. |
||
120 | * But this is still a powerful way of getting data from Vtiger. |
||
121 | * Query always limits its output to 100 records, |
||
122 | * Client application can use limit operator to get different records. |
||
123 | * @access public |
||
124 | * @param string $query SQL-like expression |
||
125 | * @return array Query results |
||
126 | */ |
||
127 | public function runQuery($query) |
||
136 | |||
137 | /** |
||
138 | * Gets an array containing the basic information about current API user |
||
139 | * @access public |
||
140 | * @return array Basic information about current API user |
||
141 | */ |
||
142 | public function getCurrentUser() |
||
146 | |||
147 | /** |
||
148 | * Gets an array containing the basic information about the connected vTiger instance |
||
149 | * @access public |
||
150 | * @return array Basic information about the connected vTiger instance |
||
151 | */ |
||
152 | public function getVtigerInfo() |
||
159 | } |
||
160 | |||
182 |