1: <?php
2:
3: class Mandrill_Tags {
4: public function __construct(Mandrill $master) {
5: $this->master = $master;
6: }
7:
8: /**
9: * Return all of the user-defined tag information
10: * @return array a list of user-defined tags
11: * - return[] struct a user-defined tag
12: * - tag string the actual tag as a string
13: * - sent integer the total number of messages sent with this tag
14: * - hard_bounces integer the total number of hard bounces by messages with this tag
15: * - soft_bounces integer the total number of soft bounces by messages with this tag
16: * - rejects integer the total number of rejected messages with this tag
17: * - complaints integer the total number of spam complaints received for messages with this tag
18: * - unsubs integer the total number of unsubscribe requests received for messages with this tag
19: * - opens integer the total number of times messages with this tag have been opened
20: * - clicks integer the total number of times tracked URLs in messages with this tag have been clicked
21: */
22: public function getList() {
23: $_params = array();
24: return $this->master->call('tags/list', $_params);
25: }
26:
27: /**
28: * Deletes a tag permanently. Deleting a tag removes the tag from any messages
29: that have been sent, and also deletes the tag's stats. There is no way to
30: undo this operation, so use it carefully.
31: * @param string $tag a tag name
32: * @return struct the tag that was deleted
33: * - tag string the actual tag as a string
34: * - sent integer the total number of messages sent with this tag
35: * - hard_bounces integer the total number of hard bounces by messages with this tag
36: * - soft_bounces integer the total number of soft bounces by messages with this tag
37: * - rejects integer the total number of rejected messages with this tag
38: * - complaints integer the total number of spam complaints received for messages with this tag
39: * - unsubs integer the total number of unsubscribe requests received for messages with this tag
40: * - opens integer the total number of times messages with this tag have been opened
41: * - clicks integer the total number of times tracked URLs in messages with this tag have been clicked
42: */
43: public function delete($tag) {
44: $_params = array("tag" => $tag);
45: return $this->master->call('tags/delete', $_params);
46: }
47:
48: /**
49: * Return more detailed information about a single tag, including aggregates of recent stats
50: * @param string $tag an existing tag name
51: * @return struct the detailed information on the tag
52: * - tag string the actual tag as a string
53: * - sent integer the total number of messages sent with this tag
54: * - hard_bounces integer the total number of hard bounces by messages with this tag
55: * - soft_bounces integer the total number of soft bounces by messages with this tag
56: * - rejects integer the total number of rejected messages with this tag
57: * - complaints integer the total number of spam complaints received for messages with this tag
58: * - unsubs integer the total number of unsubscribe requests received for messages with this tag
59: * - opens integer the total number of times messages with this tag have been opened
60: * - clicks integer the total number of times tracked URLs in messages with this tag have been clicked
61: * - stats struct an aggregate summary of the tag's sending stats
62: * - today struct stats with this tag so far today
63: * - sent integer the number of emails sent with this tag so far today
64: * - hard_bounces integer the number of emails hard bounced with this tag so far today
65: * - soft_bounces integer the number of emails soft bounced with this tag so far today
66: * - rejects integer the number of emails rejected for sending this tag so far today
67: * - complaints integer the number of spam complaints with this tag so far today
68: * - unsubs integer the number of unsubscribes with this tag so far today
69: * - opens integer the number of times emails have been opened with this tag so far today
70: * - unique_opens integer the number of unique opens for emails sent with this tag so far today
71: * - clicks integer the number of URLs that have been clicked with this tag so far today
72: * - unique_clicks integer the number of unique clicks for emails sent with this tag so far today
73: * - last_7_days struct stats with this tag in the last 7 days
74: * - sent integer the number of emails sent with this tag in the last 7 days
75: * - hard_bounces integer the number of emails hard bounced with this tag in the last 7 days
76: * - soft_bounces integer the number of emails soft bounced with this tag in the last 7 days
77: * - rejects integer the number of emails rejected for sending this tag in the last 7 days
78: * - complaints integer the number of spam complaints with this tag in the last 7 days
79: * - unsubs integer the number of unsubscribes with this tag in the last 7 days
80: * - opens integer the number of times emails have been opened with this tag in the last 7 days
81: * - unique_opens integer the number of unique opens for emails sent with this tag in the last 7 days
82: * - clicks integer the number of URLs that have been clicked with this tag in the last 7 days
83: * - unique_clicks integer the number of unique clicks for emails sent with this tag in the last 7 days
84: * - last_30_days struct stats with this tag in the last 30 days
85: * - sent integer the number of emails sent with this tag in the last 30 days
86: * - hard_bounces integer the number of emails hard bounced with this tag in the last 30 days
87: * - soft_bounces integer the number of emails soft bounced with this tag in the last 30 days
88: * - rejects integer the number of emails rejected for sending this tag in the last 30 days
89: * - complaints integer the number of spam complaints with this tag in the last 30 days
90: * - unsubs integer the number of unsubscribes with this tag in the last 30 days
91: * - opens integer the number of times emails have been opened with this tag in the last 30 days
92: * - unique_opens integer the number of unique opens for emails sent with this tag in the last 30 days
93: * - clicks integer the number of URLs that have been clicked with this tag in the last 30 days
94: * - unique_clicks integer the number of unique clicks for emails sent with this tag in the last 30 days
95: * - last_60_days struct stats with this tag in the last 60 days
96: * - sent integer the number of emails sent with this tag in the last 60 days
97: * - hard_bounces integer the number of emails hard bounced with this tag in the last 60 days
98: * - soft_bounces integer the number of emails soft bounced with this tag in the last 60 days
99: * - rejects integer the number of emails rejected for sending this tag in the last 60 days
100: * - complaints integer the number of spam complaints with this tag in the last 60 days
101: * - unsubs integer the number of unsubscribes with this tag in the last 60 days
102: * - opens integer the number of times emails have been opened with this tag in the last 60 days
103: * - unique_opens integer the number of unique opens for emails sent with this tag in the last 60 days
104: * - clicks integer the number of URLs that have been clicked with this tag in the last 60 days
105: * - unique_clicks integer the number of unique clicks for emails sent with this tag in the last 60 days
106: * - last_90_days struct stats with this tag in the last 90 days
107: * - sent integer the number of emails sent with this tag in the last 90 days
108: * - hard_bounces integer the number of emails hard bounced with this tag in the last 90 days
109: * - soft_bounces integer the number of emails soft bounced with this tag in the last 90 days
110: * - rejects integer the number of emails rejected for sending this tag in the last 90 days
111: * - complaints integer the number of spam complaints with this tag in the last 90 days
112: * - unsubs integer the number of unsubscribes with this tag in the last 90 days
113: * - opens integer the number of times emails have been opened with this tag in the last 90 days
114: * - unique_opens integer the number of unique opens for emails sent with this tag in the last 90 days
115: * - clicks integer the number of URLs that have been clicked with this tag in the last 90 days
116: * - unique_clicks integer the number of unique clicks for emails sent with this tag in the last 90 days
117: */
118: public function info($tag) {
119: $_params = array("tag" => $tag);
120: return $this->master->call('tags/info', $_params);
121: }
122:
123: /**
124: * Return the recent history (hourly stats for the last 30 days) for a tag
125: * @param string $tag an existing tag name
126: * @return array the array of history information
127: * - return[] struct the stats for a single hour
128: * - time string the hour as a UTC date string in YYYY-MM-DD HH:MM:SS format
129: * - sent integer the number of emails that were sent during the hour
130: * - hard_bounces integer the number of emails that hard bounced during the hour
131: * - soft_bounces integer the number of emails that soft bounced during the hour
132: * - rejects integer the number of emails that were rejected during the hour
133: * - complaints integer the number of spam complaints received during the hour
134: * - unsubs integer the number of unsubscribes received during the hour
135: * - opens integer the number of emails opened during the hour
136: * - unique_opens integer the number of unique opens generated by messages sent during the hour
137: * - clicks integer the number of tracked URLs clicked during the hour
138: * - unique_clicks integer the number of unique clicks generated by messages sent during the hour
139: */
140: public function timeSeries($tag) {
141: $_params = array("tag" => $tag);
142: return $this->master->call('tags/time-series', $_params);
143: }
144:
145: /**
146: * Return the recent history (hourly stats for the last 30 days) for all tags
147: * @return array the array of history information
148: * - return[] struct the stats for a single hour
149: * - time string the hour as a UTC date string in YYYY-MM-DD HH:MM:SS format
150: * - sent integer the number of emails that were sent during the hour
151: * - hard_bounces integer the number of emails that hard bounced during the hour
152: * - soft_bounces integer the number of emails that soft bounced during the hour
153: * - rejects integer the number of emails that were rejected during the hour
154: * - complaints integer the number of spam complaints received during the hour
155: * - unsubs integer the number of unsubscribes received during the hour
156: * - opens integer the number of emails opened during the hour
157: * - unique_opens integer the number of unique opens generated by messages sent during the hour
158: * - clicks integer the number of tracked URLs clicked during the hour
159: * - unique_clicks integer the number of unique clicks generated by messages sent during the hour
160: */
161: public function allTimeSeries() {
162: $_params = array();
163: return $this->master->call('tags/all-time-series', $_params);
164: }
165:
166: }
167:
168:
169: