Skip to content

Commit

Permalink
Merge pull request #10 from zoho/beta
Browse files Browse the repository at this point in the history
Beta
  • Loading branch information
raja-7453 authored Mar 2, 2021
2 parents c34d8a9 + fb63c71 commit 5684317
Show file tree
Hide file tree
Showing 110 changed files with 4,117 additions and 3,502 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/samples export-ignore
/class_hierarchy.png export-ignore
41 changes: 27 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ You can include the SDK to your project using:
- Install **PHP SDK**.

- Navigate to the workspace of your client app.

- Run the command below:

```sh
composer require zohocrm/php-sdk:3.0.1
composer require zohocrm/php-sdk:3.0.2
```

- The PHP SDK will be installed and a package named vendor will be created in the workspace of your client app.
Expand All @@ -90,7 +90,7 @@ You can include the SDK to your project using:
```php
require 'vendor/autoload.php';
```

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.

## Token Persistence
Expand Down Expand Up @@ -246,7 +246,7 @@ class CustomStore implements TokenStore
/**
* @return array An array of Token (com\zoho\api\authenticator\OAuthToken) class instances
*/
*/
public function getTokens()
{
//Add code to retrieve all the stored tokens
Expand Down Expand Up @@ -322,7 +322,7 @@ Before you get started with creating your PHP application, you need to register
$tokenstore = new DBStore("hostName", "dataBaseName", "userName", "password", "portNumber");
// $tokenstore = new FileStore("absolute_file_path");
// $tokenstore = new FileStore("absolute_file_path");
```
- Create an instance of SDKConfig containing SDK configurations.
Expand All @@ -349,7 +349,11 @@ Before you get started with creating your PHP application, you need to register
$enableSSLVerification = true;
$sdkConfig = (new SDKConfigBuilder())->setAutoRefreshFields($autoRefreshFields)->setPickListValidation($pickListValidation)->setSSLVerification($enableSSLVerification)->build();
$connectionTimeout = 2; //The number of seconds to wait while trying to connect. Use 0 to wait indefinitely.
$timeout = 2; //The maximum number of seconds to allow cURL functions to execute.
$sdkConfig = (new SDKConfigBuilder())->setAutoRefreshFields($autoRefreshFields)->setPickListValidation($pickListValidation)->setSSLVerification($enableSSLVerification)->connectionTimeout($connectionTimeout)->timeout($timeout)->build();
```
- Create an instance of RequestProxy containing the proxy properties of the user.
Expand Down Expand Up @@ -442,8 +446,11 @@ class Initialize
$pickListValidation = false;
// Create an instance of SDKConfig
$sdkConfig = (new SDKConfigBuilder())->setAutoRefreshFields($autoRefreshFields)->setPickListValidation($pickListValidation)->build();
$connectionTimeout = 2;
$timeout = 2;
$sdkConfig = (new SDKConfigBuilder())->setAutoRefreshFields($autoRefreshFields)->setPickListValidation($pickListValidation)->setSSLVerification($enableSSLVerification)->connectionTimeout($connectionTimeout)->timeout($timeout)->build();
$resourcePath = "/Users/user_name/Documents/phpsdk-application";
Expand Down Expand Up @@ -489,7 +496,7 @@ All other exceptions such as SDK anomalies and other unexpected behaviours are t
- **APIResponse<RecordActionHandler>**
- For getting Record Count for a specific Tag operation
- **APIResponse<CountHandler>**
- For operations involving BaseCurrency
Expand Down Expand Up @@ -645,8 +652,11 @@ class MultiThread
$pickListValidation = false;
// Create an instance of SDKConfig
$sdkConfig = (new SDKConfigBuilder())->setAutoRefreshFields($autoRefreshFields)->setPickListValidation($pickListValidation)->build();
$connectionTimeout = 2;
$timeout = 2;
$sdkConfig = (new SDKConfigBuilder())->setAutoRefreshFields($autoRefreshFields)->setPickListValidation($pickListValidation)->setSSLVerification($enableSSLVerification)->connectionTimeout($connectionTimeout)->timeout($timeout)->build();
$resourcePath ="/Users/user_name/Documents/phpsdk-application";
Expand Down Expand Up @@ -793,9 +803,12 @@ class Record
$pickListValidation = false;
// Create an instance of SDKConfig
$sdkConfig = (new SDKConfigBuilder())->setAutoRefreshFields($autoRefreshFields)->setPickListValidation($pickListValidation)->build();
$connectionTimeout = 2;
$timeout = 2;
$sdkConfig = (new SDKConfigBuilder())->setAutoRefreshFields($autoRefreshFields)->setPickListValidation($pickListValidation)->setSSLVerification($enableSSLVerification)->connectionTimeout($connectionTimeout)->timeout($timeout)->build();
$resourcePath ="/Users/user_name/Documents/phpsdk-application";
/*
Expand Down
11 changes: 8 additions & 3 deletions samples/src/com/zoho/crm/api/initializer/Initialize.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,17 @@ public static function initialize()

$autoRefreshFields = true;

$pickListValidation = false;
$pickListValidation = false;

$enableSSLVerification = true;

$builderInstance = new SDKConfigBuilder();

//Create an instance of SDKConfig
$configInstance = $builderInstance->setPickListValidation($pickListValidation)->setAutoRefreshFields($autoRefreshFields)->build();
$connectionTimeout = 2; //The number of seconds to wait while trying to connect. Use 0 to wait indefinitely.

$timeout = 2; //The maximum number of seconds to allow cURL functions to execute.

$configInstance = $builderInstance->setAutoRefreshFields($autoRefreshFields)->setPickListValidation($pickListValidation)->setSSLVerification($enableSSLVerification)->connectionTimeout($connectionTimeout)->timeout($timeout)->build();

//Create an instance of RequestProxy
$requestProxy = new RequestProxy("proxyHost", "proxyPort", "proxyUser", "password");
Expand Down
12 changes: 12 additions & 0 deletions samples/src/com/zoho/crm/api/record/Record.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@

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

use com\zoho\crm\api\record\CarryOverTags;

class Record
{
/**
Expand Down Expand Up @@ -3542,6 +3544,16 @@ public static function convertLead(string $recordId)
$deals->setTag($tagList);

// $record1->setDeals($deals);

$carryOverTags = new CarryOverTags();

$carryOverTags->setAccounts(["TagName"]);

$carryOverTags->setContacts(["TagName"]);

$carryOverTags->setDeals(["TagName"]);

$record1->setCarryOverTags($carryOverTags);

//Add Record instance to the list
array_push($data, $record1);
Expand Down
64 changes: 62 additions & 2 deletions src/com/zoho/crm/api/SDKConfigBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,21 @@ class SDKConfigBuilder

private $enableSSLVerification;

private $connectionTimeout;

private $timeout;

public function __Construct()
{
$this->autoRefreshFields = false;

$this->pickListValidation = true;

$this->enableSSLVerification = true;

$this->connectionTimeout = 0;

$this->timeout = 0;
}

/**
Expand Down Expand Up @@ -54,13 +62,39 @@ public function setSSLVerification(bool $enableSSLVerification)
return $this;
}

/**
* This is a setter method to set connectionTimeout.
* @param connectionTimeout A int number of seconds to wait while trying to connect.
* @return An instance of Builder
*/
public function connectionTimeout(int $connectionTimeout)
{
$this->connectionTimeout = $connectionTimeout > 0 ? $connectionTimeout : 0;

return $this;
}

/**
* This is a setter method to set timeout.
* @param timeout A int maximum number of seconds to allow cURL functions to execute.
* @return An instance of Builder
*/
public function timeout(int $timeout)
{
$this->timeout = $timeout > 0 ? $timeout : 0;

return $this;
}

// 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.

/**
* The method to build the SDKConfig instance
* @returns An instance of SDKConfig
*/
public function build()
{
return new \com\zoho\crm\api\sdkconfigbuilder\SDKConfig($this->autoRefreshFields, $this->pickListValidation, $this->enableSSLVerification);
return new \com\zoho\crm\api\sdkconfigbuilder\SDKConfig($this->autoRefreshFields, $this->pickListValidation, $this->enableSSLVerification, $this->connectionTimeout, $this->timeout);
}
}

