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 namespace MailChimp\Lists;
  3 
  4 class Interests extends Lists
  5 {
  6 
  7     /**
  8      * Get information about a list’s interest categories.
  9      *
 10      * Available query fields:
 11      * array["fields"]              array       list of strings of response fields to return
 12      * array["exclude_fields"]      array       list of strings of response fields to exclude (not to be used with "fields")
 13      * array["count"]               int         number of records to return
 14      * array["offset"]              int         number of records from a collection to skip.
 15      * array["type"]                string      Restrict results a type of interest group
 16      * @param string $list_id
 17      * @param array $query (See Above) OPTIONAL associative array of query parameters.
 18      * @return object
 19      */
 20     public function getInterestCategories($list_id, array $query = [])
 21     {
 22         return self::execute("GET", "lists/{$list_id}/interest-categories", $query);
 23     }
 24 
 25     /**
 26      * Get information about a specific interest category.
 27      *
 28      * Available query fields:
 29      * array["fields"]              array       list of strings of response fields to return
 30      * array["exclude_fields"]      array       list of strings of response fields to exclude (not to be used with "fields")
 31      * @param string $list_id
 32      * @param string $interest_category_id
 33      * @param array $query (See Above) OPTIONAL associative array of query parameters.
 34      * @return object
 35      */
 36     public function getInterestCategory($list_id, $interest_category_id, array $query = [])
 37     {
 38         return self::execute("GET", "lists/{$list_id}/interest-categories/{$interest_category_id}", $query);
 39     }
 40 
 41     /**
 42      * Create a new interest category
 43      *
 44      * array["data"]
 45      *      ["title"]           string      The text description of this category.
 46      *      ["display_order"]   int         The order that the categories are displayed in the list. Lower numbers display first.
 47      *      ["type"]            string      Determines how this category’s interests are displayed on signup forms.
 48      *                                      Possible Values: checkboxes,dropdown,radio,hidden
 49      * @param string $list_id
 50      * @param array $data
 51      * @return object
 52      */
 53      public function createInterestCategory($list_id, $title, $type, $display_order = null)
 54      {
 55         $data = [
 56             "title" => $title,
 57             "type" => $type
 58         ];
 59 
 60         if ($display_order) {
 61             $data["display_order"] = $display_order;
 62         }
 63         return self::execute("POST", "lists/{$list_id}/interest-categories", $data);
 64      }
 65 
 66      /**
 67       * Update a specific interest category.
 68       *
 69       * array["data"]
 70       *      ["title"]           string      The text description of this category.
 71       *      ["display_order"]   int         The order that the categories are displayed in the list. Lower numbers display first.
 72       *      ["type"]            string      Determines how this category’s interests are displayed on signup forms.
 73       *                                      Possible Values: checkboxes,dropdown,radio,hidden
 74       * @param string $list_id
 75       * @param string $interest_category_id
 76       * @param array $data
 77       * @return object
 78       */
 79       public function updateInterestCategory($list_id, $interest_category_id, array $data = [])
 80       {
 81          return self::execute("PATCH", "lists/{$list_id}/interest-categories/{$interest_category_id}", $data);
 82       }
 83 
 84     /**
 85      * Delete a specific interest category.
 86      *
 87      * @param string $list_id
 88      * @param string $interest_category_id
 89      */
 90     public function deleteInterestCategory($list_id, $interest_category_id)
 91     {
 92         return self::execute("DELETE", "lists/{$list_id}/interest-categories/{$interest_category_id}");
 93     }
 94 
 95     /**
 96      * Get a list of this category’s interests.
 97      *
 98      * Available query fields:
 99      * array["fields"]              array       list of strings of response fields to return
100      * array["exclude_fields"]      array       list of strings of response fields to exclude (not to be used with "fields")
101      * array["count"]               int         number of records to return
102      * array["offset"]              int         number of records from a collection to skip.
103      * @param string $list_id
104      * @param array $query (See Above) OPTIONAL associative array of query parameters.
105      * @return object
106      */
107     public function getInterests($list_id, $interest_category_id, array $query = [])
108     {
109         return self::execute("GET", "lists/{$list_id}/interest-categories/{$interest_category_id}/interests", $query);
110     }
111 
112     /**
113      * Get interests or ‘group names’ for a specific category.
114      *
115      * Available query fields:
116      * array["fields"]              array       list of strings of response fields to return
117      * array["exclude_fields"]      array       list of strings of response fields to exclude (not to be used with "fields")
118      * @param string $list_id
119      * @param string $interest_category_id
120      * @param string $interest_id
121      * @param array $query (See Above) OPTIONAL associative array of query parameters.
122      * @return object
123      */
124     public function getInterest($list_id, $interest_category_id, $interest_id, array $query = [])
125     {
126         return self::execute("GET", "lists/{$list_id}/interest-categories/{$interest_category_id}/interests/{$interest_id}", $query);
127     }
128 
129     /**
130      * Create a new interest or ‘group name’ for a specific category.
131      *
132      * array["data"]
133      *      ["name"]           string       The name of the interest.
134      * @param string $list_id
135      * @param string $interest_category_id
136      * @param array $data (See Above) OPTIONAL associative array of query parameters.
137      * @return object
138      */
139     public function createInterest($list_id, $interest_category_id, $name, $display_order = null)
140     {
141         $data = [
142             "name" => $name
143         ];
144 
145         if ($display_order !== null) {
146             $data["display_order"] = $display_order;
147         }
148         return self::execute("POST", "lists/{$list_id}/interest-categories/{$interest_category_id}/interests/", $data);
149     }
150 
151     /**
152      * Update interests or ‘group names’ for a specific category.
153      *
154      * array["data"]
155      *      ["name"]           string       The name of the interest.
156      * @param string $list_id
157      * @param string $interest_category_id
158      * @param string $interest_id
159      * @param array $data (See Above) OPTIONAL associative array of query parameters.
160      * @return object
161      */
162     public function updateInterest($list_id, $interest_category_id, $interest_id, array $data = [])
163     {
164         return self::execute("PATCH", "lists/{$list_id}/interest-categories/{$interest_category_id}/interests/{$interest_id}", $data);
165     }
166 
167 
168     /**
169      * Delete interests or group names in a specific category.
170      *
171      * @param string $list_id
172      * @param string $interest_category_id
173      * @param string $interest_id
174      * @return object
175      */
176     public function deleteInterest($list_id, $interest_category_id, $interest_id)
177     {
178         return self::execute("DELETE", "lists/{$list_id}/interest-categories/{$interest_category_id}/interests/{$interest_id}");
179     }
180 
181 
182 }
183 
API documentation generated by ApiGen