Skip to content

Commit

Permalink
Merge pull request #16 from Cheppers/hotfix/fix-legacy-flag-error
Browse files Browse the repository at this point in the history
Fix the legacy header flag, if legacy and non legacy requests were us…
  • Loading branch information
Roland Kovacsics authored May 22, 2020
2 parents c47f977 + 01a57fb commit e5d3b61
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/GatherContentClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ public function projectStatusGet($projectId, $statusId)
*/
public function itemsGet($projectId, $query = [])
{
$this->setUseLegacy(false);
$this->sendGet("projects/$projectId/items", ['query' => $query]);

$this->validateResponse();
Expand All @@ -330,6 +331,7 @@ public function itemsGet($projectId, $query = [])
*/
public function itemGet($itemId)
{
$this->setUseLegacy(false);
$this->sendGet("items/$itemId");

$this->validateResponse();
Expand All @@ -343,6 +345,7 @@ public function itemGet($itemId)
*/
public function itemPost($projectId, Item $item)
{
$this->setUseLegacy(false);
$item->setSkipEmptyProperties(true);
$this->sendPost("projects/$projectId/items", [
'body' => \GuzzleHttp\json_encode($item),
Expand All @@ -359,6 +362,7 @@ public function itemPost($projectId, Item $item)
*/
public function itemUpdatePost($itemId, array $content = [])
{
$this->setUseLegacy(false);
$this->sendPost("items/$itemId/content", [
'body' => \GuzzleHttp\json_encode(['content' => $content]),
]);
Expand All @@ -371,6 +375,7 @@ public function itemUpdatePost($itemId, array $content = [])
*/
public function itemRenamePost($itemId, $name)
{
$this->setUseLegacy(false);
$this->sendPost("items/$itemId/rename", [
'body' => \GuzzleHttp\json_encode(['name' => $name]),
]);
Expand All @@ -386,6 +391,7 @@ public function itemRenamePost($itemId, $name)
*/
public function itemMovePost($itemId, $position = null, $folderUuid = '')
{
$this->setUseLegacy(false);
$request = [];

if ($position !== null) {
Expand All @@ -412,6 +418,7 @@ public function itemMovePost($itemId, $position = null, $folderUuid = '')
*/
public function itemApplyTemplatePost($itemId, $templateId)
{
$this->setUseLegacy(false);
$this->sendPost("items/$itemId/apply_template", [
'body' => \GuzzleHttp\json_encode([
'template_id' => $templateId
Expand All @@ -429,6 +436,7 @@ public function itemApplyTemplatePost($itemId, $templateId)
*/
public function itemDisconnectTemplatePost($itemId)
{
$this->setUseLegacy(false);
$this->sendPost("items/$itemId/disconnect_template");

$this->validatePostResponse(200);
Expand All @@ -442,6 +450,7 @@ public function itemDisconnectTemplatePost($itemId)
*/
public function itemDuplicatePost($itemId)
{
$this->setUseLegacy(false);
$this->sendPost("items/$itemId/duplicate");

$this->validatePostResponse(200);
Expand Down Expand Up @@ -470,6 +479,7 @@ public function itemChooseStatusPost($itemId, $statusId)
*/
public function templatesGet($projectId)
{
$this->setUseLegacy(false);
$this->sendGet("projects/$projectId/templates");

$this->validateResponse();
Expand All @@ -483,6 +493,7 @@ public function templatesGet($projectId)
*/
public function templateGet($templateId)
{
$this->setUseLegacy(false);
$this->sendGet("templates/$templateId");

$this->validateResponse();
Expand All @@ -503,6 +514,7 @@ public function templateGet($templateId)
*/
public function templatePost($projectId, $name, Structure $structure)
{
$this->setUseLegacy(false);
$structure->setSkipEmptyProperties(true);
$this->sendPost("projects/$projectId/templates", [
'body' => \GuzzleHttp\json_encode([
Expand All @@ -522,6 +534,7 @@ public function templatePost($projectId, $name, Structure $structure)
*/
public function templateRenamePost($templateId, $name)
{
$this->setUseLegacy(false);
$this->sendPost("templates/$templateId/rename", [
'body' => \GuzzleHttp\json_encode(['name' => $name]),
]);
Expand All @@ -537,6 +550,7 @@ public function templateRenamePost($templateId, $name)
*/
public function templateDuplicatePost($templateId, $projectId = null)
{
$this->setUseLegacy(false);
$request = [];

if ($projectId !== null) {
Expand All @@ -558,6 +572,7 @@ public function templateDuplicatePost($templateId, $projectId = null)
*/
public function templateDelete($templateId)
{
$this->setUseLegacy(false);
$this->sendDelete("templates/$templateId");
}

Expand All @@ -566,6 +581,7 @@ public function templateDelete($templateId)
*/
public function structureGet($structureUuid)
{
$this->setUseLegacy(false);
$this->sendGet("structures/$structureUuid");

$this->validateResponse();
Expand All @@ -579,6 +595,7 @@ public function structureGet($structureUuid)
*/
public function structureAlterPut($structureUuid, Structure $structure, $priorityItemId = null)
{
$this->setUseLegacy(false);
$structure->setSkipEmptyProperties(true);
$request = [
'structure' => $structure,
Expand All @@ -603,6 +620,7 @@ public function structureAlterPut($structureUuid, Structure $structure, $priorit
*/
public function structureSaveAsTemplatePost($structureUuid, $name)
{
$this->setUseLegacy(false);
$this->sendPost("structures/$structureUuid/save_as_template", [
'body' => \GuzzleHttp\json_encode([
'name' => $name,
Expand All @@ -620,6 +638,7 @@ public function structureSaveAsTemplatePost($structureUuid, $name)
*/
public function foldersGet($projectId, $includeTrashed = false)
{
$this->setUseLegacy(false);
$this->sendGet("projects/$projectId/folders", ['query' => ['include_trashed' => $includeTrashed]]);

$this->validateResponse();
Expand All @@ -633,6 +652,7 @@ public function foldersGet($projectId, $includeTrashed = false)
*/
public function folderPost($parentFolderUuid, Folder $folder)
{
$this->setUseLegacy(false);
$folder->setSkipEmptyProperties(true);
$this->sendPost("folders/$parentFolderUuid/folders", [
'body' => \GuzzleHttp\json_encode($folder),
Expand All @@ -649,6 +669,7 @@ public function folderPost($parentFolderUuid, Folder $folder)
*/
public function folderRenamePost($folderUuid, $name)
{
$this->setUseLegacy(false);
$this->sendPost("folders/$folderUuid/rename", [
'body' => \GuzzleHttp\json_encode(['name' => $name]),
]);
Expand All @@ -664,6 +685,7 @@ public function folderRenamePost($folderUuid, $name)
*/
public function folderMovePost($folderUuid, $parentFolderUuid, $position = null)
{
$this->setUseLegacy(false);
$request = [
'parent_uuid' => $parentFolderUuid,
];
Expand All @@ -687,6 +709,7 @@ public function folderMovePost($folderUuid, $parentFolderUuid, $position = null)
*/
public function folderDelete($folderUuid)
{
$this->setUseLegacy(false);
$this->sendDelete("folders/$folderUuid");

if ($this->response->getStatusCode() === 200) {
Expand All @@ -703,6 +726,7 @@ public function folderDelete($folderUuid)
*/
public function folderRestorePost($folderUuid)
{
$this->setUseLegacy(false);
$this->sendPost("folders/$folderUuid/restore");

$this->validatePostResponse(200);
Expand Down

0 comments on commit e5d3b61

Please sign in to comment.