/classes/mailchimp/Mailchimp/Users.php

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