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 recipient
31 * entries. Instances of this class can be provided in many places where a
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_EmailListRecipientQuery extends Zend_Gdata_Gapps_Query
47 * If not null, specifies the name of the email list which
48 * should be requested 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 $startRecipient (optional) Value for the
62 * startRecipient property.
64 public function __construct($domain = null, $emailListName = null,
65 $startRecipient = null)
67 parent::__construct($domain);
68 $this->setEmailListName($emailListName);
69 $this->setStartRecipient($startRecipient);
73 * Set the email list name to query for. When set, only lists with a name
74 * matching this value will be returned in search results. Set to
75 * null to disable filtering by list name.
77 * @param string $value The email list name to filter search results by,
80 public function setEmailListName($value)
82 $this->_emailListName = $value;
86 * Get the email list name to query for. If no name is set, null will be
89 * @param string $value The email list name to filter search results by,
90 * or null if disabled.
92 public function getEmailListName()
94 return $this->_emailListName;
98 * Set the first recipient which should be displayed when retrieving
99 * a list of email list recipients.
101 * @param string $value The first recipient to be returned, or null to
104 public function setStartRecipient($value)
106 if ($value !== null) {
107 $this->_params['startRecipient'] = $value;
109 unset($this->_params['startRecipient']);
114 * Get the first recipient which should be displayed when retrieving
115 * a list of email list recipients.
117 * @return string The first recipient to be returned, or null if
120 public function getStartRecipient()
122 if (array_key_exists('startRecipient', $this->_params)) {
123 return $this->_params['startRecipient'];
130 * Returns the URL generated for this query, based on it's current
133 * @return string A URL generated based on the state of this query.
134 * @throws Zend_Gdata_App_InvalidArgumentException
136 public function getQueryUrl()
139 $uri = $this->getBaseUrl();
140 $uri .= Zend_Gdata_Gapps::APPS_EMAIL_LIST_PATH;
141 if ($this->_emailListName !== null) {
142 $uri .= '/' . $this->_emailListName;
144 require_once 'Zend/Gdata/App/InvalidArgumentException.php';
145 throw new Zend_Gdata_App_InvalidArgumentException(
146 'EmailListName must not be null');
148 $uri .= Zend_Gdata_Gapps::APPS_EMAIL_LIST_RECIPIENT_POSTFIX . '/';
149 $uri .= $this->getQueryString();