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-2009 Zend Technologies USA Inc. (http://www.zend.com)
20 * @license http://framework.zend.com/license/new-bsd New BSD License
24 * @see Zend_Gdata_Gapps_Query
26 require_once('Zend/Gdata/Gapps/Query.php');
29 * Assists in constructing queries for Google Apps email list recipient
30 * entries. Instances of this class can be provided in many places where a
33 * For information on submitting queries to a server, see the Google Apps
34 * service class, Zend_Gdata_Gapps.
39 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
40 * @license http://framework.zend.com/license/new-bsd New BSD License
42 class Zend_Gdata_Gapps_EmailListRecipientQuery
extends Zend_Gdata_Gapps_Query
46 * If not null, specifies the name of the email list which
47 * should be requested by this query.
51 protected $_emailListName = null;
54 * Create a new instance.
56 * @param string $domain (optional) The Google Apps-hosted domain to use
57 * when constructing query URIs.
58 * @param string $emailListName (optional) Value for the emailListName
60 * @param string $startRecipient (optional) Value for the
61 * startRecipient property.
63 public function __construct($domain = null, $emailListName = null,
64 $startRecipient = null)
66 parent
::__construct($domain);
67 $this->setEmailListName($emailListName);
68 $this->setStartRecipient($startRecipient);
72 * Set the email list name to query for. When set, only lists with a name
73 * matching this value will be returned in search results. Set to
74 * null to disable filtering by list name.
76 * @param string $value The email list name to filter search results by,
79 public function setEmailListName($value)
81 $this->_emailListName
= $value;
85 * Get the email list name to query for. If no name is set, null will be
88 * @param string $value The email list name to filter search results by,
89 * or null if disabled.
91 public function getEmailListName()
93 return $this->_emailListName
;
97 * Set the first recipient which should be displayed when retrieving
98 * a list of email list recipients.
100 * @param string $value The first recipient to be returned, or null to
103 public function setStartRecipient($value)
105 if ($value !== null) {
106 $this->_params
['startRecipient'] = $value;
108 unset($this->_params
['startRecipient']);
113 * Get the first recipient which should be displayed when retrieving
114 * a list of email list recipients.
116 * @return string The first recipient to be returned, or null if
119 public function getStartRecipient()
121 if (array_key_exists('startRecipient', $this->_params
)) {
122 return $this->_params
['startRecipient'];
129 * Returns the URL generated for this query, based on it's current
132 * @return string A URL generated based on the state of this query.
133 * @throws Zend_Gdata_App_InvalidArgumentException
135 public function getQueryUrl()
138 $uri = $this->getBaseUrl();
139 $uri .= Zend_Gdata_Gapps
::APPS_EMAIL_LIST_PATH
;
140 if ($this->_emailListName
!== null) {
141 $uri .= '/' . $this->_emailListName
;
143 require_once 'Zend/Gdata/App/InvalidArgumentException.php';
144 throw new Zend_Gdata_App_InvalidArgumentException(
145 'EmailListName must not be null');
147 $uri .= Zend_Gdata_Gapps
::APPS_EMAIL_LIST_RECIPIENT_POSTFIX
. '/';
148 $uri .= $this->getQueryString();