-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathZohoCreator.php
39 lines (32 loc) · 1.3 KB
/
ZohoCreator.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
include_once('ZohoCreatorApplication.php');
class ZohoCreator extends Zoho {
protected $applications = array();
public $ownerName;
public function __construct($authToken, $ownerName) {
$this->ownerName = $ownerName;
parent::__construct('creatorapi', 'https://creator.zoho.com/api', $authToken);
}
public function call($path, $params=array(), $options=array(), $ownerInUrl=false) {
$params = $this->fixedParams+array('scope' => $this->scope, 'authtoken' => $this->authToken)+$params;
if ($ownerInUrl) {
$url = $this->pathPrefix . '/' . $this->ownerName . '/json/' . $path;
} else {
// $params['zc_ownername'] = $this->ownerName;
$url = $this->pathPrefix . '/json/' . $path;
}
return json_decode($this->callUrl($url, $params, $options));
}
public function application($name) {
if (!array_key_exists($name, $this->applications)) {
$this->applications[$name] = new ZohoCreatorApplication($name, $this);
}
return $this->applications[$name];
}
/**
* @see https://api.creator.zoho.com/REST-API-List-Applications.html
*/
public function applications() {
return $this->call('applications', array('zc_ownername' => $this->ownerName));
}
}