8 * This source file is subject to the new BSD license that is bundled
9 * with this package in the file LICENSE.txt.
10 * It is also available through the world-wide-web at this URL:
11 * http://framework.zend.com/license/new-bsd
12 * If you did not receive a copy of the license and are unable to
13 * obtain it through the world-wide-web, please send an email
14 * to license@zend.com so we can send you a copy immediately.
19 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
20 * @license http://framework.zend.com/license/new-bsd New BSD License
25 * @see Zend_Gdata_Gapps_Query
27 require_once('Zend/Gdata/Gapps/Query.php');
30 * Assists in constructing queries for Google Apps email list entries.
31 * Instances of this class can be provided in many places where a URL is
34 * For information on submitting queries to a server, see the Google Apps
35 * service class, Zend_Gdata_Gapps.
40 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
41 * @license http://framework.zend.com/license/new-bsd New BSD License
43 class Zend_Gdata_Gapps_EmailListQuery extends Zend_Gdata_Gapps_Query
47 * A string which, if not null, indicates which email list should
48 * be retrieved by this query.
52 protected $_emailListName = null;
55 * Create a new instance.
57 * @param string $domain (optional) The Google Apps-hosted domain to use
58 * when constructing query URIs.
59 * @param string $emailListName (optional) Value for the emailListName
61 * @param string $recipient (optional) Value for the recipient
63 * @param string $startEmailListName (optional) Value for the
64 * startEmailListName property.
66 public function __construct($domain = null, $emailListName = null,
67 $recipient = null, $startEmailListName = null)
69 parent::__construct($domain);
70 $this->setEmailListName($emailListName);
71 $this->setRecipient($recipient);
72 $this->setStartEmailListName($startEmailListName);
76 * Set the email list name to query for. When set, only lists with a name
77 * matching this value will be returned in search results. Set to
78 * null to disable filtering by list name.
80 * @param string $value The email list name to filter search results by,
83 public function setEmailListName($value)
85 $this->_emailListName = $value;
89 * Get the email list name to query for. If no name is set, null will be
92 * @see setEmailListName
93 * @return string The email list name to filter search results by, or null
96 public function getEmailListName()
98 return $this->_emailListName;
102 * Set the recipient to query for. When set, only subscribers with an
103 * email address matching this value will be returned in search results.
104 * Set to null to disable filtering by username.
106 * @param string $value The recipient email address to filter search
107 * results by, or null to disable.
109 public function setRecipient($value)
111 if ($value !== null) {
112 $this->_params['recipient'] = $value;
115 unset($this->_params['recipient']);
120 * Get the recipient email address to query for. If no recipient is set,
121 * null will be returned.
124 * @return string The recipient email address to filter search results by,
125 * or null if disabled.
127 public function getRecipient()
129 if (array_key_exists('recipient', $this->_params)) {
130 return $this->_params['recipient'];
137 * Set the first email list which should be displayed when retrieving
138 * a list of email lists.
140 * @param string $value The first email list to be returned, or null to
143 public function setStartEmailListName($value)
145 if ($value !== null) {
146 $this->_params['startEmailListName'] = $value;
148 unset($this->_params['startEmailListName']);
153 * Get the first email list which should be displayed when retrieving
154 * a list of email lists.
156 * @return string The first email list to be returned, or null to
159 public function getStartEmailListName()
161 if (array_key_exists('startEmailListName', $this->_params)) {
162 return $this->_params['startEmailListName'];
169 * Returns the URL generated for this query, based on it's current
172 * @return string A URL generated based on the state of this query.
173 * @throws Zend_Gdata_App_InvalidArgumentException
175 public function getQueryUrl()
178 $uri = $this->getBaseUrl();
179 $uri .= Zend_Gdata_Gapps::APPS_EMAIL_LIST_PATH;
180 if ($this->_emailListName !== null) {
181 $uri .= '/' . $this->_emailListName;
183 $uri .= $this->getQueryString();