      1: <?php
      2:
      3: class Mailchimp_Vip {
      4:     public function __construct(Mailchimp $master) {
      5:         $this->master = $master;
      6:     }
      7:
      8:     /**
      9:      * Retrieve all Activity (opens/clicks) for VIPs over the past 10 days
     10:      * @return array structs for each activity recorded.
     11:      *     - action string The action taken - either "open" or "click"
     12:      *     - timestamp string The datetime the action occurred in GMT
     13:      *     - url string IF the action is a click, the url that was clicked
     14:      *     - unique_id string The campaign_id of the List the Member appears on
     15:      *     - title string The campaign title
     16:      *     - list_name string The name of the List the Member appears on
     17:      *     - list_id string The id of the List the Member appears on
     18:      *     - email string The email address of the member
     19:      *     - fname string IF a FNAME merge field exists on the list, that value for the member
     20:      *     - lname string IF a LNAME merge field exists on the list, that value for the member
     21:      *     - member_rating int the rating of the subscriber. This will be 1 - 5 as described <a href="http://eepurl.com/f-2P" target="_blank">here</a>
     22:      *     - member_since string the datetime the member was added and/or confirmed
     23:      *     - geo associative_array the geographic information if we have it. including:
     24:      *         - latitude string the latitude
     25:      *         - longitude string the longitude
     26:      *         - gmtoff string GMT offset
     27:      *         - dstoff string GMT offset during daylight savings (if DST not observered, will be same as gmtoff
     28:      *         - timezone string the timezone we've place them in
     29:      *         - cc string 2 digit ISO-3166 country code
     30:      *         - region string generally state, province, or similar
     31:      */
     32:     public function activity() {
     33:         $_params = array();
     34:         return $this->master->call('vip/activity', $_params);
     35:     }
     36:
     37:     /**
     38:      * Add VIPs (previously called Golden Monkeys)
     39:      * @param string $id
     40:      * @param array $emails
     41:      *     - email string an email address - for new subscribers obviously this should be used
     42:      *     - euid string the unique id for an email address (not list related) - the email "id" returned from listMemberInfo, Webhooks, Campaigns, etc.
     43:      *     - leid string the list email id (previously called web_id) for a list-member-info type call. this doesn't change when the email address changes
     44:      * @return associative_array of data and success/error counts
     45:      *     - success_count int the number of successful adds
     46:      *     - error_count int the number of unsuccessful adds
     47:      *     - errors array array of error structs including:
     48:      *         - email associative_array whatever was passed in the email parameter
     49:      *             - email string the email address added
     50:      *             - euid string the email unique id
     51:      *             - leid string the list member's truly unique id
     52:      *         - code string the error code
     53:      *         - error string the error message
     54:      *     - data array array of structs for each member added
     55:      *         - email associative_array whatever was passed in the email parameter
     56:      *             - email string the email address added
     57:      *             - euid string the email unique id
     58:      *             - leid string the list member's truly unique id
     59:      */
     60:     public function add($id, $emails) {
     61:         $_params = array("id" => $id, "emails" => $emails);
     62:         return $this->master->call('vip/add', $_params);
     63:     }
     64:
     65:     /**
     66:      * Remove VIPs - this does not affect list membership
     67:      * @param string $id
     68:      * @param array $emails
     69:      *     - email string an email address - for new subscribers obviously this should be used
     70:      *     - euid string the unique id for an email address (not list related) - the email "id" returned from listMemberInfo, Webhooks, Campaigns, etc.
     71:      *     - leid string the list email id (previously called web_id) for a list-member-info type call. this doesn't change when the email address changes
     72:      * @return associative_array of data and success/error counts
     73:      *     - success_count int the number of successful deletions
     74:      *     - error_count int the number of unsuccessful deletions
     75:      *     - errors array array of error structs including:
     76:      *         - email associative_array whatever was passed in the email parameter
     77:      *             - email string the email address
     78:      *             - euid string the email unique id
     79:      *             - leid string the list member's truly unique id
     80:      *         - code string the error code
     81:      *         - msg string the error message
     82:      *     - data array array of structs for each member deleted
     83:      *         - email associative_array whatever was passed in the email parameter
     84:      *             - email string the email address
     85:      *             - euid string the email unique id
     86:      *             - leid string the list member's truly unique id
     87:      */
     88:     public function del($id, $emails) {
     89:         $_params = array("id" => $id, "emails" => $emails);
     90:         return $this->master->call('vip/del', $_params);
     91:     }
     92:
     93:     /**
     94:      * Retrieve all Golden Monkey(s) for an account
     95:      * @return array structs for each Golden Monkey, including:
     96:      *     - list_id string The id of the List the Member appears on
     97:      *     - list_name string The name of the List the Member appears on
     98:      *     - email string The email address of the member
     99:      *     - fname string IF a FNAME merge field exists on the list, that value for the member
    100:      *     - lname string IF a LNAME merge field exists on the list, that value for the member
    101:      *     - member_rating int the rating of the subscriber. This will be 1 - 5 as described <a href="http://eepurl.com/f-2P" target="_blank">here</a>
    102:      *     - member_since string the datetime the member was added and/or confirmed
    103:      */
    104:     public function members() {
    105:         $_params = array();
    106:         return $this->master->call('vip/members', $_params);
    107:     }
    108:
    109: }
    110:
    111:
    112: