diff --git a/src/config.h b/src/config.h index 02309a2..5c4a0bc 100644 --- a/src/config.h +++ b/src/config.h @@ -13,7 +13,7 @@ #define VERSION "0.1.21" -#define BUILD 706 +#define BUILD 708 #define HOSTID "mailarchiver" diff --git a/src/defs.h b/src/defs.h index 6db3e3e..7506b0e 100644 --- a/src/defs.h +++ b/src/defs.h @@ -162,7 +162,7 @@ int bodylen; int tolen; - char ms_journal; + char ms_journal, ms_journal_dropped; }; diff --git a/src/parser.c b/src/parser.c index 64219a7..57be1d1 100644 --- a/src/parser.c +++ b/src/parser.c @@ -84,6 +84,8 @@ } if(take_into_pieces == 1 && state.writebufpos > 0){ + if(state.ms_journal == 1) remove_trailing_journal_boundary(&writebuffer[0], &state); + len = write(state.mfd, writebuffer, state.writebufpos); memset(writebuffer, 0, sizeof(writebuffer)); state.writebufpos = 0; @@ -212,6 +214,7 @@ state->saved_size += len; //n = write(state->mfd, buf, len); // WRITE if(len + state->writebufpos > writebuffersize-1){ + if(state->ms_journal == 1) remove_trailing_journal_boundary(writebuffer, state); n = write(state->mfd, writebuffer, state->writebufpos); state->writebufpos = 0; memset(writebuffer, 0, writebuffersize); } memcpy(writebuffer+state->writebufpos, buf, len); state->writebufpos += len; @@ -327,6 +330,7 @@ else if(strncasecmp(buf, "Subject:", strlen("Subject:")) == 0) state->message_state = MSG_SUBJECT; else if(strncasecmp(buf, "Recipient:", strlen("Recipient:")) == 0) state->message_state = MSG_RECIPIENT; else if(strncasecmp(buf, "Date:", strlen("Date:")) == 0 && sdata->sent == 0) sdata->sent = parse_date_header(buf); + else if(strncasecmp(buf, "Received:", strlen("Received:")) == 0) state->message_state = MSG_RECEIVED; if(state->message_state == MSG_MESSAGE_ID && state->message_id[0] == 0){ p = strchr(buf+11, ' '); @@ -357,6 +361,14 @@ if(p) *p = '\0'; } + if(state->message_state == MSG_RECEIVED && state->ms_journal == 1 && state->ms_journal_dropped == 0){ + state->ms_journal_dropped = 1; + state->writebufpos = 0; memset(writebuffer, 0, writebuffersize); + memcpy(writebuffer+state->writebufpos, buf, len); state->writebufpos += strlen(buf); + memcpy(writebuffer+state->writebufpos, "\n", 1); state->writebufpos++; + } + + if(state->is_1st_header == 1 && state->message_state == MSG_REFERENCES){ if(strncasecmp(buf, "References:", 11) == 0) parse_reference(state, buf+11); else parse_reference(state, buf); diff --git a/src/parser.h b/src/parser.h index cbce2cb..c0f24b4 100644 --- a/src/parser.h +++ b/src/parser.h @@ -34,5 +34,6 @@ char *get_attachment_extractor_by_filename(char *filename); void parse_reference(struct _state *state, char *s); int base64_decode_attachment_buffer(char *p, int plen, unsigned char *b, int blen); +void remove_trailing_journal_boundary(char *writebuffer, struct _state *state); #endif /* _PARSER_H */ diff --git a/src/parser_utils.c b/src/parser_utils.c index c1e2eac..179a867 100644 --- a/src/parser_utils.c +++ b/src/parser_utils.c @@ -96,6 +96,7 @@ state->bodylen = 0; state->ms_journal = 0; + state->ms_journal_dropped = 0; } @@ -811,3 +812,21 @@ return b64len; } + +void remove_trailing_journal_boundary(char *writebuffer, struct _state *state){ + char *p; + + p = strstr(writebuffer, state->boundaries->s); + if(p){ + state->writebufpos -= strlen(p); + *p = '\0'; + p = strrchr(writebuffer, '\n'); + if(p){ + state->writebufpos -= strlen(p); + *p = '\0'; + } + } + +} + + diff --git a/util/db-mysql.sql b/util/db-mysql.sql index b266f77..eff61ca 100644 --- a/util/db-mysql.sql +++ b/util/db-mysql.sql @@ -319,3 +319,23 @@ create index `audit_idx3` on `audit`(`ipaddr`); create index `audit_idx4` on `audit`(`ts`); + + +drop table if exists `google`; +create table if not exists `google` ( + `id` bigint unsigned not null primary key, + `email` char(128) not null unique, + `access_token` char(255) default null, + `refresh_token` char(255) default null, + `created` int default 0 +) ENGINE=InnoDB; + + +drop table if exists `google_imap`; +create table if not exists `google_imap` ( + `id` bigint unsigned not null, + `email` char(128) not null, + `last_msg_id` bigint default 0, + key(`email`) +) ENGINE=InnoDB; + diff --git a/webui/.htaccess b/webui/.htaccess index 99f7fba..7970eee 100644 --- a/webui/.htaccess +++ b/webui/.htaccess @@ -12,4 +12,5 @@ RewriteRule ^settings.php /index.php?route=user/settings [L] RewriteRule ^login.php /index.php?route=login/login [L] RewriteRule ^logout.php /index.php?route=login/logout [L] +RewriteRule ^google.php /index.php?route=login/google [QSA,L] diff --git a/webui/Zend/Exception.php b/webui/Zend/Exception.php new file mode 100644 index 0000000..92b2e46 --- /dev/null +++ b/webui/Zend/Exception.php @@ -0,0 +1,96 @@ +_previous = $previous; + } else { + parent::__construct($msg, (int) $code, $previous); + } + } + + /** + * Overloading + * + * For PHP < 5.3.0, provides access to the getPrevious() method. + * + * @param string $method + * @param array $args + * @return mixed + */ + public function __call($method, array $args) + { + if ('getprevious' == strtolower($method)) { + return $this->_getPrevious(); + } + return null; + } + + /** + * String representation of the exception + * + * @return string + */ + public function __toString() + { + if (version_compare(PHP_VERSION, '5.3.0', '<')) { + if (null !== ($e = $this->getPrevious())) { + return $e->__toString() + . "\n\nNext " + . parent::__toString(); + } + } + return parent::__toString(); + } + + /** + * Returns previous Exception + * + * @return Exception|null + */ + protected function _getPrevious() + { + return $this->_previous; + } +} diff --git a/webui/Zend/Mail.php b/webui/Zend/Mail.php new file mode 100644 index 0000000..74de7e2 --- /dev/null +++ b/webui/Zend/Mail.php @@ -0,0 +1,1276 @@ +_charset = $charset; + } + } + + /** + * Return charset string + * + * @return string + */ + public function getCharset() + { + return $this->_charset; + } + + /** + * Set content type + * + * Should only be used for manually setting multipart content types. + * + * @param string $type Content type + * @return Zend_Mail Implements fluent interface + * @throws Zend_Mail_Exception for types not supported by Zend_Mime + */ + public function setType($type) + { + $allowed = array( + Zend_Mime::MULTIPART_ALTERNATIVE, + Zend_Mime::MULTIPART_MIXED, + Zend_Mime::MULTIPART_RELATED, + ); + if (!in_array($type, $allowed)) { + /** + * @see Zend_Mail_Exception + */ + require_once 'Zend/Mail/Exception.php'; + throw new Zend_Mail_Exception('Invalid content type "' . $type . '"'); + } + + $this->_type = $type; + return $this; + } + + /** + * Get content type of the message + * + * @return string + */ + public function getType() + { + return $this->_type; + } + + /** + * Set an arbitrary mime boundary for the message + * + * If not set, Zend_Mime will generate one. + * + * @param string $boundary + * @return Zend_Mail Provides fluent interface + */ + public function setMimeBoundary($boundary) + { + $this->_mimeBoundary = $boundary; + + return $this; + } + + /** + * Return the boundary string used for the message + * + * @return string + */ + public function getMimeBoundary() + { + return $this->_mimeBoundary; + } + + /** + * Return encoding of mail headers + * + * @deprecated use {@link getHeaderEncoding()} instead + * @return string + */ + public function getEncodingOfHeaders() + { + return $this->getHeaderEncoding(); + } + + /** + * Return the encoding of mail headers + * + * Either Zend_Mime::ENCODING_QUOTEDPRINTABLE or Zend_Mime::ENCODING_BASE64 + * + * @return string + */ + public function getHeaderEncoding() + { + return $this->_headerEncoding; + } + + /** + * Set the encoding of mail headers + * + * @deprecated Use {@link setHeaderEncoding()} instead. + * @param string $encoding + * @return Zend_Mail + */ + public function setEncodingOfHeaders($encoding) + { + return $this->setHeaderEncoding($encoding); + } + + /** + * Set the encoding of mail headers + * + * @param string $encoding Zend_Mime::ENCODING_QUOTEDPRINTABLE or Zend_Mime::ENCODING_BASE64 + * @return Zend_Mail Provides fluent interface + */ + public function setHeaderEncoding($encoding) + { + $allowed = array( + Zend_Mime::ENCODING_BASE64, + Zend_Mime::ENCODING_QUOTEDPRINTABLE + ); + if (!in_array($encoding, $allowed)) { + /** + * @see Zend_Mail_Exception + */ + require_once 'Zend/Mail/Exception.php'; + throw new Zend_Mail_Exception('Invalid encoding "' . $encoding . '"'); + } + $this->_headerEncoding = $encoding; + + return $this; + } + + /** + * Sets the text body for the message. + * + * @param string $txt + * @param string $charset + * @param string $encoding + * @return Zend_Mail Provides fluent interface + */ + public function setBodyText($txt, $charset = null, $encoding = Zend_Mime::ENCODING_QUOTEDPRINTABLE) + { + if ($charset === null) { + $charset = $this->_charset; + } + + $mp = new Zend_Mime_Part($txt); + $mp->encoding = $encoding; + $mp->type = Zend_Mime::TYPE_TEXT; + $mp->disposition = Zend_Mime::DISPOSITION_INLINE; + $mp->charset = $charset; + + $this->_bodyText = $mp; + + return $this; + } + + /** + * Return text body Zend_Mime_Part or string + * + * @param bool textOnly Whether to return just the body text content or the MIME part; defaults to false, the MIME part + * @return false|Zend_Mime_Part|string + */ + public function getBodyText($textOnly = false) + { + if ($textOnly && $this->_bodyText) { + $body = $this->_bodyText; + return $body->getContent(); + } + + return $this->_bodyText; + } + + /** + * Sets the HTML body for the message + * + * @param string $html + * @param string $charset + * @param string $encoding + * @return Zend_Mail Provides fluent interface + */ + public function setBodyHtml($html, $charset = null, $encoding = Zend_Mime::ENCODING_QUOTEDPRINTABLE) + { + if ($charset === null) { + $charset = $this->_charset; + } + + $mp = new Zend_Mime_Part($html); + $mp->encoding = $encoding; + $mp->type = Zend_Mime::TYPE_HTML; + $mp->disposition = Zend_Mime::DISPOSITION_INLINE; + $mp->charset = $charset; + + $this->_bodyHtml = $mp; + + return $this; + } + + /** + * Return Zend_Mime_Part representing body HTML + * + * @param bool $htmlOnly Whether to return the body HTML only, or the MIME part; defaults to false, the MIME part + * @return false|Zend_Mime_Part|string + */ + public function getBodyHtml($htmlOnly = false) + { + if ($htmlOnly && $this->_bodyHtml) { + $body = $this->_bodyHtml; + return $body->getContent(); + } + + return $this->_bodyHtml; + } + + /** + * Adds an existing attachment to the mail message + * + * @param Zend_Mime_Part $attachment + * @return Zend_Mail Provides fluent interface + */ + public function addAttachment(Zend_Mime_Part $attachment) + { + $this->addPart($attachment); + $this->hasAttachments = true; + + return $this; + } + + /** + * Creates a Zend_Mime_Part attachment + * + * Attachment is automatically added to the mail object after creation. The + * attachment object is returned to allow for further manipulation. + * + * @param string $body + * @param string $mimeType + * @param string $disposition + * @param string $encoding + * @param string $filename OPTIONAL A filename for the attachment + * @return Zend_Mime_Part Newly created Zend_Mime_Part object (to allow + * advanced settings) + */ + public function createAttachment($body, + $mimeType = Zend_Mime::TYPE_OCTETSTREAM, + $disposition = Zend_Mime::DISPOSITION_ATTACHMENT, + $encoding = Zend_Mime::ENCODING_BASE64, + $filename = null) + { + + $mp = new Zend_Mime_Part($body); + $mp->encoding = $encoding; + $mp->type = $mimeType; + $mp->disposition = $disposition; + $mp->filename = $filename; + + $this->addAttachment($mp); + + return $mp; + } + + /** + * Return a count of message parts + * + * @return integer + */ + public function getPartCount() + { + return count($this->_parts); + } + + /** + * Encode header fields + * + * Encodes header content according to RFC1522 if it contains non-printable + * characters. + * + * @param string $value + * @return string + */ + protected function _encodeHeader($value) + { + if (Zend_Mime::isPrintable($value) === false) { + if ($this->getHeaderEncoding() === Zend_Mime::ENCODING_QUOTEDPRINTABLE) { + $value = Zend_Mime::encodeQuotedPrintableHeader($value, $this->getCharset(), Zend_Mime::LINELENGTH, Zend_Mime::LINEEND); + } else { + $value = Zend_Mime::encodeBase64Header($value, $this->getCharset(), Zend_Mime::LINELENGTH, Zend_Mime::LINEEND); + } + } + + return $value; + } + + /** + * Add a header to the message + * + * Adds a header to this message. If append is true and the header already + * exists, raises a flag indicating that the header should be appended. + * + * @param string $headerName + * @param string $value + * @param bool $append + */ + protected function _storeHeader($headerName, $value, $append = false) + { + if (isset($this->_headers[$headerName])) { + $this->_headers[$headerName][] = $value; + } else { + $this->_headers[$headerName] = array($value); + } + + if ($append) { + $this->_headers[$headerName]['append'] = true; + } + + } + + /** + * Clear header from the message + * + * @param string $headerName + * @deprecated use public method directly + */ + protected function _clearHeader($headerName) + { + $this->clearHeader($headerName); + } + + /** + * Helper function for adding a recipient and the corresponding header + * + * @param string $headerName + * @param string $email + * @param string $name + */ + protected function _addRecipientAndHeader($headerName, $email, $name) + { + $email = $this->_filterEmail($email); + $name = $this->_filterName($name); + // prevent duplicates + $this->_recipients[$email] = 1; + $this->_storeHeader($headerName, $this->_formatAddress($email, $name), true); + } + + /** + * Adds To-header and recipient, $email can be an array, or a single string address + * + * @param string|array $email + * @param string $name + * @return Zend_Mail Provides fluent interface + */ + public function addTo($email, $name='') + { + if (!is_array($email)) { + $email = array($name => $email); + } + + foreach ($email as $n => $recipient) { + $this->_addRecipientAndHeader('To', $recipient, is_int($n) ? '' : $n); + $this->_to[] = $recipient; + } + + return $this; + } + + /** + * Adds Cc-header and recipient, $email can be an array, or a single string address + * + * @param string|array $email + * @param string $name + * @return Zend_Mail Provides fluent interface + */ + public function addCc($email, $name='') + { + if (!is_array($email)) { + $email = array($name => $email); + } + + foreach ($email as $n => $recipient) { + $this->_addRecipientAndHeader('Cc', $recipient, is_int($n) ? '' : $n); + } + + return $this; + } + + /** + * Adds Bcc recipient, $email can be an array, or a single string address + * + * @param string|array $email + * @return Zend_Mail Provides fluent interface + */ + public function addBcc($email) + { + if (!is_array($email)) { + $email = array($email); + } + + foreach ($email as $recipient) { + $this->_addRecipientAndHeader('Bcc', $recipient, ''); + } + + return $this; + } + + /** + * Return list of recipient email addresses + * + * @return array (of strings) + */ + public function getRecipients() + { + return array_keys($this->_recipients); + } + + /** + * Clear header from the message + * + * @param string $headerName + * @return Zend_Mail Provides fluent inter + */ + public function clearHeader($headerName) + { + if (isset($this->_headers[$headerName])){ + unset($this->_headers[$headerName]); + } + return $this; + } + + /** + * Clears list of recipient email addresses + * + * @return Zend_Mail Provides fluent interface + */ + public function clearRecipients() + { + $this->_recipients = array(); + $this->_to = array(); + + $this->clearHeader('To'); + $this->clearHeader('Cc'); + $this->clearHeader('Bcc'); + + return $this; + } + + /** + * Sets From-header and sender of the message + * + * @param string $email + * @param string $name + * @return Zend_Mail Provides fluent interface + * @throws Zend_Mail_Exception if called subsequent times + */ + public function setFrom($email, $name = null) + { + if (null !== $this->_from) { + /** + * @see Zend_Mail_Exception + */ + require_once 'Zend/Mail/Exception.php'; + throw new Zend_Mail_Exception('From Header set twice'); + } + + $email = $this->_filterEmail($email); + $name = $this->_filterName($name); + $this->_from = $email; + $this->_storeHeader('From', $this->_formatAddress($email, $name), true); + + return $this; + } + + /** + * Set Reply-To Header + * + * @param string $email + * @param string $name + * @return Zend_Mail + * @throws Zend_Mail_Exception if called more than one time + */ + public function setReplyTo($email, $name = null) + { + if (null !== $this->_replyTo) { + /** + * @see Zend_Mail_Exception + */ + require_once 'Zend/Mail/Exception.php'; + throw new Zend_Mail_Exception('Reply-To Header set twice'); + } + + $email = $this->_filterEmail($email); + $name = $this->_filterName($name); + $this->_replyTo = $email; + $this->_storeHeader('Reply-To', $this->_formatAddress($email, $name), true); + + return $this; + } + + /** + * Returns the sender of the mail + * + * @return string + */ + public function getFrom() + { + return $this->_from; + } + + /** + * Returns the current Reply-To address of the message + * + * @return string|null Reply-To address, null when not set + */ + public function getReplyTo() + { + return $this->_replyTo; + } + + /** + * Clears the sender from the mail + * + * @return Zend_Mail Provides fluent interface + */ + public function clearFrom() + { + $this->_from = null; + $this->clearHeader('From'); + + return $this; + } + + /** + * Clears the current Reply-To address from the message + * + * @return Zend_Mail Provides fluent interface + */ + public function clearReplyTo() + { + $this->_replyTo = null; + $this->clearHeader('Reply-To'); + + return $this; + } + + /** + * Sets Default From-email and name of the message + * + * @param string $email + * @param string Optional $name + * @return void + */ + public static function setDefaultFrom($email, $name = null) + { + self::$_defaultFrom = array('email' => $email, 'name' => $name); + } + + /** + * Returns the default sender of the mail + * + * @return null|array Null if none was set. + */ + public static function getDefaultFrom() + { + return self::$_defaultFrom; + } + + /** + * Clears the default sender from the mail + * + * @return void + */ + public static function clearDefaultFrom() + { + self::$_defaultFrom = null; + } + + /** + * Sets From-name and -email based on the defaults + * + * @return Zend_Mail Provides fluent interface + */ + public function setFromToDefaultFrom() { + $from = self::getDefaultFrom(); + if($from === null) { + require_once 'Zend/Mail/Exception.php'; + throw new Zend_Mail_Exception( + 'No default From Address set to use'); + } + + $this->setFrom($from['email'], $from['name']); + + return $this; + } + + /** + * Sets Default ReplyTo-address and -name of the message + * + * @param string $email + * @param string Optional $name + * @return void + */ + public static function setDefaultReplyTo($email, $name = null) + { + self::$_defaultReplyTo = array('email' => $email, 'name' => $name); + } + + /** + * Returns the default Reply-To Address and Name of the mail + * + * @return null|array Null if none was set. + */ + public static function getDefaultReplyTo() + { + return self::$_defaultReplyTo; + } + + /** + * Clears the default ReplyTo-address and -name from the mail + * + * @return void + */ + public static function clearDefaultReplyTo() + { + self::$_defaultReplyTo = null; + } + + /** + * Sets ReplyTo-name and -email based on the defaults + * + * @return Zend_Mail Provides fluent interface + */ + public function setReplyToFromDefault() { + $replyTo = self::getDefaultReplyTo(); + if($replyTo === null) { + require_once 'Zend/Mail/Exception.php'; + throw new Zend_Mail_Exception( + 'No default Reply-To Address set to use'); + } + + $this->setReplyTo($replyTo['email'], $replyTo['name']); + + return $this; + } + + /** + * Sets the Return-Path header of the message + * + * @param string $email + * @return Zend_Mail Provides fluent interface + * @throws Zend_Mail_Exception if set multiple times + */ + public function setReturnPath($email) + { + if ($this->_returnPath === null) { + $email = $this->_filterEmail($email); + $this->_returnPath = $email; + $this->_storeHeader('Return-Path', $email, false); + } else { + /** + * @see Zend_Mail_Exception + */ + require_once 'Zend/Mail/Exception.php'; + throw new Zend_Mail_Exception('Return-Path Header set twice'); + } + return $this; + } + + /** + * Returns the current Return-Path address of the message + * + * If no Return-Path header is set, returns the value of {@link $_from}. + * + * @return string + */ + public function getReturnPath() + { + if (null !== $this->_returnPath) { + return $this->_returnPath; + } + + return $this->_from; + } + + /** + * Clears the current Return-Path address from the message + * + * @return Zend_Mail Provides fluent interface + */ + public function clearReturnPath() + { + $this->_returnPath = null; + $this->clearHeader('Return-Path'); + + return $this; + } + + /** + * Sets the subject of the message + * + * @param string $subject + * @return Zend_Mail Provides fluent interface + * @throws Zend_Mail_Exception + */ + public function setSubject($subject) + { + if ($this->_subject === null) { + $subject = $this->_filterOther($subject); + $this->_subject = $this->_encodeHeader($subject); + $this->_storeHeader('Subject', $this->_subject); + } else { + /** + * @see Zend_Mail_Exception + */ + require_once 'Zend/Mail/Exception.php'; + throw new Zend_Mail_Exception('Subject set twice'); + } + return $this; + } + + /** + * Returns the encoded subject of the message + * + * @return string + */ + public function getSubject() + { + return $this->_subject; + } + + /** + * Clears the encoded subject from the message + * + * @return Zend_Mail Provides fluent interface + */ + public function clearSubject() + { + $this->_subject = null; + $this->clearHeader('Subject'); + + return $this; + } + + /** + * Sets Date-header + * + * @param timestamp|string|Zend_Date $date + * @return Zend_Mail Provides fluent interface + * @throws Zend_Mail_Exception if called subsequent times or wrong date format. + */ + public function setDate($date = null) + { + if ($this->_date === null) { + if ($date === null) { + $date = date('r'); + } else if (is_int($date)) { + $date = date('r', $date); + } else if (is_string($date)) { + $date = strtotime($date); + if ($date === false || $date < 0) { + /** + * @see Zend_Mail_Exception + */ + require_once 'Zend/Mail/Exception.php'; + throw new Zend_Mail_Exception('String representations of Date Header must be ' . + 'strtotime()-compatible'); + } + $date = date('r', $date); + } else if ($date instanceof Zend_Date) { + $date = $date->get(Zend_Date::RFC_2822); + } else { + /** + * @see Zend_Mail_Exception + */ + require_once 'Zend/Mail/Exception.php'; + throw new Zend_Mail_Exception(__METHOD__ . ' only accepts UNIX timestamps, Zend_Date objects, ' . + ' and strtotime()-compatible strings'); + } + $this->_date = $date; + $this->_storeHeader('Date', $date); + } else { + /** + * @see Zend_Mail_Exception + */ + require_once 'Zend/Mail/Exception.php'; + throw new Zend_Mail_Exception('Date Header set twice'); + } + return $this; + } + + /** + * Returns the formatted date of the message + * + * @return string + */ + public function getDate() + { + return $this->_date; + } + + /** + * Clears the formatted date from the message + * + * @return Zend_Mail Provides fluent interface + */ + public function clearDate() + { + $this->_date = null; + $this->clearHeader('Date'); + + return $this; + } + + /** + * Sets the Message-ID of the message + * + * @param boolean|string $id + * true :Auto + * false :No set + * null :No set + * string:Sets given string (Angle brackets is not necessary) + * @return Zend_Mail Provides fluent interface + * @throws Zend_Mail_Exception + */ + public function setMessageId($id = true) + { + if ($id === null || $id === false) { + return $this; + } elseif ($id === true) { + $id = $this->createMessageId(); + } + + if ($this->_messageId === null) { + $id = $this->_filterOther($id); + $this->_messageId = $id; + $this->_storeHeader('Message-Id', '<' . $this->_messageId . '>'); + } else { + /** + * @see Zend_Mail_Exception + */ + require_once 'Zend/Mail/Exception.php'; + throw new Zend_Mail_Exception('Message-ID set twice'); + } + + return $this; + } + + /** + * Returns the Message-ID of the message + * + * @return string + */ + public function getMessageId() + { + return $this->_messageId; + } + + + /** + * Clears the Message-ID from the message + * + * @return Zend_Mail Provides fluent interface + */ + public function clearMessageId() + { + $this->_messageId = null; + $this->clearHeader('Message-Id'); + + return $this; + } + + /** + * Creates the Message-ID + * + * @return string + */ + public function createMessageId() { + + $time = time(); + + if ($this->_from !== null) { + $user = $this->_from; + } elseif (isset($_SERVER['REMOTE_ADDR'])) { + $user = $_SERVER['REMOTE_ADDR']; + } else { + $user = getmypid(); + } + + $rand = mt_rand(); + + if ($this->_recipients !== array()) { + $recipient = array_rand($this->_recipients); + } else { + $recipient = 'unknown'; + } + + if (isset($_SERVER["SERVER_NAME"])) { + $hostName = $_SERVER["SERVER_NAME"]; + } else { + $hostName = php_uname('n'); + } + + return sha1($time . $user . $rand . $recipient) . '@' . $hostName; + } + + /** + * Add a custom header to the message + * + * @param string $name + * @param string $value + * @param boolean $append + * @return Zend_Mail Provides fluent interface + * @throws Zend_Mail_Exception on attempts to create standard headers + */ + public function addHeader($name, $value, $append = false) + { + $prohibit = array('to', 'cc', 'bcc', 'from', 'subject', + 'reply-to', 'return-path', + 'date', 'message-id', + ); + if (in_array(strtolower($name), $prohibit)) { + /** + * @see Zend_Mail_Exception + */ + require_once 'Zend/Mail/Exception.php'; + throw new Zend_Mail_Exception('Cannot set standard header from addHeader()'); + } + + $value = $this->_filterOther($value); + $value = $this->_encodeHeader($value); + $this->_storeHeader($name, $value, $append); + + return $this; + } + + /** + * Return mail headers + * + * @return void + */ + public function getHeaders() + { + return $this->_headers; + } + + /** + * Sends this email using the given transport or a previously + * set DefaultTransport or the internal mail function if no + * default transport had been set. + * + * @param Zend_Mail_Transport_Abstract $transport + * @return Zend_Mail Provides fluent interface + */ + public function send($transport = null) + { + if ($transport === null) { + if (! self::$_defaultTransport instanceof Zend_Mail_Transport_Abstract) { + require_once 'Zend/Mail/Transport/Sendmail.php'; + $transport = new Zend_Mail_Transport_Sendmail(); + } else { + $transport = self::$_defaultTransport; + } + } + + if ($this->_date === null) { + $this->setDate(); + } + + if(null === $this->_from && null !== self::getDefaultFrom()) { + $this->setFromToDefaultFrom(); + } + + if(null === $this->_replyTo && null !== self::getDefaultReplyTo()) { + $this->setReplyToFromDefault(); + } + + $transport->send($this); + + return $this; + } + + /** + * Filter of email data + * + * @param string $email + * @return string + */ + protected function _filterEmail($email) + { + $rule = array("\r" => '', + "\n" => '', + "\t" => '', + '"' => '', + ',' => '', + '<' => '', + '>' => '', + ); + + return strtr($email, $rule); + } + + /** + * Filter of name data + * + * @param string $name + * @return string + */ + protected function _filterName($name) + { + $rule = array("\r" => '', + "\n" => '', + "\t" => '', + '"' => "'", + '<' => '[', + '>' => ']', + ); + + return trim(strtr($name, $rule)); + } + + /** + * Filter of other data + * + * @param string $data + * @return string + */ + protected function _filterOther($data) + { + $rule = array("\r" => '', + "\n" => '', + "\t" => '', + ); + + return strtr($data, $rule); + } + + /** + * Formats e-mail address + * + * @param string $email + * @param string $name + * @return string + */ + protected function _formatAddress($email, $name) + { + if ($name === '' || $name === null || $name === $email) { + return $email; + } else { + $encodedName = $this->_encodeHeader($name); + if ($encodedName === $name && strcspn($name, '()<>[]:;@\\,') != strlen($name)) { + $format = '"%s" <%s>'; + } else { + $format = '%s <%s>'; + } + return sprintf($format, $encodedName, $email); + } + } + +} diff --git a/webui/Zend/Mail/Exception.php b/webui/Zend/Mail/Exception.php new file mode 100644 index 0000000..89c9fdd --- /dev/null +++ b/webui/Zend/Mail/Exception.php @@ -0,0 +1,37 @@ +_flags = array_merge($this->_flags, array_combine($params['flags'],$params['flags'])); + } + + parent::__construct($params); + } + + /** + * return toplines as found after headers + * + * @return string toplines + */ + public function getTopLines() + { + return $this->_topLines; + } + + /** + * check if flag is set + * + * @param mixed $flag a flag name, use constants defined in Zend_Mail_Storage + * @return bool true if set, otherwise false + */ + public function hasFlag($flag) + { + return isset($this->_flags[$flag]); + } + + /** + * get all set flags + * + * @return array array with flags, key and value are the same for easy lookup + */ + public function getFlags() + { + return $this->_flags; + } +} diff --git a/webui/Zend/Mail/Message/File.php b/webui/Zend/Mail/Message/File.php new file mode 100644 index 0000000..aa45795 --- /dev/null +++ b/webui/Zend/Mail/Message/File.php @@ -0,0 +1,96 @@ +_flags = array_combine($params['flags'], $params['flags']); + } + + parent::__construct($params); + } + + /** + * return toplines as found after headers + * + * @return string toplines + */ + public function getTopLines() + { + return $this->_topLines; + } + + /** + * check if flag is set + * + * @param mixed $flag a flag name, use constants defined in Zend_Mail_Storage + * @return bool true if set, otherwise false + */ + public function hasFlag($flag) + { + return isset($this->_flags[$flag]); + } + + /** + * get all set flags + * + * @return array array with flags, key and value are the same for easy lookup + */ + public function getFlags() + { + return $this->_flags; + } +} diff --git a/webui/Zend/Mail/Message/Interface.php b/webui/Zend/Mail/Message/Interface.php new file mode 100644 index 0000000..5fbbe59 --- /dev/null +++ b/webui/Zend/Mail/Message/Interface.php @@ -0,0 +1,55 @@ + value) or string, if a content part is found it's used as toplines + * - noToplines ignore content found after headers in param 'headers' + * - content content as string + * + * @param array $params full message with or without headers + * @throws Zend_Mail_Exception + */ + public function __construct(array $params) + { + if (isset($params['handler'])) { + if (!$params['handler'] instanceof Zend_Mail_Storage_Abstract) { + /** + * @see Zend_Mail_Exception + */ + require_once 'Zend/Mail/Exception.php'; + throw new Zend_Mail_Exception('handler is not a valid mail handler'); + } + if (!isset($params['id'])) { + /** + * @see Zend_Mail_Exception + */ + require_once 'Zend/Mail/Exception.php'; + throw new Zend_Mail_Exception('need a message id with a handler'); + } + + $this->_mail = $params['handler']; + $this->_messageNum = $params['id']; + } + + if (isset($params['partclass'])) { + $this->setPartClass($params['partclass']); + } + + if (isset($params['raw'])) { + Zend_Mime_Decode::splitMessage($params['raw'], $this->_headers, $this->_content); + } else if (isset($params['headers'])) { + if (is_array($params['headers'])) { + $this->_headers = $params['headers']; + } else { + if (!empty($params['noToplines'])) { + Zend_Mime_Decode::splitMessage($params['headers'], $this->_headers, $null); + } else { + Zend_Mime_Decode::splitMessage($params['headers'], $this->_headers, $this->_topLines); + } + } + if (isset($params['content'])) { + $this->_content = $params['content']; + } + } + } + + /** + * Set name pf class used to encapsulate message parts + * @param string $class + * @return Zend_Mail_Part + */ + public function setPartClass($class) + { + if ( !class_exists($class) ) { + /** + * @see Zend_Mail_Exception + */ + require_once 'Zend/Mail/Exception.php'; + throw new Zend_Mail_Exception("Class '{$class}' does not exist"); + } + if ( !is_subclass_of($class, 'Zend_Mail_Part_Interface') ) { + /** + * @see Zend_Mail_Exception + */ + require_once 'Zend/Mail/Exception.php'; + throw new Zend_Mail_Exception("Class '{$class}' must implement Zend_Mail_Part_Interface"); + } + + $this->_partClass = $class; + return $this; + } + + /** + * Retrieve the class name used to encapsulate message parts + * @return string + */ + public function getPartClass() + { + if ( !$this->_partClass ) { + $this->_partClass = __CLASS__; + } + return $this->_partClass; + } + + /** + * Check if part is a multipart message + * + * @return bool if part is multipart + */ + public function isMultipart() + { + try { + return stripos($this->contentType, 'multipart/') === 0; + } catch(Zend_Mail_Exception $e) { + return false; + } + } + + + /** + * Body of part + * + * If part is multipart the raw content of this part with all sub parts is returned + * + * @return string body + * @throws Zend_Mail_Exception + */ + public function getContent() + { + if ($this->_content !== null) { + return $this->_content; + } + + if ($this->_mail) { + return $this->_mail->getRawContent($this->_messageNum); + } else { + /** + * @see Zend_Mail_Exception + */ + require_once 'Zend/Mail/Exception.php'; + throw new Zend_Mail_Exception('no content'); + } + } + + /** + * Return size of part + * + * Quite simple implemented currently (not decoding). Handle with care. + * + * @return int size + */ + public function getSize() { + return strlen($this->getContent()); + } + + + /** + * Cache content and split in parts if multipart + * + * @return null + * @throws Zend_Mail_Exception + */ + protected function _cacheContent() + { + // caching content if we can't fetch parts + if ($this->_content === null && $this->_mail) { + $this->_content = $this->_mail->getRawContent($this->_messageNum); + } + + if (!$this->isMultipart()) { + return; + } + + // split content in parts + $boundary = $this->getHeaderField('content-type', 'boundary'); + if (!$boundary) { + /** + * @see Zend_Mail_Exception + */ + require_once 'Zend/Mail/Exception.php'; + throw new Zend_Mail_Exception('no boundary found in content type to split message'); + } + $parts = Zend_Mime_Decode::splitMessageStruct($this->_content, $boundary); + if ($parts === null) { + return; + } + $partClass = $this->getPartClass(); + $counter = 1; + foreach ($parts as $part) { + $this->_parts[$counter++] = new $partClass(array('headers' => $part['header'], 'content' => $part['body'])); + } + } + + /** + * Get part of multipart message + * + * @param int $num number of part starting with 1 for first part + * @return Zend_Mail_Part wanted part + * @throws Zend_Mail_Exception + */ + public function getPart($num) + { + if (isset($this->_parts[$num])) { + return $this->_parts[$num]; + } + + if (!$this->_mail && $this->_content === null) { + /** + * @see Zend_Mail_Exception + */ + require_once 'Zend/Mail/Exception.php'; + throw new Zend_Mail_Exception('part not found'); + } + + if ($this->_mail && $this->_mail->hasFetchPart) { + // TODO: fetch part + // return + } + + $this->_cacheContent(); + + if (!isset($this->_parts[$num])) { + /** + * @see Zend_Mail_Exception + */ + require_once 'Zend/Mail/Exception.php'; + throw new Zend_Mail_Exception('part not found'); + } + + return $this->_parts[$num]; + } + + /** + * Count parts of a multipart part + * + * @return int number of sub-parts + */ + public function countParts() + { + if ($this->_countParts) { + return $this->_countParts; + } + + $this->_countParts = count($this->_parts); + if ($this->_countParts) { + return $this->_countParts; + } + + if ($this->_mail && $this->_mail->hasFetchPart) { + // TODO: fetch part + // return + } + + $this->_cacheContent(); + + $this->_countParts = count($this->_parts); + return $this->_countParts; + } + + + /** + * Get all headers + * + * The returned headers are as saved internally. All names are lowercased. The value is a string or an array + * if a header with the same name occurs more than once. + * + * @return array headers as array(name => value) + */ + public function getHeaders() + { + if ($this->_headers === null) { + if (!$this->_mail) { + $this->_headers = array(); + } else { + $part = $this->_mail->getRawHeader($this->_messageNum); + Zend_Mime_Decode::splitMessage($part, $this->_headers, $null); + } + } + + return $this->_headers; + } + + /** + * Get a header in specificed format + * + * Internally headers that occur more than once are saved as array, all other as string. If $format + * is set to string implode is used to concat the values (with Zend_Mime::LINEEND as delim). + * + * @param string $name name of header, matches case-insensitive, but camel-case is replaced with dashes + * @param string $format change type of return value to 'string' or 'array' + * @return string|array value of header in wanted or internal format + * @throws Zend_Mail_Exception + */ + public function getHeader($name, $format = null) + { + if ($this->_headers === null) { + $this->getHeaders(); + } + + $lowerName = strtolower($name); + + if ($this->headerExists($name) == false) { + $lowerName = strtolower(preg_replace('%([a-z])([A-Z])%', '\1-\2', $name)); + if($this->headerExists($lowerName) == false) { + /** + * @see Zend_Mail_Exception + */ + require_once 'Zend/Mail/Exception.php'; + throw new Zend_Mail_Exception("no Header with Name $name or $lowerName found"); + } + } + $name = $lowerName; + + $header = $this->_headers[$name]; + + switch ($format) { + case 'string': + if (is_array($header)) { + $header = implode(Zend_Mime::LINEEND, $header); + } + break; + case 'array': + $header = (array)$header; + default: + // do nothing + } + + return $header; + } + + /** + * Check wheater the Mail part has a specific header. + * + * @param string $name + * @return boolean + */ + public function headerExists($name) + { + $name = strtolower($name); + if(isset($this->_headers[$name])) { + return true; + } else { + return false; + } + } + + /** + * Get a specific field from a header like content type or all fields as array + * + * If the header occurs more than once, only the value from the first header + * is returned. + * + * Throws a Zend_Mail_Exception if the requested header does not exist. If + * the specific header field does not exist, returns null. + * + * @param string $name name of header, like in getHeader() + * @param string $wantedPart the wanted part, default is first, if null an array with all parts is returned + * @param string $firstName key name for the first part + * @return string|array wanted part or all parts as array($firstName => firstPart, partname => value) + * @throws Zend_Exception, Zend_Mail_Exception + */ + public function getHeaderField($name, $wantedPart = 0, $firstName = 0) { + return Zend_Mime_Decode::splitHeaderField(current($this->getHeader($name, 'array')), $wantedPart, $firstName); + } + + + /** + * Getter for mail headers - name is matched in lowercase + * + * This getter is short for Zend_Mail_Part::getHeader($name, 'string') + * + * @see Zend_Mail_Part::getHeader() + * + * @param string $name header name + * @return string value of header + * @throws Zend_Mail_Exception + */ + public function __get($name) + { + return $this->getHeader($name, 'string'); + } + + /** + * Isset magic method proxy to hasHeader + * + * This method is short syntax for Zend_Mail_Part::hasHeader($name); + * + * @see Zend_Mail_Part::hasHeader + * + * @param string + * @return boolean + */ + public function __isset($name) + { + return $this->headerExists($name); + } + + /** + * magic method to get content of part + * + * @return string content + */ + public function __toString() + { + return $this->getContent(); + } + + /** + * implements RecursiveIterator::hasChildren() + * + * @return bool current element has children/is multipart + */ + public function hasChildren() + { + $current = $this->current(); + return $current && $current instanceof Zend_Mail_Part && $current->isMultipart(); + } + + /** + * implements RecursiveIterator::getChildren() + * + * @return Zend_Mail_Part same as self::current() + */ + public function getChildren() + { + return $this->current(); + } + + /** + * implements Iterator::valid() + * + * @return bool check if there's a current element + */ + public function valid() + { + if ($this->_countParts === null) { + $this->countParts(); + } + return $this->_iterationPos && $this->_iterationPos <= $this->_countParts; + } + + /** + * implements Iterator::next() + * + * @return null + */ + public function next() + { + ++$this->_iterationPos; + } + + /** + * implements Iterator::key() + * + * @return string key/number of current part + */ + public function key() + { + return $this->_iterationPos; + } + + /** + * implements Iterator::current() + * + * @return Zend_Mail_Part current part + */ + public function current() + { + return $this->getPart($this->_iterationPos); + } + + /** + * implements Iterator::rewind() + * + * @return null + */ + public function rewind() + { + $this->countParts(); + $this->_iterationPos = 1; + } +} diff --git a/webui/Zend/Mail/Part/File.php b/webui/Zend/Mail/Part/File.php new file mode 100644 index 0000000..abe3395 --- /dev/null +++ b/webui/Zend/Mail/Part/File.php @@ -0,0 +1,198 @@ +_fh = fopen($params['file'], 'r'); + } else { + $this->_fh = $params['file']; + } + if (!$this->_fh) { + /** + * @see Zend_Mail_Exception + */ + require_once 'Zend/Mail/Exception.php'; + throw new Zend_Mail_Exception('could not open file'); + } + if (isset($params['startPos'])) { + fseek($this->_fh, $params['startPos']); + } + $header = ''; + $endPos = isset($params['endPos']) ? $params['endPos'] : null; + while (($endPos === null || ftell($this->_fh) < $endPos) && trim($line = fgets($this->_fh))) { + $header .= $line; + } + + Zend_Mime_Decode::splitMessage($header, $this->_headers, $null); + + $this->_contentPos[0] = ftell($this->_fh); + if ($endPos !== null) { + $this->_contentPos[1] = $endPos; + } else { + fseek($this->_fh, 0, SEEK_END); + $this->_contentPos[1] = ftell($this->_fh); + } + if (!$this->isMultipart()) { + return; + } + + $boundary = $this->getHeaderField('content-type', 'boundary'); + if (!$boundary) { + /** + * @see Zend_Mail_Exception + */ + require_once 'Zend/Mail/Exception.php'; + throw new Zend_Mail_Exception('no boundary found in content type to split message'); + } + + $part = array(); + $pos = $this->_contentPos[0]; + fseek($this->_fh, $pos); + while (!feof($this->_fh) && ($endPos === null || $pos < $endPos)) { + $line = fgets($this->_fh); + if ($line === false) { + if (feof($this->_fh)) { + break; + } + /** + * @see Zend_Mail_Exception + */ + require_once 'Zend/Mail/Exception.php'; + throw new Zend_Mail_Exception('error reading file'); + } + + $lastPos = $pos; + $pos = ftell($this->_fh); + $line = trim($line); + + if ($line == '--' . $boundary) { + if ($part) { + // not first part + $part[1] = $lastPos; + $this->_partPos[] = $part; + } + $part = array($pos); + } else if ($line == '--' . $boundary . '--') { + $part[1] = $lastPos; + $this->_partPos[] = $part; + break; + } + } + $this->_countParts = count($this->_partPos); + + } + + + /** + * Body of part + * + * If part is multipart the raw content of this part with all sub parts is returned + * + * @return string body + * @throws Zend_Mail_Exception + */ + public function getContent($stream = null) + { + fseek($this->_fh, $this->_contentPos[0]); + if ($stream !== null) { + return stream_copy_to_stream($this->_fh, $stream, $this->_contentPos[1] - $this->_contentPos[0]); + } + $length = $this->_contentPos[1] - $this->_contentPos[0]; + return $length < 1 ? '' : fread($this->_fh, $length); + } + + /** + * Return size of part + * + * Quite simple implemented currently (not decoding). Handle with care. + * + * @return int size + */ + public function getSize() { + return $this->_contentPos[1] - $this->_contentPos[0]; + } + + /** + * Get part of multipart message + * + * @param int $num number of part starting with 1 for first part + * @return Zend_Mail_Part wanted part + * @throws Zend_Mail_Exception + */ + public function getPart($num) + { + --$num; + if (!isset($this->_partPos[$num])) { + /** + * @see Zend_Mail_Exception + */ + require_once 'Zend/Mail/Exception.php'; + throw new Zend_Mail_Exception('part not found'); + } + + return new self(array('file' => $this->_fh, 'startPos' => $this->_partPos[$num][0], + 'endPos' => $this->_partPos[$num][1])); + } +} diff --git a/webui/Zend/Mail/Part/Interface.php b/webui/Zend/Mail/Part/Interface.php new file mode 100644 index 0000000..3458b78 --- /dev/null +++ b/webui/Zend/Mail/Part/Interface.php @@ -0,0 +1,136 @@ + value) + */ + public function getHeaders(); + + /** + * Get a header in specificed format + * + * Internally headers that occur more than once are saved as array, all other as string. If $format + * is set to string implode is used to concat the values (with Zend_Mime::LINEEND as delim). + * + * @param string $name name of header, matches case-insensitive, but camel-case is replaced with dashes + * @param string $format change type of return value to 'string' or 'array' + * @return string|array value of header in wanted or internal format + * @throws Zend_Mail_Exception + */ + public function getHeader($name, $format = null); + + /** + * Get a specific field from a header like content type or all fields as array + * + * If the header occurs more than once, only the value from the first header + * is returned. + * + * Throws a Zend_Mail_Exception if the requested header does not exist. If + * the specific header field does not exist, returns null. + * + * @param string $name name of header, like in getHeader() + * @param string $wantedPart the wanted part, default is first, if null an array with all parts is returned + * @param string $firstName key name for the first part + * @return string|array wanted part or all parts as array($firstName => firstPart, partname => value) + * @throws Zend_Exception, Zend_Mail_Exception + */ + public function getHeaderField($name, $wantedPart = 0, $firstName = 0); + + + /** + * Getter for mail headers - name is matched in lowercase + * + * This getter is short for Zend_Mail_Part::getHeader($name, 'string') + * + * @see Zend_Mail_Part::getHeader() + * + * @param string $name header name + * @return string value of header + * @throws Zend_Mail_Exception + */ + public function __get($name); + + /** + * magic method to get content of part + * + * @return string content + */ + public function __toString(); +} \ No newline at end of file diff --git a/webui/Zend/Mail/Protocol/Abstract.php b/webui/Zend/Mail/Protocol/Abstract.php new file mode 100644 index 0000000..54de6fe --- /dev/null +++ b/webui/Zend/Mail/Protocol/Abstract.php @@ -0,0 +1,447 @@ +_validHost = new Zend_Validate(); + $this->_validHost->addValidator(new Zend_Validate_Hostname(Zend_Validate_Hostname::ALLOW_ALL)); + + if (!$this->_validHost->isValid($host)) { + /** + * @see Zend_Mail_Protocol_Exception + */ + require_once 'Zend/Mail/Protocol/Exception.php'; + throw new Zend_Mail_Protocol_Exception(join(', ', $this->_validHost->getMessages())); + } + + $this->_host = $host; + $this->_port = $port; + } + + + /** + * Class destructor to cleanup open resources + * + * @return void + */ + public function __destruct() + { + $this->_disconnect(); + } + + /** + * Set the maximum log size + * + * @param integer $maximumLog Maximum log size + * @return void + */ + public function setMaximumLog($maximumLog) + { + $this->_maximumLog = (int) $maximumLog; + } + + + /** + * Get the maximum log size + * + * @return int the maximum log size + */ + public function getMaximumLog() + { + return $this->_maximumLog; + } + + + /** + * Create a connection to the remote host + * + * Concrete adapters for this class will implement their own unique connect scripts, using the _connect() method to create the socket resource. + */ + abstract public function connect(); + + + /** + * Retrieve the last client request + * + * @return string + */ + public function getRequest() + { + return $this->_request; + } + + + /** + * Retrieve the last server response + * + * @return array + */ + public function getResponse() + { + return $this->_response; + } + + + /** + * Retrieve the transaction log + * + * @return string + */ + public function getLog() + { + return implode('', $this->_log); + } + + + /** + * Reset the transaction log + * + * @return void + */ + public function resetLog() + { + $this->_log = array(); + } + + /** + * Add the transaction log + * + * @param string new transaction + * @return void + */ + protected function _addLog($value) + { + if ($this->_maximumLog >= 0 && count($this->_log) >= $this->_maximumLog) { + array_shift($this->_log); + } + + $this->_log[] = $value; + } + + /** + * Connect to the server using the supplied transport and target + * + * An example $remote string may be 'tcp://mail.example.com:25' or 'ssh://hostname.com:2222' + * + * @param string $remote Remote + * @throws Zend_Mail_Protocol_Exception + * @return boolean + */ + protected function _connect($remote) + { + $errorNum = 0; + $errorStr = ''; + + // open connection + $this->_socket = @stream_socket_client($remote, $errorNum, $errorStr, self::TIMEOUT_CONNECTION); + + if ($this->_socket === false) { + if ($errorNum == 0) { + $errorStr = 'Could not open socket'; + } + /** + * @see Zend_Mail_Protocol_Exception + */ + require_once 'Zend/Mail/Protocol/Exception.php'; + throw new Zend_Mail_Protocol_Exception($errorStr); + } + + if (($result = $this->_setStreamTimeout(self::TIMEOUT_CONNECTION)) === false) { + /** + * @see Zend_Mail_Protocol_Exception + */ + require_once 'Zend/Mail/Protocol/Exception.php'; + throw new Zend_Mail_Protocol_Exception('Could not set stream timeout'); + } + + return $result; + } + + + /** + * Disconnect from remote host and free resource + * + * @return void + */ + protected function _disconnect() + { + if (is_resource($this->_socket)) { + fclose($this->_socket); + } + } + + + /** + * Send the given request followed by a LINEEND to the server. + * + * @param string $request + * @throws Zend_Mail_Protocol_Exception + * @return integer|boolean Number of bytes written to remote host + */ + protected function _send($request) + { + if (!is_resource($this->_socket)) { + /** + * @see Zend_Mail_Protocol_Exception + */ + require_once 'Zend/Mail/Protocol/Exception.php'; + throw new Zend_Mail_Protocol_Exception('No connection has been established to ' . $this->_host); + } + + $this->_request = $request; + + $result = fwrite($this->_socket, $request . self::EOL); + + // Save request to internal log + $this->_addLog($request . self::EOL); + + if ($result === false) { + /** + * @see Zend_Mail_Protocol_Exception + */ + require_once 'Zend/Mail/Protocol/Exception.php'; + throw new Zend_Mail_Protocol_Exception('Could not send request to ' . $this->_host); + } + + return $result; + } + + + /** + * Get a line from the stream. + * + * @var integer $timeout Per-request timeout value if applicable + * @throws Zend_Mail_Protocol_Exception + * @return string + */ + protected function _receive($timeout = null) + { + if (!is_resource($this->_socket)) { + /** + * @see Zend_Mail_Protocol_Exception + */ + require_once 'Zend/Mail/Protocol/Exception.php'; + throw new Zend_Mail_Protocol_Exception('No connection has been established to ' . $this->_host); + } + + // Adapters may wish to supply per-commend timeouts according to appropriate RFC + if ($timeout !== null) { + $this->_setStreamTimeout($timeout); + } + + // Retrieve response + $reponse = fgets($this->_socket, 1024); + + // Save request to internal log + $this->_addLog($reponse); + + // Check meta data to ensure connection is still valid + $info = stream_get_meta_data($this->_socket); + + if (!empty($info['timed_out'])) { + /** + * @see Zend_Mail_Protocol_Exception + */ + require_once 'Zend/Mail/Protocol/Exception.php'; + throw new Zend_Mail_Protocol_Exception($this->_host . ' has timed out'); + } + + if ($reponse === false) { + /** + * @see Zend_Mail_Protocol_Exception + */ + require_once 'Zend/Mail/Protocol/Exception.php'; + throw new Zend_Mail_Protocol_Exception('Could not read from ' . $this->_host); + } + + return $reponse; + } + + + /** + * Parse server response for successful codes + * + * Read the response from the stream and check for expected return code. + * Throws a Zend_Mail_Protocol_Exception if an unexpected code is returned. + * + * @param string|array $code One or more codes that indicate a successful response + * @throws Zend_Mail_Protocol_Exception + * @return string Last line of response string + */ + protected function _expect($code, $timeout = null) + { + $this->_response = array(); + $cmd = ''; + $more = ''; + $msg = ''; + $errMsg = ''; + + if (!is_array($code)) { + $code = array($code); + } + + do { + $this->_response[] = $result = $this->_receive($timeout); + list($cmd, $more, $msg) = preg_split('/([\s-]+)/', $result, 2, PREG_SPLIT_DELIM_CAPTURE); + + if ($errMsg !== '') { + $errMsg .= ' ' . $msg; + } elseif ($cmd === null || !in_array($cmd, $code)) { + $errMsg = $msg; + } + + } while (strpos($more, '-') === 0); // The '-' message prefix indicates an information string instead of a response string. + + if ($errMsg !== '') { + /** + * @see Zend_Mail_Protocol_Exception + */ + require_once 'Zend/Mail/Protocol/Exception.php'; + throw new Zend_Mail_Protocol_Exception($errMsg, $cmd); + } + + return $msg; + } + + /** + * Set stream timeout + * + * @param integer $timeout + * @return boolean + */ + protected function _setStreamTimeout($timeout) + { + return stream_set_timeout($this->_socket, $timeout); + } +} diff --git a/webui/Zend/Mail/Protocol/Exception.php b/webui/Zend/Mail/Protocol/Exception.php new file mode 100644 index 0000000..e9a1e81 --- /dev/null +++ b/webui/Zend/Mail/Protocol/Exception.php @@ -0,0 +1,39 @@ +connect($host, $port, $ssl); + } + } + + /** + * Public destructor + */ + public function __destruct() + { + $this->logout(); + } + + /** + * Open connection to IMAP server + * + * @param string $host hostname or IP address of IMAP server + * @param int|null $port of IMAP server, default is 143 (993 for ssl) + * @param string|bool $ssl use 'SSL', 'TLS' or false + * @return string welcome message + * @throws Zend_Mail_Protocol_Exception + */ + public function connect($host, $port = null, $ssl = false) + { + if ($ssl == 'SSL') { + $host = 'ssl://' . $host; + } + + if ($port === null) { + $port = $ssl === 'SSL' ? 993 : 143; + } + + $errno = 0; + $errstr = ''; + $this->_socket = @fsockopen($host, $port, $errno, $errstr, self::TIMEOUT_CONNECTION); + if (!$this->_socket) { + /** + * @see Zend_Mail_Protocol_Exception + */ + require_once 'Zend/Mail/Protocol/Exception.php'; + throw new Zend_Mail_Protocol_Exception('cannot connect to host; error = ' . $errstr . + ' (errno = ' . $errno . ' )'); + } + + if (!$this->_assumedNextLine('* OK')) { + /** + * @see Zend_Mail_Protocol_Exception + */ + require_once 'Zend/Mail/Protocol/Exception.php'; + throw new Zend_Mail_Protocol_Exception('host doesn\'t allow connection'); + } + + if ($ssl === 'TLS') { + $result = $this->requestAndResponse('STARTTLS'); + $result = $result && stream_socket_enable_crypto($this->_socket, true, STREAM_CRYPTO_METHOD_TLS_CLIENT); + if (!$result) { + /** + * @see Zend_Mail_Protocol_Exception + */ + require_once 'Zend/Mail/Protocol/Exception.php'; + throw new Zend_Mail_Protocol_Exception('cannot enable TLS'); + } + } + } + + /** + * get the next line from socket with error checking, but nothing else + * + * @return string next line + * @throws Zend_Mail_Protocol_Exception + */ + protected function _nextLine() + { + $line = @fgets($this->_socket); + if ($line === false) { + /** + * @see Zend_Mail_Protocol_Exception + */ + require_once 'Zend/Mail/Protocol/Exception.php'; + throw new Zend_Mail_Protocol_Exception('cannot read - connection closed?'); + } + + return $line; + } + + /** + * get next line and assume it starts with $start. some requests give a simple + * feedback so we can quickly check if we can go on. + * + * @param string $start the first bytes we assume to be in the next line + * @return bool line starts with $start + * @throws Zend_Mail_Protocol_Exception + */ + protected function _assumedNextLine($start) + { + $line = $this->_nextLine(); + return strpos($line, $start) === 0; + } + + /** + * get next line and split the tag. that's the normal case for a response line + * + * @param string $tag tag of line is returned by reference + * @return string next line + * @throws Zend_Mail_Protocol_Exception + */ + protected function _nextTaggedLine(&$tag) + { + $line = $this->_nextLine(); + + // seperate tag from line + list($tag, $line) = explode(' ', $line, 2); + + return $line; + } + + /** + * split a given line in tokens. a token is literal of any form or a list + * + * @param string $line line to decode + * @return array tokens, literals are returned as string, lists as array + * @throws Zend_Mail_Protocol_Exception + */ + protected function _decodeLine($line) + { + $tokens = array(); + $stack = array(); + + /* + We start to decode the response here. The unterstood tokens are: + literal + "literal" or also "lit\\er\"al" + {bytes}literal + (literals*) + All tokens are returned in an array. Literals in braces (the last unterstood + token in the list) are returned as an array of tokens. I.e. the following response: + "foo" baz {3}bar ("f\\\"oo" bar) + would be returned as: + array('foo', 'baz', 'bar', array('f\\\"oo', 'bar')); + + // TODO: add handling of '[' and ']' to parser for easier handling of response text + */ + // replace any trailling including spaces with a single space + $line = rtrim($line) . ' '; + while (($pos = strpos($line, ' ')) !== false) { + $token = substr($line, 0, $pos); + while ($token[0] == '(') { + array_push($stack, $tokens); + $tokens = array(); + $token = substr($token, 1); + } + if ($token[0] == '"') { + if (preg_match('%^\(*"((.|\\\\|\\")*?)" *%', $line, $matches)) { + $tokens[] = $matches[1]; + $line = substr($line, strlen($matches[0])); + continue; + } + } + if ($token[0] == '{') { + $endPos = strpos($token, '}'); + $chars = substr($token, 1, $endPos - 1); + if (is_numeric($chars)) { + $token = ''; + while (strlen($token) < $chars) { + $token .= $this->_nextLine(); + } + $line = ''; + if (strlen($token) > $chars) { + $line = substr($token, $chars); + $token = substr($token, 0, $chars); + } else { + $line .= $this->_nextLine(); + } + $tokens[] = $token; + $line = trim($line) . ' '; + continue; + } + } + if ($stack && $token[strlen($token) - 1] == ')') { + // closing braces are not seperated by spaces, so we need to count them + $braces = strlen($token); + $token = rtrim($token, ')'); + // only count braces if more than one + $braces -= strlen($token) + 1; + // only add if token had more than just closing braces + if (rtrim($token) != '') { + $tokens[] = rtrim($token); + } + $token = $tokens; + $tokens = array_pop($stack); + // special handline if more than one closing brace + while ($braces-- > 0) { + $tokens[] = $token; + $token = $tokens; + $tokens = array_pop($stack); + } + } + $tokens[] = $token; + $line = substr($line, $pos + 1); + } + + // maybe the server forgot to send some closing braces + while ($stack) { + $child = $tokens; + $tokens = array_pop($stack); + $tokens[] = $child; + } + + return $tokens; + } + + /** + * read a response "line" (could also be more than one real line if response has {..}) + * and do a simple decode + * + * @param array|string $tokens decoded tokens are returned by reference, if $dontParse + * is true the unparsed line is returned here + * @param string $wantedTag check for this tag for response code. Default '*' is + * continuation tag. + * @param bool $dontParse if true only the unparsed line is returned $tokens + * @return bool if returned tag matches wanted tag + * @throws Zend_Mail_Protocol_Exception + */ + public function readLine(&$tokens = array(), $wantedTag = '*', $dontParse = false) + { + $line = $this->_nextTaggedLine($tag); + if (!$dontParse) { + $tokens = $this->_decodeLine($line); + } else { + $tokens = $line; + } + + // if tag is wanted tag we might be at the end of a multiline response + return $tag == $wantedTag; + } + + /** + * read all lines of response until given tag is found (last line of response) + * + * @param string $tag the tag of your request + * @param string|array $filter you can filter the response so you get only the + * given response lines + * @param bool $dontParse if true every line is returned unparsed instead of + * the decoded tokens + * @return null|bool|array tokens if success, false if error, null if bad request + * @throws Zend_Mail_Protocol_Exception + */ + public function readResponse($tag, $dontParse = false) + { + $lines = array(); + while (!$this->readLine($tokens, $tag, $dontParse)) { + $lines[] = $tokens; + } + + if ($dontParse) { + // last to chars are still needed for response code + $tokens = array(substr($tokens, 0, 2)); + } + // last line has response code + if ($tokens[0] == 'OK') { + return $lines ? $lines : true; + } else if ($tokens[0] == 'NO'){ + return false; + } + return null; + } + + /** + * send a request + * + * @param string $command your request command + * @param array $tokens additional parameters to command, use escapeString() to prepare + * @param string $tag provide a tag otherwise an autogenerated is returned + * @return null + * @throws Zend_Mail_Protocol_Exception + */ + public function sendRequest($command, $tokens = array(), &$tag = null) + { + if (!$tag) { + ++$this->_tagCount; + $tag = 'TAG' . $this->_tagCount; + } + + $line = $tag . ' ' . $command; + + foreach ($tokens as $token) { + if (is_array($token)) { + if (@fputs($this->_socket, $line . ' ' . $token[0] . "\r\n") === false) { + /** + * @see Zend_Mail_Protocol_Exception + */ + require_once 'Zend/Mail/Protocol/Exception.php'; + throw new Zend_Mail_Protocol_Exception('cannot write - connection closed?'); + } + if (!$this->_assumedNextLine('+ ')) { + /** + * @see Zend_Mail_Protocol_Exception + */ + require_once 'Zend/Mail/Protocol/Exception.php'; + throw new Zend_Mail_Protocol_Exception('cannot send literal string'); + } + $line = $token[1]; + } else { + $line .= ' ' . $token; + } + } + + if (@fputs($this->_socket, $line . "\r\n") === false) { + /** + * @see Zend_Mail_Protocol_Exception + */ + require_once 'Zend/Mail/Protocol/Exception.php'; + throw new Zend_Mail_Protocol_Exception('cannot write - connection closed?'); + } + } + + /** + * send a request and get response at once + * + * @param string $command command as in sendRequest() + * @param array $tokens parameters as in sendRequest() + * @param bool $dontParse if true unparsed lines are returned instead of tokens + * @return mixed response as in readResponse() + * @throws Zend_Mail_Protocol_Exception + */ + public function requestAndResponse($command, $tokens = array(), $dontParse = false) + { + $this->sendRequest($command, $tokens, $tag); + $response = $this->readResponse($tag, $dontParse); + + return $response; + } + + + public function pilerListFolders() { + $folders = array(); + + $a = $this->requestAndResponse("LIST", array('""', '"*"')); + + while(list($k, $v) = each($a)) { + if($v[1][0] == '\HasNoChildren') { + array_push($folders, $v[3]); + } + } + + return $folders; + } + + + /** + * escape one or more literals i.e. for sendRequest + * + * @param string|array $string the literal/-s + * @return string|array escape literals, literals with newline ar returned + * as array('{size}', 'string'); + */ + public function escapeString($string) + { + if (func_num_args() < 2) { + if (strpos($string, "\n") !== false) { + return array('{' . strlen($string) . '}', $string); + } else { + return '"' . str_replace(array('\\', '"'), array('\\\\', '\\"'), $string) . '"'; + } + } + $result = array(); + foreach (func_get_args() as $string) { + $result[] = $this->escapeString($string); + } + return $result; + } + + /** + * escape a list with literals or lists + * + * @param array $list list with literals or lists as PHP array + * @return string escaped list for imap + */ + public function escapeList($list) + { + $result = array(); + foreach ($list as $k => $v) { + if (!is_array($v)) { +// $result[] = $this->escapeString($v); + $result[] = $v; + continue; + } + $result[] = $this->escapeList($v); + } + return '(' . implode(' ', $result) . ')'; + } + + /** + * Login to IMAP server. + * + * @param string $user username + * @param string $password password + * @return bool success + * @throws Zend_Mail_Protocol_Exception + */ + public function login($user, $password) + { + return $this->requestAndResponse('LOGIN', $this->escapeString($user, $password), true); + } + + /** + * logout of imap server + * + * @return bool success + */ + public function logout() + { + $result = false; + if ($this->_socket) { + try { + $result = $this->requestAndResponse('LOGOUT', array(), true); + } catch (Zend_Mail_Protocol_Exception $e) { + // ignoring exception + } + fclose($this->_socket); + $this->_socket = null; + } + return $result; + } + + + /** + * Get capabilities from IMAP server + * + * @return array list of capabilities + * @throws Zend_Mail_Protocol_Exception + */ + public function capability() + { + $response = $this->requestAndResponse('CAPABILITY'); + + if (!$response) { + return $response; + } + + $capabilities = array(); + foreach ($response as $line) { + $capabilities = array_merge($capabilities, $line); + } + return $capabilities; + } + + /** + * Examine and select have the same response. The common code for both + * is in this method + * + * @param string $command can be 'EXAMINE' or 'SELECT' and this is used as command + * @param string $box which folder to change to or examine + * @return bool|array false if error, array with returned information + * otherwise (flags, exists, recent, uidvalidity) + * @throws Zend_Mail_Protocol_Exception + */ + public function examineOrSelect($command = 'EXAMINE', $box = 'INBOX') + { + $this->sendRequest($command, array($this->escapeString($box)), $tag); + + $result = array(); + while (!$this->readLine($tokens, $tag)) { + if ($tokens[0] == 'FLAGS') { + array_shift($tokens); + $result['flags'] = $tokens; + continue; + } + switch ($tokens[1]) { + case 'EXISTS': + case 'RECENT': + $result[strtolower($tokens[1])] = $tokens[0]; + break; + case '[UIDVALIDITY': + $result['uidvalidity'] = (int)$tokens[2]; + break; + default: + // ignore + } + } + + if ($tokens[0] != 'OK') { + return false; + } + return $result; + } + + /** + * change folder + * + * @param string $box change to this folder + * @return bool|array see examineOrselect() + * @throws Zend_Mail_Protocol_Exception + */ + public function select($box = 'INBOX') + { + return $this->examineOrSelect('SELECT', $box); + } + + /** + * examine folder + * + * @param string $box examine this folder + * @return bool|array see examineOrselect() + * @throws Zend_Mail_Protocol_Exception + */ + public function examine($box = 'INBOX') + { + return $this->examineOrSelect('EXAMINE', $box); + } + + /** + * fetch one or more items of one or more messages + * + * @param string|array $items items to fetch from message(s) as string (if only one item) + * or array of strings + * @param int $from message for items or start message if $to !== null + * @param int|null $to if null only one message ($from) is fetched, else it's the + * last message, INF means last message avaible + * @return string|array if only one item of one message is fetched it's returned as string + * if items of one message are fetched it's returned as (name => value) + * if one items of messages are fetched it's returned as (msgno => value) + * if items of messages are fetchted it's returned as (msgno => (name => value)) + * @throws Zend_Mail_Protocol_Exception + */ + public function fetch($items, $from, $to = null) + { + if (is_array($from)) { + $set = implode(',', $from); + } else if ($to === null) { + $set = (int)$from; + } else if ($to === INF) { + $set = (int)$from . ':*'; + } else { + $set = (int)$from . ':' . (int)$to; + } + + $items = (array)$items; + $itemList = $this->escapeList($items); + + $this->sendRequest('FETCH', array($set, $itemList), $tag); + + $result = array(); + while (!$this->readLine($tokens, $tag)) { + // ignore other responses + if ($tokens[1] != 'FETCH') { + continue; + } + // ignore other messages + if ($to === null && !is_array($from) && $tokens[0] != $from) { + continue; + } + // if we only want one item we return that one directly + if (count($items) == 1) { + if ($tokens[2][0] == $items[0]) { + $data = $tokens[2][1]; + } else { + // maybe the server send an other field we didn't wanted + $count = count($tokens[2]); + // we start with 2, because 0 was already checked + for ($i = 2; $i < $count; $i += 2) { + if ($tokens[2][$i] != $items[0]) { + continue; + } + $data = $tokens[2][$i + 1]; + break; + } + } + } else { + $data = array(); + while (key($tokens[2]) !== null) { + $data[current($tokens[2])] = next($tokens[2]); + next($tokens[2]); + } + } + // if we want only one message we can ignore everything else and just return + if ($to === null && !is_array($from) && $tokens[0] == $from) { + // we still need to read all lines + while (!$this->readLine($tokens, $tag)); + return $data; + } + $result[$tokens[0]] = $data; + } + + if ($to === null && !is_array($from)) { + /** + * @see Zend_Mail_Protocol_Exception + */ + require_once 'Zend/Mail/Protocol/Exception.php'; + throw new Zend_Mail_Protocol_Exception('the single id was not found in response'); + } + + return $result; + } + + /** + * get mailbox list + * + * this method can't be named after the IMAP command 'LIST', as list is a reserved keyword + * + * @param string $reference mailbox reference for list + * @param string $mailbox mailbox name match with wildcards + * @return array mailboxes that matched $mailbox as array(globalName => array('delim' => .., 'flags' => ..)) + * @throws Zend_Mail_Protocol_Exception + */ + public function listMailbox($reference = '', $mailbox = '*') + { + $result = array(); + $list = $this->requestAndResponse('LIST', $this->escapeString($reference, $mailbox)); + if (!$list || $list === true) { + return $result; + } + + foreach ($list as $item) { + if (count($item) != 4 || $item[0] != 'LIST') { + continue; + } + $result[$item[3]] = array('delim' => $item[2], 'flags' => $item[1]); + } + + return $result; + } + + /** + * set flags + * + * @param array $flags flags to set, add or remove - see $mode + * @param int $from message for items or start message if $to !== null + * @param int|null $to if null only one message ($from) is fetched, else it's the + * last message, INF means last message avaible + * @param string|null $mode '+' to add flags, '-' to remove flags, everything else sets the flags as given + * @param bool $silent if false the return values are the new flags for the wanted messages + * @return bool|array new flags if $silent is false, else true or false depending on success + * @throws Zend_Mail_Protocol_Exception + */ + public function store(array $flags, $from, $to = null, $mode = null, $silent = true) + { + $item = 'FLAGS'; + if ($mode == '+' || $mode == '-') { + $item = $mode . $item; + } + if ($silent) { + $item .= '.SILENT'; + } + + $flags = $this->escapeList($flags); + $set = (int)$from; + if ($to != null) { + $set .= ':' . ($to == INF ? '*' : (int)$to); + } + + $result = $this->requestAndResponse('STORE', array($set, $item, $flags), $silent); + + if ($silent) { + return $result ? true : false; + } + + $tokens = $result; + $result = array(); + foreach ($tokens as $token) { + if ($token[1] != 'FETCH' || $token[2][0] != 'FLAGS') { + continue; + } + $result[$token[0]] = $token[2][1]; + } + + return $result; + } + + /** + * append a new message to given folder + * + * @param string $folder name of target folder + * @param string $message full message content + * @param array $flags flags for new message + * @param string $date date for new message + * @return bool success + * @throws Zend_Mail_Protocol_Exception + */ + public function append($folder, $message, $flags = null, $date = null) + { + $tokens = array(); + $tokens[] = $this->escapeString($folder); + if ($flags !== null) { + $tokens[] = $this->escapeList($flags); + } + if ($date !== null) { + $tokens[] = $this->escapeString($date); + } + $tokens[] = $this->escapeString($message); + + return $this->requestAndResponse('APPEND', $tokens, true); + } + + /** + * copy message set from current folder to other folder + * + * @param string $folder destination folder + * @param int|null $to if null only one message ($from) is fetched, else it's the + * last message, INF means last message avaible + * @return bool success + * @throws Zend_Mail_Protocol_Exception + */ + public function copy($folder, $from, $to = null) + { + $set = (int)$from; + if ($to != null) { + $set .= ':' . ($to == INF ? '*' : (int)$to); + } + + return $this->requestAndResponse('COPY', array($set, $this->escapeString($folder)), true); + } + + /** + * create a new folder (and parent folders if needed) + * + * @param string $folder folder name + * @return bool success + */ + public function create($folder) + { + return $this->requestAndResponse('CREATE', array($this->escapeString($folder)), true); + } + + /** + * rename an existing folder + * + * @param string $old old name + * @param string $new new name + * @return bool success + */ + public function rename($old, $new) + { + return $this->requestAndResponse('RENAME', $this->escapeString($old, $new), true); + } + + /** + * remove a folder + * + * @param string $folder folder name + * @return bool success + */ + public function delete($folder) + { + return $this->requestAndResponse('DELETE', array($this->escapeString($folder)), true); + } + + /** + * permanently remove messages + * + * @return bool success + */ + public function expunge() + { + // TODO: parse response? + return $this->requestAndResponse('EXPUNGE'); + } + + /** + * send noop + * + * @return bool success + */ + public function noop() + { + // TODO: parse response + return $this->requestAndResponse('NOOP'); + } + + /** + * do a search request + * + * This method is currently marked as internal as the API might change and is not + * safe if you don't take precautions. + * + * @internal + * @return array message ids + */ + public function search(array $params) + { + $response = $this->requestAndResponse('SEARCH', $params); + if (!$response) { + return $response; + } + + foreach ($response as $ids) { + if ($ids[0] == 'SEARCH') { + array_shift($ids); + return $ids; + } + } + return array(); + } + +} diff --git a/webui/Zend/Mail/Protocol/Pop3.php b/webui/Zend/Mail/Protocol/Pop3.php new file mode 100644 index 0000000..afaf86d --- /dev/null +++ b/webui/Zend/Mail/Protocol/Pop3.php @@ -0,0 +1,472 @@ +connect($host, $port, $ssl); + } + } + + + /** + * Public destructor + */ + public function __destruct() + { + $this->logout(); + } + + + /** + * Open connection to POP3 server + * + * @param string $host hostname or IP address of POP3 server + * @param int|null $port of POP3 server, default is 110 (995 for ssl) + * @param string|bool $ssl use 'SSL', 'TLS' or false + * @return string welcome message + * @throws Zend_Mail_Protocol_Exception + */ + public function connect($host, $port = null, $ssl = false) + { + if ($ssl == 'SSL') { + $host = 'ssl://' . $host; + } + + if ($port === null) { + $port = $ssl == 'SSL' ? 995 : 110; + } + + $errno = 0; + $errstr = ''; + $this->_socket = @fsockopen($host, $port, $errno, $errstr, self::TIMEOUT_CONNECTION); + if (!$this->_socket) { + /** + * @see Zend_Mail_Protocol_Exception + */ + require_once 'Zend/Mail/Protocol/Exception.php'; + throw new Zend_Mail_Protocol_Exception('cannot connect to host; error = ' . $errstr . + ' (errno = ' . $errno . ' )'); + } + + $welcome = $this->readResponse(); + + strtok($welcome, '<'); + $this->_timestamp = strtok('>'); + if (!strpos($this->_timestamp, '@')) { + $this->_timestamp = null; + } else { + $this->_timestamp = '<' . $this->_timestamp . '>'; + } + + if ($ssl === 'TLS') { + $this->request('STLS'); + $result = stream_socket_enable_crypto($this->_socket, true, STREAM_CRYPTO_METHOD_TLS_CLIENT); + if (!$result) { + /** + * @see Zend_Mail_Protocol_Exception + */ + require_once 'Zend/Mail/Protocol/Exception.php'; + throw new Zend_Mail_Protocol_Exception('cannot enable TLS'); + } + } + + return $welcome; + } + + + /** + * Send a request + * + * @param string $request your request without newline + * @return null + * @throws Zend_Mail_Protocol_Exception + */ + public function sendRequest($request) + { + $result = @fputs($this->_socket, $request . "\r\n"); + if (!$result) { + /** + * @see Zend_Mail_Protocol_Exception + */ + require_once 'Zend/Mail/Protocol/Exception.php'; + throw new Zend_Mail_Protocol_Exception('send failed - connection closed?'); + } + } + + + /** + * read a response + * + * @param boolean $multiline response has multiple lines and should be read until "." + * @return string response + * @throws Zend_Mail_Protocol_Exception + */ + public function readResponse($multiline = false) + { + $result = @fgets($this->_socket); + if (!is_string($result)) { + /** + * @see Zend_Mail_Protocol_Exception + */ + require_once 'Zend/Mail/Protocol/Exception.php'; + throw new Zend_Mail_Protocol_Exception('read failed - connection closed?'); + } + + $result = trim($result); + if (strpos($result, ' ')) { + list($status, $message) = explode(' ', $result, 2); + } else { + $status = $result; + $message = ''; + } + + if ($status != '+OK') { + /** + * @see Zend_Mail_Protocol_Exception + */ + require_once 'Zend/Mail/Protocol/Exception.php'; + throw new Zend_Mail_Protocol_Exception('last request failed'); + } + + if ($multiline) { + $message = ''; + $line = fgets($this->_socket); + while ($line && rtrim($line, "\r\n") != '.') { + if ($line[0] == '.') { + $line = substr($line, 1); + } + $message .= $line; + $line = fgets($this->_socket); + }; + } + + return $message; + } + + + /** + * Send request and get resposne + * + * @see sendRequest(), readResponse() + * + * @param string $request request + * @param bool $multiline multiline response? + * @return string result from readResponse() + * @throws Zend_Mail_Protocol_Exception + */ + public function request($request, $multiline = false) + { + $this->sendRequest($request); + return $this->readResponse($multiline); + } + + + /** + * End communication with POP3 server (also closes socket) + * + * @return null + */ + public function logout() + { + if (!$this->_socket) { + return; + } + + try { + $this->request('QUIT'); + } catch (Zend_Mail_Protocol_Exception $e) { + // ignore error - we're closing the socket anyway + } + + fclose($this->_socket); + $this->_socket = null; + } + + + /** + * Get capabilities from POP3 server + * + * @return array list of capabilities + * @throws Zend_Mail_Protocol_Exception + */ + public function capa() + { + $result = $this->request('CAPA', true); + return explode("\n", $result); + } + + + /** + * Login to POP3 server. Can use APOP + * + * @param string $user username + * @param string $password password + * @param bool $try_apop should APOP be tried? + * @return void + * @throws Zend_Mail_Protocol_Exception + */ + public function login($user, $password, $tryApop = true) + { + if ($tryApop && $this->_timestamp) { + try { + $this->request("APOP $user " . md5($this->_timestamp . $password)); + return; + } catch (Zend_Mail_Protocol_Exception $e) { + // ignore + } + } + + $result = $this->request("USER $user"); + $result = $this->request("PASS $password"); + } + + + /** + * Make STAT call for message count and size sum + * + * @param int $messages out parameter with count of messages + * @param int $octets out parameter with size in octects of messages + * @return void + * @throws Zend_Mail_Protocol_Exception + */ + public function status(&$messages, &$octets) + { + $messages = 0; + $octets = 0; + $result = $this->request('STAT'); + + list($messages, $octets) = explode(' ', $result); + } + + + /** + * Make LIST call for size of message(s) + * + * @param int|null $msgno number of message, null for all + * @return int|array size of given message or list with array(num => size) + * @throws Zend_Mail_Protocol_Exception + */ + public function getList($msgno = null) + { + if ($msgno !== null) { + $result = $this->request("LIST $msgno"); + + list(, $result) = explode(' ', $result); + return (int)$result; + } + + $result = $this->request('LIST', true); + $messages = array(); + $line = strtok($result, "\n"); + while ($line) { + list($no, $size) = explode(' ', trim($line)); + $messages[(int)$no] = (int)$size; + $line = strtok("\n"); + } + + return $messages; + } + + + /** + * Make UIDL call for getting a uniqueid + * + * @param int|null $msgno number of message, null for all + * @return string|array uniqueid of message or list with array(num => uniqueid) + * @throws Zend_Mail_Protocol_Exception + */ + public function uniqueid($msgno = null) + { + if ($msgno !== null) { + $result = $this->request("UIDL $msgno"); + + list(, $result) = explode(' ', $result); + return $result; + } + + $result = $this->request('UIDL', true); + + $result = explode("\n", $result); + $messages = array(); + foreach ($result as $line) { + if (!$line) { + continue; + } + list($no, $id) = explode(' ', trim($line), 2); + $messages[(int)$no] = $id; + } + + return $messages; + + } + + + /** + * Make TOP call for getting headers and maybe some body lines + * This method also sets hasTop - before it it's not known if top is supported + * + * The fallback makes normale RETR call, which retrieves the whole message. Additional + * lines are not removed. + * + * @param int $msgno number of message + * @param int $lines number of wanted body lines (empty line is inserted after header lines) + * @param bool $fallback fallback with full retrieve if top is not supported + * @return string message headers with wanted body lines + * @throws Zend_Mail_Protocol_Exception + */ + public function top($msgno, $lines = 0, $fallback = false) + { + if ($this->hasTop === false) { + if ($fallback) { + return $this->retrieve($msgno); + } else { + /** + * @see Zend_Mail_Protocol_Exception + */ + require_once 'Zend/Mail/Protocol/Exception.php'; + throw new Zend_Mail_Protocol_Exception('top not supported and no fallback wanted'); + } + } + $this->hasTop = true; + + $lines = (!$lines || $lines < 1) ? 0 : (int)$lines; + + try { + $result = $this->request("TOP $msgno $lines", true); + } catch (Zend_Mail_Protocol_Exception $e) { + $this->hasTop = false; + if ($fallback) { + $result = $this->retrieve($msgno); + } else { + throw $e; + } + } + + return $result; + } + + + /** + * Make a RETR call for retrieving a full message with headers and body + * + * @deprecated since 1.1.0; this method has a typo - please use retrieve() + * @param int $msgno message number + * @return string message + * @throws Zend_Mail_Protocol_Exception + */ + public function retrive($msgno) + { + return $this->retrieve($msgno); + } + + + /** + * Make a RETR call for retrieving a full message with headers and body + * + * @param int $msgno message number + * @return string message + * @throws Zend_Mail_Protocol_Exception + */ + public function retrieve($msgno) + { + $result = $this->request("RETR $msgno", true); + return $result; + } + + /** + * Make a NOOP call, maybe needed for keeping the server happy + * + * @return null + * @throws Zend_Mail_Protocol_Exception + */ + public function noop() + { + $this->request('NOOP'); + } + + + /** + * Make a DELE count to remove a message + * + * @return null + * @throws Zend_Mail_Protocol_Exception + */ + public function delete($msgno) + { + $this->request("DELE $msgno"); + } + + + /** + * Make RSET call, which rollbacks delete requests + * + * @return null + * @throws Zend_Mail_Protocol_Exception + */ + public function undelete() + { + $this->request('RSET'); + } +} diff --git a/webui/Zend/Mail/Protocol/Smtp.php b/webui/Zend/Mail/Protocol/Smtp.php new file mode 100644 index 0000000..5a50a23 --- /dev/null +++ b/webui/Zend/Mail/Protocol/Smtp.php @@ -0,0 +1,443 @@ +_secure = 'tls'; + break; + + case 'ssl': + $this->_transport = 'ssl'; + $this->_secure = 'ssl'; + if ($port == null) { + $port = 465; + } + break; + + default: + /** + * @see Zend_Mail_Protocol_Exception + */ + require_once 'Zend/Mail/Protocol/Exception.php'; + throw new Zend_Mail_Protocol_Exception($config['ssl'] . ' is unsupported SSL type'); + break; + } + } + + // If no port has been specified then check the master PHP ini file. Defaults to 25 if the ini setting is null. + if ($port == null) { + if (($port = ini_get('smtp_port')) == '') { + $port = 25; + } + } + + parent::__construct($host, $port); + } + + + /** + * Connect to the server with the parameters given in the constructor. + * + * @return boolean + */ + public function connect() + { + return $this->_connect($this->_transport . '://' . $this->_host . ':'. $this->_port); + } + + + /** + * Initiate HELO/EHLO sequence and set flag to indicate valid smtp session + * + * @param string $host The client hostname or IP address (default: 127.0.0.1) + * @throws Zend_Mail_Protocol_Exception + * @return void + */ + public function helo($host = '127.0.0.1') + { + // Respect RFC 2821 and disallow HELO attempts if session is already initiated. + if ($this->_sess === true) { + /** + * @see Zend_Mail_Protocol_Exception + */ + require_once 'Zend/Mail/Protocol/Exception.php'; + throw new Zend_Mail_Protocol_Exception('Cannot issue HELO to existing session'); + } + + // Validate client hostname + if (!$this->_validHost->isValid($host)) { + /** + * @see Zend_Mail_Protocol_Exception + */ + require_once 'Zend/Mail/Protocol/Exception.php'; + throw new Zend_Mail_Protocol_Exception(join(', ', $this->_validHost->getMessages())); + } + + // Initiate helo sequence + $this->_expect(220, 300); // Timeout set for 5 minutes as per RFC 2821 4.5.3.2 + $this->_ehlo($host); + + // If a TLS session is required, commence negotiation + if ($this->_secure == 'tls') { + $this->_send('STARTTLS'); + $this->_expect(220, 180); + if (!stream_socket_enable_crypto($this->_socket, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)) { + /** + * @see Zend_Mail_Protocol_Exception + */ + require_once 'Zend/Mail/Protocol/Exception.php'; + throw new Zend_Mail_Protocol_Exception('Unable to connect via TLS'); + } + $this->_ehlo($host); + } + + $this->_startSession(); + $this->auth(); + } + + + /** + * Send EHLO or HELO depending on capabilities of smtp host + * + * @param string $host The client hostname or IP address (default: 127.0.0.1) + * @throws Zend_Mail_Protocol_Exception + * @return void + */ + protected function _ehlo($host) + { + // Support for older, less-compliant remote servers. Tries multiple attempts of EHLO or HELO. + try { + $this->_send('EHLO ' . $host); + $this->_expect(250, 300); // Timeout set for 5 minutes as per RFC 2821 4.5.3.2 + } catch (Zend_Mail_Protocol_Exception $e) { + $this->_send('HELO ' . $host); + $this->_expect(250, 300); // Timeout set for 5 minutes as per RFC 2821 4.5.3.2 + } catch (Zend_Mail_Protocol_Exception $e) { + throw $e; + } + } + + + /** + * Issues MAIL command + * + * @param string $from Sender mailbox + * @throws Zend_Mail_Protocol_Exception + * @return void + */ + public function mail($from) + { + if ($this->_sess !== true) { + /** + * @see Zend_Mail_Protocol_Exception + */ + require_once 'Zend/Mail/Protocol/Exception.php'; + throw new Zend_Mail_Protocol_Exception('A valid session has not been started'); + } + + $this->_send('MAIL FROM:<' . $from . '>'); + $this->_expect(250, 300); // Timeout set for 5 minutes as per RFC 2821 4.5.3.2 + + // Set mail to true, clear recipients and any existing data flags as per 4.1.1.2 of RFC 2821 + $this->_mail = true; + $this->_rcpt = false; + $this->_data = false; + } + + + /** + * Issues RCPT command + * + * @param string $to Receiver(s) mailbox + * @throws Zend_Mail_Protocol_Exception + * @return void + */ + public function rcpt($to) + { + if ($this->_mail !== true) { + /** + * @see Zend_Mail_Protocol_Exception + */ + require_once 'Zend/Mail/Protocol/Exception.php'; + throw new Zend_Mail_Protocol_Exception('No sender reverse path has been supplied'); + } + + // Set rcpt to true, as per 4.1.1.3 of RFC 2821 + $this->_send('RCPT TO:<' . $to . '>'); + $this->_expect(array(250, 251), 300); // Timeout set for 5 minutes as per RFC 2821 4.5.3.2 + $this->_rcpt = true; + } + + + /** + * Issues DATA command + * + * @param string $data + * @throws Zend_Mail_Protocol_Exception + * @return void + */ + public function data($data) + { + // Ensure recipients have been set + if ($this->_rcpt !== true) { + /** + * @see Zend_Mail_Protocol_Exception + */ + require_once 'Zend/Mail/Protocol/Exception.php'; + throw new Zend_Mail_Protocol_Exception('No recipient forward path has been supplied'); + } + + $this->_send('DATA'); + $this->_expect(354, 120); // Timeout set for 2 minutes as per RFC 2821 4.5.3.2 + + foreach (explode(Zend_Mime::LINEEND, $data) as $line) { + if (strpos($line, '.') === 0) { + // Escape lines prefixed with a '.' + $line = '.' . $line; + } + $this->_send($line); + } + + $this->_send('.'); + $this->_expect(250, 600); // Timeout set for 10 minutes as per RFC 2821 4.5.3.2 + $this->_data = true; + } + + + /** + * Issues the RSET command and validates answer + * + * Can be used to restore a clean smtp communication state when a transaction has been cancelled or commencing a new transaction. + * + * @return void + */ + public function rset() + { + $this->_send('RSET'); + // MS ESMTP doesn't follow RFC, see [ZF-1377] + $this->_expect(array(250, 220)); + + $this->_mail = false; + $this->_rcpt = false; + $this->_data = false; + } + + + /** + * Issues the NOOP command and validates answer + * + * Not used by Zend_Mail, could be used to keep a connection alive or check if it is still open. + * + * @return void + */ + public function noop() + { + $this->_send('NOOP'); + $this->_expect(250, 300); // Timeout set for 5 minutes as per RFC 2821 4.5.3.2 + } + + + /** + * Issues the VRFY command and validates answer + * + * Not used by Zend_Mail. + * + * @param string $user User Name or eMail to verify + * @return void + */ + public function vrfy($user) + { + $this->_send('VRFY ' . $user); + $this->_expect(array(250, 251, 252), 300); // Timeout set for 5 minutes as per RFC 2821 4.5.3.2 + } + + + /** + * Issues the QUIT command and clears the current session + * + * @return void + */ + public function quit() + { + if ($this->_sess) { + $this->_send('QUIT'); + $this->_expect(221, 300); // Timeout set for 5 minutes as per RFC 2821 4.5.3.2 + $this->_stopSession(); + } + } + + + /** + * Default authentication method + * + * This default method is implemented by AUTH adapters to properly authenticate to a remote host. + * + * @throws Zend_Mail_Protocol_Exception + * @return void + */ + public function auth() + { + if ($this->_auth === true) { + /** + * @see Zend_Mail_Protocol_Exception + */ + require_once 'Zend/Mail/Protocol/Exception.php'; + throw new Zend_Mail_Protocol_Exception('Already authenticated for this session'); + } + } + + + /** + * Closes connection + * + * @return void + */ + public function disconnect() + { + $this->_disconnect(); + } + + + /** + * Start mail session + * + * @return void + */ + protected function _startSession() + { + $this->_sess = true; + } + + + /** + * Stop mail session + * + * @return void + */ + protected function _stopSession() + { + $this->_sess = false; + } +} diff --git a/webui/Zend/Mail/Protocol/Smtp/Auth/Crammd5.php b/webui/Zend/Mail/Protocol/Smtp/Auth/Crammd5.php new file mode 100644 index 0000000..8597bfe --- /dev/null +++ b/webui/Zend/Mail/Protocol/Smtp/Auth/Crammd5.php @@ -0,0 +1,108 @@ +_username = $config['username']; + } + if (isset($config['password'])) { + $this->_password = $config['password']; + } + } + + parent::__construct($host, $port, $config); + } + + + /** + * @todo Perform CRAM-MD5 authentication with supplied credentials + * + * @return void + */ + public function auth() + { + // Ensure AUTH has not already been initiated. + parent::auth(); + + $this->_send('AUTH CRAM-MD5'); + $challenge = $this->_expect(334); + $challenge = base64_decode($challenge); + $digest = $this->_hmacMd5($this->_password, $challenge); + $this->_send(base64_encode($this->_username . ' ' . $digest)); + $this->_expect(235); + $this->_auth = true; + } + + + /** + * Prepare CRAM-MD5 response to server's ticket + * + * @param string $key Challenge key (usually password) + * @param string $data Challenge data + * @param string $block Length of blocks + * @return string + */ + protected function _hmacMd5($key, $data, $block = 64) + { + if (strlen($key) > 64) { + $key = pack('H32', md5($key)); + } elseif (strlen($key) < 64) { + $key = str_pad($key, $block, "\0"); + } + + $k_ipad = substr($key, 0, 64) ^ str_repeat(chr(0x36), 64); + $k_opad = substr($key, 0, 64) ^ str_repeat(chr(0x5C), 64); + + $inner = pack('H32', md5($k_ipad . $data)); + $digest = md5($k_opad . $inner); + + return $digest; + } +} diff --git a/webui/Zend/Mail/Protocol/Smtp/Auth/Login.php b/webui/Zend/Mail/Protocol/Smtp/Auth/Login.php new file mode 100644 index 0000000..ec2a1fe --- /dev/null +++ b/webui/Zend/Mail/Protocol/Smtp/Auth/Login.php @@ -0,0 +1,98 @@ +_username = $config['username']; + } + if (isset($config['password'])) { + $this->_password = $config['password']; + } + } + + parent::__construct($host, $port, $config); + } + + + /** + * Perform LOGIN authentication with supplied credentials + * + * @return void + */ + public function auth() + { + // Ensure AUTH has not already been initiated. + parent::auth(); + + $this->_send('AUTH LOGIN'); + $this->_expect(334); + $this->_send(base64_encode($this->_username)); + $this->_expect(334); + $this->_send(base64_encode($this->_password)); + $this->_expect(235); + $this->_auth = true; + } +} diff --git a/webui/Zend/Mail/Protocol/Smtp/Auth/Plain.php b/webui/Zend/Mail/Protocol/Smtp/Auth/Plain.php new file mode 100644 index 0000000..01d157e --- /dev/null +++ b/webui/Zend/Mail/Protocol/Smtp/Auth/Plain.php @@ -0,0 +1,96 @@ +_username = $config['username']; + } + if (isset($config['password'])) { + $this->_password = $config['password']; + } + } + + parent::__construct($host, $port, $config); + } + + + /** + * Perform PLAIN authentication with supplied credentials + * + * @return void + */ + public function auth() + { + // Ensure AUTH has not already been initiated. + parent::auth(); + + $this->_send('AUTH PLAIN'); + $this->_expect(334); + $this->_send(base64_encode("\0" . $this->_username . "\0" . $this->_password)); + $this->_expect(235); + $this->_auth = true; + } +} diff --git a/webui/Zend/Mail/Storage.php b/webui/Zend/Mail/Storage.php new file mode 100644 index 0000000..8b79281 --- /dev/null +++ b/webui/Zend/Mail/Storage.php @@ -0,0 +1,39 @@ + true, + 'delete' => false, + 'create' => false, + 'top' => false, + 'fetchPart' => true, + 'flags' => false); + + /** + * current iteration position + * @var int + */ + protected $_iterationPos = 0; + + /** + * maximum iteration position (= message count) + * @var null|int + */ + protected $_iterationMax = null; + + /** + * used message class, change it in an extened class to extend the returned message class + * @var string + */ + protected $_messageClass = 'Zend_Mail_Message'; + + /** + * Getter for has-properties. The standard has properties + * are: hasFolder, hasUniqueid, hasDelete, hasCreate, hasTop + * + * The valid values for the has-properties are: + * - true if a feature is supported + * - false if a feature is not supported + * - null is it's not yet known or it can't be know if a feature is supported + * + * @param string $var property name + * @return bool supported or not + * @throws Zend_Mail_Storage_Exception + */ + public function __get($var) + { + if (strpos($var, 'has') === 0) { + $var = strtolower(substr($var, 3)); + return isset($this->_has[$var]) ? $this->_has[$var] : null; + } + + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception($var . ' not found'); + } + + + /** + * Get a full list of features supported by the specific mail lib and the server + * + * @return array list of features as array(featurename => true|false[|null]) + */ + public function getCapabilities() + { + return $this->_has; + } + + + /** + * Count messages messages in current box/folder + * + * @return int number of messages + * @throws Zend_Mail_Storage_Exception + */ + abstract public function countMessages(); + + + /** + * Get a list of messages with number and size + * + * @param int $id number of message + * @return int|array size of given message of list with all messages as array(num => size) + */ + abstract public function getSize($id = 0); + + + /** + * Get a message with headers and body + * + * @param int $id number of message + * @return Zend_Mail_Message + */ + abstract public function getMessage($id); + + abstract public function getFullMessage($id); + + + /** + * Get raw header of message or part + * + * @param int $id number of message + * @param null|array|string $part path to part or null for messsage header + * @param int $topLines include this many lines with header (after an empty line) + * @return string raw header + */ + abstract public function getRawHeader($id, $part = null, $topLines = 0); + + /** + * Get raw content of message or part + * + * @param int $id number of message + * @param null|array|string $part path to part or null for messsage content + * @return string raw content + */ + abstract public function getRawContent($id, $part = null); + + /** + * Create instance with parameters + * + * @param array $params mail reader specific parameters + * @throws Zend_Mail_Storage_Exception + */ + abstract public function __construct($params); + + + /** + * Destructor calls close() and therefore closes the resource. + */ + public function __destruct() + { + $this->close(); + } + + + /** + * Close resource for mail lib. If you need to control, when the resource + * is closed. Otherwise the destructor would call this. + * + * @return null + */ + abstract public function close(); + + + /** + * Keep the resource alive. + * + * @return null + */ + abstract public function noop(); + + /** + * delete a message from current box/folder + * + * @return null + */ + abstract public function removeMessage($id); + + /** + * get unique id for one or all messages + * + * if storage does not support unique ids it's the same as the message number + * + * @param int|null $id message number + * @return array|string message number for given message or all messages as array + * @throws Zend_Mail_Storage_Exception + */ + abstract public function getUniqueId($id = null); + + /** + * get a message number from a unique id + * + * I.e. if you have a webmailer that supports deleting messages you should use unique ids + * as parameter and use this method to translate it to message number right before calling removeMessage() + * + * @param string $id unique id + * @return int message number + * @throws Zend_Mail_Storage_Exception + */ + abstract public function getNumberByUniqueId($id); + + // interface implementations follows + + /** + * Countable::count() + * + * @return int + */ + public function count() + { + return $this->countMessages(); + } + + + /** + * ArrayAccess::offsetExists() + * + * @param int $id + * @return boolean + */ + public function offsetExists($id) + { + try { + if ($this->getMessage($id)) { + return true; + } + } catch(Zend_Mail_Storage_Exception $e) {} + + return false; + } + + + /** + * ArrayAccess::offsetGet() + * + * @param int $id + * @return Zend_Mail_Message message object + */ + public function offsetGet($id) + { + return $this->getMessage($id); + } + + + /** + * ArrayAccess::offsetSet() + * + * @param id $id + * @param mixed $value + * @throws Zend_Mail_Storage_Exception + * @return void + */ + public function offsetSet($id, $value) + { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('cannot write mail messages via array access'); + } + + + /** + * ArrayAccess::offsetUnset() + * + * @param int $id + * @return boolean success + */ + public function offsetUnset($id) + { + return $this->removeMessage($id); + } + + + /** + * Iterator::rewind() + * + * Rewind always gets the new count from the storage. Thus if you use + * the interfaces and your scripts take long you should use reset() + * from time to time. + * + * @return void + */ + public function rewind() + { + $this->_iterationMax = $this->countMessages(); + $this->_iterationPos = 1; + } + + + /** + * Iterator::current() + * + * @return Zend_Mail_Message current message + */ + public function current() + { + return $this->getMessage($this->_iterationPos); + } + + + /** + * Iterator::key() + * + * @return int id of current position + */ + public function key() + { + return $this->_iterationPos; + } + + + /** + * Iterator::next() + * + * @return void + */ + public function next() + { + ++$this->_iterationPos; + } + + + /** + * Iterator::valid() + * + * @return boolean + */ + public function valid() + { + if ($this->_iterationMax === null) { + $this->_iterationMax = $this->countMessages(); + } + return $this->_iterationPos && $this->_iterationPos <= $this->_iterationMax; + } + + + /** + * SeekableIterator::seek() + * + * @param int $pos + * @return void + * @throws OutOfBoundsException + */ + public function seek($pos) + { + if ($this->_iterationMax === null) { + $this->_iterationMax = $this->countMessages(); + } + + if ($pos > $this->_iterationMax) { + throw new OutOfBoundsException('this position does not exist'); + } + $this->_iterationPos = $pos; + } + +} diff --git a/webui/Zend/Mail/Storage/Exception.php b/webui/Zend/Mail/Storage/Exception.php new file mode 100644 index 0000000..935380c --- /dev/null +++ b/webui/Zend/Mail/Storage/Exception.php @@ -0,0 +1,39 @@ + Zend_Mail_Storage_Folder folder) + * @var array + */ + protected $_folders; + + /** + * local name (name of folder in parent folder) + * @var string + */ + protected $_localName; + + /** + * global name (absolute name of folder) + * @var string + */ + protected $_globalName; + + /** + * folder is selectable if folder is able to hold messages, else it's just a parent folder + * @var bool + */ + protected $_selectable = true; + + /** + * create a new mail folder instance + * + * @param string $localName name of folder in current subdirectory + * @param string $globalName absolute name of folder + * @param bool $selectable if true folder holds messages, if false it's just a parent for subfolders + * @param array $folders init with given instances of Zend_Mail_Storage_Folder as subfolders + */ + public function __construct($localName, $globalName = '', $selectable = true, array $folders = array()) + { + $this->_localName = $localName; + $this->_globalName = $globalName ? $globalName : $localName; + $this->_selectable = $selectable; + $this->_folders = $folders; + } + + /** + * implements RecursiveIterator::hasChildren() + * + * @return bool current element has children + */ + public function hasChildren() + { + $current = $this->current(); + return $current && $current instanceof Zend_Mail_Storage_Folder && !$current->isLeaf(); + } + + /** + * implements RecursiveIterator::getChildren() + * + * @return Zend_Mail_Storage_Folder same as self::current() + */ + public function getChildren() + { + return $this->current(); + } + + /** + * implements Iterator::valid() + * + * @return bool check if there's a current element + */ + public function valid() + { + return key($this->_folders) !== null; + } + + /** + * implements Iterator::next() + * + * @return null + */ + public function next() + { + next($this->_folders); + } + + /** + * implements Iterator::key() + * + * @return string key/local name of current element + */ + public function key() + { + return key($this->_folders); + } + + /** + * implements Iterator::current() + * + * @return Zend_Mail_Storage_Folder current folder + */ + public function current() + { + return current($this->_folders); + } + + /** + * implements Iterator::rewind() + * + * @return null + */ + public function rewind() + { + reset($this->_folders); + } + + /** + * get subfolder named $name + * + * @param string $name wanted subfolder + * @return Zend_Mail_Storage_Folder folder named $folder + * @throws Zend_Mail_Storage_Exception + */ + public function __get($name) + { + if (!isset($this->_folders[$name])) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception("no subfolder named $name"); + } + + return $this->_folders[$name]; + } + + /** + * add or replace subfolder named $name + * + * @param string $name local name of subfolder + * @param Zend_Mail_Storage_Folder $folder instance for new subfolder + * @return null + */ + public function __set($name, Zend_Mail_Storage_Folder $folder) + { + $this->_folders[$name] = $folder; + } + + /** + * remove subfolder named $name + * + * @param string $name local name of subfolder + * @return null + */ + public function __unset($name) + { + unset($this->_folders[$name]); + } + + /** + * magic method for easy output of global name + * + * @return string global name of folder + */ + public function __toString() + { + return (string)$this->getGlobalName(); + } + + /** + * get local name + * + * @return string local name + */ + public function getLocalName() + { + return $this->_localName; + } + + /** + * get global name + * + * @return string global name + */ + public function getGlobalName() + { + return $this->_globalName; + } + + /** + * is this folder selectable? + * + * @return bool selectable + */ + public function isSelectable() + { + return $this->_selectable; + } + + /** + * check if folder has no subfolder + * + * @return bool true if no subfolders + */ + public function isLeaf() + { + return empty($this->_folders); + } +} diff --git a/webui/Zend/Mail/Storage/Folder/Interface.php b/webui/Zend/Mail/Storage/Folder/Interface.php new file mode 100644 index 0000000..0a3a084 --- /dev/null +++ b/webui/Zend/Mail/Storage/Folder/Interface.php @@ -0,0 +1,60 @@ +dirname) || !is_dir($params->dirname)) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('no valid dirname given in params'); + } + + $this->_rootdir = rtrim($params->dirname, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; + + $this->_delim = isset($params->delim) ? $params->delim : '.'; + + $this->_buildFolderTree(); + $this->selectFolder(!empty($params->folder) ? $params->folder : 'INBOX'); + $this->_has['top'] = true; + $this->_has['flags'] = true; + } + + /** + * find all subfolders and mbox files for folder structure + * + * Result is save in Zend_Mail_Storage_Folder instances with the root in $this->_rootFolder. + * $parentFolder and $parentGlobalName are only used internally for recursion. + * + * @return null + * @throws Zend_Mail_Storage_Exception + */ + protected function _buildFolderTree() + { + $this->_rootFolder = new Zend_Mail_Storage_Folder('/', '/', false); + $this->_rootFolder->INBOX = new Zend_Mail_Storage_Folder('INBOX', 'INBOX', true); + + $dh = @opendir($this->_rootdir); + if (!$dh) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception("can't read folders in maildir"); + } + $dirs = array(); + while (($entry = readdir($dh)) !== false) { + // maildir++ defines folders must start with . + if ($entry[0] != '.' || $entry == '.' || $entry == '..') { + continue; + } + if ($this->_isMaildir($this->_rootdir . $entry)) { + $dirs[] = $entry; + } + } + closedir($dh); + + sort($dirs); + $stack = array(null); + $folderStack = array(null); + $parentFolder = $this->_rootFolder; + $parent = '.'; + + foreach ($dirs as $dir) { + do { + if (strpos($dir, $parent) === 0) { + $local = substr($dir, strlen($parent)); + if (strpos($local, $this->_delim) !== false) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('error while reading maildir'); + } + array_push($stack, $parent); + $parent = $dir . $this->_delim; + $folder = new Zend_Mail_Storage_Folder($local, substr($dir, 1), true); + $parentFolder->$local = $folder; + array_push($folderStack, $parentFolder); + $parentFolder = $folder; + break; + } else if ($stack) { + $parent = array_pop($stack); + $parentFolder = array_pop($folderStack); + } + } while ($stack); + if (!$stack) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('error while reading maildir'); + } + } + } + + /** + * get root folder or given folder + * + * @param string $rootFolder get folder structure for given folder, else root + * @return Zend_Mail_Storage_Folder root or wanted folder + * @throws Zend_Mail_Storage_Exception + */ + public function getFolders($rootFolder = null) + { + if (!$rootFolder || $rootFolder == 'INBOX') { + return $this->_rootFolder; + } + + // rootdir is same as INBOX in maildir + if (strpos($rootFolder, 'INBOX' . $this->_delim) === 0) { + $rootFolder = substr($rootFolder, 6); + } + $currentFolder = $this->_rootFolder; + $subname = trim($rootFolder, $this->_delim); + while ($currentFolder) { + @list($entry, $subname) = @explode($this->_delim, $subname, 2); + $currentFolder = $currentFolder->$entry; + if (!$subname) { + break; + } + } + + if ($currentFolder->getGlobalName() != rtrim($rootFolder, $this->_delim)) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception("folder $rootFolder not found"); + } + return $currentFolder; + } + + /** + * select given folder + * + * folder must be selectable! + * + * @param Zend_Mail_Storage_Folder|string $globalName global name of folder or instance for subfolder + * @return null + * @throws Zend_Mail_Storage_Exception + */ + public function selectFolder($globalName) + { + $this->_currentFolder = (string)$globalName; + + // getting folder from folder tree for validation + $folder = $this->getFolders($this->_currentFolder); + + try { + $this->_openMaildir($this->_rootdir . '.' . $folder->getGlobalName()); + } catch(Zend_Mail_Storage_Exception $e) { + // check what went wrong + if (!$folder->isSelectable()) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception("{$this->_currentFolder} is not selectable", 0, $e); + } + // seems like file has vanished; rebuilding folder tree - but it's still an exception + $this->_buildFolderTree($this->_rootdir); + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('seems like the maildir has vanished, I\'ve rebuild the ' . + 'folder tree, search for an other folder and try again', 0, $e); + } + } + + /** + * get Zend_Mail_Storage_Folder instance for current folder + * + * @return Zend_Mail_Storage_Folder instance of current folder + * @throws Zend_Mail_Storage_Exception + */ + public function getCurrentFolder() + { + return $this->_currentFolder; + } +} diff --git a/webui/Zend/Mail/Storage/Folder/Mbox.php b/webui/Zend/Mail/Storage/Folder/Mbox.php new file mode 100644 index 0000000..572cc34 --- /dev/null +++ b/webui/Zend/Mail/Storage/Folder/Mbox.php @@ -0,0 +1,264 @@ +filename)) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('use Zend_Mail_Storage_Mbox for a single file'); + } + + if (!isset($params->dirname) || !is_dir($params->dirname)) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('no valid dirname given in params'); + } + + $this->_rootdir = rtrim($params->dirname, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; + + $this->_buildFolderTree($this->_rootdir); + $this->selectFolder(!empty($params->folder) ? $params->folder : 'INBOX'); + $this->_has['top'] = true; + $this->_has['uniqueid'] = false; + } + + /** + * find all subfolders and mbox files for folder structure + * + * Result is save in Zend_Mail_Storage_Folder instances with the root in $this->_rootFolder. + * $parentFolder and $parentGlobalName are only used internally for recursion. + * + * @param string $currentDir call with root dir, also used for recursion. + * @param Zend_Mail_Storage_Folder|null $parentFolder used for recursion + * @param string $parentGlobalName used for rescursion + * @return null + * @throws Zend_Mail_Storage_Exception + */ + protected function _buildFolderTree($currentDir, $parentFolder = null, $parentGlobalName = '') + { + if (!$parentFolder) { + $this->_rootFolder = new Zend_Mail_Storage_Folder('/', '/', false); + $parentFolder = $this->_rootFolder; + } + + $dh = @opendir($currentDir); + if (!$dh) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception("can't read dir $currentDir"); + } + while (($entry = readdir($dh)) !== false) { + // ignore hidden files for mbox + if ($entry[0] == '.') { + continue; + } + $absoluteEntry = $currentDir . $entry; + $globalName = $parentGlobalName . DIRECTORY_SEPARATOR . $entry; + if (is_file($absoluteEntry) && $this->_isMboxFile($absoluteEntry)) { + $parentFolder->$entry = new Zend_Mail_Storage_Folder($entry, $globalName); + continue; + } + if (!is_dir($absoluteEntry) /* || $entry == '.' || $entry == '..' */) { + continue; + } + $folder = new Zend_Mail_Storage_Folder($entry, $globalName, false); + $parentFolder->$entry = $folder; + $this->_buildFolderTree($absoluteEntry . DIRECTORY_SEPARATOR, $folder, $globalName); + } + + closedir($dh); + } + + /** + * get root folder or given folder + * + * @param string $rootFolder get folder structure for given folder, else root + * @return Zend_Mail_Storage_Folder root or wanted folder + * @throws Zend_Mail_Storage_Exception + */ + public function getFolders($rootFolder = null) + { + if (!$rootFolder) { + return $this->_rootFolder; + } + + $currentFolder = $this->_rootFolder; + $subname = trim($rootFolder, DIRECTORY_SEPARATOR); + while ($currentFolder) { + @list($entry, $subname) = @explode(DIRECTORY_SEPARATOR, $subname, 2); + $currentFolder = $currentFolder->$entry; + if (!$subname) { + break; + } + } + + if ($currentFolder->getGlobalName() != DIRECTORY_SEPARATOR . trim($rootFolder, DIRECTORY_SEPARATOR)) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception("folder $rootFolder not found"); + } + return $currentFolder; + } + + /** + * select given folder + * + * folder must be selectable! + * + * @param Zend_Mail_Storage_Folder|string $globalName global name of folder or instance for subfolder + * @return null + * @throws Zend_Mail_Storage_Exception + */ + public function selectFolder($globalName) + { + $this->_currentFolder = (string)$globalName; + + // getting folder from folder tree for validation + $folder = $this->getFolders($this->_currentFolder); + + try { + $this->_openMboxFile($this->_rootdir . $folder->getGlobalName()); + } catch(Zend_Mail_Storage_Exception $e) { + // check what went wrong + if (!$folder->isSelectable()) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception("{$this->_currentFolder} is not selectable", 0, $e); + } + // seems like file has vanished; rebuilding folder tree - but it's still an exception + $this->_buildFolderTree($this->_rootdir); + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('seems like the mbox file has vanished, I\'ve rebuild the ' . + 'folder tree, search for an other folder and try again', 0, $e); + } + } + + /** + * get Zend_Mail_Storage_Folder instance for current folder + * + * @return Zend_Mail_Storage_Folder instance of current folder + * @throws Zend_Mail_Storage_Exception + */ + public function getCurrentFolder() + { + return $this->_currentFolder; + } + + /** + * magic method for serialize() + * + * with this method you can cache the mbox class + * + * @return array name of variables + */ + public function __sleep() + { + return array_merge(parent::__sleep(), array('_currentFolder', '_rootFolder', '_rootdir')); + } + + /** + * magic method for unserialize() + * + * with this method you can cache the mbox class + * + * @return null + */ + public function __wakeup() + { + // if cache is stall selectFolder() rebuilds the tree on error + parent::__wakeup(); + } +} diff --git a/webui/Zend/Mail/Storage/Imap.php b/webui/Zend/Mail/Storage/Imap.php new file mode 100644 index 0000000..2de9546 --- /dev/null +++ b/webui/Zend/Mail/Storage/Imap.php @@ -0,0 +1,657 @@ + Zend_Mail_Storage::FLAG_PASSED, + '\Answered' => Zend_Mail_Storage::FLAG_ANSWERED, + '\Seen' => Zend_Mail_Storage::FLAG_SEEN, + '\Deleted' => Zend_Mail_Storage::FLAG_DELETED, + '\Draft' => Zend_Mail_Storage::FLAG_DRAFT, + '\Flagged' => Zend_Mail_Storage::FLAG_FLAGGED); + + /** + * map flags to search criterias + * @var array + */ + protected static $_searchFlags = array('\Recent' => 'RECENT', + '\Answered' => 'ANSWERED', + '\Seen' => 'SEEN', + '\Deleted' => 'DELETED', + '\Draft' => 'DRAFT', + '\Flagged' => 'FLAGGED'); + + /** + * Count messages all messages in current box + * + * @return int number of messages + * @throws Zend_Mail_Storage_Exception + * @throws Zend_Mail_Protocol_Exception + */ + public function countMessages($flags = null) + { + if (!$this->_currentFolder) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('No selected folder to count'); + } + + if ($flags === null) { + return count($this->_protocol->search(array('ALL'))); + } + + $params = array(); + foreach ((array)$flags as $flag) { + if (isset(self::$_searchFlags[$flag])) { + $params[] = self::$_searchFlags[$flag]; + } else { + $params[] = 'KEYWORD'; + $params[] = $this->_protocol->escapeString($flag); + } + } + return count($this->_protocol->search($params)); + } + + /** + * get a list of messages with number and size + * + * @param int $id number of message + * @return int|array size of given message of list with all messages as array(num => size) + * @throws Zend_Mail_Protocol_Exception + */ + public function getSize($id = 0) + { + if ($id) { + return $this->_protocol->fetch('RFC822.SIZE', $id); + } + return $this->_protocol->fetch('RFC822.SIZE', 1, INF); + } + + /** + * Fetch a message + * + * @param int $id number of message + * @return Zend_Mail_Message + * @throws Zend_Mail_Protocol_Exception + */ + public function getMessage($id) + { + $data = $this->_protocol->fetch(array('FLAGS', 'RFC822.HEADER'), $id); + $header = $data['RFC822.HEADER']; + + $flags = array(); + foreach ($data['FLAGS'] as $flag) { + $flags[] = isset(self::$_knownFlags[$flag]) ? self::$_knownFlags[$flag] : $flag; + } + + return new $this->_messageClass(array('handler' => $this, 'id' => $id, 'headers' => $header, 'flags' => $flags)); + } + + /* + * Get raw header of message or part + * + * @param int $id number of message + * @param null|array|string $part path to part or null for messsage header + * @param int $topLines include this many lines with header (after an empty line) + * @param int $topLines include this many lines with header (after an empty line) + * @return string raw header + * @throws Zend_Mail_Protocol_Exception + * @throws Zend_Mail_Storage_Exception + */ + public function getRawHeader($id, $part = null, $topLines = 0) + { + if ($part !== null) { + // TODO: implement + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('not implemented'); + } + + // TODO: toplines + return $this->_protocol->fetch('RFC822.HEADER', $id); + } + + public function getFullMessage($id) + { + $data = $this->_protocol->fetch(array('RFC822.HEADER', 'RFC822.TEXT'), $id); + return $data['RFC822.HEADER'] . "\n\n" . $data['RFC822.TEXT']; + } + + + /* + * Get raw content of message or part + * + * @param int $id number of message + * @param null|array|string $part path to part or null for messsage content + * @return string raw content + * @throws Zend_Mail_Protocol_Exception + * @throws Zend_Mail_Storage_Exception + */ + public function getRawContent($id, $part = null) + { + if ($part !== null) { + // TODO: implement + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('not implemented'); + } + + return $this->_protocol->fetch('RFC822.TEXT', $id); + } + + + public function piler_batch_fetch($from, $to) { + return $this->_protocol->fetch(array('RFC822.HEADER', 'RFC822.TEXT'), $from, $to); + } + + + /** + * create instance with parameters + * Supported paramters are + * - user username + * - host hostname or ip address of IMAP server [optional, default = 'localhost'] + * - password password for user 'username' [optional, default = ''] + * - port port for IMAP server [optional, default = 110] + * - ssl 'SSL' or 'TLS' for secure sockets + * - folder select this folder [optional, default = 'INBOX'] + * + * @param array $params mail reader specific parameters + * @throws Zend_Mail_Storage_Exception + * @throws Zend_Mail_Protocol_Exception + */ + public function __construct($params) + { + if (is_array($params)) { + $params = (object)$params; + } + + $this->_has['flags'] = true; + + if ($params instanceof Zend_Mail_Protocol_Imap) { + $this->_protocol = $params; + try { + $this->selectFolder('INBOX'); + } catch(Zend_Mail_Storage_Exception $e) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('cannot select INBOX, is this a valid transport?', 0, $e); + } + return; + } + + if (!isset($params->user)) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('need at least user in params'); + } + + $host = isset($params->host) ? $params->host : 'localhost'; + $password = isset($params->password) ? $params->password : ''; + $port = isset($params->port) ? $params->port : null; + $ssl = isset($params->ssl) ? $params->ssl : false; + + $this->_protocol = new Zend_Mail_Protocol_Imap(); + $this->_protocol->connect($host, $port, $ssl); + if (!$this->_protocol->login($params->user, $password)) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('cannot login, user or password wrong'); + } + $this->selectFolder(isset($params->folder) ? $params->folder : 'INBOX'); + } + + /** + * Close resource for mail lib. If you need to control, when the resource + * is closed. Otherwise the destructor would call this. + * + * @return null + */ + public function close() + { + $this->_currentFolder = ''; + $this->_protocol->logout(); + } + + /** + * Keep the server busy. + * + * @return null + * @throws Zend_Mail_Storage_Exception + */ + public function noop() + { + if (!$this->_protocol->noop()) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('could not do nothing'); + } + } + + /** + * Remove a message from server. If you're doing that from a web enviroment + * you should be careful and use a uniqueid as parameter if possible to + * identify the message. + * + * @param int $id number of message + * @return null + * @throws Zend_Mail_Storage_Exception + */ + public function removeMessage($id) + { + if (!$this->_protocol->store(array(Zend_Mail_Storage::FLAG_DELETED), $id, null, '+')) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('cannot set deleted flag'); + } + // TODO: expunge here or at close? we can handle an error here better and are more fail safe + if (!$this->_protocol->expunge()) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('message marked as deleted, but could not expunge'); + } + } + + /** + * get unique id for one or all messages + * + * if storage does not support unique ids it's the same as the message number + * + * @param int|null $id message number + * @return array|string message number for given message or all messages as array + * @throws Zend_Mail_Storage_Exception + */ + public function getUniqueId($id = null) + { + if ($id) { + return $this->_protocol->fetch('UID', $id); + } + + return $this->_protocol->fetch('UID', 1, INF); + } + + /** + * get a message number from a unique id + * + * I.e. if you have a webmailer that supports deleting messages you should use unique ids + * as parameter and use this method to translate it to message number right before calling removeMessage() + * + * @param string $id unique id + * @return int message number + * @throws Zend_Mail_Storage_Exception + */ + public function getNumberByUniqueId($id) + { + // TODO: use search to find number directly + $ids = $this->getUniqueId(); + foreach ($ids as $k => $v) { + if ($v == $id) { + return $k; + } + } + + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('unique id not found'); + } + + + /** + * get root folder or given folder + * + * @param string $rootFolder get folder structure for given folder, else root + * @return Zend_Mail_Storage_Folder root or wanted folder + * @throws Zend_Mail_Storage_Exception + * @throws Zend_Mail_Protocol_Exception + */ + public function getFolders($rootFolder = null) + { + $folders = $this->_protocol->listMailbox((string)$rootFolder); + if (!$folders) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('folder not found'); + } + + ksort($folders, SORT_STRING); + $root = new Zend_Mail_Storage_Folder('/', '/', false); + $stack = array(null); + $folderStack = array(null); + $parentFolder = $root; + $parent = ''; + + foreach ($folders as $globalName => $data) { + do { + if (!$parent || strpos($globalName, $parent) === 0) { + $pos = strrpos($globalName, $data['delim']); + if ($pos === false) { + $localName = $globalName; + } else { + $localName = substr($globalName, $pos + 1); + } + $selectable = !$data['flags'] || !in_array('\\Noselect', $data['flags']); + + array_push($stack, $parent); + $parent = $globalName . $data['delim']; + $folder = new Zend_Mail_Storage_Folder($localName, $globalName, $selectable); + $parentFolder->$localName = $folder; + array_push($folderStack, $parentFolder); + $parentFolder = $folder; + break; + } else if ($stack) { + $parent = array_pop($stack); + $parentFolder = array_pop($folderStack); + } + } while ($stack); + if (!$stack) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('error while constructing folder tree'); + } + } + + return $root; + } + + /** + * select given folder + * + * folder must be selectable! + * + * @param Zend_Mail_Storage_Folder|string $globalName global name of folder or instance for subfolder + * @return null + * @throws Zend_Mail_Storage_Exception + * @throws Zend_Mail_Protocol_Exception + */ + public function selectFolder($globalName) + { + $this->_currentFolder = $globalName; + if (!$this->_protocol->select($this->_currentFolder)) { + $this->_currentFolder = ''; + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('cannot change folder, maybe it does not exist'); + } + } + + + /** + * get Zend_Mail_Storage_Folder instance for current folder + * + * @return Zend_Mail_Storage_Folder instance of current folder + * @throws Zend_Mail_Storage_Exception + */ + public function getCurrentFolder() + { + return $this->_currentFolder; + } + + /** + * create a new folder + * + * This method also creates parent folders if necessary. Some mail storages may restrict, which folder + * may be used as parent or which chars may be used in the folder name + * + * @param string $name global name of folder, local name if $parentFolder is set + * @param string|Zend_Mail_Storage_Folder $parentFolder parent folder for new folder, else root folder is parent + * @return null + * @throws Zend_Mail_Storage_Exception + */ + public function createFolder($name, $parentFolder = null) + { + // TODO: we assume / as the hierarchy delim - need to get that from the folder class! + if ($parentFolder instanceof Zend_Mail_Storage_Folder) { + $folder = $parentFolder->getGlobalName() . '/' . $name; + } else if ($parentFolder != null) { + $folder = $parentFolder . '/' . $name; + } else { + $folder = $name; + } + + if (!$this->_protocol->create($folder)) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('cannot create folder'); + } + } + + /** + * remove a folder + * + * @param string|Zend_Mail_Storage_Folder $name name or instance of folder + * @return null + * @throws Zend_Mail_Storage_Exception + */ + public function removeFolder($name) + { + if ($name instanceof Zend_Mail_Storage_Folder) { + $name = $name->getGlobalName(); + } + + if (!$this->_protocol->delete($name)) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('cannot delete folder'); + } + } + + /** + * rename and/or move folder + * + * The new name has the same restrictions as in createFolder() + * + * @param string|Zend_Mail_Storage_Folder $oldName name or instance of folder + * @param string $newName new global name of folder + * @return null + * @throws Zend_Mail_Storage_Exception + */ + public function renameFolder($oldName, $newName) + { + if ($oldName instanceof Zend_Mail_Storage_Folder) { + $oldName = $oldName->getGlobalName(); + } + + if (!$this->_protocol->rename($oldName, $newName)) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('cannot rename folder'); + } + } + + /** + * append a new message to mail storage + * + * @param string $message message as string or instance of message class + * @param null|string|Zend_Mail_Storage_Folder $folder folder for new message, else current folder is taken + * @param null|array $flags set flags for new message, else a default set is used + * @throws Zend_Mail_Storage_Exception + */ + // not yet * @param string|Zend_Mail_Message|Zend_Mime_Message $message message as string or instance of message class + public function appendMessage($message, $folder = null, $flags = null) + { + if ($folder === null) { + $folder = $this->_currentFolder; + } + + if ($flags === null) { + $flags = array(Zend_Mail_Storage::FLAG_SEEN); + } + + // TODO: handle class instances for $message + if (!$this->_protocol->append($folder, $message, $flags)) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('cannot create message, please check if the folder exists and your flags'); + } + } + + /** + * copy an existing message + * + * @param int $id number of message + * @param string|Zend_Mail_Storage_Folder $folder name or instance of targer folder + * @return null + * @throws Zend_Mail_Storage_Exception + */ + public function copyMessage($id, $folder) + { + if (!$this->_protocol->copy($folder, $id)) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('cannot copy message, does the folder exist?'); + } + } + + /** + * move an existing message + * + * NOTE: imap has no native move command, thus it's emulated with copy and delete + * + * @param int $id number of message + * @param string|Zend_Mail_Storage_Folder $folder name or instance of targer folder + * @return null + * @throws Zend_Mail_Storage_Exception + */ + public function moveMessage($id, $folder) { + $this->copyMessage($id, $folder); + $this->removeMessage($id); + } + + /** + * set flags for message + * + * NOTE: this method can't set the recent flag. + * + * @param int $id number of message + * @param array $flags new flags for message + * @throws Zend_Mail_Storage_Exception + */ + public function setFlags($id, $flags) + { + if (!$this->_protocol->store($flags, $id)) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('cannot set flags, have you tried to set the recent flag or special chars?'); + } + } +} + diff --git a/webui/Zend/Mail/Storage/Maildir.php b/webui/Zend/Mail/Storage/Maildir.php new file mode 100644 index 0000000..836c3f1 --- /dev/null +++ b/webui/Zend/Mail/Storage/Maildir.php @@ -0,0 +1,475 @@ + Zend_Mail_Storage::FLAG_DRAFT, + 'F' => Zend_Mail_Storage::FLAG_FLAGGED, + 'P' => Zend_Mail_Storage::FLAG_PASSED, + 'R' => Zend_Mail_Storage::FLAG_ANSWERED, + 'S' => Zend_Mail_Storage::FLAG_SEEN, + 'T' => Zend_Mail_Storage::FLAG_DELETED); + + // TODO: getFlags($id) for fast access if headers are not needed (i.e. just setting flags)? + + /** + * Count messages all messages in current box + * + * @return int number of messages + * @throws Zend_Mail_Storage_Exception + */ + public function countMessages($flags = null) + { + if ($flags === null) { + return count($this->_files); + } + + $count = 0; + if (!is_array($flags)) { + foreach ($this->_files as $file) { + if (isset($file['flaglookup'][$flags])) { + ++$count; + } + } + return $count; + } + + $flags = array_flip($flags); + foreach ($this->_files as $file) { + foreach ($flags as $flag => $v) { + if (!isset($file['flaglookup'][$flag])) { + continue 2; + } + } + ++$count; + } + return $count; + } + + /** + * Get one or all fields from file structure. Also checks if message is valid + * + * @param int $id message number + * @param string|null $field wanted field + * @return string|array wanted field or all fields as array + * @throws Zend_Mail_Storage_Exception + */ + protected function _getFileData($id, $field = null) + { + if (!isset($this->_files[$id - 1])) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('id does not exist'); + } + + if (!$field) { + return $this->_files[$id - 1]; + } + + if (!isset($this->_files[$id - 1][$field])) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('field does not exist'); + } + + return $this->_files[$id - 1][$field]; + } + + /** + * Get a list of messages with number and size + * + * @param int|null $id number of message or null for all messages + * @return int|array size of given message of list with all messages as array(num => size) + * @throws Zend_Mail_Storage_Exception + */ + public function getSize($id = null) + { + if ($id !== null) { + $filedata = $this->_getFileData($id); + return isset($filedata['size']) ? $filedata['size'] : filesize($filedata['filename']); + } + + $result = array(); + foreach ($this->_files as $num => $data) { + $result[$num + 1] = isset($data['size']) ? $data['size'] : filesize($data['filename']); + } + + return $result; + } + + + + /** + * Fetch a message + * + * @param int $id number of message + * @return Zend_Mail_Message_File + * @throws Zend_Mail_Storage_Exception + */ + public function getMessage($id) + { + // TODO that's ugly, would be better to let the message class decide + if (strtolower($this->_messageClass) == 'zend_mail_message_file' || is_subclass_of($this->_messageClass, 'zend_mail_message_file')) { + return new $this->_messageClass(array('file' => $this->_getFileData($id, 'filename'), + 'flags' => $this->_getFileData($id, 'flags'))); + } + + return new $this->_messageClass(array('handler' => $this, 'id' => $id, 'headers' => $this->getRawHeader($id), + 'flags' => $this->_getFileData($id, 'flags'))); + } + + /* + * Get raw header of message or part + * + * @param int $id number of message + * @param null|array|string $part path to part or null for messsage header + * @param int $topLines include this many lines with header (after an empty line) + * @return string raw header + * @throws Zend_Mail_Storage_Exception + */ + public function getRawHeader($id, $part = null, $topLines = 0) + { + if ($part !== null) { + // TODO: implement + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('not implemented'); + } + + $fh = fopen($this->_getFileData($id, 'filename'), 'r'); + + $content = ''; + while (!feof($fh)) { + $line = fgets($fh); + if (!trim($line)) { + break; + } + $content .= $line; + } + + fclose($fh); + return $content; + } + + /* + * Get raw content of message or part + * + * @param int $id number of message + * @param null|array|string $part path to part or null for messsage content + * @return string raw content + * @throws Zend_Mail_Storage_Exception + */ + public function getRawContent($id, $part = null) + { + if ($part !== null) { + // TODO: implement + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('not implemented'); + } + + $fh = fopen($this->_getFileData($id, 'filename'), 'r'); + + while (!feof($fh)) { + $line = fgets($fh); + if (!trim($line)) { + break; + } + } + + $content = stream_get_contents($fh); + fclose($fh); + return $content; + } + + /** + * Create instance with parameters + * Supported parameters are: + * - dirname dirname of mbox file + * + * @param array $params mail reader specific parameters + * @throws Zend_Mail_Storage_Exception + */ + public function __construct($params) + { + if (is_array($params)) { + $params = (object)$params; + } + + if (!isset($params->dirname) || !is_dir($params->dirname)) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('no valid dirname given in params'); + } + + if (!$this->_isMaildir($params->dirname)) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('invalid maildir given'); + } + + $this->_has['top'] = true; + $this->_has['flags'] = true; + $this->_openMaildir($params->dirname); + } + + /** + * check if a given dir is a valid maildir + * + * @param string $dirname name of dir + * @return bool dir is valid maildir + */ + protected function _isMaildir($dirname) + { + if (file_exists($dirname . '/new') && !is_dir($dirname . '/new')) { + return false; + } + if (file_exists($dirname . '/tmp') && !is_dir($dirname . '/tmp')) { + return false; + } + return is_dir($dirname . '/cur'); + } + + /** + * open given dir as current maildir + * + * @param string $dirname name of maildir + * @return null + * @throws Zend_Mail_Storage_Exception + */ + protected function _openMaildir($dirname) + { + if ($this->_files) { + $this->close(); + } + + $dh = @opendir($dirname . '/cur/'); + if (!$dh) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('cannot open maildir'); + } + $this->_getMaildirFiles($dh, $dirname . '/cur/'); + closedir($dh); + + $dh = @opendir($dirname . '/new/'); + if ($dh) { + $this->_getMaildirFiles($dh, $dirname . '/new/', array(Zend_Mail_Storage::FLAG_RECENT)); + closedir($dh); + } else if (file_exists($dirname . '/new/')) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('cannot read recent mails in maildir'); + } + } + + /** + * find all files in opened dir handle and add to maildir files + * + * @param resource $dh dir handle used for search + * @param string $dirname dirname of dir in $dh + * @param array $default_flags default flags for given dir + * @return null + */ + protected function _getMaildirFiles($dh, $dirname, $default_flags = array()) + { + while (($entry = readdir($dh)) !== false) { + if ($entry[0] == '.' || !is_file($dirname . $entry)) { + continue; + } + + @list($uniq, $info) = explode(':', $entry, 2); + @list(,$size) = explode(',', $uniq, 2); + if ($size && $size[0] == 'S' && $size[1] == '=') { + $size = substr($size, 2); + } + if (!ctype_digit($size)) { + $size = null; + } + @list($version, $flags) = explode(',', $info, 2); + if ($version != 2) { + $flags = ''; + } + + $named_flags = $default_flags; + $length = strlen($flags); + for ($i = 0; $i < $length; ++$i) { + $flag = $flags[$i]; + $named_flags[$flag] = isset(self::$_knownFlags[$flag]) ? self::$_knownFlags[$flag] : $flag; + } + + $data = array('uniq' => $uniq, + 'flags' => $named_flags, + 'flaglookup' => array_flip($named_flags), + 'filename' => $dirname . $entry); + if ($size !== null) { + $data['size'] = (int)$size; + } + $this->_files[] = $data; + } + } + + + /** + * Close resource for mail lib. If you need to control, when the resource + * is closed. Otherwise the destructor would call this. + * + * @return void + */ + public function close() + { + $this->_files = array(); + } + + + /** + * Waste some CPU cycles doing nothing. + * + * @return void + */ + public function noop() + { + return true; + } + + + /** + * stub for not supported message deletion + * + * @return null + * @throws Zend_Mail_Storage_Exception + */ + public function removeMessage($id) + { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('maildir is (currently) read-only'); + } + + /** + * get unique id for one or all messages + * + * if storage does not support unique ids it's the same as the message number + * + * @param int|null $id message number + * @return array|string message number for given message or all messages as array + * @throws Zend_Mail_Storage_Exception + */ + public function getUniqueId($id = null) + { + if ($id) { + return $this->_getFileData($id, 'uniq'); + } + + $ids = array(); + foreach ($this->_files as $num => $file) { + $ids[$num + 1] = $file['uniq']; + } + return $ids; + } + + /** + * get a message number from a unique id + * + * I.e. if you have a webmailer that supports deleting messages you should use unique ids + * as parameter and use this method to translate it to message number right before calling removeMessage() + * + * @param string $id unique id + * @return int message number + * @throws Zend_Mail_Storage_Exception + */ + public function getNumberByUniqueId($id) + { + foreach ($this->_files as $num => $file) { + if ($file['uniq'] == $id) { + return $num + 1; + } + } + + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('unique id not found'); + } +} diff --git a/webui/Zend/Mail/Storage/Mbox.php b/webui/Zend/Mail/Storage/Mbox.php new file mode 100644 index 0000000..95a1050 --- /dev/null +++ b/webui/Zend/Mail/Storage/Mbox.php @@ -0,0 +1,447 @@ + start, 'seperator' => headersep, 'end' => end) + * @var array + */ + protected $_positions; + + /** + * used message class, change it in an extened class to extend the returned message class + * @var string + */ + protected $_messageClass = 'Zend_Mail_Message_File'; + + /** + * Count messages all messages in current box + * + * @return int number of messages + * @throws Zend_Mail_Storage_Exception + */ + public function countMessages() + { + return count($this->_positions); + } + + + /** + * Get a list of messages with number and size + * + * @param int|null $id number of message or null for all messages + * @return int|array size of given message of list with all messages as array(num => size) + */ + public function getSize($id = 0) + { + if ($id) { + $pos = $this->_positions[$id - 1]; + return $pos['end'] - $pos['start']; + } + + $result = array(); + foreach ($this->_positions as $num => $pos) { + $result[$num + 1] = $pos['end'] - $pos['start']; + } + + return $result; + } + + + /** + * Get positions for mail message or throw exeption if id is invalid + * + * @param int $id number of message + * @return array positions as in _positions + * @throws Zend_Mail_Storage_Exception + */ + protected function _getPos($id) + { + if (!isset($this->_positions[$id - 1])) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('id does not exist'); + } + + return $this->_positions[$id - 1]; + } + + + /** + * Fetch a message + * + * @param int $id number of message + * @return Zend_Mail_Message_File + * @throws Zend_Mail_Storage_Exception + */ + public function getMessage($id) + { + // TODO that's ugly, would be better to let the message class decide + if (strtolower($this->_messageClass) == 'zend_mail_message_file' || is_subclass_of($this->_messageClass, 'zend_mail_message_file')) { + // TODO top/body lines + $messagePos = $this->_getPos($id); + return new $this->_messageClass(array('file' => $this->_fh, 'startPos' => $messagePos['start'], + 'endPos' => $messagePos['end'])); + } + + $bodyLines = 0; // TODO: need a way to change that + + $message = $this->getRawHeader($id); + // file pointer is after headers now + if ($bodyLines) { + $message .= "\n"; + while ($bodyLines-- && ftell($this->_fh) < $this->_positions[$id - 1]['end']) { + $message .= fgets($this->_fh); + } + } + + return new $this->_messageClass(array('handler' => $this, 'id' => $id, 'headers' => $message)); + } + + /* + * Get raw header of message or part + * + * @param int $id number of message + * @param null|array|string $part path to part or null for messsage header + * @param int $topLines include this many lines with header (after an empty line) + * @return string raw header + * @throws Zend_Mail_Protocol_Exception + * @throws Zend_Mail_Storage_Exception + */ + public function getRawHeader($id, $part = null, $topLines = 0) + { + if ($part !== null) { + // TODO: implement + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('not implemented'); + } + $messagePos = $this->_getPos($id); + // TODO: toplines + return stream_get_contents($this->_fh, $messagePos['separator'] - $messagePos['start'], $messagePos['start']); + } + + /* + * Get raw content of message or part + * + * @param int $id number of message + * @param null|array|string $part path to part or null for messsage content + * @return string raw content + * @throws Zend_Mail_Protocol_Exception + * @throws Zend_Mail_Storage_Exception + */ + public function getRawContent($id, $part = null) + { + if ($part !== null) { + // TODO: implement + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('not implemented'); + } + $messagePos = $this->_getPos($id); + return stream_get_contents($this->_fh, $messagePos['end'] - $messagePos['separator'], $messagePos['separator']); + } + + /** + * Create instance with parameters + * Supported parameters are: + * - filename filename of mbox file + * + * @param array $params mail reader specific parameters + * @throws Zend_Mail_Storage_Exception + */ + public function __construct($params) + { + if (is_array($params)) { + $params = (object)$params; + } + + if (!isset($params->filename) /* || Zend_Loader::isReadable($params['filename']) */) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('no valid filename given in params'); + } + + $this->_openMboxFile($params->filename); + $this->_has['top'] = true; + $this->_has['uniqueid'] = false; + } + + /** + * check if given file is a mbox file + * + * if $file is a resource its file pointer is moved after the first line + * + * @param resource|string $file stream resource of name of file + * @param bool $fileIsString file is string or resource + * @return bool file is mbox file + */ + protected function _isMboxFile($file, $fileIsString = true) + { + if ($fileIsString) { + $file = @fopen($file, 'r'); + if (!$file) { + return false; + } + } else { + fseek($file, 0); + } + + $result = false; + + $line = fgets($file); + if (strpos($line, 'From ') === 0) { + $result = true; + } + + if ($fileIsString) { + @fclose($file); + } + + return $result; + } + + /** + * open given file as current mbox file + * + * @param string $filename filename of mbox file + * @return null + * @throws Zend_Mail_Storage_Exception + */ + protected function _openMboxFile($filename) + { + if ($this->_fh) { + $this->close(); + } + + $this->_fh = @fopen($filename, 'r'); + if (!$this->_fh) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('cannot open mbox file'); + } + $this->_filename = $filename; + $this->_filemtime = filemtime($this->_filename); + + if (!$this->_isMboxFile($this->_fh, false)) { + @fclose($this->_fh); + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('file is not a valid mbox format'); + } + + $messagePos = array('start' => ftell($this->_fh), 'separator' => 0, 'end' => 0); + while (($line = fgets($this->_fh)) !== false) { + if (strpos($line, 'From ') === 0) { + $messagePos['end'] = ftell($this->_fh) - strlen($line) - 2; // + newline + if (!$messagePos['separator']) { + $messagePos['separator'] = $messagePos['end']; + } + $this->_positions[] = $messagePos; + $messagePos = array('start' => ftell($this->_fh), 'separator' => 0, 'end' => 0); + } + if (!$messagePos['separator'] && !trim($line)) { + $messagePos['separator'] = ftell($this->_fh); + } + } + + $messagePos['end'] = ftell($this->_fh); + if (!$messagePos['separator']) { + $messagePos['separator'] = $messagePos['end']; + } + $this->_positions[] = $messagePos; + } + + /** + * Close resource for mail lib. If you need to control, when the resource + * is closed. Otherwise the destructor would call this. + * + * @return void + */ + public function close() + { + @fclose($this->_fh); + $this->_positions = array(); + } + + + /** + * Waste some CPU cycles doing nothing. + * + * @return void + */ + public function noop() + { + return true; + } + + + /** + * stub for not supported message deletion + * + * @return null + * @throws Zend_Mail_Storage_Exception + */ + public function removeMessage($id) + { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('mbox is read-only'); + } + + /** + * get unique id for one or all messages + * + * Mbox does not support unique ids (yet) - it's always the same as the message number. + * That shouldn't be a problem, because we can't change mbox files. Therefor the message + * number is save enough. + * + * @param int|null $id message number + * @return array|string message number for given message or all messages as array + * @throws Zend_Mail_Storage_Exception + */ + public function getUniqueId($id = null) + { + if ($id) { + // check if id exists + $this->_getPos($id); + return $id; + } + + $range = range(1, $this->countMessages()); + return array_combine($range, $range); + } + + /** + * get a message number from a unique id + * + * I.e. if you have a webmailer that supports deleting messages you should use unique ids + * as parameter and use this method to translate it to message number right before calling removeMessage() + * + * @param string $id unique id + * @return int message number + * @throws Zend_Mail_Storage_Exception + */ + public function getNumberByUniqueId($id) + { + // check if id exists + $this->_getPos($id); + return $id; + } + + /** + * magic method for serialize() + * + * with this method you can cache the mbox class + * + * @return array name of variables + */ + public function __sleep() + { + return array('_filename', '_positions', '_filemtime'); + } + + /** + * magic method for unserialize() + * + * with this method you can cache the mbox class + * for cache validation the mtime of the mbox file is used + * + * @return null + * @throws Zend_Mail_Storage_Exception + */ + public function __wakeup() + { + if ($this->_filemtime != @filemtime($this->_filename)) { + $this->close(); + $this->_openMboxFile($this->_filename); + } else { + $this->_fh = @fopen($this->_filename, 'r'); + if (!$this->_fh) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('cannot open mbox file'); + } + } + } + +} diff --git a/webui/Zend/Mail/Storage/Pop3.php b/webui/Zend/Mail/Storage/Pop3.php new file mode 100644 index 0000000..e658ada --- /dev/null +++ b/webui/Zend/Mail/Storage/Pop3.php @@ -0,0 +1,328 @@ +_protocol->status($count, $null); + return (int)$count; + } + + /** + * get a list of messages with number and size + * + * @param int $id number of message + * @return int|array size of given message of list with all messages as array(num => size) + * @throws Zend_Mail_Protocol_Exception + */ + public function getSize($id = 0) + { + $id = $id ? $id : null; + return $this->_protocol->getList($id); + } + + /** + * Fetch a message + * + * @param int $id number of message + * @return Zend_Mail_Message + * @throws Zend_Mail_Protocol_Exception + */ + public function getMessage($id) + { + $bodyLines = 0; + $message = $this->_protocol->top($id, $bodyLines, true); + + return new $this->_messageClass(array('handler' => $this, 'id' => $id, 'headers' => $message, + 'noToplines' => $bodyLines < 1)); + } + + /* + * Get raw header of message or part + * + * @param int $id number of message + * @param null|array|string $part path to part or null for messsage header + * @param int $topLines include this many lines with header (after an empty line) + * @return string raw header + * @throws Zend_Mail_Protocol_Exception + * @throws Zend_Mail_Storage_Exception + */ + public function getRawHeader($id, $part = null, $topLines = 0) + { + if ($part !== null) { + // TODO: implement + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('not implemented'); + } + + return $this->_protocol->top($id, 0, true); + } + + /* + * Get raw content of message or part + * + * @param int $id number of message + * @param null|array|string $part path to part or null for messsage content + * @return string raw content + * @throws Zend_Mail_Protocol_Exception + * @throws Zend_Mail_Storage_Exception + */ + public function getRawContent($id, $part = null) + { + if ($part !== null) { + // TODO: implement + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('not implemented'); + } + + $content = $this->_protocol->retrieve($id); + // TODO: find a way to avoid decoding the headers + Zend_Mime_Decode::splitMessage($content, $null, $body); + return $body; + } + + /** + * create instance with parameters + * Supported paramters are + * - host hostname or ip address of POP3 server + * - user username + * - password password for user 'username' [optional, default = ''] + * - port port for POP3 server [optional, default = 110] + * - ssl 'SSL' or 'TLS' for secure sockets + * + * @param array $params mail reader specific parameters + * @throws Zend_Mail_Storage_Exception + * @throws Zend_Mail_Protocol_Exception + */ + public function __construct($params) + { + if (is_array($params)) { + $params = (object)$params; + } + + $this->_has['fetchPart'] = false; + $this->_has['top'] = null; + $this->_has['uniqueid'] = null; + + if ($params instanceof Zend_Mail_Protocol_Pop3) { + $this->_protocol = $params; + return; + } + + if (!isset($params->user)) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('need at least user in params'); + } + + $host = isset($params->host) ? $params->host : 'localhost'; + $password = isset($params->password) ? $params->password : ''; + $port = isset($params->port) ? $params->port : null; + $ssl = isset($params->ssl) ? $params->ssl : false; + + $this->_protocol = new Zend_Mail_Protocol_Pop3(); + $this->_protocol->connect($host, $port, $ssl); + $this->_protocol->login($params->user, $password); + } + + /** + * Close resource for mail lib. If you need to control, when the resource + * is closed. Otherwise the destructor would call this. + * + * @return null + */ + public function close() + { + $this->_protocol->logout(); + } + + /** + * Keep the server busy. + * + * @return null + * @throws Zend_Mail_Protocol_Exception + */ + public function noop() + { + return $this->_protocol->noop(); + } + + /** + * Remove a message from server. If you're doing that from a web enviroment + * you should be careful and use a uniqueid as parameter if possible to + * identify the message. + * + * @param int $id number of message + * @return null + * @throws Zend_Mail_Protocol_Exception + */ + public function removeMessage($id) + { + $this->_protocol->delete($id); + } + + /** + * get unique id for one or all messages + * + * if storage does not support unique ids it's the same as the message number + * + * @param int|null $id message number + * @return array|string message number for given message or all messages as array + * @throws Zend_Mail_Storage_Exception + */ + public function getUniqueId($id = null) + { + if (!$this->hasUniqueid) { + if ($id) { + return $id; + } + $count = $this->countMessages(); + if ($count < 1) { + return array(); + } + $range = range(1, $count); + return array_combine($range, $range); + } + + return $this->_protocol->uniqueid($id); + } + + /** + * get a message number from a unique id + * + * I.e. if you have a webmailer that supports deleting messages you should use unique ids + * as parameter and use this method to translate it to message number right before calling removeMessage() + * + * @param string $id unique id + * @return int message number + * @throws Zend_Mail_Storage_Exception + */ + public function getNumberByUniqueId($id) + { + if (!$this->hasUniqueid) { + return $id; + } + + $ids = $this->getUniqueId(); + foreach ($ids as $k => $v) { + if ($v == $id) { + return $k; + } + } + + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('unique id not found'); + } + + /** + * Special handling for hasTop and hasUniqueid. The headers of the first message is + * retrieved if Top wasn't needed/tried yet. + * + * @see Zend_Mail_Storage_Abstract:__get() + * @param string $var + * @return string + * @throws Zend_Mail_Storage_Exception + */ + public function __get($var) + { + $result = parent::__get($var); + if ($result !== null) { + return $result; + } + + if (strtolower($var) == 'hastop') { + if ($this->_protocol->hasTop === null) { + // need to make a real call, because not all server are honest in their capas + try { + $this->_protocol->top(1, 0, false); + } catch(Zend_Mail_Exception $e) { + // ignoring error + } + } + $this->_has['top'] = $this->_protocol->hasTop; + return $this->_protocol->hasTop; + } + + if (strtolower($var) == 'hasuniqueid') { + $id = null; + try { + $id = $this->_protocol->uniqueid(1); + } catch(Zend_Mail_Exception $e) { + // ignoring error + } + $this->_has['uniqueid'] = $id ? true : false; + return $this->_has['uniqueid']; + } + + return $result; + } +} diff --git a/webui/Zend/Mail/Storage/Writable/Interface.php b/webui/Zend/Mail/Storage/Writable/Interface.php new file mode 100644 index 0000000..d86b791 --- /dev/null +++ b/webui/Zend/Mail/Storage/Writable/Interface.php @@ -0,0 +1,108 @@ +create) && isset($params->dirname) && !file_exists($params->dirname . DIRECTORY_SEPARATOR . 'cur')) { + self::initMaildir($params->dirname); + } + + parent::__construct($params); + } + + /** + * create a new folder + * + * This method also creates parent folders if necessary. Some mail storages may restrict, which folder + * may be used as parent or which chars may be used in the folder name + * + * @param string $name global name of folder, local name if $parentFolder is set + * @param string|Zend_Mail_Storage_Folder $parentFolder parent folder for new folder, else root folder is parent + * @return string only used internally (new created maildir) + * @throws Zend_Mail_Storage_Exception + */ + public function createFolder($name, $parentFolder = null) + { + if ($parentFolder instanceof Zend_Mail_Storage_Folder) { + $folder = $parentFolder->getGlobalName() . $this->_delim . $name; + } else if ($parentFolder != null) { + $folder = rtrim($parentFolder, $this->_delim) . $this->_delim . $name; + } else { + $folder = $name; + } + + $folder = trim($folder, $this->_delim); + + // first we check if we try to create a folder that does exist + $exists = null; + try { + $exists = $this->getFolders($folder); + } catch (Zend_Mail_Exception $e) { + // ok + } + if ($exists) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('folder already exists'); + } + + if (strpos($folder, $this->_delim . $this->_delim) !== false) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('invalid name - folder parts may not be empty'); + } + + if (strpos($folder, 'INBOX' . $this->_delim) === 0) { + $folder = substr($folder, 6); + } + + $fulldir = $this->_rootdir . '.' . $folder; + + // check if we got tricked and would create a dir outside of the rootdir or not as direct child + if (strpos($folder, DIRECTORY_SEPARATOR) !== false || strpos($folder, '/') !== false + || dirname($fulldir) . DIRECTORY_SEPARATOR != $this->_rootdir) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('invalid name - no directory seprator allowed in folder name'); + } + + // has a parent folder? + $parent = null; + if (strpos($folder, $this->_delim)) { + // let's see if the parent folder exists + $parent = substr($folder, 0, strrpos($folder, $this->_delim)); + try { + $this->getFolders($parent); + } catch (Zend_Mail_Exception $e) { + // does not - create parent folder + $this->createFolder($parent); + } + } + + if (!@mkdir($fulldir) || !@mkdir($fulldir . DIRECTORY_SEPARATOR . 'cur')) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('error while creating new folder, may be created incompletly'); + } + + mkdir($fulldir . DIRECTORY_SEPARATOR . 'new'); + mkdir($fulldir . DIRECTORY_SEPARATOR . 'tmp'); + + $localName = $parent ? substr($folder, strlen($parent) + 1) : $folder; + $this->getFolders($parent)->$localName = new Zend_Mail_Storage_Folder($localName, $folder, true); + + return $fulldir; + } + + /** + * remove a folder + * + * @param string|Zend_Mail_Storage_Folder $name name or instance of folder + * @return null + * @throws Zend_Mail_Storage_Exception + */ + public function removeFolder($name) + { + // TODO: This could fail in the middle of the task, which is not optimal. + // But there is no defined standard way to mark a folder as removed and there is no atomar fs-op + // to remove a directory. Also moving the folder to a/the trash folder is not possible, as + // all parent folders must be created. What we could do is add a dash to the front of the + // directory name and it should be ignored as long as other processes obey the standard. + + if ($name instanceof Zend_Mail_Storage_Folder) { + $name = $name->getGlobalName(); + } + + $name = trim($name, $this->_delim); + if (strpos($name, 'INBOX' . $this->_delim) === 0) { + $name = substr($name, 6); + } + + // check if folder exists and has no children + if (!$this->getFolders($name)->isLeaf()) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('delete children first'); + } + + if ($name == 'INBOX' || $name == DIRECTORY_SEPARATOR || $name == '/') { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('wont delete INBOX'); + } + + if ($name == $this->getCurrentFolder()) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('wont delete selected folder'); + } + + foreach (array('tmp', 'new', 'cur', '.') as $subdir) { + $dir = $this->_rootdir . '.' . $name . DIRECTORY_SEPARATOR . $subdir; + if (!file_exists($dir)) { + continue; + } + $dh = opendir($dir); + if (!$dh) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception("error opening $subdir"); + } + while (($entry = readdir($dh)) !== false) { + if ($entry == '.' || $entry == '..') { + continue; + } + if (!unlink($dir . DIRECTORY_SEPARATOR . $entry)) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception("error cleaning $subdir"); + } + } + closedir($dh); + if ($subdir !== '.') { + if (!rmdir($dir)) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception("error removing $subdir"); + } + } + } + + if (!rmdir($this->_rootdir . '.' . $name)) { + // at least we should try to make it a valid maildir again + mkdir($this->_rootdir . '.' . $name . DIRECTORY_SEPARATOR . 'cur'); + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception("error removing maindir"); + } + + $parent = strpos($name, $this->_delim) ? substr($name, 0, strrpos($name, $this->_delim)) : null; + $localName = $parent ? substr($name, strlen($parent) + 1) : $name; + unset($this->getFolders($parent)->$localName); + } + + /** + * rename and/or move folder + * + * The new name has the same restrictions as in createFolder() + * + * @param string|Zend_Mail_Storage_Folder $oldName name or instance of folder + * @param string $newName new global name of folder + * @return null + * @throws Zend_Mail_Storage_Exception + */ + public function renameFolder($oldName, $newName) + { + // TODO: This is also not atomar and has similar problems as removeFolder() + + if ($oldName instanceof Zend_Mail_Storage_Folder) { + $oldName = $oldName->getGlobalName(); + } + + $oldName = trim($oldName, $this->_delim); + if (strpos($oldName, 'INBOX' . $this->_delim) === 0) { + $oldName = substr($oldName, 6); + } + + $newName = trim($newName, $this->_delim); + if (strpos($newName, 'INBOX' . $this->_delim) === 0) { + $newName = substr($newName, 6); + } + + if (strpos($newName, $oldName . $this->_delim) === 0) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('new folder cannot be a child of old folder'); + } + + // check if folder exists and has no children + $folder = $this->getFolders($oldName); + + if ($oldName == 'INBOX' || $oldName == DIRECTORY_SEPARATOR || $oldName == '/') { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('wont rename INBOX'); + } + + if ($oldName == $this->getCurrentFolder()) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('wont rename selected folder'); + } + + $newdir = $this->createFolder($newName); + + if (!$folder->isLeaf()) { + foreach ($folder as $k => $v) { + $this->renameFolder($v->getGlobalName(), $newName . $this->_delim . $k); + } + } + + $olddir = $this->_rootdir . '.' . $folder; + foreach (array('tmp', 'new', 'cur') as $subdir) { + $subdir = DIRECTORY_SEPARATOR . $subdir; + if (!file_exists($olddir . $subdir)) { + continue; + } + // using copy or moving files would be even better - but also much slower + if (!rename($olddir . $subdir, $newdir . $subdir)) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('error while moving ' . $subdir); + } + } + // create a dummy if removing fails - otherwise we can't read it next time + mkdir($olddir . DIRECTORY_SEPARATOR . 'cur'); + $this->removeFolder($oldName); + } + + /** + * create a uniqueid for maildir filename + * + * This is nearly the format defined in the maildir standard. The microtime() call should already + * create a uniqueid, the pid is for multicore/-cpu machine that manage to call this function at the + * exact same time, and uname() gives us the hostname for multiple machines accessing the same storage. + * + * If someone disables posix we create a random number of the same size, so this method should also + * work on Windows - if you manage to get maildir working on Windows. + * Microtime could also be disabled, altough I've never seen it. + * + * @return string new uniqueid + */ + protected function _createUniqueId() + { + $id = ''; + $id .= function_exists('microtime') ? microtime(true) : (time() . ' ' . rand(0, 100000)); + $id .= '.' . (function_exists('posix_getpid') ? posix_getpid() : rand(50, 65535)); + $id .= '.' . php_uname('n'); + + return $id; + } + + /** + * open a temporary maildir file + * + * makes sure tmp/ exists and create a file with a unique name + * you should close the returned filehandle! + * + * @param string $folder name of current folder without leading . + * @return array array('dirname' => dir of maildir folder, 'uniq' => unique id, 'filename' => name of create file + * 'handle' => file opened for writing) + * @throws Zend_Mail_Storage_Exception + */ + protected function _createTmpFile($folder = 'INBOX') + { + if ($folder == 'INBOX') { + $tmpdir = $this->_rootdir . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR; + } else { + $tmpdir = $this->_rootdir . '.' . $folder . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR; + } + if (!file_exists($tmpdir)) { + if (!mkdir($tmpdir)) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('problems creating tmp dir'); + } + } + + // we should retry to create a unique id if a file with the same name exists + // to avoid a script timeout we only wait 1 second (instead of 2) and stop + // after a defined retry count + // if you change this variable take into account that it can take up to $max_tries seconds + // normally we should have a valid unique name after the first try, we're just following the "standard" here + $max_tries = 5; + for ($i = 0; $i < $max_tries; ++$i) { + $uniq = $this->_createUniqueId(); + if (!file_exists($tmpdir . $uniq)) { + // here is the race condition! - as defined in the standard + // to avoid having a long time between stat()ing the file and creating it we're opening it here + // to mark the filename as taken + $fh = fopen($tmpdir . $uniq, 'w'); + if (!$fh) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('could not open temp file'); + } + break; + } + sleep(1); + } + + if (!$fh) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception("tried $max_tries unique ids for a temp file, but all were taken" + . ' - giving up'); + } + + return array('dirname' => $this->_rootdir . '.' . $folder, 'uniq' => $uniq, 'filename' => $tmpdir . $uniq, + 'handle' => $fh); + } + + /** + * create an info string for filenames with given flags + * + * @param array $flags wanted flags, with the reference you'll get the set flags with correct key (= char for flag) + * @return string info string for version 2 filenames including the leading colon + * @throws Zend_Mail_Storage_Exception + */ + protected function _getInfoString(&$flags) + { + // accessing keys is easier, faster and it removes duplicated flags + $wanted_flags = array_flip($flags); + if (isset($wanted_flags[Zend_Mail_Storage::FLAG_RECENT])) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('recent flag may not be set'); + } + + $info = ':2,'; + $flags = array(); + foreach (Zend_Mail_Storage_Maildir::$_knownFlags as $char => $flag) { + if (!isset($wanted_flags[$flag])) { + continue; + } + $info .= $char; + $flags[$char] = $flag; + unset($wanted_flags[$flag]); + } + + if (!empty($wanted_flags)) { + $wanted_flags = implode(', ', array_keys($wanted_flags)); + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('unknown flag(s): ' . $wanted_flags); + } + + return $info; + } + + /** + * append a new message to mail storage + * + * @param string|stream $message message as string or stream resource + * @param null|string|Zend_Mail_Storage_Folder $folder folder for new message, else current folder is taken + * @param null|array $flags set flags for new message, else a default set is used + * @param bool $recent handle this mail as if recent flag has been set, + * should only be used in delivery + * @throws Zend_Mail_Storage_Exception + */ + // not yet * @param string|Zend_Mail_Message|Zend_Mime_Message $message message as string or instance of message class + + public function appendMessage($message, $folder = null, $flags = null, $recent = false) + { + if ($this->_quota && $this->checkQuota()) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('storage is over quota!'); + } + + if ($folder === null) { + $folder = $this->_currentFolder; + } + + if (!($folder instanceof Zend_Mail_Storage_Folder)) { + $folder = $this->getFolders($folder); + } + + if ($flags === null) { + $flags = array(Zend_Mail_Storage::FLAG_SEEN); + } + $info = $this->_getInfoString($flags); + $temp_file = $this->_createTmpFile($folder->getGlobalName()); + + // TODO: handle class instances for $message + if (is_resource($message) && get_resource_type($message) == 'stream') { + stream_copy_to_stream($message, $temp_file['handle']); + } else { + fputs($temp_file['handle'], $message); + } + fclose($temp_file['handle']); + + // we're adding the size to the filename for maildir++ + $size = filesize($temp_file['filename']); + if ($size !== false) { + $info = ',S=' . $size . $info; + } + $new_filename = $temp_file['dirname'] . DIRECTORY_SEPARATOR; + $new_filename .= $recent ? 'new' : 'cur'; + $new_filename .= DIRECTORY_SEPARATOR . $temp_file['uniq'] . $info; + + // we're throwing any exception after removing our temp file and saving it to this variable instead + $exception = null; + + if (!link($temp_file['filename'], $new_filename)) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + $exception = new Zend_Mail_Storage_Exception('cannot link message file to final dir'); + } + @unlink($temp_file['filename']); + + if ($exception) { + throw $exception; + } + + $this->_files[] = array('uniq' => $temp_file['uniq'], + 'flags' => $flags, + 'filename' => $new_filename); + if ($this->_quota) { + $this->_addQuotaEntry((int)$size, 1); + } + } + + /** + * copy an existing message + * + * @param int $id number of message + * @param string|Zend_Mail_Storage_Folder $folder name or instance of targer folder + * @return null + * @throws Zend_Mail_Storage_Exception + */ + public function copyMessage($id, $folder) + { + if ($this->_quota && $this->checkQuota()) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('storage is over quota!'); + } + + if (!($folder instanceof Zend_Mail_Storage_Folder)) { + $folder = $this->getFolders($folder); + } + + $filedata = $this->_getFileData($id); + $old_file = $filedata['filename']; + $flags = $filedata['flags']; + + // copied message can't be recent + while (($key = array_search(Zend_Mail_Storage::FLAG_RECENT, $flags)) !== false) { + unset($flags[$key]); + } + $info = $this->_getInfoString($flags); + + // we're creating the copy as temp file before moving to cur/ + $temp_file = $this->_createTmpFile($folder->getGlobalName()); + // we don't write directly to the file + fclose($temp_file['handle']); + + // we're adding the size to the filename for maildir++ + $size = filesize($old_file); + if ($size !== false) { + $info = ',S=' . $size . $info; + } + + $new_file = $temp_file['dirname'] . DIRECTORY_SEPARATOR . 'cur' . DIRECTORY_SEPARATOR . $temp_file['uniq'] . $info; + + // we're throwing any exception after removing our temp file and saving it to this variable instead + $exception = null; + + if (!copy($old_file, $temp_file['filename'])) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + $exception = new Zend_Mail_Storage_Exception('cannot copy message file'); + } else if (!link($temp_file['filename'], $new_file)) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + $exception = new Zend_Mail_Storage_Exception('cannot link message file to final dir'); + } + @unlink($temp_file['filename']); + + if ($exception) { + throw $exception; + } + + if ($folder->getGlobalName() == $this->_currentFolder + || ($this->_currentFolder == 'INBOX' && $folder->getGlobalName() == '/')) { + $this->_files[] = array('uniq' => $temp_file['uniq'], + 'flags' => $flags, + 'filename' => $new_file); + } + + if ($this->_quota) { + $this->_addQuotaEntry((int)$size, 1); + } + } + + /** + * move an existing message + * + * @param int $id number of message + * @param string|Zend_Mail_Storage_Folder $folder name or instance of targer folder + * @return null + * @throws Zend_Mail_Storage_Exception + */ + public function moveMessage($id, $folder) { + if (!($folder instanceof Zend_Mail_Storage_Folder)) { + $folder = $this->getFolders($folder); + } + + if ($folder->getGlobalName() == $this->_currentFolder + || ($this->_currentFolder == 'INBOX' && $folder->getGlobalName() == '/')) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('target is current folder'); + } + + $filedata = $this->_getFileData($id); + $old_file = $filedata['filename']; + $flags = $filedata['flags']; + + // moved message can't be recent + while (($key = array_search(Zend_Mail_Storage::FLAG_RECENT, $flags)) !== false) { + unset($flags[$key]); + } + $info = $this->_getInfoString($flags); + + // reserving a new name + $temp_file = $this->_createTmpFile($folder->getGlobalName()); + fclose($temp_file['handle']); + + // we're adding the size to the filename for maildir++ + $size = filesize($old_file); + if ($size !== false) { + $info = ',S=' . $size . $info; + } + + $new_file = $temp_file['dirname'] . DIRECTORY_SEPARATOR . 'cur' . DIRECTORY_SEPARATOR . $temp_file['uniq'] . $info; + + // we're throwing any exception after removing our temp file and saving it to this variable instead + $exception = null; + + if (!rename($old_file, $new_file)) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + $exception = new Zend_Mail_Storage_Exception('cannot move message file'); + } + @unlink($temp_file['filename']); + + if ($exception) { + throw $exception; + } + + unset($this->_files[$id - 1]); + // remove the gap + $this->_files = array_values($this->_files); + } + + + /** + * set flags for message + * + * NOTE: this method can't set the recent flag. + * + * @param int $id number of message + * @param array $flags new flags for message + * @throws Zend_Mail_Storage_Exception + */ + public function setFlags($id, $flags) + { + $info = $this->_getInfoString($flags); + $filedata = $this->_getFileData($id); + + // NOTE: double dirname to make sure we always move to cur. if recent flag has been set (message is in new) it will be moved to cur. + $new_filename = dirname(dirname($filedata['filename'])) . DIRECTORY_SEPARATOR . 'cur' . DIRECTORY_SEPARATOR . "$filedata[uniq]$info"; + + if (!@rename($filedata['filename'], $new_filename)) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('cannot rename file'); + } + + $filedata['flags'] = $flags; + $filedata['filename'] = $new_filename; + + $this->_files[$id - 1] = $filedata; + } + + + /** + * stub for not supported message deletion + * + * @return null + * @throws Zend_Mail_Storage_Exception + */ + public function removeMessage($id) + { + $filename = $this->_getFileData($id, 'filename'); + + if ($this->_quota) { + $size = filesize($filename); + } + + if (!@unlink($filename)) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('cannot remove message'); + } + unset($this->_files[$id - 1]); + // remove the gap + $this->_files = array_values($this->_files); + if ($this->_quota) { + $this->_addQuotaEntry(0 - (int)$size, -1); + } + } + + /** + * enable/disable quota and set a quota value if wanted or needed + * + * You can enable/disable quota with true/false. If you don't have + * a MDA or want to enforce a quota value you can also set this value + * here. Use array('size' => SIZE_QUOTA, 'count' => MAX_MESSAGE) do + * define your quota. Order of these fields does matter! + * + * @param bool|array $value new quota value + * @return null + */ + public function setQuota($value) { + $this->_quota = $value; + } + + /** + * get currently set quota + * + * @see Zend_Mail_Storage_Writable_Maildir::setQuota() + * + * @return bool|array + */ + public function getQuota($fromStorage = false) { + if ($fromStorage) { + $fh = @fopen($this->_rootdir . 'maildirsize', 'r'); + if (!$fh) { + /** + * @see Zend_Mail_Storage_Exception + */ + require_once 'Zend/Mail/Storage/Exception.php'; + throw new Zend_Mail_Storage_Exception('cannot open maildirsize'); + } + $definition = fgets($fh); + fclose($fh); + $definition = explode(',', trim($definition)); + $quota = array(); + foreach ($definition as $member) { + $key = $member[strlen($member) - 1]; + if ($key == 'S' || $key == 'C') { + $key = $key == 'C' ? 'count' : 'size'; + } + $quota[$key] = substr($member, 0, -1); + } + return $quota; + } + + return $this->_quota; + } + + /** + * @see http://www.inter7.com/courierimap/README.maildirquota.html "Calculating maildirsize" + */ + protected function _calculateMaildirsize() { + $timestamps = array(); + $messages = 0; + $total_size = 0; + + if (is_array($this->_quota)) { + $quota = $this->_quota; + } else { + try { + $quota = $this->getQuota(true); + } catch (Zend_Mail_Storage_Exception $e) { + throw new Zend_Mail_Storage_Exception('no quota definition found', 0, $e); + } + } + + $folders = new RecursiveIteratorIterator($this->getFolders(), RecursiveIteratorIterator::SELF_FIRST); + foreach ($folders as $folder) { + $subdir = $folder->getGlobalName(); + if ($subdir == 'INBOX') { + $subdir = ''; + } else { + $subdir = '.' . $subdir; + } + if ($subdir == 'Trash') { + continue; + } + + foreach (array('cur', 'new') as $subsubdir) { + $dirname = $this->_rootdir . $subdir . DIRECTORY_SEPARATOR . $subsubdir . DIRECTORY_SEPARATOR; + if (!file_exists($dirname)) { + continue; + } + // NOTE: we are using mtime instead of "the latest timestamp". The latest would be atime + // and as we are accessing the directory it would make the whole calculation useless. + $timestamps[$dirname] = filemtime($dirname); + + $dh = opendir($dirname); + // NOTE: Should have been checked in constructor. Not throwing an exception here, quotas will + // therefore not be fully enforeced, but next request will fail anyway, if problem persists. + if (!$dh) { + continue; + } + + + while (($entry = readdir()) !== false) { + if ($entry[0] == '.' || !is_file($dirname . $entry)) { + continue; + } + + if (strpos($entry, ',S=')) { + strtok($entry, '='); + $filesize = strtok(':'); + if (is_numeric($filesize)) { + $total_size += $filesize; + ++$messages; + continue; + } + } + $size = filesize($dirname . $entry); + if ($size === false) { + // ignore, as we assume file got removed + continue; + } + $total_size += $size; + ++$messages; + } + } + } + + $tmp = $this->_createTmpFile(); + $fh = $tmp['handle']; + $definition = array(); + foreach ($quota as $type => $value) { + if ($type == 'size' || $type == 'count') { + $type = $type == 'count' ? 'C' : 'S'; + } + $definition[] = $value . $type; + } + $definition = implode(',', $definition); + fputs($fh, "$definition\n"); + fputs($fh, "$total_size $messages\n"); + fclose($fh); + rename($tmp['filename'], $this->_rootdir . 'maildirsize'); + foreach ($timestamps as $dir => $timestamp) { + if ($timestamp < filemtime($dir)) { + unlink($this->_rootdir . 'maildirsize'); + break; + } + } + + return array('size' => $total_size, 'count' => $messages, 'quota' => $quota); + } + + /** + * @see http://www.inter7.com/courierimap/README.maildirquota.html "Calculating the quota for a Maildir++" + */ + protected function _calculateQuota($forceRecalc = false) { + $fh = null; + $total_size = 0; + $messages = 0; + $maildirsize = ''; + if (!$forceRecalc && file_exists($this->_rootdir . 'maildirsize') && filesize($this->_rootdir . 'maildirsize') < 5120) { + $fh = fopen($this->_rootdir . 'maildirsize', 'r'); + } + if ($fh) { + $maildirsize = fread($fh, 5120); + if (strlen($maildirsize) >= 5120) { + fclose($fh); + $fh = null; + $maildirsize = ''; + } + } + if (!$fh) { + $result = $this->_calculateMaildirsize(); + $total_size = $result['size']; + $messages = $result['count']; + $quota = $result['quota']; + } else { + $maildirsize = explode("\n", $maildirsize); + if (is_array($this->_quota)) { + $quota = $this->_quota; + } else { + $definition = explode(',', $maildirsize[0]); + $quota = array(); + foreach ($definition as $member) { + $key = $member[strlen($member) - 1]; + if ($key == 'S' || $key == 'C') { + $key = $key == 'C' ? 'count' : 'size'; + } + $quota[$key] = substr($member, 0, -1); + } + } + unset($maildirsize[0]); + foreach ($maildirsize as $line) { + list($size, $count) = explode(' ', trim($line)); + $total_size += $size; + $messages += $count; + } + } + + $over_quota = false; + $over_quota = $over_quota || (isset($quota['size']) && $total_size > $quota['size']); + $over_quota = $over_quota || (isset($quota['count']) && $messages > $quota['count']); + // NOTE: $maildirsize equals false if it wasn't set (AKA we recalculated) or it's only + // one line, because $maildirsize[0] gets unsetted. + // Also we're using local time to calculate the 15 minute offset. Touching a file just for known the + // local time of the file storage isn't worth the hassle. + if ($over_quota && ($maildirsize || filemtime($this->_rootdir . 'maildirsize') > time() - 900)) { + $result = $this->_calculateMaildirsize(); + $total_size = $result['size']; + $messages = $result['count']; + $quota = $result['quota']; + $over_quota = false; + $over_quota = $over_quota || (isset($quota['size']) && $total_size > $quota['size']); + $over_quota = $over_quota || (isset($quota['count']) && $messages > $quota['count']); + } + + if ($fh) { + // TODO is there a safe way to keep the handle open for writing? + fclose($fh); + } + + return array('size' => $total_size, 'count' => $messages, 'quota' => $quota, 'over_quota' => $over_quota); + } + + protected function _addQuotaEntry($size, $count = 1) { + if (!file_exists($this->_rootdir . 'maildirsize')) { + // TODO: should get file handler from _calculateQuota + } + $size = (int)$size; + $count = (int)$count; + file_put_contents($this->_rootdir . 'maildirsize', "$size $count\n", FILE_APPEND); + } + + /** + * check if storage is currently over quota + * + * @param bool $detailedResponse return known data of quota and current size and message count @see _calculateQuota() + * @return bool|array over quota state or detailed response + */ + public function checkQuota($detailedResponse = false, $forceRecalc = false) { + $result = $this->_calculateQuota($forceRecalc); + return $detailedResponse ? $result : $result['over_quota']; + } +} diff --git a/webui/Zend/Mail/Transport/Abstract.php b/webui/Zend/Mail/Transport/Abstract.php new file mode 100644 index 0000000..106074c --- /dev/null +++ b/webui/Zend/Mail/Transport/Abstract.php @@ -0,0 +1,350 @@ +_mail->getType(); + if (!$type) { + if ($this->_mail->hasAttachments) { + $type = Zend_Mime::MULTIPART_MIXED; + } elseif ($this->_mail->getBodyText() && $this->_mail->getBodyHtml()) { + $type = Zend_Mime::MULTIPART_ALTERNATIVE; + } else { + $type = Zend_Mime::MULTIPART_MIXED; + } + } + + $this->_headers['Content-Type'] = array( + $type . ';' + . $this->EOL + . " " . 'boundary="' . $boundary . '"' + ); + $this->boundary = $boundary; + } + + $this->_headers['MIME-Version'] = array('1.0'); + + return $this->_headers; + } + + /** + * Prepend header name to header value + * + * @param string $item + * @param string $key + * @param string $prefix + * @static + * @access protected + * @return void + */ + protected static function _formatHeader(&$item, $key, $prefix) + { + $item = $prefix . ': ' . $item; + } + + /** + * Prepare header string for use in transport + * + * Prepares and generates {@link $header} based on the headers provided. + * + * @param mixed $headers + * @access protected + * @return void + * @throws Zend_Mail_Transport_Exception if any header lines exceed 998 + * characters + */ + protected function _prepareHeaders($headers) + { + if (!$this->_mail) { + /** + * @see Zend_Mail_Transport_Exception + */ + require_once 'Zend/Mail/Transport/Exception.php'; + throw new Zend_Mail_Transport_Exception('Missing Zend_Mail object in _mail property'); + } + + $this->header = ''; + + foreach ($headers as $header => $content) { + if (isset($content['append'])) { + unset($content['append']); + $value = implode(',' . $this->EOL . ' ', $content); + $this->header .= $header . ': ' . $value . $this->EOL; + } else { + array_walk($content, array(get_class($this), '_formatHeader'), $header); + $this->header .= implode($this->EOL, $content) . $this->EOL; + } + } + + // Sanity check on headers -- should not be > 998 characters + $sane = true; + foreach (explode($this->EOL, $this->header) as $line) { + if (strlen(trim($line)) > 998) { + $sane = false; + break; + } + } + if (!$sane) { + /** + * @see Zend_Mail_Transport_Exception + */ + require_once 'Zend/Mail/Transport/Exception.php'; + throw new Zend_Mail_Exception('At least one mail header line is too long'); + } + } + + /** + * Generate MIME compliant message from the current configuration + * + * If both a text and HTML body are present, generates a + * multipart/alternative Zend_Mime_Part containing the headers and contents + * of each. Otherwise, uses whichever of the text or HTML parts present. + * + * The content part is then prepended to the list of Zend_Mime_Parts for + * this message. + * + * @return void + */ + protected function _buildBody() + { + if (($text = $this->_mail->getBodyText()) + && ($html = $this->_mail->getBodyHtml())) + { + // Generate unique boundary for multipart/alternative + $mime = new Zend_Mime(null); + $boundaryLine = $mime->boundaryLine($this->EOL); + $boundaryEnd = $mime->mimeEnd($this->EOL); + + $text->disposition = false; + $html->disposition = false; + + $body = $boundaryLine + . $text->getHeaders($this->EOL) + . $this->EOL + . $text->getContent($this->EOL) + . $this->EOL + . $boundaryLine + . $html->getHeaders($this->EOL) + . $this->EOL + . $html->getContent($this->EOL) + . $this->EOL + . $boundaryEnd; + + $mp = new Zend_Mime_Part($body); + $mp->type = Zend_Mime::MULTIPART_ALTERNATIVE; + $mp->boundary = $mime->boundary(); + + $this->_isMultipart = true; + + // Ensure first part contains text alternatives + array_unshift($this->_parts, $mp); + + // Get headers + $this->_headers = $this->_mail->getHeaders(); + return; + } + + // If not multipart, then get the body + if (false !== ($body = $this->_mail->getBodyHtml())) { + array_unshift($this->_parts, $body); + } elseif (false !== ($body = $this->_mail->getBodyText())) { + array_unshift($this->_parts, $body); + } + + if (!$body) { + /** + * @see Zend_Mail_Transport_Exception + */ + require_once 'Zend/Mail/Transport/Exception.php'; + throw new Zend_Mail_Transport_Exception('No body specified'); + } + + // Get headers + $this->_headers = $this->_mail->getHeaders(); + $headers = $body->getHeadersArray($this->EOL); + foreach ($headers as $header) { + // Headers in Zend_Mime_Part are kept as arrays with two elements, a + // key and a value + $this->_headers[$header[0]] = array($header[1]); + } + } + + /** + * Send a mail using this transport + * + * @param Zend_Mail $mail + * @access public + * @return void + * @throws Zend_Mail_Transport_Exception if mail is empty + */ + public function send(Zend_Mail $mail) + { + $this->_isMultipart = false; + $this->_mail = $mail; + $this->_parts = $mail->getParts(); + $mime = $mail->getMime(); + + // Build body content + $this->_buildBody(); + + // Determine number of parts and boundary + $count = count($this->_parts); + $boundary = null; + if ($count < 1) { + /** + * @see Zend_Mail_Transport_Exception + */ + require_once 'Zend/Mail/Transport/Exception.php'; + throw new Zend_Mail_Transport_Exception('Empty mail cannot be sent'); + } + + if ($count > 1) { + // Multipart message; create new MIME object and boundary + $mime = new Zend_Mime($this->_mail->getMimeBoundary()); + $boundary = $mime->boundary(); + } elseif ($this->_isMultipart) { + // multipart/alternative -- grab boundary + $boundary = $this->_parts[0]->boundary; + } + + // Determine recipients, and prepare headers + $this->recipients = implode(',', $mail->getRecipients()); + $this->_prepareHeaders($this->_getHeaders($boundary)); + + // Create message body + // This is done so that the same Zend_Mail object can be used in + // multiple transports + $message = new Zend_Mime_Message(); + $message->setParts($this->_parts); + $message->setMime($mime); + $this->body = $message->generateMessage($this->EOL); + + // Send to transport! + $this->_sendMail(); + } +} diff --git a/webui/Zend/Mail/Transport/Exception.php b/webui/Zend/Mail/Transport/Exception.php new file mode 100644 index 0000000..244dab9 --- /dev/null +++ b/webui/Zend/Mail/Transport/Exception.php @@ -0,0 +1,39 @@ +toArray(); + } elseif (!is_array($options)) { + $options = array(); + } + + // Making sure we have some defaults to work with + if (!isset($options['path'])) { + $options['path'] = sys_get_temp_dir(); + } + if (!isset($options['callback'])) { + $options['callback'] = array($this, 'defaultCallback'); + } + + $this->setOptions($options); + } + + /** + * Sets options + * + * @param array $options + * @return void + */ + public function setOptions(array $options) + { + if (isset($options['path']) && is_dir($options['path'])) { + $this->_path = $options['path']; + } + if (isset($options['callback']) && is_callable($options['callback'])) { + $this->_callback = $options['callback']; + } + } + + /** + * Saves e-mail message to a file + * + * @return void + * @throws Zend_Mail_Transport_Exception on not writable target directory + * @throws Zend_Mail_Transport_Exception on file_put_contents() failure + */ + protected function _sendMail() + { + $file = $this->_path . DIRECTORY_SEPARATOR . call_user_func($this->_callback, $this); + + if (!is_writable(dirname($file))) { + require_once 'Zend/Mail/Transport/Exception.php'; + throw new Zend_Mail_Transport_Exception(sprintf( + 'Target directory "%s" does not exist or is not writable', + dirname($file) + )); + } + + $email = $this->header . $this->EOL . $this->body; + + if (!file_put_contents($file, $email)) { + require_once 'Zend/Mail/Transport/Exception.php'; + throw new Zend_Mail_Transport_Exception('Unable to send mail'); + } + } + + /** + * Default callback for generating filenames + * + * @param Zend_Mail_Transport_File File transport instance + * @return string + */ + public function defaultCallback($transport) + { + return 'ZendMail_' . $_SERVER['REQUEST_TIME'] . '_' . mt_rand() . '.tmp'; + } +} diff --git a/webui/Zend/Mail/Transport/Sendmail.php b/webui/Zend/Mail/Transport/Sendmail.php new file mode 100644 index 0000000..39ec23e --- /dev/null +++ b/webui/Zend/Mail/Transport/Sendmail.php @@ -0,0 +1,220 @@ +toArray(); + } + + if (is_array($parameters)) { + $parameters = implode(' ', $parameters); + } + + $this->parameters = $parameters; + } + + + /** + * Send mail using PHP native mail() + * + * @access public + * @return void + * @throws Zend_Mail_Transport_Exception if parameters is set + * but not a string + * @throws Zend_Mail_Transport_Exception on mail() failure + */ + public function _sendMail() + { + if ($this->parameters === null) { + set_error_handler(array($this, '_handleMailErrors')); + $result = mail( + $this->recipients, + $this->_mail->getSubject(), + $this->body, + $this->header); + restore_error_handler(); + } else { + if(!is_string($this->parameters)) { + /** + * @see Zend_Mail_Transport_Exception + * + * Exception is thrown here because + * $parameters is a public property + */ + require_once 'Zend/Mail/Transport/Exception.php'; + throw new Zend_Mail_Transport_Exception( + 'Parameters were set but are not a string' + ); + } + + set_error_handler(array($this, '_handleMailErrors')); + $result = mail( + $this->recipients, + $this->_mail->getSubject(), + $this->body, + $this->header, + $this->parameters); + restore_error_handler(); + } + + if ($this->_errstr !== null || !$result) { + /** + * @see Zend_Mail_Transport_Exception + */ + require_once 'Zend/Mail/Transport/Exception.php'; + throw new Zend_Mail_Transport_Exception('Unable to send mail. ' . $this->_errstr); + } + } + + + /** + * Format and fix headers + * + * mail() uses its $to and $subject arguments to set the To: and Subject: + * headers, respectively. This method strips those out as a sanity check to + * prevent duplicate header entries. + * + * @access protected + * @param array $headers + * @return void + * @throws Zend_Mail_Transport_Exception + */ + protected function _prepareHeaders($headers) + { + if (!$this->_mail) { + /** + * @see Zend_Mail_Transport_Exception + */ + require_once 'Zend/Mail/Transport/Exception.php'; + throw new Zend_Mail_Transport_Exception('_prepareHeaders requires a registered Zend_Mail object'); + } + + // mail() uses its $to parameter to set the To: header, and the $subject + // parameter to set the Subject: header. We need to strip them out. + if (0 === strpos(PHP_OS, 'WIN')) { + // If the current recipients list is empty, throw an error + if (empty($this->recipients)) { + /** + * @see Zend_Mail_Transport_Exception + */ + require_once 'Zend/Mail/Transport/Exception.php'; + throw new Zend_Mail_Transport_Exception('Missing To addresses'); + } + } else { + // All others, simply grab the recipients and unset the To: header + if (!isset($headers['To'])) { + /** + * @see Zend_Mail_Transport_Exception + */ + require_once 'Zend/Mail/Transport/Exception.php'; + throw new Zend_Mail_Transport_Exception('Missing To header'); + } + + unset($headers['To']['append']); + $this->recipients = implode(',', $headers['To']); + } + + // Remove recipient header + unset($headers['To']); + + // Remove subject header, if present + if (isset($headers['Subject'])) { + unset($headers['Subject']); + } + + // Prepare headers + parent::_prepareHeaders($headers); + + // Fix issue with empty blank line ontop when using Sendmail Trnasport + $this->header = rtrim($this->header); + } + + /** + * Temporary error handler for PHP native mail(). + * + * @param int $errno + * @param string $errstr + * @param string $errfile + * @param string $errline + * @param array $errcontext + * @return true + */ + public function _handleMailErrors($errno, $errstr, $errfile = null, $errline = null, array $errcontext = null) + { + $this->_errstr = $errstr; + return true; + } + +} diff --git a/webui/Zend/Mail/Transport/Smtp.php b/webui/Zend/Mail/Transport/Smtp.php new file mode 100644 index 0000000..01d5242 --- /dev/null +++ b/webui/Zend/Mail/Transport/Smtp.php @@ -0,0 +1,243 @@ +_name = $config['name']; + } + if (isset($config['port'])) { + $this->_port = $config['port']; + } + if (isset($config['auth'])) { + $this->_auth = $config['auth']; + } + + $this->_host = $host; + $this->_config = $config; + } + + + /** + * Class destructor to ensure all open connections are closed + * + * @return void + */ + public function __destruct() + { + if ($this->_connection instanceof Zend_Mail_Protocol_Smtp) { + try { + $this->_connection->quit(); + } catch (Zend_Mail_Protocol_Exception $e) { + // ignore + } + $this->_connection->disconnect(); + } + } + + + /** + * Sets the connection protocol instance + * + * @param Zend_Mail_Protocol_Abstract $client + * + * @return void + */ + public function setConnection(Zend_Mail_Protocol_Abstract $connection) + { + $this->_connection = $connection; + } + + + /** + * Gets the connection protocol instance + * + * @return Zend_Mail_Protocol|null + */ + public function getConnection() + { + return $this->_connection; + } + + /** + * Send an email via the SMTP connection protocol + * + * The connection via the protocol adapter is made just-in-time to allow a + * developer to add a custom adapter if required before mail is sent. + * + * @return void + * @todo Rename this to sendMail, it's a public method... + */ + public function _sendMail() + { + // If sending multiple messages per session use existing adapter + if (!($this->_connection instanceof Zend_Mail_Protocol_Smtp)) { + // Check if authentication is required and determine required class + $connectionClass = 'Zend_Mail_Protocol_Smtp'; + if ($this->_auth) { + $connectionClass .= '_Auth_' . ucwords($this->_auth); + } + if (!class_exists($connectionClass)) { + require_once 'Zend/Loader.php'; + Zend_Loader::loadClass($connectionClass); + } + $this->setConnection(new $connectionClass($this->_host, $this->_port, $this->_config)); + $this->_connection->connect(); + $this->_connection->helo($this->_name); + } else { + // Reset connection to ensure reliable transaction + $this->_connection->rset(); + } + + // Set sender email address + $this->_connection->mail($this->_mail->getReturnPath()); + + // Set recipient forward paths + foreach ($this->_mail->getRecipients() as $recipient) { + $this->_connection->rcpt($recipient); + } + + // Issue DATA command to client + $this->_connection->data($this->header . Zend_Mime::LINEEND . $this->body); + } + + /** + * Format and fix headers + * + * Some SMTP servers do not strip BCC headers. Most clients do it themselves as do we. + * + * @access protected + * @param array $headers + * @return void + * @throws Zend_Transport_Exception + */ + protected function _prepareHeaders($headers) + { + if (!$this->_mail) { + /** + * @see Zend_Mail_Transport_Exception + */ + require_once 'Zend/Mail/Transport/Exception.php'; + throw new Zend_Mail_Transport_Exception('_prepareHeaders requires a registered Zend_Mail object'); + } + + unset($headers['Bcc']); + + // Prepare headers + parent::_prepareHeaders($headers); + } +} diff --git a/webui/Zend/Mime.php b/webui/Zend/Mime.php new file mode 100644 index 0000000..5a4fd5a --- /dev/null +++ b/webui/Zend/Mime.php @@ -0,0 +1,365 @@ + 0) { + $ptr = strlen($str); + if ($ptr > $lineLength) { + $ptr = $lineLength; + } + + // Ensure we are not splitting across an encoded character + $pos = strrpos(substr($str, 0, $ptr), '='); + if ($pos !== false && $pos >= $ptr - 2) { + $ptr = $pos; + } + + // Check if there is a space at the end of the line and rewind + if ($ptr > 0 && $str[$ptr - 1] == ' ') { + --$ptr; + } + + // Add string and continue + $out .= substr($str, 0, $ptr) . '=' . $lineEnd; + $str = substr($str, $ptr); + } + + $out = rtrim($out, $lineEnd); + $out = rtrim($out, '='); + return $out; + } + + /** + * Converts a string into quoted printable format. + * + * @param string $str + * @return string + */ + private static function _encodeQuotedPrintable($str) + { + $str = str_replace('=', '=3D', $str); + $str = str_replace(self::$qpKeys, self::$qpReplaceValues, $str); + $str = rtrim($str); + return $str; + } + + /** + * Encode a given string with the QUOTED_PRINTABLE mechanism for Mail Headers. + * + * Mail headers depend on an extended quoted printable algorithm otherwise + * a range of bugs can occur. + * + * @param string $str + * @param string $charset + * @param int $lineLength Defaults to {@link LINELENGTH} + * @param int $lineEnd Defaults to {@link LINEEND} + * @return string + */ + public static function encodeQuotedPrintableHeader($str, $charset, + $lineLength = self::LINELENGTH, + $lineEnd = self::LINEEND) + { + // Reduce line-length by the length of the required delimiter, charsets and encoding + $prefix = sprintf('=?%s?Q?', $charset); + $lineLength = $lineLength-strlen($prefix)-3; + + $str = self::_encodeQuotedPrintable($str); + + // Mail-Header required chars have to be encoded also: + $str = str_replace(array('?', ' ', '_', ','), array('=3F', '=20', '=5F', '=2C'), $str); + + // initialize first line, we need it anyways + $lines = array(0 => ""); + + // Split encoded text into separate lines + $tmp = ""; + while(strlen($str) > 0) { + $currentLine = max(count($lines)-1, 0); + $token = self::getNextQuotedPrintableToken($str); + $str = substr($str, strlen($token)); + + $tmp .= $token; + if($token == '=20') { + // only if we have a single char token or space, we can append the + // tempstring it to the current line or start a new line if necessary. + if(strlen($lines[$currentLine].$tmp) > $lineLength) { + $lines[$currentLine+1] = $tmp; + } else { + $lines[$currentLine] .= $tmp; + } + $tmp = ""; + } + // don't forget to append the rest to the last line + if(strlen($str) == 0) { + $lines[$currentLine] .= $tmp; + } + } + + // assemble the lines together by pre- and appending delimiters, charset, encoding. + for($i = 0; $i < count($lines); $i++) { + $lines[$i] = " ".$prefix.$lines[$i]."?="; + } + $str = trim(implode($lineEnd, $lines)); + return $str; + } + + /** + * Retrieves the first token from a quoted printable string. + * + * @param string $str + * @return string + */ + private static function getNextQuotedPrintableToken($str) + { + if(substr($str, 0, 1) == "=") { + $token = substr($str, 0, 3); + } else { + $token = substr($str, 0, 1); + } + return $token; + } + + /** + * Encode a given string in mail header compatible base64 encoding. + * + * @param string $str + * @param string $charset + * @param int $lineLength Defaults to {@link LINELENGTH} + * @param int $lineEnd Defaults to {@link LINEEND} + * @return string + */ + public static function encodeBase64Header($str, + $charset, + $lineLength = self::LINELENGTH, + $lineEnd = self::LINEEND) + { + $prefix = '=?' . $charset . '?B?'; + $suffix = '?='; + $remainingLength = $lineLength - strlen($prefix) - strlen($suffix); + + $encodedValue = self::encodeBase64($str, $remainingLength, $lineEnd); + $encodedValue = str_replace($lineEnd, $suffix . $lineEnd . ' ' . $prefix, $encodedValue); + $encodedValue = $prefix . $encodedValue . $suffix; + return $encodedValue; + } + + /** + * Encode a given string in base64 encoding and break lines + * according to the maximum linelength. + * + * @param string $str + * @param int $lineLength Defaults to {@link LINELENGTH} + * @param int $lineEnd Defaults to {@link LINEEND} + * @return string + */ + public static function encodeBase64($str, + $lineLength = self::LINELENGTH, + $lineEnd = self::LINEEND) + { + return rtrim(chunk_split(base64_encode($str), $lineLength, $lineEnd)); + } + + /** + * Constructor + * + * @param null|string $boundary + * @access public + * @return void + */ + public function __construct($boundary = null) + { + // This string needs to be somewhat unique + if ($boundary === null) { + $this->_boundary = '=_' . md5(microtime(1) . self::$makeUnique++); + } else { + $this->_boundary = $boundary; + } + } + + /** + * Encode the given string with the given encoding. + * + * @param string $str + * @param string $encoding + * @param string $EOL EOL string; defaults to {@link Zend_Mime::LINEEND} + * @return string + */ + public static function encode($str, $encoding, $EOL = self::LINEEND) + { + switch ($encoding) { + case self::ENCODING_BASE64: + return self::encodeBase64($str, self::LINELENGTH, $EOL); + + case self::ENCODING_QUOTEDPRINTABLE: + return self::encodeQuotedPrintable($str, self::LINELENGTH, $EOL); + + default: + /** + * @todo 7Bit and 8Bit is currently handled the same way. + */ + return $str; + } + } + + /** + * Return a MIME boundary + * + * @access public + * @return string + */ + public function boundary() + { + return $this->_boundary; + } + + /** + * Return a MIME boundary line + * + * @param mixed $EOL Defaults to {@link LINEEND} + * @access public + * @return string + */ + public function boundaryLine($EOL = self::LINEEND) + { + return $EOL . '--' . $this->_boundary . $EOL; + } + + /** + * Return MIME ending + * + * @access public + * @return string + */ + public function mimeEnd($EOL = self::LINEEND) + { + return $EOL . '--' . $this->_boundary . '--' . $EOL; + } +} diff --git a/webui/Zend/Mime/Decode.php b/webui/Zend/Mime/Decode.php new file mode 100644 index 0000000..eec3793 --- /dev/null +++ b/webui/Zend/Mime/Decode.php @@ -0,0 +1,244 @@ + array(name => value), 'body' => content), null if no parts found + * @throws Zend_Exception + */ + public static function splitMessageStruct($message, $boundary, $EOL = Zend_Mime::LINEEND) + { + $parts = self::splitMime($message, $boundary); + if (count($parts) <= 0) { + return null; + } + $result = array(); + foreach ($parts as $part) { + self::splitMessage($part, $headers, $body, $EOL); + $result[] = array('header' => $headers, + 'body' => $body ); + } + return $result; + } + + /** + * split a message in header and body part, if no header or an + * invalid header is found $headers is empty + * + * The charset of the returned headers depend on your iconv settings. + * + * @param string $message raw message with header and optional content + * @param array $headers output param, array with headers as array(name => value) + * @param string $body output param, content of message + * @param string $EOL EOL string; defaults to {@link Zend_Mime::LINEEND} + * @return null + */ + public static function splitMessage($message, &$headers, &$body, $EOL = Zend_Mime::LINEEND) + { + // check for valid header at first line + $firstline = strtok($message, "\n"); + if (!preg_match('%^[^\s]+[^:]*:%', $firstline)) { + $headers = array(); + // TODO: we're ignoring \r for now - is this function fast enough and is it safe to asume noone needs \r? + $body = str_replace(array("\r", "\n"), array('', $EOL), $message); + return; + } + + // find an empty line between headers and body + // default is set new line + if (strpos($message, $EOL . $EOL)) { + list($headers, $body) = explode($EOL . $EOL, $message, 2); + // next is the standard new line + } else if ($EOL != "\r\n" && strpos($message, "\r\n\r\n")) { + list($headers, $body) = explode("\r\n\r\n", $message, 2); + // next is the other "standard" new line + } else if ($EOL != "\n" && strpos($message, "\n\n")) { + list($headers, $body) = explode("\n\n", $message, 2); + // at last resort find anything that looks like a new line + } else { + @list($headers, $body) = @preg_split("%([\r\n]+)\\1%U", $message, 2); + } + + $headers = iconv_mime_decode_headers($headers, ICONV_MIME_DECODE_CONTINUE_ON_ERROR); + + if ($headers === false ) { + // an error occurs during the decoding + return; + } + + // normalize header names + foreach ($headers as $name => $header) { + $lower = strtolower($name); + if ($lower == $name) { + continue; + } + unset($headers[$name]); + if (!isset($headers[$lower])) { + $headers[$lower] = $header; + continue; + } + if (is_array($headers[$lower])) { + $headers[$lower][] = $header; + continue; + } + $headers[$lower] = array($headers[$lower], $header); + } + } + + /** + * split a content type in its different parts + * + * @param string $type content-type + * @param string $wantedPart the wanted part, else an array with all parts is returned + * @return string|array wanted part or all parts as array('type' => content-type, partname => value) + */ + public static function splitContentType($type, $wantedPart = null) + { + return self::splitHeaderField($type, $wantedPart, 'type'); + } + + /** + * split a header field like content type in its different parts + * + * @param string $type header field + * @param string $wantedPart the wanted part, else an array with all parts is returned + * @param string $firstName key name for the first part + * @return string|array wanted part or all parts as array($firstName => firstPart, partname => value) + * @throws Zend_Exception + */ + public static function splitHeaderField($field, $wantedPart = null, $firstName = 0) + { + $wantedPart = strtolower($wantedPart); + $firstName = strtolower($firstName); + + // special case - a bit optimized + if ($firstName === $wantedPart) { + $field = strtok($field, ';'); + return $field[0] == '"' ? substr($field, 1, -1) : $field; + } + + $field = $firstName . '=' . $field; + if (!preg_match_all('%([^=\s]+)\s*=\s*("[^"]+"|[^;]+)(;\s*|$)%', $field, $matches)) { + throw new Zend_Exception('not a valid header field'); + } + + if ($wantedPart) { + foreach ($matches[1] as $key => $name) { + if (strcasecmp($name, $wantedPart)) { + continue; + } + if ($matches[2][$key][0] != '"') { + return $matches[2][$key]; + } + return substr($matches[2][$key], 1, -1); + } + return null; + } + + $split = array(); + foreach ($matches[1] as $key => $name) { + $name = strtolower($name); + if ($matches[2][$key][0] == '"') { + $split[$name] = substr($matches[2][$key], 1, -1); + } else { + $split[$name] = $matches[2][$key]; + } + } + + return $split; + } + + /** + * decode a quoted printable encoded string + * + * The charset of the returned string depends on your iconv settings. + * + * @param string encoded string + * @return string decoded string + */ + public static function decodeQuotedPrintable($string) + { + return quoted_printable_decode($string); + } +} diff --git a/webui/Zend/Mime/Exception.php b/webui/Zend/Mime/Exception.php new file mode 100644 index 0000000..8f093ad --- /dev/null +++ b/webui/Zend/Mime/Exception.php @@ -0,0 +1,37 @@ +_parts; + } + + /** + * Sets the given array of Zend_Mime_Parts as the array for the message + * + * @param array $parts + */ + public function setParts($parts) + { + $this->_parts = $parts; + } + + /** + * Append a new Zend_Mime_Part to the current message + * + * @param Zend_Mime_Part $part + */ + public function addPart(Zend_Mime_Part $part) + { + /** + * @todo check for duplicate object handle + */ + $this->_parts[] = $part; + } + + /** + * Check if message needs to be sent as multipart + * MIME message or if it has only one part. + * + * @return boolean + */ + public function isMultiPart() + { + return (count($this->_parts) > 1); + } + + /** + * Set Zend_Mime object for the message + * + * This can be used to set the boundary specifically or to use a subclass of + * Zend_Mime for generating the boundary. + * + * @param Zend_Mime $mime + */ + public function setMime(Zend_Mime $mime) + { + $this->_mime = $mime; + } + + /** + * Returns the Zend_Mime object in use by the message + * + * If the object was not present, it is created and returned. Can be used to + * determine the boundary used in this message. + * + * @return Zend_Mime + */ + public function getMime() + { + if ($this->_mime === null) { + $this->_mime = new Zend_Mime(); + } + + return $this->_mime; + } + + /** + * Generate MIME-compliant message from the current configuration + * + * This can be a multipart message if more than one MIME part was added. If + * only one part is present, the content of this part is returned. If no + * part had been added, an empty string is returned. + * + * Parts are seperated by the mime boundary as defined in Zend_Mime. If + * {@link setMime()} has been called before this method, the Zend_Mime + * object set by this call will be used. Otherwise, a new Zend_Mime object + * is generated and used. + * + * @param string $EOL EOL string; defaults to {@link Zend_Mime::LINEEND} + * @return string + */ + public function generateMessage($EOL = Zend_Mime::LINEEND) + { + if (! $this->isMultiPart()) { + $body = array_shift($this->_parts); + $body = $body->getContent($EOL); + } else { + $mime = $this->getMime(); + + $boundaryLine = $mime->boundaryLine($EOL); + $body = 'This is a message in Mime Format. If you see this, ' + . "your mail reader does not support this format." . $EOL; + + foreach (array_keys($this->_parts) as $p) { + $body .= $boundaryLine + . $this->getPartHeaders($p, $EOL) + . $EOL + . $this->getPartContent($p, $EOL); + } + + $body .= $mime->mimeEnd($EOL); + } + + return trim($body); + } + + /** + * Get the headers of a given part as an array + * + * @param int $partnum + * @return array + */ + public function getPartHeadersArray($partnum) + { + return $this->_parts[$partnum]->getHeadersArray(); + } + + /** + * Get the headers of a given part as a string + * + * @param int $partnum + * @return string + */ + public function getPartHeaders($partnum, $EOL = Zend_Mime::LINEEND) + { + return $this->_parts[$partnum]->getHeaders($EOL); + } + + /** + * Get the (encoded) content of a given part as a string + * + * @param int $partnum + * @return string + */ + public function getPartContent($partnum, $EOL = Zend_Mime::LINEEND) + { + return $this->_parts[$partnum]->getContent($EOL); + } + + /** + * Explode MIME multipart string into seperate parts + * + * Parts consist of the header and the body of each MIME part. + * + * @param string $body + * @param string $boundary + * @return array + */ + protected static function _disassembleMime($body, $boundary) + { + $start = 0; + $res = array(); + // find every mime part limiter and cut out the + // string before it. + // the part before the first boundary string is discarded: + $p = strpos($body, '--'.$boundary."\n", $start); + if ($p === false) { + // no parts found! + return array(); + } + + // position after first boundary line + $start = $p + 3 + strlen($boundary); + + while (($p = strpos($body, '--' . $boundary . "\n", $start)) !== false) { + $res[] = substr($body, $start, $p-$start); + $start = $p + 3 + strlen($boundary); + } + + // no more parts, find end boundary + $p = strpos($body, '--' . $boundary . '--', $start); + if ($p===false) { + throw new Zend_Exception('Not a valid Mime Message: End Missing'); + } + + // the remaining part also needs to be parsed: + $res[] = substr($body, $start, $p-$start); + return $res; + } + + /** + * Decodes a MIME encoded string and returns a Zend_Mime_Message object with + * all the MIME parts set according to the given string + * + * @param string $message + * @param string $boundary + * @param string $EOL EOL string; defaults to {@link Zend_Mime::LINEEND} + * @return Zend_Mime_Message + */ + public static function createFromMessage($message, $boundary, $EOL = Zend_Mime::LINEEND) + { + require_once 'Zend/Mime/Decode.php'; + $parts = Zend_Mime_Decode::splitMessageStruct($message, $boundary, $EOL); + + $res = new self(); + foreach ($parts as $part) { + // now we build a new MimePart for the current Message Part: + $newPart = new Zend_Mime_Part($part['body']); + foreach ($part['header'] as $key => $value) { + /** + * @todo check for characterset and filename + */ + switch(strtolower($key)) { + case 'content-type': + $newPart->type = $value; + break; + case 'content-transfer-encoding': + $newPart->encoding = $value; + break; + case 'content-id': + $newPart->id = trim($value,'<>'); + break; + case 'content-disposition': + $newPart->disposition = $value; + break; + case 'content-description': + $newPart->description = $value; + break; + case 'content-location': + $newPart->location = $value; + break; + case 'content-language': + $newPart->language = $value; + break; + default: + throw new Zend_Exception('Unknown header ignored for MimePart:' . $key); + } + } + $res->addPart($newPart); + } + return $res; + } +} diff --git a/webui/Zend/Mime/Part.php b/webui/Zend/Mime/Part.php new file mode 100644 index 0000000..61cbbec --- /dev/null +++ b/webui/Zend/Mime/Part.php @@ -0,0 +1,230 @@ +_content = $content; + if (is_resource($content)) { + $this->_isStream = true; + } + } + + /** + * @todo setters/getters + * @todo error checking for setting $type + * @todo error checking for setting $encoding + */ + + /** + * check if this part can be read as a stream. + * if true, getEncodedStream can be called, otherwise + * only getContent can be used to fetch the encoded + * content of the part + * + * @return bool + */ + public function isStream() + { + return $this->_isStream; + } + + /** + * if this was created with a stream, return a filtered stream for + * reading the content. very useful for large file attachments. + * + * @return stream + * @throws Zend_Mime_Exception if not a stream or unable to append filter + */ + public function getEncodedStream() + { + if (!$this->_isStream) { + require_once 'Zend/Mime/Exception.php'; + throw new Zend_Mime_Exception('Attempt to get a stream from a string part'); + } + + //stream_filter_remove(); // ??? is that right? + switch ($this->encoding) { + case Zend_Mime::ENCODING_QUOTEDPRINTABLE: + $filter = stream_filter_append( + $this->_content, + 'convert.quoted-printable-encode', + STREAM_FILTER_READ, + array( + 'line-length' => 76, + 'line-break-chars' => Zend_Mime::LINEEND + ) + ); + if (!is_resource($filter)) { + require_once 'Zend/Mime/Exception.php'; + throw new Zend_Mime_Exception('Failed to append quoted-printable filter'); + } + break; + case Zend_Mime::ENCODING_BASE64: + $filter = stream_filter_append( + $this->_content, + 'convert.base64-encode', + STREAM_FILTER_READ, + array( + 'line-length' => 76, + 'line-break-chars' => Zend_Mime::LINEEND + ) + ); + if (!is_resource($filter)) { + require_once 'Zend/Mime/Exception.php'; + throw new Zend_Mime_Exception('Failed to append base64 filter'); + } + break; + default: + } + return $this->_content; + } + + /** + * Get the Content of the current Mime Part in the given encoding. + * + * @return String + */ + public function getContent($EOL = Zend_Mime::LINEEND) + { + if ($this->_isStream) { + return stream_get_contents($this->getEncodedStream()); + } else { + return Zend_Mime::encode($this->_content, $this->encoding, $EOL); + } + } + + /** + * Get the RAW unencoded content from this part + * @return string + */ + public function getRawContent() + { + if ($this->_isStream) { + return stream_get_contents($this->_content); + } else { + return $this->_content; + } + } + + /** + * Create and return the array of headers for this MIME part + * + * @access public + * @return array + */ + public function getHeadersArray($EOL = Zend_Mime::LINEEND) + { + $headers = array(); + + $contentType = $this->type; + if ($this->charset) { + $contentType .= '; charset=' . $this->charset; + } + + if ($this->boundary) { + $contentType .= ';' . $EOL + . " boundary=\"" . $this->boundary . '"'; + } + + $headers[] = array('Content-Type', $contentType); + + if ($this->encoding) { + $headers[] = array('Content-Transfer-Encoding', $this->encoding); + } + + if ($this->id) { + $headers[] = array('Content-ID', '<' . $this->id . '>'); + } + + if ($this->disposition) { + $disposition = $this->disposition; + if ($this->filename) { + $disposition .= '; filename="' . $this->filename . '"'; + } + $headers[] = array('Content-Disposition', $disposition); + } + + if ($this->description) { + $headers[] = array('Content-Description', $this->description); + } + + if ($this->location) { + $headers[] = array('Content-Location', $this->location); + } + + if ($this->language){ + $headers[] = array('Content-Language', $this->language); + } + + return $headers; + } + + /** + * Return the headers for this part as a string + * + * @return String + */ + public function getHeaders($EOL = Zend_Mime::LINEEND) + { + $res = ''; + foreach ($this->getHeadersArray($EOL) as $header) { + $res .= $header[0] . ': ' . $header[1] . $EOL; + } + + return $res; + } +} diff --git a/webui/config.php b/webui/config.php index f82b48d..432bbc2 100644 --- a/webui/config.php +++ b/webui/config.php @@ -15,6 +15,12 @@ define('ENABLE_ON_THE_FLY_VERIFICATION', 1); define('ENABLE_LDAP_IMPORT_FEATURE', 0); define('ENABLE_FOLDER_RESTRICTIONS', 0); +define('ENABLE_GOOGLE_LOGIN', 0); + +define('GOOGLE_CLIENT_ID', 'xxxxxxxxxxx'); +define('GOOGLE_CLIENT_SECRET', 'xxxxxxxxxxxxx'); +define('GOOGLE_DEVELOPER_KEY', 'xxxxxxxxxxxx'); +define('GOOGLE_APPLICATION_NAME', 'piler enterprise email archiver'); define('REMOTE_IMAGE_REPLACEMENT', '/view/theme/default/images/remote.gif'); define('ICON_ARROW_UP', '/view/theme/default/images/arrowup.gif'); @@ -107,6 +113,8 @@ define('TABLE_ARCHIVING_RULE', 'archiving_rule'); define('TABLE_RETENTION_RULE', 'retention_rule'); define('TABLE_OPTION', 'option'); +define('TABLE_GOOGLE', 'google'); +define('TABLE_GOOGLE_IMAP', 'google_imap'); define('VIEW_MESSAGES', 'v_messages'); define('SPHINX_DRIVER', 'sphinx'); @@ -150,6 +158,8 @@ define('SEARCH_TAG_URL', SITE_URL . 'index.php?route=search/tag'); define('MESSAGE_NOTE_URL', SITE_URL . 'index.php?route=message/note'); +define('GOOGLE_REDIRECT_URL', SITE_URL . 'google.php'); + define('HEALTH_URL', SITE_URL . 'index.php?route=health/health'); define('HEALTH_WORKER_URL', SITE_URL . 'index.php?route=health/worker'); define('HEALTH_REFRESH', 60); diff --git a/webui/controller/login/google.php b/webui/controller/login/google.php new file mode 100644 index 0000000..207ba44 --- /dev/null +++ b/webui/controller/login/google.php @@ -0,0 +1,96 @@ +id = "content"; + $this->template = "login/login.tpl"; + $this->layout = "common/layout"; + + + $request = Registry::get('request'); + + $db = Registry::get('db'); + + $this->load->model('user/auth'); + $this->load->model('user/user'); + $this->load->model('user/prefs'); + $this->load->model('user/google'); + $this->load->model('folder/folder'); + + $this->document->title = $this->data['text_login']; + + + $client = new apiClient(); + $client->setApplicationName(GOOGLE_APPLICATION_NAME); + + $client->setScopes(array( + 'https://www.googleapis.com/auth/userinfo.email', + 'https://www.googleapis.com/auth/userinfo.profile', + 'https://mail.google.com/', + )); + + $client->setClientId(GOOGLE_CLIENT_ID); + $client->setClientSecret(GOOGLE_CLIENT_SECRET); + $client->setRedirectUri(GOOGLE_REDIRECT_URL); + $client->setDeveloperKey(GOOGLE_DEVELOPER_KEY); + + $oauth2 = new apiOauth2Service($client); + + + if(isset($_GET['code'])) { + $client->authenticate(); + $_SESSION['access_token'] = $client->getAccessToken(); + header('Location: ' . GOOGLE_REDIRECT_URL); + } + + if(isset($_SESSION['access_token'])) { + $client->setAccessToken($_SESSION['access_token']); + } + + + if($client->getAccessToken()) { + $_SESSION['access_token'] = $client->getAccessToken(); + + $token = json_decode($_SESSION['access_token']); + + if(isset($token->{'access_token'}) && isset($token->{'refresh_token'})) { + $account = $oauth2->userinfo->get(); + + $this->model_user_google->check_for_account($account); + + $this->model_user_google->update_tokens($account['email'], $account['id'], $token); + + header("Location: " . SITE_URL . "search.php"); + exit; + } + + } + + + $this->render(); + } + + + private function validate() { + + if(strlen($this->request->post['username']) < 2){ + $this->error['username'] = $this->data['text_invalid_username']; + } + + + if (!$this->error) { + return true; + } else { + return false; + } + + } + + +} + +?> diff --git a/webui/controller/login/login.php b/webui/controller/login/login.php index 6674e68..e702669 100644 --- a/webui/controller/login/login.php +++ b/webui/controller/login/login.php @@ -51,6 +51,25 @@ } + if(ENABLE_GOOGLE_LOGIN == 1) { + $client = new apiClient(); + $client->setApplicationName(GOOGLE_APPLICATION_NAME); + + $client->setScopes(array( + 'https://www.googleapis.com/auth/userinfo.email', + 'https://www.googleapis.com/auth/userinfo.profile', + 'https://mail.google.com/', + )); + + $client->setClientId(GOOGLE_CLIENT_ID); + $client->setClientSecret(GOOGLE_CLIENT_SECRET); + $client->setRedirectUri(GOOGLE_REDIRECT_URL); + $client->setDeveloperKey(GOOGLE_DEVELOPER_KEY); + + $this->data['auth_url'] = $client->createAuthUrl(); + } + + $this->render(); } diff --git a/webui/google-api/apiClient.php b/webui/google-api/apiClient.php new file mode 100644 index 0000000..9574a27 --- /dev/null +++ b/webui/google-api/apiClient.php @@ -0,0 +1,371 @@ + + * @author Chirag Shah + */ +class apiClient { + // the version of the discovery mechanism this class is meant to work with + const discoveryVersion = 'v0.3'; + + /** + * @static + * @var apiAuth $auth + */ + static $auth; + + /** @var apiIo $io */ + static $io; + + /** @var apiCache $cache */ + static $cache; + + /** @var array $scopes */ + protected $scopes = array(); + + /** @var bool $useObjects */ + protected $useObjects = false; + + // definitions of services that are discovered. + protected $services = array(); + + // Used to track authenticated state, can't discover services after doing authenticate() + private $authenticated = false; + + private $defaultService = array( + 'authorization_token_url' => 'https://www.google.com/accounts/OAuthAuthorizeToken', + 'request_token_url' => 'https://www.google.com/accounts/OAuthGetRequestToken', + 'access_token_url' => 'https://www.google.com/accounts/OAuthGetAccessToken'); + + public function __construct($config = array()) { + global $apiConfig; + $apiConfig = array_merge($apiConfig, $config); + self::$cache = new $apiConfig['cacheClass'](); + self::$auth = new $apiConfig['authClass'](); + self::$io = new $apiConfig['ioClass'](); + } + + public function discover($service, $version = 'v1') { + $this->addService($service, $version); + $this->$service = $this->discoverService($service, $this->services[$service]['discoveryURI']); + return $this->$service; + } + + /** + * Add a service + */ + public function addService($service, $version) { + global $apiConfig; + if ($this->authenticated) { + // Adding services after being authenticated, since the oauth scope is already set (so you wouldn't have access to that data) + throw new apiException('Cant add services after having authenticated'); + } + $this->services[$service] = $this->defaultService; + if (isset($apiConfig['services'][$service])) { + // Merge the service descriptor with the default values + $this->services[$service] = array_merge($this->services[$service], $apiConfig['services'][$service]); + } + $this->services[$service]['discoveryURI'] = $apiConfig['basePath'] . '/discovery/' . self::discoveryVersion . '/describe/' . urlencode($service) . '/' . urlencode($version); + } + + /** + * Set the type of Auth class the client should use. + * @param string $authClassName + */ + public function setAuthClass($authClassName) { + self::$auth = new $authClassName(); + } + + public function authenticate() { + $service = $this->prepareService(); + $this->authenticated = true; + return self::$auth->authenticate($service); + } + + /** + * Construct the OAuth 2.0 authorization request URI. + * @return string + */ + public function createAuthUrl() { + $service = $this->prepareService(); + return self::$auth->createAuthUrl($service['scope']); + } + + private function prepareService() { + $service = $this->defaultService; + $scopes = array(); + if ($this->scopes) { + $scopes = $this->scopes; + } else { + foreach ($this->services as $key => $val) { + if (isset($val['scope'])) { + if (is_array($val['scope'])) { + $scopes = array_merge($val['scope'], $scopes); + } else { + $scopes[] = $val['scope']; + } + } else { + $scopes[] = 'https://www.googleapis.com/auth/' . $key; + } + unset($val['discoveryURI']); + unset($val['scope']); + $service = array_merge($service, $val); + } + } + $service['scope'] = implode(' ', $scopes); + return $service; + } + + /** + * Set the OAuth 2.0 access token using the string that resulted from calling authenticate() + * or apiClient#getAccessToken(). + * @param string $accessToken JSON encoded string containing in the following format: + * {"access_token":"TOKEN", "refresh_token":"TOKEN", "token_type":"Bearer", + * "expires_in":3600, "id_token":"TOKEN", "created":1320790426} + */ + public function setAccessToken($accessToken) { + if ($accessToken == null || 'null' == $accessToken) { + $accessToken = null; + } + self::$auth->setAccessToken($accessToken); + } + + /** + * Get the OAuth 2.0 access token. + * @return string $accessToken JSON encoded string in the following format: + * {"access_token":"TOKEN", "refresh_token":"TOKEN", "token_type":"Bearer", + * "expires_in":3600,"id_token":"TOKEN", "created":1320790426} + */ + public function getAccessToken() { + $token = self::$auth->getAccessToken(); + return (null == $token || 'null' == $token) ? null : $token; + } + + /** + * Set the developer key to use, these are obtained through the API Console. + * @see http://code.google.com/apis/console-help/#generatingdevkeys + * @param string $developerKey + */ + public function setDeveloperKey($developerKey) { + self::$auth->setDeveloperKey($developerKey); + } + + /** + * Set OAuth 2.0 "state" parameter to achieve per-request customization. + * @see http://tools.ietf.org/html/draft-ietf-oauth-v2-22#section-3.1.2.2 + * @param string $state + */ + public function setState($state) { + self::$auth->setState($state); + } + + /** + * @param string $accessType Possible values for access_type include: + * {@code "offline"} to request offline access from the user. (This is the default value) + * {@code "online"} to request online access from the user. + */ + public function setAccessType($accessType) { + self::$auth->setAccessType($accessType); + } + + /** + * @param string $approvalPrompt Possible values for approval_prompt include: + * {@code "force"} to force the approval UI to appear. (This is the default value) + * {@code "auto"} to request auto-approval when possible. + */ + public function setApprovalPrompt($approvalPrompt) { + self::$auth->setApprovalPrompt($approvalPrompt); + } + + /** + * Set the application name, this is included in the User-Agent HTTP header. + * @param string $applicationName + */ + public function setApplicationName($applicationName) { + global $apiConfig; + $apiConfig['application_name'] = $applicationName; + } + + /** + * Set the OAuth 2.0 Client ID. + * @param string $clientId + */ + public function setClientId($clientId) { + global $apiConfig; + $apiConfig['oauth2_client_id'] = $clientId; + self::$auth->clientId = $clientId; + } + + /** + * Set the OAuth 2.0 Client Secret. + * @param string $clientSecret + */ + public function setClientSecret($clientSecret) { + global $apiConfig; + $apiConfig['oauth2_client_secret'] = $clientSecret; + self::$auth->clientSecret = $clientSecret; + } + + /** + * Set the OAuth 2.0 Redirect URI. + * @param string $redirectUri + */ + public function setRedirectUri($redirectUri) { + global $apiConfig; + $apiConfig['oauth2_redirect_uri'] = $redirectUri; + self::$auth->redirectUri = $redirectUri; + } + + /** + * Fetches a fresh OAuth 2.0 access token with the given refresh token. + * @param string $refreshToken + * @return void + */ + public function refreshToken($refreshToken) { + self::$auth->refreshToken($refreshToken); + } + + /** + * Revoke an OAuth2 access token or refresh token. This method will revoke the current access + * token, if a token isn't provided. + * @throws apiAuthException + * @param string|null $token The token (access token or a refresh token) that should be revoked. + * @return boolean Returns True if the revocation was successful, otherwise False. + */ + public function revokeToken($token = null) { + self::$auth->revokeToken($token); + } + + /** + * Verify an id_token. This method will verify the current id_token, if one + * isn't provided. + * @throws apiAuthException + * @param string|null $token The token (id_token) that should be verified. + * @return apiLoginTicket Returns an apiLoginTicket if the verification was + * successful. + */ + public function verifyIdToken($token = null) { + return self::$auth->verifyIdToken($token); + } + + /** + * This function allows you to overrule the automatically generated scopes, + * so that you can ask for more or less permission in the auth flow + * Set this before you call authenticate() though! + * @param array $scopes, ie: array('https://www.googleapis.com/auth/plus', 'https://www.googleapis.com/auth/moderator') + */ + public function setScopes($scopes) { + $this->scopes = is_string($scopes) ? explode(" ", $scopes) : $scopes; + } + + /** + * Declare if objects should be returned by the api service classes. + * + * @param boolean $useObjects True if objects should be returned by the service classes. + * False if associative arrays should be returned (default behavior). + */ + public function setUseObjects($useObjects) { + global $apiConfig; + $apiConfig['use_objects'] = $useObjects; + } + + private function discoverService($serviceName, $serviceURI) { + $request = self::$io->makeRequest(new apiHttpRequest($serviceURI)); + if ($request->getResponseHttpCode() != 200) { + throw new apiException("Could not fetch discovery document for $serviceName, code: " + . $request->getResponseHttpCode() . ", response: " . $request->getResponseBody()); + } + $discoveryResponse = $request->getResponseBody(); + $discoveryDocument = json_decode($discoveryResponse, true); + if ($discoveryDocument == NULL) { + throw new apiException("Invalid json returned for $serviceName"); + } + return new apiService($serviceName, $discoveryDocument, apiClient::getIo()); + } + + /** + * @static + * @return apiAuth the implementation of apiAuth. + */ + public static function getAuth() { + return apiClient::$auth; + } + + /** + * @static + * @return apiIo the implementation of apiIo. + */ + public static function getIo() { + return apiClient::$io; + } + + /** + * @return apiCache the implementation of apiCache. + */ + public function getCache() { + return apiClient::$cache; + } +} + +// Exceptions that the Google PHP API Library can throw +class apiException extends Exception {} +class apiAuthException extends apiException {} +class apiCacheException extends apiException {} +class apiIOException extends apiException {} +class apiServiceException extends apiException {} diff --git a/webui/google-api/auth/apiAuth.php b/webui/google-api/auth/apiAuth.php new file mode 100644 index 0000000..d10a00d --- /dev/null +++ b/webui/google-api/auth/apiAuth.php @@ -0,0 +1,37 @@ + + * + */ +abstract class apiAuth { + abstract public function authenticate($service); + abstract public function sign(apiHttpRequest $request); + abstract public function createAuthUrl($scope); + + abstract public function getAccessToken(); + abstract public function setAccessToken($accessToken); + abstract public function setDeveloperKey($developerKey); + abstract public function refreshToken($refreshToken); + abstract public function revokeToken(); +} diff --git a/webui/google-api/auth/apiAuthNone.php b/webui/google-api/auth/apiAuthNone.php new file mode 100644 index 0000000..896d24d --- /dev/null +++ b/webui/google-api/auth/apiAuthNone.php @@ -0,0 +1,48 @@ + + * @author Chirag Shah + */ +class apiAuthNone extends apiAuth { + public $key = null; + + public function __construct() { + global $apiConfig; + if (!empty($apiConfig['developer_key'])) { + $this->setDeveloperKey($apiConfig['developer_key']); + } + } + + public function setDeveloperKey($key) {$this->key = $key;} + public function authenticate($service) {/*noop*/} + public function setAccessToken($accessToken) {/* noop*/} + public function getAccessToken() {return null;} + public function createAuthUrl($scope) {return null;} + public function refreshToken($refreshToken) {/* noop*/} + public function revokeToken() {/* noop*/} + + public function sign(apiHttpRequest $request) { + if ($this->key) { + $request->setUrl($request->getUrl() . ((strpos($request->getUrl(), '?') === false) ? '?' : '&') + . 'key='.urlencode($this->key)); + } + return $request; + } +} diff --git a/webui/google-api/auth/apiLoginTicket.php b/webui/google-api/auth/apiLoginTicket.php new file mode 100644 index 0000000..cc609a4 --- /dev/null +++ b/webui/google-api/auth/apiLoginTicket.php @@ -0,0 +1,60 @@ + + */ +class apiLoginTicket { + const USER_ATTR = "id"; + + // Information from id token envelope. + private $envelope; + + // Information from id token payload. + private $payload; + + /** + * Creates a user based on the supplied token. + * + * envelope: header from a verified authentication token. + * payload: information from a verified authentication token. + */ + public function __construct($envelope, $payload) { + $this->envelope = $envelope; + $this->payload = $payload; + } + + /** + * Returns the numeric identifier for the user. + */ + public function getUserId() { + if (array_key_exists(self::USER_ATTR, $this->payload)) { + return $this->payload[self::USER_ATTR]; + } + throw new apiAuthException("No user_id in token"); + } + + /** + * Returns attributes from the login ticket. This can contain + * various information about the user session. + */ + public function getAttributes() { + return array("envelope" => $this->envelope, "payload" => $this->payload); + } +} diff --git a/webui/google-api/auth/apiOAuth.php b/webui/google-api/auth/apiOAuth.php new file mode 100644 index 0000000..1f21f2a --- /dev/null +++ b/webui/google-api/auth/apiOAuth.php @@ -0,0 +1,250 @@ + + * + */ +class apiOAuth extends apiAuth { + public $cacheKey; + protected $consumerToken; + protected $accessToken; + protected $privateKeyFile; + protected $developerKey; + public $service; + + /** + * Instantiates the class, but does not initiate the login flow, leaving it + * to the discretion of the caller. + */ + public function __construct() { + global $apiConfig; + if (!empty($apiConfig['developer_key'])) { + $this->setDeveloperKey($apiConfig['developer_key']); + } + $this->consumerToken = new apiClientOAuthConsumer($apiConfig['oauth_consumer_key'], $apiConfig['oauth_consumer_secret'], NULL); + $this->signatureMethod = new apiClientOAuthSignatureMethod_HMAC_SHA1(); + $this->cacheKey = 'OAuth:' . $apiConfig['oauth_consumer_key']; // Scope data to the local user as well, or else multiple local users will share the same OAuth credentials. + } + + /** + * The 3 legged oauth class needs a way to store the access key and token + * it uses the apiCache class to do so. + * + * Constructing this class will initiate the 3 legged oauth work flow, including redirecting + * to the OAuth provider's site if required(!) + * + * @param string $consumerKey + * @param string $consumerSecret + * @return apiOAuth3Legged the logged-in provider instance + */ + public function authenticate($service) { + global $apiConfig; + $this->service = $service; + $this->service['authorization_token_url'] .= '?scope=' . apiClientOAuthUtil::urlencodeRFC3986($service['scope']) . '&domain=' . apiClientOAuthUtil::urlencodeRFC3986($apiConfig['site_name']) . '&oauth_token='; + if (isset($_GET['oauth_verifier']) && isset($_GET['oauth_token']) && isset($_GET['uid'])) { + $uid = $_GET['uid']; + $secret = apiClient::$cache->get($this->cacheKey.":nonce:" . $uid); + apiClient::$cache->delete($this->cacheKey.":nonce:" . $uid); + $token = $this->upgradeRequestToken($_GET['oauth_token'], $secret, $_GET['oauth_verifier']); + return json_encode($token); + } else { + // Initialize the OAuth dance, first request a request token, then kick the client to the authorize URL + // First we store the current URL in our cache, so that when the oauth dance is completed we can return there + $callbackUrl = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; + $uid = uniqid(); + $token = $this->obtainRequestToken($callbackUrl, $uid); + apiClient::$cache->set($this->cacheKey.":nonce:" . $uid, $token->secret); + $this->redirectToAuthorization($token); + } + } + + /** + * Sets the internal oauth access token (which is returned by the authenticate function), a user should only + * go through the authenticate() flow once (which involces a bunch of browser redirections and authentication screens, not fun) + * and every time the user comes back the access token from the authentication() flow should be re-used (it essentially never expires) + * @param object $accessToken + */ + public function setAccessToken($accessToken) { + $accessToken = json_decode($accessToken, true); + if ($accessToken == null) { + throw new apiAuthException("Could not json decode the access token"); + } + if (! isset($accessToken['key']) || ! isset($accessToken['secret'])) { + throw new apiAuthException("Invalid OAuth token, missing key and/or secret"); + } + $this->accessToken = new apiClientOAuthConsumer($accessToken['key'], $accessToken['secret']); + } + + /** + * Returns the current access token + */ + public function getAccessToken() { + return $this->accessToken; + } + + + /** + * Set the developer key to use, these are obtained through the API Console + */ + public function setDeveloperKey($developerKey) { + $this->developerKey = $developerKey; + } + + /** + * Upgrades an existing request token to an access token. + * + * @param apiCache $cache cache class to use (file,apc,memcache,mysql) + * @param oauthVerifier + */ + public function upgradeRequestToken($requestToken, $requestTokenSecret, $oauthVerifier) { + $ret = $this->requestAccessToken($requestToken, $requestTokenSecret, $oauthVerifier); + $matches = array(); + @parse_str($ret, $matches); + if (!isset($matches['oauth_token']) || !isset($matches['oauth_token_secret'])) { + throw new apiAuthException("Error authorizing access key (result was: {$ret})"); + } + // The token was upgraded to an access token, we can now continue to use it. + $this->accessToken = new apiClientOAuthConsumer(apiClientOAuthUtil::urldecodeRFC3986($matches['oauth_token']), apiClientOAuthUtil::urldecodeRFC3986($matches['oauth_token_secret'])); + return $this->accessToken; + } + + /** + * Sends the actual request to exchange an existing request token for an access token. + * + * @param string $requestToken the existing request token + * @param string $requestTokenSecret the request token secret + * @return array('http_code' => HTTP response code (200, 404, 401, etc), 'data' => the html document) + */ + protected function requestAccessToken($requestToken, $requestTokenSecret, $oauthVerifier) { + $accessToken = new apiClientOAuthConsumer($requestToken, $requestTokenSecret); + $accessRequest = apiClientOAuthRequest::from_consumer_and_token($this->consumerToken, $accessToken, "GET", $this->service['access_token_url'], array('oauth_verifier' => $oauthVerifier)); + $accessRequest->sign_request($this->signatureMethod, $this->consumerToken, $accessToken); + $request = apiClient::$io->makeRequest(new apiHttpRequest($accessRequest)); + if ($request->getResponseHttpCode() != 200) { + throw new apiAuthException("Could not fetch access token, http code: " . $request->getResponseHttpCode() . ', response body: '. $request->getResponseBody()); + } + return $request->getResponseBody(); + } + + /** + * Obtains a request token from the specified provider. + */ + public function obtainRequestToken($callbackUrl, $uid) { + $callbackParams = (strpos($_SERVER['REQUEST_URI'], '?') !== false ? '&' : '?') . 'uid=' . urlencode($uid); + $ret = $this->requestRequestToken($callbackUrl . $callbackParams); + $matches = array(); + preg_match('/oauth_token=(.*)&oauth_token_secret=(.*)&oauth_callback_confirmed=(.*)/', $ret, $matches); + if (!is_array($matches) || count($matches) != 4) { + throw new apiAuthException("Error retrieving request key ({$ret})"); + } + return new apiClientOAuthToken(apiClientOAuthUtil::urldecodeRFC3986($matches[1]), apiClientOAuthUtil::urldecodeRFC3986($matches[2])); + } + + /** + * Sends the actual request to obtain a request token. + * + * @return array('http_code' => HTTP response code (200, 404, 401, etc), 'data' => the html document) + */ + protected function requestRequestToken($callbackUrl) { + $requestTokenRequest = apiClientOAuthRequest::from_consumer_and_token($this->consumerToken, NULL, "GET", $this->service['request_token_url'], array()); + $requestTokenRequest->set_parameter('scope', $this->service['scope']); + $requestTokenRequest->set_parameter('oauth_callback', $callbackUrl); + $requestTokenRequest->sign_request($this->signatureMethod, $this->consumerToken, NULL); + $request = apiClient::$io->makeRequest(new apiHttpRequest($requestTokenRequest)); + if ($request->getResponseHttpCode() != 200) { + throw new apiAuthException("Couldn't fetch request token, http code: " . $request->getResponseHttpCode() . ', response body: '. $request->getResponseBody()); + } + return $request->getResponseBody(); + } + + /** + * Redirect the uset to the (provider's) authorize page, if approved it should kick the user back to the call back URL + * which hopefully means we'll end up in the constructor of this class again, but with oauth_continue=1 set + * + * @param OAuthToken $token the request token + * @param string $callbackUrl the URL to return to post-authorization (passed to login site) + */ + public function redirectToAuthorization($token) { + $authorizeRedirect = $this->service['authorization_token_url']. $token->key; + header("Location: $authorizeRedirect"); + } + + /** + * Sign the request using OAuth. This uses the consumer token and key + * + * @param string $method the method (get/put/delete/post) + * @param string $url the url to sign (http://site/social/rest/people/1/@me) + * @param array $params the params that should be appended to the url (count=20 fields=foo, etc) + * @param string $postBody for POST/PUT requests, the postBody is included in the signature + * @return string the signed url + */ + public function sign(apiHttpRequest $request) { + // add the developer key to the request before signing it + if ($this->developerKey) { + $request->setUrl($request->getUrl() . ((strpos($request->getUrl(), '?') === false) ? '?' : '&') . 'key='.urlencode($this->developerKey)); + } + // and sign the request + $oauthRequest = apiClientOAuthRequest::from_request($request->getMethod(), $request->getBaseUrl(), $request->getQueryParams()); + $params = $this->mergeParameters($request->getQueryParams()); + foreach ($params as $key => $val) { + if (is_array($val)) { + $val = implode(',', $val); + } + $oauthRequest->set_parameter($key, $val); + } + $oauthRequest->sign_request($this->signatureMethod, $this->consumerToken, $this->accessToken); + $authHeaders = $oauthRequest->to_header(); + $headers = $request->getHeaders(); + $headers[] = $authHeaders; + $request->setHeaders($headers); + // and add the access token key to it (since it doesn't include the secret, it's still secure to store this in cache) + $request->accessKey = $this->accessToken->key; + return $request; + } + + /** + * Merges the supplied parameters with reasonable defaults for 2 legged oauth. User-supplied parameters + * will have precedent over the defaults. + * + * @param array $params the user-supplied params that will be appended to the url + * @return array the combined parameters + */ + protected function mergeParameters($params) { + $defaults = array( + 'oauth_nonce' => md5(microtime() . mt_rand()), + 'oauth_version' => apiClientOAuthRequest::$version, 'oauth_timestamp' => time(), + 'oauth_consumer_key' => $this->consumerToken->key + ); + if ($this->accessToken != null) { + $params['oauth_token'] = $this->accessToken->key; + } + return array_merge($defaults, $params); + } + + public function createAuthUrl($scope) {return null;} + public function refreshToken($refreshToken) {/* noop*/} + public function revokeToken() {/* noop*/} +} \ No newline at end of file diff --git a/webui/google-api/auth/apiOAuth2.php b/webui/google-api/auth/apiOAuth2.php new file mode 100644 index 0000000..4977827 --- /dev/null +++ b/webui/google-api/auth/apiOAuth2.php @@ -0,0 +1,394 @@ + + * @author Chirag Shah + * + */ +class apiOAuth2 extends apiAuth { + public $clientId; + public $clientSecret; + public $developerKey; + public $accessToken; + public $redirectUri; + public $state; + public $accessType = 'offline'; + public $approvalPrompt = 'force'; + + const OAUTH2_REVOKE_URI = 'https://accounts.google.com/o/oauth2/revoke'; + const OAUTH2_TOKEN_URI = 'https://accounts.google.com/o/oauth2/token'; + const OAUTH2_AUTH_URL = 'https://accounts.google.com/o/oauth2/auth'; + const OAUTH2_FEDERATED_SIGNON_CERTS_URL = 'https://www.googleapis.com/oauth2/v1/certs'; + const CLOCK_SKEW_SECS = 300; // five minutes in seconds + const AUTH_TOKEN_LIFETIME_SECS = 300; // five minutes in seconds + const MAX_TOKEN_LIFETIME_SECS = 86400; // one day in seconds + + /** + * Instantiates the class, but does not initiate the login flow, leaving it + * to the discretion of the caller (which is done by calling authenticate()). + */ + public function __construct() { + global $apiConfig; + + if (! empty($apiConfig['developer_key'])) { + $this->developerKey = $apiConfig['developer_key']; + } + + if (! empty($apiConfig['oauth2_client_id'])) { + $this->clientId = $apiConfig['oauth2_client_id']; + } + + if (! empty($apiConfig['oauth2_client_secret'])) { + $this->clientSecret = $apiConfig['oauth2_client_secret']; + } + + if (! empty($apiConfig['oauth2_redirect_uri'])) { + $this->redirectUri = $apiConfig['oauth2_redirect_uri']; + } + + if (! empty($apiConfig['oauth2_access_type'])) { + $this->accessType = $apiConfig['oauth2_access_type']; + } + + if (! empty($apiConfig['oauth2_approval_prompt'])) { + $this->approvalPrompt = $apiConfig['oauth2_approval_prompt']; + } + } + + /** + * @param $service + * @return string + * @throws apiAuthException + */ + public function authenticate($service) { + if (isset($_GET['code'])) { + // We got here from the redirect from a successful authorization grant, fetch the access token + $request = apiClient::$io->makeRequest(new apiHttpRequest(self::OAUTH2_TOKEN_URI, 'POST', array(), array( + 'code' => $_GET['code'], + 'grant_type' => 'authorization_code', + 'redirect_uri' => $this->redirectUri, + 'client_id' => $this->clientId, + 'client_secret' => $this->clientSecret + ))); + + if ($request->getResponseHttpCode() == 200) { + $this->setAccessToken($request->getResponseBody()); + $this->accessToken['created'] = time(); + return $this->getAccessToken(); + } else { + $response = $request->getResponseBody(); + $decodedResponse = json_decode($response, true); + if ($decodedResponse != $response && $decodedResponse != null && $decodedResponse['error']) { + $response = $decodedResponse['error']; + } + throw new apiAuthException("Error fetching OAuth2 access token, message: '$response'", $request->getResponseHttpCode()); + } + } + + $authUrl = $this->createAuthUrl($service['scope']); + header('Location: ' . $authUrl); + } + + /** + * Create a URL to obtain user authorization. + * The authorization endpoint allows the user to first + * authenticate, and then grant/deny the access request. + * @param string $scope The scope is expressed as a list of space-delimited strings. + * @return string + */ + public function createAuthUrl($scope) { + $params = array( + 'response_type=code', + 'redirect_uri=' . urlencode($this->redirectUri), + 'client_id=' . urlencode($this->clientId), + 'scope=' . urlencode($scope), + 'access_type=' . urlencode($this->accessType), + 'approval_prompt=' . urlencode($this->approvalPrompt) + ); + + if (isset($this->state)) { + $params[] = 'state=' . urlencode($this->state); + } + $params = implode('&', $params); + return self::OAUTH2_AUTH_URL . "?$params"; + } + + /** + * @param $accessToken + * @throws apiAuthException Thrown when $accessToken is invalid. + */ + public function setAccessToken($accessToken) { + $accessToken = json_decode($accessToken, true); + if ($accessToken == null) { + throw new apiAuthException('Could not json decode the access token'); + } + if (! isset($accessToken['access_token'])) { + throw new apiAuthException("Invalid token format"); + } + $this->accessToken = $accessToken; + } + + public function getAccessToken() { + return json_encode($this->accessToken); + } + + public function setDeveloperKey($developerKey) { + $this->developerKey = $developerKey; + } + + public function setState($state) { + $this->state = $state; + } + + public function setAccessType($accessType) { + $this->accessType = $accessType; + } + + public function setApprovalPrompt($approvalPrompt) { + $this->approvalPrompt = $approvalPrompt; + } + + /** + * Include an accessToken in a given apiHttpRequest. + * @param apiHttpRequest $request + * @return apiHttpRequest + * @throws apiAuthException + */ + public function sign(apiHttpRequest $request) { + // add the developer key to the request before signing it + if ($this->developerKey) { + $requestUrl = $request->getUrl(); + $requestUrl .= (strpos($request->getUrl(), '?') === false) ? '?' : '&'; + $requestUrl .= 'key=' . urlencode($this->developerKey); + $request->setUrl($requestUrl); + } + + // Cannot sign the request without an OAuth access token. + if (null == $this->accessToken) { + return $request; + } + + // If the token is set to expire in the next 30 seconds (or has already + // expired), refresh it and set the new token. + $expired = ($this->accessToken['created'] + ($this->accessToken['expires_in'] - 30)) < time(); + if ($expired) { + if (! array_key_exists('refresh_token', $this->accessToken)) { + throw new apiAuthException("The OAuth 2.0 access token has expired, " + . "and a refresh token is not available. Refresh tokens are not " + . "returned for responses that were auto-approved."); + } + $this->refreshToken($this->accessToken['refresh_token']); + } + + // Add the OAuth2 header to the request + $request->setRequestHeaders( + array('Authorization' => 'Bearer ' . $this->accessToken['access_token']) + ); + + return $request; + } + + /** + * Fetches a fresh access token with the given refresh token. + * @param string $refreshToken + * @return void + */ + public function refreshToken($refreshToken) { + + $params = array( + 'client_id' => $this->clientId, + 'client_secret' => $this->clientSecret, + 'refresh_token' => $refreshToken, + 'grant_type' => 'refresh_token' + ); + + $request = apiClient::$io->makeRequest( + new apiHttpRequest(self::OAUTH2_TOKEN_URI, 'POST', array(), $params)); + $code = $request->getResponseHttpCode(); + $body = $request->getResponseBody(); + + if ($code == 200) { + $token = json_decode($body, true); + if ($token == null) { + throw new apiAuthException("Could not json decode the access token"); + } + + if (! isset($token['access_token']) || ! isset($token['expires_in'])) { + throw new apiAuthException("Invalid token format"); + } + + $this->accessToken['access_token'] = $token['access_token']; + $this->accessToken['expires_in'] = $token['expires_in']; + $this->accessToken['created'] = time(); + } else { + throw new apiAuthException("Error refreshing the OAuth2 token, message: '$body'", $code); + } + } + + /** + * Revoke an OAuth2 access token or refresh token. This method will revoke the current access + * token, if a token isn't provided. + * @throws apiAuthException + * @param string|null $token The token (access token or a refresh token) that should be revoked. + * @return boolean Returns True if the revocation was successful, otherwise False. + */ + public function revokeToken($token = null) { + if (!$token) { + $token = $this->accessToken['access_token']; + } + $request = new apiHttpRequest(self::OAUTH2_REVOKE_URI, 'POST', array(), "token=$token"); + $response = apiClient::$io->makeRequest($request); + $code = $response->getResponseHttpCode(); + if ($code == 200) { + $this->accessToken = null; + return true; + } + + return false; + } + + // Gets federated sign-on certificates to use for verifying identity tokens. + // Returns certs as array structure, where keys are key ids, and values + // are PEM encoded certificates. + private function getFederatedSignOnCerts() { + // This relies on makeRequest caching certificate responses. + $request = apiClient::$io->makeRequest(new apiHttpRequest( + self::OAUTH2_FEDERATED_SIGNON_CERTS_URL)); + if ($request->getResponseHttpCode() == 200) { + $certs = json_decode($request->getResponseBody(), true); + if ($certs) { + return $certs; + } + } + throw new apiAuthException( + "Failed to retrieve verification certificates: '" . + $request->getResponseBody() . "'.", + $request->getResponseHttpCode()); + } + + /** + * Verifies an id token and returns the authenticated apiLoginTicket. + * Throws an exception if the id token is not valid. + * The audience parameter can be used to control which id tokens are + * accepted. By default, the id token must have been issued to this OAuth2 client. + * + * @param $id_token + * @param $audience + * @return apiLoginTicket + */ + public function verifyIdToken($id_token = null, $audience = null) { + if (!$id_token) { + $id_token = $this->accessToken['id_token']; + } + + $certs = $this->getFederatedSignonCerts(); + if (!$audience) { + $audience = $this->clientId; + } + return $this->verifySignedJwtWithCerts($id_token, $certs, $audience); + } + + // Verifies the id token, returns the verified token contents. + // Visible for testing. + function verifySignedJwtWithCerts($jwt, $certs, $required_audience) { + $segments = explode(".", $jwt); + if (count($segments) != 3) { + throw new apiAuthException("Wrong number of segments in token: $jwt"); + } + $signed = $segments[0] . "." . $segments[1]; + $signature = apiUtils::urlSafeB64Decode($segments[2]); + + // Parse envelope. + $envelope = json_decode(apiUtils::urlSafeB64Decode($segments[0]), true); + if (!$envelope) { + throw new apiAuthException("Can't parse token envelope: " . $segments[0]); + } + + // Parse token + $json_body = apiUtils::urlSafeB64Decode($segments[1]); + $payload = json_decode($json_body, true); + if (!$payload) { + throw new apiAuthException("Can't parse token payload: " . $segments[1]); + } + + // Check signature + $verified = false; + foreach ($certs as $keyName => $pem) { + $public_key = new apiPemVerifier($pem); + if ($public_key->verify($signed, $signature)) { + $verified = true; + break; + } + } + + if (!$verified) { + throw new apiAuthException("Invalid token signature: $jwt"); + } + + // Check issued-at timestamp + $iat = 0; + if (array_key_exists("iat", $payload)) { + $iat = $payload["iat"]; + } + if (!$iat) { + throw new apiAuthException("No issue time in token: $json_body"); + } + $earliest = $iat - self::CLOCK_SKEW_SECS; + + // Check expiration timestamp + $now = time(); + $exp = 0; + if (array_key_exists("exp", $payload)) { + $exp = $payload["exp"]; + } + if (!$exp) { + throw new apiAuthException("No expiration time in token: $json_body"); + } + if ($exp >= $now + self::MAX_TOKEN_LIFETIME_SECS) { + throw new apiAuthException( + "Expiration time too far in future: $json_body"); + } + + $latest = $exp + self::CLOCK_SKEW_SECS; + if ($now < $earliest) { + throw new apiAuthException( + "Token used too early, $now < $earliest: $json_body"); + } + if ($now > $latest) { + throw new apiAuthException( + "Token used too late, $now > $latest: $json_body"); + } + + // TODO(beaton): check issuer field? + + // Check audience + $aud = $payload["aud"]; + if ($aud != $required_audience) { + throw new apiAuthException("Wrong recipient, $aud != $required_audience: $json_body"); + } + + // All good. + return new apiLoginTicket($envelope, $payload); + } +} diff --git a/webui/google-api/auth/apiP12Signer.php b/webui/google-api/auth/apiP12Signer.php new file mode 100644 index 0000000..8412466 --- /dev/null +++ b/webui/google-api/auth/apiP12Signer.php @@ -0,0 +1,66 @@ + + */ +class apiP12Signer extends apiSigner { + // OpenSSL private key resource + private $privateKey; + + // Creates a new signer from a .p12 file. + function __construct($p12file, $password) { + if (!function_exists('openssl_x509_read')) { + throw new Exception( + 'The Google PHP API library needs the openssl PHP extension'); + } + // This throws on error + $p12 = file_get_contents($p12file); + $certs = array(); + if (!openssl_pkcs12_read($p12, $certs, $password)) { + throw new apiAuthException("Unable to parse $p12file. " . + "Is this a .p12 file? Is the password correct? OpenSSL error: " . + openssl_error_string()); + } + // TODO(beaton): is this part of the contract for the openssl_pkcs12_read + // method? What happens if there are multiple private keys? Do we care? + if (!array_key_exists("pkey", $certs) || !$certs["pkey"]) { + throw new apiAuthException("No private key found in p12 file $p12file"); + } + $this->privateKey = openssl_pkey_get_private($certs["pkey"]); + if (!$this->privateKey) { + throw new apiAuthException("Unable to load private key in $p12file"); + } + } + + function __destruct() { + if ($this->privateKey) { + openssl_pkey_free($this->privateKey); + } + } + + function sign($data) { + if (!openssl_sign($data, $signature, $this->privateKey, "sha256")) { + throw new apiAuthException("Unable to sign data"); + } + return $signature; + } +} diff --git a/webui/google-api/auth/apiPemVerifier.php b/webui/google-api/auth/apiPemVerifier.php new file mode 100644 index 0000000..c25df6a --- /dev/null +++ b/webui/google-api/auth/apiPemVerifier.php @@ -0,0 +1,61 @@ + + */ +class apiPemVerifier extends apiVerifier { + private $publicKey; + + /** + * Constructs a verifier from the supplied PEM-encoded certificate. + * + * $pem: a PEM encoded certificate (not a file). + */ + function __construct($pem) { + if (!function_exists('openssl_x509_read')) { + throw new Exception( + 'The Google PHP API library needs the openssl PHP extension'); + } + $this->publicKey = openssl_x509_read($pem); + if (!$this->publicKey) { + throw new apiAuthException("Unable to parse PEM: $pem"); + } + } + + function __destruct() { + if ($this->publicKey) { + openssl_x509_free($this->publicKey); + } + } + + /** + * Verifies the signature on data. + * + * Returns true if the signature is valid, false otherwise. + */ + function verify($data, $signature) { + $status = openssl_verify($data, $signature, $this->publicKey, "sha256"); + if ($status === -1) { + throw new apiAuthException("Signature verification error: " . + openssl_error_string()); + } + return $status === 1; + } +} diff --git a/webui/google-api/auth/apiSigner.php b/webui/google-api/auth/apiSigner.php new file mode 100644 index 0000000..47ac656 --- /dev/null +++ b/webui/google-api/auth/apiSigner.php @@ -0,0 +1,30 @@ + + */ +abstract class apiSigner { + /** + * Signs data, returns the signature as binary data. + */ + abstract public function sign($data); +} diff --git a/webui/google-api/auth/apiVerifier.php b/webui/google-api/auth/apiVerifier.php new file mode 100644 index 0000000..4732680 --- /dev/null +++ b/webui/google-api/auth/apiVerifier.php @@ -0,0 +1,31 @@ + + */ +abstract class apiVerifier { + /** + * Checks a signature, returns true if the signature is correct, + * false otherwise. + */ + abstract public function verify($data, $signature); +} diff --git a/webui/google-api/cache/apiApcCache.php b/webui/google-api/cache/apiApcCache.php new file mode 100644 index 0000000..44d7ac5 --- /dev/null +++ b/webui/google-api/cache/apiApcCache.php @@ -0,0 +1,97 @@ + + */ +class apiApcCache extends apiCache { + + public function __construct() { + if (! function_exists('apc_add')) { + throw new apiCacheException("Apc functions not available"); + } + } + + private function isLocked($key) { + if ((@apc_fetch($key . '.lock')) === false) { + return false; + } + return true; + } + + private function createLock($key) { + // the interesting thing is that this could fail if the lock was created in the meantime.. + // but we'll ignore that out of convenience + @apc_add($key . '.lock', '', 5); + } + + private function removeLock($key) { + // suppress all warnings, if some other process removed it that's ok too + @apc_delete($key . '.lock'); + } + + private function waitForLock($key) { + // 20 x 250 = 5 seconds + $tries = 20; + $cnt = 0; + do { + // 250 ms is a long time to sleep, but it does stop the server from burning all resources on polling locks.. + usleep(250); + $cnt ++; + } while ($cnt <= $tries && $this->isLocked($key)); + if ($this->isLocked($key)) { + // 5 seconds passed, assume the owning process died off and remove it + $this->removeLock($key); + } + } + + /** + * @inheritDoc + */ + public function get($key, $expiration = false) { + + if (($ret = @apc_fetch($key)) === false) { + return false; + } + if (!$expiration || (time() - $ret['time'] > $expiration)) { + $this->delete($key); + return false; + } + return unserialize($ret['data']); + } + + /** + * @inheritDoc + */ + public function set($key, $value) { + if (@apc_store($key, array('time' => time(), 'data' => serialize($value))) == false) { + throw new apiCacheException("Couldn't store data"); + } + } + + /** + * @inheritDoc + */ + public function delete($key) { + @apc_delete($key); + } +} diff --git a/webui/google-api/cache/apiCache.php b/webui/google-api/cache/apiCache.php new file mode 100644 index 0000000..081ef49 --- /dev/null +++ b/webui/google-api/cache/apiCache.php @@ -0,0 +1,56 @@ + + */ +abstract class apiCache { + + /** + * Retrieves the data for the given key, or false if they + * key is unknown or expired + * + * @param String $key The key who's data to retrieve + * @param boolean|int $expiration Expiration time in seconds + * + */ + abstract function get($key, $expiration = false); + + /** + * Store the key => $value set. The $value is serialized + * by this function so can be of any type + * + * @param String $key Key of the data + * @param $value the data + */ + abstract function set($key, $value); + + /** + * Removes the key/data pair for the given $key + * + * @param String $key + */ + abstract function delete($key); +} + + diff --git a/webui/google-api/cache/apiFileCache.php b/webui/google-api/cache/apiFileCache.php new file mode 100644 index 0000000..64d85fd --- /dev/null +++ b/webui/google-api/cache/apiFileCache.php @@ -0,0 +1,135 @@ + + */ +class apiFileCache extends apiCache { + private $path; + + public function __construct() { + global $apiConfig; + $this->path = $apiConfig['ioFileCache_directory']; + } + + private function isLocked($storageFile) { + // our lock file convention is simple: /the/file/path.lock + return file_exists($storageFile . '.lock'); + } + + private function createLock($storageFile) { + $storageDir = dirname($storageFile); + if (! is_dir($storageDir)) { + if (! @mkdir($storageDir, 0755, true)) { + // make sure the failure isn't because of a concurrency issue + if (! is_dir($storageDir)) { + throw new apiCacheException("Could not create storage directory: $storageDir"); + } + } + } + @touch($storageFile . '.lock'); + } + + private function removeLock($storageFile) { + // suppress all warnings, if some other process removed it that's ok too + @unlink($storageFile . '.lock'); + } + + private function waitForLock($storageFile) { + // 20 x 250 = 5 seconds + $tries = 20; + $cnt = 0; + do { + // make sure PHP picks up on file changes. This is an expensive action but really can't be avoided + clearstatcache(); + // 250 ms is a long time to sleep, but it does stop the server from burning all resources on polling locks.. + usleep(250); + $cnt ++; + } while ($cnt <= $tries && $this->isLocked($storageFile)); + if ($this->isLocked($storageFile)) { + // 5 seconds passed, assume the owning process died off and remove it + $this->removeLock($storageFile); + } + } + + private function getCacheDir($hash) { + // use the first 2 characters of the hash as a directory prefix + // this should prevent slowdowns due to huge directory listings + // and thus give some basic amount of scalability + return $this->path . '/' . substr($hash, 0, 2); + } + + private function getCacheFile($hash) { + return $this->getCacheDir($hash) . '/' . $hash; + } + + public function get($key, $expiration = false) { + $storageFile = $this->getCacheFile(md5($key)); + // See if this storage file is locked, if so we wait upto 5 seconds for the lock owning process to + // complete it's work. If the lock is not released within that time frame, it's cleaned up. + // This should give us a fair amount of 'Cache Stampeding' protection + if ($this->isLocked($storageFile)) { + $this->waitForLock($storageFile); + } + if (file_exists($storageFile) && is_readable($storageFile)) { + $now = time(); + if (! $expiration || (($mtime = @filemtime($storageFile)) !== false && ($now - $mtime) < $expiration)) { + if (($data = @file_get_contents($storageFile)) !== false) { + $data = unserialize($data); + return $data; + } + } + } + return false; + } + + public function set($key, $value) { + $storageDir = $this->getCacheDir(md5($key)); + $storageFile = $this->getCacheFile(md5($key)); + if ($this->isLocked($storageFile)) { + // some other process is writing to this file too, wait until it's done to prevent hickups + $this->waitForLock($storageFile); + } + if (! is_dir($storageDir)) { + if (! @mkdir($storageDir, 0755, true)) { + throw new apiCacheException("Could not create storage directory: $storageDir"); + } + } + // we serialize the whole request object, since we don't only want the + // responseContent but also the postBody used, headers, size, etc + $data = serialize($value); + $this->createLock($storageFile); + if (! @file_put_contents($storageFile, $data)) { + $this->removeLock($storageFile); + throw new apiCacheException("Could not store data in the file"); + } + $this->removeLock($storageFile); + } + + public function delete($key) { + $file = $this->getCacheFile(md5($key)); + if (! @unlink($file)) { + throw new apiCacheException("Cache file could not be deleted"); + } + } +} diff --git a/webui/google-api/cache/apiMemcacheCache.php b/webui/google-api/cache/apiMemcacheCache.php new file mode 100644 index 0000000..7344209 --- /dev/null +++ b/webui/google-api/cache/apiMemcacheCache.php @@ -0,0 +1,126 @@ + + */ +class apiMemcacheCache extends apiCache { + private $connection = false; + + public function __construct() { + global $apiConfig; + if (! function_exists('memcache_connect')) { + throw new apiCacheException("Memcache functions not available"); + } + $this->host = $apiConfig['ioMemCacheCache_host']; + $this->port = $apiConfig['ioMemCacheCache_port']; + if (empty($this->host) || empty($this->port)) { + throw new apiCacheException("You need to supply a valid memcache host and port"); + } + } + + private function isLocked($key) { + $this->check(); + if ((@memcache_get($this->connection, $key . '.lock')) === false) { + return false; + } + return true; + } + + private function createLock($key) { + $this->check(); + // the interesting thing is that this could fail if the lock was created in the meantime.. + // but we'll ignore that out of convenience + @memcache_add($this->connection, $key . '.lock', '', 0, 5); + } + + private function removeLock($key) { + $this->check(); + // suppress all warnings, if some other process removed it that's ok too + @memcache_delete($this->connection, $key . '.lock'); + } + + private function waitForLock($key) { + $this->check(); + // 20 x 250 = 5 seconds + $tries = 20; + $cnt = 0; + do { + // 250 ms is a long time to sleep, but it does stop the server from burning all resources on polling locks.. + usleep(250); + $cnt ++; + } while ($cnt <= $tries && $this->isLocked($key)); + if ($this->isLocked($key)) { + // 5 seconds passed, assume the owning process died off and remove it + $this->removeLock($key); + } + } + + // I prefer lazy initialization since the cache isn't used every request + // so this potentially saves a lot of overhead + private function connect() { + if (! $this->connection = @memcache_pconnect($this->host, $this->port)) { + throw new apiCacheException("Couldn't connect to memcache server"); + } + } + + private function check() { + if (! $this->connection) { + $this->connect(); + } + } + + /** + * @inheritDoc + */ + public function get($key, $expiration = false) { + $this->check(); + if (($ret = @memcache_get($this->connection, $key)) === false) { + return false; + } + if (! $expiration || (time() - $ret['time'] > $expiration)) { + $this->delete($key); + return false; + } + return $ret['data']; + } + + /** + * @inheritDoc + */ + public function set($key, $value) { + $this->check(); + // we store it with the cache_time default expiration so objects will at least get cleaned eventually. + if (@memcache_set($this->connection, $key, array('time' => time(), + 'data' => $value), false) == false) { + throw new apiCacheException("Couldn't store data in cache"); + } + } + + /** + * @inheritDoc + */ + public function delete($key) { + $this->check(); + @memcache_delete($this->connection, $key); + } +} diff --git a/webui/google-api/config.php b/webui/google-api/config.php new file mode 100644 index 0000000..22ee535 --- /dev/null +++ b/webui/google-api/config.php @@ -0,0 +1,92 @@ + false, + + // The application_name is included in the User-Agent HTTP header. + 'application_name' => '', + + // OAuth2 Settings, you can get these keys at https://code.google.com/apis/console + 'oauth2_client_id' => '', + 'oauth2_client_secret' => '', + 'oauth2_redirect_uri' => '', + + // The developer key, you get this at https://code.google.com/apis/console + 'developer_key' => '', + + // OAuth1 Settings. + // If you're using the apiOAuth auth class, it will use these values for the oauth consumer key and secret. + // See http://code.google.com/apis/accounts/docs/RegistrationForWebAppsAuto.html for info on how to obtain those + 'oauth_consumer_key' => 'anonymous', + 'oauth_consumer_secret' => 'anonymous', + + // Site name to show in the Google's OAuth 1 authentication screen. + 'site_name' => 'www.example.org', + + // Which Authentication, Storage and HTTP IO classes to use. + 'authClass' => 'apiOAuth2', + 'ioClass' => 'apiCurlIO', + 'cacheClass' => 'apiFileCache', + + // If you want to run the test suite (by running # phpunit AllTests.php in the tests/ directory), fill in the settings below + 'oauth_test_token' => '', // the oauth access token to use (which you can get by runing authenticate() as the test user and copying the token value), ie '{"key":"foo","secret":"bar","callback_url":null}' + 'oauth_test_user' => '', // and the user ID to use, this can either be a vanity name 'testuser' or a numberic ID '123456' + + // Don't change these unless you're working against a special development or testing environment. + 'basePath' => 'https://www.googleapis.com', + + // IO Class dependent configuration, you only have to configure the values for the class that was configured as the ioClass above + 'ioFileCache_directory' => + (function_exists('sys_get_temp_dir') ? + sys_get_temp_dir() . '/apiClient' : + '/tmp/apiClient'), + 'ioMemCacheStorage_host' => '127.0.0.1', + 'ioMemcacheStorage_port' => '11211', + + // Definition of service specific values like scopes, oauth token URLs, etc + 'services' => array( + 'analytics' => array('scope' => 'https://www.googleapis.com/auth/analytics.readonly'), + 'calendar' => array( + 'scope' => array( + "https://www.googleapis.com/auth/calendar", + "https://www.googleapis.com/auth/calendar.readonly", + ) + ), + 'books' => array('scope' => 'https://www.googleapis.com/auth/books'), + 'latitude' => array( + 'scope' => array( + 'https://www.googleapis.com/auth/latitude.all.best', + 'https://www.googleapis.com/auth/latitude.all.city', + ) + ), + 'moderator' => array('scope' => 'https://www.googleapis.com/auth/moderator'), + 'oauth2' => array( + 'scope' => array( + 'https://www.googleapis.com/auth/userinfo.profile', + 'https://www.googleapis.com/auth/userinfo.email', + ) + ), + 'plus' => array('scope' => 'https://www.googleapis.com/auth/plus.me'), + 'siteVerification' => array('scope' => 'https://www.googleapis.com/auth/siteverification'), + 'tasks' => array('scope' => 'https://www.googleapis.com/auth/tasks'), + 'urlshortener' => array('scope' => 'https://www.googleapis.com/auth/urlshortener') + ) +); \ No newline at end of file diff --git a/webui/google-api/contrib/apiAdsenseService.php b/webui/google-api/contrib/apiAdsenseService.php new file mode 100644 index 0000000..2ecb224 --- /dev/null +++ b/webui/google-api/contrib/apiAdsenseService.php @@ -0,0 +1,1178 @@ + + * $adsenseService = new apiAdsenseService(...); + * $urlchannels = $adsenseService->urlchannels; + * + */ + class UrlchannelsServiceResource extends apiServiceResource { + + + /** + * List all URL channels in the specified ad client for this AdSense account. (urlchannels.list) + * + * @param string $adClientId Ad client for which to list URL channels. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string pageToken A continuation token, used to page through URL channels. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response. + * @opt_param int maxResults The maximum number of URL channels to include in the response, used for paging. + * @return UrlChannels + */ + public function listUrlchannels($adClientId, $optParams = array()) { + $params = array('adClientId' => $adClientId); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new UrlChannels($data); + } else { + return $data; + } + } + } + + /** + * The "adunits" collection of methods. + * Typical usage is: + * + * $adsenseService = new apiAdsenseService(...); + * $adunits = $adsenseService->adunits; + * + */ + class AdunitsServiceResource extends apiServiceResource { + + + /** + * List all ad units in the specified ad client for this AdSense account. (adunits.list) + * + * @param string $adClientId Ad client for which to list ad units. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param bool includeInactive Whether to include inactive ad units. Default: true. + * @opt_param string pageToken A continuation token, used to page through ad units. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response. + * @opt_param int maxResults The maximum number of ad units to include in the response, used for paging. + * @return AdUnits + */ + public function listAdunits($adClientId, $optParams = array()) { + $params = array('adClientId' => $adClientId); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new AdUnits($data); + } else { + return $data; + } + } + /** + * Gets the specified ad unit in the specified ad client. (adunits.get) + * + * @param string $adClientId Ad client for which to get the ad unit. + * @param string $adUnitId Ad unit to retrieve. + * @return AdUnit + */ + public function get($adClientId, $adUnitId, $optParams = array()) { + $params = array('adClientId' => $adClientId, 'adUnitId' => $adUnitId); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new AdUnit($data); + } else { + return $data; + } + } + } + + + /** + * The "customchannels" collection of methods. + * Typical usage is: + * + * $adsenseService = new apiAdsenseService(...); + * $customchannels = $adsenseService->customchannels; + * + */ + class AdunitsCustomchannelsServiceResource extends apiServiceResource { + + + /** + * List all custom channels which the specified ad unit belongs to. (customchannels.list) + * + * @param string $adClientId Ad client which contains the ad unit. + * @param string $adUnitId Ad unit for which to list custom channels. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string pageToken A continuation token, used to page through custom channels. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response. + * @opt_param int maxResults The maximum number of custom channels to include in the response, used for paging. + * @return CustomChannels + */ + public function listAdunitsCustomchannels($adClientId, $adUnitId, $optParams = array()) { + $params = array('adClientId' => $adClientId, 'adUnitId' => $adUnitId); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new CustomChannels($data); + } else { + return $data; + } + } + } + + /** + * The "adclients" collection of methods. + * Typical usage is: + * + * $adsenseService = new apiAdsenseService(...); + * $adclients = $adsenseService->adclients; + * + */ + class AdclientsServiceResource extends apiServiceResource { + + + /** + * List all ad clients in this AdSense account. (adclients.list) + * + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string pageToken A continuation token, used to page through ad clients. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response. + * @opt_param int maxResults The maximum number of ad clients to include in the response, used for paging. + * @return AdClients + */ + public function listAdclients($optParams = array()) { + $params = array(); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new AdClients($data); + } else { + return $data; + } + } + } + + /** + * The "reports" collection of methods. + * Typical usage is: + * + * $adsenseService = new apiAdsenseService(...); + * $reports = $adsenseService->reports; + * + */ + class ReportsServiceResource extends apiServiceResource { + + + /** + * Generate an AdSense report based on the report request sent in the query parameters. Returns the + * result as JSON; to retrieve output in CSV format specify "alt=csv" as a query parameter. + * (reports.generate) + * + * @param string $startDate Start of the date range to report on in "YYYY-MM-DD" format, inclusive. + * @param string $endDate End of the date range to report on in "YYYY-MM-DD" format, inclusive. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string sort The name of a dimension or metric to sort the resulting report on, optionally prefixed with "+" to sort ascending or "-" to sort descending. If no prefix is specified, the column is sorted ascending. + * @opt_param string locale Optional locale to use for translating report output to a local language. Defaults to "en_US" if not specified. + * @opt_param string metric Numeric columns to include in the report. + * @opt_param int maxResults The maximum number of rows of report data to return. + * @opt_param string filter Filters to be run on the report. + * @opt_param string currency Optional currency to use when reporting on monetary metrics. Defaults to the account's currency if not set. + * @opt_param int startIndex Index of the first row of report data to return. + * @opt_param string dimension Dimensions to base the report on. + * @opt_param string accountId Accounts upon which to report. + * @return AdsenseReportsGenerateResponse + */ + public function generate($startDate, $endDate, $optParams = array()) { + $params = array('startDate' => $startDate, 'endDate' => $endDate); + $params = array_merge($params, $optParams); + $data = $this->__call('generate', array($params)); + if ($this->useObjects()) { + return new AdsenseReportsGenerateResponse($data); + } else { + return $data; + } + } + } + + /** + * The "accounts" collection of methods. + * Typical usage is: + * + * $adsenseService = new apiAdsenseService(...); + * $accounts = $adsenseService->accounts; + * + */ + class AccountsServiceResource extends apiServiceResource { + + + /** + * List all accounts available to this AdSense account. (accounts.list) + * + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string pageToken A continuation token, used to page through accounts. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response. + * @opt_param int maxResults The maximum number of accounts to include in the response, used for paging. + * @return Accounts + */ + public function listAccounts($optParams = array()) { + $params = array(); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new Accounts($data); + } else { + return $data; + } + } + /** + * Get information about the selected AdSense account. (accounts.get) + * + * @param string $accountId Account to get information about. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param bool tree Whether the tree of sub accounts should be returned. + * @return Account + */ + public function get($accountId, $optParams = array()) { + $params = array('accountId' => $accountId); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new Account($data); + } else { + return $data; + } + } + } + + + /** + * The "urlchannels" collection of methods. + * Typical usage is: + * + * $adsenseService = new apiAdsenseService(...); + * $urlchannels = $adsenseService->urlchannels; + * + */ + class AccountsUrlchannelsServiceResource extends apiServiceResource { + + + /** + * List all URL channels in the specified ad client for the specified account. (urlchannels.list) + * + * @param string $accountId Account to which the ad client belongs. + * @param string $adClientId Ad client for which to list URL channels. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string pageToken A continuation token, used to page through URL channels. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response. + * @opt_param int maxResults The maximum number of URL channels to include in the response, used for paging. + * @return UrlChannels + */ + public function listAccountsUrlchannels($accountId, $adClientId, $optParams = array()) { + $params = array('accountId' => $accountId, 'adClientId' => $adClientId); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new UrlChannels($data); + } else { + return $data; + } + } + } + /** + * The "adunits" collection of methods. + * Typical usage is: + * + * $adsenseService = new apiAdsenseService(...); + * $adunits = $adsenseService->adunits; + * + */ + class AccountsAdunitsServiceResource extends apiServiceResource { + + + /** + * List all ad units in the specified ad client for the specified account. (adunits.list) + * + * @param string $accountId Account to which the ad client belongs. + * @param string $adClientId Ad client for which to list ad units. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param bool includeInactive Whether to include inactive ad units. Default: true. + * @opt_param string pageToken A continuation token, used to page through ad units. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response. + * @opt_param int maxResults The maximum number of ad units to include in the response, used for paging. + * @return AdUnits + */ + public function listAccountsAdunits($accountId, $adClientId, $optParams = array()) { + $params = array('accountId' => $accountId, 'adClientId' => $adClientId); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new AdUnits($data); + } else { + return $data; + } + } + /** + * Gets the specified ad unit in the specified ad client for the specified account. (adunits.get) + * + * @param string $accountId Account to which the ad client belongs. + * @param string $adClientId Ad client for which to get the ad unit. + * @param string $adUnitId Ad unit to retrieve. + * @return AdUnit + */ + public function get($accountId, $adClientId, $adUnitId, $optParams = array()) { + $params = array('accountId' => $accountId, 'adClientId' => $adClientId, 'adUnitId' => $adUnitId); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new AdUnit($data); + } else { + return $data; + } + } + } + + + /** + * The "customchannels" collection of methods. + * Typical usage is: + * + * $adsenseService = new apiAdsenseService(...); + * $customchannels = $adsenseService->customchannels; + * + */ + class AccountsAdunitsCustomchannelsServiceResource extends apiServiceResource { + + + /** + * List all custom channels which the specified ad unit belongs to. (customchannels.list) + * + * @param string $accountId Account to which the ad client belongs. + * @param string $adClientId Ad client which contains the ad unit. + * @param string $adUnitId Ad unit for which to list custom channels. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string pageToken A continuation token, used to page through custom channels. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response. + * @opt_param int maxResults The maximum number of custom channels to include in the response, used for paging. + * @return CustomChannels + */ + public function listAccountsAdunitsCustomchannels($accountId, $adClientId, $adUnitId, $optParams = array()) { + $params = array('accountId' => $accountId, 'adClientId' => $adClientId, 'adUnitId' => $adUnitId); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new CustomChannels($data); + } else { + return $data; + } + } + } + /** + * The "adclients" collection of methods. + * Typical usage is: + * + * $adsenseService = new apiAdsenseService(...); + * $adclients = $adsenseService->adclients; + * + */ + class AccountsAdclientsServiceResource extends apiServiceResource { + + + /** + * List all ad clients in the specified account. (adclients.list) + * + * @param string $accountId Account for which to list ad clients. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string pageToken A continuation token, used to page through ad clients. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response. + * @opt_param int maxResults The maximum number of ad clients to include in the response, used for paging. + * @return AdClients + */ + public function listAccountsAdclients($accountId, $optParams = array()) { + $params = array('accountId' => $accountId); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new AdClients($data); + } else { + return $data; + } + } + } + /** + * The "reports" collection of methods. + * Typical usage is: + * + * $adsenseService = new apiAdsenseService(...); + * $reports = $adsenseService->reports; + * + */ + class AccountsReportsServiceResource extends apiServiceResource { + + + /** + * Generate an AdSense report based on the report request sent in the query parameters. Returns the + * result as JSON; to retrieve output in CSV format specify "alt=csv" as a query parameter. + * (reports.generate) + * + * @param string $startDate Start of the date range to report on in "YYYY-MM-DD" format, inclusive. + * @param string $endDate End of the date range to report on in "YYYY-MM-DD" format, inclusive. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string accountId Account upon which to report. + * @opt_param string sort The name of a dimension or metric to sort the resulting report on, optionally prefixed with "+" to sort ascending or "-" to sort descending. If no prefix is specified, the column is sorted ascending. + * @opt_param string locale Optional locale to use for translating report output to a local language. Defaults to "en_US" if not specified. + * @opt_param string metric Numeric columns to include in the report. + * @opt_param int maxResults The maximum number of rows of report data to return. + * @opt_param string filter Filters to be run on the report. + * @opt_param string currency Optional currency to use when reporting on monetary metrics. Defaults to the account's currency if not set. + * @opt_param int startIndex Index of the first row of report data to return. + * @opt_param string dimension Dimensions to base the report on. + * @return AdsenseReportsGenerateResponse + */ + public function generate($startDate, $endDate, $optParams = array()) { + $params = array('startDate' => $startDate, 'endDate' => $endDate); + $params = array_merge($params, $optParams); + $data = $this->__call('generate', array($params)); + if ($this->useObjects()) { + return new AdsenseReportsGenerateResponse($data); + } else { + return $data; + } + } + } + /** + * The "customchannels" collection of methods. + * Typical usage is: + * + * $adsenseService = new apiAdsenseService(...); + * $customchannels = $adsenseService->customchannels; + * + */ + class AccountsCustomchannelsServiceResource extends apiServiceResource { + + + /** + * List all custom channels in the specified ad client for the specified account. + * (customchannels.list) + * + * @param string $accountId Account to which the ad client belongs. + * @param string $adClientId Ad client for which to list custom channels. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string pageToken A continuation token, used to page through custom channels. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response. + * @opt_param int maxResults The maximum number of custom channels to include in the response, used for paging. + * @return CustomChannels + */ + public function listAccountsCustomchannels($accountId, $adClientId, $optParams = array()) { + $params = array('accountId' => $accountId, 'adClientId' => $adClientId); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new CustomChannels($data); + } else { + return $data; + } + } + /** + * Get the specified custom channel from the specified ad client for the specified account. + * (customchannels.get) + * + * @param string $accountId Account to which the ad client belongs. + * @param string $adClientId Ad client which contains the custom channel. + * @param string $customChannelId Custom channel to retrieve. + * @return CustomChannel + */ + public function get($accountId, $adClientId, $customChannelId, $optParams = array()) { + $params = array('accountId' => $accountId, 'adClientId' => $adClientId, 'customChannelId' => $customChannelId); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new CustomChannel($data); + } else { + return $data; + } + } + } + + + /** + * The "adunits" collection of methods. + * Typical usage is: + * + * $adsenseService = new apiAdsenseService(...); + * $adunits = $adsenseService->adunits; + * + */ + class AccountsCustomchannelsAdunitsServiceResource extends apiServiceResource { + + + /** + * List all ad units in the specified custom channel. (adunits.list) + * + * @param string $accountId Account to which the ad client belongs. + * @param string $adClientId Ad client which contains the custom channel. + * @param string $customChannelId Custom channel for which to list ad units. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param bool includeInactive Whether to include inactive ad units. Default: true. + * @opt_param int maxResults The maximum number of ad units to include in the response, used for paging. + * @opt_param string pageToken A continuation token, used to page through ad units. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response. + * @return AdUnits + */ + public function listAccountsCustomchannelsAdunits($accountId, $adClientId, $customChannelId, $optParams = array()) { + $params = array('accountId' => $accountId, 'adClientId' => $adClientId, 'customChannelId' => $customChannelId); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new AdUnits($data); + } else { + return $data; + } + } + } + + /** + * The "customchannels" collection of methods. + * Typical usage is: + * + * $adsenseService = new apiAdsenseService(...); + * $customchannels = $adsenseService->customchannels; + * + */ + class CustomchannelsServiceResource extends apiServiceResource { + + + /** + * List all custom channels in the specified ad client for this AdSense account. + * (customchannels.list) + * + * @param string $adClientId Ad client for which to list custom channels. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string pageToken A continuation token, used to page through custom channels. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response. + * @opt_param int maxResults The maximum number of custom channels to include in the response, used for paging. + * @return CustomChannels + */ + public function listCustomchannels($adClientId, $optParams = array()) { + $params = array('adClientId' => $adClientId); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new CustomChannels($data); + } else { + return $data; + } + } + /** + * Get the specified custom channel from the specified ad client. (customchannels.get) + * + * @param string $adClientId Ad client which contains the custom channel. + * @param string $customChannelId Custom channel to retrieve. + * @return CustomChannel + */ + public function get($adClientId, $customChannelId, $optParams = array()) { + $params = array('adClientId' => $adClientId, 'customChannelId' => $customChannelId); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new CustomChannel($data); + } else { + return $data; + } + } + } + + + /** + * The "adunits" collection of methods. + * Typical usage is: + * + * $adsenseService = new apiAdsenseService(...); + * $adunits = $adsenseService->adunits; + * + */ + class CustomchannelsAdunitsServiceResource extends apiServiceResource { + + + /** + * List all ad units in the specified custom channel. (adunits.list) + * + * @param string $adClientId Ad client which contains the custom channel. + * @param string $customChannelId Custom channel for which to list ad units. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param bool includeInactive Whether to include inactive ad units. Default: true. + * @opt_param string pageToken A continuation token, used to page through ad units. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response. + * @opt_param int maxResults The maximum number of ad units to include in the response, used for paging. + * @return AdUnits + */ + public function listCustomchannelsAdunits($adClientId, $customChannelId, $optParams = array()) { + $params = array('adClientId' => $adClientId, 'customChannelId' => $customChannelId); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new AdUnits($data); + } else { + return $data; + } + } + } + + + +/** + * Service definition for Adsense (v1.1). + * + *

+ * Gives AdSense publishers access to their inventory and the ability to generate reports + *

+ * + *

+ * For more information about this service, see the + * API Documentation + *

+ * + * @author Google, Inc. + */ +class apiAdsenseService extends apiService { + public $urlchannels; + public $adunits; + public $adunits_customchannels; + public $adunits_customchannels_customchannels; + public $adclients; + public $reports; + public $accounts; + public $accounts_urlchannels; + public $accounts_urlchannels_urlchannels; + public $accounts_urlchannels_adunits; + public $accounts_urlchannels_adclients; + public $accounts_urlchannels_reports; + public $accounts_urlchannels_customchannels; + public $accounts_adunits; + public $accounts_adunits_urlchannels; + public $accounts_adunits_adunits; + public $accounts_adunits_adclients; + public $accounts_adunits_reports; + public $accounts_adunits_customchannels; + public $accounts_adclients; + public $accounts_adclients_urlchannels; + public $accounts_adclients_adunits; + public $accounts_adclients_adclients; + public $accounts_adclients_reports; + public $accounts_adclients_customchannels; + public $accounts_reports; + public $accounts_reports_urlchannels; + public $accounts_reports_adunits; + public $accounts_reports_adclients; + public $accounts_reports_reports; + public $accounts_reports_customchannels; + public $accounts_customchannels; + public $accounts_customchannels_urlchannels; + public $accounts_customchannels_adunits; + public $accounts_customchannels_adclients; + public $accounts_customchannels_reports; + public $accounts_customchannels_customchannels; + public $customchannels; + public $customchannels_adunits; + public $customchannels_adunits_adunits; + /** + * Constructs the internal representation of the Adsense service. + * + * @param apiClient apiClient + */ + public function __construct(apiClient $apiClient) { + $this->rpcPath = '/rpc'; + $this->restBasePath = '/adsense/v1.1/'; + $this->version = 'v1.1'; + $this->serviceName = 'adsense'; + + $apiClient->addService($this->serviceName, $this->version); + $this->urlchannels = new UrlchannelsServiceResource($this, $this->serviceName, 'urlchannels', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "adClientId": {"required": true, "type": "string", "location": "path"}, "maxResults": {"format": "int32", "maximum": "10000", "minimum": "0", "location": "query", "type": "integer"}}, "id": "adsense.urlchannels.list", "httpMethod": "GET", "path": "adclients/{adClientId}/urlchannels", "response": {"$ref": "UrlChannels"}}}}', true)); + $this->adunits = new AdunitsServiceResource($this, $this->serviceName, 'adunits', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"includeInactive": {"type": "boolean", "location": "query"}, "pageToken": {"type": "string", "location": "query"}, "adClientId": {"required": true, "type": "string", "location": "path"}, "maxResults": {"format": "int32", "maximum": "10000", "minimum": "0", "location": "query", "type": "integer"}}, "id": "adsense.adunits.list", "httpMethod": "GET", "path": "adclients/{adClientId}/adunits", "response": {"$ref": "AdUnits"}}, "get": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"adClientId": {"required": true, "type": "string", "location": "path"}, "adUnitId": {"required": true, "type": "string", "location": "path"}}, "id": "adsense.adunits.get", "httpMethod": "GET", "path": "adclients/{adClientId}/adunits/{adUnitId}", "response": {"$ref": "AdUnit"}}}}', true)); + $this->adunits_customchannels = new AdunitsCustomchannelsServiceResource($this, $this->serviceName, 'customchannels', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "adClientId": {"required": true, "type": "string", "location": "path"}, "adUnitId": {"required": true, "type": "string", "location": "path"}, "maxResults": {"format": "int32", "maximum": "10000", "minimum": "0", "location": "query", "type": "integer"}}, "id": "adsense.adunits.customchannels.list", "httpMethod": "GET", "path": "adclients/{adClientId}/adunits/{adUnitId}/customchannels", "response": {"$ref": "CustomChannels"}}}}', true)); + $this->adclients = new AdclientsServiceResource($this, $this->serviceName, 'adclients', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "maxResults": {"format": "int32", "maximum": "10000", "minimum": "0", "location": "query", "type": "integer"}}, "response": {"$ref": "AdClients"}, "httpMethod": "GET", "path": "adclients", "id": "adsense.adclients.list"}}}', true)); + $this->reports = new ReportsServiceResource($this, $this->serviceName, 'reports', json_decode('{"methods": {"generate": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"sort": {"repeated": true, "type": "string", "location": "query"}, "startDate": {"required": true, "type": "string", "location": "query"}, "endDate": {"required": true, "type": "string", "location": "query"}, "locale": {"type": "string", "location": "query"}, "metric": {"repeated": true, "type": "string", "location": "query"}, "maxResults": {"format": "int32", "maximum": "50000", "minimum": "0", "location": "query", "type": "integer"}, "filter": {"repeated": true, "type": "string", "location": "query"}, "currency": {"type": "string", "location": "query"}, "startIndex": {"format": "int32", "maximum": "5000", "minimum": "0", "location": "query", "type": "integer"}, "dimension": {"repeated": true, "type": "string", "location": "query"}, "accountId": {"repeated": true, "type": "string", "location": "query"}}, "id": "adsense.reports.generate", "httpMethod": "GET", "path": "reports", "response": {"$ref": "AdsenseReportsGenerateResponse"}}}}', true)); + $this->accounts = new AccountsServiceResource($this, $this->serviceName, 'accounts', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "maxResults": {"format": "int32", "maximum": "10000", "minimum": "0", "location": "query", "type": "integer"}}, "response": {"$ref": "Accounts"}, "httpMethod": "GET", "path": "accounts", "id": "adsense.accounts.list"}, "get": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"tree": {"type": "boolean", "location": "query"}, "accountId": {"required": true, "type": "string", "location": "path"}}, "id": "adsense.accounts.get", "httpMethod": "GET", "path": "accounts/{accountId}", "response": {"$ref": "Account"}}}}', true)); + $this->accounts_urlchannels = new AccountsUrlchannelsServiceResource($this, $this->serviceName, 'urlchannels', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "adClientId": {"required": true, "type": "string", "location": "path"}, "maxResults": {"format": "int32", "maximum": "10000", "minimum": "0", "location": "query", "type": "integer"}, "accountId": {"required": true, "type": "string", "location": "path"}}, "id": "adsense.accounts.urlchannels.list", "httpMethod": "GET", "path": "accounts/{accountId}/adclients/{adClientId}/urlchannels", "response": {"$ref": "UrlChannels"}}}}', true)); + $this->accounts_adunits = new AccountsAdunitsServiceResource($this, $this->serviceName, 'adunits', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"includeInactive": {"type": "boolean", "location": "query"}, "pageToken": {"type": "string", "location": "query"}, "adClientId": {"required": true, "type": "string", "location": "path"}, "maxResults": {"format": "int32", "maximum": "10000", "minimum": "0", "location": "query", "type": "integer"}, "accountId": {"required": true, "type": "string", "location": "path"}}, "id": "adsense.accounts.adunits.list", "httpMethod": "GET", "path": "accounts/{accountId}/adclients/{adClientId}/adunits", "response": {"$ref": "AdUnits"}}, "get": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"adClientId": {"required": true, "type": "string", "location": "path"}, "adUnitId": {"required": true, "type": "string", "location": "path"}, "accountId": {"required": true, "type": "string", "location": "path"}}, "id": "adsense.accounts.adunits.get", "httpMethod": "GET", "path": "accounts/{accountId}/adclients/{adClientId}/adunits/{adUnitId}", "response": {"$ref": "AdUnit"}}}}', true)); + $this->accounts_adunits_customchannels = new AccountsAdunitsCustomchannelsServiceResource($this, $this->serviceName, 'customchannels', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "adClientId": {"required": true, "type": "string", "location": "path"}, "adUnitId": {"required": true, "type": "string", "location": "path"}, "maxResults": {"format": "int32", "maximum": "10000", "minimum": "0", "location": "query", "type": "integer"}, "accountId": {"required": true, "type": "string", "location": "path"}}, "id": "adsense.accounts.adunits.customchannels.list", "httpMethod": "GET", "path": "accounts/{accountId}/adclients/{adClientId}/adunits/{adUnitId}/customchannels", "response": {"$ref": "CustomChannels"}}}}', true)); + $this->accounts_adclients = new AccountsAdclientsServiceResource($this, $this->serviceName, 'adclients', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "maxResults": {"format": "int32", "maximum": "10000", "minimum": "0", "location": "query", "type": "integer"}, "accountId": {"required": true, "type": "string", "location": "path"}}, "id": "adsense.accounts.adclients.list", "httpMethod": "GET", "path": "accounts/{accountId}/adclients", "response": {"$ref": "AdClients"}}}}', true)); + $this->accounts_reports = new AccountsReportsServiceResource($this, $this->serviceName, 'reports', json_decode('{"methods": {"generate": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"sort": {"repeated": true, "type": "string", "location": "query"}, "startDate": {"required": true, "type": "string", "location": "query"}, "endDate": {"required": true, "type": "string", "location": "query"}, "locale": {"type": "string", "location": "query"}, "metric": {"repeated": true, "type": "string", "location": "query"}, "maxResults": {"format": "int32", "maximum": "50000", "minimum": "0", "location": "query", "type": "integer"}, "filter": {"repeated": true, "type": "string", "location": "query"}, "currency": {"type": "string", "location": "query"}, "startIndex": {"format": "int32", "maximum": "5000", "minimum": "0", "location": "query", "type": "integer"}, "dimension": {"repeated": true, "type": "string", "location": "query"}, "accountId": {"type": "string", "location": "path"}}, "id": "adsense.accounts.reports.generate", "httpMethod": "GET", "path": "accounts/{accountId}/reports", "response": {"$ref": "AdsenseReportsGenerateResponse"}}}}', true)); + $this->accounts_customchannels = new AccountsCustomchannelsServiceResource($this, $this->serviceName, 'customchannels', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "adClientId": {"required": true, "type": "string", "location": "path"}, "maxResults": {"format": "int32", "maximum": "10000", "minimum": "0", "location": "query", "type": "integer"}, "accountId": {"required": true, "type": "string", "location": "path"}}, "id": "adsense.accounts.customchannels.list", "httpMethod": "GET", "path": "accounts/{accountId}/adclients/{adClientId}/customchannels", "response": {"$ref": "CustomChannels"}}, "get": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"customChannelId": {"required": true, "type": "string", "location": "path"}, "adClientId": {"required": true, "type": "string", "location": "path"}, "accountId": {"required": true, "type": "string", "location": "path"}}, "id": "adsense.accounts.customchannels.get", "httpMethod": "GET", "path": "accounts/{accountId}/adclients/{adClientId}/customchannels/{customChannelId}", "response": {"$ref": "CustomChannel"}}}}', true)); + $this->accounts_customchannels_adunits = new AccountsCustomchannelsAdunitsServiceResource($this, $this->serviceName, 'adunits', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"includeInactive": {"type": "boolean", "location": "query"}, "customChannelId": {"required": true, "type": "string", "location": "path"}, "adClientId": {"required": true, "type": "string", "location": "path"}, "maxResults": {"format": "int32", "maximum": "10000", "minimum": "0", "location": "query", "type": "integer"}, "pageToken": {"type": "string", "location": "query"}, "accountId": {"required": true, "type": "string", "location": "path"}}, "id": "adsense.accounts.customchannels.adunits.list", "httpMethod": "GET", "path": "accounts/{accountId}/adclients/{adClientId}/customchannels/{customChannelId}/adunits", "response": {"$ref": "AdUnits"}}}}', true)); + $this->customchannels = new CustomchannelsServiceResource($this, $this->serviceName, 'customchannels', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "adClientId": {"required": true, "type": "string", "location": "path"}, "maxResults": {"format": "int32", "maximum": "10000", "minimum": "0", "location": "query", "type": "integer"}}, "id": "adsense.customchannels.list", "httpMethod": "GET", "path": "adclients/{adClientId}/customchannels", "response": {"$ref": "CustomChannels"}}, "get": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"customChannelId": {"required": true, "type": "string", "location": "path"}, "adClientId": {"required": true, "type": "string", "location": "path"}}, "id": "adsense.customchannels.get", "httpMethod": "GET", "path": "adclients/{adClientId}/customchannels/{customChannelId}", "response": {"$ref": "CustomChannel"}}}}', true)); + $this->customchannels_adunits = new CustomchannelsAdunitsServiceResource($this, $this->serviceName, 'adunits', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"includeInactive": {"type": "boolean", "location": "query"}, "pageToken": {"type": "string", "location": "query"}, "customChannelId": {"required": true, "type": "string", "location": "path"}, "adClientId": {"required": true, "type": "string", "location": "path"}, "maxResults": {"format": "int32", "maximum": "10000", "minimum": "0", "location": "query", "type": "integer"}}, "id": "adsense.customchannels.adunits.list", "httpMethod": "GET", "path": "adclients/{adClientId}/customchannels/{customChannelId}/adunits", "response": {"$ref": "AdUnits"}}}}', true)); + } +} + +class Account extends apiModel { + public $kind; + public $id; + protected $__subAccountsType = 'Account'; + protected $__subAccountsDataType = 'array'; + public $subAccounts; + public $name; + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setSubAccounts(/* array(Account) */ $subAccounts) { + $this->assertIsArray($subAccounts, 'Account', __METHOD__); + $this->subAccounts = $subAccounts; + } + public function getSubAccounts() { + return $this->subAccounts; + } + public function setName($name) { + $this->name = $name; + } + public function getName() { + return $this->name; + } +} + +class Accounts extends apiModel { + public $nextPageToken; + protected $__itemsType = 'Account'; + protected $__itemsDataType = 'array'; + public $items; + public $kind; + public $etag; + public function setNextPageToken($nextPageToken) { + $this->nextPageToken = $nextPageToken; + } + public function getNextPageToken() { + return $this->nextPageToken; + } + public function setItems(/* array(Account) */ $items) { + $this->assertIsArray($items, 'Account', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setEtag($etag) { + $this->etag = $etag; + } + public function getEtag() { + return $this->etag; + } +} + +class AdClient extends apiModel { + public $productCode; + public $kind; + public $id; + public $supportsReporting; + public function setProductCode($productCode) { + $this->productCode = $productCode; + } + public function getProductCode() { + return $this->productCode; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setSupportsReporting($supportsReporting) { + $this->supportsReporting = $supportsReporting; + } + public function getSupportsReporting() { + return $this->supportsReporting; + } +} + +class AdClients extends apiModel { + public $nextPageToken; + protected $__itemsType = 'AdClient'; + protected $__itemsDataType = 'array'; + public $items; + public $kind; + public $etag; + public function setNextPageToken($nextPageToken) { + $this->nextPageToken = $nextPageToken; + } + public function getNextPageToken() { + return $this->nextPageToken; + } + public function setItems(/* array(AdClient) */ $items) { + $this->assertIsArray($items, 'AdClient', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setEtag($etag) { + $this->etag = $etag; + } + public function getEtag() { + return $this->etag; + } +} + +class AdUnit extends apiModel { + public $status; + public $kind; + public $code; + public $id; + public $name; + public function setStatus($status) { + $this->status = $status; + } + public function getStatus() { + return $this->status; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setCode($code) { + $this->code = $code; + } + public function getCode() { + return $this->code; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setName($name) { + $this->name = $name; + } + public function getName() { + return $this->name; + } +} + +class AdUnits extends apiModel { + public $nextPageToken; + protected $__itemsType = 'AdUnit'; + protected $__itemsDataType = 'array'; + public $items; + public $kind; + public $etag; + public function setNextPageToken($nextPageToken) { + $this->nextPageToken = $nextPageToken; + } + public function getNextPageToken() { + return $this->nextPageToken; + } + public function setItems(/* array(AdUnit) */ $items) { + $this->assertIsArray($items, 'AdUnit', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setEtag($etag) { + $this->etag = $etag; + } + public function getEtag() { + return $this->etag; + } +} + +class AdsenseReportsGenerateResponse extends apiModel { + public $kind; + public $rows; + public $warnings; + public $totals; + protected $__headersType = 'AdsenseReportsGenerateResponseHeaders'; + protected $__headersDataType = 'array'; + public $headers; + public $totalMatchedRows; + public $averages; + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setRows(/* array(string) */ $rows) { + $this->assertIsArray($rows, 'string', __METHOD__); + $this->rows = $rows; + } + public function getRows() { + return $this->rows; + } + public function setWarnings(/* array(string) */ $warnings) { + $this->assertIsArray($warnings, 'string', __METHOD__); + $this->warnings = $warnings; + } + public function getWarnings() { + return $this->warnings; + } + public function setTotals(/* array(string) */ $totals) { + $this->assertIsArray($totals, 'string', __METHOD__); + $this->totals = $totals; + } + public function getTotals() { + return $this->totals; + } + public function setHeaders(/* array(AdsenseReportsGenerateResponseHeaders) */ $headers) { + $this->assertIsArray($headers, 'AdsenseReportsGenerateResponseHeaders', __METHOD__); + $this->headers = $headers; + } + public function getHeaders() { + return $this->headers; + } + public function setTotalMatchedRows($totalMatchedRows) { + $this->totalMatchedRows = $totalMatchedRows; + } + public function getTotalMatchedRows() { + return $this->totalMatchedRows; + } + public function setAverages(/* array(string) */ $averages) { + $this->assertIsArray($averages, 'string', __METHOD__); + $this->averages = $averages; + } + public function getAverages() { + return $this->averages; + } +} + +class AdsenseReportsGenerateResponseHeaders extends apiModel { + public $currency; + public $type; + public $name; + public function setCurrency($currency) { + $this->currency = $currency; + } + public function getCurrency() { + return $this->currency; + } + public function setType($type) { + $this->type = $type; + } + public function getType() { + return $this->type; + } + public function setName($name) { + $this->name = $name; + } + public function getName() { + return $this->name; + } +} + +class CustomChannel extends apiModel { + public $kind; + public $code; + protected $__targetingInfoType = 'CustomChannelTargetingInfo'; + protected $__targetingInfoDataType = ''; + public $targetingInfo; + public $id; + public $name; + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setCode($code) { + $this->code = $code; + } + public function getCode() { + return $this->code; + } + public function setTargetingInfo(CustomChannelTargetingInfo $targetingInfo) { + $this->targetingInfo = $targetingInfo; + } + public function getTargetingInfo() { + return $this->targetingInfo; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setName($name) { + $this->name = $name; + } + public function getName() { + return $this->name; + } +} + +class CustomChannelTargetingInfo extends apiModel { + public $location; + public $adsAppearOn; + public $siteLanguage; + public $description; + public function setLocation($location) { + $this->location = $location; + } + public function getLocation() { + return $this->location; + } + public function setAdsAppearOn($adsAppearOn) { + $this->adsAppearOn = $adsAppearOn; + } + public function getAdsAppearOn() { + return $this->adsAppearOn; + } + public function setSiteLanguage($siteLanguage) { + $this->siteLanguage = $siteLanguage; + } + public function getSiteLanguage() { + return $this->siteLanguage; + } + public function setDescription($description) { + $this->description = $description; + } + public function getDescription() { + return $this->description; + } +} + +class CustomChannels extends apiModel { + public $nextPageToken; + protected $__itemsType = 'CustomChannel'; + protected $__itemsDataType = 'array'; + public $items; + public $kind; + public $etag; + public function setNextPageToken($nextPageToken) { + $this->nextPageToken = $nextPageToken; + } + public function getNextPageToken() { + return $this->nextPageToken; + } + public function setItems(/* array(CustomChannel) */ $items) { + $this->assertIsArray($items, 'CustomChannel', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setEtag($etag) { + $this->etag = $etag; + } + public function getEtag() { + return $this->etag; + } +} + +class UrlChannel extends apiModel { + public $kind; + public $id; + public $urlPattern; + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setUrlPattern($urlPattern) { + $this->urlPattern = $urlPattern; + } + public function getUrlPattern() { + return $this->urlPattern; + } +} + +class UrlChannels extends apiModel { + public $nextPageToken; + protected $__itemsType = 'UrlChannel'; + protected $__itemsDataType = 'array'; + public $items; + public $kind; + public $etag; + public function setNextPageToken($nextPageToken) { + $this->nextPageToken = $nextPageToken; + } + public function getNextPageToken() { + return $this->nextPageToken; + } + public function setItems(/* array(UrlChannel) */ $items) { + $this->assertIsArray($items, 'UrlChannel', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setEtag($etag) { + $this->etag = $etag; + } + public function getEtag() { + return $this->etag; + } +} diff --git a/webui/google-api/contrib/apiAnalyticsService.php b/webui/google-api/contrib/apiAnalyticsService.php new file mode 100644 index 0000000..328695a --- /dev/null +++ b/webui/google-api/contrib/apiAnalyticsService.php @@ -0,0 +1,1572 @@ + + * $analyticsService = new apiAnalyticsService(...); + * $management = $analyticsService->management; + * + */ + class ManagementServiceResource extends apiServiceResource { + + + } + + + /** + * The "webproperties" collection of methods. + * Typical usage is: + * + * $analyticsService = new apiAnalyticsService(...); + * $webproperties = $analyticsService->webproperties; + * + */ + class ManagementWebpropertiesServiceResource extends apiServiceResource { + + + /** + * Lists web properties to which the user has access. (webproperties.list) + * + * @param string $accountId Account ID for the web properties to retrieve. Can either be a specific account ID or '~all', which refers to all the accounts to which user has access. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param int max-results The maximum number of entries to include in this response. + * @opt_param int start-index An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter. + * @return Webproperties + */ + public function listManagementWebproperties($accountId, $optParams = array()) { + $params = array('accountId' => $accountId); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new Webproperties($data); + } else { + return $data; + } + } + } + /** + * The "segments" collection of methods. + * Typical usage is: + * + * $analyticsService = new apiAnalyticsService(...); + * $segments = $analyticsService->segments; + * + */ + class ManagementSegmentsServiceResource extends apiServiceResource { + + + /** + * Lists advanced segments to which the user has access. (segments.list) + * + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param int max-results The maximum number of entries to include in this response. + * @opt_param int start-index An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter. + * @return Segments + */ + public function listManagementSegments($optParams = array()) { + $params = array(); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new Segments($data); + } else { + return $data; + } + } + } + /** + * The "accounts" collection of methods. + * Typical usage is: + * + * $analyticsService = new apiAnalyticsService(...); + * $accounts = $analyticsService->accounts; + * + */ + class ManagementAccountsServiceResource extends apiServiceResource { + + + /** + * Lists all accounts to which the user has access. (accounts.list) + * + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param int max-results The maximum number of entries to include in this response. + * @opt_param int start-index An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter. + * @return Accounts + */ + public function listManagementAccounts($optParams = array()) { + $params = array(); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new Accounts($data); + } else { + return $data; + } + } + } + /** + * The "goals" collection of methods. + * Typical usage is: + * + * $analyticsService = new apiAnalyticsService(...); + * $goals = $analyticsService->goals; + * + */ + class ManagementGoalsServiceResource extends apiServiceResource { + + + /** + * Lists goals to which the user has access. (goals.list) + * + * @param string $accountId Account ID for the web properties to retrieve. Can either be a specific account ID or '~all', which refers to all the accounts to which the user has access. + * @param string $webPropertyId Web property ID for the web properties to retrieve. Can either be a specific web property ID or '~all', which refers to all the web properties to which the user has access. + * @param string $profileId Profile ID for the web properties to retrieve. Can either be a specific profile ID or '~all', which refers to all the profiles to which the user has access. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param int max-results The maximum number of entries to include in this response. + * @opt_param int start-index An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter. + * @return Goals + */ + public function listManagementGoals($accountId, $webPropertyId, $profileId, $optParams = array()) { + $params = array('accountId' => $accountId, 'webPropertyId' => $webPropertyId, 'profileId' => $profileId); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new Goals($data); + } else { + return $data; + } + } + } + /** + * The "profiles" collection of methods. + * Typical usage is: + * + * $analyticsService = new apiAnalyticsService(...); + * $profiles = $analyticsService->profiles; + * + */ + class ManagementProfilesServiceResource extends apiServiceResource { + + + /** + * Lists profiles to which the user has access. (profiles.list) + * + * @param string $accountId Account ID for the web properties to retrieve. Can either be a specific account ID or '~all', which refers to all the accounts to which the user has access. + * @param string $webPropertyId Web property ID for the web properties to retrieve. Can either be a specific web property ID or '~all', which refers to all the web properties to which the user has access. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param int max-results The maximum number of entries to include in this response. + * @opt_param int start-index An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter. + * @return Profiles + */ + public function listManagementProfiles($accountId, $webPropertyId, $optParams = array()) { + $params = array('accountId' => $accountId, 'webPropertyId' => $webPropertyId); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new Profiles($data); + } else { + return $data; + } + } + } + + /** + * The "data" collection of methods. + * Typical usage is: + * + * $analyticsService = new apiAnalyticsService(...); + * $data = $analyticsService->data; + * + */ + class DataServiceResource extends apiServiceResource { + + + } + + + /** + * The "ga" collection of methods. + * Typical usage is: + * + * $analyticsService = new apiAnalyticsService(...); + * $ga = $analyticsService->ga; + * + */ + class DataGaServiceResource extends apiServiceResource { + + + /** + * Returns Analytics data for a profile. (ga.get) + * + * @param string $ids Unique table ID for retrieving Analytics data. Table ID is of the form ga:XXXX, where XXXX is the Analytics profile ID. + * @param string $start_date Start date for fetching Analytics data. All requests should specify a start date formatted as YYYY-MM-DD. + * @param string $end_date End date for fetching Analytics data. All requests should specify an end date formatted as YYYY-MM-DD. + * @param string $metrics A comma-separated list of Analytics metrics. E.g., 'ga:visits,ga:pageviews'. At least one metric must be specified. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param int max-results The maximum number of entries to include in this feed. + * @opt_param string sort A comma-separated list of dimensions or metrics that determine the sort order for Analytics data. + * @opt_param string dimensions A comma-separated list of Analytics dimensions. E.g., 'ga:browser,ga:city'. + * @opt_param int start-index An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter. + * @opt_param string segment An Analytics advanced segment to be applied to data. + * @opt_param string filters A comma-separated list of dimension or metric filters to be applied to Analytics data. + * @return GaData + */ + public function get($ids, $start_date, $end_date, $metrics, $optParams = array()) { + $params = array('ids' => $ids, 'start-date' => $start_date, 'end-date' => $end_date, 'metrics' => $metrics); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new GaData($data); + } else { + return $data; + } + } + } + + + +/** + * Service definition for Analytics (v3). + * + *

+ * View and manage your Google Analytics data + *

+ * + *

+ * For more information about this service, see the + * API Documentation + *

+ * + * @author Google, Inc. + */ +class apiAnalyticsService extends apiService { + public $management_webproperties; + public $management_segments; + public $management_accounts; + public $management_goals; + public $management_profiles; + public $data_ga; + /** + * Constructs the internal representation of the Analytics service. + * + * @param apiClient apiClient + */ + public function __construct(apiClient $apiClient) { + $this->rpcPath = '/rpc'; + $this->restBasePath = '/analytics/v3/'; + $this->version = 'v3'; + $this->serviceName = 'analytics'; + + $apiClient->addService($this->serviceName, $this->version); + $this->management_webproperties = new ManagementWebpropertiesServiceResource($this, $this->serviceName, 'webproperties', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/analytics.readonly"], "parameters": {"max-results": {"format": "int32", "type": "integer", "location": "query"}, "start-index": {"format": "int32", "minimum": "1", "type": "integer", "location": "query"}, "accountId": {"required": true, "type": "string", "location": "path"}}, "id": "analytics.management.webproperties.list", "httpMethod": "GET", "path": "management/accounts/{accountId}/webproperties", "response": {"$ref": "Webproperties"}}}}', true)); + $this->management_segments = new ManagementSegmentsServiceResource($this, $this->serviceName, 'segments', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/analytics.readonly"], "parameters": {"max-results": {"format": "int32", "type": "integer", "location": "query"}, "start-index": {"format": "int32", "minimum": "1", "type": "integer", "location": "query"}}, "response": {"$ref": "Segments"}, "httpMethod": "GET", "path": "management/segments", "id": "analytics.management.segments.list"}}}', true)); + $this->management_accounts = new ManagementAccountsServiceResource($this, $this->serviceName, 'accounts', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/analytics.readonly"], "parameters": {"max-results": {"format": "int32", "type": "integer", "location": "query"}, "start-index": {"format": "int32", "minimum": "1", "type": "integer", "location": "query"}}, "response": {"$ref": "Accounts"}, "httpMethod": "GET", "path": "management/accounts", "id": "analytics.management.accounts.list"}}}', true)); + $this->management_goals = new ManagementGoalsServiceResource($this, $this->serviceName, 'goals', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/analytics.readonly"], "parameters": {"max-results": {"format": "int32", "type": "integer", "location": "query"}, "profileId": {"required": true, "type": "string", "location": "path"}, "start-index": {"format": "int32", "minimum": "1", "type": "integer", "location": "query"}, "accountId": {"required": true, "type": "string", "location": "path"}, "webPropertyId": {"required": true, "type": "string", "location": "path"}}, "id": "analytics.management.goals.list", "httpMethod": "GET", "path": "management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/goals", "response": {"$ref": "Goals"}}}}', true)); + $this->management_profiles = new ManagementProfilesServiceResource($this, $this->serviceName, 'profiles', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/analytics.readonly"], "parameters": {"max-results": {"format": "int32", "type": "integer", "location": "query"}, "start-index": {"format": "int32", "minimum": "1", "type": "integer", "location": "query"}, "accountId": {"required": true, "type": "string", "location": "path"}, "webPropertyId": {"required": true, "type": "string", "location": "path"}}, "id": "analytics.management.profiles.list", "httpMethod": "GET", "path": "management/accounts/{accountId}/webproperties/{webPropertyId}/profiles", "response": {"$ref": "Profiles"}}}}', true)); + $this->data_ga = new DataGaServiceResource($this, $this->serviceName, 'ga', json_decode('{"methods": {"get": {"scopes": ["https://www.googleapis.com/auth/analytics.readonly"], "parameters": {"max-results": {"format": "int32", "type": "integer", "location": "query"}, "sort": {"type": "string", "location": "query"}, "dimensions": {"type": "string", "location": "query"}, "start-date": {"required": true, "type": "string", "location": "query"}, "start-index": {"format": "int32", "minimum": "1", "type": "integer", "location": "query"}, "end-date": {"required": true, "type": "string", "location": "query"}, "ids": {"required": true, "type": "string", "location": "query"}, "metrics": {"required": true, "type": "string", "location": "query"}, "filters": {"type": "string", "location": "query"}, "segment": {"type": "string", "location": "query"}}, "id": "analytics.data.ga.get", "httpMethod": "GET", "path": "data/ga", "response": {"$ref": "GaData"}}}}', true)); + } +} + +class Account extends apiModel { + public $kind; + public $name; + public $created; + public $updated; + protected $__childLinkType = 'AccountChildLink'; + protected $__childLinkDataType = ''; + public $childLink; + public $id; + public $selfLink; + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setName($name) { + $this->name = $name; + } + public function getName() { + return $this->name; + } + public function setCreated($created) { + $this->created = $created; + } + public function getCreated() { + return $this->created; + } + public function setUpdated($updated) { + $this->updated = $updated; + } + public function getUpdated() { + return $this->updated; + } + public function setChildLink(AccountChildLink $childLink) { + $this->childLink = $childLink; + } + public function getChildLink() { + return $this->childLink; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setSelfLink($selfLink) { + $this->selfLink = $selfLink; + } + public function getSelfLink() { + return $this->selfLink; + } +} + +class AccountChildLink extends apiModel { + public $href; + public $type; + public function setHref($href) { + $this->href = $href; + } + public function getHref() { + return $this->href; + } + public function setType($type) { + $this->type = $type; + } + public function getType() { + return $this->type; + } +} + +class Accounts extends apiModel { + public $username; + public $kind; + protected $__itemsType = 'Account'; + protected $__itemsDataType = 'array'; + public $items; + public $itemsPerPage; + public $previousLink; + public $startIndex; + public $nextLink; + public $totalResults; + public function setUsername($username) { + $this->username = $username; + } + public function getUsername() { + return $this->username; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setItems(/* array(Account) */ $items) { + $this->assertIsArray($items, 'Account', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setItemsPerPage($itemsPerPage) { + $this->itemsPerPage = $itemsPerPage; + } + public function getItemsPerPage() { + return $this->itemsPerPage; + } + public function setPreviousLink($previousLink) { + $this->previousLink = $previousLink; + } + public function getPreviousLink() { + return $this->previousLink; + } + public function setStartIndex($startIndex) { + $this->startIndex = $startIndex; + } + public function getStartIndex() { + return $this->startIndex; + } + public function setNextLink($nextLink) { + $this->nextLink = $nextLink; + } + public function getNextLink() { + return $this->nextLink; + } + public function setTotalResults($totalResults) { + $this->totalResults = $totalResults; + } + public function getTotalResults() { + return $this->totalResults; + } +} + +class GaData extends apiModel { + public $kind; + public $rows; + public $containsSampledData; + public $totalResults; + public $itemsPerPage; + public $totalsForAllResults; + public $nextLink; + public $id; + protected $__queryType = 'GaDataQuery'; + protected $__queryDataType = ''; + public $query; + public $previousLink; + protected $__profileInfoType = 'GaDataProfileInfo'; + protected $__profileInfoDataType = ''; + public $profileInfo; + protected $__columnHeadersType = 'GaDataColumnHeaders'; + protected $__columnHeadersDataType = 'array'; + public $columnHeaders; + public $selfLink; + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setRows(/* array(string) */ $rows) { + $this->assertIsArray($rows, 'string', __METHOD__); + $this->rows = $rows; + } + public function getRows() { + return $this->rows; + } + public function setContainsSampledData($containsSampledData) { + $this->containsSampledData = $containsSampledData; + } + public function getContainsSampledData() { + return $this->containsSampledData; + } + public function setTotalResults($totalResults) { + $this->totalResults = $totalResults; + } + public function getTotalResults() { + return $this->totalResults; + } + public function setItemsPerPage($itemsPerPage) { + $this->itemsPerPage = $itemsPerPage; + } + public function getItemsPerPage() { + return $this->itemsPerPage; + } + public function setTotalsForAllResults($totalsForAllResults) { + $this->totalsForAllResults = $totalsForAllResults; + } + public function getTotalsForAllResults() { + return $this->totalsForAllResults; + } + public function setNextLink($nextLink) { + $this->nextLink = $nextLink; + } + public function getNextLink() { + return $this->nextLink; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setQuery(GaDataQuery $query) { + $this->query = $query; + } + public function getQuery() { + return $this->query; + } + public function setPreviousLink($previousLink) { + $this->previousLink = $previousLink; + } + public function getPreviousLink() { + return $this->previousLink; + } + public function setProfileInfo(GaDataProfileInfo $profileInfo) { + $this->profileInfo = $profileInfo; + } + public function getProfileInfo() { + return $this->profileInfo; + } + public function setColumnHeaders(/* array(GaDataColumnHeaders) */ $columnHeaders) { + $this->assertIsArray($columnHeaders, 'GaDataColumnHeaders', __METHOD__); + $this->columnHeaders = $columnHeaders; + } + public function getColumnHeaders() { + return $this->columnHeaders; + } + public function setSelfLink($selfLink) { + $this->selfLink = $selfLink; + } + public function getSelfLink() { + return $this->selfLink; + } +} + +class GaDataColumnHeaders extends apiModel { + public $dataType; + public $columnType; + public $name; + public function setDataType($dataType) { + $this->dataType = $dataType; + } + public function getDataType() { + return $this->dataType; + } + public function setColumnType($columnType) { + $this->columnType = $columnType; + } + public function getColumnType() { + return $this->columnType; + } + public function setName($name) { + $this->name = $name; + } + public function getName() { + return $this->name; + } +} + +class GaDataProfileInfo extends apiModel { + public $webPropertyId; + public $internalWebPropertyId; + public $tableId; + public $profileId; + public $profileName; + public $accountId; + public function setWebPropertyId($webPropertyId) { + $this->webPropertyId = $webPropertyId; + } + public function getWebPropertyId() { + return $this->webPropertyId; + } + public function setInternalWebPropertyId($internalWebPropertyId) { + $this->internalWebPropertyId = $internalWebPropertyId; + } + public function getInternalWebPropertyId() { + return $this->internalWebPropertyId; + } + public function setTableId($tableId) { + $this->tableId = $tableId; + } + public function getTableId() { + return $this->tableId; + } + public function setProfileId($profileId) { + $this->profileId = $profileId; + } + public function getProfileId() { + return $this->profileId; + } + public function setProfileName($profileName) { + $this->profileName = $profileName; + } + public function getProfileName() { + return $this->profileName; + } + public function setAccountId($accountId) { + $this->accountId = $accountId; + } + public function getAccountId() { + return $this->accountId; + } +} + +class GaDataQuery extends apiModel { + public $max_results; + public $sort; + public $dimensions; + public $start_date; + public $start_index; + public $segment; + public $ids; + public $metrics; + public $filters; + public $end_date; + public function setMax_results($max_results) { + $this->max_results = $max_results; + } + public function getMax_results() { + return $this->max_results; + } + public function setSort(/* array(string) */ $sort) { + $this->assertIsArray($sort, 'string', __METHOD__); + $this->sort = $sort; + } + public function getSort() { + return $this->sort; + } + public function setDimensions($dimensions) { + $this->dimensions = $dimensions; + } + public function getDimensions() { + return $this->dimensions; + } + public function setStart_date($start_date) { + $this->start_date = $start_date; + } + public function getStart_date() { + return $this->start_date; + } + public function setStart_index($start_index) { + $this->start_index = $start_index; + } + public function getStart_index() { + return $this->start_index; + } + public function setSegment($segment) { + $this->segment = $segment; + } + public function getSegment() { + return $this->segment; + } + public function setIds($ids) { + $this->ids = $ids; + } + public function getIds() { + return $this->ids; + } + public function setMetrics(/* array(string) */ $metrics) { + $this->assertIsArray($metrics, 'string', __METHOD__); + $this->metrics = $metrics; + } + public function getMetrics() { + return $this->metrics; + } + public function setFilters($filters) { + $this->filters = $filters; + } + public function getFilters() { + return $this->filters; + } + public function setEnd_date($end_date) { + $this->end_date = $end_date; + } + public function getEnd_date() { + return $this->end_date; + } +} + +class Goal extends apiModel { + public $kind; + protected $__visitTimeOnSiteDetailsType = 'GoalVisitTimeOnSiteDetails'; + protected $__visitTimeOnSiteDetailsDataType = ''; + public $visitTimeOnSiteDetails; + public $name; + public $created; + protected $__urlDestinationDetailsType = 'GoalUrlDestinationDetails'; + protected $__urlDestinationDetailsDataType = ''; + public $urlDestinationDetails; + public $updated; + public $value; + protected $__visitNumPagesDetailsType = 'GoalVisitNumPagesDetails'; + protected $__visitNumPagesDetailsDataType = ''; + public $visitNumPagesDetails; + public $internalWebPropertyId; + protected $__eventDetailsType = 'GoalEventDetails'; + protected $__eventDetailsDataType = ''; + public $eventDetails; + public $webPropertyId; + public $active; + public $profileId; + protected $__parentLinkType = 'GoalParentLink'; + protected $__parentLinkDataType = ''; + public $parentLink; + public $type; + public $id; + public $selfLink; + public $accountId; + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setVisitTimeOnSiteDetails(GoalVisitTimeOnSiteDetails $visitTimeOnSiteDetails) { + $this->visitTimeOnSiteDetails = $visitTimeOnSiteDetails; + } + public function getVisitTimeOnSiteDetails() { + return $this->visitTimeOnSiteDetails; + } + public function setName($name) { + $this->name = $name; + } + public function getName() { + return $this->name; + } + public function setCreated($created) { + $this->created = $created; + } + public function getCreated() { + return $this->created; + } + public function setUrlDestinationDetails(GoalUrlDestinationDetails $urlDestinationDetails) { + $this->urlDestinationDetails = $urlDestinationDetails; + } + public function getUrlDestinationDetails() { + return $this->urlDestinationDetails; + } + public function setUpdated($updated) { + $this->updated = $updated; + } + public function getUpdated() { + return $this->updated; + } + public function setValue($value) { + $this->value = $value; + } + public function getValue() { + return $this->value; + } + public function setVisitNumPagesDetails(GoalVisitNumPagesDetails $visitNumPagesDetails) { + $this->visitNumPagesDetails = $visitNumPagesDetails; + } + public function getVisitNumPagesDetails() { + return $this->visitNumPagesDetails; + } + public function setInternalWebPropertyId($internalWebPropertyId) { + $this->internalWebPropertyId = $internalWebPropertyId; + } + public function getInternalWebPropertyId() { + return $this->internalWebPropertyId; + } + public function setEventDetails(GoalEventDetails $eventDetails) { + $this->eventDetails = $eventDetails; + } + public function getEventDetails() { + return $this->eventDetails; + } + public function setWebPropertyId($webPropertyId) { + $this->webPropertyId = $webPropertyId; + } + public function getWebPropertyId() { + return $this->webPropertyId; + } + public function setActive($active) { + $this->active = $active; + } + public function getActive() { + return $this->active; + } + public function setProfileId($profileId) { + $this->profileId = $profileId; + } + public function getProfileId() { + return $this->profileId; + } + public function setParentLink(GoalParentLink $parentLink) { + $this->parentLink = $parentLink; + } + public function getParentLink() { + return $this->parentLink; + } + public function setType($type) { + $this->type = $type; + } + public function getType() { + return $this->type; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setSelfLink($selfLink) { + $this->selfLink = $selfLink; + } + public function getSelfLink() { + return $this->selfLink; + } + public function setAccountId($accountId) { + $this->accountId = $accountId; + } + public function getAccountId() { + return $this->accountId; + } +} + +class GoalEventDetails extends apiModel { + protected $__eventConditionsType = 'GoalEventDetailsEventConditions'; + protected $__eventConditionsDataType = 'array'; + public $eventConditions; + public $useEventValue; + public function setEventConditions(/* array(GoalEventDetailsEventConditions) */ $eventConditions) { + $this->assertIsArray($eventConditions, 'GoalEventDetailsEventConditions', __METHOD__); + $this->eventConditions = $eventConditions; + } + public function getEventConditions() { + return $this->eventConditions; + } + public function setUseEventValue($useEventValue) { + $this->useEventValue = $useEventValue; + } + public function getUseEventValue() { + return $this->useEventValue; + } +} + +class GoalEventDetailsEventConditions extends apiModel { + public $type; + public $matchType; + public $expression; + public $comparisonType; + public $comparisonValue; + public function setType($type) { + $this->type = $type; + } + public function getType() { + return $this->type; + } + public function setMatchType($matchType) { + $this->matchType = $matchType; + } + public function getMatchType() { + return $this->matchType; + } + public function setExpression($expression) { + $this->expression = $expression; + } + public function getExpression() { + return $this->expression; + } + public function setComparisonType($comparisonType) { + $this->comparisonType = $comparisonType; + } + public function getComparisonType() { + return $this->comparisonType; + } + public function setComparisonValue($comparisonValue) { + $this->comparisonValue = $comparisonValue; + } + public function getComparisonValue() { + return $this->comparisonValue; + } +} + +class GoalParentLink extends apiModel { + public $href; + public $type; + public function setHref($href) { + $this->href = $href; + } + public function getHref() { + return $this->href; + } + public function setType($type) { + $this->type = $type; + } + public function getType() { + return $this->type; + } +} + +class GoalUrlDestinationDetails extends apiModel { + public $url; + public $caseSensitive; + public $matchType; + protected $__stepsType = 'GoalUrlDestinationDetailsSteps'; + protected $__stepsDataType = 'array'; + public $steps; + public $firstStepRequired; + public function setUrl($url) { + $this->url = $url; + } + public function getUrl() { + return $this->url; + } + public function setCaseSensitive($caseSensitive) { + $this->caseSensitive = $caseSensitive; + } + public function getCaseSensitive() { + return $this->caseSensitive; + } + public function setMatchType($matchType) { + $this->matchType = $matchType; + } + public function getMatchType() { + return $this->matchType; + } + public function setSteps(/* array(GoalUrlDestinationDetailsSteps) */ $steps) { + $this->assertIsArray($steps, 'GoalUrlDestinationDetailsSteps', __METHOD__); + $this->steps = $steps; + } + public function getSteps() { + return $this->steps; + } + public function setFirstStepRequired($firstStepRequired) { + $this->firstStepRequired = $firstStepRequired; + } + public function getFirstStepRequired() { + return $this->firstStepRequired; + } +} + +class GoalUrlDestinationDetailsSteps extends apiModel { + public $url; + public $name; + public $number; + public function setUrl($url) { + $this->url = $url; + } + public function getUrl() { + return $this->url; + } + public function setName($name) { + $this->name = $name; + } + public function getName() { + return $this->name; + } + public function setNumber($number) { + $this->number = $number; + } + public function getNumber() { + return $this->number; + } +} + +class GoalVisitNumPagesDetails extends apiModel { + public $comparisonType; + public $comparisonValue; + public function setComparisonType($comparisonType) { + $this->comparisonType = $comparisonType; + } + public function getComparisonType() { + return $this->comparisonType; + } + public function setComparisonValue($comparisonValue) { + $this->comparisonValue = $comparisonValue; + } + public function getComparisonValue() { + return $this->comparisonValue; + } +} + +class GoalVisitTimeOnSiteDetails extends apiModel { + public $comparisonType; + public $comparisonValue; + public function setComparisonType($comparisonType) { + $this->comparisonType = $comparisonType; + } + public function getComparisonType() { + return $this->comparisonType; + } + public function setComparisonValue($comparisonValue) { + $this->comparisonValue = $comparisonValue; + } + public function getComparisonValue() { + return $this->comparisonValue; + } +} + +class Goals extends apiModel { + public $username; + public $kind; + protected $__itemsType = 'Goal'; + protected $__itemsDataType = 'array'; + public $items; + public $itemsPerPage; + public $previousLink; + public $startIndex; + public $nextLink; + public $totalResults; + public function setUsername($username) { + $this->username = $username; + } + public function getUsername() { + return $this->username; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setItems(/* array(Goal) */ $items) { + $this->assertIsArray($items, 'Goal', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setItemsPerPage($itemsPerPage) { + $this->itemsPerPage = $itemsPerPage; + } + public function getItemsPerPage() { + return $this->itemsPerPage; + } + public function setPreviousLink($previousLink) { + $this->previousLink = $previousLink; + } + public function getPreviousLink() { + return $this->previousLink; + } + public function setStartIndex($startIndex) { + $this->startIndex = $startIndex; + } + public function getStartIndex() { + return $this->startIndex; + } + public function setNextLink($nextLink) { + $this->nextLink = $nextLink; + } + public function getNextLink() { + return $this->nextLink; + } + public function setTotalResults($totalResults) { + $this->totalResults = $totalResults; + } + public function getTotalResults() { + return $this->totalResults; + } +} + +class Profile extends apiModel { + public $defaultPage; + public $kind; + public $excludeQueryParameters; + public $name; + public $created; + public $webPropertyId; + public $updated; + public $siteSearchQueryParameters; + public $currency; + public $internalWebPropertyId; + protected $__childLinkType = 'ProfileChildLink'; + protected $__childLinkDataType = ''; + public $childLink; + public $timezone; + public $siteSearchCategoryParameters; + protected $__parentLinkType = 'ProfileParentLink'; + protected $__parentLinkDataType = ''; + public $parentLink; + public $id; + public $selfLink; + public $accountId; + public function setDefaultPage($defaultPage) { + $this->defaultPage = $defaultPage; + } + public function getDefaultPage() { + return $this->defaultPage; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setExcludeQueryParameters($excludeQueryParameters) { + $this->excludeQueryParameters = $excludeQueryParameters; + } + public function getExcludeQueryParameters() { + return $this->excludeQueryParameters; + } + public function setName($name) { + $this->name = $name; + } + public function getName() { + return $this->name; + } + public function setCreated($created) { + $this->created = $created; + } + public function getCreated() { + return $this->created; + } + public function setWebPropertyId($webPropertyId) { + $this->webPropertyId = $webPropertyId; + } + public function getWebPropertyId() { + return $this->webPropertyId; + } + public function setUpdated($updated) { + $this->updated = $updated; + } + public function getUpdated() { + return $this->updated; + } + public function setSiteSearchQueryParameters($siteSearchQueryParameters) { + $this->siteSearchQueryParameters = $siteSearchQueryParameters; + } + public function getSiteSearchQueryParameters() { + return $this->siteSearchQueryParameters; + } + public function setCurrency($currency) { + $this->currency = $currency; + } + public function getCurrency() { + return $this->currency; + } + public function setInternalWebPropertyId($internalWebPropertyId) { + $this->internalWebPropertyId = $internalWebPropertyId; + } + public function getInternalWebPropertyId() { + return $this->internalWebPropertyId; + } + public function setChildLink(ProfileChildLink $childLink) { + $this->childLink = $childLink; + } + public function getChildLink() { + return $this->childLink; + } + public function setTimezone($timezone) { + $this->timezone = $timezone; + } + public function getTimezone() { + return $this->timezone; + } + public function setSiteSearchCategoryParameters($siteSearchCategoryParameters) { + $this->siteSearchCategoryParameters = $siteSearchCategoryParameters; + } + public function getSiteSearchCategoryParameters() { + return $this->siteSearchCategoryParameters; + } + public function setParentLink(ProfileParentLink $parentLink) { + $this->parentLink = $parentLink; + } + public function getParentLink() { + return $this->parentLink; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setSelfLink($selfLink) { + $this->selfLink = $selfLink; + } + public function getSelfLink() { + return $this->selfLink; + } + public function setAccountId($accountId) { + $this->accountId = $accountId; + } + public function getAccountId() { + return $this->accountId; + } +} + +class ProfileChildLink extends apiModel { + public $href; + public $type; + public function setHref($href) { + $this->href = $href; + } + public function getHref() { + return $this->href; + } + public function setType($type) { + $this->type = $type; + } + public function getType() { + return $this->type; + } +} + +class ProfileParentLink extends apiModel { + public $href; + public $type; + public function setHref($href) { + $this->href = $href; + } + public function getHref() { + return $this->href; + } + public function setType($type) { + $this->type = $type; + } + public function getType() { + return $this->type; + } +} + +class Profiles extends apiModel { + public $username; + public $kind; + protected $__itemsType = 'Profile'; + protected $__itemsDataType = 'array'; + public $items; + public $itemsPerPage; + public $previousLink; + public $startIndex; + public $nextLink; + public $totalResults; + public function setUsername($username) { + $this->username = $username; + } + public function getUsername() { + return $this->username; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setItems(/* array(Profile) */ $items) { + $this->assertIsArray($items, 'Profile', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setItemsPerPage($itemsPerPage) { + $this->itemsPerPage = $itemsPerPage; + } + public function getItemsPerPage() { + return $this->itemsPerPage; + } + public function setPreviousLink($previousLink) { + $this->previousLink = $previousLink; + } + public function getPreviousLink() { + return $this->previousLink; + } + public function setStartIndex($startIndex) { + $this->startIndex = $startIndex; + } + public function getStartIndex() { + return $this->startIndex; + } + public function setNextLink($nextLink) { + $this->nextLink = $nextLink; + } + public function getNextLink() { + return $this->nextLink; + } + public function setTotalResults($totalResults) { + $this->totalResults = $totalResults; + } + public function getTotalResults() { + return $this->totalResults; + } +} + +class Segment extends apiModel { + public $definition; + public $kind; + public $segmentId; + public $created; + public $updated; + public $id; + public $selfLink; + public $name; + public function setDefinition($definition) { + $this->definition = $definition; + } + public function getDefinition() { + return $this->definition; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setSegmentId($segmentId) { + $this->segmentId = $segmentId; + } + public function getSegmentId() { + return $this->segmentId; + } + public function setCreated($created) { + $this->created = $created; + } + public function getCreated() { + return $this->created; + } + public function setUpdated($updated) { + $this->updated = $updated; + } + public function getUpdated() { + return $this->updated; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setSelfLink($selfLink) { + $this->selfLink = $selfLink; + } + public function getSelfLink() { + return $this->selfLink; + } + public function setName($name) { + $this->name = $name; + } + public function getName() { + return $this->name; + } +} + +class Segments extends apiModel { + public $username; + public $kind; + protected $__itemsType = 'Segment'; + protected $__itemsDataType = 'array'; + public $items; + public $itemsPerPage; + public $previousLink; + public $startIndex; + public $nextLink; + public $totalResults; + public function setUsername($username) { + $this->username = $username; + } + public function getUsername() { + return $this->username; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setItems(/* array(Segment) */ $items) { + $this->assertIsArray($items, 'Segment', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setItemsPerPage($itemsPerPage) { + $this->itemsPerPage = $itemsPerPage; + } + public function getItemsPerPage() { + return $this->itemsPerPage; + } + public function setPreviousLink($previousLink) { + $this->previousLink = $previousLink; + } + public function getPreviousLink() { + return $this->previousLink; + } + public function setStartIndex($startIndex) { + $this->startIndex = $startIndex; + } + public function getStartIndex() { + return $this->startIndex; + } + public function setNextLink($nextLink) { + $this->nextLink = $nextLink; + } + public function getNextLink() { + return $this->nextLink; + } + public function setTotalResults($totalResults) { + $this->totalResults = $totalResults; + } + public function getTotalResults() { + return $this->totalResults; + } +} + +class Webproperties extends apiModel { + public $username; + public $kind; + protected $__itemsType = 'Webproperty'; + protected $__itemsDataType = 'array'; + public $items; + public $itemsPerPage; + public $previousLink; + public $startIndex; + public $nextLink; + public $totalResults; + public function setUsername($username) { + $this->username = $username; + } + public function getUsername() { + return $this->username; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setItems(/* array(Webproperty) */ $items) { + $this->assertIsArray($items, 'Webproperty', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setItemsPerPage($itemsPerPage) { + $this->itemsPerPage = $itemsPerPage; + } + public function getItemsPerPage() { + return $this->itemsPerPage; + } + public function setPreviousLink($previousLink) { + $this->previousLink = $previousLink; + } + public function getPreviousLink() { + return $this->previousLink; + } + public function setStartIndex($startIndex) { + $this->startIndex = $startIndex; + } + public function getStartIndex() { + return $this->startIndex; + } + public function setNextLink($nextLink) { + $this->nextLink = $nextLink; + } + public function getNextLink() { + return $this->nextLink; + } + public function setTotalResults($totalResults) { + $this->totalResults = $totalResults; + } + public function getTotalResults() { + return $this->totalResults; + } +} + +class Webproperty extends apiModel { + public $kind; + public $name; + public $created; + public $updated; + public $websiteUrl; + public $internalWebPropertyId; + protected $__childLinkType = 'WebpropertyChildLink'; + protected $__childLinkDataType = ''; + public $childLink; + protected $__parentLinkType = 'WebpropertyParentLink'; + protected $__parentLinkDataType = ''; + public $parentLink; + public $id; + public $selfLink; + public $accountId; + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setName($name) { + $this->name = $name; + } + public function getName() { + return $this->name; + } + public function setCreated($created) { + $this->created = $created; + } + public function getCreated() { + return $this->created; + } + public function setUpdated($updated) { + $this->updated = $updated; + } + public function getUpdated() { + return $this->updated; + } + public function setWebsiteUrl($websiteUrl) { + $this->websiteUrl = $websiteUrl; + } + public function getWebsiteUrl() { + return $this->websiteUrl; + } + public function setInternalWebPropertyId($internalWebPropertyId) { + $this->internalWebPropertyId = $internalWebPropertyId; + } + public function getInternalWebPropertyId() { + return $this->internalWebPropertyId; + } + public function setChildLink(WebpropertyChildLink $childLink) { + $this->childLink = $childLink; + } + public function getChildLink() { + return $this->childLink; + } + public function setParentLink(WebpropertyParentLink $parentLink) { + $this->parentLink = $parentLink; + } + public function getParentLink() { + return $this->parentLink; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setSelfLink($selfLink) { + $this->selfLink = $selfLink; + } + public function getSelfLink() { + return $this->selfLink; + } + public function setAccountId($accountId) { + $this->accountId = $accountId; + } + public function getAccountId() { + return $this->accountId; + } +} + +class WebpropertyChildLink extends apiModel { + public $href; + public $type; + public function setHref($href) { + $this->href = $href; + } + public function getHref() { + return $this->href; + } + public function setType($type) { + $this->type = $type; + } + public function getType() { + return $this->type; + } +} + +class WebpropertyParentLink extends apiModel { + public $href; + public $type; + public function setHref($href) { + $this->href = $href; + } + public function getHref() { + return $this->href; + } + public function setType($type) { + $this->type = $type; + } + public function getType() { + return $this->type; + } +} diff --git a/webui/google-api/contrib/apiBigqueryService.php b/webui/google-api/contrib/apiBigqueryService.php new file mode 100644 index 0000000..8c3b2b6 --- /dev/null +++ b/webui/google-api/contrib/apiBigqueryService.php @@ -0,0 +1,1741 @@ + + * $bigqueryService = new apiBigqueryService(...); + * $tables = $bigqueryService->tables; + * + */ + class TablesServiceResource extends apiServiceResource { + + + /** + * Creates a new, empty table in the dataset. (tables.insert) + * + * @param Table $postBody + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string projectId Project ID of the new table + * @opt_param string datasetId Dataset ID of the new table + * @return Table + */ + public function insert(Table $postBody, $optParams = array()) { + $params = array('postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('insert', array($params)); + if ($this->useObjects()) { + return new Table($data); + } else { + return $data; + } + } + /** + * Gets the specified table resource by table ID. This method does not return the data in the table, + * it only returns the table resource, which describes the structure of this table. (tables.get) + * + * @param string $projectId Project ID of the requested table + * @param string $datasetId Dataset ID of the requested table + * @param string $tableId Table ID of the requested table + * @return Table + */ + public function get($projectId, $datasetId, $tableId, $optParams = array()) { + $params = array('projectId' => $projectId, 'datasetId' => $datasetId, 'tableId' => $tableId); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new Table($data); + } else { + return $data; + } + } + /** + * Lists all tables in the specified dataset. (tables.list) + * + * @param string $projectId Project ID of the tables to list + * @param string $datasetId Dataset ID of the tables to list + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string pageToken Page token, returned by a previous call, to request the next page of results + * @opt_param string maxResults Maximum number of results to return + * @return TableList + */ + public function listTables($projectId, $datasetId, $optParams = array()) { + $params = array('projectId' => $projectId, 'datasetId' => $datasetId); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new TableList($data); + } else { + return $data; + } + } + /** + * Updates information in an existing table, specified by tableId. (tables.update) + * + * @param Table $postBody + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string projectId Project ID of the table to update + * @opt_param string datasetId Dataset ID of the table to update + * @opt_param string tableId Table ID of the table to update + * @return Table + */ + public function update(Table $postBody, $optParams = array()) { + $params = array('postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('update', array($params)); + if ($this->useObjects()) { + return new Table($data); + } else { + return $data; + } + } + /** + * Updates information in an existing table, specified by tableId. This method supports patch + * semantics. (tables.patch) + * + * @param string $projectId Project ID of the table to update + * @param string $datasetId Dataset ID of the table to update + * @param string $tableId Table ID of the table to update + * @param Table $postBody + * @return Table + */ + public function patch($projectId, $datasetId, $tableId, Table $postBody, $optParams = array()) { + $params = array('projectId' => $projectId, 'datasetId' => $datasetId, 'tableId' => $tableId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('patch', array($params)); + if ($this->useObjects()) { + return new Table($data); + } else { + return $data; + } + } + /** + * Deletes the table specified by tableId from the dataset. If the table contains data, all the data + * will be deleted. (tables.delete) + * + * @param string $projectId Project ID of the table to delete + * @param string $datasetId Dataset ID of the table to delete + * @param string $tableId Table ID of the table to delete + */ + public function delete($projectId, $datasetId, $tableId, $optParams = array()) { + $params = array('projectId' => $projectId, 'datasetId' => $datasetId, 'tableId' => $tableId); + $params = array_merge($params, $optParams); + $data = $this->__call('delete', array($params)); + return $data; + } + } + + /** + * The "datasets" collection of methods. + * Typical usage is: + * + * $bigqueryService = new apiBigqueryService(...); + * $datasets = $bigqueryService->datasets; + * + */ + class DatasetsServiceResource extends apiServiceResource { + + + /** + * Creates a new empty dataset. (datasets.insert) + * + * @param Dataset $postBody + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string projectId Project ID of the new dataset + * @return Dataset + */ + public function insert(Dataset $postBody, $optParams = array()) { + $params = array('postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('insert', array($params)); + if ($this->useObjects()) { + return new Dataset($data); + } else { + return $data; + } + } + /** + * Returns the dataset specified by datasetID. (datasets.get) + * + * @param string $projectId Project ID of the requested dataset + * @param string $datasetId Dataset ID of the requested dataset + * @return Dataset + */ + public function get($projectId, $datasetId, $optParams = array()) { + $params = array('projectId' => $projectId, 'datasetId' => $datasetId); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new Dataset($data); + } else { + return $data; + } + } + /** + * Lists all the datasets in the specified project to which the caller has read access; however, a + * project owner can list (but not necessarily get) all datasets in his project. (datasets.list) + * + * @param string $projectId Project ID of the datasets to be listed + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string pageToken Page token, returned by a previous call, to request the next page of results + * @opt_param string maxResults The maximum number of results to return + * @return DatasetList + */ + public function listDatasets($projectId, $optParams = array()) { + $params = array('projectId' => $projectId); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new DatasetList($data); + } else { + return $data; + } + } + /** + * Updates information in an existing dataset, specified by datasetId. Properties not included in + * the submitted resource will not be changed. If you include the access property without any values + * assigned, the request will fail as you must specify at least one owner for a dataset. + * (datasets.update) + * + * @param Dataset $postBody + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string projectId Project ID of the dataset being updated + * @opt_param string datasetId Dataset ID of the dataset being updated + * @return Dataset + */ + public function update(Dataset $postBody, $optParams = array()) { + $params = array('postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('update', array($params)); + if ($this->useObjects()) { + return new Dataset($data); + } else { + return $data; + } + } + /** + * Updates information in an existing dataset, specified by datasetId. Properties not included in + * the submitted resource will not be changed. If you include the access property without any values + * assigned, the request will fail as you must specify at least one owner for a dataset. This method + * supports patch semantics. (datasets.patch) + * + * @param string $projectId Project ID of the dataset being updated + * @param string $datasetId Dataset ID of the dataset being updated + * @param Dataset $postBody + * @return Dataset + */ + public function patch($projectId, $datasetId, Dataset $postBody, $optParams = array()) { + $params = array('projectId' => $projectId, 'datasetId' => $datasetId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('patch', array($params)); + if ($this->useObjects()) { + return new Dataset($data); + } else { + return $data; + } + } + /** + * Deletes the dataset specified by datasetId value. Before you can delete a dataset, you must + * delete all its tables, either manually or by specifying deleteContents. Immediately after + * deletion, you can create another dataset with the same name. (datasets.delete) + * + * @param string $projectId Project ID of the dataset being deleted + * @param string $datasetId Dataset ID of dataset being deleted + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param bool deleteContents If True, delete all the tables in the dataset. If False and the dataset contains tables, the request will fail. Default is False + */ + public function delete($projectId, $datasetId, $optParams = array()) { + $params = array('projectId' => $projectId, 'datasetId' => $datasetId); + $params = array_merge($params, $optParams); + $data = $this->__call('delete', array($params)); + return $data; + } + } + + /** + * The "jobs" collection of methods. + * Typical usage is: + * + * $bigqueryService = new apiBigqueryService(...); + * $jobs = $bigqueryService->jobs; + * + */ + class JobsServiceResource extends apiServiceResource { + + + /** + * Starts a new asynchronous job. (jobs.insert) + * + * @param Job $postBody + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string projectId Project ID of the project that will be billed for the job + * @return Job + */ + public function insert(Job $postBody, $optParams = array()) { + $params = array('postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('insert', array($params)); + if ($this->useObjects()) { + return new Job($data); + } else { + return $data; + } + } + /** + * Retrieves the specified job by ID. (jobs.get) + * + * @param string $projectId Project ID of the requested job + * @param string $jobId Job ID of the requested job + * @return Job + */ + public function get($projectId, $jobId, $optParams = array()) { + $params = array('projectId' => $projectId, 'jobId' => $jobId); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new Job($data); + } else { + return $data; + } + } + /** + * Lists all the Jobs in the specified project that were started by the user. (jobs.list) + * + * @param string $projectId Project ID of the jobs to list + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string projection Restrict information returned to a set of selected fields + * @opt_param string stateFilter Filter for job state + * @opt_param bool allUsers Whether to display jobs owned by all users in the project. Default false + * @opt_param string maxResults Maximum number of results to return + * @opt_param string pageToken Page token, returned by a previous call, to request the next page of results + * @return JobList + */ + public function listJobs($projectId, $optParams = array()) { + $params = array('projectId' => $projectId); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new JobList($data); + } else { + return $data; + } + } + /** + * Runs a BigQuery SQL query synchronously and returns query results if the query completes within a + * specified timeout. (jobs.query) + * + * @param string $projectId Project ID of the project billed for the query + * @param QueryRequest $postBody + * @return QueryResponse + */ + public function query($projectId, QueryRequest $postBody, $optParams = array()) { + $params = array('projectId' => $projectId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('query', array($params)); + if ($this->useObjects()) { + return new QueryResponse($data); + } else { + return $data; + } + } + /** + * Retrieves the results of a query job. (jobs.getQueryResults) + * + * @param string $projectId Project ID of the query job + * @param string $jobId Job ID of the query job + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string timeoutMs How long to wait for the query to complete, in milliseconds, before returning. Default is to return immediately. If the timeout passes before the job completes, the request will fail with a TIMEOUT error + * @opt_param string startIndex Zero-based index of the starting row + * @opt_param string maxResults Maximum number of results to read + * @return GetQueryResultsResponse + */ + public function getQueryResults($projectId, $jobId, $optParams = array()) { + $params = array('projectId' => $projectId, 'jobId' => $jobId); + $params = array_merge($params, $optParams); + $data = $this->__call('getQueryResults', array($params)); + if ($this->useObjects()) { + return new GetQueryResultsResponse($data); + } else { + return $data; + } + } + /** + * Deletes a completed job specified by job ID. (jobs.delete) + * + * @param string $projectId Project ID of the job to delete + * @param string $jobId Job ID of the job to delete + */ + public function delete($projectId, $jobId, $optParams = array()) { + $params = array('projectId' => $projectId, 'jobId' => $jobId); + $params = array_merge($params, $optParams); + $data = $this->__call('delete', array($params)); + return $data; + } + } + + /** + * The "tabledata" collection of methods. + * Typical usage is: + * + * $bigqueryService = new apiBigqueryService(...); + * $tabledata = $bigqueryService->tabledata; + * + */ + class TabledataServiceResource extends apiServiceResource { + + + /** + * Retrieves table data from a specified set of rows. (tabledata.list) + * + * @param string $projectId Project ID of the table to read + * @param string $datasetId Dataset ID of the table to read + * @param string $tableId Table ID of the table to read + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string startIndex Zero-based index of the starting row to read + * @opt_param string maxResults Maximum number of results to return + * @return TableDataList + */ + public function listTabledata($projectId, $datasetId, $tableId, $optParams = array()) { + $params = array('projectId' => $projectId, 'datasetId' => $datasetId, 'tableId' => $tableId); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new TableDataList($data); + } else { + return $data; + } + } + } + + /** + * The "projects" collection of methods. + * Typical usage is: + * + * $bigqueryService = new apiBigqueryService(...); + * $projects = $bigqueryService->projects; + * + */ + class ProjectsServiceResource extends apiServiceResource { + + + /** + * Lists the projects to which you have at least read access. (projects.list) + * + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string pageToken Page token, returned by a previous call, to request the next page of results + * @opt_param string maxResults Maximum number of results to return + * @return ProjectList + */ + public function listProjects($optParams = array()) { + $params = array(); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new ProjectList($data); + } else { + return $data; + } + } + } + +/** + * Service definition for Bigquery (v2). + * + *

+ * A data platform for customers to create, manage, share and query data. + *

+ * + *

+ * For more information about this service, see the + * API Documentation + *

+ * + * @author Google, Inc. + */ +class apiBigqueryService extends apiService { + public $tables; + public $datasets; + public $jobs; + public $tabledata; + public $projects; + /** + * Constructs the internal representation of the Bigquery service. + * + * @param apiClient apiClient + */ + public function __construct(apiClient $apiClient) { + $this->rpcPath = '/rpc'; + $this->restBasePath = '/bigquery/v2/'; + $this->version = 'v2'; + $this->serviceName = 'bigquery'; + + $apiClient->addService($this->serviceName, $this->version); + $this->tables = new TablesServiceResource($this, $this->serviceName, 'tables', json_decode('{"methods": {"insert": {"scopes": ["https://www.googleapis.com/auth/bigquery"], "parameters": {"projectId": {"type": "string", "location": "path"}, "datasetId": {"type": "string", "location": "path"}}, "request": {"$ref": "Table"}, "id": "bigquery.tables.insert", "httpMethod": "POST", "path": "projects/{projectId}/datasets/{datasetId}/tables", "response": {"$ref": "Table"}}, "get": {"scopes": ["https://www.googleapis.com/auth/bigquery"], "parameters": {"projectId": {"required": true, "type": "string", "location": "path"}, "tableId": {"required": true, "type": "string", "location": "path"}, "datasetId": {"required": true, "type": "string", "location": "path"}}, "id": "bigquery.tables.get", "httpMethod": "GET", "path": "projects/{projectId}/datasets/{datasetId}/tables/{tableId}", "response": {"$ref": "Table"}}, "list": {"scopes": ["https://www.googleapis.com/auth/bigquery"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "datasetId": {"required": true, "type": "string", "location": "path"}, "maxResults": {"format": "uint32", "type": "integer", "location": "query"}, "projectId": {"required": true, "type": "string", "location": "path"}}, "id": "bigquery.tables.list", "httpMethod": "GET", "path": "projects/{projectId}/datasets/{datasetId}/tables", "response": {"$ref": "TableList"}}, "update": {"scopes": ["https://www.googleapis.com/auth/bigquery"], "parameters": {"projectId": {"type": "string", "location": "path"}, "tableId": {"type": "string", "location": "path"}, "datasetId": {"type": "string", "location": "path"}}, "request": {"$ref": "Table"}, "id": "bigquery.tables.update", "httpMethod": "PUT", "path": "projects/{projectId}/datasets/{datasetId}/tables/{tableId}", "response": {"$ref": "Table"}}, "patch": {"scopes": ["https://www.googleapis.com/auth/bigquery"], "parameters": {"projectId": {"required": true, "type": "string", "location": "path"}, "tableId": {"required": true, "type": "string", "location": "path"}, "datasetId": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "Table"}, "id": "bigquery.tables.patch", "httpMethod": "PATCH", "path": "projects/{projectId}/datasets/{datasetId}/tables/{tableId}", "response": {"$ref": "Table"}}, "delete": {"scopes": ["https://www.googleapis.com/auth/bigquery"], "parameters": {"projectId": {"required": true, "type": "string", "location": "path"}, "tableId": {"required": true, "type": "string", "location": "path"}, "datasetId": {"required": true, "type": "string", "location": "path"}}, "httpMethod": "DELETE", "path": "projects/{projectId}/datasets/{datasetId}/tables/{tableId}", "id": "bigquery.tables.delete"}}}', true)); + $this->datasets = new DatasetsServiceResource($this, $this->serviceName, 'datasets', json_decode('{"methods": {"insert": {"scopes": ["https://www.googleapis.com/auth/bigquery"], "parameters": {"projectId": {"type": "string", "location": "path"}}, "request": {"$ref": "Dataset"}, "id": "bigquery.datasets.insert", "httpMethod": "POST", "path": "projects/{projectId}/datasets", "response": {"$ref": "Dataset"}}, "get": {"scopes": ["https://www.googleapis.com/auth/bigquery"], "parameters": {"projectId": {"required": true, "type": "string", "location": "path"}, "datasetId": {"required": true, "type": "string", "location": "path"}}, "id": "bigquery.datasets.get", "httpMethod": "GET", "path": "projects/{projectId}/datasets/{datasetId}", "response": {"$ref": "Dataset"}}, "list": {"scopes": ["https://www.googleapis.com/auth/bigquery"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "maxResults": {"format": "uint32", "type": "integer", "location": "query"}, "projectId": {"required": true, "type": "string", "location": "path"}}, "id": "bigquery.datasets.list", "httpMethod": "GET", "path": "projects/{projectId}/datasets", "response": {"$ref": "DatasetList"}}, "update": {"scopes": ["https://www.googleapis.com/auth/bigquery"], "parameters": {"projectId": {"type": "string", "location": "path"}, "datasetId": {"type": "string", "location": "path"}}, "request": {"$ref": "Dataset"}, "id": "bigquery.datasets.update", "httpMethod": "PUT", "path": "projects/{projectId}/datasets/{datasetId}", "response": {"$ref": "Dataset"}}, "patch": {"scopes": ["https://www.googleapis.com/auth/bigquery"], "parameters": {"projectId": {"required": true, "type": "string", "location": "path"}, "datasetId": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "Dataset"}, "id": "bigquery.datasets.patch", "httpMethod": "PATCH", "path": "projects/{projectId}/datasets/{datasetId}", "response": {"$ref": "Dataset"}}, "delete": {"scopes": ["https://www.googleapis.com/auth/bigquery"], "parameters": {"deleteContents": {"type": "boolean", "location": "query"}, "datasetId": {"required": true, "type": "string", "location": "path"}, "projectId": {"required": true, "type": "string", "location": "path"}}, "httpMethod": "DELETE", "path": "projects/{projectId}/datasets/{datasetId}", "id": "bigquery.datasets.delete"}}}', true)); + $this->jobs = new JobsServiceResource($this, $this->serviceName, 'jobs', json_decode('{"methods": {"insert": {"scopes": ["https://www.googleapis.com/auth/bigquery"], "parameters": {"projectId": {"type": "string", "location": "path"}}, "mediaUpload": {"accept": ["application/octet-stream"], "protocols": {"simple": {"path": "/upload/bigquery/v2/projects/{projectId}/jobs", "multipart": true}, "resumable": {"path": "/resumable/upload/bigquery/v2/projects/{projectId}/jobs", "multipart": true}}}, "request": {"$ref": "Job"}, "id": "bigquery.jobs.insert", "httpMethod": "POST", "path": "projects/{projectId}/jobs", "response": {"$ref": "Job"}}, "get": {"scopes": ["https://www.googleapis.com/auth/bigquery"], "parameters": {"projectId": {"required": true, "type": "string", "location": "path"}, "jobId": {"required": true, "type": "string", "location": "path"}}, "id": "bigquery.jobs.get", "httpMethod": "GET", "path": "projects/{projectId}/jobs/{jobId}", "response": {"$ref": "Job"}}, "list": {"scopes": ["https://www.googleapis.com/auth/bigquery"], "parameters": {"projection": {"enum": ["full", "minimal"], "type": "string", "location": "query"}, "stateFilter": {"enum": ["done", "pending", "running"], "repeated": true, "location": "query", "type": "string"}, "projectId": {"required": true, "type": "string", "location": "path"}, "allUsers": {"type": "boolean", "location": "query"}, "maxResults": {"format": "uint32", "type": "integer", "location": "query"}, "pageToken": {"type": "string", "location": "query"}}, "id": "bigquery.jobs.list", "httpMethod": "GET", "path": "projects/{projectId}/jobs", "response": {"$ref": "JobList"}}, "query": {"scopes": ["https://www.googleapis.com/auth/bigquery"], "parameters": {"projectId": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "QueryRequest"}, "id": "bigquery.jobs.query", "httpMethod": "POST", "path": "projects/{projectId}/queries", "response": {"$ref": "QueryResponse"}}, "getQueryResults": {"scopes": ["https://www.googleapis.com/auth/bigquery"], "parameters": {"timeoutMs": {"format": "uint32", "type": "integer", "location": "query"}, "projectId": {"required": true, "type": "string", "location": "path"}, "startIndex": {"format": "uint64", "type": "string", "location": "query"}, "maxResults": {"format": "uint32", "type": "integer", "location": "query"}, "jobId": {"required": true, "type": "string", "location": "path"}}, "id": "bigquery.jobs.getQueryResults", "httpMethod": "GET", "path": "projects/{projectId}/queries/{jobId}", "response": {"$ref": "GetQueryResultsResponse"}}, "delete": {"scopes": ["https://www.googleapis.com/auth/bigquery"], "parameters": {"projectId": {"required": true, "type": "string", "location": "path"}, "jobId": {"required": true, "type": "string", "location": "path"}}, "httpMethod": "DELETE", "path": "projects/{projectId}/jobs/{jobId}", "id": "bigquery.jobs.delete"}}}', true)); + $this->tabledata = new TabledataServiceResource($this, $this->serviceName, 'tabledata', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/bigquery"], "parameters": {"projectId": {"required": true, "type": "string", "location": "path"}, "startIndex": {"format": "uint64", "type": "string", "location": "query"}, "tableId": {"required": true, "type": "string", "location": "path"}, "datasetId": {"required": true, "type": "string", "location": "path"}, "maxResults": {"format": "uint32", "type": "integer", "location": "query"}}, "id": "bigquery.tabledata.list", "httpMethod": "GET", "path": "projects/{projectId}/datasets/{datasetId}/tables/{tableId}/data", "response": {"$ref": "TableDataList"}}}}', true)); + $this->projects = new ProjectsServiceResource($this, $this->serviceName, 'projects', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/bigquery"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "maxResults": {"format": "uint32", "type": "integer", "location": "query"}}, "response": {"$ref": "ProjectList"}, "httpMethod": "GET", "path": "projects", "id": "bigquery.projects.list"}}}', true)); + + } +} + +class Dataset extends apiModel { + public $kind; + public $description; + protected $__datasetReferenceType = 'DatasetReference'; + protected $__datasetReferenceDataType = ''; + public $datasetReference; + public $creationTime; + protected $__accessType = 'DatasetAccess'; + protected $__accessDataType = 'array'; + public $access; + public $etag; + public $friendlyName; + public $lastModifiedTime; + public $id; + public $selfLink; + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setDescription($description) { + $this->description = $description; + } + public function getDescription() { + return $this->description; + } + public function setDatasetReference(DatasetReference $datasetReference) { + $this->datasetReference = $datasetReference; + } + public function getDatasetReference() { + return $this->datasetReference; + } + public function setCreationTime($creationTime) { + $this->creationTime = $creationTime; + } + public function getCreationTime() { + return $this->creationTime; + } + public function setAccess(/* array(DatasetAccess) */ $access) { + $this->assertIsArray($access, 'DatasetAccess', __METHOD__); + $this->access = $access; + } + public function getAccess() { + return $this->access; + } + public function setEtag($etag) { + $this->etag = $etag; + } + public function getEtag() { + return $this->etag; + } + public function setFriendlyName($friendlyName) { + $this->friendlyName = $friendlyName; + } + public function getFriendlyName() { + return $this->friendlyName; + } + public function setLastModifiedTime($lastModifiedTime) { + $this->lastModifiedTime = $lastModifiedTime; + } + public function getLastModifiedTime() { + return $this->lastModifiedTime; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setSelfLink($selfLink) { + $this->selfLink = $selfLink; + } + public function getSelfLink() { + return $this->selfLink; + } +} + +class DatasetAccess extends apiModel { + public $specialGroup; + public $domain; + public $role; + public $groupByEmail; + public $userByEmail; + public function setSpecialGroup($specialGroup) { + $this->specialGroup = $specialGroup; + } + public function getSpecialGroup() { + return $this->specialGroup; + } + public function setDomain($domain) { + $this->domain = $domain; + } + public function getDomain() { + return $this->domain; + } + public function setRole($role) { + $this->role = $role; + } + public function getRole() { + return $this->role; + } + public function setGroupByEmail($groupByEmail) { + $this->groupByEmail = $groupByEmail; + } + public function getGroupByEmail() { + return $this->groupByEmail; + } + public function setUserByEmail($userByEmail) { + $this->userByEmail = $userByEmail; + } + public function getUserByEmail() { + return $this->userByEmail; + } +} + +class DatasetList extends apiModel { + public $nextPageToken; + public $kind; + protected $__datasetsType = 'DatasetListDatasets'; + protected $__datasetsDataType = 'array'; + public $datasets; + public $etag; + public function setNextPageToken($nextPageToken) { + $this->nextPageToken = $nextPageToken; + } + public function getNextPageToken() { + return $this->nextPageToken; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setDatasets(/* array(DatasetListDatasets) */ $datasets) { + $this->assertIsArray($datasets, 'DatasetListDatasets', __METHOD__); + $this->datasets = $datasets; + } + public function getDatasets() { + return $this->datasets; + } + public function setEtag($etag) { + $this->etag = $etag; + } + public function getEtag() { + return $this->etag; + } +} + +class DatasetListDatasets extends apiModel { + public $friendlyName; + public $kind; + public $id; + protected $__datasetReferenceType = 'DatasetReference'; + protected $__datasetReferenceDataType = ''; + public $datasetReference; + public function setFriendlyName($friendlyName) { + $this->friendlyName = $friendlyName; + } + public function getFriendlyName() { + return $this->friendlyName; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setDatasetReference(DatasetReference $datasetReference) { + $this->datasetReference = $datasetReference; + } + public function getDatasetReference() { + return $this->datasetReference; + } +} + +class DatasetReference extends apiModel { + public $projectId; + public $datasetId; + public function setProjectId($projectId) { + $this->projectId = $projectId; + } + public function getProjectId() { + return $this->projectId; + } + public function setDatasetId($datasetId) { + $this->datasetId = $datasetId; + } + public function getDatasetId() { + return $this->datasetId; + } +} + +class ErrorProto extends apiModel { + public $debugInfo; + public $message; + public $reason; + public $location; + public function setDebugInfo($debugInfo) { + $this->debugInfo = $debugInfo; + } + public function getDebugInfo() { + return $this->debugInfo; + } + public function setMessage($message) { + $this->message = $message; + } + public function getMessage() { + return $this->message; + } + public function setReason($reason) { + $this->reason = $reason; + } + public function getReason() { + return $this->reason; + } + public function setLocation($location) { + $this->location = $location; + } + public function getLocation() { + return $this->location; + } +} + +class GetQueryResultsResponse extends apiModel { + public $kind; + protected $__rowsType = 'TableRow'; + protected $__rowsDataType = 'array'; + public $rows; + protected $__jobReferenceType = 'JobReference'; + protected $__jobReferenceDataType = ''; + public $jobReference; + public $jobComplete; + public $totalRows; + public $etag; + protected $__schemaType = 'TableSchema'; + protected $__schemaDataType = ''; + public $schema; + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setRows(/* array(TableRow) */ $rows) { + $this->assertIsArray($rows, 'TableRow', __METHOD__); + $this->rows = $rows; + } + public function getRows() { + return $this->rows; + } + public function setJobReference(JobReference $jobReference) { + $this->jobReference = $jobReference; + } + public function getJobReference() { + return $this->jobReference; + } + public function setJobComplete($jobComplete) { + $this->jobComplete = $jobComplete; + } + public function getJobComplete() { + return $this->jobComplete; + } + public function setTotalRows($totalRows) { + $this->totalRows = $totalRows; + } + public function getTotalRows() { + return $this->totalRows; + } + public function setEtag($etag) { + $this->etag = $etag; + } + public function getEtag() { + return $this->etag; + } + public function setSchema(TableSchema $schema) { + $this->schema = $schema; + } + public function getSchema() { + return $this->schema; + } +} + +class Job extends apiModel { + protected $__statusType = 'JobStatus'; + protected $__statusDataType = ''; + public $status; + public $kind; + protected $__statisticsType = 'JobStatistics'; + protected $__statisticsDataType = ''; + public $statistics; + protected $__jobReferenceType = 'JobReference'; + protected $__jobReferenceDataType = ''; + public $jobReference; + public $etag; + protected $__configurationType = 'JobConfiguration'; + protected $__configurationDataType = ''; + public $configuration; + public $id; + public $selfLink; + public function setStatus(JobStatus $status) { + $this->status = $status; + } + public function getStatus() { + return $this->status; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setStatistics(JobStatistics $statistics) { + $this->statistics = $statistics; + } + public function getStatistics() { + return $this->statistics; + } + public function setJobReference(JobReference $jobReference) { + $this->jobReference = $jobReference; + } + public function getJobReference() { + return $this->jobReference; + } + public function setEtag($etag) { + $this->etag = $etag; + } + public function getEtag() { + return $this->etag; + } + public function setConfiguration(JobConfiguration $configuration) { + $this->configuration = $configuration; + } + public function getConfiguration() { + return $this->configuration; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setSelfLink($selfLink) { + $this->selfLink = $selfLink; + } + public function getSelfLink() { + return $this->selfLink; + } +} + +class JobConfiguration extends apiModel { + protected $__loadType = 'JobConfigurationLoad'; + protected $__loadDataType = ''; + public $load; + protected $__linkType = 'JobConfigurationLink'; + protected $__linkDataType = ''; + public $link; + protected $__queryType = 'JobConfigurationQuery'; + protected $__queryDataType = ''; + public $query; + protected $__copyType = 'JobConfigurationTableCopy'; + protected $__copyDataType = ''; + public $copy; + protected $__extractType = 'JobConfigurationExtract'; + protected $__extractDataType = ''; + public $extract; + public $properties; + public function setLoad(JobConfigurationLoad $load) { + $this->load = $load; + } + public function getLoad() { + return $this->load; + } + public function setLink(JobConfigurationLink $link) { + $this->link = $link; + } + public function getLink() { + return $this->link; + } + public function setQuery(JobConfigurationQuery $query) { + $this->query = $query; + } + public function getQuery() { + return $this->query; + } + public function setCopy(JobConfigurationTableCopy $copy) { + $this->copy = $copy; + } + public function getCopy() { + return $this->copy; + } + public function setExtract(JobConfigurationExtract $extract) { + $this->extract = $extract; + } + public function getExtract() { + return $this->extract; + } + public function setProperties($properties) { + $this->properties = $properties; + } + public function getProperties() { + return $this->properties; + } +} + +class JobConfigurationExtract extends apiModel { + public $destinationUri; + protected $__sourceTableType = 'TableReference'; + protected $__sourceTableDataType = ''; + public $sourceTable; + public function setDestinationUri($destinationUri) { + $this->destinationUri = $destinationUri; + } + public function getDestinationUri() { + return $this->destinationUri; + } + public function setSourceTable(TableReference $sourceTable) { + $this->sourceTable = $sourceTable; + } + public function getSourceTable() { + return $this->sourceTable; + } +} + +class JobConfigurationLink extends apiModel { + public $createDisposition; + protected $__destinationTableType = 'TableReference'; + protected $__destinationTableDataType = ''; + public $destinationTable; + public $sourceUri; + public function setCreateDisposition($createDisposition) { + $this->createDisposition = $createDisposition; + } + public function getCreateDisposition() { + return $this->createDisposition; + } + public function setDestinationTable(TableReference $destinationTable) { + $this->destinationTable = $destinationTable; + } + public function getDestinationTable() { + return $this->destinationTable; + } + public function setSourceUri($sourceUri) { + $this->sourceUri = $sourceUri; + } + public function getSourceUri() { + return $this->sourceUri; + } +} + +class JobConfigurationLoad extends apiModel { + public $encoding; + public $fieldDelimiter; + protected $__destinationTableType = 'TableReference'; + protected $__destinationTableDataType = ''; + public $destinationTable; + public $maxBadRecords; + public $writeDisposition; + public $sourceUris; + public $skipLeadingRows; + public $createDisposition; + protected $__schemaType = 'TableSchema'; + protected $__schemaDataType = ''; + public $schema; + public function setEncoding($encoding) { + $this->encoding = $encoding; + } + public function getEncoding() { + return $this->encoding; + } + public function setFieldDelimiter($fieldDelimiter) { + $this->fieldDelimiter = $fieldDelimiter; + } + public function getFieldDelimiter() { + return $this->fieldDelimiter; + } + public function setDestinationTable(TableReference $destinationTable) { + $this->destinationTable = $destinationTable; + } + public function getDestinationTable() { + return $this->destinationTable; + } + public function setMaxBadRecords($maxBadRecords) { + $this->maxBadRecords = $maxBadRecords; + } + public function getMaxBadRecords() { + return $this->maxBadRecords; + } + public function setWriteDisposition($writeDisposition) { + $this->writeDisposition = $writeDisposition; + } + public function getWriteDisposition() { + return $this->writeDisposition; + } + public function setSourceUris(/* array(string) */ $sourceUris) { + $this->assertIsArray($sourceUris, 'string', __METHOD__); + $this->sourceUris = $sourceUris; + } + public function getSourceUris() { + return $this->sourceUris; + } + public function setSkipLeadingRows($skipLeadingRows) { + $this->skipLeadingRows = $skipLeadingRows; + } + public function getSkipLeadingRows() { + return $this->skipLeadingRows; + } + public function setCreateDisposition($createDisposition) { + $this->createDisposition = $createDisposition; + } + public function getCreateDisposition() { + return $this->createDisposition; + } + public function setSchema(TableSchema $schema) { + $this->schema = $schema; + } + public function getSchema() { + return $this->schema; + } +} + +class JobConfigurationQuery extends apiModel { + public $createDisposition; + public $query; + public $writeDisposition; + protected $__destinationTableType = 'TableReference'; + protected $__destinationTableDataType = ''; + public $destinationTable; + protected $__defaultDatasetType = 'DatasetReference'; + protected $__defaultDatasetDataType = ''; + public $defaultDataset; + public function setCreateDisposition($createDisposition) { + $this->createDisposition = $createDisposition; + } + public function getCreateDisposition() { + return $this->createDisposition; + } + public function setQuery($query) { + $this->query = $query; + } + public function getQuery() { + return $this->query; + } + public function setWriteDisposition($writeDisposition) { + $this->writeDisposition = $writeDisposition; + } + public function getWriteDisposition() { + return $this->writeDisposition; + } + public function setDestinationTable(TableReference $destinationTable) { + $this->destinationTable = $destinationTable; + } + public function getDestinationTable() { + return $this->destinationTable; + } + public function setDefaultDataset(DatasetReference $defaultDataset) { + $this->defaultDataset = $defaultDataset; + } + public function getDefaultDataset() { + return $this->defaultDataset; + } +} + +class JobConfigurationTableCopy extends apiModel { + public $createDisposition; + public $writeDisposition; + protected $__destinationTableType = 'TableReference'; + protected $__destinationTableDataType = ''; + public $destinationTable; + protected $__sourceTableType = 'TableReference'; + protected $__sourceTableDataType = ''; + public $sourceTable; + public function setCreateDisposition($createDisposition) { + $this->createDisposition = $createDisposition; + } + public function getCreateDisposition() { + return $this->createDisposition; + } + public function setWriteDisposition($writeDisposition) { + $this->writeDisposition = $writeDisposition; + } + public function getWriteDisposition() { + return $this->writeDisposition; + } + public function setDestinationTable(TableReference $destinationTable) { + $this->destinationTable = $destinationTable; + } + public function getDestinationTable() { + return $this->destinationTable; + } + public function setSourceTable(TableReference $sourceTable) { + $this->sourceTable = $sourceTable; + } + public function getSourceTable() { + return $this->sourceTable; + } +} + +class JobList extends apiModel { + public $nextPageToken; + public $totalItems; + public $kind; + public $etag; + protected $__jobsType = 'JobListJobs'; + protected $__jobsDataType = 'array'; + public $jobs; + public function setNextPageToken($nextPageToken) { + $this->nextPageToken = $nextPageToken; + } + public function getNextPageToken() { + return $this->nextPageToken; + } + public function setTotalItems($totalItems) { + $this->totalItems = $totalItems; + } + public function getTotalItems() { + return $this->totalItems; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setEtag($etag) { + $this->etag = $etag; + } + public function getEtag() { + return $this->etag; + } + public function setJobs(/* array(JobListJobs) */ $jobs) { + $this->assertIsArray($jobs, 'JobListJobs', __METHOD__); + $this->jobs = $jobs; + } + public function getJobs() { + return $this->jobs; + } +} + +class JobListJobs extends apiModel { + protected $__statusType = 'JobStatus'; + protected $__statusDataType = ''; + public $status; + protected $__statisticsType = 'JobStatistics'; + protected $__statisticsDataType = ''; + public $statistics; + protected $__jobReferenceType = 'JobReference'; + protected $__jobReferenceDataType = ''; + public $jobReference; + public $state; + protected $__configurationType = 'JobConfiguration'; + protected $__configurationDataType = ''; + public $configuration; + public $id; + protected $__errorResultType = 'ErrorProto'; + protected $__errorResultDataType = ''; + public $errorResult; + public function setStatus(JobStatus $status) { + $this->status = $status; + } + public function getStatus() { + return $this->status; + } + public function setStatistics(JobStatistics $statistics) { + $this->statistics = $statistics; + } + public function getStatistics() { + return $this->statistics; + } + public function setJobReference(JobReference $jobReference) { + $this->jobReference = $jobReference; + } + public function getJobReference() { + return $this->jobReference; + } + public function setState($state) { + $this->state = $state; + } + public function getState() { + return $this->state; + } + public function setConfiguration(JobConfiguration $configuration) { + $this->configuration = $configuration; + } + public function getConfiguration() { + return $this->configuration; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setErrorResult(ErrorProto $errorResult) { + $this->errorResult = $errorResult; + } + public function getErrorResult() { + return $this->errorResult; + } +} + +class JobReference extends apiModel { + public $projectId; + public $jobId; + public function setProjectId($projectId) { + $this->projectId = $projectId; + } + public function getProjectId() { + return $this->projectId; + } + public function setJobId($jobId) { + $this->jobId = $jobId; + } + public function getJobId() { + return $this->jobId; + } +} + +class JobStatistics extends apiModel { + public $endTime; + public $totalBytesProcessed; + public $startTime; + public function setEndTime($endTime) { + $this->endTime = $endTime; + } + public function getEndTime() { + return $this->endTime; + } + public function setTotalBytesProcessed($totalBytesProcessed) { + $this->totalBytesProcessed = $totalBytesProcessed; + } + public function getTotalBytesProcessed() { + return $this->totalBytesProcessed; + } + public function setStartTime($startTime) { + $this->startTime = $startTime; + } + public function getStartTime() { + return $this->startTime; + } +} + +class JobStatus extends apiModel { + public $state; + protected $__errorsType = 'ErrorProto'; + protected $__errorsDataType = 'array'; + public $errors; + protected $__errorResultType = 'ErrorProto'; + protected $__errorResultDataType = ''; + public $errorResult; + public function setState($state) { + $this->state = $state; + } + public function getState() { + return $this->state; + } + public function setErrors(/* array(ErrorProto) */ $errors) { + $this->assertIsArray($errors, 'ErrorProto', __METHOD__); + $this->errors = $errors; + } + public function getErrors() { + return $this->errors; + } + public function setErrorResult(ErrorProto $errorResult) { + $this->errorResult = $errorResult; + } + public function getErrorResult() { + return $this->errorResult; + } +} + +class ProjectList extends apiModel { + public $nextPageToken; + public $totalItems; + public $kind; + public $etag; + protected $__projectsType = 'ProjectListProjects'; + protected $__projectsDataType = 'array'; + public $projects; + public function setNextPageToken($nextPageToken) { + $this->nextPageToken = $nextPageToken; + } + public function getNextPageToken() { + return $this->nextPageToken; + } + public function setTotalItems($totalItems) { + $this->totalItems = $totalItems; + } + public function getTotalItems() { + return $this->totalItems; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setEtag($etag) { + $this->etag = $etag; + } + public function getEtag() { + return $this->etag; + } + public function setProjects(/* array(ProjectListProjects) */ $projects) { + $this->assertIsArray($projects, 'ProjectListProjects', __METHOD__); + $this->projects = $projects; + } + public function getProjects() { + return $this->projects; + } +} + +class ProjectListProjects extends apiModel { + public $friendlyName; + public $kind; + public $id; + protected $__projectReferenceType = 'ProjectReference'; + protected $__projectReferenceDataType = ''; + public $projectReference; + public function setFriendlyName($friendlyName) { + $this->friendlyName = $friendlyName; + } + public function getFriendlyName() { + return $this->friendlyName; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setProjectReference(ProjectReference $projectReference) { + $this->projectReference = $projectReference; + } + public function getProjectReference() { + return $this->projectReference; + } +} + +class ProjectReference extends apiModel { + public $projectId; + public function setProjectId($projectId) { + $this->projectId = $projectId; + } + public function getProjectId() { + return $this->projectId; + } +} + +class QueryRequest extends apiModel { + public $timeoutMs; + public $query; + public $kind; + public $maxResults; + protected $__defaultDatasetType = 'DatasetReference'; + protected $__defaultDatasetDataType = ''; + public $defaultDataset; + public function setTimeoutMs($timeoutMs) { + $this->timeoutMs = $timeoutMs; + } + public function getTimeoutMs() { + return $this->timeoutMs; + } + public function setQuery($query) { + $this->query = $query; + } + public function getQuery() { + return $this->query; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setMaxResults($maxResults) { + $this->maxResults = $maxResults; + } + public function getMaxResults() { + return $this->maxResults; + } + public function setDefaultDataset(DatasetReference $defaultDataset) { + $this->defaultDataset = $defaultDataset; + } + public function getDefaultDataset() { + return $this->defaultDataset; + } +} + +class QueryResponse extends apiModel { + public $kind; + protected $__rowsType = 'TableRow'; + protected $__rowsDataType = 'array'; + public $rows; + protected $__jobReferenceType = 'JobReference'; + protected $__jobReferenceDataType = ''; + public $jobReference; + public $jobComplete; + public $totalRows; + protected $__schemaType = 'TableSchema'; + protected $__schemaDataType = ''; + public $schema; + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setRows(/* array(TableRow) */ $rows) { + $this->assertIsArray($rows, 'TableRow', __METHOD__); + $this->rows = $rows; + } + public function getRows() { + return $this->rows; + } + public function setJobReference(JobReference $jobReference) { + $this->jobReference = $jobReference; + } + public function getJobReference() { + return $this->jobReference; + } + public function setJobComplete($jobComplete) { + $this->jobComplete = $jobComplete; + } + public function getJobComplete() { + return $this->jobComplete; + } + public function setTotalRows($totalRows) { + $this->totalRows = $totalRows; + } + public function getTotalRows() { + return $this->totalRows; + } + public function setSchema(TableSchema $schema) { + $this->schema = $schema; + } + public function getSchema() { + return $this->schema; + } +} + +class Table extends apiModel { + public $kind; + public $description; + public $creationTime; + protected $__tableReferenceType = 'TableReference'; + protected $__tableReferenceDataType = ''; + public $tableReference; + public $etag; + public $friendlyName; + public $lastModifiedTime; + public $id; + public $selfLink; + protected $__schemaType = 'TableSchema'; + protected $__schemaDataType = ''; + public $schema; + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setDescription($description) { + $this->description = $description; + } + public function getDescription() { + return $this->description; + } + public function setCreationTime($creationTime) { + $this->creationTime = $creationTime; + } + public function getCreationTime() { + return $this->creationTime; + } + public function setTableReference(TableReference $tableReference) { + $this->tableReference = $tableReference; + } + public function getTableReference() { + return $this->tableReference; + } + public function setEtag($etag) { + $this->etag = $etag; + } + public function getEtag() { + return $this->etag; + } + public function setFriendlyName($friendlyName) { + $this->friendlyName = $friendlyName; + } + public function getFriendlyName() { + return $this->friendlyName; + } + public function setLastModifiedTime($lastModifiedTime) { + $this->lastModifiedTime = $lastModifiedTime; + } + public function getLastModifiedTime() { + return $this->lastModifiedTime; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setSelfLink($selfLink) { + $this->selfLink = $selfLink; + } + public function getSelfLink() { + return $this->selfLink; + } + public function setSchema(TableSchema $schema) { + $this->schema = $schema; + } + public function getSchema() { + return $this->schema; + } +} + +class TableDataList extends apiModel { + protected $__rowsType = 'TableRow'; + protected $__rowsDataType = 'array'; + public $rows; + public $kind; + public $etag; + public $totalRows; + public function setRows(/* array(TableRow) */ $rows) { + $this->assertIsArray($rows, 'TableRow', __METHOD__); + $this->rows = $rows; + } + public function getRows() { + return $this->rows; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setEtag($etag) { + $this->etag = $etag; + } + public function getEtag() { + return $this->etag; + } + public function setTotalRows($totalRows) { + $this->totalRows = $totalRows; + } + public function getTotalRows() { + return $this->totalRows; + } +} + +class TableFieldSchema extends apiModel { + protected $__fieldsType = 'TableFieldSchema'; + protected $__fieldsDataType = 'array'; + public $fields; + public $type; + public $mode; + public $name; + public function setFields(/* array(TableFieldSchema) */ $fields) { + $this->assertIsArray($fields, 'TableFieldSchema', __METHOD__); + $this->fields = $fields; + } + public function getFields() { + return $this->fields; + } + public function setType($type) { + $this->type = $type; + } + public function getType() { + return $this->type; + } + public function setMode($mode) { + $this->mode = $mode; + } + public function getMode() { + return $this->mode; + } + public function setName($name) { + $this->name = $name; + } + public function getName() { + return $this->name; + } +} + +class TableList extends apiModel { + public $nextPageToken; + protected $__tablesType = 'TableListTables'; + protected $__tablesDataType = 'array'; + public $tables; + public $kind; + public $etag; + public $totalItems; + public function setNextPageToken($nextPageToken) { + $this->nextPageToken = $nextPageToken; + } + public function getNextPageToken() { + return $this->nextPageToken; + } + public function setTables(/* array(TableListTables) */ $tables) { + $this->assertIsArray($tables, 'TableListTables', __METHOD__); + $this->tables = $tables; + } + public function getTables() { + return $this->tables; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setEtag($etag) { + $this->etag = $etag; + } + public function getEtag() { + return $this->etag; + } + public function setTotalItems($totalItems) { + $this->totalItems = $totalItems; + } + public function getTotalItems() { + return $this->totalItems; + } +} + +class TableListTables extends apiModel { + public $friendlyName; + public $kind; + public $id; + protected $__tableReferenceType = 'TableReference'; + protected $__tableReferenceDataType = ''; + public $tableReference; + public function setFriendlyName($friendlyName) { + $this->friendlyName = $friendlyName; + } + public function getFriendlyName() { + return $this->friendlyName; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setTableReference(TableReference $tableReference) { + $this->tableReference = $tableReference; + } + public function getTableReference() { + return $this->tableReference; + } +} + +class TableReference extends apiModel { + public $projectId; + public $tableId; + public $datasetId; + public function setProjectId($projectId) { + $this->projectId = $projectId; + } + public function getProjectId() { + return $this->projectId; + } + public function setTableId($tableId) { + $this->tableId = $tableId; + } + public function getTableId() { + return $this->tableId; + } + public function setDatasetId($datasetId) { + $this->datasetId = $datasetId; + } + public function getDatasetId() { + return $this->datasetId; + } +} + +class TableRow extends apiModel { + protected $__fType = 'TableRowF'; + protected $__fDataType = 'array'; + public $f; + public function setF(/* array(TableRowF) */ $f) { + $this->assertIsArray($f, 'TableRowF', __METHOD__); + $this->f = $f; + } + public function getF() { + return $this->f; + } +} + +class TableRowF extends apiModel { + public $v; + public function setV($v) { + $this->v = $v; + } + public function getV() { + return $this->v; + } +} + +class TableSchema extends apiModel { + protected $__fieldsType = 'TableFieldSchema'; + protected $__fieldsDataType = 'array'; + public $fields; + public function setFields(/* array(TableFieldSchema) */ $fields) { + $this->assertIsArray($fields, 'TableFieldSchema', __METHOD__); + $this->fields = $fields; + } + public function getFields() { + return $this->fields; + } +} diff --git a/webui/google-api/contrib/apiBloggerService.php b/webui/google-api/contrib/apiBloggerService.php new file mode 100644 index 0000000..1c8b6fb --- /dev/null +++ b/webui/google-api/contrib/apiBloggerService.php @@ -0,0 +1,1093 @@ + + * $bloggerService = new apiBloggerService(...); + * $blogs = $bloggerService->blogs; + * + */ + class BlogsServiceResource extends apiServiceResource { + + + /** + * Gets one blog by id. (blogs.get) + * + * @param string $blogId The ID of the blog to get. + * @return Blog + */ + public function get($blogId, $optParams = array()) { + $params = array('blogId' => $blogId); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new Blog($data); + } else { + return $data; + } + } + } + + /** + * The "posts" collection of methods. + * Typical usage is: + * + * $bloggerService = new apiBloggerService(...); + * $posts = $bloggerService->posts; + * + */ + class PostsServiceResource extends apiServiceResource { + + + /** + * Retrieves a list of posts, possibly filtered. (posts.list) + * + * @param string $blogId ID of the blog to fetch posts from. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string pageToken Continuation token if the request is paged. + * @opt_param bool fetchBodies Whether the body content of posts is included. + * @opt_param string maxResults Maximum number of posts to fetch. + * @opt_param string startDate Earliest post date to fetch. + * @return PostList + */ + public function listPosts($blogId, $optParams = array()) { + $params = array('blogId' => $blogId); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new PostList($data); + } else { + return $data; + } + } + /** + * Get a post by id. (posts.get) + * + * @param string $blogId ID of the blog to fetch the post from. + * @param string $postId The ID of the post + * @return Post + */ + public function get($blogId, $postId, $optParams = array()) { + $params = array('blogId' => $blogId, 'postId' => $postId); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new Post($data); + } else { + return $data; + } + } + } + + /** + * The "pages" collection of methods. + * Typical usage is: + * + * $bloggerService = new apiBloggerService(...); + * $pages = $bloggerService->pages; + * + */ + class PagesServiceResource extends apiServiceResource { + + + /** + * Retrieves pages for a blog, possibly filtered. (pages.list) + * + * @param string $blogId ID of the blog to fetch pages from. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param bool fetchBodies Whether to retrieve the Page bodies. + * @return PageList + */ + public function listPages($blogId, $optParams = array()) { + $params = array('blogId' => $blogId); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new PageList($data); + } else { + return $data; + } + } + /** + * Gets one blog page by id. (pages.get) + * + * @param string $blogId ID of the blog containing the page. + * @param string $pageId The ID of the page to get. + * @return Page + */ + public function get($blogId, $pageId, $optParams = array()) { + $params = array('blogId' => $blogId, 'pageId' => $pageId); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new Page($data); + } else { + return $data; + } + } + } + + /** + * The "comments" collection of methods. + * Typical usage is: + * + * $bloggerService = new apiBloggerService(...); + * $comments = $bloggerService->comments; + * + */ + class CommentsServiceResource extends apiServiceResource { + + + /** + * Retrieves the comments for a blog, possibly filtered. (comments.list) + * + * @param string $blogId ID of the blog to fetch comments from. + * @param string $postId ID of the post to fetch posts from. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string startDate Earliest date of comment to fetch. + * @opt_param string maxResults Maximum number of comments to include in the result. + * @opt_param string pageToken Continuation token if request is paged. + * @opt_param bool fetchBodies Whether the body content of the comments is included. + * @return CommentList + */ + public function listComments($blogId, $postId, $optParams = array()) { + $params = array('blogId' => $blogId, 'postId' => $postId); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new CommentList($data); + } else { + return $data; + } + } + /** + * Gets one comment by id. (comments.get) + * + * @param string $blogId ID of the blog to containing the comment. + * @param string $postId ID of the post to fetch posts from. + * @param string $commentId The ID of the comment to get. + * @return Comment + */ + public function get($blogId, $postId, $commentId, $optParams = array()) { + $params = array('blogId' => $blogId, 'postId' => $postId, 'commentId' => $commentId); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new Comment($data); + } else { + return $data; + } + } + } + + /** + * The "users" collection of methods. + * Typical usage is: + * + * $bloggerService = new apiBloggerService(...); + * $users = $bloggerService->users; + * + */ + class UsersServiceResource extends apiServiceResource { + + + /** + * Gets one user by id. (users.get) + * + * @param string $userId The ID of the user to get. + * @return User + */ + public function get($userId, $optParams = array()) { + $params = array('userId' => $userId); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new User($data); + } else { + return $data; + } + } + } + + + /** + * The "blogs" collection of methods. + * Typical usage is: + * + * $bloggerService = new apiBloggerService(...); + * $blogs = $bloggerService->blogs; + * + */ + class UsersBlogsServiceResource extends apiServiceResource { + + + /** + * Retrieves a list of blogs, possibly filtered. (blogs.list) + * + * @param string $userId ID of the user whose blogs are to be fetched. + * @return BlogList + */ + public function listUsersBlogs($userId, $optParams = array()) { + $params = array('userId' => $userId); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new BlogList($data); + } else { + return $data; + } + } + } + + + +/** + * Service definition for Blogger (v2). + * + *

+ * API for access to the data within Blogger. + *

+ * + *

+ * For more information about this service, see the + * API Documentation + *

+ * + * @author Google, Inc. + */ +class apiBloggerService extends apiService { + public $blogs; + public $posts; + public $pages; + public $comments; + public $users; + public $users_blogs; + /** + * Constructs the internal representation of the Blogger service. + * + * @param apiClient apiClient + */ + public function __construct(apiClient $apiClient) { + $this->rpcPath = '/rpc'; + $this->restBasePath = '/blogger/v2/'; + $this->version = 'v2'; + $this->serviceName = 'blogger'; + + $apiClient->addService($this->serviceName, $this->version); + $this->blogs = new BlogsServiceResource($this, $this->serviceName, 'blogs', json_decode('{"methods": {"get": {"scopes": ["https://www.googleapis.com/auth/blogger"], "parameters": {"blogId": {"required": true, "type": "string", "location": "path"}}, "id": "blogger.blogs.get", "httpMethod": "GET", "path": "blogs/{blogId}", "response": {"$ref": "Blog"}}}}', true)); + $this->posts = new PostsServiceResource($this, $this->serviceName, 'posts', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/blogger"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "fetchBodies": {"type": "boolean", "location": "query"}, "blogId": {"required": true, "type": "string", "location": "path"}, "maxResults": {"format": "uint32", "type": "integer", "location": "query"}, "startDate": {"type": "string", "location": "query"}}, "id": "blogger.posts.list", "httpMethod": "GET", "path": "blogs/{blogId}/posts", "response": {"$ref": "PostList"}}, "get": {"scopes": ["https://www.googleapis.com/auth/blogger"], "parameters": {"postId": {"required": true, "type": "string", "location": "path"}, "blogId": {"required": true, "type": "string", "location": "path"}}, "id": "blogger.posts.get", "httpMethod": "GET", "path": "blogs/{blogId}/posts/{postId}", "response": {"$ref": "Post"}}}}', true)); + $this->pages = new PagesServiceResource($this, $this->serviceName, 'pages', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/blogger"], "parameters": {"fetchBodies": {"type": "boolean", "location": "query"}, "blogId": {"required": true, "type": "string", "location": "path"}}, "id": "blogger.pages.list", "httpMethod": "GET", "path": "blogs/{blogId}/pages", "response": {"$ref": "PageList"}}, "get": {"scopes": ["https://www.googleapis.com/auth/blogger"], "parameters": {"pageId": {"required": true, "type": "string", "location": "path"}, "blogId": {"required": true, "type": "string", "location": "path"}}, "id": "blogger.pages.get", "httpMethod": "GET", "path": "blogs/{blogId}/pages/{pageId}", "response": {"$ref": "Page"}}}}', true)); + $this->comments = new CommentsServiceResource($this, $this->serviceName, 'comments', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/blogger"], "parameters": {"startDate": {"type": "string", "location": "query"}, "postId": {"required": true, "type": "string", "location": "path"}, "maxResults": {"format": "uint32", "type": "integer", "location": "query"}, "pageToken": {"type": "string", "location": "query"}, "fetchBodies": {"type": "boolean", "location": "query"}, "blogId": {"required": true, "type": "string", "location": "path"}}, "id": "blogger.comments.list", "httpMethod": "GET", "path": "blogs/{blogId}/posts/{postId}/comments", "response": {"$ref": "CommentList"}}, "get": {"scopes": ["https://www.googleapis.com/auth/blogger"], "parameters": {"commentId": {"required": true, "type": "string", "location": "path"}, "postId": {"required": true, "type": "string", "location": "path"}, "blogId": {"required": true, "type": "string", "location": "path"}}, "id": "blogger.comments.get", "httpMethod": "GET", "path": "blogs/{blogId}/posts/{postId}/comments/{commentId}", "response": {"$ref": "Comment"}}}}', true)); + $this->users = new UsersServiceResource($this, $this->serviceName, 'users', json_decode('{"methods": {"get": {"scopes": ["https://www.googleapis.com/auth/blogger"], "parameters": {"userId": {"required": true, "type": "string", "location": "path"}}, "id": "blogger.users.get", "httpMethod": "GET", "path": "users/{userId}", "response": {"$ref": "User"}}}}', true)); + $this->users_blogs = new UsersBlogsServiceResource($this, $this->serviceName, 'blogs', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/blogger"], "parameters": {"userId": {"required": true, "type": "string", "location": "path"}}, "id": "blogger.users.blogs.list", "httpMethod": "GET", "path": "users/{userId}/blogs", "response": {"$ref": "BlogList"}}}}', true)); + } +} + +class Blog extends apiModel { + public $kind; + public $description; + protected $__localeType = 'BlogLocale'; + protected $__localeDataType = ''; + public $locale; + protected $__postsType = 'BlogPosts'; + protected $__postsDataType = ''; + public $posts; + public $updated; + public $id; + public $url; + public $published; + protected $__pagesType = 'BlogPages'; + protected $__pagesDataType = ''; + public $pages; + public $selfLink; + public $name; + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setDescription($description) { + $this->description = $description; + } + public function getDescription() { + return $this->description; + } + public function setLocale(BlogLocale $locale) { + $this->locale = $locale; + } + public function getLocale() { + return $this->locale; + } + public function setPosts(BlogPosts $posts) { + $this->posts = $posts; + } + public function getPosts() { + return $this->posts; + } + public function setUpdated($updated) { + $this->updated = $updated; + } + public function getUpdated() { + return $this->updated; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setUrl($url) { + $this->url = $url; + } + public function getUrl() { + return $this->url; + } + public function setPublished($published) { + $this->published = $published; + } + public function getPublished() { + return $this->published; + } + public function setPages(BlogPages $pages) { + $this->pages = $pages; + } + public function getPages() { + return $this->pages; + } + public function setSelfLink($selfLink) { + $this->selfLink = $selfLink; + } + public function getSelfLink() { + return $this->selfLink; + } + public function setName($name) { + $this->name = $name; + } + public function getName() { + return $this->name; + } +} + +class BlogList extends apiModel { + protected $__itemsType = 'Blog'; + protected $__itemsDataType = 'array'; + public $items; + public $kind; + public function setItems(/* array(Blog) */ $items) { + $this->assertIsArray($items, 'Blog', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } +} + +class BlogLocale extends apiModel { + public $country; + public $variant; + public $language; + public function setCountry($country) { + $this->country = $country; + } + public function getCountry() { + return $this->country; + } + public function setVariant($variant) { + $this->variant = $variant; + } + public function getVariant() { + return $this->variant; + } + public function setLanguage($language) { + $this->language = $language; + } + public function getLanguage() { + return $this->language; + } +} + +class BlogPages extends apiModel { + public $totalItems; + public $selfLink; + public function setTotalItems($totalItems) { + $this->totalItems = $totalItems; + } + public function getTotalItems() { + return $this->totalItems; + } + public function setSelfLink($selfLink) { + $this->selfLink = $selfLink; + } + public function getSelfLink() { + return $this->selfLink; + } +} + +class BlogPosts extends apiModel { + public $totalItems; + public $selfLink; + public function setTotalItems($totalItems) { + $this->totalItems = $totalItems; + } + public function getTotalItems() { + return $this->totalItems; + } + public function setSelfLink($selfLink) { + $this->selfLink = $selfLink; + } + public function getSelfLink() { + return $this->selfLink; + } +} + +class Comment extends apiModel { + public $content; + public $kind; + protected $__authorType = 'CommentAuthor'; + protected $__authorDataType = ''; + public $author; + public $updated; + protected $__blogType = 'CommentBlog'; + protected $__blogDataType = ''; + public $blog; + public $published; + protected $__postType = 'CommentPost'; + protected $__postDataType = ''; + public $post; + public $id; + public $selfLink; + public function setContent($content) { + $this->content = $content; + } + public function getContent() { + return $this->content; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setAuthor(CommentAuthor $author) { + $this->author = $author; + } + public function getAuthor() { + return $this->author; + } + public function setUpdated($updated) { + $this->updated = $updated; + } + public function getUpdated() { + return $this->updated; + } + public function setBlog(CommentBlog $blog) { + $this->blog = $blog; + } + public function getBlog() { + return $this->blog; + } + public function setPublished($published) { + $this->published = $published; + } + public function getPublished() { + return $this->published; + } + public function setPost(CommentPost $post) { + $this->post = $post; + } + public function getPost() { + return $this->post; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setSelfLink($selfLink) { + $this->selfLink = $selfLink; + } + public function getSelfLink() { + return $this->selfLink; + } +} + +class CommentAuthor extends apiModel { + public $url; + protected $__imageType = 'CommentAuthorImage'; + protected $__imageDataType = ''; + public $image; + public $displayName; + public $id; + public function setUrl($url) { + $this->url = $url; + } + public function getUrl() { + return $this->url; + } + public function setImage(CommentAuthorImage $image) { + $this->image = $image; + } + public function getImage() { + return $this->image; + } + public function setDisplayName($displayName) { + $this->displayName = $displayName; + } + public function getDisplayName() { + return $this->displayName; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } +} + +class CommentAuthorImage extends apiModel { + public $url; + public function setUrl($url) { + $this->url = $url; + } + public function getUrl() { + return $this->url; + } +} + +class CommentBlog extends apiModel { + public $id; + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } +} + +class CommentList extends apiModel { + public $nextPageToken; + protected $__itemsType = 'Comment'; + protected $__itemsDataType = 'array'; + public $items; + public $kind; + public $prevPageToken; + public function setNextPageToken($nextPageToken) { + $this->nextPageToken = $nextPageToken; + } + public function getNextPageToken() { + return $this->nextPageToken; + } + public function setItems(/* array(Comment) */ $items) { + $this->assertIsArray($items, 'Comment', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setPrevPageToken($prevPageToken) { + $this->prevPageToken = $prevPageToken; + } + public function getPrevPageToken() { + return $this->prevPageToken; + } +} + +class CommentPost extends apiModel { + public $id; + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } +} + +class Page extends apiModel { + public $content; + public $kind; + protected $__authorType = 'PageAuthor'; + protected $__authorDataType = ''; + public $author; + public $url; + public $title; + public $updated; + protected $__blogType = 'PageBlog'; + protected $__blogDataType = ''; + public $blog; + public $published; + public $id; + public $selfLink; + public function setContent($content) { + $this->content = $content; + } + public function getContent() { + return $this->content; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setAuthor(PageAuthor $author) { + $this->author = $author; + } + public function getAuthor() { + return $this->author; + } + public function setUrl($url) { + $this->url = $url; + } + public function getUrl() { + return $this->url; + } + public function setTitle($title) { + $this->title = $title; + } + public function getTitle() { + return $this->title; + } + public function setUpdated($updated) { + $this->updated = $updated; + } + public function getUpdated() { + return $this->updated; + } + public function setBlog(PageBlog $blog) { + $this->blog = $blog; + } + public function getBlog() { + return $this->blog; + } + public function setPublished($published) { + $this->published = $published; + } + public function getPublished() { + return $this->published; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setSelfLink($selfLink) { + $this->selfLink = $selfLink; + } + public function getSelfLink() { + return $this->selfLink; + } +} + +class PageAuthor extends apiModel { + public $url; + protected $__imageType = 'PageAuthorImage'; + protected $__imageDataType = ''; + public $image; + public $displayName; + public $id; + public function setUrl($url) { + $this->url = $url; + } + public function getUrl() { + return $this->url; + } + public function setImage(PageAuthorImage $image) { + $this->image = $image; + } + public function getImage() { + return $this->image; + } + public function setDisplayName($displayName) { + $this->displayName = $displayName; + } + public function getDisplayName() { + return $this->displayName; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } +} + +class PageAuthorImage extends apiModel { + public $url; + public function setUrl($url) { + $this->url = $url; + } + public function getUrl() { + return $this->url; + } +} + +class PageBlog extends apiModel { + public $id; + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } +} + +class PageList extends apiModel { + protected $__itemsType = 'Page'; + protected $__itemsDataType = 'array'; + public $items; + public $kind; + public function setItems(/* array(Page) */ $items) { + $this->assertIsArray($items, 'Page', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } +} + +class Post extends apiModel { + public $content; + public $kind; + protected $__authorType = 'PostAuthor'; + protected $__authorDataType = ''; + public $author; + protected $__repliesType = 'PostReplies'; + protected $__repliesDataType = ''; + public $replies; + public $labels; + public $updated; + protected $__blogType = 'PostBlog'; + protected $__blogDataType = ''; + public $blog; + public $url; + public $published; + public $title; + public $id; + public $selfLink; + public function setContent($content) { + $this->content = $content; + } + public function getContent() { + return $this->content; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setAuthor(PostAuthor $author) { + $this->author = $author; + } + public function getAuthor() { + return $this->author; + } + public function setReplies(PostReplies $replies) { + $this->replies = $replies; + } + public function getReplies() { + return $this->replies; + } + public function setLabels(/* array(string) */ $labels) { + $this->assertIsArray($labels, 'string', __METHOD__); + $this->labels = $labels; + } + public function getLabels() { + return $this->labels; + } + public function setUpdated($updated) { + $this->updated = $updated; + } + public function getUpdated() { + return $this->updated; + } + public function setBlog(PostBlog $blog) { + $this->blog = $blog; + } + public function getBlog() { + return $this->blog; + } + public function setUrl($url) { + $this->url = $url; + } + public function getUrl() { + return $this->url; + } + public function setPublished($published) { + $this->published = $published; + } + public function getPublished() { + return $this->published; + } + public function setTitle($title) { + $this->title = $title; + } + public function getTitle() { + return $this->title; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setSelfLink($selfLink) { + $this->selfLink = $selfLink; + } + public function getSelfLink() { + return $this->selfLink; + } +} + +class PostAuthor extends apiModel { + public $url; + protected $__imageType = 'PostAuthorImage'; + protected $__imageDataType = ''; + public $image; + public $displayName; + public $id; + public function setUrl($url) { + $this->url = $url; + } + public function getUrl() { + return $this->url; + } + public function setImage(PostAuthorImage $image) { + $this->image = $image; + } + public function getImage() { + return $this->image; + } + public function setDisplayName($displayName) { + $this->displayName = $displayName; + } + public function getDisplayName() { + return $this->displayName; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } +} + +class PostAuthorImage extends apiModel { + public $url; + public function setUrl($url) { + $this->url = $url; + } + public function getUrl() { + return $this->url; + } +} + +class PostBlog extends apiModel { + public $id; + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } +} + +class PostList extends apiModel { + public $nextPageToken; + protected $__itemsType = 'Post'; + protected $__itemsDataType = 'array'; + public $items; + public $kind; + public $prevPageToken; + public function setNextPageToken($nextPageToken) { + $this->nextPageToken = $nextPageToken; + } + public function getNextPageToken() { + return $this->nextPageToken; + } + public function setItems(/* array(Post) */ $items) { + $this->assertIsArray($items, 'Post', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setPrevPageToken($prevPageToken) { + $this->prevPageToken = $prevPageToken; + } + public function getPrevPageToken() { + return $this->prevPageToken; + } +} + +class PostReplies extends apiModel { + public $totalItems; + public $selfLink; + public function setTotalItems($totalItems) { + $this->totalItems = $totalItems; + } + public function getTotalItems() { + return $this->totalItems; + } + public function setSelfLink($selfLink) { + $this->selfLink = $selfLink; + } + public function getSelfLink() { + return $this->selfLink; + } +} + +class User extends apiModel { + public $about; + public $displayName; + public $created; + protected $__localeType = 'UserLocale'; + protected $__localeDataType = ''; + public $locale; + protected $__blogsType = 'UserBlogs'; + protected $__blogsDataType = ''; + public $blogs; + public $kind; + public $url; + public $id; + public $selfLink; + public function setAbout($about) { + $this->about = $about; + } + public function getAbout() { + return $this->about; + } + public function setDisplayName($displayName) { + $this->displayName = $displayName; + } + public function getDisplayName() { + return $this->displayName; + } + public function setCreated($created) { + $this->created = $created; + } + public function getCreated() { + return $this->created; + } + public function setLocale(UserLocale $locale) { + $this->locale = $locale; + } + public function getLocale() { + return $this->locale; + } + public function setBlogs(UserBlogs $blogs) { + $this->blogs = $blogs; + } + public function getBlogs() { + return $this->blogs; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setUrl($url) { + $this->url = $url; + } + public function getUrl() { + return $this->url; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setSelfLink($selfLink) { + $this->selfLink = $selfLink; + } + public function getSelfLink() { + return $this->selfLink; + } +} + +class UserBlogs extends apiModel { + public $selfLink; + public function setSelfLink($selfLink) { + $this->selfLink = $selfLink; + } + public function getSelfLink() { + return $this->selfLink; + } +} + +class UserLocale extends apiModel { + public $country; + public $variant; + public $language; + public function setCountry($country) { + $this->country = $country; + } + public function getCountry() { + return $this->country; + } + public function setVariant($variant) { + $this->variant = $variant; + } + public function getVariant() { + return $this->variant; + } + public function setLanguage($language) { + $this->language = $language; + } + public function getLanguage() { + return $this->language; + } +} diff --git a/webui/google-api/contrib/apiBooksService.php b/webui/google-api/contrib/apiBooksService.php new file mode 100644 index 0000000..6be6eb1 --- /dev/null +++ b/webui/google-api/contrib/apiBooksService.php @@ -0,0 +1,1865 @@ + + * $booksService = new apiBooksService(...); + * $bookshelves = $booksService->bookshelves; + * + */ + class BookshelvesServiceResource extends apiServiceResource { + + + /** + * Retrieves a list of public bookshelves for the specified user. (bookshelves.list) + * + * @param string $userId Id of user for whom to retrieve bookshelves. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string country ISO-3166-1 code to override the IP-based location. + * @opt_param string source String to identify the originator of this request. + * @return Bookshelves + */ + public function listBookshelves($userId, $optParams = array()) { + $params = array('userId' => $userId); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new Bookshelves($data); + } else { + return $data; + } + } + /** + * Retrieves a specific bookshelf for the specified user. (bookshelves.get) + * + * @param string $userId Id of user for whom to retrieve bookshelves. + * @param string $shelf Id of bookshelf to retrieve. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string country ISO-3166-1 code to override the IP-based location. + * @opt_param string source String to identify the originator of this request. + * @return Bookshelf + */ + public function get($userId, $shelf, $optParams = array()) { + $params = array('userId' => $userId, 'shelf' => $shelf); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new Bookshelf($data); + } else { + return $data; + } + } + } + + + /** + * The "volumes" collection of methods. + * Typical usage is: + * + * $booksService = new apiBooksService(...); + * $volumes = $booksService->volumes; + * + */ + class BookshelvesVolumesServiceResource extends apiServiceResource { + + + /** + * Retrieves volumes in a specific bookshelf for the specified user. (volumes.list) + * + * @param string $userId Id of user for whom to retrieve bookshelf volumes. + * @param string $shelf Id of bookshelf to retrieve volumes. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string country ISO-3166-1 code to override the IP-based location. + * @opt_param bool showPreorders Set to true to show pre-ordered books. Defaults to false. + * @opt_param string maxResults Maximum number of results to return + * @opt_param string source String to identify the originator of this request. + * @opt_param string startIndex Index of the first element to return (starts at 0) + * @return Volumes + */ + public function listBookshelvesVolumes($userId, $shelf, $optParams = array()) { + $params = array('userId' => $userId, 'shelf' => $shelf); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new Volumes($data); + } else { + return $data; + } + } + } + + /** + * The "myconfig" collection of methods. + * Typical usage is: + * + * $booksService = new apiBooksService(...); + * $myconfig = $booksService->myconfig; + * + */ + class MyconfigServiceResource extends apiServiceResource { + + + /** + * Release downloaded content access restriction. (myconfig.releaseDownloadAccess) + * + * @param string $volumeIds The volume(s) to release restrictions for. + * @param string $cpksver The device/version identifier from which to release the restriction. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string locale ISO-639-1, ISO-3166-1 codes for message localization, i.e. en_US. + * @opt_param string country ISO-3166-1 code to override the IP-based location. + * @opt_param string source String to identify the originator of this request. + * @return DownloadAccesses + */ + public function releaseDownloadAccess($volumeIds, $cpksver, $optParams = array()) { + $params = array('volumeIds' => $volumeIds, 'cpksver' => $cpksver); + $params = array_merge($params, $optParams); + $data = $this->__call('releaseDownloadAccess', array($params)); + if ($this->useObjects()) { + return new DownloadAccesses($data); + } else { + return $data; + } + } + /** + * Request concurrent and download access restrictions. (myconfig.requestAccess) + * + * @param string $source String to identify the originator of this request. + * @param string $volumeId The volume to request concurrent/download restrictions for. + * @param string $nonce The client nonce value. + * @param string $cpksver The device/version identifier from which to request the restrictions. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string locale ISO-639-1, ISO-3166-1 codes for message localization, i.e. en_US. + * @opt_param string country ISO-3166-1 code to override the IP-based location. + * @return RequestAccess + */ + public function requestAccess($source, $volumeId, $nonce, $cpksver, $optParams = array()) { + $params = array('source' => $source, 'volumeId' => $volumeId, 'nonce' => $nonce, 'cpksver' => $cpksver); + $params = array_merge($params, $optParams); + $data = $this->__call('requestAccess', array($params)); + if ($this->useObjects()) { + return new RequestAccess($data); + } else { + return $data; + } + } + /** + * Request downloaded content access for specified volumes on the My eBooks shelf. + * (myconfig.syncVolumeLicenses) + * + * @param string $source String to identify the originator of this request. + * @param string $nonce The client nonce value. + * @param string $cpksver The device/version identifier from which to release the restriction. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string locale ISO-639-1, ISO-3166-1 codes for message localization, i.e. en_US. + * @opt_param string country ISO-3166-1 code to override the IP-based location. + * @opt_param string volumeIds The volume(s) to request download restrictions for. + * @return Volumes + */ + public function syncVolumeLicenses($source, $nonce, $cpksver, $optParams = array()) { + $params = array('source' => $source, 'nonce' => $nonce, 'cpksver' => $cpksver); + $params = array_merge($params, $optParams); + $data = $this->__call('syncVolumeLicenses', array($params)); + if ($this->useObjects()) { + return new Volumes($data); + } else { + return $data; + } + } + } + + /** + * The "volumes" collection of methods. + * Typical usage is: + * + * $booksService = new apiBooksService(...); + * $volumes = $booksService->volumes; + * + */ + class VolumesServiceResource extends apiServiceResource { + + + /** + * Performs a book search. (volumes.list) + * + * @param string $q Full-text search query string. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string orderBy Sort search results. + * @opt_param string projection Restrict information returned to a set of selected fields. + * @opt_param string libraryRestrict Restrict search to this user's library. + * @opt_param string langRestrict Restrict results to books with this language code. + * @opt_param string country ISO-3166-1 code to override the IP-based location. + * @opt_param string printType Restrict to books or magazines. + * @opt_param string maxResults Maximum number of results to return. + * @opt_param string filter Filter search results. + * @opt_param string source String to identify the originator of this request. + * @opt_param string startIndex Index of the first result to return (starts at 0) + * @opt_param string download Restrict to volumes by download availability. + * @opt_param string partner Identifier of partner for whom to restrict and brand results. + * @opt_param bool showPreorders Set to true to show books available for preorder. Defaults to false. + * @return Volumes + */ + public function listVolumes($q, $optParams = array()) { + $params = array('q' => $q); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new Volumes($data); + } else { + return $data; + } + } + /** + * Gets volume information for a single volume. (volumes.get) + * + * @param string $volumeId Id of volume to retrieve. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string source String to identify the originator of this request. + * @opt_param string country ISO-3166-1 code to override the IP-based location. + * @opt_param string projection Restrict information returned to a set of selected fields. + * @opt_param string partner Identifier of partner for whom to brand results. + * @return Volume + */ + public function get($volumeId, $optParams = array()) { + $params = array('volumeId' => $volumeId); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new Volume($data); + } else { + return $data; + } + } + } + + /** + * The "mylibrary" collection of methods. + * Typical usage is: + * + * $booksService = new apiBooksService(...); + * $mylibrary = $booksService->mylibrary; + * + */ + class MylibraryServiceResource extends apiServiceResource { + + + } + + + /** + * The "bookshelves" collection of methods. + * Typical usage is: + * + * $booksService = new apiBooksService(...); + * $bookshelves = $booksService->bookshelves; + * + */ + class MylibraryBookshelvesServiceResource extends apiServiceResource { + + + /** + * Clears all volumes from a bookshelf. (bookshelves.clearVolumes) + * + * @param string $shelf Id of bookshelf from which to remove a volume. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string country ISO-3166-1 code to override the IP-based location. + * @opt_param string source String to identify the originator of this request. + */ + public function clearVolumes($shelf, $optParams = array()) { + $params = array('shelf' => $shelf); + $params = array_merge($params, $optParams); + $data = $this->__call('clearVolumes', array($params)); + return $data; + } + /** + * Removes a volume from a bookshelf. (bookshelves.removeVolume) + * + * @param string $shelf Id of bookshelf from which to remove a volume. + * @param string $volumeId Id of volume to remove. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string country ISO-3166-1 code to override the IP-based location. + * @opt_param string source String to identify the originator of this request. + */ + public function removeVolume($shelf, $volumeId, $optParams = array()) { + $params = array('shelf' => $shelf, 'volumeId' => $volumeId); + $params = array_merge($params, $optParams); + $data = $this->__call('removeVolume', array($params)); + return $data; + } + /** + * Retrieves a list of bookshelves belonging to the authenticated user. (bookshelves.list) + * + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string country ISO-3166-1 code to override the IP-based location. + * @opt_param string source String to identify the originator of this request. + * @return Bookshelves + */ + public function listMylibraryBookshelves($optParams = array()) { + $params = array(); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new Bookshelves($data); + } else { + return $data; + } + } + /** + * Adds a volume to a bookshelf. (bookshelves.addVolume) + * + * @param string $shelf Id of bookshelf to which to add a volume. + * @param string $volumeId Id of volume to add. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string country ISO-3166-1 code to override the IP-based location. + * @opt_param string source String to identify the originator of this request. + */ + public function addVolume($shelf, $volumeId, $optParams = array()) { + $params = array('shelf' => $shelf, 'volumeId' => $volumeId); + $params = array_merge($params, $optParams); + $data = $this->__call('addVolume', array($params)); + return $data; + } + /** + * Retrieves a specific bookshelf belonging to the authenticated user. (bookshelves.get) + * + * @param string $shelf Id of bookshelf to retrieve. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string country ISO-3166-1 code to override the IP-based location. + * @opt_param string source String to identify the originator of this request. + * @return Bookshelf + */ + public function get($shelf, $optParams = array()) { + $params = array('shelf' => $shelf); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new Bookshelf($data); + } else { + return $data; + } + } + } + + + /** + * The "volumes" collection of methods. + * Typical usage is: + * + * $booksService = new apiBooksService(...); + * $volumes = $booksService->volumes; + * + */ + class MylibraryBookshelvesVolumesServiceResource extends apiServiceResource { + + + /** + * Gets volume information for volumes on a bookshelf. (volumes.list) + * + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string shelf The bookshelf id or name retrieve volumes for. + * @opt_param string projection Restrict information returned to a set of selected fields. + * @opt_param string country ISO-3166-1 code to override the IP-based location. + * @opt_param bool showPreorders Set to true to show pre-ordered books. Defaults to false. + * @opt_param string maxResults Maximum number of results to return + * @opt_param string q Full-text search query string in this bookshelf. + * @opt_param string source String to identify the originator of this request. + * @opt_param string startIndex Index of the first element to return (starts at 0) + * @return Volumes + */ + public function listMylibraryBookshelvesVolumes($optParams = array()) { + $params = array(); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new Volumes($data); + } else { + return $data; + } + } + } + /** + * The "annotations" collection of methods. + * Typical usage is: + * + * $booksService = new apiBooksService(...); + * $annotations = $booksService->annotations; + * + */ + class MylibraryAnnotationsServiceResource extends apiServiceResource { + + + /** + * Inserts a new annotation. (annotations.insert) + * + * @param Annotation $postBody + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string country ISO-3166-1 code to override the IP-based location. + * @opt_param string source String to identify the originator of this request. + * @return Annotation + */ + public function insert(Annotation $postBody, $optParams = array()) { + $params = array('postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('insert', array($params)); + if ($this->useObjects()) { + return new Annotation($data); + } else { + return $data; + } + } + /** + * Gets an annotation by its id. (annotations.get) + * + * @param string $annotationId The annotation identifier for the annotation to retrieve. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string country ISO-3166-1 code to override the IP-based location. + * @opt_param string source String to identify the originator of this request. + * @return Annotation + */ + public function get($annotationId, $optParams = array()) { + $params = array('annotationId' => $annotationId); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new Annotation($data); + } else { + return $data; + } + } + /** + * Retrieves a list of annotations, possibly filtered. (annotations.list) + * + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string source String to identify the originator of this request. + * @opt_param string country ISO-3166-1 code to override the IP-based location. + * @opt_param string volumeId The volume to restrict annotations to. + * @opt_param string maxResults Maximum number of results to return + * @opt_param string pageToken The value of the nextToken from the previous page. + * @opt_param string pageIds The page id(s) for the volume that is being queried. + * @opt_param string contentVersion The content version for the requested volume. + * @opt_param string layerId The layer id to limit annotation by. + * @return Annotations + */ + public function listMylibraryAnnotations($optParams = array()) { + $params = array(); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new Annotations($data); + } else { + return $data; + } + } + /** + * Updates an existing annotation. (annotations.update) + * + * @param string $annotationId The annotation identifier for the annotation to update. + * @param Annotation $postBody + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string country ISO-3166-1 code to override the IP-based location. + * @opt_param string source String to identify the originator of this request. + * @return Annotation + */ + public function update($annotationId, Annotation $postBody, $optParams = array()) { + $params = array('annotationId' => $annotationId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('update', array($params)); + if ($this->useObjects()) { + return new Annotation($data); + } else { + return $data; + } + } + /** + * Deletes an annotation. (annotations.delete) + * + * @param string $annotationId The annotation identifier for the annotation to delete. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string country ISO-3166-1 code to override the IP-based location. + * @opt_param string source String to identify the originator of this request. + */ + public function delete($annotationId, $optParams = array()) { + $params = array('annotationId' => $annotationId); + $params = array_merge($params, $optParams); + $data = $this->__call('delete', array($params)); + return $data; + } + } + + + +/** + * Service definition for Books (v1). + * + *

+ * Lets you search for books and manage your Google Books library. + *

+ * + *

+ * For more information about this service, see the + * API Documentation + *

+ * + * @author Google, Inc. + */ +class apiBooksService extends apiService { + public $bookshelves; + public $bookshelves_volumes; + public $myconfig; + public $volumes; + public $mylibrary; + public $mylibrary_bookshelves; + public $mylibrary_annotations; + /** + * Constructs the internal representation of the Books service. + * + * @param apiClient apiClient + */ + public function __construct(apiClient $apiClient) { + $this->rpcPath = '/rpc'; + $this->restBasePath = '/books/v1/'; + $this->version = 'v1'; + $this->serviceName = 'books'; + + $apiClient->addService($this->serviceName, $this->version); + $this->bookshelves = new BookshelvesServiceResource($this, $this->serviceName, 'bookshelves', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/books"], "parameters": {"country": {"type": "string", "location": "query"}, "userId": {"required": true, "type": "string", "location": "path"}, "source": {"type": "string", "location": "query"}}, "id": "books.bookshelves.list", "httpMethod": "GET", "path": "users/{userId}/bookshelves", "response": {"$ref": "Bookshelves"}}, "get": {"scopes": ["https://www.googleapis.com/auth/books"], "parameters": {"country": {"type": "string", "location": "query"}, "userId": {"required": true, "type": "string", "location": "path"}, "shelf": {"required": true, "type": "string", "location": "path"}, "source": {"type": "string", "location": "query"}}, "id": "books.bookshelves.get", "httpMethod": "GET", "path": "users/{userId}/bookshelves/{shelf}", "response": {"$ref": "Bookshelf"}}}}', true)); + $this->bookshelves_volumes = new BookshelvesVolumesServiceResource($this, $this->serviceName, 'volumes', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/books"], "parameters": {"country": {"type": "string", "location": "query"}, "showPreorders": {"type": "boolean", "location": "query"}, "maxResults": {"format": "uint32", "minimum": "0", "type": "integer", "location": "query"}, "source": {"type": "string", "location": "query"}, "startIndex": {"format": "uint32", "minimum": "0", "type": "integer", "location": "query"}, "shelf": {"required": true, "type": "string", "location": "path"}, "userId": {"required": true, "type": "string", "location": "path"}}, "id": "books.bookshelves.volumes.list", "httpMethod": "GET", "path": "users/{userId}/bookshelves/{shelf}/volumes", "response": {"$ref": "Volumes"}}}}', true)); + $this->myconfig = new MyconfigServiceResource($this, $this->serviceName, 'myconfig', json_decode('{"methods": {"releaseDownloadAccess": {"scopes": ["https://www.googleapis.com/auth/books"], "parameters": {"locale": {"type": "string", "location": "query"}, "country": {"type": "string", "location": "query"}, "source": {"type": "string", "location": "query"}, "cpksver": {"required": true, "type": "string", "location": "query"}, "volumeIds": {"repeated": true, "required": true, "type": "string", "location": "query"}}, "id": "books.myconfig.releaseDownloadAccess", "httpMethod": "POST", "path": "myconfig/releaseDownloadAccess", "response": {"$ref": "DownloadAccesses"}}, "requestAccess": {"scopes": ["https://www.googleapis.com/auth/books"], "parameters": {"nonce": {"required": true, "type": "string", "location": "query"}, "locale": {"type": "string", "location": "query"}, "country": {"type": "string", "location": "query"}, "cpksver": {"required": true, "type": "string", "location": "query"}, "volumeId": {"required": true, "type": "string", "location": "query"}, "source": {"required": true, "type": "string", "location": "query"}}, "id": "books.myconfig.requestAccess", "httpMethod": "POST", "path": "myconfig/requestAccess", "response": {"$ref": "RequestAccess"}}, "syncVolumeLicenses": {"scopes": ["https://www.googleapis.com/auth/books"], "parameters": {"nonce": {"required": true, "type": "string", "location": "query"}, "locale": {"type": "string", "location": "query"}, "country": {"type": "string", "location": "query"}, "cpksver": {"required": true, "type": "string", "location": "query"}, "source": {"required": true, "type": "string", "location": "query"}, "volumeIds": {"repeated": true, "type": "string", "location": "query"}}, "id": "books.myconfig.syncVolumeLicenses", "httpMethod": "POST", "path": "myconfig/syncVolumeLicenses", "response": {"$ref": "Volumes"}}}}', true)); + $this->volumes = new VolumesServiceResource($this, $this->serviceName, 'volumes', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/books"], "parameters": {"orderBy": {"enum": ["newest", "relevance"], "type": "string", "location": "query"}, "filter": {"enum": ["ebooks", "free-ebooks", "full", "paid-ebooks", "partial"], "type": "string", "location": "query"}, "projection": {"enum": ["full", "lite"], "type": "string", "location": "query"}, "libraryRestrict": {"enum": ["my-library", "no-restrict"], "type": "string", "location": "query"}, "langRestrict": {"type": "string", "location": "query"}, "country": {"type": "string", "location": "query"}, "printType": {"enum": ["all", "books", "magazines"], "type": "string", "location": "query"}, "maxResults": {"format": "uint32", "maximum": "40", "minimum": "0", "location": "query", "type": "integer"}, "q": {"required": true, "type": "string", "location": "query"}, "source": {"type": "string", "location": "query"}, "startIndex": {"format": "uint32", "minimum": "0", "type": "integer", "location": "query"}, "download": {"enum": ["epub"], "type": "string", "location": "query"}, "partner": {"type": "string", "location": "query"}, "showPreorders": {"type": "boolean", "location": "query"}}, "id": "books.volumes.list", "httpMethod": "GET", "path": "volumes", "response": {"$ref": "Volumes"}}, "get": {"scopes": ["https://www.googleapis.com/auth/books"], "parameters": {"partner": {"type": "string", "location": "query"}, "source": {"type": "string", "location": "query"}, "projection": {"enum": ["full", "lite"], "type": "string", "location": "query"}, "volumeId": {"required": true, "type": "string", "location": "path"}, "country": {"type": "string", "location": "query"}}, "id": "books.volumes.get", "httpMethod": "GET", "path": "volumes/{volumeId}", "response": {"$ref": "Volume"}}}}', true)); + $this->mylibrary = new MylibraryServiceResource($this, $this->serviceName, 'mylibrary', json_decode('{}', true)); + $this->mylibrary_bookshelves = new MylibraryBookshelvesServiceResource($this, $this->serviceName, 'bookshelves', json_decode('{"methods": {"clearVolumes": {"scopes": ["https://www.googleapis.com/auth/books"], "parameters": {"country": {"type": "string", "location": "query"}, "shelf": {"required": true, "type": "string", "location": "path"}, "source": {"type": "string", "location": "query"}}, "httpMethod": "POST", "path": "mylibrary/bookshelves/{shelf}/clearVolumes", "id": "books.mylibrary.bookshelves.clearVolumes"}, "removeVolume": {"scopes": ["https://www.googleapis.com/auth/books"], "parameters": {"country": {"type": "string", "location": "query"}, "volumeId": {"required": true, "type": "string", "location": "query"}, "shelf": {"required": true, "type": "string", "location": "path"}, "source": {"type": "string", "location": "query"}}, "httpMethod": "POST", "path": "mylibrary/bookshelves/{shelf}/removeVolume", "id": "books.mylibrary.bookshelves.removeVolume"}, "list": {"scopes": ["https://www.googleapis.com/auth/books"], "parameters": {"country": {"type": "string", "location": "query"}, "source": {"type": "string", "location": "query"}}, "response": {"$ref": "Bookshelves"}, "httpMethod": "GET", "path": "mylibrary/bookshelves", "id": "books.mylibrary.bookshelves.list"}, "addVolume": {"scopes": ["https://www.googleapis.com/auth/books"], "parameters": {"country": {"type": "string", "location": "query"}, "volumeId": {"required": true, "type": "string", "location": "query"}, "shelf": {"required": true, "type": "string", "location": "path"}, "source": {"type": "string", "location": "query"}}, "httpMethod": "POST", "path": "mylibrary/bookshelves/{shelf}/addVolume", "id": "books.mylibrary.bookshelves.addVolume"}, "get": {"scopes": ["https://www.googleapis.com/auth/books"], "parameters": {"country": {"type": "string", "location": "query"}, "shelf": {"required": true, "type": "string", "location": "path"}, "source": {"type": "string", "location": "query"}}, "id": "books.mylibrary.bookshelves.get", "httpMethod": "GET", "path": "mylibrary/bookshelves/{shelf}", "response": {"$ref": "Bookshelf"}}}}', true)); + $this->mylibrary_annotations = new MylibraryAnnotationsServiceResource($this, $this->serviceName, 'annotations', json_decode('{"methods": {"insert": {"scopes": ["https://www.googleapis.com/auth/books"], "parameters": {"country": {"type": "string", "location": "query"}, "source": {"type": "string", "location": "query"}}, "request": {"$ref": "Annotation"}, "id": "books.mylibrary.annotations.insert", "httpMethod": "POST", "path": "mylibrary/annotations", "response": {"$ref": "Annotation"}}, "delete": {"scopes": ["https://www.googleapis.com/auth/books"], "parameters": {"country": {"type": "string", "location": "query"}, "annotationId": {"required": true, "type": "string", "location": "path"}, "source": {"type": "string", "location": "query"}}, "httpMethod": "DELETE", "path": "mylibrary/annotations/{annotationId}", "id": "books.mylibrary.annotations.delete"}, "list": {"scopes": ["https://www.googleapis.com/auth/books"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "country": {"type": "string", "location": "query"}, "volumeId": {"type": "string", "location": "query"}, "maxResults": {"format": "uint32", "maximum": "40", "minimum": "0", "location": "query", "type": "integer"}, "source": {"type": "string", "location": "query"}, "pageIds": {"repeated": true, "type": "string", "location": "query"}, "contentVersion": {"type": "string", "location": "query"}, "layerId": {"type": "string", "location": "query"}}, "response": {"$ref": "Annotations"}, "httpMethod": "GET", "path": "mylibrary/annotations", "id": "books.mylibrary.annotations.list"}, "update": {"scopes": ["https://www.googleapis.com/auth/books"], "parameters": {"country": {"type": "string", "location": "query"}, "annotationId": {"required": true, "type": "string", "location": "path"}, "source": {"type": "string", "location": "query"}}, "request": {"$ref": "Annotation"}, "id": "books.mylibrary.annotations.update", "httpMethod": "PUT", "path": "mylibrary/annotations/{annotationId}", "response": {"$ref": "Annotation"}}, "get": {"scopes": ["https://www.googleapis.com/auth/books"], "parameters": {"country": {"type": "string", "location": "query"}, "annotationId": {"required": true, "type": "string", "location": "path"}, "source": {"type": "string", "location": "query"}}, "id": "books.mylibrary.annotations.get", "httpMethod": "GET", "path": "mylibrary/annotations/{annotationId}", "response": {"$ref": "Annotation"}}}}', true)); + } +} + +class Annotation extends apiModel { + public $kind; + public $updated; + public $created; + public $beforeSelectedText; + protected $__currentVersionRangesType = 'AnnotationCurrentVersionRanges'; + protected $__currentVersionRangesDataType = ''; + public $currentVersionRanges; + public $afterSelectedText; + protected $__clientVersionRangesType = 'AnnotationClientVersionRanges'; + protected $__clientVersionRangesDataType = ''; + public $clientVersionRanges; + public $volumeId; + public $pageIds; + public $layerId; + public $selectedText; + public $highlightStyle; + public $data; + public $id; + public $selfLink; + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setUpdated($updated) { + $this->updated = $updated; + } + public function getUpdated() { + return $this->updated; + } + public function setCreated($created) { + $this->created = $created; + } + public function getCreated() { + return $this->created; + } + public function setBeforeSelectedText($beforeSelectedText) { + $this->beforeSelectedText = $beforeSelectedText; + } + public function getBeforeSelectedText() { + return $this->beforeSelectedText; + } + public function setCurrentVersionRanges(AnnotationCurrentVersionRanges $currentVersionRanges) { + $this->currentVersionRanges = $currentVersionRanges; + } + public function getCurrentVersionRanges() { + return $this->currentVersionRanges; + } + public function setAfterSelectedText($afterSelectedText) { + $this->afterSelectedText = $afterSelectedText; + } + public function getAfterSelectedText() { + return $this->afterSelectedText; + } + public function setClientVersionRanges(AnnotationClientVersionRanges $clientVersionRanges) { + $this->clientVersionRanges = $clientVersionRanges; + } + public function getClientVersionRanges() { + return $this->clientVersionRanges; + } + public function setVolumeId($volumeId) { + $this->volumeId = $volumeId; + } + public function getVolumeId() { + return $this->volumeId; + } + public function setPageIds(/* array(string) */ $pageIds) { + $this->assertIsArray($pageIds, 'string', __METHOD__); + $this->pageIds = $pageIds; + } + public function getPageIds() { + return $this->pageIds; + } + public function setLayerId($layerId) { + $this->layerId = $layerId; + } + public function getLayerId() { + return $this->layerId; + } + public function setSelectedText($selectedText) { + $this->selectedText = $selectedText; + } + public function getSelectedText() { + return $this->selectedText; + } + public function setHighlightStyle($highlightStyle) { + $this->highlightStyle = $highlightStyle; + } + public function getHighlightStyle() { + return $this->highlightStyle; + } + public function setData($data) { + $this->data = $data; + } + public function getData() { + return $this->data; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setSelfLink($selfLink) { + $this->selfLink = $selfLink; + } + public function getSelfLink() { + return $this->selfLink; + } +} + +class AnnotationClientVersionRanges extends apiModel { + public $contentVersion; + protected $__gbTextRangeType = 'BooksAnnotationsRange'; + protected $__gbTextRangeDataType = ''; + public $gbTextRange; + protected $__cfiRangeType = 'BooksAnnotationsRange'; + protected $__cfiRangeDataType = ''; + public $cfiRange; + protected $__gbImageRangeType = 'BooksAnnotationsRange'; + protected $__gbImageRangeDataType = ''; + public $gbImageRange; + public function setContentVersion($contentVersion) { + $this->contentVersion = $contentVersion; + } + public function getContentVersion() { + return $this->contentVersion; + } + public function setGbTextRange(BooksAnnotationsRange $gbTextRange) { + $this->gbTextRange = $gbTextRange; + } + public function getGbTextRange() { + return $this->gbTextRange; + } + public function setCfiRange(BooksAnnotationsRange $cfiRange) { + $this->cfiRange = $cfiRange; + } + public function getCfiRange() { + return $this->cfiRange; + } + public function setGbImageRange(BooksAnnotationsRange $gbImageRange) { + $this->gbImageRange = $gbImageRange; + } + public function getGbImageRange() { + return $this->gbImageRange; + } +} + +class AnnotationCurrentVersionRanges extends apiModel { + public $contentVersion; + protected $__gbTextRangeType = 'BooksAnnotationsRange'; + protected $__gbTextRangeDataType = ''; + public $gbTextRange; + protected $__cfiRangeType = 'BooksAnnotationsRange'; + protected $__cfiRangeDataType = ''; + public $cfiRange; + protected $__gbImageRangeType = 'BooksAnnotationsRange'; + protected $__gbImageRangeDataType = ''; + public $gbImageRange; + public function setContentVersion($contentVersion) { + $this->contentVersion = $contentVersion; + } + public function getContentVersion() { + return $this->contentVersion; + } + public function setGbTextRange(BooksAnnotationsRange $gbTextRange) { + $this->gbTextRange = $gbTextRange; + } + public function getGbTextRange() { + return $this->gbTextRange; + } + public function setCfiRange(BooksAnnotationsRange $cfiRange) { + $this->cfiRange = $cfiRange; + } + public function getCfiRange() { + return $this->cfiRange; + } + public function setGbImageRange(BooksAnnotationsRange $gbImageRange) { + $this->gbImageRange = $gbImageRange; + } + public function getGbImageRange() { + return $this->gbImageRange; + } +} + +class Annotations extends apiModel { + public $nextPageToken; + protected $__itemsType = 'Annotation'; + protected $__itemsDataType = 'array'; + public $items; + public $kind; + public $totalItems; + public function setNextPageToken($nextPageToken) { + $this->nextPageToken = $nextPageToken; + } + public function getNextPageToken() { + return $this->nextPageToken; + } + public function setItems(/* array(Annotation) */ $items) { + $this->assertIsArray($items, 'Annotation', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setTotalItems($totalItems) { + $this->totalItems = $totalItems; + } + public function getTotalItems() { + return $this->totalItems; + } +} + +class BooksAnnotationsRange extends apiModel { + public $startPosition; + public $endPosition; + public $startOffset; + public $endOffset; + public function setStartPosition($startPosition) { + $this->startPosition = $startPosition; + } + public function getStartPosition() { + return $this->startPosition; + } + public function setEndPosition($endPosition) { + $this->endPosition = $endPosition; + } + public function getEndPosition() { + return $this->endPosition; + } + public function setStartOffset($startOffset) { + $this->startOffset = $startOffset; + } + public function getStartOffset() { + return $this->startOffset; + } + public function setEndOffset($endOffset) { + $this->endOffset = $endOffset; + } + public function getEndOffset() { + return $this->endOffset; + } +} + +class Bookshelf extends apiModel { + public $kind; + public $description; + public $created; + public $volumeCount; + public $title; + public $updated; + public $access; + public $volumesLastUpdated; + public $id; + public $selfLink; + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setDescription($description) { + $this->description = $description; + } + public function getDescription() { + return $this->description; + } + public function setCreated($created) { + $this->created = $created; + } + public function getCreated() { + return $this->created; + } + public function setVolumeCount($volumeCount) { + $this->volumeCount = $volumeCount; + } + public function getVolumeCount() { + return $this->volumeCount; + } + public function setTitle($title) { + $this->title = $title; + } + public function getTitle() { + return $this->title; + } + public function setUpdated($updated) { + $this->updated = $updated; + } + public function getUpdated() { + return $this->updated; + } + public function setAccess($access) { + $this->access = $access; + } + public function getAccess() { + return $this->access; + } + public function setVolumesLastUpdated($volumesLastUpdated) { + $this->volumesLastUpdated = $volumesLastUpdated; + } + public function getVolumesLastUpdated() { + return $this->volumesLastUpdated; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setSelfLink($selfLink) { + $this->selfLink = $selfLink; + } + public function getSelfLink() { + return $this->selfLink; + } +} + +class Bookshelves extends apiModel { + protected $__itemsType = 'Bookshelf'; + protected $__itemsDataType = 'array'; + public $items; + public $kind; + public function setItems(/* array(Bookshelf) */ $items) { + $this->assertIsArray($items, 'Bookshelf', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } +} + +class ConcurrentAccessRestriction extends apiModel { + public $nonce; + public $kind; + public $restricted; + public $volumeId; + public $maxConcurrentDevices; + public $deviceAllowed; + public $source; + public $timeWindowSeconds; + public $signature; + public $reasonCode; + public $message; + public function setNonce($nonce) { + $this->nonce = $nonce; + } + public function getNonce() { + return $this->nonce; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setRestricted($restricted) { + $this->restricted = $restricted; + } + public function getRestricted() { + return $this->restricted; + } + public function setVolumeId($volumeId) { + $this->volumeId = $volumeId; + } + public function getVolumeId() { + return $this->volumeId; + } + public function setMaxConcurrentDevices($maxConcurrentDevices) { + $this->maxConcurrentDevices = $maxConcurrentDevices; + } + public function getMaxConcurrentDevices() { + return $this->maxConcurrentDevices; + } + public function setDeviceAllowed($deviceAllowed) { + $this->deviceAllowed = $deviceAllowed; + } + public function getDeviceAllowed() { + return $this->deviceAllowed; + } + public function setSource($source) { + $this->source = $source; + } + public function getSource() { + return $this->source; + } + public function setTimeWindowSeconds($timeWindowSeconds) { + $this->timeWindowSeconds = $timeWindowSeconds; + } + public function getTimeWindowSeconds() { + return $this->timeWindowSeconds; + } + public function setSignature($signature) { + $this->signature = $signature; + } + public function getSignature() { + return $this->signature; + } + public function setReasonCode($reasonCode) { + $this->reasonCode = $reasonCode; + } + public function getReasonCode() { + return $this->reasonCode; + } + public function setMessage($message) { + $this->message = $message; + } + public function getMessage() { + return $this->message; + } +} + +class DownloadAccessRestriction extends apiModel { + public $nonce; + public $kind; + public $justAcquired; + public $maxDownloadDevices; + public $downloadsAcquired; + public $signature; + public $volumeId; + public $deviceAllowed; + public $source; + public $restricted; + public $reasonCode; + public $message; + public function setNonce($nonce) { + $this->nonce = $nonce; + } + public function getNonce() { + return $this->nonce; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setJustAcquired($justAcquired) { + $this->justAcquired = $justAcquired; + } + public function getJustAcquired() { + return $this->justAcquired; + } + public function setMaxDownloadDevices($maxDownloadDevices) { + $this->maxDownloadDevices = $maxDownloadDevices; + } + public function getMaxDownloadDevices() { + return $this->maxDownloadDevices; + } + public function setDownloadsAcquired($downloadsAcquired) { + $this->downloadsAcquired = $downloadsAcquired; + } + public function getDownloadsAcquired() { + return $this->downloadsAcquired; + } + public function setSignature($signature) { + $this->signature = $signature; + } + public function getSignature() { + return $this->signature; + } + public function setVolumeId($volumeId) { + $this->volumeId = $volumeId; + } + public function getVolumeId() { + return $this->volumeId; + } + public function setDeviceAllowed($deviceAllowed) { + $this->deviceAllowed = $deviceAllowed; + } + public function getDeviceAllowed() { + return $this->deviceAllowed; + } + public function setSource($source) { + $this->source = $source; + } + public function getSource() { + return $this->source; + } + public function setRestricted($restricted) { + $this->restricted = $restricted; + } + public function getRestricted() { + return $this->restricted; + } + public function setReasonCode($reasonCode) { + $this->reasonCode = $reasonCode; + } + public function getReasonCode() { + return $this->reasonCode; + } + public function setMessage($message) { + $this->message = $message; + } + public function getMessage() { + return $this->message; + } +} + +class DownloadAccesses extends apiModel { + protected $__downloadAccessListType = 'DownloadAccessRestriction'; + protected $__downloadAccessListDataType = 'array'; + public $downloadAccessList; + public $kind; + public function setDownloadAccessList(/* array(DownloadAccessRestriction) */ $downloadAccessList) { + $this->assertIsArray($downloadAccessList, 'DownloadAccessRestriction', __METHOD__); + $this->downloadAccessList = $downloadAccessList; + } + public function getDownloadAccessList() { + return $this->downloadAccessList; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } +} + +class ReadingPosition extends apiModel { + public $kind; + public $gbImagePosition; + public $epubCfiPosition; + public $updated; + public $volumeId; + public $pdfPosition; + public $gbTextPosition; + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setGbImagePosition($gbImagePosition) { + $this->gbImagePosition = $gbImagePosition; + } + public function getGbImagePosition() { + return $this->gbImagePosition; + } + public function setEpubCfiPosition($epubCfiPosition) { + $this->epubCfiPosition = $epubCfiPosition; + } + public function getEpubCfiPosition() { + return $this->epubCfiPosition; + } + public function setUpdated($updated) { + $this->updated = $updated; + } + public function getUpdated() { + return $this->updated; + } + public function setVolumeId($volumeId) { + $this->volumeId = $volumeId; + } + public function getVolumeId() { + return $this->volumeId; + } + public function setPdfPosition($pdfPosition) { + $this->pdfPosition = $pdfPosition; + } + public function getPdfPosition() { + return $this->pdfPosition; + } + public function setGbTextPosition($gbTextPosition) { + $this->gbTextPosition = $gbTextPosition; + } + public function getGbTextPosition() { + return $this->gbTextPosition; + } +} + +class RequestAccess extends apiModel { + protected $__downloadAccessType = 'DownloadAccessRestriction'; + protected $__downloadAccessDataType = ''; + public $downloadAccess; + public $kind; + protected $__concurrentAccessType = 'ConcurrentAccessRestriction'; + protected $__concurrentAccessDataType = ''; + public $concurrentAccess; + public function setDownloadAccess(DownloadAccessRestriction $downloadAccess) { + $this->downloadAccess = $downloadAccess; + } + public function getDownloadAccess() { + return $this->downloadAccess; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setConcurrentAccess(ConcurrentAccessRestriction $concurrentAccess) { + $this->concurrentAccess = $concurrentAccess; + } + public function getConcurrentAccess() { + return $this->concurrentAccess; + } +} + +class Review extends apiModel { + public $rating; + public $kind; + protected $__authorType = 'ReviewAuthor'; + protected $__authorDataType = ''; + public $author; + public $title; + public $volumeId; + public $content; + protected $__sourceType = 'ReviewSource'; + protected $__sourceDataType = ''; + public $source; + public $date; + public $type; + public $fullTextUrl; + public function setRating($rating) { + $this->rating = $rating; + } + public function getRating() { + return $this->rating; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setAuthor(ReviewAuthor $author) { + $this->author = $author; + } + public function getAuthor() { + return $this->author; + } + public function setTitle($title) { + $this->title = $title; + } + public function getTitle() { + return $this->title; + } + public function setVolumeId($volumeId) { + $this->volumeId = $volumeId; + } + public function getVolumeId() { + return $this->volumeId; + } + public function setContent($content) { + $this->content = $content; + } + public function getContent() { + return $this->content; + } + public function setSource(ReviewSource $source) { + $this->source = $source; + } + public function getSource() { + return $this->source; + } + public function setDate($date) { + $this->date = $date; + } + public function getDate() { + return $this->date; + } + public function setType($type) { + $this->type = $type; + } + public function getType() { + return $this->type; + } + public function setFullTextUrl($fullTextUrl) { + $this->fullTextUrl = $fullTextUrl; + } + public function getFullTextUrl() { + return $this->fullTextUrl; + } +} + +class ReviewAuthor extends apiModel { + public $displayName; + public function setDisplayName($displayName) { + $this->displayName = $displayName; + } + public function getDisplayName() { + return $this->displayName; + } +} + +class ReviewSource extends apiModel { + public $extraDescription; + public $url; + public $description; + public function setExtraDescription($extraDescription) { + $this->extraDescription = $extraDescription; + } + public function getExtraDescription() { + return $this->extraDescription; + } + public function setUrl($url) { + $this->url = $url; + } + public function getUrl() { + return $this->url; + } + public function setDescription($description) { + $this->description = $description; + } + public function getDescription() { + return $this->description; + } +} + +class Volume extends apiModel { + public $kind; + protected $__accessInfoType = 'VolumeAccessInfo'; + protected $__accessInfoDataType = ''; + public $accessInfo; + protected $__saleInfoType = 'VolumeSaleInfo'; + protected $__saleInfoDataType = ''; + public $saleInfo; + public $etag; + protected $__userInfoType = 'VolumeUserInfo'; + protected $__userInfoDataType = ''; + public $userInfo; + protected $__volumeInfoType = 'VolumeVolumeInfo'; + protected $__volumeInfoDataType = ''; + public $volumeInfo; + public $id; + public $selfLink; + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setAccessInfo(VolumeAccessInfo $accessInfo) { + $this->accessInfo = $accessInfo; + } + public function getAccessInfo() { + return $this->accessInfo; + } + public function setSaleInfo(VolumeSaleInfo $saleInfo) { + $this->saleInfo = $saleInfo; + } + public function getSaleInfo() { + return $this->saleInfo; + } + public function setEtag($etag) { + $this->etag = $etag; + } + public function getEtag() { + return $this->etag; + } + public function setUserInfo(VolumeUserInfo $userInfo) { + $this->userInfo = $userInfo; + } + public function getUserInfo() { + return $this->userInfo; + } + public function setVolumeInfo(VolumeVolumeInfo $volumeInfo) { + $this->volumeInfo = $volumeInfo; + } + public function getVolumeInfo() { + return $this->volumeInfo; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setSelfLink($selfLink) { + $this->selfLink = $selfLink; + } + public function getSelfLink() { + return $this->selfLink; + } +} + +class VolumeAccessInfo extends apiModel { + public $publicDomain; + public $embeddable; + protected $__downloadAccessType = 'DownloadAccessRestriction'; + protected $__downloadAccessDataType = ''; + public $downloadAccess; + public $country; + public $textToSpeechPermission; + protected $__pdfType = 'VolumeAccessInfoPdf'; + protected $__pdfDataType = ''; + public $pdf; + public $viewability; + protected $__epubType = 'VolumeAccessInfoEpub'; + protected $__epubDataType = ''; + public $epub; + public $accessViewStatus; + public function setPublicDomain($publicDomain) { + $this->publicDomain = $publicDomain; + } + public function getPublicDomain() { + return $this->publicDomain; + } + public function setEmbeddable($embeddable) { + $this->embeddable = $embeddable; + } + public function getEmbeddable() { + return $this->embeddable; + } + public function setDownloadAccess(DownloadAccessRestriction $downloadAccess) { + $this->downloadAccess = $downloadAccess; + } + public function getDownloadAccess() { + return $this->downloadAccess; + } + public function setCountry($country) { + $this->country = $country; + } + public function getCountry() { + return $this->country; + } + public function setTextToSpeechPermission($textToSpeechPermission) { + $this->textToSpeechPermission = $textToSpeechPermission; + } + public function getTextToSpeechPermission() { + return $this->textToSpeechPermission; + } + public function setPdf(VolumeAccessInfoPdf $pdf) { + $this->pdf = $pdf; + } + public function getPdf() { + return $this->pdf; + } + public function setViewability($viewability) { + $this->viewability = $viewability; + } + public function getViewability() { + return $this->viewability; + } + public function setEpub(VolumeAccessInfoEpub $epub) { + $this->epub = $epub; + } + public function getEpub() { + return $this->epub; + } + public function setAccessViewStatus($accessViewStatus) { + $this->accessViewStatus = $accessViewStatus; + } + public function getAccessViewStatus() { + return $this->accessViewStatus; + } +} + +class VolumeAccessInfoEpub extends apiModel { + public $downloadLink; + public $acsTokenLink; + public function setDownloadLink($downloadLink) { + $this->downloadLink = $downloadLink; + } + public function getDownloadLink() { + return $this->downloadLink; + } + public function setAcsTokenLink($acsTokenLink) { + $this->acsTokenLink = $acsTokenLink; + } + public function getAcsTokenLink() { + return $this->acsTokenLink; + } +} + +class VolumeAccessInfoPdf extends apiModel { + public $downloadLink; + public $acsTokenLink; + public function setDownloadLink($downloadLink) { + $this->downloadLink = $downloadLink; + } + public function getDownloadLink() { + return $this->downloadLink; + } + public function setAcsTokenLink($acsTokenLink) { + $this->acsTokenLink = $acsTokenLink; + } + public function getAcsTokenLink() { + return $this->acsTokenLink; + } +} + +class VolumeSaleInfo extends apiModel { + public $country; + protected $__retailPriceType = 'VolumeSaleInfoRetailPrice'; + protected $__retailPriceDataType = ''; + public $retailPrice; + public $isEbook; + public $saleability; + public $buyLink; + public $onSaleDate; + protected $__listPriceType = 'VolumeSaleInfoListPrice'; + protected $__listPriceDataType = ''; + public $listPrice; + public function setCountry($country) { + $this->country = $country; + } + public function getCountry() { + return $this->country; + } + public function setRetailPrice(VolumeSaleInfoRetailPrice $retailPrice) { + $this->retailPrice = $retailPrice; + } + public function getRetailPrice() { + return $this->retailPrice; + } + public function setIsEbook($isEbook) { + $this->isEbook = $isEbook; + } + public function getIsEbook() { + return $this->isEbook; + } + public function setSaleability($saleability) { + $this->saleability = $saleability; + } + public function getSaleability() { + return $this->saleability; + } + public function setBuyLink($buyLink) { + $this->buyLink = $buyLink; + } + public function getBuyLink() { + return $this->buyLink; + } + public function setOnSaleDate($onSaleDate) { + $this->onSaleDate = $onSaleDate; + } + public function getOnSaleDate() { + return $this->onSaleDate; + } + public function setListPrice(VolumeSaleInfoListPrice $listPrice) { + $this->listPrice = $listPrice; + } + public function getListPrice() { + return $this->listPrice; + } +} + +class VolumeSaleInfoListPrice extends apiModel { + public $amount; + public $currencyCode; + public function setAmount($amount) { + $this->amount = $amount; + } + public function getAmount() { + return $this->amount; + } + public function setCurrencyCode($currencyCode) { + $this->currencyCode = $currencyCode; + } + public function getCurrencyCode() { + return $this->currencyCode; + } +} + +class VolumeSaleInfoRetailPrice extends apiModel { + public $amount; + public $currencyCode; + public function setAmount($amount) { + $this->amount = $amount; + } + public function getAmount() { + return $this->amount; + } + public function setCurrencyCode($currencyCode) { + $this->currencyCode = $currencyCode; + } + public function getCurrencyCode() { + return $this->currencyCode; + } +} + +class VolumeUserInfo extends apiModel { + public $updated; + public $isPreordered; + public $isPurchased; + protected $__readingPositionType = 'ReadingPosition'; + protected $__readingPositionDataType = ''; + public $readingPosition; + protected $__reviewType = 'Review'; + protected $__reviewDataType = ''; + public $review; + public function setUpdated($updated) { + $this->updated = $updated; + } + public function getUpdated() { + return $this->updated; + } + public function setIsPreordered($isPreordered) { + $this->isPreordered = $isPreordered; + } + public function getIsPreordered() { + return $this->isPreordered; + } + public function setIsPurchased($isPurchased) { + $this->isPurchased = $isPurchased; + } + public function getIsPurchased() { + return $this->isPurchased; + } + public function setReadingPosition(ReadingPosition $readingPosition) { + $this->readingPosition = $readingPosition; + } + public function getReadingPosition() { + return $this->readingPosition; + } + public function setReview(Review $review) { + $this->review = $review; + } + public function getReview() { + return $this->review; + } +} + +class VolumeVolumeInfo extends apiModel { + public $publisher; + public $subtitle; + public $description; + public $language; + public $pageCount; + protected $__imageLinksType = 'VolumeVolumeInfoImageLinks'; + protected $__imageLinksDataType = ''; + public $imageLinks; + public $publishedDate; + public $previewLink; + public $printType; + public $ratingsCount; + public $mainCategory; + protected $__dimensionsType = 'VolumeVolumeInfoDimensions'; + protected $__dimensionsDataType = ''; + public $dimensions; + public $contentVersion; + protected $__industryIdentifiersType = 'VolumeVolumeInfoIndustryIdentifiers'; + protected $__industryIdentifiersDataType = 'array'; + public $industryIdentifiers; + public $authors; + public $title; + public $canonicalVolumeLink; + public $infoLink; + public $categories; + public $averageRating; + public function setPublisher($publisher) { + $this->publisher = $publisher; + } + public function getPublisher() { + return $this->publisher; + } + public function setSubtitle($subtitle) { + $this->subtitle = $subtitle; + } + public function getSubtitle() { + return $this->subtitle; + } + public function setDescription($description) { + $this->description = $description; + } + public function getDescription() { + return $this->description; + } + public function setLanguage($language) { + $this->language = $language; + } + public function getLanguage() { + return $this->language; + } + public function setPageCount($pageCount) { + $this->pageCount = $pageCount; + } + public function getPageCount() { + return $this->pageCount; + } + public function setImageLinks(VolumeVolumeInfoImageLinks $imageLinks) { + $this->imageLinks = $imageLinks; + } + public function getImageLinks() { + return $this->imageLinks; + } + public function setPublishedDate($publishedDate) { + $this->publishedDate = $publishedDate; + } + public function getPublishedDate() { + return $this->publishedDate; + } + public function setPreviewLink($previewLink) { + $this->previewLink = $previewLink; + } + public function getPreviewLink() { + return $this->previewLink; + } + public function setPrintType($printType) { + $this->printType = $printType; + } + public function getPrintType() { + return $this->printType; + } + public function setRatingsCount($ratingsCount) { + $this->ratingsCount = $ratingsCount; + } + public function getRatingsCount() { + return $this->ratingsCount; + } + public function setMainCategory($mainCategory) { + $this->mainCategory = $mainCategory; + } + public function getMainCategory() { + return $this->mainCategory; + } + public function setDimensions(VolumeVolumeInfoDimensions $dimensions) { + $this->dimensions = $dimensions; + } + public function getDimensions() { + return $this->dimensions; + } + public function setContentVersion($contentVersion) { + $this->contentVersion = $contentVersion; + } + public function getContentVersion() { + return $this->contentVersion; + } + public function setIndustryIdentifiers(/* array(VolumeVolumeInfoIndustryIdentifiers) */ $industryIdentifiers) { + $this->assertIsArray($industryIdentifiers, 'VolumeVolumeInfoIndustryIdentifiers', __METHOD__); + $this->industryIdentifiers = $industryIdentifiers; + } + public function getIndustryIdentifiers() { + return $this->industryIdentifiers; + } + public function setAuthors(/* array(string) */ $authors) { + $this->assertIsArray($authors, 'string', __METHOD__); + $this->authors = $authors; + } + public function getAuthors() { + return $this->authors; + } + public function setTitle($title) { + $this->title = $title; + } + public function getTitle() { + return $this->title; + } + public function setCanonicalVolumeLink($canonicalVolumeLink) { + $this->canonicalVolumeLink = $canonicalVolumeLink; + } + public function getCanonicalVolumeLink() { + return $this->canonicalVolumeLink; + } + public function setInfoLink($infoLink) { + $this->infoLink = $infoLink; + } + public function getInfoLink() { + return $this->infoLink; + } + public function setCategories(/* array(string) */ $categories) { + $this->assertIsArray($categories, 'string', __METHOD__); + $this->categories = $categories; + } + public function getCategories() { + return $this->categories; + } + public function setAverageRating($averageRating) { + $this->averageRating = $averageRating; + } + public function getAverageRating() { + return $this->averageRating; + } +} + +class VolumeVolumeInfoDimensions extends apiModel { + public $width; + public $thickness; + public $height; + public function setWidth($width) { + $this->width = $width; + } + public function getWidth() { + return $this->width; + } + public function setThickness($thickness) { + $this->thickness = $thickness; + } + public function getThickness() { + return $this->thickness; + } + public function setHeight($height) { + $this->height = $height; + } + public function getHeight() { + return $this->height; + } +} + +class VolumeVolumeInfoImageLinks extends apiModel { + public $medium; + public $smallThumbnail; + public $large; + public $extraLarge; + public $small; + public $thumbnail; + public function setMedium($medium) { + $this->medium = $medium; + } + public function getMedium() { + return $this->medium; + } + public function setSmallThumbnail($smallThumbnail) { + $this->smallThumbnail = $smallThumbnail; + } + public function getSmallThumbnail() { + return $this->smallThumbnail; + } + public function setLarge($large) { + $this->large = $large; + } + public function getLarge() { + return $this->large; + } + public function setExtraLarge($extraLarge) { + $this->extraLarge = $extraLarge; + } + public function getExtraLarge() { + return $this->extraLarge; + } + public function setSmall($small) { + $this->small = $small; + } + public function getSmall() { + return $this->small; + } + public function setThumbnail($thumbnail) { + $this->thumbnail = $thumbnail; + } + public function getThumbnail() { + return $this->thumbnail; + } +} + +class VolumeVolumeInfoIndustryIdentifiers extends apiModel { + public $identifier; + public $type; + public function setIdentifier($identifier) { + $this->identifier = $identifier; + } + public function getIdentifier() { + return $this->identifier; + } + public function setType($type) { + $this->type = $type; + } + public function getType() { + return $this->type; + } +} + +class Volumes extends apiModel { + public $totalItems; + protected $__itemsType = 'Volume'; + protected $__itemsDataType = 'array'; + public $items; + public $kind; + public function setTotalItems($totalItems) { + $this->totalItems = $totalItems; + } + public function getTotalItems() { + return $this->totalItems; + } + public function setItems(/* array(Volume) */ $items) { + $this->assertIsArray($items, 'Volume', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } +} diff --git a/webui/google-api/contrib/apiCalendarService.php b/webui/google-api/contrib/apiCalendarService.php new file mode 100644 index 0000000..e2991f9 --- /dev/null +++ b/webui/google-api/contrib/apiCalendarService.php @@ -0,0 +1,1863 @@ + + * $calendarService = new apiCalendarService(...); + * $freebusy = $calendarService->freebusy; + * + */ + class FreebusyServiceResource extends apiServiceResource { + + + /** + * Returns free/busy information for a set of calendars. (freebusy.query) + * + * @param FreeBusyRequest $postBody + * @return FreeBusyResponse + */ + public function query(FreeBusyRequest $postBody, $optParams = array()) { + $params = array('postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('query', array($params)); + if ($this->useObjects()) { + return new FreeBusyResponse($data); + } else { + return $data; + } + } + } + + /** + * The "settings" collection of methods. + * Typical usage is: + * + * $calendarService = new apiCalendarService(...); + * $settings = $calendarService->settings; + * + */ + class SettingsServiceResource extends apiServiceResource { + + + /** + * Returns all user settings for the authenticated user. (settings.list) + * + * @return Settings + */ + public function listSettings($optParams = array()) { + $params = array(); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new Settings($data); + } else { + return $data; + } + } + /** + * Returns a single user setting. (settings.get) + * + * @param string $setting Name of the user setting. + * @return Setting + */ + public function get($setting, $optParams = array()) { + $params = array('setting' => $setting); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new Setting($data); + } else { + return $data; + } + } + } + + /** + * The "calendarList" collection of methods. + * Typical usage is: + * + * $calendarService = new apiCalendarService(...); + * $calendarList = $calendarService->calendarList; + * + */ + class CalendarListServiceResource extends apiServiceResource { + + + /** + * Adds an entry to the user's calendar list. (calendarList.insert) + * + * @param CalendarListEntry $postBody + * @return CalendarListEntry + */ + public function insert(CalendarListEntry $postBody, $optParams = array()) { + $params = array('postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('insert', array($params)); + if ($this->useObjects()) { + return new CalendarListEntry($data); + } else { + return $data; + } + } + /** + * Returns an entry on the user's calendar list. (calendarList.get) + * + * @param string $calendarId Calendar identifier. + * @return CalendarListEntry + */ + public function get($calendarId, $optParams = array()) { + $params = array('calendarId' => $calendarId); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new CalendarListEntry($data); + } else { + return $data; + } + } + /** + * Returns entries on the user's calendar list. (calendarList.list) + * + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string pageToken Token specifying which result page to return. Optional. + * @opt_param bool showHidden Whether to show hidden entries. Optional. The default is False. + * @opt_param int maxResults Maximum number of entries returned on one result page. Optional. + * @opt_param string minAccessRole The minimum access role for the user in the returned entires. Optional. The default is no restriction. + * @return CalendarList + */ + public function listCalendarList($optParams = array()) { + $params = array(); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new CalendarList($data); + } else { + return $data; + } + } + /** + * Updates an entry on the user's calendar list. (calendarList.update) + * + * @param string $calendarId Calendar identifier. + * @param CalendarListEntry $postBody + * @return CalendarListEntry + */ + public function update($calendarId, CalendarListEntry $postBody, $optParams = array()) { + $params = array('calendarId' => $calendarId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('update', array($params)); + if ($this->useObjects()) { + return new CalendarListEntry($data); + } else { + return $data; + } + } + /** + * Updates an entry on the user's calendar list. This method supports patch semantics. + * (calendarList.patch) + * + * @param string $calendarId Calendar identifier. + * @param CalendarListEntry $postBody + * @return CalendarListEntry + */ + public function patch($calendarId, CalendarListEntry $postBody, $optParams = array()) { + $params = array('calendarId' => $calendarId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('patch', array($params)); + if ($this->useObjects()) { + return new CalendarListEntry($data); + } else { + return $data; + } + } + /** + * Deletes an entry on the user's calendar list. (calendarList.delete) + * + * @param string $calendarId Calendar identifier. + */ + public function delete($calendarId, $optParams = array()) { + $params = array('calendarId' => $calendarId); + $params = array_merge($params, $optParams); + $data = $this->__call('delete', array($params)); + return $data; + } + } + + /** + * The "calendars" collection of methods. + * Typical usage is: + * + * $calendarService = new apiCalendarService(...); + * $calendars = $calendarService->calendars; + * + */ + class CalendarsServiceResource extends apiServiceResource { + + + /** + * Creates a secondary calendar. (calendars.insert) + * + * @param Calendar $postBody + * @return Calendar + */ + public function insert(Calendar $postBody, $optParams = array()) { + $params = array('postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('insert', array($params)); + if ($this->useObjects()) { + return new Calendar($data); + } else { + return $data; + } + } + /** + * Returns metadata for a calendar. (calendars.get) + * + * @param string $calendarId Calendar identifier. + * @return Calendar + */ + public function get($calendarId, $optParams = array()) { + $params = array('calendarId' => $calendarId); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new Calendar($data); + } else { + return $data; + } + } + /** + * Clears a primary calendar. This operation deletes all data associated with the primary calendar + * of an account and cannot be undone. (calendars.clear) + * + * @param string $calendarId Calendar identifier. + */ + public function clear($calendarId, $optParams = array()) { + $params = array('calendarId' => $calendarId); + $params = array_merge($params, $optParams); + $data = $this->__call('clear', array($params)); + return $data; + } + /** + * Updates metadata for a calendar. (calendars.update) + * + * @param string $calendarId Calendar identifier. + * @param Calendar $postBody + * @return Calendar + */ + public function update($calendarId, Calendar $postBody, $optParams = array()) { + $params = array('calendarId' => $calendarId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('update', array($params)); + if ($this->useObjects()) { + return new Calendar($data); + } else { + return $data; + } + } + /** + * Updates metadata for a calendar. This method supports patch semantics. (calendars.patch) + * + * @param string $calendarId Calendar identifier. + * @param Calendar $postBody + * @return Calendar + */ + public function patch($calendarId, Calendar $postBody, $optParams = array()) { + $params = array('calendarId' => $calendarId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('patch', array($params)); + if ($this->useObjects()) { + return new Calendar($data); + } else { + return $data; + } + } + /** + * Deletes a secondary calendar. (calendars.delete) + * + * @param string $calendarId Calendar identifier. + */ + public function delete($calendarId, $optParams = array()) { + $params = array('calendarId' => $calendarId); + $params = array_merge($params, $optParams); + $data = $this->__call('delete', array($params)); + return $data; + } + } + + /** + * The "acl" collection of methods. + * Typical usage is: + * + * $calendarService = new apiCalendarService(...); + * $acl = $calendarService->acl; + * + */ + class AclServiceResource extends apiServiceResource { + + + /** + * Creates an access control rule. (acl.insert) + * + * @param string $calendarId Calendar identifier. + * @param AclRule $postBody + * @return AclRule + */ + public function insert($calendarId, AclRule $postBody, $optParams = array()) { + $params = array('calendarId' => $calendarId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('insert', array($params)); + if ($this->useObjects()) { + return new AclRule($data); + } else { + return $data; + } + } + /** + * Returns an access control rule. (acl.get) + * + * @param string $calendarId Calendar identifier. + * @param string $ruleId ACL rule identifier. + * @return AclRule + */ + public function get($calendarId, $ruleId, $optParams = array()) { + $params = array('calendarId' => $calendarId, 'ruleId' => $ruleId); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new AclRule($data); + } else { + return $data; + } + } + /** + * Returns the rules in the access control list for the calendar. (acl.list) + * + * @param string $calendarId Calendar identifier. + * @return Acl + */ + public function listAcl($calendarId, $optParams = array()) { + $params = array('calendarId' => $calendarId); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new Acl($data); + } else { + return $data; + } + } + /** + * Updates an access control rule. (acl.update) + * + * @param string $calendarId Calendar identifier. + * @param string $ruleId ACL rule identifier. + * @param AclRule $postBody + * @return AclRule + */ + public function update($calendarId, $ruleId, AclRule $postBody, $optParams = array()) { + $params = array('calendarId' => $calendarId, 'ruleId' => $ruleId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('update', array($params)); + if ($this->useObjects()) { + return new AclRule($data); + } else { + return $data; + } + } + /** + * Updates an access control rule. This method supports patch semantics. (acl.patch) + * + * @param string $calendarId Calendar identifier. + * @param string $ruleId ACL rule identifier. + * @param AclRule $postBody + * @return AclRule + */ + public function patch($calendarId, $ruleId, AclRule $postBody, $optParams = array()) { + $params = array('calendarId' => $calendarId, 'ruleId' => $ruleId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('patch', array($params)); + if ($this->useObjects()) { + return new AclRule($data); + } else { + return $data; + } + } + /** + * Deletes an access control rule. (acl.delete) + * + * @param string $calendarId Calendar identifier. + * @param string $ruleId ACL rule identifier. + */ + public function delete($calendarId, $ruleId, $optParams = array()) { + $params = array('calendarId' => $calendarId, 'ruleId' => $ruleId); + $params = array_merge($params, $optParams); + $data = $this->__call('delete', array($params)); + return $data; + } + } + + /** + * The "colors" collection of methods. + * Typical usage is: + * + * $calendarService = new apiCalendarService(...); + * $colors = $calendarService->colors; + * + */ + class ColorsServiceResource extends apiServiceResource { + + + /** + * Returns the color definitions for calendars and events. (colors.get) + * + * @return Colors + */ + public function get($optParams = array()) { + $params = array(); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new Colors($data); + } else { + return $data; + } + } + } + + /** + * The "events" collection of methods. + * Typical usage is: + * + * $calendarService = new apiCalendarService(...); + * $events = $calendarService->events; + * + */ + class EventsServiceResource extends apiServiceResource { + + + /** + * Resets a specialized instance of a recurring event to its original state. (events.reset) + * + * @param string $calendarId Calendar identifier. + * @param string $eventId Event identifier. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param bool sendNotifications Whether to send notifications about the event update. Optional. The default is False. + * @return Event + */ + public function reset($calendarId, $eventId, $optParams = array()) { + $params = array('calendarId' => $calendarId, 'eventId' => $eventId); + $params = array_merge($params, $optParams); + $data = $this->__call('reset', array($params)); + if ($this->useObjects()) { + return new Event($data); + } else { + return $data; + } + } + /** + * Creates an event. (events.insert) + * + * @param string $calendarId Calendar identifier. + * @param Event $postBody + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param bool sendNotifications Whether to send notifications about the creation of the new event. Optional. The default is False. + * @return Event + */ + public function insert($calendarId, Event $postBody, $optParams = array()) { + $params = array('calendarId' => $calendarId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('insert', array($params)); + if ($this->useObjects()) { + return new Event($data); + } else { + return $data; + } + } + /** + * Returns an event. (events.get) + * + * @param string $calendarId Calendar identifier. + * @param string $eventId Event identifier. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string timeZone Time zone used in the response. Optional. The default is the time zone of the calendar. + * @opt_param int maxAttendees The maximum number of attendees to include in the response. If there are more than the specified number of attendees, only the participant is returned. Optional. + * @return Event + */ + public function get($calendarId, $eventId, $optParams = array()) { + $params = array('calendarId' => $calendarId, 'eventId' => $eventId); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new Event($data); + } else { + return $data; + } + } + /** + * Moves an event to another calendar, i.e. changes an event's organizer. (events.move) + * + * @param string $calendarId Calendar identifier of the source calendar where the event currently is on. + * @param string $eventId Event identifier. + * @param string $destination Calendar identifier of the target calendar where the event is to be moved to. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param bool sendNotifications Whether to send notifications about the change of the event's organizer. Optional. The default is False. + * @return Event + */ + public function move($calendarId, $eventId, $destination, $optParams = array()) { + $params = array('calendarId' => $calendarId, 'eventId' => $eventId, 'destination' => $destination); + $params = array_merge($params, $optParams); + $data = $this->__call('move', array($params)); + if ($this->useObjects()) { + return new Event($data); + } else { + return $data; + } + } + /** + * Returns events on the specified calendar. (events.list) + * + * @param string $calendarId Calendar identifier. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string orderBy The order of the events returned in the result. Optional. The default is an unspecified, stable order. + * @opt_param bool showHiddenInvitations Whether to include hidden invitations in the result. Optional. The default is False. + * @opt_param bool showDeleted Whether to include deleted events (with 'eventStatus' equals 'cancelled') in the result. Optional. The default is False. + * @opt_param string iCalUID Specifies iCalendar UID (iCalUID) of events to be included in the response. Optional. + * @opt_param string updatedMin Lower bound for an event's last modification time (as a RFC 3339 timestamp) to filter by. Optional. The default is not to filter by last modification time. + * @opt_param bool singleEvents Whether to expand recurring events into instances and only return single one-off events and instances of recurring events, but not the underlying recurring events themselves. Optional. The default is False. + * @opt_param int maxResults Maximum number of events returned on one result page. Optional. + * @opt_param string q Free text search terms to find events that match these terms in any field, except for extended properties. Optional. + * @opt_param string pageToken Token specifying which result page to return. Optional. + * @opt_param string timeMin Lower bound (inclusive) for an event's end time to filter by. Optional. The default is not to filter by end time. + * @opt_param string timeZone Time zone used in the response. Optional. The default is the time zone of the calendar. + * @opt_param string timeMax Upper bound (exclusive) for an event's start time to filter by. Optional. The default is not to filter by start time. + * @opt_param int maxAttendees The maximum number of attendees to include in the response. If there are more than the specified number of attendees, only the participant is returned. Optional. + * @return Events + */ + public function listEvents($calendarId, $optParams = array()) { + $params = array('calendarId' => $calendarId); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new Events($data); + } else { + return $data; + } + } + /** + * Updates an event. (events.update) + * + * @param string $calendarId Calendar identifier. + * @param string $eventId Event identifier. + * @param Event $postBody + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param bool sendNotifications Whether to send notifications about the event update (e.g. attendee's responses, title changes, etc.). Optional. The default is False. + * @return Event + */ + public function update($calendarId, $eventId, Event $postBody, $optParams = array()) { + $params = array('calendarId' => $calendarId, 'eventId' => $eventId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('update', array($params)); + if ($this->useObjects()) { + return new Event($data); + } else { + return $data; + } + } + /** + * Updates an event. This method supports patch semantics. (events.patch) + * + * @param string $calendarId Calendar identifier. + * @param string $eventId Event identifier. + * @param Event $postBody + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param bool sendNotifications Whether to send notifications about the event update (e.g. attendee's responses, title changes, etc.). Optional. The default is False. + * @return Event + */ + public function patch($calendarId, $eventId, Event $postBody, $optParams = array()) { + $params = array('calendarId' => $calendarId, 'eventId' => $eventId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('patch', array($params)); + if ($this->useObjects()) { + return new Event($data); + } else { + return $data; + } + } + /** + * Returns instances of the specified recurring event. (events.instances) + * + * @param string $calendarId Calendar identifier. + * @param string $eventId Recurring event identifier. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param bool showDeleted Whether to include deleted events (with 'eventStatus' equals 'cancelled') in the result. Optional. The default is False. + * @opt_param int maxResults Maximum number of events returned on one result page. Optional. + * @opt_param string pageToken Token specifying which result page to return. Optional. + * @opt_param string timeZone Time zone used in the response. Optional. The default is the time zone of the calendar. + * @opt_param string originalStart The original start time of the instance in the result. Optional. + * @opt_param int maxAttendees The maximum number of attendees to include in the response. If there are more than the specified number of attendees, only the participant is returned. Optional. + * @return Events + */ + public function instances($calendarId, $eventId, $optParams = array()) { + $params = array('calendarId' => $calendarId, 'eventId' => $eventId); + $params = array_merge($params, $optParams); + $data = $this->__call('instances', array($params)); + if ($this->useObjects()) { + return new Events($data); + } else { + return $data; + } + } + /** + * Imports an event. (events.import) + * + * @param string $calendarId Calendar identifier. + * @param Event $postBody + * @return Event + */ + public function import($calendarId, Event $postBody, $optParams = array()) { + $params = array('calendarId' => $calendarId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('import', array($params)); + if ($this->useObjects()) { + return new Event($data); + } else { + return $data; + } + } + /** + * Creates an event based on a simple text string. (events.quickAdd) + * + * @param string $calendarId Calendar identifier. + * @param string $text The text describing the event to be created. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param bool sendNotifications Whether to send notifications about the creation of the event. Optional. The default is False. + * @return Event + */ + public function quickAdd($calendarId, $text, $optParams = array()) { + $params = array('calendarId' => $calendarId, 'text' => $text); + $params = array_merge($params, $optParams); + $data = $this->__call('quickAdd', array($params)); + if ($this->useObjects()) { + return new Event($data); + } else { + return $data; + } + } + /** + * Deletes an event. (events.delete) + * + * @param string $calendarId Calendar identifier. + * @param string $eventId Event identifier. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param bool sendNotifications Whether to send notifications about the deletion of the event. Optional. The default is False. + */ + public function delete($calendarId, $eventId, $optParams = array()) { + $params = array('calendarId' => $calendarId, 'eventId' => $eventId); + $params = array_merge($params, $optParams); + $data = $this->__call('delete', array($params)); + return $data; + } + } + + + +/** + * Service definition for Calendar (v3). + * + *

+ * Lets you manipulate events and other calendar data. + *

+ * + *

+ * For more information about this service, see the + * API Documentation + *

+ * + * @author Google, Inc. + */ +class apiCalendarService extends apiService { + public $freebusy; + public $settings; + public $calendarList; + public $calendars; + public $acl; + public $colors; + public $events; + /** + * Constructs the internal representation of the Calendar service. + * + * @param apiClient apiClient + */ + public function __construct(apiClient $apiClient) { + $this->rpcPath = '/rpc'; + $this->restBasePath = '/calendar/v3/'; + $this->version = 'v3'; + $this->serviceName = 'calendar'; + + $apiClient->addService($this->serviceName, $this->version); + $this->freebusy = new FreebusyServiceResource($this, $this->serviceName, 'freebusy', json_decode('{"methods": {"query": {"scopes": ["https://www.googleapis.com/auth/calendar", "https://www.googleapis.com/auth/calendar.readonly"], "request": {"$ref": "FreeBusyRequest"}, "response": {"$ref": "FreeBusyResponse"}, "httpMethod": "POST", "path": "freeBusy", "id": "calendar.freebusy.query"}}}', true)); + $this->settings = new SettingsServiceResource($this, $this->serviceName, 'settings', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/calendar", "https://www.googleapis.com/auth/calendar.readonly"], "id": "calendar.settings.list", "httpMethod": "GET", "path": "users/me/settings", "response": {"$ref": "Settings"}}, "get": {"scopes": ["https://www.googleapis.com/auth/calendar", "https://www.googleapis.com/auth/calendar.readonly"], "parameters": {"setting": {"required": true, "type": "string", "location": "path"}}, "id": "calendar.settings.get", "httpMethod": "GET", "path": "users/me/settings/{setting}", "response": {"$ref": "Setting"}}}}', true)); + $this->calendarList = new CalendarListServiceResource($this, $this->serviceName, 'calendarList', json_decode('{"methods": {"insert": {"scopes": ["https://www.googleapis.com/auth/calendar"], "request": {"$ref": "CalendarListEntry"}, "response": {"$ref": "CalendarListEntry"}, "httpMethod": "POST", "path": "users/me/calendarList", "id": "calendar.calendarList.insert"}, "get": {"scopes": ["https://www.googleapis.com/auth/calendar", "https://www.googleapis.com/auth/calendar.readonly"], "parameters": {"calendarId": {"required": true, "type": "string", "location": "path"}}, "id": "calendar.calendarList.get", "httpMethod": "GET", "path": "users/me/calendarList/{calendarId}", "response": {"$ref": "CalendarListEntry"}}, "list": {"scopes": ["https://www.googleapis.com/auth/calendar", "https://www.googleapis.com/auth/calendar.readonly"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "showHidden": {"type": "boolean", "location": "query"}, "maxResults": {"format": "int32", "minimum": "1", "type": "integer", "location": "query"}, "minAccessRole": {"enum": ["freeBusyReader", "owner", "reader", "writer"], "type": "string", "location": "query"}}, "response": {"$ref": "CalendarList"}, "httpMethod": "GET", "path": "users/me/calendarList", "id": "calendar.calendarList.list"}, "update": {"scopes": ["https://www.googleapis.com/auth/calendar"], "parameters": {"calendarId": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "CalendarListEntry"}, "id": "calendar.calendarList.update", "httpMethod": "PUT", "path": "users/me/calendarList/{calendarId}", "response": {"$ref": "CalendarListEntry"}}, "patch": {"scopes": ["https://www.googleapis.com/auth/calendar"], "parameters": {"calendarId": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "CalendarListEntry"}, "id": "calendar.calendarList.patch", "httpMethod": "PATCH", "path": "users/me/calendarList/{calendarId}", "response": {"$ref": "CalendarListEntry"}}, "delete": {"scopes": ["https://www.googleapis.com/auth/calendar"], "parameters": {"calendarId": {"required": true, "type": "string", "location": "path"}}, "httpMethod": "DELETE", "path": "users/me/calendarList/{calendarId}", "id": "calendar.calendarList.delete"}}}', true)); + $this->calendars = new CalendarsServiceResource($this, $this->serviceName, 'calendars', json_decode('{"methods": {"insert": {"scopes": ["https://www.googleapis.com/auth/calendar"], "request": {"$ref": "Calendar"}, "response": {"$ref": "Calendar"}, "httpMethod": "POST", "path": "calendars", "id": "calendar.calendars.insert"}, "get": {"scopes": ["https://www.googleapis.com/auth/calendar", "https://www.googleapis.com/auth/calendar.readonly"], "parameters": {"calendarId": {"required": true, "type": "string", "location": "path"}}, "id": "calendar.calendars.get", "httpMethod": "GET", "path": "calendars/{calendarId}", "response": {"$ref": "Calendar"}}, "clear": {"scopes": ["https://www.googleapis.com/auth/calendar"], "parameters": {"calendarId": {"required": true, "type": "string", "location": "path"}}, "httpMethod": "POST", "path": "calendars/{calendarId}/clear", "id": "calendar.calendars.clear"}, "update": {"scopes": ["https://www.googleapis.com/auth/calendar"], "parameters": {"calendarId": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "Calendar"}, "id": "calendar.calendars.update", "httpMethod": "PUT", "path": "calendars/{calendarId}", "response": {"$ref": "Calendar"}}, "patch": {"scopes": ["https://www.googleapis.com/auth/calendar"], "parameters": {"calendarId": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "Calendar"}, "id": "calendar.calendars.patch", "httpMethod": "PATCH", "path": "calendars/{calendarId}", "response": {"$ref": "Calendar"}}, "delete": {"scopes": ["https://www.googleapis.com/auth/calendar"], "parameters": {"calendarId": {"required": true, "type": "string", "location": "path"}}, "httpMethod": "DELETE", "path": "calendars/{calendarId}", "id": "calendar.calendars.delete"}}}', true)); + $this->acl = new AclServiceResource($this, $this->serviceName, 'acl', json_decode('{"methods": {"insert": {"scopes": ["https://www.googleapis.com/auth/calendar"], "parameters": {"calendarId": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "AclRule"}, "id": "calendar.acl.insert", "httpMethod": "POST", "path": "calendars/{calendarId}/acl", "response": {"$ref": "AclRule"}}, "get": {"scopes": ["https://www.googleapis.com/auth/calendar", "https://www.googleapis.com/auth/calendar.readonly"], "parameters": {"calendarId": {"required": true, "type": "string", "location": "path"}, "ruleId": {"required": true, "type": "string", "location": "path"}}, "id": "calendar.acl.get", "httpMethod": "GET", "path": "calendars/{calendarId}/acl/{ruleId}", "response": {"$ref": "AclRule"}}, "list": {"scopes": ["https://www.googleapis.com/auth/calendar", "https://www.googleapis.com/auth/calendar.readonly"], "parameters": {"calendarId": {"required": true, "type": "string", "location": "path"}}, "id": "calendar.acl.list", "httpMethod": "GET", "path": "calendars/{calendarId}/acl", "response": {"$ref": "Acl"}}, "update": {"scopes": ["https://www.googleapis.com/auth/calendar"], "parameters": {"calendarId": {"required": true, "type": "string", "location": "path"}, "ruleId": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "AclRule"}, "id": "calendar.acl.update", "httpMethod": "PUT", "path": "calendars/{calendarId}/acl/{ruleId}", "response": {"$ref": "AclRule"}}, "patch": {"scopes": ["https://www.googleapis.com/auth/calendar"], "parameters": {"calendarId": {"required": true, "type": "string", "location": "path"}, "ruleId": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "AclRule"}, "id": "calendar.acl.patch", "httpMethod": "PATCH", "path": "calendars/{calendarId}/acl/{ruleId}", "response": {"$ref": "AclRule"}}, "delete": {"scopes": ["https://www.googleapis.com/auth/calendar"], "parameters": {"calendarId": {"required": true, "type": "string", "location": "path"}, "ruleId": {"required": true, "type": "string", "location": "path"}}, "httpMethod": "DELETE", "path": "calendars/{calendarId}/acl/{ruleId}", "id": "calendar.acl.delete"}}}', true)); + $this->colors = new ColorsServiceResource($this, $this->serviceName, 'colors', json_decode('{"methods": {"get": {"id": "calendar.colors.get", "path": "colors", "httpMethod": "GET", "response": {"$ref": "Colors"}}}}', true)); + $this->events = new EventsServiceResource($this, $this->serviceName, 'events', json_decode('{"methods": {"reset": {"scopes": ["https://www.googleapis.com/auth/calendar"], "parameters": {"eventId": {"required": true, "type": "string", "location": "path"}, "calendarId": {"required": true, "type": "string", "location": "path"}, "sendNotifications": {"type": "boolean", "location": "query"}}, "id": "calendar.events.reset", "httpMethod": "POST", "path": "calendars/{calendarId}/events/{eventId}/reset", "response": {"$ref": "Event"}}, "insert": {"scopes": ["https://www.googleapis.com/auth/calendar"], "parameters": {"calendarId": {"required": true, "type": "string", "location": "path"}, "sendNotifications": {"type": "boolean", "location": "query"}}, "request": {"$ref": "Event"}, "id": "calendar.events.insert", "httpMethod": "POST", "path": "calendars/{calendarId}/events", "response": {"$ref": "Event"}}, "get": {"scopes": ["https://www.googleapis.com/auth/calendar", "https://www.googleapis.com/auth/calendar.readonly"], "parameters": {"eventId": {"required": true, "type": "string", "location": "path"}, "timeZone": {"type": "string", "location": "query"}, "calendarId": {"required": true, "type": "string", "location": "path"}, "maxAttendees": {"format": "int32", "minimum": "1", "type": "integer", "location": "query"}}, "id": "calendar.events.get", "httpMethod": "GET", "path": "calendars/{calendarId}/events/{eventId}", "response": {"$ref": "Event"}}, "move": {"scopes": ["https://www.googleapis.com/auth/calendar"], "parameters": {"eventId": {"required": true, "type": "string", "location": "path"}, "calendarId": {"required": true, "type": "string", "location": "path"}, "destination": {"required": true, "type": "string", "location": "query"}, "sendNotifications": {"type": "boolean", "location": "query"}}, "id": "calendar.events.move", "httpMethod": "POST", "path": "calendars/{calendarId}/events/{eventId}/move", "response": {"$ref": "Event"}}, "list": {"scopes": ["https://www.googleapis.com/auth/calendar", "https://www.googleapis.com/auth/calendar.readonly"], "parameters": {"orderBy": {"enum": ["startTime", "updated"], "type": "string", "location": "query"}, "showHiddenInvitations": {"type": "boolean", "location": "query"}, "pageToken": {"type": "string", "location": "query"}, "iCalUID": {"type": "string", "location": "query"}, "updatedMin": {"type": "string", "location": "query"}, "singleEvents": {"type": "boolean", "location": "query"}, "maxResults": {"format": "int32", "minimum": "1", "type": "integer", "location": "query"}, "q": {"type": "string", "location": "query"}, "showDeleted": {"type": "boolean", "location": "query"}, "calendarId": {"required": true, "type": "string", "location": "path"}, "timeMin": {"type": "string", "location": "query"}, "timeZone": {"type": "string", "location": "query"}, "timeMax": {"type": "string", "location": "query"}, "maxAttendees": {"format": "int32", "minimum": "1", "type": "integer", "location": "query"}}, "id": "calendar.events.list", "httpMethod": "GET", "path": "calendars/{calendarId}/events", "response": {"$ref": "Events"}}, "update": {"scopes": ["https://www.googleapis.com/auth/calendar"], "parameters": {"eventId": {"required": true, "type": "string", "location": "path"}, "calendarId": {"required": true, "type": "string", "location": "path"}, "sendNotifications": {"type": "boolean", "location": "query"}}, "request": {"$ref": "Event"}, "id": "calendar.events.update", "httpMethod": "PUT", "path": "calendars/{calendarId}/events/{eventId}", "response": {"$ref": "Event"}}, "patch": {"scopes": ["https://www.googleapis.com/auth/calendar"], "parameters": {"eventId": {"required": true, "type": "string", "location": "path"}, "calendarId": {"required": true, "type": "string", "location": "path"}, "sendNotifications": {"type": "boolean", "location": "query"}}, "request": {"$ref": "Event"}, "id": "calendar.events.patch", "httpMethod": "PATCH", "path": "calendars/{calendarId}/events/{eventId}", "response": {"$ref": "Event"}}, "instances": {"scopes": ["https://www.googleapis.com/auth/calendar", "https://www.googleapis.com/auth/calendar.readonly"], "parameters": {"eventId": {"required": true, "type": "string", "location": "path"}, "pageToken": {"type": "string", "location": "query"}, "maxResults": {"format": "int32", "minimum": "1", "type": "integer", "location": "query"}, "showDeleted": {"type": "boolean", "location": "query"}, "calendarId": {"required": true, "type": "string", "location": "path"}, "timeZone": {"type": "string", "location": "query"}, "originalStart": {"type": "string", "location": "query"}, "maxAttendees": {"format": "int32", "minimum": "1", "type": "integer", "location": "query"}}, "id": "calendar.events.instances", "httpMethod": "GET", "path": "calendars/{calendarId}/events/{eventId}/instances", "response": {"$ref": "Events"}}, "import": {"scopes": ["https://www.googleapis.com/auth/calendar"], "parameters": {"calendarId": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "Event"}, "id": "calendar.events.import", "httpMethod": "POST", "path": "calendars/{calendarId}/events/import", "response": {"$ref": "Event"}}, "quickAdd": {"scopes": ["https://www.googleapis.com/auth/calendar"], "parameters": {"text": {"required": true, "type": "string", "location": "query"}, "calendarId": {"required": true, "type": "string", "location": "path"}, "sendNotifications": {"type": "boolean", "location": "query"}}, "id": "calendar.events.quickAdd", "httpMethod": "POST", "path": "calendars/{calendarId}/events/quickAdd", "response": {"$ref": "Event"}}, "delete": {"scopes": ["https://www.googleapis.com/auth/calendar"], "parameters": {"eventId": {"required": true, "type": "string", "location": "path"}, "calendarId": {"required": true, "type": "string", "location": "path"}, "sendNotifications": {"type": "boolean", "location": "query"}}, "httpMethod": "DELETE", "path": "calendars/{calendarId}/events/{eventId}", "id": "calendar.events.delete"}}}', true)); + } +} + +class Acl extends apiModel { + public $nextPageToken; + protected $__itemsType = 'AclRule'; + protected $__itemsDataType = 'array'; + public $items; + public $kind; + public $etag; + public function setNextPageToken($nextPageToken) { + $this->nextPageToken = $nextPageToken; + } + public function getNextPageToken() { + return $this->nextPageToken; + } + public function setItems(/* array(AclRule) */ $items) { + $this->assertIsArray($items, 'AclRule', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setEtag($etag) { + $this->etag = $etag; + } + public function getEtag() { + return $this->etag; + } +} + +class AclRule extends apiModel { + protected $__scopeType = 'AclRuleScope'; + protected $__scopeDataType = ''; + public $scope; + public $kind; + public $etag; + public $role; + public $id; + public function setScope(AclRuleScope $scope) { + $this->scope = $scope; + } + public function getScope() { + return $this->scope; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setEtag($etag) { + $this->etag = $etag; + } + public function getEtag() { + return $this->etag; + } + public function setRole($role) { + $this->role = $role; + } + public function getRole() { + return $this->role; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } +} + +class AclRuleScope extends apiModel { + public $type; + public $value; + public function setType($type) { + $this->type = $type; + } + public function getType() { + return $this->type; + } + public function setValue($value) { + $this->value = $value; + } + public function getValue() { + return $this->value; + } +} + +class Calendar extends apiModel { + public $kind; + public $description; + public $summary; + public $etag; + public $location; + public $timeZone; + public $id; + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setDescription($description) { + $this->description = $description; + } + public function getDescription() { + return $this->description; + } + public function setSummary($summary) { + $this->summary = $summary; + } + public function getSummary() { + return $this->summary; + } + public function setEtag($etag) { + $this->etag = $etag; + } + public function getEtag() { + return $this->etag; + } + public function setLocation($location) { + $this->location = $location; + } + public function getLocation() { + return $this->location; + } + public function setTimeZone($timeZone) { + $this->timeZone = $timeZone; + } + public function getTimeZone() { + return $this->timeZone; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } +} + +class CalendarList extends apiModel { + public $nextPageToken; + protected $__itemsType = 'CalendarListEntry'; + protected $__itemsDataType = 'array'; + public $items; + public $kind; + public $etag; + public function setNextPageToken($nextPageToken) { + $this->nextPageToken = $nextPageToken; + } + public function getNextPageToken() { + return $this->nextPageToken; + } + public function setItems(/* array(CalendarListEntry) */ $items) { + $this->assertIsArray($items, 'CalendarListEntry', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setEtag($etag) { + $this->etag = $etag; + } + public function getEtag() { + return $this->etag; + } +} + +class CalendarListEntry extends apiModel { + public $kind; + protected $__defaultRemindersType = 'EventReminder'; + protected $__defaultRemindersDataType = 'array'; + public $defaultReminders; + public $description; + public $colorId; + public $selected; + public $summary; + public $etag; + public $location; + public $summaryOverride; + public $timeZone; + public $hidden; + public $accessRole; + public $id; + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setDefaultReminders(/* array(EventReminder) */ $defaultReminders) { + $this->assertIsArray($defaultReminders, 'EventReminder', __METHOD__); + $this->defaultReminders = $defaultReminders; + } + public function getDefaultReminders() { + return $this->defaultReminders; + } + public function setDescription($description) { + $this->description = $description; + } + public function getDescription() { + return $this->description; + } + public function setColorId($colorId) { + $this->colorId = $colorId; + } + public function getColorId() { + return $this->colorId; + } + public function setSelected($selected) { + $this->selected = $selected; + } + public function getSelected() { + return $this->selected; + } + public function setSummary($summary) { + $this->summary = $summary; + } + public function getSummary() { + return $this->summary; + } + public function setEtag($etag) { + $this->etag = $etag; + } + public function getEtag() { + return $this->etag; + } + public function setLocation($location) { + $this->location = $location; + } + public function getLocation() { + return $this->location; + } + public function setSummaryOverride($summaryOverride) { + $this->summaryOverride = $summaryOverride; + } + public function getSummaryOverride() { + return $this->summaryOverride; + } + public function setTimeZone($timeZone) { + $this->timeZone = $timeZone; + } + public function getTimeZone() { + return $this->timeZone; + } + public function setHidden($hidden) { + $this->hidden = $hidden; + } + public function getHidden() { + return $this->hidden; + } + public function setAccessRole($accessRole) { + $this->accessRole = $accessRole; + } + public function getAccessRole() { + return $this->accessRole; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } +} + +class ColorDefinition extends apiModel { + public $foreground; + public $background; + public function setForeground($foreground) { + $this->foreground = $foreground; + } + public function getForeground() { + return $this->foreground; + } + public function setBackground($background) { + $this->background = $background; + } + public function getBackground() { + return $this->background; + } +} + +class Colors extends apiModel { + protected $__calendarType = 'ColorDefinition'; + protected $__calendarDataType = 'map'; + public $calendar; + public $updated; + protected $__eventType = 'ColorDefinition'; + protected $__eventDataType = 'map'; + public $event; + public $kind; + public function setCalendar(ColorDefinition $calendar) { + $this->calendar = $calendar; + } + public function getCalendar() { + return $this->calendar; + } + public function setUpdated($updated) { + $this->updated = $updated; + } + public function getUpdated() { + return $this->updated; + } + public function setEvent(ColorDefinition $event) { + $this->event = $event; + } + public function getEvent() { + return $this->event; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } +} + +class Error extends apiModel { + public $domain; + public $reason; + public function setDomain($domain) { + $this->domain = $domain; + } + public function getDomain() { + return $this->domain; + } + public function setReason($reason) { + $this->reason = $reason; + } + public function getReason() { + return $this->reason; + } +} + +class Event extends apiModel { + protected $__creatorType = 'EventCreator'; + protected $__creatorDataType = ''; + public $creator; + protected $__organizerType = 'EventOrganizer'; + protected $__organizerDataType = ''; + public $organizer; + public $id; + protected $__attendeesType = 'EventAttendee'; + protected $__attendeesDataType = 'array'; + public $attendees; + public $htmlLink; + public $recurrence; + protected $__startType = 'EventDateTime'; + protected $__startDataType = ''; + public $start; + public $etag; + public $location; + public $recurringEventId; + protected $__originalStartTimeType = 'EventDateTime'; + protected $__originalStartTimeDataType = ''; + public $originalStartTime; + public $status; + public $updated; + protected $__gadgetType = 'EventGadget'; + protected $__gadgetDataType = ''; + public $gadget; + public $description; + public $iCalUID; + protected $__extendedPropertiesType = 'EventExtendedProperties'; + protected $__extendedPropertiesDataType = ''; + public $extendedProperties; + public $sequence; + public $visibility; + public $guestsCanModify; + protected $__endType = 'EventDateTime'; + protected $__endDataType = ''; + public $end; + public $attendeesOmitted; + public $kind; + public $created; + public $colorId; + public $anyoneCanAddSelf; + protected $__remindersType = 'EventReminders'; + protected $__remindersDataType = ''; + public $reminders; + public $guestsCanSeeOtherGuests; + public $summary; + public $guestsCanInviteOthers; + public $transparency; + public $privateCopy; + public function setCreator(EventCreator $creator) { + $this->creator = $creator; + } + public function getCreator() { + return $this->creator; + } + public function setOrganizer(EventOrganizer $organizer) { + $this->organizer = $organizer; + } + public function getOrganizer() { + return $this->organizer; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setAttendees(/* array(EventAttendee) */ $attendees) { + $this->assertIsArray($attendees, 'EventAttendee', __METHOD__); + $this->attendees = $attendees; + } + public function getAttendees() { + return $this->attendees; + } + public function setHtmlLink($htmlLink) { + $this->htmlLink = $htmlLink; + } + public function getHtmlLink() { + return $this->htmlLink; + } + public function setRecurrence(/* array(string) */ $recurrence) { + $this->assertIsArray($recurrence, 'string', __METHOD__); + $this->recurrence = $recurrence; + } + public function getRecurrence() { + return $this->recurrence; + } + public function setStart(EventDateTime $start) { + $this->start = $start; + } + public function getStart() { + return $this->start; + } + public function setEtag($etag) { + $this->etag = $etag; + } + public function getEtag() { + return $this->etag; + } + public function setLocation($location) { + $this->location = $location; + } + public function getLocation() { + return $this->location; + } + public function setRecurringEventId($recurringEventId) { + $this->recurringEventId = $recurringEventId; + } + public function getRecurringEventId() { + return $this->recurringEventId; + } + public function setOriginalStartTime(EventDateTime $originalStartTime) { + $this->originalStartTime = $originalStartTime; + } + public function getOriginalStartTime() { + return $this->originalStartTime; + } + public function setStatus($status) { + $this->status = $status; + } + public function getStatus() { + return $this->status; + } + public function setUpdated($updated) { + $this->updated = $updated; + } + public function getUpdated() { + return $this->updated; + } + public function setGadget(EventGadget $gadget) { + $this->gadget = $gadget; + } + public function getGadget() { + return $this->gadget; + } + public function setDescription($description) { + $this->description = $description; + } + public function getDescription() { + return $this->description; + } + public function setICalUID($iCalUID) { + $this->iCalUID = $iCalUID; + } + public function getICalUID() { + return $this->iCalUID; + } + public function setExtendedProperties(EventExtendedProperties $extendedProperties) { + $this->extendedProperties = $extendedProperties; + } + public function getExtendedProperties() { + return $this->extendedProperties; + } + public function setSequence($sequence) { + $this->sequence = $sequence; + } + public function getSequence() { + return $this->sequence; + } + public function setVisibility($visibility) { + $this->visibility = $visibility; + } + public function getVisibility() { + return $this->visibility; + } + public function setGuestsCanModify($guestsCanModify) { + $this->guestsCanModify = $guestsCanModify; + } + public function getGuestsCanModify() { + return $this->guestsCanModify; + } + public function setEnd(EventDateTime $end) { + $this->end = $end; + } + public function getEnd() { + return $this->end; + } + public function setAttendeesOmitted($attendeesOmitted) { + $this->attendeesOmitted = $attendeesOmitted; + } + public function getAttendeesOmitted() { + return $this->attendeesOmitted; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setCreated($created) { + $this->created = $created; + } + public function getCreated() { + return $this->created; + } + public function setColorId($colorId) { + $this->colorId = $colorId; + } + public function getColorId() { + return $this->colorId; + } + public function setAnyoneCanAddSelf($anyoneCanAddSelf) { + $this->anyoneCanAddSelf = $anyoneCanAddSelf; + } + public function getAnyoneCanAddSelf() { + return $this->anyoneCanAddSelf; + } + public function setReminders(EventReminders $reminders) { + $this->reminders = $reminders; + } + public function getReminders() { + return $this->reminders; + } + public function setGuestsCanSeeOtherGuests($guestsCanSeeOtherGuests) { + $this->guestsCanSeeOtherGuests = $guestsCanSeeOtherGuests; + } + public function getGuestsCanSeeOtherGuests() { + return $this->guestsCanSeeOtherGuests; + } + public function setSummary($summary) { + $this->summary = $summary; + } + public function getSummary() { + return $this->summary; + } + public function setGuestsCanInviteOthers($guestsCanInviteOthers) { + $this->guestsCanInviteOthers = $guestsCanInviteOthers; + } + public function getGuestsCanInviteOthers() { + return $this->guestsCanInviteOthers; + } + public function setTransparency($transparency) { + $this->transparency = $transparency; + } + public function getTransparency() { + return $this->transparency; + } + public function setPrivateCopy($privateCopy) { + $this->privateCopy = $privateCopy; + } + public function getPrivateCopy() { + return $this->privateCopy; + } +} + +class EventAttendee extends apiModel { + public $comment; + public $displayName; + public $self; + public $responseStatus; + public $additionalGuests; + public $resource; + public $organizer; + public $optional; + public $email; + public function setComment($comment) { + $this->comment = $comment; + } + public function getComment() { + return $this->comment; + } + public function setDisplayName($displayName) { + $this->displayName = $displayName; + } + public function getDisplayName() { + return $this->displayName; + } + public function setSelf($self) { + $this->self = $self; + } + public function getSelf() { + return $this->self; + } + public function setResponseStatus($responseStatus) { + $this->responseStatus = $responseStatus; + } + public function getResponseStatus() { + return $this->responseStatus; + } + public function setAdditionalGuests($additionalGuests) { + $this->additionalGuests = $additionalGuests; + } + public function getAdditionalGuests() { + return $this->additionalGuests; + } + public function setResource($resource) { + $this->resource = $resource; + } + public function getResource() { + return $this->resource; + } + public function setOrganizer($organizer) { + $this->organizer = $organizer; + } + public function getOrganizer() { + return $this->organizer; + } + public function setOptional($optional) { + $this->optional = $optional; + } + public function getOptional() { + return $this->optional; + } + public function setEmail($email) { + $this->email = $email; + } + public function getEmail() { + return $this->email; + } +} + +class EventCreator extends apiModel { + public $displayName; + public $email; + public function setDisplayName($displayName) { + $this->displayName = $displayName; + } + public function getDisplayName() { + return $this->displayName; + } + public function setEmail($email) { + $this->email = $email; + } + public function getEmail() { + return $this->email; + } +} + +class EventDateTime extends apiModel { + public $date; + public $timeZone; + public $dateTime; + public function setDate($date) { + $this->date = $date; + } + public function getDate() { + return $this->date; + } + public function setTimeZone($timeZone) { + $this->timeZone = $timeZone; + } + public function getTimeZone() { + return $this->timeZone; + } + public function setDateTime($dateTime) { + $this->dateTime = $dateTime; + } + public function getDateTime() { + return $this->dateTime; + } +} + +class EventExtendedProperties extends apiModel { + public $shared; + public $private; + public function setShared($shared) { + $this->shared = $shared; + } + public function getShared() { + return $this->shared; + } + public function setPrivate($private) { + $this->private = $private; + } + public function getPrivate() { + return $this->private; + } +} + +class EventGadget extends apiModel { + public $preferences; + public $title; + public $height; + public $width; + public $link; + public $type; + public $display; + public $iconLink; + public function setPreferences($preferences) { + $this->preferences = $preferences; + } + public function getPreferences() { + return $this->preferences; + } + public function setTitle($title) { + $this->title = $title; + } + public function getTitle() { + return $this->title; + } + public function setHeight($height) { + $this->height = $height; + } + public function getHeight() { + return $this->height; + } + public function setWidth($width) { + $this->width = $width; + } + public function getWidth() { + return $this->width; + } + public function setLink($link) { + $this->link = $link; + } + public function getLink() { + return $this->link; + } + public function setType($type) { + $this->type = $type; + } + public function getType() { + return $this->type; + } + public function setDisplay($display) { + $this->display = $display; + } + public function getDisplay() { + return $this->display; + } + public function setIconLink($iconLink) { + $this->iconLink = $iconLink; + } + public function getIconLink() { + return $this->iconLink; + } +} + +class EventOrganizer extends apiModel { + public $displayName; + public $email; + public function setDisplayName($displayName) { + $this->displayName = $displayName; + } + public function getDisplayName() { + return $this->displayName; + } + public function setEmail($email) { + $this->email = $email; + } + public function getEmail() { + return $this->email; + } +} + +class EventReminder extends apiModel { + public $minutes; + public $method; + public function setMinutes($minutes) { + $this->minutes = $minutes; + } + public function getMinutes() { + return $this->minutes; + } + public function setMethod($method) { + $this->method = $method; + } + public function getMethod() { + return $this->method; + } +} + +class EventReminders extends apiModel { + protected $__overridesType = 'EventReminder'; + protected $__overridesDataType = 'array'; + public $overrides; + public $useDefault; + public function setOverrides(/* array(EventReminder) */ $overrides) { + $this->assertIsArray($overrides, 'EventReminder', __METHOD__); + $this->overrides = $overrides; + } + public function getOverrides() { + return $this->overrides; + } + public function setUseDefault($useDefault) { + $this->useDefault = $useDefault; + } + public function getUseDefault() { + return $this->useDefault; + } +} + +class Events extends apiModel { + public $nextPageToken; + public $kind; + protected $__defaultRemindersType = 'EventReminder'; + protected $__defaultRemindersDataType = 'array'; + public $defaultReminders; + public $description; + protected $__itemsType = 'Event'; + protected $__itemsDataType = 'array'; + public $items; + public $updated; + public $summary; + public $etag; + public $timeZone; + public $accessRole; + public function setNextPageToken($nextPageToken) { + $this->nextPageToken = $nextPageToken; + } + public function getNextPageToken() { + return $this->nextPageToken; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setDefaultReminders(/* array(EventReminder) */ $defaultReminders) { + $this->assertIsArray($defaultReminders, 'EventReminder', __METHOD__); + $this->defaultReminders = $defaultReminders; + } + public function getDefaultReminders() { + return $this->defaultReminders; + } + public function setDescription($description) { + $this->description = $description; + } + public function getDescription() { + return $this->description; + } + public function setItems(/* array(Event) */ $items) { + $this->assertIsArray($items, 'Event', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setUpdated($updated) { + $this->updated = $updated; + } + public function getUpdated() { + return $this->updated; + } + public function setSummary($summary) { + $this->summary = $summary; + } + public function getSummary() { + return $this->summary; + } + public function setEtag($etag) { + $this->etag = $etag; + } + public function getEtag() { + return $this->etag; + } + public function setTimeZone($timeZone) { + $this->timeZone = $timeZone; + } + public function getTimeZone() { + return $this->timeZone; + } + public function setAccessRole($accessRole) { + $this->accessRole = $accessRole; + } + public function getAccessRole() { + return $this->accessRole; + } +} + +class FreeBusyCalendar extends apiModel { + protected $__busyType = 'TimePeriod'; + protected $__busyDataType = 'array'; + public $busy; + protected $__errorsType = 'Error'; + protected $__errorsDataType = 'array'; + public $errors; + public function setBusy(/* array(TimePeriod) */ $busy) { + $this->assertIsArray($busy, 'TimePeriod', __METHOD__); + $this->busy = $busy; + } + public function getBusy() { + return $this->busy; + } + public function setErrors(/* array(Error) */ $errors) { + $this->assertIsArray($errors, 'Error', __METHOD__); + $this->errors = $errors; + } + public function getErrors() { + return $this->errors; + } +} + +class FreeBusyGroup extends apiModel { + protected $__errorsType = 'Error'; + protected $__errorsDataType = 'array'; + public $errors; + public $calendars; + public function setErrors(/* array(Error) */ $errors) { + $this->assertIsArray($errors, 'Error', __METHOD__); + $this->errors = $errors; + } + public function getErrors() { + return $this->errors; + } + public function setCalendars(/* array(string) */ $calendars) { + $this->assertIsArray($calendars, 'string', __METHOD__); + $this->calendars = $calendars; + } + public function getCalendars() { + return $this->calendars; + } +} + +class FreeBusyRequest extends apiModel { + public $calendarExpansionMax; + public $groupExpansionMax; + public $timeMax; + protected $__itemsType = 'FreeBusyRequestItem'; + protected $__itemsDataType = 'array'; + public $items; + public $timeMin; + public $timeZone; + public function setCalendarExpansionMax($calendarExpansionMax) { + $this->calendarExpansionMax = $calendarExpansionMax; + } + public function getCalendarExpansionMax() { + return $this->calendarExpansionMax; + } + public function setGroupExpansionMax($groupExpansionMax) { + $this->groupExpansionMax = $groupExpansionMax; + } + public function getGroupExpansionMax() { + return $this->groupExpansionMax; + } + public function setTimeMax($timeMax) { + $this->timeMax = $timeMax; + } + public function getTimeMax() { + return $this->timeMax; + } + public function setItems(/* array(FreeBusyRequestItem) */ $items) { + $this->assertIsArray($items, 'FreeBusyRequestItem', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setTimeMin($timeMin) { + $this->timeMin = $timeMin; + } + public function getTimeMin() { + return $this->timeMin; + } + public function setTimeZone($timeZone) { + $this->timeZone = $timeZone; + } + public function getTimeZone() { + return $this->timeZone; + } +} + +class FreeBusyRequestItem extends apiModel { + public $id; + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } +} + +class FreeBusyResponse extends apiModel { + public $timeMax; + public $kind; + protected $__calendarsType = 'FreeBusyCalendar'; + protected $__calendarsDataType = 'map'; + public $calendars; + public $timeMin; + protected $__groupsType = 'FreeBusyGroup'; + protected $__groupsDataType = 'map'; + public $groups; + public function setTimeMax($timeMax) { + $this->timeMax = $timeMax; + } + public function getTimeMax() { + return $this->timeMax; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setCalendars(FreeBusyCalendar $calendars) { + $this->calendars = $calendars; + } + public function getCalendars() { + return $this->calendars; + } + public function setTimeMin($timeMin) { + $this->timeMin = $timeMin; + } + public function getTimeMin() { + return $this->timeMin; + } + public function setGroups(FreeBusyGroup $groups) { + $this->groups = $groups; + } + public function getGroups() { + return $this->groups; + } +} + +class Setting extends apiModel { + public $kind; + public $etag; + public $id; + public $value; + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setEtag($etag) { + $this->etag = $etag; + } + public function getEtag() { + return $this->etag; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setValue($value) { + $this->value = $value; + } + public function getValue() { + return $this->value; + } +} + +class Settings extends apiModel { + protected $__itemsType = 'Setting'; + protected $__itemsDataType = 'array'; + public $items; + public $kind; + public $etag; + public function setItems(/* array(Setting) */ $items) { + $this->assertIsArray($items, 'Setting', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setEtag($etag) { + $this->etag = $etag; + } + public function getEtag() { + return $this->etag; + } +} + +class TimePeriod extends apiModel { + public $start; + public $end; + public function setStart($start) { + $this->start = $start; + } + public function getStart() { + return $this->start; + } + public function setEnd($end) { + $this->end = $end; + } + public function getEnd() { + return $this->end; + } +} diff --git a/webui/google-api/contrib/apiCustomsearchService.php b/webui/google-api/contrib/apiCustomsearchService.php new file mode 100644 index 0000000..0a64e8a --- /dev/null +++ b/webui/google-api/contrib/apiCustomsearchService.php @@ -0,0 +1,488 @@ + + * $customsearchService = new apiCustomsearchService(...); + * $cse = $customsearchService->cse; + * + */ + class CseServiceResource extends apiServiceResource { + + + /** + * Returns metadata about the search performed, metadata about the custom search engine used for the + * search, and the search results. (cse.list) + * + * @param string $q Query + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string sort The sort expression to apply to the results + * @opt_param string num Number of search results to return + * @opt_param string googlehost The local Google domain to use to perform the search. + * @opt_param string safe Search safety level + * @opt_param string filter Controls turning on or off the duplicate content filter. + * @opt_param string start The index of the first result to return + * @opt_param string cx The custom search engine ID to scope this search query + * @opt_param string lr The language restriction for the search results + * @opt_param string cr Country restrict(s). + * @opt_param string gl Geolocation of end user. + * @opt_param string cref The URL of a linked custom search engine + * @return Search + */ + public function listCse($q, $optParams = array()) { + $params = array('q' => $q); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new Search($data); + } else { + return $data; + } + } + } + + + +/** + * Service definition for Customsearch (v1). + * + *

+ * Lets you search over a website or collection of websites + *

+ * + *

+ * For more information about this service, see the + * API Documentation + *

+ * + * @author Google, Inc. + */ +class apiCustomsearchService extends apiService { + public $cse; + /** + * Constructs the internal representation of the Customsearch service. + * + * @param apiClient apiClient + */ + public function __construct(apiClient $apiClient) { + $this->rpcPath = '/rpc'; + $this->restBasePath = '/customsearch/'; + $this->version = 'v1'; + $this->serviceName = 'customsearch'; + + $apiClient->addService($this->serviceName, $this->version); + $this->cse = new CseServiceResource($this, $this->serviceName, 'cse', json_decode('{"methods": {"list": {"parameters": {"sort": {"type": "string", "location": "query"}, "filter": {"enum": ["0", "1"], "type": "string", "location": "query"}, "cx": {"type": "string", "location": "query"}, "googlehost": {"type": "string", "location": "query"}, "safe": {"default": "off", "enum": ["high", "medium", "off"], "location": "query", "type": "string"}, "q": {"required": true, "type": "string", "location": "query"}, "start": {"type": "string", "location": "query"}, "num": {"default": "10", "type": "string", "location": "query"}, "lr": {"enum": ["lang_ar", "lang_bg", "lang_ca", "lang_cs", "lang_da", "lang_de", "lang_el", "lang_en", "lang_es", "lang_et", "lang_fi", "lang_fr", "lang_hr", "lang_hu", "lang_id", "lang_is", "lang_it", "lang_iw", "lang_ja", "lang_ko", "lang_lt", "lang_lv", "lang_nl", "lang_no", "lang_pl", "lang_pt", "lang_ro", "lang_ru", "lang_sk", "lang_sl", "lang_sr", "lang_sv", "lang_tr", "lang_zh-CN", "lang_zh-TW"], "type": "string", "location": "query"}, "cr": {"type": "string", "location": "query"}, "gl": {"type": "string", "location": "query"}, "cref": {"type": "string", "location": "query"}}, "id": "search.cse.list", "httpMethod": "GET", "path": "v1", "response": {"$ref": "Search"}}}}', true)); + } +} + +class Context extends apiModel { + protected $__facetsType = 'ContextFacets'; + protected $__facetsDataType = 'array'; + public $facets; + public $title; + public function setFacets(/* array(ContextFacets) */ $facets) { + $this->assertIsArray($facets, 'ContextFacets', __METHOD__); + $this->facets = $facets; + } + public function getFacets() { + return $this->facets; + } + public function setTitle($title) { + $this->title = $title; + } + public function getTitle() { + return $this->title; + } +} + +class ContextFacets extends apiModel { + public $anchor; + public $label; + public function setAnchor($anchor) { + $this->anchor = $anchor; + } + public function getAnchor() { + return $this->anchor; + } + public function setLabel($label) { + $this->label = $label; + } + public function getLabel() { + return $this->label; + } +} + +class Promotion extends apiModel { + public $link; + public $displayLink; + protected $__imageType = 'PromotionImage'; + protected $__imageDataType = ''; + public $image; + protected $__bodyLinesType = 'PromotionBodyLines'; + protected $__bodyLinesDataType = 'array'; + public $bodyLines; + public $title; + public function setLink($link) { + $this->link = $link; + } + public function getLink() { + return $this->link; + } + public function setDisplayLink($displayLink) { + $this->displayLink = $displayLink; + } + public function getDisplayLink() { + return $this->displayLink; + } + public function setImage(PromotionImage $image) { + $this->image = $image; + } + public function getImage() { + return $this->image; + } + public function setBodyLines(/* array(PromotionBodyLines) */ $bodyLines) { + $this->assertIsArray($bodyLines, 'PromotionBodyLines', __METHOD__); + $this->bodyLines = $bodyLines; + } + public function getBodyLines() { + return $this->bodyLines; + } + public function setTitle($title) { + $this->title = $title; + } + public function getTitle() { + return $this->title; + } +} + +class PromotionBodyLines extends apiModel { + public $url; + public $link; + public $title; + public function setUrl($url) { + $this->url = $url; + } + public function getUrl() { + return $this->url; + } + public function setLink($link) { + $this->link = $link; + } + public function getLink() { + return $this->link; + } + public function setTitle($title) { + $this->title = $title; + } + public function getTitle() { + return $this->title; + } +} + +class PromotionImage extends apiModel { + public $source; + public $width; + public $height; + public function setSource($source) { + $this->source = $source; + } + public function getSource() { + return $this->source; + } + public function setWidth($width) { + $this->width = $width; + } + public function getWidth() { + return $this->width; + } + public function setHeight($height) { + $this->height = $height; + } + public function getHeight() { + return $this->height; + } +} + +class Query extends apiModel { + public $count; + public $sort; + public $outputEncoding; + public $language; + public $title; + public $googleHost; + public $safe; + public $searchTerms; + public $filter; + public $startIndex; + public $cx; + public $startPage; + public $inputEncoding; + public $cr; + public $gl; + public $totalResults; + public $cref; + public function setCount($count) { + $this->count = $count; + } + public function getCount() { + return $this->count; + } + public function setSort($sort) { + $this->sort = $sort; + } + public function getSort() { + return $this->sort; + } + public function setOutputEncoding($outputEncoding) { + $this->outputEncoding = $outputEncoding; + } + public function getOutputEncoding() { + return $this->outputEncoding; + } + public function setLanguage($language) { + $this->language = $language; + } + public function getLanguage() { + return $this->language; + } + public function setTitle($title) { + $this->title = $title; + } + public function getTitle() { + return $this->title; + } + public function setGoogleHost($googleHost) { + $this->googleHost = $googleHost; + } + public function getGoogleHost() { + return $this->googleHost; + } + public function setSafe($safe) { + $this->safe = $safe; + } + public function getSafe() { + return $this->safe; + } + public function setSearchTerms($searchTerms) { + $this->searchTerms = $searchTerms; + } + public function getSearchTerms() { + return $this->searchTerms; + } + public function setFilter($filter) { + $this->filter = $filter; + } + public function getFilter() { + return $this->filter; + } + public function setStartIndex($startIndex) { + $this->startIndex = $startIndex; + } + public function getStartIndex() { + return $this->startIndex; + } + public function setCx($cx) { + $this->cx = $cx; + } + public function getCx() { + return $this->cx; + } + public function setStartPage($startPage) { + $this->startPage = $startPage; + } + public function getStartPage() { + return $this->startPage; + } + public function setInputEncoding($inputEncoding) { + $this->inputEncoding = $inputEncoding; + } + public function getInputEncoding() { + return $this->inputEncoding; + } + public function setCr($cr) { + $this->cr = $cr; + } + public function getCr() { + return $this->cr; + } + public function setGl($gl) { + $this->gl = $gl; + } + public function getGl() { + return $this->gl; + } + public function setTotalResults($totalResults) { + $this->totalResults = $totalResults; + } + public function getTotalResults() { + return $this->totalResults; + } + public function setCref($cref) { + $this->cref = $cref; + } + public function getCref() { + return $this->cref; + } +} + +class Result extends apiModel { + public $kind; + public $title; + public $displayLink; + public $cacheId; + public $pagemap; + public $snippet; + public $htmlSnippet; + public $link; + public $htmlTitle; + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setTitle($title) { + $this->title = $title; + } + public function getTitle() { + return $this->title; + } + public function setDisplayLink($displayLink) { + $this->displayLink = $displayLink; + } + public function getDisplayLink() { + return $this->displayLink; + } + public function setCacheId($cacheId) { + $this->cacheId = $cacheId; + } + public function getCacheId() { + return $this->cacheId; + } + public function setPagemap($pagemap) { + $this->pagemap = $pagemap; + } + public function getPagemap() { + return $this->pagemap; + } + public function setSnippet($snippet) { + $this->snippet = $snippet; + } + public function getSnippet() { + return $this->snippet; + } + public function setHtmlSnippet($htmlSnippet) { + $this->htmlSnippet = $htmlSnippet; + } + public function getHtmlSnippet() { + return $this->htmlSnippet; + } + public function setLink($link) { + $this->link = $link; + } + public function getLink() { + return $this->link; + } + public function setHtmlTitle($htmlTitle) { + $this->htmlTitle = $htmlTitle; + } + public function getHtmlTitle() { + return $this->htmlTitle; + } +} + +class Search extends apiModel { + protected $__promotionsType = 'Promotion'; + protected $__promotionsDataType = 'array'; + public $promotions; + public $kind; + protected $__urlType = 'SearchUrl'; + protected $__urlDataType = ''; + public $url; + protected $__itemsType = 'Result'; + protected $__itemsDataType = 'array'; + public $items; + protected $__contextType = 'Context'; + protected $__contextDataType = ''; + public $context; + protected $__queriesType = 'Query'; + protected $__queriesDataType = 'map'; + public $queries; + public function setPromotions(/* array(Promotion) */ $promotions) { + $this->assertIsArray($promotions, 'Promotion', __METHOD__); + $this->promotions = $promotions; + } + public function getPromotions() { + return $this->promotions; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setUrl(SearchUrl $url) { + $this->url = $url; + } + public function getUrl() { + return $this->url; + } + public function setItems(/* array(Result) */ $items) { + $this->assertIsArray($items, 'Result', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setContext(Context $context) { + $this->context = $context; + } + public function getContext() { + return $this->context; + } + public function setQueries(Query $queries) { + $this->queries = $queries; + } + public function getQueries() { + return $this->queries; + } +} + +class SearchUrl extends apiModel { + public $type; + public $template; + public function setType($type) { + $this->type = $type; + } + public function getType() { + return $this->type; + } + public function setTemplate($template) { + $this->template = $template; + } + public function getTemplate() { + return $this->template; + } +} diff --git a/webui/google-api/contrib/apiFreebaseService.php b/webui/google-api/contrib/apiFreebaseService.php new file mode 100644 index 0000000..e786440 --- /dev/null +++ b/webui/google-api/contrib/apiFreebaseService.php @@ -0,0 +1,166 @@ + + * $freebaseService = new apiFreebaseService(...); + * $text = $freebaseService->text; + * + */ + class TextServiceResource extends apiServiceResource { + + + /** + * Returns blob attached to node at specified id as HTML (text.get) + * + * @param string $id The id of the item that you want data about + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string maxlength The max number of characters to return. Valid only for 'plain' format. + * @opt_param string format Sanitizing transformation. + * @return ContentserviceGet + */ + public function get($id, $optParams = array()) { + $params = array('id' => $id); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new ContentserviceGet($data); + } else { + return $data; + } + } + } + + + /** + * The "mqlread" collection of methods. + * Typical usage is: + * + * $freebaseService = new apiFreebaseService(...); + * $mqlread = $freebaseService->mqlread; + * + */ + class MqlreadServiceResource extends apiServiceResource { + /** + * Performs MQL Queries. (mqlread.mqlread) + * + * @param string $query An envelope containing a single MQL query. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string lang The language of the results - an id of a /type/lang object. + * @opt_param bool html_escape Whether or not to escape entities. + * @opt_param string indent How many spaces to indent the json. + * @opt_param string uniqueness_failure How MQL responds to uniqueness failures. + * @opt_param string dateline The dateline that you get in a mqlwrite response to ensure consistent results. + * @opt_param string cursor The mql cursor. + * @opt_param string callback JS method name for JSONP callbacks. + * @opt_param bool cost Show the costs or not. + * @opt_param string as_of_time Run the query as it would've been run at the specified point in time. + */ + public function mqlread($query, $optParams = array()) { + $params = array('query' => $query); + $params = array_merge($params, $optParams); + $data = $this->__call('mqlread', array($params)); + return $data; + } + + } + + /** + * The "image" collection of methods. + * Typical usage is: + * + * $freebaseService = new apiFreebaseService(...); + * $image = $freebaseService->image; + * + */ + class ImageServiceResource extends apiServiceResource { + /** + * Returns the scaled/cropped image attached to a freebase node. (image.image) + * + * @param string $id Freebase entity or content id, mid, or guid. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string maxwidth Maximum width in pixels for resulting image. + * @opt_param string maxheight Maximum height in pixels for resulting image. + * @opt_param string fallbackid Use the image associated with this secondary id if no image is associated with the primary id. + * @opt_param bool pad A boolean specifying whether the resulting image should be padded up to the requested dimensions. + * @opt_param string mode Method used to scale or crop image. + */ + public function image($id, $optParams = array()) { + $params = array('id' => $id); + $params = array_merge($params, $optParams); + $data = $this->__call('image', array($params)); + return $data; + } + + } + + +/** + * Service definition for Freebase (v1). + * + *

+ * Lets you access the Freebase repository of open data. + *

+ * + *

+ * For more information about this service, see the + * API Documentation + *

+ * + * @author Google, Inc. + */ +class apiFreebaseService extends apiService { + public $mqlread; + public $image; + public $text; + /** + * Constructs the internal representation of the Freebase service. + * + * @param apiClient apiClient + */ + public function __construct(apiClient $apiClient) { + $this->rpcPath = '/rpc'; + $this->restBasePath = '/freebase/v1/'; + $this->version = 'v1'; + $this->serviceName = 'freebase'; + + $apiClient->addService($this->serviceName, $this->version); + $this->text = new TextServiceResource($this, $this->serviceName, 'text', json_decode('{"methods": {"get": {"parameters": {"format": {"default": "plain", "enum": ["html", "plain", "raw"], "location": "query", "type": "string"}, "id": {"repeated": true, "required": true, "type": "string", "location": "path"}, "maxlength": {"format": "uint32", "type": "integer", "location": "query"}}, "id": "freebase.text.get", "httpMethod": "GET", "path": "text{/id*}", "response": {"$ref": "ContentserviceGet"}}}}', true)); + $this->mqlread = new MqlreadServiceResource($this, $this->serviceName, 'mqlread', json_decode('{"httpMethod": "GET", "parameters": {"lang": {"default": "/lang/en", "type": "string", "location": "query"}, "cursor": {"type": "string", "location": "query"}, "indent": {"format": "uint32", "default": "0", "maximum": "10", "location": "query", "type": "integer"}, "uniqueness_failure": {"default": "hard", "enum": ["hard", "soft"], "location": "query", "type": "string"}, "dateline": {"type": "string", "location": "query"}, "html_escape": {"default": "true", "type": "boolean", "location": "query"}, "callback": {"type": "string", "location": "query"}, "cost": {"default": "false", "type": "boolean", "location": "query"}, "query": {"required": true, "type": "string", "location": "query"}, "as_of_time": {"type": "string", "location": "query"}}, "path": "mqlread", "id": "freebase.mqlread"}', true)); + $this->image = new ImageServiceResource($this, $this->serviceName, 'image', json_decode('{"httpMethod": "GET", "parameters": {"maxwidth": {"format": "uint32", "type": "integer", "location": "query", "maximum": "4096"}, "maxheight": {"format": "uint32", "type": "integer", "location": "query", "maximum": "4096"}, "fallbackid": {"default": "/freebase/no_image_png", "type": "string", "location": "query"}, "pad": {"default": "false", "type": "boolean", "location": "query"}, "mode": {"default": "fit", "enum": ["fill", "fillcrop", "fillcropmid", "fit"], "location": "query", "type": "string"}, "id": {"repeated": true, "required": true, "type": "string", "location": "path"}}, "path": "image{/id*}", "id": "freebase.image"}', true)); + } +} + +class ContentserviceGet extends apiModel { + public $result; + public function setResult($result) { + $this->result = $result; + } + public function getResult() { + return $this->result; + } +} diff --git a/webui/google-api/contrib/apiGanService.php b/webui/google-api/contrib/apiGanService.php new file mode 100644 index 0000000..13e2125 --- /dev/null +++ b/webui/google-api/contrib/apiGanService.php @@ -0,0 +1,1529 @@ + + * $ganService = new apiGanService(...); + * $advertisers = $ganService->advertisers; + * + */ + class AdvertisersServiceResource extends apiServiceResource { + + + /** + * Retrieves data about all advertisers that the requesting advertiser/publisher has access to. + * (advertisers.list) + * + * @param string $role The role of the requester. Valid values: 'advertisers' or 'publishers'. + * @param string $roleId The ID of the requesting advertiser or publisher. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string relationshipStatus Filters out all advertisers for which do not have the given relationship status with the requesting publisher. + * @opt_param double minSevenDayEpc Filters out all advertisers that have a seven day EPC average lower than the given value (inclusive). Min value: 0.0. Optional. + * @opt_param string advertiserCategory Caret(^) delimted list of advertiser categories. Valid categories are defined here: http://www.google.com/support/affiliatenetwork/advertiser/bin/answer.py?hl=en=107581. Filters out all advertisers not in one of the given advertiser categories. Optional. + * @opt_param double minNinetyDayEpc Filters out all advertisers that have a ninety day EPC average lower than the given value (inclusive). Min value: 0.0. Optional. + * @opt_param string pageToken The value of 'nextPageToken' from the previous page. Optional. + * @opt_param string maxResults Max number of items to return in this page. Optional. Defaults to 20. + * @opt_param int minPayoutRank A value between 1 and 4, where 1 represents the quartile of advertisers with the lowest ranks and 4 represents the quartile of advertisers with the highest ranks. Filters out all advertisers with a lower rank than the given quartile. For example if a 2 was given only advertisers with a payout rank of 25 or higher would be included. Optional. + * @return Advertisers + */ + public function listAdvertisers($role, $roleId, $optParams = array()) { + $params = array('role' => $role, 'roleId' => $roleId); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new Advertisers($data); + } else { + return $data; + } + } + /** + * Retrieves data about a single advertiser if that the requesting advertiser/publisher has access + * to it. Only publishers can lookup advertisers. Advertisers can request information about + * themselves by omitting the advertiserId query parameter. (advertisers.get) + * + * @param string $role The role of the requester. Valid values: 'advertisers' or 'publishers'. + * @param string $roleId The ID of the requesting advertiser or publisher. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string advertiserId The ID of the advertiser to look up. Optional. + * @return Advertiser + */ + public function get($role, $roleId, $optParams = array()) { + $params = array('role' => $role, 'roleId' => $roleId); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new Advertiser($data); + } else { + return $data; + } + } + } + + /** + * The "ccOffers" collection of methods. + * Typical usage is: + * + * $ganService = new apiGanService(...); + * $ccOffers = $ganService->ccOffers; + * + */ + class CcOffersServiceResource extends apiServiceResource { + + + /** + * Retrieves credit card offers for the given publisher. (ccOffers.list) + * + * @param string $publisher The ID of the publisher in question. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string advertiser The advertiser ID of a card issuer whose offers to include. Optional, may be repeated. + * @opt_param string projection The set of fields to return. + * @return CcOffers + */ + public function listCcOffers($publisher, $optParams = array()) { + $params = array('publisher' => $publisher); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new CcOffers($data); + } else { + return $data; + } + } + } + + /** + * The "events" collection of methods. + * Typical usage is: + * + * $ganService = new apiGanService(...); + * $events = $ganService->events; + * + */ + class EventsServiceResource extends apiServiceResource { + + + /** + * Retrieves event data for a given advertiser/publisher. (events.list) + * + * @param string $role The role of the requester. Valid values: 'advertisers' or 'publishers'. + * @param string $roleId The ID of the requesting advertiser or publisher. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string orderId Caret(^) delimited list of order IDs. Filters out all events that do not reference one of the given order IDs. Optional. + * @opt_param string sku Caret(^) delimited list of SKUs. Filters out all events that do not reference one of the given SKU. Optional. + * @opt_param string eventDateMax Filters out all events later than given date. Optional. Defaults to 24 hours after eventMin. + * @opt_param string type Filters out all events that are not of the given type. Valid values: 'action', 'transaction', 'charge'. Optional. + * @opt_param string linkId Caret(^) delimited list of link IDs. Filters out all events that do not reference one of the given link IDs. Optional. + * @opt_param string status Filters out all events that do not have the given status. Valid values: 'active', 'canceled'. Optional. + * @opt_param string eventDateMin Filters out all events earlier than given date. Optional. Defaults to 24 hours from current date/time. + * @opt_param string memberId Caret(^) delimited list of member IDs. Filters out all events that do not reference one of the given member IDs. Optional. + * @opt_param string maxResults Max number of offers to return in this page. Optional. Defaults to 20. + * @opt_param string advertiserId Caret(^) delimited list of advertiser IDs. Filters out all events that do not reference one of the given advertiser IDs. Only used when under publishers role. Optional. + * @opt_param string pageToken The value of 'nextPageToken' from the previous page. Optional. + * @opt_param string productCategory Caret(^) delimited list of product categories. Filters out all events that do not reference a product in one of the given product categories. Optional. + * @opt_param string chargeType Filters out all charge events that are not of the given charge type. Valid values: 'other', 'slotting_fee', 'monthly_minimum', 'tier_bonus', 'credit', 'debit'. Optional. + * @opt_param string publisherId Caret(^) delimited list of publisher IDs. Filters out all events that do not reference one of the given publishers IDs. Only used when under advertiser role. Optional. + * @return Events + */ + public function listEvents($role, $roleId, $optParams = array()) { + $params = array('role' => $role, 'roleId' => $roleId); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new Events($data); + } else { + return $data; + } + } + } + + /** + * The "publishers" collection of methods. + * Typical usage is: + * + * $ganService = new apiGanService(...); + * $publishers = $ganService->publishers; + * + */ + class PublishersServiceResource extends apiServiceResource { + + + /** + * Retrieves data about all publishers that the requesting advertiser/publisher has access to. + * (publishers.list) + * + * @param string $role The role of the requester. Valid values: 'advertisers' or 'publishers'. + * @param string $roleId The ID of the requesting advertiser or publisher. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string publisherCategory Caret(^) delimted list of publisher categories. Valid categories: (unclassified|community_and_content|shopping_and_promotion|loyalty_and_rewards|network|search_specialist|comparison_shopping|email). Filters out all publishers not in one of the given advertiser categories. Optional. + * @opt_param string relationshipStatus Filters out all publishers for which do not have the given relationship status with the requesting publisher. + * @opt_param double minSevenDayEpc Filters out all publishers that have a seven day EPC average lower than the given value (inclusive). Min value 0.0. Optional. + * @opt_param double minNinetyDayEpc Filters out all publishers that have a ninety day EPC average lower than the given value (inclusive). Min value: 0.0. Optional. + * @opt_param string pageToken The value of 'nextPageToken' from the previous page. Optional. + * @opt_param string maxResults Max number of items to return in this page. Optional. Defaults to 20. + * @opt_param int minPayoutRank A value between 1 and 4, where 1 represents the quartile of publishers with the lowest ranks and 4 represents the quartile of publishers with the highest ranks. Filters out all publishers with a lower rank than the given quartile. For example if a 2 was given only publishers with a payout rank of 25 or higher would be included. Optional. + * @return Publishers + */ + public function listPublishers($role, $roleId, $optParams = array()) { + $params = array('role' => $role, 'roleId' => $roleId); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new Publishers($data); + } else { + return $data; + } + } + /** + * Retrieves data about a single advertiser if that the requesting advertiser/publisher has access + * to it. Only advertisers can look up publishers. Publishers can request information about + * themselves by omitting the publisherId query parameter. (publishers.get) + * + * @param string $role The role of the requester. Valid values: 'advertisers' or 'publishers'. + * @param string $roleId The ID of the requesting advertiser or publisher. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string publisherId The ID of the publisher to look up. Optional. + * @return Publisher + */ + public function get($role, $roleId, $optParams = array()) { + $params = array('role' => $role, 'roleId' => $roleId); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new Publisher($data); + } else { + return $data; + } + } + } + + + +/** + * Service definition for Gan (v1beta1). + * + *

+ * Lets you have programmatic access to your Google Affiliate Network data + *

+ * + *

+ * For more information about this service, see the + * API Documentation + *

+ * + * @author Google, Inc. + */ +class apiGanService extends apiService { + public $advertisers; + public $ccOffers; + public $events; + public $publishers; + /** + * Constructs the internal representation of the Gan service. + * + * @param apiClient apiClient + */ + public function __construct(apiClient $apiClient) { + $this->rpcPath = '/rpc'; + $this->restBasePath = '/gan/v1beta1/'; + $this->version = 'v1beta1'; + $this->serviceName = 'gan'; + + $apiClient->addService($this->serviceName, $this->version); + $this->advertisers = new AdvertisersServiceResource($this, $this->serviceName, 'advertisers', json_decode('{"methods": {"list": {"parameters": {"relationshipStatus": {"enum": ["approved", "available", "deactivated", "declined", "pending"], "type": "string", "location": "query"}, "minSevenDayEpc": {"format": "double", "type": "number", "location": "query"}, "advertiserCategory": {"type": "string", "location": "query"}, "minNinetyDayEpc": {"format": "double", "type": "number", "location": "query"}, "pageToken": {"type": "string", "location": "query"}, "role": {"required": true, "enum": ["advertisers", "publishers"], "location": "path", "type": "string"}, "maxResults": {"format": "uint32", "maximum": "100", "minimum": "0", "location": "query", "type": "integer"}, "roleId": {"required": true, "type": "string", "location": "path"}, "minPayoutRank": {"format": "int32", "maximum": "4", "minimum": "1", "location": "query", "type": "integer"}}, "id": "gan.advertisers.list", "httpMethod": "GET", "path": "{role}/{roleId}/advertisers", "response": {"$ref": "Advertisers"}}, "get": {"parameters": {"advertiserId": {"type": "string", "location": "query"}, "roleId": {"required": true, "type": "string", "location": "path"}, "role": {"required": true, "enum": ["advertisers", "publishers"], "location": "path", "type": "string"}}, "id": "gan.advertisers.get", "httpMethod": "GET", "path": "{role}/{roleId}/advertiser", "response": {"$ref": "Advertiser"}}}}', true)); + $this->ccOffers = new CcOffersServiceResource($this, $this->serviceName, 'ccOffers', json_decode('{"methods": {"list": {"parameters": {"advertiser": {"repeated": true, "type": "string", "location": "query"}, "projection": {"enum": ["full", "summary"], "type": "string", "location": "query"}, "publisher": {"required": true, "type": "string", "location": "path"}}, "id": "gan.ccOffers.list", "httpMethod": "GET", "path": "publishers/{publisher}/ccOffers", "response": {"$ref": "CcOffers"}}}}', true)); + $this->events = new EventsServiceResource($this, $this->serviceName, 'events', json_decode('{"methods": {"list": {"parameters": {"orderId": {"type": "string", "location": "query"}, "sku": {"type": "string", "location": "query"}, "eventDateMax": {"type": "string", "location": "query"}, "linkId": {"type": "string", "location": "query"}, "eventDateMin": {"type": "string", "location": "query"}, "memberId": {"type": "string", "location": "query"}, "maxResults": {"format": "uint32", "maximum": "100", "minimum": "0", "location": "query", "type": "integer"}, "advertiserId": {"type": "string", "location": "query"}, "pageToken": {"type": "string", "location": "query"}, "publisherId": {"type": "string", "location": "query"}, "status": {"enum": ["active", "canceled"], "type": "string", "location": "query"}, "productCategory": {"type": "string", "location": "query"}, "chargeType": {"enum": ["credit", "debit", "monthly_minimum", "other", "slotting_fee", "tier_bonus"], "type": "string", "location": "query"}, "roleId": {"required": true, "type": "string", "location": "path"}, "role": {"required": true, "enum": ["advertisers", "publishers"], "location": "path", "type": "string"}, "type": {"enum": ["action", "charge", "transaction"], "type": "string", "location": "query"}}, "id": "gan.events.list", "httpMethod": "GET", "path": "{role}/{roleId}/events", "response": {"$ref": "Events"}}}}', true)); + $this->publishers = new PublishersServiceResource($this, $this->serviceName, 'publishers', json_decode('{"methods": {"list": {"parameters": {"publisherCategory": {"type": "string", "location": "query"}, "relationshipStatus": {"enum": ["approved", "available", "deactivated", "declined", "pending"], "type": "string", "location": "query"}, "minSevenDayEpc": {"format": "double", "type": "number", "location": "query"}, "minNinetyDayEpc": {"format": "double", "type": "number", "location": "query"}, "pageToken": {"type": "string", "location": "query"}, "role": {"required": true, "enum": ["advertisers", "publishers"], "location": "path", "type": "string"}, "maxResults": {"format": "uint32", "maximum": "100", "minimum": "0", "location": "query", "type": "integer"}, "roleId": {"required": true, "type": "string", "location": "path"}, "minPayoutRank": {"format": "int32", "maximum": "4", "minimum": "1", "location": "query", "type": "integer"}}, "id": "gan.publishers.list", "httpMethod": "GET", "path": "{role}/{roleId}/publishers", "response": {"$ref": "Publishers"}}, "get": {"parameters": {"publisherId": {"type": "string", "location": "query"}, "role": {"required": true, "enum": ["advertisers", "publishers"], "location": "path", "type": "string"}, "roleId": {"required": true, "type": "string", "location": "path"}}, "id": "gan.publishers.get", "httpMethod": "GET", "path": "{role}/{roleId}/publisher", "response": {"$ref": "Publisher"}}}}', true)); + } +} + +class Advertiser extends apiModel { + public $category; + public $productFeedsEnabled; + public $kind; + public $siteUrl; + public $contactPhone; + public $description; + public $payoutRank; + protected $__epcSevenDayAverageType = 'Money'; + protected $__epcSevenDayAverageDataType = ''; + public $epcSevenDayAverage; + public $commissionDuration; + public $status; + protected $__epcNinetyDayAverageType = 'Money'; + protected $__epcNinetyDayAverageDataType = ''; + public $epcNinetyDayAverage; + public $contactEmail; + protected $__itemType = 'Advertiser'; + protected $__itemDataType = ''; + public $item; + public $joinDate; + public $logoUrl; + public $id; + public $name; + public function setCategory($category) { + $this->category = $category; + } + public function getCategory() { + return $this->category; + } + public function setProductFeedsEnabled($productFeedsEnabled) { + $this->productFeedsEnabled = $productFeedsEnabled; + } + public function getProductFeedsEnabled() { + return $this->productFeedsEnabled; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setSiteUrl($siteUrl) { + $this->siteUrl = $siteUrl; + } + public function getSiteUrl() { + return $this->siteUrl; + } + public function setContactPhone($contactPhone) { + $this->contactPhone = $contactPhone; + } + public function getContactPhone() { + return $this->contactPhone; + } + public function setDescription($description) { + $this->description = $description; + } + public function getDescription() { + return $this->description; + } + public function setPayoutRank($payoutRank) { + $this->payoutRank = $payoutRank; + } + public function getPayoutRank() { + return $this->payoutRank; + } + public function setEpcSevenDayAverage(Money $epcSevenDayAverage) { + $this->epcSevenDayAverage = $epcSevenDayAverage; + } + public function getEpcSevenDayAverage() { + return $this->epcSevenDayAverage; + } + public function setCommissionDuration($commissionDuration) { + $this->commissionDuration = $commissionDuration; + } + public function getCommissionDuration() { + return $this->commissionDuration; + } + public function setStatus($status) { + $this->status = $status; + } + public function getStatus() { + return $this->status; + } + public function setEpcNinetyDayAverage(Money $epcNinetyDayAverage) { + $this->epcNinetyDayAverage = $epcNinetyDayAverage; + } + public function getEpcNinetyDayAverage() { + return $this->epcNinetyDayAverage; + } + public function setContactEmail($contactEmail) { + $this->contactEmail = $contactEmail; + } + public function getContactEmail() { + return $this->contactEmail; + } + public function setItem(Advertiser $item) { + $this->item = $item; + } + public function getItem() { + return $this->item; + } + public function setJoinDate($joinDate) { + $this->joinDate = $joinDate; + } + public function getJoinDate() { + return $this->joinDate; + } + public function setLogoUrl($logoUrl) { + $this->logoUrl = $logoUrl; + } + public function getLogoUrl() { + return $this->logoUrl; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setName($name) { + $this->name = $name; + } + public function getName() { + return $this->name; + } +} + +class Advertisers extends apiModel { + public $nextPageToken; + protected $__itemsType = 'Advertiser'; + protected $__itemsDataType = 'array'; + public $items; + public $kind; + public function setNextPageToken($nextPageToken) { + $this->nextPageToken = $nextPageToken; + } + public function getNextPageToken() { + return $this->nextPageToken; + } + public function setItems(/* array(Advertiser) */ $items) { + $this->assertIsArray($items, 'Advertiser', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } +} + +class CcOffer extends apiModel { + public $rewardsHaveBlackoutDates; + public $introPurchasePeriodLength; + public $introBalanceTransferRate; + public $cardBenefits; + public $introBalanceTransferAprDisplay; + public $issuer; + public $introBalanceTransferFeeRate; + public $cashAdvanceFeeDisplay; + public $annualFeeDisplay; + public $minimumFinanceCharge; + public $balanceTransferFeeDisplay; + public $landingPageUrl; + public $introPurchaseRate; + public $cashAdvanceAprDisplay; + public $maxCashAdvanceRate; + public $firstYearAnnualFee; + public $introBalanceTransferPeriodUnits; + public $variableRatesUpdateFrequency; + public $overLimitFee; + public $rewardsExpire; + public $additionalCardBenefits; + public $ageMinimum; + public $balanceTransferAprDisplay; + public $introBalanceTransferPeriodLength; + public $network; + public $introPurchaseRateType; + public $introAprDisplay; + public $flightAccidentInsurance; + public $annualRewardMaximum; + public $disclaimer; + public $creditLimitMin; + public $creditLimitMax; + public $gracePeriodDisplay; + public $cashAdvanceFeeAmount; + public $travelInsurance; + public $existingCustomerOnly; + public $initialSetupAndProcessingFee; + public $issuerId; + public $rewardUnit; + public $prohibitedCategories; + protected $__defaultFeesType = 'CcOfferDefaultFees'; + protected $__defaultFeesDataType = 'array'; + public $defaultFees; + public $introPurchasePeriodUnits; + public $trackingUrl; + public $latePaymentFee; + public $statementCopyFee; + public $variableRatesLastUpdated; + public $minBalanceTransferRate; + public $emergencyInsurance; + public $introPurchasePeriodEndDate; + public $cardName; + public $returnedPaymentFee; + public $cashAdvanceAdditionalDetails; + public $cashAdvanceLimit; + public $balanceTransferFeeRate; + public $balanceTransferRateType; + protected $__rewardsType = 'CcOfferRewards'; + protected $__rewardsDataType = 'array'; + public $rewards; + public $extendedWarranty; + public $carRentalInsurance; + public $cashAdvanceFeeRate; + public $rewardPartner; + public $foreignCurrencyTransactionFee; + public $kind; + public $introBalanceTransferFeeAmount; + public $creditRatingDisplay; + public $additionalCardHolderFee; + public $purchaseRateType; + public $cashAdvanceRateType; + protected $__bonusRewardsType = 'CcOfferBonusRewards'; + protected $__bonusRewardsDataType = 'array'; + public $bonusRewards; + public $balanceTransferLimit; + public $luggageInsurance; + public $minCashAdvanceRate; + public $offerId; + public $minPurchaseRate; + public $offersImmediateCashReward; + public $fraudLiability; + public $cardType; + public $approvedCategories; + public $annualFee; + public $maxBalanceTransferRate; + public $maxPurchaseRate; + public $issuerWebsite; + public $introBalanceTransferRateType; + public $aprDisplay; + public $imageUrl; + public $ageMinimumDetails; + public $balanceTransferFeeAmount; + public $introBalanceTransferPeriodEndDate; + public function setRewardsHaveBlackoutDates($rewardsHaveBlackoutDates) { + $this->rewardsHaveBlackoutDates = $rewardsHaveBlackoutDates; + } + public function getRewardsHaveBlackoutDates() { + return $this->rewardsHaveBlackoutDates; + } + public function setIntroPurchasePeriodLength($introPurchasePeriodLength) { + $this->introPurchasePeriodLength = $introPurchasePeriodLength; + } + public function getIntroPurchasePeriodLength() { + return $this->introPurchasePeriodLength; + } + public function setIntroBalanceTransferRate($introBalanceTransferRate) { + $this->introBalanceTransferRate = $introBalanceTransferRate; + } + public function getIntroBalanceTransferRate() { + return $this->introBalanceTransferRate; + } + public function setCardBenefits(/* array(string) */ $cardBenefits) { + $this->assertIsArray($cardBenefits, 'string', __METHOD__); + $this->cardBenefits = $cardBenefits; + } + public function getCardBenefits() { + return $this->cardBenefits; + } + public function setIntroBalanceTransferAprDisplay($introBalanceTransferAprDisplay) { + $this->introBalanceTransferAprDisplay = $introBalanceTransferAprDisplay; + } + public function getIntroBalanceTransferAprDisplay() { + return $this->introBalanceTransferAprDisplay; + } + public function setIssuer($issuer) { + $this->issuer = $issuer; + } + public function getIssuer() { + return $this->issuer; + } + public function setIntroBalanceTransferFeeRate($introBalanceTransferFeeRate) { + $this->introBalanceTransferFeeRate = $introBalanceTransferFeeRate; + } + public function getIntroBalanceTransferFeeRate() { + return $this->introBalanceTransferFeeRate; + } + public function setCashAdvanceFeeDisplay($cashAdvanceFeeDisplay) { + $this->cashAdvanceFeeDisplay = $cashAdvanceFeeDisplay; + } + public function getCashAdvanceFeeDisplay() { + return $this->cashAdvanceFeeDisplay; + } + public function setAnnualFeeDisplay($annualFeeDisplay) { + $this->annualFeeDisplay = $annualFeeDisplay; + } + public function getAnnualFeeDisplay() { + return $this->annualFeeDisplay; + } + public function setMinimumFinanceCharge($minimumFinanceCharge) { + $this->minimumFinanceCharge = $minimumFinanceCharge; + } + public function getMinimumFinanceCharge() { + return $this->minimumFinanceCharge; + } + public function setBalanceTransferFeeDisplay($balanceTransferFeeDisplay) { + $this->balanceTransferFeeDisplay = $balanceTransferFeeDisplay; + } + public function getBalanceTransferFeeDisplay() { + return $this->balanceTransferFeeDisplay; + } + public function setLandingPageUrl($landingPageUrl) { + $this->landingPageUrl = $landingPageUrl; + } + public function getLandingPageUrl() { + return $this->landingPageUrl; + } + public function setIntroPurchaseRate($introPurchaseRate) { + $this->introPurchaseRate = $introPurchaseRate; + } + public function getIntroPurchaseRate() { + return $this->introPurchaseRate; + } + public function setCashAdvanceAprDisplay($cashAdvanceAprDisplay) { + $this->cashAdvanceAprDisplay = $cashAdvanceAprDisplay; + } + public function getCashAdvanceAprDisplay() { + return $this->cashAdvanceAprDisplay; + } + public function setMaxCashAdvanceRate($maxCashAdvanceRate) { + $this->maxCashAdvanceRate = $maxCashAdvanceRate; + } + public function getMaxCashAdvanceRate() { + return $this->maxCashAdvanceRate; + } + public function setFirstYearAnnualFee($firstYearAnnualFee) { + $this->firstYearAnnualFee = $firstYearAnnualFee; + } + public function getFirstYearAnnualFee() { + return $this->firstYearAnnualFee; + } + public function setIntroBalanceTransferPeriodUnits($introBalanceTransferPeriodUnits) { + $this->introBalanceTransferPeriodUnits = $introBalanceTransferPeriodUnits; + } + public function getIntroBalanceTransferPeriodUnits() { + return $this->introBalanceTransferPeriodUnits; + } + public function setVariableRatesUpdateFrequency($variableRatesUpdateFrequency) { + $this->variableRatesUpdateFrequency = $variableRatesUpdateFrequency; + } + public function getVariableRatesUpdateFrequency() { + return $this->variableRatesUpdateFrequency; + } + public function setOverLimitFee($overLimitFee) { + $this->overLimitFee = $overLimitFee; + } + public function getOverLimitFee() { + return $this->overLimitFee; + } + public function setRewardsExpire($rewardsExpire) { + $this->rewardsExpire = $rewardsExpire; + } + public function getRewardsExpire() { + return $this->rewardsExpire; + } + public function setAdditionalCardBenefits(/* array(string) */ $additionalCardBenefits) { + $this->assertIsArray($additionalCardBenefits, 'string', __METHOD__); + $this->additionalCardBenefits = $additionalCardBenefits; + } + public function getAdditionalCardBenefits() { + return $this->additionalCardBenefits; + } + public function setAgeMinimum($ageMinimum) { + $this->ageMinimum = $ageMinimum; + } + public function getAgeMinimum() { + return $this->ageMinimum; + } + public function setBalanceTransferAprDisplay($balanceTransferAprDisplay) { + $this->balanceTransferAprDisplay = $balanceTransferAprDisplay; + } + public function getBalanceTransferAprDisplay() { + return $this->balanceTransferAprDisplay; + } + public function setIntroBalanceTransferPeriodLength($introBalanceTransferPeriodLength) { + $this->introBalanceTransferPeriodLength = $introBalanceTransferPeriodLength; + } + public function getIntroBalanceTransferPeriodLength() { + return $this->introBalanceTransferPeriodLength; + } + public function setNetwork($network) { + $this->network = $network; + } + public function getNetwork() { + return $this->network; + } + public function setIntroPurchaseRateType($introPurchaseRateType) { + $this->introPurchaseRateType = $introPurchaseRateType; + } + public function getIntroPurchaseRateType() { + return $this->introPurchaseRateType; + } + public function setIntroAprDisplay($introAprDisplay) { + $this->introAprDisplay = $introAprDisplay; + } + public function getIntroAprDisplay() { + return $this->introAprDisplay; + } + public function setFlightAccidentInsurance($flightAccidentInsurance) { + $this->flightAccidentInsurance = $flightAccidentInsurance; + } + public function getFlightAccidentInsurance() { + return $this->flightAccidentInsurance; + } + public function setAnnualRewardMaximum($annualRewardMaximum) { + $this->annualRewardMaximum = $annualRewardMaximum; + } + public function getAnnualRewardMaximum() { + return $this->annualRewardMaximum; + } + public function setDisclaimer($disclaimer) { + $this->disclaimer = $disclaimer; + } + public function getDisclaimer() { + return $this->disclaimer; + } + public function setCreditLimitMin($creditLimitMin) { + $this->creditLimitMin = $creditLimitMin; + } + public function getCreditLimitMin() { + return $this->creditLimitMin; + } + public function setCreditLimitMax($creditLimitMax) { + $this->creditLimitMax = $creditLimitMax; + } + public function getCreditLimitMax() { + return $this->creditLimitMax; + } + public function setGracePeriodDisplay($gracePeriodDisplay) { + $this->gracePeriodDisplay = $gracePeriodDisplay; + } + public function getGracePeriodDisplay() { + return $this->gracePeriodDisplay; + } + public function setCashAdvanceFeeAmount($cashAdvanceFeeAmount) { + $this->cashAdvanceFeeAmount = $cashAdvanceFeeAmount; + } + public function getCashAdvanceFeeAmount() { + return $this->cashAdvanceFeeAmount; + } + public function setTravelInsurance($travelInsurance) { + $this->travelInsurance = $travelInsurance; + } + public function getTravelInsurance() { + return $this->travelInsurance; + } + public function setExistingCustomerOnly($existingCustomerOnly) { + $this->existingCustomerOnly = $existingCustomerOnly; + } + public function getExistingCustomerOnly() { + return $this->existingCustomerOnly; + } + public function setInitialSetupAndProcessingFee($initialSetupAndProcessingFee) { + $this->initialSetupAndProcessingFee = $initialSetupAndProcessingFee; + } + public function getInitialSetupAndProcessingFee() { + return $this->initialSetupAndProcessingFee; + } + public function setIssuerId($issuerId) { + $this->issuerId = $issuerId; + } + public function getIssuerId() { + return $this->issuerId; + } + public function setRewardUnit($rewardUnit) { + $this->rewardUnit = $rewardUnit; + } + public function getRewardUnit() { + return $this->rewardUnit; + } + public function setProhibitedCategories(/* array(string) */ $prohibitedCategories) { + $this->assertIsArray($prohibitedCategories, 'string', __METHOD__); + $this->prohibitedCategories = $prohibitedCategories; + } + public function getProhibitedCategories() { + return $this->prohibitedCategories; + } + public function setDefaultFees(/* array(CcOfferDefaultFees) */ $defaultFees) { + $this->assertIsArray($defaultFees, 'CcOfferDefaultFees', __METHOD__); + $this->defaultFees = $defaultFees; + } + public function getDefaultFees() { + return $this->defaultFees; + } + public function setIntroPurchasePeriodUnits($introPurchasePeriodUnits) { + $this->introPurchasePeriodUnits = $introPurchasePeriodUnits; + } + public function getIntroPurchasePeriodUnits() { + return $this->introPurchasePeriodUnits; + } + public function setTrackingUrl($trackingUrl) { + $this->trackingUrl = $trackingUrl; + } + public function getTrackingUrl() { + return $this->trackingUrl; + } + public function setLatePaymentFee($latePaymentFee) { + $this->latePaymentFee = $latePaymentFee; + } + public function getLatePaymentFee() { + return $this->latePaymentFee; + } + public function setStatementCopyFee($statementCopyFee) { + $this->statementCopyFee = $statementCopyFee; + } + public function getStatementCopyFee() { + return $this->statementCopyFee; + } + public function setVariableRatesLastUpdated($variableRatesLastUpdated) { + $this->variableRatesLastUpdated = $variableRatesLastUpdated; + } + public function getVariableRatesLastUpdated() { + return $this->variableRatesLastUpdated; + } + public function setMinBalanceTransferRate($minBalanceTransferRate) { + $this->minBalanceTransferRate = $minBalanceTransferRate; + } + public function getMinBalanceTransferRate() { + return $this->minBalanceTransferRate; + } + public function setEmergencyInsurance($emergencyInsurance) { + $this->emergencyInsurance = $emergencyInsurance; + } + public function getEmergencyInsurance() { + return $this->emergencyInsurance; + } + public function setIntroPurchasePeriodEndDate($introPurchasePeriodEndDate) { + $this->introPurchasePeriodEndDate = $introPurchasePeriodEndDate; + } + public function getIntroPurchasePeriodEndDate() { + return $this->introPurchasePeriodEndDate; + } + public function setCardName($cardName) { + $this->cardName = $cardName; + } + public function getCardName() { + return $this->cardName; + } + public function setReturnedPaymentFee($returnedPaymentFee) { + $this->returnedPaymentFee = $returnedPaymentFee; + } + public function getReturnedPaymentFee() { + return $this->returnedPaymentFee; + } + public function setCashAdvanceAdditionalDetails($cashAdvanceAdditionalDetails) { + $this->cashAdvanceAdditionalDetails = $cashAdvanceAdditionalDetails; + } + public function getCashAdvanceAdditionalDetails() { + return $this->cashAdvanceAdditionalDetails; + } + public function setCashAdvanceLimit($cashAdvanceLimit) { + $this->cashAdvanceLimit = $cashAdvanceLimit; + } + public function getCashAdvanceLimit() { + return $this->cashAdvanceLimit; + } + public function setBalanceTransferFeeRate($balanceTransferFeeRate) { + $this->balanceTransferFeeRate = $balanceTransferFeeRate; + } + public function getBalanceTransferFeeRate() { + return $this->balanceTransferFeeRate; + } + public function setBalanceTransferRateType($balanceTransferRateType) { + $this->balanceTransferRateType = $balanceTransferRateType; + } + public function getBalanceTransferRateType() { + return $this->balanceTransferRateType; + } + public function setRewards(/* array(CcOfferRewards) */ $rewards) { + $this->assertIsArray($rewards, 'CcOfferRewards', __METHOD__); + $this->rewards = $rewards; + } + public function getRewards() { + return $this->rewards; + } + public function setExtendedWarranty($extendedWarranty) { + $this->extendedWarranty = $extendedWarranty; + } + public function getExtendedWarranty() { + return $this->extendedWarranty; + } + public function setCarRentalInsurance($carRentalInsurance) { + $this->carRentalInsurance = $carRentalInsurance; + } + public function getCarRentalInsurance() { + return $this->carRentalInsurance; + } + public function setCashAdvanceFeeRate($cashAdvanceFeeRate) { + $this->cashAdvanceFeeRate = $cashAdvanceFeeRate; + } + public function getCashAdvanceFeeRate() { + return $this->cashAdvanceFeeRate; + } + public function setRewardPartner($rewardPartner) { + $this->rewardPartner = $rewardPartner; + } + public function getRewardPartner() { + return $this->rewardPartner; + } + public function setForeignCurrencyTransactionFee($foreignCurrencyTransactionFee) { + $this->foreignCurrencyTransactionFee = $foreignCurrencyTransactionFee; + } + public function getForeignCurrencyTransactionFee() { + return $this->foreignCurrencyTransactionFee; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setIntroBalanceTransferFeeAmount($introBalanceTransferFeeAmount) { + $this->introBalanceTransferFeeAmount = $introBalanceTransferFeeAmount; + } + public function getIntroBalanceTransferFeeAmount() { + return $this->introBalanceTransferFeeAmount; + } + public function setCreditRatingDisplay($creditRatingDisplay) { + $this->creditRatingDisplay = $creditRatingDisplay; + } + public function getCreditRatingDisplay() { + return $this->creditRatingDisplay; + } + public function setAdditionalCardHolderFee($additionalCardHolderFee) { + $this->additionalCardHolderFee = $additionalCardHolderFee; + } + public function getAdditionalCardHolderFee() { + return $this->additionalCardHolderFee; + } + public function setPurchaseRateType($purchaseRateType) { + $this->purchaseRateType = $purchaseRateType; + } + public function getPurchaseRateType() { + return $this->purchaseRateType; + } + public function setCashAdvanceRateType($cashAdvanceRateType) { + $this->cashAdvanceRateType = $cashAdvanceRateType; + } + public function getCashAdvanceRateType() { + return $this->cashAdvanceRateType; + } + public function setBonusRewards(/* array(CcOfferBonusRewards) */ $bonusRewards) { + $this->assertIsArray($bonusRewards, 'CcOfferBonusRewards', __METHOD__); + $this->bonusRewards = $bonusRewards; + } + public function getBonusRewards() { + return $this->bonusRewards; + } + public function setBalanceTransferLimit($balanceTransferLimit) { + $this->balanceTransferLimit = $balanceTransferLimit; + } + public function getBalanceTransferLimit() { + return $this->balanceTransferLimit; + } + public function setLuggageInsurance($luggageInsurance) { + $this->luggageInsurance = $luggageInsurance; + } + public function getLuggageInsurance() { + return $this->luggageInsurance; + } + public function setMinCashAdvanceRate($minCashAdvanceRate) { + $this->minCashAdvanceRate = $minCashAdvanceRate; + } + public function getMinCashAdvanceRate() { + return $this->minCashAdvanceRate; + } + public function setOfferId($offerId) { + $this->offerId = $offerId; + } + public function getOfferId() { + return $this->offerId; + } + public function setMinPurchaseRate($minPurchaseRate) { + $this->minPurchaseRate = $minPurchaseRate; + } + public function getMinPurchaseRate() { + return $this->minPurchaseRate; + } + public function setOffersImmediateCashReward($offersImmediateCashReward) { + $this->offersImmediateCashReward = $offersImmediateCashReward; + } + public function getOffersImmediateCashReward() { + return $this->offersImmediateCashReward; + } + public function setFraudLiability($fraudLiability) { + $this->fraudLiability = $fraudLiability; + } + public function getFraudLiability() { + return $this->fraudLiability; + } + public function setCardType($cardType) { + $this->cardType = $cardType; + } + public function getCardType() { + return $this->cardType; + } + public function setApprovedCategories(/* array(string) */ $approvedCategories) { + $this->assertIsArray($approvedCategories, 'string', __METHOD__); + $this->approvedCategories = $approvedCategories; + } + public function getApprovedCategories() { + return $this->approvedCategories; + } + public function setAnnualFee($annualFee) { + $this->annualFee = $annualFee; + } + public function getAnnualFee() { + return $this->annualFee; + } + public function setMaxBalanceTransferRate($maxBalanceTransferRate) { + $this->maxBalanceTransferRate = $maxBalanceTransferRate; + } + public function getMaxBalanceTransferRate() { + return $this->maxBalanceTransferRate; + } + public function setMaxPurchaseRate($maxPurchaseRate) { + $this->maxPurchaseRate = $maxPurchaseRate; + } + public function getMaxPurchaseRate() { + return $this->maxPurchaseRate; + } + public function setIssuerWebsite($issuerWebsite) { + $this->issuerWebsite = $issuerWebsite; + } + public function getIssuerWebsite() { + return $this->issuerWebsite; + } + public function setIntroBalanceTransferRateType($introBalanceTransferRateType) { + $this->introBalanceTransferRateType = $introBalanceTransferRateType; + } + public function getIntroBalanceTransferRateType() { + return $this->introBalanceTransferRateType; + } + public function setAprDisplay($aprDisplay) { + $this->aprDisplay = $aprDisplay; + } + public function getAprDisplay() { + return $this->aprDisplay; + } + public function setImageUrl($imageUrl) { + $this->imageUrl = $imageUrl; + } + public function getImageUrl() { + return $this->imageUrl; + } + public function setAgeMinimumDetails($ageMinimumDetails) { + $this->ageMinimumDetails = $ageMinimumDetails; + } + public function getAgeMinimumDetails() { + return $this->ageMinimumDetails; + } + public function setBalanceTransferFeeAmount($balanceTransferFeeAmount) { + $this->balanceTransferFeeAmount = $balanceTransferFeeAmount; + } + public function getBalanceTransferFeeAmount() { + return $this->balanceTransferFeeAmount; + } + public function setIntroBalanceTransferPeriodEndDate($introBalanceTransferPeriodEndDate) { + $this->introBalanceTransferPeriodEndDate = $introBalanceTransferPeriodEndDate; + } + public function getIntroBalanceTransferPeriodEndDate() { + return $this->introBalanceTransferPeriodEndDate; + } +} + +class CcOfferBonusRewards extends apiModel { + public $amount; + public $details; + public function setAmount($amount) { + $this->amount = $amount; + } + public function getAmount() { + return $this->amount; + } + public function setDetails($details) { + $this->details = $details; + } + public function getDetails() { + return $this->details; + } +} + +class CcOfferDefaultFees extends apiModel { + public $category; + public $maxRate; + public $minRate; + public $rateType; + public function setCategory($category) { + $this->category = $category; + } + public function getCategory() { + return $this->category; + } + public function setMaxRate($maxRate) { + $this->maxRate = $maxRate; + } + public function getMaxRate() { + return $this->maxRate; + } + public function setMinRate($minRate) { + $this->minRate = $minRate; + } + public function getMinRate() { + return $this->minRate; + } + public function setRateType($rateType) { + $this->rateType = $rateType; + } + public function getRateType() { + return $this->rateType; + } +} + +class CcOfferRewards extends apiModel { + public $category; + public $minRewardTier; + public $maxRewardTier; + public $expirationMonths; + public $amount; + public $additionalDetails; + public function setCategory($category) { + $this->category = $category; + } + public function getCategory() { + return $this->category; + } + public function setMinRewardTier($minRewardTier) { + $this->minRewardTier = $minRewardTier; + } + public function getMinRewardTier() { + return $this->minRewardTier; + } + public function setMaxRewardTier($maxRewardTier) { + $this->maxRewardTier = $maxRewardTier; + } + public function getMaxRewardTier() { + return $this->maxRewardTier; + } + public function setExpirationMonths($expirationMonths) { + $this->expirationMonths = $expirationMonths; + } + public function getExpirationMonths() { + return $this->expirationMonths; + } + public function setAmount($amount) { + $this->amount = $amount; + } + public function getAmount() { + return $this->amount; + } + public function setAdditionalDetails($additionalDetails) { + $this->additionalDetails = $additionalDetails; + } + public function getAdditionalDetails() { + return $this->additionalDetails; + } +} + +class CcOffers extends apiModel { + protected $__itemsType = 'CcOffer'; + protected $__itemsDataType = 'array'; + public $items; + public $kind; + public function setItems(/* array(CcOffer) */ $items) { + $this->assertIsArray($items, 'CcOffer', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } +} + +class Event extends apiModel { + protected $__networkFeeType = 'Money'; + protected $__networkFeeDataType = ''; + public $networkFee; + public $advertiserName; + public $kind; + public $modifyDate; + public $type; + public $orderId; + public $publisherName; + public $memberId; + public $advertiserId; + public $status; + public $chargeId; + protected $__productsType = 'EventProducts'; + protected $__productsDataType = 'array'; + public $products; + protected $__earningsType = 'Money'; + protected $__earningsDataType = ''; + public $earnings; + public $chargeType; + protected $__publisherFeeType = 'Money'; + protected $__publisherFeeDataType = ''; + public $publisherFee; + protected $__commissionableSalesType = 'Money'; + protected $__commissionableSalesDataType = ''; + public $commissionableSales; + public $publisherId; + public $eventDate; + public function setNetworkFee(Money $networkFee) { + $this->networkFee = $networkFee; + } + public function getNetworkFee() { + return $this->networkFee; + } + public function setAdvertiserName($advertiserName) { + $this->advertiserName = $advertiserName; + } + public function getAdvertiserName() { + return $this->advertiserName; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setModifyDate($modifyDate) { + $this->modifyDate = $modifyDate; + } + public function getModifyDate() { + return $this->modifyDate; + } + public function setType($type) { + $this->type = $type; + } + public function getType() { + return $this->type; + } + public function setOrderId($orderId) { + $this->orderId = $orderId; + } + public function getOrderId() { + return $this->orderId; + } + public function setPublisherName($publisherName) { + $this->publisherName = $publisherName; + } + public function getPublisherName() { + return $this->publisherName; + } + public function setMemberId($memberId) { + $this->memberId = $memberId; + } + public function getMemberId() { + return $this->memberId; + } + public function setAdvertiserId($advertiserId) { + $this->advertiserId = $advertiserId; + } + public function getAdvertiserId() { + return $this->advertiserId; + } + public function setStatus($status) { + $this->status = $status; + } + public function getStatus() { + return $this->status; + } + public function setChargeId($chargeId) { + $this->chargeId = $chargeId; + } + public function getChargeId() { + return $this->chargeId; + } + public function setProducts(/* array(EventProducts) */ $products) { + $this->assertIsArray($products, 'EventProducts', __METHOD__); + $this->products = $products; + } + public function getProducts() { + return $this->products; + } + public function setEarnings(Money $earnings) { + $this->earnings = $earnings; + } + public function getEarnings() { + return $this->earnings; + } + public function setChargeType($chargeType) { + $this->chargeType = $chargeType; + } + public function getChargeType() { + return $this->chargeType; + } + public function setPublisherFee(Money $publisherFee) { + $this->publisherFee = $publisherFee; + } + public function getPublisherFee() { + return $this->publisherFee; + } + public function setCommissionableSales(Money $commissionableSales) { + $this->commissionableSales = $commissionableSales; + } + public function getCommissionableSales() { + return $this->commissionableSales; + } + public function setPublisherId($publisherId) { + $this->publisherId = $publisherId; + } + public function getPublisherId() { + return $this->publisherId; + } + public function setEventDate($eventDate) { + $this->eventDate = $eventDate; + } + public function getEventDate() { + return $this->eventDate; + } +} + +class EventProducts extends apiModel { + protected $__networkFeeType = 'Money'; + protected $__networkFeeDataType = ''; + public $networkFee; + public $sku; + public $categoryName; + public $skuName; + protected $__publisherFeeType = 'Money'; + protected $__publisherFeeDataType = ''; + public $publisherFee; + protected $__earningsType = 'Money'; + protected $__earningsDataType = ''; + public $earnings; + protected $__unitPriceType = 'Money'; + protected $__unitPriceDataType = ''; + public $unitPrice; + public $categoryId; + public $quantity; + public function setNetworkFee(Money $networkFee) { + $this->networkFee = $networkFee; + } + public function getNetworkFee() { + return $this->networkFee; + } + public function setSku($sku) { + $this->sku = $sku; + } + public function getSku() { + return $this->sku; + } + public function setCategoryName($categoryName) { + $this->categoryName = $categoryName; + } + public function getCategoryName() { + return $this->categoryName; + } + public function setSkuName($skuName) { + $this->skuName = $skuName; + } + public function getSkuName() { + return $this->skuName; + } + public function setPublisherFee(Money $publisherFee) { + $this->publisherFee = $publisherFee; + } + public function getPublisherFee() { + return $this->publisherFee; + } + public function setEarnings(Money $earnings) { + $this->earnings = $earnings; + } + public function getEarnings() { + return $this->earnings; + } + public function setUnitPrice(Money $unitPrice) { + $this->unitPrice = $unitPrice; + } + public function getUnitPrice() { + return $this->unitPrice; + } + public function setCategoryId($categoryId) { + $this->categoryId = $categoryId; + } + public function getCategoryId() { + return $this->categoryId; + } + public function setQuantity($quantity) { + $this->quantity = $quantity; + } + public function getQuantity() { + return $this->quantity; + } +} + +class Events extends apiModel { + public $nextPageToken; + protected $__itemsType = 'Event'; + protected $__itemsDataType = 'array'; + public $items; + public $kind; + public function setNextPageToken($nextPageToken) { + $this->nextPageToken = $nextPageToken; + } + public function getNextPageToken() { + return $this->nextPageToken; + } + public function setItems(/* array(Event) */ $items) { + $this->assertIsArray($items, 'Event', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } +} + +class Money extends apiModel { + public $amount; + public $currencyCode; + public function setAmount($amount) { + $this->amount = $amount; + } + public function getAmount() { + return $this->amount; + } + public function setCurrencyCode($currencyCode) { + $this->currencyCode = $currencyCode; + } + public function getCurrencyCode() { + return $this->currencyCode; + } +} + +class Publisher extends apiModel { + public $status; + public $kind; + public $name; + public $classification; + protected $__epcSevenDayAverageType = 'Money'; + protected $__epcSevenDayAverageDataType = ''; + public $epcSevenDayAverage; + public $payoutRank; + protected $__epcNinetyDayAverageType = 'Money'; + protected $__epcNinetyDayAverageDataType = ''; + public $epcNinetyDayAverage; + protected $__itemType = 'Publisher2'; + protected $__itemDataType = ''; + public $item; + public $joinDate; + public $sites; + public $id; + public function setStatus($status) { + $this->status = $status; + } + public function getStatus() { + return $this->status; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setName($name) { + $this->name = $name; + } + public function getName() { + return $this->name; + } + public function setClassification($classification) { + $this->classification = $classification; + } + public function getClassification() { + return $this->classification; + } + public function setEpcSevenDayAverage(Money $epcSevenDayAverage) { + $this->epcSevenDayAverage = $epcSevenDayAverage; + } + public function getEpcSevenDayAverage() { + return $this->epcSevenDayAverage; + } + public function setPayoutRank($payoutRank) { + $this->payoutRank = $payoutRank; + } + public function getPayoutRank() { + return $this->payoutRank; + } + public function setEpcNinetyDayAverage(Money $epcNinetyDayAverage) { + $this->epcNinetyDayAverage = $epcNinetyDayAverage; + } + public function getEpcNinetyDayAverage() { + return $this->epcNinetyDayAverage; + } + public function setItem(Publisher2 $item) { + $this->item = $item; + } + public function getItem() { + return $this->item; + } + public function setJoinDate($joinDate) { + $this->joinDate = $joinDate; + } + public function getJoinDate() { + return $this->joinDate; + } + public function setSites(/* array(string) */ $sites) { + $this->assertIsArray($sites, 'string', __METHOD__); + $this->sites = $sites; + } + public function getSites() { + return $this->sites; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } +} + +class Publishers extends apiModel { + public $nextPageToken; + protected $__itemsType = 'Publisher'; + protected $__itemsDataType = 'array'; + public $items; + public $kind; + public function setNextPageToken($nextPageToken) { + $this->nextPageToken = $nextPageToken; + } + public function getNextPageToken() { + return $this->nextPageToken; + } + public function setItems(/* array(Publisher) */ $items) { + $this->assertIsArray($items, 'Publisher', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } +} diff --git a/webui/google-api/contrib/apiLatitudeService.php b/webui/google-api/contrib/apiLatitudeService.php new file mode 100644 index 0000000..8fa9192 --- /dev/null +++ b/webui/google-api/contrib/apiLatitudeService.php @@ -0,0 +1,287 @@ + + * $latitudeService = new apiLatitudeService(...); + * $currentLocation = $latitudeService->currentLocation; + * + */ + class CurrentLocationServiceResource extends apiServiceResource { + + + /** + * Updates or creates the user's current location. (currentLocation.insert) + * + * @param Location $postBody + * @return Location + */ + public function insert(Location $postBody, $optParams = array()) { + $params = array('postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('insert', array($params)); + if ($this->useObjects()) { + return new Location($data); + } else { + return $data; + } + } + /** + * Returns the authenticated user's current location. (currentLocation.get) + * + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string granularity Granularity of the requested location. + * @return Location + */ + public function get($optParams = array()) { + $params = array(); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new Location($data); + } else { + return $data; + } + } + /** + * Deletes the authenticated user's current location. (currentLocation.delete) + * + */ + public function delete($optParams = array()) { + $params = array(); + $params = array_merge($params, $optParams); + $data = $this->__call('delete', array($params)); + return $data; + } + } + + /** + * The "location" collection of methods. + * Typical usage is: + * + * $latitudeService = new apiLatitudeService(...); + * $location = $latitudeService->location; + * + */ + class LocationServiceResource extends apiServiceResource { + + + /** + * Inserts or updates a location in the user's location history. (location.insert) + * + * @param Location $postBody + * @return Location + */ + public function insert(Location $postBody, $optParams = array()) { + $params = array('postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('insert', array($params)); + if ($this->useObjects()) { + return new Location($data); + } else { + return $data; + } + } + /** + * Reads a location from the user's location history. (location.get) + * + * @param string $locationId Timestamp of the location to read (ms since epoch). + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string granularity Granularity of the location to return. + * @return Location + */ + public function get($locationId, $optParams = array()) { + $params = array('locationId' => $locationId); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new Location($data); + } else { + return $data; + } + } + /** + * Lists the user's location history. (location.list) + * + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string max-results Maximum number of locations to return. + * @opt_param string max-time Maximum timestamp of locations to return (ms since epoch). + * @opt_param string min-time Minimum timestamp of locations to return (ms since epoch). + * @opt_param string granularity Granularity of the requested locations. + * @return LocationFeed + */ + public function listLocation($optParams = array()) { + $params = array(); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new LocationFeed($data); + } else { + return $data; + } + } + /** + * Deletes a location from the user's location history. (location.delete) + * + * @param string $locationId Timestamp of the location to delete (ms since epoch). + */ + public function delete($locationId, $optParams = array()) { + $params = array('locationId' => $locationId); + $params = array_merge($params, $optParams); + $data = $this->__call('delete', array($params)); + return $data; + } + } + + + +/** + * Service definition for Latitude (v1). + * + *

+ * Lets you read and update your current location and work with your location history + *

+ * + *

+ * For more information about this service, see the + * API Documentation + *

+ * + * @author Google, Inc. + */ +class apiLatitudeService extends apiService { + public $currentLocation; + public $location; + /** + * Constructs the internal representation of the Latitude service. + * + * @param apiClient apiClient + */ + public function __construct(apiClient $apiClient) { + $this->rpcPath = '/rpc'; + $this->restBasePath = '/latitude/v1/'; + $this->version = 'v1'; + $this->serviceName = 'latitude'; + + $apiClient->addService($this->serviceName, $this->version); + $this->currentLocation = new CurrentLocationServiceResource($this, $this->serviceName, 'currentLocation', json_decode('{"methods": {"insert": {"scopes": ["https://www.googleapis.com/auth/latitude.all.best", "https://www.googleapis.com/auth/latitude.all.city", "https://www.googleapis.com/auth/latitude.current.best", "https://www.googleapis.com/auth/latitude.current.city"], "request": {"$ref": "LatitudeCurrentlocationResourceJson"}, "response": {"$ref": "LatitudeCurrentlocationResourceJson"}, "httpMethod": "POST", "path": "currentLocation", "id": "latitude.currentLocation.insert"}, "delete": {"id": "latitude.currentLocation.delete", "path": "currentLocation", "httpMethod": "DELETE", "scopes": ["https://www.googleapis.com/auth/latitude.all.best", "https://www.googleapis.com/auth/latitude.all.city", "https://www.googleapis.com/auth/latitude.current.best", "https://www.googleapis.com/auth/latitude.current.city"]}, "get": {"scopes": ["https://www.googleapis.com/auth/latitude.all.best", "https://www.googleapis.com/auth/latitude.all.city", "https://www.googleapis.com/auth/latitude.current.best", "https://www.googleapis.com/auth/latitude.current.city"], "parameters": {"granularity": {"type": "string", "location": "query"}}, "response": {"$ref": "LatitudeCurrentlocationResourceJson"}, "httpMethod": "GET", "path": "currentLocation", "id": "latitude.currentLocation.get"}}}', true)); + $this->location = new LocationServiceResource($this, $this->serviceName, 'location', json_decode('{"methods": {"insert": {"scopes": ["https://www.googleapis.com/auth/latitude.all.best", "https://www.googleapis.com/auth/latitude.all.city"], "request": {"$ref": "Location"}, "response": {"$ref": "Location"}, "httpMethod": "POST", "path": "location", "id": "latitude.location.insert"}, "delete": {"scopes": ["https://www.googleapis.com/auth/latitude.all.best", "https://www.googleapis.com/auth/latitude.all.city"], "parameters": {"locationId": {"required": true, "type": "string", "location": "path"}}, "httpMethod": "DELETE", "path": "location/{locationId}", "id": "latitude.location.delete"}, "list": {"scopes": ["https://www.googleapis.com/auth/latitude.all.best", "https://www.googleapis.com/auth/latitude.all.city"], "parameters": {"max-results": {"type": "string", "location": "query"}, "max-time": {"type": "string", "location": "query"}, "min-time": {"type": "string", "location": "query"}, "granularity": {"type": "string", "location": "query"}}, "response": {"$ref": "LocationFeed"}, "httpMethod": "GET", "path": "location", "id": "latitude.location.list"}, "get": {"scopes": ["https://www.googleapis.com/auth/latitude.all.best", "https://www.googleapis.com/auth/latitude.all.city"], "parameters": {"locationId": {"required": true, "type": "string", "location": "path"}, "granularity": {"type": "string", "location": "query"}}, "id": "latitude.location.get", "httpMethod": "GET", "path": "location/{locationId}", "response": {"$ref": "Location"}}}}', true)); + } +} + +class Location extends apiModel { + public $kind; + public $altitude; + public $longitude; + public $activityId; + public $latitude; + public $altitudeAccuracy; + public $timestampMs; + public $speed; + public $heading; + public $accuracy; + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setAltitude($altitude) { + $this->altitude = $altitude; + } + public function getAltitude() { + return $this->altitude; + } + public function setLongitude($longitude) { + $this->longitude = $longitude; + } + public function getLongitude() { + return $this->longitude; + } + public function setActivityId($activityId) { + $this->activityId = $activityId; + } + public function getActivityId() { + return $this->activityId; + } + public function setLatitude($latitude) { + $this->latitude = $latitude; + } + public function getLatitude() { + return $this->latitude; + } + public function setAltitudeAccuracy($altitudeAccuracy) { + $this->altitudeAccuracy = $altitudeAccuracy; + } + public function getAltitudeAccuracy() { + return $this->altitudeAccuracy; + } + public function setTimestampMs($timestampMs) { + $this->timestampMs = $timestampMs; + } + public function getTimestampMs() { + return $this->timestampMs; + } + public function setSpeed($speed) { + $this->speed = $speed; + } + public function getSpeed() { + return $this->speed; + } + public function setHeading($heading) { + $this->heading = $heading; + } + public function getHeading() { + return $this->heading; + } + public function setAccuracy($accuracy) { + $this->accuracy = $accuracy; + } + public function getAccuracy() { + return $this->accuracy; + } +} + +class LocationFeed extends apiModel { + protected $__itemsType = 'Location'; + protected $__itemsDataType = 'array'; + public $items; + public $kind; + public function setItems(/* array(Location) */ $items) { + $this->assertIsArray($items, 'Location', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } +} diff --git a/webui/google-api/contrib/apiModeratorService.php b/webui/google-api/contrib/apiModeratorService.php new file mode 100644 index 0000000..33afc3d --- /dev/null +++ b/webui/google-api/contrib/apiModeratorService.php @@ -0,0 +1,1903 @@ + + * $moderatorService = new apiModeratorService(...); + * $votes = $moderatorService->votes; + * + */ + class VotesServiceResource extends apiServiceResource { + + + /** + * Inserts a new vote by the authenticated user for the specified submission within the specified + * series. (votes.insert) + * + * @param string $seriesId The decimal ID of the Series. + * @param string $submissionId The decimal ID of the Submission within the Series. + * @param Vote $postBody + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string unauthToken User identifier for unauthenticated usage mode + * @return Vote + */ + public function insert($seriesId, $submissionId, Vote $postBody, $optParams = array()) { + $params = array('seriesId' => $seriesId, 'submissionId' => $submissionId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('insert', array($params)); + if ($this->useObjects()) { + return new Vote($data); + } else { + return $data; + } + } + /** + * Updates the votes by the authenticated user for the specified submission within the specified + * series. This method supports patch semantics. (votes.patch) + * + * @param string $seriesId The decimal ID of the Series. + * @param string $submissionId The decimal ID of the Submission within the Series. + * @param Vote $postBody + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string userId + * @opt_param string unauthToken User identifier for unauthenticated usage mode + * @return Vote + */ + public function patch($seriesId, $submissionId, Vote $postBody, $optParams = array()) { + $params = array('seriesId' => $seriesId, 'submissionId' => $submissionId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('patch', array($params)); + if ($this->useObjects()) { + return new Vote($data); + } else { + return $data; + } + } + /** + * Lists the votes by the authenticated user for the given series. (votes.list) + * + * @param string $seriesId The decimal ID of the Series. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string max-results Maximum number of results to return. + * @opt_param string start-index Index of the first result to be retrieved. + * @return VoteList + */ + public function listVotes($seriesId, $optParams = array()) { + $params = array('seriesId' => $seriesId); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new VoteList($data); + } else { + return $data; + } + } + /** + * Updates the votes by the authenticated user for the specified submission within the specified + * series. (votes.update) + * + * @param string $seriesId The decimal ID of the Series. + * @param string $submissionId The decimal ID of the Submission within the Series. + * @param Vote $postBody + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string userId + * @opt_param string unauthToken User identifier for unauthenticated usage mode + * @return Vote + */ + public function update($seriesId, $submissionId, Vote $postBody, $optParams = array()) { + $params = array('seriesId' => $seriesId, 'submissionId' => $submissionId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('update', array($params)); + if ($this->useObjects()) { + return new Vote($data); + } else { + return $data; + } + } + /** + * Returns the votes by the authenticated user for the specified submission within the specified + * series. (votes.get) + * + * @param string $seriesId The decimal ID of the Series. + * @param string $submissionId The decimal ID of the Submission within the Series. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string userId + * @opt_param string unauthToken User identifier for unauthenticated usage mode + * @return Vote + */ + public function get($seriesId, $submissionId, $optParams = array()) { + $params = array('seriesId' => $seriesId, 'submissionId' => $submissionId); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new Vote($data); + } else { + return $data; + } + } + } + + /** + * The "responses" collection of methods. + * Typical usage is: + * + * $moderatorService = new apiModeratorService(...); + * $responses = $moderatorService->responses; + * + */ + class ResponsesServiceResource extends apiServiceResource { + + + /** + * Inserts a response for the specified submission in the specified topic within the specified + * series. (responses.insert) + * + * @param string $seriesId The decimal ID of the Series. + * @param string $topicId The decimal ID of the Topic within the Series. + * @param string $parentSubmissionId The decimal ID of the parent Submission within the Series. + * @param Submission $postBody + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string unauthToken User identifier for unauthenticated usage mode + * @opt_param bool anonymous Set to true to mark the new submission as anonymous. + * @return Submission + */ + public function insert($seriesId, $topicId, $parentSubmissionId, Submission $postBody, $optParams = array()) { + $params = array('seriesId' => $seriesId, 'topicId' => $topicId, 'parentSubmissionId' => $parentSubmissionId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('insert', array($params)); + if ($this->useObjects()) { + return new Submission($data); + } else { + return $data; + } + } + /** + * Lists or searches the responses for the specified submission within the specified series and + * returns the search results. (responses.list) + * + * @param string $seriesId The decimal ID of the Series. + * @param string $submissionId The decimal ID of the Submission within the Series. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string max-results Maximum number of results to return. + * @opt_param string sort Sort order. + * @opt_param string author Restricts the results to submissions by a specific author. + * @opt_param string start-index Index of the first result to be retrieved. + * @opt_param string q Search query. + * @opt_param bool hasAttachedVideo Specifies whether to restrict to submissions that have videos attached. + * @return SubmissionList + */ + public function listResponses($seriesId, $submissionId, $optParams = array()) { + $params = array('seriesId' => $seriesId, 'submissionId' => $submissionId); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new SubmissionList($data); + } else { + return $data; + } + } + } + + /** + * The "tags" collection of methods. + * Typical usage is: + * + * $moderatorService = new apiModeratorService(...); + * $tags = $moderatorService->tags; + * + */ + class TagsServiceResource extends apiServiceResource { + + + /** + * Inserts a new tag for the specified submission within the specified series. (tags.insert) + * + * @param string $seriesId The decimal ID of the Series. + * @param string $submissionId The decimal ID of the Submission within the Series. + * @param Tag $postBody + * @return Tag + */ + public function insert($seriesId, $submissionId, Tag $postBody, $optParams = array()) { + $params = array('seriesId' => $seriesId, 'submissionId' => $submissionId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('insert', array($params)); + if ($this->useObjects()) { + return new Tag($data); + } else { + return $data; + } + } + /** + * Lists all tags for the specified submission within the specified series. (tags.list) + * + * @param string $seriesId The decimal ID of the Series. + * @param string $submissionId The decimal ID of the Submission within the Series. + * @return TagList + */ + public function listTags($seriesId, $submissionId, $optParams = array()) { + $params = array('seriesId' => $seriesId, 'submissionId' => $submissionId); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new TagList($data); + } else { + return $data; + } + } + /** + * Deletes the specified tag from the specified submission within the specified series. + * (tags.delete) + * + * @param string $seriesId The decimal ID of the Series. + * @param string $submissionId The decimal ID of the Submission within the Series. + * @param string $tagId + */ + public function delete($seriesId, $submissionId, $tagId, $optParams = array()) { + $params = array('seriesId' => $seriesId, 'submissionId' => $submissionId, 'tagId' => $tagId); + $params = array_merge($params, $optParams); + $data = $this->__call('delete', array($params)); + return $data; + } + } + + /** + * The "series" collection of methods. + * Typical usage is: + * + * $moderatorService = new apiModeratorService(...); + * $series = $moderatorService->series; + * + */ + class SeriesServiceResource extends apiServiceResource { + + + /** + * Inserts a new series. (series.insert) + * + * @param Series $postBody + * @return Series + */ + public function insert(Series $postBody, $optParams = array()) { + $params = array('postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('insert', array($params)); + if ($this->useObjects()) { + return new Series($data); + } else { + return $data; + } + } + /** + * Updates the specified series. This method supports patch semantics. (series.patch) + * + * @param string $seriesId The decimal ID of the Series. + * @param Series $postBody + * @return Series + */ + public function patch($seriesId, Series $postBody, $optParams = array()) { + $params = array('seriesId' => $seriesId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('patch', array($params)); + if ($this->useObjects()) { + return new Series($data); + } else { + return $data; + } + } + /** + * Searches the series and returns the search results. (series.list) + * + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string max-results Maximum number of results to return. + * @opt_param string q Search query. + * @opt_param string start-index Index of the first result to be retrieved. + * @return SeriesList + */ + public function listSeries($optParams = array()) { + $params = array(); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new SeriesList($data); + } else { + return $data; + } + } + /** + * Updates the specified series. (series.update) + * + * @param string $seriesId The decimal ID of the Series. + * @param Series $postBody + * @return Series + */ + public function update($seriesId, Series $postBody, $optParams = array()) { + $params = array('seriesId' => $seriesId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('update', array($params)); + if ($this->useObjects()) { + return new Series($data); + } else { + return $data; + } + } + /** + * Returns the specified series. (series.get) + * + * @param string $seriesId The decimal ID of the Series. + * @return Series + */ + public function get($seriesId, $optParams = array()) { + $params = array('seriesId' => $seriesId); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new Series($data); + } else { + return $data; + } + } + } + + + /** + * The "submissions" collection of methods. + * Typical usage is: + * + * $moderatorService = new apiModeratorService(...); + * $submissions = $moderatorService->submissions; + * + */ + class SeriesSubmissionsServiceResource extends apiServiceResource { + + + /** + * Searches the submissions for the specified series and returns the search results. + * (submissions.list) + * + * @param string $seriesId The decimal ID of the Series. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string lang The language code for the language the client prefers resuls in. + * @opt_param string max-results Maximum number of results to return. + * @opt_param bool includeVotes Specifies whether to include the current user's vote + * @opt_param string start-index Index of the first result to be retrieved. + * @opt_param string author Restricts the results to submissions by a specific author. + * @opt_param string sort Sort order. + * @opt_param string q Search query. + * @opt_param bool hasAttachedVideo Specifies whether to restrict to submissions that have videos attached. + * @return SubmissionList + */ + public function listSeriesSubmissions($seriesId, $optParams = array()) { + $params = array('seriesId' => $seriesId); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new SubmissionList($data); + } else { + return $data; + } + } + } + /** + * The "responses" collection of methods. + * Typical usage is: + * + * $moderatorService = new apiModeratorService(...); + * $responses = $moderatorService->responses; + * + */ + class SeriesResponsesServiceResource extends apiServiceResource { + + + /** + * Searches the responses for the specified series and returns the search results. (responses.list) + * + * @param string $seriesId The decimal ID of the Series. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string max-results Maximum number of results to return. + * @opt_param string sort Sort order. + * @opt_param string author Restricts the results to submissions by a specific author. + * @opt_param string start-index Index of the first result to be retrieved. + * @opt_param string q Search query. + * @opt_param bool hasAttachedVideo Specifies whether to restrict to submissions that have videos attached. + * @return SeriesList + */ + public function listSeriesResponses($seriesId, $optParams = array()) { + $params = array('seriesId' => $seriesId); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new SeriesList($data); + } else { + return $data; + } + } + } + + /** + * The "topics" collection of methods. + * Typical usage is: + * + * $moderatorService = new apiModeratorService(...); + * $topics = $moderatorService->topics; + * + */ + class TopicsServiceResource extends apiServiceResource { + + + /** + * Inserts a new topic into the specified series. (topics.insert) + * + * @param string $seriesId The decimal ID of the Series. + * @param Topic $postBody + * @return Topic + */ + public function insert($seriesId, Topic $postBody, $optParams = array()) { + $params = array('seriesId' => $seriesId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('insert', array($params)); + if ($this->useObjects()) { + return new Topic($data); + } else { + return $data; + } + } + /** + * Searches the topics within the specified series and returns the search results. (topics.list) + * + * @param string $seriesId The decimal ID of the Series. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string max-results Maximum number of results to return. + * @opt_param string q Search query. + * @opt_param string start-index Index of the first result to be retrieved. + * @opt_param string mode + * @return TopicList + */ + public function listTopics($seriesId, $optParams = array()) { + $params = array('seriesId' => $seriesId); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new TopicList($data); + } else { + return $data; + } + } + /** + * Updates the specified topic within the specified series. (topics.update) + * + * @param string $seriesId The decimal ID of the Series. + * @param string $topicId The decimal ID of the Topic within the Series. + * @param Topic $postBody + * @return Topic + */ + public function update($seriesId, $topicId, Topic $postBody, $optParams = array()) { + $params = array('seriesId' => $seriesId, 'topicId' => $topicId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('update', array($params)); + if ($this->useObjects()) { + return new Topic($data); + } else { + return $data; + } + } + /** + * Returns the specified topic from the specified series. (topics.get) + * + * @param string $seriesId The decimal ID of the Series. + * @param string $topicId The decimal ID of the Topic within the Series. + * @return Topic + */ + public function get($seriesId, $topicId, $optParams = array()) { + $params = array('seriesId' => $seriesId, 'topicId' => $topicId); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new Topic($data); + } else { + return $data; + } + } + } + + + /** + * The "submissions" collection of methods. + * Typical usage is: + * + * $moderatorService = new apiModeratorService(...); + * $submissions = $moderatorService->submissions; + * + */ + class TopicsSubmissionsServiceResource extends apiServiceResource { + + + /** + * Searches the submissions for the specified topic within the specified series and returns the + * search results. (submissions.list) + * + * @param string $seriesId The decimal ID of the Series. + * @param string $topicId The decimal ID of the Topic within the Series. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string max-results Maximum number of results to return. + * @opt_param bool includeVotes Specifies whether to include the current user's vote + * @opt_param string start-index Index of the first result to be retrieved. + * @opt_param string author Restricts the results to submissions by a specific author. + * @opt_param string sort Sort order. + * @opt_param string q Search query. + * @opt_param bool hasAttachedVideo Specifies whether to restrict to submissions that have videos attached. + * @return SubmissionList + */ + public function listTopicsSubmissions($seriesId, $topicId, $optParams = array()) { + $params = array('seriesId' => $seriesId, 'topicId' => $topicId); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new SubmissionList($data); + } else { + return $data; + } + } + } + + /** + * The "global" collection of methods. + * Typical usage is: + * + * $moderatorService = new apiModeratorService(...); + * $global = $moderatorService->global; + * + */ + class ModeratorGlobalServiceResource extends apiServiceResource { + + + } + + + /** + * The "series" collection of methods. + * Typical usage is: + * + * $moderatorService = new apiModeratorService(...); + * $series = $moderatorService->series; + * + */ + class ModeratorGlobalSeriesServiceResource extends apiServiceResource { + + + /** + * Searches the public series and returns the search results. (series.list) + * + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string max-results Maximum number of results to return. + * @opt_param string q Search query. + * @opt_param string start-index Index of the first result to be retrieved. + * @return SeriesList + */ + public function listModeratorGlobalSeries($optParams = array()) { + $params = array(); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new SeriesList($data); + } else { + return $data; + } + } + } + + /** + * The "profiles" collection of methods. + * Typical usage is: + * + * $moderatorService = new apiModeratorService(...); + * $profiles = $moderatorService->profiles; + * + */ + class ProfilesServiceResource extends apiServiceResource { + + + /** + * Updates the profile information for the authenticated user. This method supports patch semantics. + * (profiles.patch) + * + * @param Profile $postBody + * @return Profile + */ + public function patch(Profile $postBody, $optParams = array()) { + $params = array('postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('patch', array($params)); + if ($this->useObjects()) { + return new Profile($data); + } else { + return $data; + } + } + /** + * Updates the profile information for the authenticated user. (profiles.update) + * + * @param Profile $postBody + * @return Profile + */ + public function update(Profile $postBody, $optParams = array()) { + $params = array('postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('update', array($params)); + if ($this->useObjects()) { + return new Profile($data); + } else { + return $data; + } + } + /** + * Returns the profile information for the authenticated user. (profiles.get) + * + * @return Profile + */ + public function get($optParams = array()) { + $params = array(); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new Profile($data); + } else { + return $data; + } + } + } + + /** + * The "featured" collection of methods. + * Typical usage is: + * + * $moderatorService = new apiModeratorService(...); + * $featured = $moderatorService->featured; + * + */ + class FeaturedServiceResource extends apiServiceResource { + + + } + + + /** + * The "series" collection of methods. + * Typical usage is: + * + * $moderatorService = new apiModeratorService(...); + * $series = $moderatorService->series; + * + */ + class FeaturedSeriesServiceResource extends apiServiceResource { + + + /** + * Lists the featured series. (series.list) + * + * @return SeriesList + */ + public function listFeaturedSeries($optParams = array()) { + $params = array(); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new SeriesList($data); + } else { + return $data; + } + } + } + + /** + * The "myrecent" collection of methods. + * Typical usage is: + * + * $moderatorService = new apiModeratorService(...); + * $myrecent = $moderatorService->myrecent; + * + */ + class MyrecentServiceResource extends apiServiceResource { + + + } + + + /** + * The "series" collection of methods. + * Typical usage is: + * + * $moderatorService = new apiModeratorService(...); + * $series = $moderatorService->series; + * + */ + class MyrecentSeriesServiceResource extends apiServiceResource { + + + /** + * Lists the series the authenticated user has visited. (series.list) + * + * @return SeriesList + */ + public function listMyrecentSeries($optParams = array()) { + $params = array(); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new SeriesList($data); + } else { + return $data; + } + } + } + + /** + * The "my" collection of methods. + * Typical usage is: + * + * $moderatorService = new apiModeratorService(...); + * $my = $moderatorService->my; + * + */ + class MyServiceResource extends apiServiceResource { + + + } + + + /** + * The "series" collection of methods. + * Typical usage is: + * + * $moderatorService = new apiModeratorService(...); + * $series = $moderatorService->series; + * + */ + class MySeriesServiceResource extends apiServiceResource { + + + /** + * Lists all series created by the authenticated user. (series.list) + * + * @return SeriesList + */ + public function listMySeries($optParams = array()) { + $params = array(); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new SeriesList($data); + } else { + return $data; + } + } + } + + /** + * The "submissions" collection of methods. + * Typical usage is: + * + * $moderatorService = new apiModeratorService(...); + * $submissions = $moderatorService->submissions; + * + */ + class SubmissionsServiceResource extends apiServiceResource { + + + /** + * Inserts a new submission in the specified topic within the specified series. (submissions.insert) + * + * @param string $seriesId The decimal ID of the Series. + * @param string $topicId The decimal ID of the Topic within the Series. + * @param Submission $postBody + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string unauthToken User identifier for unauthenticated usage mode + * @opt_param bool anonymous Set to true to mark the new submission as anonymous. + * @return Submission + */ + public function insert($seriesId, $topicId, Submission $postBody, $optParams = array()) { + $params = array('seriesId' => $seriesId, 'topicId' => $topicId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('insert', array($params)); + if ($this->useObjects()) { + return new Submission($data); + } else { + return $data; + } + } + /** + * Returns the specified submission within the specified series. (submissions.get) + * + * @param string $seriesId The decimal ID of the Series. + * @param string $submissionId The decimal ID of the Submission within the Series. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string lang The language code for the language the client prefers resuls in. + * @opt_param bool includeVotes Specifies whether to include the current user's vote + * @return Submission + */ + public function get($seriesId, $submissionId, $optParams = array()) { + $params = array('seriesId' => $seriesId, 'submissionId' => $submissionId); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new Submission($data); + } else { + return $data; + } + } + } + + + +/** + * Service definition for Moderator (v1). + * + *

+ * Moderator API + *

+ * + *

+ * For more information about this service, see the + * API Documentation + *

+ * + * @author Google, Inc. + */ +class apiModeratorService extends apiService { + public $votes; + public $responses; + public $tags; + public $series; + public $series_submissions; + public $series_submissions_submissions; + public $series_submissions_responses; + public $series_responses; + public $series_responses_submissions; + public $series_responses_responses; + public $topics; + public $topics_submissions; + public $topics_submissions_submissions; + public $global; + public $global_series; + public $global_series_series; + public $profiles; + public $featured; + public $featured_series; + public $featured_series_series; + public $myrecent; + public $myrecent_series; + public $myrecent_series_series; + public $my; + public $my_series; + public $my_series_series; + public $submissions; + /** + * Constructs the internal representation of the Moderator service. + * + * @param apiClient apiClient + */ + public function __construct(apiClient $apiClient) { + $this->rpcPath = '/rpc'; + $this->restBasePath = '/moderator/v1/'; + $this->version = 'v1'; + $this->serviceName = 'moderator'; + + $apiClient->addService($this->serviceName, $this->version); + $this->votes = new VotesServiceResource($this, $this->serviceName, 'votes', json_decode('{"methods": {"insert": {"scopes": ["https://www.googleapis.com/auth/moderator"], "parameters": {"seriesId": {"format": "uint32", "required": true, "type": "integer", "location": "path"}, "unauthToken": {"type": "string", "location": "query"}, "submissionId": {"format": "uint32", "required": true, "type": "integer", "location": "path"}}, "request": {"$ref": "Vote"}, "id": "moderator.votes.insert", "httpMethod": "POST", "path": "series/{seriesId}/submissions/{submissionId}/votes/@me", "response": {"$ref": "Vote"}}, "get": {"scopes": ["https://www.googleapis.com/auth/moderator"], "parameters": {"seriesId": {"format": "uint32", "required": true, "type": "integer", "location": "path"}, "userId": {"type": "string", "location": "query"}, "unauthToken": {"type": "string", "location": "query"}, "submissionId": {"format": "uint32", "required": true, "type": "integer", "location": "path"}}, "id": "moderator.votes.get", "httpMethod": "GET", "path": "series/{seriesId}/submissions/{submissionId}/votes/@me", "response": {"$ref": "Vote"}}, "list": {"scopes": ["https://www.googleapis.com/auth/moderator"], "parameters": {"max-results": {"format": "uint32", "type": "integer", "location": "query"}, "seriesId": {"format": "uint32", "required": true, "type": "integer", "location": "path"}, "start-index": {"format": "uint32", "type": "integer", "location": "query"}}, "id": "moderator.votes.list", "httpMethod": "GET", "path": "series/{seriesId}/votes/@me", "response": {"$ref": "VoteList"}}, "update": {"scopes": ["https://www.googleapis.com/auth/moderator"], "parameters": {"seriesId": {"format": "uint32", "required": true, "type": "integer", "location": "path"}, "userId": {"type": "string", "location": "query"}, "unauthToken": {"type": "string", "location": "query"}, "submissionId": {"format": "uint32", "required": true, "type": "integer", "location": "path"}}, "request": {"$ref": "Vote"}, "id": "moderator.votes.update", "httpMethod": "PUT", "path": "series/{seriesId}/submissions/{submissionId}/votes/@me", "response": {"$ref": "Vote"}}, "patch": {"scopes": ["https://www.googleapis.com/auth/moderator"], "parameters": {"seriesId": {"format": "uint32", "required": true, "type": "integer", "location": "path"}, "userId": {"type": "string", "location": "query"}, "unauthToken": {"type": "string", "location": "query"}, "submissionId": {"format": "uint32", "required": true, "type": "integer", "location": "path"}}, "request": {"$ref": "Vote"}, "id": "moderator.votes.patch", "httpMethod": "PATCH", "path": "series/{seriesId}/submissions/{submissionId}/votes/@me", "response": {"$ref": "Vote"}}}}', true)); + $this->responses = new ResponsesServiceResource($this, $this->serviceName, 'responses', json_decode('{"methods": {"insert": {"scopes": ["https://www.googleapis.com/auth/moderator"], "parameters": {"seriesId": {"format": "uint32", "required": true, "type": "integer", "location": "path"}, "parentSubmissionId": {"format": "uint32", "required": true, "type": "integer", "location": "path"}, "unauthToken": {"type": "string", "location": "query"}, "anonymous": {"type": "boolean", "location": "query"}, "topicId": {"format": "uint32", "required": true, "type": "integer", "location": "path"}}, "request": {"$ref": "Submission"}, "id": "moderator.responses.insert", "httpMethod": "POST", "path": "series/{seriesId}/topics/{topicId}/submissions/{parentSubmissionId}/responses", "response": {"$ref": "Submission"}}, "list": {"scopes": ["https://www.googleapis.com/auth/moderator"], "parameters": {"max-results": {"format": "uint32", "type": "integer", "location": "query"}, "sort": {"type": "string", "location": "query"}, "seriesId": {"format": "uint32", "required": true, "type": "integer", "location": "path"}, "author": {"type": "string", "location": "query"}, "start-index": {"format": "uint32", "type": "integer", "location": "query"}, "submissionId": {"format": "uint32", "required": true, "type": "integer", "location": "path"}, "q": {"type": "string", "location": "query"}, "hasAttachedVideo": {"type": "boolean", "location": "query"}}, "id": "moderator.responses.list", "httpMethod": "GET", "path": "series/{seriesId}/submissions/{submissionId}/responses", "response": {"$ref": "SubmissionList"}}}}', true)); + $this->tags = new TagsServiceResource($this, $this->serviceName, 'tags', json_decode('{"methods": {"insert": {"scopes": ["https://www.googleapis.com/auth/moderator"], "parameters": {"seriesId": {"format": "uint32", "required": true, "type": "integer", "location": "path"}, "submissionId": {"format": "uint32", "required": true, "type": "integer", "location": "path"}}, "request": {"$ref": "Tag"}, "id": "moderator.tags.insert", "httpMethod": "POST", "path": "series/{seriesId}/submissions/{submissionId}/tags", "response": {"$ref": "Tag"}}, "list": {"scopes": ["https://www.googleapis.com/auth/moderator"], "parameters": {"seriesId": {"format": "uint32", "required": true, "type": "integer", "location": "path"}, "submissionId": {"format": "uint32", "required": true, "type": "integer", "location": "path"}}, "id": "moderator.tags.list", "httpMethod": "GET", "path": "series/{seriesId}/submissions/{submissionId}/tags", "response": {"$ref": "TagList"}}, "delete": {"scopes": ["https://www.googleapis.com/auth/moderator"], "parameters": {"seriesId": {"format": "uint32", "required": true, "type": "integer", "location": "path"}, "tagId": {"required": true, "type": "string", "location": "path"}, "submissionId": {"format": "uint32", "required": true, "type": "integer", "location": "path"}}, "httpMethod": "DELETE", "path": "series/{seriesId}/submissions/{submissionId}/tags/{tagId}", "id": "moderator.tags.delete"}}}', true)); + $this->series = new SeriesServiceResource($this, $this->serviceName, 'series', json_decode('{"methods": {"insert": {"scopes": ["https://www.googleapis.com/auth/moderator"], "request": {"$ref": "Series"}, "response": {"$ref": "Series"}, "httpMethod": "POST", "path": "series", "id": "moderator.series.insert"}, "get": {"scopes": ["https://www.googleapis.com/auth/moderator"], "parameters": {"seriesId": {"format": "uint32", "required": true, "type": "integer", "location": "path"}}, "id": "moderator.series.get", "httpMethod": "GET", "path": "series/{seriesId}", "response": {"$ref": "Series"}}, "list": {"scopes": ["https://www.googleapis.com/auth/moderator"], "parameters": {"max-results": {"format": "uint32", "type": "integer", "location": "query"}, "q": {"type": "string", "location": "query"}, "start-index": {"format": "uint32", "type": "integer", "location": "query"}}, "response": {"$ref": "SeriesList"}, "httpMethod": "GET", "path": "series", "id": "moderator.series.list"}, "update": {"scopes": ["https://www.googleapis.com/auth/moderator"], "parameters": {"seriesId": {"format": "uint32", "required": true, "type": "integer", "location": "path"}}, "request": {"$ref": "Series"}, "id": "moderator.series.update", "httpMethod": "PUT", "path": "series/{seriesId}", "response": {"$ref": "Series"}}, "patch": {"scopes": ["https://www.googleapis.com/auth/moderator"], "parameters": {"seriesId": {"format": "uint32", "required": true, "type": "integer", "location": "path"}}, "request": {"$ref": "Series"}, "id": "moderator.series.patch", "httpMethod": "PATCH", "path": "series/{seriesId}", "response": {"$ref": "Series"}}}}', true)); + $this->series_submissions = new SeriesSubmissionsServiceResource($this, $this->serviceName, 'submissions', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/moderator"], "parameters": {"lang": {"type": "string", "location": "query"}, "max-results": {"format": "uint32", "type": "integer", "location": "query"}, "seriesId": {"format": "uint32", "required": true, "type": "integer", "location": "path"}, "author": {"type": "string", "location": "query"}, "start-index": {"format": "uint32", "type": "integer", "location": "query"}, "includeVotes": {"type": "boolean", "location": "query"}, "sort": {"type": "string", "location": "query"}, "q": {"type": "string", "location": "query"}, "hasAttachedVideo": {"type": "boolean", "location": "query"}}, "id": "moderator.series.submissions.list", "httpMethod": "GET", "path": "series/{seriesId}/submissions", "response": {"$ref": "SubmissionList"}}}}', true)); + $this->series_responses = new SeriesResponsesServiceResource($this, $this->serviceName, 'responses', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/moderator"], "parameters": {"max-results": {"format": "uint32", "type": "integer", "location": "query"}, "sort": {"type": "string", "location": "query"}, "seriesId": {"format": "uint32", "required": true, "type": "integer", "location": "path"}, "author": {"type": "string", "location": "query"}, "start-index": {"format": "uint32", "type": "integer", "location": "query"}, "q": {"type": "string", "location": "query"}, "hasAttachedVideo": {"type": "boolean", "location": "query"}}, "id": "moderator.series.responses.list", "httpMethod": "GET", "path": "series/{seriesId}/responses", "response": {"$ref": "SeriesList"}}}}', true)); + $this->topics = new TopicsServiceResource($this, $this->serviceName, 'topics', json_decode('{"methods": {"insert": {"scopes": ["https://www.googleapis.com/auth/moderator"], "parameters": {"seriesId": {"format": "uint32", "required": true, "type": "integer", "location": "path"}}, "request": {"$ref": "Topic"}, "id": "moderator.topics.insert", "httpMethod": "POST", "path": "series/{seriesId}/topics", "response": {"$ref": "Topic"}}, "list": {"scopes": ["https://www.googleapis.com/auth/moderator"], "parameters": {"max-results": {"format": "uint32", "type": "integer", "location": "query"}, "q": {"type": "string", "location": "query"}, "start-index": {"format": "uint32", "type": "integer", "location": "query"}, "mode": {"type": "string", "location": "query"}, "seriesId": {"format": "uint32", "required": true, "type": "integer", "location": "path"}}, "id": "moderator.topics.list", "httpMethod": "GET", "path": "series/{seriesId}/topics", "response": {"$ref": "TopicList"}}, "update": {"scopes": ["https://www.googleapis.com/auth/moderator"], "parameters": {"seriesId": {"format": "uint32", "required": true, "type": "integer", "location": "path"}, "topicId": {"format": "uint32", "required": true, "type": "integer", "location": "path"}}, "request": {"$ref": "Topic"}, "id": "moderator.topics.update", "httpMethod": "PUT", "path": "series/{seriesId}/topics/{topicId}", "response": {"$ref": "Topic"}}, "get": {"scopes": ["https://www.googleapis.com/auth/moderator"], "parameters": {"seriesId": {"format": "uint32", "required": true, "type": "integer", "location": "path"}, "topicId": {"format": "uint32", "required": true, "type": "integer", "location": "path"}}, "id": "moderator.topics.get", "httpMethod": "GET", "path": "series/{seriesId}/topics/{topicId}", "response": {"$ref": "Topic"}}}}', true)); + $this->topics_submissions = new TopicsSubmissionsServiceResource($this, $this->serviceName, 'submissions', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/moderator"], "parameters": {"max-results": {"format": "uint32", "type": "integer", "location": "query"}, "seriesId": {"format": "uint32", "required": true, "type": "integer", "location": "path"}, "includeVotes": {"type": "boolean", "location": "query"}, "topicId": {"format": "uint32", "required": true, "type": "integer", "location": "path"}, "start-index": {"format": "uint32", "type": "integer", "location": "query"}, "author": {"type": "string", "location": "query"}, "sort": {"type": "string", "location": "query"}, "q": {"type": "string", "location": "query"}, "hasAttachedVideo": {"type": "boolean", "location": "query"}}, "id": "moderator.topics.submissions.list", "httpMethod": "GET", "path": "series/{seriesId}/topics/{topicId}/submissions", "response": {"$ref": "SubmissionList"}}}}', true)); + $this->global = new ModeratorGlobalServiceResource($this, $this->serviceName, 'global', json_decode('{}', true)); + $this->global_series = new ModeratorGlobalSeriesServiceResource($this, $this->serviceName, 'series', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/moderator"], "parameters": {"max-results": {"format": "uint32", "type": "integer", "location": "query"}, "q": {"type": "string", "location": "query"}, "start-index": {"format": "uint32", "type": "integer", "location": "query"}}, "response": {"$ref": "SeriesList"}, "httpMethod": "GET", "path": "search", "id": "moderator.global.series.list"}}}', true)); + $this->profiles = new ProfilesServiceResource($this, $this->serviceName, 'profiles', json_decode('{"methods": {"get": {"scopes": ["https://www.googleapis.com/auth/moderator"], "id": "moderator.profiles.get", "httpMethod": "GET", "path": "profiles/@me", "response": {"$ref": "Profile"}}, "update": {"scopes": ["https://www.googleapis.com/auth/moderator"], "request": {"$ref": "Profile"}, "response": {"$ref": "Profile"}, "httpMethod": "PUT", "path": "profiles/@me", "id": "moderator.profiles.update"}, "patch": {"scopes": ["https://www.googleapis.com/auth/moderator"], "request": {"$ref": "Profile"}, "response": {"$ref": "Profile"}, "httpMethod": "PATCH", "path": "profiles/@me", "id": "moderator.profiles.patch"}}}', true)); + $this->featured = new FeaturedServiceResource($this, $this->serviceName, 'featured', json_decode('{}', true)); + $this->featured_series = new FeaturedSeriesServiceResource($this, $this->serviceName, 'series', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/moderator"], "id": "moderator.featured.series.list", "httpMethod": "GET", "path": "series/featured", "response": {"$ref": "SeriesList"}}}}', true)); + $this->myrecent = new MyrecentServiceResource($this, $this->serviceName, 'myrecent', json_decode('{}', true)); + $this->myrecent_series = new MyrecentSeriesServiceResource($this, $this->serviceName, 'series', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/moderator"], "id": "moderator.myrecent.series.list", "httpMethod": "GET", "path": "series/@me/recent", "response": {"$ref": "SeriesList"}}}}', true)); + $this->my = new MyServiceResource($this, $this->serviceName, 'my', json_decode('{}', true)); + $this->my_series = new MySeriesServiceResource($this, $this->serviceName, 'series', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/moderator"], "id": "moderator.my.series.list", "httpMethod": "GET", "path": "series/@me/mine", "response": {"$ref": "SeriesList"}}}}', true)); + $this->submissions = new SubmissionsServiceResource($this, $this->serviceName, 'submissions', json_decode('{"methods": {"insert": {"scopes": ["https://www.googleapis.com/auth/moderator"], "parameters": {"seriesId": {"format": "uint32", "required": true, "type": "integer", "location": "path"}, "topicId": {"format": "uint32", "required": true, "type": "integer", "location": "path"}, "unauthToken": {"type": "string", "location": "query"}, "anonymous": {"type": "boolean", "location": "query"}}, "request": {"$ref": "Submission"}, "id": "moderator.submissions.insert", "httpMethod": "POST", "path": "series/{seriesId}/topics/{topicId}/submissions", "response": {"$ref": "Submission"}}, "get": {"scopes": ["https://www.googleapis.com/auth/moderator"], "parameters": {"lang": {"type": "string", "location": "query"}, "seriesId": {"format": "uint32", "required": true, "type": "integer", "location": "path"}, "includeVotes": {"type": "boolean", "location": "query"}, "submissionId": {"format": "uint32", "required": true, "type": "integer", "location": "path"}}, "id": "moderator.submissions.get", "httpMethod": "GET", "path": "series/{seriesId}/submissions/{submissionId}", "response": {"$ref": "Submission"}}}}', true)); + } +} + +class ModeratorTopicsResourcePartial extends apiModel { + protected $__idType = 'ModeratorTopicsResourcePartialId'; + protected $__idDataType = ''; + public $id; + public function setId(ModeratorTopicsResourcePartialId $id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } +} + +class ModeratorTopicsResourcePartialId extends apiModel { + public $seriesId; + public $topicId; + public function setSeriesId($seriesId) { + $this->seriesId = $seriesId; + } + public function getSeriesId() { + return $this->seriesId; + } + public function setTopicId($topicId) { + $this->topicId = $topicId; + } + public function getTopicId() { + return $this->topicId; + } +} + +class ModeratorVotesResourcePartial extends apiModel { + public $vote; + public $flag; + public function setVote($vote) { + $this->vote = $vote; + } + public function getVote() { + return $this->vote; + } + public function setFlag($flag) { + $this->flag = $flag; + } + public function getFlag() { + return $this->flag; + } +} + +class Profile extends apiModel { + public $kind; + protected $__attributionType = 'ProfileAttribution'; + protected $__attributionDataType = ''; + public $attribution; + protected $__idType = 'ProfileId'; + protected $__idDataType = ''; + public $id; + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setAttribution(ProfileAttribution $attribution) { + $this->attribution = $attribution; + } + public function getAttribution() { + return $this->attribution; + } + public function setId(ProfileId $id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } +} + +class ProfileAttribution extends apiModel { + protected $__geoType = 'ProfileAttributionGeo'; + protected $__geoDataType = ''; + public $geo; + public $displayName; + public $location; + public $avatarUrl; + public function setGeo(ProfileAttributionGeo $geo) { + $this->geo = $geo; + } + public function getGeo() { + return $this->geo; + } + public function setDisplayName($displayName) { + $this->displayName = $displayName; + } + public function getDisplayName() { + return $this->displayName; + } + public function setLocation($location) { + $this->location = $location; + } + public function getLocation() { + return $this->location; + } + public function setAvatarUrl($avatarUrl) { + $this->avatarUrl = $avatarUrl; + } + public function getAvatarUrl() { + return $this->avatarUrl; + } +} + +class ProfileAttributionGeo extends apiModel { + public $latitude; + public $location; + public $longitude; + public function setLatitude($latitude) { + $this->latitude = $latitude; + } + public function getLatitude() { + return $this->latitude; + } + public function setLocation($location) { + $this->location = $location; + } + public function getLocation() { + return $this->location; + } + public function setLongitude($longitude) { + $this->longitude = $longitude; + } + public function getLongitude() { + return $this->longitude; + } +} + +class ProfileId extends apiModel { + public $user; + public function setUser($user) { + $this->user = $user; + } + public function getUser() { + return $this->user; + } +} + +class Series extends apiModel { + public $kind; + public $description; + protected $__rulesType = 'SeriesRules'; + protected $__rulesDataType = ''; + public $rules; + public $unauthVotingAllowed; + public $videoSubmissionAllowed; + public $name; + public $numTopics; + public $anonymousSubmissionAllowed; + public $unauthSubmissionAllowed; + protected $__idType = 'SeriesId'; + protected $__idDataType = ''; + public $id; + protected $__countersType = 'SeriesCounters'; + protected $__countersDataType = ''; + public $counters; + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setDescription($description) { + $this->description = $description; + } + public function getDescription() { + return $this->description; + } + public function setRules(SeriesRules $rules) { + $this->rules = $rules; + } + public function getRules() { + return $this->rules; + } + public function setUnauthVotingAllowed($unauthVotingAllowed) { + $this->unauthVotingAllowed = $unauthVotingAllowed; + } + public function getUnauthVotingAllowed() { + return $this->unauthVotingAllowed; + } + public function setVideoSubmissionAllowed($videoSubmissionAllowed) { + $this->videoSubmissionAllowed = $videoSubmissionAllowed; + } + public function getVideoSubmissionAllowed() { + return $this->videoSubmissionAllowed; + } + public function setName($name) { + $this->name = $name; + } + public function getName() { + return $this->name; + } + public function setNumTopics($numTopics) { + $this->numTopics = $numTopics; + } + public function getNumTopics() { + return $this->numTopics; + } + public function setAnonymousSubmissionAllowed($anonymousSubmissionAllowed) { + $this->anonymousSubmissionAllowed = $anonymousSubmissionAllowed; + } + public function getAnonymousSubmissionAllowed() { + return $this->anonymousSubmissionAllowed; + } + public function setUnauthSubmissionAllowed($unauthSubmissionAllowed) { + $this->unauthSubmissionAllowed = $unauthSubmissionAllowed; + } + public function getUnauthSubmissionAllowed() { + return $this->unauthSubmissionAllowed; + } + public function setId(SeriesId $id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setCounters(SeriesCounters $counters) { + $this->counters = $counters; + } + public function getCounters() { + return $this->counters; + } +} + +class SeriesCounters extends apiModel { + public $users; + public $noneVotes; + public $videoSubmissions; + public $minusVotes; + public $anonymousSubmissions; + public $submissions; + public $plusVotes; + public function setUsers($users) { + $this->users = $users; + } + public function getUsers() { + return $this->users; + } + public function setNoneVotes($noneVotes) { + $this->noneVotes = $noneVotes; + } + public function getNoneVotes() { + return $this->noneVotes; + } + public function setVideoSubmissions($videoSubmissions) { + $this->videoSubmissions = $videoSubmissions; + } + public function getVideoSubmissions() { + return $this->videoSubmissions; + } + public function setMinusVotes($minusVotes) { + $this->minusVotes = $minusVotes; + } + public function getMinusVotes() { + return $this->minusVotes; + } + public function setAnonymousSubmissions($anonymousSubmissions) { + $this->anonymousSubmissions = $anonymousSubmissions; + } + public function getAnonymousSubmissions() { + return $this->anonymousSubmissions; + } + public function setSubmissions($submissions) { + $this->submissions = $submissions; + } + public function getSubmissions() { + return $this->submissions; + } + public function setPlusVotes($plusVotes) { + $this->plusVotes = $plusVotes; + } + public function getPlusVotes() { + return $this->plusVotes; + } +} + +class SeriesId extends apiModel { + public $seriesId; + public function setSeriesId($seriesId) { + $this->seriesId = $seriesId; + } + public function getSeriesId() { + return $this->seriesId; + } +} + +class SeriesList extends apiModel { + protected $__itemsType = 'Series'; + protected $__itemsDataType = 'array'; + public $items; + public $kind; + public function setItems(/* array(Series) */ $items) { + $this->assertIsArray($items, 'Series', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } +} + +class SeriesRules extends apiModel { + protected $__votesType = 'SeriesRulesVotes'; + protected $__votesDataType = ''; + public $votes; + protected $__submissionsType = 'SeriesRulesSubmissions'; + protected $__submissionsDataType = ''; + public $submissions; + public function setVotes(SeriesRulesVotes $votes) { + $this->votes = $votes; + } + public function getVotes() { + return $this->votes; + } + public function setSubmissions(SeriesRulesSubmissions $submissions) { + $this->submissions = $submissions; + } + public function getSubmissions() { + return $this->submissions; + } +} + +class SeriesRulesSubmissions extends apiModel { + public $close; + public $open; + public function setClose($close) { + $this->close = $close; + } + public function getClose() { + return $this->close; + } + public function setOpen($open) { + $this->open = $open; + } + public function getOpen() { + return $this->open; + } +} + +class SeriesRulesVotes extends apiModel { + public $close; + public $open; + public function setClose($close) { + $this->close = $close; + } + public function getClose() { + return $this->close; + } + public function setOpen($open) { + $this->open = $open; + } + public function getOpen() { + return $this->open; + } +} + +class Submission extends apiModel { + public $kind; + protected $__attributionType = 'SubmissionAttribution'; + protected $__attributionDataType = ''; + public $attribution; + public $created; + public $text; + protected $__topicsType = 'ModeratorTopicsResourcePartial'; + protected $__topicsDataType = 'array'; + public $topics; + public $author; + protected $__translationsType = 'SubmissionTranslations'; + protected $__translationsDataType = 'array'; + public $translations; + protected $__parentSubmissionIdType = 'SubmissionParentSubmissionId'; + protected $__parentSubmissionIdDataType = ''; + public $parentSubmissionId; + protected $__voteType = 'ModeratorVotesResourcePartial'; + protected $__voteDataType = ''; + public $vote; + public $attachmentUrl; + protected $__geoType = 'SubmissionGeo'; + protected $__geoDataType = ''; + public $geo; + protected $__idType = 'SubmissionId'; + protected $__idDataType = ''; + public $id; + protected $__countersType = 'SubmissionCounters'; + protected $__countersDataType = ''; + public $counters; + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setAttribution(SubmissionAttribution $attribution) { + $this->attribution = $attribution; + } + public function getAttribution() { + return $this->attribution; + } + public function setCreated($created) { + $this->created = $created; + } + public function getCreated() { + return $this->created; + } + public function setText($text) { + $this->text = $text; + } + public function getText() { + return $this->text; + } + public function setTopics(/* array(ModeratorTopicsResourcePartial) */ $topics) { + $this->assertIsArray($topics, 'ModeratorTopicsResourcePartial', __METHOD__); + $this->topics = $topics; + } + public function getTopics() { + return $this->topics; + } + public function setAuthor($author) { + $this->author = $author; + } + public function getAuthor() { + return $this->author; + } + public function setTranslations(/* array(SubmissionTranslations) */ $translations) { + $this->assertIsArray($translations, 'SubmissionTranslations', __METHOD__); + $this->translations = $translations; + } + public function getTranslations() { + return $this->translations; + } + public function setParentSubmissionId(SubmissionParentSubmissionId $parentSubmissionId) { + $this->parentSubmissionId = $parentSubmissionId; + } + public function getParentSubmissionId() { + return $this->parentSubmissionId; + } + public function setVote(ModeratorVotesResourcePartial $vote) { + $this->vote = $vote; + } + public function getVote() { + return $this->vote; + } + public function setAttachmentUrl($attachmentUrl) { + $this->attachmentUrl = $attachmentUrl; + } + public function getAttachmentUrl() { + return $this->attachmentUrl; + } + public function setGeo(SubmissionGeo $geo) { + $this->geo = $geo; + } + public function getGeo() { + return $this->geo; + } + public function setId(SubmissionId $id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setCounters(SubmissionCounters $counters) { + $this->counters = $counters; + } + public function getCounters() { + return $this->counters; + } +} + +class SubmissionAttribution extends apiModel { + public $displayName; + public $location; + public $avatarUrl; + public function setDisplayName($displayName) { + $this->displayName = $displayName; + } + public function getDisplayName() { + return $this->displayName; + } + public function setLocation($location) { + $this->location = $location; + } + public function getLocation() { + return $this->location; + } + public function setAvatarUrl($avatarUrl) { + $this->avatarUrl = $avatarUrl; + } + public function getAvatarUrl() { + return $this->avatarUrl; + } +} + +class SubmissionCounters extends apiModel { + public $noneVotes; + public $minusVotes; + public $plusVotes; + public function setNoneVotes($noneVotes) { + $this->noneVotes = $noneVotes; + } + public function getNoneVotes() { + return $this->noneVotes; + } + public function setMinusVotes($minusVotes) { + $this->minusVotes = $minusVotes; + } + public function getMinusVotes() { + return $this->minusVotes; + } + public function setPlusVotes($plusVotes) { + $this->plusVotes = $plusVotes; + } + public function getPlusVotes() { + return $this->plusVotes; + } +} + +class SubmissionGeo extends apiModel { + public $latitude; + public $location; + public $longitude; + public function setLatitude($latitude) { + $this->latitude = $latitude; + } + public function getLatitude() { + return $this->latitude; + } + public function setLocation($location) { + $this->location = $location; + } + public function getLocation() { + return $this->location; + } + public function setLongitude($longitude) { + $this->longitude = $longitude; + } + public function getLongitude() { + return $this->longitude; + } +} + +class SubmissionId extends apiModel { + public $seriesId; + public $submissionId; + public function setSeriesId($seriesId) { + $this->seriesId = $seriesId; + } + public function getSeriesId() { + return $this->seriesId; + } + public function setSubmissionId($submissionId) { + $this->submissionId = $submissionId; + } + public function getSubmissionId() { + return $this->submissionId; + } +} + +class SubmissionList extends apiModel { + protected $__itemsType = 'Submission'; + protected $__itemsDataType = 'array'; + public $items; + public $kind; + public function setItems(/* array(Submission) */ $items) { + $this->assertIsArray($items, 'Submission', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } +} + +class SubmissionParentSubmissionId extends apiModel { + public $seriesId; + public $submissionId; + public function setSeriesId($seriesId) { + $this->seriesId = $seriesId; + } + public function getSeriesId() { + return $this->seriesId; + } + public function setSubmissionId($submissionId) { + $this->submissionId = $submissionId; + } + public function getSubmissionId() { + return $this->submissionId; + } +} + +class SubmissionTranslations extends apiModel { + public $lang; + public $text; + public function setLang($lang) { + $this->lang = $lang; + } + public function getLang() { + return $this->lang; + } + public function setText($text) { + $this->text = $text; + } + public function getText() { + return $this->text; + } +} + +class Tag extends apiModel { + public $text; + public $kind; + protected $__idType = 'TagId'; + protected $__idDataType = ''; + public $id; + public function setText($text) { + $this->text = $text; + } + public function getText() { + return $this->text; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setId(TagId $id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } +} + +class TagId extends apiModel { + public $seriesId; + public $tagId; + public $submissionId; + public function setSeriesId($seriesId) { + $this->seriesId = $seriesId; + } + public function getSeriesId() { + return $this->seriesId; + } + public function setTagId($tagId) { + $this->tagId = $tagId; + } + public function getTagId() { + return $this->tagId; + } + public function setSubmissionId($submissionId) { + $this->submissionId = $submissionId; + } + public function getSubmissionId() { + return $this->submissionId; + } +} + +class TagList extends apiModel { + protected $__itemsType = 'Tag'; + protected $__itemsDataType = 'array'; + public $items; + public $kind; + public function setItems(/* array(Tag) */ $items) { + $this->assertIsArray($items, 'Tag', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } +} + +class Topic extends apiModel { + public $kind; + public $description; + protected $__rulesType = 'TopicRules'; + protected $__rulesDataType = ''; + public $rules; + protected $__featuredSubmissionType = 'Submission'; + protected $__featuredSubmissionDataType = ''; + public $featuredSubmission; + public $presenter; + protected $__countersType = 'TopicCounters'; + protected $__countersDataType = ''; + public $counters; + protected $__idType = 'TopicId'; + protected $__idDataType = ''; + public $id; + public $name; + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setDescription($description) { + $this->description = $description; + } + public function getDescription() { + return $this->description; + } + public function setRules(TopicRules $rules) { + $this->rules = $rules; + } + public function getRules() { + return $this->rules; + } + public function setFeaturedSubmission(Submission $featuredSubmission) { + $this->featuredSubmission = $featuredSubmission; + } + public function getFeaturedSubmission() { + return $this->featuredSubmission; + } + public function setPresenter($presenter) { + $this->presenter = $presenter; + } + public function getPresenter() { + return $this->presenter; + } + public function setCounters(TopicCounters $counters) { + $this->counters = $counters; + } + public function getCounters() { + return $this->counters; + } + public function setId(TopicId $id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setName($name) { + $this->name = $name; + } + public function getName() { + return $this->name; + } +} + +class TopicCounters extends apiModel { + public $users; + public $noneVotes; + public $videoSubmissions; + public $minusVotes; + public $submissions; + public $plusVotes; + public function setUsers($users) { + $this->users = $users; + } + public function getUsers() { + return $this->users; + } + public function setNoneVotes($noneVotes) { + $this->noneVotes = $noneVotes; + } + public function getNoneVotes() { + return $this->noneVotes; + } + public function setVideoSubmissions($videoSubmissions) { + $this->videoSubmissions = $videoSubmissions; + } + public function getVideoSubmissions() { + return $this->videoSubmissions; + } + public function setMinusVotes($minusVotes) { + $this->minusVotes = $minusVotes; + } + public function getMinusVotes() { + return $this->minusVotes; + } + public function setSubmissions($submissions) { + $this->submissions = $submissions; + } + public function getSubmissions() { + return $this->submissions; + } + public function setPlusVotes($plusVotes) { + $this->plusVotes = $plusVotes; + } + public function getPlusVotes() { + return $this->plusVotes; + } +} + +class TopicId extends apiModel { + public $seriesId; + public $topicId; + public function setSeriesId($seriesId) { + $this->seriesId = $seriesId; + } + public function getSeriesId() { + return $this->seriesId; + } + public function setTopicId($topicId) { + $this->topicId = $topicId; + } + public function getTopicId() { + return $this->topicId; + } +} + +class TopicList extends apiModel { + protected $__itemsType = 'Topic'; + protected $__itemsDataType = 'array'; + public $items; + public $kind; + public function setItems(/* array(Topic) */ $items) { + $this->assertIsArray($items, 'Topic', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } +} + +class TopicRules extends apiModel { + protected $__votesType = 'TopicRulesVotes'; + protected $__votesDataType = ''; + public $votes; + protected $__submissionsType = 'TopicRulesSubmissions'; + protected $__submissionsDataType = ''; + public $submissions; + public function setVotes(TopicRulesVotes $votes) { + $this->votes = $votes; + } + public function getVotes() { + return $this->votes; + } + public function setSubmissions(TopicRulesSubmissions $submissions) { + $this->submissions = $submissions; + } + public function getSubmissions() { + return $this->submissions; + } +} + +class TopicRulesSubmissions extends apiModel { + public $close; + public $open; + public function setClose($close) { + $this->close = $close; + } + public function getClose() { + return $this->close; + } + public function setOpen($open) { + $this->open = $open; + } + public function getOpen() { + return $this->open; + } +} + +class TopicRulesVotes extends apiModel { + public $close; + public $open; + public function setClose($close) { + $this->close = $close; + } + public function getClose() { + return $this->close; + } + public function setOpen($open) { + $this->open = $open; + } + public function getOpen() { + return $this->open; + } +} + +class Vote extends apiModel { + public $vote; + public $flag; + protected $__idType = 'VoteId'; + protected $__idDataType = ''; + public $id; + public $kind; + public function setVote($vote) { + $this->vote = $vote; + } + public function getVote() { + return $this->vote; + } + public function setFlag($flag) { + $this->flag = $flag; + } + public function getFlag() { + return $this->flag; + } + public function setId(VoteId $id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } +} + +class VoteId extends apiModel { + public $seriesId; + public $submissionId; + public function setSeriesId($seriesId) { + $this->seriesId = $seriesId; + } + public function getSeriesId() { + return $this->seriesId; + } + public function setSubmissionId($submissionId) { + $this->submissionId = $submissionId; + } + public function getSubmissionId() { + return $this->submissionId; + } +} + +class VoteList extends apiModel { + protected $__itemsType = 'Vote'; + protected $__itemsDataType = 'array'; + public $items; + public $kind; + public function setItems(/* array(Vote) */ $items) { + $this->assertIsArray($items, 'Vote', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } +} diff --git a/webui/google-api/contrib/apiOauth2Service.php b/webui/google-api/contrib/apiOauth2Service.php new file mode 100644 index 0000000..2a9a15b --- /dev/null +++ b/webui/google-api/contrib/apiOauth2Service.php @@ -0,0 +1,307 @@ + + * $oauth2Service = new apiOauth2Service(...); + * $userinfo = $oauth2Service->userinfo; + * + */ + class UserinfoServiceResource extends apiServiceResource { + + + /** + * (userinfo.get) + * + * @return Userinfo + */ + public function get($optParams = array()) { + $params = array(); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new Userinfo($data); + } else { + return $data; + } + } + } + + + /** + * The "v2" collection of methods. + * Typical usage is: + * + * $oauth2Service = new apiOauth2Service(...); + * $v2 = $oauth2Service->v2; + * + */ + class UserinfoV2ServiceResource extends apiServiceResource { + + + } + + + /** + * The "me" collection of methods. + * Typical usage is: + * + * $oauth2Service = new apiOauth2Service(...); + * $me = $oauth2Service->me; + * + */ + class UserinfoV2MeServiceResource extends apiServiceResource { + + + /** + * (me.get) + * + * @return Userinfo + */ + public function get($optParams = array()) { + $params = array(); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new Userinfo($data); + } else { + return $data; + } + } + } + + + /** + * The "tokeninfo" collection of methods. + * Typical usage is: + * + * $oauth2Service = new apiOauth2Service(...); + * $tokeninfo = $oauth2Service->tokeninfo; + * + */ + class TokeninfoServiceResource extends apiServiceResource { + /** + * (tokeninfo.tokeninfo) + * + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string access_token + * @opt_param string id_token + * @return Tokeninfo + */ + public function tokeninfo($optParams = array()) { + $params = array(); + $params = array_merge($params, $optParams); + $data = $this->__call('tokeninfo', array($params)); + if ($this->useObjects()) { + return new Tokeninfo($data); + } else { + return $data; + } + } + + } + + +/** + * Service definition for Oauth2 (v2). + * + *

+ * OAuth2 API + *

+ * + *

+ * For more information about this service, see the + * API Documentation + *

+ * + * @author Google, Inc. + */ +class apiOauth2Service extends apiService { + public $tokeninfo; + public $userinfo; + public $userinfo_v2; + /** + * Constructs the internal representation of the Oauth2 service. + * + * @param apiClient apiClient + */ + public function __construct(apiClient $apiClient) { + $this->rpcPath = '/rpc'; + $this->restBasePath = '/'; + $this->version = 'v2'; + $this->serviceName = 'oauth2'; + + $apiClient->addService($this->serviceName, $this->version); + $this->userinfo = new UserinfoServiceResource($this, $this->serviceName, 'userinfo', json_decode('{"methods": {"get": {"path": "oauth2/v2/userinfo", "response": {"$ref": "Userinfo"}, "httpMethod": "GET", "id": "oauth2.userinfo.get"}}}', true)); + $this->userinfo_v2 = new UserinfoV2ServiceResource($this, $this->serviceName, 'v2', json_decode('{}', true)); + $this->tokeninfo = new TokeninfoServiceResource($this, $this->serviceName, 'tokeninfo', json_decode('{"id": "oauth2.tokeninfo", "path": "oauth2/v2/tokeninfo", "response": {"$ref": "Tokeninfo"}, "parameters": {"access_token": {"type": "string", "location": "query"}, "id_token": {"type": "string", "location": "query"}}, "httpMethod": "GET"}', true)); + } +} + +class Tokeninfo extends apiModel { + public $issued_to; + public $user_id; + public $expires_in; + public $access_type; + public $audience; + public $scope; + public $email; + public $verified_email; + public function setIssued_to($issued_to) { + $this->issued_to = $issued_to; + } + public function getIssued_to() { + return $this->issued_to; + } + public function setUser_id($user_id) { + $this->user_id = $user_id; + } + public function getUser_id() { + return $this->user_id; + } + public function setExpires_in($expires_in) { + $this->expires_in = $expires_in; + } + public function getExpires_in() { + return $this->expires_in; + } + public function setAccess_type($access_type) { + $this->access_type = $access_type; + } + public function getAccess_type() { + return $this->access_type; + } + public function setAudience($audience) { + $this->audience = $audience; + } + public function getAudience() { + return $this->audience; + } + public function setScope($scope) { + $this->scope = $scope; + } + public function getScope() { + return $this->scope; + } + public function setEmail($email) { + $this->email = $email; + } + public function getEmail() { + return $this->email; + } + public function setVerified_email($verified_email) { + $this->verified_email = $verified_email; + } + public function getVerified_email() { + return $this->verified_email; + } +} + +class Userinfo extends apiModel { + public $family_name; + public $name; + public $picture; + public $locale; + public $gender; + public $email; + public $birthday; + public $link; + public $given_name; + public $timezone; + public $id; + public $verified_email; + public function setFamily_name($family_name) { + $this->family_name = $family_name; + } + public function getFamily_name() { + return $this->family_name; + } + public function setName($name) { + $this->name = $name; + } + public function getName() { + return $this->name; + } + public function setPicture($picture) { + $this->picture = $picture; + } + public function getPicture() { + return $this->picture; + } + public function setLocale($locale) { + $this->locale = $locale; + } + public function getLocale() { + return $this->locale; + } + public function setGender($gender) { + $this->gender = $gender; + } + public function getGender() { + return $this->gender; + } + public function setEmail($email) { + $this->email = $email; + } + public function getEmail() { + return $this->email; + } + public function setBirthday($birthday) { + $this->birthday = $birthday; + } + public function getBirthday() { + return $this->birthday; + } + public function setLink($link) { + $this->link = $link; + } + public function getLink() { + return $this->link; + } + public function setGiven_name($given_name) { + $this->given_name = $given_name; + } + public function getGiven_name() { + return $this->given_name; + } + public function setTimezone($timezone) { + $this->timezone = $timezone; + } + public function getTimezone() { + return $this->timezone; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setVerified_email($verified_email) { + $this->verified_email = $verified_email; + } + public function getVerified_email() { + return $this->verified_email; + } +} diff --git a/webui/google-api/contrib/apiOrkutService.php b/webui/google-api/contrib/apiOrkutService.php new file mode 100644 index 0000000..c5e5460 --- /dev/null +++ b/webui/google-api/contrib/apiOrkutService.php @@ -0,0 +1,2531 @@ + + * $orkutService = new apiOrkutService(...); + * $communityMembers = $orkutService->communityMembers; + * + */ + class CommunityMembersServiceResource extends apiServiceResource { + + + /** + * Makes the user join a community. (communityMembers.insert) + * + * @param int $communityId ID of the community. + * @param string $userId ID of the user. + * @return CommunityMembers + */ + public function insert($communityId, $userId, $optParams = array()) { + $params = array('communityId' => $communityId, 'userId' => $userId); + $params = array_merge($params, $optParams); + $data = $this->__call('insert', array($params)); + if ($this->useObjects()) { + return new CommunityMembers($data); + } else { + return $data; + } + } + /** + * Retrieves the relationship between a user and a community. (communityMembers.get) + * + * @param int $communityId ID of the community. + * @param string $userId ID of the user. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string hl Specifies the interface language (host language) of your user interface. + * @return CommunityMembers + */ + public function get($communityId, $userId, $optParams = array()) { + $params = array('communityId' => $communityId, 'userId' => $userId); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new CommunityMembers($data); + } else { + return $data; + } + } + /** + * Lists members of a community. (communityMembers.list) + * + * @param int $communityId The ID of the community whose members will be listed. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string pageToken A continuation token that allows pagination. + * @opt_param bool friendsOnly Whether to list only community members who are friends of the user. + * @opt_param string maxResults The maximum number of members to include in the response. + * @opt_param string hl Specifies the interface language (host language) of your user interface. + * @return CommunityMembersList + */ + public function listCommunityMembers($communityId, $optParams = array()) { + $params = array('communityId' => $communityId); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new CommunityMembersList($data); + } else { + return $data; + } + } + /** + * Makes the user leave a community. (communityMembers.delete) + * + * @param int $communityId ID of the community. + * @param string $userId ID of the user. + */ + public function delete($communityId, $userId, $optParams = array()) { + $params = array('communityId' => $communityId, 'userId' => $userId); + $params = array_merge($params, $optParams); + $data = $this->__call('delete', array($params)); + return $data; + } + } + + /** + * The "activities" collection of methods. + * Typical usage is: + * + * $orkutService = new apiOrkutService(...); + * $activities = $orkutService->activities; + * + */ + class ActivitiesServiceResource extends apiServiceResource { + + + /** + * Retrieves a list of activities. (activities.list) + * + * @param string $userId The ID of the user whose activities will be listed. Can be me to refer to the viewer (i.e. the authenticated user). + * @param string $collection The collection of activities to list. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string pageToken A continuation token that allows pagination. + * @opt_param string maxResults The maximum number of activities to include in the response. + * @opt_param string hl Specifies the interface language (host language) of your user interface. + * @return ActivityList + */ + public function listActivities($userId, $collection, $optParams = array()) { + $params = array('userId' => $userId, 'collection' => $collection); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new ActivityList($data); + } else { + return $data; + } + } + /** + * Deletes an existing activity, if the access controls allow it. (activities.delete) + * + * @param string $activityId ID of the activity to remove. + */ + public function delete($activityId, $optParams = array()) { + $params = array('activityId' => $activityId); + $params = array_merge($params, $optParams); + $data = $this->__call('delete', array($params)); + return $data; + } + } + + /** + * The "communityPollComments" collection of methods. + * Typical usage is: + * + * $orkutService = new apiOrkutService(...); + * $communityPollComments = $orkutService->communityPollComments; + * + */ + class CommunityPollCommentsServiceResource extends apiServiceResource { + + + /** + * Adds a comment on a community poll. (communityPollComments.insert) + * + * @param int $communityId The ID of the community whose poll is being commented. + * @param string $pollId The ID of the poll being commented. + * @param CommunityPollComment $postBody + * @return CommunityPollComment + */ + public function insert($communityId, $pollId, CommunityPollComment $postBody, $optParams = array()) { + $params = array('communityId' => $communityId, 'pollId' => $pollId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('insert', array($params)); + if ($this->useObjects()) { + return new CommunityPollComment($data); + } else { + return $data; + } + } + /** + * Retrieves the comments of a community poll. (communityPollComments.list) + * + * @param int $communityId The ID of the community whose poll is having its comments listed. + * @param string $pollId The ID of the community whose polls will be listed. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string pageToken A continuation token that allows pagination. + * @opt_param string maxResults The maximum number of comments to include in the response. + * @opt_param string hl Specifies the interface language (host language) of your user interface. + * @return CommunityPollCommentList + */ + public function listCommunityPollComments($communityId, $pollId, $optParams = array()) { + $params = array('communityId' => $communityId, 'pollId' => $pollId); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new CommunityPollCommentList($data); + } else { + return $data; + } + } + } + + /** + * The "communityPolls" collection of methods. + * Typical usage is: + * + * $orkutService = new apiOrkutService(...); + * $communityPolls = $orkutService->communityPolls; + * + */ + class CommunityPollsServiceResource extends apiServiceResource { + + + /** + * Retrieves the polls of a community. (communityPolls.list) + * + * @param string $communityId The ID of the community which polls will be listed. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string pageToken A continuation token that allows pagination. + * @opt_param string maxResults The maximum number of polls to include in the response. + * @opt_param string hl Specifies the interface language (host language) of your user interface. + * @return CommunityPollList + */ + public function listCommunityPolls($communityId, $optParams = array()) { + $params = array('communityId' => $communityId); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new CommunityPollList($data); + } else { + return $data; + } + } + /** + * Retrieves one specific poll of a community. (communityPolls.get) + * + * @param int $communityId The ID of the community for whose poll will be retrieved. + * @param string $pollId The ID of the poll to get. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string hl Specifies the interface language (host language) of your user interface. + * @return CommunityPoll + */ + public function get($communityId, $pollId, $optParams = array()) { + $params = array('communityId' => $communityId, 'pollId' => $pollId); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new CommunityPoll($data); + } else { + return $data; + } + } + } + + /** + * The "communityMessages" collection of methods. + * Typical usage is: + * + * $orkutService = new apiOrkutService(...); + * $communityMessages = $orkutService->communityMessages; + * + */ + class CommunityMessagesServiceResource extends apiServiceResource { + + + /** + * Adds a message to a given community topic. (communityMessages.insert) + * + * @param int $communityId The ID of the community the message should be added to. + * @param string $topicId The ID of the topic the message should be added to. + * @param CommunityMessage $postBody + * @return CommunityMessage + */ + public function insert($communityId, $topicId, CommunityMessage $postBody, $optParams = array()) { + $params = array('communityId' => $communityId, 'topicId' => $topicId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('insert', array($params)); + if ($this->useObjects()) { + return new CommunityMessage($data); + } else { + return $data; + } + } + /** + * Retrieves the messages of a topic of a community. (communityMessages.list) + * + * @param int $communityId The ID of the community which messages will be listed. + * @param string $topicId The ID of the topic which messages will be listed. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string pageToken A continuation token that allows pagination. + * @opt_param string maxResults The maximum number of messages to include in the response. + * @opt_param string hl Specifies the interface language (host language) of your user interface. + * @return CommunityMessageList + */ + public function listCommunityMessages($communityId, $topicId, $optParams = array()) { + $params = array('communityId' => $communityId, 'topicId' => $topicId); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new CommunityMessageList($data); + } else { + return $data; + } + } + /** + * Moves a message of the community to the trash folder. (communityMessages.delete) + * + * @param int $communityId The ID of the community whose message will be moved to the trash folder. + * @param string $topicId The ID of the topic whose message will be moved to the trash folder. + * @param string $messageId The ID of the message to be moved to the trash folder. + */ + public function delete($communityId, $topicId, $messageId, $optParams = array()) { + $params = array('communityId' => $communityId, 'topicId' => $topicId, 'messageId' => $messageId); + $params = array_merge($params, $optParams); + $data = $this->__call('delete', array($params)); + return $data; + } + } + + /** + * The "communityTopics" collection of methods. + * Typical usage is: + * + * $orkutService = new apiOrkutService(...); + * $communityTopics = $orkutService->communityTopics; + * + */ + class CommunityTopicsServiceResource extends apiServiceResource { + + + /** + * Adds a topic to a given community. (communityTopics.insert) + * + * @param int $communityId The ID of the community the topic should be added to. + * @param CommunityTopic $postBody + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param bool isShout Whether this topic is a shout. + * @return CommunityTopic + */ + public function insert($communityId, CommunityTopic $postBody, $optParams = array()) { + $params = array('communityId' => $communityId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('insert', array($params)); + if ($this->useObjects()) { + return new CommunityTopic($data); + } else { + return $data; + } + } + /** + * Retrieves a topic of a community. (communityTopics.get) + * + * @param int $communityId The ID of the community whose topic will be retrieved. + * @param string $topicId The ID of the topic to get. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string hl Specifies the interface language (host language) of your user interface. + * @return CommunityTopic + */ + public function get($communityId, $topicId, $optParams = array()) { + $params = array('communityId' => $communityId, 'topicId' => $topicId); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new CommunityTopic($data); + } else { + return $data; + } + } + /** + * Retrieves the topics of a community. (communityTopics.list) + * + * @param int $communityId The ID of the community which topics will be listed. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string pageToken A continuation token that allows pagination. + * @opt_param string maxResults The maximum number of topics to include in the response. + * @opt_param string hl Specifies the interface language (host language) of your user interface. + * @return CommunityTopicList + */ + public function listCommunityTopics($communityId, $optParams = array()) { + $params = array('communityId' => $communityId); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new CommunityTopicList($data); + } else { + return $data; + } + } + /** + * Moves a topic of the community to the trash folder. (communityTopics.delete) + * + * @param int $communityId The ID of the community whose topic will be moved to the trash folder. + * @param string $topicId The ID of the topic to be moved to the trash folder. + */ + public function delete($communityId, $topicId, $optParams = array()) { + $params = array('communityId' => $communityId, 'topicId' => $topicId); + $params = array_merge($params, $optParams); + $data = $this->__call('delete', array($params)); + return $data; + } + } + + /** + * The "comments" collection of methods. + * Typical usage is: + * + * $orkutService = new apiOrkutService(...); + * $comments = $orkutService->comments; + * + */ + class CommentsServiceResource extends apiServiceResource { + + + /** + * Inserts a new comment to an activity. (comments.insert) + * + * @param string $activityId The ID of the activity to contain the new comment. + * @param Comment $postBody + * @return Comment + */ + public function insert($activityId, Comment $postBody, $optParams = array()) { + $params = array('activityId' => $activityId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('insert', array($params)); + if ($this->useObjects()) { + return new Comment($data); + } else { + return $data; + } + } + /** + * Retrieves an existing comment. (comments.get) + * + * @param string $commentId ID of the comment to get. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string hl Specifies the interface language (host language) of your user interface. + * @return Comment + */ + public function get($commentId, $optParams = array()) { + $params = array('commentId' => $commentId); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new Comment($data); + } else { + return $data; + } + } + /** + * Retrieves a list of comments, possibly filtered. (comments.list) + * + * @param string $activityId The ID of the activity containing the comments. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string orderBy Sort search results. + * @opt_param string pageToken A continuation token that allows pagination. + * @opt_param string maxResults The maximum number of activities to include in the response. + * @opt_param string hl Specifies the interface language (host language) of your user interface. + * @return CommentList + */ + public function listComments($activityId, $optParams = array()) { + $params = array('activityId' => $activityId); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new CommentList($data); + } else { + return $data; + } + } + /** + * Deletes an existing comment. (comments.delete) + * + * @param string $commentId ID of the comment to remove. + */ + public function delete($commentId, $optParams = array()) { + $params = array('commentId' => $commentId); + $params = array_merge($params, $optParams); + $data = $this->__call('delete', array($params)); + return $data; + } + } + + /** + * The "acl" collection of methods. + * Typical usage is: + * + * $orkutService = new apiOrkutService(...); + * $acl = $orkutService->acl; + * + */ + class AclServiceResource extends apiServiceResource { + + + /** + * Excludes an element from the ACL of the activity. (acl.delete) + * + * @param string $activityId ID of the activity. + * @param string $userId ID of the user to be removed from the activity. + */ + public function delete($activityId, $userId, $optParams = array()) { + $params = array('activityId' => $activityId, 'userId' => $userId); + $params = array_merge($params, $optParams); + $data = $this->__call('delete', array($params)); + return $data; + } + } + + /** + * The "communityRelated" collection of methods. + * Typical usage is: + * + * $orkutService = new apiOrkutService(...); + * $communityRelated = $orkutService->communityRelated; + * + */ + class CommunityRelatedServiceResource extends apiServiceResource { + + + /** + * Retrieves the communities related to another one. (communityRelated.list) + * + * @param int $communityId The ID of the community whose related communities will be listed. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string hl Specifies the interface language (host language) of your user interface. + * @return CommunityList + */ + public function listCommunityRelated($communityId, $optParams = array()) { + $params = array('communityId' => $communityId); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new CommunityList($data); + } else { + return $data; + } + } + } + + /** + * The "scraps" collection of methods. + * Typical usage is: + * + * $orkutService = new apiOrkutService(...); + * $scraps = $orkutService->scraps; + * + */ + class ScrapsServiceResource extends apiServiceResource { + + + /** + * Creates a new scrap. (scraps.insert) + * + * @param Activity $postBody + * @return Activity + */ + public function insert(Activity $postBody, $optParams = array()) { + $params = array('postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('insert', array($params)); + if ($this->useObjects()) { + return new Activity($data); + } else { + return $data; + } + } + } + + /** + * The "communityPollVotes" collection of methods. + * Typical usage is: + * + * $orkutService = new apiOrkutService(...); + * $communityPollVotes = $orkutService->communityPollVotes; + * + */ + class CommunityPollVotesServiceResource extends apiServiceResource { + + + /** + * Votes on a community poll. (communityPollVotes.insert) + * + * @param int $communityId The ID of the community whose poll is being voted. + * @param string $pollId The ID of the poll being voted. + * @param CommunityPollVote $postBody + * @return CommunityPollVote + */ + public function insert($communityId, $pollId, CommunityPollVote $postBody, $optParams = array()) { + $params = array('communityId' => $communityId, 'pollId' => $pollId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('insert', array($params)); + if ($this->useObjects()) { + return new CommunityPollVote($data); + } else { + return $data; + } + } + } + + /** + * The "communities" collection of methods. + * Typical usage is: + * + * $orkutService = new apiOrkutService(...); + * $communities = $orkutService->communities; + * + */ + class CommunitiesServiceResource extends apiServiceResource { + + + /** + * Retrieves the communities an user is member of. (communities.list) + * + * @param string $userId The ID of the user whose communities will be listed. Can be me to refer to caller. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string orderBy How to order the communities by. + * @opt_param string maxResults The maximum number of communities to include in the response. + * @opt_param string hl Specifies the interface language (host language) of your user interface. + * @return CommunityList + */ + public function listCommunities($userId, $optParams = array()) { + $params = array('userId' => $userId); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new CommunityList($data); + } else { + return $data; + } + } + /** + * Retrieves the profile of a community. (communities.get) + * + * @param int $communityId The ID of the community to get. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string hl Specifies the interface language (host language) of your user interface. + * @return Community + */ + public function get($communityId, $optParams = array()) { + $params = array('communityId' => $communityId); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new Community($data); + } else { + return $data; + } + } + } + + /** + * The "communityFollow" collection of methods. + * Typical usage is: + * + * $orkutService = new apiOrkutService(...); + * $communityFollow = $orkutService->communityFollow; + * + */ + class CommunityFollowServiceResource extends apiServiceResource { + + + /** + * Adds an user as a follower of a community. (communityFollow.insert) + * + * @param int $communityId ID of the community. + * @param string $userId ID of the user. + * @return CommunityMembers + */ + public function insert($communityId, $userId, $optParams = array()) { + $params = array('communityId' => $communityId, 'userId' => $userId); + $params = array_merge($params, $optParams); + $data = $this->__call('insert', array($params)); + if ($this->useObjects()) { + return new CommunityMembers($data); + } else { + return $data; + } + } + /** + * Removes an user from the followers of a community. (communityFollow.delete) + * + * @param int $communityId ID of the community. + * @param string $userId ID of the user. + */ + public function delete($communityId, $userId, $optParams = array()) { + $params = array('communityId' => $communityId, 'userId' => $userId); + $params = array_merge($params, $optParams); + $data = $this->__call('delete', array($params)); + return $data; + } + } + + /** + * The "activityVisibility" collection of methods. + * Typical usage is: + * + * $orkutService = new apiOrkutService(...); + * $activityVisibility = $orkutService->activityVisibility; + * + */ + class ActivityVisibilityServiceResource extends apiServiceResource { + + + /** + * Updates the visibility of an existing activity. This method supports patch semantics. + * (activityVisibility.patch) + * + * @param string $activityId ID of the activity. + * @param Visibility $postBody + * @return Visibility + */ + public function patch($activityId, Visibility $postBody, $optParams = array()) { + $params = array('activityId' => $activityId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('patch', array($params)); + if ($this->useObjects()) { + return new Visibility($data); + } else { + return $data; + } + } + /** + * Updates the visibility of an existing activity. (activityVisibility.update) + * + * @param string $activityId ID of the activity. + * @param Visibility $postBody + * @return Visibility + */ + public function update($activityId, Visibility $postBody, $optParams = array()) { + $params = array('activityId' => $activityId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('update', array($params)); + if ($this->useObjects()) { + return new Visibility($data); + } else { + return $data; + } + } + /** + * Gets the visibility of an existing activity. (activityVisibility.get) + * + * @param string $activityId ID of the activity to get the visibility. + * @return Visibility + */ + public function get($activityId, $optParams = array()) { + $params = array('activityId' => $activityId); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new Visibility($data); + } else { + return $data; + } + } + } + + /** + * The "badges" collection of methods. + * Typical usage is: + * + * $orkutService = new apiOrkutService(...); + * $badges = $orkutService->badges; + * + */ + class BadgesServiceResource extends apiServiceResource { + + + /** + * Retrieves the list of visible badges of a user. (badges.list) + * + * @param string $userId The id of the user whose badges will be listed. Can be me to refer to caller. + * @return BadgeList + */ + public function listBadges($userId, $optParams = array()) { + $params = array('userId' => $userId); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new BadgeList($data); + } else { + return $data; + } + } + /** + * Retrieves a badge from a user. (badges.get) + * + * @param string $userId The ID of the user whose badges will be listed. Can be me to refer to caller. + * @param string $badgeId The ID of the badge that will be retrieved. + * @return Badge + */ + public function get($userId, $badgeId, $optParams = array()) { + $params = array('userId' => $userId, 'badgeId' => $badgeId); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new Badge($data); + } else { + return $data; + } + } + } + + /** + * The "counters" collection of methods. + * Typical usage is: + * + * $orkutService = new apiOrkutService(...); + * $counters = $orkutService->counters; + * + */ + class CountersServiceResource extends apiServiceResource { + + + /** + * Retrieves the counters of an user. (counters.list) + * + * @param string $userId The ID of the user whose counters will be listed. Can be me to refer to caller. + * @return Counters + */ + public function listCounters($userId, $optParams = array()) { + $params = array('userId' => $userId); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new Counters($data); + } else { + return $data; + } + } + } + + + +/** + * Service definition for Orkut (v2). + * + *

+ * Lets you manage activities, comments and badges in Orkut. More stuff coming in time. + *

+ * + *

+ * For more information about this service, see the + * API Documentation + *

+ * + * @author Google, Inc. + */ +class apiOrkutService extends apiService { + public $communityMembers; + public $activities; + public $communityPollComments; + public $communityPolls; + public $communityMessages; + public $communityTopics; + public $comments; + public $acl; + public $communityRelated; + public $scraps; + public $communityPollVotes; + public $communities; + public $communityFollow; + public $activityVisibility; + public $badges; + public $counters; + /** + * Constructs the internal representation of the Orkut service. + * + * @param apiClient apiClient + */ + public function __construct(apiClient $apiClient) { + $this->rpcPath = '/rpc'; + $this->restBasePath = '/orkut/v2/'; + $this->version = 'v2'; + $this->serviceName = 'orkut'; + + $apiClient->addService($this->serviceName, $this->version); + $this->communityMembers = new CommunityMembersServiceResource($this, $this->serviceName, 'communityMembers', json_decode('{"methods": {"insert": {"scopes": ["https://www.googleapis.com/auth/orkut"], "parameters": {"communityId": {"format": "int32", "required": true, "type": "integer", "location": "path"}, "userId": {"required": true, "type": "string", "location": "path"}}, "id": "orkut.communityMembers.insert", "httpMethod": "POST", "path": "communities/{communityId}/members/{userId}", "response": {"$ref": "CommunityMembers"}}, "delete": {"scopes": ["https://www.googleapis.com/auth/orkut"], "parameters": {"communityId": {"format": "int32", "required": true, "type": "integer", "location": "path"}, "userId": {"required": true, "type": "string", "location": "path"}}, "httpMethod": "DELETE", "path": "communities/{communityId}/members/{userId}", "id": "orkut.communityMembers.delete"}, "list": {"scopes": ["https://www.googleapis.com/auth/orkut", "https://www.googleapis.com/auth/orkut.readonly"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "friendsOnly": {"type": "boolean", "location": "query"}, "communityId": {"format": "int32", "required": true, "type": "integer", "location": "path"}, "hl": {"type": "string", "location": "query"}, "maxResults": {"format": "uint32", "minimum": "1", "type": "integer", "location": "query"}}, "id": "orkut.communityMembers.list", "httpMethod": "GET", "path": "communities/{communityId}/members", "response": {"$ref": "CommunityMembersList"}}, "get": {"scopes": ["https://www.googleapis.com/auth/orkut", "https://www.googleapis.com/auth/orkut.readonly"], "parameters": {"communityId": {"format": "int32", "required": true, "type": "integer", "location": "path"}, "userId": {"required": true, "type": "string", "location": "path"}, "hl": {"type": "string", "location": "query"}}, "id": "orkut.communityMembers.get", "httpMethod": "GET", "path": "communities/{communityId}/members/{userId}", "response": {"$ref": "CommunityMembers"}}}}', true)); + $this->activities = new ActivitiesServiceResource($this, $this->serviceName, 'activities', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/orkut", "https://www.googleapis.com/auth/orkut.readonly"], "parameters": {"collection": {"required": true, "enum": ["all", "scraps", "stream"], "location": "path", "type": "string"}, "pageToken": {"type": "string", "location": "query"}, "userId": {"required": true, "type": "string", "location": "path"}, "hl": {"type": "string", "location": "query"}, "maxResults": {"format": "uint32", "maximum": "100", "minimum": "1", "location": "query", "type": "integer"}}, "id": "orkut.activities.list", "httpMethod": "GET", "path": "people/{userId}/activities/{collection}", "response": {"$ref": "ActivityList"}}, "delete": {"scopes": ["https://www.googleapis.com/auth/orkut"], "parameters": {"activityId": {"required": true, "type": "string", "location": "path"}}, "httpMethod": "DELETE", "path": "activities/{activityId}", "id": "orkut.activities.delete"}}}', true)); + $this->communityPollComments = new CommunityPollCommentsServiceResource($this, $this->serviceName, 'communityPollComments', json_decode('{"methods": {"insert": {"scopes": ["https://www.googleapis.com/auth/orkut"], "parameters": {"communityId": {"format": "int32", "required": true, "type": "integer", "location": "path"}, "pollId": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "CommunityPollComment"}, "id": "orkut.communityPollComments.insert", "httpMethod": "POST", "path": "communities/{communityId}/polls/{pollId}/comments", "response": {"$ref": "CommunityPollComment"}}, "list": {"scopes": ["https://www.googleapis.com/auth/orkut", "https://www.googleapis.com/auth/orkut.readonly"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "communityId": {"format": "int32", "required": true, "type": "integer", "location": "path"}, "hl": {"type": "string", "location": "query"}, "maxResults": {"format": "uint32", "minimum": "1", "type": "integer", "location": "query"}, "pollId": {"required": true, "type": "string", "location": "path"}}, "id": "orkut.communityPollComments.list", "httpMethod": "GET", "path": "communities/{communityId}/polls/{pollId}/comments", "response": {"$ref": "CommunityPollCommentList"}}}}', true)); + $this->communityPolls = new CommunityPollsServiceResource($this, $this->serviceName, 'communityPolls', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/orkut", "https://www.googleapis.com/auth/orkut.readonly"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "communityId": {"required": true, "type": "string", "location": "path"}, "hl": {"type": "string", "location": "query"}, "maxResults": {"format": "uint32", "minimum": "1", "type": "integer", "location": "query"}}, "id": "orkut.communityPolls.list", "httpMethod": "GET", "path": "communities/{communityId}/polls", "response": {"$ref": "CommunityPollList"}}, "get": {"scopes": ["https://www.googleapis.com/auth/orkut", "https://www.googleapis.com/auth/orkut.readonly"], "parameters": {"communityId": {"format": "int32", "required": true, "type": "integer", "location": "path"}, "hl": {"type": "string", "location": "query"}, "pollId": {"required": true, "type": "string", "location": "path"}}, "id": "orkut.communityPolls.get", "httpMethod": "GET", "path": "communities/{communityId}/polls/{pollId}", "response": {"$ref": "CommunityPoll"}}}}', true)); + $this->communityMessages = new CommunityMessagesServiceResource($this, $this->serviceName, 'communityMessages', json_decode('{"methods": {"insert": {"scopes": ["https://www.googleapis.com/auth/orkut"], "parameters": {"topicId": {"format": "uint64", "required": true, "type": "string", "location": "path"}, "communityId": {"format": "int32", "required": true, "type": "integer", "location": "path"}}, "request": {"$ref": "CommunityMessage"}, "id": "orkut.communityMessages.insert", "httpMethod": "POST", "path": "communities/{communityId}/topics/{topicId}/messages", "response": {"$ref": "CommunityMessage"}}, "list": {"scopes": ["https://www.googleapis.com/auth/orkut", "https://www.googleapis.com/auth/orkut.readonly"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "communityId": {"format": "int32", "required": true, "type": "integer", "location": "path"}, "hl": {"type": "string", "location": "query"}, "maxResults": {"format": "uint32", "maximum": "100", "minimum": "1", "location": "query", "type": "integer"}, "topicId": {"format": "uint64", "required": true, "type": "string", "location": "path"}}, "id": "orkut.communityMessages.list", "httpMethod": "GET", "path": "communities/{communityId}/topics/{topicId}/messages", "response": {"$ref": "CommunityMessageList"}}, "delete": {"scopes": ["https://www.googleapis.com/auth/orkut"], "parameters": {"topicId": {"format": "uint64", "required": true, "type": "string", "location": "path"}, "communityId": {"format": "int32", "required": true, "type": "integer", "location": "path"}, "messageId": {"format": "uint64", "required": true, "type": "string", "location": "path"}}, "httpMethod": "DELETE", "path": "communities/{communityId}/topics/{topicId}/messages/{messageId}", "id": "orkut.communityMessages.delete"}}}', true)); + $this->communityTopics = new CommunityTopicsServiceResource($this, $this->serviceName, 'communityTopics', json_decode('{"methods": {"insert": {"scopes": ["https://www.googleapis.com/auth/orkut"], "parameters": {"isShout": {"type": "boolean", "location": "query"}, "communityId": {"format": "int32", "required": true, "type": "integer", "location": "path"}}, "request": {"$ref": "CommunityTopic"}, "id": "orkut.communityTopics.insert", "httpMethod": "POST", "path": "communities/{communityId}/topics", "response": {"$ref": "CommunityTopic"}}, "delete": {"scopes": ["https://www.googleapis.com/auth/orkut"], "parameters": {"topicId": {"format": "uint64", "required": true, "type": "string", "location": "path"}, "communityId": {"format": "int32", "required": true, "type": "integer", "location": "path"}}, "httpMethod": "DELETE", "path": "communities/{communityId}/topics/{topicId}", "id": "orkut.communityTopics.delete"}, "list": {"scopes": ["https://www.googleapis.com/auth/orkut", "https://www.googleapis.com/auth/orkut.readonly"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "communityId": {"format": "int32", "required": true, "type": "integer", "location": "path"}, "hl": {"type": "string", "location": "query"}, "maxResults": {"format": "uint32", "maximum": "100", "minimum": "1", "location": "query", "type": "integer"}}, "id": "orkut.communityTopics.list", "httpMethod": "GET", "path": "communities/{communityId}/topics", "response": {"$ref": "CommunityTopicList"}}, "get": {"scopes": ["https://www.googleapis.com/auth/orkut", "https://www.googleapis.com/auth/orkut.readonly"], "parameters": {"topicId": {"format": "uint64", "required": true, "type": "string", "location": "path"}, "communityId": {"format": "int32", "required": true, "type": "integer", "location": "path"}, "hl": {"type": "string", "location": "query"}}, "id": "orkut.communityTopics.get", "httpMethod": "GET", "path": "communities/{communityId}/topics/{topicId}", "response": {"$ref": "CommunityTopic"}}}}', true)); + $this->comments = new CommentsServiceResource($this, $this->serviceName, 'comments', json_decode('{"methods": {"insert": {"scopes": ["https://www.googleapis.com/auth/orkut"], "parameters": {"activityId": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "Comment"}, "id": "orkut.comments.insert", "httpMethod": "POST", "path": "activities/{activityId}/comments", "response": {"$ref": "Comment"}}, "delete": {"scopes": ["https://www.googleapis.com/auth/orkut"], "parameters": {"commentId": {"required": true, "type": "string", "location": "path"}}, "httpMethod": "DELETE", "path": "comments/{commentId}", "id": "orkut.comments.delete"}, "list": {"scopes": ["https://www.googleapis.com/auth/orkut", "https://www.googleapis.com/auth/orkut.readonly"], "parameters": {"orderBy": {"default": "DESCENDING_SORT", "enum": ["ascending", "descending"], "location": "query", "type": "string"}, "pageToken": {"type": "string", "location": "query"}, "activityId": {"required": true, "type": "string", "location": "path"}, "hl": {"type": "string", "location": "query"}, "maxResults": {"format": "uint32", "minimum": "1", "type": "integer", "location": "query"}}, "id": "orkut.comments.list", "httpMethod": "GET", "path": "activities/{activityId}/comments", "response": {"$ref": "CommentList"}}, "get": {"scopes": ["https://www.googleapis.com/auth/orkut", "https://www.googleapis.com/auth/orkut.readonly"], "parameters": {"commentId": {"required": true, "type": "string", "location": "path"}, "hl": {"type": "string", "location": "query"}}, "id": "orkut.comments.get", "httpMethod": "GET", "path": "comments/{commentId}", "response": {"$ref": "Comment"}}}}', true)); + $this->acl = new AclServiceResource($this, $this->serviceName, 'acl', json_decode('{"methods": {"delete": {"scopes": ["https://www.googleapis.com/auth/orkut"], "parameters": {"activityId": {"required": true, "type": "string", "location": "path"}, "userId": {"required": true, "type": "string", "location": "path"}}, "httpMethod": "DELETE", "path": "activities/{activityId}/acl/{userId}", "id": "orkut.acl.delete"}}}', true)); + $this->communityRelated = new CommunityRelatedServiceResource($this, $this->serviceName, 'communityRelated', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/orkut", "https://www.googleapis.com/auth/orkut.readonly"], "parameters": {"communityId": {"format": "int32", "required": true, "type": "integer", "location": "path"}, "hl": {"type": "string", "location": "query"}}, "id": "orkut.communityRelated.list", "httpMethod": "GET", "path": "communities/{communityId}/related", "response": {"$ref": "CommunityList"}}}}', true)); + $this->scraps = new ScrapsServiceResource($this, $this->serviceName, 'scraps', json_decode('{"methods": {"insert": {"scopes": ["https://www.googleapis.com/auth/orkut"], "request": {"$ref": "Activity"}, "response": {"$ref": "Activity"}, "httpMethod": "POST", "path": "activities/scraps", "id": "orkut.scraps.insert"}}}', true)); + $this->communityPollVotes = new CommunityPollVotesServiceResource($this, $this->serviceName, 'communityPollVotes', json_decode('{"methods": {"insert": {"scopes": ["https://www.googleapis.com/auth/orkut"], "parameters": {"communityId": {"format": "int32", "required": true, "type": "integer", "location": "path"}, "pollId": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "CommunityPollVote"}, "id": "orkut.communityPollVotes.insert", "httpMethod": "POST", "path": "communities/{communityId}/polls/{pollId}/votes", "response": {"$ref": "CommunityPollVote"}}}}', true)); + $this->communities = new CommunitiesServiceResource($this, $this->serviceName, 'communities', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/orkut", "https://www.googleapis.com/auth/orkut.readonly"], "parameters": {"orderBy": {"enum": ["id", "ranked"], "type": "string", "location": "query"}, "userId": {"required": true, "type": "string", "location": "path"}, "hl": {"type": "string", "location": "query"}, "maxResults": {"format": "uint32", "minimum": "1", "type": "integer", "location": "query"}}, "id": "orkut.communities.list", "httpMethod": "GET", "path": "people/{userId}/communities", "response": {"$ref": "CommunityList"}}, "get": {"scopes": ["https://www.googleapis.com/auth/orkut", "https://www.googleapis.com/auth/orkut.readonly"], "parameters": {"communityId": {"format": "int32", "required": true, "type": "integer", "location": "path"}, "hl": {"type": "string", "location": "query"}}, "id": "orkut.communities.get", "httpMethod": "GET", "path": "communities/{communityId}", "response": {"$ref": "Community"}}}}', true)); + $this->communityFollow = new CommunityFollowServiceResource($this, $this->serviceName, 'communityFollow', json_decode('{"methods": {"insert": {"scopes": ["https://www.googleapis.com/auth/orkut"], "parameters": {"communityId": {"format": "int32", "required": true, "type": "integer", "location": "path"}, "userId": {"required": true, "type": "string", "location": "path"}}, "id": "orkut.communityFollow.insert", "httpMethod": "POST", "path": "communities/{communityId}/followers/{userId}", "response": {"$ref": "CommunityMembers"}}, "delete": {"scopes": ["https://www.googleapis.com/auth/orkut"], "parameters": {"communityId": {"format": "int32", "required": true, "type": "integer", "location": "path"}, "userId": {"required": true, "type": "string", "location": "path"}}, "httpMethod": "DELETE", "path": "communities/{communityId}/followers/{userId}", "id": "orkut.communityFollow.delete"}}}', true)); + $this->activityVisibility = new ActivityVisibilityServiceResource($this, $this->serviceName, 'activityVisibility', json_decode('{"methods": {"get": {"scopes": ["https://www.googleapis.com/auth/orkut", "https://www.googleapis.com/auth/orkut.readonly"], "parameters": {"activityId": {"required": true, "type": "string", "location": "path"}}, "id": "orkut.activityVisibility.get", "httpMethod": "GET", "path": "activities/{activityId}/visibility", "response": {"$ref": "Visibility"}}, "update": {"scopes": ["https://www.googleapis.com/auth/orkut"], "parameters": {"activityId": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "Visibility"}, "id": "orkut.activityVisibility.update", "httpMethod": "PUT", "path": "activities/{activityId}/visibility", "response": {"$ref": "Visibility"}}, "patch": {"scopes": ["https://www.googleapis.com/auth/orkut"], "parameters": {"activityId": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "Visibility"}, "id": "orkut.activityVisibility.patch", "httpMethod": "PATCH", "path": "activities/{activityId}/visibility", "response": {"$ref": "Visibility"}}}}', true)); + $this->badges = new BadgesServiceResource($this, $this->serviceName, 'badges', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/orkut", "https://www.googleapis.com/auth/orkut.readonly"], "parameters": {"userId": {"required": true, "type": "string", "location": "path"}}, "id": "orkut.badges.list", "httpMethod": "GET", "path": "people/{userId}/badges", "response": {"$ref": "BadgeList"}}, "get": {"scopes": ["https://www.googleapis.com/auth/orkut", "https://www.googleapis.com/auth/orkut.readonly"], "parameters": {"userId": {"required": true, "type": "string", "location": "path"}, "badgeId": {"format": "int64", "required": true, "type": "string", "location": "path"}}, "id": "orkut.badges.get", "httpMethod": "GET", "path": "people/{userId}/badges/{badgeId}", "response": {"$ref": "Badge"}}}}', true)); + $this->counters = new CountersServiceResource($this, $this->serviceName, 'counters', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/orkut", "https://www.googleapis.com/auth/orkut.readonly"], "parameters": {"userId": {"required": true, "type": "string", "location": "path"}}, "id": "orkut.counters.list", "httpMethod": "GET", "path": "people/{userId}/counters", "response": {"$ref": "Counters"}}}}', true)); + } +} + +class Acl extends apiModel { + protected $__itemsType = 'AclItems'; + protected $__itemsDataType = 'array'; + public $items; + public $kind; + public $description; + public $totalParticipants; + public function setItems(/* array(AclItems) */ $items) { + $this->assertIsArray($items, 'AclItems', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setDescription($description) { + $this->description = $description; + } + public function getDescription() { + return $this->description; + } + public function setTotalParticipants($totalParticipants) { + $this->totalParticipants = $totalParticipants; + } + public function getTotalParticipants() { + return $this->totalParticipants; + } +} + +class AclItems extends apiModel { + public $type; + public $id; + public function setType($type) { + $this->type = $type; + } + public function getType() { + return $this->type; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } +} + +class Activity extends apiModel { + public $kind; + protected $__linksType = 'OrkutLinkResource'; + protected $__linksDataType = 'array'; + public $links; + public $title; + protected $__objectType = 'ActivityObject'; + protected $__objectDataType = ''; + public $object; + public $updated; + protected $__actorType = 'OrkutAuthorResource'; + protected $__actorDataType = ''; + public $actor; + protected $__accessType = 'Acl'; + protected $__accessDataType = ''; + public $access; + public $verb; + public $published; + public $id; + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setLinks(/* array(OrkutLinkResource) */ $links) { + $this->assertIsArray($links, 'OrkutLinkResource', __METHOD__); + $this->links = $links; + } + public function getLinks() { + return $this->links; + } + public function setTitle($title) { + $this->title = $title; + } + public function getTitle() { + return $this->title; + } + public function setObject(ActivityObject $object) { + $this->object = $object; + } + public function getObject() { + return $this->object; + } + public function setUpdated($updated) { + $this->updated = $updated; + } + public function getUpdated() { + return $this->updated; + } + public function setActor(OrkutAuthorResource $actor) { + $this->actor = $actor; + } + public function getActor() { + return $this->actor; + } + public function setAccess(Acl $access) { + $this->access = $access; + } + public function getAccess() { + return $this->access; + } + public function setVerb($verb) { + $this->verb = $verb; + } + public function getVerb() { + return $this->verb; + } + public function setPublished($published) { + $this->published = $published; + } + public function getPublished() { + return $this->published; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } +} + +class ActivityList extends apiModel { + public $nextPageToken; + protected $__itemsType = 'Activity'; + protected $__itemsDataType = 'array'; + public $items; + public $kind; + public function setNextPageToken($nextPageToken) { + $this->nextPageToken = $nextPageToken; + } + public function getNextPageToken() { + return $this->nextPageToken; + } + public function setItems(/* array(Activity) */ $items) { + $this->assertIsArray($items, 'Activity', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } +} + +class ActivityObject extends apiModel { + public $content; + protected $__itemsType = 'OrkutActivityobjectsResource'; + protected $__itemsDataType = 'array'; + public $items; + protected $__repliesType = 'ActivityObjectReplies'; + protected $__repliesDataType = ''; + public $replies; + public $objectType; + public function setContent($content) { + $this->content = $content; + } + public function getContent() { + return $this->content; + } + public function setItems(/* array(OrkutActivityobjectsResource) */ $items) { + $this->assertIsArray($items, 'OrkutActivityobjectsResource', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setReplies(ActivityObjectReplies $replies) { + $this->replies = $replies; + } + public function getReplies() { + return $this->replies; + } + public function setObjectType($objectType) { + $this->objectType = $objectType; + } + public function getObjectType() { + return $this->objectType; + } +} + +class ActivityObjectReplies extends apiModel { + public $totalItems; + protected $__itemsType = 'Comment'; + protected $__itemsDataType = 'array'; + public $items; + public $url; + public function setTotalItems($totalItems) { + $this->totalItems = $totalItems; + } + public function getTotalItems() { + return $this->totalItems; + } + public function setItems(/* array(Comment) */ $items) { + $this->assertIsArray($items, 'Comment', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setUrl($url) { + $this->url = $url; + } + public function getUrl() { + return $this->url; + } +} + +class Badge extends apiModel { + public $badgeSmallLogo; + public $kind; + public $description; + public $sponsorLogo; + public $sponsorName; + public $badgeLargeLogo; + public $caption; + public $sponsorUrl; + public $id; + public function setBadgeSmallLogo($badgeSmallLogo) { + $this->badgeSmallLogo = $badgeSmallLogo; + } + public function getBadgeSmallLogo() { + return $this->badgeSmallLogo; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setDescription($description) { + $this->description = $description; + } + public function getDescription() { + return $this->description; + } + public function setSponsorLogo($sponsorLogo) { + $this->sponsorLogo = $sponsorLogo; + } + public function getSponsorLogo() { + return $this->sponsorLogo; + } + public function setSponsorName($sponsorName) { + $this->sponsorName = $sponsorName; + } + public function getSponsorName() { + return $this->sponsorName; + } + public function setBadgeLargeLogo($badgeLargeLogo) { + $this->badgeLargeLogo = $badgeLargeLogo; + } + public function getBadgeLargeLogo() { + return $this->badgeLargeLogo; + } + public function setCaption($caption) { + $this->caption = $caption; + } + public function getCaption() { + return $this->caption; + } + public function setSponsorUrl($sponsorUrl) { + $this->sponsorUrl = $sponsorUrl; + } + public function getSponsorUrl() { + return $this->sponsorUrl; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } +} + +class BadgeList extends apiModel { + protected $__itemsType = 'Badge'; + protected $__itemsDataType = 'array'; + public $items; + public $kind; + public function setItems(/* array(Badge) */ $items) { + $this->assertIsArray($items, 'Badge', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } +} + +class Comment extends apiModel { + protected $__inReplyToType = 'CommentInReplyTo'; + protected $__inReplyToDataType = ''; + public $inReplyTo; + public $kind; + protected $__linksType = 'OrkutLinkResource'; + protected $__linksDataType = 'array'; + public $links; + protected $__actorType = 'OrkutAuthorResource'; + protected $__actorDataType = ''; + public $actor; + public $content; + public $published; + public $id; + public function setInReplyTo(CommentInReplyTo $inReplyTo) { + $this->inReplyTo = $inReplyTo; + } + public function getInReplyTo() { + return $this->inReplyTo; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setLinks(/* array(OrkutLinkResource) */ $links) { + $this->assertIsArray($links, 'OrkutLinkResource', __METHOD__); + $this->links = $links; + } + public function getLinks() { + return $this->links; + } + public function setActor(OrkutAuthorResource $actor) { + $this->actor = $actor; + } + public function getActor() { + return $this->actor; + } + public function setContent($content) { + $this->content = $content; + } + public function getContent() { + return $this->content; + } + public function setPublished($published) { + $this->published = $published; + } + public function getPublished() { + return $this->published; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } +} + +class CommentInReplyTo extends apiModel { + public $type; + public $href; + public $ref; + public $rel; + public function setType($type) { + $this->type = $type; + } + public function getType() { + return $this->type; + } + public function setHref($href) { + $this->href = $href; + } + public function getHref() { + return $this->href; + } + public function setRef($ref) { + $this->ref = $ref; + } + public function getRef() { + return $this->ref; + } + public function setRel($rel) { + $this->rel = $rel; + } + public function getRel() { + return $this->rel; + } +} + +class CommentList extends apiModel { + public $nextPageToken; + protected $__itemsType = 'Comment'; + protected $__itemsDataType = 'array'; + public $items; + public $kind; + public $previousPageToken; + public function setNextPageToken($nextPageToken) { + $this->nextPageToken = $nextPageToken; + } + public function getNextPageToken() { + return $this->nextPageToken; + } + public function setItems(/* array(Comment) */ $items) { + $this->assertIsArray($items, 'Comment', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setPreviousPageToken($previousPageToken) { + $this->previousPageToken = $previousPageToken; + } + public function getPreviousPageToken() { + return $this->previousPageToken; + } +} + +class Community extends apiModel { + public $category; + public $kind; + public $member_count; + public $description; + public $language; + protected $__linksType = 'OrkutLinkResource'; + protected $__linksDataType = 'array'; + public $links; + public $creation_date; + protected $__ownerType = 'OrkutAuthorResource'; + protected $__ownerDataType = ''; + public $owner; + protected $__moderatorsType = 'OrkutAuthorResource'; + protected $__moderatorsDataType = 'array'; + public $moderators; + public $location; + protected $__co_ownersType = 'OrkutAuthorResource'; + protected $__co_ownersDataType = 'array'; + public $co_owners; + public $photo_url; + public $id; + public $name; + public function setCategory($category) { + $this->category = $category; + } + public function getCategory() { + return $this->category; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setMember_count($member_count) { + $this->member_count = $member_count; + } + public function getMember_count() { + return $this->member_count; + } + public function setDescription($description) { + $this->description = $description; + } + public function getDescription() { + return $this->description; + } + public function setLanguage($language) { + $this->language = $language; + } + public function getLanguage() { + return $this->language; + } + public function setLinks(/* array(OrkutLinkResource) */ $links) { + $this->assertIsArray($links, 'OrkutLinkResource', __METHOD__); + $this->links = $links; + } + public function getLinks() { + return $this->links; + } + public function setCreation_date($creation_date) { + $this->creation_date = $creation_date; + } + public function getCreation_date() { + return $this->creation_date; + } + public function setOwner(OrkutAuthorResource $owner) { + $this->owner = $owner; + } + public function getOwner() { + return $this->owner; + } + public function setModerators(/* array(OrkutAuthorResource) */ $moderators) { + $this->assertIsArray($moderators, 'OrkutAuthorResource', __METHOD__); + $this->moderators = $moderators; + } + public function getModerators() { + return $this->moderators; + } + public function setLocation($location) { + $this->location = $location; + } + public function getLocation() { + return $this->location; + } + public function setCo_owners(/* array(OrkutAuthorResource) */ $co_owners) { + $this->assertIsArray($co_owners, 'OrkutAuthorResource', __METHOD__); + $this->co_owners = $co_owners; + } + public function getCo_owners() { + return $this->co_owners; + } + public function setPhoto_url($photo_url) { + $this->photo_url = $photo_url; + } + public function getPhoto_url() { + return $this->photo_url; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setName($name) { + $this->name = $name; + } + public function getName() { + return $this->name; + } +} + +class CommunityList extends apiModel { + protected $__itemsType = 'Community'; + protected $__itemsDataType = 'array'; + public $items; + public $kind; + public function setItems(/* array(Community) */ $items) { + $this->assertIsArray($items, 'Community', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } +} + +class CommunityMembers extends apiModel { + protected $__communityMembershipStatusType = 'CommunityMembershipStatus'; + protected $__communityMembershipStatusDataType = ''; + public $communityMembershipStatus; + protected $__personType = 'OrkutActivitypersonResource'; + protected $__personDataType = ''; + public $person; + public $kind; + public function setCommunityMembershipStatus(CommunityMembershipStatus $communityMembershipStatus) { + $this->communityMembershipStatus = $communityMembershipStatus; + } + public function getCommunityMembershipStatus() { + return $this->communityMembershipStatus; + } + public function setPerson(OrkutActivitypersonResource $person) { + $this->person = $person; + } + public function getPerson() { + return $this->person; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } +} + +class CommunityMembersList extends apiModel { + public $nextPageToken; + public $kind; + protected $__itemsType = 'CommunityMembers'; + protected $__itemsDataType = 'array'; + public $items; + public $prevPageToken; + public $lastPageToken; + public $firstPageToken; + public function setNextPageToken($nextPageToken) { + $this->nextPageToken = $nextPageToken; + } + public function getNextPageToken() { + return $this->nextPageToken; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setItems(/* array(CommunityMembers) */ $items) { + $this->assertIsArray($items, 'CommunityMembers', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setPrevPageToken($prevPageToken) { + $this->prevPageToken = $prevPageToken; + } + public function getPrevPageToken() { + return $this->prevPageToken; + } + public function setLastPageToken($lastPageToken) { + $this->lastPageToken = $lastPageToken; + } + public function getLastPageToken() { + return $this->lastPageToken; + } + public function setFirstPageToken($firstPageToken) { + $this->firstPageToken = $firstPageToken; + } + public function getFirstPageToken() { + return $this->firstPageToken; + } +} + +class CommunityMembershipStatus extends apiModel { + public $status; + public $isFollowing; + public $isRestoreAvailable; + public $isModerator; + public $kind; + public $isCoOwner; + public $canCreatePoll; + public $canShout; + public $isOwner; + public $canCreateTopic; + public $isTakebackAvailable; + public function setStatus($status) { + $this->status = $status; + } + public function getStatus() { + return $this->status; + } + public function setIsFollowing($isFollowing) { + $this->isFollowing = $isFollowing; + } + public function getIsFollowing() { + return $this->isFollowing; + } + public function setIsRestoreAvailable($isRestoreAvailable) { + $this->isRestoreAvailable = $isRestoreAvailable; + } + public function getIsRestoreAvailable() { + return $this->isRestoreAvailable; + } + public function setIsModerator($isModerator) { + $this->isModerator = $isModerator; + } + public function getIsModerator() { + return $this->isModerator; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setIsCoOwner($isCoOwner) { + $this->isCoOwner = $isCoOwner; + } + public function getIsCoOwner() { + return $this->isCoOwner; + } + public function setCanCreatePoll($canCreatePoll) { + $this->canCreatePoll = $canCreatePoll; + } + public function getCanCreatePoll() { + return $this->canCreatePoll; + } + public function setCanShout($canShout) { + $this->canShout = $canShout; + } + public function getCanShout() { + return $this->canShout; + } + public function setIsOwner($isOwner) { + $this->isOwner = $isOwner; + } + public function getIsOwner() { + return $this->isOwner; + } + public function setCanCreateTopic($canCreateTopic) { + $this->canCreateTopic = $canCreateTopic; + } + public function getCanCreateTopic() { + return $this->canCreateTopic; + } + public function setIsTakebackAvailable($isTakebackAvailable) { + $this->isTakebackAvailable = $isTakebackAvailable; + } + public function getIsTakebackAvailable() { + return $this->isTakebackAvailable; + } +} + +class CommunityMessage extends apiModel { + public $body; + public $kind; + protected $__linksType = 'OrkutLinkResource'; + protected $__linksDataType = 'array'; + public $links; + protected $__authorType = 'OrkutAuthorResource'; + protected $__authorDataType = ''; + public $author; + public $id; + public $addedDate; + public $isSpam; + public $subject; + public function setBody($body) { + $this->body = $body; + } + public function getBody() { + return $this->body; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setLinks(/* array(OrkutLinkResource) */ $links) { + $this->assertIsArray($links, 'OrkutLinkResource', __METHOD__); + $this->links = $links; + } + public function getLinks() { + return $this->links; + } + public function setAuthor(OrkutAuthorResource $author) { + $this->author = $author; + } + public function getAuthor() { + return $this->author; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setAddedDate($addedDate) { + $this->addedDate = $addedDate; + } + public function getAddedDate() { + return $this->addedDate; + } + public function setIsSpam($isSpam) { + $this->isSpam = $isSpam; + } + public function getIsSpam() { + return $this->isSpam; + } + public function setSubject($subject) { + $this->subject = $subject; + } + public function getSubject() { + return $this->subject; + } +} + +class CommunityMessageList extends apiModel { + public $nextPageToken; + public $kind; + protected $__itemsType = 'CommunityMessage'; + protected $__itemsDataType = 'array'; + public $items; + public $prevPageToken; + public $lastPageToken; + public $firstPageToken; + public function setNextPageToken($nextPageToken) { + $this->nextPageToken = $nextPageToken; + } + public function getNextPageToken() { + return $this->nextPageToken; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setItems(/* array(CommunityMessage) */ $items) { + $this->assertIsArray($items, 'CommunityMessage', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setPrevPageToken($prevPageToken) { + $this->prevPageToken = $prevPageToken; + } + public function getPrevPageToken() { + return $this->prevPageToken; + } + public function setLastPageToken($lastPageToken) { + $this->lastPageToken = $lastPageToken; + } + public function getLastPageToken() { + return $this->lastPageToken; + } + public function setFirstPageToken($firstPageToken) { + $this->firstPageToken = $firstPageToken; + } + public function getFirstPageToken() { + return $this->firstPageToken; + } +} + +class CommunityPoll extends apiModel { + protected $__linksType = 'OrkutLinkResource'; + protected $__linksDataType = 'array'; + public $links; + public $isMultipleAnswers; + protected $__imageType = 'CommunityPollImage'; + protected $__imageDataType = ''; + public $image; + public $endingTime; + public $isVotingAllowedForNonMembers; + public $isSpam; + public $totalNumberOfVotes; + protected $__authorType = 'OrkutAuthorResource'; + protected $__authorDataType = ''; + public $author; + public $question; + public $id; + public $isRestricted; + public $communityId; + public $isUsersVotePublic; + public $lastUpdate; + public $description; + public $votedOptions; + public $isOpenForVoting; + public $isClosed; + public $hasVoted; + public $kind; + public $creationTime; + protected $__optionsType = 'OrkutCommunitypolloptionResource'; + protected $__optionsDataType = 'array'; + public $options; + public function setLinks(/* array(OrkutLinkResource) */ $links) { + $this->assertIsArray($links, 'OrkutLinkResource', __METHOD__); + $this->links = $links; + } + public function getLinks() { + return $this->links; + } + public function setIsMultipleAnswers($isMultipleAnswers) { + $this->isMultipleAnswers = $isMultipleAnswers; + } + public function getIsMultipleAnswers() { + return $this->isMultipleAnswers; + } + public function setImage(CommunityPollImage $image) { + $this->image = $image; + } + public function getImage() { + return $this->image; + } + public function setEndingTime($endingTime) { + $this->endingTime = $endingTime; + } + public function getEndingTime() { + return $this->endingTime; + } + public function setIsVotingAllowedForNonMembers($isVotingAllowedForNonMembers) { + $this->isVotingAllowedForNonMembers = $isVotingAllowedForNonMembers; + } + public function getIsVotingAllowedForNonMembers() { + return $this->isVotingAllowedForNonMembers; + } + public function setIsSpam($isSpam) { + $this->isSpam = $isSpam; + } + public function getIsSpam() { + return $this->isSpam; + } + public function setTotalNumberOfVotes($totalNumberOfVotes) { + $this->totalNumberOfVotes = $totalNumberOfVotes; + } + public function getTotalNumberOfVotes() { + return $this->totalNumberOfVotes; + } + public function setAuthor(OrkutAuthorResource $author) { + $this->author = $author; + } + public function getAuthor() { + return $this->author; + } + public function setQuestion($question) { + $this->question = $question; + } + public function getQuestion() { + return $this->question; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setIsRestricted($isRestricted) { + $this->isRestricted = $isRestricted; + } + public function getIsRestricted() { + return $this->isRestricted; + } + public function setCommunityId($communityId) { + $this->communityId = $communityId; + } + public function getCommunityId() { + return $this->communityId; + } + public function setIsUsersVotePublic($isUsersVotePublic) { + $this->isUsersVotePublic = $isUsersVotePublic; + } + public function getIsUsersVotePublic() { + return $this->isUsersVotePublic; + } + public function setLastUpdate($lastUpdate) { + $this->lastUpdate = $lastUpdate; + } + public function getLastUpdate() { + return $this->lastUpdate; + } + public function setDescription($description) { + $this->description = $description; + } + public function getDescription() { + return $this->description; + } + public function setVotedOptions(/* array(int) */ $votedOptions) { + $this->assertIsArray($votedOptions, 'int', __METHOD__); + $this->votedOptions = $votedOptions; + } + public function getVotedOptions() { + return $this->votedOptions; + } + public function setIsOpenForVoting($isOpenForVoting) { + $this->isOpenForVoting = $isOpenForVoting; + } + public function getIsOpenForVoting() { + return $this->isOpenForVoting; + } + public function setIsClosed($isClosed) { + $this->isClosed = $isClosed; + } + public function getIsClosed() { + return $this->isClosed; + } + public function setHasVoted($hasVoted) { + $this->hasVoted = $hasVoted; + } + public function getHasVoted() { + return $this->hasVoted; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setCreationTime($creationTime) { + $this->creationTime = $creationTime; + } + public function getCreationTime() { + return $this->creationTime; + } + public function setOptions(/* array(OrkutCommunitypolloptionResource) */ $options) { + $this->assertIsArray($options, 'OrkutCommunitypolloptionResource', __METHOD__); + $this->options = $options; + } + public function getOptions() { + return $this->options; + } +} + +class CommunityPollComment extends apiModel { + public $body; + public $kind; + public $addedDate; + public $id; + protected $__authorType = 'OrkutAuthorResource'; + protected $__authorDataType = ''; + public $author; + public function setBody($body) { + $this->body = $body; + } + public function getBody() { + return $this->body; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setAddedDate($addedDate) { + $this->addedDate = $addedDate; + } + public function getAddedDate() { + return $this->addedDate; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setAuthor(OrkutAuthorResource $author) { + $this->author = $author; + } + public function getAuthor() { + return $this->author; + } +} + +class CommunityPollCommentList extends apiModel { + public $nextPageToken; + public $kind; + protected $__itemsType = 'CommunityPollComment'; + protected $__itemsDataType = 'array'; + public $items; + public $prevPageToken; + public $lastPageToken; + public $firstPageToken; + public function setNextPageToken($nextPageToken) { + $this->nextPageToken = $nextPageToken; + } + public function getNextPageToken() { + return $this->nextPageToken; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setItems(/* array(CommunityPollComment) */ $items) { + $this->assertIsArray($items, 'CommunityPollComment', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setPrevPageToken($prevPageToken) { + $this->prevPageToken = $prevPageToken; + } + public function getPrevPageToken() { + return $this->prevPageToken; + } + public function setLastPageToken($lastPageToken) { + $this->lastPageToken = $lastPageToken; + } + public function getLastPageToken() { + return $this->lastPageToken; + } + public function setFirstPageToken($firstPageToken) { + $this->firstPageToken = $firstPageToken; + } + public function getFirstPageToken() { + return $this->firstPageToken; + } +} + +class CommunityPollImage extends apiModel { + public $url; + public function setUrl($url) { + $this->url = $url; + } + public function getUrl() { + return $this->url; + } +} + +class CommunityPollList extends apiModel { + public $nextPageToken; + public $kind; + protected $__itemsType = 'CommunityPoll'; + protected $__itemsDataType = 'array'; + public $items; + public $prevPageToken; + public $lastPageToken; + public $firstPageToken; + public function setNextPageToken($nextPageToken) { + $this->nextPageToken = $nextPageToken; + } + public function getNextPageToken() { + return $this->nextPageToken; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setItems(/* array(CommunityPoll) */ $items) { + $this->assertIsArray($items, 'CommunityPoll', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setPrevPageToken($prevPageToken) { + $this->prevPageToken = $prevPageToken; + } + public function getPrevPageToken() { + return $this->prevPageToken; + } + public function setLastPageToken($lastPageToken) { + $this->lastPageToken = $lastPageToken; + } + public function getLastPageToken() { + return $this->lastPageToken; + } + public function setFirstPageToken($firstPageToken) { + $this->firstPageToken = $firstPageToken; + } + public function getFirstPageToken() { + return $this->firstPageToken; + } +} + +class CommunityPollVote extends apiModel { + public $kind; + public $optionIds; + public $isVotevisible; + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setOptionIds(/* array(int) */ $optionIds) { + $this->assertIsArray($optionIds, 'int', __METHOD__); + $this->optionIds = $optionIds; + } + public function getOptionIds() { + return $this->optionIds; + } + public function setIsVotevisible($isVotevisible) { + $this->isVotevisible = $isVotevisible; + } + public function getIsVotevisible() { + return $this->isVotevisible; + } +} + +class CommunityTopic extends apiModel { + public $body; + public $lastUpdate; + public $kind; + protected $__linksType = 'OrkutLinkResource'; + protected $__linksDataType = 'array'; + public $links; + protected $__authorType = 'OrkutAuthorResource'; + protected $__authorDataType = ''; + public $author; + public $title; + protected $__messagesType = 'CommunityMessage'; + protected $__messagesDataType = 'array'; + public $messages; + public $latestMessageSnippet; + public $isClosed; + public $numberOfReplies; + public $id; + public function setBody($body) { + $this->body = $body; + } + public function getBody() { + return $this->body; + } + public function setLastUpdate($lastUpdate) { + $this->lastUpdate = $lastUpdate; + } + public function getLastUpdate() { + return $this->lastUpdate; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setLinks(/* array(OrkutLinkResource) */ $links) { + $this->assertIsArray($links, 'OrkutLinkResource', __METHOD__); + $this->links = $links; + } + public function getLinks() { + return $this->links; + } + public function setAuthor(OrkutAuthorResource $author) { + $this->author = $author; + } + public function getAuthor() { + return $this->author; + } + public function setTitle($title) { + $this->title = $title; + } + public function getTitle() { + return $this->title; + } + public function setMessages(/* array(CommunityMessage) */ $messages) { + $this->assertIsArray($messages, 'CommunityMessage', __METHOD__); + $this->messages = $messages; + } + public function getMessages() { + return $this->messages; + } + public function setLatestMessageSnippet($latestMessageSnippet) { + $this->latestMessageSnippet = $latestMessageSnippet; + } + public function getLatestMessageSnippet() { + return $this->latestMessageSnippet; + } + public function setIsClosed($isClosed) { + $this->isClosed = $isClosed; + } + public function getIsClosed() { + return $this->isClosed; + } + public function setNumberOfReplies($numberOfReplies) { + $this->numberOfReplies = $numberOfReplies; + } + public function getNumberOfReplies() { + return $this->numberOfReplies; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } +} + +class CommunityTopicList extends apiModel { + public $nextPageToken; + public $kind; + protected $__itemsType = 'CommunityTopic'; + protected $__itemsDataType = 'array'; + public $items; + public $prevPageToken; + public $lastPageToken; + public $firstPageToken; + public function setNextPageToken($nextPageToken) { + $this->nextPageToken = $nextPageToken; + } + public function getNextPageToken() { + return $this->nextPageToken; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setItems(/* array(CommunityTopic) */ $items) { + $this->assertIsArray($items, 'CommunityTopic', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setPrevPageToken($prevPageToken) { + $this->prevPageToken = $prevPageToken; + } + public function getPrevPageToken() { + return $this->prevPageToken; + } + public function setLastPageToken($lastPageToken) { + $this->lastPageToken = $lastPageToken; + } + public function getLastPageToken() { + return $this->lastPageToken; + } + public function setFirstPageToken($firstPageToken) { + $this->firstPageToken = $firstPageToken; + } + public function getFirstPageToken() { + return $this->firstPageToken; + } +} + +class Counters extends apiModel { + protected $__itemsType = 'OrkutCounterResource'; + protected $__itemsDataType = 'array'; + public $items; + public $kind; + public function setItems(/* array(OrkutCounterResource) */ $items) { + $this->assertIsArray($items, 'OrkutCounterResource', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } +} + +class OrkutActivityobjectsResource extends apiModel { + public $displayName; + protected $__linksType = 'OrkutLinkResource'; + protected $__linksDataType = 'array'; + public $links; + public $content; + protected $__personType = 'OrkutActivitypersonResource'; + protected $__personDataType = ''; + public $person; + public $id; + public $objectType; + public function setDisplayName($displayName) { + $this->displayName = $displayName; + } + public function getDisplayName() { + return $this->displayName; + } + public function setLinks(/* array(OrkutLinkResource) */ $links) { + $this->assertIsArray($links, 'OrkutLinkResource', __METHOD__); + $this->links = $links; + } + public function getLinks() { + return $this->links; + } + public function setContent($content) { + $this->content = $content; + } + public function getContent() { + return $this->content; + } + public function setPerson(OrkutActivitypersonResource $person) { + $this->person = $person; + } + public function getPerson() { + return $this->person; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setObjectType($objectType) { + $this->objectType = $objectType; + } + public function getObjectType() { + return $this->objectType; + } +} + +class OrkutActivitypersonResource extends apiModel { + protected $__nameType = 'OrkutActivitypersonResourceName'; + protected $__nameDataType = ''; + public $name; + public $url; + public $gender; + protected $__imageType = 'OrkutActivitypersonResourceImage'; + protected $__imageDataType = ''; + public $image; + public $birthday; + public $id; + public function setName(OrkutActivitypersonResourceName $name) { + $this->name = $name; + } + public function getName() { + return $this->name; + } + public function setUrl($url) { + $this->url = $url; + } + public function getUrl() { + return $this->url; + } + public function setGender($gender) { + $this->gender = $gender; + } + public function getGender() { + return $this->gender; + } + public function setImage(OrkutActivitypersonResourceImage $image) { + $this->image = $image; + } + public function getImage() { + return $this->image; + } + public function setBirthday($birthday) { + $this->birthday = $birthday; + } + public function getBirthday() { + return $this->birthday; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } +} + +class OrkutActivitypersonResourceImage extends apiModel { + public $url; + public function setUrl($url) { + $this->url = $url; + } + public function getUrl() { + return $this->url; + } +} + +class OrkutActivitypersonResourceName extends apiModel { + public $givenName; + public $familyName; + public function setGivenName($givenName) { + $this->givenName = $givenName; + } + public function getGivenName() { + return $this->givenName; + } + public function setFamilyName($familyName) { + $this->familyName = $familyName; + } + public function getFamilyName() { + return $this->familyName; + } +} + +class OrkutAuthorResource extends apiModel { + public $url; + protected $__imageType = 'OrkutAuthorResourceImage'; + protected $__imageDataType = ''; + public $image; + public $displayName; + public $id; + public function setUrl($url) { + $this->url = $url; + } + public function getUrl() { + return $this->url; + } + public function setImage(OrkutAuthorResourceImage $image) { + $this->image = $image; + } + public function getImage() { + return $this->image; + } + public function setDisplayName($displayName) { + $this->displayName = $displayName; + } + public function getDisplayName() { + return $this->displayName; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } +} + +class OrkutAuthorResourceImage extends apiModel { + public $url; + public function setUrl($url) { + $this->url = $url; + } + public function getUrl() { + return $this->url; + } +} + +class OrkutCommunitypolloptionResource extends apiModel { + protected $__imageType = 'OrkutCommunitypolloptionResourceImage'; + protected $__imageDataType = ''; + public $image; + public $optionId; + public $description; + public $numberOfVotes; + public function setImage(OrkutCommunitypolloptionResourceImage $image) { + $this->image = $image; + } + public function getImage() { + return $this->image; + } + public function setOptionId($optionId) { + $this->optionId = $optionId; + } + public function getOptionId() { + return $this->optionId; + } + public function setDescription($description) { + $this->description = $description; + } + public function getDescription() { + return $this->description; + } + public function setNumberOfVotes($numberOfVotes) { + $this->numberOfVotes = $numberOfVotes; + } + public function getNumberOfVotes() { + return $this->numberOfVotes; + } +} + +class OrkutCommunitypolloptionResourceImage extends apiModel { + public $url; + public function setUrl($url) { + $this->url = $url; + } + public function getUrl() { + return $this->url; + } +} + +class OrkutCounterResource extends apiModel { + public $total; + protected $__linkType = 'OrkutLinkResource'; + protected $__linkDataType = ''; + public $link; + public $name; + public function setTotal($total) { + $this->total = $total; + } + public function getTotal() { + return $this->total; + } + public function setLink(OrkutLinkResource $link) { + $this->link = $link; + } + public function getLink() { + return $this->link; + } + public function setName($name) { + $this->name = $name; + } + public function getName() { + return $this->name; + } +} + +class OrkutLinkResource extends apiModel { + public $href; + public $type; + public $rel; + public $title; + public function setHref($href) { + $this->href = $href; + } + public function getHref() { + return $this->href; + } + public function setType($type) { + $this->type = $type; + } + public function getType() { + return $this->type; + } + public function setRel($rel) { + $this->rel = $rel; + } + public function getRel() { + return $this->rel; + } + public function setTitle($title) { + $this->title = $title; + } + public function getTitle() { + return $this->title; + } +} + +class Visibility extends apiModel { + public $kind; + public $visibility; + protected $__linksType = 'OrkutLinkResource'; + protected $__linksDataType = 'array'; + public $links; + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setVisibility($visibility) { + $this->visibility = $visibility; + } + public function getVisibility() { + return $this->visibility; + } + public function setLinks(/* array(OrkutLinkResource) */ $links) { + $this->assertIsArray($links, 'OrkutLinkResource', __METHOD__); + $this->links = $links; + } + public function getLinks() { + return $this->links; + } +} diff --git a/webui/google-api/contrib/apiPagespeedonlineService.php b/webui/google-api/contrib/apiPagespeedonlineService.php new file mode 100644 index 0000000..e1cb0ac --- /dev/null +++ b/webui/google-api/contrib/apiPagespeedonlineService.php @@ -0,0 +1,482 @@ + + * $pagespeedonlineService = new apiPagespeedonlineService(...); + * $pagespeedapi = $pagespeedonlineService->pagespeedapi; + * + */ + class PagespeedapiServiceResource extends apiServiceResource { + + + /** + * Runs Page Speed analysis on the page at the specified URL, and returns a Page Speed score, a list + * of suggestions to make that page faster, and other information. (pagespeedapi.runpagespeed) + * + * @param string $url The URL to fetch and analyze + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string locale The locale used to localize formatted results + * @opt_param string rule A Page Speed rule to run; if none are given, all rules are run + * @opt_param string strategy The analysis strategy to use + * @return Result + */ + public function runpagespeed($url, $optParams = array()) { + $params = array('url' => $url); + $params = array_merge($params, $optParams); + $data = $this->__call('runpagespeed', array($params)); + if ($this->useObjects()) { + return new Result($data); + } else { + return $data; + } + } + } + + + +/** + * Service definition for Pagespeedonline (v1). + * + *

+ * Lets you analyze the performance of a web page and get tailored suggestions to make that page faster. + *

+ * + *

+ * For more information about this service, see the + * API Documentation + *

+ * + * @author Google, Inc. + */ +class apiPagespeedonlineService extends apiService { + public $pagespeedapi; + /** + * Constructs the internal representation of the Pagespeedonline service. + * + * @param apiClient apiClient + */ + public function __construct(apiClient $apiClient) { + $this->rpcPath = '/rpc'; + $this->restBasePath = '/pagespeedonline/v1/'; + $this->version = 'v1'; + $this->serviceName = 'pagespeedonline'; + + $apiClient->addService($this->serviceName, $this->version); + $this->pagespeedapi = new PagespeedapiServiceResource($this, $this->serviceName, 'pagespeedapi', json_decode('{"methods": {"runpagespeed": {"parameters": {"locale": {"type": "string", "location": "query"}, "url": {"required": true, "type": "string", "location": "query"}, "rule": {"repeated": true, "type": "string", "location": "query"}, "strategy": {"enum": ["desktop", "mobile"], "type": "string", "location": "query"}}, "id": "pagespeedonline.pagespeedapi.runpagespeed", "httpMethod": "GET", "path": "runPagespeed", "response": {"$ref": "Result"}}}}', true)); + } +} + +class Result extends apiModel { + public $kind; + protected $__formattedResultsType = 'ResultFormattedResults'; + protected $__formattedResultsDataType = ''; + public $formattedResults; + public $title; + protected $__versionType = 'ResultVersion'; + protected $__versionDataType = ''; + public $version; + public $score; + public $responseCode; + public $invalidRules; + protected $__pageStatsType = 'ResultPageStats'; + protected $__pageStatsDataType = ''; + public $pageStats; + public $id; + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setFormattedResults(ResultFormattedResults $formattedResults) { + $this->formattedResults = $formattedResults; + } + public function getFormattedResults() { + return $this->formattedResults; + } + public function setTitle($title) { + $this->title = $title; + } + public function getTitle() { + return $this->title; + } + public function setVersion(ResultVersion $version) { + $this->version = $version; + } + public function getVersion() { + return $this->version; + } + public function setScore($score) { + $this->score = $score; + } + public function getScore() { + return $this->score; + } + public function setResponseCode($responseCode) { + $this->responseCode = $responseCode; + } + public function getResponseCode() { + return $this->responseCode; + } + public function setInvalidRules(/* array(string) */ $invalidRules) { + $this->assertIsArray($invalidRules, 'string', __METHOD__); + $this->invalidRules = $invalidRules; + } + public function getInvalidRules() { + return $this->invalidRules; + } + public function setPageStats(ResultPageStats $pageStats) { + $this->pageStats = $pageStats; + } + public function getPageStats() { + return $this->pageStats; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } +} + +class ResultFormattedResults extends apiModel { + public $locale; + protected $__ruleResultsType = 'ResultFormattedResultsRuleResults'; + protected $__ruleResultsDataType = 'map'; + public $ruleResults; + public function setLocale($locale) { + $this->locale = $locale; + } + public function getLocale() { + return $this->locale; + } + public function setRuleResults(ResultFormattedResultsRuleResults $ruleResults) { + $this->ruleResults = $ruleResults; + } + public function getRuleResults() { + return $this->ruleResults; + } +} + +class ResultFormattedResultsRuleResults extends apiModel { + public $localizedRuleName; + protected $__urlBlocksType = 'ResultFormattedResultsRuleResultsUrlBlocks'; + protected $__urlBlocksDataType = 'array'; + public $urlBlocks; + public $ruleScore; + public $ruleImpact; + public function setLocalizedRuleName($localizedRuleName) { + $this->localizedRuleName = $localizedRuleName; + } + public function getLocalizedRuleName() { + return $this->localizedRuleName; + } + public function setUrlBlocks(/* array(ResultFormattedResultsRuleResultsUrlBlocks) */ $urlBlocks) { + $this->assertIsArray($urlBlocks, 'ResultFormattedResultsRuleResultsUrlBlocks', __METHOD__); + $this->urlBlocks = $urlBlocks; + } + public function getUrlBlocks() { + return $this->urlBlocks; + } + public function setRuleScore($ruleScore) { + $this->ruleScore = $ruleScore; + } + public function getRuleScore() { + return $this->ruleScore; + } + public function setRuleImpact($ruleImpact) { + $this->ruleImpact = $ruleImpact; + } + public function getRuleImpact() { + return $this->ruleImpact; + } +} + +class ResultFormattedResultsRuleResultsUrlBlocks extends apiModel { + protected $__headerType = 'ResultFormattedResultsRuleResultsUrlBlocksHeader'; + protected $__headerDataType = ''; + public $header; + protected $__urlsType = 'ResultFormattedResultsRuleResultsUrlBlocksUrls'; + protected $__urlsDataType = 'array'; + public $urls; + public function setHeader(ResultFormattedResultsRuleResultsUrlBlocksHeader $header) { + $this->header = $header; + } + public function getHeader() { + return $this->header; + } + public function setUrls(/* array(ResultFormattedResultsRuleResultsUrlBlocksUrls) */ $urls) { + $this->assertIsArray($urls, 'ResultFormattedResultsRuleResultsUrlBlocksUrls', __METHOD__); + $this->urls = $urls; + } + public function getUrls() { + return $this->urls; + } +} + +class ResultFormattedResultsRuleResultsUrlBlocksHeader extends apiModel { + protected $__argsType = 'ResultFormattedResultsRuleResultsUrlBlocksHeaderArgs'; + protected $__argsDataType = 'array'; + public $args; + public $format; + public function setArgs(/* array(ResultFormattedResultsRuleResultsUrlBlocksHeaderArgs) */ $args) { + $this->assertIsArray($args, 'ResultFormattedResultsRuleResultsUrlBlocksHeaderArgs', __METHOD__); + $this->args = $args; + } + public function getArgs() { + return $this->args; + } + public function setFormat($format) { + $this->format = $format; + } + public function getFormat() { + return $this->format; + } +} + +class ResultFormattedResultsRuleResultsUrlBlocksHeaderArgs extends apiModel { + public $type; + public $value; + public function setType($type) { + $this->type = $type; + } + public function getType() { + return $this->type; + } + public function setValue($value) { + $this->value = $value; + } + public function getValue() { + return $this->value; + } +} + +class ResultFormattedResultsRuleResultsUrlBlocksUrls extends apiModel { + protected $__detailsType = 'ResultFormattedResultsRuleResultsUrlBlocksUrlsDetails'; + protected $__detailsDataType = 'array'; + public $details; + protected $__resultType = 'ResultFormattedResultsRuleResultsUrlBlocksUrlsResult'; + protected $__resultDataType = ''; + public $result; + public function setDetails(/* array(ResultFormattedResultsRuleResultsUrlBlocksUrlsDetails) */ $details) { + $this->assertIsArray($details, 'ResultFormattedResultsRuleResultsUrlBlocksUrlsDetails', __METHOD__); + $this->details = $details; + } + public function getDetails() { + return $this->details; + } + public function setResult(ResultFormattedResultsRuleResultsUrlBlocksUrlsResult $result) { + $this->result = $result; + } + public function getResult() { + return $this->result; + } +} + +class ResultFormattedResultsRuleResultsUrlBlocksUrlsDetails extends apiModel { + protected $__argsType = 'ResultFormattedResultsRuleResultsUrlBlocksUrlsDetailsArgs'; + protected $__argsDataType = 'array'; + public $args; + public $format; + public function setArgs(/* array(ResultFormattedResultsRuleResultsUrlBlocksUrlsDetailsArgs) */ $args) { + $this->assertIsArray($args, 'ResultFormattedResultsRuleResultsUrlBlocksUrlsDetailsArgs', __METHOD__); + $this->args = $args; + } + public function getArgs() { + return $this->args; + } + public function setFormat($format) { + $this->format = $format; + } + public function getFormat() { + return $this->format; + } +} + +class ResultFormattedResultsRuleResultsUrlBlocksUrlsDetailsArgs extends apiModel { + public $type; + public $value; + public function setType($type) { + $this->type = $type; + } + public function getType() { + return $this->type; + } + public function setValue($value) { + $this->value = $value; + } + public function getValue() { + return $this->value; + } +} + +class ResultFormattedResultsRuleResultsUrlBlocksUrlsResult extends apiModel { + protected $__argsType = 'ResultFormattedResultsRuleResultsUrlBlocksUrlsResultArgs'; + protected $__argsDataType = 'array'; + public $args; + public $format; + public function setArgs(/* array(ResultFormattedResultsRuleResultsUrlBlocksUrlsResultArgs) */ $args) { + $this->assertIsArray($args, 'ResultFormattedResultsRuleResultsUrlBlocksUrlsResultArgs', __METHOD__); + $this->args = $args; + } + public function getArgs() { + return $this->args; + } + public function setFormat($format) { + $this->format = $format; + } + public function getFormat() { + return $this->format; + } +} + +class ResultFormattedResultsRuleResultsUrlBlocksUrlsResultArgs extends apiModel { + public $type; + public $value; + public function setType($type) { + $this->type = $type; + } + public function getType() { + return $this->type; + } + public function setValue($value) { + $this->value = $value; + } + public function getValue() { + return $this->value; + } +} + +class ResultPageStats extends apiModel { + public $otherResponseBytes; + public $flashResponseBytes; + public $totalRequestBytes; + public $numberCssResources; + public $numberResources; + public $cssResponseBytes; + public $javascriptResponseBytes; + public $imageResponseBytes; + public $numberHosts; + public $numberStaticResources; + public $htmlResponseBytes; + public $numberJsResources; + public $textResponseBytes; + public function setOtherResponseBytes($otherResponseBytes) { + $this->otherResponseBytes = $otherResponseBytes; + } + public function getOtherResponseBytes() { + return $this->otherResponseBytes; + } + public function setFlashResponseBytes($flashResponseBytes) { + $this->flashResponseBytes = $flashResponseBytes; + } + public function getFlashResponseBytes() { + return $this->flashResponseBytes; + } + public function setTotalRequestBytes($totalRequestBytes) { + $this->totalRequestBytes = $totalRequestBytes; + } + public function getTotalRequestBytes() { + return $this->totalRequestBytes; + } + public function setNumberCssResources($numberCssResources) { + $this->numberCssResources = $numberCssResources; + } + public function getNumberCssResources() { + return $this->numberCssResources; + } + public function setNumberResources($numberResources) { + $this->numberResources = $numberResources; + } + public function getNumberResources() { + return $this->numberResources; + } + public function setCssResponseBytes($cssResponseBytes) { + $this->cssResponseBytes = $cssResponseBytes; + } + public function getCssResponseBytes() { + return $this->cssResponseBytes; + } + public function setJavascriptResponseBytes($javascriptResponseBytes) { + $this->javascriptResponseBytes = $javascriptResponseBytes; + } + public function getJavascriptResponseBytes() { + return $this->javascriptResponseBytes; + } + public function setImageResponseBytes($imageResponseBytes) { + $this->imageResponseBytes = $imageResponseBytes; + } + public function getImageResponseBytes() { + return $this->imageResponseBytes; + } + public function setNumberHosts($numberHosts) { + $this->numberHosts = $numberHosts; + } + public function getNumberHosts() { + return $this->numberHosts; + } + public function setNumberStaticResources($numberStaticResources) { + $this->numberStaticResources = $numberStaticResources; + } + public function getNumberStaticResources() { + return $this->numberStaticResources; + } + public function setHtmlResponseBytes($htmlResponseBytes) { + $this->htmlResponseBytes = $htmlResponseBytes; + } + public function getHtmlResponseBytes() { + return $this->htmlResponseBytes; + } + public function setNumberJsResources($numberJsResources) { + $this->numberJsResources = $numberJsResources; + } + public function getNumberJsResources() { + return $this->numberJsResources; + } + public function setTextResponseBytes($textResponseBytes) { + $this->textResponseBytes = $textResponseBytes; + } + public function getTextResponseBytes() { + return $this->textResponseBytes; + } +} + +class ResultVersion extends apiModel { + public $major; + public $minor; + public function setMajor($major) { + $this->major = $major; + } + public function getMajor() { + return $this->major; + } + public function setMinor($minor) { + $this->minor = $minor; + } + public function getMinor() { + return $this->minor; + } +} diff --git a/webui/google-api/contrib/apiPlusService.php b/webui/google-api/contrib/apiPlusService.php new file mode 100644 index 0000000..adda9e1 --- /dev/null +++ b/webui/google-api/contrib/apiPlusService.php @@ -0,0 +1,1525 @@ + + * $plusService = new apiPlusService(...); + * $activities = $plusService->activities; + * + */ + class ActivitiesServiceResource extends apiServiceResource { + + + /** + * Search public activities. (activities.search) + * + * @param string $query Full-text search query string. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string orderBy Specifies how to order search results. + * @opt_param string pageToken The continuation token, used to page through large result sets. To get the next page of results, set this parameter to the value of "nextPageToken" from the previous response. This token may be of any length. + * @opt_param string maxResults The maximum number of activities to include in the response, used for paging. For any response, the actual number returned may be less than the specified maxResults. + * @opt_param string language Specify the preferred language to search with. See search language codes for available values. + * @return ActivityFeed + */ + public function search($query, $optParams = array()) { + $params = array('query' => $query); + $params = array_merge($params, $optParams); + $data = $this->__call('search', array($params)); + if ($this->useObjects()) { + return new ActivityFeed($data); + } else { + return $data; + } + } + /** + * List all of the activities in the specified collection for a particular user. (activities.list) + * + * @param string $userId The ID of the user to get activities for. The special value "me" can be used to indicate the authenticated user. + * @param string $collection The collection of activities to list. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string pageToken The continuation token, used to page through large result sets. To get the next page of results, set this parameter to the value of "nextPageToken" from the previous response. + * @opt_param string maxResults The maximum number of activities to include in the response, used for paging. For any response, the actual number returned may be less than the specified maxResults. + * @return ActivityFeed + */ + public function listActivities($userId, $collection, $optParams = array()) { + $params = array('userId' => $userId, 'collection' => $collection); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new ActivityFeed($data); + } else { + return $data; + } + } + /** + * Get an activity. (activities.get) + * + * @param string $activityId The ID of the activity to get. + * @return Activity + */ + public function get($activityId, $optParams = array()) { + $params = array('activityId' => $activityId); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new Activity($data); + } else { + return $data; + } + } + } + + /** + * The "comments" collection of methods. + * Typical usage is: + * + * $plusService = new apiPlusService(...); + * $comments = $plusService->comments; + * + */ + class CommentsServiceResource extends apiServiceResource { + + + /** + * List all of the comments for an activity. (comments.list) + * + * @param string $activityId The ID of the activity to get comments for. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string pageToken The continuation token, used to page through large result sets. To get the next page of results, set this parameter to the value of "nextPageToken" from the previous response. + * @opt_param string maxResults The maximum number of comments to include in the response, used for paging. For any response, the actual number returned may be less than the specified maxResults. + * @return CommentFeed + */ + public function listComments($activityId, $optParams = array()) { + $params = array('activityId' => $activityId); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new CommentFeed($data); + } else { + return $data; + } + } + /** + * Get a comment. (comments.get) + * + * @param string $commentId The ID of the comment to get. + * @return Comment + */ + public function get($commentId, $optParams = array()) { + $params = array('commentId' => $commentId); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new Comment($data); + } else { + return $data; + } + } + } + + /** + * The "people" collection of methods. + * Typical usage is: + * + * $plusService = new apiPlusService(...); + * $people = $plusService->people; + * + */ + class PeopleServiceResource extends apiServiceResource { + + + /** + * List all of the people in the specified collection for a particular activity. + * (people.listByActivity) + * + * @param string $activityId The ID of the activity to get the list of people for. + * @param string $collection The collection of people to list. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string pageToken The continuation token, used to page through large result sets. To get the next page of results, set this parameter to the value of "nextPageToken" from the previous response. + * @opt_param string maxResults The maximum number of people to include in the response, used for paging. For any response, the actual number returned may be less than the specified maxResults. + * @return PeopleFeed + */ + public function listByActivity($activityId, $collection, $optParams = array()) { + $params = array('activityId' => $activityId, 'collection' => $collection); + $params = array_merge($params, $optParams); + $data = $this->__call('listByActivity', array($params)); + if ($this->useObjects()) { + return new PeopleFeed($data); + } else { + return $data; + } + } + /** + * Search all public profiles. (people.search) + * + * @param string $query Full-text search query string. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string pageToken The continuation token, used to page through large result sets. To get the next page of results, set this parameter to the value of "nextPageToken" from the previous response. This token may be of any length. + * @opt_param string maxResults The maximum number of people to include in the response, used for paging. For any response, the actual number returned may be less than the specified maxResults. + * @opt_param string language Specify the preferred language to search with. See search language codes for available values. + * @return PeopleFeed + */ + public function search($query, $optParams = array()) { + $params = array('query' => $query); + $params = array_merge($params, $optParams); + $data = $this->__call('search', array($params)); + if ($this->useObjects()) { + return new PeopleFeed($data); + } else { + return $data; + } + } + /** + * Get a person's profile. (people.get) + * + * @param string $userId The ID of the person to get the profile for. The special value "me" can be used to indicate the authenticated user. + * @return Person + */ + public function get($userId, $optParams = array()) { + $params = array('userId' => $userId); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new Person($data); + } else { + return $data; + } + } + } + + + +/** + * Service definition for Plus (v1). + * + *

+ * The Google+ API enables developers to build on top of the Google+ platform. + *

+ * + *

+ * For more information about this service, see the + * API Documentation + *

+ * + * @author Google, Inc. + */ +class apiPlusService extends apiService { + public $activities; + public $comments; + public $people; + /** + * Constructs the internal representation of the Plus service. + * + * @param apiClient apiClient + */ + public function __construct(apiClient $apiClient) { + $this->rpcPath = '/rpc'; + $this->restBasePath = '/plus/v1/'; + $this->version = 'v1'; + $this->serviceName = 'plus'; + + $apiClient->addService($this->serviceName, $this->version); + $this->activities = new ActivitiesServiceResource($this, $this->serviceName, 'activities', json_decode('{"methods": {"search": {"scopes": ["https://www.googleapis.com/auth/plus.me"], "parameters": {"orderBy": {"default": "recent", "enum": ["best", "recent"], "location": "query", "type": "string"}, "pageToken": {"type": "string", "location": "query"}, "language": {"default": "", "type": "string", "location": "query"}, "maxResults": {"format": "uint32", "default": "10", "maximum": "20", "minimum": "1", "location": "query", "type": "integer"}, "query": {"required": true, "type": "string", "location": "query"}}, "id": "plus.activities.search", "httpMethod": "GET", "path": "activities", "response": {"$ref": "ActivityFeed"}}, "list": {"scopes": ["https://www.googleapis.com/auth/plus.me"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "alt": {"default": "json", "enum": ["json"], "location": "query", "type": "string"}, "userId": {"required": true, "type": "string", "location": "path"}, "collection": {"required": true, "enum": ["public"], "location": "path", "type": "string"}, "maxResults": {"format": "uint32", "default": "20", "maximum": "100", "minimum": "1", "location": "query", "type": "integer"}}, "id": "plus.activities.list", "httpMethod": "GET", "path": "people/{userId}/activities/{collection}", "response": {"$ref": "ActivityFeed"}}, "get": {"scopes": ["https://www.googleapis.com/auth/plus.me"], "parameters": {"activityId": {"required": true, "type": "string", "location": "path"}, "alt": {"default": "json", "enum": ["json"], "location": "query", "type": "string"}}, "id": "plus.activities.get", "httpMethod": "GET", "path": "activities/{activityId}", "response": {"$ref": "Activity"}}}}', true)); + $this->comments = new CommentsServiceResource($this, $this->serviceName, 'comments', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/plus.me"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "activityId": {"required": true, "type": "string", "location": "path"}, "alt": {"default": "json", "enum": ["json"], "location": "query", "type": "string"}, "maxResults": {"format": "uint32", "default": "20", "maximum": "100", "minimum": "0", "location": "query", "type": "integer"}}, "id": "plus.comments.list", "httpMethod": "GET", "path": "activities/{activityId}/comments", "response": {"$ref": "CommentFeed"}}, "get": {"scopes": ["https://www.googleapis.com/auth/plus.me"], "parameters": {"commentId": {"required": true, "type": "string", "location": "path"}}, "id": "plus.comments.get", "httpMethod": "GET", "path": "comments/{commentId}", "response": {"$ref": "Comment"}}}}', true)); + $this->people = new PeopleServiceResource($this, $this->serviceName, 'people', json_decode('{"methods": {"listByActivity": {"scopes": ["https://www.googleapis.com/auth/plus.me"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "activityId": {"required": true, "type": "string", "location": "path"}, "collection": {"required": true, "enum": ["plusoners", "resharers"], "location": "path", "type": "string"}, "maxResults": {"format": "uint32", "default": "20", "maximum": "100", "minimum": "1", "location": "query", "type": "integer"}}, "id": "plus.people.listByActivity", "httpMethod": "GET", "path": "activities/{activityId}/people/{collection}", "response": {"$ref": "PeopleFeed"}}, "search": {"scopes": ["https://www.googleapis.com/auth/plus.me"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "language": {"default": "", "type": "string", "location": "query"}, "maxResults": {"format": "uint32", "default": "10", "maximum": "20", "minimum": "1", "location": "query", "type": "integer"}, "query": {"required": true, "type": "string", "location": "query"}}, "id": "plus.people.search", "httpMethod": "GET", "path": "people", "response": {"$ref": "PeopleFeed"}}, "get": {"scopes": ["https://www.googleapis.com/auth/plus.me", "https://www.googleapis.com/auth/userinfo.email"], "parameters": {"userId": {"required": true, "type": "string", "location": "path"}}, "id": "plus.people.get", "httpMethod": "GET", "path": "people/{userId}", "response": {"$ref": "Person"}}}}', true)); + } +} + +class Acl extends apiModel { + protected $__itemsType = 'PlusAclentryResource'; + protected $__itemsDataType = 'array'; + public $items; + public $kind; + public $description; + public function setItems(/* array(PlusAclentryResource) */ $items) { + $this->assertIsArray($items, 'PlusAclentryResource', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setDescription($description) { + $this->description = $description; + } + public function getDescription() { + return $this->description; + } +} + +class Activity extends apiModel { + public $placeName; + public $kind; + public $updated; + protected $__providerType = 'ActivityProvider'; + protected $__providerDataType = ''; + public $provider; + public $title; + public $url; + public $geocode; + protected $__objectType = 'ActivityObject'; + protected $__objectDataType = ''; + public $object; + public $placeId; + protected $__actorType = 'ActivityActor'; + protected $__actorDataType = ''; + public $actor; + public $id; + protected $__accessType = 'Acl'; + protected $__accessDataType = ''; + public $access; + public $verb; + public $etag; + public $radius; + public $address; + public $crosspostSource; + public $placeholder; + public $annotation; + public $published; + public function setPlaceName($placeName) { + $this->placeName = $placeName; + } + public function getPlaceName() { + return $this->placeName; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setUpdated($updated) { + $this->updated = $updated; + } + public function getUpdated() { + return $this->updated; + } + public function setProvider(ActivityProvider $provider) { + $this->provider = $provider; + } + public function getProvider() { + return $this->provider; + } + public function setTitle($title) { + $this->title = $title; + } + public function getTitle() { + return $this->title; + } + public function setUrl($url) { + $this->url = $url; + } + public function getUrl() { + return $this->url; + } + public function setGeocode($geocode) { + $this->geocode = $geocode; + } + public function getGeocode() { + return $this->geocode; + } + public function setObject(ActivityObject $object) { + $this->object = $object; + } + public function getObject() { + return $this->object; + } + public function setPlaceId($placeId) { + $this->placeId = $placeId; + } + public function getPlaceId() { + return $this->placeId; + } + public function setActor(ActivityActor $actor) { + $this->actor = $actor; + } + public function getActor() { + return $this->actor; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setAccess(Acl $access) { + $this->access = $access; + } + public function getAccess() { + return $this->access; + } + public function setVerb($verb) { + $this->verb = $verb; + } + public function getVerb() { + return $this->verb; + } + public function setEtag($etag) { + $this->etag = $etag; + } + public function getEtag() { + return $this->etag; + } + public function setRadius($radius) { + $this->radius = $radius; + } + public function getRadius() { + return $this->radius; + } + public function setAddress($address) { + $this->address = $address; + } + public function getAddress() { + return $this->address; + } + public function setCrosspostSource($crosspostSource) { + $this->crosspostSource = $crosspostSource; + } + public function getCrosspostSource() { + return $this->crosspostSource; + } + public function setPlaceholder($placeholder) { + $this->placeholder = $placeholder; + } + public function getPlaceholder() { + return $this->placeholder; + } + public function setAnnotation($annotation) { + $this->annotation = $annotation; + } + public function getAnnotation() { + return $this->annotation; + } + public function setPublished($published) { + $this->published = $published; + } + public function getPublished() { + return $this->published; + } +} + +class ActivityActor extends apiModel { + public $displayName; + public $url; + protected $__imageType = 'ActivityActorImage'; + protected $__imageDataType = ''; + public $image; + public $familyName; + public $givenName; + public $id; + public function setDisplayName($displayName) { + $this->displayName = $displayName; + } + public function getDisplayName() { + return $this->displayName; + } + public function setUrl($url) { + $this->url = $url; + } + public function getUrl() { + return $this->url; + } + public function setImage(ActivityActorImage $image) { + $this->image = $image; + } + public function getImage() { + return $this->image; + } + public function setFamilyName($familyName) { + $this->familyName = $familyName; + } + public function getFamilyName() { + return $this->familyName; + } + public function setGivenName($givenName) { + $this->givenName = $givenName; + } + public function getGivenName() { + return $this->givenName; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } +} + +class ActivityActorImage extends apiModel { + public $url; + public function setUrl($url) { + $this->url = $url; + } + public function getUrl() { + return $this->url; + } +} + +class ActivityFeed extends apiModel { + public $nextPageToken; + public $kind; + public $title; + protected $__itemsType = 'Activity'; + protected $__itemsDataType = 'array'; + public $items; + public $updated; + public $nextLink; + public $etag; + public $id; + public $selfLink; + public function setNextPageToken($nextPageToken) { + $this->nextPageToken = $nextPageToken; + } + public function getNextPageToken() { + return $this->nextPageToken; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setTitle($title) { + $this->title = $title; + } + public function getTitle() { + return $this->title; + } + public function setItems(/* array(Activity) */ $items) { + $this->assertIsArray($items, 'Activity', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setUpdated($updated) { + $this->updated = $updated; + } + public function getUpdated() { + return $this->updated; + } + public function setNextLink($nextLink) { + $this->nextLink = $nextLink; + } + public function getNextLink() { + return $this->nextLink; + } + public function setEtag($etag) { + $this->etag = $etag; + } + public function getEtag() { + return $this->etag; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setSelfLink($selfLink) { + $this->selfLink = $selfLink; + } + public function getSelfLink() { + return $this->selfLink; + } +} + +class ActivityObject extends apiModel { + protected $__resharersType = 'ActivityObjectResharers'; + protected $__resharersDataType = ''; + public $resharers; + protected $__attachmentsType = 'ActivityObjectAttachments'; + protected $__attachmentsDataType = 'array'; + public $attachments; + public $originalContent; + protected $__plusonersType = 'ActivityObjectPlusoners'; + protected $__plusonersDataType = ''; + public $plusoners; + protected $__actorType = 'ActivityObjectActor'; + protected $__actorDataType = ''; + public $actor; + public $content; + public $url; + protected $__repliesType = 'ActivityObjectReplies'; + protected $__repliesDataType = ''; + public $replies; + public $id; + public $objectType; + public function setResharers(ActivityObjectResharers $resharers) { + $this->resharers = $resharers; + } + public function getResharers() { + return $this->resharers; + } + public function setAttachments(/* array(ActivityObjectAttachments) */ $attachments) { + $this->assertIsArray($attachments, 'ActivityObjectAttachments', __METHOD__); + $this->attachments = $attachments; + } + public function getAttachments() { + return $this->attachments; + } + public function setOriginalContent($originalContent) { + $this->originalContent = $originalContent; + } + public function getOriginalContent() { + return $this->originalContent; + } + public function setPlusoners(ActivityObjectPlusoners $plusoners) { + $this->plusoners = $plusoners; + } + public function getPlusoners() { + return $this->plusoners; + } + public function setActor(ActivityObjectActor $actor) { + $this->actor = $actor; + } + public function getActor() { + return $this->actor; + } + public function setContent($content) { + $this->content = $content; + } + public function getContent() { + return $this->content; + } + public function setUrl($url) { + $this->url = $url; + } + public function getUrl() { + return $this->url; + } + public function setReplies(ActivityObjectReplies $replies) { + $this->replies = $replies; + } + public function getReplies() { + return $this->replies; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setObjectType($objectType) { + $this->objectType = $objectType; + } + public function getObjectType() { + return $this->objectType; + } +} + +class ActivityObjectActor extends apiModel { + public $url; + protected $__imageType = 'ActivityObjectActorImage'; + protected $__imageDataType = ''; + public $image; + public $displayName; + public $id; + public function setUrl($url) { + $this->url = $url; + } + public function getUrl() { + return $this->url; + } + public function setImage(ActivityObjectActorImage $image) { + $this->image = $image; + } + public function getImage() { + return $this->image; + } + public function setDisplayName($displayName) { + $this->displayName = $displayName; + } + public function getDisplayName() { + return $this->displayName; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } +} + +class ActivityObjectActorImage extends apiModel { + public $url; + public function setUrl($url) { + $this->url = $url; + } + public function getUrl() { + return $this->url; + } +} + +class ActivityObjectAttachments extends apiModel { + public $displayName; + protected $__fullImageType = 'ActivityObjectAttachmentsFullImage'; + protected $__fullImageDataType = ''; + public $fullImage; + public $url; + protected $__imageType = 'ActivityObjectAttachmentsImage'; + protected $__imageDataType = ''; + public $image; + public $content; + protected $__embedType = 'ActivityObjectAttachmentsEmbed'; + protected $__embedDataType = ''; + public $embed; + public $id; + public $objectType; + public function setDisplayName($displayName) { + $this->displayName = $displayName; + } + public function getDisplayName() { + return $this->displayName; + } + public function setFullImage(ActivityObjectAttachmentsFullImage $fullImage) { + $this->fullImage = $fullImage; + } + public function getFullImage() { + return $this->fullImage; + } + public function setUrl($url) { + $this->url = $url; + } + public function getUrl() { + return $this->url; + } + public function setImage(ActivityObjectAttachmentsImage $image) { + $this->image = $image; + } + public function getImage() { + return $this->image; + } + public function setContent($content) { + $this->content = $content; + } + public function getContent() { + return $this->content; + } + public function setEmbed(ActivityObjectAttachmentsEmbed $embed) { + $this->embed = $embed; + } + public function getEmbed() { + return $this->embed; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setObjectType($objectType) { + $this->objectType = $objectType; + } + public function getObjectType() { + return $this->objectType; + } +} + +class ActivityObjectAttachmentsEmbed extends apiModel { + public $url; + public $type; + public function setUrl($url) { + $this->url = $url; + } + public function getUrl() { + return $this->url; + } + public function setType($type) { + $this->type = $type; + } + public function getType() { + return $this->type; + } +} + +class ActivityObjectAttachmentsFullImage extends apiModel { + public $url; + public $width; + public $type; + public $height; + public function setUrl($url) { + $this->url = $url; + } + public function getUrl() { + return $this->url; + } + public function setWidth($width) { + $this->width = $width; + } + public function getWidth() { + return $this->width; + } + public function setType($type) { + $this->type = $type; + } + public function getType() { + return $this->type; + } + public function setHeight($height) { + $this->height = $height; + } + public function getHeight() { + return $this->height; + } +} + +class ActivityObjectAttachmentsImage extends apiModel { + public $url; + public $width; + public $type; + public $height; + public function setUrl($url) { + $this->url = $url; + } + public function getUrl() { + return $this->url; + } + public function setWidth($width) { + $this->width = $width; + } + public function getWidth() { + return $this->width; + } + public function setType($type) { + $this->type = $type; + } + public function getType() { + return $this->type; + } + public function setHeight($height) { + $this->height = $height; + } + public function getHeight() { + return $this->height; + } +} + +class ActivityObjectPlusoners extends apiModel { + public $totalItems; + public $selfLink; + public function setTotalItems($totalItems) { + $this->totalItems = $totalItems; + } + public function getTotalItems() { + return $this->totalItems; + } + public function setSelfLink($selfLink) { + $this->selfLink = $selfLink; + } + public function getSelfLink() { + return $this->selfLink; + } +} + +class ActivityObjectReplies extends apiModel { + public $totalItems; + public $selfLink; + public function setTotalItems($totalItems) { + $this->totalItems = $totalItems; + } + public function getTotalItems() { + return $this->totalItems; + } + public function setSelfLink($selfLink) { + $this->selfLink = $selfLink; + } + public function getSelfLink() { + return $this->selfLink; + } +} + +class ActivityObjectResharers extends apiModel { + public $totalItems; + public $selfLink; + public function setTotalItems($totalItems) { + $this->totalItems = $totalItems; + } + public function getTotalItems() { + return $this->totalItems; + } + public function setSelfLink($selfLink) { + $this->selfLink = $selfLink; + } + public function getSelfLink() { + return $this->selfLink; + } +} + +class ActivityProvider extends apiModel { + public $title; + public function setTitle($title) { + $this->title = $title; + } + public function getTitle() { + return $this->title; + } +} + +class Comment extends apiModel { + protected $__inReplyToType = 'CommentInReplyTo'; + protected $__inReplyToDataType = 'array'; + public $inReplyTo; + public $kind; + protected $__objectType = 'CommentObject'; + protected $__objectDataType = ''; + public $object; + public $updated; + protected $__actorType = 'CommentActor'; + protected $__actorDataType = ''; + public $actor; + public $verb; + public $etag; + public $published; + public $id; + public $selfLink; + public function setInReplyTo(/* array(CommentInReplyTo) */ $inReplyTo) { + $this->assertIsArray($inReplyTo, 'CommentInReplyTo', __METHOD__); + $this->inReplyTo = $inReplyTo; + } + public function getInReplyTo() { + return $this->inReplyTo; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setObject(CommentObject $object) { + $this->object = $object; + } + public function getObject() { + return $this->object; + } + public function setUpdated($updated) { + $this->updated = $updated; + } + public function getUpdated() { + return $this->updated; + } + public function setActor(CommentActor $actor) { + $this->actor = $actor; + } + public function getActor() { + return $this->actor; + } + public function setVerb($verb) { + $this->verb = $verb; + } + public function getVerb() { + return $this->verb; + } + public function setEtag($etag) { + $this->etag = $etag; + } + public function getEtag() { + return $this->etag; + } + public function setPublished($published) { + $this->published = $published; + } + public function getPublished() { + return $this->published; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setSelfLink($selfLink) { + $this->selfLink = $selfLink; + } + public function getSelfLink() { + return $this->selfLink; + } +} + +class CommentActor extends apiModel { + public $url; + protected $__imageType = 'CommentActorImage'; + protected $__imageDataType = ''; + public $image; + public $displayName; + public $id; + public function setUrl($url) { + $this->url = $url; + } + public function getUrl() { + return $this->url; + } + public function setImage(CommentActorImage $image) { + $this->image = $image; + } + public function getImage() { + return $this->image; + } + public function setDisplayName($displayName) { + $this->displayName = $displayName; + } + public function getDisplayName() { + return $this->displayName; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } +} + +class CommentActorImage extends apiModel { + public $url; + public function setUrl($url) { + $this->url = $url; + } + public function getUrl() { + return $this->url; + } +} + +class CommentFeed extends apiModel { + public $nextPageToken; + public $kind; + public $title; + protected $__itemsType = 'Comment'; + protected $__itemsDataType = 'array'; + public $items; + public $updated; + public $nextLink; + public $etag; + public $id; + public function setNextPageToken($nextPageToken) { + $this->nextPageToken = $nextPageToken; + } + public function getNextPageToken() { + return $this->nextPageToken; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setTitle($title) { + $this->title = $title; + } + public function getTitle() { + return $this->title; + } + public function setItems(/* array(Comment) */ $items) { + $this->assertIsArray($items, 'Comment', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setUpdated($updated) { + $this->updated = $updated; + } + public function getUpdated() { + return $this->updated; + } + public function setNextLink($nextLink) { + $this->nextLink = $nextLink; + } + public function getNextLink() { + return $this->nextLink; + } + public function setEtag($etag) { + $this->etag = $etag; + } + public function getEtag() { + return $this->etag; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } +} + +class CommentInReplyTo extends apiModel { + public $url; + public $id; + public function setUrl($url) { + $this->url = $url; + } + public function getUrl() { + return $this->url; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } +} + +class CommentObject extends apiModel { + public $content; + public $objectType; + public function setContent($content) { + $this->content = $content; + } + public function getContent() { + return $this->content; + } + public function setObjectType($objectType) { + $this->objectType = $objectType; + } + public function getObjectType() { + return $this->objectType; + } +} + +class PeopleFeed extends apiModel { + public $nextPageToken; + public $kind; + public $title; + protected $__itemsType = 'Person'; + protected $__itemsDataType = 'array'; + public $items; + public $etag; + public $selfLink; + public function setNextPageToken($nextPageToken) { + $this->nextPageToken = $nextPageToken; + } + public function getNextPageToken() { + return $this->nextPageToken; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setTitle($title) { + $this->title = $title; + } + public function getTitle() { + return $this->title; + } + public function setItems(/* array(Person) */ $items) { + $this->assertIsArray($items, 'Person', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setEtag($etag) { + $this->etag = $etag; + } + public function getEtag() { + return $this->etag; + } + public function setSelfLink($selfLink) { + $this->selfLink = $selfLink; + } + public function getSelfLink() { + return $this->selfLink; + } +} + +class Person extends apiModel { + public $relationshipStatus; + protected $__organizationsType = 'PersonOrganizations'; + protected $__organizationsDataType = 'array'; + public $organizations; + public $kind; + public $displayName; + protected $__nameType = 'PersonName'; + protected $__nameDataType = ''; + public $name; + public $url; + public $gender; + public $aboutMe; + public $tagline; + protected $__urlsType = 'PersonUrls'; + protected $__urlsDataType = 'array'; + public $urls; + protected $__placesLivedType = 'PersonPlacesLived'; + protected $__placesLivedDataType = 'array'; + public $placesLived; + protected $__emailsType = 'PersonEmails'; + protected $__emailsDataType = 'array'; + public $emails; + public $nickname; + public $birthday; + public $etag; + protected $__imageType = 'PersonImage'; + protected $__imageDataType = ''; + public $image; + public $hasApp; + public $id; + public $languagesSpoken; + public $currentLocation; + public $objectType; + public function setRelationshipStatus($relationshipStatus) { + $this->relationshipStatus = $relationshipStatus; + } + public function getRelationshipStatus() { + return $this->relationshipStatus; + } + public function setOrganizations(/* array(PersonOrganizations) */ $organizations) { + $this->assertIsArray($organizations, 'PersonOrganizations', __METHOD__); + $this->organizations = $organizations; + } + public function getOrganizations() { + return $this->organizations; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setDisplayName($displayName) { + $this->displayName = $displayName; + } + public function getDisplayName() { + return $this->displayName; + } + public function setName(PersonName $name) { + $this->name = $name; + } + public function getName() { + return $this->name; + } + public function setUrl($url) { + $this->url = $url; + } + public function getUrl() { + return $this->url; + } + public function setGender($gender) { + $this->gender = $gender; + } + public function getGender() { + return $this->gender; + } + public function setAboutMe($aboutMe) { + $this->aboutMe = $aboutMe; + } + public function getAboutMe() { + return $this->aboutMe; + } + public function setTagline($tagline) { + $this->tagline = $tagline; + } + public function getTagline() { + return $this->tagline; + } + public function setUrls(/* array(PersonUrls) */ $urls) { + $this->assertIsArray($urls, 'PersonUrls', __METHOD__); + $this->urls = $urls; + } + public function getUrls() { + return $this->urls; + } + public function setPlacesLived(/* array(PersonPlacesLived) */ $placesLived) { + $this->assertIsArray($placesLived, 'PersonPlacesLived', __METHOD__); + $this->placesLived = $placesLived; + } + public function getPlacesLived() { + return $this->placesLived; + } + public function setEmails(/* array(PersonEmails) */ $emails) { + $this->assertIsArray($emails, 'PersonEmails', __METHOD__); + $this->emails = $emails; + } + public function getEmails() { + return $this->emails; + } + public function setNickname($nickname) { + $this->nickname = $nickname; + } + public function getNickname() { + return $this->nickname; + } + public function setBirthday($birthday) { + $this->birthday = $birthday; + } + public function getBirthday() { + return $this->birthday; + } + public function setEtag($etag) { + $this->etag = $etag; + } + public function getEtag() { + return $this->etag; + } + public function setImage(PersonImage $image) { + $this->image = $image; + } + public function getImage() { + return $this->image; + } + public function setHasApp($hasApp) { + $this->hasApp = $hasApp; + } + public function getHasApp() { + return $this->hasApp; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setLanguagesSpoken(/* array(string) */ $languagesSpoken) { + $this->assertIsArray($languagesSpoken, 'string', __METHOD__); + $this->languagesSpoken = $languagesSpoken; + } + public function getLanguagesSpoken() { + return $this->languagesSpoken; + } + public function setCurrentLocation($currentLocation) { + $this->currentLocation = $currentLocation; + } + public function getCurrentLocation() { + return $this->currentLocation; + } + public function setObjectType($objectType) { + $this->objectType = $objectType; + } + public function getObjectType() { + return $this->objectType; + } +} + +class PersonEmails extends apiModel { + public $type; + public $primary; + public $value; + public function setType($type) { + $this->type = $type; + } + public function getType() { + return $this->type; + } + public function setPrimary($primary) { + $this->primary = $primary; + } + public function getPrimary() { + return $this->primary; + } + public function setValue($value) { + $this->value = $value; + } + public function getValue() { + return $this->value; + } +} + +class PersonImage extends apiModel { + public $url; + public function setUrl($url) { + $this->url = $url; + } + public function getUrl() { + return $this->url; + } +} + +class PersonName extends apiModel { + public $honorificPrefix; + public $middleName; + public $familyName; + public $formatted; + public $givenName; + public $honorificSuffix; + public function setHonorificPrefix($honorificPrefix) { + $this->honorificPrefix = $honorificPrefix; + } + public function getHonorificPrefix() { + return $this->honorificPrefix; + } + public function setMiddleName($middleName) { + $this->middleName = $middleName; + } + public function getMiddleName() { + return $this->middleName; + } + public function setFamilyName($familyName) { + $this->familyName = $familyName; + } + public function getFamilyName() { + return $this->familyName; + } + public function setFormatted($formatted) { + $this->formatted = $formatted; + } + public function getFormatted() { + return $this->formatted; + } + public function setGivenName($givenName) { + $this->givenName = $givenName; + } + public function getGivenName() { + return $this->givenName; + } + public function setHonorificSuffix($honorificSuffix) { + $this->honorificSuffix = $honorificSuffix; + } + public function getHonorificSuffix() { + return $this->honorificSuffix; + } +} + +class PersonOrganizations extends apiModel { + public $startDate; + public $endDate; + public $description; + public $title; + public $primary; + public $location; + public $department; + public $type; + public $name; + public function setStartDate($startDate) { + $this->startDate = $startDate; + } + public function getStartDate() { + return $this->startDate; + } + public function setEndDate($endDate) { + $this->endDate = $endDate; + } + public function getEndDate() { + return $this->endDate; + } + public function setDescription($description) { + $this->description = $description; + } + public function getDescription() { + return $this->description; + } + public function setTitle($title) { + $this->title = $title; + } + public function getTitle() { + return $this->title; + } + public function setPrimary($primary) { + $this->primary = $primary; + } + public function getPrimary() { + return $this->primary; + } + public function setLocation($location) { + $this->location = $location; + } + public function getLocation() { + return $this->location; + } + public function setDepartment($department) { + $this->department = $department; + } + public function getDepartment() { + return $this->department; + } + public function setType($type) { + $this->type = $type; + } + public function getType() { + return $this->type; + } + public function setName($name) { + $this->name = $name; + } + public function getName() { + return $this->name; + } +} + +class PersonPlacesLived extends apiModel { + public $primary; + public $value; + public function setPrimary($primary) { + $this->primary = $primary; + } + public function getPrimary() { + return $this->primary; + } + public function setValue($value) { + $this->value = $value; + } + public function getValue() { + return $this->value; + } +} + +class PersonUrls extends apiModel { + public $type; + public $primary; + public $value; + public function setType($type) { + $this->type = $type; + } + public function getType() { + return $this->type; + } + public function setPrimary($primary) { + $this->primary = $primary; + } + public function getPrimary() { + return $this->primary; + } + public function setValue($value) { + $this->value = $value; + } + public function getValue() { + return $this->value; + } +} + +class PlusAclentryResource extends apiModel { + public $type; + public $id; + public function setType($type) { + $this->type = $type; + } + public function getType() { + return $this->type; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } +} diff --git a/webui/google-api/contrib/apiPredictionService.php b/webui/google-api/contrib/apiPredictionService.php new file mode 100644 index 0000000..87df773 --- /dev/null +++ b/webui/google-api/contrib/apiPredictionService.php @@ -0,0 +1,431 @@ + + * $predictionService = new apiPredictionService(...); + * $trainedmodels = $predictionService->trainedmodels; + * + */ + class TrainedmodelsServiceResource extends apiServiceResource { + + + /** + * Submit model id and request a prediction (trainedmodels.predict) + * + * @param string $id The unique name for the predictive model. + * @param Input $postBody + * @return Output + */ + public function predict($id, Input $postBody, $optParams = array()) { + $params = array('id' => $id, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('predict', array($params)); + if ($this->useObjects()) { + return new Output($data); + } else { + return $data; + } + } + /** + * Begin training your model. (trainedmodels.insert) + * + * @param Training $postBody + * @return Training + */ + public function insert(Training $postBody, $optParams = array()) { + $params = array('postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('insert', array($params)); + if ($this->useObjects()) { + return new Training($data); + } else { + return $data; + } + } + /** + * Check training status of your model. (trainedmodels.get) + * + * @param string $id The unique name for the predictive model. + * @return Training + */ + public function get($id, $optParams = array()) { + $params = array('id' => $id); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new Training($data); + } else { + return $data; + } + } + /** + * Add new data to a trained model. (trainedmodels.update) + * + * @param string $id The unique name for the predictive model. + * @param Update $postBody + * @return Training + */ + public function update($id, Update $postBody, $optParams = array()) { + $params = array('id' => $id, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('update', array($params)); + if ($this->useObjects()) { + return new Training($data); + } else { + return $data; + } + } + /** + * Delete a trained model. (trainedmodels.delete) + * + * @param string $id The unique name for the predictive model. + */ + public function delete($id, $optParams = array()) { + $params = array('id' => $id); + $params = array_merge($params, $optParams); + $data = $this->__call('delete', array($params)); + return $data; + } + } + + /** + * The "hostedmodels" collection of methods. + * Typical usage is: + * + * $predictionService = new apiPredictionService(...); + * $hostedmodels = $predictionService->hostedmodels; + * + */ + class HostedmodelsServiceResource extends apiServiceResource { + + + /** + * Submit input and request an output against a hosted model. (hostedmodels.predict) + * + * @param string $hostedModelName The name of a hosted model. + * @param Input $postBody + * @return Output + */ + public function predict($hostedModelName, Input $postBody, $optParams = array()) { + $params = array('hostedModelName' => $hostedModelName, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('predict', array($params)); + if ($this->useObjects()) { + return new Output($data); + } else { + return $data; + } + } + } + + + +/** + * Service definition for Prediction (v1.4). + * + *

+ * Lets you access a cloud hosted machine learning service that makes it easy to build smart apps + *

+ * + *

+ * For more information about this service, see the + * API Documentation + *

+ * + * @author Google, Inc. + */ +class apiPredictionService extends apiService { + public $trainedmodels; + public $hostedmodels; + /** + * Constructs the internal representation of the Prediction service. + * + * @param apiClient apiClient + */ + public function __construct(apiClient $apiClient) { + $this->rpcPath = '/rpc'; + $this->restBasePath = '/prediction/v1.4/'; + $this->version = 'v1.4'; + $this->serviceName = 'prediction'; + + $apiClient->addService($this->serviceName, $this->version); + $this->trainedmodels = new TrainedmodelsServiceResource($this, $this->serviceName, 'trainedmodels', json_decode('{"methods": {"predict": {"scopes": ["https://www.googleapis.com/auth/prediction"], "parameters": {"id": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "Input"}, "id": "prediction.trainedmodels.predict", "httpMethod": "POST", "path": "trainedmodels/{id}/predict", "response": {"$ref": "Output"}}, "insert": {"scopes": ["https://www.googleapis.com/auth/prediction"], "request": {"$ref": "Training"}, "response": {"$ref": "Training"}, "httpMethod": "POST", "path": "trainedmodels", "id": "prediction.trainedmodels.insert"}, "delete": {"scopes": ["https://www.googleapis.com/auth/prediction"], "parameters": {"id": {"required": true, "type": "string", "location": "path"}}, "httpMethod": "DELETE", "path": "trainedmodels/{id}", "id": "prediction.trainedmodels.delete"}, "update": {"scopes": ["https://www.googleapis.com/auth/prediction"], "parameters": {"id": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "Update"}, "id": "prediction.trainedmodels.update", "httpMethod": "PUT", "path": "trainedmodels/{id}", "response": {"$ref": "Training"}}, "get": {"scopes": ["https://www.googleapis.com/auth/prediction"], "parameters": {"id": {"required": true, "type": "string", "location": "path"}}, "id": "prediction.trainedmodels.get", "httpMethod": "GET", "path": "trainedmodels/{id}", "response": {"$ref": "Training"}}}}', true)); + $this->hostedmodels = new HostedmodelsServiceResource($this, $this->serviceName, 'hostedmodels', json_decode('{"methods": {"predict": {"scopes": ["https://www.googleapis.com/auth/prediction"], "parameters": {"hostedModelName": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "Input"}, "id": "prediction.hostedmodels.predict", "httpMethod": "POST", "path": "hostedmodels/{hostedModelName}/predict", "response": {"$ref": "Output"}}}}', true)); + } +} + +class Input extends apiModel { + protected $__inputType = 'InputInput'; + protected $__inputDataType = ''; + public $input; + public function setInput(InputInput $input) { + $this->input = $input; + } + public function getInput() { + return $this->input; + } +} + +class InputInput extends apiModel { + public $csvInstance; + public function setCsvInstance(/* array(object) */ $csvInstance) { + $this->assertIsArray($csvInstance, 'object', __METHOD__); + $this->csvInstance = $csvInstance; + } + public function getCsvInstance() { + return $this->csvInstance; + } +} + +class Output extends apiModel { + public $kind; + public $outputLabel; + public $id; + protected $__outputMultiType = 'OutputOutputMulti'; + protected $__outputMultiDataType = 'array'; + public $outputMulti; + public $outputValue; + public $selfLink; + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setOutputLabel($outputLabel) { + $this->outputLabel = $outputLabel; + } + public function getOutputLabel() { + return $this->outputLabel; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setOutputMulti(/* array(OutputOutputMulti) */ $outputMulti) { + $this->assertIsArray($outputMulti, 'OutputOutputMulti', __METHOD__); + $this->outputMulti = $outputMulti; + } + public function getOutputMulti() { + return $this->outputMulti; + } + public function setOutputValue($outputValue) { + $this->outputValue = $outputValue; + } + public function getOutputValue() { + return $this->outputValue; + } + public function setSelfLink($selfLink) { + $this->selfLink = $selfLink; + } + public function getSelfLink() { + return $this->selfLink; + } +} + +class OutputOutputMulti extends apiModel { + public $score; + public $label; + public function setScore($score) { + $this->score = $score; + } + public function getScore() { + return $this->score; + } + public function setLabel($label) { + $this->label = $label; + } + public function getLabel() { + return $this->label; + } +} + +class Training extends apiModel { + public $kind; + public $storageDataLocation; + public $storagePMMLModelLocation; + protected $__dataAnalysisType = 'TrainingDataAnalysis'; + protected $__dataAnalysisDataType = ''; + public $dataAnalysis; + public $trainingStatus; + protected $__modelInfoType = 'TrainingModelInfo'; + protected $__modelInfoDataType = ''; + public $modelInfo; + public $storagePMMLLocation; + public $id; + public $selfLink; + public $utility; + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setStorageDataLocation($storageDataLocation) { + $this->storageDataLocation = $storageDataLocation; + } + public function getStorageDataLocation() { + return $this->storageDataLocation; + } + public function setStoragePMMLModelLocation($storagePMMLModelLocation) { + $this->storagePMMLModelLocation = $storagePMMLModelLocation; + } + public function getStoragePMMLModelLocation() { + return $this->storagePMMLModelLocation; + } + public function setDataAnalysis(TrainingDataAnalysis $dataAnalysis) { + $this->dataAnalysis = $dataAnalysis; + } + public function getDataAnalysis() { + return $this->dataAnalysis; + } + public function setTrainingStatus($trainingStatus) { + $this->trainingStatus = $trainingStatus; + } + public function getTrainingStatus() { + return $this->trainingStatus; + } + public function setModelInfo(TrainingModelInfo $modelInfo) { + $this->modelInfo = $modelInfo; + } + public function getModelInfo() { + return $this->modelInfo; + } + public function setStoragePMMLLocation($storagePMMLLocation) { + $this->storagePMMLLocation = $storagePMMLLocation; + } + public function getStoragePMMLLocation() { + return $this->storagePMMLLocation; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setSelfLink($selfLink) { + $this->selfLink = $selfLink; + } + public function getSelfLink() { + return $this->selfLink; + } + public function setUtility(/* array(double) */ $utility) { + $this->assertIsArray($utility, 'double', __METHOD__); + $this->utility = $utility; + } + public function getUtility() { + return $this->utility; + } +} + +class TrainingDataAnalysis extends apiModel { + public $warnings; + public function setWarnings(/* array(string) */ $warnings) { + $this->assertIsArray($warnings, 'string', __METHOD__); + $this->warnings = $warnings; + } + public function getWarnings() { + return $this->warnings; + } +} + +class TrainingModelInfo extends apiModel { + public $confusionMatrixRowTotals; + public $numberLabels; + public $confusionMatrix; + public $meanSquaredError; + public $modelType; + public $numberInstances; + public $classWeightedAccuracy; + public $classificationAccuracy; + public function setConfusionMatrixRowTotals($confusionMatrixRowTotals) { + $this->confusionMatrixRowTotals = $confusionMatrixRowTotals; + } + public function getConfusionMatrixRowTotals() { + return $this->confusionMatrixRowTotals; + } + public function setNumberLabels($numberLabels) { + $this->numberLabels = $numberLabels; + } + public function getNumberLabels() { + return $this->numberLabels; + } + public function setConfusionMatrix($confusionMatrix) { + $this->confusionMatrix = $confusionMatrix; + } + public function getConfusionMatrix() { + return $this->confusionMatrix; + } + public function setMeanSquaredError($meanSquaredError) { + $this->meanSquaredError = $meanSquaredError; + } + public function getMeanSquaredError() { + return $this->meanSquaredError; + } + public function setModelType($modelType) { + $this->modelType = $modelType; + } + public function getModelType() { + return $this->modelType; + } + public function setNumberInstances($numberInstances) { + $this->numberInstances = $numberInstances; + } + public function getNumberInstances() { + return $this->numberInstances; + } + public function setClassWeightedAccuracy($classWeightedAccuracy) { + $this->classWeightedAccuracy = $classWeightedAccuracy; + } + public function getClassWeightedAccuracy() { + return $this->classWeightedAccuracy; + } + public function setClassificationAccuracy($classificationAccuracy) { + $this->classificationAccuracy = $classificationAccuracy; + } + public function getClassificationAccuracy() { + return $this->classificationAccuracy; + } +} + +class Update extends apiModel { + public $csvInstance; + public $label; + public function setCsvInstance(/* array(object) */ $csvInstance) { + $this->assertIsArray($csvInstance, 'object', __METHOD__); + $this->csvInstance = $csvInstance; + } + public function getCsvInstance() { + return $this->csvInstance; + } + public function setLabel($label) { + $this->label = $label; + } + public function getLabel() { + return $this->label; + } +} diff --git a/webui/google-api/contrib/apiShoppingService.php b/webui/google-api/contrib/apiShoppingService.php new file mode 100644 index 0000000..ac635fd --- /dev/null +++ b/webui/google-api/contrib/apiShoppingService.php @@ -0,0 +1,1260 @@ + + * $shoppingService = new apiShoppingService(...); + * $products = $shoppingService->products; + * + */ + class ProductsServiceResource extends apiServiceResource { + + + /** + * Returns a list of products and content modules (products.list) + * + * @param string $source Query source + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param bool sayt.useGcsConfig Google Internal + * @opt_param string rankBy Ranking specification + * @opt_param bool debug.enableLogging Google Internal + * @opt_param bool facets.enabled Whether to return facet information + * @opt_param bool relatedQueries.useGcsConfig This parameter is currently ignored + * @opt_param bool promotions.enabled Whether to return promotion information + * @opt_param bool debug.enabled Google Internal + * @opt_param string facets.include Facets to include (applies when useGcsConfig == false) + * @opt_param string productFields Google Internal + * @opt_param string channels Channels specification + * @opt_param string currency Currency restriction (ISO 4217) + * @opt_param string startIndex Index (1-based) of first product to return + * @opt_param string facets.discover Facets to discover + * @opt_param bool debug.searchResponse Google Internal + * @opt_param string crowdBy Crowding specification + * @opt_param bool spelling.enabled Whether to return spelling suggestions + * @opt_param string taxonomy Taxonomy name + * @opt_param bool debug.geocodeRequest Google Internal + * @opt_param bool spelling.useGcsConfig This parameter is currently ignored + * @opt_param string useCase One of CommerceSearchUseCase, ShoppingApiUseCase + * @opt_param string location Location used to determine tax and shipping + * @opt_param string maxVariants Maximum number of variant results to return per result + * @opt_param bool debug.rdcRequest Google Internal + * @opt_param string categories.include Category specification + * @opt_param string boostBy Boosting specification + * @opt_param bool redirects.useGcsConfig Whether to return redirect information as configured in the GCS account + * @opt_param bool safe Whether safe search is enabled. Default: true + * @opt_param bool categories.useGcsConfig This parameter is currently ignored + * @opt_param string maxResults Maximum number of results to return + * @opt_param bool facets.useGcsConfig Whether to return facet information as configured in the GCS account + * @opt_param bool categories.enabled Whether to return category information + * @opt_param string attributeFilter Comma separated list of attributes to return + * @opt_param bool sayt.enabled Google Internal + * @opt_param bool promotions.useGcsConfig Whether to return promotion information as configured in the GCS account + * @opt_param string thumbnails Image thumbnails specification + * @opt_param string language Language restriction (BCP 47) + * @opt_param string country Country restriction (ISO 3166) + * @opt_param bool debug.geocodeResponse Google Internal + * @opt_param string restrictBy Restriction specification + * @opt_param bool debug.rdcResponse Google Internal + * @opt_param string q Search query + * @opt_param bool redirects.enabled Whether to return redirect information + * @opt_param bool debug.searchRequest Google Internal + * @opt_param bool relatedQueries.enabled Whether to return related queries + * @opt_param string minAvailability + * @opt_param string plusOne +1 rendering specification. + * @return Products + */ + public function listProducts($source, $optParams = array()) { + $params = array('source' => $source); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new Products($data); + } else { + return $data; + } + } + /** + * Returns a single product (products.get) + * + * @param string $source Query source + * @param string $accountId Merchant center account id + * @param string $productIdType Type of productId + * @param string $productId Id of product + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string categories.include Category specification + * @opt_param bool recommendations.enabled Whether to return recommendation information + * @opt_param bool debug.enableLogging Google Internal + * @opt_param string taxonomy Merchant taxonomy + * @opt_param bool categories.useGcsConfig This parameter is currently ignored + * @opt_param bool debug.searchResponse Google Internal + * @opt_param bool debug.enabled Google Internal + * @opt_param string recommendations.include Recommendation specification + * @opt_param bool categories.enabled Whether to return category information + * @opt_param string productFields Google Internal + * @opt_param string location Location used to determine tax and shipping + * @opt_param bool debug.searchRequest Google Internal + * @opt_param string attributeFilter Comma separated list of attributes to return + * @opt_param bool recommendations.useGcsConfig This parameter is currently ignored + * @opt_param string plusOne +1 rendering specification. + * @opt_param string thumbnails Thumbnail specification + * @return Product + */ + public function get($source, $accountId, $productIdType, $productId, $optParams = array()) { + $params = array('source' => $source, 'accountId' => $accountId, 'productIdType' => $productIdType, 'productId' => $productId); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new Product($data); + } else { + return $data; + } + } + } + + + +/** + * Service definition for Shopping (v1). + * + *

+ * Lets you search over product data + *

+ * + *

+ * For more information about this service, see the + * API Documentation + *

+ * + * @author Google, Inc. + */ +class apiShoppingService extends apiService { + public $products; + /** + * Constructs the internal representation of the Shopping service. + * + * @param apiClient apiClient + */ + public function __construct(apiClient $apiClient) { + $this->rpcPath = '/rpc'; + $this->restBasePath = '/shopping/search/v1/'; + $this->version = 'v1'; + $this->serviceName = 'shopping'; + + $apiClient->addService($this->serviceName, $this->version); + $this->products = new ProductsServiceResource($this, $this->serviceName, 'products', json_decode('{"methods": {"list": {"parameters": {"sayt.useGcsConfig": {"type": "boolean", "location": "query"}, "debug.geocodeResponse": {"type": "boolean", "location": "query"}, "debug.enableLogging": {"type": "boolean", "location": "query"}, "facets.enabled": {"type": "boolean", "location": "query"}, "relatedQueries.useGcsConfig": {"type": "boolean", "location": "query"}, "promotions.enabled": {"type": "boolean", "location": "query"}, "debug.enabled": {"type": "boolean", "location": "query"}, "facets.include": {"type": "string", "location": "query"}, "productFields": {"type": "string", "location": "query"}, "channels": {"type": "string", "location": "query"}, "currency": {"type": "string", "location": "query"}, "startIndex": {"format": "uint32", "type": "integer", "location": "query"}, "facets.discover": {"type": "string", "location": "query"}, "debug.searchResponse": {"type": "boolean", "location": "query"}, "crowdBy": {"type": "string", "location": "query"}, "spelling.enabled": {"type": "boolean", "location": "query"}, "debug.geocodeRequest": {"type": "boolean", "location": "query"}, "source": {"required": true, "type": "string", "location": "path"}, "spelling.useGcsConfig": {"type": "boolean", "location": "query"}, "useCase": {"type": "string", "location": "query"}, "location": {"type": "string", "location": "query"}, "taxonomy": {"type": "string", "location": "query"}, "debug.rdcRequest": {"type": "boolean", "location": "query"}, "categories.include": {"type": "string", "location": "query"}, "debug.searchRequest": {"type": "boolean", "location": "query"}, "safe": {"type": "boolean", "location": "query"}, "boostBy": {"type": "string", "location": "query"}, "maxVariants": {"format": "uint32", "type": "integer", "location": "query"}, "categories.useGcsConfig": {"type": "boolean", "location": "query"}, "maxResults": {"format": "uint32", "type": "integer", "location": "query"}, "facets.useGcsConfig": {"type": "boolean", "location": "query"}, "categories.enabled": {"type": "boolean", "location": "query"}, "attributeFilter": {"type": "string", "location": "query"}, "sayt.enabled": {"type": "boolean", "location": "query"}, "plusOne": {"type": "string", "location": "query"}, "thumbnails": {"type": "string", "location": "query"}, "language": {"type": "string", "location": "query"}, "redirects.useGcsConfig": {"type": "boolean", "location": "query"}, "rankBy": {"type": "string", "location": "query"}, "restrictBy": {"type": "string", "location": "query"}, "debug.rdcResponse": {"type": "boolean", "location": "query"}, "q": {"type": "string", "location": "query"}, "redirects.enabled": {"type": "boolean", "location": "query"}, "country": {"type": "string", "location": "query"}, "relatedQueries.enabled": {"type": "boolean", "location": "query"}, "minAvailability": {"enum": ["inStock", "limited", "outOfStock", "unknown"], "type": "string", "location": "query"}, "promotions.useGcsConfig": {"type": "boolean", "location": "query"}}, "id": "shopping.products.list", "httpMethod": "GET", "path": "{source}/products", "response": {"$ref": "Products"}}, "get": {"parameters": {"categories.include": {"type": "string", "location": "query"}, "recommendations.enabled": {"type": "boolean", "location": "query"}, "plusOne": {"type": "string", "location": "query"}, "debug.enableLogging": {"type": "boolean", "location": "query"}, "thumbnails": {"type": "string", "location": "query"}, "recommendations.include": {"type": "string", "location": "query"}, "taxonomy": {"type": "string", "location": "query"}, "productIdType": {"required": true, "type": "string", "location": "path"}, "categories.useGcsConfig": {"type": "boolean", "location": "query"}, "attributeFilter": {"type": "string", "location": "query"}, "debug.enabled": {"type": "boolean", "location": "query"}, "source": {"required": true, "type": "string", "location": "path"}, "categories.enabled": {"type": "boolean", "location": "query"}, "location": {"type": "string", "location": "query"}, "debug.searchRequest": {"type": "boolean", "location": "query"}, "debug.searchResponse": {"type": "boolean", "location": "query"}, "recommendations.useGcsConfig": {"type": "boolean", "location": "query"}, "productFields": {"type": "string", "location": "query"}, "accountId": {"format": "uint32", "required": true, "type": "integer", "location": "path"}, "productId": {"required": true, "type": "string", "location": "path"}}, "id": "shopping.products.get", "httpMethod": "GET", "path": "{source}/products/{accountId}/{productIdType}/{productId}", "response": {"$ref": "Product"}}}}', true)); + } +} + +class Product extends apiModel { + public $selfLink; + public $kind; + protected $__productType = 'ShoppingModelProductJsonV1'; + protected $__productDataType = ''; + public $product; + public $requestId; + protected $__recommendationsType = 'ProductRecommendations'; + protected $__recommendationsDataType = 'array'; + public $recommendations; + protected $__debugType = 'ShoppingModelDebugJsonV1'; + protected $__debugDataType = ''; + public $debug; + public $id; + protected $__categoriesType = 'ShoppingModelCategoryJsonV1'; + protected $__categoriesDataType = 'array'; + public $categories; + public function setSelfLink($selfLink) { + $this->selfLink = $selfLink; + } + public function getSelfLink() { + return $this->selfLink; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setProduct(ShoppingModelProductJsonV1 $product) { + $this->product = $product; + } + public function getProduct() { + return $this->product; + } + public function setRequestId($requestId) { + $this->requestId = $requestId; + } + public function getRequestId() { + return $this->requestId; + } + public function setRecommendations(/* array(ProductRecommendations) */ $recommendations) { + $this->assertIsArray($recommendations, 'ProductRecommendations', __METHOD__); + $this->recommendations = $recommendations; + } + public function getRecommendations() { + return $this->recommendations; + } + public function setDebug(ShoppingModelDebugJsonV1 $debug) { + $this->debug = $debug; + } + public function getDebug() { + return $this->debug; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setCategories(/* array(ShoppingModelCategoryJsonV1) */ $categories) { + $this->assertIsArray($categories, 'ShoppingModelCategoryJsonV1', __METHOD__); + $this->categories = $categories; + } + public function getCategories() { + return $this->categories; + } +} + +class ProductRecommendations extends apiModel { + protected $__recommendationListType = 'ProductRecommendationsRecommendationList'; + protected $__recommendationListDataType = 'array'; + public $recommendationList; + public $type; + public function setRecommendationList(/* array(ProductRecommendationsRecommendationList) */ $recommendationList) { + $this->assertIsArray($recommendationList, 'ProductRecommendationsRecommendationList', __METHOD__); + $this->recommendationList = $recommendationList; + } + public function getRecommendationList() { + return $this->recommendationList; + } + public function setType($type) { + $this->type = $type; + } + public function getType() { + return $this->type; + } +} + +class ProductRecommendationsRecommendationList extends apiModel { + protected $__productType = 'ShoppingModelProductJsonV1'; + protected $__productDataType = ''; + public $product; + public function setProduct(ShoppingModelProductJsonV1 $product) { + $this->product = $product; + } + public function getProduct() { + return $this->product; + } +} + +class Products extends apiModel { + protected $__promotionsType = 'ProductsPromotions'; + protected $__promotionsDataType = 'array'; + public $promotions; + public $selfLink; + public $kind; + protected $__storesType = 'ProductsStores'; + protected $__storesDataType = 'array'; + public $stores; + public $currentItemCount; + protected $__itemsType = 'Product'; + protected $__itemsDataType = 'array'; + public $items; + protected $__facetsType = 'ProductsFacets'; + protected $__facetsDataType = 'array'; + public $facets; + public $itemsPerPage; + public $redirects; + public $nextLink; + protected $__shelfSpaceAdsType = 'ProductsShelfSpaceAds'; + protected $__shelfSpaceAdsDataType = 'array'; + public $shelfSpaceAds; + public $startIndex; + public $etag; + public $requestId; + public $relatedQueries; + protected $__debugType = 'ShoppingModelDebugJsonV1'; + protected $__debugDataType = ''; + public $debug; + protected $__spellingType = 'ProductsSpelling'; + protected $__spellingDataType = ''; + public $spelling; + public $previousLink; + public $totalItems; + public $id; + protected $__categoriesType = 'ShoppingModelCategoryJsonV1'; + protected $__categoriesDataType = 'array'; + public $categories; + public function setPromotions(/* array(ProductsPromotions) */ $promotions) { + $this->assertIsArray($promotions, 'ProductsPromotions', __METHOD__); + $this->promotions = $promotions; + } + public function getPromotions() { + return $this->promotions; + } + public function setSelfLink($selfLink) { + $this->selfLink = $selfLink; + } + public function getSelfLink() { + return $this->selfLink; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setStores(/* array(ProductsStores) */ $stores) { + $this->assertIsArray($stores, 'ProductsStores', __METHOD__); + $this->stores = $stores; + } + public function getStores() { + return $this->stores; + } + public function setCurrentItemCount($currentItemCount) { + $this->currentItemCount = $currentItemCount; + } + public function getCurrentItemCount() { + return $this->currentItemCount; + } + public function setItems(/* array(Product) */ $items) { + $this->assertIsArray($items, 'Product', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setFacets(/* array(ProductsFacets) */ $facets) { + $this->assertIsArray($facets, 'ProductsFacets', __METHOD__); + $this->facets = $facets; + } + public function getFacets() { + return $this->facets; + } + public function setItemsPerPage($itemsPerPage) { + $this->itemsPerPage = $itemsPerPage; + } + public function getItemsPerPage() { + return $this->itemsPerPage; + } + public function setRedirects(/* array(string) */ $redirects) { + $this->assertIsArray($redirects, 'string', __METHOD__); + $this->redirects = $redirects; + } + public function getRedirects() { + return $this->redirects; + } + public function setNextLink($nextLink) { + $this->nextLink = $nextLink; + } + public function getNextLink() { + return $this->nextLink; + } + public function setShelfSpaceAds(/* array(ProductsShelfSpaceAds) */ $shelfSpaceAds) { + $this->assertIsArray($shelfSpaceAds, 'ProductsShelfSpaceAds', __METHOD__); + $this->shelfSpaceAds = $shelfSpaceAds; + } + public function getShelfSpaceAds() { + return $this->shelfSpaceAds; + } + public function setStartIndex($startIndex) { + $this->startIndex = $startIndex; + } + public function getStartIndex() { + return $this->startIndex; + } + public function setEtag($etag) { + $this->etag = $etag; + } + public function getEtag() { + return $this->etag; + } + public function setRequestId($requestId) { + $this->requestId = $requestId; + } + public function getRequestId() { + return $this->requestId; + } + public function setRelatedQueries(/* array(string) */ $relatedQueries) { + $this->assertIsArray($relatedQueries, 'string', __METHOD__); + $this->relatedQueries = $relatedQueries; + } + public function getRelatedQueries() { + return $this->relatedQueries; + } + public function setDebug(ShoppingModelDebugJsonV1 $debug) { + $this->debug = $debug; + } + public function getDebug() { + return $this->debug; + } + public function setSpelling(ProductsSpelling $spelling) { + $this->spelling = $spelling; + } + public function getSpelling() { + return $this->spelling; + } + public function setPreviousLink($previousLink) { + $this->previousLink = $previousLink; + } + public function getPreviousLink() { + return $this->previousLink; + } + public function setTotalItems($totalItems) { + $this->totalItems = $totalItems; + } + public function getTotalItems() { + return $this->totalItems; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setCategories(/* array(ShoppingModelCategoryJsonV1) */ $categories) { + $this->assertIsArray($categories, 'ShoppingModelCategoryJsonV1', __METHOD__); + $this->categories = $categories; + } + public function getCategories() { + return $this->categories; + } +} + +class ProductsFacets extends apiModel { + public $count; + public $displayName; + public $name; + protected $__bucketsType = 'ProductsFacetsBuckets'; + protected $__bucketsDataType = 'array'; + public $buckets; + public $property; + public $type; + public $unit; + public function setCount($count) { + $this->count = $count; + } + public function getCount() { + return $this->count; + } + public function setDisplayName($displayName) { + $this->displayName = $displayName; + } + public function getDisplayName() { + return $this->displayName; + } + public function setName($name) { + $this->name = $name; + } + public function getName() { + return $this->name; + } + public function setBuckets(/* array(ProductsFacetsBuckets) */ $buckets) { + $this->assertIsArray($buckets, 'ProductsFacetsBuckets', __METHOD__); + $this->buckets = $buckets; + } + public function getBuckets() { + return $this->buckets; + } + public function setProperty($property) { + $this->property = $property; + } + public function getProperty() { + return $this->property; + } + public function setType($type) { + $this->type = $type; + } + public function getType() { + return $this->type; + } + public function setUnit($unit) { + $this->unit = $unit; + } + public function getUnit() { + return $this->unit; + } +} + +class ProductsFacetsBuckets extends apiModel { + public $count; + public $minExclusive; + public $min; + public $max; + public $value; + public $maxExclusive; + public function setCount($count) { + $this->count = $count; + } + public function getCount() { + return $this->count; + } + public function setMinExclusive($minExclusive) { + $this->minExclusive = $minExclusive; + } + public function getMinExclusive() { + return $this->minExclusive; + } + public function setMin($min) { + $this->min = $min; + } + public function getMin() { + return $this->min; + } + public function setMax($max) { + $this->max = $max; + } + public function getMax() { + return $this->max; + } + public function setValue($value) { + $this->value = $value; + } + public function getValue() { + return $this->value; + } + public function setMaxExclusive($maxExclusive) { + $this->maxExclusive = $maxExclusive; + } + public function getMaxExclusive() { + return $this->maxExclusive; + } +} + +class ProductsPromotions extends apiModel { + protected $__productType = 'ShoppingModelProductJsonV1'; + protected $__productDataType = ''; + public $product; + public $description; + public $imageLink; + public $destLink; + public $customHtml; + public $link; + protected $__customFieldsType = 'ProductsPromotionsCustomFields'; + protected $__customFieldsDataType = 'array'; + public $customFields; + public $type; + public $name; + public function setProduct(ShoppingModelProductJsonV1 $product) { + $this->product = $product; + } + public function getProduct() { + return $this->product; + } + public function setDescription($description) { + $this->description = $description; + } + public function getDescription() { + return $this->description; + } + public function setImageLink($imageLink) { + $this->imageLink = $imageLink; + } + public function getImageLink() { + return $this->imageLink; + } + public function setDestLink($destLink) { + $this->destLink = $destLink; + } + public function getDestLink() { + return $this->destLink; + } + public function setCustomHtml($customHtml) { + $this->customHtml = $customHtml; + } + public function getCustomHtml() { + return $this->customHtml; + } + public function setLink($link) { + $this->link = $link; + } + public function getLink() { + return $this->link; + } + public function setCustomFields(/* array(ProductsPromotionsCustomFields) */ $customFields) { + $this->assertIsArray($customFields, 'ProductsPromotionsCustomFields', __METHOD__); + $this->customFields = $customFields; + } + public function getCustomFields() { + return $this->customFields; + } + public function setType($type) { + $this->type = $type; + } + public function getType() { + return $this->type; + } + public function setName($name) { + $this->name = $name; + } + public function getName() { + return $this->name; + } +} + +class ProductsPromotionsCustomFields extends apiModel { + public $name; + public $value; + public function setName($name) { + $this->name = $name; + } + public function getName() { + return $this->name; + } + public function setValue($value) { + $this->value = $value; + } + public function getValue() { + return $this->value; + } +} + +class ProductsShelfSpaceAds extends apiModel { + protected $__productType = 'ShoppingModelProductJsonV1'; + protected $__productDataType = ''; + public $product; + public function setProduct(ShoppingModelProductJsonV1 $product) { + $this->product = $product; + } + public function getProduct() { + return $this->product; + } +} + +class ProductsSpelling extends apiModel { + public $suggestion; + public function setSuggestion($suggestion) { + $this->suggestion = $suggestion; + } + public function getSuggestion() { + return $this->suggestion; + } +} + +class ProductsStores extends apiModel { + public $storeCode; + public $name; + public $storeId; + public $telephone; + public $location; + public $address; + public function setStoreCode($storeCode) { + $this->storeCode = $storeCode; + } + public function getStoreCode() { + return $this->storeCode; + } + public function setName($name) { + $this->name = $name; + } + public function getName() { + return $this->name; + } + public function setStoreId($storeId) { + $this->storeId = $storeId; + } + public function getStoreId() { + return $this->storeId; + } + public function setTelephone($telephone) { + $this->telephone = $telephone; + } + public function getTelephone() { + return $this->telephone; + } + public function setLocation($location) { + $this->location = $location; + } + public function getLocation() { + return $this->location; + } + public function setAddress($address) { + $this->address = $address; + } + public function getAddress() { + return $this->address; + } +} + +class ShoppingModelCategoryJsonV1 extends apiModel { + public $url; + public $shortName; + public $parents; + public $id; + public function setUrl($url) { + $this->url = $url; + } + public function getUrl() { + return $this->url; + } + public function setShortName($shortName) { + $this->shortName = $shortName; + } + public function getShortName() { + return $this->shortName; + } + public function setParents(/* array(string) */ $parents) { + $this->assertIsArray($parents, 'string', __METHOD__); + $this->parents = $parents; + } + public function getParents() { + return $this->parents; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } +} + +class ShoppingModelDebugJsonV1 extends apiModel { + public $searchResponse; + public $searchRequest; + public $rdcResponse; + protected $__backendTimesType = 'ShoppingModelDebugJsonV1BackendTimes'; + protected $__backendTimesDataType = 'array'; + public $backendTimes; + public $elapsedMillis; + public function setSearchResponse($searchResponse) { + $this->searchResponse = $searchResponse; + } + public function getSearchResponse() { + return $this->searchResponse; + } + public function setSearchRequest($searchRequest) { + $this->searchRequest = $searchRequest; + } + public function getSearchRequest() { + return $this->searchRequest; + } + public function setRdcResponse($rdcResponse) { + $this->rdcResponse = $rdcResponse; + } + public function getRdcResponse() { + return $this->rdcResponse; + } + public function setBackendTimes(/* array(ShoppingModelDebugJsonV1BackendTimes) */ $backendTimes) { + $this->assertIsArray($backendTimes, 'ShoppingModelDebugJsonV1BackendTimes', __METHOD__); + $this->backendTimes = $backendTimes; + } + public function getBackendTimes() { + return $this->backendTimes; + } + public function setElapsedMillis($elapsedMillis) { + $this->elapsedMillis = $elapsedMillis; + } + public function getElapsedMillis() { + return $this->elapsedMillis; + } +} + +class ShoppingModelDebugJsonV1BackendTimes extends apiModel { + public $serverMillis; + public $hostName; + public $name; + public $elapsedMillis; + public function setServerMillis($serverMillis) { + $this->serverMillis = $serverMillis; + } + public function getServerMillis() { + return $this->serverMillis; + } + public function setHostName($hostName) { + $this->hostName = $hostName; + } + public function getHostName() { + return $this->hostName; + } + public function setName($name) { + $this->name = $name; + } + public function getName() { + return $this->name; + } + public function setElapsedMillis($elapsedMillis) { + $this->elapsedMillis = $elapsedMillis; + } + public function getElapsedMillis() { + return $this->elapsedMillis; + } +} + +class ShoppingModelProductJsonV1 extends apiModel { + public $queryMatched; + public $gtin; + protected $__imagesType = 'ShoppingModelProductJsonV1Images'; + protected $__imagesDataType = 'array'; + public $images; + protected $__inventoriesType = 'ShoppingModelProductJsonV1Inventories'; + protected $__inventoriesDataType = 'array'; + public $inventories; + protected $__authorType = 'ShoppingModelProductJsonV1Author'; + protected $__authorDataType = ''; + public $author; + public $condition; + public $providedId; + public $internal8; + public $description; + public $gtins; + public $internal1; + public $brand; + public $internal3; + protected $__internal4Type = 'ShoppingModelProductJsonV1Internal4'; + protected $__internal4DataType = 'array'; + public $internal4; + public $internal6; + public $internal7; + public $link; + protected $__attributesType = 'ShoppingModelProductJsonV1Attributes'; + protected $__attributesDataType = 'array'; + public $attributes; + public $totalMatchingVariants; + protected $__variantsType = 'ShoppingModelProductJsonV1Variants'; + protected $__variantsDataType = 'array'; + public $variants; + public $modificationTime; + public $categories; + public $language; + public $country; + public $title; + public $creationTime; + public $internal14; + public $internal12; + public $internal13; + public $internal10; + public $plusOne; + public $googleId; + public $internal15; + public function setQueryMatched($queryMatched) { + $this->queryMatched = $queryMatched; + } + public function getQueryMatched() { + return $this->queryMatched; + } + public function setGtin($gtin) { + $this->gtin = $gtin; + } + public function getGtin() { + return $this->gtin; + } + public function setImages(/* array(ShoppingModelProductJsonV1Images) */ $images) { + $this->assertIsArray($images, 'ShoppingModelProductJsonV1Images', __METHOD__); + $this->images = $images; + } + public function getImages() { + return $this->images; + } + public function setInventories(/* array(ShoppingModelProductJsonV1Inventories) */ $inventories) { + $this->assertIsArray($inventories, 'ShoppingModelProductJsonV1Inventories', __METHOD__); + $this->inventories = $inventories; + } + public function getInventories() { + return $this->inventories; + } + public function setAuthor(ShoppingModelProductJsonV1Author $author) { + $this->author = $author; + } + public function getAuthor() { + return $this->author; + } + public function setCondition($condition) { + $this->condition = $condition; + } + public function getCondition() { + return $this->condition; + } + public function setProvidedId($providedId) { + $this->providedId = $providedId; + } + public function getProvidedId() { + return $this->providedId; + } + public function setInternal8(/* array(string) */ $internal8) { + $this->assertIsArray($internal8, 'string', __METHOD__); + $this->internal8 = $internal8; + } + public function getInternal8() { + return $this->internal8; + } + public function setDescription($description) { + $this->description = $description; + } + public function getDescription() { + return $this->description; + } + public function setGtins(/* array(string) */ $gtins) { + $this->assertIsArray($gtins, 'string', __METHOD__); + $this->gtins = $gtins; + } + public function getGtins() { + return $this->gtins; + } + public function setInternal1(/* array(string) */ $internal1) { + $this->assertIsArray($internal1, 'string', __METHOD__); + $this->internal1 = $internal1; + } + public function getInternal1() { + return $this->internal1; + } + public function setBrand($brand) { + $this->brand = $brand; + } + public function getBrand() { + return $this->brand; + } + public function setInternal3($internal3) { + $this->internal3 = $internal3; + } + public function getInternal3() { + return $this->internal3; + } + public function setInternal4(/* array(ShoppingModelProductJsonV1Internal4) */ $internal4) { + $this->assertIsArray($internal4, 'ShoppingModelProductJsonV1Internal4', __METHOD__); + $this->internal4 = $internal4; + } + public function getInternal4() { + return $this->internal4; + } + public function setInternal6($internal6) { + $this->internal6 = $internal6; + } + public function getInternal6() { + return $this->internal6; + } + public function setInternal7($internal7) { + $this->internal7 = $internal7; + } + public function getInternal7() { + return $this->internal7; + } + public function setLink($link) { + $this->link = $link; + } + public function getLink() { + return $this->link; + } + public function setAttributes(/* array(ShoppingModelProductJsonV1Attributes) */ $attributes) { + $this->assertIsArray($attributes, 'ShoppingModelProductJsonV1Attributes', __METHOD__); + $this->attributes = $attributes; + } + public function getAttributes() { + return $this->attributes; + } + public function setTotalMatchingVariants($totalMatchingVariants) { + $this->totalMatchingVariants = $totalMatchingVariants; + } + public function getTotalMatchingVariants() { + return $this->totalMatchingVariants; + } + public function setVariants(/* array(ShoppingModelProductJsonV1Variants) */ $variants) { + $this->assertIsArray($variants, 'ShoppingModelProductJsonV1Variants', __METHOD__); + $this->variants = $variants; + } + public function getVariants() { + return $this->variants; + } + public function setModificationTime($modificationTime) { + $this->modificationTime = $modificationTime; + } + public function getModificationTime() { + return $this->modificationTime; + } + public function setCategories(/* array(string) */ $categories) { + $this->assertIsArray($categories, 'string', __METHOD__); + $this->categories = $categories; + } + public function getCategories() { + return $this->categories; + } + public function setLanguage($language) { + $this->language = $language; + } + public function getLanguage() { + return $this->language; + } + public function setCountry($country) { + $this->country = $country; + } + public function getCountry() { + return $this->country; + } + public function setTitle($title) { + $this->title = $title; + } + public function getTitle() { + return $this->title; + } + public function setCreationTime($creationTime) { + $this->creationTime = $creationTime; + } + public function getCreationTime() { + return $this->creationTime; + } + public function setInternal14($internal14) { + $this->internal14 = $internal14; + } + public function getInternal14() { + return $this->internal14; + } + public function setInternal12($internal12) { + $this->internal12 = $internal12; + } + public function getInternal12() { + return $this->internal12; + } + public function setInternal13($internal13) { + $this->internal13 = $internal13; + } + public function getInternal13() { + return $this->internal13; + } + public function setInternal10(/* array(string) */ $internal10) { + $this->assertIsArray($internal10, 'string', __METHOD__); + $this->internal10 = $internal10; + } + public function getInternal10() { + return $this->internal10; + } + public function setPlusOne($plusOne) { + $this->plusOne = $plusOne; + } + public function getPlusOne() { + return $this->plusOne; + } + public function setGoogleId($googleId) { + $this->googleId = $googleId; + } + public function getGoogleId() { + return $this->googleId; + } + public function setInternal15($internal15) { + $this->internal15 = $internal15; + } + public function getInternal15() { + return $this->internal15; + } +} + +class ShoppingModelProductJsonV1Attributes extends apiModel { + public $type; + public $value; + public $displayName; + public $name; + public $unit; + public function setType($type) { + $this->type = $type; + } + public function getType() { + return $this->type; + } + public function setValue($value) { + $this->value = $value; + } + public function getValue() { + return $this->value; + } + public function setDisplayName($displayName) { + $this->displayName = $displayName; + } + public function getDisplayName() { + return $this->displayName; + } + public function setName($name) { + $this->name = $name; + } + public function getName() { + return $this->name; + } + public function setUnit($unit) { + $this->unit = $unit; + } + public function getUnit() { + return $this->unit; + } +} + +class ShoppingModelProductJsonV1Author extends apiModel { + public $name; + public $accountId; + public function setName($name) { + $this->name = $name; + } + public function getName() { + return $this->name; + } + public function setAccountId($accountId) { + $this->accountId = $accountId; + } + public function getAccountId() { + return $this->accountId; + } +} + +class ShoppingModelProductJsonV1Images extends apiModel { + public $link; + protected $__thumbnailsType = 'ShoppingModelProductJsonV1ImagesThumbnails'; + protected $__thumbnailsDataType = 'array'; + public $thumbnails; + public function setLink($link) { + $this->link = $link; + } + public function getLink() { + return $this->link; + } + public function setThumbnails(/* array(ShoppingModelProductJsonV1ImagesThumbnails) */ $thumbnails) { + $this->assertIsArray($thumbnails, 'ShoppingModelProductJsonV1ImagesThumbnails', __METHOD__); + $this->thumbnails = $thumbnails; + } + public function getThumbnails() { + return $this->thumbnails; + } +} + +class ShoppingModelProductJsonV1ImagesThumbnails extends apiModel { + public $content; + public $width; + public $link; + public $height; + public function setContent($content) { + $this->content = $content; + } + public function getContent() { + return $this->content; + } + public function setWidth($width) { + $this->width = $width; + } + public function getWidth() { + return $this->width; + } + public function setLink($link) { + $this->link = $link; + } + public function getLink() { + return $this->link; + } + public function setHeight($height) { + $this->height = $height; + } + public function getHeight() { + return $this->height; + } +} + +class ShoppingModelProductJsonV1Internal4 extends apiModel { + public $node; + public $confidence; + public function setNode($node) { + $this->node = $node; + } + public function getNode() { + return $this->node; + } + public function setConfidence($confidence) { + $this->confidence = $confidence; + } + public function getConfidence() { + return $this->confidence; + } +} + +class ShoppingModelProductJsonV1Inventories extends apiModel { + public $distance; + public $price; + public $storeId; + public $tax; + public $shipping; + public $currency; + public $distanceUnit; + public $availability; + public $channel; + public function setDistance($distance) { + $this->distance = $distance; + } + public function getDistance() { + return $this->distance; + } + public function setPrice($price) { + $this->price = $price; + } + public function getPrice() { + return $this->price; + } + public function setStoreId($storeId) { + $this->storeId = $storeId; + } + public function getStoreId() { + return $this->storeId; + } + public function setTax($tax) { + $this->tax = $tax; + } + public function getTax() { + return $this->tax; + } + public function setShipping($shipping) { + $this->shipping = $shipping; + } + public function getShipping() { + return $this->shipping; + } + public function setCurrency($currency) { + $this->currency = $currency; + } + public function getCurrency() { + return $this->currency; + } + public function setDistanceUnit($distanceUnit) { + $this->distanceUnit = $distanceUnit; + } + public function getDistanceUnit() { + return $this->distanceUnit; + } + public function setAvailability($availability) { + $this->availability = $availability; + } + public function getAvailability() { + return $this->availability; + } + public function setChannel($channel) { + $this->channel = $channel; + } + public function getChannel() { + return $this->channel; + } +} + +class ShoppingModelProductJsonV1Variants extends apiModel { + protected $__variantType = 'ShoppingModelProductJsonV1'; + protected $__variantDataType = ''; + public $variant; + public function setVariant(ShoppingModelProductJsonV1 $variant) { + $this->variant = $variant; + } + public function getVariant() { + return $this->variant; + } +} diff --git a/webui/google-api/contrib/apiSiteVerificationService.php b/webui/google-api/contrib/apiSiteVerificationService.php new file mode 100644 index 0000000..0c4bdf7 --- /dev/null +++ b/webui/google-api/contrib/apiSiteVerificationService.php @@ -0,0 +1,292 @@ + + * $siteVerificationService = new apiSiteVerificationService(...); + * $webResource = $siteVerificationService->webResource; + * + */ + class WebResourceServiceResource extends apiServiceResource { + + + /** + * Attempt verification of a website or domain. (webResource.insert) + * + * @param string $verificationMethod The method to use for verifying a site or domain. + * @param SiteVerificationWebResourceResource $postBody + * @return SiteVerificationWebResourceResource + */ + public function insert($verificationMethod, SiteVerificationWebResourceResource $postBody, $optParams = array()) { + $params = array('verificationMethod' => $verificationMethod, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('insert', array($params)); + if ($this->useObjects()) { + return new SiteVerificationWebResourceResource($data); + } else { + return $data; + } + } + /** + * Get the most current data for a website or domain. (webResource.get) + * + * @param string $id The id of a verified site or domain. + * @return SiteVerificationWebResourceResource + */ + public function get($id, $optParams = array()) { + $params = array('id' => $id); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new SiteVerificationWebResourceResource($data); + } else { + return $data; + } + } + /** + * Get the list of your verified websites and domains. (webResource.list) + * + * @return SiteVerificationWebResourceListResponse + */ + public function listWebResource($optParams = array()) { + $params = array(); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new SiteVerificationWebResourceListResponse($data); + } else { + return $data; + } + } + /** + * Modify the list of owners for your website or domain. (webResource.update) + * + * @param string $id The id of a verified site or domain. + * @param SiteVerificationWebResourceResource $postBody + * @return SiteVerificationWebResourceResource + */ + public function update($id, SiteVerificationWebResourceResource $postBody, $optParams = array()) { + $params = array('id' => $id, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('update', array($params)); + if ($this->useObjects()) { + return new SiteVerificationWebResourceResource($data); + } else { + return $data; + } + } + /** + * Modify the list of owners for your website or domain. This method supports patch semantics. + * (webResource.patch) + * + * @param string $id The id of a verified site or domain. + * @param SiteVerificationWebResourceResource $postBody + * @return SiteVerificationWebResourceResource + */ + public function patch($id, SiteVerificationWebResourceResource $postBody, $optParams = array()) { + $params = array('id' => $id, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('patch', array($params)); + if ($this->useObjects()) { + return new SiteVerificationWebResourceResource($data); + } else { + return $data; + } + } + /** + * Get a verification token for placing on a website or domain. (webResource.getToken) + * + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string verificationMethod The method to use for verifying a site or domain. + * @opt_param string identifier The URL or domain to verify. + * @opt_param string type Type of resource to verify. Can be 'site' (URL) or 'inet_domain' (domain name). + * @return SiteVerificationWebResourceGettokenResponse + */ + public function getToken($optParams = array()) { + $params = array(); + $params = array_merge($params, $optParams); + $data = $this->__call('getToken', array($params)); + if ($this->useObjects()) { + return new SiteVerificationWebResourceGettokenResponse($data); + } else { + return $data; + } + } + /** + * Relinquish ownership of a website or domain. (webResource.delete) + * + * @param string $id The id of a verified site or domain. + */ + public function delete($id, $optParams = array()) { + $params = array('id' => $id); + $params = array_merge($params, $optParams); + $data = $this->__call('delete', array($params)); + return $data; + } + } + + + +/** + * Service definition for SiteVerification (v1). + * + *

+ * Lets you programatically verify ownership of websites or domains with Google. + *

+ * + *

+ * For more information about this service, see the + * API Documentation + *

+ * + * @author Google, Inc. + */ +class apiSiteVerificationService extends apiService { + public $webResource; + /** + * Constructs the internal representation of the SiteVerification service. + * + * @param apiClient apiClient + */ + public function __construct(apiClient $apiClient) { + $this->rpcPath = '/rpc'; + $this->restBasePath = '/siteVerification/v1/'; + $this->version = 'v1'; + $this->serviceName = 'siteVerification'; + + $apiClient->addService($this->serviceName, $this->version); + $this->webResource = new WebResourceServiceResource($this, $this->serviceName, 'webResource', json_decode('{"methods": {"insert": {"scopes": ["https://www.googleapis.com/auth/siteverification"], "parameters": {"verificationMethod": {"required": true, "type": "string", "location": "query"}}, "request": {"$ref": "SiteVerificationWebResourceResource"}, "id": "siteVerification.webResource.insert", "httpMethod": "POST", "path": "webResource", "response": {"$ref": "SiteVerificationWebResourceResource"}}, "get": {"scopes": ["https://www.googleapis.com/auth/siteverification"], "parameters": {"id": {"required": true, "type": "string", "location": "path"}}, "id": "siteVerification.webResource.get", "httpMethod": "GET", "path": "webResource/{id}", "response": {"$ref": "SiteVerificationWebResourceResource"}}, "list": {"scopes": ["https://www.googleapis.com/auth/siteverification"], "id": "siteVerification.webResource.list", "httpMethod": "GET", "path": "webResource", "response": {"$ref": "SiteVerificationWebResourceListResponse"}}, "update": {"scopes": ["https://www.googleapis.com/auth/siteverification"], "parameters": {"id": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "SiteVerificationWebResourceResource"}, "id": "siteVerification.webResource.update", "httpMethod": "PUT", "path": "webResource/{id}", "response": {"$ref": "SiteVerificationWebResourceResource"}}, "patch": {"scopes": ["https://www.googleapis.com/auth/siteverification"], "parameters": {"id": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "SiteVerificationWebResourceResource"}, "id": "siteVerification.webResource.patch", "httpMethod": "PATCH", "path": "webResource/{id}", "response": {"$ref": "SiteVerificationWebResourceResource"}}, "getToken": {"scopes": ["https://www.googleapis.com/auth/siteverification"], "parameters": {"type": {"type": "string", "location": "query"}, "identifier": {"type": "string", "location": "query"}, "verificationMethod": {"type": "string", "location": "query"}}, "response": {"$ref": "SiteVerificationWebResourceGettokenResponse"}, "httpMethod": "GET", "path": "token", "id": "siteVerification.webResource.getToken"}, "delete": {"scopes": ["https://www.googleapis.com/auth/siteverification"], "parameters": {"id": {"required": true, "type": "string", "location": "path"}}, "httpMethod": "DELETE", "path": "webResource/{id}", "id": "siteVerification.webResource.delete"}}}', true)); + } +} + +class SiteVerificationWebResourceGettokenRequest extends apiModel { + public $verificationMethod; + protected $__siteType = 'SiteVerificationWebResourceGettokenRequestSite'; + protected $__siteDataType = ''; + public $site; + public function setVerificationMethod($verificationMethod) { + $this->verificationMethod = $verificationMethod; + } + public function getVerificationMethod() { + return $this->verificationMethod; + } + public function setSite(SiteVerificationWebResourceGettokenRequestSite $site) { + $this->site = $site; + } + public function getSite() { + return $this->site; + } +} + +class SiteVerificationWebResourceGettokenRequestSite extends apiModel { + public $identifier; + public $type; + public function setIdentifier($identifier) { + $this->identifier = $identifier; + } + public function getIdentifier() { + return $this->identifier; + } + public function setType($type) { + $this->type = $type; + } + public function getType() { + return $this->type; + } +} + +class SiteVerificationWebResourceGettokenResponse extends apiModel { + public $token; + public $method; + public function setToken($token) { + $this->token = $token; + } + public function getToken() { + return $this->token; + } + public function setMethod($method) { + $this->method = $method; + } + public function getMethod() { + return $this->method; + } +} + +class SiteVerificationWebResourceListResponse extends apiModel { + protected $__itemsType = 'SiteVerificationWebResourceResource'; + protected $__itemsDataType = 'array'; + public $items; + public function setItems(/* array(SiteVerificationWebResourceResource) */ $items) { + $this->assertIsArray($items, 'SiteVerificationWebResourceResource', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } +} + +class SiteVerificationWebResourceResource extends apiModel { + public $owners; + public $id; + protected $__siteType = 'SiteVerificationWebResourceResourceSite'; + protected $__siteDataType = ''; + public $site; + public function setOwners(/* array(string) */ $owners) { + $this->assertIsArray($owners, 'string', __METHOD__); + $this->owners = $owners; + } + public function getOwners() { + return $this->owners; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setSite(SiteVerificationWebResourceResourceSite $site) { + $this->site = $site; + } + public function getSite() { + return $this->site; + } +} + +class SiteVerificationWebResourceResourceSite extends apiModel { + public $identifier; + public $type; + public function setIdentifier($identifier) { + $this->identifier = $identifier; + } + public function getIdentifier() { + return $this->identifier; + } + public function setType($type) { + $this->type = $type; + } + public function getType() { + return $this->type; + } +} diff --git a/webui/google-api/contrib/apiTasksService.php b/webui/google-api/contrib/apiTasksService.php new file mode 100644 index 0000000..c6b7a42 --- /dev/null +++ b/webui/google-api/contrib/apiTasksService.php @@ -0,0 +1,571 @@ + + * $tasksService = new apiTasksService(...); + * $tasks = $tasksService->tasks; + * + */ + class TasksServiceResource extends apiServiceResource { + + + /** + * Creates a new task on the specified task list. (tasks.insert) + * + * @param string $tasklist Task list identifier. + * @param Task $postBody + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string parent Parent task identifier. If the task is created at the top level, this parameter is omitted. Optional. + * @opt_param string previous Previous sibling task identifier. If the task is created at the first position among its siblings, this parameter is omitted. Optional. + * @return Task + */ + public function insert($tasklist, Task $postBody, $optParams = array()) { + $params = array('tasklist' => $tasklist, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('insert', array($params)); + if ($this->useObjects()) { + return new Task($data); + } else { + return $data; + } + } + /** + * Returns the specified task. (tasks.get) + * + * @param string $tasklist Task list identifier. + * @param string $task Task identifier. + * @return Task + */ + public function get($tasklist, $task, $optParams = array()) { + $params = array('tasklist' => $tasklist, 'task' => $task); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new Task($data); + } else { + return $data; + } + } + /** + * Clears all completed tasks from the specified task list. The affected tasks will be marked as + * 'hidden' and no longer be returned by default when retrieving all tasks for a task list. + * (tasks.clear) + * + * @param string $tasklist Task list identifier. + */ + public function clear($tasklist, $optParams = array()) { + $params = array('tasklist' => $tasklist); + $params = array_merge($params, $optParams); + $data = $this->__call('clear', array($params)); + return $data; + } + /** + * Moves the specified task to another position in the task list. This can include putting it as a + * child task under a new parent and/or move it to a different position among its sibling tasks. + * (tasks.move) + * + * @param string $tasklist Task list identifier. + * @param string $task Task identifier. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string parent New parent task identifier. If the task is moved to the top level, this parameter is omitted. Optional. + * @opt_param string previous New previous sibling task identifier. If the task is moved to the first position among its siblings, this parameter is omitted. Optional. + * @return Task + */ + public function move($tasklist, $task, $optParams = array()) { + $params = array('tasklist' => $tasklist, 'task' => $task); + $params = array_merge($params, $optParams); + $data = $this->__call('move', array($params)); + if ($this->useObjects()) { + return new Task($data); + } else { + return $data; + } + } + /** + * Returns all tasks in the specified task list. (tasks.list) + * + * @param string $tasklist Task list identifier. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string dueMax Upper bound for a task's due date (as a RFC 3339 timestamp) to filter by. Optional. The default is not to filter by due date. + * @opt_param bool showDeleted Flag indicating whether deleted tasks are returned in the result. Optional. The default is False. + * @opt_param string updatedMin Lower bound for a task's last modification time (as a RFC 3339 timestamp) to filter by. Optional. The default is not to filter by last modification time. + * @opt_param string completedMin Lower bound for a task's completion date (as a RFC 3339 timestamp) to filter by. Optional. The default is not to filter by completion date. + * @opt_param string maxResults Maximum number of task lists returned on one page. Optional. The default is 100. + * @opt_param bool showCompleted Flag indicating whether completed tasks are returned in the result. Optional. The default is True. + * @opt_param string pageToken Token specifying the result page to return. Optional. + * @opt_param string completedMax Upper bound for a task's completion date (as a RFC 3339 timestamp) to filter by. Optional. The default is not to filter by completion date. + * @opt_param bool showHidden Flag indicating whether hidden tasks are returned in the result. Optional. The default is False. + * @opt_param string dueMin Lower bound for a task's due date (as a RFC 3339 timestamp) to filter by. Optional. The default is not to filter by due date. + * @return Tasks + */ + public function listTasks($tasklist, $optParams = array()) { + $params = array('tasklist' => $tasklist); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new Tasks($data); + } else { + return $data; + } + } + /** + * Updates the specified task. (tasks.update) + * + * @param string $tasklist Task list identifier. + * @param string $task Task identifier. + * @param Task $postBody + * @return Task + */ + public function update($tasklist, $task, Task $postBody, $optParams = array()) { + $params = array('tasklist' => $tasklist, 'task' => $task, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('update', array($params)); + if ($this->useObjects()) { + return new Task($data); + } else { + return $data; + } + } + /** + * Updates the specified task. This method supports patch semantics. (tasks.patch) + * + * @param string $tasklist Task list identifier. + * @param string $task Task identifier. + * @param Task $postBody + * @return Task + */ + public function patch($tasklist, $task, Task $postBody, $optParams = array()) { + $params = array('tasklist' => $tasklist, 'task' => $task, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('patch', array($params)); + if ($this->useObjects()) { + return new Task($data); + } else { + return $data; + } + } + /** + * Deletes the specified task from the task list. (tasks.delete) + * + * @param string $tasklist Task list identifier. + * @param string $task Task identifier. + */ + public function delete($tasklist, $task, $optParams = array()) { + $params = array('tasklist' => $tasklist, 'task' => $task); + $params = array_merge($params, $optParams); + $data = $this->__call('delete', array($params)); + return $data; + } + } + + /** + * The "tasklists" collection of methods. + * Typical usage is: + * + * $tasksService = new apiTasksService(...); + * $tasklists = $tasksService->tasklists; + * + */ + class TasklistsServiceResource extends apiServiceResource { + + + /** + * Creates a new task list and adds it to the authenticated user's task lists. (tasklists.insert) + * + * @param TaskList $postBody + * @return TaskList + */ + public function insert(TaskList $postBody, $optParams = array()) { + $params = array('postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('insert', array($params)); + if ($this->useObjects()) { + return new TaskList($data); + } else { + return $data; + } + } + /** + * Returns the authenticated user's specified task list. (tasklists.get) + * + * @param string $tasklist Task list identifier. + * @return TaskList + */ + public function get($tasklist, $optParams = array()) { + $params = array('tasklist' => $tasklist); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new TaskList($data); + } else { + return $data; + } + } + /** + * Returns all the authenticated user's task lists. (tasklists.list) + * + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string pageToken Token specifying the result page to return. Optional. + * @opt_param string maxResults Maximum number of task lists returned on one page. Optional. The default is 100. + * @return TaskLists + */ + public function listTasklists($optParams = array()) { + $params = array(); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new TaskLists($data); + } else { + return $data; + } + } + /** + * Updates the authenticated user's specified task list. (tasklists.update) + * + * @param string $tasklist Task list identifier. + * @param TaskList $postBody + * @return TaskList + */ + public function update($tasklist, TaskList $postBody, $optParams = array()) { + $params = array('tasklist' => $tasklist, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('update', array($params)); + if ($this->useObjects()) { + return new TaskList($data); + } else { + return $data; + } + } + /** + * Updates the authenticated user's specified task list. This method supports patch semantics. + * (tasklists.patch) + * + * @param string $tasklist Task list identifier. + * @param TaskList $postBody + * @return TaskList + */ + public function patch($tasklist, TaskList $postBody, $optParams = array()) { + $params = array('tasklist' => $tasklist, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('patch', array($params)); + if ($this->useObjects()) { + return new TaskList($data); + } else { + return $data; + } + } + /** + * Deletes the authenticated user's specified task list. (tasklists.delete) + * + * @param string $tasklist Task list identifier. + */ + public function delete($tasklist, $optParams = array()) { + $params = array('tasklist' => $tasklist); + $params = array_merge($params, $optParams); + $data = $this->__call('delete', array($params)); + return $data; + } + } + + + +/** + * Service definition for Tasks (v1). + * + *

+ * Lets you manage your tasks and task lists. + *

+ * + *

+ * For more information about this service, see the + * API Documentation + *

+ * + * @author Google, Inc. + */ +class apiTasksService extends apiService { + public $tasks; + public $tasklists; + /** + * Constructs the internal representation of the Tasks service. + * + * @param apiClient apiClient + */ + public function __construct(apiClient $apiClient) { + $this->rpcPath = '/rpc'; + $this->restBasePath = '/tasks/v1/'; + $this->version = 'v1'; + $this->serviceName = 'tasks'; + + $apiClient->addService($this->serviceName, $this->version); + $this->tasks = new TasksServiceResource($this, $this->serviceName, 'tasks', json_decode('{"methods": {"insert": {"scopes": ["https://www.googleapis.com/auth/tasks"], "parameters": {"tasklist": {"required": true, "type": "string", "location": "path"}, "parent": {"type": "string", "location": "query"}, "previous": {"type": "string", "location": "query"}}, "request": {"$ref": "Task"}, "id": "tasks.tasks.insert", "httpMethod": "POST", "path": "lists/{tasklist}/tasks", "response": {"$ref": "Task"}}, "get": {"scopes": ["https://www.googleapis.com/auth/tasks", "https://www.googleapis.com/auth/tasks.readonly"], "parameters": {"tasklist": {"required": true, "type": "string", "location": "path"}, "task": {"required": true, "type": "string", "location": "path"}}, "id": "tasks.tasks.get", "httpMethod": "GET", "path": "lists/{tasklist}/tasks/{task}", "response": {"$ref": "Task"}}, "clear": {"scopes": ["https://www.googleapis.com/auth/tasks"], "parameters": {"tasklist": {"required": true, "type": "string", "location": "path"}}, "httpMethod": "POST", "path": "lists/{tasklist}/clear", "id": "tasks.tasks.clear"}, "move": {"scopes": ["https://www.googleapis.com/auth/tasks"], "parameters": {"previous": {"type": "string", "location": "query"}, "tasklist": {"required": true, "type": "string", "location": "path"}, "parent": {"type": "string", "location": "query"}, "task": {"required": true, "type": "string", "location": "path"}}, "id": "tasks.tasks.move", "httpMethod": "POST", "path": "lists/{tasklist}/tasks/{task}/move", "response": {"$ref": "Task"}}, "list": {"scopes": ["https://www.googleapis.com/auth/tasks", "https://www.googleapis.com/auth/tasks.readonly"], "parameters": {"dueMax": {"type": "string", "location": "query"}, "tasklist": {"required": true, "type": "string", "location": "path"}, "pageToken": {"type": "string", "location": "query"}, "updatedMin": {"type": "string", "location": "query"}, "completedMin": {"type": "string", "location": "query"}, "maxResults": {"format": "int64", "type": "string", "location": "query"}, "showCompleted": {"type": "boolean", "location": "query"}, "showDeleted": {"type": "boolean", "location": "query"}, "completedMax": {"type": "string", "location": "query"}, "showHidden": {"type": "boolean", "location": "query"}, "dueMin": {"type": "string", "location": "query"}}, "id": "tasks.tasks.list", "httpMethod": "GET", "path": "lists/{tasklist}/tasks", "response": {"$ref": "Tasks"}}, "update": {"scopes": ["https://www.googleapis.com/auth/tasks"], "parameters": {"tasklist": {"required": true, "type": "string", "location": "path"}, "task": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "Task"}, "id": "tasks.tasks.update", "httpMethod": "PUT", "path": "lists/{tasklist}/tasks/{task}", "response": {"$ref": "Task"}}, "patch": {"scopes": ["https://www.googleapis.com/auth/tasks"], "parameters": {"tasklist": {"required": true, "type": "string", "location": "path"}, "task": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "Task"}, "id": "tasks.tasks.patch", "httpMethod": "PATCH", "path": "lists/{tasklist}/tasks/{task}", "response": {"$ref": "Task"}}, "delete": {"scopes": ["https://www.googleapis.com/auth/tasks"], "parameters": {"tasklist": {"required": true, "type": "string", "location": "path"}, "task": {"required": true, "type": "string", "location": "path"}}, "httpMethod": "DELETE", "path": "lists/{tasklist}/tasks/{task}", "id": "tasks.tasks.delete"}}}', true)); + $this->tasklists = new TasklistsServiceResource($this, $this->serviceName, 'tasklists', json_decode('{"methods": {"insert": {"scopes": ["https://www.googleapis.com/auth/tasks"], "request": {"$ref": "TaskList"}, "response": {"$ref": "TaskList"}, "httpMethod": "POST", "path": "users/@me/lists", "id": "tasks.tasklists.insert"}, "get": {"scopes": ["https://www.googleapis.com/auth/tasks", "https://www.googleapis.com/auth/tasks.readonly"], "parameters": {"tasklist": {"required": true, "type": "string", "location": "path"}}, "id": "tasks.tasklists.get", "httpMethod": "GET", "path": "users/@me/lists/{tasklist}", "response": {"$ref": "TaskList"}}, "list": {"scopes": ["https://www.googleapis.com/auth/tasks", "https://www.googleapis.com/auth/tasks.readonly"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "maxResults": {"format": "int64", "type": "string", "location": "query"}}, "response": {"$ref": "TaskLists"}, "httpMethod": "GET", "path": "users/@me/lists", "id": "tasks.tasklists.list"}, "update": {"scopes": ["https://www.googleapis.com/auth/tasks"], "parameters": {"tasklist": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "TaskList"}, "id": "tasks.tasklists.update", "httpMethod": "PUT", "path": "users/@me/lists/{tasklist}", "response": {"$ref": "TaskList"}}, "patch": {"scopes": ["https://www.googleapis.com/auth/tasks"], "parameters": {"tasklist": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "TaskList"}, "id": "tasks.tasklists.patch", "httpMethod": "PATCH", "path": "users/@me/lists/{tasklist}", "response": {"$ref": "TaskList"}}, "delete": {"scopes": ["https://www.googleapis.com/auth/tasks"], "parameters": {"tasklist": {"required": true, "type": "string", "location": "path"}}, "httpMethod": "DELETE", "path": "users/@me/lists/{tasklist}", "id": "tasks.tasklists.delete"}}}', true)); + } +} + +class Task extends apiModel { + public $status; + public $kind; + public $updated; + public $parent; + protected $__linksType = 'TaskLinks'; + protected $__linksDataType = 'array'; + public $links; + public $title; + public $deleted; + public $completed; + public $due; + public $etag; + public $notes; + public $position; + public $hidden; + public $id; + public $selfLink; + public function setStatus($status) { + $this->status = $status; + } + public function getStatus() { + return $this->status; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setUpdated($updated) { + $this->updated = $updated; + } + public function getUpdated() { + return $this->updated; + } + public function setParent($parent) { + $this->parent = $parent; + } + public function getParent() { + return $this->parent; + } + public function setLinks(/* array(TaskLinks) */ $links) { + $this->assertIsArray($links, 'TaskLinks', __METHOD__); + $this->links = $links; + } + public function getLinks() { + return $this->links; + } + public function setTitle($title) { + $this->title = $title; + } + public function getTitle() { + return $this->title; + } + public function setDeleted($deleted) { + $this->deleted = $deleted; + } + public function getDeleted() { + return $this->deleted; + } + public function setCompleted($completed) { + $this->completed = $completed; + } + public function getCompleted() { + return $this->completed; + } + public function setDue($due) { + $this->due = $due; + } + public function getDue() { + return $this->due; + } + public function setEtag($etag) { + $this->etag = $etag; + } + public function getEtag() { + return $this->etag; + } + public function setNotes($notes) { + $this->notes = $notes; + } + public function getNotes() { + return $this->notes; + } + public function setPosition($position) { + $this->position = $position; + } + public function getPosition() { + return $this->position; + } + public function setHidden($hidden) { + $this->hidden = $hidden; + } + public function getHidden() { + return $this->hidden; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setSelfLink($selfLink) { + $this->selfLink = $selfLink; + } + public function getSelfLink() { + return $this->selfLink; + } +} + +class TaskLinks extends apiModel { + public $type; + public $link; + public $description; + public function setType($type) { + $this->type = $type; + } + public function getType() { + return $this->type; + } + public function setLink($link) { + $this->link = $link; + } + public function getLink() { + return $this->link; + } + public function setDescription($description) { + $this->description = $description; + } + public function getDescription() { + return $this->description; + } +} + +class TaskList extends apiModel { + public $kind; + public $etag; + public $id; + public $selfLink; + public $title; + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setEtag($etag) { + $this->etag = $etag; + } + public function getEtag() { + return $this->etag; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + public function setSelfLink($selfLink) { + $this->selfLink = $selfLink; + } + public function getSelfLink() { + return $this->selfLink; + } + public function setTitle($title) { + $this->title = $title; + } + public function getTitle() { + return $this->title; + } +} + +class TaskLists extends apiModel { + public $nextPageToken; + protected $__itemsType = 'TaskList'; + protected $__itemsDataType = 'array'; + public $items; + public $kind; + public $etag; + public function setNextPageToken($nextPageToken) { + $this->nextPageToken = $nextPageToken; + } + public function getNextPageToken() { + return $this->nextPageToken; + } + public function setItems(/* array(TaskList) */ $items) { + $this->assertIsArray($items, 'TaskList', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setEtag($etag) { + $this->etag = $etag; + } + public function getEtag() { + return $this->etag; + } +} + +class Tasks extends apiModel { + public $nextPageToken; + protected $__itemsType = 'Task'; + protected $__itemsDataType = 'array'; + public $items; + public $kind; + public $etag; + public function setNextPageToken($nextPageToken) { + $this->nextPageToken = $nextPageToken; + } + public function getNextPageToken() { + return $this->nextPageToken; + } + public function setItems(/* array(Task) */ $items) { + $this->assertIsArray($items, 'Task', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setEtag($etag) { + $this->etag = $etag; + } + public function getEtag() { + return $this->etag; + } +} diff --git a/webui/google-api/contrib/apiTranslateService.php b/webui/google-api/contrib/apiTranslateService.php new file mode 100644 index 0000000..9a41af2 --- /dev/null +++ b/webui/google-api/contrib/apiTranslateService.php @@ -0,0 +1,254 @@ + + * $translateService = new apiTranslateService(...); + * $languages = $translateService->languages; + * + */ + class LanguagesServiceResource extends apiServiceResource { + + + /** + * List the source/target languages supported by the API (languages.list) + * + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string target the language and collation in which the localized results should be returned + * @return LanguagesListResponse + */ + public function listLanguages($optParams = array()) { + $params = array(); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new LanguagesListResponse($data); + } else { + return $data; + } + } + } + + /** + * The "detections" collection of methods. + * Typical usage is: + * + * $translateService = new apiTranslateService(...); + * $detections = $translateService->detections; + * + */ + class DetectionsServiceResource extends apiServiceResource { + + + /** + * Detect the language of text. (detections.list) + * + * @param string $q The text to detect + * @return DetectionsListResponse + */ + public function listDetections($q, $optParams = array()) { + $params = array('q' => $q); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new DetectionsListResponse($data); + } else { + return $data; + } + } + } + + /** + * The "translations" collection of methods. + * Typical usage is: + * + * $translateService = new apiTranslateService(...); + * $translations = $translateService->translations; + * + */ + class TranslationsServiceResource extends apiServiceResource { + + + /** + * Returns text translations from one language to another. (translations.list) + * + * @param string $q The text to translate + * @param string $target The target language into which the text should be translated + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string source The source language of the text + * @opt_param string format The format of the text + * @opt_param string cid The customization id for translate + * @return TranslationsListResponse + */ + public function listTranslations($q, $target, $optParams = array()) { + $params = array('q' => $q, 'target' => $target); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new TranslationsListResponse($data); + } else { + return $data; + } + } + } + + + +/** + * Service definition for Translate (v2). + * + *

+ * Lets you translate text from one language to another + *

+ * + *

+ * For more information about this service, see the + * API Documentation + *

+ * + * @author Google, Inc. + */ +class apiTranslateService extends apiService { + public $languages; + public $detections; + public $translations; + /** + * Constructs the internal representation of the Translate service. + * + * @param apiClient apiClient + */ + public function __construct(apiClient $apiClient) { + $this->rpcPath = '/rpc'; + $this->restBasePath = '/language/translate/'; + $this->version = 'v2'; + $this->serviceName = 'translate'; + + $apiClient->addService($this->serviceName, $this->version); + $this->languages = new LanguagesServiceResource($this, $this->serviceName, 'languages', json_decode('{"methods": {"list": {"parameters": {"target": {"type": "string", "location": "query"}}, "id": "language.languages.list", "httpMethod": "GET", "path": "v2/languages", "response": {"$ref": "LanguagesListResponse"}}}}', true)); + $this->detections = new DetectionsServiceResource($this, $this->serviceName, 'detections', json_decode('{"methods": {"list": {"parameters": {"q": {"repeated": true, "required": true, "type": "string", "location": "query"}}, "id": "language.detections.list", "httpMethod": "GET", "path": "v2/detect", "response": {"$ref": "DetectionsListResponse"}}}}', true)); + $this->translations = new TranslationsServiceResource($this, $this->serviceName, 'translations', json_decode('{"methods": {"list": {"parameters": {"q": {"repeated": true, "required": true, "type": "string", "location": "query"}, "source": {"type": "string", "location": "query"}, "cid": {"repeated": true, "type": "string", "location": "query"}, "target": {"required": true, "type": "string", "location": "query"}, "format": {"enum": ["html", "text"], "type": "string", "location": "query"}}, "id": "language.translations.list", "httpMethod": "GET", "path": "v2", "response": {"$ref": "TranslationsListResponse"}}}}', true)); + } +} + +class DetectionsListResponse extends apiModel { + protected $__detectionsType = 'DetectionsResourceItems'; + protected $__detectionsDataType = 'array'; + public $detections; + public function setDetections(/* array(DetectionsResourceItems) */ $detections) { + $this->assertIsArray($detections, 'DetectionsResourceItems', __METHOD__); + $this->detections = $detections; + } + public function getDetections() { + return $this->detections; + } +} + +class DetectionsResource extends apiModel { +} + +class DetectionsResourceItems extends apiModel { + public $isReliable; + public $confidence; + public $language; + public function setIsReliable($isReliable) { + $this->isReliable = $isReliable; + } + public function getIsReliable() { + return $this->isReliable; + } + public function setConfidence($confidence) { + $this->confidence = $confidence; + } + public function getConfidence() { + return $this->confidence; + } + public function setLanguage($language) { + $this->language = $language; + } + public function getLanguage() { + return $this->language; + } +} + +class LanguagesListResponse extends apiModel { + protected $__languagesType = 'LanguagesResource'; + protected $__languagesDataType = 'array'; + public $languages; + public function setLanguages(/* array(LanguagesResource) */ $languages) { + $this->assertIsArray($languages, 'LanguagesResource', __METHOD__); + $this->languages = $languages; + } + public function getLanguages() { + return $this->languages; + } +} + +class LanguagesResource extends apiModel { + public $name; + public $language; + public function setName($name) { + $this->name = $name; + } + public function getName() { + return $this->name; + } + public function setLanguage($language) { + $this->language = $language; + } + public function getLanguage() { + return $this->language; + } +} + +class TranslationsListResponse extends apiModel { + protected $__translationsType = 'TranslationsResource'; + protected $__translationsDataType = 'array'; + public $translations; + public function setTranslations(/* array(TranslationsResource) */ $translations) { + $this->assertIsArray($translations, 'TranslationsResource', __METHOD__); + $this->translations = $translations; + } + public function getTranslations() { + return $this->translations; + } +} + +class TranslationsResource extends apiModel { + public $detectedSourceLanguage; + public $translatedText; + public function setDetectedSourceLanguage($detectedSourceLanguage) { + $this->detectedSourceLanguage = $detectedSourceLanguage; + } + public function getDetectedSourceLanguage() { + return $this->detectedSourceLanguage; + } + public function setTranslatedText($translatedText) { + $this->translatedText = $translatedText; + } + public function getTranslatedText() { + return $this->translatedText; + } +} diff --git a/webui/google-api/contrib/apiUrlshortenerService.php b/webui/google-api/contrib/apiUrlshortenerService.php new file mode 100644 index 0000000..a45211b --- /dev/null +++ b/webui/google-api/contrib/apiUrlshortenerService.php @@ -0,0 +1,332 @@ + + * $urlshortenerService = new apiUrlshortenerService(...); + * $url = $urlshortenerService->url; + * + */ + class UrlServiceResource extends apiServiceResource { + + + /** + * Creates a new short URL. (url.insert) + * + * @param Url $postBody + * @return Url + */ + public function insert(Url $postBody, $optParams = array()) { + $params = array('postBody' => $postBody); + $params = array_merge($params, $optParams); + $data = $this->__call('insert', array($params)); + if ($this->useObjects()) { + return new Url($data); + } else { + return $data; + } + } + /** + * Retrieves a list of URLs shortened by a user. (url.list) + * + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string start-token Token for requesting successive pages of results. + * @opt_param string projection Additional information to return. + * @return UrlHistory + */ + public function listUrl($optParams = array()) { + $params = array(); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new UrlHistory($data); + } else { + return $data; + } + } + /** + * Expands a short URL or gets creation time and analytics. (url.get) + * + * @param string $shortUrl The short URL, including the protocol. + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string projection Additional information to return. + * @return Url + */ + public function get($shortUrl, $optParams = array()) { + $params = array('shortUrl' => $shortUrl); + $params = array_merge($params, $optParams); + $data = $this->__call('get', array($params)); + if ($this->useObjects()) { + return new Url($data); + } else { + return $data; + } + } + } + + + +/** + * Service definition for Urlshortener (v1). + * + *

+ * Lets you create, inspect, and manage goo.gl short URLs + *

+ * + *

+ * For more information about this service, see the + * API Documentation + *

+ * + * @author Google, Inc. + */ +class apiUrlshortenerService extends apiService { + public $url; + /** + * Constructs the internal representation of the Urlshortener service. + * + * @param apiClient apiClient + */ + public function __construct(apiClient $apiClient) { + $this->rpcPath = '/rpc'; + $this->restBasePath = '/urlshortener/v1/'; + $this->version = 'v1'; + $this->serviceName = 'urlshortener'; + + $apiClient->addService($this->serviceName, $this->version); + $this->url = new UrlServiceResource($this, $this->serviceName, 'url', json_decode('{"methods": {"insert": {"scopes": ["https://www.googleapis.com/auth/urlshortener"], "request": {"$ref": "Url"}, "response": {"$ref": "Url"}, "httpMethod": "POST", "path": "url", "id": "urlshortener.url.insert"}, "list": {"scopes": ["https://www.googleapis.com/auth/urlshortener"], "parameters": {"start-token": {"type": "string", "location": "query"}, "projection": {"enum": ["ANALYTICS_CLICKS", "FULL"], "type": "string", "location": "query"}}, "response": {"$ref": "UrlHistory"}, "httpMethod": "GET", "path": "url/history", "id": "urlshortener.url.list"}, "get": {"parameters": {"shortUrl": {"required": true, "type": "string", "location": "query"}, "projection": {"enum": ["ANALYTICS_CLICKS", "ANALYTICS_TOP_STRINGS", "FULL"], "type": "string", "location": "query"}}, "id": "urlshortener.url.get", "httpMethod": "GET", "path": "url", "response": {"$ref": "Url"}}}}', true)); + } +} + +class AnalyticsSnapshot extends apiModel { + public $shortUrlClicks; + protected $__countriesType = 'StringCount'; + protected $__countriesDataType = 'array'; + public $countries; + protected $__platformsType = 'StringCount'; + protected $__platformsDataType = 'array'; + public $platforms; + protected $__browsersType = 'StringCount'; + protected $__browsersDataType = 'array'; + public $browsers; + protected $__referrersType = 'StringCount'; + protected $__referrersDataType = 'array'; + public $referrers; + public $longUrlClicks; + public function setShortUrlClicks($shortUrlClicks) { + $this->shortUrlClicks = $shortUrlClicks; + } + public function getShortUrlClicks() { + return $this->shortUrlClicks; + } + public function setCountries(/* array(StringCount) */ $countries) { + $this->assertIsArray($countries, 'StringCount', __METHOD__); + $this->countries = $countries; + } + public function getCountries() { + return $this->countries; + } + public function setPlatforms(/* array(StringCount) */ $platforms) { + $this->assertIsArray($platforms, 'StringCount', __METHOD__); + $this->platforms = $platforms; + } + public function getPlatforms() { + return $this->platforms; + } + public function setBrowsers(/* array(StringCount) */ $browsers) { + $this->assertIsArray($browsers, 'StringCount', __METHOD__); + $this->browsers = $browsers; + } + public function getBrowsers() { + return $this->browsers; + } + public function setReferrers(/* array(StringCount) */ $referrers) { + $this->assertIsArray($referrers, 'StringCount', __METHOD__); + $this->referrers = $referrers; + } + public function getReferrers() { + return $this->referrers; + } + public function setLongUrlClicks($longUrlClicks) { + $this->longUrlClicks = $longUrlClicks; + } + public function getLongUrlClicks() { + return $this->longUrlClicks; + } +} + +class AnalyticsSummary extends apiModel { + protected $__weekType = 'AnalyticsSnapshot'; + protected $__weekDataType = ''; + public $week; + protected $__allTimeType = 'AnalyticsSnapshot'; + protected $__allTimeDataType = ''; + public $allTime; + protected $__twoHoursType = 'AnalyticsSnapshot'; + protected $__twoHoursDataType = ''; + public $twoHours; + protected $__dayType = 'AnalyticsSnapshot'; + protected $__dayDataType = ''; + public $day; + protected $__monthType = 'AnalyticsSnapshot'; + protected $__monthDataType = ''; + public $month; + public function setWeek(AnalyticsSnapshot $week) { + $this->week = $week; + } + public function getWeek() { + return $this->week; + } + public function setAllTime(AnalyticsSnapshot $allTime) { + $this->allTime = $allTime; + } + public function getAllTime() { + return $this->allTime; + } + public function setTwoHours(AnalyticsSnapshot $twoHours) { + $this->twoHours = $twoHours; + } + public function getTwoHours() { + return $this->twoHours; + } + public function setDay(AnalyticsSnapshot $day) { + $this->day = $day; + } + public function getDay() { + return $this->day; + } + public function setMonth(AnalyticsSnapshot $month) { + $this->month = $month; + } + public function getMonth() { + return $this->month; + } +} + +class StringCount extends apiModel { + public $count; + public $id; + public function setCount($count) { + $this->count = $count; + } + public function getCount() { + return $this->count; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } +} + +class Url extends apiModel { + public $status; + public $kind; + public $created; + protected $__analyticsType = 'AnalyticsSummary'; + protected $__analyticsDataType = ''; + public $analytics; + public $longUrl; + public $id; + public function setStatus($status) { + $this->status = $status; + } + public function getStatus() { + return $this->status; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setCreated($created) { + $this->created = $created; + } + public function getCreated() { + return $this->created; + } + public function setAnalytics(AnalyticsSummary $analytics) { + $this->analytics = $analytics; + } + public function getAnalytics() { + return $this->analytics; + } + public function setLongUrl($longUrl) { + $this->longUrl = $longUrl; + } + public function getLongUrl() { + return $this->longUrl; + } + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } +} + +class UrlHistory extends apiModel { + public $nextPageToken; + protected $__itemsType = 'Url'; + protected $__itemsDataType = 'array'; + public $items; + public $kind; + public $itemsPerPage; + public $totalItems; + public function setNextPageToken($nextPageToken) { + $this->nextPageToken = $nextPageToken; + } + public function getNextPageToken() { + return $this->nextPageToken; + } + public function setItems(/* array(Url) */ $items) { + $this->assertIsArray($items, 'Url', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setItemsPerPage($itemsPerPage) { + $this->itemsPerPage = $itemsPerPage; + } + public function getItemsPerPage() { + return $this->itemsPerPage; + } + public function setTotalItems($totalItems) { + $this->totalItems = $totalItems; + } + public function getTotalItems() { + return $this->totalItems; + } +} diff --git a/webui/google-api/contrib/apiWebfontsService.php b/webui/google-api/contrib/apiWebfontsService.php new file mode 100644 index 0000000..ff26ca5 --- /dev/null +++ b/webui/google-api/contrib/apiWebfontsService.php @@ -0,0 +1,138 @@ + + * $webfontsService = new apiWebfontsService(...); + * $webfonts = $webfontsService->webfonts; + * + */ + class WebfontsServiceResource extends apiServiceResource { + + + /** + * Retrieves the list of fonts currently served by the Google Web Fonts Developer API + * (webfonts.list) + * + * @param array $optParams Optional parameters. Valid optional parameters are listed below. + * + * @opt_param string sort Enables sorting of the list + * @return WebfontList + */ + public function listWebfonts($optParams = array()) { + $params = array(); + $params = array_merge($params, $optParams); + $data = $this->__call('list', array($params)); + if ($this->useObjects()) { + return new WebfontList($data); + } else { + return $data; + } + } + } + + + +/** + * Service definition for Webfonts (v1). + * + *

+ * The Google Web Fonts Developer API. + *

+ * + *

+ * For more information about this service, see the + * API Documentation + *

+ * + * @author Google, Inc. + */ +class apiWebfontsService extends apiService { + public $webfonts; + /** + * Constructs the internal representation of the Webfonts service. + * + * @param apiClient apiClient + */ + public function __construct(apiClient $apiClient) { + $this->rpcPath = '/rpc'; + $this->restBasePath = '/webfonts/v1/'; + $this->version = 'v1'; + $this->serviceName = 'webfonts'; + + $apiClient->addService($this->serviceName, $this->version); + $this->webfonts = new WebfontsServiceResource($this, $this->serviceName, 'webfonts', json_decode('{"methods": {"list": {"parameters": {"sort": {"enum": ["alpha", "date", "popularity", "style", "trending"], "type": "string", "location": "query"}}, "id": "webfonts.webfonts.list", "httpMethod": "GET", "path": "webfonts", "response": {"$ref": "WebfontList"}}}}', true)); + } +} + +class Webfont extends apiModel { + public $kind; + public $variants; + public $subsets; + public $family; + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } + public function setVariants($variants) { + $this->variants = $variants; + } + public function getVariants() { + return $this->variants; + } + public function setSubsets($subsets) { + $this->subsets = $subsets; + } + public function getSubsets() { + return $this->subsets; + } + public function setFamily($family) { + $this->family = $family; + } + public function getFamily() { + return $this->family; + } +} + +class WebfontList extends apiModel { + protected $__itemsType = 'Webfont'; + protected $__itemsDataType = 'array'; + public $items; + public $kind; + public function setItems(/* array(Webfont) */ $items) { + $this->assertIsArray($items, 'Webfont', __METHOD__); + $this->items = $items; + } + public function getItems() { + return $this->items; + } + public function setKind($kind) { + $this->kind = $kind; + } + public function getKind() { + return $this->kind; + } +} diff --git a/webui/google-api/external/OAuth.php b/webui/google-api/external/OAuth.php new file mode 100755 index 0000000..c14ef54 --- /dev/null +++ b/webui/google-api/external/OAuth.php @@ -0,0 +1,486 @@ +key = $key; + $this->secret = $secret; + $this->callback_url = $callback_url; + } +} + +class apiClientOAuthToken { + // access tokens and request tokens + public $key; + public $secret; + + /** + * key = the token + * secret = the token secret + */ + function __construct($key, $secret) { + $this->key = $key; + $this->secret = $secret; + } + + /** + * generates the basic string serialization of a token that a server + * would respond to request_token and access_token calls with + */ + function to_string() { + return "oauth_token=" . apiClientOAuthUtil::urlencodeRFC3986($this->key) . + "&oauth_token_secret=" . apiClientOAuthUtil::urlencodeRFC3986($this->secret); + } + + function __toString() { + return $this->to_string(); + } +} + +class apiClientOAuthSignatureMethod { + public function check_signature(&$request, $consumer, $token, $signature) { + $built = $this->build_signature($request, $consumer, $token); + return $built == $signature; + } +} + +class apiClientOAuthSignatureMethod_HMAC_SHA1 extends apiClientOAuthSignatureMethod { + function get_name() { + return "HMAC-SHA1"; + } + + public function build_signature($request, $consumer, $token, $privKey=NULL) { + $base_string = $request->get_signature_base_string(); + $request->base_string = $base_string; + + $key_parts = array( + $consumer->secret, + ($token) ? $token->secret : "" + ); + + $key_parts = array_map(array('apiClientOAuthUtil','urlencodeRFC3986'), $key_parts); + $key = implode('&', $key_parts); + + return base64_encode( hash_hmac('sha1', $base_string, $key, true)); + } +} + +class apiClientOAuthSignatureMethod_RSA_SHA1 extends apiClientOAuthSignatureMethod { + public function get_name() { + return "RSA-SHA1"; + } + + protected function fetch_public_cert(&$request) { + // not implemented yet, ideas are: + // (1) do a lookup in a table of trusted certs keyed off of consumer + // (2) fetch via http using a url provided by the requester + // (3) some sort of specific discovery code based on request + // + // either way should return a string representation of the certificate + throw Exception("fetch_public_cert not implemented"); + } + + protected function fetch_private_cert($privKey) {//&$request) { + // not implemented yet, ideas are: + // (1) do a lookup in a table of trusted certs keyed off of consumer + // + // either way should return a string representation of the certificate + throw Exception("fetch_private_cert not implemented"); + } + + public function build_signature(&$request, $consumer, $token, $privKey) { + $base_string = $request->get_signature_base_string(); + + // Fetch the private key cert based on the request + //$cert = $this->fetch_private_cert($consumer->privKey); + + //Pull the private key ID from the certificate + //$privatekeyid = openssl_get_privatekey($cert); + + // hacked in + if ($privKey == '') { + $fp = fopen($GLOBALS['PRIV_KEY_FILE'], "r"); + $privKey = fread($fp, 8192); + fclose($fp); + } + $privatekeyid = openssl_get_privatekey($privKey); + + //Check the computer signature against the one passed in the query + $ok = openssl_sign($base_string, $signature, $privatekeyid); + + //Release the key resource + openssl_free_key($privatekeyid); + + return base64_encode($signature); + } + + public function check_signature(&$request, $consumer, $token, $signature) { + $decoded_sig = base64_decode($signature); + + $base_string = $request->get_signature_base_string(); + + // Fetch the public key cert based on the request + $cert = $this->fetch_public_cert($request); + + //Pull the public key ID from the certificate + $publickeyid = openssl_get_publickey($cert); + + //Check the computer signature against the one passed in the query + $ok = openssl_verify($base_string, $decoded_sig, $publickeyid); + + //Release the key resource + openssl_free_key($publickeyid); + + return $ok == 1; + } +} + +class apiClientOAuthRequest { + private $parameters; + private $http_method; + private $http_url; + // for debug purposes + public $base_string; + public static $version = '1.0'; + + function __construct($http_method, $http_url, $parameters=NULL) { + @$parameters or $parameters = array(); + $this->parameters = $parameters; + $this->http_method = $http_method; + $this->http_url = $http_url; + } + + + /** + * attempt to build up a request from what was passed to the server + */ + public static function from_request($http_method=NULL, $http_url=NULL, $parameters=NULL) { + $scheme = (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != "on") ? 'http' : 'https'; + @$http_url or $http_url = $scheme . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; + @$http_method or $http_method = $_SERVER['REQUEST_METHOD']; + + $request_headers = apiClientOAuthRequest::get_headers(); + + // let the library user override things however they'd like, if they know + // which parameters to use then go for it, for example XMLRPC might want to + // do this + if ($parameters) { + $req = new apiClientOAuthRequest($http_method, $http_url, $parameters); + } + // next check for the auth header, we need to do some extra stuff + // if that is the case, namely suck in the parameters from GET or POST + // so that we can include them in the signature + else if (@substr($request_headers['Authorization'], 0, 5) == "OAuth") { + $header_parameters = apiClientOAuthRequest::split_header($request_headers['Authorization']); + if ($http_method == "GET") { + $req_parameters = $_GET; + } + else if ($http_method = "POST") { + $req_parameters = $_POST; + } + $parameters = array_merge($header_parameters, $req_parameters); + $req = new apiClientOAuthRequest($http_method, $http_url, $parameters); + } + else if ($http_method == "GET") { + $req = new apiClientOAuthRequest($http_method, $http_url, $_GET); + } + else if ($http_method == "POST") { + $req = new apiClientOAuthRequest($http_method, $http_url, $_POST); + } + return $req; + } + + /** + * pretty much a helper function to set up the request + */ + public static function from_consumer_and_token($consumer, $token, $http_method, $http_url, $parameters=NULL) { + @$parameters or $parameters = array(); + $defaults = array("oauth_version" => apiClientOAuthRequest::$version, + "oauth_nonce" => apiClientOAuthRequest::generate_nonce(), + "oauth_timestamp" => apiClientOAuthRequest::generate_timestamp(), + "oauth_consumer_key" => $consumer->key); + $parameters = array_merge($defaults, $parameters); + + if ($token) { + $parameters['oauth_token'] = $token->key; + } + + // oauth v1.0a + /*if (isset($_REQUEST['oauth_verifier'])) { + $parameters['oauth_verifier'] = $_REQUEST['oauth_verifier']; + }*/ + + + return new apiClientOAuthRequest($http_method, $http_url, $parameters); + } + + public function set_parameter($name, $value) { + $this->parameters[$name] = $value; + } + + public function get_parameter($name) { + return $this->parameters[$name]; + } + + public function get_parameters() { + return $this->parameters; + } + + /** + * Returns the normalized parameters of the request + * + * This will be all (except oauth_signature) parameters, + * sorted first by key, and if duplicate keys, then by + * value. + * + * The returned string will be all the key=value pairs + * concated by &. + * + * @return string + */ + public function get_signable_parameters() { + // Grab all parameters + $params = $this->parameters; + + // Remove oauth_signature if present + if (isset($params['oauth_signature'])) { + unset($params['oauth_signature']); + } + + // Urlencode both keys and values + $keys = array_map(array('apiClientOAuthUtil', 'urlencodeRFC3986'), array_keys($params)); + $values = array_map(array('apiClientOAuthUtil', 'urlencodeRFC3986'), array_values($params)); + $params = array_combine($keys, $values); + + // Sort by keys (natsort) + uksort($params, 'strnatcmp'); + +if(isset($params['title']) && isset($params['title-exact'])) { + $temp = $params['title-exact']; + $title = $params['title']; + + unset($params['title']); + unset($params['title-exact']); + + $params['title-exact'] = $temp; + $params['title'] = $title; +} + + // Generate key=value pairs + $pairs = array(); + foreach ($params as $key=>$value ) { + if (is_array($value)) { + // If the value is an array, it's because there are multiple + // with the same key, sort them, then add all the pairs + natsort($value); + foreach ($value as $v2) { + $pairs[] = $key . '=' . $v2; + } + } else { + $pairs[] = $key . '=' . $value; + } + } + + // Return the pairs, concated with & + return implode('&', $pairs); + } + + /** + * Returns the base string of this request + * + * The base string defined as the method, the url + * and the parameters (normalized), each urlencoded + * and the concated with &. + */ + public function get_signature_base_string() { + $parts = array( + $this->get_normalized_http_method(), + $this->get_normalized_http_url(), + $this->get_signable_parameters() + ); + + $parts = array_map(array('apiClientOAuthUtil', 'urlencodeRFC3986'), $parts); + + return implode('&', $parts); + } + + /** + * just uppercases the http method + */ + public function get_normalized_http_method() { + return strtoupper($this->http_method); + } + + /** + * parses the url and rebuilds it to be + * scheme://host/path + */ + public function get_normalized_http_url() { + $parts = parse_url($this->http_url); + + // FIXME: port should handle according to http://groups.google.com/group/oauth/browse_thread/thread/1b203a51d9590226 + $port = (isset($parts['port']) && $parts['port'] != '80') ? ':' . $parts['port'] : ''; + $path = (isset($parts['path'])) ? $parts['path'] : ''; + + return $parts['scheme'] . '://' . $parts['host'] . $port . $path; + } + + /** + * builds a url usable for a GET request + */ + public function to_url() { + $out = $this->get_normalized_http_url() . "?"; + $out .= $this->to_postdata(); + return $out; + } + + /** + * builds the data one would send in a POST request + */ + public function to_postdata() { + $total = array(); + foreach ($this->parameters as $k => $v) { + $total[] = apiClientOAuthUtil::urlencodeRFC3986($k) . "=" . apiClientOAuthUtil::urlencodeRFC3986($v); + } + $out = implode("&", $total); + return $out; + } + + /** + * builds the Authorization: header + */ + public function to_header() { + $out ='Authorization: OAuth '; + $total = array(); + foreach ($this->parameters as $k => $v) { + if (substr($k, 0, 5) != "oauth") continue; + $out .= apiClientOAuthUtil::urlencodeRFC3986($k) . '="' . apiClientOAuthUtil::urlencodeRFC3986($v) . '", '; + } + $out = substr_replace($out, '', strlen($out) - 2); + return $out; + } + + public function __toString() { + return $this->to_url(); + } + + + public function sign_request($signature_method, $consumer, $token, $privKey=NULL) { + $this->set_parameter("oauth_signature_method", $signature_method->get_name()); + $signature = $this->build_signature($signature_method, $consumer, $token, $privKey); + $this->set_parameter("oauth_signature", $signature); + } + + public function build_signature($signature_method, $consumer, $token, $privKey=NULL) { + $signature = $signature_method->build_signature($this, $consumer, $token, $privKey); + return $signature; + } + + /** + * util function: current timestamp + */ + private static function generate_timestamp() { + return time(); + } + + /** + * util function: current nonce + */ + private static function generate_nonce() { + $mt = microtime(); + $rand = mt_rand(); + + return md5($mt . $rand); // md5s look nicer than numbers + } + + /** + * util function for turning the Authorization: header into + * parameters, has to do some unescaping + */ + private static function split_header($header) { + // this should be a regex + // error cases: commas in parameter values + $parts = explode(",", $header); + $out = array(); + foreach ($parts as $param) { + $param = ltrim($param); + // skip the "realm" param, nobody ever uses it anyway + if (substr($param, 0, 5) != "oauth") continue; + + $param_parts = explode("=", $param); + + // rawurldecode() used because urldecode() will turn a "+" in the + // value into a space + $out[$param_parts[0]] = rawurldecode(substr($param_parts[1], 1, -1)); + } + return $out; + } + + /** + * helper to try to sort out headers for people who aren't running apache + */ + private static function get_headers() { + if (function_exists('apache_request_headers')) { + // we need this to get the actual Authorization: header + // because apache tends to tell us it doesn't exist + return apache_request_headers(); + } + // otherwise we don't have apache and are just going to have to hope + // that $_SERVER actually contains what we need + $out = array(); + foreach ($_SERVER as $key => $value) { + if (substr($key, 0, 5) == "HTTP_") { + // this is chaos, basically it is just there to capitalize the first + // letter of every word that is not an initial HTTP and strip HTTP + // code from przemek + $key = str_replace(" ", "-", ucwords(strtolower(str_replace("_", " ", substr($key, 5))))); + $out[$key] = $value; + } + } + return $out; + } +} + +class apiClientOAuthDataStore { + function lookup_consumer($consumer_key) { + // implement me + } + + function lookup_token($consumer, $token_type, $token) { + // implement me + } + + function lookup_nonce($consumer, $token, $nonce, $timestamp) { + // implement me + } + + function fetch_request_token($consumer) { + // return a new token attached to this consumer + } + + function fetch_access_token($token, $consumer) { + // return a new access token attached to this consumer + // for the user associated with this token if the request token + // is authorized + // should also invalidate the request token + } + +} + +class apiClientOAuthUtil { + public static function urlencodeRFC3986($string) { + return str_replace('%7E', '~', rawurlencode($string)); + } + + public static function urldecodeRFC3986($string) { + return rawurldecode($string); + } +} diff --git a/webui/google-api/external/URITemplateParser.php b/webui/google-api/external/URITemplateParser.php new file mode 100644 index 0000000..594adbb --- /dev/null +++ b/webui/google-api/external/URITemplateParser.php @@ -0,0 +1,209 @@ +template = $template; + } + + public function expand($data) { + // Modification to make this a bit more performant (since gettype is very slow) + if (! is_array($data)) { + $data = (array)$data; + } + /* + // Original code, which uses a slow gettype() statement, kept in place for if the assumption that is_array always works here is incorrect + switch (gettype($data)) { + case "boolean": + case "integer": + case "double": + case "string": + case "object": + $data = (array)$data; + break; + } +*/ + + // Resolve template vars + preg_match_all('/\{([^\}]*)\}/', $this->template, $em); + + foreach ($em[1] as $i => $bare_expression) { + preg_match('/^([\+\;\?\/\.]{1})?(.*)$/', $bare_expression, $lm); + $exp = new StdClass(); + $exp->expression = $em[0][$i]; + $exp->operator = $lm[1]; + $exp->variable_list = $lm[2]; + $exp->varspecs = explode(',', $exp->variable_list); + $exp->vars = array(); + foreach ($exp->varspecs as $varspec) { + preg_match('/^([a-zA-Z0-9_]+)([\*\+]{1})?([\:\^][0-9-]+)?(\=[^,]+)?$/', $varspec, $vm); + $var = new StdClass(); + $var->name = $vm[1]; + $var->modifier = isset($vm[2]) && $vm[2] ? $vm[2] : null; + $var->modifier = isset($vm[3]) && $vm[3] ? $vm[3] : $var->modifier; + $var->default = isset($vm[4]) ? substr($vm[4], 1) : null; + $exp->vars[] = $var; + } + + // Add processing flags + $exp->reserved = false; + $exp->prefix = ''; + $exp->delimiter = ','; + switch ($exp->operator) { + case '+': + $exp->reserved = 'true'; + break; + case ';': + $exp->prefix = ';'; + $exp->delimiter = ';'; + break; + case '?': + $exp->prefix = '?'; + $exp->delimiter = '&'; + break; + case '/': + $exp->prefix = '/'; + $exp->delimiter = '/'; + break; + case '.': + $exp->prefix = '.'; + $exp->delimiter = '.'; + break; + } + $expressions[] = $exp; + } + + // Expansion + $this->expansion = $this->template; + + foreach ($expressions as $exp) { + $part = $exp->prefix; + $exp->one_var_defined = false; + foreach ($exp->vars as $var) { + $val = ''; + if ($exp->one_var_defined && isset($data[$var->name])) { + $part .= $exp->delimiter; + } + // Variable present + if (isset($data[$var->name])) { + $exp->one_var_defined = true; + $var->data = $data[$var->name]; + + $val = self::val_from_var($var, $exp); + + // Variable missing + } else { + if ($var->default) { + $exp->one_var_defined = true; + $val = $var->default; + } + } + $part .= $val; + } + if (! $exp->one_var_defined) $part = ''; + $this->expansion = str_replace($exp->expression, $part, $this->expansion); + } + + return $this->expansion; + } + + private function val_from_var($var, $exp) { + $val = ''; + if (is_array($var->data)) { + $i = 0; + if ($exp->operator == '?' && ! $var->modifier) { + $val .= $var->name . '='; + } + foreach ($var->data as $k => $v) { + $del = $var->modifier ? $exp->delimiter : ','; + $ek = rawurlencode($k); + $ev = rawurlencode($v); + + // Array + if ($k !== $i) { + if ($var->modifier == '+') { + $val .= $var->name . '.'; + } + if ($exp->operator == '?' && $var->modifier || $exp->operator == ';' && $var->modifier == '*' || $exp->operator == ';' && $var->modifier == '+') { + $val .= $ek . '='; + } else { + $val .= $ek . $del; + } + + // List + } else { + if ($var->modifier == '+') { + if ($exp->operator == ';' && $var->modifier == '*' || $exp->operator == ';' && $var->modifier == '+' || $exp->operator == '?' && $var->modifier == '+') { + $val .= $var->name . '='; + } else { + $val .= $var->name . '.'; + } + } + } + $val .= $ev . $del; + $i ++; + } + $val = trim($val, $del); + + // Strings, numbers, etc. + } else { + if ($exp->operator == '?') { + $val = $var->name . (isset($var->data) ? '=' : ''); + } else if ($exp->operator == ';') { + $val = $var->name . ($var->data ? '=' : ''); + } + $val .= rawurlencode($var->data); + if ($exp->operator == '+') { + $val = str_replace(self::$reserved_pct, self::$reserved, $val); + } + } + return $val; + } + + public function match($uri) {} + + public function __toString() { + return $this->template; + } +} diff --git a/webui/google-api/io/apiCacheParser.php b/webui/google-api/io/apiCacheParser.php new file mode 100644 index 0000000..ef39686 --- /dev/null +++ b/webui/google-api/io/apiCacheParser.php @@ -0,0 +1,173 @@ + + */ +class apiCacheParser { + public static $CACHEABLE_HTTP_METHODS = array('GET', 'HEAD'); + public static $CACHEABLE_STATUS_CODES = array('200', '203', '300', '301'); + + private function __construct() {} + + /** + * Check if an HTTP request can be cached by a private local cache. + * + * @static + * @param apiHttpRequest $resp + * @return bool True if the request is cacheable. + * False if the request is uncacheable. + */ + public static function isRequestCacheable (apiHttpRequest $resp) { + $method = $resp->getRequestMethod(); + if (! in_array($method, self::$CACHEABLE_HTTP_METHODS)) { + return false; + } + + // Don't cache authorized requests/responses. + // [rfc2616-14.8] When a shared cache receives a request containing an + // Authorization field, it MUST NOT return the corresponding response + // as a reply to any other request... + if ($resp->getRequestHeader("authorization")) { + return false; + } + + return true; + } + + /** + * Check if an HTTP response can be cached by a private local cache. + * + * @static + * @param apiHttpRequest $resp + * @return bool True if the response is cacheable. + * False if the response is un-cacheable. + */ + public static function isResponseCacheable (apiHttpRequest $resp) { + // First, check if the HTTP request was cacheable before inspecting the + // HTTP response. + if (false == self::isRequestCacheable($resp)) { + return false; + } + + $code = $resp->getResponseHttpCode(); + if (! in_array($code, self::$CACHEABLE_STATUS_CODES)) { + return false; + } + + // The resource is uncacheable if the resource is already expired and + // the resource doesn't have an ETag for revalidation. + $etag = $resp->getResponseHeader("etag"); + if (self::isExpired($resp) && $etag == false) { + return false; + } + + // [rfc2616-14.9.2] If [no-store is] sent in a response, a cache MUST NOT + // store any part of either this response or the request that elicited it. + $cacheControl = $resp->getParsedCacheControl(); + if (isset($cacheControl['no-store'])) { + return false; + } + + // Pragma: no-cache is an http request directive, but is occasionally + // used as a response header incorrectly. + $pragma = $resp->getResponseHeader('pragma'); + if ($pragma == 'no-cache' || strpos($pragma, 'no-cache') !== false) { + return false; + } + + // [rfc2616-14.44] Vary: * is extremely difficult to cache. "It implies that + // a cache cannot determine from the request headers of a subsequent request + // whether this response is the appropriate representation." + // Given this, we deem responses with the Vary header as uncacheable. + $vary = $resp->getResponseHeader('vary'); + if ($vary) { + return false; + } + + return true; + } + + /** + * @static + * @param apiHttpRequest $resp + * @return bool True if the HTTP response is considered to be expired. + * False if it is considered to be fresh. + */ + public static function isExpired(apiHttpRequest $resp) { + // HTTP/1.1 clients and caches MUST treat other invalid date formats, + // especially including the value “0”, as in the past. + $parsedExpires = false; + $responseHeaders = $resp->getResponseHeaders(); + if (isset($responseHeaders['expires'])) { + $rawExpires = $responseHeaders['expires']; + // Check for a malformed expires header first. + if (empty($rawExpires) || (is_numeric($rawExpires) && $rawExpires <= 0)) { + return true; + } + + // See if we can parse the expires header. + $parsedExpires = strtotime($rawExpires); + if (false == $parsedExpires || $parsedExpires <= 0) { + return true; + } + } + + // Calculate the freshness of an http response. + $freshnessLifetime = false; + $cacheControl = $resp->getParsedCacheControl(); + if (isset($cacheControl['max-age'])) { + $freshnessLifetime = $cacheControl['max-age']; + } + + $rawDate = $resp->getResponseHeader('date'); + $parsedDate = strtotime($rawDate); + + if (empty($rawDate) || false == $parsedDate) { + $parsedDate = time(); + } + if (false == $freshnessLifetime && isset($responseHeaders['expires'])) { + $freshnessLifetime = $parsedExpires - $parsedDate; + } + + if (false == $freshnessLifetime) { + return true; + } + + // Calculate the age of an http response. + $age = max(0, time() - $parsedDate); + if (isset($responseHeaders['age'])) { + $age = max($age, strtotime($responseHeaders['age'])); + } + + return $freshnessLifetime <= $age; + } + + /** + * Determine if a cache entry should be revalidated with by the origin. + * + * @param apiHttpRequest $response + * @return bool True if the entry is expired, else return false. + */ + public static function mustRevalidate(apiHttpRequest $response) { + // [13.3] When a cache has a stale entry that it would like to use as a + // response to a client's request, it first has to check with the origin + // server to see if its cached entry is still usable. + return self::isExpired($response); + } +} \ No newline at end of file diff --git a/webui/google-api/io/apiCurlIO.php b/webui/google-api/io/apiCurlIO.php new file mode 100644 index 0000000..f6a6b04 --- /dev/null +++ b/webui/google-api/io/apiCurlIO.php @@ -0,0 +1,254 @@ + + * @author Chirag Shah + */ + +require_once 'apiCacheParser.php'; + +class apiCurlIO implements apiIO { + const CONNECTION_ESTABLISHED = "HTTP/1.0 200 Connection established\r\n\r\n"; + const FORM_URLENCODED = 'application/x-www-form-urlencoded'; + + private static $ENTITY_HTTP_METHODS = array("POST" => null, "PUT" => null); + private static $HOP_BY_HOP = array( + 'connection', 'keep-alive', 'proxy-authenticate', 'proxy-authorization', + 'te', 'trailers', 'transfer-encoding', 'upgrade'); + + private static $DEFAULT_CURL_PARAMS = array ( + CURLOPT_RETURNTRANSFER => true, + CURLOPT_FOLLOWLOCATION => 0, + CURLOPT_FAILONERROR => false, + CURLOPT_SSL_VERIFYPEER => true, + CURLOPT_HEADER => true, + ); + + /** + * Perform an authenticated / signed apiHttpRequest. + * This function takes the apiHttpRequest, calls apiAuth->sign on it + * (which can modify the request in what ever way fits the auth mechanism) + * and then calls apiCurlIO::makeRequest on the signed request + * + * @param apiHttpRequest $request + * @return apiHttpRequest The resulting HTTP response including the + * responseHttpCode, responseHeaders and responseBody. + */ + public function authenticatedRequest(apiHttpRequest $request) { + $request = apiClient::$auth->sign($request); + return $this->makeRequest($request); + } + + /** + * Execute a apiHttpRequest + * + * @param apiHttpRequest $request the http request to be executed + * @return apiHttpRequest http request with the response http code, response + * headers and response body filled in + * @throws apiIOException on curl or IO error + */ + public function makeRequest(apiHttpRequest $request) { + // First, check to see if we have a valid cached version. + $cached = $this->getCachedRequest($request); + if ($cached !== false) { + if (apiCacheParser::mustRevalidate($cached)) { + $addHeaders = array(); + if ($cached->getResponseHeader('etag')) { + // [13.3.4] If an entity tag has been provided by the origin server, + // we must use that entity tag in any cache-conditional request. + $addHeaders['If-None-Match'] = $cached->getResponseHeader('etag'); + } elseif ($cached->getResponseHeader('date')) { + $addHeaders['If-Modified-Since'] = $cached->getResponseHeader('date'); + } + + $request->setRequestHeaders($addHeaders); + } else { + // No need to revalidate the request, return it directly + return $cached; + } + } + + if (array_key_exists($request->getRequestMethod(), + self::$ENTITY_HTTP_METHODS)) { + $request = $this->processEntityRequest($request); + } + + $ch = curl_init(); + curl_setopt_array($ch, self::$DEFAULT_CURL_PARAMS); + curl_setopt($ch, CURLOPT_URL, $request->getUrl()); + if ($request->getPostBody()) { + curl_setopt($ch, CURLOPT_POSTFIELDS, $request->getPostBody()); + } + + $requestHeaders = $request->getRequestHeaders(); + if ($requestHeaders && is_array($requestHeaders)) { + $parsed = array(); + foreach ($requestHeaders as $k => $v) { + $parsed[] = "$k: $v"; + } + curl_setopt($ch, CURLOPT_HTTPHEADER, $parsed); + } + + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $request->getRequestMethod()); + curl_setopt($ch, CURLOPT_USERAGENT, $request->getUserAgent()); + $respData = curl_exec($ch); + + // Retry if certificates are missing. + if (curl_errno($ch) == CURLE_SSL_CACERT) { + error_log('SSL certificate problem, verify that the CA cert is OK.' + . ' Retrying with the CA cert bundle from google-api-php-client.'); + curl_setopt($ch, CURLOPT_CAINFO, dirname(__FILE__) . '/cacerts.pem'); + $respData = curl_exec($ch); + } + + $respHeaderSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE); + $respHttpCode = (int) curl_getinfo($ch, CURLINFO_HTTP_CODE); + $curlErrorNum = curl_errno($ch); + $curlError = curl_error($ch); + curl_close($ch); + if ($curlErrorNum != CURLE_OK) { + throw new apiIOException("HTTP Error: ($respHttpCode) $curlError"); + } + + // Parse out the raw response into usable bits + list($responseHeaders, $responseBody) = + $this->parseHttpResponseBody($respData, $respHeaderSize); + + if ($respHttpCode == 304 && $cached) { + // If the server responded NOT_MODIFIED, return the cached request. + if (isset($responseHeaders['connection'])) { + $hopByHop = array_merge( + self::$HOP_BY_HOP, + explode(',', $responseHeaders['connection']) + ); + + $endToEnd = array(); + foreach($hopByHop as $key) { + if (isset($responseHeaders[$key])) { + $endToEnd[$key] = $responseHeaders[$key]; + } + } + $cached->setResponseHeaders($endToEnd); + } + return $cached; + } + + // Fill in the apiHttpRequest with the response values + $request->setResponseHttpCode($respHttpCode); + $request->setResponseHeaders($responseHeaders); + $request->setResponseBody($responseBody); + // Store the request in cache (the function checks to see if the request + // can actually be cached) + $this->setCachedRequest($request); + // And finally return it + return $request; + } + + /** + * @visible for testing. + * Cache the response to an HTTP request if it is cacheable. + * @param apiHttpRequest $request + * @return bool Returns true if the insertion was successful. + * Otherwise, return false. + */ + public function setCachedRequest(apiHttpRequest $request) { + // Determine if the request is cacheable. + if (apiCacheParser::isResponseCacheable($request)) { + apiClient::$cache->set($request->getCacheKey(), $request); + return true; + } + + return false; + } + + /** + * @visible for testing. + * @param apiHttpRequest $request + * @return apiHttpRequest|bool Returns the cached object or + * false if the operation was unsuccessful. + */ + public function getCachedRequest(apiHttpRequest $request) { + if (false == apiCacheParser::isRequestCacheable($request)) { + false; + } + + return apiClient::$cache->get($request->getCacheKey()); + } + + /** + * @param $respData + * @param $headerSize + * @return array + */ + public function parseHttpResponseBody($respData, $headerSize) { + if (stripos($respData, self::CONNECTION_ESTABLISHED) !== false) { + $respData = str_ireplace(self::CONNECTION_ESTABLISHED, '', $respData); + } + + $responseBody = substr($respData, $headerSize); + $responseHeaderLines = explode("\r\n", substr($respData, 0, $headerSize)); + $responseHeaders = array(); + + foreach ($responseHeaderLines as $headerLine) { + if ($headerLine && strpos($headerLine, ':') !== false) { + list($header, $value) = explode(': ', $headerLine, 2); + $header = strtolower($header); + if (isset($responseHeaders[$header])) { + $responseHeaders[$header] .= "\n" . $value; + } else { + $responseHeaders[$header] = $value; + } + } + } + + return array($responseHeaders, $responseBody); + } + + /** + * @visible for testing + * Process an http request that contains an enclosed entity. + * @param apiHttpRequest $request + * @return apiHttpRequest Processed request with the enclosed entity. + */ + public function processEntityRequest(apiHttpRequest $request) { + $postBody = $request->getPostBody(); + $contentType = $request->getRequestHeader("content-type"); + + // Set the default content-type as application/x-www-form-urlencoded. + if (false == $contentType) { + $contentType = self::FORM_URLENCODED; + $request->setRequestHeaders(array('content-type' => $contentType)); + } + + // Force the payload to match the content-type asserted in the header. + if ($contentType == self::FORM_URLENCODED && is_array($postBody)) { + $postBody = http_build_query($postBody, '', '&'); + $request->setPostBody($postBody); + } + + // Make sure the content-length header is set. + if (!$postBody || is_string($postBody)) { + $postsLength = strlen($postBody); + $request->setRequestHeaders(array('content-length' => $postsLength)); + } + + return $request; + } +} \ No newline at end of file diff --git a/webui/google-api/io/apiHttpRequest.php b/webui/google-api/io/apiHttpRequest.php new file mode 100644 index 0000000..7e18e25 --- /dev/null +++ b/webui/google-api/io/apiHttpRequest.php @@ -0,0 +1,262 @@ + + * @author Chirag Shah + * + */ +class apiHttpRequest { + const USER_AGENT_SUFFIX = "google-api-php-client/0.5.0"; + + protected $url; + protected $requestMethod; + protected $requestHeaders; + protected $postBody; + protected $userAgent; + + protected $responseHttpCode; + protected $responseHeaders; + protected $responseBody; + + public $accessKey; + + public function __construct($url, $method = 'GET', $headers = array(), $postBody = null) { + $this->url = $url; + $this->setRequestMethod($method); + $this->setRequestHeaders($headers); + $this->setPostBody($postBody); + + global $apiConfig; + if (empty($apiConfig['application_name'])) { + $this->userAgent = self::USER_AGENT_SUFFIX; + } else { + $this->userAgent = $apiConfig['application_name'] . " " . self::USER_AGENT_SUFFIX; + } + } + + /** + * Misc function that returns the base url component of the $url + * used by the OAuth signing class to calculate the base string + * @return string The base url component of the $url. + * @see http://oauth.net/core/1.0a/#anchor13 + */ + public function getBaseUrl() { + if ($pos = strpos($this->url, '?')) { + return substr($this->url, 0, $pos); + } + return $this->url; + } + + /** + * Misc function that returns an array of the query parameters of the current + * url used by the OAuth signing class to calculate the signature + * @return array Query parameters in the query string. + */ + public function getQueryParams() { + if ($pos = strpos($this->url, '?')) { + $queryStr = substr($this->url, $pos + 1); + $params = array(); + parse_str($queryStr, $params); + return $params; + } + return array(); + } + + /** + * @return string HTTP Response Code. + */ + public function getResponseHttpCode() { + return (int) $this->responseHttpCode; + } + + /** + * @param int $responseHttpCode HTTP Response Code. + */ + public function setResponseHttpCode($responseHttpCode) { + $this->responseHttpCode = $responseHttpCode; + } + + /** + * @return $responseHeaders (array) HTTP Response Headers. + */ + public function getResponseHeaders() { + return $this->responseHeaders; + } + + /** + * @return string HTTP Response Body + */ + public function getResponseBody() { + return $this->responseBody; + } + + /** + * @param array $headers The HTTP response headers + * to be normalized. + */ + public function setResponseHeaders($headers) { + $headers = apiUtils::normalize($headers); + if ($this->responseHeaders) { + $headers = array_merge($this->responseHeaders, $headers); + } + + $this->responseHeaders = $headers; + } + + /** + * @param string $key + * @return array|boolean Returns the requested HTTP header or + * false if unavailable. + */ + public function getResponseHeader($key) { + return isset($this->responseHeaders[$key]) + ? $this->responseHeaders[$key] + : false; + } + + /** + * @param string $responseBody The HTTP response body. + */ + public function setResponseBody($responseBody) { + $this->responseBody = $responseBody; + } + + /** + * @return string $url The request URL. + */ + + public function getUrl() { + return $this->url; + } + + /** + * @return string $method HTTP Request Method. + */ + public function getRequestMethod() { + return $this->requestMethod; + } + + /** + * @return array $headers HTTP Request Headers. + */ + public function getRequestHeaders() { + return $this->requestHeaders; + } + + /** + * @param string $key + * @return array|boolean Returns the requested HTTP header or + * false if unavailable. + */ + public function getRequestHeader($key) { + return isset($this->requestHeaders[$key]) + ? $this->requestHeaders[$key] + : false; + } + + /** + * @return string $postBody HTTP Request Body. + */ + public function getPostBody() { + return $this->postBody; + } + + /** + * @param string $url the url to set + */ + public function setUrl($url) { + $this->url = $url; + } + + /** + * @param string $method Set he HTTP Method and normalize + * it to upper-case, as required by HTTP. + * + */ + public function setRequestMethod($method) { + $this->requestMethod = strtoupper($method); + } + + /** + * @param array $headers The HTTP request headers + * to be set and normalized. + */ + public function setRequestHeaders($headers) { + $headers = apiUtils::normalize($headers); + if ($this->requestHeaders) { + $headers = array_merge($this->requestHeaders, $headers); + } + $this->requestHeaders = $headers; + } + + /** + * @param string $postBody the postBody to set + */ + public function setPostBody($postBody) { + $this->postBody = $postBody; + } + + /** + * Set the User-Agent Header. + * @param string $userAgent The User-Agent. + */ + public function setUserAgent($userAgent) { + $this->userAgent = $userAgent; + } + + /** + * @return string The User-Agent. + */ + public function getUserAgent() { + return $this->userAgent; + } + + /** + * Returns a cache key depending on if this was an OAuth signed request + * in which case it will use the non-signed url and access key to make this + * cache key unique per authenticated user, else use the plain request url + * @return The md5 hash of the request cache key. + */ + public function getCacheKey() { + $key = $this->getUrl(); + + if (isset($this->accessKey)) { + $key .= $this->accessKey; + } + + if (isset($this->requestHeaders['authorization'])) { + $key .= $this->requestHeaders['authorization']; + } + + return md5($key); + } + + public function getParsedCacheControl() { + $parsed = array(); + $rawCacheControl = $this->getResponseHeader('cache-control'); + if ($rawCacheControl) { + $rawCacheControl = str_replace(", ", "&", $rawCacheControl); + parse_str($rawCacheControl, $parsed); + } + + return $parsed; + } +} diff --git a/webui/google-api/io/apiIO.php b/webui/google-api/io/apiIO.php new file mode 100644 index 0000000..7ad880d --- /dev/null +++ b/webui/google-api/io/apiIO.php @@ -0,0 +1,43 @@ + + */ +interface apiIO { + /** + * An utility function that first calls $this->auth->sign($request) and then executes makeRequest() + * on that signed request. Used for when a request should be authenticated + * @param apiHttpRequest $request + * @return apiHttpRequest $request + */ + public function authenticatedRequest(apiHttpRequest $request); + + /** + * Executes a apIHttpRequest and returns the resulting populated httpRequest + * @param apiHttpRequest $request + * @return apiHttpRequest $request + */ + public function makeRequest(apiHttpRequest $request); +} diff --git a/webui/google-api/io/apiREST.php b/webui/google-api/io/apiREST.php new file mode 100644 index 0000000..e66e380 --- /dev/null +++ b/webui/google-api/io/apiREST.php @@ -0,0 +1,148 @@ + + * @author Chirag Shah + */ +class apiREST { + /** + * Executes a apiServiceRequest using a RESTful call by transforming it into + * an apiHttpRequest, and executed via apiIO::authenticatedRequest(). + * + * @param apiServiceRequest $req + * @return array decoded result + * @throws apiServiceException on server side error (ie: not authenticated, invalid or + * malformed post body, invalid url) + */ + static public function execute(apiServiceRequest $req) { + $result = null; + $postBody = $req->getPostBody(); + $url = self::createRequestUri( + $req->getRestBasePath(), $req->getRestPath(), $req->getParameters()); + + $httpRequest = new apiHttpRequest($url, $req->getHttpMethod(), null, $postBody); + if ($postBody) { + $contentTypeHeader = array(); + if (isset($req->contentType) && $req->contentType) { + $contentTypeHeader['content-type'] = $req->contentType; + } else { + $contentTypeHeader['content-type'] = 'application/json; charset=UTF-8'; + $contentTypeHeader['content-length'] = apiUtils::getStrLen($postBody); + } + $httpRequest->setRequestHeaders($contentTypeHeader); + } + + $httpRequest = apiClient::$io->authenticatedRequest($httpRequest); + $decodedResponse = self::decodeHttpResponse($httpRequest); + + //FIXME currently everything is wrapped in a data envelope, but hopefully this might change some day + $ret = isset($decodedResponse['data']) ? $decodedResponse['data'] : $decodedResponse; + return $ret; + } + + + /** + * Decode an HTTP Response. + * @static + * @throws apiServiceException + * @param apiHttpRequest $response The http response to be decoded. + * @return mixed|null + */ + static function decodeHttpResponse($response) { + $code = $response->getResponseHttpCode(); + $body = $response->getResponseBody(); + $decoded = null; + + if ($code != '200' && $code != '201' && $code != '204') { + $decoded = json_decode($body, true); + $err = 'Error calling ' . $response->getRequestMethod() . ' ' . $response->getUrl(); + if ($decoded != null && isset($decoded['error']['message']) && isset($decoded['error']['code'])) { + // if we're getting a json encoded error definition, use that instead of the raw response + // body for improved readability + $err .= ": ({$decoded['error']['code']}) {$decoded['error']['message']}"; + } else { + $err .= ": ($code) $body"; + } + throw new apiServiceException($err, $code); + } + + // Only attempt to decode the response, if the response code wasn't (204) 'no content' + if ($code != '204') { + $decoded = json_decode($body, true); + if ($decoded == null) { + throw new apiServiceException("Invalid json in service response: $body"); + } + } + return $decoded; + } + + /** + * Parse/expand request parameters and create a fully qualified + * request uri. + * @static + * @param string $basePath + * @param string $restPath + * @param array $params + * @return string $requestUrl + */ + static function createRequestUri($basePath, $restPath, $params) { + $requestUrl = $basePath . $restPath; + $uriTemplateVars = array(); + $queryVars = array(); + foreach ($params as $paramName => $paramSpec) { + // Discovery v1.0 puts the canonical location under the 'location' field. + if (! isset($paramSpec['location'])) { + $paramSpec['location'] = $paramSpec['restParameterType']; + } + + if ($paramSpec['type'] == 'boolean') { + $paramSpec['value'] = ($paramSpec['value']) ? 'true' : 'false'; + } + if ($paramSpec['location'] == 'path') { + $uriTemplateVars[$paramName] = $paramSpec['value']; + } else { + if (isset($paramSpec['repeated']) && is_array($paramSpec['value'])) { + foreach ($paramSpec['value'] as $value) { + $queryVars[] = $paramName . '=' . rawurlencode($value); + } + } else { + $queryVars[] = $paramName . '=' . rawurlencode($paramSpec['value']); + } + } + } + + if (count($uriTemplateVars)) { + $uriTemplateParser = new URI_Template_Parser($requestUrl); + $requestUrl = $uriTemplateParser->expand($uriTemplateVars); + } + //FIXME work around for the the uri template lib which url encodes + // the @'s & confuses our servers. + $requestUrl = str_replace('%40', '@', $requestUrl); + + if (count($queryVars)) { + $requestUrl .= '?' . implode($queryVars, '&'); + } + + return $requestUrl; + } +} diff --git a/webui/google-api/io/apiRPC.php b/webui/google-api/io/apiRPC.php new file mode 100644 index 0000000..e888b92 --- /dev/null +++ b/webui/google-api/io/apiRPC.php @@ -0,0 +1,63 @@ + + */ +class apiRPC { + static public function execute($requests) { + $jsonRpcRequest = array(); + foreach ($requests as $request) { + $parameters = array(); + foreach ($request->getParameters() as $parameterName => $parameterVal) { + $parameters[$parameterName] = $parameterVal['value']; + } + $jsonRpcRequest[] = array( + 'id' => $request->getBatchKey(), + 'method' => $request->getRpcName(), + 'params' => $parameters, + 'apiVersion' => 'v1' + ); + } + $httpRequest = new apiHttpRequest($request->getRpcPath()); + $httpRequest->setRequestHeaders(array('Content-Type' => 'application/json')); + $httpRequest->setRequestMethod('POST'); + $httpRequest->setPostBody(json_encode($jsonRpcRequest)); + $httpRequest = apiClient::$io->authenticatedRequest($httpRequest); + if (($decodedResponse = json_decode($httpRequest->getResponseBody(), true)) != false) { + $ret = array(); + foreach ($decodedResponse as $response) { + $ret[$response['id']] = self::checkNextLink($response['result']); + } + return $ret; + } else { + throw new apiServiceException("Invalid json returned by the json-rpc end-point"); + } + } + + static private function checkNextLink($response) { + if (isset($response['links']) && isset($response['links']['next'][0]['href'])) { + parse_str($response['links']['next'][0]['href'], $params); + if (isset($params['c'])) { + $response['continuationToken'] = $params['c']; + } + } + return $response; + } +} \ No newline at end of file diff --git a/webui/google-api/io/cacerts.pem b/webui/google-api/io/cacerts.pem new file mode 100644 index 0000000..da36ed1 --- /dev/null +++ b/webui/google-api/io/cacerts.pem @@ -0,0 +1,714 @@ +# Certifcate Authority certificates for validating SSL connections. +# +# This file contains PEM format certificates generated from +# http://mxr.mozilla.org/seamonkey/source/security/nss/lib/ckfw/builtins/certdata.txt +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +Verisign/RSA Secure Server CA +============================= + +-----BEGIN CERTIFICATE----- +MIICNDCCAaECEAKtZn5ORf5eV288mBle3cAwDQYJKoZIhvcNAQECBQAwXzELMAkG +A1UEBhMCVVMxIDAeBgNVBAoTF1JTQSBEYXRhIFNlY3VyaXR5LCBJbmMuMS4wLAYD +VQQLEyVTZWN1cmUgU2VydmVyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk0 +MTEwOTAwMDAwMFoXDTEwMDEwNzIzNTk1OVowXzELMAkGA1UEBhMCVVMxIDAeBgNV +BAoTF1JTQSBEYXRhIFNlY3VyaXR5LCBJbmMuMS4wLAYDVQQLEyVTZWN1cmUgU2Vy +dmVyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGbMA0GCSqGSIb3DQEBAQUAA4GJ +ADCBhQJ+AJLOesGugz5aqomDV6wlAXYMra6OLDfO6zV4ZFQD5YRAUcm/jwjiioII +0haGN1XpsSECrXZogZoFokvJSyVmIlZsiAeP94FZbYQHZXATcXY+m3dM41CJVphI +uR2nKRoTLkoRWZweFdVJVCxzOmmCsZc5nG1wZ0jl3S3WyB57AgMBAAEwDQYJKoZI +hvcNAQECBQADfgBl3X7hsuyw4jrg7HFGmhkRuNPHoLQDQCYCPgmc4RKz0Vr2N6W3 +YQO2WxZpO8ZECAyIUwxrl0nHPjXcbLm7qt9cuzovk2C2qUtN8iD3zV9/ZHuO3ABc +1/p3yjkWWW8O6tO1g39NTUJWdrTJXwT4OPjr0l91X817/OWOgHz8UA== +-----END CERTIFICATE----- + +Thawte Personal Basic CA +======================== + +-----BEGIN CERTIFICATE----- +MIIDITCCAoqgAwIBAgIBADANBgkqhkiG9w0BAQQFADCByzELMAkGA1UEBhMCWkEx +FTATBgNVBAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMRowGAYD +VQQKExFUaGF3dGUgQ29uc3VsdGluZzEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBT +ZXJ2aWNlcyBEaXZpc2lvbjEhMB8GA1UEAxMYVGhhd3RlIFBlcnNvbmFsIEJhc2lj +IENBMSgwJgYJKoZIhvcNAQkBFhlwZXJzb25hbC1iYXNpY0B0aGF3dGUuY29tMB4X +DTk2MDEwMTAwMDAwMFoXDTIwMTIzMTIzNTk1OVowgcsxCzAJBgNVBAYTAlpBMRUw +EwYDVQQIEwxXZXN0ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEaMBgGA1UE +ChMRVGhhd3RlIENvbnN1bHRpbmcxKDAmBgNVBAsTH0NlcnRpZmljYXRpb24gU2Vy +dmljZXMgRGl2aXNpb24xITAfBgNVBAMTGFRoYXd0ZSBQZXJzb25hbCBCYXNpYyBD +QTEoMCYGCSqGSIb3DQEJARYZcGVyc29uYWwtYmFzaWNAdGhhd3RlLmNvbTCBnzAN +BgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAvLyTU23AUE+CFeZIlDWmWr5vQvoPR+53 +dXLdjUmbllegeNTKP1GzaQuRdhciB5dqxFGTS+CN7zeVoQxN2jSQHReJl+A1OFdK +wPQIcOk8RHtQfmGakOMj04gRRif1CwcOu93RfyAKiLlWCy4cgNrx454p7xS9CkT7 +G1sY0b8jkyECAwEAAaMTMBEwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQQF +AAOBgQAt4plrsD16iddZopQBHyvdEktTwq1/qqcAXJFAVyVKOKqEcLnZgA+le1z7 +c8a914phXAPjLSeoF+CEhULcXpvGt7Jtu3Sv5D/Lp7ew4F2+eIMllNLbgQ95B21P +9DkVWlIBe94y1k049hJcBlDfBVu9FEuh3ym6O0GN92NWod8isQ== +-----END CERTIFICATE----- + +Thawte Personal Premium CA +========================== + +-----BEGIN CERTIFICATE----- +MIIDKTCCApKgAwIBAgIBADANBgkqhkiG9w0BAQQFADCBzzELMAkGA1UEBhMCWkEx +FTATBgNVBAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMRowGAYD +VQQKExFUaGF3dGUgQ29uc3VsdGluZzEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBT +ZXJ2aWNlcyBEaXZpc2lvbjEjMCEGA1UEAxMaVGhhd3RlIFBlcnNvbmFsIFByZW1p +dW0gQ0ExKjAoBgkqhkiG9w0BCQEWG3BlcnNvbmFsLXByZW1pdW1AdGhhd3RlLmNv +bTAeFw05NjAxMDEwMDAwMDBaFw0yMDEyMzEyMzU5NTlaMIHPMQswCQYDVQQGEwJa +QTEVMBMGA1UECBMMV2VzdGVybiBDYXBlMRIwEAYDVQQHEwlDYXBlIFRvd24xGjAY +BgNVBAoTEVRoYXd0ZSBDb25zdWx0aW5nMSgwJgYDVQQLEx9DZXJ0aWZpY2F0aW9u +IFNlcnZpY2VzIERpdmlzaW9uMSMwIQYDVQQDExpUaGF3dGUgUGVyc29uYWwgUHJl +bWl1bSBDQTEqMCgGCSqGSIb3DQEJARYbcGVyc29uYWwtcHJlbWl1bUB0aGF3dGUu +Y29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDJZtn4B0TPuYwu8KHvE0Vs +Bd/eJxZRNkERbGw77f4QfRKe5ZtCmv5gMcNmt3M6SK5O0DI3lIi1DbbZ8/JE2dWI +Et12TfIa/G8jHnrx2JhFTgcQ7xZC0EN1bUre4qrJMf8fAHB8Zs8QJQi6+u4A6UYD +ZicRFTuqW/KY3TZCstqIdQIDAQABoxMwETAPBgNVHRMBAf8EBTADAQH/MA0GCSqG +SIb3DQEBBAUAA4GBAGk2ifc0KjNyL2071CKyuG+axTZmDhs8obF1Wub9NdP4qPIH +b4Vnjt4rueIXsDqg8A6iAJrf8xQVbrvIhVqYgPn/vnQdPfP+MCXRNzRn+qVxeTBh +KXLA4CxM+1bkOqhv5TJZUtt1KFBZDPgLGeSs2a+WjS9Q2wfD6h+rM+D1KzGJ +-----END CERTIFICATE----- + +Thawte Personal Freemail CA +=========================== + +-----BEGIN CERTIFICATE----- +MIIDLTCCApagAwIBAgIBADANBgkqhkiG9w0BAQQFADCB0TELMAkGA1UEBhMCWkEx +FTATBgNVBAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMRowGAYD +VQQKExFUaGF3dGUgQ29uc3VsdGluZzEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBT +ZXJ2aWNlcyBEaXZpc2lvbjEkMCIGA1UEAxMbVGhhd3RlIFBlcnNvbmFsIEZyZWVt +YWlsIENBMSswKQYJKoZIhvcNAQkBFhxwZXJzb25hbC1mcmVlbWFpbEB0aGF3dGUu +Y29tMB4XDTk2MDEwMTAwMDAwMFoXDTIwMTIzMTIzNTk1OVowgdExCzAJBgNVBAYT +AlpBMRUwEwYDVQQIEwxXZXN0ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEa +MBgGA1UEChMRVGhhd3RlIENvbnN1bHRpbmcxKDAmBgNVBAsTH0NlcnRpZmljYXRp +b24gU2VydmljZXMgRGl2aXNpb24xJDAiBgNVBAMTG1RoYXd0ZSBQZXJzb25hbCBG +cmVlbWFpbCBDQTErMCkGCSqGSIb3DQEJARYccGVyc29uYWwtZnJlZW1haWxAdGhh +d3RlLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA1GnX1LCUZFtx6UfY +DFG26nKRsIRefS0Nj3sS34UldSh0OkIsYyeflXtL734Zhx2G6qPduc6WZBrCFG5E +rHzmj+hND3EfQDimAKOHePb5lIZererAXnbr2RSjXW56fAylS1V/Bhkpf56aJtVq +uzgkCGqYx7Hao5iR/Xnb5VrEHLkCAwEAAaMTMBEwDwYDVR0TAQH/BAUwAwEB/zAN +BgkqhkiG9w0BAQQFAAOBgQDH7JJ+Tvj1lqVnYiqk8E0RYNBvjWBYYawmu1I1XAjP +MPuoSpaKH2JCI4wXD/S6ZJwXrEcp352YXtJsYHFcoqzceePnbgBHH7UNKOgCneSa +/RP0ptl8sfjcXyMmCZGAc9AUG95DqYMl8uacLxXK/qarigd1iwzdUYRr5PjRznei +gQ== +-----END CERTIFICATE----- + +Thawte Server CA +================ + +-----BEGIN CERTIFICATE----- +MIIDEzCCAnygAwIBAgIBATANBgkqhkiG9w0BAQQFADCBxDELMAkGA1UEBhMCWkEx +FTATBgNVBAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMR0wGwYD +VQQKExRUaGF3dGUgQ29uc3VsdGluZyBjYzEoMCYGA1UECxMfQ2VydGlmaWNhdGlv +biBTZXJ2aWNlcyBEaXZpc2lvbjEZMBcGA1UEAxMQVGhhd3RlIFNlcnZlciBDQTEm +MCQGCSqGSIb3DQEJARYXc2VydmVyLWNlcnRzQHRoYXd0ZS5jb20wHhcNOTYwODAx +MDAwMDAwWhcNMjAxMjMxMjM1OTU5WjCBxDELMAkGA1UEBhMCWkExFTATBgNVBAgT +DFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMR0wGwYDVQQKExRUaGF3 +dGUgQ29uc3VsdGluZyBjYzEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNl +cyBEaXZpc2lvbjEZMBcGA1UEAxMQVGhhd3RlIFNlcnZlciBDQTEmMCQGCSqGSIb3 +DQEJARYXc2VydmVyLWNlcnRzQHRoYXd0ZS5jb20wgZ8wDQYJKoZIhvcNAQEBBQAD +gY0AMIGJAoGBANOkUG7I/1Zr5s9dtuoMaHVHoqrC2oQl/Kj0R1HahbUgdJSGHg91 +yekIYfUGbTBuFRkC6VLAYttNmZ7iagxEOM3+vuNkCXDF/rFrKbYvScg71CcEJRCX +L+eQbcAoQpnXTEPew/UhbVSfXcNY4cDk2VuwuNy0e982OsK1ZiIS1ocNAgMBAAGj +EzARMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEEBQADgYEAB/pMaVz7lcxG +7oWDTSEwjsrZqG9JGubaUeNgcGyEYRGhGshIPllDfU+VPaGLtwtimHp1it2ITk6e +QNuozDJ0uW8NxuOzRAvZim+aKZuZGCg70eNAKJpaPNW15yAbi8qkq43pUdniTCxZ +qdq5snUb9kLy78fyGPmJvKP/iiMucEc= +-----END CERTIFICATE----- + +Thawte Premium Server CA +======================== + +-----BEGIN CERTIFICATE----- +MIIDJzCCApCgAwIBAgIBATANBgkqhkiG9w0BAQQFADCBzjELMAkGA1UEBhMCWkEx +FTATBgNVBAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMR0wGwYD +VQQKExRUaGF3dGUgQ29uc3VsdGluZyBjYzEoMCYGA1UECxMfQ2VydGlmaWNhdGlv +biBTZXJ2aWNlcyBEaXZpc2lvbjEhMB8GA1UEAxMYVGhhd3RlIFByZW1pdW0gU2Vy +dmVyIENBMSgwJgYJKoZIhvcNAQkBFhlwcmVtaXVtLXNlcnZlckB0aGF3dGUuY29t +MB4XDTk2MDgwMTAwMDAwMFoXDTIwMTIzMTIzNTk1OVowgc4xCzAJBgNVBAYTAlpB +MRUwEwYDVQQIEwxXZXN0ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEdMBsG +A1UEChMUVGhhd3RlIENvbnN1bHRpbmcgY2MxKDAmBgNVBAsTH0NlcnRpZmljYXRp +b24gU2VydmljZXMgRGl2aXNpb24xITAfBgNVBAMTGFRoYXd0ZSBQcmVtaXVtIFNl +cnZlciBDQTEoMCYGCSqGSIb3DQEJARYZcHJlbWl1bS1zZXJ2ZXJAdGhhd3RlLmNv +bTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA0jY2aovXwlue2oFBYo847kkE +VdbQ7xwblRZH7xhINTpS9CtqBo87L+pW46+GjZ4X9560ZXUCTe/LCaIhUdib0GfQ +ug2SBhRz1JPLlyoAnFxODLz6FVL88kRu2hFKbgifLy3j+ao6hnO2RlNYyIkFvYMR +uHM/qgeN9EJN50CdHDcCAwEAAaMTMBEwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG +9w0BAQQFAAOBgQAmSCwWwlj66BZ0DKqqX1Q/8tfJeGBeXm43YyJ3Nn6yF8Q0ufUI +hfzJATj/Tb7yFkJD57taRvvBxhEf8UqwKEbJw8RCfbz6q1lu1bdRiBHjpIUZa4JM +pAwSremkrj/xw0llmozFyD4lt5SZu5IycQfwhl7tUCemDaYj+bvLpgcUQg== +-----END CERTIFICATE----- + +Equifax Secure CA +================= + +-----BEGIN CERTIFICATE----- +MIIDIDCCAomgAwIBAgIENd70zzANBgkqhkiG9w0BAQUFADBOMQswCQYDVQQGEwJV +UzEQMA4GA1UEChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2Vy +dGlmaWNhdGUgQXV0aG9yaXR5MB4XDTk4MDgyMjE2NDE1MVoXDTE4MDgyMjE2NDE1 +MVowTjELMAkGA1UEBhMCVVMxEDAOBgNVBAoTB0VxdWlmYXgxLTArBgNVBAsTJEVx +dWlmYXggU2VjdXJlIENlcnRpZmljYXRlIEF1dGhvcml0eTCBnzANBgkqhkiG9w0B +AQEFAAOBjQAwgYkCgYEAwV2xWGcIYu6gmi0fCG2RFGiYCh7+2gRvE4RiIcPRfM6f +BeC4AfBONOziipUEZKzxa1NfBbPLZ4C/QgKO/t0BCezhABRP/PvwDN1Dulsr4R+A +cJkVV5MW8Q+XarfCaCMczE1ZMKxRHjuvK9buY0V7xdlfUNLjUA86iOe/FP3gx7kC +AwEAAaOCAQkwggEFMHAGA1UdHwRpMGcwZaBjoGGkXzBdMQswCQYDVQQGEwJVUzEQ +MA4GA1UEChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2VydGlm +aWNhdGUgQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMBoGA1UdEAQTMBGBDzIwMTgw +ODIyMTY0MTUxWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAUSOZo+SvSspXXR9gj +IBBPM5iQn9QwHQYDVR0OBBYEFEjmaPkr0rKV10fYIyAQTzOYkJ/UMAwGA1UdEwQF +MAMBAf8wGgYJKoZIhvZ9B0EABA0wCxsFVjMuMGMDAgbAMA0GCSqGSIb3DQEBBQUA +A4GBAFjOKer89961zgK5F7WF0bnj4JXMJTENAKaSbn+2kmOeUJXRmm/kEd5jhW6Y +7qj/WsjTVbJmcVfewCHrPSqnI0kBBIZCe/zuf6IWUrVnZ9NA2zsmWLIodz2uFHdh +1voqZiegDfqnc1zqcPGUIWVEX/r87yloqaKHee9570+sB3c4 +-----END CERTIFICATE----- + +Verisign Class 1 Public Primary Certification Authority +======================================================= + +-----BEGIN CERTIFICATE----- +MIICPTCCAaYCEQDNun9W8N/kvFT+IqyzcqpVMA0GCSqGSIb3DQEBAgUAMF8xCzAJ +BgNVBAYTAlVTMRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE3MDUGA1UECxMuQ2xh +c3MgMSBQdWJsaWMgUHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw05 +NjAxMjkwMDAwMDBaFw0yODA4MDEyMzU5NTlaMF8xCzAJBgNVBAYTAlVTMRcwFQYD +VQQKEw5WZXJpU2lnbiwgSW5jLjE3MDUGA1UECxMuQ2xhc3MgMSBQdWJsaWMgUHJp +bWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCBnzANBgkqhkiG9w0BAQEFAAOB +jQAwgYkCgYEA5Rm/baNWYS2ZSHH2Z965jeu3noaACpEO+jglr0aIguVzqKCbJF0N +H8xlbgyw0FaEGIeaBpsQoXPftFg5a27B9hXVqKg/qhIGjTGsf7A01480Z4gJzRQR +4k5FVmkfeAKA2txHkSm7NsljXMXg1y2He6G3MrB7MLoqLzGq7qNn2tsCAwEAATAN +BgkqhkiG9w0BAQIFAAOBgQBMP7iLxmjf7kMzDl3ppssHhE16M/+SG/Q2rdiVIjZo +EWx8QszznC7EBz8UsA9P/5CSdvnivErpj82ggAr3xSnxgiJduLHdgSOjeyUVRjB5 +FvjqBUuUfx3CHMjjt/QQQDwTw18fU+hI5Ia0e6E1sHslurjTjqs/OJ0ANACY89Fx +lA== +-----END CERTIFICATE----- + +Verisign Class 2 Public Primary Certification Authority +======================================================= + +-----BEGIN CERTIFICATE----- +MIICPDCCAaUCEC0b/EoXjaOR6+f/9YtFvgswDQYJKoZIhvcNAQECBQAwXzELMAkG +A1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFz +cyAyIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2 +MDEyOTAwMDAwMFoXDTI4MDgwMTIzNTk1OVowXzELMAkGA1UEBhMCVVMxFzAVBgNV +BAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAyIFB1YmxpYyBQcmlt +YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUAA4GN +ADCBiQKBgQC2WoujDWojg4BrzzmH9CETMwZMJaLtVRKXxaeAufqDwSCg+i8VDXyh +YGt+eSz6Bg86rvYbb7HS/y8oUl+DfUvEerf4Zh+AVPy3wo5ZShRXRtGak75BkQO7 +FYCTXOvnzAhsPz6zSvz/S2wj1VCCJkQZjiPDceoZJEcEnnW/yKYAHwIDAQABMA0G +CSqGSIb3DQEBAgUAA4GBAIobK/o5wXTXXtgZZKJYSi034DNHD6zt96rbHuSLBlxg +J8pFUs4W7z8GZOeUaHxgMxURaa+dYo2jA1Rrpr7l7gUYYAS/QoD90KioHgE796Nc +r6Pc5iaAIzy4RHT3Cq5Ji2F4zCS/iIqnDupzGUH9TQPwiNHleI2lKk/2lw0Xd8rY +-----END CERTIFICATE----- + +Verisign Class 3 Public Primary Certification Authority +======================================================= + +-----BEGIN CERTIFICATE----- +MIICPDCCAaUCEHC65B0Q2Sk0tjjKewPMur8wDQYJKoZIhvcNAQECBQAwXzELMAkG +A1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFz +cyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2 +MDEyOTAwMDAwMFoXDTI4MDgwMTIzNTk1OVowXzELMAkGA1UEBhMCVVMxFzAVBgNV +BAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAzIFB1YmxpYyBQcmlt +YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUAA4GN +ADCBiQKBgQDJXFme8huKARS0EN8EQNvjV69qRUCPhAwL0TPZ2RHP7gJYHyX3KqhE +BarsAx94f56TuZoAqiN91qyFomNFx3InzPRMxnVx0jnvT0Lwdd8KkMaOIG+YD/is +I19wKTakyYbnsZogy1Olhec9vn2a/iRFM9x2Fe0PonFkTGUugWhFpwIDAQABMA0G +CSqGSIb3DQEBAgUAA4GBALtMEivPLCYATxQT3ab7/AoRhIzzKBxnki98tsX63/Do +lbwdj2wsqFHMc9ikwFPwTtYmwHYBV4GSXiHx0bH/59AhWM1pF+NEHJwZRDmJXNyc +AA9WjQKZ7aKQRUzkuxCkPfAyAw7xzvjoyVGM5mKf5p/AfbdynMk2OmufTqj/ZA1k +-----END CERTIFICATE----- + +Verisign Class 1 Public Primary Certification Authority - G2 +============================================================ + +-----BEGIN CERTIFICATE----- +MIIDAjCCAmsCEEzH6qqYPnHTkxD4PTqJkZIwDQYJKoZIhvcNAQEFBQAwgcExCzAJ +BgNVBAYTAlVTMRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE8MDoGA1UECxMzQ2xh +c3MgMSBQdWJsaWMgUHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcy +MTowOAYDVQQLEzEoYykgMTk5OCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3Jp +emVkIHVzZSBvbmx5MR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMB4X +DTk4MDUxODAwMDAwMFoXDTI4MDgwMTIzNTk1OVowgcExCzAJBgNVBAYTAlVTMRcw +FQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE8MDoGA1UECxMzQ2xhc3MgMSBQdWJsaWMg +UHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMTowOAYDVQQLEzEo +YykgMTk5OCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5 +MR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMIGfMA0GCSqGSIb3DQEB +AQUAA4GNADCBiQKBgQCq0Lq+Fi24g9TK0g+8djHKlNgdk4xWArzZbxpvUjZudVYK +VdPfQ4chEWWKfo+9Id5rMj8bhDSVBZ1BNeuS65bdqlk/AVNtmU/t5eIqWpDBucSm +Fc/IReumXY6cPvBkJHalzasab7bYe1FhbqZ/h8jit+U03EGI6glAvnOSPWvndQID +AQABMA0GCSqGSIb3DQEBBQUAA4GBAKlPww3HZ74sy9mozS11534Vnjty637rXC0J +h9ZrbWB85a7FkCMMXErQr7Fd88e2CtvgFZMN3QO8x3aKtd1Pw5sTdbgBwObJW2ul +uIncrKTdcu1OofdPvAbT6shkdHvClUGcZXNY8ZCaPGqxmMnEh7zPRW1F4m4iP/68 +DzFc6PLZ +-----END CERTIFICATE----- + +Verisign Class 2 Public Primary Certification Authority - G2 +============================================================ + +-----BEGIN CERTIFICATE----- +MIIDAzCCAmwCEQC5L2DMiJ+hekYJuFtwbIqvMA0GCSqGSIb3DQEBBQUAMIHBMQsw +CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xPDA6BgNVBAsTM0Ns +YXNzIDIgUHVibGljIFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBH +MjE6MDgGA1UECxMxKGMpIDE5OTggVmVyaVNpZ24sIEluYy4gLSBGb3IgYXV0aG9y +aXplZCB1c2Ugb25seTEfMB0GA1UECxMWVmVyaVNpZ24gVHJ1c3QgTmV0d29yazAe +Fw05ODA1MTgwMDAwMDBaFw0yODA4MDEyMzU5NTlaMIHBMQswCQYDVQQGEwJVUzEX +MBUGA1UEChMOVmVyaVNpZ24sIEluYy4xPDA6BgNVBAsTM0NsYXNzIDIgUHVibGlj +IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMjE6MDgGA1UECxMx +KGMpIDE5OTggVmVyaVNpZ24sIEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25s +eTEfMB0GA1UECxMWVmVyaVNpZ24gVHJ1c3QgTmV0d29yazCBnzANBgkqhkiG9w0B +AQEFAAOBjQAwgYkCgYEAp4gBIXQs5xoD8JjhlzwPIQjxnNuX6Zr8wgQGE75fUsjM +HiwSViy4AWkszJkfrbCWrnkE8hM5wXuYuggs6MKEEyyqaekJ9MepAqRCwiNPStjw +DqL7MWzJ5m+ZJwf15vRMeJ5t60aG+rmGyVTyssSv1EYcWskVMP8NbPUtDm3Of3cC +AwEAATANBgkqhkiG9w0BAQUFAAOBgQByLvl/0fFx+8Se9sVeUYpAmLho+Jscg9ji +nb3/7aHmZuovCfTK1+qlK5X2JGCGTUQug6XELaDTrnhpb3LabK4I8GOSN+a7xDAX +rXfMSTWqz9iP0b63GJZHc2pUIjRkLbYWm1lbtFFZOrMLFPQS32eg9K0yZF6xRnIn +jBJ7xUS0rg== +-----END CERTIFICATE----- + +Verisign Class 3 Public Primary Certification Authority - G2 +============================================================ + +-----BEGIN CERTIFICATE----- +MIIDAjCCAmsCEH3Z/gfPqB63EHln+6eJNMYwDQYJKoZIhvcNAQEFBQAwgcExCzAJ +BgNVBAYTAlVTMRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE8MDoGA1UECxMzQ2xh +c3MgMyBQdWJsaWMgUHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcy +MTowOAYDVQQLEzEoYykgMTk5OCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3Jp +emVkIHVzZSBvbmx5MR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMB4X +DTk4MDUxODAwMDAwMFoXDTI4MDgwMTIzNTk1OVowgcExCzAJBgNVBAYTAlVTMRcw +FQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE8MDoGA1UECxMzQ2xhc3MgMyBQdWJsaWMg +UHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMTowOAYDVQQLEzEo +YykgMTk5OCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5 +MR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMIGfMA0GCSqGSIb3DQEB +AQUAA4GNADCBiQKBgQDMXtERXVxp0KvTuWpMmR9ZmDCOFoUgRm1HP9SFIIThbbP4 +pO0M8RcPO/mn+SXXwc+EY/J8Y8+iR/LGWzOOZEAEaMGAuWQcRXfH2G71lSk8UOg0 +13gfqLptQ5GVj0VXXn7F+8qkBOvqlzdUMG+7AUcyM83cV5tkaWH4mx0ciU9cZwID +AQABMA0GCSqGSIb3DQEBBQUAA4GBAFFNzb5cy5gZnBWyATl4Lk0PZ3BwmcYQWpSk +U01UbSuvDV1Ai2TT1+7eVmGSX6bEHRBhNtMsJzzoKQm5EWR0zLVznxxIqbxhAe7i +F6YM40AIOw7n60RzKprxaZLvcRTDOaxxp5EJb+RxBrO6WVcmeQD2+A2iMzAo1KpY +oJ2daZH9 +-----END CERTIFICATE----- + +Verisign Class 4 Public Primary Certification Authority - G2 +============================================================ + +-----BEGIN CERTIFICATE----- +MIIDAjCCAmsCEDKIjprS9esTR/h/xCA3JfgwDQYJKoZIhvcNAQEFBQAwgcExCzAJ +BgNVBAYTAlVTMRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE8MDoGA1UECxMzQ2xh +c3MgNCBQdWJsaWMgUHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcy +MTowOAYDVQQLEzEoYykgMTk5OCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3Jp +emVkIHVzZSBvbmx5MR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMB4X +DTk4MDUxODAwMDAwMFoXDTI4MDgwMTIzNTk1OVowgcExCzAJBgNVBAYTAlVTMRcw +FQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE8MDoGA1UECxMzQ2xhc3MgNCBQdWJsaWMg +UHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMTowOAYDVQQLEzEo +YykgMTk5OCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5 +MR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMIGfMA0GCSqGSIb3DQEB +AQUAA4GNADCBiQKBgQC68OTP+cSuhVS5B1f5j8V/aBH4xBewRNzjMHPVKmIquNDM +HO0oW369atyzkSTKQWI8/AIBvxwWMZQFl3Zuoq29YRdsTjCG8FE3KlDHqGKB3FtK +qsGgtG7rL+VXxbErQHDbWk2hjh+9Ax/YA9SPTJlxvOKCzFjomDqG04Y48wApHwID +AQABMA0GCSqGSIb3DQEBBQUAA4GBAIWMEsGnuVAVess+rLhDityq3RS6iYF+ATwj +cSGIL4LcY/oCRaxFWdcqWERbt5+BO5JoPeI3JPV7bI92NZYJqFmduc4jq3TWg/0y +cyfYaT5DdPauxYma51N86Xv2S/PBZYPejYqcPIiNOVn8qj8ijaHBZlCBckztImRP +T8qAkbYp +-----END CERTIFICATE----- + +Verisign Class 1 Public Primary Certification Authority - G3 +============================================================ + +-----BEGIN CERTIFICATE----- +MIIEGjCCAwICEQCLW3VWhFSFCwDPrzhIzrGkMA0GCSqGSIb3DQEBBQUAMIHKMQsw +CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZl +cmlTaWduIFRydXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWdu +LCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlT +aWduIENsYXNzIDEgUHVibGljIFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3Jp +dHkgLSBHMzAeFw05OTEwMDEwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMIHKMQswCQYD +VQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlT +aWduIFRydXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJ +bmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWdu +IENsYXNzIDEgUHVibGljIFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkg +LSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAN2E1Lm0+afY8wR4 +nN493GwTFtl63SRRZsDHJlkNrAYIwpTRMx/wgzUfbhvI3qpuFU5UJ+/EbRrsC+MO +8ESlV8dAWB6jRx9x7GD2bZTIGDnt/kIYVt/kTEkQeE4BdjVjEjbdZrwBBDajVWjV +ojYJrKshJlQGrT/KFOCsyq0GHZXi+J3x4GD/wn91K0zM2v6HmSHquv4+VNfSWXjb +PG7PoBMAGrgnoeS+Z5bKoMWznN3JdZ7rMJpfo83ZrngZPyPpXNspva1VyBtUjGP2 +6KbqxzcSXKMpHgLZ2x87tNcPVkeBFQRKr4Mn0cVYiMHd9qqnoxjaaKptEVHhv2Vr +n5Z20T0CAwEAATANBgkqhkiG9w0BAQUFAAOCAQEAq2aN17O6x5q25lXQBfGfMY1a +qtmqRiYPce2lrVNWYgFHKkTp/j90CxObufRNG7LRX7K20ohcs5/Ny9Sn2WCVhDr4 +wTcdYcrnsMXlkdpUpqwxga6X3s0IrLjAl4B/bnKk52kTlWUfxJM8/XmPBNQ+T+r3 +ns7NZ3xPZQL/kYVUc8f/NveGLezQXk//EZ9yBta4GvFMDSZl4kSAHsef493oCtrs +pSCAaWihT37ha88HQfqDjrw43bAuEbFrskLMmrz5SCJ5ShkPshw+IHTZasO+8ih4 +E1Z5T21Q6huwtVexN2ZYI/PcD98Kh8TvhgXVOBRgmaNL3gaWcSzy27YfpO8/7g== +-----END CERTIFICATE----- + +Verisign Class 2 Public Primary Certification Authority - G3 +============================================================ + +-----BEGIN CERTIFICATE----- +MIIEGTCCAwECEGFwy0mMX5hFKeewptlQW3owDQYJKoZIhvcNAQEFBQAwgcoxCzAJ +BgNVBAYTAlVTMRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjEfMB0GA1UECxMWVmVy +aVNpZ24gVHJ1c3QgTmV0d29yazE6MDgGA1UECxMxKGMpIDE5OTkgVmVyaVNpZ24s +IEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTFFMEMGA1UEAxM8VmVyaVNp +Z24gQ2xhc3MgMiBQdWJsaWMgUHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0 +eSAtIEczMB4XDTk5MTAwMTAwMDAwMFoXDTM2MDcxNjIzNTk1OVowgcoxCzAJBgNV +BAYTAlVTMRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjEfMB0GA1UECxMWVmVyaVNp +Z24gVHJ1c3QgTmV0d29yazE6MDgGA1UECxMxKGMpIDE5OTkgVmVyaVNpZ24sIElu +Yy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTFFMEMGA1UEAxM8VmVyaVNpZ24g +Q2xhc3MgMiBQdWJsaWMgUHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAt +IEczMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArwoNwtUs22e5LeWU +J92lvuCwTY+zYVY81nzD9M0+hsuiiOLh2KRpxbXiv8GmR1BeRjmL1Za6tW8UvxDO +JxOeBUebMXoT2B/Z0wI3i60sR/COgQanDTAM6/c8DyAd3HJG7qUCyFvDyVZpTMUY +wZF7C9UTAJu878NIPkZgIIUq1ZC2zYugzDLdt/1AVbJQHFauzI13TccgTacxdu9o +koqQHgiBVrKtaaNS0MscxCM9H5n+TOgWY47GCI72MfbS+uV23bUckqNJzc0BzWjN +qWm6o+sdDZykIKbBoMXRRkwXbdKsZj+WjOCE1Db/IlnF+RFgqF8EffIa9iVCYQ/E +Srg+iQIDAQABMA0GCSqGSIb3DQEBBQUAA4IBAQA0JhU8wI1NQ0kdvekhktdmnLfe +xbjQ5F1fdiLAJvmEOjr5jLX77GDx6M4EsMjdpwOPMPOY36TmpDHf0xwLRtxyID+u +7gU8pDM/CzmscHhzS5kr3zDCVLCoO1Wh/hYozUK9dG6A2ydEp85EXdQbkJgNHkKU +sQAsBNB0owIFImNjzYO1+8FtYmtpdf1dcEG59b98377BMnMiIYtYgXsVkXq642RI +sH/7NiXaldDxJBQX3RiAa0YjOVT1jmIJBB2UkKab5iXiQkWquJCtvgiPqQtCGJTP +cjnhsUPgKM+351psE2tJs//jGHyJizNdrDPXp/naOlXJWBD5qu9ats9LS98q +-----END CERTIFICATE----- + +Verisign Class 3 Public Primary Certification Authority - G3 +============================================================ + +-----BEGIN CERTIFICATE----- +MIIEGjCCAwICEQCbfgZJoz5iudXukEhxKe9XMA0GCSqGSIb3DQEBBQUAMIHKMQsw +CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZl +cmlTaWduIFRydXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWdu +LCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlT +aWduIENsYXNzIDMgUHVibGljIFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3Jp +dHkgLSBHMzAeFw05OTEwMDEwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMIHKMQswCQYD +VQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlT +aWduIFRydXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJ +bmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWdu +IENsYXNzIDMgUHVibGljIFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkg +LSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMu6nFL8eB8aHm8b +N3O9+MlrlBIwT/A2R/XQkQr1F8ilYcEWQE37imGQ5XYgwREGfassbqb1EUGO+i2t +KmFZpGcmTNDovFJbcCAEWNF6yaRpvIMXZK0Fi7zQWM6NjPXr8EJJC52XJ2cybuGu +kxUccLwgTS8Y3pKI6GyFVxEa6X7jJhFUokWWVYPKMIno3Nij7SqAP395ZVc+FSBm +CC+Vk7+qRy+oRpfwEuL+wgorUeZ25rdGt+INpsyow0xZVYnm6FNcHOqd8GIWC6fJ +Xwzw3sJ2zq/3avL6QaaiMxTJ5Xpj055iN9WFZZ4O5lMkdBteHRJTW8cs54NJOxWu +imi5V5cCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEAERSWwauSCPc/L8my/uRan2Te +2yFPhpk0djZX3dAVL8WtfxUfN2JzPtTnX84XA9s1+ivbrmAJXx5fj267Cz3qWhMe +DGBvtcC1IyIuBwvLqXTLR7sdwdela8wv0kL9Sd2nic9TutoAWii/gt/4uhMdUIaC +/Y4wjylGsB49Ndo4YhYYSq3mtlFs3q9i6wHQHiT+eo8SGhJouPtmmRQURVyu565p +F4ErWjfJXir0xuKhXFSbplQAz/DxwceYMBo7Nhbbo27q/a2ywtrvAkcTisDxszGt +TxzhT5yvDwyd93gN2PQ1VoDat20Xj50egWTh/sVFuq1ruQp6Tk9LhO5L8X3dEQ== +-----END CERTIFICATE----- + +Verisign Class 4 Public Primary Certification Authority - G3 +============================================================ + +-----BEGIN CERTIFICATE----- +MIIEGjCCAwICEQDsoKeLbnVqAc/EfMwvlF7XMA0GCSqGSIb3DQEBBQUAMIHKMQsw +CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZl +cmlTaWduIFRydXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWdu +LCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlT +aWduIENsYXNzIDQgUHVibGljIFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3Jp +dHkgLSBHMzAeFw05OTEwMDEwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMIHKMQswCQYD +VQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlT +aWduIFRydXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJ +bmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWdu +IENsYXNzIDQgUHVibGljIFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkg +LSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAK3LpRFpxlmr8Y+1 +GQ9Wzsy1HyDkniYlS+BzZYlZ3tCD5PUPtbut8XzoIfzk6AzufEUiGXaStBO3IFsJ ++mGuqPKljYXCKtbeZjbSmwL0qJJgfJxptI8kHtCGUvYynEFYHiK9zUVilQhu0Gbd +U6LM8BDcVHOLBKFGMzNcF0C5nk3T875Vg+ixiY5afJqWIpA7iCXy0lOIAgwLePLm +NxdLMEYH5IBtptiWLugs+BGzOA1mppvqySNb247i8xOOGlktqgLw7KSHZtzBP/XY +ufTsgsbSPZUd5cBPhMnZo0QoBmrXRazwa2rvTl/4EYIeOGM0ZlDUPpNz+jDDZq3/ +ky2X7wMCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEAj/ola09b5KROJ1WrIhVZPMq1 +CtRK26vdoV9TxaBXOcLORyu+OshWv8LZJxA6sQU8wHcxuzrTBXttmhwwjIDLk5Mq +g6sFUYICABFna/OIYUdfA5PVWw3g8dShMjWFsjrbsIKr0csKvE+MW8VLADsfKoKm +fjaF3H48ZwC15DtS4KjrXRX5xm3wrR0OhbepmnMUWluPQSjA1egtTaRezarZ7c7c +2NU8Qh0XwRJdRTjDOPP8hS6DRkiy1yBfkjaP53kPmF6Z6PDQpLv1U70qzlmwr25/ +bLvSHgCwIe34QWKCudiyxLtGUPMxxY8BqHTr9Xgn2uf3ZkPznoM+IKrDNWCRzg== +-----END CERTIFICATE----- + +Equifax Secure Global eBusiness CA +================================== + +-----BEGIN CERTIFICATE----- +MIICkDCCAfmgAwIBAgIBATANBgkqhkiG9w0BAQQFADBaMQswCQYDVQQGEwJVUzEc +MBoGA1UEChMTRXF1aWZheCBTZWN1cmUgSW5jLjEtMCsGA1UEAxMkRXF1aWZheCBT +ZWN1cmUgR2xvYmFsIGVCdXNpbmVzcyBDQS0xMB4XDTk5MDYyMTA0MDAwMFoXDTIw +MDYyMTA0MDAwMFowWjELMAkGA1UEBhMCVVMxHDAaBgNVBAoTE0VxdWlmYXggU2Vj +dXJlIEluYy4xLTArBgNVBAMTJEVxdWlmYXggU2VjdXJlIEdsb2JhbCBlQnVzaW5l +c3MgQ0EtMTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAuucXkAJlsTRVPEnC +UdXfp9E3j9HngXNBUmCbnaEXJnitx7HoJpQytd4zjTov2/KaelpzmKNc6fuKcxtc +58O/gGzNqfTWK8D3+ZmqY6KxRwIP1ORROhI8bIpaVIRw28HFkM9yRcuoWcDNM50/ +o5brhTMhHD4ePmBudpxnhcXIw2ECAwEAAaNmMGQwEQYJYIZIAYb4QgEBBAQDAgAH +MA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUvqigdHJQa0S3ySPY+6j/s1dr +aGwwHQYDVR0OBBYEFL6ooHRyUGtEt8kj2Puo/7NXa2hsMA0GCSqGSIb3DQEBBAUA +A4GBADDiAVGqx+pf2rnQZQ8w1j7aDRRJbpGTJxQx78T3LUX47Me/okENI7SS+RkA +Z70Br83gcfxaz2TE4JaY0KNA4gGK7ycH8WUBikQtBmV1UsCGECAhX2xrD2yuCRyv +8qIYNMR1pHMc8Y3c7635s3a0kr/clRAevsvIO1qEYBlWlKlV +-----END CERTIFICATE----- + +Equifax Secure eBusiness CA 1 +============================= + +-----BEGIN CERTIFICATE----- +MIICgjCCAeugAwIBAgIBBDANBgkqhkiG9w0BAQQFADBTMQswCQYDVQQGEwJVUzEc +MBoGA1UEChMTRXF1aWZheCBTZWN1cmUgSW5jLjEmMCQGA1UEAxMdRXF1aWZheCBT +ZWN1cmUgZUJ1c2luZXNzIENBLTEwHhcNOTkwNjIxMDQwMDAwWhcNMjAwNjIxMDQw +MDAwWjBTMQswCQYDVQQGEwJVUzEcMBoGA1UEChMTRXF1aWZheCBTZWN1cmUgSW5j +LjEmMCQGA1UEAxMdRXF1aWZheCBTZWN1cmUgZUJ1c2luZXNzIENBLTEwgZ8wDQYJ +KoZIhvcNAQEBBQADgY0AMIGJAoGBAM4vGbwXt3fek6lfWg0XTzQaDJj0ItlZ1MRo +RvC0NcWFAyDGr0WlIVFFQesWWDYyb+JQYmT5/VGcqiTZ9J2DKocKIdMSODRsjQBu +WqDZQu4aIZX5UkxVWsUPOE9G+m34LjXWHXzr4vCwdYDIqROsvojvOm6rXyo4YgKw +Env+j6YDAgMBAAGjZjBkMBEGCWCGSAGG+EIBAQQEAwIABzAPBgNVHRMBAf8EBTAD +AQH/MB8GA1UdIwQYMBaAFEp4MlIR21kWNl7fwRQ2QGpHfEyhMB0GA1UdDgQWBBRK +eDJSEdtZFjZe38EUNkBqR3xMoTANBgkqhkiG9w0BAQQFAAOBgQB1W6ibAxHm6VZM +zfmpTMANmvPMZWnmJXbMWbfWVMMdzZmsGd20hdXgPfxiIKeES1hl8eL5lSE/9dR+ +WB5Hh1Q+WKG1tfgq73HnvMP2sUlG4tega+VWeponmHxGYhTnyfxuAxJ5gDgdSIKN +/Bf+KpYrtWKmpj29f5JZzVoqgrI3eQ== +-----END CERTIFICATE----- + +Equifax Secure eBusiness CA 2 +============================= + +-----BEGIN CERTIFICATE----- +MIIDIDCCAomgAwIBAgIEN3DPtTANBgkqhkiG9w0BAQUFADBOMQswCQYDVQQGEwJV +UzEXMBUGA1UEChMORXF1aWZheCBTZWN1cmUxJjAkBgNVBAsTHUVxdWlmYXggU2Vj +dXJlIGVCdXNpbmVzcyBDQS0yMB4XDTk5MDYyMzEyMTQ0NVoXDTE5MDYyMzEyMTQ0 +NVowTjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDkVxdWlmYXggU2VjdXJlMSYwJAYD +VQQLEx1FcXVpZmF4IFNlY3VyZSBlQnVzaW5lc3MgQ0EtMjCBnzANBgkqhkiG9w0B +AQEFAAOBjQAwgYkCgYEA5Dk5kx5SBhsoNviyoynF7Y6yEb3+6+e0dMKP/wXn2Z0G +vxLIPw7y1tEkshHe0XMJitSxLJgJDR5QRrKDpkWNYmi7hRsgcDKqQM2mll/EcTc/ +BPO3QSQ5BxoeLmFYoBIL5aXfxavqN3HMHMg3OrmXUqesxWoklE6ce8/AatbfIb0C +AwEAAaOCAQkwggEFMHAGA1UdHwRpMGcwZaBjoGGkXzBdMQswCQYDVQQGEwJVUzEX +MBUGA1UEChMORXF1aWZheCBTZWN1cmUxJjAkBgNVBAsTHUVxdWlmYXggU2VjdXJl +IGVCdXNpbmVzcyBDQS0yMQ0wCwYDVQQDEwRDUkwxMBoGA1UdEAQTMBGBDzIwMTkw +NjIzMTIxNDQ1WjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAUUJ4L6q9euSBIplBq +y/3YIHqngnYwHQYDVR0OBBYEFFCeC+qvXrkgSKZQasv92CB6p4J2MAwGA1UdEwQF +MAMBAf8wGgYJKoZIhvZ9B0EABA0wCxsFVjMuMGMDAgbAMA0GCSqGSIb3DQEBBQUA +A4GBAAyGgq3oThr1jokn4jVYPSm0B482UJW/bsGe68SQsoWou7dC4A8HOd/7npCy +0cE+U58DRLB+S/Rv5Hwf5+Kx5Lia78O9zt4LMjTZ3ijtM2vE1Nc9ElirfQkty3D1 +E4qUoSek1nDFbZS1yX2doNLGCEnZZpum0/QL3MUmV+GRMOrN +-----END CERTIFICATE----- + +Thawte Time Stamping CA +======================= + +-----BEGIN CERTIFICATE----- +MIICoTCCAgqgAwIBAgIBADANBgkqhkiG9w0BAQQFADCBizELMAkGA1UEBhMCWkEx +FTATBgNVBAgTDFdlc3Rlcm4gQ2FwZTEUMBIGA1UEBxMLRHVyYmFudmlsbGUxDzAN +BgNVBAoTBlRoYXd0ZTEdMBsGA1UECxMUVGhhd3RlIENlcnRpZmljYXRpb24xHzAd +BgNVBAMTFlRoYXd0ZSBUaW1lc3RhbXBpbmcgQ0EwHhcNOTcwMTAxMDAwMDAwWhcN +MjAxMjMxMjM1OTU5WjCBizELMAkGA1UEBhMCWkExFTATBgNVBAgTDFdlc3Rlcm4g +Q2FwZTEUMBIGA1UEBxMLRHVyYmFudmlsbGUxDzANBgNVBAoTBlRoYXd0ZTEdMBsG +A1UECxMUVGhhd3RlIENlcnRpZmljYXRpb24xHzAdBgNVBAMTFlRoYXd0ZSBUaW1l +c3RhbXBpbmcgQ0EwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANYrWHhhRYZT +6jR7UZztsOYuGA7+4F+oJ9O0yeB8WU4WDnNUYMF/9p8u6TqFJBU820cEY8OexJQa +Wt9MevPZQx08EHp5JduQ/vBR5zDWQQD9nyjfeb6Uu522FOMjhdepQeBMpHmwKxqL +8vg7ij5FrHGSALSQQZj7X+36ty6K+Ig3AgMBAAGjEzARMA8GA1UdEwEB/wQFMAMB +Af8wDQYJKoZIhvcNAQEEBQADgYEAZ9viwuaHPUCDhjc1fR/OmsMMZiCouqoEiYbC +9RAIDb/LogWK0E02PvTX72nGXuSwlG9KuefeW4i2e9vjJ+V2w/A1wcu1J5szedyQ +pgCed/r8zSeUQhac0xxo7L9c3eWpexAKMnRUEzGLhQOEkbdYATAUOK8oyvyxUBkZ +CayJSdM= +-----END CERTIFICATE----- + +thawte Primary Root CA +====================== + +-----BEGIN CERTIFICATE----- +MIIEIDCCAwigAwIBAgIQNE7VVyDV7exJ9C/ON9srbTANBgkqhkiG9w0BAQUFADCB +qTELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMf +Q2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIw +MDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxHzAdBgNV +BAMTFnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwHhcNMDYxMTE3MDAwMDAwWhcNMzYw +NzE2MjM1OTU5WjCBqTELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5j +LjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYG +A1UECxMvKGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl +IG9ubHkxHzAdBgNVBAMTFnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwggEiMA0GCSqG +SIb3DQEBAQUAA4IBDwAwggEKAoIBAQCsoPD7gFnUnMekz52hWXMJEEUMDSxuaPFs +W0hoSVk3/AszGcJ3f8wQLZU0HObrTQmnHNK4yZc2AreJ1CRfBsDMRJSUjQJib+ta +3RGNKJpchJAQeg29dGYvajig4tVUROsdB58Hum/u6f1OCyn1PoSgAfGcq/gcfomk +6KHYcWUNo1F77rzSImANuVud37r8UVsLr5iy6S7pBOhih94ryNdOwUxkHt3Ph1i6 +Sk/KaAcdHJ1KxtUvkcx8cXIcxcBn6zL9yZJclNqFwJu/U30rCfSMnZEfl2pSy94J +NqR32HuHUETVPm4pafs5SSYeCaWAe0At6+gnhcn+Yf1+5nyXHdWdAgMBAAGjQjBA +MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBR7W0XP +r87Lev0xkhpqtvNG61dIUDANBgkqhkiG9w0BAQUFAAOCAQEAeRHAS7ORtvzw6WfU +DW5FvlXok9LOAz/t2iWwHVfLHjp2oEzsUHboZHIMpKnxuIvW1oeEuzLlQRHAd9mz +YJ3rG9XRbkREqaYB7FViHXe4XI5ISXycO1cRrK1zN44veFyQaEfZYGDm/Ac9IiAX +xPcW6cTYcvnIc3zfFi8VqT79aie2oetaupgf1eNNZAqdE8hhuvU5HIe6uL17In/2 +/qxAeeWsEG89jxt5dovEN7MhGITlNgDrYyCZuen+MwS7QcjBAvlEYyCegc5C09Y/ +LHbTY5xZ3Y+m4Q6gLkH3LpVHz7z9M/P2C2F+fpErgUfCJzDupxBdN49cOSvkBPB7 +jVaMaA== +-----END CERTIFICATE----- + +VeriSign Class 3 Public Primary Certification Authority - G5 +============================================================ + +-----BEGIN CERTIFICATE----- +MIIE0zCCA7ugAwIBAgIQGNrRniZ96LtKIVjNzGs7SjANBgkqhkiG9w0BAQUFADCB +yjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQL +ExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJp +U2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxW +ZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0 +aG9yaXR5IC0gRzUwHhcNMDYxMTA4MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCByjEL +MAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZW +ZXJpU2lnbiBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2ln +biwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJp +U2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9y +aXR5IC0gRzUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvJAgIKXo1 +nmAMqudLO07cfLw8RRy7K+D+KQL5VwijZIUVJ/XxrcgxiV0i6CqqpkKzj/i5Vbex +t0uz/o9+B1fs70PbZmIVYc9gDaTY3vjgw2IIPVQT60nKWVSFJuUrjxuf6/WhkcIz +SdhDY2pSS9KP6HBRTdGJaXvHcPaz3BJ023tdS1bTlr8Vd6Gw9KIl8q8ckmcY5fQG +BO+QueQA5N06tRn/Arr0PO7gi+s3i+z016zy9vA9r911kTMZHRxAy3QkGSGT2RT+ +rCpSx4/VBEnkjWNHiDxpg8v+R70rfk/Fla4OndTRQ8Bnc+MUCH7lP59zuDMKz10/ +NIeWiu5T6CUVAgMBAAGjgbIwga8wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8E +BAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2UvZ2lmMCEwHzAH +BgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVy +aXNpZ24uY29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFH/TZafC3ey78DAJ80M5+gKv +MzEzMA0GCSqGSIb3DQEBBQUAA4IBAQCTJEowX2LP2BqYLz3q3JktvXf2pXkiOOzE +p6B4Eq1iDkVwZMXnl2YtmAl+X6/WzChl8gGqCBpH3vn5fJJaCGkgDdk+bW48DW7Y +5gaRQBi5+MHt39tBquCWIMnNZBU4gcmU7qKEKQsTb47bDN0lAtukixlE0kF6BWlK +WE9gyn6CagsCqiUXObXbf+eEZSqVir2G3l6BFoMtEMze/aiCKm0oHw0LxOXnGiYZ +4fQRbxC1lfznQgUy286dUV4otp6F01vvpX1FQHKOtw5rDgb7MzVIcbidJ4vEZV8N +hnacRHr2lVz2XTIIM6RUthg/aFzyQkqFOFSDX9HoLPKsEdao7WNq +-----END CERTIFICATE----- + +Entrust.net Secure Server Certification Authority +================================================= + +-----BEGIN CERTIFICATE----- +MIIE2DCCBEGgAwIBAgIEN0rSQzANBgkqhkiG9w0BAQUFADCBwzELMAkGA1UEBhMC +VVMxFDASBgNVBAoTC0VudHJ1c3QubmV0MTswOQYDVQQLEzJ3d3cuZW50cnVzdC5u +ZXQvQ1BTIGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTElMCMGA1UECxMc +KGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDE6MDgGA1UEAxMxRW50cnVzdC5u +ZXQgU2VjdXJlIFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw05OTA1 +MjUxNjA5NDBaFw0xOTA1MjUxNjM5NDBaMIHDMQswCQYDVQQGEwJVUzEUMBIGA1UE +ChMLRW50cnVzdC5uZXQxOzA5BgNVBAsTMnd3dy5lbnRydXN0Lm5ldC9DUFMgaW5j +b3JwLiBieSByZWYuIChsaW1pdHMgbGlhYi4pMSUwIwYDVQQLExwoYykgMTk5OSBF +bnRydXN0Lm5ldCBMaW1pdGVkMTowOAYDVQQDEzFFbnRydXN0Lm5ldCBTZWN1cmUg +U2VydmVyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGdMA0GCSqGSIb3DQEBAQUA +A4GLADCBhwKBgQDNKIM0VBuJ8w+vN5Ex/68xYMmo6LIQaO2f55M28Qpku0f1BBc/ +I0dNxScZgSYMVHINiC3ZH5oSn7yzcdOAGT9HZnuMNSjSuQrfJNqc1lB5gXpa0zf3 +wkrYKZImZNHkmGw6AIr1NJtl+O3jEP/9uElY3KDegjlrgbEWGWG5VLbmQwIBA6OC +AdcwggHTMBEGCWCGSAGG+EIBAQQEAwIABzCCARkGA1UdHwSCARAwggEMMIHeoIHb +oIHYpIHVMIHSMQswCQYDVQQGEwJVUzEUMBIGA1UEChMLRW50cnVzdC5uZXQxOzA5 +BgNVBAsTMnd3dy5lbnRydXN0Lm5ldC9DUFMgaW5jb3JwLiBieSByZWYuIChsaW1p +dHMgbGlhYi4pMSUwIwYDVQQLExwoYykgMTk5OSBFbnRydXN0Lm5ldCBMaW1pdGVk +MTowOAYDVQQDEzFFbnRydXN0Lm5ldCBTZWN1cmUgU2VydmVyIENlcnRpZmljYXRp +b24gQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMCmgJ6AlhiNodHRwOi8vd3d3LmVu +dHJ1c3QubmV0L0NSTC9uZXQxLmNybDArBgNVHRAEJDAigA8xOTk5MDUyNTE2MDk0 +MFqBDzIwMTkwNTI1MTYwOTQwWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAU8Bdi +E1U9s/8KAGv7UISX8+1i0BowHQYDVR0OBBYEFPAXYhNVPbP/CgBr+1CEl/PtYtAa +MAwGA1UdEwQFMAMBAf8wGQYJKoZIhvZ9B0EABAwwChsEVjQuMAMCBJAwDQYJKoZI +hvcNAQEFBQADgYEAkNwwAvpkdMKnCqV8IY00F6j7Rw7/JXyNEwr75Ji174z4xRAN +95K+8cPV1ZVqBLssziY2ZcgxxufuP+NXdYR6Ee9GTxj005i7qIcyunL2POI9n9cd +2cNgQ4xYDiKWL2KjLB+6rQXvqzJ4h6BUcxm1XAX5Uj5tLUUL9wqT6u0G+bI= +-----END CERTIFICATE----- + +Go Daddy Certification Authority Root Certificate Bundle +======================================================== + +-----BEGIN CERTIFICATE----- +MIIE3jCCA8agAwIBAgICAwEwDQYJKoZIhvcNAQEFBQAwYzELMAkGA1UEBhMCVVMx +ITAfBgNVBAoTGFRoZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28g +RGFkZHkgQ2xhc3MgMiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjExMTYw +MTU0MzdaFw0yNjExMTYwMTU0MzdaMIHKMQswCQYDVQQGEwJVUzEQMA4GA1UECBMH +QXJpem9uYTETMBEGA1UEBxMKU2NvdHRzZGFsZTEaMBgGA1UEChMRR29EYWRkeS5j +b20sIEluYy4xMzAxBgNVBAsTKmh0dHA6Ly9jZXJ0aWZpY2F0ZXMuZ29kYWRkeS5j +b20vcmVwb3NpdG9yeTEwMC4GA1UEAxMnR28gRGFkZHkgU2VjdXJlIENlcnRpZmlj +YXRpb24gQXV0aG9yaXR5MREwDwYDVQQFEwgwNzk2OTI4NzCCASIwDQYJKoZIhvcN +AQEBBQADggEPADCCAQoCggEBAMQt1RWMnCZM7DI161+4WQFapmGBWTtwY6vj3D3H +KrjJM9N55DrtPDAjhI6zMBS2sofDPZVUBJ7fmd0LJR4h3mUpfjWoqVTr9vcyOdQm +VZWt7/v+WIbXnvQAjYwqDL1CBM6nPwT27oDyqu9SoWlm2r4arV3aLGbqGmu75RpR +SgAvSMeYddi5Kcju+GZtCpyz8/x4fKL4o/K1w/O5epHBp+YlLpyo7RJlbmr2EkRT +cDCVw5wrWCs9CHRK8r5RsL+H0EwnWGu1NcWdrxcx+AuP7q2BNgWJCJjPOq8lh8BJ +6qf9Z/dFjpfMFDniNoW1fho3/Rb2cRGadDAW/hOUoz+EDU8CAwEAAaOCATIwggEu +MB0GA1UdDgQWBBT9rGEyk2xF1uLuhV+auud2mWjM5zAfBgNVHSMEGDAWgBTSxLDS +kdRMEXGzYcs9of7dqGrU4zASBgNVHRMBAf8ECDAGAQH/AgEAMDMGCCsGAQUFBwEB +BCcwJTAjBggrBgEFBQcwAYYXaHR0cDovL29jc3AuZ29kYWRkeS5jb20wRgYDVR0f +BD8wPTA7oDmgN4Y1aHR0cDovL2NlcnRpZmljYXRlcy5nb2RhZGR5LmNvbS9yZXBv +c2l0b3J5L2dkcm9vdC5jcmwwSwYDVR0gBEQwQjBABgRVHSAAMDgwNgYIKwYBBQUH +AgEWKmh0dHA6Ly9jZXJ0aWZpY2F0ZXMuZ29kYWRkeS5jb20vcmVwb3NpdG9yeTAO +BgNVHQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQEFBQADggEBANKGwOy9+aG2Z+5mC6IG +OgRQjhVyrEp0lVPLN8tESe8HkGsz2ZbwlFalEzAFPIUyIXvJxwqoJKSQ3kbTJSMU +A2fCENZvD117esyfxVgqwcSeIaha86ykRvOe5GPLL5CkKSkB2XIsKd83ASe8T+5o +0yGPwLPk9Qnt0hCqU7S+8MxZC9Y7lhyVJEnfzuz9p0iRFEUOOjZv2kWzRaJBydTX +RE4+uXR21aITVSzGh6O1mawGhId/dQb8vxRMDsxuxN89txJx9OjxUUAiKEngHUuH +qDTMBqLdElrRhjZkAzVvb3du6/KFUJheqwNTrZEjYx8WnM25sgVjOuH0aBsXBTWV +U+4= +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIE+zCCBGSgAwIBAgICAQ0wDQYJKoZIhvcNAQEFBQAwgbsxJDAiBgNVBAcTG1Zh +bGlDZXJ0IFZhbGlkYXRpb24gTmV0d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIElu +Yy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENsYXNzIDIgUG9saWN5IFZhbGlkYXRpb24g +QXV0aG9yaXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZhbGljZXJ0LmNvbS8xIDAe +BgkqhkiG9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMB4XDTA0MDYyOTE3MDYyMFoX +DTI0MDYyOTE3MDYyMFowYzELMAkGA1UEBhMCVVMxITAfBgNVBAoTGFRoZSBHbyBE +YWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28gRGFkZHkgQ2xhc3MgMiBDZXJ0 +aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQADggENADCCAQgC +ggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XCAPVYYYwhv +2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6wwdhFJ2+q +N1j3hybX2C32qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXiEqITLdiO +r18SPaAIBQi2XKVlOARFmR6jYGB0xUGlcmIbYsUfb18aQr4CUWWoriMYavx4A6lN +f4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmYvLEHZ6IVDd2gWMZEewo+YihfukEH +U1jPEX44dMX4/7VpkI+EdOqXG68CAQOjggHhMIIB3TAdBgNVHQ4EFgQU0sSw0pHU +TBFxs2HLPaH+3ahq1OMwgdIGA1UdIwSByjCBx6GBwaSBvjCBuzEkMCIGA1UEBxMb +VmFsaUNlcnQgVmFsaWRhdGlvbiBOZXR3b3JrMRcwFQYDVQQKEw5WYWxpQ2VydCwg +SW5jLjE1MDMGA1UECxMsVmFsaUNlcnQgQ2xhc3MgMiBQb2xpY3kgVmFsaWRhdGlv +biBBdXRob3JpdHkxITAfBgNVBAMTGGh0dHA6Ly93d3cudmFsaWNlcnQuY29tLzEg +MB4GCSqGSIb3DQEJARYRaW5mb0B2YWxpY2VydC5jb22CAQEwDwYDVR0TAQH/BAUw +AwEB/zAzBggrBgEFBQcBAQQnMCUwIwYIKwYBBQUHMAGGF2h0dHA6Ly9vY3NwLmdv +ZGFkZHkuY29tMEQGA1UdHwQ9MDswOaA3oDWGM2h0dHA6Ly9jZXJ0aWZpY2F0ZXMu +Z29kYWRkeS5jb20vcmVwb3NpdG9yeS9yb290LmNybDBLBgNVHSAERDBCMEAGBFUd +IAAwODA2BggrBgEFBQcCARYqaHR0cDovL2NlcnRpZmljYXRlcy5nb2RhZGR5LmNv +bS9yZXBvc2l0b3J5MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOBgQC1 +QPmnHfbq/qQaQlpE9xXUhUaJwL6e4+PrxeNYiY+Sn1eocSxI0YGyeR+sBjUZsE4O +WBsUs5iB0QQeyAfJg594RAoYC5jcdnplDQ1tgMQLARzLrUc+cb53S8wGd9D0Vmsf +SxOaFIqII6hR8INMqzW/Rn453HWkrugp++85j09VZw== +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIC5zCCAlACAQEwDQYJKoZIhvcNAQEFBQAwgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0 +IFZhbGlkYXRpb24gTmV0d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAz +BgNVBAsTLFZhbGlDZXJ0IENsYXNzIDIgUG9saWN5IFZhbGlkYXRpb24gQXV0aG9y +aXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZhbGljZXJ0LmNvbS8xIDAeBgkqhkiG +9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMB4XDTk5MDYyNjAwMTk1NFoXDTE5MDYy +NjAwMTk1NFowgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRpb24gTmV0d29y +azEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENs +YXNzIDIgUG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRw +Oi8vd3d3LnZhbGljZXJ0LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNl +cnQuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDOOnHK5avIWZJV16vY +dA757tn2VUdZZUcOBVXc65g2PFxTXdMwzzjsvUGJ7SVCCSRrCl6zfN1SLUzm1NZ9 +WlmpZdRJEy0kTRxQb7XBhVQ7/nHk01xC+YDgkRoKWzk2Z/M/VXwbP7RfZHM047QS +v4dk+NoS/zcnwbNDu+97bi5p9wIDAQABMA0GCSqGSIb3DQEBBQUAA4GBADt/UG9v +UJSZSWI4OB9L+KXIPqeCgfYrx+jFzug6EILLGACOTb2oWH+heQC1u+mNr0HZDzTu +IYEZoDJJKPTEjlbVUjP9UNV+mWwD5MlM/Mtsq2azSiGM5bUMMj4QssxsodyamEwC +W/POuZ6lcg5Ktz885hZo+L7tdEy8W9ViH0Pd +-----END CERTIFICATE----- + diff --git a/webui/google-api/service/apiBatch.php b/webui/google-api/service/apiBatch.php new file mode 100644 index 0000000..b1cc918 --- /dev/null +++ b/webui/google-api/service/apiBatch.php @@ -0,0 +1,39 @@ + + */ +class apiBatch { + + /** + * Execute one or multiple Google API requests, takes one or multiple requests as param + * Example usage: + * $ret = apiBatch::execute( + * $apiClient->activities->list(array('@public', '@me'), 'listActivitiesKey'), + * $apiClient->people->get(array('userId' => '@me'), 'getPeopleKey') + * ); + * print_r($ret['getPeopleKey']); + */ + static public function execute( /* polymorphic */) { + $requests = func_get_args(); + return apiRPC::execute($requests); + } + +} \ No newline at end of file diff --git a/webui/google-api/service/apiMediaFileUpload.php b/webui/google-api/service/apiMediaFileUpload.php new file mode 100644 index 0000000..47a03b0 --- /dev/null +++ b/webui/google-api/service/apiMediaFileUpload.php @@ -0,0 +1,89 @@ + + * + */ +class apiMediaFileUpload { + public $mimeType; + public $fileName; + public $chunkSize; + + public static function process($metadata, $method, &$params) { + $payload = array(); + + $data = isset($params['data']) ? $params['data']['value'] : false; + $mimeType = isset($params['mimeType']) ? $params['mimeType']['value'] : false; + $file = isset($params['file']) ? $params['file']['value'] : false; + $uploadPath = $method['mediaUpload']['protocols']['simple']['path']; + + unset($params['data']); + unset($params['mimeType']); + unset($params['file']); + + if ($file) { + if (substr($file, 0, 1) != '@') { + $file = '@' . $file; + } + $payload['file'] = $file; + $payload['content-type'] = 'multipart/form-data'; + $payload['restBasePath'] = $uploadPath; + + // This is a standard file upload with curl. + return $payload; + } + + $parsedMeta = is_string($metadata) ? json_decode($metadata, true) : $metadata; + if ($metadata && false == $data) { + // Process as a normal API request. + return false; + } + + // Process as a media upload request. + $params['uploadType'] = array( + 'type' => 'string', + 'location' => 'query', + 'value' => 'media', + ); + + // Determine which type. + $payload['restBasePath'] = $uploadPath; + if (false == $metadata || false == $parsedMeta) { + // This is a simple media upload. + $payload['content-type'] = $mimeType; + $payload['data'] = $data; + } else { + // This is a multipart/related upload. + $boundary = isset($params['boundary']) ? $params['boundary'] : mt_rand(); + $boundary = str_replace('"', '', $boundary); + $payload['content-type'] = 'multipart/related; boundary=' . $boundary; + + $related = "--$boundary\r\n"; + $related .= "Content-Type: application/json; charset=UTF-8\r\n"; + $related .= "\r\n" . $metadata . "\r\n"; + $related .= "--$boundary\r\n"; + $related .= "Content-Type: $mimeType\r\n"; + $related .= "Content-Transfer-Encoding: base64\r\n"; + $related .= "\r\n" . base64_encode($data) . "\r\n"; + $related .= "--$boundary--"; + $payload['data'] = $related; + } + + return $payload; + } +} \ No newline at end of file diff --git a/webui/google-api/service/apiModel.php b/webui/google-api/service/apiModel.php new file mode 100644 index 0000000..8ad9a82 --- /dev/null +++ b/webui/google-api/service/apiModel.php @@ -0,0 +1,115 @@ + + * + */ +class apiModel { + public function __construct( /* polymorphic */ ) { + if (func_num_args() == 1 && is_array(func_get_arg(0))) { + // Initialize the model with the array's contents. + $array = func_get_arg(0); + $this->mapTypes($array); + } + } + + /** + * Initialize this object's properties from an array. + * + * @param array Used to seed this object's properties. + * @return void + */ + private function mapTypes($array) { + foreach ($array as $key => $val) { + $this->$key = $val; + + $keyTypeName = "__$key" . 'Type'; + $keyDataType = "__$key" . 'DataType'; + if ($this->useObjects() && property_exists($this, $keyTypeName)) { + if ($this->isAssociativeArray($val)) { + if (isset($this->$keyDataType) && 'map' == $this->$keyDataType) { + foreach($val as $arrayKey => $arrayItem) { + $val[$arrayKey] = $this->createObjectFromName($keyTypeName, $arrayItem); + } + $this->$key = $val; + } else { + $this->$key = $this->createObjectFromName($keyTypeName, $val); + } + } else if (is_array($val)) { + $arrayObject = array(); + foreach ($val as $arrayIndex => $arrayItem) { + $arrayObject[$arrayIndex] = $this->createObjectFromName($keyTypeName, $arrayItem); + } + $this->$key = $arrayObject; + } + } + } + } + + /** + * Returns true only if the array is associative. + * @param array $array + * @return bool True if the array is associative. + */ + private function isAssociativeArray($array) { + if (!is_array($array)) { + return false; + } + $keys = array_keys($array); + foreach($keys as $key) { + if (is_string($key)) { + return true; + } + } + return false; + } + + /** + * Given a variable name, discover its type. + * + * @param $name + * @param $item + * @return object The object from the item. + */ + private function createObjectFromName($name, $item) { + $type = $this->$name; + return new $type($item); + } + + protected function useObjects() { + global $apiConfig; + return (isset($apiConfig['use_objects']) && $apiConfig['use_objects']); + } + + /** + * Verify if $obj is an array. + * @throws apiException Thrown if $obj isn't an array. + * @param array $obj Items that should be validated. + * @param string $type Array items should be of this type. + * @param string $method Method expecting an array as an argument. + */ + protected function assertIsArray($obj, $type, $method) { + if ($obj && !is_array($obj)) { + throw new apiException("Incorrect parameter type passed to $method(), expected an" + . " array containing items of type $type."); + } + } +} \ No newline at end of file diff --git a/webui/google-api/service/apiService.php b/webui/google-api/service/apiService.php new file mode 100644 index 0000000..c599305 --- /dev/null +++ b/webui/google-api/service/apiService.php @@ -0,0 +1,64 @@ +activities, $this->comments, $this->people, etc. + * + * @author Chris Chabot + * + */ +class apiService { + public $version = null; + public $restBasePath; + public $rpcPath; + public $resource = null; + + public function __construct($serviceName, $discoveryDocument) { + global $apiConfig; + if (!isset($discoveryDocument['version']) || !isset($discoveryDocument['restBasePath']) || !isset($discoveryDocument['rpcPath'])) { + throw new apiServiceException("Invalid discovery document"); + } + $this->version = $discoveryDocument['version']; + $this->restBasePath = $apiConfig['basePath'] . $discoveryDocument['restBasePath']; + $this->rpcPath = $apiConfig['basePath'] . $discoveryDocument['rpcPath']; + foreach ($discoveryDocument['resources'] as $resourceName => $resourceTypes) { + $this->$resourceName = new apiServiceResource($this, $serviceName, $resourceName, $resourceTypes); + } + } + + /** + * @return string $restBasePath + */ + public function getRestBasePath() { + return $this->restBasePath; + } + + /** + * @return string $rpcPath + */ + public function getRpcPath() { + return $this->rpcPath; + } +} diff --git a/webui/google-api/service/apiServiceRequest.php b/webui/google-api/service/apiServiceRequest.php new file mode 100644 index 0000000..4fd8e82 --- /dev/null +++ b/webui/google-api/service/apiServiceRequest.php @@ -0,0 +1,135 @@ + + * @author Chirag Shah + * + */ +class apiServiceRequest { + public $restBasePath; + public $restPath; + public $rpcPath; + public $rpcName; + public $httpMethod; + public $parameters; + public $postBody; + public $batchKey; + public $contentType; + + /** + * @param string $restBasePath + * @param string $rpcPath + * @param string $restPath + * @param string $rpcName + * @param string $httpMethod + * @param array $parameters + * @param string $postBody + */ + public function __construct($restBasePath, $rpcPath, $restPath, $rpcName, $httpMethod, $parameters, $postBody = null) { + if (substr($restBasePath, 0, 4) == 'http') { + $this->restBasePath = $restBasePath; + } else { + global $apiConfig; + $this->restBasePath = $apiConfig['basePath'] . $restBasePath; + } + + $this->restPath = $restPath; + $this->rpcPath = $rpcPath; + $this->rpcName = $rpcName; + $this->httpMethod = $httpMethod; + $this->parameters = $parameters; + $this->postBody = $postBody; + } + + /** + * @return string $postBody + */ + public function getPostBody() { + return $this->postBody; + } + + /** + * @param string $postBody The post body. + */ + public function setPostBody($postBody) { + $this->postBody = $postBody; + } + /** + * @return string restBasePath + */ + public function getRestBasePath() { + return $this->restBasePath; + } + /** + * @return string restPath + */ + public function getRestPath() { + return $this->restPath; + } + + /** + * @return string $rpcPath + */ + public function getRpcPath() { + return $this->rpcPath; + } + + /** + * @return string $rpcName + */ + public function getRpcName() { + return $this->rpcName; + } + + /** + * @return string $httpMethod + */ + public function getHttpMethod() { + return $this->httpMethod; + } + + /** + * @return array $parameters + */ + public function getParameters() { + return $this->parameters; + } + + /** + * @return string $batchKey + */ + public function getBatchKey() { + return $this->batchKey; + } + + /** + * @param $batchKey the $batchKey to set + */ + public function setBatchKey($batchKey) { + $this->batchKey = $batchKey; + } + + public function setContentType($type) { + $this->contentType = $type; + } +} diff --git a/webui/google-api/service/apiServiceResource.php b/webui/google-api/service/apiServiceResource.php new file mode 100644 index 0000000..9daac0d --- /dev/null +++ b/webui/google-api/service/apiServiceResource.php @@ -0,0 +1,207 @@ + + * @author Chirag Shah + * + */ +class apiServiceResource { + // Valid query parameters that work, but don't appear in discovery. + private $stackParameters = array( + 'alt' => array('type' => 'string', 'location' => 'query'), + 'fields' => array('type' => 'string', 'location' => 'query'), + 'trace' => array('type' => 'string', 'location' => 'query'), + 'userIp' => array('type' => 'string', 'location' => 'query'), + 'userip' => array('type' => 'string', 'location' => 'query'), + 'file' => array('type' => 'complex', 'location' => 'body'), + 'data' => array('type' => 'string', 'location' => 'body'), + 'mimeType' => array('type' => 'string', 'location' => 'header'), + 'uploadType' => array('type' => 'string', 'location' => 'query'), + ); + + /** @var apiService $service */ + private $service; + + /** @var string $serviceName */ + private $serviceName; + + /** @var string $resourceName */ + private $resourceName; + + /** @var array $methods */ + private $methods; + + public function __construct($service, $serviceName, $resourceName, $resource) { + $this->service = $service; + $this->serviceName = $serviceName; + $this->resourceName = $resourceName; + $this->methods = isset($resource['methods']) ? $resource['methods'] : array($resourceName => $resource); + } + + /** + * @param $name + * @param $arguments + * @return apiServiceRequest|array + * @throws apiException + */ + public function __call($name, $arguments) { + if (count($arguments) != 1 && count($arguments) != 2) { + throw new apiException("client method calls expect 1 or 2 parameter (\$client->plus->activities->list(array('userId' => 'me'))"); + } + if (! is_array($arguments[0])) { + throw new apiException("client method parameter should be an array (\$client->plus->activities->list(array('userId' => 'me'))"); + } + $batchKey = false; + if (isset($arguments[1])) { + if (! is_string($arguments[1])) { + throw new apiException("The batch key parameter should be a string (\$client->plus->activities->list( array('userId' => 'me'), 'batchKey'))"); + } + $batchKey = $arguments[1]; + } + if (! isset($this->methods[$name])) { + throw new apiException("Unknown function: {$this->serviceName}->{$this->resourceName}->{$name}()"); + } + $method = $this->methods[$name]; + $parameters = $arguments[0]; + // postBody is a special case since it's not defined in the discovery document as parameter, but we abuse the param entry for storing it + $postBody = null; + if (isset($parameters['postBody'])) { + if (is_object($parameters['postBody'])) { + $this->stripNull($parameters['postBody']); + } + + // Some APIs require the postBody to be set under the data key. + if (is_array($parameters['postBody']) && 'latitude' == $this->serviceName) { + if (!isset($parameters['postBody']['data'])) { + $rawBody = $parameters['postBody']; + unset($parameters['postBody']); + $parameters['postBody']['data'] = $rawBody; + } + } + + $postBody = is_array($parameters['postBody']) || is_object($parameters['postBody']) + ? json_encode($parameters['postBody']) + : $parameters['postBody']; + unset($parameters['postBody']); + + if (isset($parameters['optParams'])) { + $optParams = $parameters['optParams']; + unset($parameters['optParams']); + $parameters = array_merge($parameters, $optParams); + } + } + + if (!isset($method['parameters'])) { + $method['parameters'] = array(); + } + + $method['parameters'] = array_merge($method['parameters'], $this->stackParameters); + foreach ($parameters as $key => $val) { + if ($key != 'postBody' && ! isset($method['parameters'][$key])) { + throw new apiException("($name) unknown parameter: '$key'"); + } + } + if (isset($method['parameters'])) { + foreach ($method['parameters'] as $paramName => $paramSpec) { + if (isset($paramSpec['required']) && $paramSpec['required'] && ! isset($parameters[$paramName])) { + throw new apiException("($name) missing required param: '$paramName'"); + } + if (isset($parameters[$paramName])) { + $value = $parameters[$paramName]; + $parameters[$paramName] = $paramSpec; + $parameters[$paramName]['value'] = $value; + unset($parameters[$paramName]['required']); + } else { + unset($parameters[$paramName]); + } + } + } + + // Discovery v1.0 puts the canonical method id under the 'id' field. + if (! isset($method['id'])) { + $method['id'] = $method['rpcMethod']; + } + + // Discovery v1.0 puts the canonical path under the 'path' field. + if (! isset($method['path'])) { + $method['path'] = $method['restPath']; + } + + $restBasePath = $this->service->restBasePath; + + // Process Media Request + $contentType = false; + if (isset($method['mediaUpload'])) { + $media = apiMediaFileUpload::process($postBody, $method, $parameters); + if (isset($media['content-type'])) { + $contentType = $media['content-type']; + } + + if (isset($media['data'])) { + $postBody = $media['data']; + } + + if (isset($media['file'])) { + $postBody = array('file' => $media['file']); + } + + if (isset($media['restBasePath'])) { + $restBasePath = $media['restBasePath']; + $method['path'] = ''; + } + } + + $request = new apiServiceRequest( + $restBasePath, + $this->service->rpcPath, + $method['path'], + $method['id'], + $method['httpMethod'], + $parameters, $postBody + ); + + $request->setContentType($contentType); + if ($batchKey) { + $request->setBatchKey($batchKey); + return $request; + } else { + return apiREST::execute($request); + } + } + + protected function useObjects() { + global $apiConfig; + return (isset($apiConfig['use_objects']) && $apiConfig['use_objects']); + } + + protected function stripNull(&$o) { + $o = (array) $o; + foreach ($o as $k => $v) { + if ($v === null || strstr($k, "\0*\0__")) { + unset($o[$k]); + } + elseif (is_object($v) || is_array($v)) { + $this->stripNull($o[$k]); + } + } + } +} diff --git a/webui/google-api/service/apiUtils.php b/webui/google-api/service/apiUtils.php new file mode 100644 index 0000000..c692ec4 --- /dev/null +++ b/webui/google-api/service/apiUtils.php @@ -0,0 +1,117 @@ + + */ +class apiUtils { + public static function urlSafeB64Encode($data) { + $b64 = base64_encode($data); + $b64 = str_replace(array('+', '/', '\r', '\n', '='), + array('-', '_'), + $b64); + return $b64; + } + + public static function urlSafeB64Decode($b64) { + $b64 = str_replace(array('-', '_'), + array('+', '/'), + $b64); + return base64_decode($b64); + } + + /** + * Misc function used to count the number of bytes in a post body, in the world of multi-byte chars + * and the unpredictability of strlen/mb_strlen/sizeof, this is the only way to do that in a sane + * manner at the moment. + * + * This algorithm was originally developed for the + * Solar Framework by Paul M. Jones + * + * @link http://solarphp.com/ + * @link http://svn.solarphp.com/core/trunk/Solar/Json.php + * @link http://framework.zend.com/svn/framework/standard/trunk/library/Zend/Json/Decoder.php + * @param string $str + * @return int The number of bytes in a string. + */ + static public function getStrLen($str) { + $strlenVar = strlen($str); + $d = $ret = 0; + for ($count = 0; $count < $strlenVar; ++ $count) { + $ordinalValue = ord($str{$ret}); + switch (true) { + case (($ordinalValue >= 0x20) && ($ordinalValue <= 0x7F)): + // characters U-00000000 - U-0000007F (same as ASCII) + $ret ++; + break; + + case (($ordinalValue & 0xE0) == 0xC0): + // characters U-00000080 - U-000007FF, mask 110XXXXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $ret += 2; + break; + + case (($ordinalValue & 0xF0) == 0xE0): + // characters U-00000800 - U-0000FFFF, mask 1110XXXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $ret += 3; + break; + + case (($ordinalValue & 0xF8) == 0xF0): + // characters U-00010000 - U-001FFFFF, mask 11110XXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $ret += 4; + break; + + case (($ordinalValue & 0xFC) == 0xF8): + // characters U-00200000 - U-03FFFFFF, mask 111110XX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $ret += 5; + break; + + case (($ordinalValue & 0xFE) == 0xFC): + // characters U-04000000 - U-7FFFFFFF, mask 1111110X + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $ret += 6; + break; + default: + $ret ++; + } + } + return $ret; + } + + /** + * Normalize all keys in an array to lower-case. + * @param array $arr + * @return array Normalized array. + */ + public static function normalize($arr) { + if (!is_array($arr)) { + return array(); + } + + $normalized = array(); + foreach ($arr as $key => $val) { + $normalized[strtolower($key)] = $val; + } + return $normalized; + } +} \ No newline at end of file diff --git a/webui/index.php b/webui/index.php index a53411c..68ac1ba 100644 --- a/webui/index.php +++ b/webui/index.php @@ -79,7 +79,11 @@ } } else { - $action = new Router('login/login'); + if(ENABLE_GOOGLE_LOGIN == 1 && isset($request->get['route']) && $request->get['route'] == 'login/google') { + $action = new Router('login/google'); + } else { + $action = new Router('login/login'); + } } diff --git a/webui/language/en/messages.php b/webui/language/en/messages.php index 2afdbdc..0d0d75f 100644 --- a/webui/language/en/messages.php +++ b/webui/language/en/messages.php @@ -163,6 +163,7 @@ $_['text_login'] = "Login"; $_['text_login2'] = "login"; $_['text_login_failed'] = "login failed"; +$_['text_login_via_google'] = "Login via Google account"; $_['text_logout'] = "Logout"; $_['text_logout2'] = "logout"; diff --git a/webui/language/hu/messages.iso-8859-2.php b/webui/language/hu/messages.iso-8859-2.php index 86ef68f..3bbe101 100644 --- a/webui/language/hu/messages.iso-8859-2.php +++ b/webui/language/hu/messages.iso-8859-2.php @@ -164,6 +164,7 @@ $_['text_login'] = "Bejelentkez�s"; $_['text_login2'] = "bejelentkez�s"; $_['text_login_failed'] = "sikertelen bejelentkez�s"; +$_['text_login_via_google'] = "Bejelentkez�s Google fi�kkal"; $_['text_logout'] = "Kijelentkez�s"; $_['text_logout2'] = "kijelentkez�s"; diff --git a/webui/language/hu/messages.php b/webui/language/hu/messages.php index 1264306..c2030f6 100644 --- a/webui/language/hu/messages.php +++ b/webui/language/hu/messages.php @@ -164,6 +164,7 @@ $_['text_login'] = "Bejelentkezés"; $_['text_login2'] = "bejelentkezés"; $_['text_login_failed'] = "sikertelen bejelentkezés"; +$_['text_login_via_google'] = "Bejelentkezés Google fiókkal"; $_['text_logout'] = "Kijelentkezés"; $_['text_logout2'] = "kijelentkezés"; diff --git a/webui/model/google/google.php b/webui/model/google/google.php new file mode 100644 index 0000000..e65b2a1 --- /dev/null +++ b/webui/model/google/google.php @@ -0,0 +1,133 @@ +constructAuthString($email, $accessToken)); + + $imap->sendRequest('AUTHENTICATE', $authenticateParams); + while (true) { + $response = ""; + $is_plus = $imap->readLine($response, '+', true); + if($is_plus) { + error_log("got an extra server challenge: $response"); + // Send empty client response. + $imap->sendRequest(''); + } else { + if(preg_match('/^NO /i', $response) || + preg_match('/^BAD /i', $response)) { + error_log("got failure response: $response"); + return false; + } else if (preg_match("/^OK /i", $response)) { + return true; + } else { + // Some untagged response, such as CAPABILITY + } + } + } + } + + + public function try_imap_login($email, $accessToken) { + $imap = new Zend_Mail_Protocol_Imap('imap.gmail.com', '993', true); + + if($this->oauth2Authenticate($imap, $email, $accessToken)) { + return $imap; + } else { + return ''; + } + } + + + + public function download_users_emails($email, $accessToken) { + $last_msg_id = -1; + $from = 1; + + if(!$email || !$accessToken) { return 0; } + + $imap = $this->try_imap_login($email, $accessToken); + + if($imap) { + + $storage = new Zend_Mail_Storage_Imap($imap); + $storage->selectFolder('[Gmail]/All Mail'); + + $from = $this->get_last_message_id_by_unique_id($email, $storage) + 1; + + //print "will download messages from: $from\n"; + + + $num = $storage->countMessages(); + + $to = $from; + + while($from <= $num) { + if($num - $from > 9) { $delta = 9; } + else { $delta = $num-$from; } + + $to = $from + $delta; + + //print "downloading $from, $to\n"; + + $unique_msg_id = $storage->getUniqueId($to); + + $messages = $storage->piler_batch_fetch($from, $to); + + while(list($k, $v) = each($messages)) { + $uuid = $storage->getUniqueId($k); + + $tmpname = DIR_TMP . "piler-" . $email . "-" . $k . "-" . $uuid . ".eml"; + $f = fopen($tmpname, "w+"); + if($f){ + fwrite($f, $v['RFC822.HEADER'] . $v['RFC822.TEXT']); + fclose($f); + } + //print "k: $k\n"; + } + + $this->update_imap_table($email, $unique_msg_id, $to); + + $from += $delta + 1; + } + + + + } + + } + + + private function get_last_message_id_by_unique_id($email = '', $storage) { + if($email == '') { return 0; } + + $query = $this->db->query("SELECT last_msg_id FROM " . TABLE_GOOGLE_IMAP . " WHERE email=? ORDER BY last_msg_id DESC", array($email)); + if(isset($query->rows)) { + foreach ($query->rows as $q) { + try { + $num = $storage->getNumberByUniqueId($q['last_msg_id']); + return $num; + } + catch(Exception $exception) {} + } + } + + return 0; + } + + + private function update_imap_table($email, $unique_msg_id, $id) { + $query = $this->db->query("INSERT INTO " . TABLE_GOOGLE_IMAP . " (id, email, last_msg_id) VALUES(?,?,?)", array($id, $email, $unique_msg_id)); + + return $this->db->countAffected(); + } + + +} + +?> diff --git a/webui/model/user/google.php b/webui/model/user/google.php new file mode 100644 index 0000000..763f4ff --- /dev/null +++ b/webui/model/user/google.php @@ -0,0 +1,85 @@ +db->query("SELECT " . TABLE_USER . ".username, " . TABLE_USER . ".uid, " . TABLE_USER . ".realname, " . TABLE_USER . ".dn, " . TABLE_USER . ".password, " . TABLE_USER . ".isadmin, " . TABLE_USER . ".domain FROM " . TABLE_USER . ", " . TABLE_EMAIL . " WHERE " . TABLE_EMAIL . ".email=? AND " . TABLE_EMAIL . ".uid=" . TABLE_USER . ".uid", array($google_account['email'])); + + if($query->num_rows == 1) { + $user = $query->row; + } + else { +/* + [id] => 117316069531814989987 + [email] => forum@hfp.hu + [verified_email] => 1 + [name] => Forum Admin + [given_name] => Forum + [family_name] => Admin +*/ + + $d = explode('@', $google_account['email']); + + $user['uid'] = $this->model_user_user->get_next_uid(); + + $user['username'] = $google_account['email']; + $user['realname'] = $google_account['name']; + $user['email'] = $google_account['email']; + $user['domain'] = $d[1]; + $user['dn'] = '*'; + $user['isadmin'] = 0; + $user['password'] = generate_random_string(12); + $user['group'] = ''; + $user['folder'] = ''; + + + $this->model_user_user->add_user($user); + + } + + $_SESSION['username'] = $user['username']; + $_SESSION['uid'] = $user['uid']; + $_SESSION['admin_user'] = 0; + $_SESSION['email'] = $user['username']; + $_SESSION['domain'] = $query->row['domain']; + $_SESSION['realname'] = $query->row['realname']; + + $_SESSION['emails'] = $this->model_user_user->get_users_all_email_addresses($user['uid']); + $_SESSION['folders'] = $this->model_folder_folder->get_all_folder_ids($user['uid']); + $_SESSION['extra_folders'] = $this->model_folder_folder->get_all_extra_folder_ids($user['uid']); + + AUDIT(ACTION_LOGIN, $user['username'], '', '', 'successful auth against Google'); + + } + + + public function update_tokens($email = '', $id = 0, $token = array()) { + if($email == '') { return 0; } + + $query = $this->db->query("SELECT email FROM " . TABLE_GOOGLE . " WHERE email=?", array($email)); + + if($query->num_rows > 0) { + $query = $this->db->query("UPDATE " . TABLE_GOOGLE . " SET id=?, access_token=?, refresh_token=?, created=? WHERE email=?", array($id, $token->{'access_token'}, $token->{'refresh_token'}, $token->{'created'}, $email)); + } + else { + $query = $this->db->query("INSERT INTO " . TABLE_GOOGLE . " (id, email, access_token, refresh_token, created) VALUES(?,?,?,?,?)", array($id, $email, $token->{'access_token'}, $token->{'refresh_token'}, $token->{'created'})); + } + + return $this->db->countAffected(); + +/* + [access_token] => ya29.AHES6ZSavh4CnWXyfAYRNwqqZ3FmZ-bHPZkWIEPlutG6K_E + [token_type] => Bearer + [expires_in] => 3600 + [refresh_token] => 1/J7bwdfCfQkjCu3Q51ypdJeGOzOtw6F1uyg1vaAwOZ2Q + [created] => 1348415267 +*/ + + + } + + +} + +?> diff --git a/webui/system/startup.php b/webui/system/startup.php index f100e61..d06a6fb 100644 --- a/webui/system/startup.php +++ b/webui/system/startup.php @@ -15,6 +15,11 @@ require(DIR_SYSTEM . "/db.php"); require_once(DIR_SYSTEM . "/database/ldap.php"); +if(ENABLE_GOOGLE_LOGIN == 1) { + require_once 'google-api/apiClient.php'; + require_once 'google-api/contrib/apiOauth2Service.php'; +} + date_default_timezone_set(TIMEZONE); ?> diff --git a/webui/view/theme/default/templates/login/login.tpl b/webui/view/theme/default/templates/login/login.tpl index 45bb99d..d0326ba 100644 --- a/webui/view/theme/default/templates/login/login.tpl +++ b/webui/view/theme/default/templates/login/login.tpl @@ -8,6 +8,11 @@
+ +
+
+
+
:
@@ -22,7 +27,7 @@
 
- +