From aef92dd80d7a4d8344a07edd35f078e3d4ea3679 Mon Sep 17 00:00:00 2001 From: Phil Birnie Date: Tue, 11 May 2021 19:38:35 -0400 Subject: [PATCH 1/3] Adds Header Map to delete and update --- src/com/zoho/crm/api/record/RecordOperations.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/com/zoho/crm/api/record/RecordOperations.php b/src/com/zoho/crm/api/record/RecordOperations.php index 4ca04b8..200aa30 100644 --- a/src/com/zoho/crm/api/record/RecordOperations.php +++ b/src/com/zoho/crm/api/record/RecordOperations.php @@ -48,7 +48,7 @@ public function getRecord(string $id, string $moduleAPIName, ParameterMap $para * @param BodyWrapper $request An instance of BodyWrapper * @return APIResponse An instance of APIResponse */ - public function updateRecord(string $id, string $moduleAPIName, BodyWrapper $request) + public function updateRecord(string $id, string $moduleAPIName, BodyWrapper $request, HeaderMap $header_map) { $handlerInstance=new CommonAPIHandler(); $apiPath=""; @@ -62,6 +62,7 @@ public function updateRecord(string $id, string $moduleAPIName, BodyWrapper $re $handlerInstance->setContentType('application/json'); $handlerInstance->setRequest($request); Utility::getFields($moduleAPIName); + $handlerInstance->setHeader($header_map); $handlerInstance->setModuleAPIName($moduleAPIName); return $handlerInstance->apiCall(ActionHandler::class, 'application/json'); @@ -74,7 +75,7 @@ public function updateRecord(string $id, string $moduleAPIName, BodyWrapper $re * @param ParameterMap $paramInstance An instance of ParameterMap * @return APIResponse An instance of APIResponse */ - public function deleteRecord(string $id, string $moduleAPIName, ParameterMap $paramInstance=null) + public function deleteRecord(string $id, string $moduleAPIName, ParameterMap $paramInstance=null, HeaderMap $header_map) { $handlerInstance=new CommonAPIHandler(); $apiPath=""; @@ -86,6 +87,7 @@ public function deleteRecord(string $id, string $moduleAPIName, ParameterMap $p $handlerInstance->setHttpMethod(Constants::REQUEST_METHOD_DELETE); $handlerInstance->setCategoryMethod(Constants::REQUEST_METHOD_DELETE); $handlerInstance->setParam($paramInstance); + $handlerInstance->setHeader($header_map); return $handlerInstance->apiCall(ActionHandler::class, 'application/json'); } From 715be34d27849ec8c73538508dc4ced51415c742 Mon Sep 17 00:00:00 2001 From: Phil Birnie Date: Wed, 12 May 2021 08:35:18 -0400 Subject: [PATCH 2/3] Corrects updateRecord/deleteRecord method calls so that header_map is not required. --- src/com/zoho/crm/api/record/RecordOperations.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/com/zoho/crm/api/record/RecordOperations.php b/src/com/zoho/crm/api/record/RecordOperations.php index 200aa30..e33d52d 100644 --- a/src/com/zoho/crm/api/record/RecordOperations.php +++ b/src/com/zoho/crm/api/record/RecordOperations.php @@ -48,7 +48,7 @@ public function getRecord(string $id, string $moduleAPIName, ParameterMap $para * @param BodyWrapper $request An instance of BodyWrapper * @return APIResponse An instance of APIResponse */ - public function updateRecord(string $id, string $moduleAPIName, BodyWrapper $request, HeaderMap $header_map) + public function updateRecord(string $id, string $moduleAPIName, BodyWrapper $request, HeaderMap $header_map=null) { $handlerInstance=new CommonAPIHandler(); $apiPath=""; @@ -75,7 +75,7 @@ public function updateRecord(string $id, string $moduleAPIName, BodyWrapper $re * @param ParameterMap $paramInstance An instance of ParameterMap * @return APIResponse An instance of APIResponse */ - public function deleteRecord(string $id, string $moduleAPIName, ParameterMap $paramInstance=null, HeaderMap $header_map) + public function deleteRecord(string $id, string $moduleAPIName, ParameterMap $paramInstance=null, HeaderMap $header_map=null) { $handlerInstance=new CommonAPIHandler(); $apiPath=""; From caadf37589cc0d629613de9bc4dd427d945250b7 Mon Sep 17 00:00:00 2001 From: Phil Birnie Date: Wed, 12 May 2021 08:38:43 -0400 Subject: [PATCH 3/3] Moves position of setHeader method to adhere with rest of code base. --- src/com/zoho/crm/api/record/RecordOperations.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/zoho/crm/api/record/RecordOperations.php b/src/com/zoho/crm/api/record/RecordOperations.php index e33d52d..7ba2888 100644 --- a/src/com/zoho/crm/api/record/RecordOperations.php +++ b/src/com/zoho/crm/api/record/RecordOperations.php @@ -61,8 +61,8 @@ public function updateRecord(string $id, string $moduleAPIName, BodyWrapper $re $handlerInstance->setCategoryMethod(Constants::REQUEST_CATEGORY_UPDATE); $handlerInstance->setContentType('application/json'); $handlerInstance->setRequest($request); - Utility::getFields($moduleAPIName); $handlerInstance->setHeader($header_map); + Utility::getFields($moduleAPIName); $handlerInstance->setModuleAPIName($moduleAPIName); return $handlerInstance->apiCall(ActionHandler::class, 'application/json');