Skip to content

Commit

Permalink
Merge pull request #27 from anthonyptetlow/additional_api_methods
Browse files Browse the repository at this point in the history
Additional API Funcitons
  • Loading branch information
dchesterton committed Dec 2, 2015
2 parents 1277729 + 9a54ebb commit 839281b
Show file tree
Hide file tree
Showing 5 changed files with 150 additions and 0 deletions.
55 changes: 55 additions & 0 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,61 @@ public function getLeadChanges($nextPageToken, $fields, $args = array(), $return
return $this->getResult('getLeadChanges', $args, true, $returnRaw);
}

/**
* Update an editable section in an email
*
* @param int $emailId
* @param string $htmlId
* @param array $args
*
* @link http://developers.marketo.com/documentation/asset-api/update-email-content-by-id/
*
* @return Response
*/
public function updateEmailContent($emailId, $args = array(), $returnRaw = false)
{
$args['id'] = $emailId;

return $this->getResult('updateEmailContent', $args, false, $returnRaw);
}

/**
* Update an editable section in an email
*
* @param int $emailId
* @param string $htmlId
* @param array $args
*
* @link http://developers.marketo.com/documentation/asset-api/update-email-content-in-editable-section/
*
* @return UpdateEmailContentInEditableSectionResponse
*/
public function updateEmailContentInEditableSection($emailId, $htmlId, $args = array(), $returnRaw = false)
{
$args['id'] = $emailId;
$args['htmlId'] = $htmlId;

return $this->getResult('updateEmailContentInEditableSection', $args, false, $returnRaw);
}

/**
* Approve an email
*
* @param int $emailId
* @param string $htmlId
* @param array $args
*
* @link http://developers.marketo.com/documentation/asset-api/approve-email-by-id/
*
* @return approveEmail
*/
public function approveEmail($emailId, $args = array(), $returnRaw = false)
{
$args['id'] = $emailId;

return $this->getResult('approveEmailbyId', $args, false, $returnRaw);
}

/**
* Internal helper method to actually perform command.
*
Expand Down
22 changes: 22 additions & 0 deletions src/Response/ApproveEmailResponse.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

/*
* This file is part of the Marketo REST API Client package.
*
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace CSD\Marketo\Response;

use CSD\Marketo\Response;

/**
* Response for the create/update lead API methods.
*
*/
class ApproveEmailResponse extends Response
{

}
21 changes: 21 additions & 0 deletions src/Response/UpdateEmailContentInEditableSectionResponse.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php
/*
* This file is part of the Marketo REST API Client package.
*
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace CSD\Marketo\Response;

use CSD\Marketo\Response;

/**
* Response for the email content in editable section API method.
*
*/
class UpdateEmailContentInEditableSectionResponse extends Response
{

}
21 changes: 21 additions & 0 deletions src/Response/UpdateEmailContentReponse.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php
/*
* This file is part of the Marketo REST API Client package.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace CSD\Marketo\Response;

use CSD\Marketo\Response;

/**
* Response for the update email content API method.
*
*/
class UpdateEmailContentReponse extends Response
{

}

31 changes: 31 additions & 0 deletions src/service.json
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,37 @@
"uri": "leads/partitions.json",
"parameters": {},
"responseClass": "CSD\\Marketo\\Response\\GetLeadPartitionsResponse"
},
"updateEmailContent": {
"httpMethod": "POST",
"uri": "/rest/asset/v1/email/{id}/content.json",
"parameters": {
"id": {"location": "uri"},
"subject": {"location": "query"},
"fromEmail": {"location": "query"},
"fromName": {"location": "query"},
"replyTo": {"location": "query"}
},
"responseClass": "CSD\\Marketo\\Response\\UpdateEmailContentReponse"
},
"updateEmailContentInEditableSection": {
"httpMethod": "POST",
"uri": "/rest/asset/v1/email/{id}/content/{htmlId}.json",
"parameters": {
"id": {"location": "uri"},
"htmlId": {"location": "uri"},
"type": {"location": "query"},
"value": {"location": "query"}
},
"responseClass": "CSD\\Marketo\\Response\\UpdateEmailContentInEditableSectionResponse"
},
"approveEmailbyId": {
"httpMethod": "POST",
"uri": "/rest/asset/v1/email/{id}/approveDraft.json",
"parameters": {
"id": {"location": "uri"}
},
"responseClass": "CSD\\Marketo\\Response\\ApproveEmailResponse"
}
}
}

0 comments on commit 839281b

Please sign in to comment.