1: <?php
2:
3: class Mailchimp_Users {
4: public function __construct(Mailchimp $master) {
5: $this->master = $master;
6: }
7:
8: /**
9: * Invite a user to your account
10: * @param string $email
11: * @param string $role
12: * @param string $msg
13: * @return associative_array the method completion status
14: * - status string The status (success) of the call if it completed. Otherwise an error is thrown.
15: */
16: public function invite($email, $role='viewer', $msg='') {
17: $_params = array("email" => $email, "role" => $role, "msg" => $msg);
18: return $this->master->call('users/invite', $_params);
19: }
20:
21: /**
22: * Resend an invite a user to your account. Note, if the same address has been invited multiple times, this will simpy re-send the most recent invite
23: * @param string $email
24: * @return associative_array the method completion status
25: * - status string The status (success) of the call if it completed. Otherwise an error is thrown.
26: */
27: public function inviteResend($email) {
28: $_params = array("email" => $email);
29: return $this->master->call('users/invite-resend', $_params);
30: }
31:
32: /**
33: * Revoke an invitation sent to a user to your account. Note, if the same address has been invited multiple times, this will simpy revoke the most recent invite
34: * @param string $email
35: * @return associative_array the method completion status
36: * - status string The status (success) of the call if it completed. Otherwise an error is thrown.
37: */
38: public function inviteRevoke($email) {
39: $_params = array("email" => $email);
40: return $this->master->call('users/invite-revoke', $_params);
41: }
42:
43: /**
44: * Retrieve the list of pending users invitations have been sent for.
45: * @return array structs for each invitation, including:
46: * - email string the email address the invitation was sent to
47: * - role string the role that will be assigned if they accept
48: * - sent_at string the time the invitation was sent. this will change if it's resent.
49: * - expiration string the expiration time for the invitation. this will change if it's resent.
50: * - msg string the welcome message included with the invitation
51: */
52: public function invites() {
53: $_params = array();
54: return $this->master->call('users/invites', $_params);
55: }
56:
57: /**
58: * Revoke access for a specified login
59: * @param string $username
60: * @return associative_array the method completion status
61: * - status string The status (success) of the call if it completed. Otherwise an error is thrown.
62: */
63: public function loginRevoke($username) {
64: $_params = array("username" => $username);
65: return $this->master->call('users/login-revoke', $_params);
66: }
67:
68: /**
69: * Retrieve the list of active logins.
70: * @return array structs for each user, including:
71: * - id int the login id for this login
72: * - username string the username used to log in
73: * - name string a display name for the account - empty first/last names will return the username
74: * - email string the email tied to the account used for passwords resets and the ilk
75: * - role string the role assigned to the account
76: * - avatar string if available, the url for the login's avatar
77: */
78: public function logins() {
79: $_params = array();
80: return $this->master->call('users/logins', $_params);
81: }
82:
83: /**
84: * Retrieve the profile for the login owning the provided API Key
85: * @return associative_array the current user's details, including:
86: * - id int the login id for this login
87: * - username string the username used to log in
88: * - name string a display name for the account - empty first/last names will return the username
89: * - email string the email tied to the account used for passwords resets and the ilk
90: * - role string the role assigned to the account
91: * - avatar string if available, the url for the login's avatar
92: */
93: public function profile() {
94: $_params = array();
95: return $this->master->call('users/profile', $_params);
96: }
97:
98: }
99:
100:
101: