Commits

Maxim Moiseev committed 56ed6c7

initial commit

  • Participants

Comments (0)

Files changed (30)

+syntax:glob
+.DS_Store
+*.hi
+*.o
+bin
+dist
+LocalSettings.hs

File src/Evernote.hs

+{-# LANGUAGE OverloadedStrings #-}
+module Evernote (
+      createNote
+    ) where
+
+import qualified Evernote.Common as C
+import qualified Evernote.Network as N
+import qualified Evernote.Enml as E
+
+createNote :: C.NoteTitle -> [E.EnmlNode] -> N.Note
+createNote t ns =
+    N.mkNote t $ E.renderFull ns

File src/Evernote/Common.hs

+{-# LANGUAGE OverloadedStrings #-}
+module Evernote.Common (
+      NoteTitle
+    , NoteContent
+    ) where
+
+import          Data.ByteString as B
+
+type NoteTitle = B.ByteString
+type NoteContent = B.ByteString

File src/Evernote/Enml.hs

+{-# LANGUAGE OverloadedStrings #-}
+module Evernote.Enml (
+      EnmlNode()
+    , EnmlText()
+    , CheckedState()
+    , todo
+    , done
+    , text
+    , br
+
+    , renderFull
+    , renderPartial
+    ) where
+
+import           Data.Text (Text, pack)
+import           Data.Text.Encoding (decodeUtf8)
+import qualified Data.ByteString as B
+import           Text.XmlHtml (
+                      Document(XmlDocument)
+                    , DocType(DocType)
+                    , ExternalID(System)
+                    , InternalSubset(NoInternalSubset)
+                    , Node(TextNode, Element)
+                    , Encoding(UTF8)
+                    , render
+                    , renderXmlFragment
+                    )
+import           Blaze.ByteString.Builder (toByteString)
+
+import           Evernote.Common (NoteContent)
+
+type EnmlText = B.ByteString
+
+newtype CheckedState = CheckedState Bool
+
+instance Show CheckedState where
+    show (CheckedState True) = "true"
+    show (CheckedState False) = "false"
+
+data EnmlNode =
+      Todo EnmlText CheckedState
+    | Text EnmlText
+    | Single Node -- one-to-one matching between ENML node and XML node
+    deriving (Show)
+
+toXml :: EnmlNode -> [Node]
+toXml (Todo txt checked) = [Element todoTag [(checkedAttr, showText checked)] [], textNode txt]
+toXml (Text txt) = [textNode txt]
+toXml (Single node) = [node]
+
+textNode :: EnmlText -> Node
+textNode = TextNode . decodeUtf8
+
+showText :: (Show a) => a -> Text
+showText = pack . show
+
+todo :: EnmlText -> EnmlNode
+todo = flip Todo $ CheckedState False
+
+done :: EnmlText -> EnmlNode
+done = flip Todo $ CheckedState True
+
+text :: EnmlText -> EnmlNode
+text = Text
+
+br :: EnmlNode
+br = Single $ Element (showText Br) [] []
+
+
+noteTag, todoTag, checkedAttr :: Text
+noteTag = "en-note"
+todoTag = "en-todo"
+checkedAttr = "checked"
+
+data SupportedTag =
+      Br
+-- TODO: list all supported tags from the API specification
+instance Show SupportedTag where
+    show Br = "br"
+
+enmlDTD :: DocType
+enmlDTD = DocType "en-note" (System "http://xml.evernote.com/pub/enml2.dtd") NoInternalSubset
+
+mkDocument :: [Node] -> Document
+mkDocument = XmlDocument UTF8 (Just enmlDTD) . (:[]) . wrapInNote
+
+wrapInNote :: [Node] -> Node
+wrapInNote = Element noteTag []
+
+processNodes :: [EnmlNode] -> [Node]
+processNodes = concatMap toXml
+
+renderFull :: [EnmlNode] -> NoteContent
+renderFull = toByteString . render . mkDocument . processNodes
+
+renderPartial :: [EnmlNode] -> NoteContent
+renderPartial = toByteString . renderXmlFragment UTF8 . processNodes

File src/Evernote/Network.hs

+{-# LANGUAGE OverloadedStrings #-}
+module Evernote.Network (
+     Credentials(..)
+    , Login
+    , Password
+    , Settings()
+    , Key
+    , Secret
+    , AppId
+    , setupEvernote
+    , connectToUserStore
+    , connectToNoteStore
+    , authenticate
+    , saveToDefaultNotebook
+    , mkNote
+    , Note()
+    ) where
+
+import Network.URI (parseURI, nullURI, URI())
+
+import qualified Data.ByteString.Char8 as S
+import qualified Data.List as L 
+import           Data.Maybe (listToMaybe, fromJust)
+import           Control.Applicative ((<$>), (<*>))
+
+import           Thrift.Transport.HttpClient (openHttpClient, HttpClient)
+import           Thrift.Protocol.Binary (BinaryProtocol(..))
+
+import qualified UserStore_Client as USC
+import qualified UserStore_Consts as Consts
+import qualified UserStore_Types as UST
+import qualified Types_Types as TT
+import qualified Errors_Types as ET
+import qualified NoteStore_Client as NSC
+import           NoteStore_Types()
+
+import           Evernote.Common
+
+evernoteSandboxHost, evernoteHost :: String
+evernoteSandboxHost = "sandbox.evernote.com"
+evernoteHost = "evernote.com"
+
+mkUserStoreUri :: Bool -> String
+mkUserStoreUri False  = "https://" ++ evernoteHost ++ "/edam/user"
+mkUserStoreUri True   = "https://" ++ evernoteSandboxHost ++ "/edam/user"
+
+mkNoteStoreUriBase :: Bool -> String
+mkNoteStoreUriBase False = "https://" ++ evernoteHost ++ "/edam/note/"
+mkNoteStoreUriBase True = "https://" ++ evernoteSandboxHost ++ "/edam/note/"
+
+type Note = TT.Note
+
+type Login = S.ByteString
+type Password = S.ByteString
+type Key = S.ByteString
+type Secret = S.ByteString
+type AppId = S.ByteString
+
+data Credentials = Credentials {
+      getLogin :: Login
+    , getPassword :: Password
+    } deriving (Show)
+
+data Settings = Settings {
+       getKey :: Key
+     , getSecret :: Secret
+     , getAppId :: AppId
+     } deriving (Show)
+
+setupEvernote :: Key -> Secret -> AppId -> Settings
+setupEvernote = Settings
+
+correctURI :: String -> URI
+correctURI = maybe nullURI id . parseURI
+
+type ProtoPair = (BinaryProtocol HttpClient, BinaryProtocol HttpClient)
+
+mkProtoPair :: HttpClient -> ProtoPair 
+mkProtoPair t = (BinaryProtocol t, BinaryProtocol t)
+
+noteStoreURI :: Bool -> TT.User -> URI
+noteStoreURI useSandbox user =
+    let shardId = TT.f_User_shardId user
+        uriBase = mkNoteStoreUriBase useSandbox
+    in
+    correctURI $ maybe uriBase (uriBase ++) shardId
+
+
+type AuthToken = String
+
+data UStore = UStore
+data NStore = NStore
+
+type EvernoteAction s a = ProtoPair -> IO a
+
+type UserStoreAction a = EvernoteAction UStore a
+type NoteStoreAction a = AuthToken -> EvernoteAction NStore a
+
+checkVersion :: Settings -> UserStoreAction Bool
+checkVersion stg iops =
+    let appId = S.unpack $ getAppId stg
+    in
+        USC.checkVersion iops appId Consts.eDAM_VERSION_MAJOR Consts.eDAM_VERSION_MINOR
+
+authenticate' :: Settings -> Credentials -> UserStoreAction UST.AuthenticationResult
+authenticate' (Settings key0 secret0 _) (Credentials usr0 pwd0) iops = 
+    let usr = S.unpack usr0
+        pwd = S.unpack pwd0
+        key = S.unpack key0
+        secret = S.unpack secret0
+    in
+        -- TODO: catch EDAM exception and convert it to specific exception type with proper message
+        -- TODO: do the same for other low level functions invocations
+        USC.authenticate iops usr pwd key secret
+
+data AuthInfo = AuthInfo {
+        aiUser :: TT.User
+      , aiToken :: String
+      } deriving (Show)
+
+toAuthInfo :: UST.AuthenticationResult -> AuthInfo
+toAuthInfo authRes =
+    fromJust $
+        AuthInfo <$>
+            (UST.f_AuthenticationResult_user authRes) <*>
+            (UST.f_AuthenticationResult_authenticationToken authRes)
+
+newtype UserStoreConnection = UserStoreConnection HttpClient
+
+connectToUserStore :: Bool -> IO UserStoreConnection
+connectToUserStore useSandbox =
+    UserStoreConnection <$> (openHttpClient $ correctURI $ mkUserStoreUri $ useSandbox)
+
+data NoteStoreConnection = NoteStoreConnection HttpClient AuthToken
+
+connectToNoteStore :: AuthInfo -> Bool -> IO NoteStoreConnection
+connectToNoteStore (AuthInfo user token) useSandbox = do
+    t <- openHttpClient $ noteStoreURI useSandbox user
+    return $ NoteStoreConnection t token
+
+authenticate :: UserStoreConnection -> Settings -> Credentials -> IO AuthInfo
+authenticate (UserStoreConnection t) stg cred = do
+    versionOk <- checkVersion stg iops
+    if versionOk
+        then authenticate' stg cred iops >>= (return . toAuthInfo)
+        else fail "Protocol version mismatch"
+  where
+    iops = mkProtoPair t
+
+withNoteStore :: NoteStoreConnection -> NoteStoreAction a -> IO a
+withNoteStore (NoteStoreConnection t token) action =
+    action token $ mkProtoPair t
+
+saveToDefaultNotebook :: NoteStoreConnection -> TT.Note -> IO TT.Note
+saveToDefaultNotebook conn note =
+    withNoteStore conn storeNote
+  where
+    storeNote token iops = NSC.createNote iops token note
+
+---------------------------------------------------
+--
+-- notebook and notes manipulation functions
+--
+---------------------------------------------------
+
+defaultNotebook :: [TT.Notebook] -> Maybe TT.Notebook
+defaultNotebook =
+    listToMaybe . L.filter isDefault
+    where
+        isDefault :: TT.Notebook -> Bool
+        isDefault = maybe False id . TT.f_Notebook_defaultNotebook
+
+mkEmptyNote :: TT.Note
+mkEmptyNote =
+    TT.Note 
+        Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing
+        Nothing Nothing Nothing Nothing Nothing Nothing Nothing 
+
+mkNote :: NoteTitle -> NoteContent -> TT.Note
+mkNote t c =
+    n { TT.f_Note_title = Just $ S.unpack t
+      , TT.f_Note_content = Just $ S.unpack c
+      }
+  where
+    n = mkEmptyNote
+
+---------------------------------------------------
+--
+-- Error processing helpers
+--
+---------------------------------------------------
+class ErrorMessageHolder a where
+    errorMessage :: a -> String
+
+newtype UserException = UserEx ET.EDAMUserException
+instance ErrorMessageHolder UserException where
+    errorMessage (UserEx _e) = undefined
+    -- TODO: implement generation of proper error messages from error code and parameter name
+
+-- TODO: implement newtypes and instances for other EDAM exceptions

File src/Evernote/Thrift/Errors_Consts.hs

+{-# LANGUAGE DeriveDataTypeable #-}
+{-# OPTIONS_GHC -fno-warn-missing-fields #-}
+{-# OPTIONS_GHC -fno-warn-missing-signatures #-}
+{-# OPTIONS_GHC -fno-warn-name-shadowing #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports #-}
+{-# OPTIONS_GHC -fno-warn-unused-matches #-}
+
+-----------------------------------------------------------------
+-- Autogenerated by Thrift Compiler (0.7.0)                      --
+--                                                             --
+-- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING --
+-----------------------------------------------------------------
+
+module Errors_Consts where
+import Prelude ( Bool(..), Enum, Double, String, Maybe(..),
+                 Eq, Show, Ord,
+                 return, length, IO, fromIntegral, fromEnum, toEnum,
+                 (&&), (||), (==), (++), ($), (-) )
+
+import Control.Exception
+import Data.ByteString.Lazy
+import Data.Int
+import Data.Typeable ( Typeable )
+import qualified Data.Map as Map
+import qualified Data.Set as Set
+
+import Thrift
+
+
+import Errors_Types

File src/Evernote/Thrift/Errors_Types.hs

+{-# LANGUAGE DeriveDataTypeable #-}
+{-# OPTIONS_GHC -fno-warn-missing-fields #-}
+{-# OPTIONS_GHC -fno-warn-missing-signatures #-}
+{-# OPTIONS_GHC -fno-warn-name-shadowing #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports #-}
+{-# OPTIONS_GHC -fno-warn-unused-matches #-}
+
+-----------------------------------------------------------------
+-- Autogenerated by Thrift Compiler (0.7.0)                      --
+--                                                             --
+-- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING --
+-----------------------------------------------------------------
+
+module Errors_Types where
+import Prelude ( Bool(..), Enum, Double, String, Maybe(..),
+                 Eq, Show, Ord,
+                 return, length, IO, fromIntegral, fromEnum, toEnum,
+                 (&&), (||), (==), (++), ($), (-) )
+
+import Control.Exception
+import Data.ByteString.Lazy
+import Data.Int
+import Data.Typeable ( Typeable )
+import qualified Data.Map as Map
+import qualified Data.Set as Set
+
+import Thrift
+
+
+data EDAMErrorCode = UNKNOWN|BAD_DATA_FORMAT|PERMISSION_DENIED|INTERNAL_ERROR|DATA_REQUIRED|LIMIT_REACHED|QUOTA_REACHED|INVALID_AUTH|AUTH_EXPIRED|DATA_CONFLICT|ENML_VALIDATION|SHARD_UNAVAILABLE  deriving (Show,Eq, Typeable, Ord)
+instance Enum EDAMErrorCode where
+  fromEnum t = case t of
+    UNKNOWN -> 1
+    BAD_DATA_FORMAT -> 2
+    PERMISSION_DENIED -> 3
+    INTERNAL_ERROR -> 4
+    DATA_REQUIRED -> 5
+    LIMIT_REACHED -> 6
+    QUOTA_REACHED -> 7
+    INVALID_AUTH -> 8
+    AUTH_EXPIRED -> 9
+    DATA_CONFLICT -> 10
+    ENML_VALIDATION -> 11
+    SHARD_UNAVAILABLE -> 12
+  toEnum t = case t of
+    1 -> UNKNOWN
+    2 -> BAD_DATA_FORMAT
+    3 -> PERMISSION_DENIED
+    4 -> INTERNAL_ERROR
+    5 -> DATA_REQUIRED
+    6 -> LIMIT_REACHED
+    7 -> QUOTA_REACHED
+    8 -> INVALID_AUTH
+    9 -> AUTH_EXPIRED
+    10 -> DATA_CONFLICT
+    11 -> ENML_VALIDATION
+    12 -> SHARD_UNAVAILABLE
+    _ -> throw ThriftException
+data EDAMUserException = EDAMUserException{f_EDAMUserException_errorCode :: Maybe EDAMErrorCode,f_EDAMUserException_parameter :: Maybe String} deriving (Show,Eq,Ord,Typeable)
+instance Exception EDAMUserException
+write_EDAMUserException oprot record = do
+  writeStructBegin oprot "EDAMUserException"
+  case f_EDAMUserException_errorCode record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("errorCode",T_I32,1)
+    writeI32 oprot (fromIntegral $ fromEnum _v)
+    writeFieldEnd oprot}
+  case f_EDAMUserException_parameter record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("parameter",T_STRING,2)
+    writeString oprot _v
+    writeFieldEnd oprot}
+  writeFieldStop oprot
+  writeStructEnd oprot
+read_EDAMUserException_fields iprot record = do
+  (_,_t3,_id4) <- readFieldBegin iprot
+  if _t3 == T_STOP then return record else
+    case _id4 of 
+      1 -> if _t3 == T_I32 then do
+        s <- (do {i <- readI32 iprot; return $ toEnum $ fromIntegral i})
+        read_EDAMUserException_fields iprot record{f_EDAMUserException_errorCode=Just s}
+        else do
+          skip iprot _t3
+          read_EDAMUserException_fields iprot record
+      2 -> if _t3 == T_STRING then do
+        s <- readString iprot
+        read_EDAMUserException_fields iprot record{f_EDAMUserException_parameter=Just s}
+        else do
+          skip iprot _t3
+          read_EDAMUserException_fields iprot record
+      _ -> do
+        skip iprot _t3
+        readFieldEnd iprot
+        read_EDAMUserException_fields iprot record
+read_EDAMUserException iprot = do
+  _ <- readStructBegin iprot
+  record <- read_EDAMUserException_fields iprot (EDAMUserException{f_EDAMUserException_errorCode=Nothing,f_EDAMUserException_parameter=Nothing})
+  readStructEnd iprot
+  return record
+data EDAMSystemException = EDAMSystemException{f_EDAMSystemException_errorCode :: Maybe EDAMErrorCode,f_EDAMSystemException_message :: Maybe String} deriving (Show,Eq,Ord,Typeable)
+instance Exception EDAMSystemException
+write_EDAMSystemException oprot record = do
+  writeStructBegin oprot "EDAMSystemException"
+  case f_EDAMSystemException_errorCode record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("errorCode",T_I32,1)
+    writeI32 oprot (fromIntegral $ fromEnum _v)
+    writeFieldEnd oprot}
+  case f_EDAMSystemException_message record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("message",T_STRING,2)
+    writeString oprot _v
+    writeFieldEnd oprot}
+  writeFieldStop oprot
+  writeStructEnd oprot
+read_EDAMSystemException_fields iprot record = do
+  (_,_t8,_id9) <- readFieldBegin iprot
+  if _t8 == T_STOP then return record else
+    case _id9 of 
+      1 -> if _t8 == T_I32 then do
+        s <- (do {i <- readI32 iprot; return $ toEnum $ fromIntegral i})
+        read_EDAMSystemException_fields iprot record{f_EDAMSystemException_errorCode=Just s}
+        else do
+          skip iprot _t8
+          read_EDAMSystemException_fields iprot record
+      2 -> if _t8 == T_STRING then do
+        s <- readString iprot
+        read_EDAMSystemException_fields iprot record{f_EDAMSystemException_message=Just s}
+        else do
+          skip iprot _t8
+          read_EDAMSystemException_fields iprot record
+      _ -> do
+        skip iprot _t8
+        readFieldEnd iprot
+        read_EDAMSystemException_fields iprot record
+read_EDAMSystemException iprot = do
+  _ <- readStructBegin iprot
+  record <- read_EDAMSystemException_fields iprot (EDAMSystemException{f_EDAMSystemException_errorCode=Nothing,f_EDAMSystemException_message=Nothing})
+  readStructEnd iprot
+  return record
+data EDAMNotFoundException = EDAMNotFoundException{f_EDAMNotFoundException_identifier :: Maybe String,f_EDAMNotFoundException_key :: Maybe String} deriving (Show,Eq,Ord,Typeable)
+instance Exception EDAMNotFoundException
+write_EDAMNotFoundException oprot record = do
+  writeStructBegin oprot "EDAMNotFoundException"
+  case f_EDAMNotFoundException_identifier record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("identifier",T_STRING,1)
+    writeString oprot _v
+    writeFieldEnd oprot}
+  case f_EDAMNotFoundException_key record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("key",T_STRING,2)
+    writeString oprot _v
+    writeFieldEnd oprot}
+  writeFieldStop oprot
+  writeStructEnd oprot
+read_EDAMNotFoundException_fields iprot record = do
+  (_,_t13,_id14) <- readFieldBegin iprot
+  if _t13 == T_STOP then return record else
+    case _id14 of 
+      1 -> if _t13 == T_STRING then do
+        s <- readString iprot
+        read_EDAMNotFoundException_fields iprot record{f_EDAMNotFoundException_identifier=Just s}
+        else do
+          skip iprot _t13
+          read_EDAMNotFoundException_fields iprot record
+      2 -> if _t13 == T_STRING then do
+        s <- readString iprot
+        read_EDAMNotFoundException_fields iprot record{f_EDAMNotFoundException_key=Just s}
+        else do
+          skip iprot _t13
+          read_EDAMNotFoundException_fields iprot record
+      _ -> do
+        skip iprot _t13
+        readFieldEnd iprot
+        read_EDAMNotFoundException_fields iprot record
+read_EDAMNotFoundException iprot = do
+  _ <- readStructBegin iprot
+  record <- read_EDAMNotFoundException_fields iprot (EDAMNotFoundException{f_EDAMNotFoundException_identifier=Nothing,f_EDAMNotFoundException_key=Nothing})
+  readStructEnd iprot
+  return record

File src/Evernote/Thrift/Limits_Consts.hs

+{-# LANGUAGE DeriveDataTypeable #-}
+{-# OPTIONS_GHC -fno-warn-missing-fields #-}
+{-# OPTIONS_GHC -fno-warn-missing-signatures #-}
+{-# OPTIONS_GHC -fno-warn-name-shadowing #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports #-}
+{-# OPTIONS_GHC -fno-warn-unused-matches #-}
+
+-----------------------------------------------------------------
+-- Autogenerated by Thrift Compiler (0.7.0)                      --
+--                                                             --
+-- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING --
+-----------------------------------------------------------------
+
+module Limits_Consts where
+import Prelude ( Bool(..), Enum, Double, String, Maybe(..),
+                 Eq, Show, Ord,
+                 return, length, IO, fromIntegral, fromEnum, toEnum,
+                 (&&), (||), (==), (++), ($), (-) )
+
+import Control.Exception
+import Data.ByteString.Lazy
+import Data.Int
+import Data.Typeable ( Typeable )
+import qualified Data.Map as Map
+import qualified Data.Set as Set
+
+import Thrift
+
+
+import Limits_Types
+eDAM_ATTRIBUTE_LEN_MIN :: Int32
+eDAM_ATTRIBUTE_LEN_MIN = (1 :: Int32)
+
+eDAM_ATTRIBUTE_LEN_MAX :: Int32
+eDAM_ATTRIBUTE_LEN_MAX = (4096 :: Int32)
+
+eDAM_ATTRIBUTE_REGEX :: String
+eDAM_ATTRIBUTE_REGEX = "^[^\\p{Cc}\\p{Zl}\\p{Zp}]{1,4096}$"
+
+eDAM_ATTRIBUTE_LIST_MAX :: Int32
+eDAM_ATTRIBUTE_LIST_MAX = (100 :: Int32)
+
+eDAM_GUID_LEN_MIN :: Int32
+eDAM_GUID_LEN_MIN = (36 :: Int32)
+
+eDAM_GUID_LEN_MAX :: Int32
+eDAM_GUID_LEN_MAX = (36 :: Int32)
+
+eDAM_GUID_REGEX :: String
+eDAM_GUID_REGEX = "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
+
+eDAM_EMAIL_LEN_MIN :: Int32
+eDAM_EMAIL_LEN_MIN = (6 :: Int32)
+
+eDAM_EMAIL_LEN_MAX :: Int32
+eDAM_EMAIL_LEN_MAX = (255 :: Int32)
+
+eDAM_EMAIL_LOCAL_REGEX :: String
+eDAM_EMAIL_LOCAL_REGEX = "^[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+(\\.[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+)*$"
+
+eDAM_EMAIL_DOMAIN_REGEX :: String
+eDAM_EMAIL_DOMAIN_REGEX = "^[A-Za-z0-9-]+(\\.[A-Za-z0-9-]+)*\\.([A-Za-z]{2,})$"
+
+eDAM_EMAIL_REGEX :: String
+eDAM_EMAIL_REGEX = "^[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+(\\.[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9-]+)*\\.([A-Za-z]{2,})$"
+
+eDAM_TIMEZONE_LEN_MIN :: Int32
+eDAM_TIMEZONE_LEN_MIN = (1 :: Int32)
+
+eDAM_TIMEZONE_LEN_MAX :: Int32
+eDAM_TIMEZONE_LEN_MAX = (32 :: Int32)
+
+eDAM_TIMEZONE_REGEX :: String
+eDAM_TIMEZONE_REGEX = "^([A-Za-z_-]+(/[A-Za-z_-]+)*)|(GMT(-|\\+)[0-9]{1,2}(:[0-9]{2})?)$"
+
+eDAM_MIME_LEN_MIN :: Int32
+eDAM_MIME_LEN_MIN = (3 :: Int32)
+
+eDAM_MIME_LEN_MAX :: Int32
+eDAM_MIME_LEN_MAX = (255 :: Int32)
+
+eDAM_MIME_REGEX :: String
+eDAM_MIME_REGEX = "^[A-Za-z]+/[A-Za-z0-9._+-]+$"
+
+eDAM_MIME_TYPE_GIF :: String
+eDAM_MIME_TYPE_GIF = "image/gif"
+
+eDAM_MIME_TYPE_JPEG :: String
+eDAM_MIME_TYPE_JPEG = "image/jpeg"
+
+eDAM_MIME_TYPE_PNG :: String
+eDAM_MIME_TYPE_PNG = "image/png"
+
+eDAM_MIME_TYPE_WAV :: String
+eDAM_MIME_TYPE_WAV = "audio/wav"
+
+eDAM_MIME_TYPE_MP3 :: String
+eDAM_MIME_TYPE_MP3 = "audio/mpeg"
+
+eDAM_MIME_TYPE_AMR :: String
+eDAM_MIME_TYPE_AMR = "audio/amr"
+
+eDAM_MIME_TYPE_MP4_VIDEO :: String
+eDAM_MIME_TYPE_MP4_VIDEO = "video/mp4"
+
+eDAM_MIME_TYPE_INK :: String
+eDAM_MIME_TYPE_INK = "application/vnd.evernote.ink"
+
+eDAM_MIME_TYPE_PDF :: String
+eDAM_MIME_TYPE_PDF = "application/pdf"
+
+eDAM_MIME_TYPE_DEFAULT :: String
+eDAM_MIME_TYPE_DEFAULT = "application/octet-stream"
+
+eDAM_MIME_TYPES :: Set.Set String
+eDAM_MIME_TYPES = (Set.fromList ["image/gif","image/jpeg","image/png","audio/wav","audio/mpeg","audio/amr","application/vnd.evernote.ink","application/pdf","video/mp4"])
+
+eDAM_COMMERCE_SERVICE_GOOGLE :: String
+eDAM_COMMERCE_SERVICE_GOOGLE = "Google"
+
+eDAM_COMMERCE_SERVICE_PAYPAL :: String
+eDAM_COMMERCE_SERVICE_PAYPAL = "Paypal"
+
+eDAM_COMMERCE_SERVICE_GIFT :: String
+eDAM_COMMERCE_SERVICE_GIFT = "Gift"
+
+eDAM_COMMERCE_SERVICE_TRIALPAY :: String
+eDAM_COMMERCE_SERVICE_TRIALPAY = "TrialPay"
+
+eDAM_COMMERCE_SERVICE_TRIAL :: String
+eDAM_COMMERCE_SERVICE_TRIAL = "Trial"
+
+eDAM_COMMERCE_SERVICE_GROUP :: String
+eDAM_COMMERCE_SERVICE_GROUP = "Group"
+
+eDAM_COMMERCE_SERVICE_CYBERSOURCE :: String
+eDAM_COMMERCE_SERVICE_CYBERSOURCE = "CYBERSRC"
+
+eDAM_COMMERCE_DEFAULT_CURRENCY_COUNTRY_CODE :: String
+eDAM_COMMERCE_DEFAULT_CURRENCY_COUNTRY_CODE = "USD"
+
+eDAM_SEARCH_QUERY_LEN_MIN :: Int32
+eDAM_SEARCH_QUERY_LEN_MIN = (0 :: Int32)
+
+eDAM_SEARCH_QUERY_LEN_MAX :: Int32
+eDAM_SEARCH_QUERY_LEN_MAX = (1024 :: Int32)
+
+eDAM_SEARCH_QUERY_REGEX :: String
+eDAM_SEARCH_QUERY_REGEX = "^[^\\p{Cc}\\p{Zl}\\p{Zp}]{0,1024}$"
+
+eDAM_HASH_LEN :: Int32
+eDAM_HASH_LEN = (16 :: Int32)
+
+eDAM_USER_USERNAME_LEN_MIN :: Int32
+eDAM_USER_USERNAME_LEN_MIN = (1 :: Int32)
+
+eDAM_USER_USERNAME_LEN_MAX :: Int32
+eDAM_USER_USERNAME_LEN_MAX = (64 :: Int32)
+
+eDAM_USER_USERNAME_REGEX :: String
+eDAM_USER_USERNAME_REGEX = "^[a-z0-9]([a-z0-9_-]{0,62}[a-z0-9])?$"
+
+eDAM_USER_NAME_LEN_MIN :: Int32
+eDAM_USER_NAME_LEN_MIN = (1 :: Int32)
+
+eDAM_USER_NAME_LEN_MAX :: Int32
+eDAM_USER_NAME_LEN_MAX = (255 :: Int32)
+
+eDAM_USER_NAME_REGEX :: String
+eDAM_USER_NAME_REGEX = "^[^\\p{Cc}\\p{Zl}\\p{Zp}]{1,255}$"
+
+eDAM_TAG_NAME_LEN_MIN :: Int32
+eDAM_TAG_NAME_LEN_MIN = (1 :: Int32)
+
+eDAM_TAG_NAME_LEN_MAX :: Int32
+eDAM_TAG_NAME_LEN_MAX = (100 :: Int32)
+
+eDAM_TAG_NAME_REGEX :: String
+eDAM_TAG_NAME_REGEX = "^[^,\\p{Cc}\\p{Z}]([^,\\p{Cc}\\p{Zl}\\p{Zp}]{0,98}[^,\\p{Cc}\\p{Z}])?$"
+
+eDAM_NOTE_TITLE_LEN_MIN :: Int32
+eDAM_NOTE_TITLE_LEN_MIN = (1 :: Int32)
+
+eDAM_NOTE_TITLE_LEN_MAX :: Int32
+eDAM_NOTE_TITLE_LEN_MAX = (255 :: Int32)
+
+eDAM_NOTE_TITLE_REGEX :: String
+eDAM_NOTE_TITLE_REGEX = "^[^\\p{Cc}\\p{Z}]([^\\p{Cc}\\p{Zl}\\p{Zp}]{0,253}[^\\p{Cc}\\p{Z}])?$"
+
+eDAM_NOTE_CONTENT_LEN_MIN :: Int32
+eDAM_NOTE_CONTENT_LEN_MIN = (0 :: Int32)
+
+eDAM_NOTE_CONTENT_LEN_MAX :: Int32
+eDAM_NOTE_CONTENT_LEN_MAX = (5242880 :: Int32)
+
+eDAM_NOTEBOOK_NAME_LEN_MIN :: Int32
+eDAM_NOTEBOOK_NAME_LEN_MIN = (1 :: Int32)
+
+eDAM_NOTEBOOK_NAME_LEN_MAX :: Int32
+eDAM_NOTEBOOK_NAME_LEN_MAX = (100 :: Int32)
+
+eDAM_NOTEBOOK_NAME_REGEX :: String
+eDAM_NOTEBOOK_NAME_REGEX = "^[^\\p{Cc}\\p{Z}]([^\\p{Cc}\\p{Zl}\\p{Zp}]{0,98}[^\\p{Cc}\\p{Z}])?$"
+
+eDAM_NOTEBOOK_STACK_LEN_MIN :: Int32
+eDAM_NOTEBOOK_STACK_LEN_MIN = (1 :: Int32)
+
+eDAM_NOTEBOOK_STACK_LEN_MAX :: Int32
+eDAM_NOTEBOOK_STACK_LEN_MAX = (100 :: Int32)
+
+eDAM_NOTEBOOK_STACK_REGEX :: String
+eDAM_NOTEBOOK_STACK_REGEX = "^[^\\p{Cc}\\p{Z}]([^\\p{Cc}\\p{Zl}\\p{Zp}]{0,98}[^\\p{Cc}\\p{Z}])?$"
+
+eDAM_PUBLISHING_URI_LEN_MIN :: Int32
+eDAM_PUBLISHING_URI_LEN_MIN = (1 :: Int32)
+
+eDAM_PUBLISHING_URI_LEN_MAX :: Int32
+eDAM_PUBLISHING_URI_LEN_MAX = (255 :: Int32)
+
+eDAM_PUBLISHING_URI_REGEX :: String
+eDAM_PUBLISHING_URI_REGEX = "^[a-zA-Z0-9.~_+-]{1,255}$"
+
+eDAM_PUBLISHING_URI_PROHIBITED :: Set.Set String
+eDAM_PUBLISHING_URI_PROHIBITED = (Set.fromList [".."])
+
+eDAM_PUBLISHING_DESCRIPTION_LEN_MIN :: Int32
+eDAM_PUBLISHING_DESCRIPTION_LEN_MIN = (1 :: Int32)
+
+eDAM_PUBLISHING_DESCRIPTION_LEN_MAX :: Int32
+eDAM_PUBLISHING_DESCRIPTION_LEN_MAX = (200 :: Int32)
+
+eDAM_PUBLISHING_DESCRIPTION_REGEX :: String
+eDAM_PUBLISHING_DESCRIPTION_REGEX = "^[^\\p{Cc}\\p{Z}]([^\\p{Cc}\\p{Zl}\\p{Zp}]{0,198}[^\\p{Cc}\\p{Z}])?$"
+
+eDAM_SAVED_SEARCH_NAME_LEN_MIN :: Int32
+eDAM_SAVED_SEARCH_NAME_LEN_MIN = (1 :: Int32)
+
+eDAM_SAVED_SEARCH_NAME_LEN_MAX :: Int32
+eDAM_SAVED_SEARCH_NAME_LEN_MAX = (100 :: Int32)
+
+eDAM_SAVED_SEARCH_NAME_REGEX :: String
+eDAM_SAVED_SEARCH_NAME_REGEX = "^[^\\p{Cc}\\p{Z}]([^\\p{Cc}\\p{Zl}\\p{Zp}]{0,98}[^\\p{Cc}\\p{Z}])?$"
+
+eDAM_USER_PASSWORD_LEN_MIN :: Int32
+eDAM_USER_PASSWORD_LEN_MIN = (6 :: Int32)
+
+eDAM_USER_PASSWORD_LEN_MAX :: Int32
+eDAM_USER_PASSWORD_LEN_MAX = (64 :: Int32)
+
+eDAM_USER_PASSWORD_REGEX :: String
+eDAM_USER_PASSWORD_REGEX = "^[A-Za-z0-9!#$%&'()*+,./:;<=>?@^_`{|}~\\[\\]\\\\-]{6,64}$"
+
+eDAM_NOTE_TAGS_MAX :: Int32
+eDAM_NOTE_TAGS_MAX = (100 :: Int32)
+
+eDAM_NOTE_RESOURCES_MAX :: Int32
+eDAM_NOTE_RESOURCES_MAX = (1000 :: Int32)
+
+eDAM_USER_TAGS_MAX :: Int32
+eDAM_USER_TAGS_MAX = (100000 :: Int32)
+
+eDAM_USER_SAVED_SEARCHES_MAX :: Int32
+eDAM_USER_SAVED_SEARCHES_MAX = (100 :: Int32)
+
+eDAM_USER_NOTES_MAX :: Int32
+eDAM_USER_NOTES_MAX = (100000 :: Int32)
+
+eDAM_USER_NOTEBOOKS_MAX :: Int32
+eDAM_USER_NOTEBOOKS_MAX = (250 :: Int32)
+
+eDAM_USER_RECENT_MAILED_ADDRESSES_MAX :: Int32
+eDAM_USER_RECENT_MAILED_ADDRESSES_MAX = (10 :: Int32)
+
+eDAM_USER_MAIL_LIMIT_DAILY_FREE :: Int32
+eDAM_USER_MAIL_LIMIT_DAILY_FREE = (50 :: Int32)
+
+eDAM_USER_MAIL_LIMIT_DAILY_PREMIUM :: Int32
+eDAM_USER_MAIL_LIMIT_DAILY_PREMIUM = (200 :: Int32)
+
+eDAM_USER_UPLOAD_LIMIT_FREE :: Int64
+eDAM_USER_UPLOAD_LIMIT_FREE = (62914560 :: Int64)
+
+eDAM_USER_UPLOAD_LIMIT_PREMIUM :: Int64
+eDAM_USER_UPLOAD_LIMIT_PREMIUM = (1073741824 :: Int64)
+
+eDAM_NOTE_SIZE_MAX_FREE :: Int32
+eDAM_NOTE_SIZE_MAX_FREE = (26214400 :: Int32)
+
+eDAM_NOTE_SIZE_MAX_PREMIUM :: Int32
+eDAM_NOTE_SIZE_MAX_PREMIUM = (52428800 :: Int32)
+
+eDAM_RESOURCE_SIZE_MAX_FREE :: Int32
+eDAM_RESOURCE_SIZE_MAX_FREE = (26214400 :: Int32)
+
+eDAM_RESOURCE_SIZE_MAX_PREMIUM :: Int32
+eDAM_RESOURCE_SIZE_MAX_PREMIUM = (52428800 :: Int32)
+
+eDAM_USER_LINKED_NOTEBOOK_MAX :: Int32
+eDAM_USER_LINKED_NOTEBOOK_MAX = (100 :: Int32)
+
+eDAM_NOTEBOOK_SHARED_NOTEBOOK_MAX :: Int32
+eDAM_NOTEBOOK_SHARED_NOTEBOOK_MAX = (250 :: Int32)
+

File src/Evernote/Thrift/Limits_Types.hs

+{-# LANGUAGE DeriveDataTypeable #-}
+{-# OPTIONS_GHC -fno-warn-missing-fields #-}
+{-# OPTIONS_GHC -fno-warn-missing-signatures #-}
+{-# OPTIONS_GHC -fno-warn-name-shadowing #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports #-}
+{-# OPTIONS_GHC -fno-warn-unused-matches #-}
+
+-----------------------------------------------------------------
+-- Autogenerated by Thrift Compiler (0.7.0)                      --
+--                                                             --
+-- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING --
+-----------------------------------------------------------------
+
+module Limits_Types where
+import Prelude ( Bool(..), Enum, Double, String, Maybe(..),
+                 Eq, Show, Ord,
+                 return, length, IO, fromIntegral, fromEnum, toEnum,
+                 (&&), (||), (==), (++), ($), (-) )
+
+import Control.Exception
+import Data.ByteString.Lazy
+import Data.Int
+import Data.Typeable ( Typeable )
+import qualified Data.Map as Map
+import qualified Data.Set as Set
+
+import Thrift
+
+

File src/Evernote/Thrift/NoteStore.hs

+{-# LANGUAGE DeriveDataTypeable #-}
+{-# OPTIONS_GHC -fno-warn-missing-fields #-}
+{-# OPTIONS_GHC -fno-warn-missing-signatures #-}
+{-# OPTIONS_GHC -fno-warn-name-shadowing #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports #-}
+{-# OPTIONS_GHC -fno-warn-unused-matches #-}
+
+-----------------------------------------------------------------
+-- Autogenerated by Thrift Compiler (0.7.0)                      --
+--                                                             --
+-- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING --
+-----------------------------------------------------------------
+
+module NoteStore where
+import Prelude ( Bool(..), Enum, Double, String, Maybe(..),
+                 Eq, Show, Ord,
+                 return, length, IO, fromIntegral, fromEnum, toEnum,
+                 (&&), (||), (==), (++), ($), (-) )
+
+import Control.Exception
+import Data.ByteString.Lazy
+import Data.Int
+import Data.Typeable ( Typeable )
+import qualified Data.Map as Map
+import qualified Data.Set as Set
+
+import Thrift
+
+import UserStore_Types
+import Types_Types
+import Errors_Types
+import Limits_Types
+
+
+import NoteStore_Types
+import qualified NoteStore_Iface as Iface
+-- HELPER FUNCTIONS AND STRUCTURES --
+
+data GetSyncState_args = GetSyncState_args{f_GetSyncState_args_authenticationToken :: Maybe String} deriving (Show,Eq,Ord,Typeable)
+write_GetSyncState_args oprot record = do
+  writeStructBegin oprot "GetSyncState_args"
+  case f_GetSyncState_args_authenticationToken record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("authenticationToken",T_STRING,1)
+    writeString oprot _v
+    writeFieldEnd oprot}
+  writeFieldStop oprot
+  writeStructEnd oprot
+read_GetSyncState_args_fields iprot record = do
+  (_,_t221,_id222) <- readFieldBegin iprot
+  if _t221 == T_STOP then return record else
+    case _id222 of 
+      1 -> if _t221 == T_STRING then do
+        s <- readString iprot
+        read_GetSyncState_args_fields iprot record{f_GetSyncState_args_authenticationToken=Just s}
+        else do
+          skip iprot _t221
+          read_GetSyncState_args_fields iprot record
+      _ -> do
+        skip iprot _t221
+        readFieldEnd iprot
+        read_GetSyncState_args_fields iprot record
+read_GetSyncState_args iprot = do
+  _ <- readStructBegin iprot
+  record <- read_GetSyncState_args_fields iprot (GetSyncState_args{f_GetSyncState_args_authenticationToken=Nothing})
+  readStructEnd iprot
+  return record
+data GetSyncState_result = GetSyncState_result{f_GetSyncState_result_success :: Maybe SyncState,f_GetSyncState_result_userException :: Maybe Errors_Types.EDAMUserException,f_GetSyncState_result_systemException :: Maybe Errors_Types.EDAMSystemException} deriving (Show,Eq,Ord,Typeable)
+write_GetSyncState_result oprot record = do
+  writeStructBegin oprot "GetSyncState_result"
+  case f_GetSyncState_result_success record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("success",T_STRUCT,0)
+    write_SyncState oprot _v
+    writeFieldEnd oprot}
+  case f_GetSyncState_result_userException record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("userException",T_STRUCT,1)
+    Errors_Types.write_EDAMUserException oprot _v
+    writeFieldEnd oprot}
+  case f_GetSyncState_result_systemException record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("systemException",T_STRUCT,2)
+    Errors_Types.write_EDAMSystemException oprot _v
+    writeFieldEnd oprot}
+  writeFieldStop oprot
+  writeStructEnd oprot
+read_GetSyncState_result_fields iprot record = do
+  (_,_t226,_id227) <- readFieldBegin iprot
+  if _t226 == T_STOP then return record else
+    case _id227 of 
+      0 -> if _t226 == T_STRUCT then do
+        s <- (read_SyncState iprot)
+        read_GetSyncState_result_fields iprot record{f_GetSyncState_result_success=Just s}
+        else do
+          skip iprot _t226
+          read_GetSyncState_result_fields iprot record
+      1 -> if _t226 == T_STRUCT then do
+        s <- (read_EDAMUserException iprot)
+        read_GetSyncState_result_fields iprot record{f_GetSyncState_result_userException=Just s}
+        else do
+          skip iprot _t226
+          read_GetSyncState_result_fields iprot record
+      2 -> if _t226 == T_STRUCT then do
+        s <- (read_EDAMSystemException iprot)
+        read_GetSyncState_result_fields iprot record{f_GetSyncState_result_systemException=Just s}
+        else do
+          skip iprot _t226
+          read_GetSyncState_result_fields iprot record
+      _ -> do
+        skip iprot _t226
+        readFieldEnd iprot
+        read_GetSyncState_result_fields iprot record
+read_GetSyncState_result iprot = do
+  _ <- readStructBegin iprot
+  record <- read_GetSyncState_result_fields iprot (GetSyncState_result{f_GetSyncState_result_success=Nothing,f_GetSyncState_result_userException=Nothing,f_GetSyncState_result_systemException=Nothing})
+  readStructEnd iprot
+  return record
+data GetSyncChunk_args = GetSyncChunk_args{f_GetSyncChunk_args_authenticationToken :: Maybe String,f_GetSyncChunk_args_afterUSN :: Maybe Int32,f_GetSyncChunk_args_maxEntries :: Maybe Int32,f_GetSyncChunk_args_fullSyncOnly :: Maybe Bool} deriving (Show,Eq,Ord,Typeable)
+write_GetSyncChunk_args oprot record = do
+  writeStructBegin oprot "GetSyncChunk_args"
+  case f_GetSyncChunk_args_authenticationToken record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("authenticationToken",T_STRING,1)
+    writeString oprot _v
+    writeFieldEnd oprot}
+  case f_GetSyncChunk_args_afterUSN record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("afterUSN",T_I32,2)
+    writeI32 oprot _v
+    writeFieldEnd oprot}
+  case f_GetSyncChunk_args_maxEntries record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("maxEntries",T_I32,3)
+    writeI32 oprot _v
+    writeFieldEnd oprot}
+  case f_GetSyncChunk_args_fullSyncOnly record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("fullSyncOnly",T_BOOL,4)
+    writeBool oprot _v
+    writeFieldEnd oprot}
+  writeFieldStop oprot
+  writeStructEnd oprot
+read_GetSyncChunk_args_fields iprot record = do
+  (_,_t231,_id232) <- readFieldBegin iprot
+  if _t231 == T_STOP then return record else
+    case _id232 of 
+      1 -> if _t231 == T_STRING then do
+        s <- readString iprot
+        read_GetSyncChunk_args_fields iprot record{f_GetSyncChunk_args_authenticationToken=Just s}
+        else do
+          skip iprot _t231
+          read_GetSyncChunk_args_fields iprot record
+      2 -> if _t231 == T_I32 then do
+        s <- readI32 iprot
+        read_GetSyncChunk_args_fields iprot record{f_GetSyncChunk_args_afterUSN=Just s}
+        else do
+          skip iprot _t231
+          read_GetSyncChunk_args_fields iprot record
+      3 -> if _t231 == T_I32 then do
+        s <- readI32 iprot
+        read_GetSyncChunk_args_fields iprot record{f_GetSyncChunk_args_maxEntries=Just s}
+        else do
+          skip iprot _t231
+          read_GetSyncChunk_args_fields iprot record
+      4 -> if _t231 == T_BOOL then do
+        s <- readBool iprot
+        read_GetSyncChunk_args_fields iprot record{f_GetSyncChunk_args_fullSyncOnly=Just s}
+        else do
+          skip iprot _t231
+          read_GetSyncChunk_args_fields iprot record
+      _ -> do
+        skip iprot _t231
+        readFieldEnd iprot
+        read_GetSyncChunk_args_fields iprot record
+read_GetSyncChunk_args iprot = do
+  _ <- readStructBegin iprot
+  record <- read_GetSyncChunk_args_fields iprot (GetSyncChunk_args{f_GetSyncChunk_args_authenticationToken=Nothing,f_GetSyncChunk_args_afterUSN=Nothing,f_GetSyncChunk_args_maxEntries=Nothing,f_GetSyncChunk_args_fullSyncOnly=Nothing})
+  readStructEnd iprot
+  return record
+data GetSyncChunk_result = GetSyncChunk_result{f_GetSyncChunk_result_success :: Maybe SyncChunk,f_GetSyncChunk_result_userException :: Maybe Errors_Types.EDAMUserException,f_GetSyncChunk_result_systemException :: Maybe Errors_Types.EDAMSystemException} deriving (Show,Eq,Ord,Typeable)
+write_GetSyncChunk_result oprot record = do
+  writeStructBegin oprot "GetSyncChunk_result"
+  case f_GetSyncChunk_result_success record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("success",T_STRUCT,0)
+    write_SyncChunk oprot _v
+    writeFieldEnd oprot}
+  case f_GetSyncChunk_result_userException record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("userException",T_STRUCT,1)
+    Errors_Types.write_EDAMUserException oprot _v
+    writeFieldEnd oprot}
+  case f_GetSyncChunk_result_systemException record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("systemException",T_STRUCT,2)
+    Errors_Types.write_EDAMSystemException oprot _v
+    writeFieldEnd oprot}
+  writeFieldStop oprot
+  writeStructEnd oprot
+read_GetSyncChunk_result_fields iprot record = do
+  (_,_t236,_id237) <- readFieldBegin iprot
+  if _t236 == T_STOP then return record else
+    case _id237 of 
+      0 -> if _t236 == T_STRUCT then do
+        s <- (read_SyncChunk iprot)
+        read_GetSyncChunk_result_fields iprot record{f_GetSyncChunk_result_success=Just s}
+        else do
+          skip iprot _t236
+          read_GetSyncChunk_result_fields iprot record
+      1 -> if _t236 == T_STRUCT then do
+        s <- (read_EDAMUserException iprot)
+        read_GetSyncChunk_result_fields iprot record{f_GetSyncChunk_result_userException=Just s}
+        else do
+          skip iprot _t236
+          read_GetSyncChunk_result_fields iprot record
+      2 -> if _t236 == T_STRUCT then do
+        s <- (read_EDAMSystemException iprot)
+        read_GetSyncChunk_result_fields iprot record{f_GetSyncChunk_result_systemException=Just s}
+        else do
+          skip iprot _t236
+          read_GetSyncChunk_result_fields iprot record
+      _ -> do
+        skip iprot _t236
+        readFieldEnd iprot
+        read_GetSyncChunk_result_fields iprot record
+read_GetSyncChunk_result iprot = do
+  _ <- readStructBegin iprot
+  record <- read_GetSyncChunk_result_fields iprot (GetSyncChunk_result{f_GetSyncChunk_result_success=Nothing,f_GetSyncChunk_result_userException=Nothing,f_GetSyncChunk_result_systemException=Nothing})
+  readStructEnd iprot
+  return record
+data GetFilteredSyncChunk_args = GetFilteredSyncChunk_args{f_GetFilteredSyncChunk_args_authenticationToken :: Maybe String,f_GetFilteredSyncChunk_args_afterUSN :: Maybe Int32,f_GetFilteredSyncChunk_args_maxEntries :: Maybe Int32,f_GetFilteredSyncChunk_args_filter :: Maybe SyncChunkFilter} deriving (Show,Eq,Ord,Typeable)
+write_GetFilteredSyncChunk_args oprot record = do
+  writeStructBegin oprot "GetFilteredSyncChunk_args"
+  case f_GetFilteredSyncChunk_args_authenticationToken record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("authenticationToken",T_STRING,1)
+    writeString oprot _v
+    writeFieldEnd oprot}
+  case f_GetFilteredSyncChunk_args_afterUSN record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("afterUSN",T_I32,2)
+    writeI32 oprot _v
+    writeFieldEnd oprot}
+  case f_GetFilteredSyncChunk_args_maxEntries record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("maxEntries",T_I32,3)
+    writeI32 oprot _v
+    writeFieldEnd oprot}
+  case f_GetFilteredSyncChunk_args_filter record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("filter",T_STRUCT,4)
+    write_SyncChunkFilter oprot _v
+    writeFieldEnd oprot}
+  writeFieldStop oprot
+  writeStructEnd oprot
+read_GetFilteredSyncChunk_args_fields iprot record = do
+  (_,_t241,_id242) <- readFieldBegin iprot
+  if _t241 == T_STOP then return record else
+    case _id242 of 
+      1 -> if _t241 == T_STRING then do
+        s <- readString iprot
+        read_GetFilteredSyncChunk_args_fields iprot record{f_GetFilteredSyncChunk_args_authenticationToken=Just s}
+        else do
+          skip iprot _t241
+          read_GetFilteredSyncChunk_args_fields iprot record
+      2 -> if _t241 == T_I32 then do
+        s <- readI32 iprot
+        read_GetFilteredSyncChunk_args_fields iprot record{f_GetFilteredSyncChunk_args_afterUSN=Just s}
+        else do
+          skip iprot _t241
+          read_GetFilteredSyncChunk_args_fields iprot record
+      3 -> if _t241 == T_I32 then do
+        s <- readI32 iprot
+        read_GetFilteredSyncChunk_args_fields iprot record{f_GetFilteredSyncChunk_args_maxEntries=Just s}
+        else do
+          skip iprot _t241
+          read_GetFilteredSyncChunk_args_fields iprot record
+      4 -> if _t241 == T_STRUCT then do
+        s <- (read_SyncChunkFilter iprot)
+        read_GetFilteredSyncChunk_args_fields iprot record{f_GetFilteredSyncChunk_args_filter=Just s}
+        else do
+          skip iprot _t241
+          read_GetFilteredSyncChunk_args_fields iprot record
+      _ -> do
+        skip iprot _t241
+        readFieldEnd iprot
+        read_GetFilteredSyncChunk_args_fields iprot record
+read_GetFilteredSyncChunk_args iprot = do
+  _ <- readStructBegin iprot
+  record <- read_GetFilteredSyncChunk_args_fields iprot (GetFilteredSyncChunk_args{f_GetFilteredSyncChunk_args_authenticationToken=Nothing,f_GetFilteredSyncChunk_args_afterUSN=Nothing,f_GetFilteredSyncChunk_args_maxEntries=Nothing,f_GetFilteredSyncChunk_args_filter=Nothing})
+  readStructEnd iprot
+  return record
+data GetFilteredSyncChunk_result = GetFilteredSyncChunk_result{f_GetFilteredSyncChunk_result_success :: Maybe SyncChunk,f_GetFilteredSyncChunk_result_userException :: Maybe Errors_Types.EDAMUserException,f_GetFilteredSyncChunk_result_systemException :: Maybe Errors_Types.EDAMSystemException} deriving (Show,Eq,Ord,Typeable)
+write_GetFilteredSyncChunk_result oprot record = do
+  writeStructBegin oprot "GetFilteredSyncChunk_result"
+  case f_GetFilteredSyncChunk_result_success record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("success",T_STRUCT,0)
+    write_SyncChunk oprot _v
+    writeFieldEnd oprot}
+  case f_GetFilteredSyncChunk_result_userException record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("userException",T_STRUCT,1)
+    Errors_Types.write_EDAMUserException oprot _v
+    writeFieldEnd oprot}
+  case f_GetFilteredSyncChunk_result_systemException record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("systemException",T_STRUCT,2)
+    Errors_Types.write_EDAMSystemException oprot _v
+    writeFieldEnd oprot}
+  writeFieldStop oprot
+  writeStructEnd oprot
+read_GetFilteredSyncChunk_result_fields iprot record = do
+  (_,_t246,_id247) <- readFieldBegin iprot
+  if _t246 == T_STOP then return record else
+    case _id247 of 
+      0 -> if _t246 == T_STRUCT then do
+        s <- (read_SyncChunk iprot)
+        read_GetFilteredSyncChunk_result_fields iprot record{f_GetFilteredSyncChunk_result_success=Just s}
+        else do
+          skip iprot _t246
+          read_GetFilteredSyncChunk_result_fields iprot record
+      1 -> if _t246 == T_STRUCT then do
+        s <- (read_EDAMUserException iprot)
+        read_GetFilteredSyncChunk_result_fields iprot record{f_GetFilteredSyncChunk_result_userException=Just s}
+        else do
+          skip iprot _t246
+          read_GetFilteredSyncChunk_result_fields iprot record
+      2 -> if _t246 == T_STRUCT then do
+        s <- (read_EDAMSystemException iprot)
+        read_GetFilteredSyncChunk_result_fields iprot record{f_GetFilteredSyncChunk_result_systemException=Just s}
+        else do
+          skip iprot _t246
+          read_GetFilteredSyncChunk_result_fields iprot record
+      _ -> do
+        skip iprot _t246
+        readFieldEnd iprot
+        read_GetFilteredSyncChunk_result_fields iprot record
+read_GetFilteredSyncChunk_result iprot = do
+  _ <- readStructBegin iprot
+  record <- read_GetFilteredSyncChunk_result_fields iprot (GetFilteredSyncChunk_result{f_GetFilteredSyncChunk_result_success=Nothing,f_GetFilteredSyncChunk_result_userException=Nothing,f_GetFilteredSyncChunk_result_systemException=Nothing})
+  readStructEnd iprot
+  return record
+data GetLinkedNotebookSyncState_args = GetLinkedNotebookSyncState_args{f_GetLinkedNotebookSyncState_args_authenticationToken :: Maybe String,f_GetLinkedNotebookSyncState_args_linkedNotebook :: Maybe Types_Types.LinkedNotebook} deriving (Show,Eq,Ord,Typeable)
+write_GetLinkedNotebookSyncState_args oprot record = do
+  writeStructBegin oprot "GetLinkedNotebookSyncState_args"
+  case f_GetLinkedNotebookSyncState_args_authenticationToken record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("authenticationToken",T_STRING,1)
+    writeString oprot _v
+    writeFieldEnd oprot}
+  case f_GetLinkedNotebookSyncState_args_linkedNotebook record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("linkedNotebook",T_STRUCT,2)
+    Types_Types.write_LinkedNotebook oprot _v
+    writeFieldEnd oprot}
+  writeFieldStop oprot
+  writeStructEnd oprot
+read_GetLinkedNotebookSyncState_args_fields iprot record = do
+  (_,_t251,_id252) <- readFieldBegin iprot
+  if _t251 == T_STOP then return record else
+    case _id252 of 
+      1 -> if _t251 == T_STRING then do
+        s <- readString iprot
+        read_GetLinkedNotebookSyncState_args_fields iprot record{f_GetLinkedNotebookSyncState_args_authenticationToken=Just s}
+        else do
+          skip iprot _t251
+          read_GetLinkedNotebookSyncState_args_fields iprot record
+      2 -> if _t251 == T_STRUCT then do
+        s <- (read_LinkedNotebook iprot)
+        read_GetLinkedNotebookSyncState_args_fields iprot record{f_GetLinkedNotebookSyncState_args_linkedNotebook=Just s}
+        else do
+          skip iprot _t251
+          read_GetLinkedNotebookSyncState_args_fields iprot record
+      _ -> do
+        skip iprot _t251
+        readFieldEnd iprot
+        read_GetLinkedNotebookSyncState_args_fields iprot record
+read_GetLinkedNotebookSyncState_args iprot = do
+  _ <- readStructBegin iprot
+  record <- read_GetLinkedNotebookSyncState_args_fields iprot (GetLinkedNotebookSyncState_args{f_GetLinkedNotebookSyncState_args_authenticationToken=Nothing,f_GetLinkedNotebookSyncState_args_linkedNotebook=Nothing})
+  readStructEnd iprot
+  return record
+data GetLinkedNotebookSyncState_result = GetLinkedNotebookSyncState_result{f_GetLinkedNotebookSyncState_result_success :: Maybe SyncState,f_GetLinkedNotebookSyncState_result_userException :: Maybe Errors_Types.EDAMUserException,f_GetLinkedNotebookSyncState_result_systemException :: Maybe Errors_Types.EDAMSystemException,f_GetLinkedNotebookSyncState_result_notFoundException :: Maybe Errors_Types.EDAMNotFoundException} deriving (Show,Eq,Ord,Typeable)
+write_GetLinkedNotebookSyncState_result oprot record = do
+  writeStructBegin oprot "GetLinkedNotebookSyncState_result"
+  case f_GetLinkedNotebookSyncState_result_success record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("success",T_STRUCT,0)
+    write_SyncState oprot _v
+    writeFieldEnd oprot}
+  case f_GetLinkedNotebookSyncState_result_userException record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("userException",T_STRUCT,1)
+    Errors_Types.write_EDAMUserException oprot _v
+    writeFieldEnd oprot}
+  case f_GetLinkedNotebookSyncState_result_systemException record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("systemException",T_STRUCT,2)
+    Errors_Types.write_EDAMSystemException oprot _v
+    writeFieldEnd oprot}
+  case f_GetLinkedNotebookSyncState_result_notFoundException record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("notFoundException",T_STRUCT,3)
+    Errors_Types.write_EDAMNotFoundException oprot _v
+    writeFieldEnd oprot}
+  writeFieldStop oprot
+  writeStructEnd oprot
+read_GetLinkedNotebookSyncState_result_fields iprot record = do
+  (_,_t256,_id257) <- readFieldBegin iprot
+  if _t256 == T_STOP then return record else
+    case _id257 of 
+      0 -> if _t256 == T_STRUCT then do
+        s <- (read_SyncState iprot)
+        read_GetLinkedNotebookSyncState_result_fields iprot record{f_GetLinkedNotebookSyncState_result_success=Just s}
+        else do
+          skip iprot _t256
+          read_GetLinkedNotebookSyncState_result_fields iprot record
+      1 -> if _t256 == T_STRUCT then do
+        s <- (read_EDAMUserException iprot)
+        read_GetLinkedNotebookSyncState_result_fields iprot record{f_GetLinkedNotebookSyncState_result_userException=Just s}
+        else do
+          skip iprot _t256
+          read_GetLinkedNotebookSyncState_result_fields iprot record
+      2 -> if _t256 == T_STRUCT then do
+        s <- (read_EDAMSystemException iprot)
+        read_GetLinkedNotebookSyncState_result_fields iprot record{f_GetLinkedNotebookSyncState_result_systemException=Just s}
+        else do
+          skip iprot _t256
+          read_GetLinkedNotebookSyncState_result_fields iprot record
+      3 -> if _t256 == T_STRUCT then do
+        s <- (read_EDAMNotFoundException iprot)
+        read_GetLinkedNotebookSyncState_result_fields iprot record{f_GetLinkedNotebookSyncState_result_notFoundException=Just s}
+        else do
+          skip iprot _t256
+          read_GetLinkedNotebookSyncState_result_fields iprot record
+      _ -> do
+        skip iprot _t256
+        readFieldEnd iprot
+        read_GetLinkedNotebookSyncState_result_fields iprot record
+read_GetLinkedNotebookSyncState_result iprot = do
+  _ <- readStructBegin iprot
+  record <- read_GetLinkedNotebookSyncState_result_fields iprot (GetLinkedNotebookSyncState_result{f_GetLinkedNotebookSyncState_result_success=Nothing,f_GetLinkedNotebookSyncState_result_userException=Nothing,f_GetLinkedNotebookSyncState_result_systemException=Nothing,f_GetLinkedNotebookSyncState_result_notFoundException=Nothing})
+  readStructEnd iprot
+  return record
+data GetLinkedNotebookSyncChunk_args = GetLinkedNotebookSyncChunk_args{f_GetLinkedNotebookSyncChunk_args_authenticationToken :: Maybe String,f_GetLinkedNotebookSyncChunk_args_linkedNotebook :: Maybe Types_Types.LinkedNotebook,f_GetLinkedNotebookSyncChunk_args_afterUSN :: Maybe Int32,f_GetLinkedNotebookSyncChunk_args_maxEntries :: Maybe Int32,f_GetLinkedNotebookSyncChunk_args_fullSyncOnly :: Maybe Bool} deriving (Show,Eq,Ord,Typeable)
+write_GetLinkedNotebookSyncChunk_args oprot record = do
+  writeStructBegin oprot "GetLinkedNotebookSyncChunk_args"
+  case f_GetLinkedNotebookSyncChunk_args_authenticationToken record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("authenticationToken",T_STRING,1)
+    writeString oprot _v
+    writeFieldEnd oprot}
+  case f_GetLinkedNotebookSyncChunk_args_linkedNotebook record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("linkedNotebook",T_STRUCT,2)
+    Types_Types.write_LinkedNotebook oprot _v
+    writeFieldEnd oprot}
+  case f_GetLinkedNotebookSyncChunk_args_afterUSN record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("afterUSN",T_I32,3)
+    writeI32 oprot _v
+    writeFieldEnd oprot}
+  case f_GetLinkedNotebookSyncChunk_args_maxEntries record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("maxEntries",T_I32,4)
+    writeI32 oprot _v
+    writeFieldEnd oprot}
+  case f_GetLinkedNotebookSyncChunk_args_fullSyncOnly record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("fullSyncOnly",T_BOOL,5)
+    writeBool oprot _v
+    writeFieldEnd oprot}
+  writeFieldStop oprot
+  writeStructEnd oprot
+read_GetLinkedNotebookSyncChunk_args_fields iprot record = do
+  (_,_t261,_id262) <- readFieldBegin iprot
+  if _t261 == T_STOP then return record else
+    case _id262 of 
+      1 -> if _t261 == T_STRING then do
+        s <- readString iprot
+        read_GetLinkedNotebookSyncChunk_args_fields iprot record{f_GetLinkedNotebookSyncChunk_args_authenticationToken=Just s}
+        else do
+          skip iprot _t261
+          read_GetLinkedNotebookSyncChunk_args_fields iprot record
+      2 -> if _t261 == T_STRUCT then do
+        s <- (read_LinkedNotebook iprot)
+        read_GetLinkedNotebookSyncChunk_args_fields iprot record{f_GetLinkedNotebookSyncChunk_args_linkedNotebook=Just s}
+        else do
+          skip iprot _t261
+          read_GetLinkedNotebookSyncChunk_args_fields iprot record
+      3 -> if _t261 == T_I32 then do
+        s <- readI32 iprot
+        read_GetLinkedNotebookSyncChunk_args_fields iprot record{f_GetLinkedNotebookSyncChunk_args_afterUSN=Just s}
+        else do
+          skip iprot _t261
+          read_GetLinkedNotebookSyncChunk_args_fields iprot record
+      4 -> if _t261 == T_I32 then do
+        s <- readI32 iprot
+        read_GetLinkedNotebookSyncChunk_args_fields iprot record{f_GetLinkedNotebookSyncChunk_args_maxEntries=Just s}
+        else do
+          skip iprot _t261
+          read_GetLinkedNotebookSyncChunk_args_fields iprot record
+      5 -> if _t261 == T_BOOL then do
+        s <- readBool iprot
+        read_GetLinkedNotebookSyncChunk_args_fields iprot record{f_GetLinkedNotebookSyncChunk_args_fullSyncOnly=Just s}
+        else do
+          skip iprot _t261
+          read_GetLinkedNotebookSyncChunk_args_fields iprot record
+      _ -> do
+        skip iprot _t261
+        readFieldEnd iprot
+        read_GetLinkedNotebookSyncChunk_args_fields iprot record
+read_GetLinkedNotebookSyncChunk_args iprot = do
+  _ <- readStructBegin iprot
+  record <- read_GetLinkedNotebookSyncChunk_args_fields iprot (GetLinkedNotebookSyncChunk_args{f_GetLinkedNotebookSyncChunk_args_authenticationToken=Nothing,f_GetLinkedNotebookSyncChunk_args_linkedNotebook=Nothing,f_GetLinkedNotebookSyncChunk_args_afterUSN=Nothing,f_GetLinkedNotebookSyncChunk_args_maxEntries=Nothing,f_GetLinkedNotebookSyncChunk_args_fullSyncOnly=Nothing})
+  readStructEnd iprot
+  return record
+data GetLinkedNotebookSyncChunk_result = GetLinkedNotebookSyncChunk_result{f_GetLinkedNotebookSyncChunk_result_success :: Maybe SyncChunk,f_GetLinkedNotebookSyncChunk_result_userException :: Maybe Errors_Types.EDAMUserException,f_GetLinkedNotebookSyncChunk_result_systemException :: Maybe Errors_Types.EDAMSystemException,f_GetLinkedNotebookSyncChunk_result_notFoundException :: Maybe Errors_Types.EDAMNotFoundException} deriving (Show,Eq,Ord,Typeable)
+write_GetLinkedNotebookSyncChunk_result oprot record = do
+  writeStructBegin oprot "GetLinkedNotebookSyncChunk_result"
+  case f_GetLinkedNotebookSyncChunk_result_success record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("success",T_STRUCT,0)
+    write_SyncChunk oprot _v
+    writeFieldEnd oprot}
+  case f_GetLinkedNotebookSyncChunk_result_userException record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("userException",T_STRUCT,1)
+    Errors_Types.write_EDAMUserException oprot _v
+    writeFieldEnd oprot}
+  case f_GetLinkedNotebookSyncChunk_result_systemException record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("systemException",T_STRUCT,2)
+    Errors_Types.write_EDAMSystemException oprot _v
+    writeFieldEnd oprot}
+  case f_GetLinkedNotebookSyncChunk_result_notFoundException record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("notFoundException",T_STRUCT,3)
+    Errors_Types.write_EDAMNotFoundException oprot _v
+    writeFieldEnd oprot}
+  writeFieldStop oprot
+  writeStructEnd oprot
+read_GetLinkedNotebookSyncChunk_result_fields iprot record = do
+  (_,_t266,_id267) <- readFieldBegin iprot
+  if _t266 == T_STOP then return record else
+    case _id267 of 
+      0 -> if _t266 == T_STRUCT then do
+        s <- (read_SyncChunk iprot)
+        read_GetLinkedNotebookSyncChunk_result_fields iprot record{f_GetLinkedNotebookSyncChunk_result_success=Just s}
+        else do
+          skip iprot _t266
+          read_GetLinkedNotebookSyncChunk_result_fields iprot record
+      1 -> if _t266 == T_STRUCT then do
+        s <- (read_EDAMUserException iprot)
+        read_GetLinkedNotebookSyncChunk_result_fields iprot record{f_GetLinkedNotebookSyncChunk_result_userException=Just s}
+        else do
+          skip iprot _t266
+          read_GetLinkedNotebookSyncChunk_result_fields iprot record
+      2 -> if _t266 == T_STRUCT then do
+        s <- (read_EDAMSystemException iprot)
+        read_GetLinkedNotebookSyncChunk_result_fields iprot record{f_GetLinkedNotebookSyncChunk_result_systemException=Just s}
+        else do
+          skip iprot _t266
+          read_GetLinkedNotebookSyncChunk_result_fields iprot record
+      3 -> if _t266 == T_STRUCT then do
+        s <- (read_EDAMNotFoundException iprot)
+        read_GetLinkedNotebookSyncChunk_result_fields iprot record{f_GetLinkedNotebookSyncChunk_result_notFoundException=Just s}
+        else do
+          skip iprot _t266
+          read_GetLinkedNotebookSyncChunk_result_fields iprot record
+      _ -> do
+        skip iprot _t266
+        readFieldEnd iprot
+        read_GetLinkedNotebookSyncChunk_result_fields iprot record
+read_GetLinkedNotebookSyncChunk_result iprot = do
+  _ <- readStructBegin iprot
+  record <- read_GetLinkedNotebookSyncChunk_result_fields iprot (GetLinkedNotebookSyncChunk_result{f_GetLinkedNotebookSyncChunk_result_success=Nothing,f_GetLinkedNotebookSyncChunk_result_userException=Nothing,f_GetLinkedNotebookSyncChunk_result_systemException=Nothing,f_GetLinkedNotebookSyncChunk_result_notFoundException=Nothing})
+  readStructEnd iprot
+  return record
+data ListNotebooks_args = ListNotebooks_args{f_ListNotebooks_args_authenticationToken :: Maybe String} deriving (Show,Eq,Ord,Typeable)
+write_ListNotebooks_args oprot record = do
+  writeStructBegin oprot "ListNotebooks_args"
+  case f_ListNotebooks_args_authenticationToken record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("authenticationToken",T_STRING,1)
+    writeString oprot _v
+    writeFieldEnd oprot}
+  writeFieldStop oprot
+  writeStructEnd oprot
+read_ListNotebooks_args_fields iprot record = do
+  (_,_t271,_id272) <- readFieldBegin iprot
+  if _t271 == T_STOP then return record else
+    case _id272 of 
+      1 -> if _t271 == T_STRING then do
+        s <- readString iprot
+        read_ListNotebooks_args_fields iprot record{f_ListNotebooks_args_authenticationToken=Just s}
+        else do
+          skip iprot _t271
+          read_ListNotebooks_args_fields iprot record
+      _ -> do
+        skip iprot _t271
+        readFieldEnd iprot
+        read_ListNotebooks_args_fields iprot record
+read_ListNotebooks_args iprot = do
+  _ <- readStructBegin iprot
+  record <- read_ListNotebooks_args_fields iprot (ListNotebooks_args{f_ListNotebooks_args_authenticationToken=Nothing})
+  readStructEnd iprot
+  return record
+data ListNotebooks_result = ListNotebooks_result{f_ListNotebooks_result_success :: Maybe [Types_Types.Notebook],f_ListNotebooks_result_userException :: Maybe Errors_Types.EDAMUserException,f_ListNotebooks_result_systemException :: Maybe Errors_Types.EDAMSystemException} deriving (Show,Eq,Ord,Typeable)
+write_ListNotebooks_result oprot record = do
+  writeStructBegin oprot "ListNotebooks_result"
+  case f_ListNotebooks_result_success record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("success",T_LIST,0)
+    (let {f [] = return (); f (_viter275:t) = do {Types_Types.write_Notebook oprot _viter275;f t}} in do {writeListBegin oprot (T_STRUCT,fromIntegral $ Prelude.length _v); f _v;writeListEnd oprot})
+    writeFieldEnd oprot}
+  case f_ListNotebooks_result_userException record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("userException",T_STRUCT,1)
+    Errors_Types.write_EDAMUserException oprot _v
+    writeFieldEnd oprot}
+  case f_ListNotebooks_result_systemException record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("systemException",T_STRUCT,2)
+    Errors_Types.write_EDAMSystemException oprot _v
+    writeFieldEnd oprot}
+  writeFieldStop oprot
+  writeStructEnd oprot
+read_ListNotebooks_result_fields iprot record = do
+  (_,_t277,_id278) <- readFieldBegin iprot
+  if _t277 == T_STOP then return record else
+    case _id278 of 
+      0 -> if _t277 == T_LIST then do
+        s <- (let {f 0 = return []; f n = do {v <- (read_Notebook iprot);r <- f (n-1); return $ v:r}} in do {(_etype282,_size279) <- readListBegin iprot; f _size279})
+        read_ListNotebooks_result_fields iprot record{f_ListNotebooks_result_success=Just s}
+        else do
+          skip iprot _t277
+          read_ListNotebooks_result_fields iprot record
+      1 -> if _t277 == T_STRUCT then do
+        s <- (read_EDAMUserException iprot)
+        read_ListNotebooks_result_fields iprot record{f_ListNotebooks_result_userException=Just s}
+        else do
+          skip iprot _t277
+          read_ListNotebooks_result_fields iprot record
+      2 -> if _t277 == T_STRUCT then do
+        s <- (read_EDAMSystemException iprot)
+        read_ListNotebooks_result_fields iprot record{f_ListNotebooks_result_systemException=Just s}
+        else do
+          skip iprot _t277
+          read_ListNotebooks_result_fields iprot record
+      _ -> do
+        skip iprot _t277
+        readFieldEnd iprot
+        read_ListNotebooks_result_fields iprot record
+read_ListNotebooks_result iprot = do
+  _ <- readStructBegin iprot
+  record <- read_ListNotebooks_result_fields iprot (ListNotebooks_result{f_ListNotebooks_result_success=Nothing,f_ListNotebooks_result_userException=Nothing,f_ListNotebooks_result_systemException=Nothing})
+  readStructEnd iprot
+  return record
+data GetNotebook_args = GetNotebook_args{f_GetNotebook_args_authenticationToken :: Maybe String,f_GetNotebook_args_guid :: Maybe String} deriving (Show,Eq,Ord,Typeable)
+write_GetNotebook_args oprot record = do
+  writeStructBegin oprot "GetNotebook_args"
+  case f_GetNotebook_args_authenticationToken record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("authenticationToken",T_STRING,1)
+    writeString oprot _v
+    writeFieldEnd oprot}
+  case f_GetNotebook_args_guid record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("guid",T_STRING,2)
+    writeString oprot _v
+    writeFieldEnd oprot}
+  writeFieldStop oprot
+  writeStructEnd oprot
+read_GetNotebook_args_fields iprot record = do
+  (_,_t287,_id288) <- readFieldBegin iprot
+  if _t287 == T_STOP then return record else
+    case _id288 of 
+      1 -> if _t287 == T_STRING then do
+        s <- readString iprot
+        read_GetNotebook_args_fields iprot record{f_GetNotebook_args_authenticationToken=Just s}
+        else do
+          skip iprot _t287
+          read_GetNotebook_args_fields iprot record
+      2 -> if _t287 == T_STRING then do
+        s <- readString iprot
+        read_GetNotebook_args_fields iprot record{f_GetNotebook_args_guid=Just s}
+        else do
+          skip iprot _t287
+          read_GetNotebook_args_fields iprot record
+      _ -> do
+        skip iprot _t287
+        readFieldEnd iprot
+        read_GetNotebook_args_fields iprot record
+read_GetNotebook_args iprot = do
+  _ <- readStructBegin iprot
+  record <- read_GetNotebook_args_fields iprot (GetNotebook_args{f_GetNotebook_args_authenticationToken=Nothing,f_GetNotebook_args_guid=Nothing})
+  readStructEnd iprot
+  return record
+data GetNotebook_result = GetNotebook_result{f_GetNotebook_result_success :: Maybe Types_Types.Notebook,f_GetNotebook_result_userException :: Maybe Errors_Types.EDAMUserException,f_GetNotebook_result_systemException :: Maybe Errors_Types.EDAMSystemException,f_GetNotebook_result_notFoundException :: Maybe Errors_Types.EDAMNotFoundException} deriving (Show,Eq,Ord,Typeable)
+write_GetNotebook_result oprot record = do
+  writeStructBegin oprot "GetNotebook_result"
+  case f_GetNotebook_result_success record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("success",T_STRUCT,0)
+    Types_Types.write_Notebook oprot _v
+    writeFieldEnd oprot}
+  case f_GetNotebook_result_userException record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("userException",T_STRUCT,1)
+    Errors_Types.write_EDAMUserException oprot _v
+    writeFieldEnd oprot}
+  case f_GetNotebook_result_systemException record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("systemException",T_STRUCT,2)
+    Errors_Types.write_EDAMSystemException oprot _v
+    writeFieldEnd oprot}
+  case f_GetNotebook_result_notFoundException record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("notFoundException",T_STRUCT,3)
+    Errors_Types.write_EDAMNotFoundException oprot _v
+    writeFieldEnd oprot}
+  writeFieldStop oprot
+  writeStructEnd oprot
+read_GetNotebook_result_fields iprot record = do
+  (_,_t292,_id293) <- readFieldBegin iprot
+  if _t292 == T_STOP then return record else
+    case _id293 of 
+      0 -> if _t292 == T_STRUCT then do
+        s <- (read_Notebook iprot)
+        read_GetNotebook_result_fields iprot record{f_GetNotebook_result_success=Just s}
+        else do
+          skip iprot _t292
+          read_GetNotebook_result_fields iprot record
+      1 -> if _t292 == T_STRUCT then do
+        s <- (read_EDAMUserException iprot)
+        read_GetNotebook_result_fields iprot record{f_GetNotebook_result_userException=Just s}
+        else do
+          skip iprot _t292
+          read_GetNotebook_result_fields iprot record
+      2 -> if _t292 == T_STRUCT then do
+        s <- (read_EDAMSystemException iprot)
+        read_GetNotebook_result_fields iprot record{f_GetNotebook_result_systemException=Just s}
+        else do
+          skip iprot _t292
+          read_GetNotebook_result_fields iprot record
+      3 -> if _t292 == T_STRUCT then do
+        s <- (read_EDAMNotFoundException iprot)
+        read_GetNotebook_result_fields iprot record{f_GetNotebook_result_notFoundException=Just s}
+        else do
+          skip iprot _t292
+          read_GetNotebook_result_fields iprot record
+      _ -> do
+        skip iprot _t292
+        readFieldEnd iprot
+        read_GetNotebook_result_fields iprot record
+read_GetNotebook_result iprot = do
+  _ <- readStructBegin iprot
+  record <- read_GetNotebook_result_fields iprot (GetNotebook_result{f_GetNotebook_result_success=Nothing,f_GetNotebook_result_userException=Nothing,f_GetNotebook_result_systemException=Nothing,f_GetNotebook_result_notFoundException=Nothing})
+  readStructEnd iprot
+  return record
+data GetDefaultNotebook_args = GetDefaultNotebook_args{f_GetDefaultNotebook_args_authenticationToken :: Maybe String} deriving (Show,Eq,Ord,Typeable)
+write_GetDefaultNotebook_args oprot record = do
+  writeStructBegin oprot "GetDefaultNotebook_args"
+  case f_GetDefaultNotebook_args_authenticationToken record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("authenticationToken",T_STRING,1)
+    writeString oprot _v
+    writeFieldEnd oprot}
+  writeFieldStop oprot
+  writeStructEnd oprot
+read_GetDefaultNotebook_args_fields iprot record = do
+  (_,_t297,_id298) <- readFieldBegin iprot
+  if _t297 == T_STOP then return record else
+    case _id298 of 
+      1 -> if _t297 == T_STRING then do
+        s <- readString iprot
+        read_GetDefaultNotebook_args_fields iprot record{f_GetDefaultNotebook_args_authenticationToken=Just s}
+        else do
+          skip iprot _t297
+          read_GetDefaultNotebook_args_fields iprot record
+      _ -> do
+        skip iprot _t297
+        readFieldEnd iprot
+        read_GetDefaultNotebook_args_fields iprot record
+read_GetDefaultNotebook_args iprot = do
+  _ <- readStructBegin iprot
+  record <- read_GetDefaultNotebook_args_fields iprot (GetDefaultNotebook_args{f_GetDefaultNotebook_args_authenticationToken=Nothing})
+  readStructEnd iprot
+  return record
+data GetDefaultNotebook_result = GetDefaultNotebook_result{f_GetDefaultNotebook_result_success :: Maybe Types_Types.Notebook,f_GetDefaultNotebook_result_userException :: Maybe Errors_Types.EDAMUserException,f_GetDefaultNotebook_result_systemException :: Maybe Errors_Types.EDAMSystemException} deriving (Show,Eq,Ord,Typeable)
+write_GetDefaultNotebook_result oprot record = do
+  writeStructBegin oprot "GetDefaultNotebook_result"
+  case f_GetDefaultNotebook_result_success record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("success",T_STRUCT,0)
+    Types_Types.write_Notebook oprot _v
+    writeFieldEnd oprot}
+  case f_GetDefaultNotebook_result_userException record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("userException",T_STRUCT,1)
+    Errors_Types.write_EDAMUserException oprot _v
+    writeFieldEnd oprot}
+  case f_GetDefaultNotebook_result_systemException record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("systemException",T_STRUCT,2)
+    Errors_Types.write_EDAMSystemException oprot _v
+    writeFieldEnd oprot}
+  writeFieldStop oprot
+  writeStructEnd oprot
+read_GetDefaultNotebook_result_fields iprot record = do
+  (_,_t302,_id303) <- readFieldBegin iprot
+  if _t302 == T_STOP then return record else
+    case _id303 of 
+      0 -> if _t302 == T_STRUCT then do
+        s <- (read_Notebook iprot)
+        read_GetDefaultNotebook_result_fields iprot record{f_GetDefaultNotebook_result_success=Just s}
+        else do
+          skip iprot _t302
+          read_GetDefaultNotebook_result_fields iprot record
+      1 -> if _t302 == T_STRUCT then do
+        s <- (read_EDAMUserException iprot)
+        read_GetDefaultNotebook_result_fields iprot record{f_GetDefaultNotebook_result_userException=Just s}
+        else do
+          skip iprot _t302
+          read_GetDefaultNotebook_result_fields iprot record
+      2 -> if _t302 == T_STRUCT then do
+        s <- (read_EDAMSystemException iprot)
+        read_GetDefaultNotebook_result_fields iprot record{f_GetDefaultNotebook_result_systemException=Just s}
+        else do
+          skip iprot _t302
+          read_GetDefaultNotebook_result_fields iprot record
+      _ -> do
+        skip iprot _t302
+        readFieldEnd iprot
+        read_GetDefaultNotebook_result_fields iprot record
+read_GetDefaultNotebook_result iprot = do
+  _ <- readStructBegin iprot
+  record <- read_GetDefaultNotebook_result_fields iprot (GetDefaultNotebook_result{f_GetDefaultNotebook_result_success=Nothing,f_GetDefaultNotebook_result_userException=Nothing,f_GetDefaultNotebook_result_systemException=Nothing})
+  readStructEnd iprot
+  return record
+data CreateNotebook_args = CreateNotebook_args{f_CreateNotebook_args_authenticationToken :: Maybe String,f_CreateNotebook_args_notebook :: Maybe Types_Types.Notebook} deriving (Show,Eq,Ord,Typeable)
+write_CreateNotebook_args oprot record = do
+  writeStructBegin oprot "CreateNotebook_args"
+  case f_CreateNotebook_args_authenticationToken record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("authenticationToken",T_STRING,1)
+    writeString oprot _v
+    writeFieldEnd oprot}
+  case f_CreateNotebook_args_notebook record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("notebook",T_STRUCT,2)
+    Types_Types.write_Notebook oprot _v
+    writeFieldEnd oprot}
+  writeFieldStop oprot
+  writeStructEnd oprot
+read_CreateNotebook_args_fields iprot record = do
+  (_,_t307,_id308) <- readFieldBegin iprot
+  if _t307 == T_STOP then return record else
+    case _id308 of 
+      1 -> if _t307 == T_STRING then do
+        s <- readString iprot
+        read_CreateNotebook_args_fields iprot record{f_CreateNotebook_args_authenticationToken=Just s}
+        else do
+          skip iprot _t307
+          read_CreateNotebook_args_fields iprot record
+      2 -> if _t307 == T_STRUCT then do
+        s <- (read_Notebook iprot)
+        read_CreateNotebook_args_fields iprot record{f_CreateNotebook_args_notebook=Just s}
+        else do
+          skip iprot _t307
+          read_CreateNotebook_args_fields iprot record
+      _ -> do
+        skip iprot _t307
+        readFieldEnd iprot
+        read_CreateNotebook_args_fields iprot record
+read_CreateNotebook_args iprot = do
+  _ <- readStructBegin iprot
+  record <- read_CreateNotebook_args_fields iprot (CreateNotebook_args{f_CreateNotebook_args_authenticationToken=Nothing,f_CreateNotebook_args_notebook=Nothing})
+  readStructEnd iprot
+  return record
+data CreateNotebook_result = CreateNotebook_result{f_CreateNotebook_result_success :: Maybe Types_Types.Notebook,f_CreateNotebook_result_userException :: Maybe Errors_Types.EDAMUserException,f_CreateNotebook_result_systemException :: Maybe Errors_Types.EDAMSystemException} deriving (Show,Eq,Ord,Typeable)
+write_CreateNotebook_result oprot record = do
+  writeStructBegin oprot "CreateNotebook_result"
+  case f_CreateNotebook_result_success record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("success",T_STRUCT,0)
+    Types_Types.write_Notebook oprot _v
+    writeFieldEnd oprot}
+  case f_CreateNotebook_result_userException record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("userException",T_STRUCT,1)
+    Errors_Types.write_EDAMUserException oprot _v
+    writeFieldEnd oprot}
+  case f_CreateNotebook_result_systemException record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("systemException",T_STRUCT,2)
+    Errors_Types.write_EDAMSystemException oprot _v
+    writeFieldEnd oprot}
+  writeFieldStop oprot
+  writeStructEnd oprot
+read_CreateNotebook_result_fields iprot record = do
+  (_,_t312,_id313) <- readFieldBegin iprot
+  if _t312 == T_STOP then return record else
+    case _id313 of 
+      0 -> if _t312 == T_STRUCT then do
+        s <- (read_Notebook iprot)
+        read_CreateNotebook_result_fields iprot record{f_CreateNotebook_result_success=Just s}
+        else do
+          skip iprot _t312
+          read_CreateNotebook_result_fields iprot record
+      1 -> if _t312 == T_STRUCT then do
+        s <- (read_EDAMUserException iprot)
+        read_CreateNotebook_result_fields iprot record{f_CreateNotebook_result_userException=Just s}
+        else do
+          skip iprot _t312
+          read_CreateNotebook_result_fields iprot record
+      2 -> if _t312 == T_STRUCT then do
+        s <- (read_EDAMSystemException iprot)
+        read_CreateNotebook_result_fields iprot record{f_CreateNotebook_result_systemException=Just s}
+        else do
+          skip iprot _t312
+          read_CreateNotebook_result_fields iprot record
+      _ -> do
+        skip iprot _t312
+        readFieldEnd iprot
+        read_CreateNotebook_result_fields iprot record
+read_CreateNotebook_result iprot = do
+  _ <- readStructBegin iprot
+  record <- read_CreateNotebook_result_fields iprot (CreateNotebook_result{f_CreateNotebook_result_success=Nothing,f_CreateNotebook_result_userException=Nothing,f_CreateNotebook_result_systemException=Nothing})
+  readStructEnd iprot
+  return record
+data UpdateNotebook_args = UpdateNotebook_args{f_UpdateNotebook_args_authenticationToken :: Maybe String,f_UpdateNotebook_args_notebook :: Maybe Types_Types.Notebook} deriving (Show,Eq,Ord,Typeable)
+write_UpdateNotebook_args oprot record = do
+  writeStructBegin oprot "UpdateNotebook_args"
+  case f_UpdateNotebook_args_authenticationToken record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("authenticationToken",T_STRING,1)
+    writeString oprot _v
+    writeFieldEnd oprot}
+  case f_UpdateNotebook_args_notebook record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("notebook",T_STRUCT,2)
+    Types_Types.write_Notebook oprot _v
+    writeFieldEnd oprot}
+  writeFieldStop oprot
+  writeStructEnd oprot
+read_UpdateNotebook_args_fields iprot record = do
+  (_,_t317,_id318) <- readFieldBegin iprot
+  if _t317 == T_STOP then return record else
+    case _id318 of 
+      1 -> if _t317 == T_STRING then do
+        s <- readString iprot
+        read_UpdateNotebook_args_fields iprot record{f_UpdateNotebook_args_authenticationToken=Just s}
+        else do
+          skip iprot _t317
+          read_UpdateNotebook_args_fields iprot record
+      2 -> if _t317 == T_STRUCT then do
+        s <- (read_Notebook iprot)
+        read_UpdateNotebook_args_fields iprot record{f_UpdateNotebook_args_notebook=Just s}
+        else do
+          skip iprot _t317
+          read_UpdateNotebook_args_fields iprot record
+      _ -> do
+        skip iprot _t317
+        readFieldEnd iprot
+        read_UpdateNotebook_args_fields iprot record
+read_UpdateNotebook_args iprot = do
+  _ <- readStructBegin iprot
+  record <- read_UpdateNotebook_args_fields iprot (UpdateNotebook_args{f_UpdateNotebook_args_authenticationToken=Nothing,f_UpdateNotebook_args_notebook=Nothing})
+  readStructEnd iprot
+  return record
+data UpdateNotebook_result = UpdateNotebook_result{f_UpdateNotebook_result_success :: Maybe Int32,f_UpdateNotebook_result_userException :: Maybe Errors_Types.EDAMUserException,f_UpdateNotebook_result_systemException :: Maybe Errors_Types.EDAMSystemException,f_UpdateNotebook_result_notFoundException :: Maybe Errors_Types.EDAMNotFoundException} deriving (Show,Eq,Ord,Typeable)
+write_UpdateNotebook_result oprot record = do
+  writeStructBegin oprot "UpdateNotebook_result"
+  case f_UpdateNotebook_result_success record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("success",T_I32,0)
+    writeI32 oprot _v
+    writeFieldEnd oprot}
+  case f_UpdateNotebook_result_userException record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("userException",T_STRUCT,1)
+    Errors_Types.write_EDAMUserException oprot _v
+    writeFieldEnd oprot}
+  case f_UpdateNotebook_result_systemException record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("systemException",T_STRUCT,2)
+    Errors_Types.write_EDAMSystemException oprot _v
+    writeFieldEnd oprot}
+  case f_UpdateNotebook_result_notFoundException record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("notFoundException",T_STRUCT,3)
+    Errors_Types.write_EDAMNotFoundException oprot _v
+    writeFieldEnd oprot}
+  writeFieldStop oprot
+  writeStructEnd oprot
+read_UpdateNotebook_result_fields iprot record = do
+  (_,_t322,_id323) <- readFieldBegin iprot
+  if _t322 == T_STOP then return record else
+    case _id323 of 
+      0 -> if _t322 == T_I32 then do
+        s <- readI32 iprot
+        read_UpdateNotebook_result_fields iprot record{f_UpdateNotebook_result_success=Just s}
+        else do
+          skip iprot _t322
+          read_UpdateNotebook_result_fields iprot record
+      1 -> if _t322 == T_STRUCT then do
+        s <- (read_EDAMUserException iprot)
+        read_UpdateNotebook_result_fields iprot record{f_UpdateNotebook_result_userException=Just s}
+        else do
+          skip iprot _t322
+          read_UpdateNotebook_result_fields iprot record
+      2 -> if _t322 == T_STRUCT then do
+        s <- (read_EDAMSystemException iprot)
+        read_UpdateNotebook_result_fields iprot record{f_UpdateNotebook_result_systemException=Just s}
+        else do
+          skip iprot _t322
+          read_UpdateNotebook_result_fields iprot record
+      3 -> if _t322 == T_STRUCT then do
+        s <- (read_EDAMNotFoundException iprot)
+        read_UpdateNotebook_result_fields iprot record{f_UpdateNotebook_result_notFoundException=Just s}
+        else do
+          skip iprot _t322
+          read_UpdateNotebook_result_fields iprot record
+      _ -> do
+        skip iprot _t322
+        readFieldEnd iprot
+        read_UpdateNotebook_result_fields iprot record
+read_UpdateNotebook_result iprot = do
+  _ <- readStructBegin iprot
+  record <- read_UpdateNotebook_result_fields iprot (UpdateNotebook_result{f_UpdateNotebook_result_success=Nothing,f_UpdateNotebook_result_userException=Nothing,f_UpdateNotebook_result_systemException=Nothing,f_UpdateNotebook_result_notFoundException=Nothing})
+  readStructEnd iprot
+  return record
+data ExpungeNotebook_args = ExpungeNotebook_args{f_ExpungeNotebook_args_authenticationToken :: Maybe String,f_ExpungeNotebook_args_guid :: Maybe String} deriving (Show,Eq,Ord,Typeable)
+write_ExpungeNotebook_args oprot record = do
+  writeStructBegin oprot "ExpungeNotebook_args"
+  case f_ExpungeNotebook_args_authenticationToken record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("authenticationToken",T_STRING,1)
+    writeString oprot _v
+    writeFieldEnd oprot}
+  case f_ExpungeNotebook_args_guid record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("guid",T_STRING,2)
+    writeString oprot _v
+    writeFieldEnd oprot}
+  writeFieldStop oprot
+  writeStructEnd oprot
+read_ExpungeNotebook_args_fields iprot record = do
+  (_,_t327,_id328) <- readFieldBegin iprot
+  if _t327 == T_STOP then return record else
+    case _id328 of 
+      1 -> if _t327 == T_STRING then do
+        s <- readString iprot
+        read_ExpungeNotebook_args_fields iprot record{f_ExpungeNotebook_args_authenticationToken=Just s}
+        else do
+          skip iprot _t327
+          read_ExpungeNotebook_args_fields iprot record
+      2 -> if _t327 == T_STRING then do
+        s <- readString iprot
+        read_ExpungeNotebook_args_fields iprot record{f_ExpungeNotebook_args_guid=Just s}
+        else do
+          skip iprot _t327
+          read_ExpungeNotebook_args_fields iprot record
+      _ -> do
+        skip iprot _t327
+        readFieldEnd iprot
+        read_ExpungeNotebook_args_fields iprot record
+read_ExpungeNotebook_args iprot = do
+  _ <- readStructBegin iprot
+  record <- read_ExpungeNotebook_args_fields iprot (ExpungeNotebook_args{f_ExpungeNotebook_args_authenticationToken=Nothing,f_ExpungeNotebook_args_guid=Nothing})
+  readStructEnd iprot
+  return record
+data ExpungeNotebook_result = ExpungeNotebook_result{f_ExpungeNotebook_result_success :: Maybe Int32,f_ExpungeNotebook_result_userException :: Maybe Errors_Types.EDAMUserException,f_ExpungeNotebook_result_systemException :: Maybe Errors_Types.EDAMSystemException,f_ExpungeNotebook_result_notFoundException :: Maybe Errors_Types.EDAMNotFoundException} deriving (Show,Eq,Ord,Typeable)
+write_ExpungeNotebook_result oprot record = do
+  writeStructBegin oprot "ExpungeNotebook_result"
+  case f_ExpungeNotebook_result_success record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("success",T_I32,0)
+    writeI32 oprot _v
+    writeFieldEnd oprot}
+  case f_ExpungeNotebook_result_userException record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("userException",T_STRUCT,1)
+    Errors_Types.write_EDAMUserException oprot _v
+    writeFieldEnd oprot}
+  case f_ExpungeNotebook_result_systemException record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("systemException",T_STRUCT,2)
+    Errors_Types.write_EDAMSystemException oprot _v
+    writeFieldEnd oprot}
+  case f_ExpungeNotebook_result_notFoundException record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("notFoundException",T_STRUCT,3)
+    Errors_Types.write_EDAMNotFoundException oprot _v
+    writeFieldEnd oprot}
+  writeFieldStop oprot
+  writeStructEnd oprot
+read_ExpungeNotebook_result_fields iprot record = do
+  (_,_t332,_id333) <- readFieldBegin iprot
+  if _t332 == T_STOP then return record else
+    case _id333 of 
+      0 -> if _t332 == T_I32 then do
+        s <- readI32 iprot
+        read_ExpungeNotebook_result_fields iprot record{f_ExpungeNotebook_result_success=Just s}
+        else do
+          skip iprot _t332
+          read_ExpungeNotebook_result_fields iprot record
+      1 -> if _t332 == T_STRUCT then do
+        s <- (read_EDAMUserException iprot)
+        read_ExpungeNotebook_result_fields iprot record{f_ExpungeNotebook_result_userException=Just s}
+        else do
+          skip iprot _t332
+          read_ExpungeNotebook_result_fields iprot record
+      2 -> if _t332 == T_STRUCT then do
+        s <- (read_EDAMSystemException iprot)
+        read_ExpungeNotebook_result_fields iprot record{f_ExpungeNotebook_result_systemException=Just s}
+        else do
+          skip iprot _t332
+          read_ExpungeNotebook_result_fields iprot record
+      3 -> if _t332 == T_STRUCT then do
+        s <- (read_EDAMNotFoundException iprot)
+        read_ExpungeNotebook_result_fields iprot record{f_ExpungeNotebook_result_notFoundException=Just s}
+        else do
+          skip iprot _t332
+          read_ExpungeNotebook_result_fields iprot record
+      _ -> do
+        skip iprot _t332
+        readFieldEnd iprot
+        read_ExpungeNotebook_result_fields iprot record
+read_ExpungeNotebook_result iprot = do
+  _ <- readStructBegin iprot
+  record <- read_ExpungeNotebook_result_fields iprot (ExpungeNotebook_result{f_ExpungeNotebook_result_success=Nothing,f_ExpungeNotebook_result_userException=Nothing,f_ExpungeNotebook_result_systemException=Nothing,f_ExpungeNotebook_result_notFoundException=Nothing})
+  readStructEnd iprot
+  return record
+data ListTags_args = ListTags_args{f_ListTags_args_authenticationToken :: Maybe String} deriving (Show,Eq,Ord,Typeable)
+write_ListTags_args oprot record = do
+  writeStructBegin oprot "ListTags_args"
+  case f_ListTags_args_authenticationToken record of {Nothing -> return (); Just _v -> do
+    writeFieldBegin oprot ("authenticationToken",T_STRING,1)
+    writeString oprot _v
+    writeFieldEnd oprot}
+  writeFieldStop oprot
+  writeStructEnd oprot
+read_ListTags_args_fields iprot record = do
+  (_,_t337,_id338) <- readFieldBegin iprot
+  if _t337 == T_STOP then return record else
+    case _id338 of 
+      1 -> if _t337 == T_STRING then do
+        s <- readString iprot
+        read_ListTags_args_fields iprot record{f_ListTags_args_authenticationToken=Just s}
+        else do
+          skip iprot _t337
+          read_ListTags_args_fields iprot record
+      _ -> do
+        skip iprot _t337