Skip to content

Commit

Permalink
Merge pull request #19 from SykesCottagesDev/replace-transactional-data
Browse files Browse the repository at this point in the history
Replace transactional data
  • Loading branch information
romanpitak committed Sep 14, 2015
2 parents f86da94 + cbbcf16 commit 7fa4151
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/Resources/IResources.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
use DotMailer\Api\DataTypes\ApiImage;
use DotMailer\Api\DataTypes\ApiImageFolder;
use DotMailer\Api\DataTypes\ApiImageFolderList;
use DotMailer\Api\DataTypes\ApiJsonData;
use DotMailer\Api\DataTypes\ApiProgram;
use DotMailer\Api\DataTypes\ApiProgramList;
use DotMailer\Api\DataTypes\ApiProgramEnrolment;
Expand Down Expand Up @@ -675,14 +676,25 @@ public function GetContactsSuppressedSinceDate($date, $select = 1000, $skip = 0)
* Adds a single piece of transactional data to a contact.
*
* /contacts/transactional-data/{collectionName}
* todo maybe look at contacts/transactional-data/{collectionName}/{key}
*
* @param string|XsString $collectionName
* @param ApiTransactionalData $apiTransactionalData
* @return ApiTransactionalData
*/
public function PostContactsTransactionalData($collectionName, ApiTransactionalData $apiTransactionalData);

/**
* Replaces a piece of transactional data by key (logical equivalent to a delete and an insert).
*
* /contacts/transactional-data/{collectionName}/{key}
*
* @param string|XsString $collectionName
* @param int|XsInt $importId
* @param ApiJsonData $apiJsonData
* @return ApiTransactionalData
*/
public function PostContactsTransactionalDataUpdate($collectionName, $importId, ApiJsonData $apiJsonData);

/**
* Deletes a piece of transactional data by key.
*
Expand Down
7 changes: 7 additions & 0 deletions src/Resources/Resources.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
use DotMailer\Api\DataTypes\ApiImage;
use DotMailer\Api\DataTypes\ApiImageFolder;
use DotMailer\Api\DataTypes\ApiImageFolderList;
use DotMailer\Api\DataTypes\ApiJsonData;
use DotMailer\Api\DataTypes\ApiProgram;
use DotMailer\Api\DataTypes\ApiProgramList;
use DotMailer\Api\DataTypes\ApiProgramEnrolment;
Expand Down Expand Up @@ -473,6 +474,12 @@ public function PostContactsTransactionalData($collectionName, ApiTransactionalD
return new ApiTransactionalData($this->execute($url, 'POST', $apiTransactionalData->toJson()));
}

public function PostContactsTransactionalDataUpdate($collectionName, $importId, ApiJsonData $apiJsonData)
{
$url = sprintf("contacts/transactional-data/%s/%s", $collectionName, $importId);
return new ApiTransactionalData($this->execute($url, 'POST', $apiJsonData->toJson()));
}

public function DeleteContactsTransactionalData($collectionName, $key)
{
$url = sprintf("contacts/transactional-data/%s/%s", $collectionName, $key);
Expand Down

0 comments on commit 7fa4151

Please sign in to comment.