Skip to content

Commit fb63c71

Browse files
committed
Supported tags cary-over, connection timeout and followed PSR4 standards.
1 parent 926c4e6 commit fb63c71

File tree

110 files changed

+4116
-3501
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+4116
-3501
lines changed

.gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/samples export-ignore
2+
/class_hierarchy.png export-ignore

README.md

+27-14
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ You can include the SDK to your project using:
7474
- Install **PHP SDK**.
7575

7676
- Navigate to the workspace of your client app.
77-
77+
7878
- Run the command below:
7979

8080
```sh
81-
composer require zohocrm/php-sdk:3.0.1
81+
composer require zohocrm/php-sdk:3.0.2
8282
```
8383

8484
- The PHP SDK will be installed and a package named vendor will be created in the workspace of your client app.
@@ -90,7 +90,7 @@ You can include the SDK to your project using:
9090
```php
9191
require 'vendor/autoload.php';
9292
```
93-
93+
9494
Through this line, you can access all the functionalities of the PHP SDK. The namespaces of the class to be used must be included within the "use" statement.
9595

9696
## Token Persistence
@@ -246,7 +246,7 @@ class CustomStore implements TokenStore
246246
247247
/**
248248
* @return array An array of Token (com\zoho\api\authenticator\OAuthToken) class instances
249-
*/
249+
*/
250250
public function getTokens()
251251
{
252252
//Add code to retrieve all the stored tokens
@@ -322,7 +322,7 @@ Before you get started with creating your PHP application, you need to register
322322
323323
$tokenstore = new DBStore("hostName", "dataBaseName", "userName", "password", "portNumber");
324324
325-
// $tokenstore = new FileStore("absolute_file_path");
325+
// $tokenstore = new FileStore("absolute_file_path");
326326
```
327327
328328
- Create an instance of SDKConfig containing SDK configurations.
@@ -349,7 +349,11 @@ Before you get started with creating your PHP application, you need to register
349349
350350
$enableSSLVerification = true;
351351
352-
$sdkConfig = (new SDKConfigBuilder())->setAutoRefreshFields($autoRefreshFields)->setPickListValidation($pickListValidation)->setSSLVerification($enableSSLVerification)->build();
352+
$connectionTimeout = 2; //The number of seconds to wait while trying to connect. Use 0 to wait indefinitely.
353+
354+
$timeout = 2; //The maximum number of seconds to allow cURL functions to execute.
355+
356+
$sdkConfig = (new SDKConfigBuilder())->setAutoRefreshFields($autoRefreshFields)->setPickListValidation($pickListValidation)->setSSLVerification($enableSSLVerification)->connectionTimeout($connectionTimeout)->timeout($timeout)->build();
353357
```
354358
355359
- Create an instance of RequestProxy containing the proxy properties of the user.
@@ -442,8 +446,11 @@ class Initialize
442446
443447
$pickListValidation = false;
444448
445-
// Create an instance of SDKConfig
446-
$sdkConfig = (new SDKConfigBuilder())->setAutoRefreshFields($autoRefreshFields)->setPickListValidation($pickListValidation)->build();
449+
$connectionTimeout = 2;
450+
451+
$timeout = 2;
452+
453+
$sdkConfig = (new SDKConfigBuilder())->setAutoRefreshFields($autoRefreshFields)->setPickListValidation($pickListValidation)->setSSLVerification($enableSSLVerification)->connectionTimeout($connectionTimeout)->timeout($timeout)->build();
447454
448455
$resourcePath = "/Users/user_name/Documents/phpsdk-application";
449456
@@ -489,7 +496,7 @@ All other exceptions such as SDK anomalies and other unexpected behaviours are t
489496
- **APIResponse<RecordActionHandler>**
490497
491498
- For getting Record Count for a specific Tag operation
492-
499+
493500
- **APIResponse<CountHandler>**
494501
495502
- For operations involving BaseCurrency
@@ -645,8 +652,11 @@ class MultiThread
645652
646653
$pickListValidation = false;
647654
648-
// Create an instance of SDKConfig
649-
$sdkConfig = (new SDKConfigBuilder())->setAutoRefreshFields($autoRefreshFields)->setPickListValidation($pickListValidation)->build();
655+
$connectionTimeout = 2;
656+
657+
$timeout = 2;
658+
659+
$sdkConfig = (new SDKConfigBuilder())->setAutoRefreshFields($autoRefreshFields)->setPickListValidation($pickListValidation)->setSSLVerification($enableSSLVerification)->connectionTimeout($connectionTimeout)->timeout($timeout)->build();
650660
651661
$resourcePath ="/Users/user_name/Documents/phpsdk-application";
652662
@@ -793,9 +803,12 @@ class Record
793803
794804
$pickListValidation = false;
795805
796-
// Create an instance of SDKConfig
797-
$sdkConfig = (new SDKConfigBuilder())->setAutoRefreshFields($autoRefreshFields)->setPickListValidation($pickListValidation)->build();
798-
806+
$connectionTimeout = 2;
807+
808+
$timeout = 2;
809+
810+
$sdkConfig = (new SDKConfigBuilder())->setAutoRefreshFields($autoRefreshFields)->setPickListValidation($pickListValidation)->setSSLVerification($enableSSLVerification)->connectionTimeout($connectionTimeout)->timeout($timeout)->build();
811+
799812
$resourcePath ="/Users/user_name/Documents/phpsdk-application";
800813
801814
/*

samples/src/com/zoho/crm/api/initializer/Initialize.php

+8-3
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,17 @@ public static function initialize()
5858

5959
$autoRefreshFields = true;
6060

61-
$pickListValidation = false;
61+
$pickListValidation = false;
62+
63+
$enableSSLVerification = true;
6264

6365
$builderInstance = new SDKConfigBuilder();
6466

65-
//Create an instance of SDKConfig
66-
$configInstance = $builderInstance->setPickListValidation($pickListValidation)->setAutoRefreshFields($autoRefreshFields)->build();
67+
$connectionTimeout = 2; //The number of seconds to wait while trying to connect. Use 0 to wait indefinitely.
68+
69+
$timeout = 2; //The maximum number of seconds to allow cURL functions to execute.
70+
71+
$configInstance = $builderInstance->setAutoRefreshFields($autoRefreshFields)->setPickListValidation($pickListValidation)->setSSLVerification($enableSSLVerification)->connectionTimeout($connectionTimeout)->timeout($timeout)->build();
6772

6873
//Create an instance of RequestProxy
6974
$requestProxy = new RequestProxy("proxyHost", "proxyPort", "proxyUser", "password");

samples/src/com/zoho/crm/api/record/Record.php

+12
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@
9393

9494
use com\zoho\crm\api\attachments\Attachment;
9595

96+
use com\zoho\crm\api\record\CarryOverTags;
97+
9698
class Record
9799
{
98100
/**
@@ -3542,6 +3544,16 @@ public static function convertLead(string $recordId)
35423544
$deals->setTag($tagList);
35433545

35443546
// $record1->setDeals($deals);
3547+
3548+
$carryOverTags = new CarryOverTags();
3549+
3550+
$carryOverTags->setAccounts(["TagName"]);
3551+
3552+
$carryOverTags->setContacts(["TagName"]);
3553+
3554+
$carryOverTags->setDeals(["TagName"]);
3555+
3556+
$record1->setCarryOverTags($carryOverTags);
35453557

35463558
//Add Record instance to the list
35473559
array_push($data, $record1);

src/com/zoho/crm/api/SDKConfigBuilder.php

+62-2
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,21 @@ class SDKConfigBuilder
1212

1313
private $enableSSLVerification;
1414

15+
private $connectionTimeout;
16+
17+
private $timeout;
18+
1519
public function __Construct()
1620
{
1721
$this->autoRefreshFields = false;
1822

1923
$this->pickListValidation = true;
2024

2125
$this->enableSSLVerification = true;
26+
27+
$this->connectionTimeout = 0;
28+
29+
$this->timeout = 0;
2230
}
2331

2432
/**
@@ -54,13 +62,39 @@ public function setSSLVerification(bool $enableSSLVerification)
5462
return $this;
5563
}
5664

65+
/**
66+
* This is a setter method to set connectionTimeout.
67+
* @param connectionTimeout A int number of seconds to wait while trying to connect.
68+
* @return An instance of Builder
69+
*/
70+
public function connectionTimeout(int $connectionTimeout)
71+
{
72+
$this->connectionTimeout = $connectionTimeout > 0 ? $connectionTimeout : 0;
73+
74+
return $this;
75+
}
76+
77+
/**
78+
* This is a setter method to set timeout.
79+
* @param timeout A int maximum number of seconds to allow cURL functions to execute.
80+
* @return An instance of Builder
81+
*/
82+
public function timeout(int $timeout)
83+
{
84+
$this->timeout = $timeout > 0 ? $timeout : 0;
85+
86+
return $this;
87+
}
88+
89+
// CURLOPT_CONNECTTIMEOUT is a segment of the time represented by CURLOPT_TIMEOUT, so the value of the CURLOPT_TIMEOUT should be greater than the value of the CURLOPT_CONNECTTIMEOUT.
90+
5791
/**
5892
* The method to build the SDKConfig instance
5993
* @returns An instance of SDKConfig
6094
*/
6195
public function build()
6296
{
63-
return new \com\zoho\crm\api\sdkconfigbuilder\SDKConfig($this->autoRefreshFields, $this->pickListValidation, $this->enableSSLVerification);
97+
return new \com\zoho\crm\api\sdkconfigbuilder\SDKConfig($this->autoRefreshFields, $this->pickListValidation, $this->enableSSLVerification, $this->connectionTimeout, $this->timeout);
6498
}
6599
}
66100

@@ -77,19 +111,27 @@ class SDKConfig
77111

78112
private $enableSSLVerification;
79113

114+
private $connectionTimeout;
115+
116+
private $timeout;
117+
80118
/**
81119
* Creates an instance of SDKConfig with the given parameters
82120
* @param autoRefreshFields - A boolean representing autoRefreshFields
83121
* @param pickListValidation - A boolean representing pickListValidation
84122
* @param enableSSLVerification - A boolean representing enableSSLVerification
85123
*/
86-
public function __Construct(bool $autoRefreshFields, bool $pickListValidation, bool $enableSSLVerification)
124+
public function __Construct(bool $autoRefreshFields, bool $pickListValidation, bool $enableSSLVerification, int $connectionTimeout, int $timeout)
87125
{
88126
$this->autoRefreshFields = $autoRefreshFields;
89127

90128
$this->pickListValidation = $pickListValidation;
91129

92130
$this->enableSSLVerification = $enableSSLVerification;
131+
132+
$this->connectionTimeout = $connectionTimeout;
133+
134+
$this->timeout = $timeout;
93135
}
94136

95137
/**
@@ -118,5 +160,23 @@ public function isSSLVerificationEnabled()
118160
{
119161
return $this->enableSSLVerification;
120162
}
163+
164+
/**
165+
* This is a getter method to get connectionTimeout.
166+
* @return A int representing connectionTimeout
167+
*/
168+
public function connectionTimeout()
169+
{
170+
return $this->connectionTimeout;
171+
}
172+
173+
/**
174+
* This is a getter method to get cURL Timeout.
175+
* @return A int representing cURL Timeout
176+
*/
177+
public function timeout()
178+
{
179+
return $this->timeout;
180+
}
121181
}
122182
?>

