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