[
  {
    "path": ".gitignore",
    "content": ".idea\n.swp\n/vendor/\n/composer.phar\n/composer.lock\n.DS_Store\nphpunit.xml"
  },
  {
    "path": ".travis.yml",
    "content": "language: php\n\nphp:\n    - 5.3\n\nbefore_script:\n    - composer self-update\n    - composer install --dev --prefer-dist --no-interaction\n\nscript: phpunit --coverage-text -c phpunit.xml.dist\n"
  },
  {
    "path": "APACHE-LICENSE-2.0.txt",
    "content": "\n                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [yyyy] [name of copyright owner]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "LICENSE",
    "content": "/*\n * Copyright (c) 2007-2015 by Evernote Corporation, All rights reserved.\n *\n * Use of the source code and binary libraries included in this package\n * is permitted under the following terms:\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.    \n */\n"
  },
  {
    "path": "NOTICE",
    "content": "Apache Thrift\nCopyright 2006-2015 The Apache Software Foundation.\n\nThis product includes software developed at\nThe Apache Software Foundation (http://www.apache.org/)."
  },
  {
    "path": "README.md",
    "content": "Evernote Cloud SDK PHP v2.0.2\n=====================================\n\nA newly-redesigned, simple, workflow-oriented library built on the Evernote Cloud API. It's designed to drop into your web app easily and make most common Evernote integrations very simple to accomplish. (And even the more complex integrations easier than they used to be.)\n\nInstallation\n------------\n\nThe recommended way to install the SDK is through composer.\n\nJust run these two commands to install it:\n\n``` bash\n$ curl -sS https://getcomposer.org/installer | php\n$ php composer.phar require evernote/evernote-cloud-sdk-php\n```\n\nNow you can add the autoloader, and you will have access to the library:\n\n``` php\n<?php\n\nrequire 'vendor/autoload.php';\n```\n\nIf you don't use  **Composer** , just require the provided autoloader:\n\n``` php\n<?php\n\nrequire_once 'src/autoload.php';\n```\nGetting started with the SDK\n-------------------------------------\n[Getting started guide](documentation/Getting_Started.md)\n\nNote for users of the 1.x SDK for PHP\n-------------------------------------\nThis SDK is a complete revision of the previous Evernote SDK for PHP.\nSee the [Migration guide](documentation/Migration.md) for more information.\n\nFAQ\n---\n\n#### Where can I find out more about the Evernote API?\n\nPlease check out the [Evernote Developers Portal](https://dev.evernote.com).\n"
  },
  {
    "path": "composer.json",
    "content": "{\n    \"name\": \"evernote/evernote-cloud-sdk-php\",\n    \"description\": \"Evernote Cloud SDK for PHP\",\n    \"keywords\": [\n        \"evernote\",\n        \"api\",\n        \"sdk\"\n    ],\n    \"homepage\": \"https://github.com/evernote/evernote-cloud-sdk-php\",\n    \"version\": \"2.0.2\",\n    \"license\": \"Apache\",\n    \"authors\": [\n        {\n            \"name\": \"Laurent Sarrazin for Evernote\",\n            \"email\": \"laurent@sarrazin.io\",\n            \"homepage\": \"http://laurent.sarrazin.io\",\n            \"role\": \"Lead developer\"\n        }\n    ],\n    \"support\": {\n        \"issues\": \"https://github.com/evernote/evernote-cloud-sdk-php/issues\",\n        \"forum\": \"https://discussion.evernote.com/forum/61-evernote-for-developers/\"\n    },\n    \"require\": {\n        \"php\": \">=5.3\",\n        \"ezyang/htmlpurifier\": \"^4.6.0\",\n        \"tijsverkoyen/css-to-inline-styles\": \"~2.2\",\n        \"psr/log\": \"~1.0\"\n    },\n    \"autoload\": {\n        \"psr-0\": { \"Evernote\": \"src/\", \"Thrift\": \"src/\"},\n        \"classmap\": [\"src/EDAM\"]\n    }\n}\n"
  },
  {
    "path": "documentation/ApiIndex.md",
    "content": "API Index\n=========\n\n* Evernote\n    * [Client](Evernote-Client.md)\n\n"
  },
  {
    "path": "documentation/Evernote-Client.md",
    "content": "Evernote\\Client\n===============\n\n\n\n\n\n\n* Class name: Client\n* Namespace: Evernote\n\n\n\nConstants\n----------\n\n\n### PERSONAL_SCOPE\n\n    const PERSONAL_SCOPE = 1\n\n\n\n\n\n### LINKED_SCOPE\n\n    const LINKED_SCOPE = 2\n\n\n\n\n\n### SEARCH_SCOPE_NONE\n\n    const SEARCH_SCOPE_NONE = 0\n\n\n\n\n\n### SEARCH_SCOPE_PERSONAL\n\n    const SEARCH_SCOPE_PERSONAL = 1\n\n\n\n\n\n### SEARCH_SCOPE_PERSONAL_LINKED\n\n    const SEARCH_SCOPE_PERSONAL_LINKED = 2\n\n\n\n\n\n### SEARCH_SCOPE_BUSINESS\n\n    const SEARCH_SCOPE_BUSINESS = 4\n\n\n\n\n\n### SEARCH_SCOPE_APP_NOTEBOOK\n\n    const SEARCH_SCOPE_APP_NOTEBOOK = 8\n\n\n\n\n\n### SEARCH_SCOPE_DEFAULT\n\n    const SEARCH_SCOPE_DEFAULT = 1\n\n\n\n\n\n### SEARCH_SCOPE_ALL\n\n    const SEARCH_SCOPE_ALL = 7\n\n\n\n\n\n### SORT_ORDER_TITLE\n\n    const SORT_ORDER_TITLE = 1\n\n\n\n\n\n### SORT_ORDER_RECENTLY_CREATED\n\n    const SORT_ORDER_RECENTLY_CREATED = 2\n\n\n\n\n\n### SORT_ORDER_RECENTLY_UPDATED\n\n    const SORT_ORDER_RECENTLY_UPDATED = 4\n\n\n\n\n\n### SORT_ORDER_RELEVANCE\n\n    const SORT_ORDER_RELEVANCE = 8\n\n\n\n\n\n### SORT_ORDER_NORMAL\n\n    const SORT_ORDER_NORMAL = 0\n\n\n\n\n\n### SORT_ORDER_REVERSE\n\n    const SORT_ORDER_REVERSE = 65536\n\n\n\n\n\n### BUSINESS_NOTE\n\n    const BUSINESS_NOTE = 0\n\n\n\n\n\n### PERSONAL_NOTE\n\n    const PERSONAL_NOTE = 1\n\n\n\n\n\n### SHARED_NOTE\n\n    const SHARED_NOTE = 2\n\n\n\n\n\nProperties\n----------\n\n\n### $advancedClient\n\n    protected \\Evernote\\AdvancedClient $advancedClient\n\n\n\n\n\n* Visibility: **protected**\n\n\n### $token\n\n    protected string $token\n\n\n\n\n\n* Visibility: **protected**\n\n\n### $sandbox\n\n    protected boolean $sandbox\n\n\n\n\n\n* Visibility: **protected**\n\n\n\n### $china\n\n    protected boolean $china\n\n\n\n\n\n* Visibility: **protected**\n\n\n\n### $userNoteStore\n\n    protected \\EDAM\\NoteStore\\NoteStoreClient $userNoteStore\n\n\n\n\n\n* Visibility: **protected**\n\n\n### $businessNoteStore\n\n    protected \\EDAM\\NoteStore\\NoteStoreClient $businessNoteStore\n\n\n\n\n\n* Visibility: **protected**\n\n\n### $businessToken\n\n    protected string $businessToken\n\n\n\n\n\n* Visibility: **protected**\n\n\n### $user\n\n    protected \\EDAM\\Types\\User $user\n\n\n\n\n\n* Visibility: **protected**\n\n\n### $businessAuth\n\n    protected \\EDAM\\UserStore\\AuthenticationResult $businessAuth\n\n\n\n\n\n* Visibility: **protected**\n\n\nMethods\n-------\n\n\n### __construct\n\n    mixed Evernote\\Client::__construct(string|null $token, boolean $sandbox, \\Evernote\\AdvancedClient|null $advancedClient, \\Psr\\Log\\LoggerInterface|null $logger, boolean $china)\n\n\n\n\n\n* Visibility: **public**\n\n\n#### Arguments\n* $token **string|null**\n* $sandbox **boolean**\n* $advancedClient **Evernote\\AdvancedClient|null**\n* $logger **Psr\\Log\\LoggerInterface|null**\n* $china **boolean**\n\n\n\n### getUser\n\n    \\EDAM\\Types\\User Evernote\\Client::getUser()\n\nReturns the User corresponding to the provided authentication token\n\n\n\n* Visibility: **public**\n\n\n\n\n### isBusinessUser\n\n    boolean Evernote\\Client::isBusinessUser()\n\nReturns a boolean indicating if the user has a business account\n\n\n\n* Visibility: **public**\n\n\n\n\n### getBusinessToken\n\n    string Evernote\\Client::getBusinessToken()\n\nReturns the token used to access the business notestore\n\n\n\n* Visibility: **public**\n\n\n\n\n### getBusinessNoteStore\n\n    \\EDAM\\NoteStore\\NoteStoreClient|mixed Evernote\\Client::getBusinessNoteStore()\n\nReturns the business notestore\n\n\n\n* Visibility: **public**\n\n\n\n\n### getBusinessSharedNotebooks\n\n    null Evernote\\Client::getBusinessSharedNotebooks()\n\nReturns the list of notebooks shared by the user with her business account\n\n\n\n* Visibility: **public**\n\n\n\n\n### getBusinessLinkedNotebooks\n\n    array Evernote\\Client::getBusinessLinkedNotebooks()\n\nReturns the list of notebooks shared to the user through the business account\n\n\n\n* Visibility: **public**\n\n\n\n\n### listNotebooks\n\n    array Evernote\\Client::listNotebooks()\n\nReturns the list of notebooks\n\n\n\n* Visibility: **public**\n\n\n\n\n### listPersonalNotebooks\n\n    array Evernote\\Client::listPersonalNotebooks()\n\nReturns the list of personal notebooks\n\n\n\n* Visibility: **public**\n\n\n\n\n### listSharedNotebooks\n\n    array Evernote\\Client::listSharedNotebooks()\n\nReturns the list of notebooks shared by the user\n\n\n\n* Visibility: **public**\n\n\n\n\n### listLinkedNotebooks\n\n    array Evernote\\Client::listLinkedNotebooks()\n\nReturns the list of notebooks shared to the user\n\n\n\n* Visibility: **public**\n\n\n\n\n### getUserNotestore\n\n    \\EDAM\\NoteStore\\NoteStoreClient|mixed Evernote\\Client::getUserNotestore()\n\nReturns the personal notestore of the user\n\n\n\n* Visibility: **public**\n\n\n\n\n### replaceNote\n\n    \\Evernote\\Model\\Note Evernote\\Client::replaceNote(\\Evernote\\Model\\Note $noteToReplace, \\Evernote\\Model\\Note $note)\n\nReplaces an existing note by another one (new or existing)\n\n\n\n* Visibility: **public**\n\n\n#### Arguments\n* $noteToReplace **Evernote\\Model\\Note**\n* $note **Evernote\\Model\\Note**\n\n\n\n### uploadNote\n\n    \\Evernote\\Model\\Note Evernote\\Client::uploadNote(\\Evernote\\Model\\Note $note, \\Evernote\\Model\\Notebook $notebook)\n\nSends a new Note to the API\n\n\n\n* Visibility: **public**\n\n\n#### Arguments\n* $note **Evernote\\Model\\Note**\n* $notebook **Evernote\\Model\\Notebook**\n\n\n\n### deleteNote\n\n    boolean Evernote\\Client::deleteNote(\\Evernote\\Model\\Note $note)\n\nDeletes a note\n\n\n\n* Visibility: **public**\n\n\n#### Arguments\n* $note **Evernote\\Model\\Note**\n\n\n\n### shareNote\n\n    null|string Evernote\\Client::shareNote(\\Evernote\\Model\\Note $note)\n\nShares a note and returns the share url\n\n\n\n* Visibility: **public**\n\n\n#### Arguments\n* $note **Evernote\\Model\\Note**\n\n\n\n### moveNote\n\n    \\Evernote\\Model\\Note Evernote\\Client::moveNote(\\Evernote\\Model\\Note $note, \\Evernote\\Model\\Notebook $notebook)\n\nMoves a note to another notebook\n\n\n\n* Visibility: **public**\n\n\n#### Arguments\n* $note **Evernote\\Model\\Note**\n* $notebook **Evernote\\Model\\Notebook**\n\n\n\n### getNote\n\n    \\Evernote\\Model\\Note|null Evernote\\Client::getNote($guid, null $scope)\n\nRetrieves an existing note\n\n\n\n* Visibility: **public**\n\n\n#### Arguments\n* $guid **mixed**\n* $scope **null**\n\n\n\n### isAppNotebookToken\n\n    boolean Evernote\\Client::isAppNotebookToken($token)\n\nChecks if the token is an \"app notebook\" one\n\n\n\n* Visibility: **public**\n\n\n#### Arguments\n* $token **mixed**\n\n\n\n### getNotebook\n\n    \\Evernote\\Model\\Notebook|null Evernote\\Client::getNotebook($notebook_guid, null $scope)\n\nRetrieves a notebook\n\n\n\n* Visibility: **public**\n\n\n#### Arguments\n* $notebook_guid **mixed**\n* $scope **null**\n\n\n\n### findNotesWithSearch\n\n    array|boolean Evernote\\Client::findNotesWithSearch($noteSearch, \\Evernote\\Model\\Notebook $notebook, integer $scope, integer $sortOrder, integer $maxResults)\n\nSearches for notes\n\n\n\n* Visibility: **public**\n\n\n#### Arguments\n* $noteSearch **mixed**\n* $notebook **Evernote\\Model\\Notebook**\n* $scope **integer**\n* $sortOrder **integer**\n* $maxResults **integer**\n\n\n\n### setAdvancedClient\n\n    mixed Evernote\\Client::setAdvancedClient(\\Evernote\\AdvancedClient $advancedClient)\n\nSets the advancedClient\n\n\n\n* Visibility: **public**\n\n\n#### Arguments\n* $advancedClient **Evernote\\AdvancedClient**\n\n\n\n### getAdvancedClient\n\n    \\Evernote\\AdvancedClient Evernote\\Client::getAdvancedClient()\n\nReturns the advancedClient\n\n\n\n* Visibility: **public**\n\n\n\n\n### setSandbox\n\n    mixed Evernote\\Client::setSandbox(boolean $sandbox)\n\nSets the sandbox flag to true or false\n\n\n\n* Visibility: **public**\n\n\n#### Arguments\n* $sandbox **boolean**\n\n\n\n### getSandbox\n\n    boolean Evernote\\Client::getSandbox()\n\nGets the current sandbox flag\n\n\n\n* Visibility: **public**\n\n\n\n\n### setChina\n\n    mixed Evernote\\Client::setChina(boolean $china)\n\nSets the china flag to true or false\n\n\n\n* Visibility: **public**\n\n\n#### Arguments\n* $china **boolean**\n\n\n\n### getChina\n\n    boolean Evernote\\Client::getChina()\n\nGets the current china flag\n\n\n\n* Visibility: **public**\n\n\n\n\n\n### setToken\n\n    mixed Evernote\\Client::setToken(string $token)\n\nSets the authentication token\n\n\n\n* Visibility: **public**\n\n\n#### Arguments\n* $token **string**\n\n\n\n### getToken\n\n    string Evernote\\Client::getToken()\n\nReturns the current authentication token\n\n\n\n* Visibility: **public**\n\n\n\n\n### getNoteStore\n\n    mixed Evernote\\Client::getNoteStore($noteStoreUrl)\n\n\n\n\n\n* Visibility: **protected**\n\n\n#### Arguments\n* $noteStoreUrl **mixed**\n\n\n\n### getShareUrl\n\n    mixed Evernote\\Client::getShareUrl($guid, $shardId, $shareKey, $serviceHost)\n\n\n\n\n\n* Visibility: **protected**\n\n\n#### Arguments\n* $guid **mixed**\n* $shardId **mixed**\n* $shareKey **mixed**\n* $serviceHost **mixed**\n\n\n\n### getSharedNotebookAuthResult\n\n    mixed Evernote\\Client::getSharedNotebookAuthResult(\\EDAM\\Types\\LinkedNotebook $linkedNotebook)\n\n\n\n\n\n* Visibility: **protected**\n\n\n#### Arguments\n* $linkedNotebook **EDAM\\Types\\LinkedNotebook**\n\n\n\n### getNoteBookByLinkedNotebook\n\n    mixed Evernote\\Client::getNoteBookByLinkedNotebook(\\EDAM\\Types\\LinkedNotebook $linkedNotebook)\n\n\n\n\n\n* Visibility: **protected**\n\n\n#### Arguments\n* $linkedNotebook **EDAM\\Types\\LinkedNotebook**\n\n\n\n### getBusinessAuth\n\n    \\EDAM\\UserStore\\AuthenticationResult Evernote\\Client::getBusinessAuth()\n\n\n\n\n\n* Visibility: **protected**\n\n\n\n\n### getNoteInstance\n\n    mixed Evernote\\Client::getNoteInstance(\\EDAM\\Types\\Note $edamNote, $noteStore, $token)\n\n\n\n\n\n* Visibility: **protected**\n\n\n#### Arguments\n* $edamNote **EDAM\\Types\\Note**\n* $noteStore **mixed**\n* $token **mixed**\n\n\n\n### getShardIdFromToken\n\n    mixed Evernote\\Client::getShardIdFromToken($token)\n\n\n\n\n\n* Visibility: **protected**\n\n\n#### Arguments\n* $token **mixed**\n\n\n\n### isFlagSet\n\n    mixed Evernote\\Client::isFlagSet($flags, $flag)\n\n\n\n\n\n* Visibility: **protected**\n\n\n#### Arguments\n* $flags **mixed**\n* $flag **mixed**\n\n\n\n### findNotes_listNotebooksWithContext\n\n    mixed Evernote\\Client::findNotes_listNotebooksWithContext($context)\n\n\n\n\n\n* Visibility: **protected**\n\n\n#### Arguments\n* $context **mixed**\n\n\n\n### findNotes_findInPersonalScopeWithContext\n\n    mixed Evernote\\Client::findNotes_findInPersonalScopeWithContext($context)\n\n\n\n\n\n* Visibility: **protected**\n\n\n#### Arguments\n* $context **mixed**\n\n\n\n### findNotes_findInBusinessScopeWithContext\n\n    mixed Evernote\\Client::findNotes_findInBusinessScopeWithContext($context)\n\n\n\n\n\n* Visibility: **protected**\n\n\n#### Arguments\n* $context **mixed**\n\n\n\n### findNotes_findInLinkedScopeWithContext\n\n    mixed Evernote\\Client::findNotes_findInLinkedScopeWithContext($context)\n\n\n\n\n\n* Visibility: **protected**\n\n\n#### Arguments\n* $context **mixed**\n\n\n\n### findNotes_nextFindInLinkedScopeWithContext\n\n    mixed Evernote\\Client::findNotes_nextFindInLinkedScopeWithContext($context)\n\n\n\n\n\n* Visibility: **protected**\n\n\n#### Arguments\n* $context **mixed**\n\n\n\n### compareByTitle\n\n    mixed Evernote\\Client::compareByTitle($obj1, $obj2)\n\n\n\n\n\n* Visibility: **protected**\n\n\n#### Arguments\n* $obj1 **mixed**\n* $obj2 **mixed**\n\n\n\n### compareByCreated\n\n    mixed Evernote\\Client::compareByCreated($obj1, $obj2)\n\n\n\n\n\n* Visibility: **protected**\n\n\n#### Arguments\n* $obj1 **mixed**\n* $obj2 **mixed**\n\n\n\n### compareByUpdated\n\n    mixed Evernote\\Client::compareByUpdated($obj1, $obj2)\n\n\n\n\n\n* Visibility: **protected**\n\n\n#### Arguments\n* $obj1 **mixed**\n* $obj2 **mixed**\n\n\n\n### findNotes_processResultsWithContext\n\n    mixed Evernote\\Client::findNotes_processResultsWithContext($context)\n\n\n\n\n\n* Visibility: **protected**\n\n\n#### Arguments\n* $context **mixed**\n\n\n"
  },
  {
    "path": "documentation/Getting_Started.md",
    "content": "Installation\n------------\n\nThe recommended way to install the SDK is through composer.\n\nJust run these two commands to install it:\n\n``` bash\n$ curl -sS https://getcomposer.org/installer | php\n$ php composer.phar require evernote/evernote-cloud-sdk-php dev-master\n```\n\nNow you can add the autoloader, and you will have access to the library:\n\n``` php\n<?php\n\nrequire 'vendor/autoload.php';\n```\n\nIf you don't use  **Composer** , just require the provided autoloader:\n\n``` php\n<?php\n\nrequire 'src/autoload.php';\n```\n\nGetting an OAuth token\n----------------------\n\nThe OAuth process does not require the php-oauth extension.\nThe only requirement is to have sessions enabled to keep data during the oauth process.\n\n``` php\n<?php\nrequire 'vendor/autoload.php';\n\n//set this to false to use in production\n$sandbox = true;\n\n$oauth_handler = new \\Evernote\\Auth\\OauthHandler($sandbox);\n\n$key      = '%key%';\n$secret   = '%secret%';\n$callback = 'http://host/pathto/evernote-cloud-sdk-php/sample/oauth/index.php';\n\n$oauth_data  = $oauth_handler->authorize($key, $secret, $callback);\n\necho \"\\nOauth Token : \" . $oauth_data['oauth_token'];\n```\n\nYou can then instantiate the client and call the api with this token.\n\nGetting the \"simple\" client\n---------------------------\n\nThe \"simple\" client is a high-level wrapper on top of the \"advanced\" client (see below).\nIt provides helper methods that hide complex stuff such as dealing with business accounts, app notebooks, etc.\n\nAll API calls are made with the \\Evernote\\Client.\nInstantiate a new client object with a token and you're done.\nThe token can be an oauth token or a dev token.\n\n``` php\n<?php\n\nrequire_once 'vendor/autoload.php';\n\n$token = '%oauth_token%';\n\n$sandbox = true;\n\n$client = new \\Evernote\\Client($token, $sandbox);\n```\n\nGetting the \"advanced\" client\n-----------------------------\n\nThe advanced client gives you a low level access to the API. That means you can call the thrift methods directly.  See the [API Reference](https://dev.evernote.com/doc/reference/) for the list of methods available.\nYou can use this client for optimization reasons or to achieve more complex tasks than the ones handled by the simple client.\n\nThere are two ways to get the advanced client.\n\nFrom scratch :\n\n```php\n<?php\n\nrequire_once 'vendor/autoload.php';\n\n$token = '%oauth_token%';\n\n$sandbox = true;\n\n$advancedClient = new \\Evernote\\AdvancedClient($token, $sandbox);\n```\n\nor, if you already have an instance of the simple client :\n\n```php\n<?php\n\nrequire_once 'vendor/autoload.php';\n\n$token = '%oauth_token%';\n\n$sandbox = true;\n\n$client = new \\Evernote\\Client($token, $sandbox);\n\n$client->getNote('the-note-guid');\n\n$advancedClient = $client->getAdvancedClient();\n```\n\nOnce you have a instance of the advanced client you can, for example, call the getUser() method:\n\n``` php\n// First, get the right Store\n$userStore = $advancedClient->getUserStore();\n\n// Then do the call\n$user = $userStore->getUser();\n```\nYou may notice that we don't pass the token to the getUser() method.  It's the same with all the methods that require a token. Just omit it as it is already set on the client object.\n\nUsing the \"simple\" client\n-------------\n[Create a note](../sample/client/create_note.php)\n\n[Delete a note](../sample/client/delete_note.php)\n\n[Move a note](../sample/client/move_note.php)\n\n[Share a note](../sample/client/share_note.php)\n\n[Replace a note](../sample/client/replace_note.php)\n\n[Add resources to a note](../sample/client/add_resource.php)\n\n[Find notes](../sample/client/find_notes.php)\n\n[Manage reminders](../sample/client/reminders.php)\n\nGoing further\n-------------\n\nThe 'sample' folder contains a few code samples to help you get started with basic features."
  },
  {
    "path": "documentation/Migration.md",
    "content": "Migrating from Evernote SDK for PHP 1.x\n=======================================\n\nOauth\n-----\n\nThe OAuth process has been entirely rewritten in order to remove the dependency on the php-oauth extension.\n\nHowever you'll still need the curl extension and sessions enabled in order to make it work.\n\nBoth are installed and configured by default on most server hosts.\n\nThe code to get an oauth token is pretty straightforward :\n\n```php\n<?php\nrequire 'vendor/autoload.php';\n\n//set this to false to use in production\n$sandbox = true;\n\n$oauth_handler = new \\Evernote\\Auth\\OauthHandler($sandbox);\n\n$key      = '%key%';\n$secret   = '%secret%';\n$callback = 'http://host/pathto/evernote-cloud-sdk-php/sample/oauth/index.php';\n\n$oauth_data  = $oauth_handler->authorize($key, $secret, $callback);\n\n$oauth_token = $oauth_data['oauth_token'];\n```\n\nClient\n------\n\nThe \"advanced\" client is mostly the same as the client of the old SDK.\n\nThe only difference is the constructor which now takes 2 params : the token and a boolean that indicates the environment you want to work on.\n\n``` php\n<?php\n\nrequire_once 'vendor/autoload.php';\n\n$token = '%oauth_token%';\n\n$sandbox = true;\n\n$advancedClient = new \\Evernote\\AdvancedClient($token, $sandbox);\n```\n\nYou can now use the \"advanced\" client as the old client :\n\n``` php\n<?php\n\nrequire_once 'vendor/autoload.php';\n\n$token = '%oauth_token%';\n\n$sandbox = true;\n\n$advancedClient = new \\Evernote\\AdvancedClient($token, $sandbox);\n```"
  },
  {
    "path": "phpunit.xml.dist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<phpunit backupGlobals=\"false\"\n         backupStaticAttributes=\"false\"\n         colors=\"true\"\n         convertErrorsToExceptions=\"true\"\n         convertNoticesToExceptions=\"true\"\n         convertWarningsToExceptions=\"true\"\n         processIsolation=\"false\"\n         stopOnFailure=\"false\"\n         syntaxCheck=\"false\"\n         bootstrap=\"./tests/bootstrap.php\"\n        >\n    <php>\n        <!-- TOKENS -->\n        <server name=\"BUSINESS_USER_TOKEN\" value=\"\" />\n        <server name=\"BUSINESS_ADMIN_TOKEN\" value=\"\" />\n        <server name=\"REGULAR_USER_TOKEN\" value=\"\" />\n    </php>\n    <testsuites>\n        <testsuite name=\"Evernote Test Suite\">\n            <directory>./tests/</directory>\n        </testsuite>\n    </testsuites>\n    <filter>\n        <whitelist>\n            <directory>./src/Evernote/</directory>\n        </whitelist>\n    </filter>\n</phpunit>"
  },
  {
    "path": "sample/client/add_resource.php",
    "content": "<?php\nrequire __DIR__ . '/../../vendor/autoload.php';\n\n/**\n * Authorization Tokens are created by either:\n * [1] OAuth workflow: https://dev.evernote.com/doc/articles/authentication.php\n * or by creating a \n * [2] Developer Token: https://dev.evernote.com/doc/articles/authentication.php#devtoken\n */\n$token = '%YOUR_TOKEN%';\n\n/** Understanding SANDBOX vs PRODUCTION vs CHINA Environments\n *\n * The Evernote API 'Sandbox' environment -> SANDBOX.EVERNOTE.COM \n *    - Create a sample Evernote account at https://sandbox.evernote.com\n * \n * The Evernote API 'Production' Environment -> WWW.EVERNOTE.COM\n *    - Activate your Sandboxed API key for production access at https://dev.evernote.com/support/\n * \n * The Evernote API 'CHINA' Environment -> APP.YINXIANG.COM\n *    - Activate your Sandboxed API key for Evernote China service access at https://dev.evernote.com/support/ \n *      or https://dev.yinxiang.com/support/. For more information about Evernote China service, please refer \n *      to https://dev.evernote.com/doc/articles/bootstrap.php\n *\n * For testing, set $sandbox to true; for production, set $sandbox to false and $china to false; \n * for china service, set $sandbox to false and $china to true.\n * \n */\n$sandbox = true;\n$china   = false;\n\n$client = new \\Evernote\\Client($token, $sandbox, null, null, $china);\n\n// Create the resource\n$resource = new \\Evernote\\Model\\Resource('enlogo.png', 'image/png', 100, 100);\n\n// Get a preformatted enml media tag (something like '<en-media type=\"%mime%\" hash=\"%hash%\" />')\n$enml_media_tag = $resource->getEnmlMediaTag();\n\n// Create the note\n$note = new \\Evernote\\Model\\Note();\n$note->addResource($resource);\n$note->title  = 'Test note';\n$note->content = new \\Evernote\\Model\\EnmlNoteContent(\n    <<<ENML\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE en-note SYSTEM \"http://xml.evernote.com/pub/enml2.dtd\">\n<en-note>$enml_media_tag</en-note>\nENML\n);\n\n// Upload the note\n$client->uploadNote($note);"
  },
  {
    "path": "sample/client/create_note.php",
    "content": "<?php\nrequire __DIR__ . '/../../vendor/autoload.php';\n\n/**\n * Authorization Tokens are created by either:\n * [1] OAuth workflow: https://dev.evernote.com/doc/articles/authentication.php\n * or by creating a \n * [2] Developer Token: https://dev.evernote.com/doc/articles/authentication.php#devtoken\n */\n$token = '%YOUR_TOKEN%';\n\n/** Understanding SANDBOX vs PRODUCTION vs CHINA Environments\n *\n * The Evernote API 'Sandbox' environment -> SANDBOX.EVERNOTE.COM \n *    - Create a sample Evernote account at https://sandbox.evernote.com\n * \n * The Evernote API 'Production' Environment -> WWW.EVERNOTE.COM\n *    - Activate your Sandboxed API key for production access at https://dev.evernote.com/support/\n * \n * The Evernote API 'CHINA' Environment -> APP.YINXIANG.COM\n *    - Activate your Sandboxed API key for Evernote China service access at https://dev.evernote.com/support/ \n *      or https://dev.yinxiang.com/support/. For more information about Evernote China service, please refer \n *      to https://dev.evernote.com/doc/articles/bootstrap.php\n *\n * For testing, set $sandbox to true; for production, set $sandbox to false and $china to false; \n * for china service, set $sandbox to false and $china to true.\n * \n */\n$sandbox = true;\n$china   = false;\n\n$client = new \\Evernote\\Client($token, $sandbox, null, null, $china);\n\n$note         = new \\Evernote\\Model\\Note();\n$note->title  = 'Test note';\n$note->content = new \\Evernote\\Model\\PlainTextNoteContent('Some plain text content.');\n$note->tagNames = array('tag1', 'tag2');\n\n/**\n * The second parameter $notebook is optionnal.\n * If left blank or set as null, the note will be created in the default notebook\n * Or in the App Notebook if applicable.\n *\n * Otherwise, you need to pass a \\Evernote\\Model\\Notebook object\n * There are 2 options :\n *\n * If you already have a Notebook object (from the listNotebooks method for example)\n * just pass it as is to the method.\n *\n * If you only have a notebookGuid, instantiate an empty notebook and set the guid :\n *\n * $notebook = new \\Evernote\\Model\\Notebook();\n * $notebook->guid = $notebook_guid;\n *\n * The notebook will be automatically retrieved if necessary\n */\n\n$notebook = null;\n$client->uploadNote($note, $notebook);"
  },
  {
    "path": "sample/client/delete_note.php",
    "content": "<?php\nrequire __DIR__ . '/../../vendor/autoload.php';\n\n/**\n * Authorization Tokens are created by either:\n * [1] OAuth workflow: https://dev.evernote.com/doc/articles/authentication.php\n * or by creating a \n * [2] Developer Token: https://dev.evernote.com/doc/articles/authentication.php#devtoken\n */\n$token = '%YOUR_TOKEN%';\n\n/** Understanding SANDBOX vs PRODUCTION vs CHINA Environments\n *\n * The Evernote API 'Sandbox' environment -> SANDBOX.EVERNOTE.COM \n *    - Create a sample Evernote account at https://sandbox.evernote.com\n * \n * The Evernote API 'Production' Environment -> WWW.EVERNOTE.COM\n *    - Activate your Sandboxed API key for production access at https://dev.evernote.com/support/\n * \n * The Evernote API 'CHINA' Environment -> APP.YINXIANG.COM\n *    - Activate your Sandboxed API key for Evernote China service access at https://dev.evernote.com/support/ \n *      or https://dev.yinxiang.com/support/. For more information about Evernote China service, please refer \n *      to https://dev.evernote.com/doc/articles/bootstrap.php\n *\n * For testing, set $sandbox to true; for production, set $sandbox to false and $china to false; \n * for china service, set $sandbox to false and $china to true.\n * \n */\n$sandbox = true;\n$china   = false;\n\n$client = new \\Evernote\\Client($token, $sandbox, null, null, $china);\n\n/**\n * You need to pass a \\Evernote\\Model\\Note object\n * There are 2 options :\n *\n * If you already have a Note object (from the getNote method for example)\n * just pass it as is to the method.\n *\n * If you only have a note guid, instantiate an empty note and set the guid :\n *\n * $note = new \\Evernote\\Model\\Note();\n * $note->guid = 'GUID';\n *\n */\n\n$note = new \\Evernote\\Model\\Note();\n$note->guid = 'GUID';\n\n$client->deleteNote($note);\n"
  },
  {
    "path": "sample/client/find_notes.php",
    "content": "<?php\nrequire __DIR__ . '/../../vendor/autoload.php';\n\n/**\n * Authorization Tokens are created by either:\n * [1] OAuth workflow: https://dev.evernote.com/doc/articles/authentication.php\n * or by creating a \n * [2] Developer Token: https://dev.evernote.com/doc/articles/authentication.php#devtoken\n */\n$token = '%YOUR_TOKEN%';\n\n/** Understanding SANDBOX vs PRODUCTION vs CHINA Environments\n *\n * The Evernote API 'Sandbox' environment -> SANDBOX.EVERNOTE.COM \n *    - Create a sample Evernote account at https://sandbox.evernote.com\n * \n * The Evernote API 'Production' Environment -> WWW.EVERNOTE.COM\n *    - Activate your Sandboxed API key for production access at https://dev.evernote.com/support/\n * \n * The Evernote API 'CHINA' Environment -> APP.YINXIANG.COM\n *    - Activate your Sandboxed API key for Evernote China service access at https://dev.evernote.com/support/ \n *      or https://dev.yinxiang.com/support/. For more information about Evernote China service, please refer \n *      to https://dev.evernote.com/doc/articles/bootstrap.php\n *\n * For testing, set $sandbox to true; for production, set $sandbox to false and $china to false; \n * for china service, set $sandbox to false and $china to true.\n * \n */\n$sandbox = true;\n$china   = false;\n\n$client = new \\Evernote\\Client($token, $sandbox, null, null, $china);\n\n/**\n * The search string\n */\n$search = new \\Evernote\\Model\\Search('test');\n\n/**\n * The notebook to search in\n */\n$notebook = null;\n\n/**\n * The scope of the search\n */\n$scope = \\Evernote\\Client::SEARCH_SCOPE_BUSINESS;\n\n/**\n * The order of the sort\n */\n$order = \\Evernote\\Client::SORT_ORDER_REVERSE | \\Evernote\\Client::SORT_ORDER_RECENTLY_CREATED;\n\n/**\n * The number of results\n */\n$maxResult = 5;\n\n$results = $client->findNotesWithSearch($search, $notebook, $scope, $order, $maxResult);\n\nforeach ($results as $result) {\n    $noteGuid    = $result->guid;\n    $noteType    = $result->type;\n    $noteTitle   = $result->title;\n    $noteCreated = $result->created;\n    $noteUpdated = $result->updated;\n}"
  },
  {
    "path": "sample/client/list_notebooks.php",
    "content": "<?php\nrequire __DIR__ . '/../../vendor/autoload.php';\n\n/**\n * Authorization Tokens are created by either:\n * [1] OAuth workflow: https://dev.evernote.com/doc/articles/authentication.php\n * or by creating a \n * [2] Developer Token: https://dev.evernote.com/doc/articles/authentication.php#devtoken\n */\n$token = '%YOUR_TOKEN%';\n\n/** Understanding SANDBOX vs PRODUCTION vs CHINA Environments\n *\n * The Evernote API 'Sandbox' environment -> SANDBOX.EVERNOTE.COM \n *    - Create a sample Evernote account at https://sandbox.evernote.com\n * \n * The Evernote API 'Production' Environment -> WWW.EVERNOTE.COM\n *    - Activate your Sandboxed API key for production access at https://dev.evernote.com/support/\n * \n * The Evernote API 'CHINA' Environment -> APP.YINXIANG.COM\n *    - Activate your Sandboxed API key for Evernote China service access at https://dev.evernote.com/support/ \n *      or https://dev.yinxiang.com/support/. For more information about Evernote China service, please refer \n *      to https://dev.evernote.com/doc/articles/bootstrap.php\n *\n * For testing, set $sandbox to true; for production, set $sandbox to false and $china to false; \n * for china service, set $sandbox to false and $china to true.\n * \n */\n$sandbox = true;\n$china   = false;\n\n$client = new \\Evernote\\Client($token, $sandbox, null, null, $china);\n\n$notebooks = array();\n\n$notebooks = $client->listNotebooks();\n\nforeach ($notebooks as $notebook) {\n\n    echo \"\\n\\nName : \" . $notebook->name;\n\n    echo \"\\nGuid : \" . $notebook->guid;\n\n    echo \"\\nIs Business : \";\n    echo $notebook->isBusinessNotebook()?\"Y\":\"N\";\n\n    echo \"\\nIs Default  : \";\n    echo $notebook->isDefaultNotebook()?\"Y\":\"N\";\n\n    echo \"\\nIs Linked   : \";\n    echo $notebook->isLinkedNotebook()?\"Y\":\"N\";\n}"
  },
  {
    "path": "sample/client/move_note.php",
    "content": "<?php\nrequire __DIR__ . '/../../vendor/autoload.php';\n\n/**\n * Authorization Tokens are created by either:\n * [1] OAuth workflow: https://dev.evernote.com/doc/articles/authentication.php\n * or by creating a \n * [2] Developer Token: https://dev.evernote.com/doc/articles/authentication.php#devtoken\n */\n$token = '%YOUR_TOKEN%';\n\n/** Understanding SANDBOX vs PRODUCTION vs CHINA Environments\n *\n * The Evernote API 'Sandbox' environment -> SANDBOX.EVERNOTE.COM \n *    - Create a sample Evernote account at https://sandbox.evernote.com\n * \n * The Evernote API 'Production' Environment -> WWW.EVERNOTE.COM\n *    - Activate your Sandboxed API key for production access at https://dev.evernote.com/support/\n * \n * The Evernote API 'CHINA' Environment -> APP.YINXIANG.COM\n *    - Activate your Sandboxed API key for Evernote China service access at https://dev.evernote.com/support/ \n *      or https://dev.yinxiang.com/support/. For more information about Evernote China service, please refer \n *      to https://dev.evernote.com/doc/articles/bootstrap.php\n *\n * For testing, set $sandbox to true; for production, set $sandbox to false and $china to false; \n * for china service, set $sandbox to false and $china to true.\n * \n */\n$sandbox = true;\n$china   = false;\n\n$client = new \\Evernote\\Client($token, $sandbox, null, null, $china);\n\n$note         = new \\Evernote\\Model\\Note();\n$note->title  = 'Move a note';\n$note->content = new \\Evernote\\Model\\PlainTextNoteContent('Some plain text content.');\n\n$notebook = null;\n\n$uploaded_note = $client->uploadNote($note, $notebook);\n\necho \"\\nFirst guid : \" . $uploaded_note->guid;\n\n/**\n * The second parameter $notebook is - of course - mandatory.\n *\n * You need to pass a \\Evernote\\Model\\Notebook object\n * There are 2 options :\n *\n * If you already have a Notebook object (from the listNotebooks method for example)\n * just pass it as is to the method.\n *\n * If you only have a notebookGuid, instantiate an empty notebook and set the guid :\n *\n * $notebook = new \\Evernote\\Model\\Notebook();\n * $notebook->guid = $notebook_guid;\n *\n * The notebook will be automatically retrieved if necessary\n */\n$notebook       = new \\Evernote\\Model\\Notebook();\n$notebook->guid = '%notebook_guid%';\n\n\n/**\n * Be aware that calling this method can change the guid of the note\n * if you're moving the note from one notestore to another.\n * There is no way to update a note between different notestores, so the process\n * is to create a copy of the note is the destination notebook and delete the original note.\n * This will put the note in the trash.\n */\n$moved_note = $client->moveNote($uploaded_note, $notebook);\n\n/**\n * Get the guid of the moved note as it could have changed if the destination notebook is not in the same notestore\n */\necho \"\\nNew guid : \" . $new_guid = $moved_note->guid;"
  },
  {
    "path": "sample/client/reminders.php",
    "content": "<?php\nrequire __DIR__ . '/../../vendor/autoload.php';\n\n/**\n * Authorization Tokens are created by either:\n * [1] OAuth workflow: https://dev.evernote.com/doc/articles/authentication.php\n * or by creating a \n * [2] Developer Token: https://dev.evernote.com/doc/articles/authentication.php#devtoken\n */\n$token = '%YOUR_TOKEN%';\n\n/** Understanding SANDBOX vs PRODUCTION vs CHINA Environments\n *\n * The Evernote API 'Sandbox' environment -> SANDBOX.EVERNOTE.COM \n *    - Create a sample Evernote account at https://sandbox.evernote.com\n * \n * The Evernote API 'Production' Environment -> WWW.EVERNOTE.COM\n *    - Activate your Sandboxed API key for production access at https://dev.evernote.com/support/\n * \n * The Evernote API 'CHINA' Environment -> APP.YINXIANG.COM\n *    - Activate your Sandboxed API key for Evernote China service access at https://dev.evernote.com/support/ \n *      or https://dev.yinxiang.com/support/. For more information about Evernote China service, please refer \n *      to https://dev.evernote.com/doc/articles/bootstrap.php\n *\n * For testing, set $sandbox to true; for production, set $sandbox to false and $china to false; \n * for china service, set $sandbox to false and $china to true.\n * \n */\n$sandbox = true;\n$china   = false;\n\n$client = new \\Evernote\\Client($token, $sandbox, null, null, $china);\n\n$note         = new \\Evernote\\Model\\Note();\n$note->title  = 'Test note';\n$note->content = new \\Evernote\\Model\\PlainTextNoteContent('Some plain text content.');\n\n$uploaded_note = $client->uploadNote($note);\n\n$datetime = new \\DateTime('tomorrow');\n\n// Check if the note \"is\" a reminder\nvar_dump($uploaded_note->isReminder());\n\n// Set a reminder. The parameter is a timestamp in seconds.\n$uploaded_note->setReminder($datetime->getTimestamp());\n\n$client->uploadNote($uploaded_note);\n\nvar_dump($uploaded_note->isReminder());\nvar_dump($uploaded_note->getReminderTime());\n\n// Check if the reminder has been set as done.\nvar_dump($uploaded_note->isDone());\n\n$uploaded_note->setAsDone();\n\n$client->uploadNote($uploaded_note);\n\nvar_dump($uploaded_note->isReminder());\nvar_dump($uploaded_note->getReminderDoneTime());\nvar_dump($uploaded_note->isDone());\n\n// Clean the note of any reminder attributes\n$uploaded_note->clearReminder();\n\n$client->uploadNote($uploaded_note);\n\nvar_dump($uploaded_note->isReminder());\nvar_dump($uploaded_note->isDone());"
  },
  {
    "path": "sample/client/replace_note.php",
    "content": "<?php\nrequire __DIR__ . '/../../vendor/autoload.php';\n\n/**\n * Authorization Tokens are created by either:\n * [1] OAuth workflow: https://dev.evernote.com/doc/articles/authentication.php\n * or by creating a \n * [2] Developer Token: https://dev.evernote.com/doc/articles/authentication.php#devtoken\n */\n$token = '%YOUR_TOKEN%';\n\n/** Understanding SANDBOX vs PRODUCTION vs CHINA Environments\n *\n * The Evernote API 'Sandbox' environment -> SANDBOX.EVERNOTE.COM \n *    - Create a sample Evernote account at https://sandbox.evernote.com\n * \n * The Evernote API 'Production' Environment -> WWW.EVERNOTE.COM\n *    - Activate your Sandboxed API key for production access at https://dev.evernote.com/support/\n * \n * The Evernote API 'CHINA' Environment -> APP.YINXIANG.COM\n *    - Activate your Sandboxed API key for Evernote China service access at https://dev.evernote.com/support/ \n *      or https://dev.yinxiang.com/support/. For more information about Evernote China service, please refer \n *      to https://dev.evernote.com/doc/articles/bootstrap.php\n *\n * For testing, set $sandbox to true; for production, set $sandbox to false and $china to false; \n * for china service, set $sandbox to false and $china to true.\n * \n */\n$sandbox = true;\n$china   = false;\n\n$client = new \\Evernote\\Client($token, $sandbox, null, null, $china);\n\n$note         = new \\Evernote\\Model\\Note();\n$note->title  = 'Test note';\n$note->content = new \\Evernote\\Model\\PlainTextNoteContent('Some plain text content.');\n\n$uploaded_note = $client->uploadNote($note);\n\n$new_note         = new \\Evernote\\Model\\Note();\n$new_note->title  = 'New note';\n$new_note->content = new \\Evernote\\Model\\PlainTextNoteContent('Some new plain text content.');\n\n$client->replaceNote($uploaded_note, $new_note);\n\n"
  },
  {
    "path": "sample/client/share_note.php",
    "content": "<?php\nrequire __DIR__ . '/../../vendor/autoload.php';\n\n/**\n * Authorization Tokens are created by either:\n * [1] OAuth workflow: https://dev.evernote.com/doc/articles/authentication.php\n * or by creating a \n * [2] Developer Token: https://dev.evernote.com/doc/articles/authentication.php#devtoken\n */\n$token = '%YOUR_TOKEN%';\n\n/** Understanding SANDBOX vs PRODUCTION vs CHINA Environments\n *\n * The Evernote API 'Sandbox' environment -> SANDBOX.EVERNOTE.COM \n *    - Create a sample Evernote account at https://sandbox.evernote.com\n * \n * The Evernote API 'Production' Environment -> WWW.EVERNOTE.COM\n *    - Activate your Sandboxed API key for production access at https://dev.evernote.com/support/\n * \n * The Evernote API 'CHINA' Environment -> APP.YINXIANG.COM\n *    - Activate your Sandboxed API key for Evernote China service access at https://dev.evernote.com/support/ \n *      or https://dev.yinxiang.com/support/. For more information about Evernote China service, please refer \n *      to https://dev.evernote.com/doc/articles/bootstrap.php\n *\n * For testing, set $sandbox to true; for production, set $sandbox to false and $china to false; \n * for china service, set $sandbox to false and $china to true.\n * \n */\n$sandbox = true;\n$china   = false;\n\n$client = new \\Evernote\\Client($token, $sandbox, null, null, $china);\n\n$note          = new \\Evernote\\Model\\Note();\n$note->title   = 'Share a note';\n$note->content = new \\Evernote\\Model\\PlainTextNoteContent('Some plain text content.');\n\n$uploaded_note = $client->uploadNote($note);\n\necho \"\\nPublic link : \" . $client->shareNote($uploaded_note);"
  },
  {
    "path": "sample/oauth/index.php",
    "content": "<?php\nrequire __DIR__ . '/../../vendor/autoload.php';\n\n/** Understanding SANDBOX vs PRODUCTION vs CHINA Environments\n *\n * The Evernote API 'Sandbox' environment -> SANDBOX.EVERNOTE.COM \n *    - Create a sample Evernote account at https://sandbox.evernote.com\n * \n * The Evernote API 'Production' Environment -> WWW.EVERNOTE.COM\n *    - Activate your Sandboxed API key for production access at https://dev.evernote.com/support/\n * \n * The Evernote API 'CHINA' Environment -> APP.YINXIANG.COM\n *    - Activate your Sandboxed API key for Evernote China service access at https://dev.evernote.com/support/ \n *      or https://dev.yinxiang.com/support/. For more information about Evernote China service, please refer \n *      to https://dev.evernote.com/doc/articles/bootstrap.php\n *\n * For testing, set $sandbox to true; for production, set $sandbox to false and $china to false; \n * for china service, set $sandbox to false and $china to true.\n * \n */\n$sandbox = true;\n$china   = false;\n\n$oauth_handler = new \\Evernote\\Auth\\OauthHandler($sandbox, false, $china);\n\n$key      = '%key%';\n$secret   = '%secret%';\n$callback = 'http://host/pathto/evernote-cloud-sdk-php/sample/oauth/index.php';\n\ntry {\n    $oauth_data  = $oauth_handler->authorize($key, $secret, $callback);\n\n    echo \"\\nOauth Token : \" . $oauth_data['oauth_token'];\n\n    // Now you can use this token to call the api\n    $client = new \\Evernote\\Client($oauth_data['oauth_token']);\n\n} catch (Evernote\\Exception\\AuthorizationDeniedException $e) {\n    //If the user decline the authorization, an exception is thrown.\n    echo \"Declined\";\n}\n"
  },
  {
    "path": "src/EDAM/Error/Types.php",
    "content": "<?php\nnamespace EDAM\\Error;\n\n/**\n * Autogenerated by Thrift Compiler (0.9.1)\n *\n * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING\n *  @generated\n */\nuse Thrift\\Base\\TBase;\nuse Thrift\\Type\\TType;\nuse Thrift\\Type\\TMessageType;\nuse Thrift\\Exception\\TException;\nuse Thrift\\Exception\\TProtocolException;\nuse Thrift\\Protocol\\TProtocol;\nuse Thrift\\Protocol\\TBinaryProtocolAccelerated;\nuse Thrift\\Exception\\TApplicationException;\n\n\nfinal class EDAMErrorCode {\n  const UNKNOWN = 1;\n  const BAD_DATA_FORMAT = 2;\n  const PERMISSION_DENIED = 3;\n  const INTERNAL_ERROR = 4;\n  const DATA_REQUIRED = 5;\n  const LIMIT_REACHED = 6;\n  const QUOTA_REACHED = 7;\n  const INVALID_AUTH = 8;\n  const AUTH_EXPIRED = 9;\n  const DATA_CONFLICT = 10;\n  const ENML_VALIDATION = 11;\n  const SHARD_UNAVAILABLE = 12;\n  const LEN_TOO_SHORT = 13;\n  const LEN_TOO_LONG = 14;\n  const TOO_FEW = 15;\n  const TOO_MANY = 16;\n  const UNSUPPORTED_OPERATION = 17;\n  const TAKEN_DOWN = 18;\n  const RATE_LIMIT_REACHED = 19;\n  static public $__names = array(\n    1 => 'UNKNOWN',\n    2 => 'BAD_DATA_FORMAT',\n    3 => 'PERMISSION_DENIED',\n    4 => 'INTERNAL_ERROR',\n    5 => 'DATA_REQUIRED',\n    6 => 'LIMIT_REACHED',\n    7 => 'QUOTA_REACHED',\n    8 => 'INVALID_AUTH',\n    9 => 'AUTH_EXPIRED',\n    10 => 'DATA_CONFLICT',\n    11 => 'ENML_VALIDATION',\n    12 => 'SHARD_UNAVAILABLE',\n    13 => 'LEN_TOO_SHORT',\n    14 => 'LEN_TOO_LONG',\n    15 => 'TOO_FEW',\n    16 => 'TOO_MANY',\n    17 => 'UNSUPPORTED_OPERATION',\n    18 => 'TAKEN_DOWN',\n    19 => 'RATE_LIMIT_REACHED',\n  );\n}\n\nclass EDAMUserException extends TException {\n  static $_TSPEC;\n\n  public $errorCode = null;\n  public $parameter = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'errorCode',\n          'type' => TType::I32,\n          ),\n        2 => array(\n          'var' => 'parameter',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['errorCode'])) {\n        $this->errorCode = $vals['errorCode'];\n      }\n      if (isset($vals['parameter'])) {\n        $this->parameter = $vals['parameter'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'EDAMUserException';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->errorCode);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->parameter);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('EDAMUserException');\n    if ($this->errorCode !== null) {\n      $xfer += $output->writeFieldBegin('errorCode', TType::I32, 1);\n      $xfer += $output->writeI32($this->errorCode);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->parameter !== null) {\n      $xfer += $output->writeFieldBegin('parameter', TType::STRING, 2);\n      $xfer += $output->writeString($this->parameter);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass EDAMSystemException extends TException {\n  static $_TSPEC;\n\n  public $errorCode = null;\n  public $message = null;\n  public $rateLimitDuration = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'errorCode',\n          'type' => TType::I32,\n          ),\n        2 => array(\n          'var' => 'message',\n          'type' => TType::STRING,\n          ),\n        3 => array(\n          'var' => 'rateLimitDuration',\n          'type' => TType::I32,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['errorCode'])) {\n        $this->errorCode = $vals['errorCode'];\n      }\n      if (isset($vals['message'])) {\n        $this->message = $vals['message'];\n      }\n      if (isset($vals['rateLimitDuration'])) {\n        $this->rateLimitDuration = $vals['rateLimitDuration'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'EDAMSystemException';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->errorCode);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->message);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->rateLimitDuration);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('EDAMSystemException');\n    if ($this->errorCode !== null) {\n      $xfer += $output->writeFieldBegin('errorCode', TType::I32, 1);\n      $xfer += $output->writeI32($this->errorCode);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->message !== null) {\n      $xfer += $output->writeFieldBegin('message', TType::STRING, 2);\n      $xfer += $output->writeString($this->message);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->rateLimitDuration !== null) {\n      $xfer += $output->writeFieldBegin('rateLimitDuration', TType::I32, 3);\n      $xfer += $output->writeI32($this->rateLimitDuration);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass EDAMNotFoundException extends TException {\n  static $_TSPEC;\n\n  public $identifier = null;\n  public $key = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'identifier',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'key',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['identifier'])) {\n        $this->identifier = $vals['identifier'];\n      }\n      if (isset($vals['key'])) {\n        $this->key = $vals['key'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'EDAMNotFoundException';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->identifier);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->key);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('EDAMNotFoundException');\n    if ($this->identifier !== null) {\n      $xfer += $output->writeFieldBegin('identifier', TType::STRING, 1);\n      $xfer += $output->writeString($this->identifier);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->key !== null) {\n      $xfer += $output->writeFieldBegin('key', TType::STRING, 2);\n      $xfer += $output->writeString($this->key);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\n\n"
  },
  {
    "path": "src/EDAM/Limits/Types.php",
    "content": "<?php\nnamespace EDAM\\Limits;\n\n/**\n * Autogenerated by Thrift Compiler (0.9.1)\n *\n * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING\n *  @generated\n */\nuse Thrift\\Base\\TBase;\nuse Thrift\\Type\\TType;\nuse Thrift\\Type\\TMessageType;\nuse Thrift\\Exception\\TException;\nuse Thrift\\Exception\\TProtocolException;\nuse Thrift\\Protocol\\TProtocol;\nuse Thrift\\Protocol\\TBinaryProtocolAccelerated;\nuse Thrift\\Exception\\TApplicationException;\n\n\nfinal class Constant extends \\Thrift\\Type\\TConstant {\n  static protected $EDAM_ATTRIBUTE_LEN_MIN;\n  static protected $EDAM_ATTRIBUTE_LEN_MAX;\n  static protected $EDAM_ATTRIBUTE_REGEX;\n  static protected $EDAM_ATTRIBUTE_LIST_MAX;\n  static protected $EDAM_ATTRIBUTE_MAP_MAX;\n  static protected $EDAM_GUID_LEN_MIN;\n  static protected $EDAM_GUID_LEN_MAX;\n  static protected $EDAM_GUID_REGEX;\n  static protected $EDAM_EMAIL_LEN_MIN;\n  static protected $EDAM_EMAIL_LEN_MAX;\n  static protected $EDAM_EMAIL_LOCAL_REGEX;\n  static protected $EDAM_EMAIL_DOMAIN_REGEX;\n  static protected $EDAM_EMAIL_REGEX;\n  static protected $EDAM_VAT_REGEX;\n  static protected $EDAM_TIMEZONE_LEN_MIN;\n  static protected $EDAM_TIMEZONE_LEN_MAX;\n  static protected $EDAM_TIMEZONE_REGEX;\n  static protected $EDAM_MIME_LEN_MIN;\n  static protected $EDAM_MIME_LEN_MAX;\n  static protected $EDAM_MIME_REGEX;\n  static protected $EDAM_MIME_TYPE_GIF;\n  static protected $EDAM_MIME_TYPE_JPEG;\n  static protected $EDAM_MIME_TYPE_PNG;\n  static protected $EDAM_MIME_TYPE_WAV;\n  static protected $EDAM_MIME_TYPE_MP3;\n  static protected $EDAM_MIME_TYPE_AMR;\n  static protected $EDAM_MIME_TYPE_AAC;\n  static protected $EDAM_MIME_TYPE_M4A;\n  static protected $EDAM_MIME_TYPE_MP4_VIDEO;\n  static protected $EDAM_MIME_TYPE_INK;\n  static protected $EDAM_MIME_TYPE_PDF;\n  static protected $EDAM_MIME_TYPE_DEFAULT;\n  static protected $EDAM_MIME_TYPES;\n  static protected $EDAM_INDEXABLE_RESOURCE_MIME_TYPES;\n  static protected $EDAM_SEARCH_QUERY_LEN_MIN;\n  static protected $EDAM_SEARCH_QUERY_LEN_MAX;\n  static protected $EDAM_SEARCH_QUERY_REGEX;\n  static protected $EDAM_HASH_LEN;\n  static protected $EDAM_USER_USERNAME_LEN_MIN;\n  static protected $EDAM_USER_USERNAME_LEN_MAX;\n  static protected $EDAM_USER_USERNAME_REGEX;\n  static protected $EDAM_USER_NAME_LEN_MIN;\n  static protected $EDAM_USER_NAME_LEN_MAX;\n  static protected $EDAM_USER_NAME_REGEX;\n  static protected $EDAM_TAG_NAME_LEN_MIN;\n  static protected $EDAM_TAG_NAME_LEN_MAX;\n  static protected $EDAM_TAG_NAME_REGEX;\n  static protected $EDAM_NOTE_TITLE_LEN_MIN;\n  static protected $EDAM_NOTE_TITLE_LEN_MAX;\n  static protected $EDAM_NOTE_TITLE_REGEX;\n  static protected $EDAM_NOTE_CONTENT_LEN_MIN;\n  static protected $EDAM_NOTE_CONTENT_LEN_MAX;\n  static protected $EDAM_APPLICATIONDATA_NAME_LEN_MIN;\n  static protected $EDAM_APPLICATIONDATA_NAME_LEN_MAX;\n  static protected $EDAM_APPLICATIONDATA_VALUE_LEN_MIN;\n  static protected $EDAM_APPLICATIONDATA_VALUE_LEN_MAX;\n  static protected $EDAM_APPLICATIONDATA_ENTRY_LEN_MAX;\n  static protected $EDAM_APPLICATIONDATA_NAME_REGEX;\n  static protected $EDAM_APPLICATIONDATA_VALUE_REGEX;\n  static protected $EDAM_NOTEBOOK_NAME_LEN_MIN;\n  static protected $EDAM_NOTEBOOK_NAME_LEN_MAX;\n  static protected $EDAM_NOTEBOOK_NAME_REGEX;\n  static protected $EDAM_NOTEBOOK_STACK_LEN_MIN;\n  static protected $EDAM_NOTEBOOK_STACK_LEN_MAX;\n  static protected $EDAM_NOTEBOOK_STACK_REGEX;\n  static protected $EDAM_PUBLISHING_URI_LEN_MIN;\n  static protected $EDAM_PUBLISHING_URI_LEN_MAX;\n  static protected $EDAM_PUBLISHING_URI_REGEX;\n  static protected $EDAM_PUBLISHING_URI_PROHIBITED;\n  static protected $EDAM_PUBLISHING_DESCRIPTION_LEN_MIN;\n  static protected $EDAM_PUBLISHING_DESCRIPTION_LEN_MAX;\n  static protected $EDAM_PUBLISHING_DESCRIPTION_REGEX;\n  static protected $EDAM_SAVED_SEARCH_NAME_LEN_MIN;\n  static protected $EDAM_SAVED_SEARCH_NAME_LEN_MAX;\n  static protected $EDAM_SAVED_SEARCH_NAME_REGEX;\n  static protected $EDAM_USER_PASSWORD_LEN_MIN;\n  static protected $EDAM_USER_PASSWORD_LEN_MAX;\n  static protected $EDAM_USER_PASSWORD_REGEX;\n  static protected $EDAM_BUSINESS_URI_LEN_MAX;\n  static protected $EDAM_NOTE_TAGS_MAX;\n  static protected $EDAM_NOTE_RESOURCES_MAX;\n  static protected $EDAM_USER_TAGS_MAX;\n  static protected $EDAM_BUSINESS_TAGS_MAX;\n  static protected $EDAM_USER_SAVED_SEARCHES_MAX;\n  static protected $EDAM_USER_NOTES_MAX;\n  static protected $EDAM_BUSINESS_NOTES_MAX;\n  static protected $EDAM_USER_NOTEBOOKS_MAX;\n  static protected $EDAM_BUSINESS_NOTEBOOKS_MAX;\n  static protected $EDAM_USER_RECENT_MAILED_ADDRESSES_MAX;\n  static protected $EDAM_USER_MAIL_LIMIT_DAILY_FREE;\n  static protected $EDAM_USER_MAIL_LIMIT_DAILY_PREMIUM;\n  static protected $EDAM_USER_UPLOAD_LIMIT_FREE;\n  static protected $EDAM_USER_UPLOAD_LIMIT_PREMIUM;\n  static protected $EDAM_USER_UPLOAD_LIMIT_BUSINESS;\n  static protected $EDAM_NOTE_SIZE_MAX_FREE;\n  static protected $EDAM_NOTE_SIZE_MAX_PREMIUM;\n  static protected $EDAM_RESOURCE_SIZE_MAX_FREE;\n  static protected $EDAM_RESOURCE_SIZE_MAX_PREMIUM;\n  static protected $EDAM_USER_LINKED_NOTEBOOK_MAX;\n  static protected $EDAM_USER_LINKED_NOTEBOOK_MAX_PREMIUM;\n  static protected $EDAM_NOTEBOOK_SHARED_NOTEBOOK_MAX;\n  static protected $EDAM_NOTE_CONTENT_CLASS_LEN_MIN;\n  static protected $EDAM_NOTE_CONTENT_CLASS_LEN_MAX;\n  static protected $EDAM_NOTE_CONTENT_CLASS_REGEX;\n  static protected $EDAM_HELLO_APP_CONTENT_CLASS_PREFIX;\n  static protected $EDAM_FOOD_APP_CONTENT_CLASS_PREFIX;\n  static protected $EDAM_CONTENT_CLASS_HELLO_ENCOUNTER;\n  static protected $EDAM_CONTENT_CLASS_HELLO_PROFILE;\n  static protected $EDAM_CONTENT_CLASS_FOOD_MEAL;\n  static protected $EDAM_CONTENT_CLASS_SKITCH_PREFIX;\n  static protected $EDAM_CONTENT_CLASS_SKITCH;\n  static protected $EDAM_CONTENT_CLASS_SKITCH_PDF;\n  static protected $EDAM_CONTENT_CLASS_PENULTIMATE_PREFIX;\n  static protected $EDAM_CONTENT_CLASS_PENULTIMATE_NOTEBOOK;\n  static protected $EDAM_RELATED_PLAINTEXT_LEN_MIN;\n  static protected $EDAM_RELATED_PLAINTEXT_LEN_MAX;\n  static protected $EDAM_RELATED_MAX_NOTES;\n  static protected $EDAM_RELATED_MAX_NOTEBOOKS;\n  static protected $EDAM_RELATED_MAX_TAGS;\n  static protected $EDAM_BUSINESS_NOTEBOOK_DESCRIPTION_LEN_MIN;\n  static protected $EDAM_BUSINESS_NOTEBOOK_DESCRIPTION_LEN_MAX;\n  static protected $EDAM_BUSINESS_NOTEBOOK_DESCRIPTION_REGEX;\n  static protected $EDAM_BUSINESS_PHONE_NUMBER_LEN_MAX;\n  static protected $EDAM_PREFERENCE_NAME_LEN_MIN;\n  static protected $EDAM_PREFERENCE_NAME_LEN_MAX;\n  static protected $EDAM_PREFERENCE_VALUE_LEN_MIN;\n  static protected $EDAM_PREFERENCE_VALUE_LEN_MAX;\n  static protected $EDAM_MAX_PREFERENCES;\n  static protected $EDAM_MAX_VALUES_PER_PREFERENCE;\n  static protected $EDAM_PREFERENCE_NAME_REGEX;\n  static protected $EDAM_PREFERENCE_VALUE_REGEX;\n  static protected $EDAM_PREFERENCE_SHORTCUTS;\n  static protected $EDAM_PREFERENCE_SHORTCUTS_MAX_VALUES;\n  static protected $EDAM_DEVICE_ID_LEN_MAX;\n  static protected $EDAM_DEVICE_ID_REGEX;\n  static protected $EDAM_DEVICE_DESCRIPTION_LEN_MAX;\n  static protected $EDAM_DEVICE_DESCRIPTION_REGEX;\n  static protected $EDAM_SEARCH_SUGGESTIONS_MAX;\n  static protected $EDAM_SEARCH_SUGGESTIONS_PREFIX_LEN_MAX;\n  static protected $EDAM_SEARCH_SUGGESTIONS_PREFIX_LEN_MIN;\n\n  static protected function init_EDAM_ATTRIBUTE_LEN_MIN() {\n    return 1;\n  }\n\n  static protected function init_EDAM_ATTRIBUTE_LEN_MAX() {\n    return 4096;\n  }\n\n  static protected function init_EDAM_ATTRIBUTE_REGEX() {\n    return \"^[^\\\\p{Cc}\\\\p{Zl}\\\\p{Zp}]{1,4096}\\$\";\n  }\n\n  static protected function init_EDAM_ATTRIBUTE_LIST_MAX() {\n    return 100;\n  }\n\n  static protected function init_EDAM_ATTRIBUTE_MAP_MAX() {\n    return 100;\n  }\n\n  static protected function init_EDAM_GUID_LEN_MIN() {\n    return 36;\n  }\n\n  static protected function init_EDAM_GUID_LEN_MAX() {\n    return 36;\n  }\n\n  static protected function init_EDAM_GUID_REGEX() {\n    return \"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\\$\";\n  }\n\n  static protected function init_EDAM_EMAIL_LEN_MIN() {\n    return 6;\n  }\n\n  static protected function init_EDAM_EMAIL_LEN_MAX() {\n    return 255;\n  }\n\n  static protected function init_EDAM_EMAIL_LOCAL_REGEX() {\n    return \"^[A-Za-z0-9!#\\$%&'*+/=?^_`{|}~-]+(\\\\.[A-Za-z0-9!#\\$%&'*+/=?^_`{|}~-]+)*\\$\";\n  }\n\n  static protected function init_EDAM_EMAIL_DOMAIN_REGEX() {\n    return \"^[A-Za-z0-9-]+(\\\\.[A-Za-z0-9-]+)*\\\\.([A-Za-z]{2,})\\$\";\n  }\n\n  static protected function init_EDAM_EMAIL_REGEX() {\n    return \"^[A-Za-z0-9!#\\$%&'*+/=?^_`{|}~-]+(\\\\.[A-Za-z0-9!#\\$%&'*+/=?^_`{|}~-]+)*@[A-Za-z0-9-]+(\\\\.[A-Za-z0-9-]+)*\\\\.([A-Za-z]{2,})\\$\";\n  }\n\n  static protected function init_EDAM_VAT_REGEX() {\n    return \"^((AT)?U[0-9]{8}|(BE)?0?[0-9]{9}|(BG)?[0-9]{9,10}|(CY)?[0-9]{8}L|(CZ)?[0-9]{8,10}|(DE)?[0-9]{9}|(DK)?[0-9]{8}|(EE)?[0-9]{9}|(EL|GR)?[0-9]{9}|(ES)?[0-9A-Z][0-9]{7}[0-9A-Z]|(FI)?[0-9]{8}|(FR)?[0-9A-Z]{2}[0-9]{9}|(GB)?([0-9]{9}([0-9]{3})?|[A-Z]{2}[0-9]{3})|(HU)?[0-9]{8}|(IE)?[0-9]S[0-9]{5}L|(IT)?[0-9]{11}|(LT)?([0-9]{9}|[0-9]{12})|(LU)?[0-9]{8}|(LV)?[0-9]{11}|(MT)?[0-9]{8}|(NL)?[0-9]{9}B[0-9]{2}|(PL)?[0-9]{10}|(PT)?[0-9]{9}|(RO)?[0-9]{2,10}|(SE)?[0-9]{12}|(SI)?[0-9]{8}|(SK)?[0-9]{10})|[0-9]{9}MVA|[0-9]{6}|CHE[0-9]{9}(TVA|MWST|IVA)\\$\";\n  }\n\n  static protected function init_EDAM_TIMEZONE_LEN_MIN() {\n    return 1;\n  }\n\n  static protected function init_EDAM_TIMEZONE_LEN_MAX() {\n    return 32;\n  }\n\n  static protected function init_EDAM_TIMEZONE_REGEX() {\n    return \"^([A-Za-z_-]+(/[A-Za-z_-]+)*)|(GMT(-|\\\\+)[0-9]{1,2}(:[0-9]{2})?)\\$\";\n  }\n\n  static protected function init_EDAM_MIME_LEN_MIN() {\n    return 3;\n  }\n\n  static protected function init_EDAM_MIME_LEN_MAX() {\n    return 255;\n  }\n\n  static protected function init_EDAM_MIME_REGEX() {\n    return \"^[A-Za-z]+/[A-Za-z0-9._+-]+\\$\";\n  }\n\n  static protected function init_EDAM_MIME_TYPE_GIF() {\n    return \"image/gif\";\n  }\n\n  static protected function init_EDAM_MIME_TYPE_JPEG() {\n    return \"image/jpeg\";\n  }\n\n  static protected function init_EDAM_MIME_TYPE_PNG() {\n    return \"image/png\";\n  }\n\n  static protected function init_EDAM_MIME_TYPE_WAV() {\n    return \"audio/wav\";\n  }\n\n  static protected function init_EDAM_MIME_TYPE_MP3() {\n    return \"audio/mpeg\";\n  }\n\n  static protected function init_EDAM_MIME_TYPE_AMR() {\n    return \"audio/amr\";\n  }\n\n  static protected function init_EDAM_MIME_TYPE_AAC() {\n    return \"audio/aac\";\n  }\n\n  static protected function init_EDAM_MIME_TYPE_M4A() {\n    return \"audio/mp4\";\n  }\n\n  static protected function init_EDAM_MIME_TYPE_MP4_VIDEO() {\n    return \"video/mp4\";\n  }\n\n  static protected function init_EDAM_MIME_TYPE_INK() {\n    return \"application/vnd.evernote.ink\";\n  }\n\n  static protected function init_EDAM_MIME_TYPE_PDF() {\n    return \"application/pdf\";\n  }\n\n  static protected function init_EDAM_MIME_TYPE_DEFAULT() {\n    return \"application/octet-stream\";\n  }\n\n  static protected function init_EDAM_MIME_TYPES() {\n    return array(\n      \"image/gif\" => true,\n      \"image/jpeg\" => true,\n      \"image/png\" => true,\n      \"audio/wav\" => true,\n      \"audio/mpeg\" => true,\n      \"audio/amr\" => true,\n      \"application/vnd.evernote.ink\" => true,\n      \"application/pdf\" => true,\n      \"video/mp4\" => true,\n      \"audio/aac\" => true,\n      \"audio/mp4\" => true,\n    );\n  }\n\n  static protected function init_EDAM_INDEXABLE_RESOURCE_MIME_TYPES() {\n    return array(\n      \"application/msword\" => true,\n      \"application/mspowerpoint\" => true,\n      \"application/excel\" => true,\n      \"application/vnd.ms-word\" => true,\n      \"application/vnd.ms-powerpoint\" => true,\n      \"application/vnd.ms-excel\" => true,\n      \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\" => true,\n      \"application/vnd.openxmlformats-officedocument.presentationml.presentation\" => true,\n      \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\" => true,\n      \"application/vnd.apple.pages\" => true,\n      \"application/vnd.apple.numbers\" => true,\n      \"application/vnd.apple.keynote\" => true,\n      \"application/x-iwork-pages-sffpages\" => true,\n      \"application/x-iwork-numbers-sffnumbers\" => true,\n      \"application/x-iwork-keynote-sffkey\" => true,\n    );\n  }\n\n  static protected function init_EDAM_SEARCH_QUERY_LEN_MIN() {\n    return 0;\n  }\n\n  static protected function init_EDAM_SEARCH_QUERY_LEN_MAX() {\n    return 1024;\n  }\n\n  static protected function init_EDAM_SEARCH_QUERY_REGEX() {\n    return \"^[^\\\\p{Cc}\\\\p{Zl}\\\\p{Zp}]{0,1024}\\$\";\n  }\n\n  static protected function init_EDAM_HASH_LEN() {\n    return 16;\n  }\n\n  static protected function init_EDAM_USER_USERNAME_LEN_MIN() {\n    return 1;\n  }\n\n  static protected function init_EDAM_USER_USERNAME_LEN_MAX() {\n    return 64;\n  }\n\n  static protected function init_EDAM_USER_USERNAME_REGEX() {\n    return \"^[a-z0-9]([a-z0-9_-]{0,62}[a-z0-9])?\\$\";\n  }\n\n  static protected function init_EDAM_USER_NAME_LEN_MIN() {\n    return 1;\n  }\n\n  static protected function init_EDAM_USER_NAME_LEN_MAX() {\n    return 255;\n  }\n\n  static protected function init_EDAM_USER_NAME_REGEX() {\n    return \"^[^\\\\p{Cc}\\\\p{Zl}\\\\p{Zp}]{1,255}\\$\";\n  }\n\n  static protected function init_EDAM_TAG_NAME_LEN_MIN() {\n    return 1;\n  }\n\n  static protected function init_EDAM_TAG_NAME_LEN_MAX() {\n    return 100;\n  }\n\n  static protected function init_EDAM_TAG_NAME_REGEX() {\n    return \"^[^,\\\\p{Cc}\\\\p{Z}]([^,\\\\p{Cc}\\\\p{Zl}\\\\p{Zp}]{0,98}[^,\\\\p{Cc}\\\\p{Z}])?\\$\";\n  }\n\n  static protected function init_EDAM_NOTE_TITLE_LEN_MIN() {\n    return 1;\n  }\n\n  static protected function init_EDAM_NOTE_TITLE_LEN_MAX() {\n    return 255;\n  }\n\n  static protected function init_EDAM_NOTE_TITLE_REGEX() {\n    return \"^[^\\\\p{Cc}\\\\p{Z}]([^\\\\p{Cc}\\\\p{Zl}\\\\p{Zp}]{0,253}[^\\\\p{Cc}\\\\p{Z}])?\\$\";\n  }\n\n  static protected function init_EDAM_NOTE_CONTENT_LEN_MIN() {\n    return 0;\n  }\n\n  static protected function init_EDAM_NOTE_CONTENT_LEN_MAX() {\n    return 5242880;\n  }\n\n  static protected function init_EDAM_APPLICATIONDATA_NAME_LEN_MIN() {\n    return 3;\n  }\n\n  static protected function init_EDAM_APPLICATIONDATA_NAME_LEN_MAX() {\n    return 32;\n  }\n\n  static protected function init_EDAM_APPLICATIONDATA_VALUE_LEN_MIN() {\n    return 0;\n  }\n\n  static protected function init_EDAM_APPLICATIONDATA_VALUE_LEN_MAX() {\n    return 4092;\n  }\n\n  static protected function init_EDAM_APPLICATIONDATA_ENTRY_LEN_MAX() {\n    return 4095;\n  }\n\n  static protected function init_EDAM_APPLICATIONDATA_NAME_REGEX() {\n    return \"^[A-Za-z0-9_.-]{3,32}\\$\";\n  }\n\n  static protected function init_EDAM_APPLICATIONDATA_VALUE_REGEX() {\n    return \"^[^\\\\p{Cc}]{0,4092}\\$\";\n  }\n\n  static protected function init_EDAM_NOTEBOOK_NAME_LEN_MIN() {\n    return 1;\n  }\n\n  static protected function init_EDAM_NOTEBOOK_NAME_LEN_MAX() {\n    return 100;\n  }\n\n  static protected function init_EDAM_NOTEBOOK_NAME_REGEX() {\n    return \"^[^\\\\p{Cc}\\\\p{Z}]([^\\\\p{Cc}\\\\p{Zl}\\\\p{Zp}]{0,98}[^\\\\p{Cc}\\\\p{Z}])?\\$\";\n  }\n\n  static protected function init_EDAM_NOTEBOOK_STACK_LEN_MIN() {\n    return 1;\n  }\n\n  static protected function init_EDAM_NOTEBOOK_STACK_LEN_MAX() {\n    return 100;\n  }\n\n  static protected function init_EDAM_NOTEBOOK_STACK_REGEX() {\n    return \"^[^\\\\p{Cc}\\\\p{Z}]([^\\\\p{Cc}\\\\p{Zl}\\\\p{Zp}]{0,98}[^\\\\p{Cc}\\\\p{Z}])?\\$\";\n  }\n\n  static protected function init_EDAM_PUBLISHING_URI_LEN_MIN() {\n    return 1;\n  }\n\n  static protected function init_EDAM_PUBLISHING_URI_LEN_MAX() {\n    return 255;\n  }\n\n  static protected function init_EDAM_PUBLISHING_URI_REGEX() {\n    return \"^[a-zA-Z0-9.~_+-]{1,255}\\$\";\n  }\n\n  static protected function init_EDAM_PUBLISHING_URI_PROHIBITED() {\n    return array(\n      \"..\" => true,\n    );\n  }\n\n  static protected function init_EDAM_PUBLISHING_DESCRIPTION_LEN_MIN() {\n    return 1;\n  }\n\n  static protected function init_EDAM_PUBLISHING_DESCRIPTION_LEN_MAX() {\n    return 200;\n  }\n\n  static protected function init_EDAM_PUBLISHING_DESCRIPTION_REGEX() {\n    return \"^[^\\\\p{Cc}\\\\p{Z}]([^\\\\p{Cc}\\\\p{Zl}\\\\p{Zp}]{0,198}[^\\\\p{Cc}\\\\p{Z}])?\\$\";\n  }\n\n  static protected function init_EDAM_SAVED_SEARCH_NAME_LEN_MIN() {\n    return 1;\n  }\n\n  static protected function init_EDAM_SAVED_SEARCH_NAME_LEN_MAX() {\n    return 100;\n  }\n\n  static protected function init_EDAM_SAVED_SEARCH_NAME_REGEX() {\n    return \"^[^\\\\p{Cc}\\\\p{Z}]([^\\\\p{Cc}\\\\p{Zl}\\\\p{Zp}]{0,98}[^\\\\p{Cc}\\\\p{Z}])?\\$\";\n  }\n\n  static protected function init_EDAM_USER_PASSWORD_LEN_MIN() {\n    return 6;\n  }\n\n  static protected function init_EDAM_USER_PASSWORD_LEN_MAX() {\n    return 64;\n  }\n\n  static protected function init_EDAM_USER_PASSWORD_REGEX() {\n    return \"^[A-Za-z0-9!#\\$%&'()*+,./:;<=>?@^_`{|}~\\\\[\\\\]\\\\\\\\-]{6,64}\\$\";\n  }\n\n  static protected function init_EDAM_BUSINESS_URI_LEN_MAX() {\n    return 32;\n  }\n\n  static protected function init_EDAM_NOTE_TAGS_MAX() {\n    return 100;\n  }\n\n  static protected function init_EDAM_NOTE_RESOURCES_MAX() {\n    return 1000;\n  }\n\n  static protected function init_EDAM_USER_TAGS_MAX() {\n    return 100000;\n  }\n\n  static protected function init_EDAM_BUSINESS_TAGS_MAX() {\n    return 100000;\n  }\n\n  static protected function init_EDAM_USER_SAVED_SEARCHES_MAX() {\n    return 100;\n  }\n\n  static protected function init_EDAM_USER_NOTES_MAX() {\n    return 100000;\n  }\n\n  static protected function init_EDAM_BUSINESS_NOTES_MAX() {\n    return 500000;\n  }\n\n  static protected function init_EDAM_USER_NOTEBOOKS_MAX() {\n    return 250;\n  }\n\n  static protected function init_EDAM_BUSINESS_NOTEBOOKS_MAX() {\n    return 5000;\n  }\n\n  static protected function init_EDAM_USER_RECENT_MAILED_ADDRESSES_MAX() {\n    return 10;\n  }\n\n  static protected function init_EDAM_USER_MAIL_LIMIT_DAILY_FREE() {\n    return 50;\n  }\n\n  static protected function init_EDAM_USER_MAIL_LIMIT_DAILY_PREMIUM() {\n    return 200;\n  }\n\n  static protected function init_EDAM_USER_UPLOAD_LIMIT_FREE() {\n    return 62914560;\n  }\n\n  static protected function init_EDAM_USER_UPLOAD_LIMIT_PREMIUM() {\n    return 1073741824;\n  }\n\n  static protected function init_EDAM_USER_UPLOAD_LIMIT_BUSINESS() {\n    return 2147483647;\n  }\n\n  static protected function init_EDAM_NOTE_SIZE_MAX_FREE() {\n    return 26214400;\n  }\n\n  static protected function init_EDAM_NOTE_SIZE_MAX_PREMIUM() {\n    return 104857600;\n  }\n\n  static protected function init_EDAM_RESOURCE_SIZE_MAX_FREE() {\n    return 26214400;\n  }\n\n  static protected function init_EDAM_RESOURCE_SIZE_MAX_PREMIUM() {\n    return 104857600;\n  }\n\n  static protected function init_EDAM_USER_LINKED_NOTEBOOK_MAX() {\n    return 100;\n  }\n\n  static protected function init_EDAM_USER_LINKED_NOTEBOOK_MAX_PREMIUM() {\n    return 250;\n  }\n\n  static protected function init_EDAM_NOTEBOOK_SHARED_NOTEBOOK_MAX() {\n    return 250;\n  }\n\n  static protected function init_EDAM_NOTE_CONTENT_CLASS_LEN_MIN() {\n    return 3;\n  }\n\n  static protected function init_EDAM_NOTE_CONTENT_CLASS_LEN_MAX() {\n    return 32;\n  }\n\n  static protected function init_EDAM_NOTE_CONTENT_CLASS_REGEX() {\n    return \"^[A-Za-z0-9_.-]{3,32}\\$\";\n  }\n\n  static protected function init_EDAM_HELLO_APP_CONTENT_CLASS_PREFIX() {\n    return \"evernote.hello.\";\n  }\n\n  static protected function init_EDAM_FOOD_APP_CONTENT_CLASS_PREFIX() {\n    return \"evernote.food.\";\n  }\n\n  static protected function init_EDAM_CONTENT_CLASS_HELLO_ENCOUNTER() {\n    return \"evernote.hello.encounter\";\n  }\n\n  static protected function init_EDAM_CONTENT_CLASS_HELLO_PROFILE() {\n    return \"evernote.hello.profile\";\n  }\n\n  static protected function init_EDAM_CONTENT_CLASS_FOOD_MEAL() {\n    return \"evernote.food.meal\";\n  }\n\n  static protected function init_EDAM_CONTENT_CLASS_SKITCH_PREFIX() {\n    return \"evernote.skitch\";\n  }\n\n  static protected function init_EDAM_CONTENT_CLASS_SKITCH() {\n    return \"evernote.skitch\";\n  }\n\n  static protected function init_EDAM_CONTENT_CLASS_SKITCH_PDF() {\n    return \"evernote.skitch.pdf\";\n  }\n\n  static protected function init_EDAM_CONTENT_CLASS_PENULTIMATE_PREFIX() {\n    return \"evernote.penultimate.\";\n  }\n\n  static protected function init_EDAM_CONTENT_CLASS_PENULTIMATE_NOTEBOOK() {\n    return \"evernote.penultimate.notebook\";\n  }\n\n  static protected function init_EDAM_RELATED_PLAINTEXT_LEN_MIN() {\n    return 1;\n  }\n\n  static protected function init_EDAM_RELATED_PLAINTEXT_LEN_MAX() {\n    return 131072;\n  }\n\n  static protected function init_EDAM_RELATED_MAX_NOTES() {\n    return 25;\n  }\n\n  static protected function init_EDAM_RELATED_MAX_NOTEBOOKS() {\n    return 1;\n  }\n\n  static protected function init_EDAM_RELATED_MAX_TAGS() {\n    return 25;\n  }\n\n  static protected function init_EDAM_BUSINESS_NOTEBOOK_DESCRIPTION_LEN_MIN() {\n    return 1;\n  }\n\n  static protected function init_EDAM_BUSINESS_NOTEBOOK_DESCRIPTION_LEN_MAX() {\n    return 200;\n  }\n\n  static protected function init_EDAM_BUSINESS_NOTEBOOK_DESCRIPTION_REGEX() {\n    return \"^[^\\\\p{Cc}\\\\p{Z}]([^\\\\p{Cc}\\\\p{Zl}\\\\p{Zp}]{0,198}[^\\\\p{Cc}\\\\p{Z}])?\\$\";\n  }\n\n  static protected function init_EDAM_BUSINESS_PHONE_NUMBER_LEN_MAX() {\n    return 20;\n  }\n\n  static protected function init_EDAM_PREFERENCE_NAME_LEN_MIN() {\n    return 3;\n  }\n\n  static protected function init_EDAM_PREFERENCE_NAME_LEN_MAX() {\n    return 32;\n  }\n\n  static protected function init_EDAM_PREFERENCE_VALUE_LEN_MIN() {\n    return 1;\n  }\n\n  static protected function init_EDAM_PREFERENCE_VALUE_LEN_MAX() {\n    return 1024;\n  }\n\n  static protected function init_EDAM_MAX_PREFERENCES() {\n    return 100;\n  }\n\n  static protected function init_EDAM_MAX_VALUES_PER_PREFERENCE() {\n    return 256;\n  }\n\n  static protected function init_EDAM_PREFERENCE_NAME_REGEX() {\n    return \"^[A-Za-z0-9_.-]{3,32}\\$\";\n  }\n\n  static protected function init_EDAM_PREFERENCE_VALUE_REGEX() {\n    return \"^[^\\\\p{Cc}]{1,1024}\\$\";\n  }\n\n  static protected function init_EDAM_PREFERENCE_SHORTCUTS() {\n    return \"evernote.shortcuts\";\n  }\n\n  static protected function init_EDAM_PREFERENCE_SHORTCUTS_MAX_VALUES() {\n    return 250;\n  }\n\n  static protected function init_EDAM_DEVICE_ID_LEN_MAX() {\n    return 32;\n  }\n\n  static protected function init_EDAM_DEVICE_ID_REGEX() {\n    return \"^[^\\\\p{Cc}]{1,32}\\$\";\n  }\n\n  static protected function init_EDAM_DEVICE_DESCRIPTION_LEN_MAX() {\n    return 64;\n  }\n\n  static protected function init_EDAM_DEVICE_DESCRIPTION_REGEX() {\n    return \"^[^\\\\p{Cc}]{1,64}\\$\";\n  }\n\n  static protected function init_EDAM_SEARCH_SUGGESTIONS_MAX() {\n    return 10;\n  }\n\n  static protected function init_EDAM_SEARCH_SUGGESTIONS_PREFIX_LEN_MAX() {\n    return 1024;\n  }\n\n  static protected function init_EDAM_SEARCH_SUGGESTIONS_PREFIX_LEN_MIN() {\n    return 2;\n  }\n}\n\n\n"
  },
  {
    "path": "src/EDAM/NoteStore/NoteStore.php",
    "content": "<?php\nnamespace EDAM\\NoteStore;\n/**\n * Autogenerated by Thrift Compiler (0.9.1)\n *\n * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING\n *  @generated\n */\nuse Thrift\\Base\\TBase;\nuse Thrift\\Type\\TType;\nuse Thrift\\Type\\TMessageType;\nuse Thrift\\Exception\\TException;\nuse Thrift\\Exception\\TProtocolException;\nuse Thrift\\Protocol\\TProtocol;\nuse Thrift\\Protocol\\TBinaryProtocolAccelerated;\nuse Thrift\\Exception\\TApplicationException;\n\ninterface NoteStoreIf {\n    public function getSyncState($authenticationToken);\n    public function getSyncStateWithMetrics($authenticationToken, \\EDAM\\NoteStore\\ClientUsageMetrics $clientMetrics);\n    public function getSyncChunk($authenticationToken, $afterUSN, $maxEntries, $fullSyncOnly);\n    public function getFilteredSyncChunk($authenticationToken, $afterUSN, $maxEntries, \\EDAM\\NoteStore\\SyncChunkFilter $filter);\n    public function getLinkedNotebookSyncState($authenticationToken, \\EDAM\\Types\\LinkedNotebook $linkedNotebook);\n    public function getLinkedNotebookSyncChunk($authenticationToken, \\EDAM\\Types\\LinkedNotebook $linkedNotebook, $afterUSN, $maxEntries, $fullSyncOnly);\n    public function listNotebooks($authenticationToken);\n    public function getNotebook($authenticationToken, $guid);\n    public function getDefaultNotebook($authenticationToken);\n    public function createNotebook($authenticationToken, \\EDAM\\Types\\Notebook $notebook);\n    public function updateNotebook($authenticationToken, \\EDAM\\Types\\Notebook $notebook);\n    public function expungeNotebook($authenticationToken, $guid);\n    public function listTags($authenticationToken);\n    public function listTagsByNotebook($authenticationToken, $notebookGuid);\n    public function getTag($authenticationToken, $guid);\n    public function createTag($authenticationToken, \\EDAM\\Types\\Tag $tag);\n    public function updateTag($authenticationToken, \\EDAM\\Types\\Tag $tag);\n    public function untagAll($authenticationToken, $guid);\n    public function expungeTag($authenticationToken, $guid);\n    public function listSearches($authenticationToken);\n    public function getSearch($authenticationToken, $guid);\n    public function createSearch($authenticationToken, \\EDAM\\Types\\SavedSearch $search);\n    public function updateSearch($authenticationToken, \\EDAM\\Types\\SavedSearch $search);\n    public function expungeSearch($authenticationToken, $guid);\n    public function findNotes($authenticationToken, \\EDAM\\NoteStore\\NoteFilter $filter, $offset, $maxNotes);\n    public function findNoteOffset($authenticationToken, \\EDAM\\NoteStore\\NoteFilter $filter, $guid);\n    public function findNotesMetadata($authenticationToken, \\EDAM\\NoteStore\\NoteFilter $filter, $offset, $maxNotes, \\EDAM\\NoteStore\\NotesMetadataResultSpec $resultSpec);\n    public function findNoteCounts($authenticationToken, \\EDAM\\NoteStore\\NoteFilter $filter, $withTrash);\n    public function getNote($authenticationToken, $guid, $withContent, $withResourcesData, $withResourcesRecognition, $withResourcesAlternateData);\n    public function getNoteApplicationData($authenticationToken, $guid);\n    public function getNoteApplicationDataEntry($authenticationToken, $guid, $key);\n    public function setNoteApplicationDataEntry($authenticationToken, $guid, $key, $value);\n    public function unsetNoteApplicationDataEntry($authenticationToken, $guid, $key);\n    public function getNoteContent($authenticationToken, $guid);\n    public function getNoteSearchText($authenticationToken, $guid, $noteOnly, $tokenizeForIndexing);\n    public function getResourceSearchText($authenticationToken, $guid);\n    public function getNoteTagNames($authenticationToken, $guid);\n    public function createNote($authenticationToken, \\EDAM\\Types\\Note $note);\n    public function updateNote($authenticationToken, \\EDAM\\Types\\Note $note);\n    public function deleteNote($authenticationToken, $guid);\n    public function expungeNote($authenticationToken, $guid);\n    public function expungeNotes($authenticationToken, $noteGuids);\n    public function expungeInactiveNotes($authenticationToken);\n    public function copyNote($authenticationToken, $noteGuid, $toNotebookGuid);\n    public function listNoteVersions($authenticationToken, $noteGuid);\n    public function getNoteVersion($authenticationToken, $noteGuid, $updateSequenceNum, $withResourcesData, $withResourcesRecognition, $withResourcesAlternateData);\n    public function getResource($authenticationToken, $guid, $withData, $withRecognition, $withAttributes, $withAlternateData);\n    public function getResourceApplicationData($authenticationToken, $guid);\n    public function getResourceApplicationDataEntry($authenticationToken, $guid, $key);\n    public function setResourceApplicationDataEntry($authenticationToken, $guid, $key, $value);\n    public function unsetResourceApplicationDataEntry($authenticationToken, $guid, $key);\n    public function updateResource($authenticationToken, \\EDAM\\Types\\Resource $resource);\n    public function getResourceData($authenticationToken, $guid);\n    public function getResourceByHash($authenticationToken, $noteGuid, $contentHash, $withData, $withRecognition, $withAlternateData);\n    public function getResourceRecognition($authenticationToken, $guid);\n    public function getResourceAlternateData($authenticationToken, $guid);\n    public function getResourceAttributes($authenticationToken, $guid);\n    public function getPublicNotebook($userId, $publicUri);\n    public function createSharedNotebook($authenticationToken, \\EDAM\\Types\\SharedNotebook $sharedNotebook);\n    public function updateSharedNotebook($authenticationToken, \\EDAM\\Types\\SharedNotebook $sharedNotebook);\n    public function setSharedNotebookRecipientSettings($authenticationToken, $sharedNotebookId, \\EDAM\\Types\\SharedNotebookRecipientSettings $recipientSettings);\n    public function sendMessageToSharedNotebookMembers($authenticationToken, $notebookGuid, $messageText, $recipients);\n    public function listSharedNotebooks($authenticationToken);\n    public function expungeSharedNotebooks($authenticationToken, $sharedNotebookIds);\n    public function createLinkedNotebook($authenticationToken, \\EDAM\\Types\\LinkedNotebook $linkedNotebook);\n    public function updateLinkedNotebook($authenticationToken, \\EDAM\\Types\\LinkedNotebook $linkedNotebook);\n    public function listLinkedNotebooks($authenticationToken);\n    public function expungeLinkedNotebook($authenticationToken, $guid);\n    public function authenticateToSharedNotebook($shareKey, $authenticationToken);\n    public function getSharedNotebookByAuth($authenticationToken);\n    public function emailNote($authenticationToken, \\EDAM\\NoteStore\\NoteEmailParameters $parameters);\n    public function shareNote($authenticationToken, $guid);\n    public function stopSharingNote($authenticationToken, $guid);\n    public function authenticateToSharedNote($guid, $noteKey, $authenticationToken);\n    public function findRelated($authenticationToken, \\EDAM\\NoteStore\\RelatedQuery $query, \\EDAM\\NoteStore\\RelatedResultSpec $resultSpec);\n}\n\nclass NoteStoreClient implements \\EDAM\\NoteStore\\NoteStoreIf {\n    protected $input_ = null;\n    protected $output_ = null;\n\n    protected $seqid_ = 0;\n\n    public function __construct($input, $output=null) {\n        $this->input_ = $input;\n        $this->output_ = $output ? $output : $input;\n    }\n\n    public function getSyncState($authenticationToken)\n    {\n        $this->send_getSyncState($authenticationToken);\n        return $this->recv_getSyncState();\n    }\n\n    public function send_getSyncState($authenticationToken)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_getSyncState_args();\n        $args->authenticationToken = $authenticationToken;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'getSyncState', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('getSyncState', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_getSyncState()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_getSyncState_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_getSyncState_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        throw new \\Exception(\"getSyncState failed: unknown result\");\n    }\n\n    public function getSyncStateWithMetrics($authenticationToken, \\EDAM\\NoteStore\\ClientUsageMetrics $clientMetrics)\n    {\n        $this->send_getSyncStateWithMetrics($authenticationToken, $clientMetrics);\n        return $this->recv_getSyncStateWithMetrics();\n    }\n\n    public function send_getSyncStateWithMetrics($authenticationToken, \\EDAM\\NoteStore\\ClientUsageMetrics $clientMetrics)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_getSyncStateWithMetrics_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->clientMetrics = $clientMetrics;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'getSyncStateWithMetrics', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('getSyncStateWithMetrics', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_getSyncStateWithMetrics()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_getSyncStateWithMetrics_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_getSyncStateWithMetrics_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        throw new \\Exception(\"getSyncStateWithMetrics failed: unknown result\");\n    }\n\n    public function getSyncChunk($authenticationToken, $afterUSN, $maxEntries, $fullSyncOnly)\n    {\n        $this->send_getSyncChunk($authenticationToken, $afterUSN, $maxEntries, $fullSyncOnly);\n        return $this->recv_getSyncChunk();\n    }\n\n    public function send_getSyncChunk($authenticationToken, $afterUSN, $maxEntries, $fullSyncOnly)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_getSyncChunk_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->afterUSN = $afterUSN;\n        $args->maxEntries = $maxEntries;\n        $args->fullSyncOnly = $fullSyncOnly;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'getSyncChunk', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('getSyncChunk', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_getSyncChunk()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_getSyncChunk_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_getSyncChunk_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        throw new \\Exception(\"getSyncChunk failed: unknown result\");\n    }\n\n    public function getFilteredSyncChunk($authenticationToken, $afterUSN, $maxEntries, \\EDAM\\NoteStore\\SyncChunkFilter $filter)\n    {\n        $this->send_getFilteredSyncChunk($authenticationToken, $afterUSN, $maxEntries, $filter);\n        return $this->recv_getFilteredSyncChunk();\n    }\n\n    public function send_getFilteredSyncChunk($authenticationToken, $afterUSN, $maxEntries, \\EDAM\\NoteStore\\SyncChunkFilter $filter)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_getFilteredSyncChunk_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->afterUSN = $afterUSN;\n        $args->maxEntries = $maxEntries;\n        $args->filter = $filter;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'getFilteredSyncChunk', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('getFilteredSyncChunk', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_getFilteredSyncChunk()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_getFilteredSyncChunk_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_getFilteredSyncChunk_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        throw new \\Exception(\"getFilteredSyncChunk failed: unknown result\");\n    }\n\n    public function getLinkedNotebookSyncState($authenticationToken, \\EDAM\\Types\\LinkedNotebook $linkedNotebook)\n    {\n        $this->send_getLinkedNotebookSyncState($authenticationToken, $linkedNotebook);\n        return $this->recv_getLinkedNotebookSyncState();\n    }\n\n    public function send_getLinkedNotebookSyncState($authenticationToken, \\EDAM\\Types\\LinkedNotebook $linkedNotebook)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_getLinkedNotebookSyncState_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->linkedNotebook = $linkedNotebook;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'getLinkedNotebookSyncState', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('getLinkedNotebookSyncState', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_getLinkedNotebookSyncState()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_getLinkedNotebookSyncState_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_getLinkedNotebookSyncState_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        throw new \\Exception(\"getLinkedNotebookSyncState failed: unknown result\");\n    }\n\n    public function getLinkedNotebookSyncChunk($authenticationToken, \\EDAM\\Types\\LinkedNotebook $linkedNotebook, $afterUSN, $maxEntries, $fullSyncOnly)\n    {\n        $this->send_getLinkedNotebookSyncChunk($authenticationToken, $linkedNotebook, $afterUSN, $maxEntries, $fullSyncOnly);\n        return $this->recv_getLinkedNotebookSyncChunk();\n    }\n\n    public function send_getLinkedNotebookSyncChunk($authenticationToken, \\EDAM\\Types\\LinkedNotebook $linkedNotebook, $afterUSN, $maxEntries, $fullSyncOnly)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_getLinkedNotebookSyncChunk_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->linkedNotebook = $linkedNotebook;\n        $args->afterUSN = $afterUSN;\n        $args->maxEntries = $maxEntries;\n        $args->fullSyncOnly = $fullSyncOnly;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'getLinkedNotebookSyncChunk', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('getLinkedNotebookSyncChunk', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_getLinkedNotebookSyncChunk()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_getLinkedNotebookSyncChunk_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_getLinkedNotebookSyncChunk_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        throw new \\Exception(\"getLinkedNotebookSyncChunk failed: unknown result\");\n    }\n\n    public function listNotebooks($authenticationToken)\n    {\n        $this->send_listNotebooks($authenticationToken);\n        return $this->recv_listNotebooks();\n    }\n\n    public function send_listNotebooks($authenticationToken)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_listNotebooks_args();\n        $args->authenticationToken = $authenticationToken;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'listNotebooks', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('listNotebooks', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_listNotebooks()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_listNotebooks_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_listNotebooks_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        throw new \\Exception(\"listNotebooks failed: unknown result\");\n    }\n\n    public function getNotebook($authenticationToken, $guid)\n    {\n        $this->send_getNotebook($authenticationToken, $guid);\n        return $this->recv_getNotebook();\n    }\n\n    public function send_getNotebook($authenticationToken, $guid)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_getNotebook_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->guid = $guid;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'getNotebook', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('getNotebook', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_getNotebook()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_getNotebook_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_getNotebook_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        throw new \\Exception(\"getNotebook failed: unknown result\");\n    }\n\n    public function getDefaultNotebook($authenticationToken)\n    {\n        $this->send_getDefaultNotebook($authenticationToken);\n        return $this->recv_getDefaultNotebook();\n    }\n\n    public function send_getDefaultNotebook($authenticationToken)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_getDefaultNotebook_args();\n        $args->authenticationToken = $authenticationToken;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'getDefaultNotebook', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('getDefaultNotebook', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_getDefaultNotebook()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_getDefaultNotebook_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_getDefaultNotebook_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        throw new \\Exception(\"getDefaultNotebook failed: unknown result\");\n    }\n\n    public function createNotebook($authenticationToken, \\EDAM\\Types\\Notebook $notebook)\n    {\n        $this->send_createNotebook($authenticationToken, $notebook);\n        return $this->recv_createNotebook();\n    }\n\n    public function send_createNotebook($authenticationToken, \\EDAM\\Types\\Notebook $notebook)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_createNotebook_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->notebook = $notebook;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'createNotebook', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('createNotebook', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_createNotebook()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_createNotebook_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_createNotebook_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        throw new \\Exception(\"createNotebook failed: unknown result\");\n    }\n\n    public function updateNotebook($authenticationToken, \\EDAM\\Types\\Notebook $notebook)\n    {\n        $this->send_updateNotebook($authenticationToken, $notebook);\n        return $this->recv_updateNotebook();\n    }\n\n    public function send_updateNotebook($authenticationToken, \\EDAM\\Types\\Notebook $notebook)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_updateNotebook_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->notebook = $notebook;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'updateNotebook', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('updateNotebook', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_updateNotebook()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_updateNotebook_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_updateNotebook_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        throw new \\Exception(\"updateNotebook failed: unknown result\");\n    }\n\n    public function expungeNotebook($authenticationToken, $guid)\n    {\n        $this->send_expungeNotebook($authenticationToken, $guid);\n        return $this->recv_expungeNotebook();\n    }\n\n    public function send_expungeNotebook($authenticationToken, $guid)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_expungeNotebook_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->guid = $guid;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'expungeNotebook', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('expungeNotebook', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_expungeNotebook()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_expungeNotebook_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_expungeNotebook_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        throw new \\Exception(\"expungeNotebook failed: unknown result\");\n    }\n\n    public function listTags($authenticationToken)\n    {\n        $this->send_listTags($authenticationToken);\n        return $this->recv_listTags();\n    }\n\n    public function send_listTags($authenticationToken)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_listTags_args();\n        $args->authenticationToken = $authenticationToken;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'listTags', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('listTags', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_listTags()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_listTags_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_listTags_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        throw new \\Exception(\"listTags failed: unknown result\");\n    }\n\n    public function listTagsByNotebook($authenticationToken, $notebookGuid)\n    {\n        $this->send_listTagsByNotebook($authenticationToken, $notebookGuid);\n        return $this->recv_listTagsByNotebook();\n    }\n\n    public function send_listTagsByNotebook($authenticationToken, $notebookGuid)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_listTagsByNotebook_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->notebookGuid = $notebookGuid;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'listTagsByNotebook', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('listTagsByNotebook', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_listTagsByNotebook()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_listTagsByNotebook_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_listTagsByNotebook_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        throw new \\Exception(\"listTagsByNotebook failed: unknown result\");\n    }\n\n    public function getTag($authenticationToken, $guid)\n    {\n        $this->send_getTag($authenticationToken, $guid);\n        return $this->recv_getTag();\n    }\n\n    public function send_getTag($authenticationToken, $guid)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_getTag_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->guid = $guid;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'getTag', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('getTag', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_getTag()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_getTag_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_getTag_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        throw new \\Exception(\"getTag failed: unknown result\");\n    }\n\n    public function createTag($authenticationToken, \\EDAM\\Types\\Tag $tag)\n    {\n        $this->send_createTag($authenticationToken, $tag);\n        return $this->recv_createTag();\n    }\n\n    public function send_createTag($authenticationToken, \\EDAM\\Types\\Tag $tag)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_createTag_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->tag = $tag;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'createTag', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('createTag', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_createTag()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_createTag_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_createTag_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        throw new \\Exception(\"createTag failed: unknown result\");\n    }\n\n    public function updateTag($authenticationToken, \\EDAM\\Types\\Tag $tag)\n    {\n        $this->send_updateTag($authenticationToken, $tag);\n        return $this->recv_updateTag();\n    }\n\n    public function send_updateTag($authenticationToken, \\EDAM\\Types\\Tag $tag)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_updateTag_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->tag = $tag;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'updateTag', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('updateTag', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_updateTag()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_updateTag_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_updateTag_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        throw new \\Exception(\"updateTag failed: unknown result\");\n    }\n\n    public function untagAll($authenticationToken, $guid)\n    {\n        $this->send_untagAll($authenticationToken, $guid);\n        $this->recv_untagAll();\n    }\n\n    public function send_untagAll($authenticationToken, $guid)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_untagAll_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->guid = $guid;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'untagAll', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('untagAll', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_untagAll()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_untagAll_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_untagAll_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        return;\n    }\n\n    public function expungeTag($authenticationToken, $guid)\n    {\n        $this->send_expungeTag($authenticationToken, $guid);\n        return $this->recv_expungeTag();\n    }\n\n    public function send_expungeTag($authenticationToken, $guid)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_expungeTag_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->guid = $guid;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'expungeTag', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('expungeTag', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_expungeTag()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_expungeTag_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_expungeTag_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        throw new \\Exception(\"expungeTag failed: unknown result\");\n    }\n\n    public function listSearches($authenticationToken)\n    {\n        $this->send_listSearches($authenticationToken);\n        return $this->recv_listSearches();\n    }\n\n    public function send_listSearches($authenticationToken)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_listSearches_args();\n        $args->authenticationToken = $authenticationToken;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'listSearches', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('listSearches', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_listSearches()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_listSearches_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_listSearches_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        throw new \\Exception(\"listSearches failed: unknown result\");\n    }\n\n    public function getSearch($authenticationToken, $guid)\n    {\n        $this->send_getSearch($authenticationToken, $guid);\n        return $this->recv_getSearch();\n    }\n\n    public function send_getSearch($authenticationToken, $guid)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_getSearch_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->guid = $guid;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'getSearch', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('getSearch', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_getSearch()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_getSearch_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_getSearch_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        throw new \\Exception(\"getSearch failed: unknown result\");\n    }\n\n    public function createSearch($authenticationToken, \\EDAM\\Types\\SavedSearch $search)\n    {\n        $this->send_createSearch($authenticationToken, $search);\n        return $this->recv_createSearch();\n    }\n\n    public function send_createSearch($authenticationToken, \\EDAM\\Types\\SavedSearch $search)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_createSearch_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->search = $search;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'createSearch', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('createSearch', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_createSearch()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_createSearch_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_createSearch_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        throw new \\Exception(\"createSearch failed: unknown result\");\n    }\n\n    public function updateSearch($authenticationToken, \\EDAM\\Types\\SavedSearch $search)\n    {\n        $this->send_updateSearch($authenticationToken, $search);\n        return $this->recv_updateSearch();\n    }\n\n    public function send_updateSearch($authenticationToken, \\EDAM\\Types\\SavedSearch $search)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_updateSearch_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->search = $search;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'updateSearch', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('updateSearch', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_updateSearch()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_updateSearch_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_updateSearch_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        throw new \\Exception(\"updateSearch failed: unknown result\");\n    }\n\n    public function expungeSearch($authenticationToken, $guid)\n    {\n        $this->send_expungeSearch($authenticationToken, $guid);\n        return $this->recv_expungeSearch();\n    }\n\n    public function send_expungeSearch($authenticationToken, $guid)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_expungeSearch_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->guid = $guid;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'expungeSearch', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('expungeSearch', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_expungeSearch()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_expungeSearch_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_expungeSearch_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        throw new \\Exception(\"expungeSearch failed: unknown result\");\n    }\n\n    public function findNotes($authenticationToken, \\EDAM\\NoteStore\\NoteFilter $filter, $offset, $maxNotes)\n    {\n        $this->send_findNotes($authenticationToken, $filter, $offset, $maxNotes);\n        return $this->recv_findNotes();\n    }\n\n    public function send_findNotes($authenticationToken, \\EDAM\\NoteStore\\NoteFilter $filter, $offset, $maxNotes)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_findNotes_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->filter = $filter;\n        $args->offset = $offset;\n        $args->maxNotes = $maxNotes;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'findNotes', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('findNotes', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_findNotes()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_findNotes_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_findNotes_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        throw new \\Exception(\"findNotes failed: unknown result\");\n    }\n\n    public function findNoteOffset($authenticationToken, \\EDAM\\NoteStore\\NoteFilter $filter, $guid)\n    {\n        $this->send_findNoteOffset($authenticationToken, $filter, $guid);\n        return $this->recv_findNoteOffset();\n    }\n\n    public function send_findNoteOffset($authenticationToken, \\EDAM\\NoteStore\\NoteFilter $filter, $guid)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_findNoteOffset_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->filter = $filter;\n        $args->guid = $guid;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'findNoteOffset', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('findNoteOffset', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_findNoteOffset()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_findNoteOffset_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_findNoteOffset_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        throw new \\Exception(\"findNoteOffset failed: unknown result\");\n    }\n\n    public function findNotesMetadata($authenticationToken, \\EDAM\\NoteStore\\NoteFilter $filter, $offset, $maxNotes, \\EDAM\\NoteStore\\NotesMetadataResultSpec $resultSpec)\n    {\n        $this->send_findNotesMetadata($authenticationToken, $filter, $offset, $maxNotes, $resultSpec);\n        return $this->recv_findNotesMetadata();\n    }\n\n    public function send_findNotesMetadata($authenticationToken, \\EDAM\\NoteStore\\NoteFilter $filter, $offset, $maxNotes, \\EDAM\\NoteStore\\NotesMetadataResultSpec $resultSpec)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_findNotesMetadata_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->filter = $filter;\n        $args->offset = $offset;\n        $args->maxNotes = $maxNotes;\n        $args->resultSpec = $resultSpec;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'findNotesMetadata', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('findNotesMetadata', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_findNotesMetadata()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_findNotesMetadata_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_findNotesMetadata_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        throw new \\Exception(\"findNotesMetadata failed: unknown result\");\n    }\n\n    public function findNoteCounts($authenticationToken, \\EDAM\\NoteStore\\NoteFilter $filter, $withTrash)\n    {\n        $this->send_findNoteCounts($authenticationToken, $filter, $withTrash);\n        return $this->recv_findNoteCounts();\n    }\n\n    public function send_findNoteCounts($authenticationToken, \\EDAM\\NoteStore\\NoteFilter $filter, $withTrash)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_findNoteCounts_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->filter = $filter;\n        $args->withTrash = $withTrash;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'findNoteCounts', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('findNoteCounts', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_findNoteCounts()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_findNoteCounts_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_findNoteCounts_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        throw new \\Exception(\"findNoteCounts failed: unknown result\");\n    }\n\n    public function getNote($authenticationToken, $guid, $withContent, $withResourcesData, $withResourcesRecognition, $withResourcesAlternateData)\n    {\n        $this->send_getNote($authenticationToken, $guid, $withContent, $withResourcesData, $withResourcesRecognition, $withResourcesAlternateData);\n        return $this->recv_getNote();\n    }\n\n    public function send_getNote($authenticationToken, $guid, $withContent, $withResourcesData, $withResourcesRecognition, $withResourcesAlternateData)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_getNote_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->guid = $guid;\n        $args->withContent = $withContent;\n        $args->withResourcesData = $withResourcesData;\n        $args->withResourcesRecognition = $withResourcesRecognition;\n        $args->withResourcesAlternateData = $withResourcesAlternateData;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'getNote', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('getNote', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_getNote()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_getNote_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_getNote_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        throw new \\Exception(\"getNote failed: unknown result\");\n    }\n\n    public function getNoteApplicationData($authenticationToken, $guid)\n    {\n        $this->send_getNoteApplicationData($authenticationToken, $guid);\n        return $this->recv_getNoteApplicationData();\n    }\n\n    public function send_getNoteApplicationData($authenticationToken, $guid)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_getNoteApplicationData_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->guid = $guid;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'getNoteApplicationData', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('getNoteApplicationData', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_getNoteApplicationData()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_getNoteApplicationData_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_getNoteApplicationData_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        throw new \\Exception(\"getNoteApplicationData failed: unknown result\");\n    }\n\n    public function getNoteApplicationDataEntry($authenticationToken, $guid, $key)\n    {\n        $this->send_getNoteApplicationDataEntry($authenticationToken, $guid, $key);\n        return $this->recv_getNoteApplicationDataEntry();\n    }\n\n    public function send_getNoteApplicationDataEntry($authenticationToken, $guid, $key)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_getNoteApplicationDataEntry_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->guid = $guid;\n        $args->key = $key;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'getNoteApplicationDataEntry', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('getNoteApplicationDataEntry', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_getNoteApplicationDataEntry()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_getNoteApplicationDataEntry_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_getNoteApplicationDataEntry_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        throw new \\Exception(\"getNoteApplicationDataEntry failed: unknown result\");\n    }\n\n    public function setNoteApplicationDataEntry($authenticationToken, $guid, $key, $value)\n    {\n        $this->send_setNoteApplicationDataEntry($authenticationToken, $guid, $key, $value);\n        return $this->recv_setNoteApplicationDataEntry();\n    }\n\n    public function send_setNoteApplicationDataEntry($authenticationToken, $guid, $key, $value)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_setNoteApplicationDataEntry_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->guid = $guid;\n        $args->key = $key;\n        $args->value = $value;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'setNoteApplicationDataEntry', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('setNoteApplicationDataEntry', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_setNoteApplicationDataEntry()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_setNoteApplicationDataEntry_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_setNoteApplicationDataEntry_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        throw new \\Exception(\"setNoteApplicationDataEntry failed: unknown result\");\n    }\n\n    public function unsetNoteApplicationDataEntry($authenticationToken, $guid, $key)\n    {\n        $this->send_unsetNoteApplicationDataEntry($authenticationToken, $guid, $key);\n        return $this->recv_unsetNoteApplicationDataEntry();\n    }\n\n    public function send_unsetNoteApplicationDataEntry($authenticationToken, $guid, $key)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_unsetNoteApplicationDataEntry_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->guid = $guid;\n        $args->key = $key;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'unsetNoteApplicationDataEntry', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('unsetNoteApplicationDataEntry', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_unsetNoteApplicationDataEntry()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_unsetNoteApplicationDataEntry_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_unsetNoteApplicationDataEntry_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        throw new \\Exception(\"unsetNoteApplicationDataEntry failed: unknown result\");\n    }\n\n    public function getNoteContent($authenticationToken, $guid)\n    {\n        $this->send_getNoteContent($authenticationToken, $guid);\n        return $this->recv_getNoteContent();\n    }\n\n    public function send_getNoteContent($authenticationToken, $guid)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_getNoteContent_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->guid = $guid;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'getNoteContent', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('getNoteContent', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_getNoteContent()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_getNoteContent_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_getNoteContent_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        throw new \\Exception(\"getNoteContent failed: unknown result\");\n    }\n\n    public function getNoteSearchText($authenticationToken, $guid, $noteOnly, $tokenizeForIndexing)\n    {\n        $this->send_getNoteSearchText($authenticationToken, $guid, $noteOnly, $tokenizeForIndexing);\n        return $this->recv_getNoteSearchText();\n    }\n\n    public function send_getNoteSearchText($authenticationToken, $guid, $noteOnly, $tokenizeForIndexing)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_getNoteSearchText_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->guid = $guid;\n        $args->noteOnly = $noteOnly;\n        $args->tokenizeForIndexing = $tokenizeForIndexing;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'getNoteSearchText', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('getNoteSearchText', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_getNoteSearchText()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_getNoteSearchText_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_getNoteSearchText_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        throw new \\Exception(\"getNoteSearchText failed: unknown result\");\n    }\n\n    public function getResourceSearchText($authenticationToken, $guid)\n    {\n        $this->send_getResourceSearchText($authenticationToken, $guid);\n        return $this->recv_getResourceSearchText();\n    }\n\n    public function send_getResourceSearchText($authenticationToken, $guid)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_getResourceSearchText_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->guid = $guid;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'getResourceSearchText', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('getResourceSearchText', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_getResourceSearchText()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_getResourceSearchText_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_getResourceSearchText_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        throw new \\Exception(\"getResourceSearchText failed: unknown result\");\n    }\n\n    public function getNoteTagNames($authenticationToken, $guid)\n    {\n        $this->send_getNoteTagNames($authenticationToken, $guid);\n        return $this->recv_getNoteTagNames();\n    }\n\n    public function send_getNoteTagNames($authenticationToken, $guid)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_getNoteTagNames_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->guid = $guid;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'getNoteTagNames', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('getNoteTagNames', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_getNoteTagNames()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_getNoteTagNames_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_getNoteTagNames_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        throw new \\Exception(\"getNoteTagNames failed: unknown result\");\n    }\n\n    public function createNote($authenticationToken, \\EDAM\\Types\\Note $note)\n    {\n        $this->send_createNote($authenticationToken, $note);\n        return $this->recv_createNote();\n    }\n\n    public function send_createNote($authenticationToken, \\EDAM\\Types\\Note $note)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_createNote_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->note = $note;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'createNote', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('createNote', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_createNote()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_createNote_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_createNote_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        throw new \\Exception(\"createNote failed: unknown result\");\n    }\n\n    public function updateNote($authenticationToken, \\EDAM\\Types\\Note $note)\n    {\n        $this->send_updateNote($authenticationToken, $note);\n        return $this->recv_updateNote();\n    }\n\n    public function send_updateNote($authenticationToken, \\EDAM\\Types\\Note $note)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_updateNote_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->note = $note;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'updateNote', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('updateNote', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_updateNote()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_updateNote_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_updateNote_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        throw new \\Exception(\"updateNote failed: unknown result\");\n    }\n\n    public function deleteNote($authenticationToken, $guid)\n    {\n        $this->send_deleteNote($authenticationToken, $guid);\n        return $this->recv_deleteNote();\n    }\n\n    public function send_deleteNote($authenticationToken, $guid)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_deleteNote_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->guid = $guid;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'deleteNote', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('deleteNote', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_deleteNote()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_deleteNote_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_deleteNote_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        throw new \\Exception(\"deleteNote failed: unknown result\");\n    }\n\n    public function expungeNote($authenticationToken, $guid)\n    {\n        $this->send_expungeNote($authenticationToken, $guid);\n        return $this->recv_expungeNote();\n    }\n\n    public function send_expungeNote($authenticationToken, $guid)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_expungeNote_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->guid = $guid;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'expungeNote', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('expungeNote', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_expungeNote()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_expungeNote_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_expungeNote_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        throw new \\Exception(\"expungeNote failed: unknown result\");\n    }\n\n    public function expungeNotes($authenticationToken, $noteGuids)\n    {\n        $this->send_expungeNotes($authenticationToken, $noteGuids);\n        return $this->recv_expungeNotes();\n    }\n\n    public function send_expungeNotes($authenticationToken, $noteGuids)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_expungeNotes_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->noteGuids = $noteGuids;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'expungeNotes', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('expungeNotes', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_expungeNotes()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_expungeNotes_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_expungeNotes_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        throw new \\Exception(\"expungeNotes failed: unknown result\");\n    }\n\n    public function expungeInactiveNotes($authenticationToken)\n    {\n        $this->send_expungeInactiveNotes($authenticationToken);\n        return $this->recv_expungeInactiveNotes();\n    }\n\n    public function send_expungeInactiveNotes($authenticationToken)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_expungeInactiveNotes_args();\n        $args->authenticationToken = $authenticationToken;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'expungeInactiveNotes', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('expungeInactiveNotes', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_expungeInactiveNotes()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_expungeInactiveNotes_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_expungeInactiveNotes_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        throw new \\Exception(\"expungeInactiveNotes failed: unknown result\");\n    }\n\n    public function copyNote($authenticationToken, $noteGuid, $toNotebookGuid)\n    {\n        $this->send_copyNote($authenticationToken, $noteGuid, $toNotebookGuid);\n        return $this->recv_copyNote();\n    }\n\n    public function send_copyNote($authenticationToken, $noteGuid, $toNotebookGuid)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_copyNote_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->noteGuid = $noteGuid;\n        $args->toNotebookGuid = $toNotebookGuid;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'copyNote', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('copyNote', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_copyNote()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_copyNote_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_copyNote_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        throw new \\Exception(\"copyNote failed: unknown result\");\n    }\n\n    public function listNoteVersions($authenticationToken, $noteGuid)\n    {\n        $this->send_listNoteVersions($authenticationToken, $noteGuid);\n        return $this->recv_listNoteVersions();\n    }\n\n    public function send_listNoteVersions($authenticationToken, $noteGuid)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_listNoteVersions_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->noteGuid = $noteGuid;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'listNoteVersions', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('listNoteVersions', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_listNoteVersions()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_listNoteVersions_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_listNoteVersions_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        throw new \\Exception(\"listNoteVersions failed: unknown result\");\n    }\n\n    public function getNoteVersion($authenticationToken, $noteGuid, $updateSequenceNum, $withResourcesData, $withResourcesRecognition, $withResourcesAlternateData)\n    {\n        $this->send_getNoteVersion($authenticationToken, $noteGuid, $updateSequenceNum, $withResourcesData, $withResourcesRecognition, $withResourcesAlternateData);\n        return $this->recv_getNoteVersion();\n    }\n\n    public function send_getNoteVersion($authenticationToken, $noteGuid, $updateSequenceNum, $withResourcesData, $withResourcesRecognition, $withResourcesAlternateData)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_getNoteVersion_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->noteGuid = $noteGuid;\n        $args->updateSequenceNum = $updateSequenceNum;\n        $args->withResourcesData = $withResourcesData;\n        $args->withResourcesRecognition = $withResourcesRecognition;\n        $args->withResourcesAlternateData = $withResourcesAlternateData;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'getNoteVersion', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('getNoteVersion', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_getNoteVersion()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_getNoteVersion_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_getNoteVersion_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        throw new \\Exception(\"getNoteVersion failed: unknown result\");\n    }\n\n    public function getResource($authenticationToken, $guid, $withData, $withRecognition, $withAttributes, $withAlternateData)\n    {\n        $this->send_getResource($authenticationToken, $guid, $withData, $withRecognition, $withAttributes, $withAlternateData);\n        return $this->recv_getResource();\n    }\n\n    public function send_getResource($authenticationToken, $guid, $withData, $withRecognition, $withAttributes, $withAlternateData)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_getResource_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->guid = $guid;\n        $args->withData = $withData;\n        $args->withRecognition = $withRecognition;\n        $args->withAttributes = $withAttributes;\n        $args->withAlternateData = $withAlternateData;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'getResource', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('getResource', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_getResource()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_getResource_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_getResource_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        throw new \\Exception(\"getResource failed: unknown result\");\n    }\n\n    public function getResourceApplicationData($authenticationToken, $guid)\n    {\n        $this->send_getResourceApplicationData($authenticationToken, $guid);\n        return $this->recv_getResourceApplicationData();\n    }\n\n    public function send_getResourceApplicationData($authenticationToken, $guid)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_getResourceApplicationData_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->guid = $guid;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'getResourceApplicationData', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('getResourceApplicationData', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_getResourceApplicationData()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_getResourceApplicationData_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_getResourceApplicationData_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        throw new \\Exception(\"getResourceApplicationData failed: unknown result\");\n    }\n\n    public function getResourceApplicationDataEntry($authenticationToken, $guid, $key)\n    {\n        $this->send_getResourceApplicationDataEntry($authenticationToken, $guid, $key);\n        return $this->recv_getResourceApplicationDataEntry();\n    }\n\n    public function send_getResourceApplicationDataEntry($authenticationToken, $guid, $key)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_getResourceApplicationDataEntry_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->guid = $guid;\n        $args->key = $key;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'getResourceApplicationDataEntry', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('getResourceApplicationDataEntry', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_getResourceApplicationDataEntry()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_getResourceApplicationDataEntry_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_getResourceApplicationDataEntry_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        throw new \\Exception(\"getResourceApplicationDataEntry failed: unknown result\");\n    }\n\n    public function setResourceApplicationDataEntry($authenticationToken, $guid, $key, $value)\n    {\n        $this->send_setResourceApplicationDataEntry($authenticationToken, $guid, $key, $value);\n        return $this->recv_setResourceApplicationDataEntry();\n    }\n\n    public function send_setResourceApplicationDataEntry($authenticationToken, $guid, $key, $value)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_setResourceApplicationDataEntry_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->guid = $guid;\n        $args->key = $key;\n        $args->value = $value;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'setResourceApplicationDataEntry', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('setResourceApplicationDataEntry', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_setResourceApplicationDataEntry()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_setResourceApplicationDataEntry_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_setResourceApplicationDataEntry_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        throw new \\Exception(\"setResourceApplicationDataEntry failed: unknown result\");\n    }\n\n    public function unsetResourceApplicationDataEntry($authenticationToken, $guid, $key)\n    {\n        $this->send_unsetResourceApplicationDataEntry($authenticationToken, $guid, $key);\n        return $this->recv_unsetResourceApplicationDataEntry();\n    }\n\n    public function send_unsetResourceApplicationDataEntry($authenticationToken, $guid, $key)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_unsetResourceApplicationDataEntry_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->guid = $guid;\n        $args->key = $key;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'unsetResourceApplicationDataEntry', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('unsetResourceApplicationDataEntry', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_unsetResourceApplicationDataEntry()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_unsetResourceApplicationDataEntry_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_unsetResourceApplicationDataEntry_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        throw new \\Exception(\"unsetResourceApplicationDataEntry failed: unknown result\");\n    }\n\n    public function updateResource($authenticationToken, \\EDAM\\Types\\Resource $resource)\n    {\n        $this->send_updateResource($authenticationToken, $resource);\n        return $this->recv_updateResource();\n    }\n\n    public function send_updateResource($authenticationToken, \\EDAM\\Types\\Resource $resource)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_updateResource_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->resource = $resource;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'updateResource', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('updateResource', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_updateResource()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_updateResource_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_updateResource_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        throw new \\Exception(\"updateResource failed: unknown result\");\n    }\n\n    public function getResourceData($authenticationToken, $guid)\n    {\n        $this->send_getResourceData($authenticationToken, $guid);\n        return $this->recv_getResourceData();\n    }\n\n    public function send_getResourceData($authenticationToken, $guid)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_getResourceData_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->guid = $guid;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'getResourceData', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('getResourceData', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_getResourceData()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_getResourceData_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_getResourceData_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        throw new \\Exception(\"getResourceData failed: unknown result\");\n    }\n\n    public function getResourceByHash($authenticationToken, $noteGuid, $contentHash, $withData, $withRecognition, $withAlternateData)\n    {\n        $this->send_getResourceByHash($authenticationToken, $noteGuid, $contentHash, $withData, $withRecognition, $withAlternateData);\n        return $this->recv_getResourceByHash();\n    }\n\n    public function send_getResourceByHash($authenticationToken, $noteGuid, $contentHash, $withData, $withRecognition, $withAlternateData)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_getResourceByHash_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->noteGuid = $noteGuid;\n        $args->contentHash = $contentHash;\n        $args->withData = $withData;\n        $args->withRecognition = $withRecognition;\n        $args->withAlternateData = $withAlternateData;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'getResourceByHash', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('getResourceByHash', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_getResourceByHash()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_getResourceByHash_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_getResourceByHash_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        throw new \\Exception(\"getResourceByHash failed: unknown result\");\n    }\n\n    public function getResourceRecognition($authenticationToken, $guid)\n    {\n        $this->send_getResourceRecognition($authenticationToken, $guid);\n        return $this->recv_getResourceRecognition();\n    }\n\n    public function send_getResourceRecognition($authenticationToken, $guid)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_getResourceRecognition_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->guid = $guid;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'getResourceRecognition', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('getResourceRecognition', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_getResourceRecognition()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_getResourceRecognition_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_getResourceRecognition_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        throw new \\Exception(\"getResourceRecognition failed: unknown result\");\n    }\n\n    public function getResourceAlternateData($authenticationToken, $guid)\n    {\n        $this->send_getResourceAlternateData($authenticationToken, $guid);\n        return $this->recv_getResourceAlternateData();\n    }\n\n    public function send_getResourceAlternateData($authenticationToken, $guid)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_getResourceAlternateData_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->guid = $guid;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'getResourceAlternateData', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('getResourceAlternateData', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_getResourceAlternateData()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_getResourceAlternateData_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_getResourceAlternateData_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        throw new \\Exception(\"getResourceAlternateData failed: unknown result\");\n    }\n\n    public function getResourceAttributes($authenticationToken, $guid)\n    {\n        $this->send_getResourceAttributes($authenticationToken, $guid);\n        return $this->recv_getResourceAttributes();\n    }\n\n    public function send_getResourceAttributes($authenticationToken, $guid)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_getResourceAttributes_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->guid = $guid;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'getResourceAttributes', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('getResourceAttributes', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_getResourceAttributes()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_getResourceAttributes_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_getResourceAttributes_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        throw new \\Exception(\"getResourceAttributes failed: unknown result\");\n    }\n\n    public function getPublicNotebook($userId, $publicUri)\n    {\n        $this->send_getPublicNotebook($userId, $publicUri);\n        return $this->recv_getPublicNotebook();\n    }\n\n    public function send_getPublicNotebook($userId, $publicUri)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_getPublicNotebook_args();\n        $args->userId = $userId;\n        $args->publicUri = $publicUri;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'getPublicNotebook', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('getPublicNotebook', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_getPublicNotebook()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_getPublicNotebook_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_getPublicNotebook_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        throw new \\Exception(\"getPublicNotebook failed: unknown result\");\n    }\n\n    public function createSharedNotebook($authenticationToken, \\EDAM\\Types\\SharedNotebook $sharedNotebook)\n    {\n        $this->send_createSharedNotebook($authenticationToken, $sharedNotebook);\n        return $this->recv_createSharedNotebook();\n    }\n\n    public function send_createSharedNotebook($authenticationToken, \\EDAM\\Types\\SharedNotebook $sharedNotebook)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_createSharedNotebook_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->sharedNotebook = $sharedNotebook;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'createSharedNotebook', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('createSharedNotebook', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_createSharedNotebook()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_createSharedNotebook_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_createSharedNotebook_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        throw new \\Exception(\"createSharedNotebook failed: unknown result\");\n    }\n\n    public function updateSharedNotebook($authenticationToken, \\EDAM\\Types\\SharedNotebook $sharedNotebook)\n    {\n        $this->send_updateSharedNotebook($authenticationToken, $sharedNotebook);\n        return $this->recv_updateSharedNotebook();\n    }\n\n    public function send_updateSharedNotebook($authenticationToken, \\EDAM\\Types\\SharedNotebook $sharedNotebook)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_updateSharedNotebook_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->sharedNotebook = $sharedNotebook;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'updateSharedNotebook', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('updateSharedNotebook', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_updateSharedNotebook()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_updateSharedNotebook_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_updateSharedNotebook_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        throw new \\Exception(\"updateSharedNotebook failed: unknown result\");\n    }\n\n    public function setSharedNotebookRecipientSettings($authenticationToken, $sharedNotebookId, \\EDAM\\Types\\SharedNotebookRecipientSettings $recipientSettings)\n    {\n        $this->send_setSharedNotebookRecipientSettings($authenticationToken, $sharedNotebookId, $recipientSettings);\n        return $this->recv_setSharedNotebookRecipientSettings();\n    }\n\n    public function send_setSharedNotebookRecipientSettings($authenticationToken, $sharedNotebookId, \\EDAM\\Types\\SharedNotebookRecipientSettings $recipientSettings)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_setSharedNotebookRecipientSettings_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->sharedNotebookId = $sharedNotebookId;\n        $args->recipientSettings = $recipientSettings;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'setSharedNotebookRecipientSettings', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('setSharedNotebookRecipientSettings', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_setSharedNotebookRecipientSettings()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_setSharedNotebookRecipientSettings_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_setSharedNotebookRecipientSettings_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        throw new \\Exception(\"setSharedNotebookRecipientSettings failed: unknown result\");\n    }\n\n    public function sendMessageToSharedNotebookMembers($authenticationToken, $notebookGuid, $messageText, $recipients)\n    {\n        $this->send_sendMessageToSharedNotebookMembers($authenticationToken, $notebookGuid, $messageText, $recipients);\n        return $this->recv_sendMessageToSharedNotebookMembers();\n    }\n\n    public function send_sendMessageToSharedNotebookMembers($authenticationToken, $notebookGuid, $messageText, $recipients)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_sendMessageToSharedNotebookMembers_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->notebookGuid = $notebookGuid;\n        $args->messageText = $messageText;\n        $args->recipients = $recipients;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'sendMessageToSharedNotebookMembers', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('sendMessageToSharedNotebookMembers', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_sendMessageToSharedNotebookMembers()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_sendMessageToSharedNotebookMembers_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_sendMessageToSharedNotebookMembers_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        throw new \\Exception(\"sendMessageToSharedNotebookMembers failed: unknown result\");\n    }\n\n    public function listSharedNotebooks($authenticationToken)\n    {\n        $this->send_listSharedNotebooks($authenticationToken);\n        return $this->recv_listSharedNotebooks();\n    }\n\n    public function send_listSharedNotebooks($authenticationToken)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_listSharedNotebooks_args();\n        $args->authenticationToken = $authenticationToken;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'listSharedNotebooks', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('listSharedNotebooks', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_listSharedNotebooks()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_listSharedNotebooks_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_listSharedNotebooks_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        throw new \\Exception(\"listSharedNotebooks failed: unknown result\");\n    }\n\n    public function expungeSharedNotebooks($authenticationToken, $sharedNotebookIds)\n    {\n        $this->send_expungeSharedNotebooks($authenticationToken, $sharedNotebookIds);\n        return $this->recv_expungeSharedNotebooks();\n    }\n\n    public function send_expungeSharedNotebooks($authenticationToken, $sharedNotebookIds)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_expungeSharedNotebooks_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->sharedNotebookIds = $sharedNotebookIds;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'expungeSharedNotebooks', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('expungeSharedNotebooks', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_expungeSharedNotebooks()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_expungeSharedNotebooks_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_expungeSharedNotebooks_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        throw new \\Exception(\"expungeSharedNotebooks failed: unknown result\");\n    }\n\n    public function createLinkedNotebook($authenticationToken, \\EDAM\\Types\\LinkedNotebook $linkedNotebook)\n    {\n        $this->send_createLinkedNotebook($authenticationToken, $linkedNotebook);\n        return $this->recv_createLinkedNotebook();\n    }\n\n    public function send_createLinkedNotebook($authenticationToken, \\EDAM\\Types\\LinkedNotebook $linkedNotebook)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_createLinkedNotebook_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->linkedNotebook = $linkedNotebook;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'createLinkedNotebook', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('createLinkedNotebook', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_createLinkedNotebook()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_createLinkedNotebook_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_createLinkedNotebook_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        throw new \\Exception(\"createLinkedNotebook failed: unknown result\");\n    }\n\n    public function updateLinkedNotebook($authenticationToken, \\EDAM\\Types\\LinkedNotebook $linkedNotebook)\n    {\n        $this->send_updateLinkedNotebook($authenticationToken, $linkedNotebook);\n        return $this->recv_updateLinkedNotebook();\n    }\n\n    public function send_updateLinkedNotebook($authenticationToken, \\EDAM\\Types\\LinkedNotebook $linkedNotebook)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_updateLinkedNotebook_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->linkedNotebook = $linkedNotebook;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'updateLinkedNotebook', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('updateLinkedNotebook', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_updateLinkedNotebook()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_updateLinkedNotebook_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_updateLinkedNotebook_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        throw new \\Exception(\"updateLinkedNotebook failed: unknown result\");\n    }\n\n    public function listLinkedNotebooks($authenticationToken)\n    {\n        $this->send_listLinkedNotebooks($authenticationToken);\n        return $this->recv_listLinkedNotebooks();\n    }\n\n    public function send_listLinkedNotebooks($authenticationToken)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_listLinkedNotebooks_args();\n        $args->authenticationToken = $authenticationToken;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'listLinkedNotebooks', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('listLinkedNotebooks', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_listLinkedNotebooks()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_listLinkedNotebooks_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_listLinkedNotebooks_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        throw new \\Exception(\"listLinkedNotebooks failed: unknown result\");\n    }\n\n    public function expungeLinkedNotebook($authenticationToken, $guid)\n    {\n        $this->send_expungeLinkedNotebook($authenticationToken, $guid);\n        return $this->recv_expungeLinkedNotebook();\n    }\n\n    public function send_expungeLinkedNotebook($authenticationToken, $guid)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_expungeLinkedNotebook_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->guid = $guid;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'expungeLinkedNotebook', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('expungeLinkedNotebook', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_expungeLinkedNotebook()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_expungeLinkedNotebook_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_expungeLinkedNotebook_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        throw new \\Exception(\"expungeLinkedNotebook failed: unknown result\");\n    }\n\n    public function authenticateToSharedNotebook($shareKey, $authenticationToken)\n    {\n        $this->send_authenticateToSharedNotebook($shareKey, $authenticationToken);\n        return $this->recv_authenticateToSharedNotebook();\n    }\n\n    public function send_authenticateToSharedNotebook($shareKey, $authenticationToken)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_authenticateToSharedNotebook_args();\n        $args->shareKey = $shareKey;\n        $args->authenticationToken = $authenticationToken;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'authenticateToSharedNotebook', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('authenticateToSharedNotebook', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_authenticateToSharedNotebook()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_authenticateToSharedNotebook_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_authenticateToSharedNotebook_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        throw new \\Exception(\"authenticateToSharedNotebook failed: unknown result\");\n    }\n\n    public function getSharedNotebookByAuth($authenticationToken)\n    {\n        $this->send_getSharedNotebookByAuth($authenticationToken);\n        return $this->recv_getSharedNotebookByAuth();\n    }\n\n    public function send_getSharedNotebookByAuth($authenticationToken)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_getSharedNotebookByAuth_args();\n        $args->authenticationToken = $authenticationToken;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'getSharedNotebookByAuth', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('getSharedNotebookByAuth', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_getSharedNotebookByAuth()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_getSharedNotebookByAuth_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_getSharedNotebookByAuth_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        throw new \\Exception(\"getSharedNotebookByAuth failed: unknown result\");\n    }\n\n    public function emailNote($authenticationToken, \\EDAM\\NoteStore\\NoteEmailParameters $parameters)\n    {\n        $this->send_emailNote($authenticationToken, $parameters);\n        $this->recv_emailNote();\n    }\n\n    public function send_emailNote($authenticationToken, \\EDAM\\NoteStore\\NoteEmailParameters $parameters)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_emailNote_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->parameters = $parameters;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'emailNote', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('emailNote', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_emailNote()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_emailNote_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_emailNote_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        return;\n    }\n\n    public function shareNote($authenticationToken, $guid)\n    {\n        $this->send_shareNote($authenticationToken, $guid);\n        return $this->recv_shareNote();\n    }\n\n    public function send_shareNote($authenticationToken, $guid)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_shareNote_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->guid = $guid;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'shareNote', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('shareNote', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_shareNote()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_shareNote_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_shareNote_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        throw new \\Exception(\"shareNote failed: unknown result\");\n    }\n\n    public function stopSharingNote($authenticationToken, $guid)\n    {\n        $this->send_stopSharingNote($authenticationToken, $guid);\n        $this->recv_stopSharingNote();\n    }\n\n    public function send_stopSharingNote($authenticationToken, $guid)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_stopSharingNote_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->guid = $guid;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'stopSharingNote', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('stopSharingNote', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_stopSharingNote()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_stopSharingNote_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_stopSharingNote_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        return;\n    }\n\n    public function authenticateToSharedNote($guid, $noteKey, $authenticationToken)\n    {\n        $this->send_authenticateToSharedNote($guid, $noteKey, $authenticationToken);\n        return $this->recv_authenticateToSharedNote();\n    }\n\n    public function send_authenticateToSharedNote($guid, $noteKey, $authenticationToken)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_authenticateToSharedNote_args();\n        $args->guid = $guid;\n        $args->noteKey = $noteKey;\n        $args->authenticationToken = $authenticationToken;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'authenticateToSharedNote', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('authenticateToSharedNote', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_authenticateToSharedNote()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_authenticateToSharedNote_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_authenticateToSharedNote_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        throw new \\Exception(\"authenticateToSharedNote failed: unknown result\");\n    }\n\n    public function findRelated($authenticationToken, \\EDAM\\NoteStore\\RelatedQuery $query, \\EDAM\\NoteStore\\RelatedResultSpec $resultSpec)\n    {\n        $this->send_findRelated($authenticationToken, $query, $resultSpec);\n        return $this->recv_findRelated();\n    }\n\n    public function send_findRelated($authenticationToken, \\EDAM\\NoteStore\\RelatedQuery $query, \\EDAM\\NoteStore\\RelatedResultSpec $resultSpec)\n    {\n        $args = new \\EDAM\\NoteStore\\NoteStore_findRelated_args();\n        $args->authenticationToken = $authenticationToken;\n        $args->query = $query;\n        $args->resultSpec = $resultSpec;\n        $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n        if ($bin_accel)\n        {\n            thrift_protocol_write_binary($this->output_, 'findRelated', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n        }\n        else\n        {\n            $this->output_->writeMessageBegin('findRelated', TMessageType::CALL, $this->seqid_);\n            $args->write($this->output_);\n            $this->output_->writeMessageEnd();\n            $this->output_->getTransport()->flush();\n        }\n    }\n\n    public function recv_findRelated()\n    {\n        $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n        if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\NoteStore\\NoteStore_findRelated_result', $this->input_->isStrictRead());\n        else\n        {\n            $rseqid = 0;\n            $fname = null;\n            $mtype = 0;\n\n            $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n            if ($mtype == TMessageType::EXCEPTION) {\n                $x = new TApplicationException();\n                $x->read($this->input_);\n                $this->input_->readMessageEnd();\n                throw $x;\n            }\n            $result = new \\EDAM\\NoteStore\\NoteStore_findRelated_result();\n            $result->read($this->input_);\n            $this->input_->readMessageEnd();\n        }\n        if ($result->success !== null) {\n            return $result->success;\n        }\n        if ($result->userException !== null) {\n            throw $result->userException;\n        }\n        if ($result->systemException !== null) {\n            throw $result->systemException;\n        }\n        if ($result->notFoundException !== null) {\n            throw $result->notFoundException;\n        }\n        throw new \\Exception(\"findRelated failed: unknown result\");\n    }\n\n}\n\n\n// HELPER FUNCTIONS AND STRUCTURES\n\nclass NoteStore_getSyncState_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getSyncState_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getSyncState_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getSyncState_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\NoteStore\\SyncState',\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getSyncState_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRUCT) {\n            $this->success = new \\EDAM\\NoteStore\\SyncState();\n            $xfer += $this->success->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getSyncState_result');\n    if ($this->success !== null) {\n      if (!is_object($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);\n      $xfer += $this->success->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getSyncStateWithMetrics_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $clientMetrics = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'clientMetrics',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\NoteStore\\ClientUsageMetrics',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['clientMetrics'])) {\n        $this->clientMetrics = $vals['clientMetrics'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getSyncStateWithMetrics_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->clientMetrics = new \\EDAM\\NoteStore\\ClientUsageMetrics();\n            $xfer += $this->clientMetrics->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getSyncStateWithMetrics_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->clientMetrics !== null) {\n      if (!is_object($this->clientMetrics)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('clientMetrics', TType::STRUCT, 2);\n      $xfer += $this->clientMetrics->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getSyncStateWithMetrics_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\NoteStore\\SyncState',\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getSyncStateWithMetrics_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRUCT) {\n            $this->success = new \\EDAM\\NoteStore\\SyncState();\n            $xfer += $this->success->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getSyncStateWithMetrics_result');\n    if ($this->success !== null) {\n      if (!is_object($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);\n      $xfer += $this->success->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getSyncChunk_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $afterUSN = null;\n  public $maxEntries = null;\n  public $fullSyncOnly = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'afterUSN',\n          'type' => TType::I32,\n          ),\n        3 => array(\n          'var' => 'maxEntries',\n          'type' => TType::I32,\n          ),\n        4 => array(\n          'var' => 'fullSyncOnly',\n          'type' => TType::BOOL,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['afterUSN'])) {\n        $this->afterUSN = $vals['afterUSN'];\n      }\n      if (isset($vals['maxEntries'])) {\n        $this->maxEntries = $vals['maxEntries'];\n      }\n      if (isset($vals['fullSyncOnly'])) {\n        $this->fullSyncOnly = $vals['fullSyncOnly'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getSyncChunk_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->afterUSN);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->maxEntries);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 4:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->fullSyncOnly);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getSyncChunk_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->afterUSN !== null) {\n      $xfer += $output->writeFieldBegin('afterUSN', TType::I32, 2);\n      $xfer += $output->writeI32($this->afterUSN);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->maxEntries !== null) {\n      $xfer += $output->writeFieldBegin('maxEntries', TType::I32, 3);\n      $xfer += $output->writeI32($this->maxEntries);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->fullSyncOnly !== null) {\n      $xfer += $output->writeFieldBegin('fullSyncOnly', TType::BOOL, 4);\n      $xfer += $output->writeBool($this->fullSyncOnly);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getSyncChunk_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\NoteStore\\SyncChunk',\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getSyncChunk_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRUCT) {\n            $this->success = new \\EDAM\\NoteStore\\SyncChunk();\n            $xfer += $this->success->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getSyncChunk_result');\n    if ($this->success !== null) {\n      if (!is_object($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);\n      $xfer += $this->success->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getFilteredSyncChunk_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $afterUSN = null;\n  public $maxEntries = null;\n  public $filter = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'afterUSN',\n          'type' => TType::I32,\n          ),\n        3 => array(\n          'var' => 'maxEntries',\n          'type' => TType::I32,\n          ),\n        4 => array(\n          'var' => 'filter',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\NoteStore\\SyncChunkFilter',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['afterUSN'])) {\n        $this->afterUSN = $vals['afterUSN'];\n      }\n      if (isset($vals['maxEntries'])) {\n        $this->maxEntries = $vals['maxEntries'];\n      }\n      if (isset($vals['filter'])) {\n        $this->filter = $vals['filter'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getFilteredSyncChunk_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->afterUSN);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->maxEntries);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 4:\n          if ($ftype == TType::STRUCT) {\n            $this->filter = new \\EDAM\\NoteStore\\SyncChunkFilter();\n            $xfer += $this->filter->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getFilteredSyncChunk_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->afterUSN !== null) {\n      $xfer += $output->writeFieldBegin('afterUSN', TType::I32, 2);\n      $xfer += $output->writeI32($this->afterUSN);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->maxEntries !== null) {\n      $xfer += $output->writeFieldBegin('maxEntries', TType::I32, 3);\n      $xfer += $output->writeI32($this->maxEntries);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->filter !== null) {\n      if (!is_object($this->filter)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('filter', TType::STRUCT, 4);\n      $xfer += $this->filter->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getFilteredSyncChunk_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\NoteStore\\SyncChunk',\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getFilteredSyncChunk_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRUCT) {\n            $this->success = new \\EDAM\\NoteStore\\SyncChunk();\n            $xfer += $this->success->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getFilteredSyncChunk_result');\n    if ($this->success !== null) {\n      if (!is_object($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);\n      $xfer += $this->success->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getLinkedNotebookSyncState_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $linkedNotebook = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'linkedNotebook',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\LinkedNotebook',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['linkedNotebook'])) {\n        $this->linkedNotebook = $vals['linkedNotebook'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getLinkedNotebookSyncState_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->linkedNotebook = new \\EDAM\\Types\\LinkedNotebook();\n            $xfer += $this->linkedNotebook->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getLinkedNotebookSyncState_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->linkedNotebook !== null) {\n      if (!is_object($this->linkedNotebook)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('linkedNotebook', TType::STRUCT, 2);\n      $xfer += $this->linkedNotebook->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getLinkedNotebookSyncState_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n  public $notFoundException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\NoteStore\\SyncState',\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        3 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getLinkedNotebookSyncState_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRUCT) {\n            $this->success = new \\EDAM\\NoteStore\\SyncState();\n            $xfer += $this->success->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getLinkedNotebookSyncState_result');\n    if ($this->success !== null) {\n      if (!is_object($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);\n      $xfer += $this->success->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 3);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getLinkedNotebookSyncChunk_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $linkedNotebook = null;\n  public $afterUSN = null;\n  public $maxEntries = null;\n  public $fullSyncOnly = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'linkedNotebook',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\LinkedNotebook',\n          ),\n        3 => array(\n          'var' => 'afterUSN',\n          'type' => TType::I32,\n          ),\n        4 => array(\n          'var' => 'maxEntries',\n          'type' => TType::I32,\n          ),\n        5 => array(\n          'var' => 'fullSyncOnly',\n          'type' => TType::BOOL,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['linkedNotebook'])) {\n        $this->linkedNotebook = $vals['linkedNotebook'];\n      }\n      if (isset($vals['afterUSN'])) {\n        $this->afterUSN = $vals['afterUSN'];\n      }\n      if (isset($vals['maxEntries'])) {\n        $this->maxEntries = $vals['maxEntries'];\n      }\n      if (isset($vals['fullSyncOnly'])) {\n        $this->fullSyncOnly = $vals['fullSyncOnly'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getLinkedNotebookSyncChunk_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->linkedNotebook = new \\EDAM\\Types\\LinkedNotebook();\n            $xfer += $this->linkedNotebook->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->afterUSN);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 4:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->maxEntries);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 5:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->fullSyncOnly);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getLinkedNotebookSyncChunk_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->linkedNotebook !== null) {\n      if (!is_object($this->linkedNotebook)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('linkedNotebook', TType::STRUCT, 2);\n      $xfer += $this->linkedNotebook->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->afterUSN !== null) {\n      $xfer += $output->writeFieldBegin('afterUSN', TType::I32, 3);\n      $xfer += $output->writeI32($this->afterUSN);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->maxEntries !== null) {\n      $xfer += $output->writeFieldBegin('maxEntries', TType::I32, 4);\n      $xfer += $output->writeI32($this->maxEntries);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->fullSyncOnly !== null) {\n      $xfer += $output->writeFieldBegin('fullSyncOnly', TType::BOOL, 5);\n      $xfer += $output->writeBool($this->fullSyncOnly);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getLinkedNotebookSyncChunk_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n  public $notFoundException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\NoteStore\\SyncChunk',\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        3 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getLinkedNotebookSyncChunk_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRUCT) {\n            $this->success = new \\EDAM\\NoteStore\\SyncChunk();\n            $xfer += $this->success->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getLinkedNotebookSyncChunk_result');\n    if ($this->success !== null) {\n      if (!is_object($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);\n      $xfer += $this->success->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 3);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_listNotebooks_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_listNotebooks_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_listNotebooks_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_listNotebooks_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::LST,\n          'etype' => TType::STRUCT,\n          'elem' => array(\n            'type' => TType::STRUCT,\n            'class' => '\\EDAM\\Types\\Notebook',\n            ),\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_listNotebooks_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::LST) {\n            $this->success = array();\n            $_size193 = 0;\n            $_etype196 = 0;\n            $xfer += $input->readListBegin($_etype196, $_size193);\n            for ($_i197 = 0; $_i197 < $_size193; ++$_i197)\n            {\n              $elem198 = null;\n              $elem198 = new \\EDAM\\Types\\Notebook();\n              $xfer += $elem198->read($input);\n              $this->success []= $elem198;\n            }\n            $xfer += $input->readListEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_listNotebooks_result');\n    if ($this->success !== null) {\n      if (!is_array($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::LST, 0);\n      {\n        $output->writeListBegin(TType::STRUCT, count($this->success));\n        {\n          foreach ($this->success as $iter199)\n          {\n            $xfer += $iter199->write($output);\n          }\n        }\n        $output->writeListEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getNotebook_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $guid = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'guid',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['guid'])) {\n        $this->guid = $vals['guid'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getNotebook_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->guid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getNotebook_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->guid !== null) {\n      $xfer += $output->writeFieldBegin('guid', TType::STRING, 2);\n      $xfer += $output->writeString($this->guid);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getNotebook_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n  public $notFoundException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\Notebook',\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        3 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getNotebook_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRUCT) {\n            $this->success = new \\EDAM\\Types\\Notebook();\n            $xfer += $this->success->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getNotebook_result');\n    if ($this->success !== null) {\n      if (!is_object($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);\n      $xfer += $this->success->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 3);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getDefaultNotebook_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getDefaultNotebook_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getDefaultNotebook_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getDefaultNotebook_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\Notebook',\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getDefaultNotebook_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRUCT) {\n            $this->success = new \\EDAM\\Types\\Notebook();\n            $xfer += $this->success->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getDefaultNotebook_result');\n    if ($this->success !== null) {\n      if (!is_object($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);\n      $xfer += $this->success->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_createNotebook_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $notebook = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'notebook',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\Notebook',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['notebook'])) {\n        $this->notebook = $vals['notebook'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_createNotebook_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->notebook = new \\EDAM\\Types\\Notebook();\n            $xfer += $this->notebook->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_createNotebook_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notebook !== null) {\n      if (!is_object($this->notebook)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('notebook', TType::STRUCT, 2);\n      $xfer += $this->notebook->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_createNotebook_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\Notebook',\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_createNotebook_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRUCT) {\n            $this->success = new \\EDAM\\Types\\Notebook();\n            $xfer += $this->success->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_createNotebook_result');\n    if ($this->success !== null) {\n      if (!is_object($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);\n      $xfer += $this->success->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_updateNotebook_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $notebook = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'notebook',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\Notebook',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['notebook'])) {\n        $this->notebook = $vals['notebook'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_updateNotebook_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->notebook = new \\EDAM\\Types\\Notebook();\n            $xfer += $this->notebook->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_updateNotebook_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notebook !== null) {\n      if (!is_object($this->notebook)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('notebook', TType::STRUCT, 2);\n      $xfer += $this->notebook->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_updateNotebook_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n  public $notFoundException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::I32,\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        3 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_updateNotebook_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->success);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_updateNotebook_result');\n    if ($this->success !== null) {\n      $xfer += $output->writeFieldBegin('success', TType::I32, 0);\n      $xfer += $output->writeI32($this->success);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 3);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_expungeNotebook_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $guid = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'guid',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['guid'])) {\n        $this->guid = $vals['guid'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_expungeNotebook_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->guid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_expungeNotebook_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->guid !== null) {\n      $xfer += $output->writeFieldBegin('guid', TType::STRING, 2);\n      $xfer += $output->writeString($this->guid);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_expungeNotebook_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n  public $notFoundException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::I32,\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        3 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_expungeNotebook_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->success);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_expungeNotebook_result');\n    if ($this->success !== null) {\n      $xfer += $output->writeFieldBegin('success', TType::I32, 0);\n      $xfer += $output->writeI32($this->success);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 3);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_listTags_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_listTags_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_listTags_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_listTags_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::LST,\n          'etype' => TType::STRUCT,\n          'elem' => array(\n            'type' => TType::STRUCT,\n            'class' => '\\EDAM\\Types\\Tag',\n            ),\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_listTags_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::LST) {\n            $this->success = array();\n            $_size200 = 0;\n            $_etype203 = 0;\n            $xfer += $input->readListBegin($_etype203, $_size200);\n            for ($_i204 = 0; $_i204 < $_size200; ++$_i204)\n            {\n              $elem205 = null;\n              $elem205 = new \\EDAM\\Types\\Tag();\n              $xfer += $elem205->read($input);\n              $this->success []= $elem205;\n            }\n            $xfer += $input->readListEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_listTags_result');\n    if ($this->success !== null) {\n      if (!is_array($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::LST, 0);\n      {\n        $output->writeListBegin(TType::STRUCT, count($this->success));\n        {\n          foreach ($this->success as $iter206)\n          {\n            $xfer += $iter206->write($output);\n          }\n        }\n        $output->writeListEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_listTagsByNotebook_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $notebookGuid = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'notebookGuid',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['notebookGuid'])) {\n        $this->notebookGuid = $vals['notebookGuid'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_listTagsByNotebook_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->notebookGuid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_listTagsByNotebook_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notebookGuid !== null) {\n      $xfer += $output->writeFieldBegin('notebookGuid', TType::STRING, 2);\n      $xfer += $output->writeString($this->notebookGuid);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_listTagsByNotebook_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n  public $notFoundException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::LST,\n          'etype' => TType::STRUCT,\n          'elem' => array(\n            'type' => TType::STRUCT,\n            'class' => '\\EDAM\\Types\\Tag',\n            ),\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        3 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_listTagsByNotebook_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::LST) {\n            $this->success = array();\n            $_size207 = 0;\n            $_etype210 = 0;\n            $xfer += $input->readListBegin($_etype210, $_size207);\n            for ($_i211 = 0; $_i211 < $_size207; ++$_i211)\n            {\n              $elem212 = null;\n              $elem212 = new \\EDAM\\Types\\Tag();\n              $xfer += $elem212->read($input);\n              $this->success []= $elem212;\n            }\n            $xfer += $input->readListEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_listTagsByNotebook_result');\n    if ($this->success !== null) {\n      if (!is_array($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::LST, 0);\n      {\n        $output->writeListBegin(TType::STRUCT, count($this->success));\n        {\n          foreach ($this->success as $iter213)\n          {\n            $xfer += $iter213->write($output);\n          }\n        }\n        $output->writeListEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 3);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getTag_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $guid = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'guid',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['guid'])) {\n        $this->guid = $vals['guid'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getTag_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->guid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getTag_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->guid !== null) {\n      $xfer += $output->writeFieldBegin('guid', TType::STRING, 2);\n      $xfer += $output->writeString($this->guid);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getTag_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n  public $notFoundException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\Tag',\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        3 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getTag_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRUCT) {\n            $this->success = new \\EDAM\\Types\\Tag();\n            $xfer += $this->success->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getTag_result');\n    if ($this->success !== null) {\n      if (!is_object($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);\n      $xfer += $this->success->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 3);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_createTag_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $tag = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'tag',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\Tag',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['tag'])) {\n        $this->tag = $vals['tag'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_createTag_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->tag = new \\EDAM\\Types\\Tag();\n            $xfer += $this->tag->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_createTag_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->tag !== null) {\n      if (!is_object($this->tag)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('tag', TType::STRUCT, 2);\n      $xfer += $this->tag->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_createTag_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n  public $notFoundException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\Tag',\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        3 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_createTag_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRUCT) {\n            $this->success = new \\EDAM\\Types\\Tag();\n            $xfer += $this->success->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_createTag_result');\n    if ($this->success !== null) {\n      if (!is_object($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);\n      $xfer += $this->success->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 3);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_updateTag_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $tag = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'tag',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\Tag',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['tag'])) {\n        $this->tag = $vals['tag'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_updateTag_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->tag = new \\EDAM\\Types\\Tag();\n            $xfer += $this->tag->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_updateTag_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->tag !== null) {\n      if (!is_object($this->tag)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('tag', TType::STRUCT, 2);\n      $xfer += $this->tag->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_updateTag_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n  public $notFoundException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::I32,\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        3 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_updateTag_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->success);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_updateTag_result');\n    if ($this->success !== null) {\n      $xfer += $output->writeFieldBegin('success', TType::I32, 0);\n      $xfer += $output->writeI32($this->success);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 3);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_untagAll_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $guid = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'guid',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['guid'])) {\n        $this->guid = $vals['guid'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_untagAll_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->guid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_untagAll_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->guid !== null) {\n      $xfer += $output->writeFieldBegin('guid', TType::STRING, 2);\n      $xfer += $output->writeString($this->guid);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_untagAll_result {\n  static $_TSPEC;\n\n  public $userException = null;\n  public $systemException = null;\n  public $notFoundException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        3 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_untagAll_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_untagAll_result');\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 3);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_expungeTag_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $guid = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'guid',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['guid'])) {\n        $this->guid = $vals['guid'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_expungeTag_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->guid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_expungeTag_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->guid !== null) {\n      $xfer += $output->writeFieldBegin('guid', TType::STRING, 2);\n      $xfer += $output->writeString($this->guid);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_expungeTag_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n  public $notFoundException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::I32,\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        3 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_expungeTag_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->success);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_expungeTag_result');\n    if ($this->success !== null) {\n      $xfer += $output->writeFieldBegin('success', TType::I32, 0);\n      $xfer += $output->writeI32($this->success);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 3);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_listSearches_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_listSearches_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_listSearches_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_listSearches_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::LST,\n          'etype' => TType::STRUCT,\n          'elem' => array(\n            'type' => TType::STRUCT,\n            'class' => '\\EDAM\\Types\\SavedSearch',\n            ),\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_listSearches_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::LST) {\n            $this->success = array();\n            $_size214 = 0;\n            $_etype217 = 0;\n            $xfer += $input->readListBegin($_etype217, $_size214);\n            for ($_i218 = 0; $_i218 < $_size214; ++$_i218)\n            {\n              $elem219 = null;\n              $elem219 = new \\EDAM\\Types\\SavedSearch();\n              $xfer += $elem219->read($input);\n              $this->success []= $elem219;\n            }\n            $xfer += $input->readListEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_listSearches_result');\n    if ($this->success !== null) {\n      if (!is_array($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::LST, 0);\n      {\n        $output->writeListBegin(TType::STRUCT, count($this->success));\n        {\n          foreach ($this->success as $iter220)\n          {\n            $xfer += $iter220->write($output);\n          }\n        }\n        $output->writeListEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getSearch_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $guid = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'guid',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['guid'])) {\n        $this->guid = $vals['guid'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getSearch_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->guid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getSearch_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->guid !== null) {\n      $xfer += $output->writeFieldBegin('guid', TType::STRING, 2);\n      $xfer += $output->writeString($this->guid);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getSearch_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n  public $notFoundException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\SavedSearch',\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        3 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getSearch_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRUCT) {\n            $this->success = new \\EDAM\\Types\\SavedSearch();\n            $xfer += $this->success->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getSearch_result');\n    if ($this->success !== null) {\n      if (!is_object($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);\n      $xfer += $this->success->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 3);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_createSearch_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $search = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'search',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\SavedSearch',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['search'])) {\n        $this->search = $vals['search'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_createSearch_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->search = new \\EDAM\\Types\\SavedSearch();\n            $xfer += $this->search->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_createSearch_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->search !== null) {\n      if (!is_object($this->search)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('search', TType::STRUCT, 2);\n      $xfer += $this->search->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_createSearch_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\SavedSearch',\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_createSearch_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRUCT) {\n            $this->success = new \\EDAM\\Types\\SavedSearch();\n            $xfer += $this->success->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_createSearch_result');\n    if ($this->success !== null) {\n      if (!is_object($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);\n      $xfer += $this->success->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_updateSearch_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $search = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'search',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\SavedSearch',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['search'])) {\n        $this->search = $vals['search'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_updateSearch_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->search = new \\EDAM\\Types\\SavedSearch();\n            $xfer += $this->search->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_updateSearch_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->search !== null) {\n      if (!is_object($this->search)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('search', TType::STRUCT, 2);\n      $xfer += $this->search->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_updateSearch_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n  public $notFoundException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::I32,\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        3 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_updateSearch_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->success);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_updateSearch_result');\n    if ($this->success !== null) {\n      $xfer += $output->writeFieldBegin('success', TType::I32, 0);\n      $xfer += $output->writeI32($this->success);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 3);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_expungeSearch_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $guid = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'guid',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['guid'])) {\n        $this->guid = $vals['guid'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_expungeSearch_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->guid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_expungeSearch_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->guid !== null) {\n      $xfer += $output->writeFieldBegin('guid', TType::STRING, 2);\n      $xfer += $output->writeString($this->guid);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_expungeSearch_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n  public $notFoundException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::I32,\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        3 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_expungeSearch_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->success);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_expungeSearch_result');\n    if ($this->success !== null) {\n      $xfer += $output->writeFieldBegin('success', TType::I32, 0);\n      $xfer += $output->writeI32($this->success);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 3);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_findNotes_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $filter = null;\n  public $offset = null;\n  public $maxNotes = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'filter',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\NoteStore\\NoteFilter',\n          ),\n        3 => array(\n          'var' => 'offset',\n          'type' => TType::I32,\n          ),\n        4 => array(\n          'var' => 'maxNotes',\n          'type' => TType::I32,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['filter'])) {\n        $this->filter = $vals['filter'];\n      }\n      if (isset($vals['offset'])) {\n        $this->offset = $vals['offset'];\n      }\n      if (isset($vals['maxNotes'])) {\n        $this->maxNotes = $vals['maxNotes'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_findNotes_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->filter = new \\EDAM\\NoteStore\\NoteFilter();\n            $xfer += $this->filter->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->offset);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 4:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->maxNotes);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_findNotes_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->filter !== null) {\n      if (!is_object($this->filter)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('filter', TType::STRUCT, 2);\n      $xfer += $this->filter->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->offset !== null) {\n      $xfer += $output->writeFieldBegin('offset', TType::I32, 3);\n      $xfer += $output->writeI32($this->offset);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->maxNotes !== null) {\n      $xfer += $output->writeFieldBegin('maxNotes', TType::I32, 4);\n      $xfer += $output->writeI32($this->maxNotes);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_findNotes_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n  public $notFoundException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\NoteStore\\NoteList',\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        3 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_findNotes_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRUCT) {\n            $this->success = new \\EDAM\\NoteStore\\NoteList();\n            $xfer += $this->success->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_findNotes_result');\n    if ($this->success !== null) {\n      if (!is_object($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);\n      $xfer += $this->success->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 3);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_findNoteOffset_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $filter = null;\n  public $guid = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'filter',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\NoteStore\\NoteFilter',\n          ),\n        3 => array(\n          'var' => 'guid',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['filter'])) {\n        $this->filter = $vals['filter'];\n      }\n      if (isset($vals['guid'])) {\n        $this->guid = $vals['guid'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_findNoteOffset_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->filter = new \\EDAM\\NoteStore\\NoteFilter();\n            $xfer += $this->filter->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->guid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_findNoteOffset_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->filter !== null) {\n      if (!is_object($this->filter)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('filter', TType::STRUCT, 2);\n      $xfer += $this->filter->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->guid !== null) {\n      $xfer += $output->writeFieldBegin('guid', TType::STRING, 3);\n      $xfer += $output->writeString($this->guid);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_findNoteOffset_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n  public $notFoundException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::I32,\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        3 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_findNoteOffset_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->success);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_findNoteOffset_result');\n    if ($this->success !== null) {\n      $xfer += $output->writeFieldBegin('success', TType::I32, 0);\n      $xfer += $output->writeI32($this->success);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 3);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_findNotesMetadata_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $filter = null;\n  public $offset = null;\n  public $maxNotes = null;\n  public $resultSpec = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'filter',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\NoteStore\\NoteFilter',\n          ),\n        3 => array(\n          'var' => 'offset',\n          'type' => TType::I32,\n          ),\n        4 => array(\n          'var' => 'maxNotes',\n          'type' => TType::I32,\n          ),\n        5 => array(\n          'var' => 'resultSpec',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\NoteStore\\NotesMetadataResultSpec',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['filter'])) {\n        $this->filter = $vals['filter'];\n      }\n      if (isset($vals['offset'])) {\n        $this->offset = $vals['offset'];\n      }\n      if (isset($vals['maxNotes'])) {\n        $this->maxNotes = $vals['maxNotes'];\n      }\n      if (isset($vals['resultSpec'])) {\n        $this->resultSpec = $vals['resultSpec'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_findNotesMetadata_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->filter = new \\EDAM\\NoteStore\\NoteFilter();\n            $xfer += $this->filter->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->offset);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 4:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->maxNotes);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 5:\n          if ($ftype == TType::STRUCT) {\n            $this->resultSpec = new \\EDAM\\NoteStore\\NotesMetadataResultSpec();\n            $xfer += $this->resultSpec->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_findNotesMetadata_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->filter !== null) {\n      if (!is_object($this->filter)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('filter', TType::STRUCT, 2);\n      $xfer += $this->filter->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->offset !== null) {\n      $xfer += $output->writeFieldBegin('offset', TType::I32, 3);\n      $xfer += $output->writeI32($this->offset);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->maxNotes !== null) {\n      $xfer += $output->writeFieldBegin('maxNotes', TType::I32, 4);\n      $xfer += $output->writeI32($this->maxNotes);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->resultSpec !== null) {\n      if (!is_object($this->resultSpec)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('resultSpec', TType::STRUCT, 5);\n      $xfer += $this->resultSpec->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_findNotesMetadata_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n  public $notFoundException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\NoteStore\\NotesMetadataList',\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        3 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_findNotesMetadata_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRUCT) {\n            $this->success = new \\EDAM\\NoteStore\\NotesMetadataList();\n            $xfer += $this->success->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_findNotesMetadata_result');\n    if ($this->success !== null) {\n      if (!is_object($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);\n      $xfer += $this->success->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 3);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_findNoteCounts_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $filter = null;\n  public $withTrash = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'filter',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\NoteStore\\NoteFilter',\n          ),\n        3 => array(\n          'var' => 'withTrash',\n          'type' => TType::BOOL,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['filter'])) {\n        $this->filter = $vals['filter'];\n      }\n      if (isset($vals['withTrash'])) {\n        $this->withTrash = $vals['withTrash'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_findNoteCounts_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->filter = new \\EDAM\\NoteStore\\NoteFilter();\n            $xfer += $this->filter->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->withTrash);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_findNoteCounts_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->filter !== null) {\n      if (!is_object($this->filter)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('filter', TType::STRUCT, 2);\n      $xfer += $this->filter->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->withTrash !== null) {\n      $xfer += $output->writeFieldBegin('withTrash', TType::BOOL, 3);\n      $xfer += $output->writeBool($this->withTrash);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_findNoteCounts_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n  public $notFoundException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\NoteStore\\NoteCollectionCounts',\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        3 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_findNoteCounts_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRUCT) {\n            $this->success = new \\EDAM\\NoteStore\\NoteCollectionCounts();\n            $xfer += $this->success->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_findNoteCounts_result');\n    if ($this->success !== null) {\n      if (!is_object($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);\n      $xfer += $this->success->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 3);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getNote_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $guid = null;\n  public $withContent = null;\n  public $withResourcesData = null;\n  public $withResourcesRecognition = null;\n  public $withResourcesAlternateData = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'guid',\n          'type' => TType::STRING,\n          ),\n        3 => array(\n          'var' => 'withContent',\n          'type' => TType::BOOL,\n          ),\n        4 => array(\n          'var' => 'withResourcesData',\n          'type' => TType::BOOL,\n          ),\n        5 => array(\n          'var' => 'withResourcesRecognition',\n          'type' => TType::BOOL,\n          ),\n        6 => array(\n          'var' => 'withResourcesAlternateData',\n          'type' => TType::BOOL,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['guid'])) {\n        $this->guid = $vals['guid'];\n      }\n      if (isset($vals['withContent'])) {\n        $this->withContent = $vals['withContent'];\n      }\n      if (isset($vals['withResourcesData'])) {\n        $this->withResourcesData = $vals['withResourcesData'];\n      }\n      if (isset($vals['withResourcesRecognition'])) {\n        $this->withResourcesRecognition = $vals['withResourcesRecognition'];\n      }\n      if (isset($vals['withResourcesAlternateData'])) {\n        $this->withResourcesAlternateData = $vals['withResourcesAlternateData'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getNote_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->guid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->withContent);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 4:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->withResourcesData);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 5:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->withResourcesRecognition);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 6:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->withResourcesAlternateData);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getNote_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->guid !== null) {\n      $xfer += $output->writeFieldBegin('guid', TType::STRING, 2);\n      $xfer += $output->writeString($this->guid);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->withContent !== null) {\n      $xfer += $output->writeFieldBegin('withContent', TType::BOOL, 3);\n      $xfer += $output->writeBool($this->withContent);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->withResourcesData !== null) {\n      $xfer += $output->writeFieldBegin('withResourcesData', TType::BOOL, 4);\n      $xfer += $output->writeBool($this->withResourcesData);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->withResourcesRecognition !== null) {\n      $xfer += $output->writeFieldBegin('withResourcesRecognition', TType::BOOL, 5);\n      $xfer += $output->writeBool($this->withResourcesRecognition);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->withResourcesAlternateData !== null) {\n      $xfer += $output->writeFieldBegin('withResourcesAlternateData', TType::BOOL, 6);\n      $xfer += $output->writeBool($this->withResourcesAlternateData);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getNote_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n  public $notFoundException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\Note',\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        3 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getNote_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRUCT) {\n            $this->success = new \\EDAM\\Types\\Note();\n            $xfer += $this->success->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getNote_result');\n    if ($this->success !== null) {\n      if (!is_object($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);\n      $xfer += $this->success->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 3);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getNoteApplicationData_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $guid = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'guid',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['guid'])) {\n        $this->guid = $vals['guid'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getNoteApplicationData_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->guid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getNoteApplicationData_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->guid !== null) {\n      $xfer += $output->writeFieldBegin('guid', TType::STRING, 2);\n      $xfer += $output->writeString($this->guid);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getNoteApplicationData_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n  public $notFoundException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\LazyMap',\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        3 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getNoteApplicationData_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRUCT) {\n            $this->success = new \\EDAM\\Types\\LazyMap();\n            $xfer += $this->success->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getNoteApplicationData_result');\n    if ($this->success !== null) {\n      if (!is_object($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);\n      $xfer += $this->success->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 3);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getNoteApplicationDataEntry_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $guid = null;\n  public $key = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'guid',\n          'type' => TType::STRING,\n          ),\n        3 => array(\n          'var' => 'key',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['guid'])) {\n        $this->guid = $vals['guid'];\n      }\n      if (isset($vals['key'])) {\n        $this->key = $vals['key'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getNoteApplicationDataEntry_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->guid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->key);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getNoteApplicationDataEntry_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->guid !== null) {\n      $xfer += $output->writeFieldBegin('guid', TType::STRING, 2);\n      $xfer += $output->writeString($this->guid);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->key !== null) {\n      $xfer += $output->writeFieldBegin('key', TType::STRING, 3);\n      $xfer += $output->writeString($this->key);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getNoteApplicationDataEntry_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n  public $notFoundException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRING,\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        3 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getNoteApplicationDataEntry_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->success);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getNoteApplicationDataEntry_result');\n    if ($this->success !== null) {\n      $xfer += $output->writeFieldBegin('success', TType::STRING, 0);\n      $xfer += $output->writeString($this->success);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 3);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_setNoteApplicationDataEntry_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $guid = null;\n  public $key = null;\n  public $value = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'guid',\n          'type' => TType::STRING,\n          ),\n        3 => array(\n          'var' => 'key',\n          'type' => TType::STRING,\n          ),\n        4 => array(\n          'var' => 'value',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['guid'])) {\n        $this->guid = $vals['guid'];\n      }\n      if (isset($vals['key'])) {\n        $this->key = $vals['key'];\n      }\n      if (isset($vals['value'])) {\n        $this->value = $vals['value'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_setNoteApplicationDataEntry_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->guid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->key);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 4:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->value);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_setNoteApplicationDataEntry_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->guid !== null) {\n      $xfer += $output->writeFieldBegin('guid', TType::STRING, 2);\n      $xfer += $output->writeString($this->guid);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->key !== null) {\n      $xfer += $output->writeFieldBegin('key', TType::STRING, 3);\n      $xfer += $output->writeString($this->key);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->value !== null) {\n      $xfer += $output->writeFieldBegin('value', TType::STRING, 4);\n      $xfer += $output->writeString($this->value);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_setNoteApplicationDataEntry_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n  public $notFoundException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::I32,\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        3 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_setNoteApplicationDataEntry_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->success);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_setNoteApplicationDataEntry_result');\n    if ($this->success !== null) {\n      $xfer += $output->writeFieldBegin('success', TType::I32, 0);\n      $xfer += $output->writeI32($this->success);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 3);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_unsetNoteApplicationDataEntry_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $guid = null;\n  public $key = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'guid',\n          'type' => TType::STRING,\n          ),\n        3 => array(\n          'var' => 'key',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['guid'])) {\n        $this->guid = $vals['guid'];\n      }\n      if (isset($vals['key'])) {\n        $this->key = $vals['key'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_unsetNoteApplicationDataEntry_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->guid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->key);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_unsetNoteApplicationDataEntry_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->guid !== null) {\n      $xfer += $output->writeFieldBegin('guid', TType::STRING, 2);\n      $xfer += $output->writeString($this->guid);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->key !== null) {\n      $xfer += $output->writeFieldBegin('key', TType::STRING, 3);\n      $xfer += $output->writeString($this->key);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_unsetNoteApplicationDataEntry_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n  public $notFoundException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::I32,\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        3 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_unsetNoteApplicationDataEntry_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->success);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_unsetNoteApplicationDataEntry_result');\n    if ($this->success !== null) {\n      $xfer += $output->writeFieldBegin('success', TType::I32, 0);\n      $xfer += $output->writeI32($this->success);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 3);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getNoteContent_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $guid = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'guid',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['guid'])) {\n        $this->guid = $vals['guid'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getNoteContent_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->guid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getNoteContent_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->guid !== null) {\n      $xfer += $output->writeFieldBegin('guid', TType::STRING, 2);\n      $xfer += $output->writeString($this->guid);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getNoteContent_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n  public $notFoundException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRING,\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        3 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getNoteContent_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->success);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getNoteContent_result');\n    if ($this->success !== null) {\n      $xfer += $output->writeFieldBegin('success', TType::STRING, 0);\n      $xfer += $output->writeString($this->success);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 3);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getNoteSearchText_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $guid = null;\n  public $noteOnly = null;\n  public $tokenizeForIndexing = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'guid',\n          'type' => TType::STRING,\n          ),\n        3 => array(\n          'var' => 'noteOnly',\n          'type' => TType::BOOL,\n          ),\n        4 => array(\n          'var' => 'tokenizeForIndexing',\n          'type' => TType::BOOL,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['guid'])) {\n        $this->guid = $vals['guid'];\n      }\n      if (isset($vals['noteOnly'])) {\n        $this->noteOnly = $vals['noteOnly'];\n      }\n      if (isset($vals['tokenizeForIndexing'])) {\n        $this->tokenizeForIndexing = $vals['tokenizeForIndexing'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getNoteSearchText_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->guid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->noteOnly);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 4:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->tokenizeForIndexing);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getNoteSearchText_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->guid !== null) {\n      $xfer += $output->writeFieldBegin('guid', TType::STRING, 2);\n      $xfer += $output->writeString($this->guid);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->noteOnly !== null) {\n      $xfer += $output->writeFieldBegin('noteOnly', TType::BOOL, 3);\n      $xfer += $output->writeBool($this->noteOnly);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->tokenizeForIndexing !== null) {\n      $xfer += $output->writeFieldBegin('tokenizeForIndexing', TType::BOOL, 4);\n      $xfer += $output->writeBool($this->tokenizeForIndexing);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getNoteSearchText_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n  public $notFoundException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRING,\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        3 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getNoteSearchText_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->success);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getNoteSearchText_result');\n    if ($this->success !== null) {\n      $xfer += $output->writeFieldBegin('success', TType::STRING, 0);\n      $xfer += $output->writeString($this->success);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 3);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getResourceSearchText_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $guid = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'guid',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['guid'])) {\n        $this->guid = $vals['guid'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getResourceSearchText_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->guid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getResourceSearchText_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->guid !== null) {\n      $xfer += $output->writeFieldBegin('guid', TType::STRING, 2);\n      $xfer += $output->writeString($this->guid);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getResourceSearchText_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n  public $notFoundException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRING,\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        3 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getResourceSearchText_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->success);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getResourceSearchText_result');\n    if ($this->success !== null) {\n      $xfer += $output->writeFieldBegin('success', TType::STRING, 0);\n      $xfer += $output->writeString($this->success);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 3);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getNoteTagNames_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $guid = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'guid',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['guid'])) {\n        $this->guid = $vals['guid'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getNoteTagNames_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->guid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getNoteTagNames_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->guid !== null) {\n      $xfer += $output->writeFieldBegin('guid', TType::STRING, 2);\n      $xfer += $output->writeString($this->guid);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getNoteTagNames_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n  public $notFoundException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::LST,\n          'etype' => TType::STRING,\n          'elem' => array(\n            'type' => TType::STRING,\n            ),\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        3 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getNoteTagNames_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::LST) {\n            $this->success = array();\n            $_size221 = 0;\n            $_etype224 = 0;\n            $xfer += $input->readListBegin($_etype224, $_size221);\n            for ($_i225 = 0; $_i225 < $_size221; ++$_i225)\n            {\n              $elem226 = null;\n              $xfer += $input->readString($elem226);\n              $this->success []= $elem226;\n            }\n            $xfer += $input->readListEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getNoteTagNames_result');\n    if ($this->success !== null) {\n      if (!is_array($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::LST, 0);\n      {\n        $output->writeListBegin(TType::STRING, count($this->success));\n        {\n          foreach ($this->success as $iter227)\n          {\n            $xfer += $output->writeString($iter227);\n          }\n        }\n        $output->writeListEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 3);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_createNote_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $note = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'note',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\Note',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['note'])) {\n        $this->note = $vals['note'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_createNote_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->note = new \\EDAM\\Types\\Note();\n            $xfer += $this->note->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_createNote_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->note !== null) {\n      if (!is_object($this->note)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('note', TType::STRUCT, 2);\n      $xfer += $this->note->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_createNote_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n  public $notFoundException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\Note',\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        3 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_createNote_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRUCT) {\n            $this->success = new \\EDAM\\Types\\Note();\n            $xfer += $this->success->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_createNote_result');\n    if ($this->success !== null) {\n      if (!is_object($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);\n      $xfer += $this->success->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 3);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_updateNote_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $note = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'note',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\Note',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['note'])) {\n        $this->note = $vals['note'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_updateNote_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->note = new \\EDAM\\Types\\Note();\n            $xfer += $this->note->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_updateNote_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->note !== null) {\n      if (!is_object($this->note)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('note', TType::STRUCT, 2);\n      $xfer += $this->note->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_updateNote_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n  public $notFoundException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\Note',\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        3 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_updateNote_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRUCT) {\n            $this->success = new \\EDAM\\Types\\Note();\n            $xfer += $this->success->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_updateNote_result');\n    if ($this->success !== null) {\n      if (!is_object($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);\n      $xfer += $this->success->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 3);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_deleteNote_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $guid = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'guid',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['guid'])) {\n        $this->guid = $vals['guid'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_deleteNote_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->guid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_deleteNote_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->guid !== null) {\n      $xfer += $output->writeFieldBegin('guid', TType::STRING, 2);\n      $xfer += $output->writeString($this->guid);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_deleteNote_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n  public $notFoundException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::I32,\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        3 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_deleteNote_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->success);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_deleteNote_result');\n    if ($this->success !== null) {\n      $xfer += $output->writeFieldBegin('success', TType::I32, 0);\n      $xfer += $output->writeI32($this->success);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 3);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_expungeNote_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $guid = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'guid',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['guid'])) {\n        $this->guid = $vals['guid'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_expungeNote_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->guid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_expungeNote_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->guid !== null) {\n      $xfer += $output->writeFieldBegin('guid', TType::STRING, 2);\n      $xfer += $output->writeString($this->guid);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_expungeNote_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n  public $notFoundException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::I32,\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        3 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_expungeNote_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->success);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_expungeNote_result');\n    if ($this->success !== null) {\n      $xfer += $output->writeFieldBegin('success', TType::I32, 0);\n      $xfer += $output->writeI32($this->success);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 3);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_expungeNotes_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $noteGuids = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'noteGuids',\n          'type' => TType::LST,\n          'etype' => TType::STRING,\n          'elem' => array(\n            'type' => TType::STRING,\n            ),\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['noteGuids'])) {\n        $this->noteGuids = $vals['noteGuids'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_expungeNotes_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::LST) {\n            $this->noteGuids = array();\n            $_size228 = 0;\n            $_etype231 = 0;\n            $xfer += $input->readListBegin($_etype231, $_size228);\n            for ($_i232 = 0; $_i232 < $_size228; ++$_i232)\n            {\n              $elem233 = null;\n              $xfer += $input->readString($elem233);\n              $this->noteGuids []= $elem233;\n            }\n            $xfer += $input->readListEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_expungeNotes_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->noteGuids !== null) {\n      if (!is_array($this->noteGuids)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('noteGuids', TType::LST, 2);\n      {\n        $output->writeListBegin(TType::STRING, count($this->noteGuids));\n        {\n          foreach ($this->noteGuids as $iter234)\n          {\n            $xfer += $output->writeString($iter234);\n          }\n        }\n        $output->writeListEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_expungeNotes_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n  public $notFoundException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::I32,\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        3 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_expungeNotes_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->success);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_expungeNotes_result');\n    if ($this->success !== null) {\n      $xfer += $output->writeFieldBegin('success', TType::I32, 0);\n      $xfer += $output->writeI32($this->success);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 3);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_expungeInactiveNotes_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_expungeInactiveNotes_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_expungeInactiveNotes_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_expungeInactiveNotes_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::I32,\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_expungeInactiveNotes_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->success);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_expungeInactiveNotes_result');\n    if ($this->success !== null) {\n      $xfer += $output->writeFieldBegin('success', TType::I32, 0);\n      $xfer += $output->writeI32($this->success);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_copyNote_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $noteGuid = null;\n  public $toNotebookGuid = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'noteGuid',\n          'type' => TType::STRING,\n          ),\n        3 => array(\n          'var' => 'toNotebookGuid',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['noteGuid'])) {\n        $this->noteGuid = $vals['noteGuid'];\n      }\n      if (isset($vals['toNotebookGuid'])) {\n        $this->toNotebookGuid = $vals['toNotebookGuid'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_copyNote_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->noteGuid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->toNotebookGuid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_copyNote_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->noteGuid !== null) {\n      $xfer += $output->writeFieldBegin('noteGuid', TType::STRING, 2);\n      $xfer += $output->writeString($this->noteGuid);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->toNotebookGuid !== null) {\n      $xfer += $output->writeFieldBegin('toNotebookGuid', TType::STRING, 3);\n      $xfer += $output->writeString($this->toNotebookGuid);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_copyNote_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n  public $notFoundException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\Note',\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        3 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_copyNote_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRUCT) {\n            $this->success = new \\EDAM\\Types\\Note();\n            $xfer += $this->success->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_copyNote_result');\n    if ($this->success !== null) {\n      if (!is_object($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);\n      $xfer += $this->success->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 3);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_listNoteVersions_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $noteGuid = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'noteGuid',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['noteGuid'])) {\n        $this->noteGuid = $vals['noteGuid'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_listNoteVersions_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->noteGuid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_listNoteVersions_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->noteGuid !== null) {\n      $xfer += $output->writeFieldBegin('noteGuid', TType::STRING, 2);\n      $xfer += $output->writeString($this->noteGuid);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_listNoteVersions_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n  public $notFoundException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::LST,\n          'etype' => TType::STRUCT,\n          'elem' => array(\n            'type' => TType::STRUCT,\n            'class' => '\\EDAM\\NoteStore\\NoteVersionId',\n            ),\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        3 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_listNoteVersions_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::LST) {\n            $this->success = array();\n            $_size235 = 0;\n            $_etype238 = 0;\n            $xfer += $input->readListBegin($_etype238, $_size235);\n            for ($_i239 = 0; $_i239 < $_size235; ++$_i239)\n            {\n              $elem240 = null;\n              $elem240 = new \\EDAM\\NoteStore\\NoteVersionId();\n              $xfer += $elem240->read($input);\n              $this->success []= $elem240;\n            }\n            $xfer += $input->readListEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_listNoteVersions_result');\n    if ($this->success !== null) {\n      if (!is_array($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::LST, 0);\n      {\n        $output->writeListBegin(TType::STRUCT, count($this->success));\n        {\n          foreach ($this->success as $iter241)\n          {\n            $xfer += $iter241->write($output);\n          }\n        }\n        $output->writeListEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 3);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getNoteVersion_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $noteGuid = null;\n  public $updateSequenceNum = null;\n  public $withResourcesData = null;\n  public $withResourcesRecognition = null;\n  public $withResourcesAlternateData = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'noteGuid',\n          'type' => TType::STRING,\n          ),\n        3 => array(\n          'var' => 'updateSequenceNum',\n          'type' => TType::I32,\n          ),\n        4 => array(\n          'var' => 'withResourcesData',\n          'type' => TType::BOOL,\n          ),\n        5 => array(\n          'var' => 'withResourcesRecognition',\n          'type' => TType::BOOL,\n          ),\n        6 => array(\n          'var' => 'withResourcesAlternateData',\n          'type' => TType::BOOL,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['noteGuid'])) {\n        $this->noteGuid = $vals['noteGuid'];\n      }\n      if (isset($vals['updateSequenceNum'])) {\n        $this->updateSequenceNum = $vals['updateSequenceNum'];\n      }\n      if (isset($vals['withResourcesData'])) {\n        $this->withResourcesData = $vals['withResourcesData'];\n      }\n      if (isset($vals['withResourcesRecognition'])) {\n        $this->withResourcesRecognition = $vals['withResourcesRecognition'];\n      }\n      if (isset($vals['withResourcesAlternateData'])) {\n        $this->withResourcesAlternateData = $vals['withResourcesAlternateData'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getNoteVersion_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->noteGuid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->updateSequenceNum);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 4:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->withResourcesData);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 5:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->withResourcesRecognition);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 6:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->withResourcesAlternateData);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getNoteVersion_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->noteGuid !== null) {\n      $xfer += $output->writeFieldBegin('noteGuid', TType::STRING, 2);\n      $xfer += $output->writeString($this->noteGuid);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->updateSequenceNum !== null) {\n      $xfer += $output->writeFieldBegin('updateSequenceNum', TType::I32, 3);\n      $xfer += $output->writeI32($this->updateSequenceNum);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->withResourcesData !== null) {\n      $xfer += $output->writeFieldBegin('withResourcesData', TType::BOOL, 4);\n      $xfer += $output->writeBool($this->withResourcesData);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->withResourcesRecognition !== null) {\n      $xfer += $output->writeFieldBegin('withResourcesRecognition', TType::BOOL, 5);\n      $xfer += $output->writeBool($this->withResourcesRecognition);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->withResourcesAlternateData !== null) {\n      $xfer += $output->writeFieldBegin('withResourcesAlternateData', TType::BOOL, 6);\n      $xfer += $output->writeBool($this->withResourcesAlternateData);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getNoteVersion_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n  public $notFoundException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\Note',\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        3 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getNoteVersion_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRUCT) {\n            $this->success = new \\EDAM\\Types\\Note();\n            $xfer += $this->success->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getNoteVersion_result');\n    if ($this->success !== null) {\n      if (!is_object($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);\n      $xfer += $this->success->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 3);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getResource_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $guid = null;\n  public $withData = null;\n  public $withRecognition = null;\n  public $withAttributes = null;\n  public $withAlternateData = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'guid',\n          'type' => TType::STRING,\n          ),\n        3 => array(\n          'var' => 'withData',\n          'type' => TType::BOOL,\n          ),\n        4 => array(\n          'var' => 'withRecognition',\n          'type' => TType::BOOL,\n          ),\n        5 => array(\n          'var' => 'withAttributes',\n          'type' => TType::BOOL,\n          ),\n        6 => array(\n          'var' => 'withAlternateData',\n          'type' => TType::BOOL,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['guid'])) {\n        $this->guid = $vals['guid'];\n      }\n      if (isset($vals['withData'])) {\n        $this->withData = $vals['withData'];\n      }\n      if (isset($vals['withRecognition'])) {\n        $this->withRecognition = $vals['withRecognition'];\n      }\n      if (isset($vals['withAttributes'])) {\n        $this->withAttributes = $vals['withAttributes'];\n      }\n      if (isset($vals['withAlternateData'])) {\n        $this->withAlternateData = $vals['withAlternateData'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getResource_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->guid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->withData);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 4:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->withRecognition);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 5:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->withAttributes);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 6:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->withAlternateData);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getResource_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->guid !== null) {\n      $xfer += $output->writeFieldBegin('guid', TType::STRING, 2);\n      $xfer += $output->writeString($this->guid);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->withData !== null) {\n      $xfer += $output->writeFieldBegin('withData', TType::BOOL, 3);\n      $xfer += $output->writeBool($this->withData);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->withRecognition !== null) {\n      $xfer += $output->writeFieldBegin('withRecognition', TType::BOOL, 4);\n      $xfer += $output->writeBool($this->withRecognition);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->withAttributes !== null) {\n      $xfer += $output->writeFieldBegin('withAttributes', TType::BOOL, 5);\n      $xfer += $output->writeBool($this->withAttributes);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->withAlternateData !== null) {\n      $xfer += $output->writeFieldBegin('withAlternateData', TType::BOOL, 6);\n      $xfer += $output->writeBool($this->withAlternateData);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getResource_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n  public $notFoundException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\Resource',\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        3 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getResource_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRUCT) {\n            $this->success = new \\EDAM\\Types\\Resource();\n            $xfer += $this->success->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getResource_result');\n    if ($this->success !== null) {\n      if (!is_object($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);\n      $xfer += $this->success->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 3);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getResourceApplicationData_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $guid = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'guid',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['guid'])) {\n        $this->guid = $vals['guid'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getResourceApplicationData_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->guid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getResourceApplicationData_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->guid !== null) {\n      $xfer += $output->writeFieldBegin('guid', TType::STRING, 2);\n      $xfer += $output->writeString($this->guid);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getResourceApplicationData_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n  public $notFoundException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\LazyMap',\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        3 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getResourceApplicationData_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRUCT) {\n            $this->success = new \\EDAM\\Types\\LazyMap();\n            $xfer += $this->success->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getResourceApplicationData_result');\n    if ($this->success !== null) {\n      if (!is_object($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);\n      $xfer += $this->success->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 3);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getResourceApplicationDataEntry_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $guid = null;\n  public $key = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'guid',\n          'type' => TType::STRING,\n          ),\n        3 => array(\n          'var' => 'key',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['guid'])) {\n        $this->guid = $vals['guid'];\n      }\n      if (isset($vals['key'])) {\n        $this->key = $vals['key'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getResourceApplicationDataEntry_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->guid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->key);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getResourceApplicationDataEntry_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->guid !== null) {\n      $xfer += $output->writeFieldBegin('guid', TType::STRING, 2);\n      $xfer += $output->writeString($this->guid);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->key !== null) {\n      $xfer += $output->writeFieldBegin('key', TType::STRING, 3);\n      $xfer += $output->writeString($this->key);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getResourceApplicationDataEntry_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n  public $notFoundException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRING,\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        3 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getResourceApplicationDataEntry_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->success);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getResourceApplicationDataEntry_result');\n    if ($this->success !== null) {\n      $xfer += $output->writeFieldBegin('success', TType::STRING, 0);\n      $xfer += $output->writeString($this->success);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 3);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_setResourceApplicationDataEntry_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $guid = null;\n  public $key = null;\n  public $value = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'guid',\n          'type' => TType::STRING,\n          ),\n        3 => array(\n          'var' => 'key',\n          'type' => TType::STRING,\n          ),\n        4 => array(\n          'var' => 'value',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['guid'])) {\n        $this->guid = $vals['guid'];\n      }\n      if (isset($vals['key'])) {\n        $this->key = $vals['key'];\n      }\n      if (isset($vals['value'])) {\n        $this->value = $vals['value'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_setResourceApplicationDataEntry_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->guid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->key);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 4:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->value);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_setResourceApplicationDataEntry_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->guid !== null) {\n      $xfer += $output->writeFieldBegin('guid', TType::STRING, 2);\n      $xfer += $output->writeString($this->guid);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->key !== null) {\n      $xfer += $output->writeFieldBegin('key', TType::STRING, 3);\n      $xfer += $output->writeString($this->key);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->value !== null) {\n      $xfer += $output->writeFieldBegin('value', TType::STRING, 4);\n      $xfer += $output->writeString($this->value);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_setResourceApplicationDataEntry_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n  public $notFoundException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::I32,\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        3 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_setResourceApplicationDataEntry_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->success);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_setResourceApplicationDataEntry_result');\n    if ($this->success !== null) {\n      $xfer += $output->writeFieldBegin('success', TType::I32, 0);\n      $xfer += $output->writeI32($this->success);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 3);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_unsetResourceApplicationDataEntry_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $guid = null;\n  public $key = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'guid',\n          'type' => TType::STRING,\n          ),\n        3 => array(\n          'var' => 'key',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['guid'])) {\n        $this->guid = $vals['guid'];\n      }\n      if (isset($vals['key'])) {\n        $this->key = $vals['key'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_unsetResourceApplicationDataEntry_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->guid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->key);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_unsetResourceApplicationDataEntry_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->guid !== null) {\n      $xfer += $output->writeFieldBegin('guid', TType::STRING, 2);\n      $xfer += $output->writeString($this->guid);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->key !== null) {\n      $xfer += $output->writeFieldBegin('key', TType::STRING, 3);\n      $xfer += $output->writeString($this->key);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_unsetResourceApplicationDataEntry_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n  public $notFoundException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::I32,\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        3 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_unsetResourceApplicationDataEntry_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->success);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_unsetResourceApplicationDataEntry_result');\n    if ($this->success !== null) {\n      $xfer += $output->writeFieldBegin('success', TType::I32, 0);\n      $xfer += $output->writeI32($this->success);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 3);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_updateResource_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $resource = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'resource',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\Resource',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['resource'])) {\n        $this->resource = $vals['resource'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_updateResource_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->resource = new \\EDAM\\Types\\Resource();\n            $xfer += $this->resource->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_updateResource_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->resource !== null) {\n      if (!is_object($this->resource)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('resource', TType::STRUCT, 2);\n      $xfer += $this->resource->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_updateResource_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n  public $notFoundException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::I32,\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        3 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_updateResource_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->success);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_updateResource_result');\n    if ($this->success !== null) {\n      $xfer += $output->writeFieldBegin('success', TType::I32, 0);\n      $xfer += $output->writeI32($this->success);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 3);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getResourceData_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $guid = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'guid',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['guid'])) {\n        $this->guid = $vals['guid'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getResourceData_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->guid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getResourceData_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->guid !== null) {\n      $xfer += $output->writeFieldBegin('guid', TType::STRING, 2);\n      $xfer += $output->writeString($this->guid);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getResourceData_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n  public $notFoundException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRING,\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        3 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getResourceData_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->success);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getResourceData_result');\n    if ($this->success !== null) {\n      $xfer += $output->writeFieldBegin('success', TType::STRING, 0);\n      $xfer += $output->writeString($this->success);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 3);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getResourceByHash_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $noteGuid = null;\n  public $contentHash = null;\n  public $withData = null;\n  public $withRecognition = null;\n  public $withAlternateData = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'noteGuid',\n          'type' => TType::STRING,\n          ),\n        3 => array(\n          'var' => 'contentHash',\n          'type' => TType::STRING,\n          ),\n        4 => array(\n          'var' => 'withData',\n          'type' => TType::BOOL,\n          ),\n        5 => array(\n          'var' => 'withRecognition',\n          'type' => TType::BOOL,\n          ),\n        6 => array(\n          'var' => 'withAlternateData',\n          'type' => TType::BOOL,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['noteGuid'])) {\n        $this->noteGuid = $vals['noteGuid'];\n      }\n      if (isset($vals['contentHash'])) {\n        $this->contentHash = $vals['contentHash'];\n      }\n      if (isset($vals['withData'])) {\n        $this->withData = $vals['withData'];\n      }\n      if (isset($vals['withRecognition'])) {\n        $this->withRecognition = $vals['withRecognition'];\n      }\n      if (isset($vals['withAlternateData'])) {\n        $this->withAlternateData = $vals['withAlternateData'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getResourceByHash_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->noteGuid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->contentHash);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 4:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->withData);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 5:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->withRecognition);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 6:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->withAlternateData);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getResourceByHash_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->noteGuid !== null) {\n      $xfer += $output->writeFieldBegin('noteGuid', TType::STRING, 2);\n      $xfer += $output->writeString($this->noteGuid);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->contentHash !== null) {\n      $xfer += $output->writeFieldBegin('contentHash', TType::STRING, 3);\n      $xfer += $output->writeString($this->contentHash);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->withData !== null) {\n      $xfer += $output->writeFieldBegin('withData', TType::BOOL, 4);\n      $xfer += $output->writeBool($this->withData);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->withRecognition !== null) {\n      $xfer += $output->writeFieldBegin('withRecognition', TType::BOOL, 5);\n      $xfer += $output->writeBool($this->withRecognition);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->withAlternateData !== null) {\n      $xfer += $output->writeFieldBegin('withAlternateData', TType::BOOL, 6);\n      $xfer += $output->writeBool($this->withAlternateData);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getResourceByHash_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n  public $notFoundException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\Resource',\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        3 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getResourceByHash_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRUCT) {\n            $this->success = new \\EDAM\\Types\\Resource();\n            $xfer += $this->success->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getResourceByHash_result');\n    if ($this->success !== null) {\n      if (!is_object($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);\n      $xfer += $this->success->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 3);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getResourceRecognition_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $guid = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'guid',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['guid'])) {\n        $this->guid = $vals['guid'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getResourceRecognition_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->guid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getResourceRecognition_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->guid !== null) {\n      $xfer += $output->writeFieldBegin('guid', TType::STRING, 2);\n      $xfer += $output->writeString($this->guid);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getResourceRecognition_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n  public $notFoundException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRING,\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        3 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getResourceRecognition_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->success);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getResourceRecognition_result');\n    if ($this->success !== null) {\n      $xfer += $output->writeFieldBegin('success', TType::STRING, 0);\n      $xfer += $output->writeString($this->success);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 3);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getResourceAlternateData_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $guid = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'guid',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['guid'])) {\n        $this->guid = $vals['guid'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getResourceAlternateData_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->guid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getResourceAlternateData_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->guid !== null) {\n      $xfer += $output->writeFieldBegin('guid', TType::STRING, 2);\n      $xfer += $output->writeString($this->guid);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getResourceAlternateData_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n  public $notFoundException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRING,\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        3 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getResourceAlternateData_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->success);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getResourceAlternateData_result');\n    if ($this->success !== null) {\n      $xfer += $output->writeFieldBegin('success', TType::STRING, 0);\n      $xfer += $output->writeString($this->success);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 3);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getResourceAttributes_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $guid = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'guid',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['guid'])) {\n        $this->guid = $vals['guid'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getResourceAttributes_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->guid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getResourceAttributes_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->guid !== null) {\n      $xfer += $output->writeFieldBegin('guid', TType::STRING, 2);\n      $xfer += $output->writeString($this->guid);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getResourceAttributes_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n  public $notFoundException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\ResourceAttributes',\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        3 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getResourceAttributes_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRUCT) {\n            $this->success = new \\EDAM\\Types\\ResourceAttributes();\n            $xfer += $this->success->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getResourceAttributes_result');\n    if ($this->success !== null) {\n      if (!is_object($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);\n      $xfer += $this->success->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 3);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getPublicNotebook_args {\n  static $_TSPEC;\n\n  public $userId = null;\n  public $publicUri = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'userId',\n          'type' => TType::I32,\n          ),\n        2 => array(\n          'var' => 'publicUri',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['userId'])) {\n        $this->userId = $vals['userId'];\n      }\n      if (isset($vals['publicUri'])) {\n        $this->publicUri = $vals['publicUri'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getPublicNotebook_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->userId);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->publicUri);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getPublicNotebook_args');\n    if ($this->userId !== null) {\n      $xfer += $output->writeFieldBegin('userId', TType::I32, 1);\n      $xfer += $output->writeI32($this->userId);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->publicUri !== null) {\n      $xfer += $output->writeFieldBegin('publicUri', TType::STRING, 2);\n      $xfer += $output->writeString($this->publicUri);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getPublicNotebook_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $systemException = null;\n  public $notFoundException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\Notebook',\n          ),\n        1 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        2 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getPublicNotebook_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRUCT) {\n            $this->success = new \\EDAM\\Types\\Notebook();\n            $xfer += $this->success->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getPublicNotebook_result');\n    if ($this->success !== null) {\n      if (!is_object($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);\n      $xfer += $this->success->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 1);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 2);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_createSharedNotebook_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $sharedNotebook = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'sharedNotebook',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\SharedNotebook',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['sharedNotebook'])) {\n        $this->sharedNotebook = $vals['sharedNotebook'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_createSharedNotebook_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->sharedNotebook = new \\EDAM\\Types\\SharedNotebook();\n            $xfer += $this->sharedNotebook->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_createSharedNotebook_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->sharedNotebook !== null) {\n      if (!is_object($this->sharedNotebook)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('sharedNotebook', TType::STRUCT, 2);\n      $xfer += $this->sharedNotebook->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_createSharedNotebook_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $notFoundException = null;\n  public $systemException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\SharedNotebook',\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        3 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_createSharedNotebook_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRUCT) {\n            $this->success = new \\EDAM\\Types\\SharedNotebook();\n            $xfer += $this->success->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_createSharedNotebook_result');\n    if ($this->success !== null) {\n      if (!is_object($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);\n      $xfer += $this->success->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 2);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 3);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_updateSharedNotebook_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $sharedNotebook = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'sharedNotebook',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\SharedNotebook',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['sharedNotebook'])) {\n        $this->sharedNotebook = $vals['sharedNotebook'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_updateSharedNotebook_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->sharedNotebook = new \\EDAM\\Types\\SharedNotebook();\n            $xfer += $this->sharedNotebook->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_updateSharedNotebook_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->sharedNotebook !== null) {\n      if (!is_object($this->sharedNotebook)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('sharedNotebook', TType::STRUCT, 2);\n      $xfer += $this->sharedNotebook->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_updateSharedNotebook_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $notFoundException = null;\n  public $systemException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::I32,\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        3 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_updateSharedNotebook_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->success);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_updateSharedNotebook_result');\n    if ($this->success !== null) {\n      $xfer += $output->writeFieldBegin('success', TType::I32, 0);\n      $xfer += $output->writeI32($this->success);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 2);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 3);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_setSharedNotebookRecipientSettings_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $sharedNotebookId = null;\n  public $recipientSettings = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'sharedNotebookId',\n          'type' => TType::I64,\n          ),\n        3 => array(\n          'var' => 'recipientSettings',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\SharedNotebookRecipientSettings',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['sharedNotebookId'])) {\n        $this->sharedNotebookId = $vals['sharedNotebookId'];\n      }\n      if (isset($vals['recipientSettings'])) {\n        $this->recipientSettings = $vals['recipientSettings'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_setSharedNotebookRecipientSettings_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::I64) {\n            $xfer += $input->readI64($this->sharedNotebookId);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->recipientSettings = new \\EDAM\\Types\\SharedNotebookRecipientSettings();\n            $xfer += $this->recipientSettings->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_setSharedNotebookRecipientSettings_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->sharedNotebookId !== null) {\n      $xfer += $output->writeFieldBegin('sharedNotebookId', TType::I64, 2);\n      $xfer += $output->writeI64($this->sharedNotebookId);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->recipientSettings !== null) {\n      if (!is_object($this->recipientSettings)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('recipientSettings', TType::STRUCT, 3);\n      $xfer += $this->recipientSettings->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_setSharedNotebookRecipientSettings_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $notFoundException = null;\n  public $systemException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::I32,\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        3 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_setSharedNotebookRecipientSettings_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->success);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_setSharedNotebookRecipientSettings_result');\n    if ($this->success !== null) {\n      $xfer += $output->writeFieldBegin('success', TType::I32, 0);\n      $xfer += $output->writeI32($this->success);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 2);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 3);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_sendMessageToSharedNotebookMembers_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $notebookGuid = null;\n  public $messageText = null;\n  public $recipients = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'notebookGuid',\n          'type' => TType::STRING,\n          ),\n        3 => array(\n          'var' => 'messageText',\n          'type' => TType::STRING,\n          ),\n        4 => array(\n          'var' => 'recipients',\n          'type' => TType::LST,\n          'etype' => TType::STRING,\n          'elem' => array(\n            'type' => TType::STRING,\n            ),\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['notebookGuid'])) {\n        $this->notebookGuid = $vals['notebookGuid'];\n      }\n      if (isset($vals['messageText'])) {\n        $this->messageText = $vals['messageText'];\n      }\n      if (isset($vals['recipients'])) {\n        $this->recipients = $vals['recipients'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_sendMessageToSharedNotebookMembers_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->notebookGuid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->messageText);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 4:\n          if ($ftype == TType::LST) {\n            $this->recipients = array();\n            $_size242 = 0;\n            $_etype245 = 0;\n            $xfer += $input->readListBegin($_etype245, $_size242);\n            for ($_i246 = 0; $_i246 < $_size242; ++$_i246)\n            {\n              $elem247 = null;\n              $xfer += $input->readString($elem247);\n              $this->recipients []= $elem247;\n            }\n            $xfer += $input->readListEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_sendMessageToSharedNotebookMembers_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notebookGuid !== null) {\n      $xfer += $output->writeFieldBegin('notebookGuid', TType::STRING, 2);\n      $xfer += $output->writeString($this->notebookGuid);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->messageText !== null) {\n      $xfer += $output->writeFieldBegin('messageText', TType::STRING, 3);\n      $xfer += $output->writeString($this->messageText);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->recipients !== null) {\n      if (!is_array($this->recipients)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('recipients', TType::LST, 4);\n      {\n        $output->writeListBegin(TType::STRING, count($this->recipients));\n        {\n          foreach ($this->recipients as $iter248)\n          {\n            $xfer += $output->writeString($iter248);\n          }\n        }\n        $output->writeListEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_sendMessageToSharedNotebookMembers_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $notFoundException = null;\n  public $systemException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::I32,\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        3 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_sendMessageToSharedNotebookMembers_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->success);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_sendMessageToSharedNotebookMembers_result');\n    if ($this->success !== null) {\n      $xfer += $output->writeFieldBegin('success', TType::I32, 0);\n      $xfer += $output->writeI32($this->success);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 2);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 3);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_listSharedNotebooks_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_listSharedNotebooks_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_listSharedNotebooks_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_listSharedNotebooks_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $notFoundException = null;\n  public $systemException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::LST,\n          'etype' => TType::STRUCT,\n          'elem' => array(\n            'type' => TType::STRUCT,\n            'class' => '\\EDAM\\Types\\SharedNotebook',\n            ),\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        3 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_listSharedNotebooks_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::LST) {\n            $this->success = array();\n            $_size249 = 0;\n            $_etype252 = 0;\n            $xfer += $input->readListBegin($_etype252, $_size249);\n            for ($_i253 = 0; $_i253 < $_size249; ++$_i253)\n            {\n              $elem254 = null;\n              $elem254 = new \\EDAM\\Types\\SharedNotebook();\n              $xfer += $elem254->read($input);\n              $this->success []= $elem254;\n            }\n            $xfer += $input->readListEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_listSharedNotebooks_result');\n    if ($this->success !== null) {\n      if (!is_array($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::LST, 0);\n      {\n        $output->writeListBegin(TType::STRUCT, count($this->success));\n        {\n          foreach ($this->success as $iter255)\n          {\n            $xfer += $iter255->write($output);\n          }\n        }\n        $output->writeListEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 2);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 3);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_expungeSharedNotebooks_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $sharedNotebookIds = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'sharedNotebookIds',\n          'type' => TType::LST,\n          'etype' => TType::I64,\n          'elem' => array(\n            'type' => TType::I64,\n            ),\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['sharedNotebookIds'])) {\n        $this->sharedNotebookIds = $vals['sharedNotebookIds'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_expungeSharedNotebooks_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::LST) {\n            $this->sharedNotebookIds = array();\n            $_size256 = 0;\n            $_etype259 = 0;\n            $xfer += $input->readListBegin($_etype259, $_size256);\n            for ($_i260 = 0; $_i260 < $_size256; ++$_i260)\n            {\n              $elem261 = null;\n              $xfer += $input->readI64($elem261);\n              $this->sharedNotebookIds []= $elem261;\n            }\n            $xfer += $input->readListEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_expungeSharedNotebooks_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->sharedNotebookIds !== null) {\n      if (!is_array($this->sharedNotebookIds)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('sharedNotebookIds', TType::LST, 2);\n      {\n        $output->writeListBegin(TType::I64, count($this->sharedNotebookIds));\n        {\n          foreach ($this->sharedNotebookIds as $iter262)\n          {\n            $xfer += $output->writeI64($iter262);\n          }\n        }\n        $output->writeListEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_expungeSharedNotebooks_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $notFoundException = null;\n  public $systemException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::I32,\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        3 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_expungeSharedNotebooks_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->success);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_expungeSharedNotebooks_result');\n    if ($this->success !== null) {\n      $xfer += $output->writeFieldBegin('success', TType::I32, 0);\n      $xfer += $output->writeI32($this->success);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 2);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 3);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_createLinkedNotebook_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $linkedNotebook = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'linkedNotebook',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\LinkedNotebook',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['linkedNotebook'])) {\n        $this->linkedNotebook = $vals['linkedNotebook'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_createLinkedNotebook_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->linkedNotebook = new \\EDAM\\Types\\LinkedNotebook();\n            $xfer += $this->linkedNotebook->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_createLinkedNotebook_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->linkedNotebook !== null) {\n      if (!is_object($this->linkedNotebook)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('linkedNotebook', TType::STRUCT, 2);\n      $xfer += $this->linkedNotebook->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_createLinkedNotebook_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $notFoundException = null;\n  public $systemException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\LinkedNotebook',\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        3 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_createLinkedNotebook_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRUCT) {\n            $this->success = new \\EDAM\\Types\\LinkedNotebook();\n            $xfer += $this->success->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_createLinkedNotebook_result');\n    if ($this->success !== null) {\n      if (!is_object($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);\n      $xfer += $this->success->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 2);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 3);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_updateLinkedNotebook_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $linkedNotebook = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'linkedNotebook',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\LinkedNotebook',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['linkedNotebook'])) {\n        $this->linkedNotebook = $vals['linkedNotebook'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_updateLinkedNotebook_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->linkedNotebook = new \\EDAM\\Types\\LinkedNotebook();\n            $xfer += $this->linkedNotebook->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_updateLinkedNotebook_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->linkedNotebook !== null) {\n      if (!is_object($this->linkedNotebook)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('linkedNotebook', TType::STRUCT, 2);\n      $xfer += $this->linkedNotebook->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_updateLinkedNotebook_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $notFoundException = null;\n  public $systemException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::I32,\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        3 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_updateLinkedNotebook_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->success);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_updateLinkedNotebook_result');\n    if ($this->success !== null) {\n      $xfer += $output->writeFieldBegin('success', TType::I32, 0);\n      $xfer += $output->writeI32($this->success);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 2);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 3);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_listLinkedNotebooks_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_listLinkedNotebooks_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_listLinkedNotebooks_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_listLinkedNotebooks_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $notFoundException = null;\n  public $systemException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::LST,\n          'etype' => TType::STRUCT,\n          'elem' => array(\n            'type' => TType::STRUCT,\n            'class' => '\\EDAM\\Types\\LinkedNotebook',\n            ),\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        3 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_listLinkedNotebooks_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::LST) {\n            $this->success = array();\n            $_size263 = 0;\n            $_etype266 = 0;\n            $xfer += $input->readListBegin($_etype266, $_size263);\n            for ($_i267 = 0; $_i267 < $_size263; ++$_i267)\n            {\n              $elem268 = null;\n              $elem268 = new \\EDAM\\Types\\LinkedNotebook();\n              $xfer += $elem268->read($input);\n              $this->success []= $elem268;\n            }\n            $xfer += $input->readListEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_listLinkedNotebooks_result');\n    if ($this->success !== null) {\n      if (!is_array($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::LST, 0);\n      {\n        $output->writeListBegin(TType::STRUCT, count($this->success));\n        {\n          foreach ($this->success as $iter269)\n          {\n            $xfer += $iter269->write($output);\n          }\n        }\n        $output->writeListEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 2);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 3);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_expungeLinkedNotebook_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $guid = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'guid',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['guid'])) {\n        $this->guid = $vals['guid'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_expungeLinkedNotebook_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->guid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_expungeLinkedNotebook_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->guid !== null) {\n      $xfer += $output->writeFieldBegin('guid', TType::STRING, 2);\n      $xfer += $output->writeString($this->guid);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_expungeLinkedNotebook_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $notFoundException = null;\n  public $systemException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::I32,\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        3 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_expungeLinkedNotebook_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->success);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_expungeLinkedNotebook_result');\n    if ($this->success !== null) {\n      $xfer += $output->writeFieldBegin('success', TType::I32, 0);\n      $xfer += $output->writeI32($this->success);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 2);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 3);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_authenticateToSharedNotebook_args {\n  static $_TSPEC;\n\n  public $shareKey = null;\n  public $authenticationToken = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'shareKey',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['shareKey'])) {\n        $this->shareKey = $vals['shareKey'];\n      }\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_authenticateToSharedNotebook_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->shareKey);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_authenticateToSharedNotebook_args');\n    if ($this->shareKey !== null) {\n      $xfer += $output->writeFieldBegin('shareKey', TType::STRING, 1);\n      $xfer += $output->writeString($this->shareKey);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 2);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_authenticateToSharedNotebook_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $notFoundException = null;\n  public $systemException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\UserStore\\AuthenticationResult',\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        3 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_authenticateToSharedNotebook_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRUCT) {\n            $this->success = new \\EDAM\\UserStore\\AuthenticationResult();\n            $xfer += $this->success->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_authenticateToSharedNotebook_result');\n    if ($this->success !== null) {\n      if (!is_object($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);\n      $xfer += $this->success->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 2);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 3);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getSharedNotebookByAuth_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getSharedNotebookByAuth_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getSharedNotebookByAuth_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_getSharedNotebookByAuth_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $notFoundException = null;\n  public $systemException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\SharedNotebook',\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        3 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_getSharedNotebookByAuth_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRUCT) {\n            $this->success = new \\EDAM\\Types\\SharedNotebook();\n            $xfer += $this->success->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_getSharedNotebookByAuth_result');\n    if ($this->success !== null) {\n      if (!is_object($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);\n      $xfer += $this->success->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 2);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 3);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_emailNote_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $parameters = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'parameters',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\NoteStore\\NoteEmailParameters',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['parameters'])) {\n        $this->parameters = $vals['parameters'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_emailNote_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->parameters = new \\EDAM\\NoteStore\\NoteEmailParameters();\n            $xfer += $this->parameters->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_emailNote_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->parameters !== null) {\n      if (!is_object($this->parameters)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('parameters', TType::STRUCT, 2);\n      $xfer += $this->parameters->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_emailNote_result {\n  static $_TSPEC;\n\n  public $userException = null;\n  public $notFoundException = null;\n  public $systemException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        3 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_emailNote_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_emailNote_result');\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 2);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 3);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_shareNote_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $guid = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'guid',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['guid'])) {\n        $this->guid = $vals['guid'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_shareNote_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->guid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_shareNote_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->guid !== null) {\n      $xfer += $output->writeFieldBegin('guid', TType::STRING, 2);\n      $xfer += $output->writeString($this->guid);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_shareNote_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $notFoundException = null;\n  public $systemException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRING,\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        3 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_shareNote_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->success);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_shareNote_result');\n    if ($this->success !== null) {\n      $xfer += $output->writeFieldBegin('success', TType::STRING, 0);\n      $xfer += $output->writeString($this->success);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 2);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 3);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_stopSharingNote_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $guid = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'guid',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['guid'])) {\n        $this->guid = $vals['guid'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_stopSharingNote_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->guid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_stopSharingNote_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->guid !== null) {\n      $xfer += $output->writeFieldBegin('guid', TType::STRING, 2);\n      $xfer += $output->writeString($this->guid);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_stopSharingNote_result {\n  static $_TSPEC;\n\n  public $userException = null;\n  public $notFoundException = null;\n  public $systemException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        3 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_stopSharingNote_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_stopSharingNote_result');\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 2);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 3);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_authenticateToSharedNote_args {\n  static $_TSPEC;\n\n  public $guid = null;\n  public $noteKey = null;\n  public $authenticationToken = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'guid',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'noteKey',\n          'type' => TType::STRING,\n          ),\n        3 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['guid'])) {\n        $this->guid = $vals['guid'];\n      }\n      if (isset($vals['noteKey'])) {\n        $this->noteKey = $vals['noteKey'];\n      }\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_authenticateToSharedNote_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->guid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->noteKey);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_authenticateToSharedNote_args');\n    if ($this->guid !== null) {\n      $xfer += $output->writeFieldBegin('guid', TType::STRING, 1);\n      $xfer += $output->writeString($this->guid);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->noteKey !== null) {\n      $xfer += $output->writeFieldBegin('noteKey', TType::STRING, 2);\n      $xfer += $output->writeString($this->noteKey);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 3);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_authenticateToSharedNote_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $notFoundException = null;\n  public $systemException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\UserStore\\AuthenticationResult',\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        3 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_authenticateToSharedNote_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRUCT) {\n            $this->success = new \\EDAM\\UserStore\\AuthenticationResult();\n            $xfer += $this->success->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_authenticateToSharedNote_result');\n    if ($this->success !== null) {\n      if (!is_object($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);\n      $xfer += $this->success->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 2);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 3);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_findRelated_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $query = null;\n  public $resultSpec = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'query',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\NoteStore\\RelatedQuery',\n          ),\n        3 => array(\n          'var' => 'resultSpec',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\NoteStore\\RelatedResultSpec',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['query'])) {\n        $this->query = $vals['query'];\n      }\n      if (isset($vals['resultSpec'])) {\n        $this->resultSpec = $vals['resultSpec'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_findRelated_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->query = new \\EDAM\\NoteStore\\RelatedQuery();\n            $xfer += $this->query->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->resultSpec = new \\EDAM\\NoteStore\\RelatedResultSpec();\n            $xfer += $this->resultSpec->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_findRelated_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->query !== null) {\n      if (!is_object($this->query)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('query', TType::STRUCT, 2);\n      $xfer += $this->query->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->resultSpec !== null) {\n      if (!is_object($this->resultSpec)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('resultSpec', TType::STRUCT, 3);\n      $xfer += $this->resultSpec->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteStore_findRelated_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n  public $notFoundException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\NoteStore\\RelatedResult',\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        3 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteStore_findRelated_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRUCT) {\n            $this->success = new \\EDAM\\NoteStore\\RelatedResult();\n            $xfer += $this->success->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteStore_findRelated_result');\n    if ($this->success !== null) {\n      if (!is_object($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);\n      $xfer += $this->success->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 3);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\n\n"
  },
  {
    "path": "src/EDAM/NoteStore/Types.php",
    "content": "<?php\nnamespace EDAM\\NoteStore;\n\n/**\n * Autogenerated by Thrift Compiler (0.9.1)\n *\n * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING\n *  @generated\n */\nuse Thrift\\Base\\TBase;\nuse Thrift\\Type\\TType;\nuse Thrift\\Type\\TMessageType;\nuse Thrift\\Exception\\TException;\nuse Thrift\\Exception\\TProtocolException;\nuse Thrift\\Protocol\\TProtocol;\nuse Thrift\\Protocol\\TBinaryProtocolAccelerated;\nuse Thrift\\Exception\\TApplicationException;\n\n\nclass SyncState {\n  static $_TSPEC;\n\n  public $currentTime = null;\n  public $fullSyncBefore = null;\n  public $updateCount = null;\n  public $uploaded = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'currentTime',\n          'type' => TType::I64,\n          ),\n        2 => array(\n          'var' => 'fullSyncBefore',\n          'type' => TType::I64,\n          ),\n        3 => array(\n          'var' => 'updateCount',\n          'type' => TType::I32,\n          ),\n        4 => array(\n          'var' => 'uploaded',\n          'type' => TType::I64,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['currentTime'])) {\n        $this->currentTime = $vals['currentTime'];\n      }\n      if (isset($vals['fullSyncBefore'])) {\n        $this->fullSyncBefore = $vals['fullSyncBefore'];\n      }\n      if (isset($vals['updateCount'])) {\n        $this->updateCount = $vals['updateCount'];\n      }\n      if (isset($vals['uploaded'])) {\n        $this->uploaded = $vals['uploaded'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'SyncState';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::I64) {\n            $xfer += $input->readI64($this->currentTime);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::I64) {\n            $xfer += $input->readI64($this->fullSyncBefore);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->updateCount);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 4:\n          if ($ftype == TType::I64) {\n            $xfer += $input->readI64($this->uploaded);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('SyncState');\n    if ($this->currentTime !== null) {\n      $xfer += $output->writeFieldBegin('currentTime', TType::I64, 1);\n      $xfer += $output->writeI64($this->currentTime);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->fullSyncBefore !== null) {\n      $xfer += $output->writeFieldBegin('fullSyncBefore', TType::I64, 2);\n      $xfer += $output->writeI64($this->fullSyncBefore);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->updateCount !== null) {\n      $xfer += $output->writeFieldBegin('updateCount', TType::I32, 3);\n      $xfer += $output->writeI32($this->updateCount);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->uploaded !== null) {\n      $xfer += $output->writeFieldBegin('uploaded', TType::I64, 4);\n      $xfer += $output->writeI64($this->uploaded);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass SyncChunk {\n  static $_TSPEC;\n\n  public $currentTime = null;\n  public $chunkHighUSN = null;\n  public $updateCount = null;\n  public $notes = null;\n  public $notebooks = null;\n  public $tags = null;\n  public $searches = null;\n  public $resources = null;\n  public $expungedNotes = null;\n  public $expungedNotebooks = null;\n  public $expungedTags = null;\n  public $expungedSearches = null;\n  public $linkedNotebooks = null;\n  public $expungedLinkedNotebooks = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'currentTime',\n          'type' => TType::I64,\n          ),\n        2 => array(\n          'var' => 'chunkHighUSN',\n          'type' => TType::I32,\n          ),\n        3 => array(\n          'var' => 'updateCount',\n          'type' => TType::I32,\n          ),\n        4 => array(\n          'var' => 'notes',\n          'type' => TType::LST,\n          'etype' => TType::STRUCT,\n          'elem' => array(\n            'type' => TType::STRUCT,\n            'class' => '\\EDAM\\Types\\Note',\n            ),\n          ),\n        5 => array(\n          'var' => 'notebooks',\n          'type' => TType::LST,\n          'etype' => TType::STRUCT,\n          'elem' => array(\n            'type' => TType::STRUCT,\n            'class' => '\\EDAM\\Types\\Notebook',\n            ),\n          ),\n        6 => array(\n          'var' => 'tags',\n          'type' => TType::LST,\n          'etype' => TType::STRUCT,\n          'elem' => array(\n            'type' => TType::STRUCT,\n            'class' => '\\EDAM\\Types\\Tag',\n            ),\n          ),\n        7 => array(\n          'var' => 'searches',\n          'type' => TType::LST,\n          'etype' => TType::STRUCT,\n          'elem' => array(\n            'type' => TType::STRUCT,\n            'class' => '\\EDAM\\Types\\SavedSearch',\n            ),\n          ),\n        8 => array(\n          'var' => 'resources',\n          'type' => TType::LST,\n          'etype' => TType::STRUCT,\n          'elem' => array(\n            'type' => TType::STRUCT,\n            'class' => '\\EDAM\\Types\\Resource',\n            ),\n          ),\n        9 => array(\n          'var' => 'expungedNotes',\n          'type' => TType::LST,\n          'etype' => TType::STRING,\n          'elem' => array(\n            'type' => TType::STRING,\n            ),\n          ),\n        10 => array(\n          'var' => 'expungedNotebooks',\n          'type' => TType::LST,\n          'etype' => TType::STRING,\n          'elem' => array(\n            'type' => TType::STRING,\n            ),\n          ),\n        11 => array(\n          'var' => 'expungedTags',\n          'type' => TType::LST,\n          'etype' => TType::STRING,\n          'elem' => array(\n            'type' => TType::STRING,\n            ),\n          ),\n        12 => array(\n          'var' => 'expungedSearches',\n          'type' => TType::LST,\n          'etype' => TType::STRING,\n          'elem' => array(\n            'type' => TType::STRING,\n            ),\n          ),\n        13 => array(\n          'var' => 'linkedNotebooks',\n          'type' => TType::LST,\n          'etype' => TType::STRUCT,\n          'elem' => array(\n            'type' => TType::STRUCT,\n            'class' => '\\EDAM\\Types\\LinkedNotebook',\n            ),\n          ),\n        14 => array(\n          'var' => 'expungedLinkedNotebooks',\n          'type' => TType::LST,\n          'etype' => TType::STRING,\n          'elem' => array(\n            'type' => TType::STRING,\n            ),\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['currentTime'])) {\n        $this->currentTime = $vals['currentTime'];\n      }\n      if (isset($vals['chunkHighUSN'])) {\n        $this->chunkHighUSN = $vals['chunkHighUSN'];\n      }\n      if (isset($vals['updateCount'])) {\n        $this->updateCount = $vals['updateCount'];\n      }\n      if (isset($vals['notes'])) {\n        $this->notes = $vals['notes'];\n      }\n      if (isset($vals['notebooks'])) {\n        $this->notebooks = $vals['notebooks'];\n      }\n      if (isset($vals['tags'])) {\n        $this->tags = $vals['tags'];\n      }\n      if (isset($vals['searches'])) {\n        $this->searches = $vals['searches'];\n      }\n      if (isset($vals['resources'])) {\n        $this->resources = $vals['resources'];\n      }\n      if (isset($vals['expungedNotes'])) {\n        $this->expungedNotes = $vals['expungedNotes'];\n      }\n      if (isset($vals['expungedNotebooks'])) {\n        $this->expungedNotebooks = $vals['expungedNotebooks'];\n      }\n      if (isset($vals['expungedTags'])) {\n        $this->expungedTags = $vals['expungedTags'];\n      }\n      if (isset($vals['expungedSearches'])) {\n        $this->expungedSearches = $vals['expungedSearches'];\n      }\n      if (isset($vals['linkedNotebooks'])) {\n        $this->linkedNotebooks = $vals['linkedNotebooks'];\n      }\n      if (isset($vals['expungedLinkedNotebooks'])) {\n        $this->expungedLinkedNotebooks = $vals['expungedLinkedNotebooks'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'SyncChunk';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::I64) {\n            $xfer += $input->readI64($this->currentTime);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->chunkHighUSN);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->updateCount);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 4:\n          if ($ftype == TType::LST) {\n            $this->notes = array();\n            $_size0 = 0;\n            $_etype3 = 0;\n            $xfer += $input->readListBegin($_etype3, $_size0);\n            for ($_i4 = 0; $_i4 < $_size0; ++$_i4)\n            {\n              $elem5 = null;\n              $elem5 = new \\EDAM\\Types\\Note();\n              $xfer += $elem5->read($input);\n              $this->notes []= $elem5;\n            }\n            $xfer += $input->readListEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 5:\n          if ($ftype == TType::LST) {\n            $this->notebooks = array();\n            $_size6 = 0;\n            $_etype9 = 0;\n            $xfer += $input->readListBegin($_etype9, $_size6);\n            for ($_i10 = 0; $_i10 < $_size6; ++$_i10)\n            {\n              $elem11 = null;\n              $elem11 = new \\EDAM\\Types\\Notebook();\n              $xfer += $elem11->read($input);\n              $this->notebooks []= $elem11;\n            }\n            $xfer += $input->readListEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 6:\n          if ($ftype == TType::LST) {\n            $this->tags = array();\n            $_size12 = 0;\n            $_etype15 = 0;\n            $xfer += $input->readListBegin($_etype15, $_size12);\n            for ($_i16 = 0; $_i16 < $_size12; ++$_i16)\n            {\n              $elem17 = null;\n              $elem17 = new \\EDAM\\Types\\Tag();\n              $xfer += $elem17->read($input);\n              $this->tags []= $elem17;\n            }\n            $xfer += $input->readListEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 7:\n          if ($ftype == TType::LST) {\n            $this->searches = array();\n            $_size18 = 0;\n            $_etype21 = 0;\n            $xfer += $input->readListBegin($_etype21, $_size18);\n            for ($_i22 = 0; $_i22 < $_size18; ++$_i22)\n            {\n              $elem23 = null;\n              $elem23 = new \\EDAM\\Types\\SavedSearch();\n              $xfer += $elem23->read($input);\n              $this->searches []= $elem23;\n            }\n            $xfer += $input->readListEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 8:\n          if ($ftype == TType::LST) {\n            $this->resources = array();\n            $_size24 = 0;\n            $_etype27 = 0;\n            $xfer += $input->readListBegin($_etype27, $_size24);\n            for ($_i28 = 0; $_i28 < $_size24; ++$_i28)\n            {\n              $elem29 = null;\n              $elem29 = new \\EDAM\\Types\\Resource();\n              $xfer += $elem29->read($input);\n              $this->resources []= $elem29;\n            }\n            $xfer += $input->readListEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 9:\n          if ($ftype == TType::LST) {\n            $this->expungedNotes = array();\n            $_size30 = 0;\n            $_etype33 = 0;\n            $xfer += $input->readListBegin($_etype33, $_size30);\n            for ($_i34 = 0; $_i34 < $_size30; ++$_i34)\n            {\n              $elem35 = null;\n              $xfer += $input->readString($elem35);\n              $this->expungedNotes []= $elem35;\n            }\n            $xfer += $input->readListEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 10:\n          if ($ftype == TType::LST) {\n            $this->expungedNotebooks = array();\n            $_size36 = 0;\n            $_etype39 = 0;\n            $xfer += $input->readListBegin($_etype39, $_size36);\n            for ($_i40 = 0; $_i40 < $_size36; ++$_i40)\n            {\n              $elem41 = null;\n              $xfer += $input->readString($elem41);\n              $this->expungedNotebooks []= $elem41;\n            }\n            $xfer += $input->readListEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 11:\n          if ($ftype == TType::LST) {\n            $this->expungedTags = array();\n            $_size42 = 0;\n            $_etype45 = 0;\n            $xfer += $input->readListBegin($_etype45, $_size42);\n            for ($_i46 = 0; $_i46 < $_size42; ++$_i46)\n            {\n              $elem47 = null;\n              $xfer += $input->readString($elem47);\n              $this->expungedTags []= $elem47;\n            }\n            $xfer += $input->readListEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 12:\n          if ($ftype == TType::LST) {\n            $this->expungedSearches = array();\n            $_size48 = 0;\n            $_etype51 = 0;\n            $xfer += $input->readListBegin($_etype51, $_size48);\n            for ($_i52 = 0; $_i52 < $_size48; ++$_i52)\n            {\n              $elem53 = null;\n              $xfer += $input->readString($elem53);\n              $this->expungedSearches []= $elem53;\n            }\n            $xfer += $input->readListEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 13:\n          if ($ftype == TType::LST) {\n            $this->linkedNotebooks = array();\n            $_size54 = 0;\n            $_etype57 = 0;\n            $xfer += $input->readListBegin($_etype57, $_size54);\n            for ($_i58 = 0; $_i58 < $_size54; ++$_i58)\n            {\n              $elem59 = null;\n              $elem59 = new \\EDAM\\Types\\LinkedNotebook();\n              $xfer += $elem59->read($input);\n              $this->linkedNotebooks []= $elem59;\n            }\n            $xfer += $input->readListEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 14:\n          if ($ftype == TType::LST) {\n            $this->expungedLinkedNotebooks = array();\n            $_size60 = 0;\n            $_etype63 = 0;\n            $xfer += $input->readListBegin($_etype63, $_size60);\n            for ($_i64 = 0; $_i64 < $_size60; ++$_i64)\n            {\n              $elem65 = null;\n              $xfer += $input->readString($elem65);\n              $this->expungedLinkedNotebooks []= $elem65;\n            }\n            $xfer += $input->readListEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('SyncChunk');\n    if ($this->currentTime !== null) {\n      $xfer += $output->writeFieldBegin('currentTime', TType::I64, 1);\n      $xfer += $output->writeI64($this->currentTime);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->chunkHighUSN !== null) {\n      $xfer += $output->writeFieldBegin('chunkHighUSN', TType::I32, 2);\n      $xfer += $output->writeI32($this->chunkHighUSN);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->updateCount !== null) {\n      $xfer += $output->writeFieldBegin('updateCount', TType::I32, 3);\n      $xfer += $output->writeI32($this->updateCount);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notes !== null) {\n      if (!is_array($this->notes)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('notes', TType::LST, 4);\n      {\n        $output->writeListBegin(TType::STRUCT, count($this->notes));\n        {\n          foreach ($this->notes as $iter66)\n          {\n            $xfer += $iter66->write($output);\n          }\n        }\n        $output->writeListEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notebooks !== null) {\n      if (!is_array($this->notebooks)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('notebooks', TType::LST, 5);\n      {\n        $output->writeListBegin(TType::STRUCT, count($this->notebooks));\n        {\n          foreach ($this->notebooks as $iter67)\n          {\n            $xfer += $iter67->write($output);\n          }\n        }\n        $output->writeListEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->tags !== null) {\n      if (!is_array($this->tags)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('tags', TType::LST, 6);\n      {\n        $output->writeListBegin(TType::STRUCT, count($this->tags));\n        {\n          foreach ($this->tags as $iter68)\n          {\n            $xfer += $iter68->write($output);\n          }\n        }\n        $output->writeListEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->searches !== null) {\n      if (!is_array($this->searches)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('searches', TType::LST, 7);\n      {\n        $output->writeListBegin(TType::STRUCT, count($this->searches));\n        {\n          foreach ($this->searches as $iter69)\n          {\n            $xfer += $iter69->write($output);\n          }\n        }\n        $output->writeListEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->resources !== null) {\n      if (!is_array($this->resources)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('resources', TType::LST, 8);\n      {\n        $output->writeListBegin(TType::STRUCT, count($this->resources));\n        {\n          foreach ($this->resources as $iter70)\n          {\n            $xfer += $iter70->write($output);\n          }\n        }\n        $output->writeListEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->expungedNotes !== null) {\n      if (!is_array($this->expungedNotes)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('expungedNotes', TType::LST, 9);\n      {\n        $output->writeListBegin(TType::STRING, count($this->expungedNotes));\n        {\n          foreach ($this->expungedNotes as $iter71)\n          {\n            $xfer += $output->writeString($iter71);\n          }\n        }\n        $output->writeListEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->expungedNotebooks !== null) {\n      if (!is_array($this->expungedNotebooks)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('expungedNotebooks', TType::LST, 10);\n      {\n        $output->writeListBegin(TType::STRING, count($this->expungedNotebooks));\n        {\n          foreach ($this->expungedNotebooks as $iter72)\n          {\n            $xfer += $output->writeString($iter72);\n          }\n        }\n        $output->writeListEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->expungedTags !== null) {\n      if (!is_array($this->expungedTags)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('expungedTags', TType::LST, 11);\n      {\n        $output->writeListBegin(TType::STRING, count($this->expungedTags));\n        {\n          foreach ($this->expungedTags as $iter73)\n          {\n            $xfer += $output->writeString($iter73);\n          }\n        }\n        $output->writeListEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->expungedSearches !== null) {\n      if (!is_array($this->expungedSearches)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('expungedSearches', TType::LST, 12);\n      {\n        $output->writeListBegin(TType::STRING, count($this->expungedSearches));\n        {\n          foreach ($this->expungedSearches as $iter74)\n          {\n            $xfer += $output->writeString($iter74);\n          }\n        }\n        $output->writeListEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->linkedNotebooks !== null) {\n      if (!is_array($this->linkedNotebooks)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('linkedNotebooks', TType::LST, 13);\n      {\n        $output->writeListBegin(TType::STRUCT, count($this->linkedNotebooks));\n        {\n          foreach ($this->linkedNotebooks as $iter75)\n          {\n            $xfer += $iter75->write($output);\n          }\n        }\n        $output->writeListEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->expungedLinkedNotebooks !== null) {\n      if (!is_array($this->expungedLinkedNotebooks)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('expungedLinkedNotebooks', TType::LST, 14);\n      {\n        $output->writeListBegin(TType::STRING, count($this->expungedLinkedNotebooks));\n        {\n          foreach ($this->expungedLinkedNotebooks as $iter76)\n          {\n            $xfer += $output->writeString($iter76);\n          }\n        }\n        $output->writeListEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass SyncChunkFilter {\n  static $_TSPEC;\n\n  public $includeNotes = null;\n  public $includeNoteResources = null;\n  public $includeNoteAttributes = null;\n  public $includeNotebooks = null;\n  public $includeTags = null;\n  public $includeSearches = null;\n  public $includeResources = null;\n  public $includeLinkedNotebooks = null;\n  public $includeExpunged = null;\n  public $includeNoteApplicationDataFullMap = null;\n  public $includeResourceApplicationDataFullMap = null;\n  public $includeNoteResourceApplicationDataFullMap = null;\n  public $requireNoteContentClass = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'includeNotes',\n          'type' => TType::BOOL,\n          ),\n        2 => array(\n          'var' => 'includeNoteResources',\n          'type' => TType::BOOL,\n          ),\n        3 => array(\n          'var' => 'includeNoteAttributes',\n          'type' => TType::BOOL,\n          ),\n        4 => array(\n          'var' => 'includeNotebooks',\n          'type' => TType::BOOL,\n          ),\n        5 => array(\n          'var' => 'includeTags',\n          'type' => TType::BOOL,\n          ),\n        6 => array(\n          'var' => 'includeSearches',\n          'type' => TType::BOOL,\n          ),\n        7 => array(\n          'var' => 'includeResources',\n          'type' => TType::BOOL,\n          ),\n        8 => array(\n          'var' => 'includeLinkedNotebooks',\n          'type' => TType::BOOL,\n          ),\n        9 => array(\n          'var' => 'includeExpunged',\n          'type' => TType::BOOL,\n          ),\n        10 => array(\n          'var' => 'includeNoteApplicationDataFullMap',\n          'type' => TType::BOOL,\n          ),\n        12 => array(\n          'var' => 'includeResourceApplicationDataFullMap',\n          'type' => TType::BOOL,\n          ),\n        13 => array(\n          'var' => 'includeNoteResourceApplicationDataFullMap',\n          'type' => TType::BOOL,\n          ),\n        11 => array(\n          'var' => 'requireNoteContentClass',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['includeNotes'])) {\n        $this->includeNotes = $vals['includeNotes'];\n      }\n      if (isset($vals['includeNoteResources'])) {\n        $this->includeNoteResources = $vals['includeNoteResources'];\n      }\n      if (isset($vals['includeNoteAttributes'])) {\n        $this->includeNoteAttributes = $vals['includeNoteAttributes'];\n      }\n      if (isset($vals['includeNotebooks'])) {\n        $this->includeNotebooks = $vals['includeNotebooks'];\n      }\n      if (isset($vals['includeTags'])) {\n        $this->includeTags = $vals['includeTags'];\n      }\n      if (isset($vals['includeSearches'])) {\n        $this->includeSearches = $vals['includeSearches'];\n      }\n      if (isset($vals['includeResources'])) {\n        $this->includeResources = $vals['includeResources'];\n      }\n      if (isset($vals['includeLinkedNotebooks'])) {\n        $this->includeLinkedNotebooks = $vals['includeLinkedNotebooks'];\n      }\n      if (isset($vals['includeExpunged'])) {\n        $this->includeExpunged = $vals['includeExpunged'];\n      }\n      if (isset($vals['includeNoteApplicationDataFullMap'])) {\n        $this->includeNoteApplicationDataFullMap = $vals['includeNoteApplicationDataFullMap'];\n      }\n      if (isset($vals['includeResourceApplicationDataFullMap'])) {\n        $this->includeResourceApplicationDataFullMap = $vals['includeResourceApplicationDataFullMap'];\n      }\n      if (isset($vals['includeNoteResourceApplicationDataFullMap'])) {\n        $this->includeNoteResourceApplicationDataFullMap = $vals['includeNoteResourceApplicationDataFullMap'];\n      }\n      if (isset($vals['requireNoteContentClass'])) {\n        $this->requireNoteContentClass = $vals['requireNoteContentClass'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'SyncChunkFilter';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->includeNotes);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->includeNoteResources);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->includeNoteAttributes);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 4:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->includeNotebooks);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 5:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->includeTags);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 6:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->includeSearches);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 7:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->includeResources);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 8:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->includeLinkedNotebooks);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 9:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->includeExpunged);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 10:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->includeNoteApplicationDataFullMap);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 12:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->includeResourceApplicationDataFullMap);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 13:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->includeNoteResourceApplicationDataFullMap);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 11:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->requireNoteContentClass);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('SyncChunkFilter');\n    if ($this->includeNotes !== null) {\n      $xfer += $output->writeFieldBegin('includeNotes', TType::BOOL, 1);\n      $xfer += $output->writeBool($this->includeNotes);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->includeNoteResources !== null) {\n      $xfer += $output->writeFieldBegin('includeNoteResources', TType::BOOL, 2);\n      $xfer += $output->writeBool($this->includeNoteResources);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->includeNoteAttributes !== null) {\n      $xfer += $output->writeFieldBegin('includeNoteAttributes', TType::BOOL, 3);\n      $xfer += $output->writeBool($this->includeNoteAttributes);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->includeNotebooks !== null) {\n      $xfer += $output->writeFieldBegin('includeNotebooks', TType::BOOL, 4);\n      $xfer += $output->writeBool($this->includeNotebooks);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->includeTags !== null) {\n      $xfer += $output->writeFieldBegin('includeTags', TType::BOOL, 5);\n      $xfer += $output->writeBool($this->includeTags);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->includeSearches !== null) {\n      $xfer += $output->writeFieldBegin('includeSearches', TType::BOOL, 6);\n      $xfer += $output->writeBool($this->includeSearches);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->includeResources !== null) {\n      $xfer += $output->writeFieldBegin('includeResources', TType::BOOL, 7);\n      $xfer += $output->writeBool($this->includeResources);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->includeLinkedNotebooks !== null) {\n      $xfer += $output->writeFieldBegin('includeLinkedNotebooks', TType::BOOL, 8);\n      $xfer += $output->writeBool($this->includeLinkedNotebooks);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->includeExpunged !== null) {\n      $xfer += $output->writeFieldBegin('includeExpunged', TType::BOOL, 9);\n      $xfer += $output->writeBool($this->includeExpunged);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->includeNoteApplicationDataFullMap !== null) {\n      $xfer += $output->writeFieldBegin('includeNoteApplicationDataFullMap', TType::BOOL, 10);\n      $xfer += $output->writeBool($this->includeNoteApplicationDataFullMap);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->requireNoteContentClass !== null) {\n      $xfer += $output->writeFieldBegin('requireNoteContentClass', TType::STRING, 11);\n      $xfer += $output->writeString($this->requireNoteContentClass);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->includeResourceApplicationDataFullMap !== null) {\n      $xfer += $output->writeFieldBegin('includeResourceApplicationDataFullMap', TType::BOOL, 12);\n      $xfer += $output->writeBool($this->includeResourceApplicationDataFullMap);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->includeNoteResourceApplicationDataFullMap !== null) {\n      $xfer += $output->writeFieldBegin('includeNoteResourceApplicationDataFullMap', TType::BOOL, 13);\n      $xfer += $output->writeBool($this->includeNoteResourceApplicationDataFullMap);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteFilter {\n  static $_TSPEC;\n\n  public $order = null;\n  public $ascending = null;\n  public $words = null;\n  public $notebookGuid = null;\n  public $tagGuids = null;\n  public $timeZone = null;\n  public $inactive = null;\n  public $emphasized = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'order',\n          'type' => TType::I32,\n          ),\n        2 => array(\n          'var' => 'ascending',\n          'type' => TType::BOOL,\n          ),\n        3 => array(\n          'var' => 'words',\n          'type' => TType::STRING,\n          ),\n        4 => array(\n          'var' => 'notebookGuid',\n          'type' => TType::STRING,\n          ),\n        5 => array(\n          'var' => 'tagGuids',\n          'type' => TType::LST,\n          'etype' => TType::STRING,\n          'elem' => array(\n            'type' => TType::STRING,\n            ),\n          ),\n        6 => array(\n          'var' => 'timeZone',\n          'type' => TType::STRING,\n          ),\n        7 => array(\n          'var' => 'inactive',\n          'type' => TType::BOOL,\n          ),\n        8 => array(\n          'var' => 'emphasized',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['order'])) {\n        $this->order = $vals['order'];\n      }\n      if (isset($vals['ascending'])) {\n        $this->ascending = $vals['ascending'];\n      }\n      if (isset($vals['words'])) {\n        $this->words = $vals['words'];\n      }\n      if (isset($vals['notebookGuid'])) {\n        $this->notebookGuid = $vals['notebookGuid'];\n      }\n      if (isset($vals['tagGuids'])) {\n        $this->tagGuids = $vals['tagGuids'];\n      }\n      if (isset($vals['timeZone'])) {\n        $this->timeZone = $vals['timeZone'];\n      }\n      if (isset($vals['inactive'])) {\n        $this->inactive = $vals['inactive'];\n      }\n      if (isset($vals['emphasized'])) {\n        $this->emphasized = $vals['emphasized'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteFilter';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->order);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->ascending);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->words);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 4:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->notebookGuid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 5:\n          if ($ftype == TType::LST) {\n            $this->tagGuids = array();\n            $_size77 = 0;\n            $_etype80 = 0;\n            $xfer += $input->readListBegin($_etype80, $_size77);\n            for ($_i81 = 0; $_i81 < $_size77; ++$_i81)\n            {\n              $elem82 = null;\n              $xfer += $input->readString($elem82);\n              $this->tagGuids []= $elem82;\n            }\n            $xfer += $input->readListEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 6:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->timeZone);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 7:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->inactive);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 8:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->emphasized);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteFilter');\n    if ($this->order !== null) {\n      $xfer += $output->writeFieldBegin('order', TType::I32, 1);\n      $xfer += $output->writeI32($this->order);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->ascending !== null) {\n      $xfer += $output->writeFieldBegin('ascending', TType::BOOL, 2);\n      $xfer += $output->writeBool($this->ascending);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->words !== null) {\n      $xfer += $output->writeFieldBegin('words', TType::STRING, 3);\n      $xfer += $output->writeString($this->words);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notebookGuid !== null) {\n      $xfer += $output->writeFieldBegin('notebookGuid', TType::STRING, 4);\n      $xfer += $output->writeString($this->notebookGuid);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->tagGuids !== null) {\n      if (!is_array($this->tagGuids)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('tagGuids', TType::LST, 5);\n      {\n        $output->writeListBegin(TType::STRING, count($this->tagGuids));\n        {\n          foreach ($this->tagGuids as $iter83)\n          {\n            $xfer += $output->writeString($iter83);\n          }\n        }\n        $output->writeListEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->timeZone !== null) {\n      $xfer += $output->writeFieldBegin('timeZone', TType::STRING, 6);\n      $xfer += $output->writeString($this->timeZone);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->inactive !== null) {\n      $xfer += $output->writeFieldBegin('inactive', TType::BOOL, 7);\n      $xfer += $output->writeBool($this->inactive);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->emphasized !== null) {\n      $xfer += $output->writeFieldBegin('emphasized', TType::STRING, 8);\n      $xfer += $output->writeString($this->emphasized);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteList {\n  static $_TSPEC;\n\n  public $startIndex = null;\n  public $totalNotes = null;\n  public $notes = null;\n  public $stoppedWords = null;\n  public $searchedWords = null;\n  public $updateCount = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'startIndex',\n          'type' => TType::I32,\n          ),\n        2 => array(\n          'var' => 'totalNotes',\n          'type' => TType::I32,\n          ),\n        3 => array(\n          'var' => 'notes',\n          'type' => TType::LST,\n          'etype' => TType::STRUCT,\n          'elem' => array(\n            'type' => TType::STRUCT,\n            'class' => '\\EDAM\\Types\\Note',\n            ),\n          ),\n        4 => array(\n          'var' => 'stoppedWords',\n          'type' => TType::LST,\n          'etype' => TType::STRING,\n          'elem' => array(\n            'type' => TType::STRING,\n            ),\n          ),\n        5 => array(\n          'var' => 'searchedWords',\n          'type' => TType::LST,\n          'etype' => TType::STRING,\n          'elem' => array(\n            'type' => TType::STRING,\n            ),\n          ),\n        6 => array(\n          'var' => 'updateCount',\n          'type' => TType::I32,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['startIndex'])) {\n        $this->startIndex = $vals['startIndex'];\n      }\n      if (isset($vals['totalNotes'])) {\n        $this->totalNotes = $vals['totalNotes'];\n      }\n      if (isset($vals['notes'])) {\n        $this->notes = $vals['notes'];\n      }\n      if (isset($vals['stoppedWords'])) {\n        $this->stoppedWords = $vals['stoppedWords'];\n      }\n      if (isset($vals['searchedWords'])) {\n        $this->searchedWords = $vals['searchedWords'];\n      }\n      if (isset($vals['updateCount'])) {\n        $this->updateCount = $vals['updateCount'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteList';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->startIndex);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->totalNotes);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::LST) {\n            $this->notes = array();\n            $_size84 = 0;\n            $_etype87 = 0;\n            $xfer += $input->readListBegin($_etype87, $_size84);\n            for ($_i88 = 0; $_i88 < $_size84; ++$_i88)\n            {\n              $elem89 = null;\n              $elem89 = new \\EDAM\\Types\\Note();\n              $xfer += $elem89->read($input);\n              $this->notes []= $elem89;\n            }\n            $xfer += $input->readListEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 4:\n          if ($ftype == TType::LST) {\n            $this->stoppedWords = array();\n            $_size90 = 0;\n            $_etype93 = 0;\n            $xfer += $input->readListBegin($_etype93, $_size90);\n            for ($_i94 = 0; $_i94 < $_size90; ++$_i94)\n            {\n              $elem95 = null;\n              $xfer += $input->readString($elem95);\n              $this->stoppedWords []= $elem95;\n            }\n            $xfer += $input->readListEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 5:\n          if ($ftype == TType::LST) {\n            $this->searchedWords = array();\n            $_size96 = 0;\n            $_etype99 = 0;\n            $xfer += $input->readListBegin($_etype99, $_size96);\n            for ($_i100 = 0; $_i100 < $_size96; ++$_i100)\n            {\n              $elem101 = null;\n              $xfer += $input->readString($elem101);\n              $this->searchedWords []= $elem101;\n            }\n            $xfer += $input->readListEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 6:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->updateCount);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteList');\n    if ($this->startIndex !== null) {\n      $xfer += $output->writeFieldBegin('startIndex', TType::I32, 1);\n      $xfer += $output->writeI32($this->startIndex);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->totalNotes !== null) {\n      $xfer += $output->writeFieldBegin('totalNotes', TType::I32, 2);\n      $xfer += $output->writeI32($this->totalNotes);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notes !== null) {\n      if (!is_array($this->notes)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('notes', TType::LST, 3);\n      {\n        $output->writeListBegin(TType::STRUCT, count($this->notes));\n        {\n          foreach ($this->notes as $iter102)\n          {\n            $xfer += $iter102->write($output);\n          }\n        }\n        $output->writeListEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->stoppedWords !== null) {\n      if (!is_array($this->stoppedWords)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('stoppedWords', TType::LST, 4);\n      {\n        $output->writeListBegin(TType::STRING, count($this->stoppedWords));\n        {\n          foreach ($this->stoppedWords as $iter103)\n          {\n            $xfer += $output->writeString($iter103);\n          }\n        }\n        $output->writeListEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->searchedWords !== null) {\n      if (!is_array($this->searchedWords)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('searchedWords', TType::LST, 5);\n      {\n        $output->writeListBegin(TType::STRING, count($this->searchedWords));\n        {\n          foreach ($this->searchedWords as $iter104)\n          {\n            $xfer += $output->writeString($iter104);\n          }\n        }\n        $output->writeListEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->updateCount !== null) {\n      $xfer += $output->writeFieldBegin('updateCount', TType::I32, 6);\n      $xfer += $output->writeI32($this->updateCount);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteMetadata {\n  static $_TSPEC;\n\n  public $guid = null;\n  public $title = null;\n  public $contentLength = null;\n  public $created = null;\n  public $updated = null;\n  public $deleted = null;\n  public $updateSequenceNum = null;\n  public $notebookGuid = null;\n  public $tagGuids = null;\n  public $attributes = null;\n  public $largestResourceMime = null;\n  public $largestResourceSize = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'guid',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'title',\n          'type' => TType::STRING,\n          ),\n        5 => array(\n          'var' => 'contentLength',\n          'type' => TType::I32,\n          ),\n        6 => array(\n          'var' => 'created',\n          'type' => TType::I64,\n          ),\n        7 => array(\n          'var' => 'updated',\n          'type' => TType::I64,\n          ),\n        8 => array(\n          'var' => 'deleted',\n          'type' => TType::I64,\n          ),\n        10 => array(\n          'var' => 'updateSequenceNum',\n          'type' => TType::I32,\n          ),\n        11 => array(\n          'var' => 'notebookGuid',\n          'type' => TType::STRING,\n          ),\n        12 => array(\n          'var' => 'tagGuids',\n          'type' => TType::LST,\n          'etype' => TType::STRING,\n          'elem' => array(\n            'type' => TType::STRING,\n            ),\n          ),\n        14 => array(\n          'var' => 'attributes',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\NoteAttributes',\n          ),\n        20 => array(\n          'var' => 'largestResourceMime',\n          'type' => TType::STRING,\n          ),\n        21 => array(\n          'var' => 'largestResourceSize',\n          'type' => TType::I32,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['guid'])) {\n        $this->guid = $vals['guid'];\n      }\n      if (isset($vals['title'])) {\n        $this->title = $vals['title'];\n      }\n      if (isset($vals['contentLength'])) {\n        $this->contentLength = $vals['contentLength'];\n      }\n      if (isset($vals['created'])) {\n        $this->created = $vals['created'];\n      }\n      if (isset($vals['updated'])) {\n        $this->updated = $vals['updated'];\n      }\n      if (isset($vals['deleted'])) {\n        $this->deleted = $vals['deleted'];\n      }\n      if (isset($vals['updateSequenceNum'])) {\n        $this->updateSequenceNum = $vals['updateSequenceNum'];\n      }\n      if (isset($vals['notebookGuid'])) {\n        $this->notebookGuid = $vals['notebookGuid'];\n      }\n      if (isset($vals['tagGuids'])) {\n        $this->tagGuids = $vals['tagGuids'];\n      }\n      if (isset($vals['attributes'])) {\n        $this->attributes = $vals['attributes'];\n      }\n      if (isset($vals['largestResourceMime'])) {\n        $this->largestResourceMime = $vals['largestResourceMime'];\n      }\n      if (isset($vals['largestResourceSize'])) {\n        $this->largestResourceSize = $vals['largestResourceSize'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteMetadata';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->guid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->title);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 5:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->contentLength);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 6:\n          if ($ftype == TType::I64) {\n            $xfer += $input->readI64($this->created);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 7:\n          if ($ftype == TType::I64) {\n            $xfer += $input->readI64($this->updated);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 8:\n          if ($ftype == TType::I64) {\n            $xfer += $input->readI64($this->deleted);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 10:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->updateSequenceNum);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 11:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->notebookGuid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 12:\n          if ($ftype == TType::LST) {\n            $this->tagGuids = array();\n            $_size105 = 0;\n            $_etype108 = 0;\n            $xfer += $input->readListBegin($_etype108, $_size105);\n            for ($_i109 = 0; $_i109 < $_size105; ++$_i109)\n            {\n              $elem110 = null;\n              $xfer += $input->readString($elem110);\n              $this->tagGuids []= $elem110;\n            }\n            $xfer += $input->readListEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 14:\n          if ($ftype == TType::STRUCT) {\n            $this->attributes = new \\EDAM\\Types\\NoteAttributes();\n            $xfer += $this->attributes->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 20:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->largestResourceMime);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 21:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->largestResourceSize);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteMetadata');\n    if ($this->guid !== null) {\n      $xfer += $output->writeFieldBegin('guid', TType::STRING, 1);\n      $xfer += $output->writeString($this->guid);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->title !== null) {\n      $xfer += $output->writeFieldBegin('title', TType::STRING, 2);\n      $xfer += $output->writeString($this->title);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->contentLength !== null) {\n      $xfer += $output->writeFieldBegin('contentLength', TType::I32, 5);\n      $xfer += $output->writeI32($this->contentLength);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->created !== null) {\n      $xfer += $output->writeFieldBegin('created', TType::I64, 6);\n      $xfer += $output->writeI64($this->created);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->updated !== null) {\n      $xfer += $output->writeFieldBegin('updated', TType::I64, 7);\n      $xfer += $output->writeI64($this->updated);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->deleted !== null) {\n      $xfer += $output->writeFieldBegin('deleted', TType::I64, 8);\n      $xfer += $output->writeI64($this->deleted);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->updateSequenceNum !== null) {\n      $xfer += $output->writeFieldBegin('updateSequenceNum', TType::I32, 10);\n      $xfer += $output->writeI32($this->updateSequenceNum);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notebookGuid !== null) {\n      $xfer += $output->writeFieldBegin('notebookGuid', TType::STRING, 11);\n      $xfer += $output->writeString($this->notebookGuid);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->tagGuids !== null) {\n      if (!is_array($this->tagGuids)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('tagGuids', TType::LST, 12);\n      {\n        $output->writeListBegin(TType::STRING, count($this->tagGuids));\n        {\n          foreach ($this->tagGuids as $iter111)\n          {\n            $xfer += $output->writeString($iter111);\n          }\n        }\n        $output->writeListEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->attributes !== null) {\n      if (!is_object($this->attributes)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('attributes', TType::STRUCT, 14);\n      $xfer += $this->attributes->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->largestResourceMime !== null) {\n      $xfer += $output->writeFieldBegin('largestResourceMime', TType::STRING, 20);\n      $xfer += $output->writeString($this->largestResourceMime);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->largestResourceSize !== null) {\n      $xfer += $output->writeFieldBegin('largestResourceSize', TType::I32, 21);\n      $xfer += $output->writeI32($this->largestResourceSize);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NotesMetadataList {\n  static $_TSPEC;\n\n  public $startIndex = null;\n  public $totalNotes = null;\n  public $notes = null;\n  public $stoppedWords = null;\n  public $searchedWords = null;\n  public $updateCount = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'startIndex',\n          'type' => TType::I32,\n          ),\n        2 => array(\n          'var' => 'totalNotes',\n          'type' => TType::I32,\n          ),\n        3 => array(\n          'var' => 'notes',\n          'type' => TType::LST,\n          'etype' => TType::STRUCT,\n          'elem' => array(\n            'type' => TType::STRUCT,\n            'class' => '\\EDAM\\NoteStore\\NoteMetadata',\n            ),\n          ),\n        4 => array(\n          'var' => 'stoppedWords',\n          'type' => TType::LST,\n          'etype' => TType::STRING,\n          'elem' => array(\n            'type' => TType::STRING,\n            ),\n          ),\n        5 => array(\n          'var' => 'searchedWords',\n          'type' => TType::LST,\n          'etype' => TType::STRING,\n          'elem' => array(\n            'type' => TType::STRING,\n            ),\n          ),\n        6 => array(\n          'var' => 'updateCount',\n          'type' => TType::I32,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['startIndex'])) {\n        $this->startIndex = $vals['startIndex'];\n      }\n      if (isset($vals['totalNotes'])) {\n        $this->totalNotes = $vals['totalNotes'];\n      }\n      if (isset($vals['notes'])) {\n        $this->notes = $vals['notes'];\n      }\n      if (isset($vals['stoppedWords'])) {\n        $this->stoppedWords = $vals['stoppedWords'];\n      }\n      if (isset($vals['searchedWords'])) {\n        $this->searchedWords = $vals['searchedWords'];\n      }\n      if (isset($vals['updateCount'])) {\n        $this->updateCount = $vals['updateCount'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NotesMetadataList';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->startIndex);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->totalNotes);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::LST) {\n            $this->notes = array();\n            $_size112 = 0;\n            $_etype115 = 0;\n            $xfer += $input->readListBegin($_etype115, $_size112);\n            for ($_i116 = 0; $_i116 < $_size112; ++$_i116)\n            {\n              $elem117 = null;\n              $elem117 = new \\EDAM\\NoteStore\\NoteMetadata();\n              $xfer += $elem117->read($input);\n              $this->notes []= $elem117;\n            }\n            $xfer += $input->readListEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 4:\n          if ($ftype == TType::LST) {\n            $this->stoppedWords = array();\n            $_size118 = 0;\n            $_etype121 = 0;\n            $xfer += $input->readListBegin($_etype121, $_size118);\n            for ($_i122 = 0; $_i122 < $_size118; ++$_i122)\n            {\n              $elem123 = null;\n              $xfer += $input->readString($elem123);\n              $this->stoppedWords []= $elem123;\n            }\n            $xfer += $input->readListEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 5:\n          if ($ftype == TType::LST) {\n            $this->searchedWords = array();\n            $_size124 = 0;\n            $_etype127 = 0;\n            $xfer += $input->readListBegin($_etype127, $_size124);\n            for ($_i128 = 0; $_i128 < $_size124; ++$_i128)\n            {\n              $elem129 = null;\n              $xfer += $input->readString($elem129);\n              $this->searchedWords []= $elem129;\n            }\n            $xfer += $input->readListEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 6:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->updateCount);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NotesMetadataList');\n    if ($this->startIndex !== null) {\n      $xfer += $output->writeFieldBegin('startIndex', TType::I32, 1);\n      $xfer += $output->writeI32($this->startIndex);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->totalNotes !== null) {\n      $xfer += $output->writeFieldBegin('totalNotes', TType::I32, 2);\n      $xfer += $output->writeI32($this->totalNotes);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notes !== null) {\n      if (!is_array($this->notes)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('notes', TType::LST, 3);\n      {\n        $output->writeListBegin(TType::STRUCT, count($this->notes));\n        {\n          foreach ($this->notes as $iter130)\n          {\n            $xfer += $iter130->write($output);\n          }\n        }\n        $output->writeListEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->stoppedWords !== null) {\n      if (!is_array($this->stoppedWords)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('stoppedWords', TType::LST, 4);\n      {\n        $output->writeListBegin(TType::STRING, count($this->stoppedWords));\n        {\n          foreach ($this->stoppedWords as $iter131)\n          {\n            $xfer += $output->writeString($iter131);\n          }\n        }\n        $output->writeListEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->searchedWords !== null) {\n      if (!is_array($this->searchedWords)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('searchedWords', TType::LST, 5);\n      {\n        $output->writeListBegin(TType::STRING, count($this->searchedWords));\n        {\n          foreach ($this->searchedWords as $iter132)\n          {\n            $xfer += $output->writeString($iter132);\n          }\n        }\n        $output->writeListEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->updateCount !== null) {\n      $xfer += $output->writeFieldBegin('updateCount', TType::I32, 6);\n      $xfer += $output->writeI32($this->updateCount);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NotesMetadataResultSpec {\n  static $_TSPEC;\n\n  public $includeTitle = null;\n  public $includeContentLength = null;\n  public $includeCreated = null;\n  public $includeUpdated = null;\n  public $includeDeleted = null;\n  public $includeUpdateSequenceNum = null;\n  public $includeNotebookGuid = null;\n  public $includeTagGuids = null;\n  public $includeAttributes = null;\n  public $includeLargestResourceMime = null;\n  public $includeLargestResourceSize = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        2 => array(\n          'var' => 'includeTitle',\n          'type' => TType::BOOL,\n          ),\n        5 => array(\n          'var' => 'includeContentLength',\n          'type' => TType::BOOL,\n          ),\n        6 => array(\n          'var' => 'includeCreated',\n          'type' => TType::BOOL,\n          ),\n        7 => array(\n          'var' => 'includeUpdated',\n          'type' => TType::BOOL,\n          ),\n        8 => array(\n          'var' => 'includeDeleted',\n          'type' => TType::BOOL,\n          ),\n        10 => array(\n          'var' => 'includeUpdateSequenceNum',\n          'type' => TType::BOOL,\n          ),\n        11 => array(\n          'var' => 'includeNotebookGuid',\n          'type' => TType::BOOL,\n          ),\n        12 => array(\n          'var' => 'includeTagGuids',\n          'type' => TType::BOOL,\n          ),\n        14 => array(\n          'var' => 'includeAttributes',\n          'type' => TType::BOOL,\n          ),\n        20 => array(\n          'var' => 'includeLargestResourceMime',\n          'type' => TType::BOOL,\n          ),\n        21 => array(\n          'var' => 'includeLargestResourceSize',\n          'type' => TType::BOOL,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['includeTitle'])) {\n        $this->includeTitle = $vals['includeTitle'];\n      }\n      if (isset($vals['includeContentLength'])) {\n        $this->includeContentLength = $vals['includeContentLength'];\n      }\n      if (isset($vals['includeCreated'])) {\n        $this->includeCreated = $vals['includeCreated'];\n      }\n      if (isset($vals['includeUpdated'])) {\n        $this->includeUpdated = $vals['includeUpdated'];\n      }\n      if (isset($vals['includeDeleted'])) {\n        $this->includeDeleted = $vals['includeDeleted'];\n      }\n      if (isset($vals['includeUpdateSequenceNum'])) {\n        $this->includeUpdateSequenceNum = $vals['includeUpdateSequenceNum'];\n      }\n      if (isset($vals['includeNotebookGuid'])) {\n        $this->includeNotebookGuid = $vals['includeNotebookGuid'];\n      }\n      if (isset($vals['includeTagGuids'])) {\n        $this->includeTagGuids = $vals['includeTagGuids'];\n      }\n      if (isset($vals['includeAttributes'])) {\n        $this->includeAttributes = $vals['includeAttributes'];\n      }\n      if (isset($vals['includeLargestResourceMime'])) {\n        $this->includeLargestResourceMime = $vals['includeLargestResourceMime'];\n      }\n      if (isset($vals['includeLargestResourceSize'])) {\n        $this->includeLargestResourceSize = $vals['includeLargestResourceSize'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NotesMetadataResultSpec';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 2:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->includeTitle);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 5:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->includeContentLength);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 6:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->includeCreated);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 7:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->includeUpdated);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 8:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->includeDeleted);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 10:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->includeUpdateSequenceNum);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 11:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->includeNotebookGuid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 12:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->includeTagGuids);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 14:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->includeAttributes);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 20:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->includeLargestResourceMime);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 21:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->includeLargestResourceSize);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NotesMetadataResultSpec');\n    if ($this->includeTitle !== null) {\n      $xfer += $output->writeFieldBegin('includeTitle', TType::BOOL, 2);\n      $xfer += $output->writeBool($this->includeTitle);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->includeContentLength !== null) {\n      $xfer += $output->writeFieldBegin('includeContentLength', TType::BOOL, 5);\n      $xfer += $output->writeBool($this->includeContentLength);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->includeCreated !== null) {\n      $xfer += $output->writeFieldBegin('includeCreated', TType::BOOL, 6);\n      $xfer += $output->writeBool($this->includeCreated);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->includeUpdated !== null) {\n      $xfer += $output->writeFieldBegin('includeUpdated', TType::BOOL, 7);\n      $xfer += $output->writeBool($this->includeUpdated);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->includeDeleted !== null) {\n      $xfer += $output->writeFieldBegin('includeDeleted', TType::BOOL, 8);\n      $xfer += $output->writeBool($this->includeDeleted);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->includeUpdateSequenceNum !== null) {\n      $xfer += $output->writeFieldBegin('includeUpdateSequenceNum', TType::BOOL, 10);\n      $xfer += $output->writeBool($this->includeUpdateSequenceNum);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->includeNotebookGuid !== null) {\n      $xfer += $output->writeFieldBegin('includeNotebookGuid', TType::BOOL, 11);\n      $xfer += $output->writeBool($this->includeNotebookGuid);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->includeTagGuids !== null) {\n      $xfer += $output->writeFieldBegin('includeTagGuids', TType::BOOL, 12);\n      $xfer += $output->writeBool($this->includeTagGuids);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->includeAttributes !== null) {\n      $xfer += $output->writeFieldBegin('includeAttributes', TType::BOOL, 14);\n      $xfer += $output->writeBool($this->includeAttributes);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->includeLargestResourceMime !== null) {\n      $xfer += $output->writeFieldBegin('includeLargestResourceMime', TType::BOOL, 20);\n      $xfer += $output->writeBool($this->includeLargestResourceMime);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->includeLargestResourceSize !== null) {\n      $xfer += $output->writeFieldBegin('includeLargestResourceSize', TType::BOOL, 21);\n      $xfer += $output->writeBool($this->includeLargestResourceSize);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteCollectionCounts {\n  static $_TSPEC;\n\n  public $notebookCounts = null;\n  public $tagCounts = null;\n  public $trashCount = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'notebookCounts',\n          'type' => TType::MAP,\n          'ktype' => TType::STRING,\n          'vtype' => TType::I32,\n          'key' => array(\n            'type' => TType::STRING,\n          ),\n          'val' => array(\n            'type' => TType::I32,\n            ),\n          ),\n        2 => array(\n          'var' => 'tagCounts',\n          'type' => TType::MAP,\n          'ktype' => TType::STRING,\n          'vtype' => TType::I32,\n          'key' => array(\n            'type' => TType::STRING,\n          ),\n          'val' => array(\n            'type' => TType::I32,\n            ),\n          ),\n        3 => array(\n          'var' => 'trashCount',\n          'type' => TType::I32,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['notebookCounts'])) {\n        $this->notebookCounts = $vals['notebookCounts'];\n      }\n      if (isset($vals['tagCounts'])) {\n        $this->tagCounts = $vals['tagCounts'];\n      }\n      if (isset($vals['trashCount'])) {\n        $this->trashCount = $vals['trashCount'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteCollectionCounts';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::MAP) {\n            $this->notebookCounts = array();\n            $_size133 = 0;\n            $_ktype134 = 0;\n            $_vtype135 = 0;\n            $xfer += $input->readMapBegin($_ktype134, $_vtype135, $_size133);\n            for ($_i137 = 0; $_i137 < $_size133; ++$_i137)\n            {\n              $key138 = '';\n              $val139 = 0;\n              $xfer += $input->readString($key138);\n              $xfer += $input->readI32($val139);\n              $this->notebookCounts[$key138] = $val139;\n            }\n            $xfer += $input->readMapEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::MAP) {\n            $this->tagCounts = array();\n            $_size140 = 0;\n            $_ktype141 = 0;\n            $_vtype142 = 0;\n            $xfer += $input->readMapBegin($_ktype141, $_vtype142, $_size140);\n            for ($_i144 = 0; $_i144 < $_size140; ++$_i144)\n            {\n              $key145 = '';\n              $val146 = 0;\n              $xfer += $input->readString($key145);\n              $xfer += $input->readI32($val146);\n              $this->tagCounts[$key145] = $val146;\n            }\n            $xfer += $input->readMapEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->trashCount);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteCollectionCounts');\n    if ($this->notebookCounts !== null) {\n      if (!is_array($this->notebookCounts)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('notebookCounts', TType::MAP, 1);\n      {\n        $output->writeMapBegin(TType::STRING, TType::I32, count($this->notebookCounts));\n        {\n          foreach ($this->notebookCounts as $kiter147 => $viter148)\n          {\n            $xfer += $output->writeString($kiter147);\n            $xfer += $output->writeI32($viter148);\n          }\n        }\n        $output->writeMapEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->tagCounts !== null) {\n      if (!is_array($this->tagCounts)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('tagCounts', TType::MAP, 2);\n      {\n        $output->writeMapBegin(TType::STRING, TType::I32, count($this->tagCounts));\n        {\n          foreach ($this->tagCounts as $kiter149 => $viter150)\n          {\n            $xfer += $output->writeString($kiter149);\n            $xfer += $output->writeI32($viter150);\n          }\n        }\n        $output->writeMapEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->trashCount !== null) {\n      $xfer += $output->writeFieldBegin('trashCount', TType::I32, 3);\n      $xfer += $output->writeI32($this->trashCount);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteEmailParameters {\n  static $_TSPEC;\n\n  public $guid = null;\n  public $note = null;\n  public $toAddresses = null;\n  public $ccAddresses = null;\n  public $subject = null;\n  public $message = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'guid',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'note',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\Note',\n          ),\n        3 => array(\n          'var' => 'toAddresses',\n          'type' => TType::LST,\n          'etype' => TType::STRING,\n          'elem' => array(\n            'type' => TType::STRING,\n            ),\n          ),\n        4 => array(\n          'var' => 'ccAddresses',\n          'type' => TType::LST,\n          'etype' => TType::STRING,\n          'elem' => array(\n            'type' => TType::STRING,\n            ),\n          ),\n        5 => array(\n          'var' => 'subject',\n          'type' => TType::STRING,\n          ),\n        6 => array(\n          'var' => 'message',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['guid'])) {\n        $this->guid = $vals['guid'];\n      }\n      if (isset($vals['note'])) {\n        $this->note = $vals['note'];\n      }\n      if (isset($vals['toAddresses'])) {\n        $this->toAddresses = $vals['toAddresses'];\n      }\n      if (isset($vals['ccAddresses'])) {\n        $this->ccAddresses = $vals['ccAddresses'];\n      }\n      if (isset($vals['subject'])) {\n        $this->subject = $vals['subject'];\n      }\n      if (isset($vals['message'])) {\n        $this->message = $vals['message'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteEmailParameters';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->guid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->note = new \\EDAM\\Types\\Note();\n            $xfer += $this->note->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::LST) {\n            $this->toAddresses = array();\n            $_size151 = 0;\n            $_etype154 = 0;\n            $xfer += $input->readListBegin($_etype154, $_size151);\n            for ($_i155 = 0; $_i155 < $_size151; ++$_i155)\n            {\n              $elem156 = null;\n              $xfer += $input->readString($elem156);\n              $this->toAddresses []= $elem156;\n            }\n            $xfer += $input->readListEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 4:\n          if ($ftype == TType::LST) {\n            $this->ccAddresses = array();\n            $_size157 = 0;\n            $_etype160 = 0;\n            $xfer += $input->readListBegin($_etype160, $_size157);\n            for ($_i161 = 0; $_i161 < $_size157; ++$_i161)\n            {\n              $elem162 = null;\n              $xfer += $input->readString($elem162);\n              $this->ccAddresses []= $elem162;\n            }\n            $xfer += $input->readListEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 5:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->subject);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 6:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->message);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteEmailParameters');\n    if ($this->guid !== null) {\n      $xfer += $output->writeFieldBegin('guid', TType::STRING, 1);\n      $xfer += $output->writeString($this->guid);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->note !== null) {\n      if (!is_object($this->note)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('note', TType::STRUCT, 2);\n      $xfer += $this->note->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->toAddresses !== null) {\n      if (!is_array($this->toAddresses)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('toAddresses', TType::LST, 3);\n      {\n        $output->writeListBegin(TType::STRING, count($this->toAddresses));\n        {\n          foreach ($this->toAddresses as $iter163)\n          {\n            $xfer += $output->writeString($iter163);\n          }\n        }\n        $output->writeListEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->ccAddresses !== null) {\n      if (!is_array($this->ccAddresses)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('ccAddresses', TType::LST, 4);\n      {\n        $output->writeListBegin(TType::STRING, count($this->ccAddresses));\n        {\n          foreach ($this->ccAddresses as $iter164)\n          {\n            $xfer += $output->writeString($iter164);\n          }\n        }\n        $output->writeListEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->subject !== null) {\n      $xfer += $output->writeFieldBegin('subject', TType::STRING, 5);\n      $xfer += $output->writeString($this->subject);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->message !== null) {\n      $xfer += $output->writeFieldBegin('message', TType::STRING, 6);\n      $xfer += $output->writeString($this->message);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteVersionId {\n  static $_TSPEC;\n\n  public $updateSequenceNum = null;\n  public $updated = null;\n  public $saved = null;\n  public $title = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'updateSequenceNum',\n          'type' => TType::I32,\n          ),\n        2 => array(\n          'var' => 'updated',\n          'type' => TType::I64,\n          ),\n        3 => array(\n          'var' => 'saved',\n          'type' => TType::I64,\n          ),\n        4 => array(\n          'var' => 'title',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['updateSequenceNum'])) {\n        $this->updateSequenceNum = $vals['updateSequenceNum'];\n      }\n      if (isset($vals['updated'])) {\n        $this->updated = $vals['updated'];\n      }\n      if (isset($vals['saved'])) {\n        $this->saved = $vals['saved'];\n      }\n      if (isset($vals['title'])) {\n        $this->title = $vals['title'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteVersionId';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->updateSequenceNum);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::I64) {\n            $xfer += $input->readI64($this->updated);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::I64) {\n            $xfer += $input->readI64($this->saved);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 4:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->title);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteVersionId');\n    if ($this->updateSequenceNum !== null) {\n      $xfer += $output->writeFieldBegin('updateSequenceNum', TType::I32, 1);\n      $xfer += $output->writeI32($this->updateSequenceNum);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->updated !== null) {\n      $xfer += $output->writeFieldBegin('updated', TType::I64, 2);\n      $xfer += $output->writeI64($this->updated);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->saved !== null) {\n      $xfer += $output->writeFieldBegin('saved', TType::I64, 3);\n      $xfer += $output->writeI64($this->saved);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->title !== null) {\n      $xfer += $output->writeFieldBegin('title', TType::STRING, 4);\n      $xfer += $output->writeString($this->title);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass ClientUsageMetrics {\n  static $_TSPEC;\n\n  public $sessions = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'sessions',\n          'type' => TType::I32,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['sessions'])) {\n        $this->sessions = $vals['sessions'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'ClientUsageMetrics';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->sessions);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('ClientUsageMetrics');\n    if ($this->sessions !== null) {\n      $xfer += $output->writeFieldBegin('sessions', TType::I32, 1);\n      $xfer += $output->writeI32($this->sessions);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass RelatedQuery {\n  static $_TSPEC;\n\n  public $noteGuid = null;\n  public $plainText = null;\n  public $filter = null;\n  public $referenceUri = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'noteGuid',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'plainText',\n          'type' => TType::STRING,\n          ),\n        3 => array(\n          'var' => 'filter',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\NoteStore\\NoteFilter',\n          ),\n        4 => array(\n          'var' => 'referenceUri',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['noteGuid'])) {\n        $this->noteGuid = $vals['noteGuid'];\n      }\n      if (isset($vals['plainText'])) {\n        $this->plainText = $vals['plainText'];\n      }\n      if (isset($vals['filter'])) {\n        $this->filter = $vals['filter'];\n      }\n      if (isset($vals['referenceUri'])) {\n        $this->referenceUri = $vals['referenceUri'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'RelatedQuery';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->noteGuid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->plainText);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->filter = new \\EDAM\\NoteStore\\NoteFilter();\n            $xfer += $this->filter->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 4:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->referenceUri);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('RelatedQuery');\n    if ($this->noteGuid !== null) {\n      $xfer += $output->writeFieldBegin('noteGuid', TType::STRING, 1);\n      $xfer += $output->writeString($this->noteGuid);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->plainText !== null) {\n      $xfer += $output->writeFieldBegin('plainText', TType::STRING, 2);\n      $xfer += $output->writeString($this->plainText);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->filter !== null) {\n      if (!is_object($this->filter)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('filter', TType::STRUCT, 3);\n      $xfer += $this->filter->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->referenceUri !== null) {\n      $xfer += $output->writeFieldBegin('referenceUri', TType::STRING, 4);\n      $xfer += $output->writeString($this->referenceUri);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass RelatedResult {\n  static $_TSPEC;\n\n  public $notes = null;\n  public $notebooks = null;\n  public $tags = null;\n  public $containingNotebooks = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'notes',\n          'type' => TType::LST,\n          'etype' => TType::STRUCT,\n          'elem' => array(\n            'type' => TType::STRUCT,\n            'class' => '\\EDAM\\Types\\Note',\n            ),\n          ),\n        2 => array(\n          'var' => 'notebooks',\n          'type' => TType::LST,\n          'etype' => TType::STRUCT,\n          'elem' => array(\n            'type' => TType::STRUCT,\n            'class' => '\\EDAM\\Types\\Notebook',\n            ),\n          ),\n        3 => array(\n          'var' => 'tags',\n          'type' => TType::LST,\n          'etype' => TType::STRUCT,\n          'elem' => array(\n            'type' => TType::STRUCT,\n            'class' => '\\EDAM\\Types\\Tag',\n            ),\n          ),\n        4 => array(\n          'var' => 'containingNotebooks',\n          'type' => TType::LST,\n          'etype' => TType::STRUCT,\n          'elem' => array(\n            'type' => TType::STRUCT,\n            'class' => '\\EDAM\\Types\\NotebookDescriptor',\n            ),\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['notes'])) {\n        $this->notes = $vals['notes'];\n      }\n      if (isset($vals['notebooks'])) {\n        $this->notebooks = $vals['notebooks'];\n      }\n      if (isset($vals['tags'])) {\n        $this->tags = $vals['tags'];\n      }\n      if (isset($vals['containingNotebooks'])) {\n        $this->containingNotebooks = $vals['containingNotebooks'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'RelatedResult';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::LST) {\n            $this->notes = array();\n            $_size165 = 0;\n            $_etype168 = 0;\n            $xfer += $input->readListBegin($_etype168, $_size165);\n            for ($_i169 = 0; $_i169 < $_size165; ++$_i169)\n            {\n              $elem170 = null;\n              $elem170 = new \\EDAM\\Types\\Note();\n              $xfer += $elem170->read($input);\n              $this->notes []= $elem170;\n            }\n            $xfer += $input->readListEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::LST) {\n            $this->notebooks = array();\n            $_size171 = 0;\n            $_etype174 = 0;\n            $xfer += $input->readListBegin($_etype174, $_size171);\n            for ($_i175 = 0; $_i175 < $_size171; ++$_i175)\n            {\n              $elem176 = null;\n              $elem176 = new \\EDAM\\Types\\Notebook();\n              $xfer += $elem176->read($input);\n              $this->notebooks []= $elem176;\n            }\n            $xfer += $input->readListEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::LST) {\n            $this->tags = array();\n            $_size177 = 0;\n            $_etype180 = 0;\n            $xfer += $input->readListBegin($_etype180, $_size177);\n            for ($_i181 = 0; $_i181 < $_size177; ++$_i181)\n            {\n              $elem182 = null;\n              $elem182 = new \\EDAM\\Types\\Tag();\n              $xfer += $elem182->read($input);\n              $this->tags []= $elem182;\n            }\n            $xfer += $input->readListEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 4:\n          if ($ftype == TType::LST) {\n            $this->containingNotebooks = array();\n            $_size183 = 0;\n            $_etype186 = 0;\n            $xfer += $input->readListBegin($_etype186, $_size183);\n            for ($_i187 = 0; $_i187 < $_size183; ++$_i187)\n            {\n              $elem188 = null;\n              $elem188 = new \\EDAM\\Types\\NotebookDescriptor();\n              $xfer += $elem188->read($input);\n              $this->containingNotebooks []= $elem188;\n            }\n            $xfer += $input->readListEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('RelatedResult');\n    if ($this->notes !== null) {\n      if (!is_array($this->notes)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('notes', TType::LST, 1);\n      {\n        $output->writeListBegin(TType::STRUCT, count($this->notes));\n        {\n          foreach ($this->notes as $iter189)\n          {\n            $xfer += $iter189->write($output);\n          }\n        }\n        $output->writeListEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notebooks !== null) {\n      if (!is_array($this->notebooks)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('notebooks', TType::LST, 2);\n      {\n        $output->writeListBegin(TType::STRUCT, count($this->notebooks));\n        {\n          foreach ($this->notebooks as $iter190)\n          {\n            $xfer += $iter190->write($output);\n          }\n        }\n        $output->writeListEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->tags !== null) {\n      if (!is_array($this->tags)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('tags', TType::LST, 3);\n      {\n        $output->writeListBegin(TType::STRUCT, count($this->tags));\n        {\n          foreach ($this->tags as $iter191)\n          {\n            $xfer += $iter191->write($output);\n          }\n        }\n        $output->writeListEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->containingNotebooks !== null) {\n      if (!is_array($this->containingNotebooks)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('containingNotebooks', TType::LST, 4);\n      {\n        $output->writeListBegin(TType::STRUCT, count($this->containingNotebooks));\n        {\n          foreach ($this->containingNotebooks as $iter192)\n          {\n            $xfer += $iter192->write($output);\n          }\n        }\n        $output->writeListEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass RelatedResultSpec {\n  static $_TSPEC;\n\n  public $maxNotes = null;\n  public $maxNotebooks = null;\n  public $maxTags = null;\n  public $writableNotebooksOnly = null;\n  public $includeContainingNotebooks = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'maxNotes',\n          'type' => TType::I32,\n          ),\n        2 => array(\n          'var' => 'maxNotebooks',\n          'type' => TType::I32,\n          ),\n        3 => array(\n          'var' => 'maxTags',\n          'type' => TType::I32,\n          ),\n        4 => array(\n          'var' => 'writableNotebooksOnly',\n          'type' => TType::BOOL,\n          ),\n        5 => array(\n          'var' => 'includeContainingNotebooks',\n          'type' => TType::BOOL,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['maxNotes'])) {\n        $this->maxNotes = $vals['maxNotes'];\n      }\n      if (isset($vals['maxNotebooks'])) {\n        $this->maxNotebooks = $vals['maxNotebooks'];\n      }\n      if (isset($vals['maxTags'])) {\n        $this->maxTags = $vals['maxTags'];\n      }\n      if (isset($vals['writableNotebooksOnly'])) {\n        $this->writableNotebooksOnly = $vals['writableNotebooksOnly'];\n      }\n      if (isset($vals['includeContainingNotebooks'])) {\n        $this->includeContainingNotebooks = $vals['includeContainingNotebooks'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'RelatedResultSpec';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->maxNotes);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->maxNotebooks);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->maxTags);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 4:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->writableNotebooksOnly);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 5:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->includeContainingNotebooks);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('RelatedResultSpec');\n    if ($this->maxNotes !== null) {\n      $xfer += $output->writeFieldBegin('maxNotes', TType::I32, 1);\n      $xfer += $output->writeI32($this->maxNotes);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->maxNotebooks !== null) {\n      $xfer += $output->writeFieldBegin('maxNotebooks', TType::I32, 2);\n      $xfer += $output->writeI32($this->maxNotebooks);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->maxTags !== null) {\n      $xfer += $output->writeFieldBegin('maxTags', TType::I32, 3);\n      $xfer += $output->writeI32($this->maxTags);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->writableNotebooksOnly !== null) {\n      $xfer += $output->writeFieldBegin('writableNotebooksOnly', TType::BOOL, 4);\n      $xfer += $output->writeBool($this->writableNotebooksOnly);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->includeContainingNotebooks !== null) {\n      $xfer += $output->writeFieldBegin('includeContainingNotebooks', TType::BOOL, 5);\n      $xfer += $output->writeBool($this->includeContainingNotebooks);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\n\n"
  },
  {
    "path": "src/EDAM/Types/Types.php",
    "content": "<?php\nnamespace EDAM\\Types;\n\n/**\n * Autogenerated by Thrift Compiler (0.9.1)\n *\n * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING\n *  @generated\n */\nuse Thrift\\Base\\TBase;\nuse Thrift\\Type\\TType;\nuse Thrift\\Type\\TMessageType;\nuse Thrift\\Exception\\TException;\nuse Thrift\\Exception\\TProtocolException;\nuse Thrift\\Protocol\\TProtocol;\nuse Thrift\\Protocol\\TBinaryProtocolAccelerated;\nuse Thrift\\Exception\\TApplicationException;\n\n\nfinal class PrivilegeLevel {\n  const NORMAL = 1;\n  const PREMIUM = 3;\n  const VIP = 5;\n  const MANAGER = 7;\n  const SUPPORT = 8;\n  const ADMIN = 9;\n  static public $__names = array(\n    1 => 'NORMAL',\n    3 => 'PREMIUM',\n    5 => 'VIP',\n    7 => 'MANAGER',\n    8 => 'SUPPORT',\n    9 => 'ADMIN',\n  );\n}\n\nfinal class QueryFormat {\n  const USER = 1;\n  const SEXP = 2;\n  static public $__names = array(\n    1 => 'USER',\n    2 => 'SEXP',\n  );\n}\n\nfinal class NoteSortOrder {\n  const CREATED = 1;\n  const UPDATED = 2;\n  const RELEVANCE = 3;\n  const UPDATE_SEQUENCE_NUMBER = 4;\n  const TITLE = 5;\n  static public $__names = array(\n    1 => 'CREATED',\n    2 => 'UPDATED',\n    3 => 'RELEVANCE',\n    4 => 'UPDATE_SEQUENCE_NUMBER',\n    5 => 'TITLE',\n  );\n}\n\nfinal class PremiumOrderStatus {\n  const NONE = 0;\n  const PENDING = 1;\n  const ACTIVE = 2;\n  const FAILED = 3;\n  const CANCELLATION_PENDING = 4;\n  const CANCELED = 5;\n  static public $__names = array(\n    0 => 'NONE',\n    1 => 'PENDING',\n    2 => 'ACTIVE',\n    3 => 'FAILED',\n    4 => 'CANCELLATION_PENDING',\n    5 => 'CANCELED',\n  );\n}\n\nfinal class SharedNotebookPrivilegeLevel {\n  const READ_NOTEBOOK = 0;\n  const MODIFY_NOTEBOOK_PLUS_ACTIVITY = 1;\n  const READ_NOTEBOOK_PLUS_ACTIVITY = 2;\n  const GROUP = 3;\n  const FULL_ACCESS = 4;\n  const BUSINESS_FULL_ACCESS = 5;\n  static public $__names = array(\n    0 => 'READ_NOTEBOOK',\n    1 => 'MODIFY_NOTEBOOK_PLUS_ACTIVITY',\n    2 => 'READ_NOTEBOOK_PLUS_ACTIVITY',\n    3 => 'GROUP',\n    4 => 'FULL_ACCESS',\n    5 => 'BUSINESS_FULL_ACCESS',\n  );\n}\n\nfinal class SponsoredGroupRole {\n  const GROUP_MEMBER = 1;\n  const GROUP_ADMIN = 2;\n  const GROUP_OWNER = 3;\n  static public $__names = array(\n    1 => 'GROUP_MEMBER',\n    2 => 'GROUP_ADMIN',\n    3 => 'GROUP_OWNER',\n  );\n}\n\nfinal class BusinessUserRole {\n  const ADMIN = 1;\n  const NORMAL = 2;\n  static public $__names = array(\n    1 => 'ADMIN',\n    2 => 'NORMAL',\n  );\n}\n\nfinal class SharedNotebookInstanceRestrictions {\n  const ONLY_JOINED_OR_PREVIEW = 1;\n  const NO_SHARED_NOTEBOOKS = 2;\n  static public $__names = array(\n    1 => 'ONLY_JOINED_OR_PREVIEW',\n    2 => 'NO_SHARED_NOTEBOOKS',\n  );\n}\n\nfinal class ReminderEmailConfig {\n  const DO_NOT_SEND = 1;\n  const SEND_DAILY_EMAIL = 2;\n  static public $__names = array(\n    1 => 'DO_NOT_SEND',\n    2 => 'SEND_DAILY_EMAIL',\n  );\n}\n\nclass Data {\n  static $_TSPEC;\n\n  public $bodyHash = null;\n  public $size = null;\n  public $body = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'bodyHash',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'size',\n          'type' => TType::I32,\n          ),\n        3 => array(\n          'var' => 'body',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['bodyHash'])) {\n        $this->bodyHash = $vals['bodyHash'];\n      }\n      if (isset($vals['size'])) {\n        $this->size = $vals['size'];\n      }\n      if (isset($vals['body'])) {\n        $this->body = $vals['body'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'Data';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->bodyHash);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->size);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->body);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('Data');\n    if ($this->bodyHash !== null) {\n      $xfer += $output->writeFieldBegin('bodyHash', TType::STRING, 1);\n      $xfer += $output->writeString($this->bodyHash);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->size !== null) {\n      $xfer += $output->writeFieldBegin('size', TType::I32, 2);\n      $xfer += $output->writeI32($this->size);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->body !== null) {\n      $xfer += $output->writeFieldBegin('body', TType::STRING, 3);\n      $xfer += $output->writeString($this->body);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass UserAttributes {\n  static $_TSPEC;\n\n  public $defaultLocationName = null;\n  public $defaultLatitude = null;\n  public $defaultLongitude = null;\n  public $preactivation = null;\n  public $viewedPromotions = null;\n  public $incomingEmailAddress = null;\n  public $recentMailedAddresses = null;\n  public $comments = null;\n  public $dateAgreedToTermsOfService = null;\n  public $maxReferrals = null;\n  public $referralCount = null;\n  public $refererCode = null;\n  public $sentEmailDate = null;\n  public $sentEmailCount = null;\n  public $dailyEmailLimit = null;\n  public $emailOptOutDate = null;\n  public $partnerEmailOptInDate = null;\n  public $preferredLanguage = null;\n  public $preferredCountry = null;\n  public $clipFullPage = null;\n  public $twitterUserName = null;\n  public $twitterId = null;\n  public $groupName = null;\n  public $recognitionLanguage = null;\n  public $referralProof = null;\n  public $educationalDiscount = null;\n  public $businessAddress = null;\n  public $hideSponsorBilling = null;\n  public $taxExempt = null;\n  public $useEmailAutoFiling = null;\n  public $reminderEmailConfig = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'defaultLocationName',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'defaultLatitude',\n          'type' => TType::DOUBLE,\n          ),\n        3 => array(\n          'var' => 'defaultLongitude',\n          'type' => TType::DOUBLE,\n          ),\n        4 => array(\n          'var' => 'preactivation',\n          'type' => TType::BOOL,\n          ),\n        5 => array(\n          'var' => 'viewedPromotions',\n          'type' => TType::LST,\n          'etype' => TType::STRING,\n          'elem' => array(\n            'type' => TType::STRING,\n            ),\n          ),\n        6 => array(\n          'var' => 'incomingEmailAddress',\n          'type' => TType::STRING,\n          ),\n        7 => array(\n          'var' => 'recentMailedAddresses',\n          'type' => TType::LST,\n          'etype' => TType::STRING,\n          'elem' => array(\n            'type' => TType::STRING,\n            ),\n          ),\n        9 => array(\n          'var' => 'comments',\n          'type' => TType::STRING,\n          ),\n        11 => array(\n          'var' => 'dateAgreedToTermsOfService',\n          'type' => TType::I64,\n          ),\n        12 => array(\n          'var' => 'maxReferrals',\n          'type' => TType::I32,\n          ),\n        13 => array(\n          'var' => 'referralCount',\n          'type' => TType::I32,\n          ),\n        14 => array(\n          'var' => 'refererCode',\n          'type' => TType::STRING,\n          ),\n        15 => array(\n          'var' => 'sentEmailDate',\n          'type' => TType::I64,\n          ),\n        16 => array(\n          'var' => 'sentEmailCount',\n          'type' => TType::I32,\n          ),\n        17 => array(\n          'var' => 'dailyEmailLimit',\n          'type' => TType::I32,\n          ),\n        18 => array(\n          'var' => 'emailOptOutDate',\n          'type' => TType::I64,\n          ),\n        19 => array(\n          'var' => 'partnerEmailOptInDate',\n          'type' => TType::I64,\n          ),\n        20 => array(\n          'var' => 'preferredLanguage',\n          'type' => TType::STRING,\n          ),\n        21 => array(\n          'var' => 'preferredCountry',\n          'type' => TType::STRING,\n          ),\n        22 => array(\n          'var' => 'clipFullPage',\n          'type' => TType::BOOL,\n          ),\n        23 => array(\n          'var' => 'twitterUserName',\n          'type' => TType::STRING,\n          ),\n        24 => array(\n          'var' => 'twitterId',\n          'type' => TType::STRING,\n          ),\n        25 => array(\n          'var' => 'groupName',\n          'type' => TType::STRING,\n          ),\n        26 => array(\n          'var' => 'recognitionLanguage',\n          'type' => TType::STRING,\n          ),\n        28 => array(\n          'var' => 'referralProof',\n          'type' => TType::STRING,\n          ),\n        29 => array(\n          'var' => 'educationalDiscount',\n          'type' => TType::BOOL,\n          ),\n        30 => array(\n          'var' => 'businessAddress',\n          'type' => TType::STRING,\n          ),\n        31 => array(\n          'var' => 'hideSponsorBilling',\n          'type' => TType::BOOL,\n          ),\n        32 => array(\n          'var' => 'taxExempt',\n          'type' => TType::BOOL,\n          ),\n        33 => array(\n          'var' => 'useEmailAutoFiling',\n          'type' => TType::BOOL,\n          ),\n        34 => array(\n          'var' => 'reminderEmailConfig',\n          'type' => TType::I32,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['defaultLocationName'])) {\n        $this->defaultLocationName = $vals['defaultLocationName'];\n      }\n      if (isset($vals['defaultLatitude'])) {\n        $this->defaultLatitude = $vals['defaultLatitude'];\n      }\n      if (isset($vals['defaultLongitude'])) {\n        $this->defaultLongitude = $vals['defaultLongitude'];\n      }\n      if (isset($vals['preactivation'])) {\n        $this->preactivation = $vals['preactivation'];\n      }\n      if (isset($vals['viewedPromotions'])) {\n        $this->viewedPromotions = $vals['viewedPromotions'];\n      }\n      if (isset($vals['incomingEmailAddress'])) {\n        $this->incomingEmailAddress = $vals['incomingEmailAddress'];\n      }\n      if (isset($vals['recentMailedAddresses'])) {\n        $this->recentMailedAddresses = $vals['recentMailedAddresses'];\n      }\n      if (isset($vals['comments'])) {\n        $this->comments = $vals['comments'];\n      }\n      if (isset($vals['dateAgreedToTermsOfService'])) {\n        $this->dateAgreedToTermsOfService = $vals['dateAgreedToTermsOfService'];\n      }\n      if (isset($vals['maxReferrals'])) {\n        $this->maxReferrals = $vals['maxReferrals'];\n      }\n      if (isset($vals['referralCount'])) {\n        $this->referralCount = $vals['referralCount'];\n      }\n      if (isset($vals['refererCode'])) {\n        $this->refererCode = $vals['refererCode'];\n      }\n      if (isset($vals['sentEmailDate'])) {\n        $this->sentEmailDate = $vals['sentEmailDate'];\n      }\n      if (isset($vals['sentEmailCount'])) {\n        $this->sentEmailCount = $vals['sentEmailCount'];\n      }\n      if (isset($vals['dailyEmailLimit'])) {\n        $this->dailyEmailLimit = $vals['dailyEmailLimit'];\n      }\n      if (isset($vals['emailOptOutDate'])) {\n        $this->emailOptOutDate = $vals['emailOptOutDate'];\n      }\n      if (isset($vals['partnerEmailOptInDate'])) {\n        $this->partnerEmailOptInDate = $vals['partnerEmailOptInDate'];\n      }\n      if (isset($vals['preferredLanguage'])) {\n        $this->preferredLanguage = $vals['preferredLanguage'];\n      }\n      if (isset($vals['preferredCountry'])) {\n        $this->preferredCountry = $vals['preferredCountry'];\n      }\n      if (isset($vals['clipFullPage'])) {\n        $this->clipFullPage = $vals['clipFullPage'];\n      }\n      if (isset($vals['twitterUserName'])) {\n        $this->twitterUserName = $vals['twitterUserName'];\n      }\n      if (isset($vals['twitterId'])) {\n        $this->twitterId = $vals['twitterId'];\n      }\n      if (isset($vals['groupName'])) {\n        $this->groupName = $vals['groupName'];\n      }\n      if (isset($vals['recognitionLanguage'])) {\n        $this->recognitionLanguage = $vals['recognitionLanguage'];\n      }\n      if (isset($vals['referralProof'])) {\n        $this->referralProof = $vals['referralProof'];\n      }\n      if (isset($vals['educationalDiscount'])) {\n        $this->educationalDiscount = $vals['educationalDiscount'];\n      }\n      if (isset($vals['businessAddress'])) {\n        $this->businessAddress = $vals['businessAddress'];\n      }\n      if (isset($vals['hideSponsorBilling'])) {\n        $this->hideSponsorBilling = $vals['hideSponsorBilling'];\n      }\n      if (isset($vals['taxExempt'])) {\n        $this->taxExempt = $vals['taxExempt'];\n      }\n      if (isset($vals['useEmailAutoFiling'])) {\n        $this->useEmailAutoFiling = $vals['useEmailAutoFiling'];\n      }\n      if (isset($vals['reminderEmailConfig'])) {\n        $this->reminderEmailConfig = $vals['reminderEmailConfig'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'UserAttributes';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->defaultLocationName);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::DOUBLE) {\n            $xfer += $input->readDouble($this->defaultLatitude);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::DOUBLE) {\n            $xfer += $input->readDouble($this->defaultLongitude);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 4:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->preactivation);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 5:\n          if ($ftype == TType::LST) {\n            $this->viewedPromotions = array();\n            $_size0 = 0;\n            $_etype3 = 0;\n            $xfer += $input->readListBegin($_etype3, $_size0);\n            for ($_i4 = 0; $_i4 < $_size0; ++$_i4)\n            {\n              $elem5 = null;\n              $xfer += $input->readString($elem5);\n              $this->viewedPromotions []= $elem5;\n            }\n            $xfer += $input->readListEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 6:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->incomingEmailAddress);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 7:\n          if ($ftype == TType::LST) {\n            $this->recentMailedAddresses = array();\n            $_size6 = 0;\n            $_etype9 = 0;\n            $xfer += $input->readListBegin($_etype9, $_size6);\n            for ($_i10 = 0; $_i10 < $_size6; ++$_i10)\n            {\n              $elem11 = null;\n              $xfer += $input->readString($elem11);\n              $this->recentMailedAddresses []= $elem11;\n            }\n            $xfer += $input->readListEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 9:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->comments);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 11:\n          if ($ftype == TType::I64) {\n            $xfer += $input->readI64($this->dateAgreedToTermsOfService);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 12:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->maxReferrals);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 13:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->referralCount);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 14:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->refererCode);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 15:\n          if ($ftype == TType::I64) {\n            $xfer += $input->readI64($this->sentEmailDate);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 16:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->sentEmailCount);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 17:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->dailyEmailLimit);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 18:\n          if ($ftype == TType::I64) {\n            $xfer += $input->readI64($this->emailOptOutDate);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 19:\n          if ($ftype == TType::I64) {\n            $xfer += $input->readI64($this->partnerEmailOptInDate);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 20:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->preferredLanguage);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 21:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->preferredCountry);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 22:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->clipFullPage);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 23:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->twitterUserName);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 24:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->twitterId);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 25:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->groupName);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 26:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->recognitionLanguage);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 28:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->referralProof);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 29:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->educationalDiscount);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 30:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->businessAddress);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 31:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->hideSponsorBilling);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 32:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->taxExempt);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 33:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->useEmailAutoFiling);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 34:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->reminderEmailConfig);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('UserAttributes');\n    if ($this->defaultLocationName !== null) {\n      $xfer += $output->writeFieldBegin('defaultLocationName', TType::STRING, 1);\n      $xfer += $output->writeString($this->defaultLocationName);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->defaultLatitude !== null) {\n      $xfer += $output->writeFieldBegin('defaultLatitude', TType::DOUBLE, 2);\n      $xfer += $output->writeDouble($this->defaultLatitude);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->defaultLongitude !== null) {\n      $xfer += $output->writeFieldBegin('defaultLongitude', TType::DOUBLE, 3);\n      $xfer += $output->writeDouble($this->defaultLongitude);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->preactivation !== null) {\n      $xfer += $output->writeFieldBegin('preactivation', TType::BOOL, 4);\n      $xfer += $output->writeBool($this->preactivation);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->viewedPromotions !== null) {\n      if (!is_array($this->viewedPromotions)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('viewedPromotions', TType::LST, 5);\n      {\n        $output->writeListBegin(TType::STRING, count($this->viewedPromotions));\n        {\n          foreach ($this->viewedPromotions as $iter12)\n          {\n            $xfer += $output->writeString($iter12);\n          }\n        }\n        $output->writeListEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->incomingEmailAddress !== null) {\n      $xfer += $output->writeFieldBegin('incomingEmailAddress', TType::STRING, 6);\n      $xfer += $output->writeString($this->incomingEmailAddress);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->recentMailedAddresses !== null) {\n      if (!is_array($this->recentMailedAddresses)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('recentMailedAddresses', TType::LST, 7);\n      {\n        $output->writeListBegin(TType::STRING, count($this->recentMailedAddresses));\n        {\n          foreach ($this->recentMailedAddresses as $iter13)\n          {\n            $xfer += $output->writeString($iter13);\n          }\n        }\n        $output->writeListEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->comments !== null) {\n      $xfer += $output->writeFieldBegin('comments', TType::STRING, 9);\n      $xfer += $output->writeString($this->comments);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->dateAgreedToTermsOfService !== null) {\n      $xfer += $output->writeFieldBegin('dateAgreedToTermsOfService', TType::I64, 11);\n      $xfer += $output->writeI64($this->dateAgreedToTermsOfService);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->maxReferrals !== null) {\n      $xfer += $output->writeFieldBegin('maxReferrals', TType::I32, 12);\n      $xfer += $output->writeI32($this->maxReferrals);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->referralCount !== null) {\n      $xfer += $output->writeFieldBegin('referralCount', TType::I32, 13);\n      $xfer += $output->writeI32($this->referralCount);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->refererCode !== null) {\n      $xfer += $output->writeFieldBegin('refererCode', TType::STRING, 14);\n      $xfer += $output->writeString($this->refererCode);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->sentEmailDate !== null) {\n      $xfer += $output->writeFieldBegin('sentEmailDate', TType::I64, 15);\n      $xfer += $output->writeI64($this->sentEmailDate);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->sentEmailCount !== null) {\n      $xfer += $output->writeFieldBegin('sentEmailCount', TType::I32, 16);\n      $xfer += $output->writeI32($this->sentEmailCount);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->dailyEmailLimit !== null) {\n      $xfer += $output->writeFieldBegin('dailyEmailLimit', TType::I32, 17);\n      $xfer += $output->writeI32($this->dailyEmailLimit);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->emailOptOutDate !== null) {\n      $xfer += $output->writeFieldBegin('emailOptOutDate', TType::I64, 18);\n      $xfer += $output->writeI64($this->emailOptOutDate);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->partnerEmailOptInDate !== null) {\n      $xfer += $output->writeFieldBegin('partnerEmailOptInDate', TType::I64, 19);\n      $xfer += $output->writeI64($this->partnerEmailOptInDate);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->preferredLanguage !== null) {\n      $xfer += $output->writeFieldBegin('preferredLanguage', TType::STRING, 20);\n      $xfer += $output->writeString($this->preferredLanguage);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->preferredCountry !== null) {\n      $xfer += $output->writeFieldBegin('preferredCountry', TType::STRING, 21);\n      $xfer += $output->writeString($this->preferredCountry);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->clipFullPage !== null) {\n      $xfer += $output->writeFieldBegin('clipFullPage', TType::BOOL, 22);\n      $xfer += $output->writeBool($this->clipFullPage);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->twitterUserName !== null) {\n      $xfer += $output->writeFieldBegin('twitterUserName', TType::STRING, 23);\n      $xfer += $output->writeString($this->twitterUserName);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->twitterId !== null) {\n      $xfer += $output->writeFieldBegin('twitterId', TType::STRING, 24);\n      $xfer += $output->writeString($this->twitterId);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->groupName !== null) {\n      $xfer += $output->writeFieldBegin('groupName', TType::STRING, 25);\n      $xfer += $output->writeString($this->groupName);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->recognitionLanguage !== null) {\n      $xfer += $output->writeFieldBegin('recognitionLanguage', TType::STRING, 26);\n      $xfer += $output->writeString($this->recognitionLanguage);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->referralProof !== null) {\n      $xfer += $output->writeFieldBegin('referralProof', TType::STRING, 28);\n      $xfer += $output->writeString($this->referralProof);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->educationalDiscount !== null) {\n      $xfer += $output->writeFieldBegin('educationalDiscount', TType::BOOL, 29);\n      $xfer += $output->writeBool($this->educationalDiscount);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->businessAddress !== null) {\n      $xfer += $output->writeFieldBegin('businessAddress', TType::STRING, 30);\n      $xfer += $output->writeString($this->businessAddress);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->hideSponsorBilling !== null) {\n      $xfer += $output->writeFieldBegin('hideSponsorBilling', TType::BOOL, 31);\n      $xfer += $output->writeBool($this->hideSponsorBilling);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->taxExempt !== null) {\n      $xfer += $output->writeFieldBegin('taxExempt', TType::BOOL, 32);\n      $xfer += $output->writeBool($this->taxExempt);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->useEmailAutoFiling !== null) {\n      $xfer += $output->writeFieldBegin('useEmailAutoFiling', TType::BOOL, 33);\n      $xfer += $output->writeBool($this->useEmailAutoFiling);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->reminderEmailConfig !== null) {\n      $xfer += $output->writeFieldBegin('reminderEmailConfig', TType::I32, 34);\n      $xfer += $output->writeI32($this->reminderEmailConfig);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass Accounting {\n  static $_TSPEC;\n\n  public $uploadLimit = null;\n  public $uploadLimitEnd = null;\n  public $uploadLimitNextMonth = null;\n  public $premiumServiceStatus = null;\n  public $premiumOrderNumber = null;\n  public $premiumCommerceService = null;\n  public $premiumServiceStart = null;\n  public $premiumServiceSKU = null;\n  public $lastSuccessfulCharge = null;\n  public $lastFailedCharge = null;\n  public $lastFailedChargeReason = null;\n  public $nextPaymentDue = null;\n  public $premiumLockUntil = null;\n  public $updated = null;\n  public $premiumSubscriptionNumber = null;\n  public $lastRequestedCharge = null;\n  public $currency = null;\n  public $unitPrice = null;\n  public $businessId = null;\n  public $businessName = null;\n  public $businessRole = null;\n  public $unitDiscount = null;\n  public $nextChargeDate = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'uploadLimit',\n          'type' => TType::I64,\n          ),\n        2 => array(\n          'var' => 'uploadLimitEnd',\n          'type' => TType::I64,\n          ),\n        3 => array(\n          'var' => 'uploadLimitNextMonth',\n          'type' => TType::I64,\n          ),\n        4 => array(\n          'var' => 'premiumServiceStatus',\n          'type' => TType::I32,\n          ),\n        5 => array(\n          'var' => 'premiumOrderNumber',\n          'type' => TType::STRING,\n          ),\n        6 => array(\n          'var' => 'premiumCommerceService',\n          'type' => TType::STRING,\n          ),\n        7 => array(\n          'var' => 'premiumServiceStart',\n          'type' => TType::I64,\n          ),\n        8 => array(\n          'var' => 'premiumServiceSKU',\n          'type' => TType::STRING,\n          ),\n        9 => array(\n          'var' => 'lastSuccessfulCharge',\n          'type' => TType::I64,\n          ),\n        10 => array(\n          'var' => 'lastFailedCharge',\n          'type' => TType::I64,\n          ),\n        11 => array(\n          'var' => 'lastFailedChargeReason',\n          'type' => TType::STRING,\n          ),\n        12 => array(\n          'var' => 'nextPaymentDue',\n          'type' => TType::I64,\n          ),\n        13 => array(\n          'var' => 'premiumLockUntil',\n          'type' => TType::I64,\n          ),\n        14 => array(\n          'var' => 'updated',\n          'type' => TType::I64,\n          ),\n        16 => array(\n          'var' => 'premiumSubscriptionNumber',\n          'type' => TType::STRING,\n          ),\n        17 => array(\n          'var' => 'lastRequestedCharge',\n          'type' => TType::I64,\n          ),\n        18 => array(\n          'var' => 'currency',\n          'type' => TType::STRING,\n          ),\n        19 => array(\n          'var' => 'unitPrice',\n          'type' => TType::I32,\n          ),\n        20 => array(\n          'var' => 'businessId',\n          'type' => TType::I32,\n          ),\n        21 => array(\n          'var' => 'businessName',\n          'type' => TType::STRING,\n          ),\n        22 => array(\n          'var' => 'businessRole',\n          'type' => TType::I32,\n          ),\n        23 => array(\n          'var' => 'unitDiscount',\n          'type' => TType::I32,\n          ),\n        24 => array(\n          'var' => 'nextChargeDate',\n          'type' => TType::I64,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['uploadLimit'])) {\n        $this->uploadLimit = $vals['uploadLimit'];\n      }\n      if (isset($vals['uploadLimitEnd'])) {\n        $this->uploadLimitEnd = $vals['uploadLimitEnd'];\n      }\n      if (isset($vals['uploadLimitNextMonth'])) {\n        $this->uploadLimitNextMonth = $vals['uploadLimitNextMonth'];\n      }\n      if (isset($vals['premiumServiceStatus'])) {\n        $this->premiumServiceStatus = $vals['premiumServiceStatus'];\n      }\n      if (isset($vals['premiumOrderNumber'])) {\n        $this->premiumOrderNumber = $vals['premiumOrderNumber'];\n      }\n      if (isset($vals['premiumCommerceService'])) {\n        $this->premiumCommerceService = $vals['premiumCommerceService'];\n      }\n      if (isset($vals['premiumServiceStart'])) {\n        $this->premiumServiceStart = $vals['premiumServiceStart'];\n      }\n      if (isset($vals['premiumServiceSKU'])) {\n        $this->premiumServiceSKU = $vals['premiumServiceSKU'];\n      }\n      if (isset($vals['lastSuccessfulCharge'])) {\n        $this->lastSuccessfulCharge = $vals['lastSuccessfulCharge'];\n      }\n      if (isset($vals['lastFailedCharge'])) {\n        $this->lastFailedCharge = $vals['lastFailedCharge'];\n      }\n      if (isset($vals['lastFailedChargeReason'])) {\n        $this->lastFailedChargeReason = $vals['lastFailedChargeReason'];\n      }\n      if (isset($vals['nextPaymentDue'])) {\n        $this->nextPaymentDue = $vals['nextPaymentDue'];\n      }\n      if (isset($vals['premiumLockUntil'])) {\n        $this->premiumLockUntil = $vals['premiumLockUntil'];\n      }\n      if (isset($vals['updated'])) {\n        $this->updated = $vals['updated'];\n      }\n      if (isset($vals['premiumSubscriptionNumber'])) {\n        $this->premiumSubscriptionNumber = $vals['premiumSubscriptionNumber'];\n      }\n      if (isset($vals['lastRequestedCharge'])) {\n        $this->lastRequestedCharge = $vals['lastRequestedCharge'];\n      }\n      if (isset($vals['currency'])) {\n        $this->currency = $vals['currency'];\n      }\n      if (isset($vals['unitPrice'])) {\n        $this->unitPrice = $vals['unitPrice'];\n      }\n      if (isset($vals['businessId'])) {\n        $this->businessId = $vals['businessId'];\n      }\n      if (isset($vals['businessName'])) {\n        $this->businessName = $vals['businessName'];\n      }\n      if (isset($vals['businessRole'])) {\n        $this->businessRole = $vals['businessRole'];\n      }\n      if (isset($vals['unitDiscount'])) {\n        $this->unitDiscount = $vals['unitDiscount'];\n      }\n      if (isset($vals['nextChargeDate'])) {\n        $this->nextChargeDate = $vals['nextChargeDate'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'Accounting';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::I64) {\n            $xfer += $input->readI64($this->uploadLimit);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::I64) {\n            $xfer += $input->readI64($this->uploadLimitEnd);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::I64) {\n            $xfer += $input->readI64($this->uploadLimitNextMonth);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 4:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->premiumServiceStatus);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 5:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->premiumOrderNumber);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 6:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->premiumCommerceService);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 7:\n          if ($ftype == TType::I64) {\n            $xfer += $input->readI64($this->premiumServiceStart);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 8:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->premiumServiceSKU);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 9:\n          if ($ftype == TType::I64) {\n            $xfer += $input->readI64($this->lastSuccessfulCharge);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 10:\n          if ($ftype == TType::I64) {\n            $xfer += $input->readI64($this->lastFailedCharge);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 11:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->lastFailedChargeReason);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 12:\n          if ($ftype == TType::I64) {\n            $xfer += $input->readI64($this->nextPaymentDue);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 13:\n          if ($ftype == TType::I64) {\n            $xfer += $input->readI64($this->premiumLockUntil);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 14:\n          if ($ftype == TType::I64) {\n            $xfer += $input->readI64($this->updated);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 16:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->premiumSubscriptionNumber);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 17:\n          if ($ftype == TType::I64) {\n            $xfer += $input->readI64($this->lastRequestedCharge);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 18:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->currency);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 19:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->unitPrice);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 20:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->businessId);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 21:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->businessName);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 22:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->businessRole);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 23:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->unitDiscount);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 24:\n          if ($ftype == TType::I64) {\n            $xfer += $input->readI64($this->nextChargeDate);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('Accounting');\n    if ($this->uploadLimit !== null) {\n      $xfer += $output->writeFieldBegin('uploadLimit', TType::I64, 1);\n      $xfer += $output->writeI64($this->uploadLimit);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->uploadLimitEnd !== null) {\n      $xfer += $output->writeFieldBegin('uploadLimitEnd', TType::I64, 2);\n      $xfer += $output->writeI64($this->uploadLimitEnd);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->uploadLimitNextMonth !== null) {\n      $xfer += $output->writeFieldBegin('uploadLimitNextMonth', TType::I64, 3);\n      $xfer += $output->writeI64($this->uploadLimitNextMonth);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->premiumServiceStatus !== null) {\n      $xfer += $output->writeFieldBegin('premiumServiceStatus', TType::I32, 4);\n      $xfer += $output->writeI32($this->premiumServiceStatus);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->premiumOrderNumber !== null) {\n      $xfer += $output->writeFieldBegin('premiumOrderNumber', TType::STRING, 5);\n      $xfer += $output->writeString($this->premiumOrderNumber);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->premiumCommerceService !== null) {\n      $xfer += $output->writeFieldBegin('premiumCommerceService', TType::STRING, 6);\n      $xfer += $output->writeString($this->premiumCommerceService);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->premiumServiceStart !== null) {\n      $xfer += $output->writeFieldBegin('premiumServiceStart', TType::I64, 7);\n      $xfer += $output->writeI64($this->premiumServiceStart);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->premiumServiceSKU !== null) {\n      $xfer += $output->writeFieldBegin('premiumServiceSKU', TType::STRING, 8);\n      $xfer += $output->writeString($this->premiumServiceSKU);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->lastSuccessfulCharge !== null) {\n      $xfer += $output->writeFieldBegin('lastSuccessfulCharge', TType::I64, 9);\n      $xfer += $output->writeI64($this->lastSuccessfulCharge);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->lastFailedCharge !== null) {\n      $xfer += $output->writeFieldBegin('lastFailedCharge', TType::I64, 10);\n      $xfer += $output->writeI64($this->lastFailedCharge);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->lastFailedChargeReason !== null) {\n      $xfer += $output->writeFieldBegin('lastFailedChargeReason', TType::STRING, 11);\n      $xfer += $output->writeString($this->lastFailedChargeReason);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->nextPaymentDue !== null) {\n      $xfer += $output->writeFieldBegin('nextPaymentDue', TType::I64, 12);\n      $xfer += $output->writeI64($this->nextPaymentDue);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->premiumLockUntil !== null) {\n      $xfer += $output->writeFieldBegin('premiumLockUntil', TType::I64, 13);\n      $xfer += $output->writeI64($this->premiumLockUntil);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->updated !== null) {\n      $xfer += $output->writeFieldBegin('updated', TType::I64, 14);\n      $xfer += $output->writeI64($this->updated);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->premiumSubscriptionNumber !== null) {\n      $xfer += $output->writeFieldBegin('premiumSubscriptionNumber', TType::STRING, 16);\n      $xfer += $output->writeString($this->premiumSubscriptionNumber);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->lastRequestedCharge !== null) {\n      $xfer += $output->writeFieldBegin('lastRequestedCharge', TType::I64, 17);\n      $xfer += $output->writeI64($this->lastRequestedCharge);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->currency !== null) {\n      $xfer += $output->writeFieldBegin('currency', TType::STRING, 18);\n      $xfer += $output->writeString($this->currency);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->unitPrice !== null) {\n      $xfer += $output->writeFieldBegin('unitPrice', TType::I32, 19);\n      $xfer += $output->writeI32($this->unitPrice);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->businessId !== null) {\n      $xfer += $output->writeFieldBegin('businessId', TType::I32, 20);\n      $xfer += $output->writeI32($this->businessId);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->businessName !== null) {\n      $xfer += $output->writeFieldBegin('businessName', TType::STRING, 21);\n      $xfer += $output->writeString($this->businessName);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->businessRole !== null) {\n      $xfer += $output->writeFieldBegin('businessRole', TType::I32, 22);\n      $xfer += $output->writeI32($this->businessRole);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->unitDiscount !== null) {\n      $xfer += $output->writeFieldBegin('unitDiscount', TType::I32, 23);\n      $xfer += $output->writeI32($this->unitDiscount);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->nextChargeDate !== null) {\n      $xfer += $output->writeFieldBegin('nextChargeDate', TType::I64, 24);\n      $xfer += $output->writeI64($this->nextChargeDate);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass BusinessUserInfo {\n  static $_TSPEC;\n\n  public $businessId = null;\n  public $businessName = null;\n  public $role = null;\n  public $email = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'businessId',\n          'type' => TType::I32,\n          ),\n        2 => array(\n          'var' => 'businessName',\n          'type' => TType::STRING,\n          ),\n        3 => array(\n          'var' => 'role',\n          'type' => TType::I32,\n          ),\n        4 => array(\n          'var' => 'email',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['businessId'])) {\n        $this->businessId = $vals['businessId'];\n      }\n      if (isset($vals['businessName'])) {\n        $this->businessName = $vals['businessName'];\n      }\n      if (isset($vals['role'])) {\n        $this->role = $vals['role'];\n      }\n      if (isset($vals['email'])) {\n        $this->email = $vals['email'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'BusinessUserInfo';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->businessId);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->businessName);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->role);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 4:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->email);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('BusinessUserInfo');\n    if ($this->businessId !== null) {\n      $xfer += $output->writeFieldBegin('businessId', TType::I32, 1);\n      $xfer += $output->writeI32($this->businessId);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->businessName !== null) {\n      $xfer += $output->writeFieldBegin('businessName', TType::STRING, 2);\n      $xfer += $output->writeString($this->businessName);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->role !== null) {\n      $xfer += $output->writeFieldBegin('role', TType::I32, 3);\n      $xfer += $output->writeI32($this->role);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->email !== null) {\n      $xfer += $output->writeFieldBegin('email', TType::STRING, 4);\n      $xfer += $output->writeString($this->email);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass PremiumInfo {\n  static $_TSPEC;\n\n  public $currentTime = null;\n  public $premium = null;\n  public $premiumRecurring = null;\n  public $premiumExpirationDate = null;\n  public $premiumExtendable = null;\n  public $premiumPending = null;\n  public $premiumCancellationPending = null;\n  public $canPurchaseUploadAllowance = null;\n  public $sponsoredGroupName = null;\n  public $sponsoredGroupRole = null;\n  public $premiumUpgradable = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'currentTime',\n          'type' => TType::I64,\n          ),\n        2 => array(\n          'var' => 'premium',\n          'type' => TType::BOOL,\n          ),\n        3 => array(\n          'var' => 'premiumRecurring',\n          'type' => TType::BOOL,\n          ),\n        4 => array(\n          'var' => 'premiumExpirationDate',\n          'type' => TType::I64,\n          ),\n        5 => array(\n          'var' => 'premiumExtendable',\n          'type' => TType::BOOL,\n          ),\n        6 => array(\n          'var' => 'premiumPending',\n          'type' => TType::BOOL,\n          ),\n        7 => array(\n          'var' => 'premiumCancellationPending',\n          'type' => TType::BOOL,\n          ),\n        8 => array(\n          'var' => 'canPurchaseUploadAllowance',\n          'type' => TType::BOOL,\n          ),\n        9 => array(\n          'var' => 'sponsoredGroupName',\n          'type' => TType::STRING,\n          ),\n        10 => array(\n          'var' => 'sponsoredGroupRole',\n          'type' => TType::I32,\n          ),\n        11 => array(\n          'var' => 'premiumUpgradable',\n          'type' => TType::BOOL,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['currentTime'])) {\n        $this->currentTime = $vals['currentTime'];\n      }\n      if (isset($vals['premium'])) {\n        $this->premium = $vals['premium'];\n      }\n      if (isset($vals['premiumRecurring'])) {\n        $this->premiumRecurring = $vals['premiumRecurring'];\n      }\n      if (isset($vals['premiumExpirationDate'])) {\n        $this->premiumExpirationDate = $vals['premiumExpirationDate'];\n      }\n      if (isset($vals['premiumExtendable'])) {\n        $this->premiumExtendable = $vals['premiumExtendable'];\n      }\n      if (isset($vals['premiumPending'])) {\n        $this->premiumPending = $vals['premiumPending'];\n      }\n      if (isset($vals['premiumCancellationPending'])) {\n        $this->premiumCancellationPending = $vals['premiumCancellationPending'];\n      }\n      if (isset($vals['canPurchaseUploadAllowance'])) {\n        $this->canPurchaseUploadAllowance = $vals['canPurchaseUploadAllowance'];\n      }\n      if (isset($vals['sponsoredGroupName'])) {\n        $this->sponsoredGroupName = $vals['sponsoredGroupName'];\n      }\n      if (isset($vals['sponsoredGroupRole'])) {\n        $this->sponsoredGroupRole = $vals['sponsoredGroupRole'];\n      }\n      if (isset($vals['premiumUpgradable'])) {\n        $this->premiumUpgradable = $vals['premiumUpgradable'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'PremiumInfo';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::I64) {\n            $xfer += $input->readI64($this->currentTime);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->premium);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->premiumRecurring);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 4:\n          if ($ftype == TType::I64) {\n            $xfer += $input->readI64($this->premiumExpirationDate);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 5:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->premiumExtendable);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 6:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->premiumPending);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 7:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->premiumCancellationPending);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 8:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->canPurchaseUploadAllowance);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 9:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->sponsoredGroupName);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 10:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->sponsoredGroupRole);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 11:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->premiumUpgradable);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('PremiumInfo');\n    if ($this->currentTime !== null) {\n      $xfer += $output->writeFieldBegin('currentTime', TType::I64, 1);\n      $xfer += $output->writeI64($this->currentTime);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->premium !== null) {\n      $xfer += $output->writeFieldBegin('premium', TType::BOOL, 2);\n      $xfer += $output->writeBool($this->premium);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->premiumRecurring !== null) {\n      $xfer += $output->writeFieldBegin('premiumRecurring', TType::BOOL, 3);\n      $xfer += $output->writeBool($this->premiumRecurring);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->premiumExpirationDate !== null) {\n      $xfer += $output->writeFieldBegin('premiumExpirationDate', TType::I64, 4);\n      $xfer += $output->writeI64($this->premiumExpirationDate);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->premiumExtendable !== null) {\n      $xfer += $output->writeFieldBegin('premiumExtendable', TType::BOOL, 5);\n      $xfer += $output->writeBool($this->premiumExtendable);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->premiumPending !== null) {\n      $xfer += $output->writeFieldBegin('premiumPending', TType::BOOL, 6);\n      $xfer += $output->writeBool($this->premiumPending);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->premiumCancellationPending !== null) {\n      $xfer += $output->writeFieldBegin('premiumCancellationPending', TType::BOOL, 7);\n      $xfer += $output->writeBool($this->premiumCancellationPending);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->canPurchaseUploadAllowance !== null) {\n      $xfer += $output->writeFieldBegin('canPurchaseUploadAllowance', TType::BOOL, 8);\n      $xfer += $output->writeBool($this->canPurchaseUploadAllowance);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->sponsoredGroupName !== null) {\n      $xfer += $output->writeFieldBegin('sponsoredGroupName', TType::STRING, 9);\n      $xfer += $output->writeString($this->sponsoredGroupName);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->sponsoredGroupRole !== null) {\n      $xfer += $output->writeFieldBegin('sponsoredGroupRole', TType::I32, 10);\n      $xfer += $output->writeI32($this->sponsoredGroupRole);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->premiumUpgradable !== null) {\n      $xfer += $output->writeFieldBegin('premiumUpgradable', TType::BOOL, 11);\n      $xfer += $output->writeBool($this->premiumUpgradable);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass User {\n  static $_TSPEC;\n\n  public $id = null;\n  public $username = null;\n  public $email = null;\n  public $name = null;\n  public $timezone = null;\n  public $privilege = null;\n  public $created = null;\n  public $updated = null;\n  public $deleted = null;\n  public $active = null;\n  public $shardId = null;\n  public $attributes = null;\n  public $accounting = null;\n  public $premiumInfo = null;\n  public $businessUserInfo = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'id',\n          'type' => TType::I32,\n          ),\n        2 => array(\n          'var' => 'username',\n          'type' => TType::STRING,\n          ),\n        3 => array(\n          'var' => 'email',\n          'type' => TType::STRING,\n          ),\n        4 => array(\n          'var' => 'name',\n          'type' => TType::STRING,\n          ),\n        6 => array(\n          'var' => 'timezone',\n          'type' => TType::STRING,\n          ),\n        7 => array(\n          'var' => 'privilege',\n          'type' => TType::I32,\n          ),\n        9 => array(\n          'var' => 'created',\n          'type' => TType::I64,\n          ),\n        10 => array(\n          'var' => 'updated',\n          'type' => TType::I64,\n          ),\n        11 => array(\n          'var' => 'deleted',\n          'type' => TType::I64,\n          ),\n        13 => array(\n          'var' => 'active',\n          'type' => TType::BOOL,\n          ),\n        14 => array(\n          'var' => 'shardId',\n          'type' => TType::STRING,\n          ),\n        15 => array(\n          'var' => 'attributes',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\UserAttributes',\n          ),\n        16 => array(\n          'var' => 'accounting',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\Accounting',\n          ),\n        17 => array(\n          'var' => 'premiumInfo',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\PremiumInfo',\n          ),\n        18 => array(\n          'var' => 'businessUserInfo',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\BusinessUserInfo',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['id'])) {\n        $this->id = $vals['id'];\n      }\n      if (isset($vals['username'])) {\n        $this->username = $vals['username'];\n      }\n      if (isset($vals['email'])) {\n        $this->email = $vals['email'];\n      }\n      if (isset($vals['name'])) {\n        $this->name = $vals['name'];\n      }\n      if (isset($vals['timezone'])) {\n        $this->timezone = $vals['timezone'];\n      }\n      if (isset($vals['privilege'])) {\n        $this->privilege = $vals['privilege'];\n      }\n      if (isset($vals['created'])) {\n        $this->created = $vals['created'];\n      }\n      if (isset($vals['updated'])) {\n        $this->updated = $vals['updated'];\n      }\n      if (isset($vals['deleted'])) {\n        $this->deleted = $vals['deleted'];\n      }\n      if (isset($vals['active'])) {\n        $this->active = $vals['active'];\n      }\n      if (isset($vals['shardId'])) {\n        $this->shardId = $vals['shardId'];\n      }\n      if (isset($vals['attributes'])) {\n        $this->attributes = $vals['attributes'];\n      }\n      if (isset($vals['accounting'])) {\n        $this->accounting = $vals['accounting'];\n      }\n      if (isset($vals['premiumInfo'])) {\n        $this->premiumInfo = $vals['premiumInfo'];\n      }\n      if (isset($vals['businessUserInfo'])) {\n        $this->businessUserInfo = $vals['businessUserInfo'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'User';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->id);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->username);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->email);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 4:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->name);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 6:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->timezone);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 7:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->privilege);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 9:\n          if ($ftype == TType::I64) {\n            $xfer += $input->readI64($this->created);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 10:\n          if ($ftype == TType::I64) {\n            $xfer += $input->readI64($this->updated);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 11:\n          if ($ftype == TType::I64) {\n            $xfer += $input->readI64($this->deleted);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 13:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->active);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 14:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->shardId);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 15:\n          if ($ftype == TType::STRUCT) {\n            $this->attributes = new \\EDAM\\Types\\UserAttributes();\n            $xfer += $this->attributes->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 16:\n          if ($ftype == TType::STRUCT) {\n            $this->accounting = new \\EDAM\\Types\\Accounting();\n            $xfer += $this->accounting->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 17:\n          if ($ftype == TType::STRUCT) {\n            $this->premiumInfo = new \\EDAM\\Types\\PremiumInfo();\n            $xfer += $this->premiumInfo->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 18:\n          if ($ftype == TType::STRUCT) {\n            $this->businessUserInfo = new \\EDAM\\Types\\BusinessUserInfo();\n            $xfer += $this->businessUserInfo->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('User');\n    if ($this->id !== null) {\n      $xfer += $output->writeFieldBegin('id', TType::I32, 1);\n      $xfer += $output->writeI32($this->id);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->username !== null) {\n      $xfer += $output->writeFieldBegin('username', TType::STRING, 2);\n      $xfer += $output->writeString($this->username);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->email !== null) {\n      $xfer += $output->writeFieldBegin('email', TType::STRING, 3);\n      $xfer += $output->writeString($this->email);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->name !== null) {\n      $xfer += $output->writeFieldBegin('name', TType::STRING, 4);\n      $xfer += $output->writeString($this->name);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->timezone !== null) {\n      $xfer += $output->writeFieldBegin('timezone', TType::STRING, 6);\n      $xfer += $output->writeString($this->timezone);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->privilege !== null) {\n      $xfer += $output->writeFieldBegin('privilege', TType::I32, 7);\n      $xfer += $output->writeI32($this->privilege);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->created !== null) {\n      $xfer += $output->writeFieldBegin('created', TType::I64, 9);\n      $xfer += $output->writeI64($this->created);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->updated !== null) {\n      $xfer += $output->writeFieldBegin('updated', TType::I64, 10);\n      $xfer += $output->writeI64($this->updated);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->deleted !== null) {\n      $xfer += $output->writeFieldBegin('deleted', TType::I64, 11);\n      $xfer += $output->writeI64($this->deleted);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->active !== null) {\n      $xfer += $output->writeFieldBegin('active', TType::BOOL, 13);\n      $xfer += $output->writeBool($this->active);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->shardId !== null) {\n      $xfer += $output->writeFieldBegin('shardId', TType::STRING, 14);\n      $xfer += $output->writeString($this->shardId);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->attributes !== null) {\n      if (!is_object($this->attributes)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('attributes', TType::STRUCT, 15);\n      $xfer += $this->attributes->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->accounting !== null) {\n      if (!is_object($this->accounting)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('accounting', TType::STRUCT, 16);\n      $xfer += $this->accounting->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->premiumInfo !== null) {\n      if (!is_object($this->premiumInfo)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('premiumInfo', TType::STRUCT, 17);\n      $xfer += $this->premiumInfo->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->businessUserInfo !== null) {\n      if (!is_object($this->businessUserInfo)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('businessUserInfo', TType::STRUCT, 18);\n      $xfer += $this->businessUserInfo->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass Tag {\n  static $_TSPEC;\n\n  public $guid = null;\n  public $name = null;\n  public $parentGuid = null;\n  public $updateSequenceNum = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'guid',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'name',\n          'type' => TType::STRING,\n          ),\n        3 => array(\n          'var' => 'parentGuid',\n          'type' => TType::STRING,\n          ),\n        4 => array(\n          'var' => 'updateSequenceNum',\n          'type' => TType::I32,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['guid'])) {\n        $this->guid = $vals['guid'];\n      }\n      if (isset($vals['name'])) {\n        $this->name = $vals['name'];\n      }\n      if (isset($vals['parentGuid'])) {\n        $this->parentGuid = $vals['parentGuid'];\n      }\n      if (isset($vals['updateSequenceNum'])) {\n        $this->updateSequenceNum = $vals['updateSequenceNum'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'Tag';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->guid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->name);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->parentGuid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 4:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->updateSequenceNum);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('Tag');\n    if ($this->guid !== null) {\n      $xfer += $output->writeFieldBegin('guid', TType::STRING, 1);\n      $xfer += $output->writeString($this->guid);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->name !== null) {\n      $xfer += $output->writeFieldBegin('name', TType::STRING, 2);\n      $xfer += $output->writeString($this->name);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->parentGuid !== null) {\n      $xfer += $output->writeFieldBegin('parentGuid', TType::STRING, 3);\n      $xfer += $output->writeString($this->parentGuid);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->updateSequenceNum !== null) {\n      $xfer += $output->writeFieldBegin('updateSequenceNum', TType::I32, 4);\n      $xfer += $output->writeI32($this->updateSequenceNum);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass LazyMap {\n  static $_TSPEC;\n\n  public $keysOnly = null;\n  public $fullMap = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'keysOnly',\n          'type' => TType::SET,\n          'etype' => TType::STRING,\n          'elem' => array(\n            'type' => TType::STRING,\n            ),\n          ),\n        2 => array(\n          'var' => 'fullMap',\n          'type' => TType::MAP,\n          'ktype' => TType::STRING,\n          'vtype' => TType::STRING,\n          'key' => array(\n            'type' => TType::STRING,\n          ),\n          'val' => array(\n            'type' => TType::STRING,\n            ),\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['keysOnly'])) {\n        $this->keysOnly = $vals['keysOnly'];\n      }\n      if (isset($vals['fullMap'])) {\n        $this->fullMap = $vals['fullMap'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'LazyMap';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::SET) {\n            $this->keysOnly = array();\n            $_size14 = 0;\n            $_etype17 = 0;\n            $xfer += $input->readSetBegin($_etype17, $_size14);\n            for ($_i18 = 0; $_i18 < $_size14; ++$_i18)\n            {\n              $elem19 = null;\n              $xfer += $input->readString($elem19);\n              if (is_scalar($elem19)) {\n                $this->keysOnly[$elem19] = true;\n              } else {\n                $this->keysOnly []= $elem19;\n              }\n            }\n            $xfer += $input->readSetEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::MAP) {\n            $this->fullMap = array();\n            $_size20 = 0;\n            $_ktype21 = 0;\n            $_vtype22 = 0;\n            $xfer += $input->readMapBegin($_ktype21, $_vtype22, $_size20);\n            for ($_i24 = 0; $_i24 < $_size20; ++$_i24)\n            {\n              $key25 = '';\n              $val26 = '';\n              $xfer += $input->readString($key25);\n              $xfer += $input->readString($val26);\n              $this->fullMap[$key25] = $val26;\n            }\n            $xfer += $input->readMapEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('LazyMap');\n    if ($this->keysOnly !== null) {\n      if (!is_array($this->keysOnly)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('keysOnly', TType::SET, 1);\n      {\n        $output->writeSetBegin(TType::STRING, count($this->keysOnly));\n        {\n          foreach ($this->keysOnly as $iter27 => $iter28)\n          {\n            if (is_scalar($iter28)) {\n            $xfer += $output->writeString($iter27);\n            } else {\n            $xfer += $output->writeString($iter28);\n            }\n          }\n        }\n        $output->writeSetEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->fullMap !== null) {\n      if (!is_array($this->fullMap)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('fullMap', TType::MAP, 2);\n      {\n        $output->writeMapBegin(TType::STRING, TType::STRING, count($this->fullMap));\n        {\n          foreach ($this->fullMap as $kiter29 => $viter30)\n          {\n            $xfer += $output->writeString($kiter29);\n            $xfer += $output->writeString($viter30);\n          }\n        }\n        $output->writeMapEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass ResourceAttributes {\n  static $_TSPEC;\n\n  public $sourceURL = null;\n  public $timestamp = null;\n  public $latitude = null;\n  public $longitude = null;\n  public $altitude = null;\n  public $cameraMake = null;\n  public $cameraModel = null;\n  public $clientWillIndex = null;\n  public $recoType = null;\n  public $fileName = null;\n  public $attachment = null;\n  public $applicationData = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'sourceURL',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'timestamp',\n          'type' => TType::I64,\n          ),\n        3 => array(\n          'var' => 'latitude',\n          'type' => TType::DOUBLE,\n          ),\n        4 => array(\n          'var' => 'longitude',\n          'type' => TType::DOUBLE,\n          ),\n        5 => array(\n          'var' => 'altitude',\n          'type' => TType::DOUBLE,\n          ),\n        6 => array(\n          'var' => 'cameraMake',\n          'type' => TType::STRING,\n          ),\n        7 => array(\n          'var' => 'cameraModel',\n          'type' => TType::STRING,\n          ),\n        8 => array(\n          'var' => 'clientWillIndex',\n          'type' => TType::BOOL,\n          ),\n        9 => array(\n          'var' => 'recoType',\n          'type' => TType::STRING,\n          ),\n        10 => array(\n          'var' => 'fileName',\n          'type' => TType::STRING,\n          ),\n        11 => array(\n          'var' => 'attachment',\n          'type' => TType::BOOL,\n          ),\n        12 => array(\n          'var' => 'applicationData',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\LazyMap',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['sourceURL'])) {\n        $this->sourceURL = $vals['sourceURL'];\n      }\n      if (isset($vals['timestamp'])) {\n        $this->timestamp = $vals['timestamp'];\n      }\n      if (isset($vals['latitude'])) {\n        $this->latitude = $vals['latitude'];\n      }\n      if (isset($vals['longitude'])) {\n        $this->longitude = $vals['longitude'];\n      }\n      if (isset($vals['altitude'])) {\n        $this->altitude = $vals['altitude'];\n      }\n      if (isset($vals['cameraMake'])) {\n        $this->cameraMake = $vals['cameraMake'];\n      }\n      if (isset($vals['cameraModel'])) {\n        $this->cameraModel = $vals['cameraModel'];\n      }\n      if (isset($vals['clientWillIndex'])) {\n        $this->clientWillIndex = $vals['clientWillIndex'];\n      }\n      if (isset($vals['recoType'])) {\n        $this->recoType = $vals['recoType'];\n      }\n      if (isset($vals['fileName'])) {\n        $this->fileName = $vals['fileName'];\n      }\n      if (isset($vals['attachment'])) {\n        $this->attachment = $vals['attachment'];\n      }\n      if (isset($vals['applicationData'])) {\n        $this->applicationData = $vals['applicationData'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'ResourceAttributes';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->sourceURL);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::I64) {\n            $xfer += $input->readI64($this->timestamp);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::DOUBLE) {\n            $xfer += $input->readDouble($this->latitude);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 4:\n          if ($ftype == TType::DOUBLE) {\n            $xfer += $input->readDouble($this->longitude);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 5:\n          if ($ftype == TType::DOUBLE) {\n            $xfer += $input->readDouble($this->altitude);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 6:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->cameraMake);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 7:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->cameraModel);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 8:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->clientWillIndex);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 9:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->recoType);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 10:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->fileName);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 11:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->attachment);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 12:\n          if ($ftype == TType::STRUCT) {\n            $this->applicationData = new \\EDAM\\Types\\LazyMap();\n            $xfer += $this->applicationData->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('ResourceAttributes');\n    if ($this->sourceURL !== null) {\n      $xfer += $output->writeFieldBegin('sourceURL', TType::STRING, 1);\n      $xfer += $output->writeString($this->sourceURL);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->timestamp !== null) {\n      $xfer += $output->writeFieldBegin('timestamp', TType::I64, 2);\n      $xfer += $output->writeI64($this->timestamp);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->latitude !== null) {\n      $xfer += $output->writeFieldBegin('latitude', TType::DOUBLE, 3);\n      $xfer += $output->writeDouble($this->latitude);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->longitude !== null) {\n      $xfer += $output->writeFieldBegin('longitude', TType::DOUBLE, 4);\n      $xfer += $output->writeDouble($this->longitude);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->altitude !== null) {\n      $xfer += $output->writeFieldBegin('altitude', TType::DOUBLE, 5);\n      $xfer += $output->writeDouble($this->altitude);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->cameraMake !== null) {\n      $xfer += $output->writeFieldBegin('cameraMake', TType::STRING, 6);\n      $xfer += $output->writeString($this->cameraMake);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->cameraModel !== null) {\n      $xfer += $output->writeFieldBegin('cameraModel', TType::STRING, 7);\n      $xfer += $output->writeString($this->cameraModel);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->clientWillIndex !== null) {\n      $xfer += $output->writeFieldBegin('clientWillIndex', TType::BOOL, 8);\n      $xfer += $output->writeBool($this->clientWillIndex);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->recoType !== null) {\n      $xfer += $output->writeFieldBegin('recoType', TType::STRING, 9);\n      $xfer += $output->writeString($this->recoType);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->fileName !== null) {\n      $xfer += $output->writeFieldBegin('fileName', TType::STRING, 10);\n      $xfer += $output->writeString($this->fileName);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->attachment !== null) {\n      $xfer += $output->writeFieldBegin('attachment', TType::BOOL, 11);\n      $xfer += $output->writeBool($this->attachment);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->applicationData !== null) {\n      if (!is_object($this->applicationData)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('applicationData', TType::STRUCT, 12);\n      $xfer += $this->applicationData->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass Resource {\n  static $_TSPEC;\n\n  public $guid = null;\n  public $noteGuid = null;\n  public $data = null;\n  public $mime = null;\n  public $width = null;\n  public $height = null;\n  public $duration = null;\n  public $active = null;\n  public $recognition = null;\n  public $attributes = null;\n  public $updateSequenceNum = null;\n  public $alternateData = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'guid',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'noteGuid',\n          'type' => TType::STRING,\n          ),\n        3 => array(\n          'var' => 'data',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\Data',\n          ),\n        4 => array(\n          'var' => 'mime',\n          'type' => TType::STRING,\n          ),\n        5 => array(\n          'var' => 'width',\n          'type' => TType::I16,\n          ),\n        6 => array(\n          'var' => 'height',\n          'type' => TType::I16,\n          ),\n        7 => array(\n          'var' => 'duration',\n          'type' => TType::I16,\n          ),\n        8 => array(\n          'var' => 'active',\n          'type' => TType::BOOL,\n          ),\n        9 => array(\n          'var' => 'recognition',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\Data',\n          ),\n        11 => array(\n          'var' => 'attributes',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\ResourceAttributes',\n          ),\n        12 => array(\n          'var' => 'updateSequenceNum',\n          'type' => TType::I32,\n          ),\n        13 => array(\n          'var' => 'alternateData',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\Data',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['guid'])) {\n        $this->guid = $vals['guid'];\n      }\n      if (isset($vals['noteGuid'])) {\n        $this->noteGuid = $vals['noteGuid'];\n      }\n      if (isset($vals['data'])) {\n        $this->data = $vals['data'];\n      }\n      if (isset($vals['mime'])) {\n        $this->mime = $vals['mime'];\n      }\n      if (isset($vals['width'])) {\n        $this->width = $vals['width'];\n      }\n      if (isset($vals['height'])) {\n        $this->height = $vals['height'];\n      }\n      if (isset($vals['duration'])) {\n        $this->duration = $vals['duration'];\n      }\n      if (isset($vals['active'])) {\n        $this->active = $vals['active'];\n      }\n      if (isset($vals['recognition'])) {\n        $this->recognition = $vals['recognition'];\n      }\n      if (isset($vals['attributes'])) {\n        $this->attributes = $vals['attributes'];\n      }\n      if (isset($vals['updateSequenceNum'])) {\n        $this->updateSequenceNum = $vals['updateSequenceNum'];\n      }\n      if (isset($vals['alternateData'])) {\n        $this->alternateData = $vals['alternateData'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'Resource';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->guid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->noteGuid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->data = new \\EDAM\\Types\\Data();\n            $xfer += $this->data->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 4:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->mime);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 5:\n          if ($ftype == TType::I16) {\n            $xfer += $input->readI16($this->width);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 6:\n          if ($ftype == TType::I16) {\n            $xfer += $input->readI16($this->height);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 7:\n          if ($ftype == TType::I16) {\n            $xfer += $input->readI16($this->duration);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 8:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->active);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 9:\n          if ($ftype == TType::STRUCT) {\n            $this->recognition = new \\EDAM\\Types\\Data();\n            $xfer += $this->recognition->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 11:\n          if ($ftype == TType::STRUCT) {\n            $this->attributes = new \\EDAM\\Types\\ResourceAttributes();\n            $xfer += $this->attributes->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 12:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->updateSequenceNum);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 13:\n          if ($ftype == TType::STRUCT) {\n            $this->alternateData = new \\EDAM\\Types\\Data();\n            $xfer += $this->alternateData->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('Resource');\n    if ($this->guid !== null) {\n      $xfer += $output->writeFieldBegin('guid', TType::STRING, 1);\n      $xfer += $output->writeString($this->guid);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->noteGuid !== null) {\n      $xfer += $output->writeFieldBegin('noteGuid', TType::STRING, 2);\n      $xfer += $output->writeString($this->noteGuid);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->data !== null) {\n      if (!is_object($this->data)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('data', TType::STRUCT, 3);\n      $xfer += $this->data->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->mime !== null) {\n      $xfer += $output->writeFieldBegin('mime', TType::STRING, 4);\n      $xfer += $output->writeString($this->mime);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->width !== null) {\n      $xfer += $output->writeFieldBegin('width', TType::I16, 5);\n      $xfer += $output->writeI16($this->width);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->height !== null) {\n      $xfer += $output->writeFieldBegin('height', TType::I16, 6);\n      $xfer += $output->writeI16($this->height);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->duration !== null) {\n      $xfer += $output->writeFieldBegin('duration', TType::I16, 7);\n      $xfer += $output->writeI16($this->duration);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->active !== null) {\n      $xfer += $output->writeFieldBegin('active', TType::BOOL, 8);\n      $xfer += $output->writeBool($this->active);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->recognition !== null) {\n      if (!is_object($this->recognition)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('recognition', TType::STRUCT, 9);\n      $xfer += $this->recognition->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->attributes !== null) {\n      if (!is_object($this->attributes)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('attributes', TType::STRUCT, 11);\n      $xfer += $this->attributes->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->updateSequenceNum !== null) {\n      $xfer += $output->writeFieldBegin('updateSequenceNum', TType::I32, 12);\n      $xfer += $output->writeI32($this->updateSequenceNum);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->alternateData !== null) {\n      if (!is_object($this->alternateData)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('alternateData', TType::STRUCT, 13);\n      $xfer += $this->alternateData->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NoteAttributes {\n  static $_TSPEC;\n\n  public $subjectDate = null;\n  public $latitude = null;\n  public $longitude = null;\n  public $altitude = null;\n  public $author = null;\n  public $source = null;\n  public $sourceURL = null;\n  public $sourceApplication = null;\n  public $shareDate = null;\n  public $reminderOrder = null;\n  public $reminderDoneTime = null;\n  public $reminderTime = null;\n  public $placeName = null;\n  public $contentClass = null;\n  public $applicationData = null;\n  public $lastEditedBy = null;\n  public $classifications = null;\n  public $creatorId = null;\n  public $lastEditorId = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'subjectDate',\n          'type' => TType::I64,\n          ),\n        10 => array(\n          'var' => 'latitude',\n          'type' => TType::DOUBLE,\n          ),\n        11 => array(\n          'var' => 'longitude',\n          'type' => TType::DOUBLE,\n          ),\n        12 => array(\n          'var' => 'altitude',\n          'type' => TType::DOUBLE,\n          ),\n        13 => array(\n          'var' => 'author',\n          'type' => TType::STRING,\n          ),\n        14 => array(\n          'var' => 'source',\n          'type' => TType::STRING,\n          ),\n        15 => array(\n          'var' => 'sourceURL',\n          'type' => TType::STRING,\n          ),\n        16 => array(\n          'var' => 'sourceApplication',\n          'type' => TType::STRING,\n          ),\n        17 => array(\n          'var' => 'shareDate',\n          'type' => TType::I64,\n          ),\n        18 => array(\n          'var' => 'reminderOrder',\n          'type' => TType::I64,\n          ),\n        19 => array(\n          'var' => 'reminderDoneTime',\n          'type' => TType::I64,\n          ),\n        20 => array(\n          'var' => 'reminderTime',\n          'type' => TType::I64,\n          ),\n        21 => array(\n          'var' => 'placeName',\n          'type' => TType::STRING,\n          ),\n        22 => array(\n          'var' => 'contentClass',\n          'type' => TType::STRING,\n          ),\n        23 => array(\n          'var' => 'applicationData',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\LazyMap',\n          ),\n        24 => array(\n          'var' => 'lastEditedBy',\n          'type' => TType::STRING,\n          ),\n        26 => array(\n          'var' => 'classifications',\n          'type' => TType::MAP,\n          'ktype' => TType::STRING,\n          'vtype' => TType::STRING,\n          'key' => array(\n            'type' => TType::STRING,\n          ),\n          'val' => array(\n            'type' => TType::STRING,\n            ),\n          ),\n        27 => array(\n          'var' => 'creatorId',\n          'type' => TType::I32,\n          ),\n        28 => array(\n          'var' => 'lastEditorId',\n          'type' => TType::I32,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['subjectDate'])) {\n        $this->subjectDate = $vals['subjectDate'];\n      }\n      if (isset($vals['latitude'])) {\n        $this->latitude = $vals['latitude'];\n      }\n      if (isset($vals['longitude'])) {\n        $this->longitude = $vals['longitude'];\n      }\n      if (isset($vals['altitude'])) {\n        $this->altitude = $vals['altitude'];\n      }\n      if (isset($vals['author'])) {\n        $this->author = $vals['author'];\n      }\n      if (isset($vals['source'])) {\n        $this->source = $vals['source'];\n      }\n      if (isset($vals['sourceURL'])) {\n        $this->sourceURL = $vals['sourceURL'];\n      }\n      if (isset($vals['sourceApplication'])) {\n        $this->sourceApplication = $vals['sourceApplication'];\n      }\n      if (isset($vals['shareDate'])) {\n        $this->shareDate = $vals['shareDate'];\n      }\n      if (isset($vals['reminderOrder'])) {\n        $this->reminderOrder = $vals['reminderOrder'];\n      }\n      if (isset($vals['reminderDoneTime'])) {\n        $this->reminderDoneTime = $vals['reminderDoneTime'];\n      }\n      if (isset($vals['reminderTime'])) {\n        $this->reminderTime = $vals['reminderTime'];\n      }\n      if (isset($vals['placeName'])) {\n        $this->placeName = $vals['placeName'];\n      }\n      if (isset($vals['contentClass'])) {\n        $this->contentClass = $vals['contentClass'];\n      }\n      if (isset($vals['applicationData'])) {\n        $this->applicationData = $vals['applicationData'];\n      }\n      if (isset($vals['lastEditedBy'])) {\n        $this->lastEditedBy = $vals['lastEditedBy'];\n      }\n      if (isset($vals['classifications'])) {\n        $this->classifications = $vals['classifications'];\n      }\n      if (isset($vals['creatorId'])) {\n        $this->creatorId = $vals['creatorId'];\n      }\n      if (isset($vals['lastEditorId'])) {\n        $this->lastEditorId = $vals['lastEditorId'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NoteAttributes';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::I64) {\n            $xfer += $input->readI64($this->subjectDate);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 10:\n          if ($ftype == TType::DOUBLE) {\n            $xfer += $input->readDouble($this->latitude);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 11:\n          if ($ftype == TType::DOUBLE) {\n            $xfer += $input->readDouble($this->longitude);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 12:\n          if ($ftype == TType::DOUBLE) {\n            $xfer += $input->readDouble($this->altitude);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 13:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->author);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 14:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->source);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 15:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->sourceURL);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 16:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->sourceApplication);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 17:\n          if ($ftype == TType::I64) {\n            $xfer += $input->readI64($this->shareDate);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 18:\n          if ($ftype == TType::I64) {\n            $xfer += $input->readI64($this->reminderOrder);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 19:\n          if ($ftype == TType::I64) {\n            $xfer += $input->readI64($this->reminderDoneTime);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 20:\n          if ($ftype == TType::I64) {\n            $xfer += $input->readI64($this->reminderTime);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 21:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->placeName);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 22:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->contentClass);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 23:\n          if ($ftype == TType::STRUCT) {\n            $this->applicationData = new \\EDAM\\Types\\LazyMap();\n            $xfer += $this->applicationData->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 24:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->lastEditedBy);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 26:\n          if ($ftype == TType::MAP) {\n            $this->classifications = array();\n            $_size31 = 0;\n            $_ktype32 = 0;\n            $_vtype33 = 0;\n            $xfer += $input->readMapBegin($_ktype32, $_vtype33, $_size31);\n            for ($_i35 = 0; $_i35 < $_size31; ++$_i35)\n            {\n              $key36 = '';\n              $val37 = '';\n              $xfer += $input->readString($key36);\n              $xfer += $input->readString($val37);\n              $this->classifications[$key36] = $val37;\n            }\n            $xfer += $input->readMapEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 27:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->creatorId);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 28:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->lastEditorId);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NoteAttributes');\n    if ($this->subjectDate !== null) {\n      $xfer += $output->writeFieldBegin('subjectDate', TType::I64, 1);\n      $xfer += $output->writeI64($this->subjectDate);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->latitude !== null) {\n      $xfer += $output->writeFieldBegin('latitude', TType::DOUBLE, 10);\n      $xfer += $output->writeDouble($this->latitude);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->longitude !== null) {\n      $xfer += $output->writeFieldBegin('longitude', TType::DOUBLE, 11);\n      $xfer += $output->writeDouble($this->longitude);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->altitude !== null) {\n      $xfer += $output->writeFieldBegin('altitude', TType::DOUBLE, 12);\n      $xfer += $output->writeDouble($this->altitude);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->author !== null) {\n      $xfer += $output->writeFieldBegin('author', TType::STRING, 13);\n      $xfer += $output->writeString($this->author);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->source !== null) {\n      $xfer += $output->writeFieldBegin('source', TType::STRING, 14);\n      $xfer += $output->writeString($this->source);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->sourceURL !== null) {\n      $xfer += $output->writeFieldBegin('sourceURL', TType::STRING, 15);\n      $xfer += $output->writeString($this->sourceURL);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->sourceApplication !== null) {\n      $xfer += $output->writeFieldBegin('sourceApplication', TType::STRING, 16);\n      $xfer += $output->writeString($this->sourceApplication);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->shareDate !== null) {\n      $xfer += $output->writeFieldBegin('shareDate', TType::I64, 17);\n      $xfer += $output->writeI64($this->shareDate);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->reminderOrder !== null) {\n      $xfer += $output->writeFieldBegin('reminderOrder', TType::I64, 18);\n      $xfer += $output->writeI64($this->reminderOrder);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->reminderDoneTime !== null) {\n      $xfer += $output->writeFieldBegin('reminderDoneTime', TType::I64, 19);\n      $xfer += $output->writeI64($this->reminderDoneTime);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->reminderTime !== null) {\n      $xfer += $output->writeFieldBegin('reminderTime', TType::I64, 20);\n      $xfer += $output->writeI64($this->reminderTime);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->placeName !== null) {\n      $xfer += $output->writeFieldBegin('placeName', TType::STRING, 21);\n      $xfer += $output->writeString($this->placeName);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->contentClass !== null) {\n      $xfer += $output->writeFieldBegin('contentClass', TType::STRING, 22);\n      $xfer += $output->writeString($this->contentClass);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->applicationData !== null) {\n      if (!is_object($this->applicationData)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('applicationData', TType::STRUCT, 23);\n      $xfer += $this->applicationData->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->lastEditedBy !== null) {\n      $xfer += $output->writeFieldBegin('lastEditedBy', TType::STRING, 24);\n      $xfer += $output->writeString($this->lastEditedBy);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->classifications !== null) {\n      if (!is_array($this->classifications)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('classifications', TType::MAP, 26);\n      {\n        $output->writeMapBegin(TType::STRING, TType::STRING, count($this->classifications));\n        {\n          foreach ($this->classifications as $kiter38 => $viter39)\n          {\n            $xfer += $output->writeString($kiter38);\n            $xfer += $output->writeString($viter39);\n          }\n        }\n        $output->writeMapEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->creatorId !== null) {\n      $xfer += $output->writeFieldBegin('creatorId', TType::I32, 27);\n      $xfer += $output->writeI32($this->creatorId);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->lastEditorId !== null) {\n      $xfer += $output->writeFieldBegin('lastEditorId', TType::I32, 28);\n      $xfer += $output->writeI32($this->lastEditorId);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass Note {\n  static $_TSPEC;\n\n  public $guid = null;\n  public $title = null;\n  public $content = null;\n  public $contentHash = null;\n  public $contentLength = null;\n  public $created = null;\n  public $updated = null;\n  public $deleted = null;\n  public $active = null;\n  public $updateSequenceNum = null;\n  public $notebookGuid = null;\n  public $tagGuids = null;\n  public $resources = null;\n  public $attributes = null;\n  public $tagNames = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'guid',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'title',\n          'type' => TType::STRING,\n          ),\n        3 => array(\n          'var' => 'content',\n          'type' => TType::STRING,\n          ),\n        4 => array(\n          'var' => 'contentHash',\n          'type' => TType::STRING,\n          ),\n        5 => array(\n          'var' => 'contentLength',\n          'type' => TType::I32,\n          ),\n        6 => array(\n          'var' => 'created',\n          'type' => TType::I64,\n          ),\n        7 => array(\n          'var' => 'updated',\n          'type' => TType::I64,\n          ),\n        8 => array(\n          'var' => 'deleted',\n          'type' => TType::I64,\n          ),\n        9 => array(\n          'var' => 'active',\n          'type' => TType::BOOL,\n          ),\n        10 => array(\n          'var' => 'updateSequenceNum',\n          'type' => TType::I32,\n          ),\n        11 => array(\n          'var' => 'notebookGuid',\n          'type' => TType::STRING,\n          ),\n        12 => array(\n          'var' => 'tagGuids',\n          'type' => TType::LST,\n          'etype' => TType::STRING,\n          'elem' => array(\n            'type' => TType::STRING,\n            ),\n          ),\n        13 => array(\n          'var' => 'resources',\n          'type' => TType::LST,\n          'etype' => TType::STRUCT,\n          'elem' => array(\n            'type' => TType::STRUCT,\n            'class' => '\\EDAM\\Types\\Resource',\n            ),\n          ),\n        14 => array(\n          'var' => 'attributes',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\NoteAttributes',\n          ),\n        15 => array(\n          'var' => 'tagNames',\n          'type' => TType::LST,\n          'etype' => TType::STRING,\n          'elem' => array(\n            'type' => TType::STRING,\n            ),\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['guid'])) {\n        $this->guid = $vals['guid'];\n      }\n      if (isset($vals['title'])) {\n        $this->title = $vals['title'];\n      }\n      if (isset($vals['content'])) {\n        $this->content = $vals['content'];\n      }\n      if (isset($vals['contentHash'])) {\n        $this->contentHash = $vals['contentHash'];\n      }\n      if (isset($vals['contentLength'])) {\n        $this->contentLength = $vals['contentLength'];\n      }\n      if (isset($vals['created'])) {\n        $this->created = $vals['created'];\n      }\n      if (isset($vals['updated'])) {\n        $this->updated = $vals['updated'];\n      }\n      if (isset($vals['deleted'])) {\n        $this->deleted = $vals['deleted'];\n      }\n      if (isset($vals['active'])) {\n        $this->active = $vals['active'];\n      }\n      if (isset($vals['updateSequenceNum'])) {\n        $this->updateSequenceNum = $vals['updateSequenceNum'];\n      }\n      if (isset($vals['notebookGuid'])) {\n        $this->notebookGuid = $vals['notebookGuid'];\n      }\n      if (isset($vals['tagGuids'])) {\n        $this->tagGuids = $vals['tagGuids'];\n      }\n      if (isset($vals['resources'])) {\n        $this->resources = $vals['resources'];\n      }\n      if (isset($vals['attributes'])) {\n        $this->attributes = $vals['attributes'];\n      }\n      if (isset($vals['tagNames'])) {\n        $this->tagNames = $vals['tagNames'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'Note';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->guid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->title);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->content);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 4:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->contentHash);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 5:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->contentLength);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 6:\n          if ($ftype == TType::I64) {\n            $xfer += $input->readI64($this->created);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 7:\n          if ($ftype == TType::I64) {\n            $xfer += $input->readI64($this->updated);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 8:\n          if ($ftype == TType::I64) {\n            $xfer += $input->readI64($this->deleted);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 9:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->active);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 10:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->updateSequenceNum);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 11:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->notebookGuid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 12:\n          if ($ftype == TType::LST) {\n            $this->tagGuids = array();\n            $_size40 = 0;\n            $_etype43 = 0;\n            $xfer += $input->readListBegin($_etype43, $_size40);\n            for ($_i44 = 0; $_i44 < $_size40; ++$_i44)\n            {\n              $elem45 = null;\n              $xfer += $input->readString($elem45);\n              $this->tagGuids []= $elem45;\n            }\n            $xfer += $input->readListEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 13:\n          if ($ftype == TType::LST) {\n            $this->resources = array();\n            $_size46 = 0;\n            $_etype49 = 0;\n            $xfer += $input->readListBegin($_etype49, $_size46);\n            for ($_i50 = 0; $_i50 < $_size46; ++$_i50)\n            {\n              $elem51 = null;\n              $elem51 = new \\EDAM\\Types\\Resource();\n              $xfer += $elem51->read($input);\n              $this->resources []= $elem51;\n            }\n            $xfer += $input->readListEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 14:\n          if ($ftype == TType::STRUCT) {\n            $this->attributes = new \\EDAM\\Types\\NoteAttributes();\n            $xfer += $this->attributes->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 15:\n          if ($ftype == TType::LST) {\n            $this->tagNames = array();\n            $_size52 = 0;\n            $_etype55 = 0;\n            $xfer += $input->readListBegin($_etype55, $_size52);\n            for ($_i56 = 0; $_i56 < $_size52; ++$_i56)\n            {\n              $elem57 = null;\n              $xfer += $input->readString($elem57);\n              $this->tagNames []= $elem57;\n            }\n            $xfer += $input->readListEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('Note');\n    if ($this->guid !== null) {\n      $xfer += $output->writeFieldBegin('guid', TType::STRING, 1);\n      $xfer += $output->writeString($this->guid);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->title !== null) {\n      $xfer += $output->writeFieldBegin('title', TType::STRING, 2);\n      $xfer += $output->writeString($this->title);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->content !== null) {\n      $xfer += $output->writeFieldBegin('content', TType::STRING, 3);\n      $xfer += $output->writeString($this->content);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->contentHash !== null) {\n      $xfer += $output->writeFieldBegin('contentHash', TType::STRING, 4);\n      $xfer += $output->writeString($this->contentHash);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->contentLength !== null) {\n      $xfer += $output->writeFieldBegin('contentLength', TType::I32, 5);\n      $xfer += $output->writeI32($this->contentLength);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->created !== null) {\n      $xfer += $output->writeFieldBegin('created', TType::I64, 6);\n      $xfer += $output->writeI64($this->created);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->updated !== null) {\n      $xfer += $output->writeFieldBegin('updated', TType::I64, 7);\n      $xfer += $output->writeI64($this->updated);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->deleted !== null) {\n      $xfer += $output->writeFieldBegin('deleted', TType::I64, 8);\n      $xfer += $output->writeI64($this->deleted);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->active !== null) {\n      $xfer += $output->writeFieldBegin('active', TType::BOOL, 9);\n      $xfer += $output->writeBool($this->active);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->updateSequenceNum !== null) {\n      $xfer += $output->writeFieldBegin('updateSequenceNum', TType::I32, 10);\n      $xfer += $output->writeI32($this->updateSequenceNum);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notebookGuid !== null) {\n      $xfer += $output->writeFieldBegin('notebookGuid', TType::STRING, 11);\n      $xfer += $output->writeString($this->notebookGuid);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->tagGuids !== null) {\n      if (!is_array($this->tagGuids)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('tagGuids', TType::LST, 12);\n      {\n        $output->writeListBegin(TType::STRING, count($this->tagGuids));\n        {\n          foreach ($this->tagGuids as $iter58)\n          {\n            $xfer += $output->writeString($iter58);\n          }\n        }\n        $output->writeListEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->resources !== null) {\n      if (!is_array($this->resources)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('resources', TType::LST, 13);\n      {\n        $output->writeListBegin(TType::STRUCT, count($this->resources));\n        {\n          foreach ($this->resources as $iter59)\n          {\n            $xfer += $iter59->write($output);\n          }\n        }\n        $output->writeListEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->attributes !== null) {\n      if (!is_object($this->attributes)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('attributes', TType::STRUCT, 14);\n      $xfer += $this->attributes->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->tagNames !== null) {\n      if (!is_array($this->tagNames)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('tagNames', TType::LST, 15);\n      {\n        $output->writeListBegin(TType::STRING, count($this->tagNames));\n        {\n          foreach ($this->tagNames as $iter60)\n          {\n            $xfer += $output->writeString($iter60);\n          }\n        }\n        $output->writeListEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass Publishing {\n  static $_TSPEC;\n\n  public $uri = null;\n  public $order = null;\n  public $ascending = null;\n  public $publicDescription = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'uri',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'order',\n          'type' => TType::I32,\n          ),\n        3 => array(\n          'var' => 'ascending',\n          'type' => TType::BOOL,\n          ),\n        4 => array(\n          'var' => 'publicDescription',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['uri'])) {\n        $this->uri = $vals['uri'];\n      }\n      if (isset($vals['order'])) {\n        $this->order = $vals['order'];\n      }\n      if (isset($vals['ascending'])) {\n        $this->ascending = $vals['ascending'];\n      }\n      if (isset($vals['publicDescription'])) {\n        $this->publicDescription = $vals['publicDescription'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'Publishing';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->uri);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->order);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->ascending);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 4:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->publicDescription);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('Publishing');\n    if ($this->uri !== null) {\n      $xfer += $output->writeFieldBegin('uri', TType::STRING, 1);\n      $xfer += $output->writeString($this->uri);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->order !== null) {\n      $xfer += $output->writeFieldBegin('order', TType::I32, 2);\n      $xfer += $output->writeI32($this->order);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->ascending !== null) {\n      $xfer += $output->writeFieldBegin('ascending', TType::BOOL, 3);\n      $xfer += $output->writeBool($this->ascending);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->publicDescription !== null) {\n      $xfer += $output->writeFieldBegin('publicDescription', TType::STRING, 4);\n      $xfer += $output->writeString($this->publicDescription);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass BusinessNotebook {\n  static $_TSPEC;\n\n  public $notebookDescription = null;\n  public $privilege = null;\n  public $recommended = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'notebookDescription',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'privilege',\n          'type' => TType::I32,\n          ),\n        3 => array(\n          'var' => 'recommended',\n          'type' => TType::BOOL,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['notebookDescription'])) {\n        $this->notebookDescription = $vals['notebookDescription'];\n      }\n      if (isset($vals['privilege'])) {\n        $this->privilege = $vals['privilege'];\n      }\n      if (isset($vals['recommended'])) {\n        $this->recommended = $vals['recommended'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'BusinessNotebook';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->notebookDescription);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->privilege);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->recommended);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('BusinessNotebook');\n    if ($this->notebookDescription !== null) {\n      $xfer += $output->writeFieldBegin('notebookDescription', TType::STRING, 1);\n      $xfer += $output->writeString($this->notebookDescription);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->privilege !== null) {\n      $xfer += $output->writeFieldBegin('privilege', TType::I32, 2);\n      $xfer += $output->writeI32($this->privilege);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->recommended !== null) {\n      $xfer += $output->writeFieldBegin('recommended', TType::BOOL, 3);\n      $xfer += $output->writeBool($this->recommended);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass SavedSearchScope {\n  static $_TSPEC;\n\n  public $includeAccount = null;\n  public $includePersonalLinkedNotebooks = null;\n  public $includeBusinessLinkedNotebooks = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'includeAccount',\n          'type' => TType::BOOL,\n          ),\n        2 => array(\n          'var' => 'includePersonalLinkedNotebooks',\n          'type' => TType::BOOL,\n          ),\n        3 => array(\n          'var' => 'includeBusinessLinkedNotebooks',\n          'type' => TType::BOOL,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['includeAccount'])) {\n        $this->includeAccount = $vals['includeAccount'];\n      }\n      if (isset($vals['includePersonalLinkedNotebooks'])) {\n        $this->includePersonalLinkedNotebooks = $vals['includePersonalLinkedNotebooks'];\n      }\n      if (isset($vals['includeBusinessLinkedNotebooks'])) {\n        $this->includeBusinessLinkedNotebooks = $vals['includeBusinessLinkedNotebooks'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'SavedSearchScope';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->includeAccount);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->includePersonalLinkedNotebooks);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->includeBusinessLinkedNotebooks);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('SavedSearchScope');\n    if ($this->includeAccount !== null) {\n      $xfer += $output->writeFieldBegin('includeAccount', TType::BOOL, 1);\n      $xfer += $output->writeBool($this->includeAccount);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->includePersonalLinkedNotebooks !== null) {\n      $xfer += $output->writeFieldBegin('includePersonalLinkedNotebooks', TType::BOOL, 2);\n      $xfer += $output->writeBool($this->includePersonalLinkedNotebooks);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->includeBusinessLinkedNotebooks !== null) {\n      $xfer += $output->writeFieldBegin('includeBusinessLinkedNotebooks', TType::BOOL, 3);\n      $xfer += $output->writeBool($this->includeBusinessLinkedNotebooks);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass SavedSearch {\n  static $_TSPEC;\n\n  public $guid = null;\n  public $name = null;\n  public $query = null;\n  public $format = null;\n  public $updateSequenceNum = null;\n  public $scope = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'guid',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'name',\n          'type' => TType::STRING,\n          ),\n        3 => array(\n          'var' => 'query',\n          'type' => TType::STRING,\n          ),\n        4 => array(\n          'var' => 'format',\n          'type' => TType::I32,\n          ),\n        5 => array(\n          'var' => 'updateSequenceNum',\n          'type' => TType::I32,\n          ),\n        6 => array(\n          'var' => 'scope',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\SavedSearchScope',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['guid'])) {\n        $this->guid = $vals['guid'];\n      }\n      if (isset($vals['name'])) {\n        $this->name = $vals['name'];\n      }\n      if (isset($vals['query'])) {\n        $this->query = $vals['query'];\n      }\n      if (isset($vals['format'])) {\n        $this->format = $vals['format'];\n      }\n      if (isset($vals['updateSequenceNum'])) {\n        $this->updateSequenceNum = $vals['updateSequenceNum'];\n      }\n      if (isset($vals['scope'])) {\n        $this->scope = $vals['scope'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'SavedSearch';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->guid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->name);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->query);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 4:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->format);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 5:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->updateSequenceNum);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 6:\n          if ($ftype == TType::STRUCT) {\n            $this->scope = new \\EDAM\\Types\\SavedSearchScope();\n            $xfer += $this->scope->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('SavedSearch');\n    if ($this->guid !== null) {\n      $xfer += $output->writeFieldBegin('guid', TType::STRING, 1);\n      $xfer += $output->writeString($this->guid);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->name !== null) {\n      $xfer += $output->writeFieldBegin('name', TType::STRING, 2);\n      $xfer += $output->writeString($this->name);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->query !== null) {\n      $xfer += $output->writeFieldBegin('query', TType::STRING, 3);\n      $xfer += $output->writeString($this->query);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->format !== null) {\n      $xfer += $output->writeFieldBegin('format', TType::I32, 4);\n      $xfer += $output->writeI32($this->format);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->updateSequenceNum !== null) {\n      $xfer += $output->writeFieldBegin('updateSequenceNum', TType::I32, 5);\n      $xfer += $output->writeI32($this->updateSequenceNum);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->scope !== null) {\n      if (!is_object($this->scope)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('scope', TType::STRUCT, 6);\n      $xfer += $this->scope->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass SharedNotebookRecipientSettings {\n  static $_TSPEC;\n\n  public $reminderNotifyEmail = null;\n  public $reminderNotifyInApp = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'reminderNotifyEmail',\n          'type' => TType::BOOL,\n          ),\n        2 => array(\n          'var' => 'reminderNotifyInApp',\n          'type' => TType::BOOL,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['reminderNotifyEmail'])) {\n        $this->reminderNotifyEmail = $vals['reminderNotifyEmail'];\n      }\n      if (isset($vals['reminderNotifyInApp'])) {\n        $this->reminderNotifyInApp = $vals['reminderNotifyInApp'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'SharedNotebookRecipientSettings';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->reminderNotifyEmail);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->reminderNotifyInApp);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('SharedNotebookRecipientSettings');\n    if ($this->reminderNotifyEmail !== null) {\n      $xfer += $output->writeFieldBegin('reminderNotifyEmail', TType::BOOL, 1);\n      $xfer += $output->writeBool($this->reminderNotifyEmail);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->reminderNotifyInApp !== null) {\n      $xfer += $output->writeFieldBegin('reminderNotifyInApp', TType::BOOL, 2);\n      $xfer += $output->writeBool($this->reminderNotifyInApp);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass SharedNotebook {\n  static $_TSPEC;\n\n  public $id = null;\n  public $userId = null;\n  public $notebookGuid = null;\n  public $email = null;\n  public $notebookModifiable = null;\n  public $requireLogin = null;\n  public $serviceCreated = null;\n  public $serviceUpdated = null;\n  public $shareKey = null;\n  public $username = null;\n  public $privilege = null;\n  public $allowPreview = null;\n  public $recipientSettings = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'id',\n          'type' => TType::I64,\n          ),\n        2 => array(\n          'var' => 'userId',\n          'type' => TType::I32,\n          ),\n        3 => array(\n          'var' => 'notebookGuid',\n          'type' => TType::STRING,\n          ),\n        4 => array(\n          'var' => 'email',\n          'type' => TType::STRING,\n          ),\n        5 => array(\n          'var' => 'notebookModifiable',\n          'type' => TType::BOOL,\n          ),\n        6 => array(\n          'var' => 'requireLogin',\n          'type' => TType::BOOL,\n          ),\n        7 => array(\n          'var' => 'serviceCreated',\n          'type' => TType::I64,\n          ),\n        10 => array(\n          'var' => 'serviceUpdated',\n          'type' => TType::I64,\n          ),\n        8 => array(\n          'var' => 'shareKey',\n          'type' => TType::STRING,\n          ),\n        9 => array(\n          'var' => 'username',\n          'type' => TType::STRING,\n          ),\n        11 => array(\n          'var' => 'privilege',\n          'type' => TType::I32,\n          ),\n        12 => array(\n          'var' => 'allowPreview',\n          'type' => TType::BOOL,\n          ),\n        13 => array(\n          'var' => 'recipientSettings',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\SharedNotebookRecipientSettings',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['id'])) {\n        $this->id = $vals['id'];\n      }\n      if (isset($vals['userId'])) {\n        $this->userId = $vals['userId'];\n      }\n      if (isset($vals['notebookGuid'])) {\n        $this->notebookGuid = $vals['notebookGuid'];\n      }\n      if (isset($vals['email'])) {\n        $this->email = $vals['email'];\n      }\n      if (isset($vals['notebookModifiable'])) {\n        $this->notebookModifiable = $vals['notebookModifiable'];\n      }\n      if (isset($vals['requireLogin'])) {\n        $this->requireLogin = $vals['requireLogin'];\n      }\n      if (isset($vals['serviceCreated'])) {\n        $this->serviceCreated = $vals['serviceCreated'];\n      }\n      if (isset($vals['serviceUpdated'])) {\n        $this->serviceUpdated = $vals['serviceUpdated'];\n      }\n      if (isset($vals['shareKey'])) {\n        $this->shareKey = $vals['shareKey'];\n      }\n      if (isset($vals['username'])) {\n        $this->username = $vals['username'];\n      }\n      if (isset($vals['privilege'])) {\n        $this->privilege = $vals['privilege'];\n      }\n      if (isset($vals['allowPreview'])) {\n        $this->allowPreview = $vals['allowPreview'];\n      }\n      if (isset($vals['recipientSettings'])) {\n        $this->recipientSettings = $vals['recipientSettings'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'SharedNotebook';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::I64) {\n            $xfer += $input->readI64($this->id);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->userId);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->notebookGuid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 4:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->email);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 5:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->notebookModifiable);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 6:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->requireLogin);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 7:\n          if ($ftype == TType::I64) {\n            $xfer += $input->readI64($this->serviceCreated);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 10:\n          if ($ftype == TType::I64) {\n            $xfer += $input->readI64($this->serviceUpdated);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 8:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->shareKey);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 9:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->username);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 11:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->privilege);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 12:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->allowPreview);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 13:\n          if ($ftype == TType::STRUCT) {\n            $this->recipientSettings = new \\EDAM\\Types\\SharedNotebookRecipientSettings();\n            $xfer += $this->recipientSettings->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('SharedNotebook');\n    if ($this->id !== null) {\n      $xfer += $output->writeFieldBegin('id', TType::I64, 1);\n      $xfer += $output->writeI64($this->id);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userId !== null) {\n      $xfer += $output->writeFieldBegin('userId', TType::I32, 2);\n      $xfer += $output->writeI32($this->userId);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notebookGuid !== null) {\n      $xfer += $output->writeFieldBegin('notebookGuid', TType::STRING, 3);\n      $xfer += $output->writeString($this->notebookGuid);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->email !== null) {\n      $xfer += $output->writeFieldBegin('email', TType::STRING, 4);\n      $xfer += $output->writeString($this->email);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notebookModifiable !== null) {\n      $xfer += $output->writeFieldBegin('notebookModifiable', TType::BOOL, 5);\n      $xfer += $output->writeBool($this->notebookModifiable);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->requireLogin !== null) {\n      $xfer += $output->writeFieldBegin('requireLogin', TType::BOOL, 6);\n      $xfer += $output->writeBool($this->requireLogin);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->serviceCreated !== null) {\n      $xfer += $output->writeFieldBegin('serviceCreated', TType::I64, 7);\n      $xfer += $output->writeI64($this->serviceCreated);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->shareKey !== null) {\n      $xfer += $output->writeFieldBegin('shareKey', TType::STRING, 8);\n      $xfer += $output->writeString($this->shareKey);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->username !== null) {\n      $xfer += $output->writeFieldBegin('username', TType::STRING, 9);\n      $xfer += $output->writeString($this->username);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->serviceUpdated !== null) {\n      $xfer += $output->writeFieldBegin('serviceUpdated', TType::I64, 10);\n      $xfer += $output->writeI64($this->serviceUpdated);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->privilege !== null) {\n      $xfer += $output->writeFieldBegin('privilege', TType::I32, 11);\n      $xfer += $output->writeI32($this->privilege);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->allowPreview !== null) {\n      $xfer += $output->writeFieldBegin('allowPreview', TType::BOOL, 12);\n      $xfer += $output->writeBool($this->allowPreview);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->recipientSettings !== null) {\n      if (!is_object($this->recipientSettings)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('recipientSettings', TType::STRUCT, 13);\n      $xfer += $this->recipientSettings->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NotebookRestrictions {\n  static $_TSPEC;\n\n  public $noReadNotes = null;\n  public $noCreateNotes = null;\n  public $noUpdateNotes = null;\n  public $noExpungeNotes = null;\n  public $noShareNotes = null;\n  public $noEmailNotes = null;\n  public $noSendMessageToRecipients = null;\n  public $noUpdateNotebook = null;\n  public $noExpungeNotebook = null;\n  public $noSetDefaultNotebook = null;\n  public $noSetNotebookStack = null;\n  public $noPublishToPublic = null;\n  public $noPublishToBusinessLibrary = null;\n  public $noCreateTags = null;\n  public $noUpdateTags = null;\n  public $noExpungeTags = null;\n  public $noSetParentTag = null;\n  public $noCreateSharedNotebooks = null;\n  public $updateWhichSharedNotebookRestrictions = null;\n  public $expungeWhichSharedNotebookRestrictions = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'noReadNotes',\n          'type' => TType::BOOL,\n          ),\n        2 => array(\n          'var' => 'noCreateNotes',\n          'type' => TType::BOOL,\n          ),\n        3 => array(\n          'var' => 'noUpdateNotes',\n          'type' => TType::BOOL,\n          ),\n        4 => array(\n          'var' => 'noExpungeNotes',\n          'type' => TType::BOOL,\n          ),\n        5 => array(\n          'var' => 'noShareNotes',\n          'type' => TType::BOOL,\n          ),\n        6 => array(\n          'var' => 'noEmailNotes',\n          'type' => TType::BOOL,\n          ),\n        7 => array(\n          'var' => 'noSendMessageToRecipients',\n          'type' => TType::BOOL,\n          ),\n        8 => array(\n          'var' => 'noUpdateNotebook',\n          'type' => TType::BOOL,\n          ),\n        9 => array(\n          'var' => 'noExpungeNotebook',\n          'type' => TType::BOOL,\n          ),\n        10 => array(\n          'var' => 'noSetDefaultNotebook',\n          'type' => TType::BOOL,\n          ),\n        11 => array(\n          'var' => 'noSetNotebookStack',\n          'type' => TType::BOOL,\n          ),\n        12 => array(\n          'var' => 'noPublishToPublic',\n          'type' => TType::BOOL,\n          ),\n        13 => array(\n          'var' => 'noPublishToBusinessLibrary',\n          'type' => TType::BOOL,\n          ),\n        14 => array(\n          'var' => 'noCreateTags',\n          'type' => TType::BOOL,\n          ),\n        15 => array(\n          'var' => 'noUpdateTags',\n          'type' => TType::BOOL,\n          ),\n        16 => array(\n          'var' => 'noExpungeTags',\n          'type' => TType::BOOL,\n          ),\n        17 => array(\n          'var' => 'noSetParentTag',\n          'type' => TType::BOOL,\n          ),\n        18 => array(\n          'var' => 'noCreateSharedNotebooks',\n          'type' => TType::BOOL,\n          ),\n        19 => array(\n          'var' => 'updateWhichSharedNotebookRestrictions',\n          'type' => TType::I32,\n          ),\n        20 => array(\n          'var' => 'expungeWhichSharedNotebookRestrictions',\n          'type' => TType::I32,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['noReadNotes'])) {\n        $this->noReadNotes = $vals['noReadNotes'];\n      }\n      if (isset($vals['noCreateNotes'])) {\n        $this->noCreateNotes = $vals['noCreateNotes'];\n      }\n      if (isset($vals['noUpdateNotes'])) {\n        $this->noUpdateNotes = $vals['noUpdateNotes'];\n      }\n      if (isset($vals['noExpungeNotes'])) {\n        $this->noExpungeNotes = $vals['noExpungeNotes'];\n      }\n      if (isset($vals['noShareNotes'])) {\n        $this->noShareNotes = $vals['noShareNotes'];\n      }\n      if (isset($vals['noEmailNotes'])) {\n        $this->noEmailNotes = $vals['noEmailNotes'];\n      }\n      if (isset($vals['noSendMessageToRecipients'])) {\n        $this->noSendMessageToRecipients = $vals['noSendMessageToRecipients'];\n      }\n      if (isset($vals['noUpdateNotebook'])) {\n        $this->noUpdateNotebook = $vals['noUpdateNotebook'];\n      }\n      if (isset($vals['noExpungeNotebook'])) {\n        $this->noExpungeNotebook = $vals['noExpungeNotebook'];\n      }\n      if (isset($vals['noSetDefaultNotebook'])) {\n        $this->noSetDefaultNotebook = $vals['noSetDefaultNotebook'];\n      }\n      if (isset($vals['noSetNotebookStack'])) {\n        $this->noSetNotebookStack = $vals['noSetNotebookStack'];\n      }\n      if (isset($vals['noPublishToPublic'])) {\n        $this->noPublishToPublic = $vals['noPublishToPublic'];\n      }\n      if (isset($vals['noPublishToBusinessLibrary'])) {\n        $this->noPublishToBusinessLibrary = $vals['noPublishToBusinessLibrary'];\n      }\n      if (isset($vals['noCreateTags'])) {\n        $this->noCreateTags = $vals['noCreateTags'];\n      }\n      if (isset($vals['noUpdateTags'])) {\n        $this->noUpdateTags = $vals['noUpdateTags'];\n      }\n      if (isset($vals['noExpungeTags'])) {\n        $this->noExpungeTags = $vals['noExpungeTags'];\n      }\n      if (isset($vals['noSetParentTag'])) {\n        $this->noSetParentTag = $vals['noSetParentTag'];\n      }\n      if (isset($vals['noCreateSharedNotebooks'])) {\n        $this->noCreateSharedNotebooks = $vals['noCreateSharedNotebooks'];\n      }\n      if (isset($vals['updateWhichSharedNotebookRestrictions'])) {\n        $this->updateWhichSharedNotebookRestrictions = $vals['updateWhichSharedNotebookRestrictions'];\n      }\n      if (isset($vals['expungeWhichSharedNotebookRestrictions'])) {\n        $this->expungeWhichSharedNotebookRestrictions = $vals['expungeWhichSharedNotebookRestrictions'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NotebookRestrictions';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->noReadNotes);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->noCreateNotes);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->noUpdateNotes);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 4:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->noExpungeNotes);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 5:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->noShareNotes);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 6:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->noEmailNotes);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 7:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->noSendMessageToRecipients);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 8:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->noUpdateNotebook);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 9:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->noExpungeNotebook);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 10:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->noSetDefaultNotebook);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 11:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->noSetNotebookStack);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 12:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->noPublishToPublic);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 13:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->noPublishToBusinessLibrary);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 14:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->noCreateTags);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 15:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->noUpdateTags);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 16:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->noExpungeTags);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 17:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->noSetParentTag);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 18:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->noCreateSharedNotebooks);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 19:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->updateWhichSharedNotebookRestrictions);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 20:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->expungeWhichSharedNotebookRestrictions);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NotebookRestrictions');\n    if ($this->noReadNotes !== null) {\n      $xfer += $output->writeFieldBegin('noReadNotes', TType::BOOL, 1);\n      $xfer += $output->writeBool($this->noReadNotes);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->noCreateNotes !== null) {\n      $xfer += $output->writeFieldBegin('noCreateNotes', TType::BOOL, 2);\n      $xfer += $output->writeBool($this->noCreateNotes);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->noUpdateNotes !== null) {\n      $xfer += $output->writeFieldBegin('noUpdateNotes', TType::BOOL, 3);\n      $xfer += $output->writeBool($this->noUpdateNotes);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->noExpungeNotes !== null) {\n      $xfer += $output->writeFieldBegin('noExpungeNotes', TType::BOOL, 4);\n      $xfer += $output->writeBool($this->noExpungeNotes);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->noShareNotes !== null) {\n      $xfer += $output->writeFieldBegin('noShareNotes', TType::BOOL, 5);\n      $xfer += $output->writeBool($this->noShareNotes);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->noEmailNotes !== null) {\n      $xfer += $output->writeFieldBegin('noEmailNotes', TType::BOOL, 6);\n      $xfer += $output->writeBool($this->noEmailNotes);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->noSendMessageToRecipients !== null) {\n      $xfer += $output->writeFieldBegin('noSendMessageToRecipients', TType::BOOL, 7);\n      $xfer += $output->writeBool($this->noSendMessageToRecipients);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->noUpdateNotebook !== null) {\n      $xfer += $output->writeFieldBegin('noUpdateNotebook', TType::BOOL, 8);\n      $xfer += $output->writeBool($this->noUpdateNotebook);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->noExpungeNotebook !== null) {\n      $xfer += $output->writeFieldBegin('noExpungeNotebook', TType::BOOL, 9);\n      $xfer += $output->writeBool($this->noExpungeNotebook);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->noSetDefaultNotebook !== null) {\n      $xfer += $output->writeFieldBegin('noSetDefaultNotebook', TType::BOOL, 10);\n      $xfer += $output->writeBool($this->noSetDefaultNotebook);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->noSetNotebookStack !== null) {\n      $xfer += $output->writeFieldBegin('noSetNotebookStack', TType::BOOL, 11);\n      $xfer += $output->writeBool($this->noSetNotebookStack);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->noPublishToPublic !== null) {\n      $xfer += $output->writeFieldBegin('noPublishToPublic', TType::BOOL, 12);\n      $xfer += $output->writeBool($this->noPublishToPublic);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->noPublishToBusinessLibrary !== null) {\n      $xfer += $output->writeFieldBegin('noPublishToBusinessLibrary', TType::BOOL, 13);\n      $xfer += $output->writeBool($this->noPublishToBusinessLibrary);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->noCreateTags !== null) {\n      $xfer += $output->writeFieldBegin('noCreateTags', TType::BOOL, 14);\n      $xfer += $output->writeBool($this->noCreateTags);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->noUpdateTags !== null) {\n      $xfer += $output->writeFieldBegin('noUpdateTags', TType::BOOL, 15);\n      $xfer += $output->writeBool($this->noUpdateTags);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->noExpungeTags !== null) {\n      $xfer += $output->writeFieldBegin('noExpungeTags', TType::BOOL, 16);\n      $xfer += $output->writeBool($this->noExpungeTags);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->noSetParentTag !== null) {\n      $xfer += $output->writeFieldBegin('noSetParentTag', TType::BOOL, 17);\n      $xfer += $output->writeBool($this->noSetParentTag);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->noCreateSharedNotebooks !== null) {\n      $xfer += $output->writeFieldBegin('noCreateSharedNotebooks', TType::BOOL, 18);\n      $xfer += $output->writeBool($this->noCreateSharedNotebooks);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->updateWhichSharedNotebookRestrictions !== null) {\n      $xfer += $output->writeFieldBegin('updateWhichSharedNotebookRestrictions', TType::I32, 19);\n      $xfer += $output->writeI32($this->updateWhichSharedNotebookRestrictions);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->expungeWhichSharedNotebookRestrictions !== null) {\n      $xfer += $output->writeFieldBegin('expungeWhichSharedNotebookRestrictions', TType::I32, 20);\n      $xfer += $output->writeI32($this->expungeWhichSharedNotebookRestrictions);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass Notebook {\n  static $_TSPEC;\n\n  public $guid = null;\n  public $name = null;\n  public $updateSequenceNum = null;\n  public $defaultNotebook = null;\n  public $serviceCreated = null;\n  public $serviceUpdated = null;\n  public $publishing = null;\n  public $published = null;\n  public $stack = null;\n  public $sharedNotebookIds = null;\n  public $sharedNotebooks = null;\n  public $businessNotebook = null;\n  public $contact = null;\n  public $restrictions = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'guid',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'name',\n          'type' => TType::STRING,\n          ),\n        5 => array(\n          'var' => 'updateSequenceNum',\n          'type' => TType::I32,\n          ),\n        6 => array(\n          'var' => 'defaultNotebook',\n          'type' => TType::BOOL,\n          ),\n        7 => array(\n          'var' => 'serviceCreated',\n          'type' => TType::I64,\n          ),\n        8 => array(\n          'var' => 'serviceUpdated',\n          'type' => TType::I64,\n          ),\n        10 => array(\n          'var' => 'publishing',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\Publishing',\n          ),\n        11 => array(\n          'var' => 'published',\n          'type' => TType::BOOL,\n          ),\n        12 => array(\n          'var' => 'stack',\n          'type' => TType::STRING,\n          ),\n        13 => array(\n          'var' => 'sharedNotebookIds',\n          'type' => TType::LST,\n          'etype' => TType::I64,\n          'elem' => array(\n            'type' => TType::I64,\n            ),\n          ),\n        14 => array(\n          'var' => 'sharedNotebooks',\n          'type' => TType::LST,\n          'etype' => TType::STRUCT,\n          'elem' => array(\n            'type' => TType::STRUCT,\n            'class' => '\\EDAM\\Types\\SharedNotebook',\n            ),\n          ),\n        15 => array(\n          'var' => 'businessNotebook',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\BusinessNotebook',\n          ),\n        16 => array(\n          'var' => 'contact',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\User',\n          ),\n        17 => array(\n          'var' => 'restrictions',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\NotebookRestrictions',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['guid'])) {\n        $this->guid = $vals['guid'];\n      }\n      if (isset($vals['name'])) {\n        $this->name = $vals['name'];\n      }\n      if (isset($vals['updateSequenceNum'])) {\n        $this->updateSequenceNum = $vals['updateSequenceNum'];\n      }\n      if (isset($vals['defaultNotebook'])) {\n        $this->defaultNotebook = $vals['defaultNotebook'];\n      }\n      if (isset($vals['serviceCreated'])) {\n        $this->serviceCreated = $vals['serviceCreated'];\n      }\n      if (isset($vals['serviceUpdated'])) {\n        $this->serviceUpdated = $vals['serviceUpdated'];\n      }\n      if (isset($vals['publishing'])) {\n        $this->publishing = $vals['publishing'];\n      }\n      if (isset($vals['published'])) {\n        $this->published = $vals['published'];\n      }\n      if (isset($vals['stack'])) {\n        $this->stack = $vals['stack'];\n      }\n      if (isset($vals['sharedNotebookIds'])) {\n        $this->sharedNotebookIds = $vals['sharedNotebookIds'];\n      }\n      if (isset($vals['sharedNotebooks'])) {\n        $this->sharedNotebooks = $vals['sharedNotebooks'];\n      }\n      if (isset($vals['businessNotebook'])) {\n        $this->businessNotebook = $vals['businessNotebook'];\n      }\n      if (isset($vals['contact'])) {\n        $this->contact = $vals['contact'];\n      }\n      if (isset($vals['restrictions'])) {\n        $this->restrictions = $vals['restrictions'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'Notebook';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->guid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->name);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 5:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->updateSequenceNum);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 6:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->defaultNotebook);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 7:\n          if ($ftype == TType::I64) {\n            $xfer += $input->readI64($this->serviceCreated);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 8:\n          if ($ftype == TType::I64) {\n            $xfer += $input->readI64($this->serviceUpdated);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 10:\n          if ($ftype == TType::STRUCT) {\n            $this->publishing = new \\EDAM\\Types\\Publishing();\n            $xfer += $this->publishing->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 11:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->published);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 12:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->stack);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 13:\n          if ($ftype == TType::LST) {\n            $this->sharedNotebookIds = array();\n            $_size61 = 0;\n            $_etype64 = 0;\n            $xfer += $input->readListBegin($_etype64, $_size61);\n            for ($_i65 = 0; $_i65 < $_size61; ++$_i65)\n            {\n              $elem66 = null;\n              $xfer += $input->readI64($elem66);\n              $this->sharedNotebookIds []= $elem66;\n            }\n            $xfer += $input->readListEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 14:\n          if ($ftype == TType::LST) {\n            $this->sharedNotebooks = array();\n            $_size67 = 0;\n            $_etype70 = 0;\n            $xfer += $input->readListBegin($_etype70, $_size67);\n            for ($_i71 = 0; $_i71 < $_size67; ++$_i71)\n            {\n              $elem72 = null;\n              $elem72 = new \\EDAM\\Types\\SharedNotebook();\n              $xfer += $elem72->read($input);\n              $this->sharedNotebooks []= $elem72;\n            }\n            $xfer += $input->readListEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 15:\n          if ($ftype == TType::STRUCT) {\n            $this->businessNotebook = new \\EDAM\\Types\\BusinessNotebook();\n            $xfer += $this->businessNotebook->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 16:\n          if ($ftype == TType::STRUCT) {\n            $this->contact = new \\EDAM\\Types\\User();\n            $xfer += $this->contact->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 17:\n          if ($ftype == TType::STRUCT) {\n            $this->restrictions = new \\EDAM\\Types\\NotebookRestrictions();\n            $xfer += $this->restrictions->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('Notebook');\n    if ($this->guid !== null) {\n      $xfer += $output->writeFieldBegin('guid', TType::STRING, 1);\n      $xfer += $output->writeString($this->guid);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->name !== null) {\n      $xfer += $output->writeFieldBegin('name', TType::STRING, 2);\n      $xfer += $output->writeString($this->name);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->updateSequenceNum !== null) {\n      $xfer += $output->writeFieldBegin('updateSequenceNum', TType::I32, 5);\n      $xfer += $output->writeI32($this->updateSequenceNum);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->defaultNotebook !== null) {\n      $xfer += $output->writeFieldBegin('defaultNotebook', TType::BOOL, 6);\n      $xfer += $output->writeBool($this->defaultNotebook);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->serviceCreated !== null) {\n      $xfer += $output->writeFieldBegin('serviceCreated', TType::I64, 7);\n      $xfer += $output->writeI64($this->serviceCreated);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->serviceUpdated !== null) {\n      $xfer += $output->writeFieldBegin('serviceUpdated', TType::I64, 8);\n      $xfer += $output->writeI64($this->serviceUpdated);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->publishing !== null) {\n      if (!is_object($this->publishing)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('publishing', TType::STRUCT, 10);\n      $xfer += $this->publishing->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->published !== null) {\n      $xfer += $output->writeFieldBegin('published', TType::BOOL, 11);\n      $xfer += $output->writeBool($this->published);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->stack !== null) {\n      $xfer += $output->writeFieldBegin('stack', TType::STRING, 12);\n      $xfer += $output->writeString($this->stack);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->sharedNotebookIds !== null) {\n      if (!is_array($this->sharedNotebookIds)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('sharedNotebookIds', TType::LST, 13);\n      {\n        $output->writeListBegin(TType::I64, count($this->sharedNotebookIds));\n        {\n          foreach ($this->sharedNotebookIds as $iter73)\n          {\n            $xfer += $output->writeI64($iter73);\n          }\n        }\n        $output->writeListEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->sharedNotebooks !== null) {\n      if (!is_array($this->sharedNotebooks)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('sharedNotebooks', TType::LST, 14);\n      {\n        $output->writeListBegin(TType::STRUCT, count($this->sharedNotebooks));\n        {\n          foreach ($this->sharedNotebooks as $iter74)\n          {\n            $xfer += $iter74->write($output);\n          }\n        }\n        $output->writeListEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->businessNotebook !== null) {\n      if (!is_object($this->businessNotebook)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('businessNotebook', TType::STRUCT, 15);\n      $xfer += $this->businessNotebook->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->contact !== null) {\n      if (!is_object($this->contact)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('contact', TType::STRUCT, 16);\n      $xfer += $this->contact->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->restrictions !== null) {\n      if (!is_object($this->restrictions)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('restrictions', TType::STRUCT, 17);\n      $xfer += $this->restrictions->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass LinkedNotebook {\n  static $_TSPEC;\n\n  public $shareName = null;\n  public $username = null;\n  public $shardId = null;\n  public $shareKey = null;\n  public $uri = null;\n  public $guid = null;\n  public $updateSequenceNum = null;\n  public $noteStoreUrl = null;\n  public $webApiUrlPrefix = null;\n  public $stack = null;\n  public $businessId = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        2 => array(\n          'var' => 'shareName',\n          'type' => TType::STRING,\n          ),\n        3 => array(\n          'var' => 'username',\n          'type' => TType::STRING,\n          ),\n        4 => array(\n          'var' => 'shardId',\n          'type' => TType::STRING,\n          ),\n        5 => array(\n          'var' => 'shareKey',\n          'type' => TType::STRING,\n          ),\n        6 => array(\n          'var' => 'uri',\n          'type' => TType::STRING,\n          ),\n        7 => array(\n          'var' => 'guid',\n          'type' => TType::STRING,\n          ),\n        8 => array(\n          'var' => 'updateSequenceNum',\n          'type' => TType::I32,\n          ),\n        9 => array(\n          'var' => 'noteStoreUrl',\n          'type' => TType::STRING,\n          ),\n        10 => array(\n          'var' => 'webApiUrlPrefix',\n          'type' => TType::STRING,\n          ),\n        11 => array(\n          'var' => 'stack',\n          'type' => TType::STRING,\n          ),\n        12 => array(\n          'var' => 'businessId',\n          'type' => TType::I32,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['shareName'])) {\n        $this->shareName = $vals['shareName'];\n      }\n      if (isset($vals['username'])) {\n        $this->username = $vals['username'];\n      }\n      if (isset($vals['shardId'])) {\n        $this->shardId = $vals['shardId'];\n      }\n      if (isset($vals['shareKey'])) {\n        $this->shareKey = $vals['shareKey'];\n      }\n      if (isset($vals['uri'])) {\n        $this->uri = $vals['uri'];\n      }\n      if (isset($vals['guid'])) {\n        $this->guid = $vals['guid'];\n      }\n      if (isset($vals['updateSequenceNum'])) {\n        $this->updateSequenceNum = $vals['updateSequenceNum'];\n      }\n      if (isset($vals['noteStoreUrl'])) {\n        $this->noteStoreUrl = $vals['noteStoreUrl'];\n      }\n      if (isset($vals['webApiUrlPrefix'])) {\n        $this->webApiUrlPrefix = $vals['webApiUrlPrefix'];\n      }\n      if (isset($vals['stack'])) {\n        $this->stack = $vals['stack'];\n      }\n      if (isset($vals['businessId'])) {\n        $this->businessId = $vals['businessId'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'LinkedNotebook';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->shareName);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->username);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 4:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->shardId);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 5:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->shareKey);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 6:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->uri);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 7:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->guid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 8:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->updateSequenceNum);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 9:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->noteStoreUrl);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 10:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->webApiUrlPrefix);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 11:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->stack);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 12:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->businessId);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('LinkedNotebook');\n    if ($this->shareName !== null) {\n      $xfer += $output->writeFieldBegin('shareName', TType::STRING, 2);\n      $xfer += $output->writeString($this->shareName);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->username !== null) {\n      $xfer += $output->writeFieldBegin('username', TType::STRING, 3);\n      $xfer += $output->writeString($this->username);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->shardId !== null) {\n      $xfer += $output->writeFieldBegin('shardId', TType::STRING, 4);\n      $xfer += $output->writeString($this->shardId);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->shareKey !== null) {\n      $xfer += $output->writeFieldBegin('shareKey', TType::STRING, 5);\n      $xfer += $output->writeString($this->shareKey);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->uri !== null) {\n      $xfer += $output->writeFieldBegin('uri', TType::STRING, 6);\n      $xfer += $output->writeString($this->uri);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->guid !== null) {\n      $xfer += $output->writeFieldBegin('guid', TType::STRING, 7);\n      $xfer += $output->writeString($this->guid);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->updateSequenceNum !== null) {\n      $xfer += $output->writeFieldBegin('updateSequenceNum', TType::I32, 8);\n      $xfer += $output->writeI32($this->updateSequenceNum);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->noteStoreUrl !== null) {\n      $xfer += $output->writeFieldBegin('noteStoreUrl', TType::STRING, 9);\n      $xfer += $output->writeString($this->noteStoreUrl);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->webApiUrlPrefix !== null) {\n      $xfer += $output->writeFieldBegin('webApiUrlPrefix', TType::STRING, 10);\n      $xfer += $output->writeString($this->webApiUrlPrefix);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->stack !== null) {\n      $xfer += $output->writeFieldBegin('stack', TType::STRING, 11);\n      $xfer += $output->writeString($this->stack);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->businessId !== null) {\n      $xfer += $output->writeFieldBegin('businessId', TType::I32, 12);\n      $xfer += $output->writeI32($this->businessId);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass NotebookDescriptor {\n  static $_TSPEC;\n\n  public $guid = null;\n  public $notebookDisplayName = null;\n  public $contactName = null;\n  public $hasSharedNotebook = null;\n  public $joinedUserCount = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'guid',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'notebookDisplayName',\n          'type' => TType::STRING,\n          ),\n        3 => array(\n          'var' => 'contactName',\n          'type' => TType::STRING,\n          ),\n        4 => array(\n          'var' => 'hasSharedNotebook',\n          'type' => TType::BOOL,\n          ),\n        5 => array(\n          'var' => 'joinedUserCount',\n          'type' => TType::I32,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['guid'])) {\n        $this->guid = $vals['guid'];\n      }\n      if (isset($vals['notebookDisplayName'])) {\n        $this->notebookDisplayName = $vals['notebookDisplayName'];\n      }\n      if (isset($vals['contactName'])) {\n        $this->contactName = $vals['contactName'];\n      }\n      if (isset($vals['hasSharedNotebook'])) {\n        $this->hasSharedNotebook = $vals['hasSharedNotebook'];\n      }\n      if (isset($vals['joinedUserCount'])) {\n        $this->joinedUserCount = $vals['joinedUserCount'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'NotebookDescriptor';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->guid);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->notebookDisplayName);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->contactName);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 4:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->hasSharedNotebook);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 5:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->joinedUserCount);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('NotebookDescriptor');\n    if ($this->guid !== null) {\n      $xfer += $output->writeFieldBegin('guid', TType::STRING, 1);\n      $xfer += $output->writeString($this->guid);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notebookDisplayName !== null) {\n      $xfer += $output->writeFieldBegin('notebookDisplayName', TType::STRING, 2);\n      $xfer += $output->writeString($this->notebookDisplayName);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->contactName !== null) {\n      $xfer += $output->writeFieldBegin('contactName', TType::STRING, 3);\n      $xfer += $output->writeString($this->contactName);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->hasSharedNotebook !== null) {\n      $xfer += $output->writeFieldBegin('hasSharedNotebook', TType::BOOL, 4);\n      $xfer += $output->writeBool($this->hasSharedNotebook);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->joinedUserCount !== null) {\n      $xfer += $output->writeFieldBegin('joinedUserCount', TType::I32, 5);\n      $xfer += $output->writeI32($this->joinedUserCount);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nfinal class Constant extends \\Thrift\\Type\\TConstant {\n  static protected $CLASSIFICATION_RECIPE_USER_NON_RECIPE;\n  static protected $CLASSIFICATION_RECIPE_USER_RECIPE;\n  static protected $CLASSIFICATION_RECIPE_SERVICE_RECIPE;\n  static protected $EDAM_NOTE_SOURCE_WEB_CLIP;\n  static protected $EDAM_NOTE_SOURCE_MAIL_CLIP;\n  static protected $EDAM_NOTE_SOURCE_MAIL_SMTP_GATEWAY;\n\n  static protected function init_CLASSIFICATION_RECIPE_USER_NON_RECIPE() {\n    return \"000\";\n  }\n\n  static protected function init_CLASSIFICATION_RECIPE_USER_RECIPE() {\n    return \"001\";\n  }\n\n  static protected function init_CLASSIFICATION_RECIPE_SERVICE_RECIPE() {\n    return \"002\";\n  }\n\n  static protected function init_EDAM_NOTE_SOURCE_WEB_CLIP() {\n    return \"web.clip\";\n  }\n\n  static protected function init_EDAM_NOTE_SOURCE_MAIL_CLIP() {\n    return \"mail.clip\";\n  }\n\n  static protected function init_EDAM_NOTE_SOURCE_MAIL_SMTP_GATEWAY() {\n    return \"mail.smtp\";\n  }\n}\n\n\n"
  },
  {
    "path": "src/EDAM/UserStore/Types.php",
    "content": "<?php\nnamespace EDAM\\UserStore;\n\n/**\n * Autogenerated by Thrift Compiler (0.9.1)\n *\n * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING\n *  @generated\n */\nuse Thrift\\Base\\TBase;\nuse Thrift\\Type\\TType;\nuse Thrift\\Type\\TMessageType;\nuse Thrift\\Exception\\TException;\nuse Thrift\\Exception\\TProtocolException;\nuse Thrift\\Protocol\\TProtocol;\nuse Thrift\\Protocol\\TBinaryProtocolAccelerated;\nuse Thrift\\Exception\\TApplicationException;\n\n\nclass PublicUserInfo {\n  static $_TSPEC;\n\n  public $userId = null;\n  public $shardId = null;\n  public $privilege = null;\n  public $username = null;\n  public $noteStoreUrl = null;\n  public $webApiUrlPrefix = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'userId',\n          'type' => TType::I32,\n          ),\n        2 => array(\n          'var' => 'shardId',\n          'type' => TType::STRING,\n          ),\n        3 => array(\n          'var' => 'privilege',\n          'type' => TType::I32,\n          ),\n        4 => array(\n          'var' => 'username',\n          'type' => TType::STRING,\n          ),\n        5 => array(\n          'var' => 'noteStoreUrl',\n          'type' => TType::STRING,\n          ),\n        6 => array(\n          'var' => 'webApiUrlPrefix',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['userId'])) {\n        $this->userId = $vals['userId'];\n      }\n      if (isset($vals['shardId'])) {\n        $this->shardId = $vals['shardId'];\n      }\n      if (isset($vals['privilege'])) {\n        $this->privilege = $vals['privilege'];\n      }\n      if (isset($vals['username'])) {\n        $this->username = $vals['username'];\n      }\n      if (isset($vals['noteStoreUrl'])) {\n        $this->noteStoreUrl = $vals['noteStoreUrl'];\n      }\n      if (isset($vals['webApiUrlPrefix'])) {\n        $this->webApiUrlPrefix = $vals['webApiUrlPrefix'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'PublicUserInfo';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->userId);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->shardId);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::I32) {\n            $xfer += $input->readI32($this->privilege);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 4:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->username);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 5:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->noteStoreUrl);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 6:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->webApiUrlPrefix);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('PublicUserInfo');\n    if ($this->userId !== null) {\n      $xfer += $output->writeFieldBegin('userId', TType::I32, 1);\n      $xfer += $output->writeI32($this->userId);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->shardId !== null) {\n      $xfer += $output->writeFieldBegin('shardId', TType::STRING, 2);\n      $xfer += $output->writeString($this->shardId);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->privilege !== null) {\n      $xfer += $output->writeFieldBegin('privilege', TType::I32, 3);\n      $xfer += $output->writeI32($this->privilege);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->username !== null) {\n      $xfer += $output->writeFieldBegin('username', TType::STRING, 4);\n      $xfer += $output->writeString($this->username);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->noteStoreUrl !== null) {\n      $xfer += $output->writeFieldBegin('noteStoreUrl', TType::STRING, 5);\n      $xfer += $output->writeString($this->noteStoreUrl);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->webApiUrlPrefix !== null) {\n      $xfer += $output->writeFieldBegin('webApiUrlPrefix', TType::STRING, 6);\n      $xfer += $output->writeString($this->webApiUrlPrefix);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass AuthenticationResult {\n  static $_TSPEC;\n\n  public $currentTime = null;\n  public $authenticationToken = null;\n  public $expiration = null;\n  public $user = null;\n  public $publicUserInfo = null;\n  public $noteStoreUrl = null;\n  public $webApiUrlPrefix = null;\n  public $secondFactorRequired = null;\n  public $secondFactorDeliveryHint = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'currentTime',\n          'type' => TType::I64,\n          ),\n        2 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        3 => array(\n          'var' => 'expiration',\n          'type' => TType::I64,\n          ),\n        4 => array(\n          'var' => 'user',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\User',\n          ),\n        5 => array(\n          'var' => 'publicUserInfo',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\UserStore\\PublicUserInfo',\n          ),\n        6 => array(\n          'var' => 'noteStoreUrl',\n          'type' => TType::STRING,\n          ),\n        7 => array(\n          'var' => 'webApiUrlPrefix',\n          'type' => TType::STRING,\n          ),\n        8 => array(\n          'var' => 'secondFactorRequired',\n          'type' => TType::BOOL,\n          ),\n        9 => array(\n          'var' => 'secondFactorDeliveryHint',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['currentTime'])) {\n        $this->currentTime = $vals['currentTime'];\n      }\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['expiration'])) {\n        $this->expiration = $vals['expiration'];\n      }\n      if (isset($vals['user'])) {\n        $this->user = $vals['user'];\n      }\n      if (isset($vals['publicUserInfo'])) {\n        $this->publicUserInfo = $vals['publicUserInfo'];\n      }\n      if (isset($vals['noteStoreUrl'])) {\n        $this->noteStoreUrl = $vals['noteStoreUrl'];\n      }\n      if (isset($vals['webApiUrlPrefix'])) {\n        $this->webApiUrlPrefix = $vals['webApiUrlPrefix'];\n      }\n      if (isset($vals['secondFactorRequired'])) {\n        $this->secondFactorRequired = $vals['secondFactorRequired'];\n      }\n      if (isset($vals['secondFactorDeliveryHint'])) {\n        $this->secondFactorDeliveryHint = $vals['secondFactorDeliveryHint'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'AuthenticationResult';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::I64) {\n            $xfer += $input->readI64($this->currentTime);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::I64) {\n            $xfer += $input->readI64($this->expiration);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 4:\n          if ($ftype == TType::STRUCT) {\n            $this->user = new \\EDAM\\Types\\User();\n            $xfer += $this->user->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 5:\n          if ($ftype == TType::STRUCT) {\n            $this->publicUserInfo = new \\EDAM\\UserStore\\PublicUserInfo();\n            $xfer += $this->publicUserInfo->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 6:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->noteStoreUrl);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 7:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->webApiUrlPrefix);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 8:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->secondFactorRequired);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 9:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->secondFactorDeliveryHint);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('AuthenticationResult');\n    if ($this->currentTime !== null) {\n      $xfer += $output->writeFieldBegin('currentTime', TType::I64, 1);\n      $xfer += $output->writeI64($this->currentTime);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 2);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->expiration !== null) {\n      $xfer += $output->writeFieldBegin('expiration', TType::I64, 3);\n      $xfer += $output->writeI64($this->expiration);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->user !== null) {\n      if (!is_object($this->user)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('user', TType::STRUCT, 4);\n      $xfer += $this->user->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->publicUserInfo !== null) {\n      if (!is_object($this->publicUserInfo)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('publicUserInfo', TType::STRUCT, 5);\n      $xfer += $this->publicUserInfo->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->noteStoreUrl !== null) {\n      $xfer += $output->writeFieldBegin('noteStoreUrl', TType::STRING, 6);\n      $xfer += $output->writeString($this->noteStoreUrl);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->webApiUrlPrefix !== null) {\n      $xfer += $output->writeFieldBegin('webApiUrlPrefix', TType::STRING, 7);\n      $xfer += $output->writeString($this->webApiUrlPrefix);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->secondFactorRequired !== null) {\n      $xfer += $output->writeFieldBegin('secondFactorRequired', TType::BOOL, 8);\n      $xfer += $output->writeBool($this->secondFactorRequired);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->secondFactorDeliveryHint !== null) {\n      $xfer += $output->writeFieldBegin('secondFactorDeliveryHint', TType::STRING, 9);\n      $xfer += $output->writeString($this->secondFactorDeliveryHint);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass BootstrapSettings {\n  static $_TSPEC;\n\n  public $serviceHost = null;\n  public $marketingUrl = null;\n  public $supportUrl = null;\n  public $accountEmailDomain = null;\n  public $enableFacebookSharing = null;\n  public $enableGiftSubscriptions = null;\n  public $enableSupportTickets = null;\n  public $enableSharedNotebooks = null;\n  public $enableSingleNoteSharing = null;\n  public $enableSponsoredAccounts = null;\n  public $enableTwitterSharing = null;\n  public $enableLinkedInSharing = null;\n  public $enablePublicNotebooks = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'serviceHost',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'marketingUrl',\n          'type' => TType::STRING,\n          ),\n        3 => array(\n          'var' => 'supportUrl',\n          'type' => TType::STRING,\n          ),\n        4 => array(\n          'var' => 'accountEmailDomain',\n          'type' => TType::STRING,\n          ),\n        5 => array(\n          'var' => 'enableFacebookSharing',\n          'type' => TType::BOOL,\n          ),\n        6 => array(\n          'var' => 'enableGiftSubscriptions',\n          'type' => TType::BOOL,\n          ),\n        7 => array(\n          'var' => 'enableSupportTickets',\n          'type' => TType::BOOL,\n          ),\n        8 => array(\n          'var' => 'enableSharedNotebooks',\n          'type' => TType::BOOL,\n          ),\n        9 => array(\n          'var' => 'enableSingleNoteSharing',\n          'type' => TType::BOOL,\n          ),\n        10 => array(\n          'var' => 'enableSponsoredAccounts',\n          'type' => TType::BOOL,\n          ),\n        11 => array(\n          'var' => 'enableTwitterSharing',\n          'type' => TType::BOOL,\n          ),\n        12 => array(\n          'var' => 'enableLinkedInSharing',\n          'type' => TType::BOOL,\n          ),\n        13 => array(\n          'var' => 'enablePublicNotebooks',\n          'type' => TType::BOOL,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['serviceHost'])) {\n        $this->serviceHost = $vals['serviceHost'];\n      }\n      if (isset($vals['marketingUrl'])) {\n        $this->marketingUrl = $vals['marketingUrl'];\n      }\n      if (isset($vals['supportUrl'])) {\n        $this->supportUrl = $vals['supportUrl'];\n      }\n      if (isset($vals['accountEmailDomain'])) {\n        $this->accountEmailDomain = $vals['accountEmailDomain'];\n      }\n      if (isset($vals['enableFacebookSharing'])) {\n        $this->enableFacebookSharing = $vals['enableFacebookSharing'];\n      }\n      if (isset($vals['enableGiftSubscriptions'])) {\n        $this->enableGiftSubscriptions = $vals['enableGiftSubscriptions'];\n      }\n      if (isset($vals['enableSupportTickets'])) {\n        $this->enableSupportTickets = $vals['enableSupportTickets'];\n      }\n      if (isset($vals['enableSharedNotebooks'])) {\n        $this->enableSharedNotebooks = $vals['enableSharedNotebooks'];\n      }\n      if (isset($vals['enableSingleNoteSharing'])) {\n        $this->enableSingleNoteSharing = $vals['enableSingleNoteSharing'];\n      }\n      if (isset($vals['enableSponsoredAccounts'])) {\n        $this->enableSponsoredAccounts = $vals['enableSponsoredAccounts'];\n      }\n      if (isset($vals['enableTwitterSharing'])) {\n        $this->enableTwitterSharing = $vals['enableTwitterSharing'];\n      }\n      if (isset($vals['enableLinkedInSharing'])) {\n        $this->enableLinkedInSharing = $vals['enableLinkedInSharing'];\n      }\n      if (isset($vals['enablePublicNotebooks'])) {\n        $this->enablePublicNotebooks = $vals['enablePublicNotebooks'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'BootstrapSettings';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->serviceHost);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->marketingUrl);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->supportUrl);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 4:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->accountEmailDomain);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 5:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->enableFacebookSharing);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 6:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->enableGiftSubscriptions);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 7:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->enableSupportTickets);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 8:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->enableSharedNotebooks);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 9:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->enableSingleNoteSharing);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 10:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->enableSponsoredAccounts);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 11:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->enableTwitterSharing);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 12:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->enableLinkedInSharing);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 13:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->enablePublicNotebooks);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('BootstrapSettings');\n    if ($this->serviceHost !== null) {\n      $xfer += $output->writeFieldBegin('serviceHost', TType::STRING, 1);\n      $xfer += $output->writeString($this->serviceHost);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->marketingUrl !== null) {\n      $xfer += $output->writeFieldBegin('marketingUrl', TType::STRING, 2);\n      $xfer += $output->writeString($this->marketingUrl);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->supportUrl !== null) {\n      $xfer += $output->writeFieldBegin('supportUrl', TType::STRING, 3);\n      $xfer += $output->writeString($this->supportUrl);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->accountEmailDomain !== null) {\n      $xfer += $output->writeFieldBegin('accountEmailDomain', TType::STRING, 4);\n      $xfer += $output->writeString($this->accountEmailDomain);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->enableFacebookSharing !== null) {\n      $xfer += $output->writeFieldBegin('enableFacebookSharing', TType::BOOL, 5);\n      $xfer += $output->writeBool($this->enableFacebookSharing);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->enableGiftSubscriptions !== null) {\n      $xfer += $output->writeFieldBegin('enableGiftSubscriptions', TType::BOOL, 6);\n      $xfer += $output->writeBool($this->enableGiftSubscriptions);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->enableSupportTickets !== null) {\n      $xfer += $output->writeFieldBegin('enableSupportTickets', TType::BOOL, 7);\n      $xfer += $output->writeBool($this->enableSupportTickets);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->enableSharedNotebooks !== null) {\n      $xfer += $output->writeFieldBegin('enableSharedNotebooks', TType::BOOL, 8);\n      $xfer += $output->writeBool($this->enableSharedNotebooks);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->enableSingleNoteSharing !== null) {\n      $xfer += $output->writeFieldBegin('enableSingleNoteSharing', TType::BOOL, 9);\n      $xfer += $output->writeBool($this->enableSingleNoteSharing);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->enableSponsoredAccounts !== null) {\n      $xfer += $output->writeFieldBegin('enableSponsoredAccounts', TType::BOOL, 10);\n      $xfer += $output->writeBool($this->enableSponsoredAccounts);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->enableTwitterSharing !== null) {\n      $xfer += $output->writeFieldBegin('enableTwitterSharing', TType::BOOL, 11);\n      $xfer += $output->writeBool($this->enableTwitterSharing);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->enableLinkedInSharing !== null) {\n      $xfer += $output->writeFieldBegin('enableLinkedInSharing', TType::BOOL, 12);\n      $xfer += $output->writeBool($this->enableLinkedInSharing);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->enablePublicNotebooks !== null) {\n      $xfer += $output->writeFieldBegin('enablePublicNotebooks', TType::BOOL, 13);\n      $xfer += $output->writeBool($this->enablePublicNotebooks);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass BootstrapProfile {\n  static $_TSPEC;\n\n  public $name = null;\n  public $settings = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'name',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'settings',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\UserStore\\BootstrapSettings',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['name'])) {\n        $this->name = $vals['name'];\n      }\n      if (isset($vals['settings'])) {\n        $this->settings = $vals['settings'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'BootstrapProfile';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->name);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->settings = new \\EDAM\\UserStore\\BootstrapSettings();\n            $xfer += $this->settings->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('BootstrapProfile');\n    if ($this->name !== null) {\n      $xfer += $output->writeFieldBegin('name', TType::STRING, 1);\n      $xfer += $output->writeString($this->name);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->settings !== null) {\n      if (!is_object($this->settings)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('settings', TType::STRUCT, 2);\n      $xfer += $this->settings->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass BootstrapInfo {\n  static $_TSPEC;\n\n  public $profiles = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'profiles',\n          'type' => TType::LST,\n          'etype' => TType::STRUCT,\n          'elem' => array(\n            'type' => TType::STRUCT,\n            'class' => '\\EDAM\\UserStore\\BootstrapProfile',\n            ),\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['profiles'])) {\n        $this->profiles = $vals['profiles'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'BootstrapInfo';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::LST) {\n            $this->profiles = array();\n            $_size0 = 0;\n            $_etype3 = 0;\n            $xfer += $input->readListBegin($_etype3, $_size0);\n            for ($_i4 = 0; $_i4 < $_size0; ++$_i4)\n            {\n              $elem5 = null;\n              $elem5 = new \\EDAM\\UserStore\\BootstrapProfile();\n              $xfer += $elem5->read($input);\n              $this->profiles []= $elem5;\n            }\n            $xfer += $input->readListEnd();\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('BootstrapInfo');\n    if ($this->profiles !== null) {\n      if (!is_array($this->profiles)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('profiles', TType::LST, 1);\n      {\n        $output->writeListBegin(TType::STRUCT, count($this->profiles));\n        {\n          foreach ($this->profiles as $iter6)\n          {\n            $xfer += $iter6->write($output);\n          }\n        }\n        $output->writeListEnd();\n      }\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nfinal class Constant extends \\Thrift\\Type\\TConstant {\n  static protected $EDAM_VERSION_MAJOR;\n  static protected $EDAM_VERSION_MINOR;\n\n  static protected function init_EDAM_VERSION_MAJOR() {\n    return 1;\n  }\n\n  static protected function init_EDAM_VERSION_MINOR() {\n    return 25;\n  }\n}\n\n\n"
  },
  {
    "path": "src/EDAM/UserStore/UserStore.php",
    "content": "<?php\nnamespace EDAM\\UserStore;\n/**\n * Autogenerated by Thrift Compiler (0.9.1)\n *\n * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING\n *  @generated\n */\nuse Thrift\\Base\\TBase;\nuse Thrift\\Type\\TType;\nuse Thrift\\Type\\TMessageType;\nuse Thrift\\Exception\\TException;\nuse Thrift\\Exception\\TProtocolException;\nuse Thrift\\Protocol\\TProtocol;\nuse Thrift\\Protocol\\TBinaryProtocolAccelerated;\nuse Thrift\\Exception\\TApplicationException;\n\n\ninterface UserStoreIf {\n  public function checkVersion($clientName, $edamVersionMajor, $edamVersionMinor);\n  public function getBootstrapInfo($locale);\n  public function authenticate($username, $password, $consumerKey, $consumerSecret, $supportsTwoFactor);\n  public function authenticateLongSession($username, $password, $consumerKey, $consumerSecret, $deviceIdentifier, $deviceDescription, $supportsTwoFactor);\n  public function completeTwoFactorAuthentication($authenticationToken, $oneTimeCode, $deviceIdentifier, $deviceDescription);\n  public function revokeLongSession($authenticationToken);\n  public function authenticateToBusiness($authenticationToken);\n  public function refreshAuthentication($authenticationToken);\n  public function getUser($authenticationToken);\n  public function getPublicUserInfo($username);\n  public function getPremiumInfo($authenticationToken);\n  public function getNoteStoreUrl($authenticationToken);\n}\n\nclass UserStoreClient implements \\EDAM\\UserStore\\UserStoreIf {\n  protected $input_ = null;\n  protected $output_ = null;\n\n  protected $seqid_ = 0;\n\n  public function __construct($input, $output=null) {\n    $this->input_ = $input;\n    $this->output_ = $output ? $output : $input;\n  }\n\n  public function checkVersion($clientName, $edamVersionMajor, $edamVersionMinor)\n  {\n    $this->send_checkVersion($clientName, $edamVersionMajor, $edamVersionMinor);\n    return $this->recv_checkVersion();\n  }\n\n  public function send_checkVersion($clientName, $edamVersionMajor, $edamVersionMinor)\n  {\n    $args = new \\EDAM\\UserStore\\UserStore_checkVersion_args();\n    $args->clientName = $clientName;\n    $args->edamVersionMajor = $edamVersionMajor;\n    $args->edamVersionMinor = $edamVersionMinor;\n    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n    if ($bin_accel)\n    {\n      thrift_protocol_write_binary($this->output_, 'checkVersion', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n    }\n    else\n    {\n      $this->output_->writeMessageBegin('checkVersion', TMessageType::CALL, $this->seqid_);\n      $args->write($this->output_);\n      $this->output_->writeMessageEnd();\n      $this->output_->getTransport()->flush();\n    }\n  }\n\n  public function recv_checkVersion()\n  {\n    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\UserStore\\UserStore_checkVersion_result', $this->input_->isStrictRead());\n    else\n    {\n      $rseqid = 0;\n      $fname = null;\n      $mtype = 0;\n\n      $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n      if ($mtype == TMessageType::EXCEPTION) {\n        $x = new TApplicationException();\n        $x->read($this->input_);\n        $this->input_->readMessageEnd();\n        throw $x;\n      }\n      $result = new \\EDAM\\UserStore\\UserStore_checkVersion_result();\n      $result->read($this->input_);\n      $this->input_->readMessageEnd();\n    }\n    if ($result->success !== null) {\n      return $result->success;\n    }\n    throw new \\Exception(\"checkVersion failed: unknown result\");\n  }\n\n  public function getBootstrapInfo($locale)\n  {\n    $this->send_getBootstrapInfo($locale);\n    return $this->recv_getBootstrapInfo();\n  }\n\n  public function send_getBootstrapInfo($locale)\n  {\n    $args = new \\EDAM\\UserStore\\UserStore_getBootstrapInfo_args();\n    $args->locale = $locale;\n    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n    if ($bin_accel)\n    {\n      thrift_protocol_write_binary($this->output_, 'getBootstrapInfo', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n    }\n    else\n    {\n      $this->output_->writeMessageBegin('getBootstrapInfo', TMessageType::CALL, $this->seqid_);\n      $args->write($this->output_);\n      $this->output_->writeMessageEnd();\n      $this->output_->getTransport()->flush();\n    }\n  }\n\n  public function recv_getBootstrapInfo()\n  {\n    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\UserStore\\UserStore_getBootstrapInfo_result', $this->input_->isStrictRead());\n    else\n    {\n      $rseqid = 0;\n      $fname = null;\n      $mtype = 0;\n\n      $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n      if ($mtype == TMessageType::EXCEPTION) {\n        $x = new TApplicationException();\n        $x->read($this->input_);\n        $this->input_->readMessageEnd();\n        throw $x;\n      }\n      $result = new \\EDAM\\UserStore\\UserStore_getBootstrapInfo_result();\n      $result->read($this->input_);\n      $this->input_->readMessageEnd();\n    }\n    if ($result->success !== null) {\n      return $result->success;\n    }\n    throw new \\Exception(\"getBootstrapInfo failed: unknown result\");\n  }\n\n  public function authenticate($username, $password, $consumerKey, $consumerSecret, $supportsTwoFactor)\n  {\n    $this->send_authenticate($username, $password, $consumerKey, $consumerSecret, $supportsTwoFactor);\n    return $this->recv_authenticate();\n  }\n\n  public function send_authenticate($username, $password, $consumerKey, $consumerSecret, $supportsTwoFactor)\n  {\n    $args = new \\EDAM\\UserStore\\UserStore_authenticate_args();\n    $args->username = $username;\n    $args->password = $password;\n    $args->consumerKey = $consumerKey;\n    $args->consumerSecret = $consumerSecret;\n    $args->supportsTwoFactor = $supportsTwoFactor;\n    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n    if ($bin_accel)\n    {\n      thrift_protocol_write_binary($this->output_, 'authenticate', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n    }\n    else\n    {\n      $this->output_->writeMessageBegin('authenticate', TMessageType::CALL, $this->seqid_);\n      $args->write($this->output_);\n      $this->output_->writeMessageEnd();\n      $this->output_->getTransport()->flush();\n    }\n  }\n\n  public function recv_authenticate()\n  {\n    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\UserStore\\UserStore_authenticate_result', $this->input_->isStrictRead());\n    else\n    {\n      $rseqid = 0;\n      $fname = null;\n      $mtype = 0;\n\n      $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n      if ($mtype == TMessageType::EXCEPTION) {\n        $x = new TApplicationException();\n        $x->read($this->input_);\n        $this->input_->readMessageEnd();\n        throw $x;\n      }\n      $result = new \\EDAM\\UserStore\\UserStore_authenticate_result();\n      $result->read($this->input_);\n      $this->input_->readMessageEnd();\n    }\n    if ($result->success !== null) {\n      return $result->success;\n    }\n    if ($result->userException !== null) {\n      throw $result->userException;\n    }\n    if ($result->systemException !== null) {\n      throw $result->systemException;\n    }\n    throw new \\Exception(\"authenticate failed: unknown result\");\n  }\n\n  public function authenticateLongSession($username, $password, $consumerKey, $consumerSecret, $deviceIdentifier, $deviceDescription, $supportsTwoFactor)\n  {\n    $this->send_authenticateLongSession($username, $password, $consumerKey, $consumerSecret, $deviceIdentifier, $deviceDescription, $supportsTwoFactor);\n    return $this->recv_authenticateLongSession();\n  }\n\n  public function send_authenticateLongSession($username, $password, $consumerKey, $consumerSecret, $deviceIdentifier, $deviceDescription, $supportsTwoFactor)\n  {\n    $args = new \\EDAM\\UserStore\\UserStore_authenticateLongSession_args();\n    $args->username = $username;\n    $args->password = $password;\n    $args->consumerKey = $consumerKey;\n    $args->consumerSecret = $consumerSecret;\n    $args->deviceIdentifier = $deviceIdentifier;\n    $args->deviceDescription = $deviceDescription;\n    $args->supportsTwoFactor = $supportsTwoFactor;\n    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n    if ($bin_accel)\n    {\n      thrift_protocol_write_binary($this->output_, 'authenticateLongSession', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n    }\n    else\n    {\n      $this->output_->writeMessageBegin('authenticateLongSession', TMessageType::CALL, $this->seqid_);\n      $args->write($this->output_);\n      $this->output_->writeMessageEnd();\n      $this->output_->getTransport()->flush();\n    }\n  }\n\n  public function recv_authenticateLongSession()\n  {\n    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\UserStore\\UserStore_authenticateLongSession_result', $this->input_->isStrictRead());\n    else\n    {\n      $rseqid = 0;\n      $fname = null;\n      $mtype = 0;\n\n      $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n      if ($mtype == TMessageType::EXCEPTION) {\n        $x = new TApplicationException();\n        $x->read($this->input_);\n        $this->input_->readMessageEnd();\n        throw $x;\n      }\n      $result = new \\EDAM\\UserStore\\UserStore_authenticateLongSession_result();\n      $result->read($this->input_);\n      $this->input_->readMessageEnd();\n    }\n    if ($result->success !== null) {\n      return $result->success;\n    }\n    if ($result->userException !== null) {\n      throw $result->userException;\n    }\n    if ($result->systemException !== null) {\n      throw $result->systemException;\n    }\n    throw new \\Exception(\"authenticateLongSession failed: unknown result\");\n  }\n\n  public function completeTwoFactorAuthentication($authenticationToken, $oneTimeCode, $deviceIdentifier, $deviceDescription)\n  {\n    $this->send_completeTwoFactorAuthentication($authenticationToken, $oneTimeCode, $deviceIdentifier, $deviceDescription);\n    return $this->recv_completeTwoFactorAuthentication();\n  }\n\n  public function send_completeTwoFactorAuthentication($authenticationToken, $oneTimeCode, $deviceIdentifier, $deviceDescription)\n  {\n    $args = new \\EDAM\\UserStore\\UserStore_completeTwoFactorAuthentication_args();\n    $args->authenticationToken = $authenticationToken;\n    $args->oneTimeCode = $oneTimeCode;\n    $args->deviceIdentifier = $deviceIdentifier;\n    $args->deviceDescription = $deviceDescription;\n    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n    if ($bin_accel)\n    {\n      thrift_protocol_write_binary($this->output_, 'completeTwoFactorAuthentication', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n    }\n    else\n    {\n      $this->output_->writeMessageBegin('completeTwoFactorAuthentication', TMessageType::CALL, $this->seqid_);\n      $args->write($this->output_);\n      $this->output_->writeMessageEnd();\n      $this->output_->getTransport()->flush();\n    }\n  }\n\n  public function recv_completeTwoFactorAuthentication()\n  {\n    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\UserStore\\UserStore_completeTwoFactorAuthentication_result', $this->input_->isStrictRead());\n    else\n    {\n      $rseqid = 0;\n      $fname = null;\n      $mtype = 0;\n\n      $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n      if ($mtype == TMessageType::EXCEPTION) {\n        $x = new TApplicationException();\n        $x->read($this->input_);\n        $this->input_->readMessageEnd();\n        throw $x;\n      }\n      $result = new \\EDAM\\UserStore\\UserStore_completeTwoFactorAuthentication_result();\n      $result->read($this->input_);\n      $this->input_->readMessageEnd();\n    }\n    if ($result->success !== null) {\n      return $result->success;\n    }\n    if ($result->userException !== null) {\n      throw $result->userException;\n    }\n    if ($result->systemException !== null) {\n      throw $result->systemException;\n    }\n    throw new \\Exception(\"completeTwoFactorAuthentication failed: unknown result\");\n  }\n\n  public function revokeLongSession($authenticationToken)\n  {\n    $this->send_revokeLongSession($authenticationToken);\n    $this->recv_revokeLongSession();\n  }\n\n  public function send_revokeLongSession($authenticationToken)\n  {\n    $args = new \\EDAM\\UserStore\\UserStore_revokeLongSession_args();\n    $args->authenticationToken = $authenticationToken;\n    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n    if ($bin_accel)\n    {\n      thrift_protocol_write_binary($this->output_, 'revokeLongSession', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n    }\n    else\n    {\n      $this->output_->writeMessageBegin('revokeLongSession', TMessageType::CALL, $this->seqid_);\n      $args->write($this->output_);\n      $this->output_->writeMessageEnd();\n      $this->output_->getTransport()->flush();\n    }\n  }\n\n  public function recv_revokeLongSession()\n  {\n    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\UserStore\\UserStore_revokeLongSession_result', $this->input_->isStrictRead());\n    else\n    {\n      $rseqid = 0;\n      $fname = null;\n      $mtype = 0;\n\n      $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n      if ($mtype == TMessageType::EXCEPTION) {\n        $x = new TApplicationException();\n        $x->read($this->input_);\n        $this->input_->readMessageEnd();\n        throw $x;\n      }\n      $result = new \\EDAM\\UserStore\\UserStore_revokeLongSession_result();\n      $result->read($this->input_);\n      $this->input_->readMessageEnd();\n    }\n    if ($result->userException !== null) {\n      throw $result->userException;\n    }\n    if ($result->systemException !== null) {\n      throw $result->systemException;\n    }\n    return;\n  }\n\n  public function authenticateToBusiness($authenticationToken)\n  {\n    $this->send_authenticateToBusiness($authenticationToken);\n    return $this->recv_authenticateToBusiness();\n  }\n\n  public function send_authenticateToBusiness($authenticationToken)\n  {\n    $args = new \\EDAM\\UserStore\\UserStore_authenticateToBusiness_args();\n    $args->authenticationToken = $authenticationToken;\n    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n    if ($bin_accel)\n    {\n      thrift_protocol_write_binary($this->output_, 'authenticateToBusiness', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n    }\n    else\n    {\n      $this->output_->writeMessageBegin('authenticateToBusiness', TMessageType::CALL, $this->seqid_);\n      $args->write($this->output_);\n      $this->output_->writeMessageEnd();\n      $this->output_->getTransport()->flush();\n    }\n  }\n\n  public function recv_authenticateToBusiness()\n  {\n    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\UserStore\\UserStore_authenticateToBusiness_result', $this->input_->isStrictRead());\n    else\n    {\n      $rseqid = 0;\n      $fname = null;\n      $mtype = 0;\n\n      $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n      if ($mtype == TMessageType::EXCEPTION) {\n        $x = new TApplicationException();\n        $x->read($this->input_);\n        $this->input_->readMessageEnd();\n        throw $x;\n      }\n      $result = new \\EDAM\\UserStore\\UserStore_authenticateToBusiness_result();\n      $result->read($this->input_);\n      $this->input_->readMessageEnd();\n    }\n    if ($result->success !== null) {\n      return $result->success;\n    }\n    if ($result->userException !== null) {\n      throw $result->userException;\n    }\n    if ($result->systemException !== null) {\n      throw $result->systemException;\n    }\n    throw new \\Exception(\"authenticateToBusiness failed: unknown result\");\n  }\n\n  public function refreshAuthentication($authenticationToken)\n  {\n    $this->send_refreshAuthentication($authenticationToken);\n    return $this->recv_refreshAuthentication();\n  }\n\n  public function send_refreshAuthentication($authenticationToken)\n  {\n    $args = new \\EDAM\\UserStore\\UserStore_refreshAuthentication_args();\n    $args->authenticationToken = $authenticationToken;\n    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n    if ($bin_accel)\n    {\n      thrift_protocol_write_binary($this->output_, 'refreshAuthentication', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n    }\n    else\n    {\n      $this->output_->writeMessageBegin('refreshAuthentication', TMessageType::CALL, $this->seqid_);\n      $args->write($this->output_);\n      $this->output_->writeMessageEnd();\n      $this->output_->getTransport()->flush();\n    }\n  }\n\n  public function recv_refreshAuthentication()\n  {\n    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\UserStore\\UserStore_refreshAuthentication_result', $this->input_->isStrictRead());\n    else\n    {\n      $rseqid = 0;\n      $fname = null;\n      $mtype = 0;\n\n      $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n      if ($mtype == TMessageType::EXCEPTION) {\n        $x = new TApplicationException();\n        $x->read($this->input_);\n        $this->input_->readMessageEnd();\n        throw $x;\n      }\n      $result = new \\EDAM\\UserStore\\UserStore_refreshAuthentication_result();\n      $result->read($this->input_);\n      $this->input_->readMessageEnd();\n    }\n    if ($result->success !== null) {\n      return $result->success;\n    }\n    if ($result->userException !== null) {\n      throw $result->userException;\n    }\n    if ($result->systemException !== null) {\n      throw $result->systemException;\n    }\n    throw new \\Exception(\"refreshAuthentication failed: unknown result\");\n  }\n\n  public function getUser($authenticationToken)\n  {\n    $this->send_getUser($authenticationToken);\n    return $this->recv_getUser();\n  }\n\n  public function send_getUser($authenticationToken)\n  {\n    $args = new \\EDAM\\UserStore\\UserStore_getUser_args();\n    $args->authenticationToken = $authenticationToken;\n    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n    if ($bin_accel)\n    {\n      thrift_protocol_write_binary($this->output_, 'getUser', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n    }\n    else\n    {\n      $this->output_->writeMessageBegin('getUser', TMessageType::CALL, $this->seqid_);\n      $args->write($this->output_);\n      $this->output_->writeMessageEnd();\n      $this->output_->getTransport()->flush();\n    }\n  }\n\n  public function recv_getUser()\n  {\n    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\UserStore\\UserStore_getUser_result', $this->input_->isStrictRead());\n    else\n    {\n      $rseqid = 0;\n      $fname = null;\n      $mtype = 0;\n\n      $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n      if ($mtype == TMessageType::EXCEPTION) {\n        $x = new TApplicationException();\n        $x->read($this->input_);\n        $this->input_->readMessageEnd();\n        throw $x;\n      }\n      $result = new \\EDAM\\UserStore\\UserStore_getUser_result();\n      $result->read($this->input_);\n      $this->input_->readMessageEnd();\n    }\n    if ($result->success !== null) {\n      return $result->success;\n    }\n    if ($result->userException !== null) {\n      throw $result->userException;\n    }\n    if ($result->systemException !== null) {\n      throw $result->systemException;\n    }\n    throw new \\Exception(\"getUser failed: unknown result\");\n  }\n\n  public function getPublicUserInfo($username)\n  {\n    $this->send_getPublicUserInfo($username);\n    return $this->recv_getPublicUserInfo();\n  }\n\n  public function send_getPublicUserInfo($username)\n  {\n    $args = new \\EDAM\\UserStore\\UserStore_getPublicUserInfo_args();\n    $args->username = $username;\n    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n    if ($bin_accel)\n    {\n      thrift_protocol_write_binary($this->output_, 'getPublicUserInfo', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n    }\n    else\n    {\n      $this->output_->writeMessageBegin('getPublicUserInfo', TMessageType::CALL, $this->seqid_);\n      $args->write($this->output_);\n      $this->output_->writeMessageEnd();\n      $this->output_->getTransport()->flush();\n    }\n  }\n\n  public function recv_getPublicUserInfo()\n  {\n    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\UserStore\\UserStore_getPublicUserInfo_result', $this->input_->isStrictRead());\n    else\n    {\n      $rseqid = 0;\n      $fname = null;\n      $mtype = 0;\n\n      $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n      if ($mtype == TMessageType::EXCEPTION) {\n        $x = new TApplicationException();\n        $x->read($this->input_);\n        $this->input_->readMessageEnd();\n        throw $x;\n      }\n      $result = new \\EDAM\\UserStore\\UserStore_getPublicUserInfo_result();\n      $result->read($this->input_);\n      $this->input_->readMessageEnd();\n    }\n    if ($result->success !== null) {\n      return $result->success;\n    }\n    if ($result->notFoundException !== null) {\n      throw $result->notFoundException;\n    }\n    if ($result->systemException !== null) {\n      throw $result->systemException;\n    }\n    if ($result->userException !== null) {\n      throw $result->userException;\n    }\n    throw new \\Exception(\"getPublicUserInfo failed: unknown result\");\n  }\n\n  public function getPremiumInfo($authenticationToken)\n  {\n    $this->send_getPremiumInfo($authenticationToken);\n    return $this->recv_getPremiumInfo();\n  }\n\n  public function send_getPremiumInfo($authenticationToken)\n  {\n    $args = new \\EDAM\\UserStore\\UserStore_getPremiumInfo_args();\n    $args->authenticationToken = $authenticationToken;\n    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n    if ($bin_accel)\n    {\n      thrift_protocol_write_binary($this->output_, 'getPremiumInfo', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n    }\n    else\n    {\n      $this->output_->writeMessageBegin('getPremiumInfo', TMessageType::CALL, $this->seqid_);\n      $args->write($this->output_);\n      $this->output_->writeMessageEnd();\n      $this->output_->getTransport()->flush();\n    }\n  }\n\n  public function recv_getPremiumInfo()\n  {\n    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\UserStore\\UserStore_getPremiumInfo_result', $this->input_->isStrictRead());\n    else\n    {\n      $rseqid = 0;\n      $fname = null;\n      $mtype = 0;\n\n      $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n      if ($mtype == TMessageType::EXCEPTION) {\n        $x = new TApplicationException();\n        $x->read($this->input_);\n        $this->input_->readMessageEnd();\n        throw $x;\n      }\n      $result = new \\EDAM\\UserStore\\UserStore_getPremiumInfo_result();\n      $result->read($this->input_);\n      $this->input_->readMessageEnd();\n    }\n    if ($result->success !== null) {\n      return $result->success;\n    }\n    if ($result->userException !== null) {\n      throw $result->userException;\n    }\n    if ($result->systemException !== null) {\n      throw $result->systemException;\n    }\n    throw new \\Exception(\"getPremiumInfo failed: unknown result\");\n  }\n\n  public function getNoteStoreUrl($authenticationToken)\n  {\n    $this->send_getNoteStoreUrl($authenticationToken);\n    return $this->recv_getNoteStoreUrl();\n  }\n\n  public function send_getNoteStoreUrl($authenticationToken)\n  {\n    $args = new \\EDAM\\UserStore\\UserStore_getNoteStoreUrl_args();\n    $args->authenticationToken = $authenticationToken;\n    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');\n    if ($bin_accel)\n    {\n      thrift_protocol_write_binary($this->output_, 'getNoteStoreUrl', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());\n    }\n    else\n    {\n      $this->output_->writeMessageBegin('getNoteStoreUrl', TMessageType::CALL, $this->seqid_);\n      $args->write($this->output_);\n      $this->output_->writeMessageEnd();\n      $this->output_->getTransport()->flush();\n    }\n  }\n\n  public function recv_getNoteStoreUrl()\n  {\n    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');\n    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\\EDAM\\UserStore\\UserStore_getNoteStoreUrl_result', $this->input_->isStrictRead());\n    else\n    {\n      $rseqid = 0;\n      $fname = null;\n      $mtype = 0;\n\n      $this->input_->readMessageBegin($fname, $mtype, $rseqid);\n      if ($mtype == TMessageType::EXCEPTION) {\n        $x = new TApplicationException();\n        $x->read($this->input_);\n        $this->input_->readMessageEnd();\n        throw $x;\n      }\n      $result = new \\EDAM\\UserStore\\UserStore_getNoteStoreUrl_result();\n      $result->read($this->input_);\n      $this->input_->readMessageEnd();\n    }\n    if ($result->success !== null) {\n      return $result->success;\n    }\n    if ($result->userException !== null) {\n      throw $result->userException;\n    }\n    if ($result->systemException !== null) {\n      throw $result->systemException;\n    }\n    throw new \\Exception(\"getNoteStoreUrl failed: unknown result\");\n  }\n\n}\n\n// HELPER FUNCTIONS AND STRUCTURES\n\nclass UserStore_checkVersion_args {\n  static $_TSPEC;\n\n  public $clientName = null;\n  public $edamVersionMajor = 1;\n  public $edamVersionMinor = 25;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'clientName',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'edamVersionMajor',\n          'type' => TType::I16,\n          ),\n        3 => array(\n          'var' => 'edamVersionMinor',\n          'type' => TType::I16,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['clientName'])) {\n        $this->clientName = $vals['clientName'];\n      }\n      if (isset($vals['edamVersionMajor'])) {\n        $this->edamVersionMajor = $vals['edamVersionMajor'];\n      }\n      if (isset($vals['edamVersionMinor'])) {\n        $this->edamVersionMinor = $vals['edamVersionMinor'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'UserStore_checkVersion_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->clientName);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::I16) {\n            $xfer += $input->readI16($this->edamVersionMajor);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::I16) {\n            $xfer += $input->readI16($this->edamVersionMinor);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('UserStore_checkVersion_args');\n    if ($this->clientName !== null) {\n      $xfer += $output->writeFieldBegin('clientName', TType::STRING, 1);\n      $xfer += $output->writeString($this->clientName);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->edamVersionMajor !== null) {\n      $xfer += $output->writeFieldBegin('edamVersionMajor', TType::I16, 2);\n      $xfer += $output->writeI16($this->edamVersionMajor);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->edamVersionMinor !== null) {\n      $xfer += $output->writeFieldBegin('edamVersionMinor', TType::I16, 3);\n      $xfer += $output->writeI16($this->edamVersionMinor);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass UserStore_checkVersion_result {\n  static $_TSPEC;\n\n  public $success = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::BOOL,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'UserStore_checkVersion_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->success);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('UserStore_checkVersion_result');\n    if ($this->success !== null) {\n      $xfer += $output->writeFieldBegin('success', TType::BOOL, 0);\n      $xfer += $output->writeBool($this->success);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass UserStore_getBootstrapInfo_args {\n  static $_TSPEC;\n\n  public $locale = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'locale',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['locale'])) {\n        $this->locale = $vals['locale'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'UserStore_getBootstrapInfo_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->locale);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('UserStore_getBootstrapInfo_args');\n    if ($this->locale !== null) {\n      $xfer += $output->writeFieldBegin('locale', TType::STRING, 1);\n      $xfer += $output->writeString($this->locale);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass UserStore_getBootstrapInfo_result {\n  static $_TSPEC;\n\n  public $success = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\UserStore\\BootstrapInfo',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'UserStore_getBootstrapInfo_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRUCT) {\n            $this->success = new \\EDAM\\UserStore\\BootstrapInfo();\n            $xfer += $this->success->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('UserStore_getBootstrapInfo_result');\n    if ($this->success !== null) {\n      if (!is_object($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);\n      $xfer += $this->success->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass UserStore_authenticate_args {\n  static $_TSPEC;\n\n  public $username = null;\n  public $password = null;\n  public $consumerKey = null;\n  public $consumerSecret = null;\n  public $supportsTwoFactor = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'username',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'password',\n          'type' => TType::STRING,\n          ),\n        3 => array(\n          'var' => 'consumerKey',\n          'type' => TType::STRING,\n          ),\n        4 => array(\n          'var' => 'consumerSecret',\n          'type' => TType::STRING,\n          ),\n        5 => array(\n          'var' => 'supportsTwoFactor',\n          'type' => TType::BOOL,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['username'])) {\n        $this->username = $vals['username'];\n      }\n      if (isset($vals['password'])) {\n        $this->password = $vals['password'];\n      }\n      if (isset($vals['consumerKey'])) {\n        $this->consumerKey = $vals['consumerKey'];\n      }\n      if (isset($vals['consumerSecret'])) {\n        $this->consumerSecret = $vals['consumerSecret'];\n      }\n      if (isset($vals['supportsTwoFactor'])) {\n        $this->supportsTwoFactor = $vals['supportsTwoFactor'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'UserStore_authenticate_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->username);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->password);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->consumerKey);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 4:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->consumerSecret);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 5:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->supportsTwoFactor);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('UserStore_authenticate_args');\n    if ($this->username !== null) {\n      $xfer += $output->writeFieldBegin('username', TType::STRING, 1);\n      $xfer += $output->writeString($this->username);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->password !== null) {\n      $xfer += $output->writeFieldBegin('password', TType::STRING, 2);\n      $xfer += $output->writeString($this->password);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->consumerKey !== null) {\n      $xfer += $output->writeFieldBegin('consumerKey', TType::STRING, 3);\n      $xfer += $output->writeString($this->consumerKey);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->consumerSecret !== null) {\n      $xfer += $output->writeFieldBegin('consumerSecret', TType::STRING, 4);\n      $xfer += $output->writeString($this->consumerSecret);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->supportsTwoFactor !== null) {\n      $xfer += $output->writeFieldBegin('supportsTwoFactor', TType::BOOL, 5);\n      $xfer += $output->writeBool($this->supportsTwoFactor);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass UserStore_authenticate_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\UserStore\\AuthenticationResult',\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'UserStore_authenticate_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRUCT) {\n            $this->success = new \\EDAM\\UserStore\\AuthenticationResult();\n            $xfer += $this->success->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('UserStore_authenticate_result');\n    if ($this->success !== null) {\n      if (!is_object($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);\n      $xfer += $this->success->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass UserStore_authenticateLongSession_args {\n  static $_TSPEC;\n\n  public $username = null;\n  public $password = null;\n  public $consumerKey = null;\n  public $consumerSecret = null;\n  public $deviceIdentifier = null;\n  public $deviceDescription = null;\n  public $supportsTwoFactor = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'username',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'password',\n          'type' => TType::STRING,\n          ),\n        3 => array(\n          'var' => 'consumerKey',\n          'type' => TType::STRING,\n          ),\n        4 => array(\n          'var' => 'consumerSecret',\n          'type' => TType::STRING,\n          ),\n        5 => array(\n          'var' => 'deviceIdentifier',\n          'type' => TType::STRING,\n          ),\n        6 => array(\n          'var' => 'deviceDescription',\n          'type' => TType::STRING,\n          ),\n        7 => array(\n          'var' => 'supportsTwoFactor',\n          'type' => TType::BOOL,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['username'])) {\n        $this->username = $vals['username'];\n      }\n      if (isset($vals['password'])) {\n        $this->password = $vals['password'];\n      }\n      if (isset($vals['consumerKey'])) {\n        $this->consumerKey = $vals['consumerKey'];\n      }\n      if (isset($vals['consumerSecret'])) {\n        $this->consumerSecret = $vals['consumerSecret'];\n      }\n      if (isset($vals['deviceIdentifier'])) {\n        $this->deviceIdentifier = $vals['deviceIdentifier'];\n      }\n      if (isset($vals['deviceDescription'])) {\n        $this->deviceDescription = $vals['deviceDescription'];\n      }\n      if (isset($vals['supportsTwoFactor'])) {\n        $this->supportsTwoFactor = $vals['supportsTwoFactor'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'UserStore_authenticateLongSession_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->username);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->password);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->consumerKey);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 4:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->consumerSecret);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 5:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->deviceIdentifier);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 6:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->deviceDescription);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 7:\n          if ($ftype == TType::BOOL) {\n            $xfer += $input->readBool($this->supportsTwoFactor);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('UserStore_authenticateLongSession_args');\n    if ($this->username !== null) {\n      $xfer += $output->writeFieldBegin('username', TType::STRING, 1);\n      $xfer += $output->writeString($this->username);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->password !== null) {\n      $xfer += $output->writeFieldBegin('password', TType::STRING, 2);\n      $xfer += $output->writeString($this->password);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->consumerKey !== null) {\n      $xfer += $output->writeFieldBegin('consumerKey', TType::STRING, 3);\n      $xfer += $output->writeString($this->consumerKey);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->consumerSecret !== null) {\n      $xfer += $output->writeFieldBegin('consumerSecret', TType::STRING, 4);\n      $xfer += $output->writeString($this->consumerSecret);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->deviceIdentifier !== null) {\n      $xfer += $output->writeFieldBegin('deviceIdentifier', TType::STRING, 5);\n      $xfer += $output->writeString($this->deviceIdentifier);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->deviceDescription !== null) {\n      $xfer += $output->writeFieldBegin('deviceDescription', TType::STRING, 6);\n      $xfer += $output->writeString($this->deviceDescription);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->supportsTwoFactor !== null) {\n      $xfer += $output->writeFieldBegin('supportsTwoFactor', TType::BOOL, 7);\n      $xfer += $output->writeBool($this->supportsTwoFactor);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass UserStore_authenticateLongSession_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\UserStore\\AuthenticationResult',\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'UserStore_authenticateLongSession_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRUCT) {\n            $this->success = new \\EDAM\\UserStore\\AuthenticationResult();\n            $xfer += $this->success->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('UserStore_authenticateLongSession_result');\n    if ($this->success !== null) {\n      if (!is_object($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);\n      $xfer += $this->success->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass UserStore_completeTwoFactorAuthentication_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n  public $oneTimeCode = null;\n  public $deviceIdentifier = null;\n  public $deviceDescription = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        2 => array(\n          'var' => 'oneTimeCode',\n          'type' => TType::STRING,\n          ),\n        3 => array(\n          'var' => 'deviceIdentifier',\n          'type' => TType::STRING,\n          ),\n        4 => array(\n          'var' => 'deviceDescription',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n      if (isset($vals['oneTimeCode'])) {\n        $this->oneTimeCode = $vals['oneTimeCode'];\n      }\n      if (isset($vals['deviceIdentifier'])) {\n        $this->deviceIdentifier = $vals['deviceIdentifier'];\n      }\n      if (isset($vals['deviceDescription'])) {\n        $this->deviceDescription = $vals['deviceDescription'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'UserStore_completeTwoFactorAuthentication_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->oneTimeCode);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->deviceIdentifier);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 4:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->deviceDescription);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('UserStore_completeTwoFactorAuthentication_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->oneTimeCode !== null) {\n      $xfer += $output->writeFieldBegin('oneTimeCode', TType::STRING, 2);\n      $xfer += $output->writeString($this->oneTimeCode);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->deviceIdentifier !== null) {\n      $xfer += $output->writeFieldBegin('deviceIdentifier', TType::STRING, 3);\n      $xfer += $output->writeString($this->deviceIdentifier);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->deviceDescription !== null) {\n      $xfer += $output->writeFieldBegin('deviceDescription', TType::STRING, 4);\n      $xfer += $output->writeString($this->deviceDescription);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass UserStore_completeTwoFactorAuthentication_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\UserStore\\AuthenticationResult',\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'UserStore_completeTwoFactorAuthentication_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRUCT) {\n            $this->success = new \\EDAM\\UserStore\\AuthenticationResult();\n            $xfer += $this->success->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('UserStore_completeTwoFactorAuthentication_result');\n    if ($this->success !== null) {\n      if (!is_object($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);\n      $xfer += $this->success->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass UserStore_revokeLongSession_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'UserStore_revokeLongSession_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('UserStore_revokeLongSession_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass UserStore_revokeLongSession_result {\n  static $_TSPEC;\n\n  public $userException = null;\n  public $systemException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'UserStore_revokeLongSession_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('UserStore_revokeLongSession_result');\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass UserStore_authenticateToBusiness_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'UserStore_authenticateToBusiness_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('UserStore_authenticateToBusiness_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass UserStore_authenticateToBusiness_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\UserStore\\AuthenticationResult',\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'UserStore_authenticateToBusiness_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRUCT) {\n            $this->success = new \\EDAM\\UserStore\\AuthenticationResult();\n            $xfer += $this->success->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('UserStore_authenticateToBusiness_result');\n    if ($this->success !== null) {\n      if (!is_object($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);\n      $xfer += $this->success->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass UserStore_refreshAuthentication_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'UserStore_refreshAuthentication_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('UserStore_refreshAuthentication_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass UserStore_refreshAuthentication_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\UserStore\\AuthenticationResult',\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'UserStore_refreshAuthentication_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRUCT) {\n            $this->success = new \\EDAM\\UserStore\\AuthenticationResult();\n            $xfer += $this->success->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('UserStore_refreshAuthentication_result');\n    if ($this->success !== null) {\n      if (!is_object($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);\n      $xfer += $this->success->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass UserStore_getUser_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'UserStore_getUser_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('UserStore_getUser_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass UserStore_getUser_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\User',\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'UserStore_getUser_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRUCT) {\n            $this->success = new \\EDAM\\Types\\User();\n            $xfer += $this->success->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('UserStore_getUser_result');\n    if ($this->success !== null) {\n      if (!is_object($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);\n      $xfer += $this->success->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass UserStore_getPublicUserInfo_args {\n  static $_TSPEC;\n\n  public $username = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'username',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['username'])) {\n        $this->username = $vals['username'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'UserStore_getPublicUserInfo_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->username);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('UserStore_getPublicUserInfo_args');\n    if ($this->username !== null) {\n      $xfer += $output->writeFieldBegin('username', TType::STRING, 1);\n      $xfer += $output->writeString($this->username);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass UserStore_getPublicUserInfo_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $notFoundException = null;\n  public $systemException = null;\n  public $userException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\UserStore\\PublicUserInfo',\n          ),\n        1 => array(\n          'var' => 'notFoundException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMNotFoundException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        3 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['notFoundException'])) {\n        $this->notFoundException = $vals['notFoundException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'UserStore_getPublicUserInfo_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRUCT) {\n            $this->success = new \\EDAM\\UserStore\\PublicUserInfo();\n            $xfer += $this->success->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->notFoundException = new \\EDAM\\Error\\EDAMNotFoundException();\n            $xfer += $this->notFoundException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 3:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('UserStore_getPublicUserInfo_result');\n    if ($this->success !== null) {\n      if (!is_object($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);\n      $xfer += $this->success->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->notFoundException !== null) {\n      $xfer += $output->writeFieldBegin('notFoundException', TType::STRUCT, 1);\n      $xfer += $this->notFoundException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 3);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass UserStore_getPremiumInfo_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'UserStore_getPremiumInfo_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('UserStore_getPremiumInfo_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass UserStore_getPremiumInfo_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Types\\PremiumInfo',\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'UserStore_getPremiumInfo_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRUCT) {\n            $this->success = new \\EDAM\\Types\\PremiumInfo();\n            $xfer += $this->success->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('UserStore_getPremiumInfo_result');\n    if ($this->success !== null) {\n      if (!is_object($this->success)) {\n        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);\n      }\n      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);\n      $xfer += $this->success->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass UserStore_getNoteStoreUrl_args {\n  static $_TSPEC;\n\n  public $authenticationToken = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        1 => array(\n          'var' => 'authenticationToken',\n          'type' => TType::STRING,\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['authenticationToken'])) {\n        $this->authenticationToken = $vals['authenticationToken'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'UserStore_getNoteStoreUrl_args';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 1:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->authenticationToken);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('UserStore_getNoteStoreUrl_args');\n    if ($this->authenticationToken !== null) {\n      $xfer += $output->writeFieldBegin('authenticationToken', TType::STRING, 1);\n      $xfer += $output->writeString($this->authenticationToken);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\nclass UserStore_getNoteStoreUrl_result {\n  static $_TSPEC;\n\n  public $success = null;\n  public $userException = null;\n  public $systemException = null;\n\n  public function __construct($vals=null) {\n    if (!isset(self::$_TSPEC)) {\n      self::$_TSPEC = array(\n        0 => array(\n          'var' => 'success',\n          'type' => TType::STRING,\n          ),\n        1 => array(\n          'var' => 'userException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMUserException',\n          ),\n        2 => array(\n          'var' => 'systemException',\n          'type' => TType::STRUCT,\n          'class' => '\\EDAM\\Error\\EDAMSystemException',\n          ),\n        );\n    }\n    if (is_array($vals)) {\n      if (isset($vals['success'])) {\n        $this->success = $vals['success'];\n      }\n      if (isset($vals['userException'])) {\n        $this->userException = $vals['userException'];\n      }\n      if (isset($vals['systemException'])) {\n        $this->systemException = $vals['systemException'];\n      }\n    }\n  }\n\n  public function getName() {\n    return 'UserStore_getNoteStoreUrl_result';\n  }\n\n  public function read($input)\n  {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true)\n    {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      switch ($fid)\n      {\n        case 0:\n          if ($ftype == TType::STRING) {\n            $xfer += $input->readString($this->success);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 1:\n          if ($ftype == TType::STRUCT) {\n            $this->userException = new \\EDAM\\Error\\EDAMUserException();\n            $xfer += $this->userException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        case 2:\n          if ($ftype == TType::STRUCT) {\n            $this->systemException = new \\EDAM\\Error\\EDAMSystemException();\n            $xfer += $this->systemException->read($input);\n          } else {\n            $xfer += $input->skip($ftype);\n          }\n          break;\n        default:\n          $xfer += $input->skip($ftype);\n          break;\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('UserStore_getNoteStoreUrl_result');\n    if ($this->success !== null) {\n      $xfer += $output->writeFieldBegin('success', TType::STRING, 0);\n      $xfer += $output->writeString($this->success);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->userException !== null) {\n      $xfer += $output->writeFieldBegin('userException', TType::STRUCT, 1);\n      $xfer += $this->userException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($this->systemException !== null) {\n      $xfer += $output->writeFieldBegin('systemException', TType::STRUCT, 2);\n      $xfer += $this->systemException->write($output);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n\n\n"
  },
  {
    "path": "src/Evernote/AdvancedClient.php",
    "content": "<?php\n\nnamespace Evernote;\n\nuse Psr\\Log\\NullLogger;\nuse Psr\\Log\\LoggerInterface;\nuse Evernote\\Factory\\ThriftClientFactory;\nuse Evernote\\Store\\Store;\n\nclass AdvancedClient\n{\n    /** @var  string */\n    protected $token;\n\n    /** @var bool */\n    protected $sandbox;\n\n    /** @var bool */\n    protected $china;\n\n    /** @var \\Evernote\\Factory\\ThriftClientFactory  */\n    protected $thriftClientFactory;\n\n    /** @var  \\EDAM\\UserStore\\UserStoreClient */\n    protected $userStore;\n\n    /** @var \\Psr\\Log\\LoggerInterface */\n    protected $logger;\n\n    const SANDBOX_BASE_URL = 'https://sandbox.evernote.com';\n    const PROD_BASE_URL    = 'https://www.evernote.com';\n    const CHINA_BASE_URL   = 'https://app.yinxiang.com';\n\n    /**\n     * @param string $token\n     * @param bool $sandbox\n     * @param Evernote\\Factory\\ThriftClientFactory|null $thriftClientFactory\n     * @param \\Psr\\Log\\LoggerInterface|null $logger\n     * @param bool $china\n     */\n    public function __construct($token, $sandbox = true, $thriftClientFactory = null, LoggerInterface $logger = null, $china = false)\n    {\n        $this->token               = $token;\n        $this->sandbox             = $sandbox;\n        $this->thriftClientFactory = $thriftClientFactory;\n        $this->logger              = $logger ?: new NullLogger;\n        $this->china               = $china;\n    }\n\n    /**\n     * @return \\EDAM\\UserStore\\UserStoreClient\n     */\n    public function getUserStore()\n    {\n        if (null === $this->userStore) {\n            $this->userStore = $this->getStoreInstance($this->token, 'user', $this->getEndpoint('/edam/user'));\n        }\n\n        return $this->userStore;\n    }\n\n    /**\n     * @param $noteStoreUrl\n     * @return mixed\n     */\n    public function getNoteStore($noteStoreUrl = null, $token = null)\n    {\n        if (null === $noteStoreUrl) {\n            $noteStoreUrl = $this->getUserStore()->getNoteStoreUrl($this->token);\n        }\n\n        if (null == $token) {\n            $token = $this->token;\n        }\n\n        return $this->getStoreInstance($token, 'note', $noteStoreUrl);\n    }\n\n\n    public function getSharedNoteStore($linkedNotebook)\n    {\n        $noteStoreUrl = $linkedNotebook->noteStoreUrl;\n        $noteStore = $this->getNoteStore($noteStoreUrl);\n        $sharedAuth = $noteStore->authenticateToSharedNotebook($linkedNotebook->shareKey);\n        $sharedToken = $sharedAuth->authenticationToken;\n\n        return $this->getStoreInstance($sharedToken, 'note', $noteStoreUrl);\n    }\n\n    public function getBusinessNoteStore()\n    {\n        $businessAuth = $this->getUserStore()->authenticateToBusiness($this->token);\n\n        return $this->getNoteStore($businessAuth->noteStoreUrl, $businessAuth->authenticationToken);\n    }\n\n    /**\n     * @param null $path\n     * @return string\n     */\n    public function getEndpoint($path = null)\n    {\n        if (true === $this->sandbox) {\n            $url = self::SANDBOX_BASE_URL;\n        } elseif (true === $this->china) {\n            $url = self::CHINA_BASE_URL;\n        } else {\n            $url = self::PROD_BASE_URL;\n        }    \n\n        if (null != $path) {\n            $url .= '/' . $path;\n        }\n\n        return $url;\n    }\n\n    /**\n     * @return ThriftClientFactory\n     */\n    public function getThriftClientFactory()\n    {\n        return $this->thriftClientFactory;\n    }\n\n\n\n    public function getStoreInstance($token, $type, $url)\n    {\n        return new Store($this->getThriftClientFactory(), $token, $type, $url);\n    }\n}\n\n"
  },
  {
    "path": "src/Evernote/Auth/OauthHandler.php",
    "content": "<?php\n\nnamespace Evernote\\Auth;\n\nuse Evernote\\Exception\\AuthorizationDeniedException;\n\nclass OauthHandler\n{\n    protected $sandbox;\n\n    protected $china;\n\n    protected $consumer_secret;\n\n    protected $token_secret;\n\n    protected $supportLinkedSandbox;\n\n    protected $params = array();\n\n    public function __construct($sandbox = true, $supportLinkedSandbox = false, $china = false)\n    {\n        $this->sandbox              = $sandbox;\n        $this->supportLinkedSandbox = $supportLinkedSandbox;\n        $this->china                = $china;\n\n        $this->params['oauth_callback']         = null;\n        $this->params['oauth_consumer_key']     = null;\n        $this->params['oauth_nonce']            = $this->getOauthNonce();\n        $this->params['oauth_signature']        = null;\n        $this->params['oauth_signature_method'] = 'HMAC-SHA1';\n        $this->params['oauth_timestamp']        = $this->getOauthTimestamp();\n        $this->params['oauth_token']            = null;\n        $this->params['oauth_verifier']         = '1.0';\n        $this->params['oauth_version']          = '1.0';\n\n        $this->token_secret = '';\n    }\n\n    public function authorize($consumer_key, $consumer_secret, $callback)\n    {\n        $this->params['oauth_callback']         = $callback;\n        $this->params['oauth_consumer_key']     = $consumer_key;\n\n        $this->consumer_secret = $consumer_secret;\n\n        if (session_status() == PHP_SESSION_NONE) {\n            session_start();\n        }\n\n        // first call\n        if (!array_key_exists('oauth_verifier', $_GET) && !array_key_exists('oauth_token', $_GET)) {\n            unset($this->params['oauth_token']);\n            unset($this->params['oauth_verifier']);\n\n            $temporaryCredentials = $this->getTemporaryCredentials();\n\n            $_SESSION['oauth_token_secret'] = $temporaryCredentials['oauth_token_secret'];;\n\n            $authorizationUrl = 'Location: '\n                . $this->getBaseUrl('OAuth.action?oauth_token=')\n                . $temporaryCredentials['oauth_token'];\n\n            if ($this->supportLinkedSandbox) {\n                $authorizationUrl .= '&supportLinkedSandbox=true';\n            }\n\n            header($authorizationUrl);\n\n        // the user declined the authorization\n        } elseif (!array_key_exists('oauth_verifier', $_GET) && array_key_exists('oauth_token', $_GET)) {\n            throw new AuthorizationDeniedException('Authorization declined.');\n        //the user authorized the app\n        } else {\n            $this->token_secret = $_SESSION['oauth_token_secret'];\n\n            $this->params['oauth_token']    = $_GET['oauth_token'];\n            $this->params['oauth_verifier'] = $_GET['oauth_verifier'];\n            unset($this->params['oauth_callback']);\n\n            return $this->getTemporaryCredentials();\n        }\n\n    }\n\n    protected function getBaseUrl($prefix = '')\n    {\n        $baseUrl = '';\n        if (true === $this->sandbox) {\n            $baseUrl = \"https://sandbox.evernote.com\";\n        } elseif (true === $this->china) {\n            $baseUrl = \"https://app.yinxiang.com\";\n        } else {\n            $baseUrl = \"https://www.evernote.com\";     \n        }\n        $baseUrl .= $prefix == '' ? '' : '/' . $prefix;   \n\n        return $baseUrl;     \n    }\n\n    protected function getTemporaryCredentials()\n    {\n        $headers = array();\n        $headers['Content-Type'] = 'application/x-www-form-urlencoded';\n        $headers['Authorization'] = $this->getAuthorizationHeaderString();\n\n        $arguments = array();\n\n        $handle  = curl_init();\n\n        curl_setopt_array($handle, array(\n            CURLOPT_POST           => true,\n            CURLOPT_URL            => $this->getBaseUrl('oauth'),\n            CURLOPT_HTTPHEADER     => $this->formatHeaders($headers),\n            CURLOPT_POSTFIELDS     => http_build_query($arguments, '', '&'),\n            CURLOPT_HEADER         => true,\n            CURLOPT_RETURNTRANSFER => true\n        ));\n\n        $raw = curl_exec($handle);\n\n        # close curl handle\n        curl_close($handle);\n\n        $responseBody = $this->getResponseBody($raw);\n\n        parse_str($responseBody, $parts);\n\n        return $parts;\n    }\n\n    protected function getResponseBody($raw)\n    {\n        list($headers, $text) = explode(\"\\r\\n\\r\\n\", $raw, 2);\n        if (strpos($headers, ' 100 Continue') !== false) {\n            list(, $text) = explode(\"\\r\\n\\r\\n\", $text, 2);\n        }\n\n        return $text;\n    }\n\n    protected function getOauthNonce()\n    {\n        return md5(mt_rand());\n    }\n\n    protected function getOauthTimestamp()\n    {\n        return time();\n    }\n\n    protected function getOauthSignature()\n    {\n        $baseString   = $this->getSignatureBaseString();\n        $signatureKey = $this->getSignatureKey();\n\n        $oauth_signature = base64_encode(\n            hash_hmac(\n                'sha1',\n                $baseString,\n                $signatureKey,\n                true\n            )\n        );\n\n        return rawurlencode($oauth_signature);\n    }\n\n    protected function getSignatureBaseString()\n    {\n        $params = $this->params;\n        unset($params['oauth_signature']);\n\n        if (array_key_exists('oauth_callback', $params)) {\n            $params['oauth_callback'] = rawurlencode($params['oauth_callback']);\n        }\n\n        return 'POST&' . rawurlencode($this->getBaseUrl('oauth')) .'&' . rawurlencode($this->formatParametersString($params, '&'));\n    }\n\n    protected function formatParametersString($params, $glue, $enclosure = '')\n    {\n        $result = array();\n        foreach ($params as $key => $value) {\n            $result[] = $key . '=' . $enclosure . $value . $enclosure;\n        }\n\n        return implode($glue, $result);\n    }\n\n    protected function getAuthorizationHeaderString()\n    {\n        $params = $this->params;\n        $params['oauth_signature'] = $this->getOauthSignature();\n\n        return 'OAuth ' . $this->formatParametersString($params, ', ', '\"');\n    }\n\n    protected function getSignatureKey()\n    {\n        return $this->consumer_secret . '&' . $this->token_secret;\n    }\n\n    protected function formatHeaders($headers)\n    {\n        $result = array();\n        foreach($headers as $key => $value) {\n            $result[] = \"$key: $value\";\n        }\n\n        return $result;\n    }\n}\n"
  },
  {
    "path": "src/Evernote/Client.php",
    "content": "<?php\n\nnamespace Evernote;\n\nuse Psr\\Log\\NullLogger;\nuse Psr\\Log\\LoggerInterface;\nuse EDAM\\Error\\EDAMNotFoundException;\nuse EDAM\\Error\\EDAMSystemException;\nuse EDAM\\Error\\EDAMUserException;\nuse EDAM\\NoteStore\\NoteFilter;\nuse EDAM\\NoteStore\\NotesMetadataResultSpec;\nuse EDAM\\Types\\LinkedNotebook;\nuse EDAM\\Types\\NoteSortOrder;\nuse Evernote\\Exception\\ExceptionFactory;\nuse Evernote\\Exception\\PermissionDeniedException;\nuse Evernote\\Model\\Note;\nuse Evernote\\Model\\Notebook;\nuse Evernote\\Model\\Search;\nuse Evernote\\Model\\SearchResult;\n\nclass Client\n{\n    /** @var  \\Evernote\\AdvancedClient */\n    protected $advancedClient;\n\n    /** @var  string */\n    protected $token;\n\n    /** @var  boolean */\n    protected $sandbox;\n\n    /** @var  boolean */\n    protected $china;\n\n    /** @var  \\EDAM\\NoteStore\\NoteStoreClient */\n    protected $userNoteStore;\n\n    protected $isBusinessUser;\n\n\n    /** @var  \\EDAM\\NoteStore\\NoteStoreClient */\n    protected $businessNoteStore;\n\n    /** @var  string */\n    protected $businessToken;\n\n    /** @var  \\EDAM\\UserStore\\AuthenticationResult */\n    protected $businessAuth;\n\n    /** @var \\Psr\\Log\\LoggerInterface */\n    protected $logger;\n\n    /**\n     * Personal scope for the getNote and getNotebook methods\n     */\n    const PERSONAL_SCOPE = 1;\n    /**\n     * Linked scope for the getNote and getNotebook methods\n     */\n    const LINKED_SCOPE   = 2;\n\n    /**\n     *  Only used if specifying an explicit notebook instead.\n     */\n    const SEARCH_SCOPE_NONE            = 0;\n    /**\n     *  Search among all personal notebooks.\n     */\n    const SEARCH_SCOPE_PERSONAL        = 1; // 1 << 0\n    /**\n     *  Search among all notebooks shared to the user by others.\n     */\n    const SEARCH_SCOPE_PERSONAL_LINKED = 2; // 1 << 1\n    /**\n     *  Search among all business notebooks the user has joined.\n     */\n    const SEARCH_SCOPE_BUSINESS        = 4; // 1 << 2\n\n    /**\n     *  Use this if your app uses an \"App Notebook\". (any other set flags will be ignored.)\n     */\n    const SEARCH_SCOPE_APP_NOTEBOOK    = 8; // 1 << 3\n\n    /**\n     * Default search is among personal notebooks only; typical and most performant scope.\n     */\n    const SEARCH_SCOPE_DEFAULT         = 1; // SEARCH_SCOPE_PERSONAL\n\n    /**\n     * Search everything this user can see. PERFORMANCE NOTE: This can be very expensive and result in many roundtrips if the\n     * user is a member of a business and/or has many linked notebooks.\n     */\n    const SEARCH_SCOPE_ALL             = 7; // SEARCH_SCOPE_PERSONAL | SEARCH_SCOPE_PERSONAL_LINKED | SEARCH_SCOPE_BUSINESS\n\n    // The following options address the kind of sort that should be used.\n\n    /**\n     *  Case-insensitive order by title.\n     */\n    const SORT_ORDER_TITLE            = 1; // 1 << 0\n    /**\n     *  Most recently created first.\n     */\n    const SORT_ORDER_RECENTLY_CREATED = 2; // 1 << 1\n    /**\n     *  Most recently updated first.\n     */\n    const SORT_ORDER_RECENTLY_UPDATED = 4; // 1 << 2\n    /**\n     *  Most relevant first. NB only valid when using a single search scope.\n     */\n    const SORT_ORDER_RELEVANCE        = 8; // 1 << 3\n\n    // The following options address the ordering of the sort.\n\n    /**\n     *  Default order (no flag).\n     */\n    const SORT_ORDER_NORMAL  = 0; // 0 << 16\n    /**\n     *  Reverse order.\n     */\n    const SORT_ORDER_REVERSE = 65536; // 1 << 16\n\n    /**\n     * Is it a business note ?\n     */\n    const BUSINESS_NOTE = 0;\n\n    /**\n     * Is it a personal note ?\n     */\n    const PERSONAL_NOTE = 1;\n\n    /**\n     * Is it a shared note ?\n     */\n    const SHARED_NOTE   = 2;\n\n    /**************************/\n    /**** Public interface ****/\n    /**************************/\n\n    /**\n     * @param string|null $token\n     * @param bool $sandbox\n     * @param \\Evernote\\AdvancedClient|null $advancedClient\n     * @param \\Psr\\Log\\LoggerInterface|null $logger\n     * @param bool $china\n     */\n    public function __construct($token = null, $sandbox = true, $advancedClient = null, LoggerInterface $logger = null, $china = false)\n    {\n        $this->token          = $token;\n        $this->sandbox        = $sandbox;\n        $this->advancedClient = $advancedClient;\n        $this->logger         = $logger ?: new NullLogger;\n        $this->china          = $china;\n    }\n\n\n    /**\n     * Returns a boolean indicating if the user has a business account\n     *\n     * @return bool\n     */\n    public function isBusinessUser()\n    {\n        if (null === $this->isBusinessUser) {\n            try {\n                $user = $this->getAdvancedClient()\n                    ->getUserStore()->getUser($this->token);\n            } catch (\\Exception $e) {\n                throw ExceptionFactory::create($e);\n            }\n\n            $this->isBusinessUser = $user->accounting->businessId !== null;\n        }\n\n        return $this->isBusinessUser;\n    }\n\n    /**\n     * Returns the token used to access the business notestore\n     *\n     * @return string\n     */\n    public function getBusinessToken()\n    {\n        if (null === $this->businessToken) {\n            $this->businessToken = $this->getBusinessAuth()->authenticationToken;\n        }\n\n        return $this->businessToken;\n    }\n\n    /**\n     * Returns the business notestore\n     *\n     * @return \\EDAM\\NoteStore\\NoteStoreClient|mixed\n     */\n    public function getBusinessNoteStore()\n    {\n        if (null === $this->businessNoteStore && $this->isBusinessUser()) {\n            $this->businessNoteStore = $this->getAdvancedClient()->getBusinessNoteStore();\n        }\n\n        return $this->businessNoteStore;\n    }\n\n    /**\n     * Returns the list of notebooks shared by the user with her business account\n     *\n     * @return null\n     */\n    public function getBusinessSharedNotebooks()\n    {\n        return $this->getBusinessNoteStore()->listSharedNotebooks($this->getBusinessToken());\n    }\n\n    /**\n     * Returns the list of notebooks shared to the user through the business account\n     *\n     * @return array\n     */\n    public function getBusinessLinkedNotebooks()\n    {\n        return $this->getBusinessNoteStore()->listNotebooks($this->getBusinessToken());\n    }\n\n    /**\n     * Returns the list of notebooks\n     *\n     * @return array\n     */\n    public function listNotebooks()\n    {\n        /**\n         * 1. Get all of the user's personal notebooks.\n         */\n        try {\n            $personalNotebooks = $this->listPersonalNotebooks();\n        } catch (EDAMUserException $e) {\n            $personalNotebooks = array();\n        } catch (EDAMSystemException $e) {\n            $personalNotebooks = array();\n        }\n\n        $resultNotebooks  = array();\n        $guidsToNotebooks = array();\n        foreach($personalNotebooks as $personalNotebook) {\n            $resultNotebook = new Notebook($personalNotebook);\n            $resultNotebooks[] = $resultNotebook;\n            $guidsToNotebooks[$personalNotebook->guid] = $resultNotebook;\n        }\n\n        /**\n         * Get shared notebooks and flag the matching notebook as shared\n         */\n        try {\n            $sharedNotebooks = $this->listSharedNotebooks();\n        } catch (EDAMUserException $e) {\n            $sharedNotebooks = array();\n        } catch (EDAMSystemException $e) {\n            $sharedNotebooks = array();\n        }\n\n        foreach ($sharedNotebooks as $sharedNotebook) {\n            $guidsToNotebooks[$sharedNotebook->notebookGuid]->isShared = true;\n        }\n\n        /**\n         * 2. Get all of the user's linked notebooks. These will include business and/or shared notebooks.\n         */\n\n        try {\n            $linkedNotebooks = $this->listLinkedNotebooks();\n        } catch (EDAMUserException $e) {\n            $linkedNotebooks = array();\n        } catch (EDAMSystemException $e) {\n            $linkedNotebooks = array();\n        }\n\n        if (count($linkedNotebooks) > 0) {\n            /**\n             * 3. Business user\n             */\n            if (null !== $this->getBusinessNoteStore()) {\n\n                /**\n                 * a. Get the business's shared notebooks. Some of these may match to personal linked notebooks.\n                 *\n                 */\n                $businessSharedNotebooks     = $this->getBusinessSharedNotebooks();\n                $sharedBusinessNotebookGuids = array();\n                $sharedBusinessNotebooks     = array();\n                foreach ($businessSharedNotebooks as $businessSharedNotebook) {\n                    $sharedBusinessNotebooks[$businessSharedNotebook->shareKey] = $businessSharedNotebook;\n                    $sharedBusinessNotebookGuids[] = $businessSharedNotebook->notebookGuid;\n                }\n\n                $guidsCount = array_count_values($sharedBusinessNotebookGuids);\n\n                $businessNotebooksGuids = array();\n\n                /**\n                 * b. Get the business's linked notebooks. Some of these will match to shared notebooks in (a), providing a\n                 *    complete authorization story for the notebook.\n                 */\n                $businessNotebooks = $this->getBusinessLinkedNotebooks();\n\n                foreach ($businessNotebooks as $businessNotebook) {\n                    $businessNotebooksGuids[$businessNotebook->guid] = $businessNotebook;\n                }\n\n                foreach ($linkedNotebooks as $linkedNotebook) {\n                    if (array_key_exists($linkedNotebook->shareKey, $sharedBusinessNotebooks)) {\n                        $sharedNotebook = $sharedBusinessNotebooks[$linkedNotebook->shareKey];\n                        $businessNotebook = $businessNotebooksGuids[$sharedNotebook->notebookGuid];\n\n                        $result = new Notebook($businessNotebook, $linkedNotebook, $sharedNotebook, $businessNotebook);\n                        if ((array_key_exists($sharedNotebook->notebookGuid, $guidsCount) && $guidsCount[$sharedNotebook->notebookGuid] > 1)\n                            || $businessNotebook->businessNotebook !== null) {\n                            $result->isShared = true;\n                        }\n                        $resultNotebooks[] = $result;\n                    } else {\n                        if (null === $linkedNotebook->shareKey) {\n                            continue;\n                        }\n                        $resultNotebooks[] = $this->getNoteBookByLinkedNotebook($linkedNotebook);\n                    }\n                }\n\n            } else {\n                foreach ($linkedNotebooks as $linkedNotebook) {\n                    try {\n                        $resultNotebooks[] = $this->getNoteBookByLinkedNotebook($linkedNotebook);\n                    } catch (\\Exception $e) {\n                        $e = ExceptionFactory::create($e);\n\n                        $this->logger->error('An error occured while fetching a linked notebook as a business user', array('exception' => $e, 'token' => $this->getToken()));\n                    }\n                };\n            }\n        }\n\n        return $resultNotebooks;\n    }\n\n    /**\n     * Returns the list of personal notebooks\n     *\n     * @return array\n     */\n    public function listPersonalNotebooks()\n    {\n        $notebooks = $this->getUserNotestore()->listNotebooks($this->token);\n\n        return $notebooks;\n    }\n\n    /**\n     * Returns the list of notebooks shared by the user\n     *\n     * @return array\n     */\n    public function listSharedNotebooks()\n    {\n        return $this->getUserNotestore()->listSharedNotebooks($this->token);\n    }\n\n    /**\n     * Returns the list of notebooks shared to the user\n     *\n     * @return array\n     */\n    public function listLinkedNotebooks()\n    {\n        return $this->getUserNotestore()->listLinkedNotebooks($this->token);\n    }\n\n    /**\n     *\n     * Returns the personal notestore of the user\n     *\n     * @return \\EDAM\\NoteStore\\NoteStoreClient|mixed\n     */\n    public function getUserNotestore()\n    {\n        if (null === $this->userNoteStore) {\n            $this->userNoteStore = $this->getAdvancedClient()->getNoteStore();\n        }\n\n        return $this->userNoteStore;\n    }\n\n    /**\n     * Replaces an existing note by another one (new or existing)\n     *\n     * @param Note $noteToReplace\n     * @param Note $note\n     * @return Note\n     */\n    public function replaceNote(Note $noteToReplace, Note $note)\n    {\n        $edamNote = $noteToReplace->getEdamNote();\n\n        $edamNote->title      = $note->title;\n        $edamNote->content    = $note->content;\n        $edamNote->attributes = $note->attributes;\n        $edamNote->resources  = $note->resources;\n\n        $uploaded_note = $noteToReplace->noteStore->updateNote($noteToReplace->authToken, $edamNote);\n\n        $uploaded_note->content = $note->content;\n\n        $en_note = new Note($uploaded_note);\n\n        $en_note->setSaved(true);\n\n        return $en_note;\n    }\n\n    /**\n     * Sends a new Note to the API\n     *\n     * @param Note $note\n     * @param Notebook $notebook\n     * @return Note\n     * @throws \\EDAM\\Error\\EDAMNotFoundException\n     * @throws \\Exception\n     */\n    public function uploadNote(Note $note, Notebook $notebook = null)\n    {\n        if ($this->isAppNotebookToken($this->token)) {\n            $notebook = new Notebook();\n        }\n\n        if (null != $notebook\n            && true === $note->getSaved()\n            && $note->notebookGuid === $notebook->guid) {\n            return $this->replaceNote($note, $note);\n        }\n\n        if ($note->getEdamNote()) {\n            $edamNote = $note->getEdamNote();\n        } else {\n            $edamNote = new \\EDAM\\Types\\Note();\n        }\n\n\n        $edamNote->title      = $note->title;\n        $edamNote->content    = $note->content;\n        $edamNote->attributes = $note->attributes;\n        $edamNote->created    = $note->created;\n        $edamNote->resources  = $note->resources;\n        $edamNote->tagNames   = $note->tagNames;\n\n\n        if (null !== $notebook && null !== $notebook->guid) {\n            $edamNote->notebookGuid = $notebook->guid;\n        }\n\n        try {\n            $uploaded_note = $this->getUserNotestore()->createNote($this->token, $edamNote);\n            $noteStore     = $this->getUserNotestore();\n            $token         = $this->token;\n        } catch (EDAMNotFoundException $e) {\n            $notebook = $this->getNotebook($notebook->guid, self::LINKED_SCOPE);\n            if (null === $notebook) {\n                throw $e;\n            }\n\n            if ($notebook->isLinkedNotebook()) {\n                $noteStore = $this->getNotestore($notebook->linkedNotebook->noteStoreUrl);\n                $token     = $notebook->authToken;\n\n                $edamNote->notebookGuid = $notebook->guid;\n\n                $uploaded_note = $noteStore->createNote($token, $edamNote);\n            }\n        }\n\n        $uploaded_note->content = $note->content;\n\n        $note = $this->getNoteInstance($uploaded_note, $noteStore, $token);\n\n        $note->setSaved(true);\n\n        return $note;\n    }\n\n    /**\n     * Deletes a note\n     *\n     * @param Note $note\n     * @return bool\n     */\n    public function deleteNote(Note $note)\n    {\n        if (null === $note->guid) {\n\n            return false;\n        }\n\n        // we have the credentials\n        if (null !== $note->noteStore && null !== $note->authToken) {\n            $note->noteStore->deleteNote($note->authToken, $note->guid);\n\n            return true;\n        }\n\n        try {\n            // We try to delete it with the personal credentials\n            $this->getUserNotestore()->deleteNote($this->token, $note->guid);\n\n            return true;\n        } catch (EDAMNotFoundException $e) {\n            // The note's not in a personal notebook. We'll need to find it\n            $note = $this->getNote($note->guid, self::LINKED_SCOPE);\n\n            if (null !== $note) {\n                return $this->deleteNote($note);\n            }\n\n            return false;\n         } catch (EDAMUserException $e) {\n            // You don't have permission to delete this note.\n            return false;\n        }\n\n    }\n\n    /**\n     * Shares a note and returns the share url\n     *\n     * @param Note $note\n     * @return null|string\n     */\n    public function shareNote(Note $note)\n    {\n        if (null === $note->guid) {\n\n            return null;\n        }\n\n        // we have the credentials\n        if (null !== $note->noteStore && null !== $note->authToken) {\n            $shareKey = $note->noteStore->shareNote($note->authToken, $note->guid);\n            $shardId  = $this->getShardIdFromToken($note->authToken);\n\n            return $this->getShareUrl($note->guid, $shardId, $shareKey, $this->getAdvancedClient()->getEndpoint());\n        }\n\n        try {\n            // We don't have credentials so we assume it's a personal note\n            return $this->getUserNotestore()->shareNote($this->token, $note->guid);\n\n        } catch (EDAMNotFoundException $e) {\n            // The note's not in a personal notebook. We'll need to find it\n            $note = $this->getNote($note->guid, self::LINKED_SCOPE);\n\n            if (null !== $note) {\n                $shareKey = $note->noteStore->shareNote($note->authToken, $note->guid);\n                $shardId  = $this->getShardIdFromToken($note->authToken);\n\n                return $this->getShareUrl($note->guid, $shardId, $shareKey, $this->getAdvancedClient()->getEndpoint());\n            }\n\n            return null;\n        }\n    }\n\n    /**\n     * Moves a note to another notebook\n     *\n     * @param Note $note\n     * @param Notebook $notebook\n     * @return Note\n     * @throws Exception\\PermissionDeniedException\n     * @throws \\EDAM\\Error\\EDAMUserException\n     * @throws \\Exception\n     */\n    public function moveNote(Note $note, Notebook $notebook)\n    {\n        if ($this->isAppNotebookToken($this->token)) {\n            throw new PermissionDeniedException(\"You can't move a note as you're using an app notebook token\");\n        }\n\n        $edamNote               = $note->getEdamNote();\n        $noteStore              = $note->getNoteStore();\n        $token                  = $note->getAuthToken();\n        $edamNote->notebookGuid = $notebook->guid;\n\n        try {\n            $moved_note    = $noteStore->updateNote($token, $edamNote);\n\n            $note = $this->getNoteInstance($moved_note, $noteStore, $token);\n        } catch (EDAMNotFoundException $e) {\n            $moved_note = $this->uploadNote($note, $notebook);\n            if ($moved_note && $moved_note->notebookGuid === $notebook->guid) {\n                $this->deleteNote($note);\n            }\n\n            $note = $moved_note;\n        } catch (EDAMUserException $e) {\n            if ($e->parameter === 'Note.notebookGuid') {\n                $moved_note = $this->uploadNote($note, $notebook);\n                if ($moved_note && $moved_note->notebookGuid === $notebook->guid) {\n                    $this->deleteNote($note);\n                }\n                $note = $moved_note;\n            } else {\n                throw $e;\n            }\n        }\n\n        return $note;\n    }\n\n    /**\n     * Retrieves an existing note\n     *\n     * @param $guid\n     * @param null $scope\n     * @return Note|null\n     */\n    public function getNote($guid, $scope = null)\n    {\n        if (null === $scope || self::PERSONAL_SCOPE === $scope) {\n            try {\n                $edam_note = $this->getUserNotestore()->getNote($this->token, $guid, true, true, false, false);\n\n                return $this->getNoteInstance($edam_note, $this->getUserNotestore(), $this->token);\n            } catch (EDAMNotFoundException $e) {\n                // The note does not exist. No need to go further.\n                if (self::PERSONAL_SCOPE === $scope) {\n                    return null;\n                }\n            } catch (EDAMUserException $e) {\n                // The note is in a linked notebook\n                if (self::PERSONAL_SCOPE === $scope) {\n                    // we only want the personal notes\n                    return null;\n                }\n            }\n        }\n\n        if (null === $scope || self::LINKED_SCOPE === $scope) {\n            $linkedNotebooks = $this->listLinkedNotebooks();\n\n            foreach ($linkedNotebooks as $linkedNotebook) {\n                try {\n                    $sharedNoteStore = $this->getNotestore($linkedNotebook->noteStoreUrl);\n                    $authToken = $this->getSharedNotebookAuthResult($linkedNotebook)->authenticationToken;\n\n                    $edam_note = $sharedNoteStore->getNote($authToken, $guid, true, true, false, false);\n\n                    return $this->getNoteInstance($edam_note, $sharedNoteStore, $authToken);\n\n                } catch (EDAMUserException $e) {\n                    // No right on this notebook.\n                    continue;\n                } catch (EDAMNotFoundException $e) {\n                    // Note not found\n                    continue;\n                }\n            }\n\n            return null;\n        }\n    }\n\n    /**\n     * Checks if the token is an \"app notebook\" one\n     *\n     * @param $token\n     * @return bool\n     */\n    public function isAppNotebookToken($token)\n    {\n        return strpos($token, ':B=') !== false;\n    }\n\n    /**\n     * Retrieves a notebook\n     *\n     * @param $notebook_guid\n     * @param null $scope\n     * @return Notebook|null\n     */\n    public function getNotebook($notebook_guid, $scope = null)\n    {\n        if (null === $scope || self::PERSONAL_SCOPE === $scope) {\n            try {\n                $edamNotebook = $this->getUserNotestore()->getNotebook($this->token, $notebook_guid);\n\n                return new Notebook($edamNotebook);\n            } catch (EDAMNotFoundException $e) {\n                if (self::PERSONAL_SCOPE === $scope) {\n                    return null;\n                }\n            }\n        }\n\n        if (null === $scope || self::LINKED_SCOPE === $scope) {\n            $linkedNotebooks = $this->listLinkedNotebooks();\n            foreach ($linkedNotebooks as $linkedNotebook) {\n                try {\n                    $sharedNotebook = $this->getNoteBookByLinkedNotebook($linkedNotebook);\n\n                    if ($this->isAppNotebookToken($this->token)) {\n                        return $sharedNotebook;\n                    }\n                } catch (EDAMUserException $e) {\n                    // No right on this notebook.\n                    continue;\n                }\n                if ($sharedNotebook->guid === $notebook_guid) {\n                    return $sharedNotebook;\n                }\n            }\n\n            return null;\n        }\n    }\n\n    /**\n     * Searches for notes\n     *\n     * @param $noteSearch\n     * @param Notebook $notebook\n     * @param int $scope\n     * @param int $sortOrder\n     * @param int $maxResults\n     * @return array|bool\n     */\n    public function findNotesWithSearch($noteSearch, Notebook $notebook = null, $scope = 0, $sortOrder = 0, $maxResults = 20)\n    {\n        if (!$noteSearch instanceof Search) {\n            $noteSearch = new Search($noteSearch);\n        }\n\n        // App notebook scope is internally just an \"all\" search, because we don't a priori know where the app\n        // notebook is. There's some room for a fast path in this flow if we have a saved linked record to a\n        // linked app notebook, but that case is likely rare enough to prevent complexifying this code for.\n        if ($this->isFlagSet($scope, self::SEARCH_SCOPE_APP_NOTEBOOK)) {\n            $scope = self::SEARCH_SCOPE_ALL;\n        }\n\n        // Validate the scope and sort arguments.\n        if (null !== $notebook && $scope != self::SEARCH_SCOPE_NONE) {\n            $scope = self::SEARCH_SCOPE_NONE;\n        } elseif (null === $notebook && $scope == self::SEARCH_SCOPE_NONE) {\n            $scope = self::SEARCH_SCOPE_DEFAULT;\n        }\n\n        $requiresLocalMerge = false;\n        if ($scope != self::SEARCH_SCOPE_NONE) {\n            // Check for multiple scopes. Because linked scope can subsume multiple linked notebooks, that *always* triggers\n            // the multiple scopes. If not, then both personal and business must be set together.\n            if (($this->isFlagSet($scope, self::SEARCH_SCOPE_PERSONAL) && $this->isFlagSet($scope, self::SEARCH_SCOPE_BUSINESS)) ||\n                $this->isFlagSet($scope, self::SEARCH_SCOPE_PERSONAL_LINKED)) {\n                // If we're asked for multiple scopes, relevance is not longer supportable (since we\n                // don't know how to combine relevance on the client), so default to updated date,\n                // which is probably the closest proxy to relevance.\n                if ($this->isFlagSet($sortOrder, self::SORT_ORDER_RELEVANCE)) {\n                    $sortOrder = self::SORT_ORDER_RECENTLY_UPDATED;\n                }\n                $requiresLocalMerge = true;\n            }\n        }\n\n        $resultSpec                           = new NotesMetadataResultSpec();\n        $resultSpec->includeNotebookGuid      = true;\n        $resultSpec->includeTitle             = true;\n        $resultSpec->includeCreated           = true;\n        $resultSpec->includeUpdated           = true;\n        $resultSpec->includeUpdateSequenceNum = true;\n\n        $noteFilter = new NoteFilter();\n        $noteFilter->words = $noteSearch->getSearchString();\n\n        if ($this->isFlagSet($sortOrder, self::SORT_ORDER_TITLE)) {\n            $noteFilter->order = NoteSortOrder::TITLE;\n        } elseif ($this->isFlagSet($sortOrder, self::SORT_ORDER_RECENTLY_CREATED)) {\n            $noteFilter->order = NoteSortOrder::CREATED;\n        } elseif ($this->isFlagSet($sortOrder, self::SORT_ORDER_RECENTLY_UPDATED)) {\n            $noteFilter->order = NoteSortOrder::UPDATED;\n        } elseif ($this->isFlagSet($sortOrder, self::SORT_ORDER_RELEVANCE)) {\n            $noteFilter->order = NoteSortOrder::RELEVANCE;\n        }\n\n        // \"Normal\" sort is ascending for titles, and descending for dates and relevance.\n        $sortAscending = $this->isFlagSet($sortOrder, self::SORT_ORDER_TITLE);\n\n        if ($this->isFlagSet($sortOrder, self::SORT_ORDER_REVERSE)) {\n            $sortAscending = !$sortAscending;\n        }\n\n        $noteFilter->ascending = $sortAscending;\n\n        if (null !== $notebook) {\n            $noteFilter->notebookGuid = $notebook->guid;\n        }\n\n        // Set up context.\n        $context = new \\stdClass();\n        $context->scopeNotebook       = $notebook;\n        $context->scope               = $scope;\n        $context->sortOrder           = $sortOrder;\n        $context->noteFilter          = $noteFilter;\n        $context->resultSpec          = $resultSpec;\n        $context->maxResults          = $maxResults;\n        $context->findMetadataResults = array();\n        $context->requiresLocalMerge  = $requiresLocalMerge;\n        $context->sortAscending       = $sortAscending;\n\n        // If we have a scope notebook, we already know what notebook the results will appear in.\n        // If we don't have a scope notebook, then we need to query for all the notebooks to determine\n        // where to search.\n        if (null === $context->scopeNotebook) {\n            return $this->findNotes_listNotebooksWithContext($context);\n        }\n\n        // Go directly to the next step.\n        return $this->findNotes_findInPersonalScopeWithContext($context);\n    }\n\n    /**********************/\n    /** Getters / Setters */\n    /**********************/\n\n    /**\n     * Sets the advancedClient\n     *\n     * @param \\Evernote\\AdvancedClient $advancedClient\n     */\n    public function setAdvancedClient($advancedClient)\n    {\n        $this->advancedClient = $advancedClient;\n    }\n\n    /**\n     * Returns the advancedClient\n     *\n     * @return \\Evernote\\AdvancedClient\n     */\n    public function getAdvancedClient()\n    {\n        if (null === $this->advancedClient) {\n            $this->advancedClient = new AdvancedClient($this->getToken(), $this->sandbox, null, $this->logger, $this->china);\n        }\n\n        return $this->advancedClient;\n    }\n\n    /**\n     * Sets the sandbox flag to true or false\n     *\n     * @param boolean $sandbox\n     */\n    public function setSandbox($sandbox)\n    {\n        $this->sandbox = $sandbox;\n    }\n\n    /**\n     * Gets the current sandbox flag\n     *\n     * @return boolean\n     */\n    public function getSandbox()\n    {\n        return $this->sandbox;\n    }\n\n    /**\n     * Sets the china flag to true or false\n     *\n     * @param boolean $china\n     */\n    public function setChina($china)\n    {\n        $this->china = $china;\n    }\n\n    /**\n     * Gets the current china flag\n     *\n     * @return boolean\n     */\n    public function getChina()\n    {\n        return $this->china;\n    } \n\n    /**\n     * Sets the authentication token\n     *\n     * @param string $token\n     */\n    public function setToken($token)\n    {\n        $this->token = $token;\n    }\n\n    /**\n     * Returns the current authentication token\n     *\n     * @return string\n     */\n    public function getToken()\n    {\n        return $this->token;\n    }\n\n    /**************************/\n\n    /***************************/\n    /**** protected methods ****/\n    /***************************/\n\n    protected function getNoteStore($noteStoreUrl)\n    {\n        return $this->getAdvancedClient()->getNoteStore($noteStoreUrl);\n    }\n\n    protected function getShareUrl($guid, $shardId, $shareKey, $serviceHost)\n    {\n        return $serviceHost . \"/shard/\" . $shardId . \"/sh/\" . $guid . \"/\" . $shareKey;\n    }\n\n    protected function getSharedNotebookAuthResult(LinkedNotebook $linkedNotebook)\n    {\n        $sharedNoteStore = $this->getNotestore($linkedNotebook->noteStoreUrl);\n        return $sharedNoteStore->authenticateToSharedNotebook($linkedNotebook->shareKey, $this->token);\n    }\n\n    protected function getNoteBookByLinkedNotebook(LinkedNotebook $linkedNotebook)\n    {\n        $sharedNoteStore = $this->getNotestore($linkedNotebook->noteStoreUrl);\n        $authToken = $this->getSharedNotebookAuthResult($linkedNotebook)->authenticationToken;\n        $sharedNotebook = $sharedNoteStore->getSharedNotebookByAuth($authToken);\n\n        $notebook = new Notebook(null, $linkedNotebook, $sharedNotebook);\n\n        $notebook->authToken = $authToken;\n\n        return $notebook;\n    }\n\n\n    /**\n     * @return \\EDAM\\UserStore\\AuthenticationResult\n     * @throws \\Exception\n     */\n    protected function getBusinessAuth()\n    {\n        if (null === $this->businessAuth) {\n            try {\n                $this->businessAuth =\n                    $this->getAdvancedClient()\n                        ->getUserStore()->authenticateToBusiness($this->token);\n            } catch (\\Exception $e) {\n                throw ExceptionFactory::create($e);\n            }\n        }\n\n        return $this->businessAuth;\n    }\n\n    protected function getNoteInstance(\\EDAM\\Types\\Note $edamNote = null, $noteStore = null, $token = null)\n    {\n        $note = new Note($edamNote);\n\n        $note->authToken = $token;\n\n        $note->noteStore = $noteStore;\n\n        return $note;\n    }\n\n    protected function getShardIdFromToken($token)\n    {\n        $result = preg_match('/:?S=(s[0-9]+):?/', $token, $matches);\n\n        if ($result === 1 && array_key_exists(1, $matches)) {\n            return $matches[1];\n        }\n\n        return null;\n    }\n\n    protected function isFlagSet($flags, $flag)\n    {\n        return !!(($flags) & ($flag));\n    }\n\n    protected function findNotes_listNotebooksWithContext($context)\n    {\n        \n        // XXX: We do the full listNotebooks operation here, which is overkill in all situations,\n        // and could wind us up doing a bunch of extra work. Optimization is to only look at -listNotebooks\n        // if we're personal scope, and -listLinkedNotebooks for linked and business, without ever\n        // authenticating to other note stores.\n        $notebooks = $this->listNotebooks();\n\n        if ($notebooks) {\n            $context->allNotebooks = $notebooks;\n            return $this->findNotes_findInPersonalScopeWithContext($context);\n        } else {\n            // TODO : handle error\n        }\n    }\n\n    protected function findNotes_findInPersonalScopeWithContext($context)\n    {\n        $skipPersonalScope = false;\n\n        // Skip the personal scope if the scope notebook isn't personal, or if the scope\n        // flag doesn't include personal.\n        if ($context->scopeNotebook) {\n            // If the scope notebook isn't personal, skip personal.\n            if ($context->scopeNotebook->isLinkedNotebook()) {\n                $skipPersonalScope = true;\n            }\n        } else if (!$this->isFlagSet($context->scope, self::SEARCH_SCOPE_PERSONAL)) {\n            // If the caller didn't request personal scope.\n            $skipPersonalScope = true;\n        }\n        // TODO : handle linked app notebook\n//        else if ([self appNotebookIsLinked]) {\n//        // If we know this is an app notebook scoped app, and we know the app notebook is not personal.\n//        $skipPersonalScope = true;\n//        }\n\n        // If we're skipping personal scope, proceed directly to busines scope.\n        if (true === $skipPersonalScope) {\n            return $this->findNotes_findInBusinessScopeWithContext($context);\n        }\n\n        $notesMetadataList = $this->getUserNotestore()->findNotesMetadata(\n            $this->token,\n            $context->noteFilter,\n            0,\n            $context->maxResults,\n            $context->resultSpec\n        );\n\n        foreach ($notesMetadataList->notes as $notesMetadata) {\n            $context->findMetadataResults[] = $notesMetadata;\n        }\n\n        return $this->findNotes_findInBusinessScopeWithContext($context);\n    }\n\n    protected function findNotes_findInBusinessScopeWithContext($context)\n    {\n        \n        // Skip the business scope if the user is not a business user, or the scope notebook\n        // is not a business notebook, or the business scope is not included.\n        if (false === $this->isBusinessUser() ||\n            ($context->scopeNotebook && !$context->scopeNotebook->isBusinessNotebook()) ||\n            (!$context->scopeNotebook && !$this->isFlagSet($context->scope, self::SEARCH_SCOPE_BUSINESS))\n        ) {\n            return $this->findNotes_findInLinkedScopeWithContext($context);\n        }\n\n        $notesMetadataList = $this->getBusinessNoteStore()->findNotesMetadata(\n            $this->getBusinessToken(),\n            $context->noteFilter,\n            0,\n            $context->maxResults,\n            $context->resultSpec\n        );\n\n        foreach ($notesMetadataList->notes as $notesMetadata) {\n            $context->findMetadataResults[] = $notesMetadata;\n        }\n\n        // Remember which note guids came from the business. We'll use this later to\n        // determine if we're worried about an inability to map back to notebooks.\n        $context->resultGuidsFromBusiness = array();\n        foreach ($notesMetadataList->notes as $noteMetadata) {\n            $context->resultGuidsFromBusiness[] = $noteMetadata->guid;\n        }\n\n        return $this->findNotes_findInLinkedScopeWithContext($context);\n        //TODO:\n        // This is a business user, but apparently has an app notebook restriction that's\n        // not in the business. Go look in linked scope.\n    }\n\n    protected function findNotes_findInLinkedScopeWithContext($context)\n    {\n        \n        // Skip linked scope if scope notebook is not a personal linked notebook, or if the\n        // linked scope is not included.\n        if ($context->scopeNotebook) {\n            if (!$context->scopeNotebook->isLinkedNotebook() || !$context->scopeNotebook->isBusinessNotebook()) {\n                return $this->findNotes_processResultsWithContext($context);\n            }\n        } elseif (!$this->isFlagSet($context->scope, self::SEARCH_SCOPE_PERSONAL_LINKED)) {\n            return $this->findNotes_processResultsWithContext($context);\n        }\n\n        // Build a list of all the linked notebooks that we need to run the search against.\n        $context->linkedNotebooksToSearch = array();\n        if ($context->scopeNotebook) {\n            $context->linkedNotebooksToSearch[] = $context->scopeNotebook;\n        } else {\n            foreach ($context->allNotebooks as $notebook) {\n                if ($notebook->isLinkedNotebook() && !$notebook->isBusinessNotebook()) {\n                    $context->linkedNotebooksToSearch[] = $notebook;\n                }\n            }\n        }\n\n        $this->findNotes_nextFindInLinkedScopeWithContext($context);\n    }\n\n    protected function findNotes_nextFindInLinkedScopeWithContext($context)\n    {\n        \n        if (count($context->linkedNotebooksToSearch) == 0) {\n            $this->findNotes_processResultsWithContext($context);\n            return;\n        }\n\n        // Pull the first notebook off the list of pending linked notebooks.\n        $linkedNotebook = array_shift($context->linkedNotebooksToSearch);\n\n\n        $noteStore = $this->getNotestore($linkedNotebook->noteStoreUrl);\n        $authToken = $this->getSharedNotebookAuthResult($linkedNotebook)->authenticationToken;\n\n        $notesMetadataList = $noteStore->findNotesMetadata(\n            $authToken,\n            $context->noteFilter,\n            0,\n            $context->maxResults,\n            $context->resultSpec\n        );\n\n        foreach ($notesMetadataList->notes as $notesMetadata) {\n            $context->findMetadataResults[] = $notesMetadata;\n        }\n\n        $this->findNotes_nextFindInLinkedScopeWithContext($context);\n\n        $this->findNotes_processResultsWithContext($context);\n    }\n\n    protected function compareByTitle($obj1, $obj2)\n    {\n        return strcmp($obj1->title, $obj2->title);\n    }\n\n    protected function compareByCreated($obj1, $obj2)\n    {\n        return strcmp($obj1->created, $obj2->created);\n    }\n\n    protected function compareByUpdated($obj1, $obj2)\n    {\n        return strcmp($obj1->updated, $obj2->updated);\n    }\n\n    protected function findNotes_processResultsWithContext($context)\n    {\n        // OK, now we have a complete list of note refs objects. If we need to do a local sort, then do so.\n        if ($context->requiresLocalMerge) {\n            if ($this->isFlagSet($context->sortOrder, self::SORT_ORDER_RECENTLY_CREATED)) {\n                return usort($context->findMetadataResults, array($this, 'compareByCreated'));\n            } elseif ($this->isFlagSet($context->sortOrder, self::SORT_ORDER_RECENTLY_UPDATED)) {\n                return usort($context->findMetadataResults, array($this, 'compareByUpdated'));\n            } else {\n                return usort($context->findMetadataResults, array($this, 'compareByTitle'));\n            }\n        }\n\n        // Prepare a dictionary of all notebooks by GUID so lookup below is fast.\n        $notebooksByGuid = array();\n        if (!$context->scopeNotebook) {\n            foreach ($context->allNotebooks as $notebook) {\n                $notebooksByGuid[$notebook->guid] = $notebook;\n            }\n        }\n\n        $findNotesResults = array();\n\n        // Turn the metadata list into a list of note refs.\n        foreach ($context->findMetadataResults as $metadata) {\n            $result       = new SearchResult();\n            $result->guid = $metadata->guid;\n\n            // Figure out which notebook this note belongs to. (If there's a scope notebook, it always belongs to that one.)\n            $notebook = $context->scopeNotebook ?: $notebooksByGuid[$metadata->notebookGuid];\n\n            if (!$notebook) {\n                // This is probably a business notebook that we haven't explicitly joined, so we don't have it in our list.\n                if (!array_key_exists($metadata->guid, $context->resultGuidsFromBusiness)) {\n                    //TODO\n                    // Oh, it's not from the business. We really can't find it. This is an error.\n                    //ENSDKLogError(@\"Found note metadata but can't determine owning notebook by guid. Metadata = %@\", metadata);\n                }\n                continue;\n            }\n\n            if ($notebook->isBusinessNotebook()) {\n                $result->type = self::BUSINESS_NOTE;\n            } elseif ($notebook->isLinkedNotebook()) {\n                $result->type = self::SHARED_NOTE;\n            } else {\n                $result->type = self::PERSONAL_NOTE;\n            }\n\n            //$result->notebook          = $notebook;\n            $result->title             = $metadata->title;\n            $result->created           = $metadata->created;\n            $result->updated           = $metadata->updated;\n            $result->updateSequenceNum = $metadata->updateSequenceNum;\n\n            $findNotesResults[] = $result;\n\n            // If the caller specified a max result count, and we've reached it, then stop fixing up\n            // results here.\n            if ($context->maxResults > 0 && count($findNotesResults) >= $context->maxResults) {\n                break;\n            }\n        }\n\n        return $findNotesResults;\n    }\n}\n"
  },
  {
    "path": "src/Evernote/Enml/CSSInliner/CssInlinerInterface.php",
    "content": "<?php\n\nnamespace Evernote\\Enml\\CSSInliner;\n\ninterface CssInlinerInterface\n{\n    public function convert($html, $css);\n} "
  },
  {
    "path": "src/Evernote/Enml/CSSInliner/CssToInlineStyles.php",
    "content": "<?php\n\nnamespace Evernote\\Enml\\CSSInliner;\n\nclass CssToInlineStyles implements CssInlinerInterface\n{\n    protected $cssInliner;\n\n    public function __construct()\n    {\n        $this->cssInliner = new \\TijsVerkoyen\\CssToInlineStyles\\CssToInlineStyles();\n    }\n\n    public function convert($html, $css)\n    {\n        $this->cssInliner->setHTML($html);\n        $this->cssInliner->setCSS($css);\n\n        return $this->cssInliner->convert();\n    }\n} "
  },
  {
    "path": "src/Evernote/Enml/Converter/EnmlConverterInterface.php",
    "content": "<?php\n\nnamespace Evernote\\Enml\\Converter;\n\ninterface EnmlConverterInterface\n{\n    public function convertToEnml($content);\n} "
  },
  {
    "path": "src/Evernote/Enml/Converter/EnmlToHtmlConverter.php",
    "content": "<?php\n\nnamespace Evernote\\Enml\\Converter;\n\nclass EnmlToHtmlConverter implements HtmlConverterInterface\n{\n    public function convertToHtml($content)\n    {\n        return $this->xslTransform($content, __DIR__ . '/enml2html.xslt');\n    }\n\n    public function xslTransform($enml, $xsl_file)\n    {\n        $xml = new \\DOMDocument();\n        @$xml->loadXML($enml);\n\n        $xsl = new \\DOMDocument();\n        $xsl->load($xsl_file);\n\n        $proc = new \\XSLTProcessor();\n        $proc->importStyleSheet($xsl); // attach the xsl rules\n\n        return $proc->transformToXML($xml);\n    }\n} "
  },
  {
    "path": "src/Evernote/Enml/Converter/HtmlConverterInterface.php",
    "content": "<?php\n\nnamespace Evernote\\Enml\\Converter;\n\ninterface HtmlConverterInterface\n{\n    public function convertToHtml($content);\n} "
  },
  {
    "path": "src/Evernote/Enml/Converter/HtmlToEnmlConverter.php",
    "content": "<?php\n\nnamespace Evernote\\Enml\\Converter;\n\nuse Evernote\\Enml\\CSSInliner\\CssInlinerInterface;\nuse Evernote\\Enml\\CSSInliner\\CssToInlineStyles;\nuse Evernote\\Enml\\HtmlCleaner\\HtmlCleanerInterface;\nuse Evernote\\Enml\\HtmlCleaner\\HtmlPurifier;\n\nclass HtmlToEnmlConverter implements EnmlConverterInterface\n{\n    protected $htmlCleaner;\n\n    protected $cssInliner;\n\n\n    public function __construct(HtmlCleanerInterface $html_cleaner = null, CssInlinerInterface $css_inliner = null)\n    {\n        if (null === $html_cleaner) {\n            $html_cleaner = new HtmlPurifier();\n        }\n\n        if (null === $css_inliner) {\n            $css_inliner = new CssToInlineStyles();\n        }\n\n        $this->htmlCleaner = $html_cleaner;\n        $this->cssInliner  = $css_inliner;\n    }\n\n    public function convertToEnml($content, $base_url = null)\n    {\n        $base_url = ($base_url === null)?'http://example.com':$base_url;\n\n        //fix urls\n        $content = str_replace('href=\"/', 'href=\"' . $base_url . '/', $content);\n        $content = str_replace('href=\"\"', 'href=\"' . $base_url . '\"', $content);\n\n//      $css = $this->extractCssFromHtml($content);\n        //Then we inline the CSS\n//      echo $cleanHtml = @$this->inlineCss($content, $css);\n\n        //First we try to clean the HTML\n        $content = $this->cleanHtml($content);\n\n        //Transform to ENML via XSLT\n        $enml_body = $this->xslTransform($content, __DIR__ . '/html2enml.xslt');\n\n        $enml = <<<EOF\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE en-note SYSTEM \"http://xml.evernote.com/pub/enml2.dtd\">\n<en-note>\n$enml_body\n</en-note>\nEOF;\n\n        $enml = $enml_body;\n\n        return $enml;\n    }\n\n    public function extractUrls($html)\n    {\n        $dom = new \\DOMDocument();\n        $dom->loadHTML($html);\n        $xpath = new \\DOMXPath($dom);\n        $nodes = $xpath->query('//a/@href');\n\n        $urls = array();\n        foreach($nodes as $href) {\n            $urls[] = $href->nodeValue;\n        }\n\n        return $urls;\n    }\n\n    public function isUrlValid($url)\n    {\n        $allowed_protocols = array('http', 'https', 'file');\n\n        return in_array(parse_url($url, PHP_URL_SCHEME), $allowed_protocols)\n            && filter_var($url, FILTER_VALIDATE_URL) !== false;\n\n    }\n\n    public function xslTransform($xhtml, $xsl_file)\n    {\n        $xml = new \\DOMDocument();\n        @$xml->loadXML($xhtml);\n\n        $xsl = new \\DOMDocument();\n        $xsl->load($xsl_file);\n\n        $proc = new \\XSLTProcessor();\n        $proc->importStyleSheet($xsl); // attach the xsl rules\n\n        return $proc->transformToXML($xml);\n    }\n\n    public function cleanHtml($html)\n    {\n        $htmlCleaner = $this->getHtmlCleaner();\n\n        $cleanHtml = $htmlCleaner->clean($html);\n\n        return <<<EOF\n<html lang=\"en-US\" xmlns=\"http://www.w3.org/1999/xhtml\">\n<body>\n$cleanHtml\n</body>\n</html>\nEOF;\n    }\n\n    public function inlineCss($html, $css)\n    {\n        return $this->getCssInliner()->convert($html, $css);\n    }\n\n    public function convertRelativeToAbsoluteUrls($html)\n    {\n        return $html;\n    }\n\n    public function validateEnml($enml, $dtd)\n    {\n\n    }\n\n    public function getHtmlCleaner()\n    {\n        return $this->htmlCleaner;\n    }\n\n    public function getCssInliner()\n    {\n        return $this->cssInliner;\n    }\n\n    public function extractCssFromHtml($html)\n    {\n        $dom = new \\DOMDocument();\n        @$dom->loadHTML($html);\n\n        $links = $dom->getElementsByTagName('link');\n\n        $css = '';\n\n        foreach($links as $link)\n        {\n            foreach ($link->attributes as $attribute) {\n                if ($attribute->name === 'rel' && $attribute->value === 'stylesheet') {\n                    $css .= file_get_contents($link->getAttribute('href'));\n                }\n            }\n        }\n\n        return $css;\n    }\n} "
  },
  {
    "path": "src/Evernote/Enml/Converter/PlainTextToEnmlConverter.php",
    "content": "<?php\n\nnamespace Evernote\\Enml\\Converter;\n\nclass PlainTextToEnmlConverter implements EnmlConverterInterface\n{\n    public function convertToEnml($content)\n    {\n        return '<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n        <!DOCTYPE en-note SYSTEM \"http://xml.evernote.com/pub/enml2.dtd\">\n        <en-note>' . $content . '</en-note>';\n    }\n} "
  },
  {
    "path": "src/Evernote/Enml/Converter/enml2html.xslt",
    "content": "<?xml version=\"1.0\"?>\n<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">\n\n    <!-- https://gist.github.com/masatomo/273067 -->\n\n    <xsl:output method=\"html\"/>\n\n    <xsl:template match=\"en-note\">\n        <xsl:apply-templates/>\n    </xsl:template>\n\n    <xsl:template match=\"en-todo\">\n        <input type=\"checkbox\" value=\"1\" checked=\"{@checked}\"/>\n    </xsl:template>\n\n    <xsl:template match=\"en-crypt\">\n        <span title=\"{@hint}\" data=\"{text()}\">\n            ENCRYPTED (Hint: <xsl:value-of select=\"@hint\"/>)\n        </span>\n    </xsl:template>\n\n    <xsl:template match=\"en-media\">\n        <xsl:choose>\n            <xsl:when test=\"contains(@type, 'image/png')\">\n                <img>\n                    <xsl:attribute name=\"class\">attach_img</xsl:attribute>\n                    <xsl:attribute name=\"src\">\n                        <xsl:value-of select=\"concat('/images/', @hash, '.png')\"/>\n                    </xsl:attribute>\n                </img>\n            </xsl:when>\n            <xsl:when test=\"contains(@type, 'image/jpeg')\">\n                <img>\n                    <xsl:attribute name=\"class\">attach_img</xsl:attribute>\n                    <xsl:attribute name=\"src\">\n                        <xsl:value-of select=\"concat('/images/', @hash, '.jpg')\"/>\n                    </xsl:attribute>\n                </img>\n            </xsl:when>\n            <xsl:otherwise>\n                Unknown media:\n                <xsl:value-of select=\"@type\"/>\n            </xsl:otherwise>\n        </xsl:choose>\n    </xsl:template>\n\n    <!-- All the rest -->\n    <xsl:template match=\"* | @* | text()\">\n        <xsl:copy>\n            <xsl:apply-templates select=\"* | @* | text()\"/>\n        </xsl:copy>\n    </xsl:template>\n\n</xsl:stylesheet>"
  },
  {
    "path": "src/Evernote/Enml/Converter/html2enml.xslt",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:xhtml=\"http://www.w3.org/1999/xhtml\">\n\n    <xsl:output method=\"xml\" omit-xml-declaration=\"yes\" indent=\"yes\" />\n\n    <xsl:template match=\"/\">\n\n            <xsl:apply-templates select=\"xhtml:html/xhtml:body\"></xsl:apply-templates>\n\n    </xsl:template>\n\n\n\n    <xsl:template match=\"xhtml:html/xhtml:body\">\n        <xsl:apply-templates />\n    </xsl:template>\n\n    <xsl:template match=\"xhtml:div\">\n        <xsl:element name=\"{name()}\">\n            <xsl:copy-of select=\"@*[contains('|style|title|lang|xml:lang|dir|align|',\n                    concat('|', name(), '|')\n                    )]\" />\n            <xsl:apply-templates />\n        </xsl:element>\n    </xsl:template>\n\n\n    <xsl:template\n            match=\"xhtml:a|xhtml:abbr|xhtml:acronym|xhtml:address|xhtml:area|xhtml:b|xhtml:bdo|xhtml:big|xhtml:blockquote|xhtml:br|xhtml:caption|xhtml:center|xhtml:cite|xhtml:code|xhtml:col|xhtml:colgroup|xhtml:dd|xhtml:del|xhtml:dfn|xhtml:dl|xhtml:dt|xhtml:em|xhtml:en-crypt|xhtml:en-media|xhtml:en-todo|xhtml:font|xhtml:h1|xhtml:h2|xhtml:h3|xhtml:h4|xhtml:h5|xhtml:h6|xhtml:hr|xhtml:i|xhtml:img|xhtml:ins|xhtml:kbd|xhtml:li|xhtml:map|xhtml:ol|xhtml:p|xhtml:pre|xhtml:q|xhtml:s|xhtml:samp|xhtml:small|xhtml:span|xhtml:strike|xhtml:strong|xhtml:sub|xhtml:sup|xhtml:table|xhtml:tbody|xhtml:td|xhtml:tfoot|xhtml:th|xhtml:thead|xhtml:tr|xhtml:tt|xhtml:u|xhtml:ul|xhtml:var\">\n        <xsl:element name=\"{name()}\">\n            <xsl:copy-of select=\"@*[not(name() = 'class') and not(name() = 'id') and not(starts-with(name(), 'data')) and not(name() = 'onclick')]\" />\n            <xsl:apply-templates />\n        </xsl:element>\n    </xsl:template>\n\n    <!-- Container of en-media and others -->\n    <xsl:template match=\"embed\">\n        <en-media>\n            <xsl:copy-of select=\"@type\" />\n        </en-media>\n    </xsl:template>\n    <!-- Strip unknown text -->\n    <xsl:template match=\"*\">\n        <xsl:apply-templates />\n    </xsl:template>\n\n    <!-- Accept all text nodes -->\n    <xsl:template match=\"text()\">\n        <xsl:copy>\n            <xsl:copy-of select=\"@*\" />\n            <xsl:apply-templates />\n        </xsl:copy>\n    </xsl:template>\n\n</xsl:stylesheet>"
  },
  {
    "path": "src/Evernote/Enml/HtmlCleaner/HtmlCleanerInterface.php",
    "content": "<?php\n\nnamespace Evernote\\Enml\\HtmlCleaner;\n\ninterface HtmlCleanerInterface\n{\n    public function clean($html);\n} "
  },
  {
    "path": "src/Evernote/Enml/HtmlCleaner/HtmlPurifier.php",
    "content": "<?php\n\nnamespace Evernote\\Enml\\HtmlCleaner;\n\nclass HtmlPurifier implements HtmlCleanerInterface\n{\n    protected $htmlPurifier;\n\n    protected $config;\n\n    public function __construct(\\HTMLPurifier_Config $config = null)\n    {\n        $this->htmlPurifier = new \\HTMLPurifier();\n        if (null === $config) {\n            $config = \\HTMLPurifier_Config::createDefault();\n        }\n        $this->config = $config;\n    }\n\n    public function clean($html)\n    {\n        return $this->htmlPurifier->purify($html, $this->config);\n    }\n}"
  },
  {
    "path": "src/Evernote/Exception/AuthExpiredException.php",
    "content": "<?php\n\nnamespace Evernote\\Exception;\n\nclass AuthExpiredException extends \\Exception\n{\n    \n} "
  },
  {
    "path": "src/Evernote/Exception/AuthorizationDeniedException.php",
    "content": "<?php\n\nnamespace Evernote\\Exception;\n\nclass AuthorizationDeniedException extends \\Exception\n{\n    \n} "
  },
  {
    "path": "src/Evernote/Exception/BadDataFormatException.php",
    "content": "<?php\n\nnamespace Evernote\\Exception;\n\nclass BadDataFormatException extends \\Exception\n{\n\n} "
  },
  {
    "path": "src/Evernote/Exception/DataConflictException.php",
    "content": "<?php\n\nnamespace Evernote\\Exception;\n\nclass DataConflictException extends \\Exception\n{\n    \n} "
  },
  {
    "path": "src/Evernote/Exception/DataRequiredException.php",
    "content": "<?php\n\nnamespace Evernote\\Exception;\n\nclass DataRequiredException extends \\Exception\n{\n\n} "
  },
  {
    "path": "src/Evernote/Exception/EnmlValidationException.php",
    "content": "<?php\n\nnamespace Evernote\\Exception;\n\nclass EnmlValidationException extends \\Exception\n{\n\n} "
  },
  {
    "path": "src/Evernote/Exception/ExceptionFactory.php",
    "content": "<?php\n\nnamespace Evernote\\Exception;\n\nuse EDAM\\Error\\EDAMNotFoundException;\nuse EDAM\\Error\\EDAMSystemException;\nuse EDAM\\Error\\EDAMUserException;\n\nclass ExceptionFactory\n{\n    protected static $errorCodeMap = array(\n        1  => 'Unknown',\n        2  => 'BadDataFormat',\n        3  => 'PermissionDenied',\n        4  => 'InternalError',\n        5  => 'DataRequired',\n        6  => 'LimitReached',\n        7  => 'QuotaReached',\n        8  => 'InvalidAuth',\n        9  => 'AuthExpired',\n        10 => 'DataConflict',\n        11 => 'EnmlValidation',\n        12 => 'ShardUnavailable',\n        13 => 'LengthTooShort',\n        14 => 'LengthTooLong',\n        15 => 'TooFew',\n        16 => 'TooMany',\n        17 => 'UnsupportedOperation',\n        18 => 'TakenDown',\n        19 => 'RateLimitReached'\n    );\n\n    protected static $identifierMap = array(\n        'SharedNotebook.id' => 'NotFoundSharedNotebook',\n        'Note.guid'         => 'NotFoundNote',\n        'Note.notebookGuid' => 'NotFoundNotebook'\n    );\n\n    protected static $messageMap = array(\n        'shareKey'            => 'InvalidShareKey',\n        'authenticationToken' => 'InvalidAuth',\n    );\n\n    public static function create(\\Exception $e)\n    {\n        if ($e instanceof EDAMUserException) {\n            if (array_key_exists($e->errorCode, self::$errorCodeMap)) {\n                $class = __NAMESPACE__ . '\\\\' . self::$errorCodeMap[$e->errorCode] . 'Exception';\n\n                return new $class($e->parameter);\n            }\n\n            return $e;\n\n        } elseif ($e instanceof EDAMNotFoundException) {\n            if (array_key_exists($e->identifier, self::$identifierMap)) {\n                $class = __NAMESPACE__ . '\\\\' . self::$identifierMap[$e->identifier] . 'Exception';\n\n                return new $class($e->identifier . ' : ' . $e->key);\n            }\n\n            return $e;\n        } elseif ($e instanceof EDAMSystemException) {\n            if (array_key_exists($e->message, self::$messageMap)) {\n                $class = __NAMESPACE__ . '\\\\' . self::$messageMap[$e->message] . 'Exception';\n\n                return new $class($e->message);\n            }\n\n            return $e;\n        }\n\n        return $e;\n    }\n} "
  },
  {
    "path": "src/Evernote/Exception/InternalErrorException.php",
    "content": "<?php\n\nnamespace Evernote\\Exception;\n\nclass InternalErrorException extends \\Exception\n{\n\n} "
  },
  {
    "path": "src/Evernote/Exception/InvalidAuthException.php",
    "content": "<?php\n\nnamespace Evernote\\Exception;\n\nclass InvalidAuthException extends \\Exception\n{\n    \n} "
  },
  {
    "path": "src/Evernote/Exception/LengthTooLongException.php",
    "content": "<?php\n\nnamespace Evernote\\Exception;\n\nclass LengthTooLongException extends \\Exception\n{\n    \n} "
  },
  {
    "path": "src/Evernote/Exception/LengthTooShortException.php",
    "content": "<?php\n\nnamespace Evernote\\Exception;\n\nclass LengthTooShortException extends \\Exception\n{\n    \n} "
  },
  {
    "path": "src/Evernote/Exception/LimitReachedException.php",
    "content": "<?php\n\nnamespace Evernote\\Exception;\n\nclass LimitReachedException extends \\Exception\n{\n\n} "
  },
  {
    "path": "src/Evernote/Exception/NotFoundNoteException.php",
    "content": "<?php\n\nnamespace Evernote\\Exception;\n\nclass NotFoundNoteException extends \\Exception\n{\n\n} "
  },
  {
    "path": "src/Evernote/Exception/NotFoundNotebookException.php",
    "content": "<?php\n\nnamespace Evernote\\Exception;\n\nclass NotFoundNotebookException extends \\Exception\n{\n\n} "
  },
  {
    "path": "src/Evernote/Exception/NotFoundSharedNotebookException.php",
    "content": "<?php\n\nnamespace Evernote\\Exception;\n\nclass NotFoundSharedNotebookException extends \\Exception\n{}"
  },
  {
    "path": "src/Evernote/Exception/PermissionDeniedException.php",
    "content": "<?php\n\nnamespace Evernote\\Exception;\n\nclass PermissionDeniedException extends \\Exception\n{\n\n} "
  },
  {
    "path": "src/Evernote/Exception/QuotaReachedException.php",
    "content": "<?php\n\nnamespace Evernote\\Exception;\n\nclass QuotaReachedException extends \\Exception\n{\n    \n} "
  },
  {
    "path": "src/Evernote/Exception/RateLimitReachedException.php",
    "content": "<?php\n\nnamespace Evernote\\Exception;\n\nclass RateLimitReachedException extends \\Exception\n{\n    \n} "
  },
  {
    "path": "src/Evernote/Exception/ShardUnavailableException.php",
    "content": "<?php\n\nnamespace Evernote\\Exception;\n\nclass ShardUnavailableException extends \\Exception\n{\n    \n} "
  },
  {
    "path": "src/Evernote/Exception/TakenDownException.php",
    "content": "<?php\n\nnamespace Evernote\\Exception;\n\nclass TakenDownException extends \\Exception\n{\n    \n} "
  },
  {
    "path": "src/Evernote/Exception/TooFewException.php",
    "content": "<?php\n\nnamespace Evernote\\Exception;\n\nclass TooFewException extends \\Exception\n{\n    \n} "
  },
  {
    "path": "src/Evernote/Exception/TooManyException.php",
    "content": "<?php\n\nnamespace Evernote\\Exception;\n\nclass TooManyException extends \\Exception\n{\n    \n} "
  },
  {
    "path": "src/Evernote/Exception/UnknownException.php",
    "content": "<?php\n\nnamespace Evernote\\Exception;\n\nclass UnknownException extends \\Exception\n{\n\n} "
  },
  {
    "path": "src/Evernote/Exception/UnsupportedOperationException.php",
    "content": "<?php\n\nnamespace Evernote\\Exception;\n\nclass UnsupportedOperationException  extends \\Exception\n{\n    \n} "
  },
  {
    "path": "src/Evernote/Factory/ThriftClientFactory.php",
    "content": "<?php\n\nnamespace Evernote\\Factory;\n\nuse Thrift\\Transport\\THttpClient;\nuse Thrift\\Protocol\\TBinaryProtocol;\n\nclass ThriftClientFactory\n{\n    protected $typeList;\n\n    public function __construct()\n    {\n        $this->typeList = array('user', 'note');\n    }\n\n    public function createThriftClient($type, $url)\n    {\n        if (!in_array($type, $this->typeList)) {\n            throw new \\InvalidArgumentException(\"$type is not a valid client type.\");\n        }\n\n        $store = ucfirst($type) . 'Store';\n\n        $clientClass = '\\EDAM\\\\' . $store . '\\\\' . $store . 'Client';\n\n        $parts = parse_url($url);\n        if (!isset($parts['port'])) {\n            if ($parts['scheme'] === 'https') {\n                $parts['port'] = 443;\n            } else {\n                $parts['port'] = 80;\n            }\n        }\n\n        $httpClient = new THttpClient(\n            $parts['host'], $parts['port'], $parts['path'], $parts['scheme']);\n\n        $thriftProtocol = new TBinaryProtocol($httpClient);\n\n        return new $clientClass($thriftProtocol, $thriftProtocol);\n    }\n}"
  },
  {
    "path": "src/Evernote/File/File.php",
    "content": "<?php\n\nnamespace Evernote\\File;\n\nclass File extends \\SplFileObject implements FileInterface\n{\n    protected $mimeType;\n\n    protected $width;\n\n    protected $height;\n\n    protected $resizableMimeType = array(\n        'image/gif',\n        'image/jpeg',\n        'image/png',\n        'application/pdf'\n    );\n\n    public function __construct($path, $mime_type = null, $width = null, $height = null)\n    {\n        if (!is_file($path)) {\n            throw new \\Exception('File not found : ' . $path);\n        }\n\n        parent::__construct($path);\n\n        $this->findMimeType($path);\n        $this->mimeType = $mime_type ?: $this->findMimeType($path);\n\n        if (in_array($this->mimeType, $this->resizableMimeType)) {\n            $this->width  = $width;\n            $this->height = $height;\n        }\n    }\n\n    public function getContent()\n    {\n        $file_content = '';\n\n        while (!$this->eof()) {\n            $file_content .= $this->fgets();\n        }\n\n        return $file_content;\n    }\n\n    public function getMimeType()\n    {\n        return $this->mimeType;\n    }\n\n    /**\n     * @return mixed\n     */\n    public function getHeight()\n    {\n        return $this->height;\n    }\n\n    /**\n     * @return mixed\n     */\n    public function getWidth()\n    {\n        return $this->width;\n    }\n\n    /**\n     * Find the file's mime type.\n     *\n     * @return string\n     */\n    private function findMimeType($path)\n    {\n        $finfo = finfo_open(FILEINFO_MIME_TYPE);\n        $mime_type = finfo_file($finfo, $path);\n        finfo_close($finfo);\n\n        if (strpos($mime_type, ';') !== false) {\n            list($mime_type, $info) = explode(';', $mime_type);\n        }\n        \n        return trim($mime_type);\n    }\n}"
  },
  {
    "path": "src/Evernote/File/FileInterface.php",
    "content": "<?php\n\nnamespace Evernote\\File;\n\ninterface FileInterface\n{\n    public function getMimeType();\n    public function getFilename();\n    public function getContent();\n} "
  },
  {
    "path": "src/Evernote/Model/EnmlNoteContent.php",
    "content": "<?php\n\nnamespace Evernote\\Model;\n\nuse Evernote\\Enml\\Converter\\EnmlToHtmlConverter;\nuse Evernote\\Enml\\Converter\\HtmlConverterInterface;\n\nclass EnmlNoteContent extends NoteContent implements NoteContentInterface\n{\n    protected $htmlConverter;\n\n    public function __construct($content, HtmlConverterInterface $htmlConverter = null)\n    {\n        if (!$this->hasDoctypeDeclaration($content)) {\n            $content = $this->addDoctypeDeclaration($content);\n        }\n\n        if (!$this->hasXmlDeclaration($content)) {\n            $content = $this->addXmlDeclaration($content);\n        }\n\n        $this->content   = $content;\n        $this->htmlConverter = $htmlConverter;\n    }\n\n    public function getEnmlConverter()\n    {\n        return null;\n    }\n\n    public function getHtmlConverter()\n    {\n        if (null === $this->htmlConverter) {\n            $this->htmlConverter = new EnmlToHtmlConverter();\n        }\n\n        return $this->htmlConverter;\n    }\n\n    public function toEnml()\n    {\n        return $this->content;\n    }\n\n    public function __toString()\n    {\n        return $this->content;\n    }\n\n    public function toHtml()\n    {\n        $html = $this->getHtmlConverter()->convertToHtml($this->content);\n\n        return <<<HTLM\n<html><body>$html</body></html>\nHTLM;\n\n    }\n\n    protected function hasXmlDeclaration($content)\n    {\n        return substr(trim($content), 0, 5) == '<?xml';\n    }\n    \n    protected function hasDoctypeDeclaration($content)\n    {\n        return strpos($content, '<!DOCTYPE') !== false;\n    }\n    \n    protected function addXmlDeclaration($content)\n    {\n        return <<<ENML\n<?xml version='1.0' encoding='utf-8'?>\n$content\nENML;\n\n    }\n\n    protected function addDoctypeDeclaration($content)\n    {\n        return <<<ENML\n<!DOCTYPE en-note SYSTEM \"http://xml.evernote.com/pub/enml2.dtd\">\n<en-note>$content</en-note>\nENML;\n\n    }\n}\n"
  },
  {
    "path": "src/Evernote/Model/HtmlNoteContent.php",
    "content": "<?php\n\nnamespace Evernote\\Model;\n\nuse Evernote\\Enml\\Converter\\HtmlToEnmlConverter;\n\nclass HtmlNoteContent extends NoteContent implements NoteContentInterface\n{\n    protected $baseUrl;\n\n    public function getEnmlConverter()\n    {\n        if (null === $this->enmlConverter) {\n            $this->enmlConverter = new HtmlToEnmlConverter();\n        }\n\n        return $this->enmlConverter;\n    }\n\n    public function toEnml()\n    {\n        return $this->getEnmlConverter()->convertToEnml($this->content, $this->baseUrl);\n    }\n\n    public function setBaseUrl($base_url)\n    {\n        $this->baseUrl = $base_url;\n    }\n}"
  },
  {
    "path": "src/Evernote/Model/Note.php",
    "content": "<?php\n\nnamespace Evernote\\Model;\n\nuse EDAM\\Limits\\Constant;\nuse EDAM\\NoteStore\\NoteStoreClient;\nuse EDAM\\Types\\NoteAttributes;\nuse Evernote\\Helper\\EnmlConverterInterface;\n\nclass Note\n{\n    /** @var \\EDAM\\Types\\Note  */\n    protected $edamNote;\n\n    /** @var string */\n    protected $guid;\n\n    /** @var string  */\n    protected $title = '';\n\n    /** @var string  */\n    protected $tagNames = array();\n\n    /** @var string  */\n    protected $notebookGuid = '';\n\n    /** @var \\Evernote\\Model\\NoteContentInterface */\n    protected $content = '';\n\n    /** @var array */\n    protected $resources = array();\n\n    /** @var  \\EDAM\\Types\\NoteAttributes */\n    protected $attributes;\n\n    /** @var  \\EDAM\\Types\\NoteCreated */\n    protected $created;\n\n    /** @var  boolean */\n    protected $saved;\n\n    /** @var  string */\n    protected $authToken;\n\n    /** @var  \\EDAM\\NoteStore\\NoteStoreClient */\n    protected $noteStore;\n\n    public function __construct(\\EDAM\\Types\\Note $edamNote = null)\n    {\n        if (null !== $edamNote) {\n            $this->edamNote     = $edamNote;\n            $this->guid         = $edamNote->guid;\n            $this->notebookGuid = $edamNote->notebookGuid;\n            $this->title        = $edamNote->title;\n            $this->content      = new EnmlNoteContent($edamNote->content);\n            $this->resources    = $edamNote->resources;\n            $this->attributes   = $edamNote->attributes;\n            $this->created      = $edamNote->created;\n            $this->tagNames     = $edamNote->tagNames;\n        } else {\n            $this->attributes = new NoteAttributes();\n        }\n    }\n\n    public function __set($name, $value)\n    {\n        $method = 'set' . ucfirst($name);\n\n        if (method_exists($this, $method)) {\n\n            return $this->$method($value);\n        }\n    }\n\n    public function __get($name)\n    {\n        $method = 'get' . ucfirst($name);\n\n        if (method_exists($this, $method)) {\n\n            return $this->$method();\n        }\n    }\n\n    public function setContent($content)\n    {\n        if (false === $content instanceof NoteContentInterface) {\n            $content = new PlainTextNoteContent($content);\n        }\n\n        $this->content = $content->toEnml();\n\n        return $this;\n    }\n\n    public function validateForLimits()\n    {\n        $contentLength = strlen($this->getContent());\n        if ($contentLength > Constant::get('EDAM_NOTE_CONTENT_LEN_MAX')\n            || $contentLength < Constant::get('EDAM_NOTE_CONTENT_LEN_MIN')) {\n            return false;\n        }\n\n        return true;\n    }\n\n    /**\n     * @param string $title\n     */\n    public function setTitle($title)\n    {\n        $this->title = $title;\n    }\n\n    /**\n     * @return string\n     */\n    public function getTitle()\n    {\n        return $this->title;\n    }\n\n    /**\n     * @return \\Evernote\\Model\\NoteContentInterface\n     */\n    public function getContent()\n    {\n        return $this->content;\n    }\n\n    /**\n     * @return \\EDAM\\Types\\Note\n     */\n    public function getEdamNote()\n    {\n        return $this->edamNote;\n    }\n\n    /**\n     * @return string\n     */\n    public function getGuid()\n    {\n        return $this->guid;\n    }\n\n    public function setGuid($guid)\n    {\n        $this->guid = $guid;\n    }\n\n    public function getAttribute($attribute)\n    {\n        if (property_exists($this->attributes, $attribute)) {\n            return $this->attributes->$attribute;\n        }\n\n        return null;\n    }\n\n    public function setAttribute($attribute, $value)\n    {\n        $this->attributes->$attribute = $value;\n    }\n\n    public function getCreated()\n    {\n        return $this->created;\n    }\n\n    public function setCreated($value)\n    {\n        $this->created = $value;\n    }\n\n    public function getAttributes()\n    {\n        return $this->attributes;\n    }\n\n    public function isReminder()\n    {\n        return $this->getAttribute('reminderOrder') !== null;\n    }\n\n    public function setReminder($timestamp = null)\n    {\n        $this->setAttribute('reminderOrder', time());\n        $this->setAttribute('reminderTime', $timestamp * 1000);\n    }\n\n    public function clearReminder()\n    {\n        $this->setAttribute('reminderOrder', null);\n        $this->setAttribute('reminderTime', null);\n        $this->setAttribute('reminderDoneTime', null);\n    }\n\n    public function setAsDone()\n    {\n        $this->setAttribute('reminderDoneTime', time() * 1000);\n    }\n\n    public function isDone()\n    {\n        return $this->getAttribute('reminderDoneTime') !== null;\n    }\n\n    public function getReminderTime()\n    {\n        $reminder_time = $this->getAttribute('reminderTime');\n\n        if (null !== $reminder_time) {\n            $reminder_time = $reminder_time / 1000;\n        }\n\n        return $reminder_time;\n    }\n\n    public function getReminderDoneTime()\n    {\n        $reminder_done_time = $this->getAttribute('reminderDoneTime');\n\n        if (null !== $reminder_done_time) {\n            $reminder_done_time = $reminder_done_time / 1000;\n        }\n\n        return $reminder_done_time;\n    }\n\n    public function addResource(Resource $resource)\n    {\n        $this->resources[] = $resource->edamResource;\n    }\n\n    public function getResources()\n    {\n        return $this->resources;\n    }\n\n    public function getSaved()\n    {\n        return $this->saved;\n    }\n\n    public function setSaved($value)\n    {\n        $this->saved = $value;\n    }\n\n    public function getNotebookGuid()\n    {\n        return $this->notebookGuid;\n    }\n\n    public function getAuthToken()\n    {\n        return $this->authToken;\n    }\n\n    public function setAuthToken($authToken)\n    {\n        $this->authToken = $authToken;\n    }\n\n    public function setTagNames(array $tagNames)\n    {\n        $this->tagNames = $tagNames;\n    }\n\n    public function getTagNames()\n    {\n        return $this->tagNames;\n    }\n\n    /**\n     * @param \\EDAM\\NoteStore\\NoteStoreClient $noteStore\n     */\n    public function setNoteStore($noteStore)\n    {\n        $this->noteStore = $noteStore;\n    }\n\n    /**\n     * @return \\EDAM\\NoteStore\\NoteStoreClient\n     */\n    public function getNoteStore()\n    {\n        return $this->noteStore;\n    }\n\n\n}"
  },
  {
    "path": "src/Evernote/Model/NoteContent.php",
    "content": "<?php\n\nnamespace Evernote\\Model;\n\nuse Evernote\\Enml\\Converter\\EnmlConverterInterface;\n\nabstract class NoteContent\n{\n    /** @var  mixed */\n    protected $content;\n\n    /** @var \\Evernote\\Enml\\Converter\\EnmlConverterInterface  */\n    protected $enmlConverter;\n\n    public function __construct($content, EnmlConverterInterface $enmlConverter = null)\n    {\n        $this->content   = $content;\n        $this->enmlConverter = $enmlConverter;\n    }\n}"
  },
  {
    "path": "src/Evernote/Model/NoteContentInterface.php",
    "content": "<?php\n\nnamespace Evernote\\Model;\n\ninterface NoteContentInterface\n{\n    public function toEnml();\n\n    public function getEnmlConverter();\n}"
  },
  {
    "path": "src/Evernote/Model/Notebook.php",
    "content": "<?php\n\nnamespace Evernote\\Model;\n\nclass Notebook\n{\n    /** @var string  */\n    protected $name = '';\n\n    /** @var string  */\n    protected $guid;\n\n    /** @var bool  */\n    protected $allowsWriting = false;\n\n    /** @var bool  */\n    public $isShared = false;\n\n    /** @var bool  */\n    protected $isBusinessNotebook = false;\n\n    /** @var bool  */\n    protected $isOwnedByUser = false;\n\n    /** @var bool  */\n    protected $isDefaultNotebook = false;\n\n    /** @var  string */\n    protected $authToken;\n\n    /***********************************/\n\n    /** @var  \\EDAM\\Types\\Notebook */\n    protected $notebook;\n\n    /** @var  \\EDAM\\Types\\LinkedNotebook */\n    protected $linkedNotebook;\n\n    /** @var  \\EDAM\\Types\\SharedNotebook */\n    protected $sharedNotebook;\n\n    /** @var  bool  */\n    protected $isDefaultNotebookOverride = false;\n\n    /************************************/\n\n    public function __construct($notebook = null, $linkedNotebook = null, $sharedNotebook = null, $businessNotebook = null)\n    {\n        $this->notebook         = $notebook;\n        $this->linkedNotebook   = $linkedNotebook;\n        $this->sharedNotebook   = $sharedNotebook;\n        $this->businessNotebook = $businessNotebook;\n    }\n\n    public function __get($name)\n    {\n        $method = 'get' . ucfirst($name);\n\n        if (method_exists($this, $method)) {\n\n            return $this->$method();\n        }\n    }\n\n    public function __set($name, $value)\n    {\n        $method = 'set' . ucfirst($name);\n\n        if (method_exists($this, $method)) {\n\n            return $this->$method($value);\n        }\n    }\n\n    public function getEdamNotebook()\n    {\n        return $this->notebook;\n    }\n    \n    public function getName()\n    {\n        if (null !== $this->linkedNotebook) {\n            return $this->linkedNotebook->shareName;\n        }\n\n        if (null !== $this->notebook) {\n            return $this->notebook->name;\n        }\n\n        return $this->name;\n    }\n\n    public function isBusinessNotebook()\n    {\n       return $this->linkedNotebook !== null && $this->notebook !== null;\n    }\n\n    public function isLinkedNotebook()\n    {\n        return $this->linkedNotebook !== null;\n    }\n\n    public function isPublic()\n    {\n        return $this->isLinkedNotebook() && $this->linkedNotebook->shareKey === null;\n    }\n\n    public function isDefaultNotebook()\n    {\n        return $this->notebook !== null && $this->notebook->defaultNotebook;\n    }\n\n    public function getGuid()\n    {\n        if ($this->notebook !== null) {\n            return $this->notebook->guid;\n        }\n\n        if ($this->sharedNotebook !== null) {\n            return $this->sharedNotebook->notebookGuid;\n        }\n\n        return $this->guid;\n    }\n\n    public function setGuid($guid)\n    {\n        $this->guid = $guid;\n    }\n\n    public function getLinkedNotebook()\n    {\n        return $this->linkedNotebook;\n    }\n\n    public function getAuthToken()\n    {\n        return $this->authToken;\n    }\n\n    public function setAuthToken($authToken)\n    {\n        $this->authToken = $authToken;\n    }\n}\n"
  },
  {
    "path": "src/Evernote/Model/PlainTextNoteContent.php",
    "content": "<?php\n\nnamespace Evernote\\Model;\n\nuse Evernote\\Enml\\Converter\\PlainTextToEnmlConverter;\n\nclass PlainTextNoteContent extends NoteContent implements NoteContentInterface\n{\n    public function getEnmlConverter()\n    {\n        if (null === $this->enmlConverter) {\n            $this->enmlConverter = new PlainTextToEnmlConverter();\n        }\n\n        return $this->enmlConverter;\n    }\n\n    public function toEnml()\n    {\n        return $this->getEnmlConverter()->convertToEnml($this->content);\n    }\n}"
  },
  {
    "path": "src/Evernote/Model/Resource.php",
    "content": "<?php\n\nnamespace Evernote\\Model;\n\nuse EDAM\\Types\\Data;\nuse EDAM\\Types\\ResourceAttributes;\nuse Evernote\\File\\File;\nuse Evernote\\File\\FileInterface;\n\nclass Resource\n{\n    protected $file;\n\n    protected $edamResource;\n\n    protected $hash;\n\n    protected $mime;\n\n    protected $data;\n\n    protected $attributes;\n\n    public function __construct($file, $mime = null, $width = null, $height = null)\n    {\n        $this->file = $file;\n        if (!$file instanceof FileInterface) {\n            $this->file = new File($file, $mime, $width, $height);\n        }\n\n        $file_content = $this->file->getContent();\n        $this->hash = md5($file_content, 0);\n\n        $data           = new Data();\n        $data->size     = strlen($file_content);\n        $data->bodyHash = md5($file_content, 1);\n        $data->body     = $file_content;\n\n        $resource                       = new \\EDAM\\Types\\Resource();\n        $resource->mime                 = $this->file->getMimeType();\n        $resource->data                 = $data;\n        $resource->attributes           = new ResourceAttributes();\n        $resource->attributes->fileName = $this->file->getFilename();\n\n        $this->edamResource = $resource;\n        $this->mime         = $resource->mime;\n        $this->data         = $resource->data;\n        $this->attributes   = $resource->attributes;\n    }\n\n    public function __get($property)\n    {\n        if (property_exists($this, $property)) {\n            return $this->$property;\n        }\n    }\n\n    public function getEnmlMediaTag()\n    {\n        $tag = '<en-media type=\"%s\" hash=\"%s\"%s%s/>';\n\n        $width  = '';\n        $height = '';\n\n        if (null !== $this->file->getWidth()) {\n            $width = ' width=\"' . $this->file->getWidth() . '\"';\n        }\n\n        if (null !== $this->file->getHeight()) {\n            $width = ' height=\"' . $this->file->getHeight() . '\"';\n        }\n\n        return sprintf($tag, $this->mime, $this->hash, $width, $height);\n    }\n} "
  },
  {
    "path": "src/Evernote/Model/Search.php",
    "content": "<?php\n\nnamespace Evernote\\Model;\n\nclass Search \n{\n    protected $searchString;\n\n    public function __construct($searchString)\n    {\n        $this->searchString = $searchString;\n    }\n\n    /**\n     * @return mixed\n     */\n    public function getSearchString()\n    {\n        return $this->searchString;\n    }\n\n\n} "
  },
  {
    "path": "src/Evernote/Model/SearchResult.php",
    "content": "<?php\n\nnamespace Evernote\\Model;\n\nclass SearchResult\n{\n    public $guid;\n\n    public $type;\n\n    public $title;\n\n    public $created;\n\n    public $updated;\n} "
  },
  {
    "path": "src/Evernote/Store/Store.php",
    "content": "<?php\n\nnamespace Evernote\\Store;\n\nuse Evernote\\Factory\\ThriftClientFactory;\n\nclass Store\n{\n    /** @var \\Evernote\\Factory\\ThriftClientFactory  */\n    protected $thriftClientFactory;\n    protected $token;\n    protected $type;\n    protected $url;\n\n    public function __construct($thriftClientFactory, $token, $type, $url)\n    {\n        $this->thriftClientFactory = $thriftClientFactory;\n        $this->token               = $token;\n        $this->type                = $type;\n        $this->url                 = $url;\n    }\n\n    public function __call($name, $arguments)\n    {\n        $store = ucfirst($this->type) . 'Store';\n\n        $clientClass = '\\EDAM\\\\' . $store . '\\\\' . $store . 'Client';\n\n        $method = new \\ReflectionMethod($clientClass, $name);\n        $params = array();\n        foreach ($method->getParameters() as $param) {\n            $params[] = $param->name;\n        }\n\n        $client = $this->getThriftClient();\n\n        if (count($params) == count($arguments)) {\n            return call_user_func_array(array($client, $name), $arguments);\n        } elseif (in_array('authenticationToken', $params)) {\n            $newArgs = array();\n            foreach ($method->getParameters() as $idx=>$param) {\n                if ($param->name == 'authenticationToken') {\n                    $newArgs[] = $this->token;\n                }\n                if ($idx < count($arguments)) {\n                    $newArgs[] = $arguments[$idx];\n                }\n            }\n\n            return call_user_func_array(array($client, $name), $newArgs);\n        } else {\n            return call_user_func_array(array($client, $name), $arguments);\n        }\n    }\n\n    /**\n     * @return mixed\n     */\n    public function getToken()\n    {\n        return $this->token;\n    }\n\n    /**\n     * @param mixed $token\n     */\n    public function setToken($token)\n    {\n        $this->token = $token;\n    }\n\n    /**\n     * @param $type\n     * @param $url\n     * @return mixed\n     */\n    protected function getThriftClient()\n    {\n        return $this->getThriftClientFactory()->createThriftClient($this->type, $this->url);\n    }\n\n    /**\n     * @return ThriftClientFactory\n     */\n    public function getThriftClientFactory()\n    {\n        if (null === $this->thriftClientFactory) {\n            $this->thriftClientFactory = new ThriftClientFactory();\n        }\n\n        return $this->thriftClientFactory;\n    }\n\n}\n"
  },
  {
    "path": "src/Thrift/Base/TBase.php",
    "content": "<?php\n/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n *\n * @package thrift\n */\n\nnamespace Thrift\\Base;\n\nuse Thrift\\Type\\TType;\n\n/**\n * Base class from which other Thrift structs extend. This is so that we can\n * cut back on the size of the generated code which is turning out to have a\n * nontrivial cost just to load thanks to the wondrously abysmal implementation\n * of PHP. Note that code is intentionally duplicated in here to avoid making\n * function calls for every field or member of a container..\n */\nabstract class TBase {\n\n  static $tmethod = array(TType::BOOL   => 'Bool',\n                          TType::BYTE   => 'Byte',\n                          TType::I16    => 'I16',\n                          TType::I32    => 'I32',\n                          TType::I64    => 'I64',\n                          TType::DOUBLE => 'Double',\n                          TType::STRING => 'String');\n\n  abstract function read($input);\n\n  abstract function write($output);\n\n  public function __construct($spec=null, $vals=null) {\n    if (is_array($spec) && is_array($vals)) {\n      foreach ($spec as $fid => $fspec) {\n        $var = $fspec['var'];\n        if (isset($vals[$var])) {\n          $this->$var = $vals[$var];\n        }\n      }\n    }\n  }\n\n  public function __wakeup()\n  {\n    $this->__construct(get_object_vars($this));\n  }\n\n  private function _readMap(&$var, $spec, $input) {\n    $xfer = 0;\n    $ktype = $spec['ktype'];\n    $vtype = $spec['vtype'];\n    $kread = $vread = null;\n    if (isset(TBase::$tmethod[$ktype])) {\n      $kread = 'read'.TBase::$tmethod[$ktype];\n    } else {\n      $kspec = $spec['key'];\n    }\n    if (isset(TBase::$tmethod[$vtype])) {\n      $vread = 'read'.TBase::$tmethod[$vtype];\n    } else {\n      $vspec = $spec['val'];\n    }\n    $var = array();\n    $_ktype = $_vtype = $size = 0;\n    $xfer += $input->readMapBegin($_ktype, $_vtype, $size);\n    for ($i = 0; $i < $size; ++$i) {\n      $key = $val = null;\n      if ($kread !== null) {\n        $xfer += $input->$kread($key);\n      } else {\n        switch ($ktype) {\n        case TType::STRUCT:\n          $class = $kspec['class'];\n          $key = new $class();\n          $xfer += $key->read($input);\n          break;\n        case TType::MAP:\n          $xfer += $this->_readMap($key, $kspec, $input);\n          break;\n        case TType::LST:\n          $xfer += $this->_readList($key, $kspec, $input, false);\n          break;\n        case TType::SET:\n          $xfer += $this->_readList($key, $kspec, $input, true);\n          break;\n        }\n      }\n      if ($vread !== null) {\n        $xfer += $input->$vread($val);\n      } else {\n        switch ($vtype) {\n        case TType::STRUCT:\n          $class = $vspec['class'];\n          $val = new $class();\n          $xfer += $val->read($input);\n          break;\n        case TType::MAP:\n          $xfer += $this->_readMap($val, $vspec, $input);\n          break;\n        case TType::LST:\n          $xfer += $this->_readList($val, $vspec, $input, false);\n          break;\n        case TType::SET:\n          $xfer += $this->_readList($val, $vspec, $input, true);\n          break;\n        }\n      }\n      $var[$key] = $val;\n    }\n    $xfer += $input->readMapEnd();\n    return $xfer;\n  }\n\n  private function _readList(&$var, $spec, $input, $set=false) {\n    $xfer = 0;\n    $etype = $spec['etype'];\n    $eread = $vread = null;\n    if (isset(TBase::$tmethod[$etype])) {\n      $eread = 'read'.TBase::$tmethod[$etype];\n    } else {\n      $espec = $spec['elem'];\n    }\n    $var = array();\n    $_etype = $size = 0;\n    if ($set) {\n      $xfer += $input->readSetBegin($_etype, $size);\n    } else {\n      $xfer += $input->readListBegin($_etype, $size);\n    }\n    for ($i = 0; $i < $size; ++$i) {\n      $elem = null;\n      if ($eread !== null) {\n        $xfer += $input->$eread($elem);\n      } else {\n        $espec = $spec['elem'];\n        switch ($etype) {\n        case TType::STRUCT:\n          $class = $espec['class'];\n          $elem = new $class();\n          $xfer += $elem->read($input);\n          break;\n        case TType::MAP:\n          $xfer += $this->_readMap($elem, $espec, $input);\n          break;\n        case TType::LST:\n          $xfer += $this->_readList($elem, $espec, $input, false);\n          break;\n        case TType::SET:\n          $xfer += $this->_readList($elem, $espec, $input, true);\n          break;\n        }\n      }\n      if ($set) {\n        $var[$elem] = true;\n      } else {\n        $var []= $elem;\n      }\n    }\n    if ($set) {\n      $xfer += $input->readSetEnd();\n    } else {\n      $xfer += $input->readListEnd();\n    }\n    return $xfer;\n  }\n\n  protected function _read($class, $spec, $input) {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true) {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      if (isset($spec[$fid])) {\n        $fspec = $spec[$fid];\n        $var = $fspec['var'];\n        if ($ftype == $fspec['type']) {\n          $xfer = 0;\n          if (isset(TBase::$tmethod[$ftype])) {\n            $func = 'read'.TBase::$tmethod[$ftype];\n            $xfer += $input->$func($this->$var);\n          } else {\n            switch ($ftype) {\n            case TType::STRUCT:\n              $class = $fspec['class'];\n              $this->$var = new $class();\n              $xfer += $this->$var->read($input);\n              break;\n            case TType::MAP:\n              $xfer += $this->_readMap($this->$var, $fspec, $input);\n              break;\n            case TType::LST:\n              $xfer += $this->_readList($this->$var, $fspec, $input, false);\n              break;\n            case TType::SET:\n              $xfer += $this->_readList($this->$var, $fspec, $input, true);\n              break;\n            }\n          }\n        } else {\n          $xfer += $input->skip($ftype);\n        }\n      } else {\n        $xfer += $input->skip($ftype);\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  private function _writeMap($var, $spec, $output) {\n    $xfer = 0;\n    $ktype = $spec['ktype'];\n    $vtype = $spec['vtype'];\n    $kwrite = $vwrite = null;\n    if (isset(TBase::$tmethod[$ktype])) {\n      $kwrite = 'write'.TBase::$tmethod[$ktype];\n    } else {\n      $kspec = $spec['key'];\n    }\n    if (isset(TBase::$tmethod[$vtype])) {\n      $vwrite = 'write'.TBase::$tmethod[$vtype];\n    } else {\n      $vspec = $spec['val'];\n    }\n    $xfer += $output->writeMapBegin($ktype, $vtype, count($var));\n    foreach ($var as $key => $val) {\n      if (isset($kwrite)) {\n        $xfer += $output->$kwrite($key);\n      } else {\n        switch ($ktype) {\n        case TType::STRUCT:\n          $xfer += $key->write($output);\n          break;\n        case TType::MAP:\n          $xfer += $this->_writeMap($key, $kspec, $output);\n          break;\n        case TType::LST:\n          $xfer += $this->_writeList($key, $kspec, $output, false);\n          break;\n        case TType::SET:\n          $xfer += $this->_writeList($key, $kspec, $output, true);\n          break;\n        }\n      }\n      if (isset($vwrite)) {\n        $xfer += $output->$vwrite($val);\n      } else {\n        switch ($vtype) {\n        case TType::STRUCT:\n          $xfer += $val->write($output);\n          break;\n        case TType::MAP:\n          $xfer += $this->_writeMap($val, $vspec, $output);\n          break;\n        case TType::LST:\n          $xfer += $this->_writeList($val, $vspec, $output, false);\n          break;\n        case TType::SET:\n          $xfer += $this->_writeList($val, $vspec, $output, true);\n          break;\n        }\n      }\n    }\n    $xfer += $output->writeMapEnd();\n    return $xfer;\n  }\n\n  private function _writeList($var, $spec, $output, $set=false) {\n    $xfer = 0;\n    $etype = $spec['etype'];\n    $ewrite = null;\n    if (isset(TBase::$tmethod[$etype])) {\n      $ewrite = 'write'.TBase::$tmethod[$etype];\n    } else {\n      $espec = $spec['elem'];\n    }\n    if ($set) {\n      $xfer += $output->writeSetBegin($etype, count($var));\n    } else {\n      $xfer += $output->writeListBegin($etype, count($var));\n    }\n    foreach ($var as $key => $val) {\n      $elem = $set ? $key : $val;\n      if (isset($ewrite)) {\n        $xfer += $output->$ewrite($elem);\n      } else {\n        switch ($etype) {\n        case TType::STRUCT:\n          $xfer += $elem->write($output);\n          break;\n        case TType::MAP:\n          $xfer += $this->_writeMap($elem, $espec, $output);\n          break;\n        case TType::LST:\n          $xfer += $this->_writeList($elem, $espec, $output, false);\n          break;\n        case TType::SET:\n          $xfer += $this->_writeList($elem, $espec, $output, true);\n          break;\n        }\n      }\n    }\n    if ($set) {\n      $xfer += $output->writeSetEnd();\n    } else {\n      $xfer += $output->writeListEnd();\n    }\n    return $xfer;\n  }\n\n  protected function _write($class, $spec, $output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin($class);\n    foreach ($spec as $fid => $fspec) {\n      $var = $fspec['var'];\n      if ($this->$var !== null) {\n        $ftype = $fspec['type'];\n        $xfer += $output->writeFieldBegin($var, $ftype, $fid);\n        if (isset(TBase::$tmethod[$ftype])) {\n          $func = 'write'.TBase::$tmethod[$ftype];\n          $xfer += $output->$func($this->$var);\n        } else {\n          switch ($ftype) {\n          case TType::STRUCT:\n            $xfer += $this->$var->write($output);\n            break;\n          case TType::MAP:\n            $xfer += $this->_writeMap($this->$var, $fspec, $output);\n            break;\n          case TType::LST:\n            $xfer += $this->_writeList($this->$var, $fspec, $output, false);\n            break;\n          case TType::SET:\n            $xfer += $this->_writeList($this->$var, $fspec, $output, true);\n            break;\n          }\n        }\n        $xfer += $output->writeFieldEnd();\n      }\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n}\n"
  },
  {
    "path": "src/Thrift/ClassLoader/ThriftClassLoader.php",
    "content": "<?php\n/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n *\n * ClassLoader to load Thrift library and definitions\n * Inspired from UniversalClassLoader from Symfony 2 \n *\n * @package thrift.classloader\n */\n\nnamespace Thrift\\ClassLoader;\n\nclass ThriftClassLoader\n{\n    /**\n     * Namespaces path\n     * @var array\n     */\n    protected $namespaces = array();\n\n    /**\n     * Thrift definition paths\n     * @var type\n     */\n    protected $definitions = array();\n\n    /**\n     * Do we use APC cache ?\n     * @var boolean\n     */\n    protected $apc = false;\n\n    /**\n     * APC Cache prefix\n     * @var string\n     */\n    protected $apc_prefix;\n\n    /**\n     * Set autoloader to use APC cache\n     * @param boolean $apc\n     * @param string $apc_prefix\n     */\n    public function __construct($apc = false, $apc_prefix = null)\n    {\n        $this->apc = $apc;\n        $this->apc_prefix = $apc_prefix;\n    }\n\n    /**\n     * Registers a namespace.\n     *\n     * @param string       $namespace The namespace\n     * @param array|string $paths     The location(s) of the namespace\n     */\n    public function registerNamespace($namespace, $paths)\n    {\n        $this->namespaces[$namespace] = (array) $paths;\n    }\n\n    /**\n     * Registers a Thrift definition namespace.\n     *\n     * @param string       $namespace The definition namespace\n     * @param array|string $paths     The location(s) of the definition namespace\n     */\n    public function registerDefinition($namespace, $paths)\n    {\n        $this->definitions[$namespace] = (array) $paths;\n    }\n\n    /**\n     * Registers this instance as an autoloader.\n     *\n     * @param Boolean $prepend Whether to prepend the autoloader or not\n     */\n    public function register($prepend = false)\n    {\n        spl_autoload_register(array($this, 'loadClass'), true, $prepend);\n    }\n\n    /**\n     * Loads the given class, definition or interface.\n     *\n     * @param string $class The name of the class\n     */\n    public function loadClass($class)\n    {\n        if (\n            (true === $this->apc && ($file = $this->findFileInApc($class))) or\n            ($file = $this->findFile($class))\n        )\n        {\n            require_once $file;\n        }\n    }\n\n    /**\n     * Loads the given class or interface in APC.\n     * @param string $class The name of the class\n     * @return string\n     */\n    protected function findFileInApc($class)\n    {\n        if (false === $file = apc_fetch($this->apc_prefix.$class)) {\n            apc_store($this->apc_prefix.$class, $file = $this->findFile($class));\n        }\n\n        return $file;\n    }\n\n    /**\n     * Find class in namespaces or definitions directories\n     * @param string $class\n     * @return string\n     */\n    public function findFile($class)\n    {\n        // Remove first backslash\n        if ('\\\\' == $class[0])\n        {\n            $class = substr($class, 1);\n        }\n\n        if (false !== $pos = strrpos($class, '\\\\'))\n        {\n            // Namespaced class name\n            $namespace = substr($class, 0, $pos);\n\n            // Iterate in normal namespaces\n            foreach ($this->namespaces as $ns => $dirs)\n            {\n                //Don't interfere with other autoloaders\n                if (0 !== strpos($namespace, $ns))\n                {\n                    continue;\n                }\n\n                foreach ($dirs as $dir)\n                {\n                    $className = substr($class, $pos + 1);\n\n                    $file = $dir.DIRECTORY_SEPARATOR.\n                                 str_replace('\\\\', DIRECTORY_SEPARATOR, $namespace).\n                                 DIRECTORY_SEPARATOR.\n                                 $className.'.php';\n\n                    if (file_exists($file))\n                    {\n                        return $file;\n                    }\n                }\n            }\n\n            // Iterate in Thrift namespaces\n\n            // Remove first part of namespace\n            $m = explode('\\\\', $class);\n\n            // Ignore wrong call\n            if(count($m) <= 1)\n            {\n                return;\n            }\n\n            $class = array_pop($m);\n            $namespace = implode('\\\\', $m);\n\n            foreach ($this->definitions as $ns => $dirs)\n            {\n                //Don't interfere with other autoloaders\n                if (0 !== strpos($namespace, $ns))\n                {\n                    continue;\n                }\n\n                foreach ($dirs as $dir)\n                {\n                    /**\n                     * Available in service: Interface, Client, Processor, Rest\n                     * And every service methods (_.+)\n                     */\n                    if(\n                        0 === preg_match('#(.+)(if|client|processor|rest)$#i', $class, $n) and\n                        0 === preg_match('#(.+)_[a-z0-9]+_(args|result)$#i', $class, $n)\n                    )\n                    {\n                        $className = 'Types';\n                    }\n                    else\n                    {\n                        $className = $n[1];\n                    }\n\n                    $file = $dir.DIRECTORY_SEPARATOR .\n                                 str_replace('\\\\', DIRECTORY_SEPARATOR, $namespace) .\n                                 DIRECTORY_SEPARATOR .\n                                 $className . '.php';\n\n                    if (file_exists($file))\n                    {\n                        return $file;\n                    }\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "src/Thrift/Exception/TApplicationException.php",
    "content": "<?php\n/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n *\n * @package thrift\n */\n\nnamespace Thrift\\Exception;\n\nuse Thrift\\Exception\\TException;\nuse Thrift\\Type\\TType;\n\nclass TApplicationException extends TException {\n  static $_TSPEC =\n    array(1 => array('var' => 'message',\n                     'type' => TType::STRING),\n          2 => array('var' => 'code',\n                     'type' => TType::I32));\n\n  const UNKNOWN = 0;\n  const UNKNOWN_METHOD = 1;\n  const INVALID_MESSAGE_TYPE = 2;\n  const WRONG_METHOD_NAME = 3;\n  const BAD_SEQUENCE_ID = 4;\n  const MISSING_RESULT = 5;\n  const INTERNAL_ERROR = 6;\n  const PROTOCOL_ERROR = 7;\n  const INVALID_TRANSFORM = 8;\n  const INVALID_PROTOCOL = 9;\n  const UNSUPPORTED_CLIENT_TYPE = 10;\n\n  function __construct($message=null, $code=0) {\n    parent::__construct($message, $code);\n  }\n\n  public function read($output) {\n    return $this->_read('TApplicationException', self::$_TSPEC, $output);\n  }\n\n  public function write($output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin('TApplicationException');\n    if ($message = $this->getMessage()) {\n      $xfer += $output->writeFieldBegin('message', TType::STRING, 1);\n      $xfer += $output->writeString($message);\n      $xfer += $output->writeFieldEnd();\n    }\n    if ($code = $this->getCode()) {\n      $xfer += $output->writeFieldBegin('type', TType::I32, 2);\n      $xfer += $output->writeI32($code);\n      $xfer += $output->writeFieldEnd();\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n}\n"
  },
  {
    "path": "src/Thrift/Exception/TException.php",
    "content": "<?php\n/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n *\n * @package thrift\n */\n\nnamespace Thrift\\Exception;\n\nuse Thrift\\Type\\TType;\nuse Thrift\\Base\\TBase;\n\n/**\n * NOTE(mcslee): This currently contains a ton of duplicated code from TBase\n * because we need to save CPU cycles and this is not yet in an extension.\n * Ideally we'd multiply-inherit TException from both Exception and Base, but\n * that's not possible in PHP and there are no modules either, so for now we\n * apologetically take a trip to HackTown.\n *\n * Can be called with standard Exception constructor (message, code) or with\n * Thrift Base object constructor (spec, vals).\n *\n * @param mixed $p1 Message (string) or type-spec (array)\n * @param mixed $p2 Code (integer) or values (array)\n */\nclass TException extends \\Exception {\n  function __construct($p1=null, $p2=0) {\n    if (is_array($p1) && is_array($p2)) {\n      $spec = $p1;\n      $vals = $p2;\n      foreach ($spec as $fid => $fspec) {\n        $var = $fspec['var'];\n        if (isset($vals[$var])) {\n          $this->$var = $vals[$var];\n        }\n      }\n    } else {\n      parent::__construct($p1, $p2);\n    }\n  }\n\n  static $tmethod = array(TType::BOOL   => 'Bool',\n                          TType::BYTE   => 'Byte',\n                          TType::I16    => 'I16',\n                          TType::I32    => 'I32',\n                          TType::I64    => 'I64',\n                          TType::DOUBLE => 'Double',\n                          TType::STRING => 'String');\n\n  private function _readMap(&$var, $spec, $input) {\n    $xfer = 0;\n    $ktype = $spec['ktype'];\n    $vtype = $spec['vtype'];\n    $kread = $vread = null;\n    if (isset(TBase::$tmethod[$ktype])) {\n      $kread = 'read'.TBase::$tmethod[$ktype];\n    } else {\n      $kspec = $spec['key'];\n    }\n    if (isset(TBase::$tmethod[$vtype])) {\n      $vread = 'read'.TBase::$tmethod[$vtype];\n    } else {\n      $vspec = $spec['val'];\n    }\n    $var = array();\n    $_ktype = $_vtype = $size = 0;\n    $xfer += $input->readMapBegin($_ktype, $_vtype, $size);\n    for ($i = 0; $i < $size; ++$i) {\n      $key = $val = null;\n      if ($kread !== null) {\n        $xfer += $input->$kread($key);\n      } else {\n        switch ($ktype) {\n        case TType::STRUCT:\n          $class = $kspec['class'];\n          $key = new $class();\n          $xfer += $key->read($input);\n          break;\n        case TType::MAP:\n          $xfer += $this->_readMap($key, $kspec, $input);\n          break;\n        case TType::LST:\n          $xfer += $this->_readList($key, $kspec, $input, false);\n          break;\n        case TType::SET:\n          $xfer += $this->_readList($key, $kspec, $input, true);\n          break;\n        }\n      }\n      if ($vread !== null) {\n        $xfer += $input->$vread($val);\n      } else {\n        switch ($vtype) {\n        case TType::STRUCT:\n          $class = $vspec['class'];\n          $val = new $class();\n          $xfer += $val->read($input);\n          break;\n        case TType::MAP:\n          $xfer += $this->_readMap($val, $vspec, $input);\n          break;\n        case TType::LST:\n          $xfer += $this->_readList($val, $vspec, $input, false);\n          break;\n        case TType::SET:\n          $xfer += $this->_readList($val, $vspec, $input, true);\n          break;\n        }\n      }\n      $var[$key] = $val;\n    }\n    $xfer += $input->readMapEnd();\n    return $xfer;\n  }\n\n  private function _readList(&$var, $spec, $input, $set=false) {\n    $xfer = 0;\n    $etype = $spec['etype'];\n    $eread = $vread = null;\n    if (isset(TBase::$tmethod[$etype])) {\n      $eread = 'read'.TBase::$tmethod[$etype];\n    } else {\n      $espec = $spec['elem'];\n    }\n    $var = array();\n    $_etype = $size = 0;\n    if ($set) {\n      $xfer += $input->readSetBegin($_etype, $size);\n    } else {\n      $xfer += $input->readListBegin($_etype, $size);\n    }\n    for ($i = 0; $i < $size; ++$i) {\n      $elem = null;\n      if ($eread !== null) {\n        $xfer += $input->$eread($elem);\n      } else {\n        $espec = $spec['elem'];\n        switch ($etype) {\n        case TType::STRUCT:\n          $class = $espec['class'];\n          $elem = new $class();\n          $xfer += $elem->read($input);\n          break;\n        case TType::MAP:\n          $xfer += $this->_readMap($elem, $espec, $input);\n          break;\n        case TType::LST:\n          $xfer += $this->_readList($elem, $espec, $input, false);\n          break;\n        case TType::SET:\n          $xfer += $this->_readList($elem, $espec, $input, true);\n          break;\n        }\n      }\n      if ($set) {\n        $var[$elem] = true;\n      } else {\n        $var []= $elem;\n      }\n    }\n    if ($set) {\n      $xfer += $input->readSetEnd();\n    } else {\n      $xfer += $input->readListEnd();\n    }\n    return $xfer;\n  }\n\n  protected function _read($class, $spec, $input) {\n    $xfer = 0;\n    $fname = null;\n    $ftype = 0;\n    $fid = 0;\n    $xfer += $input->readStructBegin($fname);\n    while (true) {\n      $xfer += $input->readFieldBegin($fname, $ftype, $fid);\n      if ($ftype == TType::STOP) {\n        break;\n      }\n      if (isset($spec[$fid])) {\n        $fspec = $spec[$fid];\n        $var = $fspec['var'];\n        if ($ftype == $fspec['type']) {\n          $xfer = 0;\n          if (isset(TBase::$tmethod[$ftype])) {\n            $func = 'read'.TBase::$tmethod[$ftype];\n            $xfer += $input->$func($this->$var);\n          } else {\n            switch ($ftype) {\n            case TType::STRUCT:\n              $class = $fspec['class'];\n              $this->$var = new $class();\n              $xfer += $this->$var->read($input);\n              break;\n            case TType::MAP:\n              $xfer += $this->_readMap($this->$var, $fspec, $input);\n              break;\n            case TType::LST:\n              $xfer += $this->_readList($this->$var, $fspec, $input, false);\n              break;\n            case TType::SET:\n              $xfer += $this->_readList($this->$var, $fspec, $input, true);\n              break;\n            }\n          }\n        } else {\n          $xfer += $input->skip($ftype);\n        }\n      } else {\n        $xfer += $input->skip($ftype);\n      }\n      $xfer += $input->readFieldEnd();\n    }\n    $xfer += $input->readStructEnd();\n    return $xfer;\n  }\n\n  private function _writeMap($var, $spec, $output) {\n    $xfer = 0;\n    $ktype = $spec['ktype'];\n    $vtype = $spec['vtype'];\n    $kwrite = $vwrite = null;\n    if (isset(TBase::$tmethod[$ktype])) {\n      $kwrite = 'write'.TBase::$tmethod[$ktype];\n    } else {\n      $kspec = $spec['key'];\n    }\n    if (isset(TBase::$tmethod[$vtype])) {\n      $vwrite = 'write'.TBase::$tmethod[$vtype];\n    } else {\n      $vspec = $spec['val'];\n    }\n    $xfer += $output->writeMapBegin($ktype, $vtype, count($var));\n    foreach ($var as $key => $val) {\n      if (isset($kwrite)) {\n        $xfer += $output->$kwrite($key);\n      } else {\n        switch ($ktype) {\n        case TType::STRUCT:\n          $xfer += $key->write($output);\n          break;\n        case TType::MAP:\n          $xfer += $this->_writeMap($key, $kspec, $output);\n          break;\n        case TType::LST:\n          $xfer += $this->_writeList($key, $kspec, $output, false);\n          break;\n        case TType::SET:\n          $xfer += $this->_writeList($key, $kspec, $output, true);\n          break;\n        }\n      }\n      if (isset($vwrite)) {\n        $xfer += $output->$vwrite($val);\n      } else {\n        switch ($vtype) {\n        case TType::STRUCT:\n          $xfer += $val->write($output);\n          break;\n        case TType::MAP:\n          $xfer += $this->_writeMap($val, $vspec, $output);\n          break;\n        case TType::LST:\n          $xfer += $this->_writeList($val, $vspec, $output, false);\n          break;\n        case TType::SET:\n          $xfer += $this->_writeList($val, $vspec, $output, true);\n          break;\n        }\n      }\n    }\n    $xfer += $output->writeMapEnd();\n    return $xfer;\n  }\n\n  private function _writeList($var, $spec, $output, $set=false) {\n    $xfer = 0;\n    $etype = $spec['etype'];\n    $ewrite = null;\n    if (isset(TBase::$tmethod[$etype])) {\n      $ewrite = 'write'.TBase::$tmethod[$etype];\n    } else {\n      $espec = $spec['elem'];\n    }\n    if ($set) {\n      $xfer += $output->writeSetBegin($etype, count($var));\n    } else {\n      $xfer += $output->writeListBegin($etype, count($var));\n    }\n    foreach ($var as $key => $val) {\n      $elem = $set ? $key : $val;\n      if (isset($ewrite)) {\n        $xfer += $output->$ewrite($elem);\n      } else {\n        switch ($etype) {\n        case TType::STRUCT:\n          $xfer += $elem->write($output);\n          break;\n        case TType::MAP:\n          $xfer += $this->_writeMap($elem, $espec, $output);\n          break;\n        case TType::LST:\n          $xfer += $this->_writeList($elem, $espec, $output, false);\n          break;\n        case TType::SET:\n          $xfer += $this->_writeList($elem, $espec, $output, true);\n          break;\n        }\n      }\n    }\n    if ($set) {\n      $xfer += $output->writeSetEnd();\n    } else {\n      $xfer += $output->writeListEnd();\n    }\n    return $xfer;\n  }\n\n  protected function _write($class, $spec, $output) {\n    $xfer = 0;\n    $xfer += $output->writeStructBegin($class);\n    foreach ($spec as $fid => $fspec) {\n      $var = $fspec['var'];\n      if ($this->$var !== null) {\n        $ftype = $fspec['type'];\n        $xfer += $output->writeFieldBegin($var, $ftype, $fid);\n        if (isset(TBase::$tmethod[$ftype])) {\n          $func = 'write'.TBase::$tmethod[$ftype];\n          $xfer += $output->$func($this->$var);\n        } else {\n          switch ($ftype) {\n          case TType::STRUCT:\n            $xfer += $this->$var->write($output);\n            break;\n          case TType::MAP:\n            $xfer += $this->_writeMap($this->$var, $fspec, $output);\n            break;\n          case TType::LST:\n            $xfer += $this->_writeList($this->$var, $fspec, $output, false);\n            break;\n          case TType::SET:\n            $xfer += $this->_writeList($this->$var, $fspec, $output, true);\n            break;\n          }\n        }\n        $xfer += $output->writeFieldEnd();\n      }\n    }\n    $xfer += $output->writeFieldStop();\n    $xfer += $output->writeStructEnd();\n    return $xfer;\n  }\n\n}\n"
  },
  {
    "path": "src/Thrift/Exception/TProtocolException.php",
    "content": "<?php\n/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n *\n * @package thrift.protocol\n * @author: rmarin (marin.radu@facebook.com)\n */\n\nnamespace Thrift\\Exception;\n\nuse Thrift\\Exception\\TException;\n\n/**\n * Protocol module. Contains all the types and definitions needed to implement\n * a protocol encoder/decoder.\n *\n * @package thrift.protocol\n */\n\n/**\n * Protocol exceptions\n */\nclass TProtocolException extends TException {\n  const UNKNOWN = 0;\n  const INVALID_DATA = 1;\n  const NEGATIVE_SIZE = 2;\n  const SIZE_LIMIT = 3;\n  const BAD_VERSION = 4;\n\n  function __construct($message=null, $code=0) {\n    parent::__construct($message, $code);\n  }\n}\n"
  },
  {
    "path": "src/Thrift/Exception/TTransportException.php",
    "content": "<?php\n/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n *\n * @package thrift.transport\n */\n\nnamespace Thrift\\Exception;\n\nuse Thrift\\Exception\\TException;\n\n/**\n * Transport exceptions\n */\nclass TTransportException extends TException {\n\n  const UNKNOWN = 0;\n  const NOT_OPEN = 1;\n  const ALREADY_OPEN = 2;\n  const TIMED_OUT = 3;\n  const END_OF_FILE = 4;\n\n  function __construct($message=null, $code=0) {\n    parent::__construct($message, $code);\n  }\n}"
  },
  {
    "path": "src/Thrift/Factory/TBinaryProtocolFactory.php",
    "content": "<?php\n/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n *\n * @package thrift.protocol\n */\n\nnamespace Thrift\\Factory;\n\nuse Thrift\\Factory\\TProtocolFactory;\nuse Thrift\\Protocol\\TBinaryProtocol;\n\n/**\n * Binary Protocol Factory\n */\nclass TBinaryProtocolFactory implements TProtocolFactory {\n  private $strictRead_ = false;\n  private $strictWrite_ = false;\n\n  public function __construct($strictRead=false, $strictWrite=false) {\n    $this->strictRead_ = $strictRead;\n    $this->strictWrite_ = $strictWrite;\n  }\n\n  public function getProtocol($trans) {\n    return new TBinaryProtocol($trans, $this->strictRead_, $this->strictWrite_);\n  }\n}"
  },
  {
    "path": "src/Thrift/Factory/TCompactProtocolFactory.php",
    "content": "<?php\n/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n *\n * @package thrift.protocol\n */\n\nnamespace Thrift\\Factory;\n\nuse Thrift\\Factory\\TProtocolFactory;\nuse Thrift\\Protocol\\TCompactProtocol;\n\n/**\n * Compact Protocol Factory\n */\nclass TCompactProtocolFactory implements TProtocolFactory {\n\n  public function __construct() {\n  }\n\n  public function getProtocol($trans) {\n    return new TCompactProtocol($trans);\n  }\n}"
  },
  {
    "path": "src/Thrift/Factory/TJSONProtocolFactory.php",
    "content": "<?php\n/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n *\n * @package thrift.protocol\n */\n\nnamespace Thrift\\Factory;\n\nuse Thrift\\Factory\\TProtocolFactory;\nuse Thrift\\Protocol\\TJSONProtocol;\n\n/**\n * JSON Protocol Factory\n */\nclass TJSONProtocolFactory implements TProtocolFactory\n{\n    public function __construct()\n    {\n    }\n\n    public function getProtocol($trans)\n    {\n        return new TJSONProtocol($trans);\n    }\n}\n"
  },
  {
    "path": "src/Thrift/Factory/TProtocolFactory.php",
    "content": "<?php\n/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n *\n * @package thrift.protocol\n */\n\nnamespace Thrift\\Factory;\n\n/**\n * Protocol factory creates protocol objects from transports\n */\ninterface TProtocolFactory {\n  /**\n   * Build a protocol from the base transport\n   *\n   * @return Thrift\\Protocol\\TProtocol protocol\n   */\n  public function getProtocol($trans);\n}\n"
  },
  {
    "path": "src/Thrift/Factory/TStringFuncFactory.php",
    "content": "<?php\n/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n *\n */\n\nnamespace Thrift\\Factory;\n\nuse Thrift\\StringFunc\\Mbstring;\nuse Thrift\\StringFunc\\Core;\n\nclass TStringFuncFactory {\n    private static $_instance;\n\n    /**\n     * Get the Singleton instance of TStringFunc implementation that is\n     * compatible with the current system's mbstring.func_overload settings.\n     *\n     * @return TStringFunc\n     */\n    public static function create() {\n        if(!self::$_instance) {\n            self::_setInstance();\n        }\n\n        return self::$_instance;\n    }\n\n    private static function _setInstance() {\n        /**\n         * Cannot use str* functions for byte counting because multibyte\n         * characters will be read a single bytes.\n         *\n         * See: http://us.php.net/manual/en/mbstring.overload.php\n         */\n        if(ini_get('mbstring.func_overload') & 2) {\n            self::$_instance = new Mbstring();\n        }\n        /**\n         * mbstring is not installed or does not have function overloading\n         * of the str* functions enabled so use PHP core str* functions for\n         * byte counting.\n         */\n        else {\n            self::$_instance = new Core();\n        }\n    }\n}"
  },
  {
    "path": "src/Thrift/Factory/TTransportFactory.php",
    "content": "<?php\n\nnamespace Thrift\\Factory;\n\nuse Thrift\\Transport\\TTransport;\n\nclass TTransportFactory {\n  /**\n   * @static\n   * @param TTransport $transport\n   * @return TTransport\n   */\n  public static function getTransport(TTransport $transport) {\n    return $transport;\n  }\n}\n"
  },
  {
    "path": "src/Thrift/Protocol/JSON/BaseContext.php",
    "content": "<?php\n/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n *\n * @package thrift.protocol\n */\n\nnamespace Thrift\\Protocol\\JSON;\n\nclass BaseContext\n{\n    function escapeNum()\n    {\n        return false;\n    }\n\n    function write()\n    {\n    }\n\n    function read()\n    {\n    }\n}"
  },
  {
    "path": "src/Thrift/Protocol/JSON/ListContext.php",
    "content": "<?php\n/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n *\n * @package thrift.protocol\n */\n\nnamespace Thrift\\Protocol\\JSON;\n\nuse Thrift\\Protocol\\JSON\\BaseContext;\nuse Thrift\\Protocol\\TJSONProtocol;\n\nclass ListContext extends BaseContext\n{\n    private $first_ = true;\n    private $p_;\n\n    public function __construct($p) {\n        $this->p_ = $p;\n    }\n\n    public function write() {\n        if ($this->first_) {\n            $this->first_ = false;\n        } else {\n            $this->p_->getTransport()->write(TJSONProtocol::COMMA);\n        }\n    }\n\n    public function read() {\n        if ($this->first_) {\n            $this->first_ = false;\n        } else {\n            $this->p_->readJSONSyntaxChar(TJSONProtocol::COMMA);\n        }\n    }\n}"
  },
  {
    "path": "src/Thrift/Protocol/JSON/LookaheadReader.php",
    "content": "<?php\n/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n *\n * @package thrift.protocol\n */\n\nnamespace Thrift\\Protocol\\JSON;\n\nclass LookaheadReader\n{\n    private $hasData_ = false;\n    private $data_ = array();\n    private $p_;\n\n    public function __construct($p)\n    {\n        $this->p_ = $p;\n    }\n\n    public function read() {\n        if ($this->hasData_) {\n            $this->hasData_ = false;\n        } else {\n            $this->data_ = $this->p_->getTransport()->readAll(1);\n        }\n\n        return substr($this->data_, 0, 1);\n    }\n\n    public function peek() {\n        if (!$this->hasData_) {\n            $this->data_ = $this->p_->getTransport()->readAll(1);\n        }\n\n        $this->hasData_ = true;\n        return substr($this->data_, 0, 1);\n    }\n}"
  },
  {
    "path": "src/Thrift/Protocol/JSON/PairContext.php",
    "content": "<?php\n/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n *\n * @package thrift.protocol\n */\n\nnamespace Thrift\\Protocol\\JSON;\n\nuse Thrift\\Protocol\\JSON\\BaseContext;\nuse Thrift\\Protocol\\TJSONProtocol;\n\nclass PairContext extends BaseContext {\n    private $first_ = true;\n    private $colon_ = true;\n    private $p_ = null;\n\n    public function __construct($p) {\n        $this->p_ = $p;\n    }\n\n    public function write() {\n        if ($this->first_) {\n            $this->first_ = false;\n            $this->colon_ = true;\n        } else {\n            $this->p_->getTransport()->write($this->colon_ ? TJSONProtocol::COLON : TJSONProtocol::COMMA);\n            $this->colon_ = !$this->colon_;\n        }\n    }\n\n    public function read() {\n        if ($this->first_) {\n            $this->first_ = false;\n            $this->colon_ = true;\n        } else {\n            $this->p_->readJSONSyntaxChar($this->colon_ ? TJSONProtocol::COLON : TJSONProtocol::COMMA);\n            $this->colon_ = !$this->colon_;\n        }\n    }\n\n    public function escapeNum() {\n        return $this->colon_;\n    }\n}"
  },
  {
    "path": "src/Thrift/Protocol/TBinaryProtocol.php",
    "content": "<?php\n/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n *\n * @package thrift.protocol\n */\n\nnamespace Thrift\\Protocol;\n\nuse Thrift\\Protocol\\TProtocol;\nuse Thrift\\Type\\TType;\nuse Thrift\\Exception\\TProtocolException;\nuse Thrift\\Factory\\TStringFuncFactory;\n\n/**\n * Binary implementation of the Thrift protocol.\n *\n */\nclass TBinaryProtocol extends TProtocol {\n\n  const VERSION_MASK = 0xffff0000;\n  const VERSION_1 = 0x80010000;\n\n  protected $strictRead_ = false;\n  protected $strictWrite_ = true;\n\n  public function __construct($trans, $strictRead=false, $strictWrite=true) {\n    parent::__construct($trans);\n    $this->strictRead_ = $strictRead;\n    $this->strictWrite_ = $strictWrite;\n  }\n\n  public function writeMessageBegin($name, $type, $seqid) {\n    if ($this->strictWrite_) {\n      $version = self::VERSION_1 | $type;\n      return\n        $this->writeI32($version) +\n        $this->writeString($name) +\n        $this->writeI32($seqid);\n    } else {\n      return\n        $this->writeString($name) +\n        $this->writeByte($type) +\n        $this->writeI32($seqid);\n    }\n  }\n\n  public function writeMessageEnd() {\n    return 0;\n  }\n\n  public function writeStructBegin($name) {\n    return 0;\n  }\n\n  public function writeStructEnd() {\n    return 0;\n  }\n\n  public function writeFieldBegin($fieldName, $fieldType, $fieldId) {\n    return\n      $this->writeByte($fieldType) +\n      $this->writeI16($fieldId);\n  }\n\n  public function writeFieldEnd() {\n    return 0;\n  }\n\n  public function writeFieldStop() {\n    return\n      $this->writeByte(TType::STOP);\n  }\n\n  public function writeMapBegin($keyType, $valType, $size) {\n    return\n      $this->writeByte($keyType) +\n      $this->writeByte($valType) +\n      $this->writeI32($size);\n  }\n\n  public function writeMapEnd() {\n    return 0;\n  }\n\n  public function writeListBegin($elemType, $size) {\n    return\n      $this->writeByte($elemType) +\n      $this->writeI32($size);\n  }\n\n  public function writeListEnd() {\n    return 0;\n  }\n\n  public function writeSetBegin($elemType, $size) {\n    return\n      $this->writeByte($elemType) +\n      $this->writeI32($size);\n  }\n\n  public function writeSetEnd() {\n    return 0;\n  }\n\n  public function writeBool($value) {\n    $data = pack('c', $value ? 1 : 0);\n    $this->trans_->write($data, 1);\n    return 1;\n  }\n\n  public function writeByte($value) {\n    $data = pack('c', $value);\n    $this->trans_->write($data, 1);\n    return 1;\n  }\n\n  public function writeI16($value) {\n    $data = pack('n', $value);\n    $this->trans_->write($data, 2);\n    return 2;\n  }\n\n  public function writeI32($value) {\n    $data = pack('N', $value);\n    $this->trans_->write($data, 4);\n    return 4;\n  }\n\n  public function writeI64($value) {\n    // If we are on a 32bit architecture we have to explicitly deal with\n    // 64-bit twos-complement arithmetic since PHP wants to treat all ints\n    // as signed and any int over 2^31 - 1 as a float\n    if (PHP_INT_SIZE == 4) {\n      $neg = $value < 0;\n\n      if ($neg) {\n        $value *= -1;\n      }\n\n      $hi = (int)($value / 4294967296);\n      $lo = (int)$value;\n\n      if ($neg) {\n        $hi = ~$hi;\n        $lo = ~$lo;\n        if (($lo & (int)0xffffffff) == (int)0xffffffff) {\n          $lo = 0;\n          $hi++;\n        } else {\n          $lo++;\n        }\n      }\n      $data = pack('N2', $hi, $lo);\n\n    } else {\n      $hi = $value >> 32;\n      $lo = $value & 0xFFFFFFFF;\n      $data = pack('N2', $hi, $lo);\n    }\n\n    $this->trans_->write($data, 8);\n    return 8;\n  }\n\n  public function writeDouble($value) {\n    $data = pack('d', $value);\n    $this->trans_->write(strrev($data), 8);\n    return 8;\n  }\n\n  public function writeString($value) {\n    $len = TStringFuncFactory::create()->strlen($value);\n    $result = $this->writeI32($len);\n    if ($len) {\n      $this->trans_->write($value, $len);\n    }\n    return $result + $len;\n  }\n\n  public function readMessageBegin(&$name, &$type, &$seqid) {\n    $result = $this->readI32($sz);\n    if ($sz < 0) {\n      $version = (int) ($sz & self::VERSION_MASK);\n      if ($version != (int) self::VERSION_1) {\n        throw new TProtocolException('Bad version identifier: '.$sz, TProtocolException::BAD_VERSION);\n      }\n      $type = $sz & 0x000000ff;\n      $result +=\n        $this->readString($name) +\n        $this->readI32($seqid);\n    } else {\n      if ($this->strictRead_) {\n        throw new TProtocolException('No version identifier, old protocol client?', TProtocolException::BAD_VERSION);\n      } else {\n        // Handle pre-versioned input\n        $name = $this->trans_->readAll($sz);\n        $result +=\n          $sz +\n          $this->readByte($type) +\n          $this->readI32($seqid);\n      }\n    }\n    return $result;\n  }\n\n  public function readMessageEnd() {\n    return 0;\n  }\n\n  public function readStructBegin(&$name) {\n    $name = '';\n    return 0;\n  }\n\n  public function readStructEnd() {\n    return 0;\n  }\n\n  public function readFieldBegin(&$name, &$fieldType, &$fieldId) {\n    $result = $this->readByte($fieldType);\n    if ($fieldType == TType::STOP) {\n      $fieldId = 0;\n      return $result;\n    }\n    $result += $this->readI16($fieldId);\n    return $result;\n  }\n\n  public function readFieldEnd() {\n    return 0;\n  }\n\n  public function readMapBegin(&$keyType, &$valType, &$size) {\n    return\n      $this->readByte($keyType) +\n      $this->readByte($valType) +\n      $this->readI32($size);\n  }\n\n  public function readMapEnd() {\n    return 0;\n  }\n\n  public function readListBegin(&$elemType, &$size) {\n    return\n      $this->readByte($elemType) +\n      $this->readI32($size);\n  }\n\n  public function readListEnd() {\n    return 0;\n  }\n\n  public function readSetBegin(&$elemType, &$size) {\n    return\n      $this->readByte($elemType) +\n      $this->readI32($size);\n  }\n\n  public function readSetEnd() {\n    return 0;\n  }\n\n  public function readBool(&$value) {\n    $data = $this->trans_->readAll(1);\n    $arr = unpack('c', $data);\n    $value = $arr[1] == 1;\n    return 1;\n  }\n\n  public function readByte(&$value) {\n    $data = $this->trans_->readAll(1);\n    $arr = unpack('c', $data);\n    $value = $arr[1];\n    return 1;\n  }\n\n  public function readI16(&$value) {\n    $data = $this->trans_->readAll(2);\n    $arr = unpack('n', $data);\n    $value = $arr[1];\n    if ($value > 0x7fff) {\n      $value = 0 - (($value - 1) ^ 0xffff);\n    }\n    return 2;\n  }\n\n  public function readI32(&$value) {\n    $data = $this->trans_->readAll(4);\n    $arr = unpack('N', $data);\n    $value = $arr[1];\n    if ($value > 0x7fffffff) {\n      $value = 0 - (($value - 1) ^ 0xffffffff);\n    }\n    return 4;\n  }\n\n  public function readI64(&$value) {\n    $data = $this->trans_->readAll(8);\n\n    $arr = unpack('N2', $data);\n\n    // If we are on a 32bit architecture we have to explicitly deal with\n    // 64-bit twos-complement arithmetic since PHP wants to treat all ints\n    // as signed and any int over 2^31 - 1 as a float\n    if (PHP_INT_SIZE == 4) {\n\n      $hi = $arr[1];\n      $lo = $arr[2];\n      $isNeg = $hi  < 0;\n\n      // Check for a negative\n      if ($isNeg) {\n        $hi = ~$hi & (int)0xffffffff;\n        $lo = ~$lo & (int)0xffffffff;\n\n        if ($lo == (int)0xffffffff) {\n          $hi++;\n          $lo = 0;\n        } else {\n          $lo++;\n        }\n      }\n\n      // Force 32bit words in excess of 2G to pe positive - we deal wigh sign\n      // explicitly below\n\n      if ($hi & (int)0x80000000) {\n        $hi &= (int)0x7fffffff;\n        $hi += 0x80000000;\n      }\n\n      if ($lo & (int)0x80000000) {\n        $lo &= (int)0x7fffffff;\n        $lo += 0x80000000;\n      }\n\n      $value = $hi * 4294967296 + $lo;\n\n      if ($isNeg) {\n        $value = 0 - $value;\n      }\n    } else {\n\n      // Upcast negatives in LSB bit\n      if ($arr[2] & 0x80000000) {\n        $arr[2] = $arr[2] & 0xffffffff;\n      }\n\n      // Check for a negative\n      if ($arr[1] & 0x80000000) {\n        $arr[1] = $arr[1] & 0xffffffff;\n        $arr[1] = $arr[1] ^ 0xffffffff;\n        $arr[2] = $arr[2] ^ 0xffffffff;\n        $value = 0 - $arr[1]*4294967296 - $arr[2] - 1;\n      } else {\n        $value = $arr[1]*4294967296 + $arr[2];\n      }\n    }\n\n    return 8;\n  }\n\n  public function readDouble(&$value) {\n    $data = strrev($this->trans_->readAll(8));\n    $arr = unpack('d', $data);\n    $value = $arr[1];\n    return 8;\n  }\n\n  public function readString(&$value) {\n    $result = $this->readI32($len);\n    if ($len) {\n      $value = $this->trans_->readAll($len);\n    } else {\n      $value = '';\n    }\n    return $result + $len;\n  }\n}\n"
  },
  {
    "path": "src/Thrift/Protocol/TBinaryProtocolAccelerated.php",
    "content": "<?php\n/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n *\n * @package thrift.protocol\n */\n\nnamespace Thrift\\Protocol;\n\nuse Thrift\\Protocol\\TBinaryProtocol;\nuse Thrift\\Transport\\TBufferedTransport;\n\n/**\n * Accelerated binary protocol: used in conjunction with the thrift_protocol\n * extension for faster deserialization\n */\nclass TBinaryProtocolAccelerated extends TBinaryProtocol {\n  public function __construct($trans, $strictRead=false, $strictWrite=true) {\n    // If the transport doesn't implement putBack, wrap it in a\n    // TBufferedTransport (which does)\n    if (!method_exists($trans, 'putBack')) {\n      $trans = new TBufferedTransport($trans);\n    }\n    parent::__construct($trans, $strictRead, $strictWrite);\n  }\n  public function isStrictRead() {\n    return $this->strictRead_;\n  }\n  public function isStrictWrite() {\n    return $this->strictWrite_;\n  }\n}"
  },
  {
    "path": "src/Thrift/Protocol/TCompactProtocol.php",
    "content": "<?php\n/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n *\n * @package thrift.protocol\n */\n\nnamespace Thrift\\Protocol;\n\nuse Thrift\\Protocol\\TProtocol;\nuse Thrift\\Type\\TType;\nuse Thrift\\Exception\\TProtocolException;\nuse Thrift\\Factory\\TStringFuncFactory;\n\n/**\n * Compact implementation of the Thrift protocol.\n *\n */\nclass TCompactProtocol extends TProtocol {\n\n  const COMPACT_STOP = 0x00;\n  const COMPACT_TRUE = 0x01;\n  const COMPACT_FALSE = 0x02;\n  const COMPACT_BYTE = 0x03;\n  const COMPACT_I16 = 0x04;\n  const COMPACT_I32 = 0x05;\n  const COMPACT_I64 = 0x06;\n  const COMPACT_DOUBLE = 0x07;\n  const COMPACT_BINARY = 0x08;\n  const COMPACT_LIST = 0x09;\n  const COMPACT_SET = 0x0A;\n  const COMPACT_MAP = 0x0B;\n  const COMPACT_STRUCT = 0x0C;\n\n  const STATE_CLEAR = 0;\n  const STATE_FIELD_WRITE = 1;\n  const STATE_VALUE_WRITE = 2;\n  const STATE_CONTAINER_WRITE = 3;\n  const STATE_BOOL_WRITE = 4;\n  const STATE_FIELD_READ = 5;\n  const STATE_CONTAINER_READ = 6;\n  const STATE_VALUE_READ = 7;\n  const STATE_BOOL_READ = 8;\n\n  const VERSION_MASK = 0x1f;\n  const VERSION = 1;\n  const PROTOCOL_ID = 0x82;\n  const TYPE_MASK = 0xe0;\n  const TYPE_SHIFT_AMOUNT = 5;\n\n  protected static $ctypes = array(\n    TType::STOP => TCompactProtocol::COMPACT_STOP,\n    TType::BOOL => TCompactProtocol::COMPACT_TRUE, // used for collection\n    TType::BYTE => TCompactProtocol::COMPACT_BYTE,\n    TType::I16 => TCompactProtocol::COMPACT_I16,\n    TType::I32 => TCompactProtocol::COMPACT_I32,\n    TType::I64 => TCompactProtocol::COMPACT_I64,\n    TType::DOUBLE => TCompactProtocol::COMPACT_DOUBLE,\n    TType::STRING => TCompactProtocol::COMPACT_BINARY,\n    TType::STRUCT => TCompactProtocol::COMPACT_STRUCT,\n    TType::LST => TCompactProtocol::COMPACT_LIST,\n    TType::SET => TCompactProtocol::COMPACT_SET,\n    TType::MAP => TCompactProtocol::COMPACT_MAP,\n  );\n\n  protected static $ttypes = array(\n    TCompactProtocol::COMPACT_STOP => TType::STOP ,\n    TCompactProtocol::COMPACT_TRUE => TType::BOOL, // used for collection\n    TCompactProtocol::COMPACT_FALSE => TType::BOOL,\n    TCompactProtocol::COMPACT_BYTE => TType::BYTE,\n    TCompactProtocol::COMPACT_I16 => TType::I16,\n    TCompactProtocol::COMPACT_I32 => TType::I32,\n    TCompactProtocol::COMPACT_I64 => TType::I64,\n    TCompactProtocol::COMPACT_DOUBLE => TType::DOUBLE,\n    TCompactProtocol::COMPACT_BINARY => TType::STRING,\n    TCompactProtocol::COMPACT_STRUCT => TType::STRUCT,\n    TCompactProtocol::COMPACT_LIST => TType::LST,\n    TCompactProtocol::COMPACT_SET => TType::SET,\n    TCompactProtocol::COMPACT_MAP => TType::MAP,\n  );\n\n  protected $state = TCompactProtocol::STATE_CLEAR;\n  protected $lastFid = 0;\n  protected $boolFid = null;\n  protected $boolValue = null;\n  protected $structs = array();\n  protected $containers = array();\n\n  // Some varint / zigzag helper methods\n  public function toZigZag($n, $bits) {\n    return ($n << 1) ^ ($n >> ($bits - 1));\n  }\n\n  public function fromZigZag($n) {\n    return ($n >> 1) ^ -($n & 1);\n  }\n\n  public function getVarint($data) {\n    $out = \"\";\n    while (true) {\n      if (($data & ~0x7f) === 0) {\n        $out .= chr($data);\n        break;\n      } else {\n        $out .= chr(($data & 0xff) | 0x80);\n        $data = $data >> 7;\n      }\n    }\n    return $out;\n  }\n\n  public function writeVarint($data) {\n    $out = $this->getVarint($data);\n    $result = TStringFuncFactory::create()->strlen($out);\n    $this->trans_->write($out, $result);\n    return $result;\n  }\n\n  public function readVarint(&$result) {\n    $idx = 0;\n    $shift = 0;\n    $result = 0;\n    while (true) {\n      $x = $this->trans_->readAll(1);\n      $arr = unpack('C', $x);\n      $byte = $arr[1];\n      $idx += 1;\n      $result |= ($byte & 0x7f) << $shift;\n      if (($byte >> 7) === 0) {\n        return $idx;\n      }\n      $shift += 7;\n    }\n\n    return $idx;\n  }\n\n  public function __construct($trans) {\n    parent::__construct($trans);\n  }\n\n  public function writeMessageBegin($name, $type, $seqid) {\n    $written =\n      $this->writeUByte(TCompactProtocol::PROTOCOL_ID) +\n      $this->writeUByte(TCompactProtocol::VERSION |\n                        ($type << TCompactProtocol::TYPE_SHIFT_AMOUNT)) +\n      $this->writeVarint($seqid) +\n      $this->writeString($name);\n    $this->state = TCompactProtocol::STATE_VALUE_WRITE;\n    return $written;\n  }\n\n  public function writeMessageEnd() {\n    $this->state = TCompactProtocol::STATE_CLEAR;\n    return 0;\n  }\n\n  public function writeStructBegin($name) {\n    $this->structs[] = array($this->state, $this->lastFid);\n    $this->state = TCompactProtocol::STATE_FIELD_WRITE;\n    $this->lastFid = 0;\n    return 0;\n  }\n\n  public function writeStructEnd() {\n    $old_values = array_pop($this->structs);\n    $this->state = $old_values[0];\n    $this->lastFid = $old_values[1];\n    return 0;\n  }\n\n  public function writeFieldStop() {\n    return $this->writeByte(0);\n  }\n\n  public function writeFieldHeader($type, $fid) {\n    $written = 0;\n    $delta = $fid - $this->lastFid;\n    if (0 < $delta && $delta <= 15) {\n      $written = $this->writeUByte(($delta << 4) | $type);\n    } else {\n      $written = $this->writeByte($type) +\n        $this->writeI16($fid);\n    }\n    $this->lastFid = $fid;\n    return $written;\n  }\n\n  public function writeFieldBegin($field_name, $field_type, $field_id) {\n    if ($field_type == TTYPE::BOOL) {\n      $this->state = TCompactProtocol::STATE_BOOL_WRITE;\n      $this->boolFid = $field_id;\n      return 0;\n    } else {\n      $this->state = TCompactProtocol::STATE_VALUE_WRITE;\n      return $this->writeFieldHeader(self::$ctypes[$field_type], $field_id);\n    }\n  }\n\n  public function writeFieldEnd() {\n    $this->state = TCompactProtocol::STATE_FIELD_WRITE;\n    return 0;\n  }\n\n  public function writeCollectionBegin($etype, $size) {\n    $written = 0;\n    if ($size <= 14) {\n      $written = $this->writeUByte($size << 4 |\n                                    self::$ctypes[$etype]);\n    } else {\n      $written = $this->writeUByte(0xf0 |\n                                   self::$ctypes[$etype]) +\n        $this->writeVarint($size);\n    }\n    $this->containers[] = $this->state;\n    $this->state = TCompactProtocol::STATE_CONTAINER_WRITE;\n\n    return $written;\n  }\n\n  public function writeMapBegin($key_type, $val_type, $size) {\n    $written = 0;\n    if ($size == 0) {\n      $written = $this->writeByte(0);\n    } else {\n      $written = $this->writeVarint($size) +\n        $this->writeUByte(self::$ctypes[$key_type] << 4 |\n                          self::$ctypes[$val_type]);\n    }\n    $this->containers[] = $this->state;\n    return $written;\n  }\n\n  public function writeCollectionEnd() {\n    $this->state = array_pop($this->containers);\n    return 0;\n  }\n\n  public function writeMapEnd() {\n    return $this->writeCollectionEnd();\n  }\n\n  public function writeListBegin($elem_type, $size) {\n    return $this->writeCollectionBegin($elem_type, $size);\n  }\n\n  public function writeListEnd() {\n    return $this->writeCollectionEnd();\n  }\n\n  public function writeSetBegin($elem_type, $size) {\n    return $this->writeCollectionBegin($elem_type, $size);\n  }\n\n  public function writeSetEnd() {\n    return $this->writeCollectionEnd();\n  }\n\n  public function writeBool($value) {\n    if ($this->state == TCompactProtocol::STATE_BOOL_WRITE) {\n      $ctype = TCompactProtocol::COMPACT_FALSE;\n      if ($value) {\n        $ctype = TCompactProtocol::COMPACT_TRUE;\n      }\n      return $this->writeFieldHeader($ctype, $this->boolFid);\n    } else if ($this->state == TCompactProtocol::STATE_CONTAINER_WRITE) {\n      return $this->writeByte($value ? 1 : 0);\n    } else {\n      throw new TProtocolException('Invalid state in compact protocol');\n    }\n  }\n\n  public function writeByte($value) {\n    $data = pack('c', $value);\n    $this->trans_->write($data, 1);\n    return 1;\n  }\n\n  public function writeUByte($byte) {\n    $this->trans_->write(pack('C', $byte), 1);\n    return 1;\n  }\n\n  public function writeI16($value) {\n    $thing = $this->toZigZag($value, 16);\n    return $this->writeVarint($thing);\n  }\n\n  public function writeI32($value) {\n    $thing = $this->toZigZag($value, 32);\n    return $this->writeVarint($thing);\n  }\n\n  public function writeDouble($value) {\n    $data = pack('d', $value);\n    $this->trans_->write(strrev($data), 8);\n    return 8;\n  }\n\n  public function writeString($value) {\n    $len = TStringFuncFactory::create()->strlen($value);\n    $result = $this->writeVarint($len);\n    if ($len) {\n      $this->trans_->write($value, $len);\n    }\n    return $result + $len;\n  }\n\n  public function readFieldBegin(&$name, &$field_type, &$field_id) {\n    $result = $this->readUByte($field_type);\n\n    if (($field_type & 0x0f) == TType::STOP) {\n      $field_id = 0;\n      return $result;\n    }\n    $delta = $field_type >> 4;\n    if ($delta == 0) {\n      $result += $this->readI16($field_id);\n    } else {\n      $field_id = $this->lastFid + $delta;\n    }\n    $this->lastFid = $field_id;\n    $field_type = $this->getTType($field_type & 0x0f);\n    if ($field_type == TCompactProtocol::COMPACT_TRUE) {\n      $this->state = TCompactProtocol::STATE_BOOL_READ;\n      $this->boolValue = true;\n    } else if ($field_type == TCompactProtocol::COMPACT_FALSE) {\n      $this->state = TCompactProtocol::STATE_BOOL_READ;\n      $this->boolValue = false;\n    } else {\n      $this->state = TCompactProtocol::STATE_VALUE_READ;\n    }\n    return $result;\n  }\n\n  public function readFieldEnd() {\n    $this->state = TCompactProtocol::STATE_FIELD_READ;\n    return 0;\n  }\n\n  public function readUByte(&$value) {\n    $data = $this->trans_->readAll(1);\n    $arr = unpack('C', $data);\n    $value = $arr[1];\n    return 1;\n  }\n\n  public function readByte(&$value) {\n    $data = $this->trans_->readAll(1);\n    $arr = unpack('c', $data);\n    $value = $arr[1];\n    return 1;\n  }\n\n  public function readZigZag(&$value) {\n    $result = $this->readVarint($value);\n    $value = $this->fromZigZag($value);\n    return $result;\n  }\n\n  public function readMessageBegin(&$name, &$type, &$seqid) {\n    $protoId = 0;\n    $result = $this->readUByte($protoId);\n    if ($protoId != TCompactProtocol::PROTOCOL_ID) {\n      throw new TProtocolException('Bad protocol id in TCompact message');\n    }\n    $verType = 0;\n    $result += $this->readUByte($verType);\n    $type = ($verType & TCompactProtocol::TYPE_MASK) >>\n      TCompactProtocol::TYPE_SHIFT_AMOUNT;\n    $version = $verType & TCompactProtocol::VERSION_MASK;\n    if ($version != TCompactProtocol::VERSION) {\n      throw new TProtocolException('Bad version in TCompact message');\n    }\n    $result += $this->readVarint($seqId);\n    $name += $this->readString($name);\n\n    return $result;\n  }\n\n  public function readMessageEnd() {\n    return 0;\n  }\n\n  public function readStructBegin(&$name) {\n    $name = ''; // unused\n    $this->structs[] = array($this->state, $this->lastFid);\n    $this->state = TCompactProtocol::STATE_FIELD_READ;\n    $this->lastFid = 0;\n    return 0;\n  }\n\n  public function readStructEnd() {\n    $last = array_pop($this->structs);\n    $this->state = $last[0];\n    $this->lastFid = $last[1];\n    return 0;\n  }\n\n  public function readCollectionBegin(&$type, &$size) {\n    $sizeType = 0;\n    $result = $this->readUByte($sizeType);\n    $size = $sizeType >> 4;\n    $type = $this->getTType($sizeType);\n    if ($size == 15) {\n      $result += $this->readVarint($size);\n    }\n    $this->containers[] = $this->state;\n    $this->state = TCompactProtocol::STATE_CONTAINER_READ;\n\n    return $result;\n  }\n\n  public function readMapBegin(&$key_type, &$val_type, &$size) {\n    $result = $this->readVarint($size);\n    $types = 0;\n    if ($size > 0) {\n      $result += $this->readUByte($types);\n    }\n    $val_type = $this->getTType($types);\n    $key_type = $this->getTType($types >> 4);\n    $this->containers[] = $this->state;\n    $this->state = TCompactProtocol::STATE_CONTAINER_READ;\n\n    return $result;\n  }\n\n  public function readCollectionEnd() {\n    $this->state = array_pop($this->containers);\n    return 0;\n  }\n\n  public function readMapEnd() {\n    return $this->readCollectionEnd();\n  }\n\n  public function readListBegin(&$elem_type, &$size) {\n    return $this->readCollectionBegin($elem_type, $size);\n  }\n\n  public function readListEnd() {\n    return $this->readCollectionEnd();\n  }\n\n  public function readSetBegin(&$elem_type, &$size) {\n    return $this->readCollectionBegin($elem_type, $size);\n  }\n\n  public function readSetEnd() {\n    return $this->readCollectionEnd();\n  }\n\n  public function readBool(&$value) {\n    if ($this->state == TCompactProtocol::STATE_BOOL_READ) {\n      $value = $this->boolValue;\n      return 0;\n    } else if ($this->state == TCompactProtocol::STATE_CONTAINER_READ) {\n      return $this->readByte($value);\n    } else {\n      throw new TProtocolException('Invalid state in compact protocol');\n    }\n  }\n\n  public function readI16(&$value) {\n    return $this->readZigZag($value);\n  }\n\n  public function readI32(&$value) {\n    return $this->readZigZag($value);\n  }\n\n  public function readDouble(&$value) {\n    $data = strrev($this->trans_->readAll(8));\n    $arr = unpack('d', $data);\n    $value = $arr[1];\n    return 8;\n  }\n\n  public function readString(&$value) {\n    $result = $this->readVarint($len);\n    if ($len) {\n      $value = $this->trans_->readAll($len);\n    } else {\n      $value = '';\n    }\n    return $result + $len;\n  }\n\n  public function getTType($byte) {\n    return self::$ttypes[$byte & 0x0f];\n  }\n\n  // If we are on a 32bit architecture we have to explicitly deal with\n  // 64-bit twos-complement arithmetic since PHP wants to treat all ints\n  // as signed and any int over 2^31 - 1 as a float\n\n  // Read and write I64 as two 32 bit numbers $hi and $lo\n\n  public function readI64(&$value) {\n    // Read varint from wire\n    $hi = 0;\n    $lo = 0;\n\n    $idx = 0;\n    $shift = 0;\n\n    while (true) {\n      $x = $this->trans_->readAll(1);\n      $arr = unpack('C', $x);\n      $byte = $arr[1];\n      $idx += 1;\n      if ($shift < 32) {\n        $lo |= (($byte & 0x7f) << $shift) &\n          0x00000000ffffffff;\n      }\n      // Shift hi and lo together.\n      if ($shift >= 32) {\n        $hi |= (($byte & 0x7f) << ($shift - 32));\n      } else if ($shift > 25) {\n        $hi |= (($byte & 0x7f) >> ($shift - 25));\n      }\n      if (($byte >> 7) === 0) {\n        break;\n      }\n      $shift += 7;\n    }\n\n    // Now, unzig it.\n    $xorer = 0;\n    if ($lo & 1) {\n      $xorer = 0xffffffff;\n    }\n    $lo = ($lo >> 1) & 0x7fffffff;\n    $lo = $lo | (($hi & 1) << 31);\n    $hi = ($hi >> 1) ^ $xorer;\n    $lo = $lo ^ $xorer;\n\n    // Now put $hi and $lo back together\n    if (true) {\n      $isNeg = $hi  < 0;\n\n      // Check for a negative\n      if ($isNeg) {\n        $hi = ~$hi & (int)0xffffffff;\n        $lo = ~$lo & (int)0xffffffff;\n\n        if ($lo == (int)0xffffffff) {\n          $hi++;\n          $lo = 0;\n        } else {\n          $lo++;\n        }\n      }\n\n      // Force 32bit words in excess of 2G to be positive - we deal with sign\n      // explicitly below\n\n      if ($hi & (int)0x80000000) {\n        $hi &= (int)0x7fffffff;\n        $hi += 0x80000000;\n      }\n\n      if ($lo & (int)0x80000000) {\n        $lo &= (int)0x7fffffff;\n        $lo += 0x80000000;\n      }\n\n      $value = $hi * 4294967296 + $lo;\n\n      if ($isNeg) {\n        $value = 0 - $value;\n      }\n    } else {\n\n      // Upcast negatives in LSB bit\n      if ($arr[2] & 0x80000000) {\n        $arr[2] = $arr[2] & 0xffffffff;\n      }\n\n      // Check for a negative\n      if ($arr[1] & 0x80000000) {\n        $arr[1] = $arr[1] & 0xffffffff;\n        $arr[1] = $arr[1] ^ 0xffffffff;\n        $arr[2] = $arr[2] ^ 0xffffffff;\n        $value = 0 - $arr[1] * 4294967296 - $arr[2] - 1;\n      } else {\n        $value = $arr[1] * 4294967296 + $arr[2];\n      }\n    }\n\n    return $idx;\n  }\n\n  public function writeI64($value) {\n    // If we are in an I32 range, use the easy method below.\n    if (($value > 4294967296) || ($value < -4294967296)) {\n      // Convert $value to $hi and $lo\n      $neg = $value < 0;\n\n      if ($neg) {\n        $value *= -1;\n      }\n\n      $hi = (int)$value >> 32;\n      $lo = (int)$value & 0xffffffff;\n\n      if ($neg) {\n        $hi = ~$hi;\n        $lo = ~$lo;\n        if (($lo & (int)0xffffffff) == (int)0xffffffff) {\n          $lo = 0;\n          $hi++;\n        } else {\n          $lo++;\n        }\n      }\n\n      // Now do the zigging and zagging.\n      $xorer = 0;\n      if ($neg) {\n        $xorer = 0xffffffff;\n      }\n      $lowbit = ($lo >> 31) & 1;\n      $hi = ($hi << 1) | $lowbit;\n      $lo = ($lo << 1);\n      $lo = ($lo ^ $xorer) & 0xffffffff;\n      $hi = ($hi ^ $xorer) & 0xffffffff;\n\n      // now write out the varint, ensuring we shift both hi and lo\n      $out = \"\";\n      while (true) {\n        if (($lo & ~0x7f) === 0 &&\n           $hi === 0) {\n          $out .= chr($lo);\n          break;\n        } else {\n          $out .= chr(($lo & 0xff) | 0x80);\n          $lo = $lo >> 7;\n          $lo = $lo | ($hi << 25);\n          $hi = $hi >> 7;\n          // Right shift carries sign, but we don't want it to.\n          $hi = $hi & (127 << 25);\n        }\n      }\n\n      $ret = TStringFuncFactory::create()->strlen($out);\n      $this->trans_->write($out, $ret);\n\n      return $ret;\n    } else {\n      return $this->writeVarint($this->toZigZag($value, 64));\n    }\n  }\n}\n"
  },
  {
    "path": "src/Thrift/Protocol/TJSONProtocol.php",
    "content": "<?php\n\n/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n *\n * @package thrift.protocol\n */\n\nnamespace Thrift\\Protocol;\n\nuse Thrift\\Protocol\\TProtocol;\nuse Thrift\\Type\\TType;\nuse Thrift\\Exception\\TProtocolException;\nuse Thrift\\Protocol\\JSON\\BaseContext;\nuse Thrift\\Protocol\\JSON\\LookaheadReader;\nuse Thrift\\Protocol\\JSON\\PairContext;\nuse Thrift\\Protocol\\JSON\\ListContext;\n\n/**\n * JSON implementation of thrift protocol, ported from Java.\n */\nclass TJSONProtocol extends TProtocol\n{\n    const COMMA = ',';\n    const COLON = ':';\n    const LBRACE = '{';\n    const RBRACE = '}';\n    const LBRACKET = '[';\n    const RBRACKET = ']';\n    const QUOTE = '\"';\n    const BACKSLASH = '\\\\';\n    const ZERO = '0';\n    const ESCSEQ = '\\\\';\n    const DOUBLEESC = '__DOUBLE_ESCAPE_SEQUENCE__';\n\n    const VERSION = 1;\n\n    public static $JSON_CHAR_TABLE = array(\n        /*  0   1   2   3   4   5   6   7   8   9   A   B   C   D   E   F */\n        0, 0, 0, 0, 0, 0, 0, 0, 'b', 't', 'n', 0, 'f', 'r', 0, 0, // 0\n        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1\n        1, 1, '\"', 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 2\n    );\n\n    public static $ESCAPE_CHARS = array('\"', '\\\\', \"b\", \"f\", \"n\", \"r\", \"t\");\n\n    public static $ESCAPE_CHAR_VALS = array(\n        '\"', '\\\\', \"\\x08\", \"\\f\", \"\\n\", \"\\r\", \"\\t\",\n    );\n\n    const NAME_BOOL = \"tf\";\n    const NAME_BYTE = \"i8\";\n    const NAME_I16 = \"i16\";\n    const NAME_I32 = \"i32\";\n    const NAME_I64 = \"i64\";\n    const NAME_DOUBLE = \"dbl\";\n    const NAME_STRUCT = \"rec\";\n    const NAME_STRING = \"str\";\n    const NAME_MAP = \"map\";\n    const NAME_LIST = \"lst\";\n    const NAME_SET = \"set\";\n\n    private function getTypeNameForTypeID($typeID)\n    {\n        switch ($typeID) {\n            case TType::BOOL:\n                return self::NAME_BOOL;\n            case TType::BYTE:\n                return self::NAME_BYTE;\n            case TType::I16:\n                return self::NAME_I16;\n            case TType::I32:\n                return self::NAME_I32;\n            case TType::I64:\n                return self::NAME_I64;\n            case TType::DOUBLE:\n                return self::NAME_DOUBLE;\n            case TType::STRING:\n                return self::NAME_STRING;\n            case TType::STRUCT:\n                return self::NAME_STRUCT;\n            case TType::MAP:\n                return self::NAME_MAP;\n            case TType::SET:\n                return self::NAME_SET;\n            case TType::LST:\n                return self::NAME_LIST;\n            default:\n                throw new TProtocolException(\"Unrecognized type\", TProtocolException::UNKNOWN);\n        }\n    }\n\n    private function getTypeIDForTypeName($name)\n    {\n        $result = TType::STOP;\n\n        if (strlen($name) > 1) {\n            switch (substr($name, 0, 1)) {\n                case 'd':\n                    $result = TType::DOUBLE;\n                    break;\n                case 'i':\n                    switch (substr($name, 1, 1)) {\n                        case '8':\n                            $result = TType::BYTE;\n                            break;\n                        case '1':\n                            $result = TType::I16;\n                            break;\n                        case '3':\n                            $result = TType::I32;\n                            break;\n                        case '6':\n                            $result = TType::I64;\n                            break;\n                    }\n                    break;\n                case 'l':\n                    $result = TType::LST;\n                    break;\n                case 'm':\n                    $result = TType::MAP;\n                    break;\n                case 'r':\n                    $result = TType::STRUCT;\n                    break;\n                case 's':\n                    if (substr($name, 1, 1) == 't') {\n                        $result = TType::STRING;\n                    }\n                    else if (substr($name, 1, 1) == 'e') {\n                        $result = TType::SET;\n                    }\n                    break;\n                case 't':\n                    $result = TType::BOOL;\n                    break;\n            }\n        }\n        if ($result == TType::STOP) {\n            throw new TProtocolException(\"Unrecognized type\", TProtocolException::INVALID_DATA);\n        }\n        return $result;\n    }\n\n    public $contextStack_ = array();\n    public $context_;\n    public $reader_;\n\n    private function pushContext($c) {\n        array_push($this->contextStack_, $this->context_);\n        $this->context_ = $c;\n    }\n\n    private function popContext() {\n        $this->context_ = array_pop($this->contextStack_);\n    }\n\n    public function __construct($trans) {\n        parent::__construct($trans);\n        $this->context_ = new BaseContext();\n        $this->reader_ = new LookaheadReader($this);\n    }\n\n    public function reset() {\n        $this->contextStack_ = array();\n        $this->context_ = new BaseContext();\n        $this->reader_ = new LookaheadReader($this);\n    }\n\n    private $tmpbuf_ = array(4);\n\n    public function readJSONSyntaxChar($b) {\n        $ch = $this->reader_->read();\n\n        if (substr($ch, 0, 1) != $b) {\n            throw new TProtocolException(\"Unexpected character: \" . $ch, TProtocolException::INVALID_DATA);\n        }\n    }\n\n    private function hexVal($s) {\n        for ($i = 0; $i < strlen($s); $i++) {\n            $ch = substr($s, $i, 1);\n\n            if (!($ch >= \"a\" && $ch <= \"f\") && !($ch >= \"0\" && $ch <= \"9\")) {\n                throw new TProtocolException(\"Expected hex character \" . $ch, TProtocolException::INVALID_DATA);\n            }\n        }\n\n        return hexdec($s);\n    }\n\n    private function hexChar($val) {\n        return dechex($val);\n    }\n\n    private function writeJSONString($b) {\n        $this->context_->write();\n\n        if (is_numeric($b) && $this->context_->escapeNum()) {\n            $this->trans_->write(self::QUOTE);\n        }\n\n        $this->trans_->write(json_encode($b));\n\n        if (is_numeric($b) && $this->context_->escapeNum()) {\n            $this->trans_->write(self::QUOTE);\n        }\n    }\n\n    private function writeJSONInteger($num) {\n        $this->context_->write();\n\n        if ($this->context_->escapeNum()) {\n            $this->trans_->write(self::QUOTE);\n        }\n\n        $this->trans_->write($num);\n\n        if ($this->context_->escapeNum()) {\n            $this->trans_->write(self::QUOTE);\n        }\n    }\n\n    private function writeJSONDouble($num) {\n        $this->context_->write();\n\n        if ($this->context_->escapeNum()) {\n            $this->trans_->write(self::QUOTE);\n        }\n\n        $this->trans_->write(json_encode($num));\n\n        if ($this->context_->escapeNum()) {\n            $this->trans_->write(self::QUOTE);\n        }\n    }\n\n    private function writeJSONBase64($data) {\n        $this->context_->write();\n        $this->trans_->write(self::QUOTE);\n        $this->trans_->write(json_encode(base64_encode($data)));\n        $this->trans_->write(self::QUOTE);\n    }\n\n    private function writeJSONObjectStart() {\n      $this->context_->write();\n      $this->trans_->write(self::LBRACE);\n      $this->pushContext(new PairContext($this));\n    }\n\n    private function writeJSONObjectEnd() {\n      $this->popContext();\n      $this->trans_->write(self::RBRACE);\n    }\n\n    private function writeJSONArrayStart() {\n      $this->context_->write();\n      $this->trans_->write(self::LBRACKET);\n      $this->pushContext(new ListContext($this));\n    }\n\n    private function writeJSONArrayEnd() {\n      $this->popContext();\n      $this->trans_->write(self::RBRACKET);\n    }\n\n    private function readJSONString($skipContext) {\n      if (!$skipContext) {\n        $this->context_->read();\n      }\n\n      $jsonString = '';\n      $lastChar = NULL;\n      while (true) {\n        $ch = $this->reader_->read();\n        $jsonString .= $ch;\n        if ($ch == self::QUOTE &&\n          $lastChar !== NULL &&\n            $lastChar !== self::ESCSEQ) {\n          break;\n        }\n        if ($ch == self::ESCSEQ && $lastChar == self::ESCSEQ) {\n          $lastChar = self::DOUBLEESC;\n        } else {\n          $lastChar = $ch;\n        }\n      }\n      return json_decode($jsonString);\n    }\n\n    private function isJSONNumeric($b) {\n        switch ($b) {\n            case '+':\n            case '-':\n            case '.':\n            case '0':\n            case '1':\n            case '2':\n            case '3':\n            case '4':\n            case '5':\n            case '6':\n            case '7':\n            case '8':\n            case '9':\n            case 'E':\n            case 'e':\n              return true;\n            }\n        return false;\n    }\n\n    private function readJSONNumericChars() {\n        $strbld = array();\n\n        while (true) {\n            $ch = $this->reader_->peek();\n\n            if (!$this->isJSONNumeric($ch)) {\n                break;\n            }\n\n            $strbld[] = $this->reader_->read();\n        }\n\n        return implode(\"\", $strbld);\n    }\n\n    private function readJSONInteger() {\n        $this->context_->read();\n\n        if ($this->context_->escapeNum()) {\n            $this->readJSONSyntaxChar(self::QUOTE);\n        }\n\n        $str = $this->readJSONNumericChars();\n\n        if ($this->context_->escapeNum()) {\n            $this->readJSONSyntaxChar(self::QUOTE);\n        }\n\n        if (!is_numeric($str)) {\n            throw new TProtocolException(\"Invalid data in numeric: \" . $str, TProtocolException::INVALID_DATA);\n        }\n\n        return intval($str);\n    }\n\n    /**\n     * Identical to readJSONInteger but without the final cast.\n     * Needed for proper handling of i64 on 32 bit machines.  Why a\n     * separate function?  So we don't have to force the rest of the\n     * use cases through the extra conditional.\n     */\n    private function readJSONIntegerAsString() {\n        $this->context_->read();\n\n        if ($this->context_->escapeNum()) {\n            $this->readJSONSyntaxChar(self::QUOTE);\n        }\n\n        $str = $this->readJSONNumericChars();\n\n        if ($this->context_->escapeNum()) {\n            $this->readJSONSyntaxChar(self::QUOTE);\n        }\n\n        if (!is_numeric($str)) {\n            throw new TProtocolException(\"Invalid data in numeric: \" . $str, TProtocolException::INVALID_DATA);\n        }\n\n        return $str;\n    }\n\n    private function readJSONDouble() {\n        $this->context_->read();\n\n        if (substr($this->reader_->peek(), 0, 1) == self::QUOTE) {\n            $arr = $this->readJSONString(true);\n\n            if ($arr == \"NaN\") {\n                return NAN;\n            } else if ($arr == \"Infinity\") {\n                return INF;\n            } else if (!$this->context_->escapeNum()) {\n                throw new TProtocolException(\"Numeric data unexpectedly quoted \" . $arr,\n                                              TProtocolException::INVALID_DATA);\n            }\n\n            return floatval($arr);\n        } else {\n            if ($this->context_->escapeNum()) {\n                $this->readJSONSyntaxChar(self::QUOTE);\n            }\n\n            return floatval($this->readJSONNumericChars());\n        }\n    }\n\n    private function readJSONBase64() {\n        $arr = $this->readJSONString(false);\n        $data = base64_decode($arr, true);\n\n        if ($data === false) {\n            throw new TProtocolException(\"Invalid base64 data \" . $arr, TProtocolException::INVALID_DATA);\n        }\n\n        return $data;\n    }\n\n    private function readJSONObjectStart() {\n        $this->context_->read();\n        $this->readJSONSyntaxChar(self::LBRACE);\n        $this->pushContext(new PairContext($this));\n    }\n\n    private function readJSONObjectEnd() {\n        $this->readJSONSyntaxChar(self::RBRACE);\n        $this->popContext();\n    }\n\n    private function readJSONArrayStart()\n    {\n        $this->context_->read();\n        $this->readJSONSyntaxChar(self::LBRACKET);\n        $this->pushContext(new ListContext($this));\n    }\n\n    private function readJSONArrayEnd() {\n        $this->readJSONSyntaxChar(self::RBRACKET);\n        $this->popContext();\n    }\n\n    /**\n     * Writes the message header\n     *\n     * @param string $name Function name\n     * @param int $type message type TMessageType::CALL or TMessageType::REPLY\n     * @param int $seqid The sequence id of this message\n     */\n    public function writeMessageBegin($name, $type, $seqid) {\n        $this->writeJSONArrayStart();\n        $this->writeJSONInteger(self::VERSION);\n        $this->writeJSONString($name);\n        $this->writeJSONInteger($type);\n        $this->writeJSONInteger($seqid);\n    }\n\n    /**\n     * Close the message\n     */\n    public function writeMessageEnd() {\n        $this->writeJSONArrayEnd();\n    }\n\n    /**\n     * Writes a struct header.\n     *\n     * @param string     $name Struct name\n     * @throws TException on write error\n     * @return int How many bytes written\n     */\n    public function writeStructBegin($name) {\n        $this->writeJSONObjectStart();\n    }\n\n    /**\n     * Close a struct.\n     *\n     * @throws TException on write error\n     * @return int How many bytes written\n     */\n    public function writeStructEnd() {\n        $this->writeJSONObjectEnd();\n    }\n\n    public function writeFieldBegin($fieldName, $fieldType, $fieldId) {\n        $this->writeJSONInteger($fieldId);\n        $this->writeJSONObjectStart();\n        $this->writeJSONString($this->getTypeNameForTypeID($fieldType));\n    }\n\n    public function writeFieldEnd() {\n        $this->writeJsonObjectEnd();\n    }\n\n    public function writeFieldStop() {\n    }\n\n    public function writeMapBegin($keyType, $valType, $size) {\n        $this->writeJSONArrayStart();\n        $this->writeJSONString($this->getTypeNameForTypeID($keyType));\n        $this->writeJSONString($this->getTypeNameForTypeID($valType));\n        $this->writeJSONInteger($size);\n        $this->writeJSONObjectStart();\n    }\n\n    public function writeMapEnd() {\n        $this->writeJSONObjectEnd();\n        $this->writeJSONArrayEnd();\n    }\n\n    public function writeListBegin($elemType, $size) {\n        $this->writeJSONArrayStart();\n        $this->writeJSONString($this->getTypeNameForTypeID($elemType));\n        $this->writeJSONInteger($size);\n    }\n\n    public function writeListEnd() {\n        $this->writeJSONArrayEnd();\n    }\n\n    public function writeSetBegin($elemType, $size) {\n        $this->writeJSONArrayStart();\n        $this->writeJSONString($this->getTypeNameForTypeID($elemType));\n        $this->writeJSONInteger($size);\n    }\n\n    public function writeSetEnd() {\n        $this->writeJSONArrayEnd();\n    }\n\n    public function writeBool($bool) {\n        $this->writeJSONInteger($bool ? 1 : 0);\n    }\n\n    public function writeByte($byte) {\n        $this->writeJSONInteger($byte);\n    }\n\n    public function writeI16($i16) {\n        $this->writeJSONInteger($i16);\n    }\n\n    public function writeI32($i32) {\n        $this->writeJSONInteger($i32);\n    }\n\n    public function writeI64($i64) {\n        $this->writeJSONInteger($i64);\n    }\n\n    public function writeDouble($dub) {\n        $this->writeJSONDouble($dub);\n    }\n\n    public function writeString($str) {\n        $this->writeJSONString($str);\n    }\n\n    /**\n     * Reads the message header\n     *\n     * @param string $name Function name\n     * @param int $type message type TMessageType::CALL or TMessageType::REPLY\n     * @parem int $seqid The sequence id of this message\n     */\n    public function readMessageBegin(&$name, &$type, &$seqid) {\n        $this->readJSONArrayStart();\n\n        if ($this->readJSONInteger() != self::VERSION) {\n            throw new TProtocolException(\"Message contained bad version\", TProtocolException::BAD_VERSION);\n        }\n\n        $name = $this->readJSONString(false);\n        $type = $this->readJSONInteger();\n        $seqid = $this->readJSONInteger();\n\n        return true;\n    }\n\n    /**\n     * Read the close of message\n     */\n    public function readMessageEnd() {\n        $this->readJSONArrayEnd();\n    }\n\n    public function readStructBegin(&$name) {\n        $this->readJSONObjectStart();\n        return 0;\n    }\n\n    public function readStructEnd() {\n        $this->readJSONObjectEnd();\n    }\n\n    public function readFieldBegin(&$name, &$fieldType, &$fieldId) {\n        $ch = $this->reader_->peek();\n        $name = \"\";\n\n        if (substr($ch, 0, 1) == self::RBRACE) {\n            $fieldType = TType::STOP;\n        } else {\n            $fieldId = $this->readJSONInteger();\n            $this->readJSONObjectStart();\n            $fieldType = $this->getTypeIDForTypeName($this->readJSONString(false));\n        }\n    }\n\n    public function readFieldEnd() {\n        $this->readJSONObjectEnd();\n    }\n\n    public function readMapBegin(&$keyType, &$valType, &$size) {\n        $this->readJSONArrayStart();\n        $keyType = $this->getTypeIDForTypeName($this->readJSONString(false));\n        $valType = $this->getTypeIDForTypeName($this->readJSONString(false));\n        $size = $this->readJSONInteger();\n        $this->readJSONObjectStart();\n    }\n\n    public function readMapEnd() {\n        $this->readJSONObjectEnd();\n        $this->readJSONArrayEnd();\n    }\n\n    public function readListBegin(&$elemType, &$size) {\n        $this->readJSONArrayStart();\n        $elemType = $this->getTypeIDForTypeName($this->readJSONString(false));\n        $size = $this->readJSONInteger();\n        return true;\n    }\n\n    public function readListEnd() {\n        $this->readJSONArrayEnd();\n    }\n\n    public function readSetBegin(&$elemType, &$size) {\n        $this->readJSONArrayStart();\n        $elemType = $this->getTypeIDForTypeName($this->readJSONString(false));\n        $size = $this->readJSONInteger();\n        return true;\n    }\n\n    public function readSetEnd() {\n        $this->readJSONArrayEnd();\n    }\n\n    public function readBool(&$bool) {\n        $bool = $this->readJSONInteger() == 0 ? false : true;\n        return true;\n    }\n\n    public function readByte(&$byte) {\n        $byte = $this->readJSONInteger();\n        return true;\n    }\n\n    public function readI16(&$i16) {\n        $i16 = $this->readJSONInteger();\n        return true;\n    }\n\n    public function readI32(&$i32) {\n        $i32 = $this->readJSONInteger();\n        return true;\n    }\n\n    public function readI64(&$i64) {\n        if ( PHP_INT_SIZE === 4 ) {\n            $i64 = $this->readJSONIntegerAsString();\n        } else {\n            $i64 = $this->readJSONInteger();\n        }\n        return true;\n    }\n\n    public function readDouble(&$dub) {\n        $dub = $this->readJSONDouble();\n        return true;\n    }\n\n    public function readString(&$str) {\n        $str = $this->readJSONString(false);\n        return true;\n    }\n}\n"
  },
  {
    "path": "src/Thrift/Protocol/TProtocol.php",
    "content": "<?php\n/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n *\n * @package thrift.protocol\n */\n\nnamespace Thrift\\Protocol;\n\nuse Thrift\\Type\\TType;\nuse Thrift\\Exception\\TProtocolException;\n\n/**\n * Protocol base class module.\n */\nabstract class TProtocol {\n\n  /**\n   * Underlying transport\n   *\n   * @var TTransport\n   */\n  protected $trans_;\n\n  /**\n   * Constructor\n   */\n  protected function __construct($trans) {\n    $this->trans_ = $trans;\n  }\n\n  /**\n   * Accessor for transport\n   *\n   * @return TTransport\n   */\n  public function getTransport() {\n    return $this->trans_;\n  }\n\n  /**\n   * Writes the message header\n   *\n   * @param string $name Function name\n   * @param int $type message type TMessageType::CALL or TMessageType::REPLY\n   * @param int $seqid The sequence id of this message\n   */\n  public abstract function writeMessageBegin($name, $type, $seqid);\n\n  /**\n   * Close the message\n   */\n  public abstract function writeMessageEnd();\n\n  /**\n   * Writes a struct header.\n   *\n   * @param string     $name Struct name\n   * @throws TException on write error\n   * @return int How many bytes written\n   */\n  public abstract function writeStructBegin($name);\n\n  /**\n   * Close a struct.\n   *\n   * @throws TException on write error\n   * @return int How many bytes written\n   */\n  public abstract function writeStructEnd();\n\n  /*\n   * Starts a field.\n   *\n   * @param string     $name Field name\n   * @param int        $type Field type\n   * @param int        $fid  Field id\n   * @throws TException on write error\n   * @return int How many bytes written\n   */\n  public abstract function writeFieldBegin($fieldName, $fieldType, $fieldId);\n\n  public abstract function writeFieldEnd();\n\n  public abstract function writeFieldStop();\n\n  public abstract function writeMapBegin($keyType, $valType, $size);\n\n  public abstract function writeMapEnd();\n\n  public abstract function writeListBegin($elemType, $size);\n\n  public abstract function writeListEnd();\n\n  public abstract function writeSetBegin($elemType, $size);\n\n  public abstract function writeSetEnd();\n\n  public abstract function writeBool($bool);\n\n  public abstract function writeByte($byte);\n\n  public abstract function writeI16($i16);\n\n  public abstract function writeI32($i32);\n\n  public abstract function writeI64($i64);\n\n  public abstract function writeDouble($dub);\n\n  public abstract function writeString($str);\n\n  /**\n   * Reads the message header\n   *\n   * @param string $name Function name\n   * @param int $type message type TMessageType::CALL or TMessageType::REPLY\n   * @parem int $seqid The sequence id of this message\n   */\n  public abstract function readMessageBegin(&$name, &$type, &$seqid);\n\n  /**\n   * Read the close of message\n   */\n  public abstract function readMessageEnd();\n\n  public abstract function readStructBegin(&$name);\n\n  public abstract function readStructEnd();\n\n  public abstract function readFieldBegin(&$name, &$fieldType, &$fieldId);\n\n  public abstract function readFieldEnd();\n\n  public abstract function readMapBegin(&$keyType, &$valType, &$size);\n\n  public abstract function readMapEnd();\n\n  public abstract function readListBegin(&$elemType, &$size);\n\n  public abstract function readListEnd();\n\n  public abstract function readSetBegin(&$elemType, &$size);\n\n  public abstract function readSetEnd();\n\n  public abstract function readBool(&$bool);\n\n  public abstract function readByte(&$byte);\n\n  public abstract function readI16(&$i16);\n\n  public abstract function readI32(&$i32);\n\n  public abstract function readI64(&$i64);\n\n  public abstract function readDouble(&$dub);\n\n  public abstract function readString(&$str);\n\n  /**\n   * The skip function is a utility to parse over unrecognized date without\n   * causing corruption.\n   *\n   * @param TType $type What type is it\n   */\n  public function skip($type) {\n    switch ($type) {\n    case TType::BOOL:\n      return $this->readBool($bool);\n    case TType::BYTE:\n      return $this->readByte($byte);\n    case TType::I16:\n      return $this->readI16($i16);\n    case TType::I32:\n      return $this->readI32($i32);\n    case TType::I64:\n      return $this->readI64($i64);\n    case TType::DOUBLE:\n      return $this->readDouble($dub);\n    case TType::STRING:\n      return $this->readString($str);\n    case TType::STRUCT:\n      {\n        $result = $this->readStructBegin($name);\n        while (true) {\n          $result += $this->readFieldBegin($name, $ftype, $fid);\n          if ($ftype == TType::STOP) {\n            break;\n          }\n          $result += $this->skip($ftype);\n          $result += $this->readFieldEnd();\n        }\n        $result += $this->readStructEnd();\n        return $result;\n      }\n    case TType::MAP:\n      {\n        $result = $this->readMapBegin($keyType, $valType, $size);\n        for ($i = 0; $i < $size; $i++) {\n          $result += $this->skip($keyType);\n          $result += $this->skip($valType);\n        }\n        $result += $this->readMapEnd();\n        return $result;\n      }\n    case TType::SET:\n      {\n        $result = $this->readSetBegin($elemType, $size);\n        for ($i = 0; $i < $size; $i++) {\n          $result += $this->skip($elemType);\n        }\n        $result += $this->readSetEnd();\n        return $result;\n      }\n    case TType::LST:\n      {\n        $result = $this->readListBegin($elemType, $size);\n        for ($i = 0; $i < $size; $i++) {\n          $result += $this->skip($elemType);\n        }\n        $result += $this->readListEnd();\n        return $result;\n      }\n    default:\n      throw new TProtocolException('Unknown field type: '.$type,\n                                   TProtocolException::INVALID_DATA);\n    }\n  }\n\n  /**\n   * Utility for skipping binary data\n   *\n   * @param TTransport $itrans TTransport object\n   * @param int        $type   Field type\n   */\n  public static function skipBinary($itrans, $type) {\n    switch ($type) {\n    case TType::BOOL:\n      return $itrans->readAll(1);\n    case TType::BYTE:\n      return $itrans->readAll(1);\n    case TType::I16:\n      return $itrans->readAll(2);\n    case TType::I32:\n      return $itrans->readAll(4);\n    case TType::I64:\n      return $itrans->readAll(8);\n    case TType::DOUBLE:\n      return $itrans->readAll(8);\n    case TType::STRING:\n      $len = unpack('N', $itrans->readAll(4));\n      $len = $len[1];\n      if ($len > 0x7fffffff) {\n        $len = 0 - (($len - 1) ^ 0xffffffff);\n      }\n      return 4 + $itrans->readAll($len);\n    case TType::STRUCT:\n      {\n        $result = 0;\n        while (true) {\n          $ftype = 0;\n          $fid = 0;\n          $data = $itrans->readAll(1);\n          $arr = unpack('c', $data);\n          $ftype = $arr[1];\n          if ($ftype == TType::STOP) {\n            break;\n          }\n          // I16 field id\n          $result += $itrans->readAll(2);\n          $result += self::skipBinary($itrans, $ftype);\n        }\n        return $result;\n      }\n    case TType::MAP:\n      {\n        // Ktype\n        $data = $itrans->readAll(1);\n        $arr = unpack('c', $data);\n        $ktype = $arr[1];\n        // Vtype\n        $data = $itrans->readAll(1);\n        $arr = unpack('c', $data);\n        $vtype = $arr[1];\n        // Size\n        $data = $itrans->readAll(4);\n        $arr = unpack('N', $data);\n        $size = $arr[1];\n        if ($size > 0x7fffffff) {\n          $size = 0 - (($size - 1) ^ 0xffffffff);\n        }\n        $result = 6;\n        for ($i = 0; $i < $size; $i++) {\n          $result += self::skipBinary($itrans, $ktype);\n          $result += self::skipBinary($itrans, $vtype);\n        }\n        return $result;\n      }\n    case TType::SET:\n    case TType::LST:\n      {\n        // Vtype\n        $data = $itrans->readAll(1);\n        $arr = unpack('c', $data);\n        $vtype = $arr[1];\n        // Size\n        $data = $itrans->readAll(4);\n        $arr = unpack('N', $data);\n        $size = $arr[1];\n        if ($size > 0x7fffffff) {\n          $size = 0 - (($size - 1) ^ 0xffffffff);\n        }\n        $result = 5;\n        for ($i = 0; $i < $size; $i++) {\n          $result += self::skipBinary($itrans, $vtype);\n        }\n        return $result;\n      }\n    default:\n      throw new TProtocolException('Unknown field type: '.$type,\n                                   TProtocolException::INVALID_DATA);\n    }\n  }\n}\n"
  },
  {
    "path": "src/Thrift/Serializer/TBinarySerializer.php",
    "content": "<?php\n/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n *\n * @package thrift.protocol\n * @author: rmarin (marin.radu@facebook.com)\n */\n\nnamespace Thrift\\Serializer;\n\nuse Thrift\\Transport\\TMemoryBuffer;\nuse Thrift\\Protocol\\TBinaryProtocolAccelerated;\nuse Thrift\\Type\\TMessageType;\n\n/**\n * Utility class for serializing and deserializing\n * a thrift object using TBinaryProtocolAccelerated.\n */\nclass TBinarySerializer {\n\n  // NOTE(rmarin): Because thrift_protocol_write_binary\n  // adds a begin message prefix, you cannot specify\n  // a transport in which to serialize an object. It has to\n  // be a string. Otherwise we will break the compatibility with\n  // normal deserialization.\n  public static function serialize($object) {\n    $transport = new TMemoryBuffer();\n    $protocol = new TBinaryProtocolAccelerated($transport);\n    if (function_exists('thrift_protocol_write_binary')) {\n      thrift_protocol_write_binary($protocol, $object->getName(),\n                                   TMessageType::REPLY, $object,\n                                   0, $protocol->isStrictWrite());\n\n      $protocol->readMessageBegin($unused_name, $unused_type,\n                                  $unused_seqid);\n    } else {\n      $object->write($protocol);\n    }\n    $protocol->getTransport()->flush();\n    return $transport->getBuffer();\n  }\n\n  public static function deserialize($string_object, $class_name) {\n     $transport = new TMemoryBuffer();\n     $protocol = new TBinaryProtocolAccelerated($transport);\n     if (function_exists('thrift_protocol_read_binary')) {\n       $protocol->writeMessageBegin('', TMessageType::REPLY, 0);\n       $transport->write($string_object);\n       return thrift_protocol_read_binary($protocol, $class_name,\n                                          $protocol->isStrictRead());\n     } else {\n       $transport->write($string_object);\n       $object = new $class_name();\n       $object->read($protocol);\n       return $object;\n     }\n  }\n}\n"
  },
  {
    "path": "src/Thrift/Server/TForkingServer.php",
    "content": "<?php\n\nnamespace Thrift\\Server;\n\nuse Thrift\\Server\\TServer;\nuse Thrift\\Transport\\TTransport;\nuse Thrift\\Exception\\TException;\nuse Thrift\\Exception\\TTransportException;\n\n/**\n * A forking implementation of a Thrift server.\n *\n * @package thrift.server\n */\nclass TForkingServer extends TServer {\n  /**\n   * Flag for the main serving loop\n   *\n   * @var bool\n   */\n  private $stop_ = false;\n\n  /**\n   * List of children.\n   *\n   * @var array\n   */\n  protected $children_ = array();\n\n  /**\n   * Listens for new client using the supplied\n   * transport. We fork when a new connection\n   * arrives.\n   *\n   * @return void\n   */\n  public function serve() {\n    $this->transport_->listen();\n\n    while (!$this->stop_) {\n      try {\n        $transport = $this->transport_->accept();\n\n        if ($transport != null) {\n          $pid = pcntl_fork();\n\n          if ($pid > 0) {\n            $this->handleParent($transport, $pid);\n          }\n          else if ($pid === 0) {\n            $this->handleChild($transport);\n          }\n          else {\n            throw new TException('Failed to fork');\n          }\n        }\n      }\n      catch (TTransportException $e) { }\n\n      $this->collectChildren();\n    }\n  }\n\n  /**\n   * Code run by the parent\n   *\n   * @param TTransport $transport\n   * @param int $pid\n   * @return void\n   */\n  private function handleParent(TTransport $transport, $pid) {\n    $this->children_[$pid] = $transport;\n  }\n\n  /**\n   * Code run by the child.\n   *\n   * @param TTransport $transport\n   * @return void\n   */\n  private function handleChild(TTransport $transport) {\n    try {\n      $inputTransport = $this->inputTransportFactory_->getTransport($transport);\n      $outputTransport = $this->outputTransportFactory_->getTransport($transport);\n      $inputProtocol = $this->inputProtocolFactory_->getProtocol($inputTransport);\n      $outputProtocol = $this->outputProtocolFactory_->getProtocol($outputTransport);\n      while ($this->processor_->process($inputProtocol, $outputProtocol)) { }\n      @$transport->close();\n    }\n    catch (TTransportException $e) { }\n\n    exit(0);\n  }\n\n  /**\n   * Collects any children we may have\n   *\n   * @return void\n   */\n  private function collectChildren() {\n    foreach ($this->children_ as $pid => $transport) {\n      if (pcntl_waitpid($pid, $status, WNOHANG) > 0) {\n        unset($this->children_[$pid]);\n        if ($transport) @$transport->close();\n      }\n    }\n  }\n\n  /**\n   * Stops the server running. Kills the transport\n   * and then stops the main serving loop\n   *\n   * @return void\n   */\n  public function stop() {\n    $this->transport_->close();\n    $this->stop_ = true;\n  }\n}\n"
  },
  {
    "path": "src/Thrift/Server/TServer.php",
    "content": "<?php\n\nnamespace Thrift\\Server;\n\nuse Thrift\\Server\\TServerTransport;\nuse Thrift\\Factory\\TTransportFactory;\nuse Thrift\\Factory\\TProtocolFactory;\n\n/**\n * Generic class for a Thrift server.\n *\n * @package thrift.server\n */\nabstract class TServer {\n\n  /**\n   * Processor to handle new clients\n   *\n   * @var TProcessor\n   */\n  protected $processor_;\n\n  /**\n   * Server transport to be used for listening\n   * and accepting new clients\n   *\n   * @var TServerTransport\n   */\n  protected $transport_;\n\n  /**\n   * Input transport factory\n   *\n   * @var TTransportFactory\n   */\n  protected $inputTransportFactory_;\n\n  /**\n   * Output transport factory\n   *\n   * @var TTransportFactory\n   */\n  protected $outputTransportFactory_;\n\n  /**\n   * Input protocol factory\n   *\n   * @var TProtocolFactory\n   */\n  protected $inputProtocolFactory_;\n\n  /**\n   * Output protocol factory\n   *\n   * @var TProtocolFactory\n   */\n  protected $outputProtocolFactory_;\n\n  /**\n   * Sets up all the factories, etc\n   *\n   * @param object $processor\n   * @param TServerTransport $transport\n   * @param TTransportFactory $inputTransportFactory\n   * @param TTransportFactory $outputTransportFactory\n   * @param TProtocolFactory $inputProtocolFactory\n   * @param TProtocolFactory $outputProtocolFactory\n   * @return void\n   */\n  public function __construct($processor,\n                              TServerTransport $transport,\n                              TTransportFactory $inputTransportFactory,\n                              TTransportFactory $outputTransportFactory,\n                              TProtocolFactory $inputProtocolFactory,\n                              TProtocolFactory $outputProtocolFactory) {\n    $this->processor_ = $processor;\n    $this->transport_ = $transport;\n    $this->inputTransportFactory_ = $inputTransportFactory;\n    $this->outputTransportFactory_ = $outputTransportFactory;\n    $this->inputProtocolFactory_ = $inputProtocolFactory;\n    $this->outputProtocolFactory_ = $outputProtocolFactory;\n  }\n\n  /**\n   * Serves the server. This should never return\n   * unless a problem permits it to do so or it\n   * is interrupted intentionally\n   *\n   * @abstract\n   * @return void\n   */\n  abstract public function serve();\n\n  /**\n   * Stops the server serving\n   *\n   * @abstract\n   * @return void\n   */\n  abstract public function stop();\n}\n"
  },
  {
    "path": "src/Thrift/Server/TServerSocket.php",
    "content": "<?php\n\nnamespace Thrift\\Server;\n\nuse Thrift\\Server\\TServerTransport;\nuse Thrift\\Transport\\TSocket;\n\n/**\n * Socket implementation of a server agent.\n *\n * @package thrift.transport\n */\nclass TServerSocket extends TServerTransport {\n\n  /**\n   * Handle for the listener socket\n   *\n   * @var resource\n   */\n  private $listener_;\n\n  /**\n   * Port for the listener to listen on\n   *\n   * @var int\n   */\n  private $port_;\n\n  /**\n   * Timeout when listening for a new client\n   *\n   * @var int\n   */\n  private $acceptTimeout_ = 30000;\n\n  /**\n   * Host to listen on\n   *\n   * @var string\n   */\n  private $host_;\n\n  /**\n   * ServerSocket constructor\n   *\n   * @param string $host        Host to listen on\n   * @param int $port           Port to listen on\n   * @return void\n   */\n  public function __construct($host = 'localhost', $port = 9090) {\n    $this->host_ = $host;\n    $this->port_ = $port;\n  }\n\n  /**\n   * Sets the accept timeout\n   *\n   * @param int $acceptTimeout\n   * @return void\n   */\n  public function setAcceptTimeout($acceptTimeout) {\n    $this->acceptTimeout_ = $acceptTimeout;\n  }\n\n  /**\n   * Opens a new socket server handle\n   *\n   * @return void\n   */\n  public function listen() {\n    $this->listener_ = stream_socket_server('tcp://' . $this->host_ . ':' . $this->port_);\n  }\n\n  /**\n   * Closes the socket server handle\n   *\n   * @return void\n   */\n  public function close() {\n    @fclose($this->listener_);\n    $this->listener_ = null;\n  }\n\n  /**\n   * Implementation of accept. If not client is accepted in the given time\n   *\n   * @return TSocket\n   */\n  protected function acceptImpl() {\n    $handle = @stream_socket_accept($this->listener_, $this->acceptTimeout_ / 1000.0);\n    if(!$handle) return null;\n\n    $socket = new TSocket();\n    $socket->setHandle($handle);\n\n    return $socket;\n  }\n}\n"
  },
  {
    "path": "src/Thrift/Server/TServerTransport.php",
    "content": "<?php\n\nnamespace Thrift\\Server;\n\nuse Thrift\\Exception\\TTransportException;\n\n/**\n * Generic class for Server agent.\n *\n * @package thrift.transport\n */\nabstract class TServerTransport {\n  /**\n   * List for new clients\n   *\n   * @abstract\n   * @return void\n   */\n  abstract public function listen();\n\n  /**\n   * Close the server\n   *\n   * @abstract\n   * @return void\n   */\n  abstract public function close();\n\n  /**\n   * Subclasses should use this to implement\n   * accept.\n   *\n   * @abstract\n   * @return TTransport\n   */\n  protected abstract function acceptImpl();\n\n  /**\n   * Uses the accept implemtation. If null is returned, an\n   * exception is thrown.\n   *\n   * @throws TTransportException\n   * @return TTransport\n   */\n  public function accept() {\n    $transport = $this->acceptImpl();\n\n    if ($transport == null) {\n      throw new TTransportException(\"accept() may not return NULL\");\n    }\n\n    return $transport;\n  }\n}\n"
  },
  {
    "path": "src/Thrift/Server/TSimpleServer.php",
    "content": "<?php\n\nnamespace Thrift\\Server;\n\nuse Thrift\\Server\\TServer;\nuse Thrift\\Exception\\TTransportException;\n\n/**\n * Simple implemtation of a Thrift server.\n *\n * @package thrift.server\n */\nclass TSimpleServer extends TServer {\n  /**\n   * Flag for the main serving loop\n   *\n   * @var bool\n   */\n  private $stop_ = false;\n\n  /**\n   * Listens for new client using the supplied\n   * transport. It handles TTransportExceptions\n   * to avoid timeouts etc killing it\n   *\n   * @return void\n   */\n  public function serve() {\n    $this->transport_->listen();\n\n    while (!$this->stop_) {\n      try {\n        $transport = $this->transport_->accept();\n\n        if ($transport != null) {\n          $inputTransport = $this->inputTransportFactory_->getTransport($transport);\n          $outputTransport = $this->outputTransportFactory_->getTransport($transport);\n          $inputProtocol = $this->inputProtocolFactory_->getProtocol($inputTransport);\n          $outputProtocol = $this->outputProtocolFactory_->getProtocol($outputTransport);\n          while ($this->processor_->process($inputProtocol, $outputProtocol)) { }\n        }\n      }\n      catch (TTransportException $e) { }\n    }\n  }\n\n  /**\n   * Stops the server running. Kills the transport\n   * and then stops the main serving loop\n   *\n   * @return void\n   */\n  public function stop() {\n    $this->transport_->close();\n    $this->stop_ = true;\n  }\n}\n"
  },
  {
    "path": "src/Thrift/StringFunc/Core.php",
    "content": "<?php\n/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n *\n */\n\nnamespace Thrift\\StringFunc;\n\nuse Thrift\\StringFunc\\TStringFunc;\n\nclass Core implements TStringFunc {\n    public function substr($str, $start, $length = null) {\n        // specifying a null $length would return an empty string\n        if($length === null) {\n            return substr($str, $start);\n        }\n        return substr($str, $start, $length);\n    }\n\n    public function strlen($str) {\n        return strlen($str);\n    }\n}"
  },
  {
    "path": "src/Thrift/StringFunc/Mbstring.php",
    "content": "<?php\n/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n *\n */\n\nnamespace Thrift\\StringFunc;\n\nuse Thrift\\StringFunc\\TStringFunc;\n\nclass Mbstring implements TStringFunc {\n    public function substr($str, $start, $length = null) {\n        /**\n         * We need to set the charset parameter, which is the second\n         * optional parameter and the first optional parameter can't\n         * be null or false as a \"magic\" value because that would\n         * cause an empty string to be returned, so we need to\n         * actually calculate the proper length value.\n         */\n        if($length === null) {\n            $length = $this->strlen($str) - $start;\n        }\n\n        return mb_substr($str, $start, $length, '8bit');\n    }\n\n    public function strlen($str) {\n        return mb_strlen($str, '8bit');\n    }\n}"
  },
  {
    "path": "src/Thrift/StringFunc/TStringFunc.php",
    "content": "<?php\n/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n *\n */\n\nnamespace Thrift\\StringFunc;\n\ninterface TStringFunc {\n    public function substr($str, $start, $length = null);\n    public function strlen($str);\n}"
  },
  {
    "path": "src/Thrift/Transport/TBufferedTransport.php",
    "content": "<?php\n/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n *\n * @package thrift.transport\n */\n\nnamespace Thrift\\Transport;\n\nuse Thrift\\Transport\\TTransport;\nuse Thrift\\Factory\\TStringFuncFactory;\n\n/**\n * Buffered transport. Stores data to an internal buffer that it doesn't\n * actually write out until flush is called. For reading, we do a greedy\n * read and then serve data out of the internal buffer.\n *\n * @package thrift.transport\n */\nclass TBufferedTransport extends TTransport {\n\n  /**\n   * Constructor. Creates a buffered transport around an underlying transport\n   */\n  public function __construct($transport=null, $rBufSize=512, $wBufSize=512) {\n    $this->transport_ = $transport;\n    $this->rBufSize_ = $rBufSize;\n    $this->wBufSize_ = $wBufSize;\n  }\n\n  /**\n   * The underlying transport\n   *\n   * @var TTransport\n   */\n  protected $transport_ = null;\n\n  /**\n   * The receive buffer size\n   *\n   * @var int\n   */\n  protected $rBufSize_ = 512;\n\n  /**\n   * The write buffer size\n   *\n   * @var int\n   */\n  protected $wBufSize_ = 512;\n\n  /**\n   * The write buffer.\n   *\n   * @var string\n   */\n  protected $wBuf_ = '';\n\n  /**\n   * The read buffer.\n   *\n   * @var string\n   */\n  protected $rBuf_ = '';\n\n  public function isOpen() {\n    return $this->transport_->isOpen();\n  }\n\n  public function open() {\n    $this->transport_->open();\n  }\n\n  public function close() {\n    $this->transport_->close();\n  }\n\n  public function putBack($data) {\n    if (TStringFuncFactory::create()->strlen($this->rBuf_) === 0) {\n      $this->rBuf_ = $data;\n    } else {\n      $this->rBuf_ = ($data . $this->rBuf_);\n    }\n  }\n\n  /**\n   * The reason that we customize readAll here is that the majority of PHP\n   * streams are already internally buffered by PHP. The socket stream, for\n   * example, buffers internally and blocks if you call read with $len greater\n   * than the amount of data available, unlike recv() in C.\n   *\n   * Therefore, use the readAll method of the wrapped transport inside\n   * the buffered readAll.\n   */\n  public function readAll($len) {\n    $have = TStringFuncFactory::create()->strlen($this->rBuf_);\n    if ($have == 0) {\n      $data = $this->transport_->readAll($len);\n    } else if ($have < $len) {\n      $data = $this->rBuf_;\n      $this->rBuf_ = '';\n      $data .= $this->transport_->readAll($len - $have);\n    } else if ($have == $len) {\n      $data = $this->rBuf_;\n      $this->rBuf_ = '';\n    } else if ($have > $len) {\n      $data = TStringFuncFactory::create()->substr($this->rBuf_, 0, $len);\n      $this->rBuf_ = TStringFuncFactory::create()->substr($this->rBuf_, $len);\n    }\n    return $data;\n  }\n\n  public function read($len) {\n    if (TStringFuncFactory::create()->strlen($this->rBuf_) === 0) {\n      $this->rBuf_ = $this->transport_->read($this->rBufSize_);\n    }\n\n    if (TStringFuncFactory::create()->strlen($this->rBuf_) <= $len) {\n      $ret = $this->rBuf_;\n      $this->rBuf_ = '';\n      return $ret;\n    }\n\n    $ret = TStringFuncFactory::create()->substr($this->rBuf_, 0, $len);\n    $this->rBuf_ = TStringFuncFactory::create()->substr($this->rBuf_, $len);\n    return $ret;\n  }\n\n  public function write($buf) {\n    $this->wBuf_ .= $buf;\n    if (TStringFuncFactory::create()->strlen($this->wBuf_) >= $this->wBufSize_) {\n      $out = $this->wBuf_;\n\n      // Note that we clear the internal wBuf_ prior to the underlying write\n      // to ensure we're in a sane state (i.e. internal buffer cleaned)\n      // if the underlying write throws up an exception\n      $this->wBuf_ = '';\n      $this->transport_->write($out);\n    }\n  }\n\n  public function flush() {\n    if (TStringFuncFactory::create()->strlen($this->wBuf_) > 0) {\n      $this->transport_->write($this->wBuf_);\n      $this->wBuf_ = '';\n    }\n    $this->transport_->flush();\n  }\n\n}\n"
  },
  {
    "path": "src/Thrift/Transport/TFramedTransport.php",
    "content": "<?php\n/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n *\n * @package thrift.transport\n */\n\nnamespace Thrift\\Transport;\n\nuse Thrift\\Transport\\TTransport;\nuse Thrift\\Factory\\TStringFuncFactory;\n\n/**\n * Framed transport. Writes and reads data in chunks that are stamped with\n * their length.\n *\n * @package thrift.transport\n */\nclass TFramedTransport extends TTransport {\n\n  /**\n   * Underlying transport object.\n   *\n   * @var TTransport\n   */\n  private $transport_;\n\n  /**\n   * Buffer for read data.\n   *\n   * @var string\n   */\n  private $rBuf_;\n\n  /**\n   * Buffer for queued output data\n   *\n   * @var string\n   */\n  private $wBuf_;\n\n  /**\n   * Whether to frame reads\n   *\n   * @var bool\n   */\n  private $read_;\n\n  /**\n   * Whether to frame writes\n   *\n   * @var bool\n   */\n  private $write_;\n\n  /**\n   * Constructor.\n   *\n   * @param TTransport $transport Underlying transport\n   */\n  public function __construct($transport=null, $read=true, $write=true) {\n    $this->transport_ = $transport;\n    $this->read_ = $read;\n    $this->write_ = $write;\n  }\n\n  public function isOpen() {\n    return $this->transport_->isOpen();\n  }\n\n  public function open() {\n    $this->transport_->open();\n  }\n\n  public function close() {\n    $this->transport_->close();\n  }\n\n  /**\n   * Reads from the buffer. When more data is required reads another entire\n   * chunk and serves future reads out of that.\n   *\n   * @param int $len How much data\n   */\n  public function read($len) {\n    if (!$this->read_) {\n      return $this->transport_->read($len);\n    }\n\n    if (TStringFuncFactory::create()->strlen($this->rBuf_) === 0) {\n      $this->readFrame();\n    }\n\n    // Just return full buff\n    if ($len >= TStringFuncFactory::create()->strlen($this->rBuf_)) {\n      $out = $this->rBuf_;\n      $this->rBuf_ = null;\n      return $out;\n    }\n\n    // Return TStringFuncFactory::create()->substr\n    $out = TStringFuncFactory::create()->substr($this->rBuf_, 0, $len);\n    $this->rBuf_ = TStringFuncFactory::create()->substr($this->rBuf_, $len);\n    return $out;\n  }\n\n  /**\n   * Put previously read data back into the buffer\n   *\n   * @param string $data data to return\n   */\n  public function putBack($data) {\n    if (TStringFuncFactory::create()->strlen($this->rBuf_) === 0) {\n      $this->rBuf_ = $data;\n    } else {\n      $this->rBuf_ = ($data . $this->rBuf_);\n    }\n  }\n\n  /**\n   * Reads a chunk of data into the internal read buffer.\n   */\n  private function readFrame() {\n    $buf = $this->transport_->readAll(4);\n    $val = unpack('N', $buf);\n    $sz = $val[1];\n\n    $this->rBuf_ = $this->transport_->readAll($sz);\n  }\n\n  /**\n   * Writes some data to the pending output buffer.\n   *\n   * @param string $buf The data\n   * @param int    $len Limit of bytes to write\n   */\n  public function write($buf, $len=null) {\n    if (!$this->write_) {\n      return $this->transport_->write($buf, $len);\n    }\n\n    if ($len !== null && $len < TStringFuncFactory::create()->strlen($buf)) {\n      $buf = TStringFuncFactory::create()->substr($buf, 0, $len);\n    }\n    $this->wBuf_ .= $buf;\n  }\n\n  /**\n   * Writes the output buffer to the stream in the format of a 4-byte length\n   * followed by the actual data.\n   */\n  public function flush() {\n    if (!$this->write_ || TStringFuncFactory::create()->strlen($this->wBuf_) == 0) {\n      return $this->transport_->flush();\n    }\n\n    $out = pack('N', TStringFuncFactory::create()->strlen($this->wBuf_));\n    $out .= $this->wBuf_;\n\n    // Note that we clear the internal wBuf_ prior to the underlying write\n    // to ensure we're in a sane state (i.e. internal buffer cleaned)\n    // if the underlying write throws up an exception\n    $this->wBuf_ = '';\n    $this->transport_->write($out);\n    $this->transport_->flush();\n  }\n\n}\n"
  },
  {
    "path": "src/Thrift/Transport/THttpClient.php",
    "content": "<?php\n/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n *\n * @package thrift.transport\n */\n\nnamespace Thrift\\Transport;\n\nuse Thrift\\Transport\\TTransport;\nuse Thrift\\Exception\\TTransportException;\nuse Thrift\\Factory\\TStringFuncFactory;\n\n/**\n * HTTP client for Thrift\n *\n * @package thrift.transport\n */\nclass THttpClient extends TTransport {\n\n  /**\n   * The host to connect to\n   *\n   * @var string\n   */\n  protected $host_;\n\n  /**\n   * The port to connect on\n   *\n   * @var int\n   */\n  protected $port_;\n\n  /**\n   * The URI to request\n   *\n   * @var string\n   */\n  protected $uri_;\n\n  /**\n   * The scheme to use for the request, i.e. http, https\n   *\n   * @var string\n   */\n  protected $scheme_;\n\n  /**\n   * Buffer for the HTTP request data\n   *\n   * @var string\n   */\n  protected $buf_;\n\n  /**\n   * Input socket stream.\n   *\n   * @var resource\n   */\n  protected $handle_;\n\n  /**\n   * Read timeout\n   *\n   * @var float\n   */\n  protected $timeout_;\n\n  /**\n   * http headers\n   *\n   * @var array\n   */\n  protected $headers_;\n\n  /**\n   * Make a new HTTP client.\n   *\n   * @param string $host\n   * @param int    $port\n   * @param string $uri\n   */\n  public function __construct($host, $port=80, $uri='', $scheme = 'http') {\n    if ((TStringFuncFactory::create()->strlen($uri) > 0) && ($uri{0} != '/')) {\n      $uri = '/'.$uri;\n    }\n    $this->scheme_ = $scheme;\n    $this->host_ = $host;\n    $this->port_ = $port;\n    $this->uri_ = $uri;\n    $this->buf_ = '';\n    $this->handle_ = null;\n    $this->timeout_ = null;\n    $this->headers_ = array();\n  }\n\n  /**\n   * Set read timeout\n   *\n   * @param float $timeout\n   */\n  public function setTimeoutSecs($timeout) {\n    $this->timeout_ = $timeout;\n  }\n\n  /**\n   * Whether this transport is open.\n   *\n   * @return boolean true if open\n   */\n  public function isOpen() {\n    return true;\n  }\n\n  /**\n   * Open the transport for reading/writing\n   *\n   * @throws TTransportException if cannot open\n   */\n  public function open() {}\n\n  /**\n   * Close the transport.\n   */\n  public function close() {\n    if ($this->handle_) {\n      @fclose($this->handle_);\n      $this->handle_ = null;\n    }\n  }\n\n  /**\n   * Read some data into the array.\n   *\n   * @param int    $len How much to read\n   * @return string The data that has been read\n   * @throws TTransportException if cannot read any more data\n   */\n  public function read($len) {\n    $data = @fread($this->handle_, $len);\n    if ($data === FALSE || $data === '') {\n      $md = stream_get_meta_data($this->handle_);\n      if ($md['timed_out']) {\n        throw new TTransportException('THttpClient: timed out reading '.$len.' bytes from '.$this->host_.':'.$this->port_.$this->uri_, TTransportException::TIMED_OUT);\n      } else {\n        throw new TTransportException('THttpClient: Could not read '.$len.' bytes from '.$this->host_.':'.$this->port_.$this->uri_, TTransportException::UNKNOWN);\n      }\n    }\n    return $data;\n  }\n\n  /**\n   * Writes some data into the pending buffer\n   *\n   * @param string $buf  The data to write\n   * @throws TTransportException if writing fails\n   */\n  public function write($buf) {\n    $this->buf_ .= $buf;\n  }\n\n  /**\n   * Opens and sends the actual request over the HTTP connection\n   *\n   * @throws TTransportException if a writing error occurs\n   */\n  public function flush() {\n    // God, PHP really has some esoteric ways of doing simple things.\n    $host = $this->host_.($this->port_ != 80 ? ':'.$this->port_ : '');\n\n    $headers = array();\n    $defaultHeaders = array('Host' => $host,\n                            'Accept' => 'application/x-thrift',\n                            'User-Agent' => 'PHP/THttpClient',\n                            'Content-Type' => 'application/x-thrift',\n                            'Content-Length' => TStringFuncFactory::create()->strlen($this->buf_));\n    foreach (array_merge($defaultHeaders, $this->headers_) as $key => $value) {\n        $headers[] = \"$key: $value\";\n    }\n\n    $options = array('method' => 'POST',\n                     'header' => implode(\"\\r\\n\", $headers),\n                     'max_redirects' => 1,\n                     'content' => $this->buf_);\n    if ($this->timeout_ > 0) {\n      $options['timeout'] = $this->timeout_;\n    }\n    $this->buf_ = '';\n\n    $contextid = stream_context_create(array('http' => $options));\n    $this->handle_ = @fopen($this->scheme_.'://'.$host.$this->uri_, 'r', false, $contextid);\n\n    // Connect failed?\n    if ($this->handle_ === FALSE) {\n      $this->handle_ = null;\n      $error = 'THttpClient: Could not connect to '.$host.$this->uri_;\n      throw new TTransportException($error, TTransportException::NOT_OPEN);\n    }\n  }\n\n  public function addHeaders($headers) {\n    $this->headers_ = array_merge($this->headers_, $headers);\n  }\n\n}\n"
  },
  {
    "path": "src/Thrift/Transport/TMemoryBuffer.php",
    "content": "<?php\n/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n *\n * @package thrift.transport\n */\n\nnamespace Thrift\\Transport;\n\nuse Thrift\\Transport\\TTransport;\nuse Thrift\\Exception\\TTransportException;\nuse Thrift\\Factory\\TStringFuncFactory;\n\n/**\n * A memory buffer is a tranpsort that simply reads from and writes to an\n * in-memory string buffer. Anytime you call write on it, the data is simply\n * placed into a buffer, and anytime you call read, data is read from that\n * buffer.\n *\n * @package thrift.transport\n */\nclass TMemoryBuffer extends TTransport {\n\n  /**\n   * Constructor. Optionally pass an initial value\n   * for the buffer.\n   */\n  public function __construct($buf = '') {\n    $this->buf_ = $buf;\n  }\n\n  protected $buf_ = '';\n\n  public function isOpen() {\n    return true;\n  }\n\n  public function open() {}\n\n  public function close() {}\n\n  public function write($buf) {\n    $this->buf_ .= $buf;\n  }\n\n  public function read($len) {\n    $bufLength = TStringFuncFactory::create()->strlen($this->buf_);\n\n    if ($bufLength === 0) {\n      throw new TTransportException('TMemoryBuffer: Could not read ' .\n                                    $len . ' bytes from buffer.',\n                                    TTransportException::UNKNOWN);\n    }\n\n    if ($bufLength <= $len) {\n      $ret = $this->buf_;\n      $this->buf_ = '';\n      return $ret;\n    }\n\n    $ret = TStringFuncFactory::create()->substr($this->buf_, 0, $len);\n    $this->buf_ = TStringFuncFactory::create()->substr($this->buf_, $len);\n\n    return $ret;\n  }\n\n  function getBuffer() {\n    return $this->buf_;\n  }\n\n  public function available() {\n    return TStringFuncFactory::create()->strlen($this->buf_);\n  }\n}\n"
  },
  {
    "path": "src/Thrift/Transport/TNullTransport.php",
    "content": "<?php\n/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n *\n * @package thrift.transport\n */\n\nnamespace Thrift\\Transport;\n\nuse Thrift\\Transport\\TTransport;\nuse Thrift\\Exception\\TTransportException;\n\n/**\n * Transport that only accepts writes and ignores them.\n * This is useful for measuring the serialized size of structures.\n *\n * @package thrift.transport\n */\nclass TNullTransport extends TTransport {\n\n  public function isOpen() {\n    return true;\n  }\n\n  public function open() {}\n\n  public function close() {}\n\n  public function read($len) {\n    throw new TTransportException(\"Can't read from TNullTransport.\");\n  }\n\n  public function write($buf) {}\n\n}\n"
  },
  {
    "path": "src/Thrift/Transport/TPhpStream.php",
    "content": "<?php\n/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n *\n * @package thrift.transport\n */\n\nnamespace Thrift\\Transport;\n\nuse Thrift\\Transport\\TTransport;\nuse Thrift\\Exception\\TException;\nuse Thrift\\Factory\\TStringFuncFactory;\n\n/**\n * Php stream transport. Reads to and writes from the php standard streams\n * php://input and php://output\n *\n * @package thrift.transport\n */\nclass TPhpStream extends TTransport {\n\n  const MODE_R = 1;\n  const MODE_W = 2;\n\n  private $inStream_ = null;\n\n  private $outStream_ = null;\n\n  private $read_ = false;\n\n  private $write_ = false;\n\n  public function __construct($mode) {\n    $this->read_ = $mode & self::MODE_R;\n    $this->write_ = $mode & self::MODE_W;\n  }\n\n  public function open() {\n    if ($this->read_) {\n      $this->inStream_ = @fopen(self::inStreamName(), 'r');\n      if (!is_resource($this->inStream_)) {\n        throw new TException('TPhpStream: Could not open php://input');\n      }\n    }\n    if ($this->write_) {\n      $this->outStream_ = @fopen('php://output', 'w');\n      if (!is_resource($this->outStream_)) {\n        throw new TException('TPhpStream: Could not open php://output');\n      }\n    }\n  }\n\n  public function close() {\n    if ($this->read_) {\n      @fclose($this->inStream_);\n      $this->inStream_ = null;\n    }\n    if ($this->write_) {\n      @fclose($this->outStream_);\n      $this->outStream_ = null;\n    }\n  }\n\n  public function isOpen() {\n    return\n      (!$this->read_ || is_resource($this->inStream_)) &&\n      (!$this->write_ || is_resource($this->outStream_));\n  }\n\n  public function read($len) {\n    $data = @fread($this->inStream_, $len);\n    if ($data === FALSE || $data === '') {\n      throw new TException('TPhpStream: Could not read '.$len.' bytes');\n    }\n    return $data;\n  }\n\n  public function write($buf) {\n    while (TStringFuncFactory::create()->strlen($buf) > 0) {\n      $got = @fwrite($this->outStream_, $buf);\n      if ($got === 0 || $got === FALSE) {\n        throw new TException('TPhpStream: Could not write '.TStringFuncFactory::create()->strlen($buf).' bytes');\n      }\n      $buf = TStringFuncFactory::create()->substr($buf, $got);\n    }\n  }\n\n  public function flush() {\n    @fflush($this->outStream_);\n  }\n\n  private static function inStreamName() {\n    if (php_sapi_name() == 'cli') {\n      return 'php://stdin';\n    }\n    return 'php://input';\n  }\n\n}\n"
  },
  {
    "path": "src/Thrift/Transport/TSocket.php",
    "content": "<?php\n/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n *\n * @package thrift.transport\n */\n\nnamespace Thrift\\Transport;\n\nuse Thrift\\Transport\\TTransport;\nuse Thrift\\Exception\\TException;\nuse Thrift\\Exception\\TTransportException;\nuse Thrift\\Factory\\TStringFuncFactory;\n\n/**\n * Sockets implementation of the TTransport interface.\n *\n * @package thrift.transport\n */\nclass TSocket extends TTransport {\n\n  /**\n   * Handle to PHP socket\n   *\n   * @var resource\n   */\n  private $handle_ = null;\n\n  /**\n   * Remote hostname\n   *\n   * @var string\n   */\n  protected $host_ = 'localhost';\n\n  /**\n   * Remote port\n   *\n   * @var int\n   */\n  protected $port_ = '9090';\n\n  /**\n   * Send timeout in seconds.\n   *\n   * Combined with sendTimeoutUsec this is used for send timeouts.\n   *\n   * @var int\n   */\n  private $sendTimeoutSec_ = 0;\n\n  /**\n   * Send timeout in microseconds.\n   *\n   * Combined with sendTimeoutSec this is used for send timeouts.\n   *\n   * @var int\n   */\n  private $sendTimeoutUsec_ = 100000;\n\n  /**\n   * Recv timeout in seconds\n   *\n   * Combined with recvTimeoutUsec this is used for recv timeouts.\n   *\n   * @var int\n   */\n  private $recvTimeoutSec_ = 0;\n\n  /**\n   * Recv timeout in microseconds\n   *\n   * Combined with recvTimeoutSec this is used for recv timeouts.\n   *\n   * @var int\n   */\n  private $recvTimeoutUsec_ = 750000;\n\n  /**\n   * Persistent socket or plain?\n   *\n   * @var bool\n   */\n  protected $persist_ = FALSE;\n\n  /**\n   * Debugging on?\n   *\n   * @var bool\n   */\n  protected $debug_ = FALSE;\n\n  /**\n   * Debug handler\n   *\n   * @var mixed\n   */\n  protected $debugHandler_ = null;\n\n  /**\n   * Socket constructor\n   *\n   * @param string $host         Remote hostname\n   * @param int    $port         Remote port\n   * @param bool   $persist      Whether to use a persistent socket\n   * @param string $debugHandler Function to call for error logging\n   */\n  public function __construct($host='localhost',\n                              $port=9090,\n                              $persist=FALSE,\n                              $debugHandler=null) {\n    $this->host_ = $host;\n    $this->port_ = $port;\n    $this->persist_ = $persist;\n    $this->debugHandler_ = $debugHandler ? $debugHandler : 'error_log';\n  }\n\n  /**\n   * @param resource $handle\n   * @return void\n   */\n  public function setHandle($handle) {\n    $this->handle_ = $handle;\n  }\n\n  /**\n   * Sets the send timeout.\n   *\n   * @param int $timeout  Timeout in milliseconds.\n   */\n  public function setSendTimeout($timeout) {\n    $this->sendTimeoutSec_ = floor($timeout / 1000);\n    $this->sendTimeoutUsec_ =\n            ($timeout - ($this->sendTimeoutSec_ * 1000)) * 1000;\n  }\n\n  /**\n   * Sets the receive timeout.\n   *\n   * @param int $timeout  Timeout in milliseconds.\n   */\n  public function setRecvTimeout($timeout) {\n    $this->recvTimeoutSec_ = floor($timeout / 1000);\n    $this->recvTimeoutUsec_ =\n            ($timeout - ($this->recvTimeoutSec_ * 1000)) * 1000;\n  }\n\n  /**\n   * Sets debugging output on or off\n   *\n   * @param bool $debug\n   */\n  public function setDebug($debug) {\n    $this->debug_ = $debug;\n  }\n\n  /**\n   * Get the host that this socket is connected to\n   *\n   * @return string host\n   */\n  public function getHost() {\n    return $this->host_;\n  }\n\n  /**\n   * Get the remote port that this socket is connected to\n   *\n   * @return int port\n   */\n  public function getPort() {\n    return $this->port_;\n  }\n\n  /**\n   * Tests whether this is open\n   *\n   * @return bool true if the socket is open\n   */\n  public function isOpen() {\n    return is_resource($this->handle_);\n  }\n\n  /**\n   * Connects the socket.\n   */\n  public function open() {\n    if ($this->isOpen()) {\n      throw new TTransportException('Socket already connected', TTransportException::ALREADY_OPEN);\n    }\n\n    if (empty($this->host_)) {\n      throw new TTransportException('Cannot open null host', TTransportException::NOT_OPEN);\n    }\n\n    if ($this->port_ <= 0) {\n      throw new TTransportException('Cannot open without port', TTransportException::NOT_OPEN);\n    }\n\n    if ($this->persist_) {\n      $this->handle_ = @pfsockopen($this->host_,\n                                   $this->port_,\n                                   $errno,\n                                   $errstr,\n                                   $this->sendTimeoutSec_ + ($this->sendTimeoutUsec_ / 1000000));\n    } else {\n      $this->handle_ = @fsockopen($this->host_,\n                                  $this->port_,\n                                  $errno,\n                                  $errstr,\n                                  $this->sendTimeoutSec_ + ($this->sendTimeoutUsec_ / 1000000));\n    }\n\n    // Connect failed?\n    if ($this->handle_ === FALSE) {\n      $error = 'TSocket: Could not connect to '.$this->host_.':'.$this->port_.' ('.$errstr.' ['.$errno.'])';\n      if ($this->debug_) {\n        call_user_func($this->debugHandler_, $error);\n      }\n      throw new TException($error);\n    }\n  }\n\n  /**\n   * Closes the socket.\n   */\n  public function close() {\n    if (!$this->persist_) {\n      @fclose($this->handle_);\n      $this->handle_ = null;\n    }\n  }\n\n  /**\n   * Read from the socket at most $len bytes.\n   *\n   * This method will not wait for all the requested data, it will return as\n   * soon as any data is received.\n   *\n   * @param int $len Maximum number of bytes to read.\n   * @return string Binary data\n   */\n  public function read($len) {\n    $null = null;\n    $read = array($this->handle_);\n    $readable = @stream_select($read, $null, $null, $this->recvTimeoutSec_, $this->recvTimeoutUsec_);\n\n    if ($readable > 0) {\n      $data = @stream_socket_recvfrom($this->handle_, $len);\n      if ($data === false) {\n          throw new TTransportException('TSocket: Could not read '.$len.' bytes from '.\n                               $this->host_.':'.$this->port_);\n      } elseif($data == '' && feof($this->handle_)) {\n          throw new TTransportException('TSocket read 0 bytes');\n        }\n\n      return $data;\n    } else if ($readable === 0) {\n        throw new TTransportException('TSocket: timed out reading '.$len.' bytes from '.\n                             $this->host_.':'.$this->port_);\n      } else {\n        throw new TTransportException('TSocket: Could not read '.$len.' bytes from '.\n                             $this->host_.':'.$this->port_);\n      }\n    }\n\n  /**\n   * Write to the socket.\n   *\n   * @param string $buf The data to write\n   */\n  public function write($buf) {\n    $null = null;\n    $write = array($this->handle_);\n\n    // keep writing until all the data has been written\n    while (TStringFuncFactory::create()->strlen($buf) > 0) {\n      // wait for stream to become available for writing\n      $writable = @stream_select($null, $write, $null, $this->sendTimeoutSec_, $this->sendTimeoutUsec_);\n      if ($writable > 0) {\n        // write buffer to stream\n        $written = @stream_socket_sendto($this->handle_, $buf);\n        if ($written === -1 || $written === false) {\n          throw new TTransportException('TSocket: Could not write '.TStringFuncFactory::create()->strlen($buf).' bytes '.\n                                   $this->host_.':'.$this->port_);\n        }\n        // determine how much of the buffer is left to write\n        $buf = TStringFuncFactory::create()->substr($buf, $written);\n      } else if ($writable === 0) {\n          throw new TTransportException('TSocket: timed out writing '.TStringFuncFactory::create()->strlen($buf).' bytes from '.\n                               $this->host_.':'.$this->port_);\n        } else {\n            throw new TTransportException('TSocket: Could not write '.TStringFuncFactory::create()->strlen($buf).' bytes '.\n                                 $this->host_.':'.$this->port_);\n        }\n      }\n    }\n\n  /**\n   * Flush output to the socket.\n   *\n   * Since read(), readAll() and write() operate on the sockets directly,\n   * this is a no-op\n   *\n   * If you wish to have flushable buffering behaviour, wrap this TSocket\n   * in a TBufferedTransport.\n   */\n  public function flush() {\n    // no-op\n    }\n  }\n"
  },
  {
    "path": "src/Thrift/Transport/TSocketPool.php",
    "content": "<?php\n/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n *\n * @package thrift.transport\n */\n\nnamespace Thrift\\Transport;\n\nuse Thrift\\Transport\\TSocket;\nuse Thrift\\Exception\\TException;\n\n/**\n * This library makes use of APC cache to make hosts as down in a web\n * environment. If you are running from the CLI or on a system without APC\n * installed, then these null functions will step in and act like cache\n * misses.\n */\nif (!function_exists('apc_fetch')) {\n  function apc_fetch($key) { return FALSE; }\n  function apc_store($key, $var, $ttl=0) { return FALSE; }\n}\n\n/**\n * Sockets implementation of the TTransport interface that allows connection\n * to a pool of servers.\n *\n * @package thrift.transport\n */\nclass TSocketPool extends TSocket {\n\n  /**\n   * Remote servers. Array of associative arrays with 'host' and 'port' keys\n   */\n  private $servers_ = array();\n\n  /**\n   * How many times to retry each host in connect\n   *\n   * @var int\n   */\n  private $numRetries_ = 1;\n\n  /**\n   * Retry interval in seconds, how long to not try a host if it has been\n   * marked as down.\n   *\n   * @var int\n   */\n  private $retryInterval_ = 60;\n\n  /**\n   * Max consecutive failures before marking a host down.\n   *\n   * @var int\n   */\n  private $maxConsecutiveFailures_ = 1;\n\n  /**\n   * Try hosts in order? or Randomized?\n   *\n   * @var bool\n   */\n  private $randomize_ = TRUE;\n\n  /**\n   * Always try last host, even if marked down?\n   *\n   * @var bool\n   */\n  private $alwaysTryLast_ = TRUE;\n\n  /**\n   * Socket pool constructor\n   *\n   * @param array  $hosts        List of remote hostnames\n   * @param mixed  $ports        Array of remote ports, or a single common port\n   * @param bool   $persist      Whether to use a persistent socket\n   * @param mixed  $debugHandler Function for error logging\n   */\n  public function __construct($hosts=array('localhost'),\n                              $ports=array(9090),\n                              $persist=FALSE,\n                              $debugHandler=null) {\n    parent::__construct(null, 0, $persist, $debugHandler);\n\n    if (!is_array($ports)) {\n      $port = $ports;\n      $ports = array();\n      foreach ($hosts as $key => $val) {\n        $ports[$key] = $port;\n      }\n    }\n\n    foreach ($hosts as $key => $host) {\n      $this->servers_ []= array('host' => $host,\n                                'port' => $ports[$key]);\n    }\n  }\n\n  /**\n   * Add a server to the pool\n   *\n   * This function does not prevent you from adding a duplicate server entry.\n   *\n   * @param string $host hostname or IP\n   * @param int $port port\n   */\n  public function addServer($host, $port) {\n    $this->servers_[] = array('host' => $host, 'port' => $port);\n  }\n\n  /**\n   * Sets how many time to keep retrying a host in the connect function.\n   *\n   * @param int $numRetries\n   */\n  public function setNumRetries($numRetries) {\n    $this->numRetries_ = $numRetries;\n  }\n\n  /**\n   * Sets how long to wait until retrying a host if it was marked down\n   *\n   * @param int $numRetries\n   */\n  public function setRetryInterval($retryInterval) {\n    $this->retryInterval_ = $retryInterval;\n  }\n\n  /**\n   * Sets how many time to keep retrying a host before marking it as down.\n   *\n   * @param int $numRetries\n   */\n  public function setMaxConsecutiveFailures($maxConsecutiveFailures) {\n    $this->maxConsecutiveFailures_ = $maxConsecutiveFailures;\n  }\n\n  /**\n   * Turns randomization in connect order on or off.\n   *\n   * @param bool $randomize\n   */\n  public function setRandomize($randomize) {\n    $this->randomize_ = $randomize;\n  }\n\n  /**\n   * Whether to always try the last server.\n   *\n   * @param bool $alwaysTryLast\n   */\n  public function setAlwaysTryLast($alwaysTryLast) {\n    $this->alwaysTryLast_ = $alwaysTryLast;\n  }\n\n\n  /**\n   * Connects the socket by iterating through all the servers in the pool\n   * and trying to find one that works.\n   */\n  public function open() {\n    // Check if we want order randomization\n    if ($this->randomize_) {\n      shuffle($this->servers_);\n    }\n\n    // Count servers to identify the \"last\" one\n    $numServers = count($this->servers_);\n\n    for ($i = 0; $i < $numServers; ++$i) {\n\n      // This extracts the $host and $port variables\n      extract($this->servers_[$i]);\n\n      // Check APC cache for a record of this server being down\n      $failtimeKey = 'thrift_failtime:'.$host.':'.$port.'~';\n\n      // Cache miss? Assume it's OK\n      $lastFailtime = apc_fetch($failtimeKey);\n      if ($lastFailtime === FALSE) {\n        $lastFailtime = 0;\n      }\n\n      $retryIntervalPassed = FALSE;\n\n      // Cache hit...make sure enough the retry interval has elapsed\n      if ($lastFailtime > 0) {\n        $elapsed = time() - $lastFailtime;\n        if ($elapsed > $this->retryInterval_) {\n          $retryIntervalPassed = TRUE;\n          if ($this->debug_) {\n            call_user_func($this->debugHandler_,\n                           'TSocketPool: retryInterval '.\n                           '('.$this->retryInterval_.') '.\n                           'has passed for host '.$host.':'.$port);\n          }\n        }\n      }\n\n      // Only connect if not in the middle of a fail interval, OR if this\n      // is the LAST server we are trying, just hammer away on it\n      $isLastServer = FALSE;\n      if ($this->alwaysTryLast_) {\n        $isLastServer = ($i == ($numServers - 1));\n      }\n\n      if (($lastFailtime === 0) ||\n          ($isLastServer) ||\n          ($lastFailtime > 0 && $retryIntervalPassed)) {\n\n        // Set underlying TSocket params to this one\n        $this->host_ = $host;\n        $this->port_ = $port;\n\n        // Try up to numRetries_ connections per server\n        for ($attempt = 0; $attempt < $this->numRetries_; $attempt++) {\n          try {\n            // Use the underlying TSocket open function\n            parent::open();\n\n            // Only clear the failure counts if required to do so\n            if ($lastFailtime > 0) {\n              apc_store($failtimeKey, 0);\n            }\n\n            // Successful connection, return now\n            return;\n\n          } catch (TException $tx) {\n            // Connection failed\n          }\n        }\n\n        // Mark failure of this host in the cache\n        $consecfailsKey = 'thrift_consecfails:'.$host.':'.$port.'~';\n\n        // Ignore cache misses\n        $consecfails = apc_fetch($consecfailsKey);\n        if ($consecfails === FALSE) {\n          $consecfails = 0;\n        }\n\n        // Increment by one\n        $consecfails++;\n\n        // Log and cache this failure\n        if ($consecfails >= $this->maxConsecutiveFailures_) {\n          if ($this->debug_) {\n            call_user_func($this->debugHandler_,\n                           'TSocketPool: marking '.$host.':'.$port.\n                           ' as down for '.$this->retryInterval_.' secs '.\n                           'after '.$consecfails.' failed attempts.');\n          }\n          // Store the failure time\n          apc_store($failtimeKey, time());\n\n          // Clear the count of consecutive failures\n          apc_store($consecfailsKey, 0);\n        } else {\n          apc_store($consecfailsKey, $consecfails);\n        }\n      }\n    }\n\n    // Oh no; we failed them all. The system is totally ill!\n    $error = 'TSocketPool: All hosts in pool are down. ';\n    $hosts = array();\n    foreach ($this->servers_ as $server) {\n      $hosts []= $server['host'].':'.$server['port'];\n    }\n    $hostlist = implode(',', $hosts);\n    $error .= '('.$hostlist.')';\n    if ($this->debug_) {\n      call_user_func($this->debugHandler_, $error);\n    }\n    throw new TException($error);\n  }\n}\n"
  },
  {
    "path": "src/Thrift/Transport/TTransport.php",
    "content": "<?php\n/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n *\n * @package thrift.transport\n */\n\nnamespace Thrift\\Transport;\n\nuse Thrift\\Factory\\TStringFuncFactory;\n\n/**\n * Base interface for a transport agent.\n *\n * @package thrift.transport\n */\nabstract class TTransport {\n\n  /**\n   * Whether this transport is open.\n   *\n   * @return boolean true if open\n   */\n  public abstract function isOpen();\n\n  /**\n   * Open the transport for reading/writing\n   *\n   * @throws TTransportException if cannot open\n   */\n  public abstract function open();\n\n  /**\n   * Close the transport.\n   */\n  public abstract function close();\n\n  /**\n   * Read some data into the array.\n   *\n   * @param int    $len How much to read\n   * @return string The data that has been read\n   * @throws TTransportException if cannot read any more data\n   */\n  public abstract function read($len);\n\n  /**\n   * Guarantees that the full amount of data is read.\n   *\n   * @return string The data, of exact length\n   * @throws TTransportException if cannot read data\n   */\n  public function readAll($len) {\n    // return $this->read($len);\n\n    $data = '';\n    $got = 0;\n    while (($got = TStringFuncFactory::create()->strlen($data)) < $len) {\n      $data .= $this->read($len - $got);\n    }\n    return $data;\n  }\n\n  /**\n   * Writes the given data out.\n   *\n   * @param string $buf  The data to write\n   * @throws TTransportException if writing fails\n   */\n  public abstract function write($buf);\n\n  /**\n   * Flushes any pending data out of a buffer\n   *\n   * @throws TTransportException if a writing error occurs\n   */\n  public function flush() {}\n}\n"
  },
  {
    "path": "src/Thrift/Type/TConstant.php",
    "content": "<?php\n/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n *\n * @package thrift\n */\n\nnamespace Thrift\\Type;\n\n/**\n * Base class for constant Management\n *\n * @author Xavier HAUSHERR <xavier.hausherr@ebuzzing.com>\n */\nabstract class TConstant\n{\n    /**\n     * Don't instanciate this class\n     */\n    protected function __construct() {}\n\n    /**\n     * Get a constant value\n     * @param string $constant\n     * @return mixed\n     */\n    public static function get($constant)\n    {\n        if(is_null(static::$$constant))\n        {\n            static::$$constant = call_user_func(\n                    sprintf('static::init_%s', $constant)\n                );\n        }\n\n        return static::$$constant;\n    }\n}\n"
  },
  {
    "path": "src/Thrift/Type/TMessageType.php",
    "content": "<?php\n/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n *\n * @package thrift\n */\n\nnamespace Thrift\\Type;\n\n/**\n * Message types for RPC\n */\nclass TMessageType {\n  const CALL  = 1;\n  const REPLY = 2;\n  const EXCEPTION = 3;\n  const ONEWAY = 4;\n}"
  },
  {
    "path": "src/Thrift/Type/TType.php",
    "content": "<?php\n/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n *\n * @package thrift\n */\n\nnamespace Thrift\\Type;\n\n/**\n * Data types that can be sent via Thrift\n */\nclass TType {\n  const STOP   = 0;\n  const VOID   = 1;\n  const BOOL   = 2;\n  const BYTE   = 3;\n  const I08    = 3;\n  const DOUBLE = 4;\n  const I16    = 6;\n  const I32    = 8;\n  const I64    = 10;\n  const STRING = 11;\n  const UTF7   = 11;\n  const STRUCT = 12;\n  const MAP    = 13;\n  const SET    = 14;\n  const LST    = 15;    // N.B. cannot use LIST keyword in PHP!\n  const UTF8   = 16;\n  const UTF16  = 17;\n}\n"
  },
  {
    "path": "src/autoload.php",
    "content": "<?php\n\nfunction autoload($className)\n{\n    $className  = ltrim($className, '\\\\');\n    $vendor     = substr($className, 0, strpos($className, '\\\\'));\n    $namespaces = array(\n        'EDAM',\n        'Thrift',\n        'Evernote'\n    );\n    if (!in_array($vendor, $namespaces)) {\n        return false;\n    }\n\n    $fileName  = '';\n    $namespace = '';\n\n    if ($lastNsPos = strrpos($className, '\\\\')) {\n        $namespace = substr($className, 0, $lastNsPos);\n        $fileName  =  __DIR__ . DIRECTORY_SEPARATOR . str_replace('\\\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;\n        $function  = strtolower($vendor) . 'Autoload';\n        $fileName .= $function($className, $lastNsPos);\n    }\n\n    if (is_file($fileName)) {\n        require $fileName;\n\n        return true;\n    }\n\n    return false;\n}\n\nfunction edamAutoload($className, $lastNsPos)\n{\n    $penultimateNsPos = strrpos($className, '\\\\', $lastNsPos - strlen($className) - 1);\n    $penultimateNs    = substr($className, $penultimateNsPos + 1, $lastNsPos - $penultimateNsPos - 1);\n\n    if (0 === strpos(substr($className, $lastNsPos + 1), $penultimateNs)) {\n        $fileName = $penultimateNs . '.php';\n    } else {\n        $fileName = 'Types.php';\n    }\n\n    return $fileName;\n}\n\nfunction evernoteAutoload($className, $lastNsPos)\n{\n    return genericAutoload($className, $lastNsPos);\n}\n\nfunction thriftAutoload($className, $lastNsPos)\n{\n    return genericAutoload($className, $lastNsPos);\n}\n\nfunction genericAutoload($className, $lastNsPos)\n{\n    return substr($className, $lastNsPos + 1) . '.php';;\n}\n\nspl_autoload_register('autoload');\n"
  },
  {
    "path": "tests/Evernote/Tests/ClientTest.php",
    "content": "<?php\nnamespace Evernote\\Tests;\n\nuse Evernote\\AdvancedClient;\nuse Evernote\\Client;\nuse Evernote\\Tests\\Factory\\ThriftClientFactoryMock;\n\nclass ClientTest extends \\PHPUnit_Framework_TestCase\n{\n    const REGULAR_USER_TOKEN   = 'REGULAR_USER_TOKEN';\n    const BUSINESS_USER_TOKEN  = 'BUSINESS_USER_TOKEN';\n    const BUSINESS_ADMIN_TOKEN = 'BUSINESS_ADMIN_TOKEN';\n\n    /** @var  \\Evernote\\Client */\n    protected $client;\n\n    protected $useFixtures = true;\n\n    protected function requires($var)\n    {\n        if (!array_key_exists($var, $_SERVER)) {\n            $this->markTestSkipped();\n        }\n\n        return $_SERVER[$var];\n    }\n\n    public function getClient($token, $token_type, $sandbox = true, $useFixtures = null)\n    {\n        $useFixtures = (null === $useFixtures) ? $this->useFixtures : $useFixtures;\n        $advancedClient = new AdvancedClient($token, $sandbox, new ThriftClientFactoryMock($token, $token_type, $useFixtures));\n        return new Client($token, $sandbox, $advancedClient);\n    }\n\n    public function test_listNotebooks_regularUser_shouldReturnAllKindsOfNotebooks()\n    {\n        $notebooks = $this->getClient($this->requires(self::REGULAR_USER_TOKEN), self::REGULAR_USER_TOKEN)->listNotebooks();\n\n        $this->assertInternalType('array', $notebooks);\n        $this->assertContainsOnlyInstancesOf('\\Evernote\\Model\\Notebook', $notebooks);\n        $expected = <<<EOF\n\nUser created not shared not published\nINBOX\nUser created and shared\nUser created and published\nUser created, shared and published\nShared with user (All permissions)\nEOF;\n\n        $actual = \"\";\n        array_walk($notebooks, function($value) use (&$actual) {$actual .= \"\\n\" . $value->name;});\n\n        $this->assertEquals($expected, $actual);\n    }\n\n    public function test_listNotebooks_businessUser_shouldReturnAllKindsOfNotebooks()\n    {\n        $notebooks = $this->getClient($this->requires(self::BUSINESS_USER_TOKEN), self::BUSINESS_USER_TOKEN)->listNotebooks();\n\n        $this->assertInternalType('array', $notebooks);\n        $this->assertContainsOnlyInstancesOf('\\Evernote\\Model\\Notebook', $notebooks);\n        $expected = <<<EOF\n\nINBOX\nPersonal shared but not published\nPersonal published but not shared\nPersonal shared and published\nBusiness private\nBusiness shared with user\nBusiness shared but not published\nBusiness published but not shared\nBusiness shared and published\nUser created and shared\nEOF;\n\n        $actual = \"\";\n        array_walk($notebooks, function($value) use (&$actual) {$actual .= \"\\n\" . $value->name;});\n\n        $this->assertEquals($expected, $actual);\n    }\n\n    public function test_listNotebooks_businessAdmin_shouldReturnAllKindsOfNotebooks()\n    {\n        $notebooks = $this->getClient($this->requires(self::BUSINESS_ADMIN_TOKEN), self::BUSINESS_ADMIN_TOKEN)->listNotebooks();\n\n        $this->assertInternalType('array', $notebooks);\n        $this->assertContainsOnlyInstancesOf('\\Evernote\\Model\\Notebook', $notebooks);\n        $expected = <<<EOF\n\nINBOX\nPersonal shared but not published\nPersonal published but not shared\nPersonal shared and published\nBusiness Notebook 1\nBusiness shared but not published\nMy shared notebook\nPrivate business\nBusiness shared but not published bis\nBusiness published but not shared\nBusiness published and shared\nEOF;\n\n        $actual = \"\";\n        array_walk($notebooks, function($value) use (&$actual) {$actual .= \"\\n\" . $value->name;});\n\n        $this->assertEquals($expected, $actual);\n    }\n}\n"
  },
  {
    "path": "tests/Evernote/Tests/Factory/ThriftClientFactoryMock.php",
    "content": "<?php\n\nnamespace Evernote\\Tests\\Factory;\n\nuse Evernote\\Factory\\ThriftClientFactory;\n\nclass ThriftClientFactoryMock\n{\n    protected $token;\n    protected $tokenType;\n    protected $useFixtures;\n\n    public function __construct($token, $token_type, $useFixtures = true)\n    {\n        $this->token       = $token;\n        $this->tokenType   = $token_type;\n        $this->useFixtures = $useFixtures;\n    }\n\n    public function createThriftClient($type, $url)\n    {\n        return new ThriftClient($type, $url, $this->token, $this->tokenType, $this->useFixtures);\n    }\n}\n\nclass ThriftClient\n{\n    protected $type;\n    protected $url;\n    protected $token;\n    protected $tokenType;\n    protected $useFixtures;\n\n    public function __construct($type, $url, $token, $token_type, $useFixtures)\n    {\n        $this->type        = $type;\n        $this->url         = $url;\n        $this->token       = $token;\n        $this->tokenType   = $token_type;\n        $this->useFixtures = $useFixtures;\n    }\n\n    public function __call($name, $args)\n    {\n        $file = $this->generateFixtureFilename($name, $args);\n\n        if ($this->useFixtures && is_file($file) && is_readable($file)) {\n            $response = unserialize(file_get_contents($file));\n\n            if (!empty($response)) {\n                if ($response instanceof \\Exception) {\n                    throw $response;\n                }\n\n                return $response;\n            }\n        }\n\n        $realThriftClientFactory = new ThriftClientFactory();\n        $client = $realThriftClientFactory->createThriftClient($this->type, $this->url);\n\n        try {\n            $response = call_user_func_array(array($client, $name), $args);\n            file_put_contents($file, serialize($response));\n        } catch (\\Exception $e) {\n            file_put_contents($file, serialize($e));\n            throw $e;\n        }\n\n        return $response;\n    }\n\n    private function generateFixtureFilename($name, $args)\n    {\n        $store = ucfirst($this->type) . 'Store';\n\n        $clientClass = '\\EDAM\\\\' . $store . '\\\\' . $store . 'Client';\n\n        $method = new \\ReflectionMethod($clientClass, $name);\n        foreach ($method->getParameters() as $param) {\n            if ('authenticationToken' === $param->getName()) {\n                $idx = $param->getPosition();\n                $args[$idx] = $this->tokenType;\n                break;\n            }\n        }\n\n        return __DIR__ . '/../../../fixtures/' . $this->type . '/'\n            . $name . '_' . $this->tokenType . '_'\n            . sha1(str_replace($this->token, $this->tokenType, implode('', $args)));\n    }\n}"
  },
  {
    "path": "tests/bootstrap.php",
    "content": "<?php\n$loader = include __DIR__ . '/../vendor/autoload.php';\n$loader->add('Evernote\\Tests', __DIR__);"
  },
  {
    "path": "tests/fixtures/note/authenticateToSharedNotebook_BUSINESS_ADMIN_TOKEN_1d9fc47121ec77f859917916d8d773c44190b332",
    "content": "O:35:\"EDAM\\UserStore\\AuthenticationResult\":9:{s:11:\"currentTime\";i:1438028493748;s:19:\"authenticationToken\";s:128:\"S=s1:U=62624:E=14ed1646234:C=14ed12d73b5:P=185:N=7587:R=6242d:A=en-devtoken:V=2:F=14ed00ba548:H=41a64e37e0586b0aa41a993f626e5a71\";s:10:\"expiration\";i:1438032093748;s:4:\"user\";O:15:\"EDAM\\Types\\User\":15:{s:2:\"id\";i:402980;s:8:\"username\";s:25:\"_business_businessaccount\";s:5:\"email\";N;s:4:\"name\";s:15:\"BusinessAccount\";s:8:\"timezone\";N;s:9:\"privilege\";i:3;s:7:\"created\";N;s:7:\"updated\";N;s:7:\"deleted\";N;s:6:\"active\";b:1;s:7:\"shardId\";s:2:\"s1\";s:10:\"attributes\";N;s:10:\"accounting\";O:21:\"EDAM\\Types\\Accounting\":23:{s:11:\"uploadLimit\";i:6442450941;s:14:\"uploadLimitEnd\";i:1440140400000;s:20:\"uploadLimitNextMonth\";i:6442450941;s:20:\"premiumServiceStatus\";i:2;s:18:\"premiumOrderNumber\";N;s:22:\"premiumCommerceService\";N;s:19:\"premiumServiceStart\";N;s:17:\"premiumServiceSKU\";N;s:20:\"lastSuccessfulCharge\";N;s:16:\"lastFailedCharge\";N;s:22:\"lastFailedChargeReason\";N;s:14:\"nextPaymentDue\";N;s:16:\"premiumLockUntil\";N;s:7:\"updated\";N;s:25:\"premiumSubscriptionNumber\";N;s:19:\"lastRequestedCharge\";N;s:8:\"currency\";N;s:9:\"unitPrice\";N;s:10:\"businessId\";N;s:12:\"businessName\";N;s:12:\"businessRole\";N;s:12:\"unitDiscount\";N;s:14:\"nextChargeDate\";N;}s:11:\"premiumInfo\";N;s:16:\"businessUserInfo\";N;}s:14:\"publicUserInfo\";O:29:\"EDAM\\UserStore\\PublicUserInfo\":6:{s:6:\"userId\";i:402980;s:7:\"shardId\";s:2:\"s1\";s:9:\"privilege\";i:3;s:8:\"username\";s:25:\"_business_businessaccount\";s:12:\"noteStoreUrl\";s:47:\"https://sandbox.evernote.com/shard/s1/notestore\";s:15:\"webApiUrlPrefix\";s:38:\"https://sandbox.evernote.com/shard/s1/\";}s:12:\"noteStoreUrl\";s:47:\"https://sandbox.evernote.com/shard/s1/notestore\";s:15:\"webApiUrlPrefix\";s:38:\"https://sandbox.evernote.com/shard/s1/\";s:20:\"secondFactorRequired\";N;s:24:\"secondFactorDeliveryHint\";N;}"
  },
  {
    "path": "tests/fixtures/note/authenticateToSharedNotebook_BUSINESS_ADMIN_TOKEN_4308453c30010f6fddcfcbf282b8cd29e44af0a1",
    "content": "O:35:\"EDAM\\UserStore\\AuthenticationResult\":9:{s:11:\"currentTime\";i:1438028502894;s:19:\"authenticationToken\";s:128:\"S=s1:U=62624:E=14ed16485ee:C=14ed12d976f:P=185:N=8475:R=6242d:A=en-devtoken:V=2:F=14ed00ba548:H=314267654bbad2f685d28a12b231bdea\";s:10:\"expiration\";i:1438032102894;s:4:\"user\";O:15:\"EDAM\\Types\\User\":15:{s:2:\"id\";i:402980;s:8:\"username\";s:25:\"_business_businessaccount\";s:5:\"email\";N;s:4:\"name\";s:15:\"BusinessAccount\";s:8:\"timezone\";N;s:9:\"privilege\";i:3;s:7:\"created\";N;s:7:\"updated\";N;s:7:\"deleted\";N;s:6:\"active\";b:1;s:7:\"shardId\";s:2:\"s1\";s:10:\"attributes\";N;s:10:\"accounting\";O:21:\"EDAM\\Types\\Accounting\":23:{s:11:\"uploadLimit\";i:6442450941;s:14:\"uploadLimitEnd\";i:1440140400000;s:20:\"uploadLimitNextMonth\";i:6442450941;s:20:\"premiumServiceStatus\";i:2;s:18:\"premiumOrderNumber\";N;s:22:\"premiumCommerceService\";N;s:19:\"premiumServiceStart\";N;s:17:\"premiumServiceSKU\";N;s:20:\"lastSuccessfulCharge\";N;s:16:\"lastFailedCharge\";N;s:22:\"lastFailedChargeReason\";N;s:14:\"nextPaymentDue\";N;s:16:\"premiumLockUntil\";N;s:7:\"updated\";N;s:25:\"premiumSubscriptionNumber\";N;s:19:\"lastRequestedCharge\";N;s:8:\"currency\";N;s:9:\"unitPrice\";N;s:10:\"businessId\";N;s:12:\"businessName\";N;s:12:\"businessRole\";N;s:12:\"unitDiscount\";N;s:14:\"nextChargeDate\";N;}s:11:\"premiumInfo\";N;s:16:\"businessUserInfo\";N;}s:14:\"publicUserInfo\";O:29:\"EDAM\\UserStore\\PublicUserInfo\":6:{s:6:\"userId\";i:402980;s:7:\"shardId\";s:2:\"s1\";s:9:\"privilege\";i:3;s:8:\"username\";s:25:\"_business_businessaccount\";s:12:\"noteStoreUrl\";s:47:\"https://sandbox.evernote.com/shard/s1/notestore\";s:15:\"webApiUrlPrefix\";s:38:\"https://sandbox.evernote.com/shard/s1/\";}s:12:\"noteStoreUrl\";s:47:\"https://sandbox.evernote.com/shard/s1/notestore\";s:15:\"webApiUrlPrefix\";s:38:\"https://sandbox.evernote.com/shard/s1/\";s:20:\"secondFactorRequired\";N;s:24:\"secondFactorDeliveryHint\";N;}"
  },
  {
    "path": "tests/fixtures/note/authenticateToSharedNotebook_BUSINESS_ADMIN_TOKEN_73b11960aeaa2ba866b406c2a93ed03f16db36d9",
    "content": "O:35:\"EDAM\\UserStore\\AuthenticationResult\":9:{s:11:\"currentTime\";i:1438028496218;s:19:\"authenticationToken\";s:128:\"S=s1:U=62624:E=14ed1646bda:C=14ed12d7d5b:P=185:N=8465:R=6242d:A=en-devtoken:V=2:F=14ed00ba548:H=7543ef876917bf5b6d8fff1918bcb943\";s:10:\"expiration\";i:1438032096218;s:4:\"user\";O:15:\"EDAM\\Types\\User\":15:{s:2:\"id\";i:402980;s:8:\"username\";s:25:\"_business_businessaccount\";s:5:\"email\";N;s:4:\"name\";s:15:\"BusinessAccount\";s:8:\"timezone\";N;s:9:\"privilege\";i:3;s:7:\"created\";N;s:7:\"updated\";N;s:7:\"deleted\";N;s:6:\"active\";b:1;s:7:\"shardId\";s:2:\"s1\";s:10:\"attributes\";N;s:10:\"accounting\";O:21:\"EDAM\\Types\\Accounting\":23:{s:11:\"uploadLimit\";i:6442450941;s:14:\"uploadLimitEnd\";i:1440140400000;s:20:\"uploadLimitNextMonth\";i:6442450941;s:20:\"premiumServiceStatus\";i:2;s:18:\"premiumOrderNumber\";N;s:22:\"premiumCommerceService\";N;s:19:\"premiumServiceStart\";N;s:17:\"premiumServiceSKU\";N;s:20:\"lastSuccessfulCharge\";N;s:16:\"lastFailedCharge\";N;s:22:\"lastFailedChargeReason\";N;s:14:\"nextPaymentDue\";N;s:16:\"premiumLockUntil\";N;s:7:\"updated\";N;s:25:\"premiumSubscriptionNumber\";N;s:19:\"lastRequestedCharge\";N;s:8:\"currency\";N;s:9:\"unitPrice\";N;s:10:\"businessId\";N;s:12:\"businessName\";N;s:12:\"businessRole\";N;s:12:\"unitDiscount\";N;s:14:\"nextChargeDate\";N;}s:11:\"premiumInfo\";N;s:16:\"businessUserInfo\";N;}s:14:\"publicUserInfo\";O:29:\"EDAM\\UserStore\\PublicUserInfo\":6:{s:6:\"userId\";i:402980;s:7:\"shardId\";s:2:\"s1\";s:9:\"privilege\";i:3;s:8:\"username\";s:25:\"_business_businessaccount\";s:12:\"noteStoreUrl\";s:47:\"https://sandbox.evernote.com/shard/s1/notestore\";s:15:\"webApiUrlPrefix\";s:38:\"https://sandbox.evernote.com/shard/s1/\";}s:12:\"noteStoreUrl\";s:47:\"https://sandbox.evernote.com/shard/s1/notestore\";s:15:\"webApiUrlPrefix\";s:38:\"https://sandbox.evernote.com/shard/s1/\";s:20:\"secondFactorRequired\";N;s:24:\"secondFactorDeliveryHint\";N;}"
  },
  {
    "path": "tests/fixtures/note/authenticateToSharedNotebook_BUSINESS_ADMIN_TOKEN_8d241b577460159e730d3b82088ce127583e2bec",
    "content": "O:35:\"EDAM\\UserStore\\AuthenticationResult\":9:{s:11:\"currentTime\";i:1438028500228;s:19:\"authenticationToken\";s:128:\"S=s1:U=62624:E=14ed1647b84:C=14ed12d8d05:P=185:N=8472:R=6242d:A=en-devtoken:V=2:F=14ed00ba548:H=fb6bfb888de95b836343872991a2a40c\";s:10:\"expiration\";i:1438032100228;s:4:\"user\";O:15:\"EDAM\\Types\\User\":15:{s:2:\"id\";i:402980;s:8:\"username\";s:25:\"_business_businessaccount\";s:5:\"email\";N;s:4:\"name\";s:15:\"BusinessAccount\";s:8:\"timezone\";N;s:9:\"privilege\";i:3;s:7:\"created\";N;s:7:\"updated\";N;s:7:\"deleted\";N;s:6:\"active\";b:1;s:7:\"shardId\";s:2:\"s1\";s:10:\"attributes\";N;s:10:\"accounting\";O:21:\"EDAM\\Types\\Accounting\":23:{s:11:\"uploadLimit\";i:6442450941;s:14:\"uploadLimitEnd\";i:1440140400000;s:20:\"uploadLimitNextMonth\";i:6442450941;s:20:\"premiumServiceStatus\";i:2;s:18:\"premiumOrderNumber\";N;s:22:\"premiumCommerceService\";N;s:19:\"premiumServiceStart\";N;s:17:\"premiumServiceSKU\";N;s:20:\"lastSuccessfulCharge\";N;s:16:\"lastFailedCharge\";N;s:22:\"lastFailedChargeReason\";N;s:14:\"nextPaymentDue\";N;s:16:\"premiumLockUntil\";N;s:7:\"updated\";N;s:25:\"premiumSubscriptionNumber\";N;s:19:\"lastRequestedCharge\";N;s:8:\"currency\";N;s:9:\"unitPrice\";N;s:10:\"businessId\";N;s:12:\"businessName\";N;s:12:\"businessRole\";N;s:12:\"unitDiscount\";N;s:14:\"nextChargeDate\";N;}s:11:\"premiumInfo\";N;s:16:\"businessUserInfo\";N;}s:14:\"publicUserInfo\";O:29:\"EDAM\\UserStore\\PublicUserInfo\":6:{s:6:\"userId\";i:402980;s:7:\"shardId\";s:2:\"s1\";s:9:\"privilege\";i:3;s:8:\"username\";s:25:\"_business_businessaccount\";s:12:\"noteStoreUrl\";s:47:\"https://sandbox.evernote.com/shard/s1/notestore\";s:15:\"webApiUrlPrefix\";s:38:\"https://sandbox.evernote.com/shard/s1/\";}s:12:\"noteStoreUrl\";s:47:\"https://sandbox.evernote.com/shard/s1/notestore\";s:15:\"webApiUrlPrefix\";s:38:\"https://sandbox.evernote.com/shard/s1/\";s:20:\"secondFactorRequired\";N;s:24:\"secondFactorDeliveryHint\";N;}"
  },
  {
    "path": "tests/fixtures/note/authenticateToSharedNotebook_BUSINESS_ADMIN_TOKEN_9577897cad7bf1e37f2606087f3f693f47506bd3",
    "content": "O:35:\"EDAM\\UserStore\\AuthenticationResult\":9:{s:11:\"currentTime\";i:1438028498894;s:19:\"authenticationToken\";s:128:\"S=s1:U=62624:E=14ed164764e:C=14ed12d87cf:P=185:N=8471:R=6242d:A=en-devtoken:V=2:F=14ed00ba548:H=70fb5740ed8f561b61232089fff25d0e\";s:10:\"expiration\";i:1438032098894;s:4:\"user\";O:15:\"EDAM\\Types\\User\":15:{s:2:\"id\";i:402980;s:8:\"username\";s:25:\"_business_businessaccount\";s:5:\"email\";N;s:4:\"name\";s:15:\"BusinessAccount\";s:8:\"timezone\";N;s:9:\"privilege\";i:3;s:7:\"created\";N;s:7:\"updated\";N;s:7:\"deleted\";N;s:6:\"active\";b:1;s:7:\"shardId\";s:2:\"s1\";s:10:\"attributes\";N;s:10:\"accounting\";O:21:\"EDAM\\Types\\Accounting\":23:{s:11:\"uploadLimit\";i:6442450941;s:14:\"uploadLimitEnd\";i:1440140400000;s:20:\"uploadLimitNextMonth\";i:6442450941;s:20:\"premiumServiceStatus\";i:2;s:18:\"premiumOrderNumber\";N;s:22:\"premiumCommerceService\";N;s:19:\"premiumServiceStart\";N;s:17:\"premiumServiceSKU\";N;s:20:\"lastSuccessfulCharge\";N;s:16:\"lastFailedCharge\";N;s:22:\"lastFailedChargeReason\";N;s:14:\"nextPaymentDue\";N;s:16:\"premiumLockUntil\";N;s:7:\"updated\";N;s:25:\"premiumSubscriptionNumber\";N;s:19:\"lastRequestedCharge\";N;s:8:\"currency\";N;s:9:\"unitPrice\";N;s:10:\"businessId\";N;s:12:\"businessName\";N;s:12:\"businessRole\";N;s:12:\"unitDiscount\";N;s:14:\"nextChargeDate\";N;}s:11:\"premiumInfo\";N;s:16:\"businessUserInfo\";N;}s:14:\"publicUserInfo\";O:29:\"EDAM\\UserStore\\PublicUserInfo\":6:{s:6:\"userId\";i:402980;s:7:\"shardId\";s:2:\"s1\";s:9:\"privilege\";i:3;s:8:\"username\";s:25:\"_business_businessaccount\";s:12:\"noteStoreUrl\";s:47:\"https://sandbox.evernote.com/shard/s1/notestore\";s:15:\"webApiUrlPrefix\";s:38:\"https://sandbox.evernote.com/shard/s1/\";}s:12:\"noteStoreUrl\";s:47:\"https://sandbox.evernote.com/shard/s1/notestore\";s:15:\"webApiUrlPrefix\";s:38:\"https://sandbox.evernote.com/shard/s1/\";s:20:\"secondFactorRequired\";N;s:24:\"secondFactorDeliveryHint\";N;}"
  },
  {
    "path": "tests/fixtures/note/authenticateToSharedNotebook_BUSINESS_ADMIN_TOKEN_a99bcc7351d22c34ea3a721ee456bd94de037d8c",
    "content": "O:35:\"EDAM\\UserStore\\AuthenticationResult\":9:{s:11:\"currentTime\";i:1438028501567;s:19:\"authenticationToken\";s:128:\"S=s1:U=62624:E=14ed16480bf:C=14ed12d9241:P=185:N=8474:R=6242d:A=en-devtoken:V=2:F=14ed00ba548:H=dd32553d279e06846b5f1f91f5a8673b\";s:10:\"expiration\";i:1438032101567;s:4:\"user\";O:15:\"EDAM\\Types\\User\":15:{s:2:\"id\";i:402980;s:8:\"username\";s:25:\"_business_businessaccount\";s:5:\"email\";N;s:4:\"name\";s:15:\"BusinessAccount\";s:8:\"timezone\";N;s:9:\"privilege\";i:3;s:7:\"created\";N;s:7:\"updated\";N;s:7:\"deleted\";N;s:6:\"active\";b:1;s:7:\"shardId\";s:2:\"s1\";s:10:\"attributes\";N;s:10:\"accounting\";O:21:\"EDAM\\Types\\Accounting\":23:{s:11:\"uploadLimit\";i:6442450941;s:14:\"uploadLimitEnd\";i:1440140400000;s:20:\"uploadLimitNextMonth\";i:6442450941;s:20:\"premiumServiceStatus\";i:2;s:18:\"premiumOrderNumber\";N;s:22:\"premiumCommerceService\";N;s:19:\"premiumServiceStart\";N;s:17:\"premiumServiceSKU\";N;s:20:\"lastSuccessfulCharge\";N;s:16:\"lastFailedCharge\";N;s:22:\"lastFailedChargeReason\";N;s:14:\"nextPaymentDue\";N;s:16:\"premiumLockUntil\";N;s:7:\"updated\";N;s:25:\"premiumSubscriptionNumber\";N;s:19:\"lastRequestedCharge\";N;s:8:\"currency\";N;s:9:\"unitPrice\";N;s:10:\"businessId\";N;s:12:\"businessName\";N;s:12:\"businessRole\";N;s:12:\"unitDiscount\";N;s:14:\"nextChargeDate\";N;}s:11:\"premiumInfo\";N;s:16:\"businessUserInfo\";N;}s:14:\"publicUserInfo\";O:29:\"EDAM\\UserStore\\PublicUserInfo\":6:{s:6:\"userId\";i:402980;s:7:\"shardId\";s:2:\"s1\";s:9:\"privilege\";i:3;s:8:\"username\";s:25:\"_business_businessaccount\";s:12:\"noteStoreUrl\";s:47:\"https://sandbox.evernote.com/shard/s1/notestore\";s:15:\"webApiUrlPrefix\";s:38:\"https://sandbox.evernote.com/shard/s1/\";}s:12:\"noteStoreUrl\";s:47:\"https://sandbox.evernote.com/shard/s1/notestore\";s:15:\"webApiUrlPrefix\";s:38:\"https://sandbox.evernote.com/shard/s1/\";s:20:\"secondFactorRequired\";N;s:24:\"secondFactorDeliveryHint\";N;}"
  },
  {
    "path": "tests/fixtures/note/authenticateToSharedNotebook_BUSINESS_ADMIN_TOKEN_c20b1b0b4a29805231df016645ecd8d10df5f482",
    "content": "O:35:\"EDAM\\UserStore\\AuthenticationResult\":9:{s:11:\"currentTime\";i:1438028497541;s:19:\"authenticationToken\";s:114:\"S=s1:U=6242c:E=14ed1647105:C=14ed12d8287:P=185:N=8470:R=6242d:A=en-devtoken:V=2:H=c0a5b0b97fafed13aa85a8834d180c00\";s:10:\"expiration\";i:1438032097541;s:4:\"user\";O:15:\"EDAM\\Types\\User\":15:{s:2:\"id\";i:402476;s:8:\"username\";s:28:\"laurent_sarrazin_sbx_premium\";s:5:\"email\";N;s:4:\"name\";N;s:8:\"timezone\";s:13:\"Europe/Tirane\";s:9:\"privilege\";i:1;s:7:\"created\";N;s:7:\"updated\";N;s:7:\"deleted\";N;s:6:\"active\";b:1;s:7:\"shardId\";s:2:\"s1\";s:10:\"attributes\";N;s:10:\"accounting\";O:21:\"EDAM\\Types\\Accounting\":23:{s:11:\"uploadLimit\";i:62914560;s:14:\"uploadLimitEnd\";i:1440054000000;s:20:\"uploadLimitNextMonth\";i:62914560;s:20:\"premiumServiceStatus\";i:5;s:18:\"premiumOrderNumber\";N;s:22:\"premiumCommerceService\";N;s:19:\"premiumServiceStart\";N;s:17:\"premiumServiceSKU\";N;s:20:\"lastSuccessfulCharge\";N;s:16:\"lastFailedCharge\";N;s:22:\"lastFailedChargeReason\";N;s:14:\"nextPaymentDue\";N;s:16:\"premiumLockUntil\";N;s:7:\"updated\";N;s:25:\"premiumSubscriptionNumber\";N;s:19:\"lastRequestedCharge\";N;s:8:\"currency\";N;s:9:\"unitPrice\";N;s:10:\"businessId\";N;s:12:\"businessName\";N;s:12:\"businessRole\";N;s:12:\"unitDiscount\";N;s:14:\"nextChargeDate\";N;}s:11:\"premiumInfo\";N;s:16:\"businessUserInfo\";N;}s:14:\"publicUserInfo\";O:29:\"EDAM\\UserStore\\PublicUserInfo\":6:{s:6:\"userId\";i:402476;s:7:\"shardId\";s:2:\"s1\";s:9:\"privilege\";i:1;s:8:\"username\";s:28:\"laurent_sarrazin_sbx_premium\";s:12:\"noteStoreUrl\";s:47:\"https://sandbox.evernote.com/shard/s1/notestore\";s:15:\"webApiUrlPrefix\";s:38:\"https://sandbox.evernote.com/shard/s1/\";}s:12:\"noteStoreUrl\";s:47:\"https://sandbox.evernote.com/shard/s1/notestore\";s:15:\"webApiUrlPrefix\";s:38:\"https://sandbox.evernote.com/shard/s1/\";s:20:\"secondFactorRequired\";N;s:24:\"secondFactorDeliveryHint\";N;}"
  },
  {
    "path": "tests/fixtures/note/authenticateToSharedNotebook_BUSINESS_USER_TOKEN_3e6b2af694337e2953fccfd591ac7a23ac9cc541",
    "content": "O:35:\"EDAM\\UserStore\\AuthenticationResult\":9:{s:11:\"currentTime\";i:1438005164586;s:19:\"authenticationToken\";s:128:\"S=s1:U=62624:E=14ed00068aa:C=14ecfc97a2a:P=185:N=7588:R=6285a:A=en-devtoken:V=2:F=14ece91bb30:H=82ca85639556a7e6f65f529a8b9b1603\";s:10:\"expiration\";i:1438008764586;s:4:\"user\";O:15:\"EDAM\\Types\\User\":15:{s:2:\"id\";i:402980;s:8:\"username\";s:25:\"_business_businessaccount\";s:5:\"email\";N;s:4:\"name\";s:15:\"BusinessAccount\";s:8:\"timezone\";N;s:9:\"privilege\";i:3;s:7:\"created\";N;s:7:\"updated\";N;s:7:\"deleted\";N;s:6:\"active\";b:1;s:7:\"shardId\";s:2:\"s1\";s:10:\"attributes\";N;s:10:\"accounting\";O:21:\"EDAM\\Types\\Accounting\":23:{s:11:\"uploadLimit\";i:6442450941;s:14:\"uploadLimitEnd\";i:1440140400000;s:20:\"uploadLimitNextMonth\";i:6442450941;s:20:\"premiumServiceStatus\";i:2;s:18:\"premiumOrderNumber\";N;s:22:\"premiumCommerceService\";N;s:19:\"premiumServiceStart\";N;s:17:\"premiumServiceSKU\";N;s:20:\"lastSuccessfulCharge\";N;s:16:\"lastFailedCharge\";N;s:22:\"lastFailedChargeReason\";N;s:14:\"nextPaymentDue\";N;s:16:\"premiumLockUntil\";N;s:7:\"updated\";N;s:25:\"premiumSubscriptionNumber\";N;s:19:\"lastRequestedCharge\";N;s:8:\"currency\";N;s:9:\"unitPrice\";N;s:10:\"businessId\";N;s:12:\"businessName\";N;s:12:\"businessRole\";N;s:12:\"unitDiscount\";N;s:14:\"nextChargeDate\";N;}s:11:\"premiumInfo\";N;s:16:\"businessUserInfo\";N;}s:14:\"publicUserInfo\";O:29:\"EDAM\\UserStore\\PublicUserInfo\":6:{s:6:\"userId\";i:402980;s:7:\"shardId\";s:2:\"s1\";s:9:\"privilege\";i:3;s:8:\"username\";s:25:\"_business_businessaccount\";s:12:\"noteStoreUrl\";s:47:\"https://sandbox.evernote.com/shard/s1/notestore\";s:15:\"webApiUrlPrefix\";s:38:\"https://sandbox.evernote.com/shard/s1/\";}s:12:\"noteStoreUrl\";s:47:\"https://sandbox.evernote.com/shard/s1/notestore\";s:15:\"webApiUrlPrefix\";s:38:\"https://sandbox.evernote.com/shard/s1/\";s:20:\"secondFactorRequired\";N;s:24:\"secondFactorDeliveryHint\";N;}"
  },
  {
    "path": "tests/fixtures/note/authenticateToSharedNotebook_BUSINESS_USER_TOKEN_530966c9d987f0a33eb4aae4795088981d09de2d",
    "content": "O:35:\"EDAM\\UserStore\\AuthenticationResult\":9:{s:11:\"currentTime\";i:1438005165742;s:19:\"authenticationToken\";s:128:\"S=s1:U=62624:E=14ed0006d2e:C=14ecfc97eaf:P=185:N=845e:R=6285a:A=en-devtoken:V=2:F=14ece91bb30:H=99d0bdde89bbcc0d621b5f37ae672255\";s:10:\"expiration\";i:1438008765742;s:4:\"user\";O:15:\"EDAM\\Types\\User\":15:{s:2:\"id\";i:402980;s:8:\"username\";s:25:\"_business_businessaccount\";s:5:\"email\";N;s:4:\"name\";s:15:\"BusinessAccount\";s:8:\"timezone\";N;s:9:\"privilege\";i:3;s:7:\"created\";N;s:7:\"updated\";N;s:7:\"deleted\";N;s:6:\"active\";b:1;s:7:\"shardId\";s:2:\"s1\";s:10:\"attributes\";N;s:10:\"accounting\";O:21:\"EDAM\\Types\\Accounting\":23:{s:11:\"uploadLimit\";i:6442450941;s:14:\"uploadLimitEnd\";i:1440140400000;s:20:\"uploadLimitNextMonth\";i:6442450941;s:20:\"premiumServiceStatus\";i:2;s:18:\"premiumOrderNumber\";N;s:22:\"premiumCommerceService\";N;s:19:\"premiumServiceStart\";N;s:17:\"premiumServiceSKU\";N;s:20:\"lastSuccessfulCharge\";N;s:16:\"lastFailedCharge\";N;s:22:\"lastFailedChargeReason\";N;s:14:\"nextPaymentDue\";N;s:16:\"premiumLockUntil\";N;s:7:\"updated\";N;s:25:\"premiumSubscriptionNumber\";N;s:19:\"lastRequestedCharge\";N;s:8:\"currency\";N;s:9:\"unitPrice\";N;s:10:\"businessId\";N;s:12:\"businessName\";N;s:12:\"businessRole\";N;s:12:\"unitDiscount\";N;s:14:\"nextChargeDate\";N;}s:11:\"premiumInfo\";N;s:16:\"businessUserInfo\";N;}s:14:\"publicUserInfo\";O:29:\"EDAM\\UserStore\\PublicUserInfo\":6:{s:6:\"userId\";i:402980;s:7:\"shardId\";s:2:\"s1\";s:9:\"privilege\";i:3;s:8:\"username\";s:25:\"_business_businessaccount\";s:12:\"noteStoreUrl\";s:47:\"https://sandbox.evernote.com/shard/s1/notestore\";s:15:\"webApiUrlPrefix\";s:38:\"https://sandbox.evernote.com/shard/s1/\";}s:12:\"noteStoreUrl\";s:47:\"https://sandbox.evernote.com/shard/s1/notestore\";s:15:\"webApiUrlPrefix\";s:38:\"https://sandbox.evernote.com/shard/s1/\";s:20:\"secondFactorRequired\";N;s:24:\"secondFactorDeliveryHint\";N;}"
  },
  {
    "path": "tests/fixtures/note/authenticateToSharedNotebook_BUSINESS_USER_TOKEN_98109d118517ebeb7ada77c9db5ab71341f7590f",
    "content": "O:35:\"EDAM\\UserStore\\AuthenticationResult\":9:{s:11:\"currentTime\";i:1438005169264;s:19:\"authenticationToken\";s:114:\"S=s1:U=62418:E=14ed0007af0:C=14ecfc98c71:P=185:N=8467:R=6285a:A=en-devtoken:V=2:H=c4e61241595a83581e7581733aab8f4e\";s:10:\"expiration\";i:1438008769264;s:4:\"user\";O:15:\"EDAM\\Types\\User\":15:{s:2:\"id\";i:402456;s:8:\"username\";s:25:\"laurent_sarrazin_sbx_free\";s:5:\"email\";N;s:4:\"name\";N;s:8:\"timezone\";N;s:9:\"privilege\";i:1;s:7:\"created\";N;s:7:\"updated\";N;s:7:\"deleted\";N;s:6:\"active\";b:1;s:7:\"shardId\";s:2:\"s1\";s:10:\"attributes\";N;s:10:\"accounting\";O:21:\"EDAM\\Types\\Accounting\":23:{s:11:\"uploadLimit\";i:62914560;s:14:\"uploadLimitEnd\";i:1439967600000;s:20:\"uploadLimitNextMonth\";i:62914560;s:20:\"premiumServiceStatus\";i:0;s:18:\"premiumOrderNumber\";N;s:22:\"premiumCommerceService\";N;s:19:\"premiumServiceStart\";N;s:17:\"premiumServiceSKU\";N;s:20:\"lastSuccessfulCharge\";N;s:16:\"lastFailedCharge\";N;s:22:\"lastFailedChargeReason\";N;s:14:\"nextPaymentDue\";N;s:16:\"premiumLockUntil\";N;s:7:\"updated\";N;s:25:\"premiumSubscriptionNumber\";N;s:19:\"lastRequestedCharge\";N;s:8:\"currency\";N;s:9:\"unitPrice\";N;s:10:\"businessId\";N;s:12:\"businessName\";N;s:12:\"businessRole\";N;s:12:\"unitDiscount\";N;s:14:\"nextChargeDate\";N;}s:11:\"premiumInfo\";N;s:16:\"businessUserInfo\";N;}s:14:\"publicUserInfo\";O:29:\"EDAM\\UserStore\\PublicUserInfo\":6:{s:6:\"userId\";i:402456;s:7:\"shardId\";s:2:\"s1\";s:9:\"privilege\";i:1;s:8:\"username\";s:25:\"laurent_sarrazin_sbx_free\";s:12:\"noteStoreUrl\";s:47:\"https://sandbox.evernote.com/shard/s1/notestore\";s:15:\"webApiUrlPrefix\";s:38:\"https://sandbox.evernote.com/shard/s1/\";}s:12:\"noteStoreUrl\";s:47:\"https://sandbox.evernote.com/shard/s1/notestore\";s:15:\"webApiUrlPrefix\";s:38:\"https://sandbox.evernote.com/shard/s1/\";s:20:\"secondFactorRequired\";N;s:24:\"secondFactorDeliveryHint\";N;}"
  },
  {
    "path": "tests/fixtures/note/authenticateToSharedNotebook_BUSINESS_USER_TOKEN_9cf7cf916a80d10d4e4eeb62398dd60ce497d607",
    "content": "O:35:\"EDAM\\UserStore\\AuthenticationResult\":9:{s:11:\"currentTime\";i:1438005166923;s:19:\"authenticationToken\";s:128:\"S=s1:U=62624:E=14ed00071cb:C=14ecfc9834c:P=185:N=8460:R=6285a:A=en-devtoken:V=2:F=14ece91bb30:H=95ceb9dd2ded12d022dd8c2c900a09c7\";s:10:\"expiration\";i:1438008766923;s:4:\"user\";O:15:\"EDAM\\Types\\User\":15:{s:2:\"id\";i:402980;s:8:\"username\";s:25:\"_business_businessaccount\";s:5:\"email\";N;s:4:\"name\";s:15:\"BusinessAccount\";s:8:\"timezone\";N;s:9:\"privilege\";i:3;s:7:\"created\";N;s:7:\"updated\";N;s:7:\"deleted\";N;s:6:\"active\";b:1;s:7:\"shardId\";s:2:\"s1\";s:10:\"attributes\";N;s:10:\"accounting\";O:21:\"EDAM\\Types\\Accounting\":23:{s:11:\"uploadLimit\";i:6442450941;s:14:\"uploadLimitEnd\";i:1440140400000;s:20:\"uploadLimitNextMonth\";i:6442450941;s:20:\"premiumServiceStatus\";i:2;s:18:\"premiumOrderNumber\";N;s:22:\"premiumCommerceService\";N;s:19:\"premiumServiceStart\";N;s:17:\"premiumServiceSKU\";N;s:20:\"lastSuccessfulCharge\";N;s:16:\"lastFailedCharge\";N;s:22:\"lastFailedChargeReason\";N;s:14:\"nextPaymentDue\";N;s:16:\"premiumLockUntil\";N;s:7:\"updated\";N;s:25:\"premiumSubscriptionNumber\";N;s:19:\"lastRequestedCharge\";N;s:8:\"currency\";N;s:9:\"unitPrice\";N;s:10:\"businessId\";N;s:12:\"businessName\";N;s:12:\"businessRole\";N;s:12:\"unitDiscount\";N;s:14:\"nextChargeDate\";N;}s:11:\"premiumInfo\";N;s:16:\"businessUserInfo\";N;}s:14:\"publicUserInfo\";O:29:\"EDAM\\UserStore\\PublicUserInfo\":6:{s:6:\"userId\";i:402980;s:7:\"shardId\";s:2:\"s1\";s:9:\"privilege\";i:3;s:8:\"username\";s:25:\"_business_businessaccount\";s:12:\"noteStoreUrl\";s:47:\"https://sandbox.evernote.com/shard/s1/notestore\";s:15:\"webApiUrlPrefix\";s:38:\"https://sandbox.evernote.com/shard/s1/\";}s:12:\"noteStoreUrl\";s:47:\"https://sandbox.evernote.com/shard/s1/notestore\";s:15:\"webApiUrlPrefix\";s:38:\"https://sandbox.evernote.com/shard/s1/\";s:20:\"secondFactorRequired\";N;s:24:\"secondFactorDeliveryHint\";N;}"
  },
  {
    "path": "tests/fixtures/note/authenticateToSharedNotebook_BUSINESS_USER_TOKEN_d1901257919570d4c4cc1f2fc47fc1a97327fd92",
    "content": "O:35:\"EDAM\\UserStore\\AuthenticationResult\":9:{s:11:\"currentTime\";i:1438005162250;s:19:\"authenticationToken\";s:128:\"S=s1:U=62624:E=14ed0005f8a:C=14ecfc9710b:P=185:N=7589:R=6285a:A=en-devtoken:V=2:F=14ece91bb30:H=96aed12f05b69d4406bd9921ed455537\";s:10:\"expiration\";i:1438008762250;s:4:\"user\";O:15:\"EDAM\\Types\\User\":15:{s:2:\"id\";i:402980;s:8:\"username\";s:25:\"_business_businessaccount\";s:5:\"email\";N;s:4:\"name\";s:15:\"BusinessAccount\";s:8:\"timezone\";N;s:9:\"privilege\";i:3;s:7:\"created\";N;s:7:\"updated\";N;s:7:\"deleted\";N;s:6:\"active\";b:1;s:7:\"shardId\";s:2:\"s1\";s:10:\"attributes\";N;s:10:\"accounting\";O:21:\"EDAM\\Types\\Accounting\":23:{s:11:\"uploadLimit\";i:6442450941;s:14:\"uploadLimitEnd\";i:1440140400000;s:20:\"uploadLimitNextMonth\";i:6442450941;s:20:\"premiumServiceStatus\";i:2;s:18:\"premiumOrderNumber\";N;s:22:\"premiumCommerceService\";N;s:19:\"premiumServiceStart\";N;s:17:\"premiumServiceSKU\";N;s:20:\"lastSuccessfulCharge\";N;s:16:\"lastFailedCharge\";N;s:22:\"lastFailedChargeReason\";N;s:14:\"nextPaymentDue\";N;s:16:\"premiumLockUntil\";N;s:7:\"updated\";N;s:25:\"premiumSubscriptionNumber\";N;s:19:\"lastRequestedCharge\";N;s:8:\"currency\";N;s:9:\"unitPrice\";N;s:10:\"businessId\";N;s:12:\"businessName\";N;s:12:\"businessRole\";N;s:12:\"unitDiscount\";N;s:14:\"nextChargeDate\";N;}s:11:\"premiumInfo\";N;s:16:\"businessUserInfo\";N;}s:14:\"publicUserInfo\";O:29:\"EDAM\\UserStore\\PublicUserInfo\":6:{s:6:\"userId\";i:402980;s:7:\"shardId\";s:2:\"s1\";s:9:\"privilege\";i:3;s:8:\"username\";s:25:\"_business_businessaccount\";s:12:\"noteStoreUrl\";s:47:\"https://sandbox.evernote.com/shard/s1/notestore\";s:15:\"webApiUrlPrefix\";s:38:\"https://sandbox.evernote.com/shard/s1/\";}s:12:\"noteStoreUrl\";s:47:\"https://sandbox.evernote.com/shard/s1/notestore\";s:15:\"webApiUrlPrefix\";s:38:\"https://sandbox.evernote.com/shard/s1/\";s:20:\"secondFactorRequired\";N;s:24:\"secondFactorDeliveryHint\";N;}"
  },
  {
    "path": "tests/fixtures/note/authenticateToSharedNotebook_BUSINESS_USER_TOKEN_dda1101e9822fbd8d1a1dbeb09df9045e2cd7a6a",
    "content": "O:35:\"EDAM\\UserStore\\AuthenticationResult\":9:{s:11:\"currentTime\";i:1438005168101;s:19:\"authenticationToken\";s:128:\"S=s1:U=62624:E=14ed0007665:C=14ecfc987e6:P=185:N=8461:R=6285a:A=en-devtoken:V=2:F=14ece91bb30:H=54f10588d517eed915364195d6bd9a86\";s:10:\"expiration\";i:1438008768101;s:4:\"user\";O:15:\"EDAM\\Types\\User\":15:{s:2:\"id\";i:402980;s:8:\"username\";s:25:\"_business_businessaccount\";s:5:\"email\";N;s:4:\"name\";s:15:\"BusinessAccount\";s:8:\"timezone\";N;s:9:\"privilege\";i:3;s:7:\"created\";N;s:7:\"updated\";N;s:7:\"deleted\";N;s:6:\"active\";b:1;s:7:\"shardId\";s:2:\"s1\";s:10:\"attributes\";N;s:10:\"accounting\";O:21:\"EDAM\\Types\\Accounting\":23:{s:11:\"uploadLimit\";i:6442450941;s:14:\"uploadLimitEnd\";i:1440140400000;s:20:\"uploadLimitNextMonth\";i:6442450941;s:20:\"premiumServiceStatus\";i:2;s:18:\"premiumOrderNumber\";N;s:22:\"premiumCommerceService\";N;s:19:\"premiumServiceStart\";N;s:17:\"premiumServiceSKU\";N;s:20:\"lastSuccessfulCharge\";N;s:16:\"lastFailedCharge\";N;s:22:\"lastFailedChargeReason\";N;s:14:\"nextPaymentDue\";N;s:16:\"premiumLockUntil\";N;s:7:\"updated\";N;s:25:\"premiumSubscriptionNumber\";N;s:19:\"lastRequestedCharge\";N;s:8:\"currency\";N;s:9:\"unitPrice\";N;s:10:\"businessId\";N;s:12:\"businessName\";N;s:12:\"businessRole\";N;s:12:\"unitDiscount\";N;s:14:\"nextChargeDate\";N;}s:11:\"premiumInfo\";N;s:16:\"businessUserInfo\";N;}s:14:\"publicUserInfo\";O:29:\"EDAM\\UserStore\\PublicUserInfo\":6:{s:6:\"userId\";i:402980;s:7:\"shardId\";s:2:\"s1\";s:9:\"privilege\";i:3;s:8:\"username\";s:25:\"_business_businessaccount\";s:12:\"noteStoreUrl\";s:47:\"https://sandbox.evernote.com/shard/s1/notestore\";s:15:\"webApiUrlPrefix\";s:38:\"https://sandbox.evernote.com/shard/s1/\";}s:12:\"noteStoreUrl\";s:47:\"https://sandbox.evernote.com/shard/s1/notestore\";s:15:\"webApiUrlPrefix\";s:38:\"https://sandbox.evernote.com/shard/s1/\";s:20:\"secondFactorRequired\";N;s:24:\"secondFactorDeliveryHint\";N;}"
  },
  {
    "path": "tests/fixtures/note/authenticateToSharedNotebook_REGULAR_USER_TOKEN_ab05ad6f7147221284dae09f8170c8e57ec73287",
    "content": "O:35:\"EDAM\\UserStore\\AuthenticationResult\":9:{s:11:\"currentTime\";i:1438005152847;s:19:\"authenticationToken\";s:114:\"S=s1:U=8f169:E=14ed0003acf:C=14ecfc94c50:P=185:N=7586:R=62418:A=en-devtoken:V=2:H=69eac3be7d86f1527e8f2d1adbf14b39\";s:10:\"expiration\";i:1438008752847;s:4:\"user\";O:15:\"EDAM\\Types\\User\":15:{s:2:\"id\";i:586089;s:8:\"username\";s:8:\"laurents\";s:5:\"email\";N;s:4:\"name\";N;s:8:\"timezone\";N;s:9:\"privilege\";i:1;s:7:\"created\";N;s:7:\"updated\";N;s:7:\"deleted\";N;s:6:\"active\";b:1;s:7:\"shardId\";s:2:\"s1\";s:10:\"attributes\";N;s:10:\"accounting\";O:21:\"EDAM\\Types\\Accounting\":23:{s:11:\"uploadLimit\";i:62914560;s:14:\"uploadLimitEnd\";i:1440486000000;s:20:\"uploadLimitNextMonth\";i:62914560;s:20:\"premiumServiceStatus\";i:0;s:18:\"premiumOrderNumber\";N;s:22:\"premiumCommerceService\";N;s:19:\"premiumServiceStart\";N;s:17:\"premiumServiceSKU\";N;s:20:\"lastSuccessfulCharge\";N;s:16:\"lastFailedCharge\";N;s:22:\"lastFailedChargeReason\";N;s:14:\"nextPaymentDue\";N;s:16:\"premiumLockUntil\";N;s:7:\"updated\";N;s:25:\"premiumSubscriptionNumber\";N;s:19:\"lastRequestedCharge\";N;s:8:\"currency\";N;s:9:\"unitPrice\";N;s:10:\"businessId\";N;s:12:\"businessName\";N;s:12:\"businessRole\";N;s:12:\"unitDiscount\";N;s:14:\"nextChargeDate\";N;}s:11:\"premiumInfo\";N;s:16:\"businessUserInfo\";N;}s:14:\"publicUserInfo\";O:29:\"EDAM\\UserStore\\PublicUserInfo\":6:{s:6:\"userId\";i:586089;s:7:\"shardId\";s:2:\"s1\";s:9:\"privilege\";i:1;s:8:\"username\";s:8:\"laurents\";s:12:\"noteStoreUrl\";s:47:\"https://sandbox.evernote.com/shard/s1/notestore\";s:15:\"webApiUrlPrefix\";s:38:\"https://sandbox.evernote.com/shard/s1/\";}s:12:\"noteStoreUrl\";s:47:\"https://sandbox.evernote.com/shard/s1/notestore\";s:15:\"webApiUrlPrefix\";s:38:\"https://sandbox.evernote.com/shard/s1/\";s:20:\"secondFactorRequired\";N;s:24:\"secondFactorDeliveryHint\";N;}"
  },
  {
    "path": "tests/fixtures/note/getSharedNotebookByAuth_BUSINESS_ADMIN_TOKEN_66e99a38209989ca7ee128dce8bea5e7dbb0d7e1",
    "content": "O:25:\"EDAM\\Types\\SharedNotebook\":13:{s:2:\"id\";i:30087;s:6:\"userId\";i:402980;s:12:\"notebookGuid\";s:36:\"db5aa2aa-8602-4d6b-b8e8-544b5b5fd6ca\";s:5:\"email\";s:38:\"mail+sbx_business@laurent-sarrazin.com\";s:18:\"notebookModifiable\";b:1;s:12:\"requireLogin\";b:1;s:14:\"serviceCreated\";i:1425397936000;s:14:\"serviceUpdated\";i:1425397936000;s:8:\"shareKey\";s:7:\"7587-s1\";s:8:\"username\";s:29:\"laurent_sarrazin_sbx_business\";s:9:\"privilege\";i:5;s:12:\"allowPreview\";b:0;s:17:\"recipientSettings\";O:42:\"EDAM\\Types\\SharedNotebookRecipientSettings\":2:{s:19:\"reminderNotifyEmail\";N;s:19:\"reminderNotifyInApp\";N;}}"
  },
  {
    "path": "tests/fixtures/note/getSharedNotebookByAuth_BUSINESS_USER_TOKEN_5da9c2159827f263c2b24e42047718b6607b17b3",
    "content": "O:25:\"EDAM\\Types\\SharedNotebook\":13:{s:2:\"id\";i:30089;s:6:\"userId\";i:402980;s:12:\"notebookGuid\";s:36:\"3bf5f260-6f31-4aee-bd09-25fbb29fe4c8\";s:5:\"email\";s:43:\"mail+sbx_business_user@laurent-sarrazin.com\";s:18:\"notebookModifiable\";b:1;s:12:\"requireLogin\";b:1;s:14:\"serviceCreated\";i:1425460062000;s:14:\"serviceUpdated\";i:1425460062000;s:8:\"shareKey\";s:7:\"7589-s1\";s:8:\"username\";s:34:\"laurent_sarrazin_sbx_business_user\";s:9:\"privilege\";i:5;s:12:\"allowPreview\";b:0;s:17:\"recipientSettings\";O:42:\"EDAM\\Types\\SharedNotebookRecipientSettings\":2:{s:19:\"reminderNotifyEmail\";N;s:19:\"reminderNotifyInApp\";N;}}"
  },
  {
    "path": "tests/fixtures/note/getSharedNotebookByAuth_REGULAR_USER_TOKEN_eebddce8d5725a83279021a0b711490bc4b4d2e1",
    "content": "O:25:\"EDAM\\Types\\SharedNotebook\":13:{s:2:\"id\";i:30086;s:6:\"userId\";i:586089;s:12:\"notebookGuid\";s:36:\"32e454e7-510a-43f6-af20-da5c74c6f88a\";s:5:\"email\";s:46:\"laurent_sarrazin_sbx_free@laurent-sarrazin.com\";s:18:\"notebookModifiable\";b:1;s:12:\"requireLogin\";b:1;s:14:\"serviceCreated\";i:1425391567000;s:14:\"serviceUpdated\";i:1425391689000;s:8:\"shareKey\";s:7:\"7586-s1\";s:8:\"username\";s:25:\"laurent_sarrazin_sbx_free\";s:9:\"privilege\";i:4;s:12:\"allowPreview\";b:0;s:17:\"recipientSettings\";O:42:\"EDAM\\Types\\SharedNotebookRecipientSettings\":2:{s:19:\"reminderNotifyEmail\";N;s:19:\"reminderNotifyInApp\";N;}}"
  },
  {
    "path": "tests/fixtures/note/listLinkedNotebooks_BUSINESS_ADMIN_TOKEN_66e99a38209989ca7ee128dce8bea5e7dbb0d7e1",
    "content": "a:7:{i:0;O:25:\"EDAM\\Types\\LinkedNotebook\":11:{s:9:\"shareName\";s:19:\"Business Notebook 1\";s:8:\"username\";s:25:\"_business_businessaccount\";s:7:\"shardId\";s:2:\"s1\";s:8:\"shareKey\";s:7:\"7587-s1\";s:3:\"uri\";N;s:4:\"guid\";s:36:\"e4e8b1ed-09a4-4605-aeff-bc1e98d0fa6b\";s:17:\"updateSequenceNum\";i:52;s:12:\"noteStoreUrl\";s:47:\"https://sandbox.evernote.com/shard/s1/notestore\";s:15:\"webApiUrlPrefix\";s:38:\"https://sandbox.evernote.com/shard/s1/\";s:5:\"stack\";N;s:10:\"businessId\";i:45;}i:1;O:25:\"EDAM\\Types\\LinkedNotebook\":11:{s:9:\"shareName\";s:33:\"Business shared but not published\";s:8:\"username\";s:25:\"_business_businessaccount\";s:7:\"shardId\";s:2:\"s1\";s:8:\"shareKey\";s:7:\"8465-s1\";s:3:\"uri\";N;s:4:\"guid\";s:36:\"6054ec71-7f0a-4012-956a-08bd5da4193b\";s:17:\"updateSequenceNum\";i:53;s:12:\"noteStoreUrl\";s:47:\"https://sandbox.evernote.com/shard/s1/notestore\";s:15:\"webApiUrlPrefix\";s:38:\"https://sandbox.evernote.com/shard/s1/\";s:5:\"stack\";N;s:10:\"businessId\";i:45;}i:2;O:25:\"EDAM\\Types\\LinkedNotebook\":11:{s:9:\"shareName\";s:18:\"My shared notebook\";s:8:\"username\";s:28:\"laurent_sarrazin_sbx_premium\";s:7:\"shardId\";s:2:\"s1\";s:8:\"shareKey\";s:7:\"8470-s1\";s:3:\"uri\";N;s:4:\"guid\";s:36:\"9eceded5-39cd-4f32-aacf-de8409ca83a0\";s:17:\"updateSequenceNum\";i:61;s:12:\"noteStoreUrl\";s:47:\"https://sandbox.evernote.com/shard/s1/notestore\";s:15:\"webApiUrlPrefix\";s:38:\"https://sandbox.evernote.com/shard/s1/\";s:5:\"stack\";N;s:10:\"businessId\";N;}i:3;O:25:\"EDAM\\Types\\LinkedNotebook\":11:{s:9:\"shareName\";s:16:\"Private business\";s:8:\"username\";s:25:\"_business_businessaccount\";s:7:\"shardId\";s:2:\"s1\";s:8:\"shareKey\";s:7:\"8471-s1\";s:3:\"uri\";N;s:4:\"guid\";s:36:\"f2a764ac-27e6-47b7-b5bb-94d5dc48132b\";s:17:\"updateSequenceNum\";i:62;s:12:\"noteStoreUrl\";s:47:\"https://sandbox.evernote.com/shard/s1/notestore\";s:15:\"webApiUrlPrefix\";s:38:\"https://sandbox.evernote.com/shard/s1/\";s:5:\"stack\";N;s:10:\"businessId\";i:45;}i:4;O:25:\"EDAM\\Types\\LinkedNotebook\":11:{s:9:\"shareName\";s:37:\"Business shared but not published bis\";s:8:\"username\";s:25:\"_business_businessaccount\";s:7:\"shardId\";s:2:\"s1\";s:8:\"shareKey\";s:7:\"8472-s1\";s:3:\"uri\";N;s:4:\"guid\";s:36:\"d65fbeb3-1916-43f5-8fd6-6def6f1862eb\";s:17:\"updateSequenceNum\";i:63;s:12:\"noteStoreUrl\";s:47:\"https://sandbox.evernote.com/shard/s1/notestore\";s:15:\"webApiUrlPrefix\";s:38:\"https://sandbox.evernote.com/shard/s1/\";s:5:\"stack\";N;s:10:\"businessId\";i:45;}i:5;O:25:\"EDAM\\Types\\LinkedNotebook\":11:{s:9:\"shareName\";s:33:\"Business published but not shared\";s:8:\"username\";s:25:\"_business_businessaccount\";s:7:\"shardId\";s:2:\"s1\";s:8:\"shareKey\";s:7:\"8474-s1\";s:3:\"uri\";N;s:4:\"guid\";s:36:\"a81c87fd-4c10-4b80-8aa0-e145fd4c4e11\";s:17:\"updateSequenceNum\";i:64;s:12:\"noteStoreUrl\";s:47:\"https://sandbox.evernote.com/shard/s1/notestore\";s:15:\"webApiUrlPrefix\";s:38:\"https://sandbox.evernote.com/shard/s1/\";s:5:\"stack\";N;s:10:\"businessId\";i:45;}i:6;O:25:\"EDAM\\Types\\LinkedNotebook\":11:{s:9:\"shareName\";s:29:\"Business published and shared\";s:8:\"username\";s:25:\"_business_businessaccount\";s:7:\"shardId\";s:2:\"s1\";s:8:\"shareKey\";s:7:\"8475-s1\";s:3:\"uri\";N;s:4:\"guid\";s:36:\"96f4074c-bebf-402c-8c18-442de3582d84\";s:17:\"updateSequenceNum\";i:65;s:12:\"noteStoreUrl\";s:47:\"https://sandbox.evernote.com/shard/s1/notestore\";s:15:\"webApiUrlPrefix\";s:38:\"https://sandbox.evernote.com/shard/s1/\";s:5:\"stack\";N;s:10:\"businessId\";i:45;}}"
  },
  {
    "path": "tests/fixtures/note/listLinkedNotebooks_BUSINESS_USER_TOKEN_5da9c2159827f263c2b24e42047718b6607b17b3",
    "content": "a:6:{i:0;O:25:\"EDAM\\Types\\LinkedNotebook\":11:{s:9:\"shareName\";s:16:\"Business private\";s:8:\"username\";s:25:\"_business_businessaccount\";s:7:\"shardId\";s:2:\"s1\";s:8:\"shareKey\";s:7:\"7589-s1\";s:3:\"uri\";N;s:4:\"guid\";s:36:\"2c9e71ba-2147-49bc-8ac7-e49cf5c80656\";s:17:\"updateSequenceNum\";i:30;s:12:\"noteStoreUrl\";s:47:\"https://sandbox.evernote.com/shard/s1/notestore\";s:15:\"webApiUrlPrefix\";s:38:\"https://sandbox.evernote.com/shard/s1/\";s:5:\"stack\";N;s:10:\"businessId\";i:45;}i:1;O:25:\"EDAM\\Types\\LinkedNotebook\":11:{s:9:\"shareName\";s:25:\"Business shared with user\";s:8:\"username\";s:25:\"_business_businessaccount\";s:7:\"shardId\";s:2:\"s1\";s:8:\"shareKey\";s:7:\"7588-s1\";s:3:\"uri\";N;s:4:\"guid\";s:36:\"e16ac946-8644-4123-a314-3305e60b8205\";s:17:\"updateSequenceNum\";i:31;s:12:\"noteStoreUrl\";s:47:\"https://sandbox.evernote.com/shard/s1/notestore\";s:15:\"webApiUrlPrefix\";s:38:\"https://sandbox.evernote.com/shard/s1/\";s:5:\"stack\";N;s:10:\"businessId\";i:45;}i:2;O:25:\"EDAM\\Types\\LinkedNotebook\":11:{s:9:\"shareName\";s:33:\"Business shared but not published\";s:8:\"username\";s:25:\"_business_businessaccount\";s:7:\"shardId\";s:2:\"s1\";s:8:\"shareKey\";s:7:\"845e-s1\";s:3:\"uri\";N;s:4:\"guid\";s:36:\"f45ab7b9-3761-4897-8428-8125df882d4d\";s:17:\"updateSequenceNum\";i:32;s:12:\"noteStoreUrl\";s:47:\"https://sandbox.evernote.com/shard/s1/notestore\";s:15:\"webApiUrlPrefix\";s:38:\"https://sandbox.evernote.com/shard/s1/\";s:5:\"stack\";N;s:10:\"businessId\";i:45;}i:3;O:25:\"EDAM\\Types\\LinkedNotebook\":11:{s:9:\"shareName\";s:33:\"Business published but not shared\";s:8:\"username\";s:25:\"_business_businessaccount\";s:7:\"shardId\";s:2:\"s1\";s:8:\"shareKey\";s:7:\"8460-s1\";s:3:\"uri\";N;s:4:\"guid\";s:36:\"2d0eebd8-32bd-4f3d-ba7b-aa2bbb9da729\";s:17:\"updateSequenceNum\";i:33;s:12:\"noteStoreUrl\";s:47:\"https://sandbox.evernote.com/shard/s1/notestore\";s:15:\"webApiUrlPrefix\";s:38:\"https://sandbox.evernote.com/shard/s1/\";s:5:\"stack\";N;s:10:\"businessId\";i:45;}i:4;O:25:\"EDAM\\Types\\LinkedNotebook\":11:{s:9:\"shareName\";s:29:\"Business shared and published\";s:8:\"username\";s:25:\"_business_businessaccount\";s:7:\"shardId\";s:2:\"s1\";s:8:\"shareKey\";s:7:\"8461-s1\";s:3:\"uri\";N;s:4:\"guid\";s:36:\"bfb480f0-ba84-48f0-bc1b-4780420f312a\";s:17:\"updateSequenceNum\";i:34;s:12:\"noteStoreUrl\";s:47:\"https://sandbox.evernote.com/shard/s1/notestore\";s:15:\"webApiUrlPrefix\";s:38:\"https://sandbox.evernote.com/shard/s1/\";s:5:\"stack\";N;s:10:\"businessId\";i:45;}i:5;O:25:\"EDAM\\Types\\LinkedNotebook\":11:{s:9:\"shareName\";s:23:\"User created and shared\";s:8:\"username\";s:25:\"laurent_sarrazin_sbx_free\";s:7:\"shardId\";s:2:\"s1\";s:8:\"shareKey\";s:7:\"8467-s1\";s:3:\"uri\";N;s:4:\"guid\";s:36:\"a00f3f3f-903a-4b20-9def-e64d45bc3c47\";s:17:\"updateSequenceNum\";i:43;s:12:\"noteStoreUrl\";s:47:\"https://sandbox.evernote.com/shard/s1/notestore\";s:15:\"webApiUrlPrefix\";s:38:\"https://sandbox.evernote.com/shard/s1/\";s:5:\"stack\";N;s:10:\"businessId\";N;}}"
  },
  {
    "path": "tests/fixtures/note/listLinkedNotebooks_REGULAR_USER_TOKEN_eebddce8d5725a83279021a0b711490bc4b4d2e1",
    "content": "a:1:{i:0;O:25:\"EDAM\\Types\\LinkedNotebook\":11:{s:9:\"shareName\";s:34:\"Shared with user (All permissions)\";s:8:\"username\";s:8:\"laurents\";s:7:\"shardId\";s:2:\"s1\";s:8:\"shareKey\";s:7:\"7586-s1\";s:3:\"uri\";N;s:4:\"guid\";s:36:\"c537c5e3-05f0-4c91-9c5c-3f999ae9e3d3\";s:17:\"updateSequenceNum\";i:206;s:12:\"noteStoreUrl\";s:47:\"https://sandbox.evernote.com/shard/s1/notestore\";s:15:\"webApiUrlPrefix\";s:38:\"https://sandbox.evernote.com/shard/s1/\";s:5:\"stack\";N;s:10:\"businessId\";N;}}"
  },
  {
    "path": "tests/fixtures/note/listNotebooks_BUSINESS_ADMIN_TOKEN_66e99a38209989ca7ee128dce8bea5e7dbb0d7e1",
    "content": "a:4:{i:0;O:19:\"EDAM\\Types\\Notebook\":14:{s:4:\"guid\";s:36:\"43cbb92f-9431-4248-8527-2993930b81c1\";s:4:\"name\";s:5:\"INBOX\";s:17:\"updateSequenceNum\";i:45;s:15:\"defaultNotebook\";b:1;s:14:\"serviceCreated\";i:1406891443000;s:14:\"serviceUpdated\";i:1425397903000;s:10:\"publishing\";N;s:9:\"published\";N;s:5:\"stack\";N;s:17:\"sharedNotebookIds\";N;s:15:\"sharedNotebooks\";N;s:16:\"businessNotebook\";N;s:7:\"contact\";N;s:12:\"restrictions\";O:31:\"EDAM\\Types\\NotebookRestrictions\":20:{s:11:\"noReadNotes\";N;s:13:\"noCreateNotes\";N;s:13:\"noUpdateNotes\";N;s:14:\"noExpungeNotes\";N;s:12:\"noShareNotes\";N;s:12:\"noEmailNotes\";b:1;s:25:\"noSendMessageToRecipients\";N;s:16:\"noUpdateNotebook\";N;s:17:\"noExpungeNotebook\";N;s:20:\"noSetDefaultNotebook\";N;s:18:\"noSetNotebookStack\";N;s:17:\"noPublishToPublic\";N;s:26:\"noPublishToBusinessLibrary\";N;s:12:\"noCreateTags\";N;s:12:\"noUpdateTags\";N;s:13:\"noExpungeTags\";N;s:14:\"noSetParentTag\";N;s:23:\"noCreateSharedNotebooks\";N;s:37:\"updateWhichSharedNotebookRestrictions\";N;s:38:\"expungeWhichSharedNotebookRestrictions\";N;}}i:1;O:19:\"EDAM\\Types\\Notebook\":14:{s:4:\"guid\";s:36:\"c6ac9177-6bdc-4551-8be1-4c12fd133e09\";s:4:\"name\";s:33:\"Personal shared but not published\";s:17:\"updateSequenceNum\";i:55;s:15:\"defaultNotebook\";b:0;s:14:\"serviceCreated\";i:1438026679000;s:14:\"serviceUpdated\";i:1438026679000;s:10:\"publishing\";N;s:9:\"published\";N;s:5:\"stack\";N;s:17:\"sharedNotebookIds\";a:1:{i:0;i:33902;}s:15:\"sharedNotebooks\";N;s:16:\"businessNotebook\";N;s:7:\"contact\";N;s:12:\"restrictions\";O:31:\"EDAM\\Types\\NotebookRestrictions\":20:{s:11:\"noReadNotes\";N;s:13:\"noCreateNotes\";N;s:13:\"noUpdateNotes\";N;s:14:\"noExpungeNotes\";N;s:12:\"noShareNotes\";N;s:12:\"noEmailNotes\";b:1;s:25:\"noSendMessageToRecipients\";N;s:16:\"noUpdateNotebook\";N;s:17:\"noExpungeNotebook\";N;s:20:\"noSetDefaultNotebook\";N;s:18:\"noSetNotebookStack\";N;s:17:\"noPublishToPublic\";N;s:26:\"noPublishToBusinessLibrary\";N;s:12:\"noCreateTags\";N;s:12:\"noUpdateTags\";N;s:13:\"noExpungeTags\";N;s:14:\"noSetParentTag\";N;s:23:\"noCreateSharedNotebooks\";N;s:37:\"updateWhichSharedNotebookRestrictions\";N;s:38:\"expungeWhichSharedNotebookRestrictions\";N;}}i:2;O:19:\"EDAM\\Types\\Notebook\":14:{s:4:\"guid\";s:36:\"673f736b-5f79-4edd-a2d0-14baa1817ebb\";s:4:\"name\";s:33:\"Personal published but not shared\";s:17:\"updateSequenceNum\";i:57;s:15:\"defaultNotebook\";b:0;s:14:\"serviceCreated\";i:1438026742000;s:14:\"serviceUpdated\";i:1438026751000;s:10:\"publishing\";O:21:\"EDAM\\Types\\Publishing\":4:{s:3:\"uri\";s:29:\"personalpublishedbutnotshared\";s:5:\"order\";i:1;s:9:\"ascending\";b:0;s:17:\"publicDescription\";N;}s:9:\"published\";b:1;s:5:\"stack\";N;s:17:\"sharedNotebookIds\";N;s:15:\"sharedNotebooks\";N;s:16:\"businessNotebook\";N;s:7:\"contact\";N;s:12:\"restrictions\";O:31:\"EDAM\\Types\\NotebookRestrictions\":20:{s:11:\"noReadNotes\";N;s:13:\"noCreateNotes\";N;s:13:\"noUpdateNotes\";N;s:14:\"noExpungeNotes\";N;s:12:\"noShareNotes\";N;s:12:\"noEmailNotes\";b:1;s:25:\"noSendMessageToRecipients\";N;s:16:\"noUpdateNotebook\";N;s:17:\"noExpungeNotebook\";N;s:20:\"noSetDefaultNotebook\";N;s:18:\"noSetNotebookStack\";N;s:17:\"noPublishToPublic\";N;s:26:\"noPublishToBusinessLibrary\";N;s:12:\"noCreateTags\";N;s:12:\"noUpdateTags\";N;s:13:\"noExpungeTags\";N;s:14:\"noSetParentTag\";N;s:23:\"noCreateSharedNotebooks\";N;s:37:\"updateWhichSharedNotebookRestrictions\";N;s:38:\"expungeWhichSharedNotebookRestrictions\";N;}}i:3;O:19:\"EDAM\\Types\\Notebook\":14:{s:4:\"guid\";s:36:\"aacf6f6a-1a5e-467b-b972-ca975beba12d\";s:4:\"name\";s:29:\"Personal shared and published\";s:17:\"updateSequenceNum\";i:60;s:15:\"defaultNotebook\";b:0;s:14:\"serviceCreated\";i:1438026768000;s:14:\"serviceUpdated\";i:1438026786000;s:10:\"publishing\";O:21:\"EDAM\\Types\\Publishing\":4:{s:3:\"uri\";s:26:\"personalsharedandpublished\";s:5:\"order\";i:1;s:9:\"ascending\";b:0;s:17:\"publicDescription\";N;}s:9:\"published\";b:1;s:5:\"stack\";N;s:17:\"sharedNotebookIds\";a:1:{i:0;i:33903;}s:15:\"sharedNotebooks\";N;s:16:\"businessNotebook\";N;s:7:\"contact\";N;s:12:\"restrictions\";O:31:\"EDAM\\Types\\NotebookRestrictions\":20:{s:11:\"noReadNotes\";N;s:13:\"noCreateNotes\";N;s:13:\"noUpdateNotes\";N;s:14:\"noExpungeNotes\";N;s:12:\"noShareNotes\";N;s:12:\"noEmailNotes\";b:1;s:25:\"noSendMessageToRecipients\";N;s:16:\"noUpdateNotebook\";N;s:17:\"noExpungeNotebook\";N;s:20:\"noSetDefaultNotebook\";N;s:18:\"noSetNotebookStack\";N;s:17:\"noPublishToPublic\";N;s:26:\"noPublishToBusinessLibrary\";N;s:12:\"noCreateTags\";N;s:12:\"noUpdateTags\";N;s:13:\"noExpungeTags\";N;s:14:\"noSetParentTag\";N;s:23:\"noCreateSharedNotebooks\";N;s:37:\"updateWhichSharedNotebookRestrictions\";N;s:38:\"expungeWhichSharedNotebookRestrictions\";N;}}}"
  },
  {
    "path": "tests/fixtures/note/listNotebooks_BUSINESS_USER_TOKEN_5da9c2159827f263c2b24e42047718b6607b17b3",
    "content": "a:4:{i:0;O:19:\"EDAM\\Types\\Notebook\":14:{s:4:\"guid\";s:36:\"3ff22164-87c0-4f91-93e9-993a53466fe8\";s:4:\"name\";s:5:\"INBOX\";s:17:\"updateSequenceNum\";i:20;s:15:\"defaultNotebook\";b:1;s:14:\"serviceCreated\";i:1400240728000;s:14:\"serviceUpdated\";i:1425398041000;s:10:\"publishing\";N;s:9:\"published\";N;s:5:\"stack\";N;s:17:\"sharedNotebookIds\";N;s:15:\"sharedNotebooks\";N;s:16:\"businessNotebook\";N;s:7:\"contact\";N;s:12:\"restrictions\";O:31:\"EDAM\\Types\\NotebookRestrictions\":20:{s:11:\"noReadNotes\";N;s:13:\"noCreateNotes\";N;s:13:\"noUpdateNotes\";N;s:14:\"noExpungeNotes\";N;s:12:\"noShareNotes\";N;s:12:\"noEmailNotes\";b:1;s:25:\"noSendMessageToRecipients\";N;s:16:\"noUpdateNotebook\";N;s:17:\"noExpungeNotebook\";N;s:20:\"noSetDefaultNotebook\";N;s:18:\"noSetNotebookStack\";N;s:17:\"noPublishToPublic\";N;s:26:\"noPublishToBusinessLibrary\";N;s:12:\"noCreateTags\";N;s:12:\"noUpdateTags\";N;s:13:\"noExpungeTags\";N;s:14:\"noSetParentTag\";N;s:23:\"noCreateSharedNotebooks\";N;s:37:\"updateWhichSharedNotebookRestrictions\";N;s:38:\"expungeWhichSharedNotebookRestrictions\";N;}}i:1;O:19:\"EDAM\\Types\\Notebook\":14:{s:4:\"guid\";s:36:\"76e1b7d3-bd7d-42e9-b737-a28238fc8e05\";s:4:\"name\";s:33:\"Personal shared but not published\";s:17:\"updateSequenceNum\";i:38;s:15:\"defaultNotebook\";b:0;s:14:\"serviceCreated\";i:1437984126000;s:14:\"serviceUpdated\";i:1437984180000;s:10:\"publishing\";N;s:9:\"published\";N;s:5:\"stack\";N;s:17:\"sharedNotebookIds\";a:1:{i:0;i:33891;}s:15:\"sharedNotebooks\";N;s:16:\"businessNotebook\";N;s:7:\"contact\";N;s:12:\"restrictions\";O:31:\"EDAM\\Types\\NotebookRestrictions\":20:{s:11:\"noReadNotes\";N;s:13:\"noCreateNotes\";N;s:13:\"noUpdateNotes\";N;s:14:\"noExpungeNotes\";N;s:12:\"noShareNotes\";N;s:12:\"noEmailNotes\";b:1;s:25:\"noSendMessageToRecipients\";N;s:16:\"noUpdateNotebook\";N;s:17:\"noExpungeNotebook\";N;s:20:\"noSetDefaultNotebook\";N;s:18:\"noSetNotebookStack\";N;s:17:\"noPublishToPublic\";N;s:26:\"noPublishToBusinessLibrary\";N;s:12:\"noCreateTags\";N;s:12:\"noUpdateTags\";N;s:13:\"noExpungeTags\";N;s:14:\"noSetParentTag\";N;s:23:\"noCreateSharedNotebooks\";N;s:37:\"updateWhichSharedNotebookRestrictions\";N;s:38:\"expungeWhichSharedNotebookRestrictions\";N;}}i:2;O:19:\"EDAM\\Types\\Notebook\":14:{s:4:\"guid\";s:36:\"adc1243c-8f90-4184-a7d8-80b78e9e99a9\";s:4:\"name\";s:33:\"Personal published but not shared\";s:17:\"updateSequenceNum\";i:40;s:15:\"defaultNotebook\";b:0;s:14:\"serviceCreated\";i:1437984171000;s:14:\"serviceUpdated\";i:1437984205000;s:10:\"publishing\";O:21:\"EDAM\\Types\\Publishing\":4:{s:3:\"uri\";s:29:\"personalpublishedbutnotshared\";s:5:\"order\";i:1;s:9:\"ascending\";b:0;s:17:\"publicDescription\";N;}s:9:\"published\";b:1;s:5:\"stack\";N;s:17:\"sharedNotebookIds\";N;s:15:\"sharedNotebooks\";N;s:16:\"businessNotebook\";N;s:7:\"contact\";N;s:12:\"restrictions\";O:31:\"EDAM\\Types\\NotebookRestrictions\":20:{s:11:\"noReadNotes\";N;s:13:\"noCreateNotes\";N;s:13:\"noUpdateNotes\";N;s:14:\"noExpungeNotes\";N;s:12:\"noShareNotes\";N;s:12:\"noEmailNotes\";b:1;s:25:\"noSendMessageToRecipients\";N;s:16:\"noUpdateNotebook\";N;s:17:\"noExpungeNotebook\";N;s:20:\"noSetDefaultNotebook\";N;s:18:\"noSetNotebookStack\";N;s:17:\"noPublishToPublic\";N;s:26:\"noPublishToBusinessLibrary\";N;s:12:\"noCreateTags\";N;s:12:\"noUpdateTags\";N;s:13:\"noExpungeTags\";N;s:14:\"noSetParentTag\";N;s:23:\"noCreateSharedNotebooks\";N;s:37:\"updateWhichSharedNotebookRestrictions\";N;s:38:\"expungeWhichSharedNotebookRestrictions\";N;}}i:3;O:19:\"EDAM\\Types\\Notebook\":14:{s:4:\"guid\";s:36:\"556fdd09-3e1a-42e4-af60-7cc904e81e35\";s:4:\"name\";s:29:\"Personal shared and published\";s:17:\"updateSequenceNum\";i:42;s:15:\"defaultNotebook\";b:0;s:14:\"serviceCreated\";i:1437984197000;s:14:\"serviceUpdated\";i:1437984220000;s:10:\"publishing\";O:21:\"EDAM\\Types\\Publishing\":4:{s:3:\"uri\";s:26:\"personalsharedandpublished\";s:5:\"order\";i:1;s:9:\"ascending\";b:0;s:17:\"publicDescription\";N;}s:9:\"published\";b:1;s:5:\"stack\";N;s:17:\"sharedNotebookIds\";a:1:{i:0;i:33892;}s:15:\"sharedNotebooks\";N;s:16:\"businessNotebook\";N;s:7:\"contact\";N;s:12:\"restrictions\";O:31:\"EDAM\\Types\\NotebookRestrictions\":20:{s:11:\"noReadNotes\";N;s:13:\"noCreateNotes\";N;s:13:\"noUpdateNotes\";N;s:14:\"noExpungeNotes\";N;s:12:\"noShareNotes\";N;s:12:\"noEmailNotes\";b:1;s:25:\"noSendMessageToRecipients\";N;s:16:\"noUpdateNotebook\";N;s:17:\"noExpungeNotebook\";N;s:20:\"noSetDefaultNotebook\";N;s:18:\"noSetNotebookStack\";N;s:17:\"noPublishToPublic\";N;s:26:\"noPublishToBusinessLibrary\";N;s:12:\"noCreateTags\";N;s:12:\"noUpdateTags\";N;s:13:\"noExpungeTags\";N;s:14:\"noSetParentTag\";N;s:23:\"noCreateSharedNotebooks\";N;s:37:\"updateWhichSharedNotebookRestrictions\";N;s:38:\"expungeWhichSharedNotebookRestrictions\";N;}}}"
  },
  {
    "path": "tests/fixtures/note/listNotebooks_REGULAR_USER_TOKEN_eebddce8d5725a83279021a0b711490bc4b4d2e1",
    "content": "a:5:{i:0;O:19:\"EDAM\\Types\\Notebook\":14:{s:4:\"guid\";s:36:\"5d23a1b5-ae86-4e0a-a0b0-76e2cf79e843\";s:4:\"name\";s:37:\"User created not shared not published\";s:17:\"updateSequenceNum\";i:201;s:15:\"defaultNotebook\";b:1;s:14:\"serviceCreated\";i:1364217450000;s:14:\"serviceUpdated\";i:1437944858000;s:10:\"publishing\";N;s:9:\"published\";N;s:5:\"stack\";N;s:17:\"sharedNotebookIds\";N;s:15:\"sharedNotebooks\";N;s:16:\"businessNotebook\";N;s:7:\"contact\";N;s:12:\"restrictions\";O:31:\"EDAM\\Types\\NotebookRestrictions\":20:{s:11:\"noReadNotes\";N;s:13:\"noCreateNotes\";N;s:13:\"noUpdateNotes\";N;s:14:\"noExpungeNotes\";N;s:12:\"noShareNotes\";N;s:12:\"noEmailNotes\";b:1;s:25:\"noSendMessageToRecipients\";N;s:16:\"noUpdateNotebook\";N;s:17:\"noExpungeNotebook\";N;s:20:\"noSetDefaultNotebook\";N;s:18:\"noSetNotebookStack\";N;s:17:\"noPublishToPublic\";N;s:26:\"noPublishToBusinessLibrary\";N;s:12:\"noCreateTags\";N;s:12:\"noUpdateTags\";N;s:13:\"noExpungeTags\";N;s:14:\"noSetParentTag\";N;s:23:\"noCreateSharedNotebooks\";N;s:37:\"updateWhichSharedNotebookRestrictions\";N;s:38:\"expungeWhichSharedNotebookRestrictions\";N;}}i:1;O:19:\"EDAM\\Types\\Notebook\":14:{s:4:\"guid\";s:36:\"5dcb3fa6-e41c-4360-aa25-738cb0bdf62c\";s:4:\"name\";s:5:\"INBOX\";s:17:\"updateSequenceNum\";i:197;s:15:\"defaultNotebook\";b:0;s:14:\"serviceCreated\";i:1425390827000;s:14:\"serviceUpdated\";i:1425390827000;s:10:\"publishing\";N;s:9:\"published\";N;s:5:\"stack\";N;s:17:\"sharedNotebookIds\";N;s:15:\"sharedNotebooks\";N;s:16:\"businessNotebook\";N;s:7:\"contact\";N;s:12:\"restrictions\";O:31:\"EDAM\\Types\\NotebookRestrictions\":20:{s:11:\"noReadNotes\";N;s:13:\"noCreateNotes\";N;s:13:\"noUpdateNotes\";N;s:14:\"noExpungeNotes\";N;s:12:\"noShareNotes\";N;s:12:\"noEmailNotes\";b:1;s:25:\"noSendMessageToRecipients\";N;s:16:\"noUpdateNotebook\";N;s:17:\"noExpungeNotebook\";N;s:20:\"noSetDefaultNotebook\";N;s:18:\"noSetNotebookStack\";N;s:17:\"noPublishToPublic\";N;s:26:\"noPublishToBusinessLibrary\";N;s:12:\"noCreateTags\";N;s:12:\"noUpdateTags\";N;s:13:\"noExpungeTags\";N;s:14:\"noSetParentTag\";N;s:23:\"noCreateSharedNotebooks\";N;s:37:\"updateWhichSharedNotebookRestrictions\";N;s:38:\"expungeWhichSharedNotebookRestrictions\";N;}}i:2;O:19:\"EDAM\\Types\\Notebook\":14:{s:4:\"guid\";s:36:\"4d89a60f-ec14-4e16-87bc-64a1c7b40841\";s:4:\"name\";s:23:\"User created and shared\";s:17:\"updateSequenceNum\";i:217;s:15:\"defaultNotebook\";b:0;s:14:\"serviceCreated\";i:1437945221000;s:14:\"serviceUpdated\";i:1437945221000;s:10:\"publishing\";N;s:9:\"published\";N;s:5:\"stack\";N;s:17:\"sharedNotebookIds\";a:2:{i:0;i:33881;i:1;i:33895;}s:15:\"sharedNotebooks\";N;s:16:\"businessNotebook\";N;s:7:\"contact\";N;s:12:\"restrictions\";O:31:\"EDAM\\Types\\NotebookRestrictions\":20:{s:11:\"noReadNotes\";N;s:13:\"noCreateNotes\";N;s:13:\"noUpdateNotes\";N;s:14:\"noExpungeNotes\";N;s:12:\"noShareNotes\";N;s:12:\"noEmailNotes\";b:1;s:25:\"noSendMessageToRecipients\";N;s:16:\"noUpdateNotebook\";N;s:17:\"noExpungeNotebook\";N;s:20:\"noSetDefaultNotebook\";N;s:18:\"noSetNotebookStack\";N;s:17:\"noPublishToPublic\";N;s:26:\"noPublishToBusinessLibrary\";N;s:12:\"noCreateTags\";N;s:12:\"noUpdateTags\";N;s:13:\"noExpungeTags\";N;s:14:\"noSetParentTag\";N;s:23:\"noCreateSharedNotebooks\";N;s:37:\"updateWhichSharedNotebookRestrictions\";N;s:38:\"expungeWhichSharedNotebookRestrictions\";N;}}i:3;O:19:\"EDAM\\Types\\Notebook\":14:{s:4:\"guid\";s:36:\"fabc50ed-62fe-4428-bb06-a9691e05dd14\";s:4:\"name\";s:26:\"User created and published\";s:17:\"updateSequenceNum\";i:210;s:15:\"defaultNotebook\";b:0;s:14:\"serviceCreated\";i:1437945292000;s:14:\"serviceUpdated\";i:1437945298000;s:10:\"publishing\";O:21:\"EDAM\\Types\\Publishing\":4:{s:3:\"uri\";s:23:\"usercreatedandpublished\";s:5:\"order\";i:1;s:9:\"ascending\";b:0;s:17:\"publicDescription\";N;}s:9:\"published\";b:1;s:5:\"stack\";N;s:17:\"sharedNotebookIds\";N;s:15:\"sharedNotebooks\";N;s:16:\"businessNotebook\";N;s:7:\"contact\";N;s:12:\"restrictions\";O:31:\"EDAM\\Types\\NotebookRestrictions\":20:{s:11:\"noReadNotes\";N;s:13:\"noCreateNotes\";N;s:13:\"noUpdateNotes\";N;s:14:\"noExpungeNotes\";N;s:12:\"noShareNotes\";N;s:12:\"noEmailNotes\";b:1;s:25:\"noSendMessageToRecipients\";N;s:16:\"noUpdateNotebook\";N;s:17:\"noExpungeNotebook\";N;s:20:\"noSetDefaultNotebook\";N;s:18:\"noSetNotebookStack\";N;s:17:\"noPublishToPublic\";N;s:26:\"noPublishToBusinessLibrary\";N;s:12:\"noCreateTags\";N;s:12:\"noUpdateTags\";N;s:13:\"noExpungeTags\";N;s:14:\"noSetParentTag\";N;s:23:\"noCreateSharedNotebooks\";N;s:37:\"updateWhichSharedNotebookRestrictions\";N;s:38:\"expungeWhichSharedNotebookRestrictions\";N;}}i:4;O:19:\"EDAM\\Types\\Notebook\":14:{s:4:\"guid\";s:36:\"34bac2f6-e5b0-4da1-94f0-585aedce3a65\";s:4:\"name\";s:34:\"User created, shared and published\";s:17:\"updateSequenceNum\";i:213;s:15:\"defaultNotebook\";b:0;s:14:\"serviceCreated\";i:1437945327000;s:14:\"serviceUpdated\";i:1437945354000;s:10:\"publishing\";O:21:\"EDAM\\Types\\Publishing\":4:{s:3:\"uri\";s:29:\"usercreatedsharedandpublished\";s:5:\"order\";i:1;s:9:\"ascending\";b:0;s:17:\"publicDescription\";N;}s:9:\"published\";b:1;s:5:\"stack\";N;s:17:\"sharedNotebookIds\";a:1:{i:0;i:33882;}s:15:\"sharedNotebooks\";N;s:16:\"businessNotebook\";N;s:7:\"contact\";N;s:12:\"restrictions\";O:31:\"EDAM\\Types\\NotebookRestrictions\":20:{s:11:\"noReadNotes\";N;s:13:\"noCreateNotes\";N;s:13:\"noUpdateNotes\";N;s:14:\"noExpungeNotes\";N;s:12:\"noShareNotes\";N;s:12:\"noEmailNotes\";b:1;s:25:\"noSendMessageToRecipients\";N;s:16:\"noUpdateNotebook\";N;s:17:\"noExpungeNotebook\";N;s:20:\"noSetDefaultNotebook\";N;s:18:\"noSetNotebookStack\";N;s:17:\"noPublishToPublic\";N;s:26:\"noPublishToBusinessLibrary\";N;s:12:\"noCreateTags\";N;s:12:\"noUpdateTags\";N;s:13:\"noExpungeTags\";N;s:14:\"noSetParentTag\";N;s:23:\"noCreateSharedNotebooks\";N;s:37:\"updateWhichSharedNotebookRestrictions\";N;s:38:\"expungeWhichSharedNotebookRestrictions\";N;}}}"
  },
  {
    "path": "tests/fixtures/note/listSharedNotebooks_BUSINESS_ADMIN_TOKEN_66e99a38209989ca7ee128dce8bea5e7dbb0d7e1",
    "content": "a:2:{i:0;O:25:\"EDAM\\Types\\SharedNotebook\":13:{s:2:\"id\";i:33902;s:6:\"userId\";i:402477;s:12:\"notebookGuid\";s:36:\"c6ac9177-6bdc-4551-8be1-4c12fd133e09\";s:5:\"email\";s:19:\"laurent@sarrazin.io\";s:18:\"notebookModifiable\";b:0;s:12:\"requireLogin\";b:1;s:14:\"serviceCreated\";i:1438026703000;s:14:\"serviceUpdated\";i:1438026703000;s:8:\"shareKey\";s:7:\"846e-s1\";s:8:\"username\";N;s:9:\"privilege\";i:4;s:12:\"allowPreview\";b:0;s:17:\"recipientSettings\";N;}i:1;O:25:\"EDAM\\Types\\SharedNotebook\":13:{s:2:\"id\";i:33903;s:6:\"userId\";i:402477;s:12:\"notebookGuid\";s:36:\"aacf6f6a-1a5e-467b-b972-ca975beba12d\";s:5:\"email\";s:19:\"laurent@sarrazin.io\";s:18:\"notebookModifiable\";b:0;s:12:\"requireLogin\";b:1;s:14:\"serviceCreated\";i:1438026784000;s:14:\"serviceUpdated\";i:1438026784000;s:8:\"shareKey\";s:7:\"846f-s1\";s:8:\"username\";N;s:9:\"privilege\";i:4;s:12:\"allowPreview\";b:0;s:17:\"recipientSettings\";N;}}"
  },
  {
    "path": "tests/fixtures/note/listSharedNotebooks_BUSINESS_USER_TOKEN_5da9c2159827f263c2b24e42047718b6607b17b3",
    "content": "a:2:{i:0;O:25:\"EDAM\\Types\\SharedNotebook\":13:{s:2:\"id\";i:33891;s:6:\"userId\";i:403546;s:12:\"notebookGuid\";s:36:\"76e1b7d3-bd7d-42e9-b737-a28238fc8e05\";s:5:\"email\";s:24:\"laurent+sbx1@sarrazin.io\";s:18:\"notebookModifiable\";b:0;s:12:\"requireLogin\";b:1;s:14:\"serviceCreated\";i:1437984141000;s:14:\"serviceUpdated\";i:1437984141000;s:8:\"shareKey\";s:7:\"8463-s1\";s:8:\"username\";N;s:9:\"privilege\";i:4;s:12:\"allowPreview\";b:0;s:17:\"recipientSettings\";N;}i:1;O:25:\"EDAM\\Types\\SharedNotebook\":13:{s:2:\"id\";i:33892;s:6:\"userId\";i:403546;s:12:\"notebookGuid\";s:36:\"556fdd09-3e1a-42e4-af60-7cc904e81e35\";s:5:\"email\";s:24:\"laurent+sbx1@sarrazin.io\";s:18:\"notebookModifiable\";b:0;s:12:\"requireLogin\";b:1;s:14:\"serviceCreated\";i:1437984219000;s:14:\"serviceUpdated\";i:1437984219000;s:8:\"shareKey\";s:7:\"8464-s1\";s:8:\"username\";N;s:9:\"privilege\";i:4;s:12:\"allowPreview\";b:0;s:17:\"recipientSettings\";N;}}"
  },
  {
    "path": "tests/fixtures/note/listSharedNotebooks_REGULAR_USER_TOKEN_eebddce8d5725a83279021a0b711490bc4b4d2e1",
    "content": "a:3:{i:0;O:25:\"EDAM\\Types\\SharedNotebook\":13:{s:2:\"id\";i:33881;s:6:\"userId\";i:402456;s:12:\"notebookGuid\";s:36:\"4d89a60f-ec14-4e16-87bc-64a1c7b40841\";s:5:\"email\";s:19:\"laurent@sarrazin.io\";s:18:\"notebookModifiable\";b:0;s:12:\"requireLogin\";b:1;s:14:\"serviceCreated\";i:1437945255000;s:14:\"serviceUpdated\";i:1437945255000;s:8:\"shareKey\";s:7:\"8459-s1\";s:8:\"username\";N;s:9:\"privilege\";i:4;s:12:\"allowPreview\";b:0;s:17:\"recipientSettings\";N;}i:1;O:25:\"EDAM\\Types\\SharedNotebook\":13:{s:2:\"id\";i:33882;s:6:\"userId\";i:402456;s:12:\"notebookGuid\";s:36:\"34bac2f6-e5b0-4da1-94f0-585aedce3a65\";s:5:\"email\";s:19:\"laurent@sarrazin.io\";s:18:\"notebookModifiable\";b:0;s:12:\"requireLogin\";b:1;s:14:\"serviceCreated\";i:1437945352000;s:14:\"serviceUpdated\";i:1437945352000;s:8:\"shareKey\";s:7:\"845a-s1\";s:8:\"username\";N;s:9:\"privilege\";i:4;s:12:\"allowPreview\";b:0;s:17:\"recipientSettings\";N;}i:2;O:25:\"EDAM\\Types\\SharedNotebook\":13:{s:2:\"id\";i:33895;s:6:\"userId\";i:402456;s:12:\"notebookGuid\";s:36:\"4d89a60f-ec14-4e16-87bc-64a1c7b40841\";s:5:\"email\";s:38:\"mail+sbx_business@laurent-sarrazin.com\";s:18:\"notebookModifiable\";b:1;s:12:\"requireLogin\";b:1;s:14:\"serviceCreated\";i:1437984616000;s:14:\"serviceUpdated\";i:1437984677000;s:8:\"shareKey\";s:7:\"8467-s1\";s:8:\"username\";s:34:\"laurent_sarrazin_sbx_business_user\";s:9:\"privilege\";i:4;s:12:\"allowPreview\";b:0;s:17:\"recipientSettings\";N;}}"
  },
  {
    "path": "tests/fixtures/user/authenticateToBusiness_BUSINESS_ADMIN_TOKEN_66e99a38209989ca7ee128dce8bea5e7dbb0d7e1",
    "content": "O:35:\"EDAM\\UserStore\\AuthenticationResult\":9:{s:11:\"currentTime\";i:1438028492425;s:19:\"authenticationToken\";s:121:\"S=s1:U=62624:E=14ed1645d09:C=14ed12d6e8a:P=185:R=6242d:A=en-devtoken:V=2:F=14ed00ba548:H=7f0041af8e4010819e12a69808925bd6\";s:10:\"expiration\";i:1438032092425;s:4:\"user\";O:15:\"EDAM\\Types\\User\":15:{s:2:\"id\";i:402980;s:8:\"username\";s:25:\"_business_businessaccount\";s:5:\"email\";s:40:\"[invalid email]_business_businessaccount\";s:4:\"name\";s:13:\"vault account\";s:8:\"timezone\";N;s:9:\"privilege\";i:3;s:7:\"created\";i:1363812888000;s:7:\"updated\";i:1426958836000;s:7:\"deleted\";N;s:6:\"active\";b:1;s:7:\"shardId\";s:2:\"s1\";s:10:\"attributes\";O:25:\"EDAM\\Types\\UserAttributes\":31:{s:19:\"defaultLocationName\";N;s:15:\"defaultLatitude\";N;s:16:\"defaultLongitude\";N;s:13:\"preactivation\";N;s:16:\"viewedPromotions\";N;s:20:\"incomingEmailAddress\";N;s:21:\"recentMailedAddresses\";N;s:8:\"comments\";N;s:26:\"dateAgreedToTermsOfService\";N;s:12:\"maxReferrals\";N;s:13:\"referralCount\";N;s:11:\"refererCode\";N;s:13:\"sentEmailDate\";N;s:14:\"sentEmailCount\";N;s:15:\"dailyEmailLimit\";N;s:15:\"emailOptOutDate\";N;s:21:\"partnerEmailOptInDate\";N;s:17:\"preferredLanguage\";N;s:16:\"preferredCountry\";N;s:12:\"clipFullPage\";N;s:15:\"twitterUserName\";N;s:9:\"twitterId\";N;s:9:\"groupName\";N;s:19:\"recognitionLanguage\";N;s:13:\"referralProof\";N;s:19:\"educationalDiscount\";N;s:15:\"businessAddress\";N;s:18:\"hideSponsorBilling\";N;s:9:\"taxExempt\";N;s:18:\"useEmailAutoFiling\";N;s:19:\"reminderEmailConfig\";N;}s:10:\"accounting\";O:21:\"EDAM\\Types\\Accounting\":23:{s:11:\"uploadLimit\";i:6442450941;s:14:\"uploadLimitEnd\";i:1440140400000;s:20:\"uploadLimitNextMonth\";i:6442450941;s:20:\"premiumServiceStatus\";i:2;s:18:\"premiumOrderNumber\";s:6:\"394324\";s:22:\"premiumCommerceService\";s:7:\"Biz-INV\";s:19:\"premiumServiceStart\";i:1363886607000;s:17:\"premiumServiceSKU\";s:9:\"biz-1year\";s:20:\"lastSuccessfulCharge\";i:1426958836000;s:16:\"lastFailedCharge\";N;s:22:\"lastFailedChargeReason\";N;s:14:\"nextPaymentDue\";i:1458581007000;s:16:\"premiumLockUntil\";i:1427045232000;s:7:\"updated\";i:1426958836000;s:25:\"premiumSubscriptionNumber\";N;s:19:\"lastRequestedCharge\";i:1426958832000;s:8:\"currency\";s:3:\"EUR\";s:9:\"unitPrice\";i:12000;s:10:\"businessId\";N;s:12:\"businessName\";N;s:12:\"businessRole\";N;s:12:\"unitDiscount\";i:0;s:14:\"nextChargeDate\";N;}s:11:\"premiumInfo\";N;s:16:\"businessUserInfo\";N;}s:14:\"publicUserInfo\";N;s:12:\"noteStoreUrl\";s:47:\"https://sandbox.evernote.com/shard/s1/notestore\";s:15:\"webApiUrlPrefix\";s:38:\"https://sandbox.evernote.com/shard/s1/\";s:20:\"secondFactorRequired\";N;s:24:\"secondFactorDeliveryHint\";N;}"
  },
  {
    "path": "tests/fixtures/user/authenticateToBusiness_BUSINESS_USER_TOKEN_5da9c2159827f263c2b24e42047718b6607b17b3",
    "content": "O:35:\"EDAM\\UserStore\\AuthenticationResult\":9:{s:11:\"currentTime\";i:1438005161088;s:19:\"authenticationToken\";s:121:\"S=s1:U=62624:E=14ed0005b00:C=14ecfc96c82:P=185:R=6285a:A=en-devtoken:V=2:F=14ece91bb30:H=ef4cac4d5dbe26594aa3d53776ac4d6f\";s:10:\"expiration\";i:1438008761088;s:4:\"user\";O:15:\"EDAM\\Types\\User\":15:{s:2:\"id\";i:402980;s:8:\"username\";s:25:\"_business_businessaccount\";s:5:\"email\";s:40:\"[invalid email]_business_businessaccount\";s:4:\"name\";s:13:\"vault account\";s:8:\"timezone\";N;s:9:\"privilege\";i:3;s:7:\"created\";i:1363812888000;s:7:\"updated\";i:1426958836000;s:7:\"deleted\";N;s:6:\"active\";b:1;s:7:\"shardId\";s:2:\"s1\";s:10:\"attributes\";O:25:\"EDAM\\Types\\UserAttributes\":31:{s:19:\"defaultLocationName\";N;s:15:\"defaultLatitude\";N;s:16:\"defaultLongitude\";N;s:13:\"preactivation\";N;s:16:\"viewedPromotions\";N;s:20:\"incomingEmailAddress\";N;s:21:\"recentMailedAddresses\";N;s:8:\"comments\";N;s:26:\"dateAgreedToTermsOfService\";N;s:12:\"maxReferrals\";N;s:13:\"referralCount\";N;s:11:\"refererCode\";N;s:13:\"sentEmailDate\";N;s:14:\"sentEmailCount\";N;s:15:\"dailyEmailLimit\";N;s:15:\"emailOptOutDate\";N;s:21:\"partnerEmailOptInDate\";N;s:17:\"preferredLanguage\";N;s:16:\"preferredCountry\";N;s:12:\"clipFullPage\";N;s:15:\"twitterUserName\";N;s:9:\"twitterId\";N;s:9:\"groupName\";N;s:19:\"recognitionLanguage\";N;s:13:\"referralProof\";N;s:19:\"educationalDiscount\";N;s:15:\"businessAddress\";N;s:18:\"hideSponsorBilling\";N;s:9:\"taxExempt\";N;s:18:\"useEmailAutoFiling\";N;s:19:\"reminderEmailConfig\";N;}s:10:\"accounting\";O:21:\"EDAM\\Types\\Accounting\":23:{s:11:\"uploadLimit\";i:6442450941;s:14:\"uploadLimitEnd\";i:1440140400000;s:20:\"uploadLimitNextMonth\";i:6442450941;s:20:\"premiumServiceStatus\";i:2;s:18:\"premiumOrderNumber\";s:6:\"394324\";s:22:\"premiumCommerceService\";s:7:\"Biz-INV\";s:19:\"premiumServiceStart\";i:1363886607000;s:17:\"premiumServiceSKU\";s:9:\"biz-1year\";s:20:\"lastSuccessfulCharge\";i:1426958836000;s:16:\"lastFailedCharge\";N;s:22:\"lastFailedChargeReason\";N;s:14:\"nextPaymentDue\";i:1458581007000;s:16:\"premiumLockUntil\";i:1427045232000;s:7:\"updated\";i:1426958836000;s:25:\"premiumSubscriptionNumber\";N;s:19:\"lastRequestedCharge\";i:1426958832000;s:8:\"currency\";s:3:\"EUR\";s:9:\"unitPrice\";i:12000;s:10:\"businessId\";N;s:12:\"businessName\";N;s:12:\"businessRole\";N;s:12:\"unitDiscount\";i:0;s:14:\"nextChargeDate\";N;}s:11:\"premiumInfo\";N;s:16:\"businessUserInfo\";N;}s:14:\"publicUserInfo\";N;s:12:\"noteStoreUrl\";s:47:\"https://sandbox.evernote.com/shard/s1/notestore\";s:15:\"webApiUrlPrefix\";s:38:\"https://sandbox.evernote.com/shard/s1/\";s:20:\"secondFactorRequired\";N;s:24:\"secondFactorDeliveryHint\";N;}"
  },
  {
    "path": "tests/fixtures/user/getNoteStoreUrl_BUSINESS_ADMIN_TOKEN_66e99a38209989ca7ee128dce8bea5e7dbb0d7e1",
    "content": "s:47:\"https://sandbox.evernote.com/shard/s1/notestore\";"
  },
  {
    "path": "tests/fixtures/user/getNoteStoreUrl_BUSINESS_USER_TOKEN_5da9c2159827f263c2b24e42047718b6607b17b3",
    "content": "s:47:\"https://sandbox.evernote.com/shard/s1/notestore\";"
  },
  {
    "path": "tests/fixtures/user/getNoteStoreUrl_REGULAR_USER_TOKEN_eebddce8d5725a83279021a0b711490bc4b4d2e1",
    "content": "s:47:\"https://sandbox.evernote.com/shard/s1/notestore\";"
  },
  {
    "path": "tests/fixtures/user/getUser_BUSINESS_ADMIN_TOKEN_66e99a38209989ca7ee128dce8bea5e7dbb0d7e1",
    "content": "O:15:\"EDAM\\Types\\User\":15:{s:2:\"id\";i:402477;s:8:\"username\";s:29:\"laurent_sarrazin_sbx_business\";s:5:\"email\";N;s:4:\"name\";s:16:\"Laurent Sarrazin\";s:8:\"timezone\";N;s:9:\"privilege\";i:3;s:7:\"created\";N;s:7:\"updated\";N;s:7:\"deleted\";N;s:6:\"active\";b:1;s:7:\"shardId\";s:2:\"s1\";s:10:\"attributes\";N;s:10:\"accounting\";O:21:\"EDAM\\Types\\Accounting\":23:{s:11:\"uploadLimit\";i:2147483647;s:14:\"uploadLimitEnd\";i:1440140400000;s:20:\"uploadLimitNextMonth\";i:2147483647;s:20:\"premiumServiceStatus\";i:2;s:18:\"premiumOrderNumber\";N;s:22:\"premiumCommerceService\";N;s:19:\"premiumServiceStart\";N;s:17:\"premiumServiceSKU\";N;s:20:\"lastSuccessfulCharge\";N;s:16:\"lastFailedCharge\";N;s:22:\"lastFailedChargeReason\";N;s:14:\"nextPaymentDue\";N;s:16:\"premiumLockUntil\";N;s:7:\"updated\";N;s:25:\"premiumSubscriptionNumber\";N;s:19:\"lastRequestedCharge\";N;s:8:\"currency\";N;s:9:\"unitPrice\";N;s:10:\"businessId\";i:45;s:12:\"businessName\";s:15:\"BusinessAccount\";s:12:\"businessRole\";i:1;s:12:\"unitDiscount\";N;s:14:\"nextChargeDate\";N;}s:11:\"premiumInfo\";N;s:16:\"businessUserInfo\";O:27:\"EDAM\\Types\\BusinessUserInfo\":4:{s:10:\"businessId\";i:45;s:12:\"businessName\";s:15:\"BusinessAccount\";s:4:\"role\";i:1;s:5:\"email\";N;}}"
  },
  {
    "path": "tests/fixtures/user/getUser_BUSINESS_USER_TOKEN_5da9c2159827f263c2b24e42047718b6607b17b3",
    "content": "O:15:\"EDAM\\Types\\User\":15:{s:2:\"id\";i:403546;s:8:\"username\";s:34:\"laurent_sarrazin_sbx_business_user\";s:5:\"email\";N;s:4:\"name\";s:13:\"Business User\";s:8:\"timezone\";N;s:9:\"privilege\";i:3;s:7:\"created\";N;s:7:\"updated\";N;s:7:\"deleted\";N;s:6:\"active\";b:1;s:7:\"shardId\";s:2:\"s1\";s:10:\"attributes\";N;s:10:\"accounting\";O:21:\"EDAM\\Types\\Accounting\":23:{s:11:\"uploadLimit\";i:2147483647;s:14:\"uploadLimitEnd\";i:1440140400000;s:20:\"uploadLimitNextMonth\";i:2147483647;s:20:\"premiumServiceStatus\";i:2;s:18:\"premiumOrderNumber\";N;s:22:\"premiumCommerceService\";N;s:19:\"premiumServiceStart\";N;s:17:\"premiumServiceSKU\";N;s:20:\"lastSuccessfulCharge\";N;s:16:\"lastFailedCharge\";N;s:22:\"lastFailedChargeReason\";N;s:14:\"nextPaymentDue\";N;s:16:\"premiumLockUntil\";N;s:7:\"updated\";N;s:25:\"premiumSubscriptionNumber\";N;s:19:\"lastRequestedCharge\";N;s:8:\"currency\";N;s:9:\"unitPrice\";N;s:10:\"businessId\";i:45;s:12:\"businessName\";s:15:\"BusinessAccount\";s:12:\"businessRole\";i:2;s:12:\"unitDiscount\";N;s:14:\"nextChargeDate\";N;}s:11:\"premiumInfo\";N;s:16:\"businessUserInfo\";O:27:\"EDAM\\Types\\BusinessUserInfo\":4:{s:10:\"businessId\";i:45;s:12:\"businessName\";s:15:\"BusinessAccount\";s:4:\"role\";i:2;s:5:\"email\";N;}}"
  },
  {
    "path": "tests/fixtures/user/getUser_REGULAR_USER_TOKEN_eebddce8d5725a83279021a0b711490bc4b4d2e1",
    "content": "O:15:\"EDAM\\Types\\User\":15:{s:2:\"id\";i:402456;s:8:\"username\";s:25:\"laurent_sarrazin_sbx_free\";s:5:\"email\";N;s:4:\"name\";N;s:8:\"timezone\";N;s:9:\"privilege\";i:1;s:7:\"created\";N;s:7:\"updated\";N;s:7:\"deleted\";N;s:6:\"active\";b:1;s:7:\"shardId\";s:2:\"s1\";s:10:\"attributes\";N;s:10:\"accounting\";O:21:\"EDAM\\Types\\Accounting\":23:{s:11:\"uploadLimit\";i:62914560;s:14:\"uploadLimitEnd\";i:1439967600000;s:20:\"uploadLimitNextMonth\";i:62914560;s:20:\"premiumServiceStatus\";i:0;s:18:\"premiumOrderNumber\";N;s:22:\"premiumCommerceService\";N;s:19:\"premiumServiceStart\";N;s:17:\"premiumServiceSKU\";N;s:20:\"lastSuccessfulCharge\";N;s:16:\"lastFailedCharge\";N;s:22:\"lastFailedChargeReason\";N;s:14:\"nextPaymentDue\";N;s:16:\"premiumLockUntil\";N;s:7:\"updated\";N;s:25:\"premiumSubscriptionNumber\";N;s:19:\"lastRequestedCharge\";N;s:8:\"currency\";N;s:9:\"unitPrice\";N;s:10:\"businessId\";N;s:12:\"businessName\";N;s:12:\"businessRole\";N;s:12:\"unitDiscount\";N;s:14:\"nextChargeDate\";N;}s:11:\"premiumInfo\";N;s:16:\"businessUserInfo\";N;}"
  }
]