@@ -40,29 +40,25 @@ for Europe the url is: [https://api-console.zoho.eu]
40
40
``` php
41
41
include __DIR__ . /* Relative path to the vendor autoloader */ '/vendor/autoload.php';
42
42
43
- use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
44
- use zcrmsdk\oauth\exception\ZohoOAuthException;
45
- use zcrmsdk\oauth\utility\ZohoOAuthConstants;
46
- use zcrmsdk\oauth\ZohoOAuth;
47
- use zcrmsdk\oauth\ZohoOAuthClient;
48
43
use Zoho\Desk\Api\Metadata;
49
44
use Zoho\Desk\Client\ConfigProviderBuilder;
45
+ use Zoho\OAuth\ZohoOAuth;
50
46
51
47
$configBuilder = ConfigProviderBuilder::getInstance();
52
48
$configBuilder->setClientId(/* Client ID */)
53
- ->setClientSecret(/* Client Secret */)
54
- ->setRedirectUrl(/* Redirect Url */)
55
- ->setCurrentUserEmail(/* User Email */)
56
- ->setApiBaseUrl(/* API Endpoint by region */)
57
- ->setApiVersion(Metadata::API_VERSION)
58
- ->setOrgId(/* Org ID */)
59
- ->setIsSandbox(/* Sandbox Status */)
60
- ->setAccountsUrl(/* Accounts Url */)
61
- ->setTokenPersistencePath(/* Persistence Path */);
49
+ ->setClientSecret(/* Client Secret */)
50
+ ->setRedirectUrl(/* Redirect Url */)
51
+ ->setCurrentUserEmail(/* User Email */)
52
+ ->setApiBaseUrl(/* API Endpoint by region */)
53
+ ->setApiVersion(Metadata::API_VERSION)
54
+ ->setOrgId(/* Org ID */)
55
+ ->setIsSandbox(/* Sandbox Status */)
56
+ ->setAccountsUrl(/* Accounts Url */)
57
+ ->setTokenPersistencePath(/* Persistence Path */);
62
58
63
59
// Add php code if the zcrm_oauthtokens.txt to create the file if it does not already exists.
64
60
65
- ZCRMRestClient ::initialize($configBuilder->create());
61
+ ZohoOAuth ::initialize($configBuilder->create()->get ());
66
62
ZohoOAuth::getClientInstance()->generateAccessToken($grantCode);
67
63
```
68
64
@@ -104,31 +100,32 @@ use Zoho\Desk\Exception\CouldNotDeleteException;
104
100
use Zoho\Desk\Exception\CouldNotReadException;
105
101
use Zoho\Desk\Exception\CouldNotSaveException;
106
102
107
- $ticketDataObject = $gateway->createDataObject ('tickets', /* Entity values */);
103
+ $ticketDataObject = $gateway->dataObjectFactory->create ('tickets', /* Entity values */);
108
104
109
105
try {
110
- $ticketDataObject = $gateway->create ('tickets', $ticketDataObject);
106
+ $ticketDataObject = $gateway->operationPool->getCreateOperation ('tickets')->create( $ticketDataObject);
111
107
} catch (CouldNotSaveException $e) {
112
108
// Handle the exception...
113
109
}
114
110
115
111
try {
116
- $ticketDataObject = $gateway->get ('tickets', 1234);
112
+ $ticketDataObject = $gateway->operationPool->getReadOperation ('tickets')->get( 1234);
117
113
} catch (CouldNotReadException $e) {
118
114
// Handle the exception...
119
115
}
120
116
121
117
try {
122
- $ticketDataObject = $gateway->update ('tickets', $ticketDataObject);
118
+ $ticketDataObject = $gateway->operationPool->getUpdateOperation ('tickets')->update( $ticketDataObject);
123
119
} catch (CouldNotSaveException $e) {
124
120
// Handle the exception...
125
121
}
126
122
127
123
try {
128
- $gateway->delete ('tickets', 1234, ['resolution']);
124
+ $gateway->operationPool->getDeleteOperation ('tickets', ['resolution'])->delete(1234 );
129
125
} catch (CouldNotDeleteException $e) {
130
126
// Handle the exception...
131
127
}
128
+
132
129
```
133
130
134
131
## Support
0 commit comments