Expand All @@ -77,19 +111,27 @@ class SDKConfig

private $enableSSLVerification;

private $connectionTimeout;

private $timeout;

/**
* Creates an instance of SDKConfig with the given parameters
* @param autoRefreshFields - A boolean representing autoRefreshFields
* @param pickListValidation - A boolean representing pickListValidation
* @param enableSSLVerification - A boolean representing enableSSLVerification
*/
public function __Construct(bool $autoRefreshFields, bool $pickListValidation, bool $enableSSLVerification)
public function __Construct(bool $autoRefreshFields, bool $pickListValidation, bool $enableSSLVerification, int $connectionTimeout, int $timeout)
{
$this->autoRefreshFields = $autoRefreshFields;

$this->pickListValidation = $pickListValidation;

$this->enableSSLVerification = $enableSSLVerification;

$this->connectionTimeout = $connectionTimeout;

$this->timeout = $timeout;
}

/**
Expand Down Expand Up @@ -118,5 +160,23 @@ public function isSSLVerificationEnabled()
{
return $this->enableSSLVerification;
}

/**
* This is a getter method to get connectionTimeout.
* @return A int representing connectionTimeout
*/
public function connectionTimeout()
{
return $this->connectionTimeout;
}

/**
* This is a getter method to get cURL Timeout.
* @return A int representing cURL Timeout
*/
public function timeout()
{
return $this->timeout;
}
}
?>
39 changes: 0 additions & 39 deletions src/com/zoho/crm/api/attachments/AttachmentsOperations.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,42 +161,3 @@ public function deleteAttachments(ParameterMap $paramInstance=null)

}
}
class GetAttachmentsParam
{
public static final function fields()
{
return new Param('fields', 'com.zoho.crm.api.Attachments.GetAttachmentsParam');

}
public static final function page()
{
return new Param('page', 'com.zoho.crm.api.Attachments.GetAttachmentsParam');

}
public static final function perPage()
{
return new Param('per_page', 'com.zoho.crm.api.Attachments.GetAttachmentsParam');

}

}