src/com/zoho/crm/api/attachments/AttachmentsOperations.php

-39
Original file line numberDiff line numberDiff line change
@@ -161,42 +161,3 @@ public function deleteAttachments(ParameterMap $paramInstance=null)
161161

162162
}
163163
}
164-
class GetAttachmentsParam
165-
{
166-
public static final function fields()
167-
{
168-
return new Param('fields', 'com.zoho.crm.api.Attachments.GetAttachmentsParam');
169-
170-
}
171-
public static final function page()
172-
{
173-
return new Param('page', 'com.zoho.crm.api.Attachments.GetAttachmentsParam');
174-
175-
}
176-
public static final function perPage()
177-
{
178-
return new Param('per_page', 'com.zoho.crm.api.Attachments.GetAttachmentsParam');
179-
180-
}
181-
182-
}
183-
184-
class UploadLinkAttachmentParam
185-
{
186-
public static final function attachmentUrl()
187-
{
188-
return new Param('attachmentUrl', 'com.zoho.crm.api.Attachments.UploadLinkAttachmentParam');
189-
190-
}
191-
192-
}
193-
194-
class DeleteAttachmentsParam
195-
{
196-
public static final function ids()
197-
{
198-
return new Param('ids', 'com.zoho.crm.api.Attachments.DeleteAttachmentsParam');
199-
200-
}
201-
202-
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
namespace com\zoho\crm\api\attachments;
3+
4+
use com\zoho\crm\api\Param;
5+
6+
class DeleteAttachmentsParam
7+
{
8+
9+
public static final function ids()
10+
{
11+
return new Param('ids', 'com.zoho.crm.api.Attachments.DeleteAttachmentsParam');
12+
13+
}
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
namespace com\zoho\crm\api\attachments;
3+
4+
use com\zoho\crm\api\Param;
5+
6+
class GetAttachmentsParam
7+
{
8+
9+
public static final function fields()
10+
{
11+
return new Param('fields', 'com.zoho.crm.api.Attachments.GetAttachmentsParam');
12+
13+
}
14+
public static final function page()
15+
{
16+
return new Param('page', 'com.zoho.crm.api.Attachments.GetAttachmentsParam');
17+
18+
}
19+
public static final function perPage()
20+
{
21+
return new Param('per_page', 'com.zoho.crm.api.Attachments.GetAttachmentsParam');
22+
23+
}
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
namespace com\zoho\crm\api\attachments;
3+
4+
use com\zoho\crm\api\Param;
5+
6+
class UploadLinkAttachmentParam
7+
{
8+
9+
public static final function attachmentUrl()
10+
{
11+
return new Param('attachmentUrl', 'com.zoho.crm.api.Attachments.UploadLinkAttachmentParam');
12+
13+
}
14+
}

src/com/zoho/crm/api/bulkwrite/BulkWriteOperations.php

-14
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,3 @@ public function downloadBulkWriteResult(string $downloadUrl)
8989

9090
}
9191
}
92-
class UploadFileHeader
93-
{
94-
public static final function feature()
95-
{
96-
return new Header('feature', 'com.zoho.crm.api.BulkWrite.UploadFileHeader');
97-
98-
}
99-
public static final function XCRMORG()
100-
{
101-
return new Header('X-CRM-ORG', 'com.zoho.crm.api.BulkWrite.UploadFileHeader');
102-
103-
}
104-
105-
}

0 commit comments

Comments
 (0)