Overview
  • Namespace
  • Class

Namespaces

  • MailChimp
    • AuthorizedApps
    • Automations
    • Batches
    • CampaignFolders
    • Campaigns
    • Conversations
    • Ecommerce
    • FileManager
    • Lists
    • Reports
    • TemplateFolders
    • Templates

Classes

  • MailChimp\AuthorizedApps\AuthorizedApps
  • MailChimp\Automations\Automations
  • MailChimp\Batches\Batches
  • MailChimp\CampaignFolders\CampaignFolders
  • MailChimp\Campaigns\Campaigns
  • MailChimp\Campaigns\Content
  • MailChimp\Campaigns\Feedback
  • MailChimp\Conversations\Conversations
  • MailChimp\Ecommerce\Carts
  • MailChimp\Ecommerce\Customers
  • MailChimp\Ecommerce\Ecommerce
  • MailChimp\Ecommerce\Orders
  • MailChimp\Ecommerce\Products
  • MailChimp\FileManager\Files
  • MailChimp\FileManager\Folders
  • MailChimp\Lists\Interests
  • MailChimp\Lists\Lists
  • MailChimp\Lists\Members
  • MailChimp\Lists\MergeFields
  • MailChimp\Lists\Segments
  • MailChimp\Lists\SignupForms
  • MailChimp\Lists\Webhooks
  • MailChimp\MailChimp
  • MailChimp\Reports\Reports
  • MailChimp\TemplateFolders\TemplateFolders
  • MailChimp\Templates\Templates
  1 <?php
  2 
  3 namespace MailChimp\Templates;
  4 
  5 use MailChimp\MailChimp as MailChimp;
  6 
  7 class Templates extends MailChimp
  8 {
  9 
 10     /**
 11      * Get a list of templates for the account
 12      *
 13      * Available query fields:
 14      * array["fields"]              array       list of strings of response fields to return
 15      * array["exclude_fields"]      array       list of strings of response fields to exclude (not to be used with "fields")
 16      * array["count"]               int         number of records to return
 17      * array["offset"]              int         number of records from a collection to skip.
 18      * array["folder_id"]           string      Filter results by a specific campaign folder.
 19      * array["type"]                string      The campaign type.
 20      *                                          Possible values: regular,plaintext,absplit,rss,variate
 21      * array["status"]              string      The status of the campaign.
 22      *                                          Possible Values: save,paused,schedule,sending,sent
 23      * array["before_send_time"]    string      Restrict the response to campaigns sent before the set time.
 24      *                                          ISO 8601 time format: 2015-10-21T15:41:36+00:00.
 25      * array["since_send_time"]     string      Restrict the response to campaigns sent after the set time.
 26      *                                          ISO 8601 time format: 2015-10-21T15:41:36+00:00.
 27      * array["before_create_time"]  string      Restrict the response to campaigns sent after the set time.
 28      *                                          ISO 8601 time format: 2015-10-21T15:41:36+00:00.
 29      * array["since_create_time"]   string      Restrict the response to campaigns created after the set time.
 30      *                                          ISO 8601 time format: 2015-10-21T15:41:36+00:00.
 31      *
 32      * @param array $query (See Above) OPTIONAL associative array of query parameters.
 33      * @return object
 34      */
 35     public function getTemplates(array $query = [])
 36     {
 37         return self::execute("GET", "templates", $query);
 38     }
 39 
 40     /**
 41      * Get a list of campaigns for the account
 42      *
 43      * Available query fields:
 44      * array["fields"]              array       list of strings of response fields to return
 45      * array["exclude_fields"]      array       list of strings of response fields to exclude (not to be used with "fields")
 46      *
 47      * @param int template id
 48      * @param array $query (See Above) OPTIONAL associative array of query parameters.
 49      * @return object
 50      */
 51     public function getTemplate($template_id, array $query = [])
 52     {
 53         return self::execute("GET", "templates/{$template_id}", $query);
 54     }
 55 
 56     /**
 57      * Get a list of campaigns for the account
 58      *
 59      * Available query fields:
 60      * array["fields"]              array       list of strings of response fields to return
 61      * array["exclude_fields"]      array       list of strings of response fields to exclude (not to be used with "fields")
 62      *
 63      * @param int template id
 64      * @param array $query (See Above) OPTIONAL associative array of query parameters.
 65      * @return object
 66      */
 67     public function getDefaultContent($template_id, array $query = [])
 68     {
 69         return self::execute("GET", "templates/{$template_id}/default-content", $query);
 70     }
 71 
 72     /**
 73      * Upload a new image or file to the File Manager.
 74      *
 75      * @param string $name
 76      * @param string $html
 77      * @param int  (optional) $folder_id
 78      * @return object
 79      */
 80     public function createTemplate($name, $html, $folder_id = null)
 81     {
 82         $data = [
 83             "name" => $name,
 84             "html" => $html
 85         ];
 86 
 87         if ($folder_id) {
 88             $data["folder_id"] = $folder_id;
 89         }
 90 
 91         return self::execute("POST", "templates", $data);
 92     }
 93 
 94     /**
 95      * Update an existing template
 96      *
 97      * @param int template id
 98      * @param array data
 99      * @return object
100      */
101     public function updateTemplate($template_id, array $data = [])
102     {
103         return self::execute("PATCH", "templates/{$template_id}", $data);
104     }
105 
106     /**
107      * Update an existing template
108      *
109      * @param int Template id
110      */
111     public function deleteTemplate($template_id)
112     {
113         return self::execute("DELETE", "templates/{$template_id}");
114     }
115 
116 }
117 
API documentation generated by ApiGen