class UploadLinkAttachmentParam
{
public static final function attachmentUrl()
{
return new Param('attachmentUrl', 'com.zoho.crm.api.Attachments.UploadLinkAttachmentParam');

}

}

class DeleteAttachmentsParam
{
public static final function ids()
{
return new Param('ids', 'com.zoho.crm.api.Attachments.DeleteAttachmentsParam');

}

}
14 changes: 14 additions & 0 deletions src/com/zoho/crm/api/attachments/DeleteAttachmentsParam.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
namespace com\zoho\crm\api\attachments;

use com\zoho\crm\api\Param;

class DeleteAttachmentsParam
{

public static final function ids()
{
return new Param('ids', 'com.zoho.crm.api.Attachments.DeleteAttachmentsParam');

}
}
24 changes: 24 additions & 0 deletions src/com/zoho/crm/api/attachments/GetAttachmentsParam.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
namespace com\zoho\crm\api\attachments;

use com\zoho\crm\api\Param;

class GetAttachmentsParam
{

public static final function fields()
{
return new Param('fields', 'com.zoho.crm.api.Attachments.GetAttachmentsParam');

}
public static final function page()
{
return new Param('page', 'com.zoho.crm.api.Attachments.GetAttachmentsParam');

}
public static final function perPage()
{
return new Param('per_page', 'com.zoho.crm.api.Attachments.GetAttachmentsParam');

}
}
14 changes: 14 additions & 0 deletions src/com/zoho/crm/api/attachments/UploadLinkAttachmentParam.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
namespace com\zoho\crm\api\attachments;

use com\zoho\crm\api\Param;

class UploadLinkAttachmentParam
{

public static final function attachmentUrl()
{
return new Param('attachmentUrl', 'com.zoho.crm.api.Attachments.UploadLinkAttachmentParam');

}
}
14 changes: 0 additions & 14 deletions src/com/zoho/crm/api/bulkwrite/BulkWriteOperations.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,3 @@ public function downloadBulkWriteResult(string $downloadUrl)

}
}
class UploadFileHeader
{
public static final function feature()
{
return new Header('feature', 'com.zoho.crm.api.BulkWrite.UploadFileHeader');

}
public static final function XCRMORG()
{
return new Header('X-CRM-ORG', 'com.zoho.crm.api.BulkWrite.UploadFileHeader');

}

}
Loading

0 comments on commit 5684317

Please sign in to comment.