Skip to content

Commit 2bbf442

Browse files
committed
update documentation
1 parent 5f27a5c commit 2bbf442

File tree

2 files changed

+22
-25
lines changed

2 files changed

+22
-25
lines changed

README.md

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -40,29 +40,25 @@ for Europe the url is: [https://api-console.zoho.eu]
4040
```php
4141
include __DIR__ . /* Relative path to the vendor autoloader */ '/vendor/autoload.php';
4242

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;
4843
use Zoho\Desk\Api\Metadata;
4944
use Zoho\Desk\Client\ConfigProviderBuilder;
45+
use Zoho\OAuth\ZohoOAuth;
5046

5147
$configBuilder = ConfigProviderBuilder::getInstance();
5248
$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 */);
6258

6359
// Add php code if the zcrm_oauthtokens.txt to create the file if it does not already exists.
6460

65-
ZCRMRestClient::initialize($configBuilder->create());
61+
ZohoOAuth::initialize($configBuilder->create()->get());
6662
ZohoOAuth::getClientInstance()->generateAccessToken($grantCode);
6763
```
6864

@@ -104,31 +100,32 @@ use Zoho\Desk\Exception\CouldNotDeleteException;
104100
use Zoho\Desk\Exception\CouldNotReadException;
105101
use Zoho\Desk\Exception\CouldNotSaveException;
106102

107-
$ticketDataObject = $gateway->createDataObject('tickets', /* Entity values */);
103+
$ticketDataObject = $gateway->dataObjectFactory->create('tickets', /* Entity values */);
108104

109105
try {
110-
$ticketDataObject = $gateway->create('tickets', $ticketDataObject);
106+
$ticketDataObject = $gateway->operationPool->getCreateOperation('tickets')->create($ticketDataObject);
111107
} catch (CouldNotSaveException $e) {
112108
// Handle the exception...
113109
}
114110

115111
try {
116-
$ticketDataObject = $gateway->get('tickets', 1234);
112+
$ticketDataObject = $gateway->operationPool->getReadOperation('tickets')->get(1234);
117113
} catch (CouldNotReadException $e) {
118114
// Handle the exception...
119115
}
120116

121117
try {
122-
$ticketDataObject = $gateway->update('tickets', $ticketDataObject);
118+
$ticketDataObject = $gateway->operationPool->getUpdateOperation('tickets')->update($ticketDataObject);
123119
} catch (CouldNotSaveException $e) {
124120
// Handle the exception...
125121
}
126122

127123
try {
128-
$gateway->delete('tickets', 1234, ['resolution']);
124+
$gateway->operationPool->getDeleteOperation('tickets', ['resolution'])->delete(1234);
129125
} catch (CouldNotDeleteException $e) {
130126
// Handle the exception...
131127
}
128+
132129
```
133130

134131
## Support

docs/sample/code/index.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,28 +30,28 @@
3030

3131
/** CRUD Operations **/
3232

33-
$ticketDataObject = $gateway->createDataObject('tickets', /* Entity values */);
33+
$ticketDataObject = $gateway->dataObjectFactory->create('tickets', /* Entity values */);
3434

3535
try {
36-
$ticketDataObject = $gateway->create('tickets', $ticketDataObject);
36+
$ticketDataObject = $gateway->operationPool->getCreateOperation('tickets')->create($ticketDataObject);
3737
} catch (CouldNotSaveException $e) {
3838
// Handle the exception...
3939
}
4040

4141
try {
42-
$ticketDataObject = $gateway->get('tickets', 1234);
42+
$ticketDataObject = $gateway->operationPool->getReadOperation('tickets')->get(1234);
4343
} catch (CouldNotReadException $e) {
4444
// Handle the exception...
4545
}
4646

4747
try {
48-
$ticketDataObject = $gateway->update('tickets', $ticketDataObject);
48+
$ticketDataObject = $gateway->operationPool->getUpdateOperation('tickets')->update($ticketDataObject);
4949
} catch (CouldNotSaveException $e) {
5050
// Handle the exception...
5151
}
5252

5353
try {
54-
$gateway->delete('tickets', 1234, ['resolution']);
54+
$gateway->operationPool->getDeleteOperation('tickets', ['resolution'])->delete(1234);
5555
} catch (CouldNotDeleteException $e) {
5656
// Handle the exception...
5757
}

0 commit comments

Comments
 (0)