# File Mandrill/Users.php

      1: <?php
      2:
      3: class Mandrill_Users {
      4:     public function __construct(Mandrill $master) {
      5:         $this->master = $master;
      6:     }
      7:
      8:     /**
      9:      * Return the information about the API-connected user
     10:      * @return struct the user information including username, key, reputation, quota, and historical sending stats
     11:      *     - username string the username of the user (used for SMTP authentication)
     12:      *     - created_at string the date and time that the user's Mandrill account was created as a UTC string in YYYY-MM-DD HH:MM:SS format
     13:      *     - public_id string a unique, permanent identifier for this user
     14:      *     - reputation integer the reputation of the user on a scale from 0 to 100, with 75 generally being a "good" reputation
     15:      *     - hourly_quota integer the maximum number of emails Mandrill will deliver for this user each hour.  Any emails beyond that will be accepted and queued for later delivery.  Users with higher reputations will have higher hourly quotas
     16:      *     - backlog integer the number of emails that are queued for delivery due to exceeding your monthly or hourly quotas
     17:      *     - stats struct an aggregate summary of the account's sending stats
     18:      *         - today struct stats for this user so far today
     19:      *             - sent integer the number of emails sent for this user so far today
     20:      *             - hard_bounces integer the number of emails hard bounced for this user so far today
     21:      *             - soft_bounces integer the number of emails soft bounced for this user so far today
     22:      *             - rejects integer the number of emails rejected for sending this user so far today
     23:      *             - complaints integer the number of spam complaints for this user so far today
     24:      *             - unsubs integer the number of unsubscribes for this user so far today
     25:      *             - opens integer the number of times emails have been opened for this user so far today
     26:      *             - unique_opens integer the number of unique opens for emails sent for this user so far today
     27:      *             - clicks integer the number of URLs that have been clicked for this user so far today
     28:      *             - unique_clicks integer the number of unique clicks for emails sent for this user so far today
     29:      *         - last_7_days struct stats for this user in the last 7 days
     30:      *             - sent integer the number of emails sent for this user in the last 7 days
     31:      *             - hard_bounces integer the number of emails hard bounced for this user in the last 7 days
     32:      *             - soft_bounces integer the number of emails soft bounced for this user in the last 7 days
     33:      *             - rejects integer the number of emails rejected for sending this user in the last 7 days
     34:      *             - complaints integer the number of spam complaints for this user in the last 7 days
     35:      *             - unsubs integer the number of unsubscribes for this user in the last 7 days
     36:      *             - opens integer the number of times emails have been opened for this user in the last 7 days
     37:      *             - unique_opens integer the number of unique opens for emails sent for this user in the last 7 days
     38:      *             - clicks integer the number of URLs that have been clicked for this user in the last 7 days
     39:      *             - unique_clicks integer the number of unique clicks for emails sent for this user in the last 7 days
     40:      *         - last_30_days struct stats for this user in the last 30 days
     41:      *             - sent integer the number of emails sent for this user in the last 30 days
     42:      *             - hard_bounces integer the number of emails hard bounced for this user in the last 30 days
     43:      *             - soft_bounces integer the number of emails soft bounced for this user in the last 30 days
     44:      *             - rejects integer the number of emails rejected for sending this user in the last 30 days
     45:      *             - complaints integer the number of spam complaints for this user in the last 30 days
     46:      *             - unsubs integer the number of unsubscribes for this user in the last 30 days
     47:      *             - opens integer the number of times emails have been opened for this user in the last 30 days
     48:      *             - unique_opens integer the number of unique opens for emails sent for this user in the last 30 days
     49:      *             - clicks integer the number of URLs that have been clicked for this user in the last 30 days
     50:      *             - unique_clicks integer the number of unique clicks for emails sent for this user in the last 30 days
     51:      *         - last_60_days struct stats for this user in the last 60 days
     52:      *             - sent integer the number of emails sent for this user in the last 60 days
     53:      *             - hard_bounces integer the number of emails hard bounced for this user in the last 60 days
     54:      *             - soft_bounces integer the number of emails soft bounced for this user in the last 60 days
     55:      *             - rejects integer the number of emails rejected for sending this user in the last 60 days
     56:      *             - complaints integer the number of spam complaints for this user in the last 60 days
     57:      *             - unsubs integer the number of unsubscribes for this user in the last 60 days
     58:      *             - opens integer the number of times emails have been opened for this user in the last 60 days
     59:      *             - unique_opens integer the number of unique opens for emails sent for this user in the last 60 days
     60:      *             - clicks integer the number of URLs that have been clicked for this user in the last 60 days
     61:      *             - unique_clicks integer the number of unique clicks for emails sent for this user in the last 60 days
     62:      *         - last_90_days struct stats for this user in the last 90 days
     63:      *             - sent integer the number of emails sent for this user in the last 90 days
     64:      *             - hard_bounces integer the number of emails hard bounced for this user in the last 90 days
     65:      *             - soft_bounces integer the number of emails soft bounced for this user in the last 90 days
     66:      *             - rejects integer the number of emails rejected for sending this user in the last 90 days
     67:      *             - complaints integer the number of spam complaints for this user in the last 90 days
     68:      *             - unsubs integer the number of unsubscribes for this user in the last 90 days
     69:      *             - opens integer the number of times emails have been opened for this user in the last 90 days
     70:      *             - unique_opens integer the number of unique opens for emails sent for this user in the last 90 days
     71:      *             - clicks integer the number of URLs that have been clicked for this user in the last 90 days
     72:      *             - unique_clicks integer the number of unique clicks for emails sent for this user in the last 90 days
     73:      *         - all_time struct stats for the lifetime of the user's account
     74:      *             - sent integer the number of emails sent in the lifetime of the user's account
     75:      *             - hard_bounces integer the number of emails hard bounced in the lifetime of the user's account
     76:      *             - soft_bounces integer the number of emails soft bounced in the lifetime of the user's account
     77:      *             - rejects integer the number of emails rejected for sending this user so far today
     78:      *             - complaints integer the number of spam complaints in the lifetime of the user's account
     79:      *             - unsubs integer the number of unsubscribes in the lifetime of the user's account
     80:      *             - opens integer the number of times emails have been opened in the lifetime of the user's account
     81:      *             - unique_opens integer the number of unique opens for emails sent in the lifetime of the user's account
     82:      *             - clicks integer the number of URLs that have been clicked in the lifetime of the user's account
     83:      *             - unique_clicks integer the number of unique clicks for emails sent in the lifetime of the user's account
     84:      */
     85:     public function info() {
     86:         $_params = array();
     87:         return $this->master->call('users/info', $_params);
     88:     }
     89:
     90:     /**
     91:      * Validate an API key and respond to a ping
     92:      * @return string the string "PONG!"
     93:      */
     94:     public function ping() {
     95:         $_params = array();
     96:         return $this->master->call('users/ping', $_params);
     97:     }
     98:
     99:     /**
    100:      * Validate an API key and respond to a ping (anal JSON parser version)
    101:      * @return struct a struct with one key "PING" with a static value "PONG!"
    102:      */
    103:     public function ping2() {
    104:         $_params = array();
    105:         return $this->master->call('users/ping2', $_params);
    106:     }
    107:
    108:     /**
    109:      * Return the senders that have tried to use this account, both verified and unverified
    110:      * @return array an array of sender data, one for each sending addresses used by the account
    111:      *     - return[] struct the information on each sending address in the account
    112:      *         - address string the sender's email address
    113:      *         - created_at string the date and time that the sender was first seen by Mandrill as a UTC date string in YYYY-MM-DD HH:MM:SS format
    114:      *         - sent integer the total number of messages sent by this sender
    115:      *         - hard_bounces integer the total number of hard bounces by messages by this sender
    116:      *         - soft_bounces integer the total number of soft bounces by messages by this sender
    117:      *         - rejects integer the total number of rejected messages by this sender
    118:      *         - complaints integer the total number of spam complaints received for messages by this sender
    119:      *         - unsubs integer the total number of unsubscribe requests received for messages by this sender
    120:      *         - opens integer the total number of times messages by this sender have been opened
    121:      *         - clicks integer the total number of times tracked URLs in messages by this sender have been clicked
    122:      *         - unique_opens integer the number of unique opens for emails sent for this sender
    123:      *         - unique_clicks integer the number of unique clicks for emails sent for this sender
    124:      */
    125:     public function senders() {
    126:         $_params = array();
    127:         return $this->master->call('users/senders', $_params);
    128:     }
    129:
    130: }
    131:
    132:
    133: