#
# Autogenerated by Thrift Compiler (0.5.0-en-exported)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#

require 'thrift'

module Evernote
  module EDAM
    module Error
      module EDAMErrorCode
        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
        LEN_TOO_SHORT = 13
        LEN_TOO_LONG = 14
        TOO_FEW = 15
        TOO_MANY = 16
        UNSUPPORTED_OPERATION = 17
        TAKEN_DOWN = 18
        RATE_LIMIT_REACHED = 19
        VALUE_MAP = {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", 13 => "LEN_TOO_SHORT", 14 => "LEN_TOO_LONG", 15 => "TOO_FEW", 16 => "TOO_MANY", 17 => "UNSUPPORTED_OPERATION", 18 => "TAKEN_DOWN", 19 => "RATE_LIMIT_REACHED"}
        VALID_VALUES = Set.new([UNKNOWN, BAD_DATA_FORMAT, PERMISSION_DENIED, INTERNAL_ERROR, DATA_REQUIRED, LIMIT_REACHED, QUOTA_REACHED, INVALID_AUTH, AUTH_EXPIRED, DATA_CONFLICT, ENML_VALIDATION, SHARD_UNAVAILABLE, LEN_TOO_SHORT, LEN_TOO_LONG, TOO_FEW, TOO_MANY, UNSUPPORTED_OPERATION, TAKEN_DOWN, RATE_LIMIT_REACHED]).freeze
      end

      # This exception is thrown by EDAM procedures when a call fails as a result of
# a problem that a caller may be able to resolve.  For example, if the user
# attempts to add a note to their account which would exceed their storage
# quota, this type of exception may be thrown to indicate the source of the
# error so that they can choose an alternate action.
# 
# This exception would not be used for internal system errors that do not
# reflect user actions, but rather reflect a problem within the service that
# the user cannot resolve.
# 
# errorCode:  The numeric code indicating the type of error that occurred.
#   must be one of the values of EDAMErrorCode.
# 
# parameter:  If the error applied to a particular input parameter, this will
#   indicate which parameter.
      class EDAMUserException < ::Thrift::Exception
        include ::Thrift::Struct, ::Thrift::Struct_Union
        ERRORCODE = 1
        PARAMETER = 2

        FIELDS = {
          ERRORCODE => {:type => ::Thrift::Types::I32, :name => 'errorCode', :enum_class => ::Evernote::EDAM::Error::EDAMErrorCode},
          PARAMETER => {:type => ::Thrift::Types::STRING, :name => 'parameter', :optional => true}
        }

        def struct_fields; FIELDS; end

        def validate
          raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field errorCode is unset!') unless @errorCode
          unless @errorCode.nil? || ::Evernote::EDAM::Error::EDAMErrorCode::VALID_VALUES.include?(@errorCode)
            raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field errorCode!')
          end
        end

        ::Thrift::Struct.generate_accessors self
      end

      # This exception is thrown by EDAM procedures when a call fails as a result of
# a problem in the service that could not be changed through caller action.
# 
# errorCode:  The numeric code indicating the type of error that occurred.
#   must be one of the values of EDAMErrorCode.
# 
# message:  This may contain additional information about the error
# 
# rateLimitDuration:  Indicates the minimum number of seconds that an application should
#   expect subsequent API calls for this user to fail. The application should not retry
#   API requests for the user until at least this many seconds have passed. Present only
#   when errorCode is RATE_LIMIT_REACHED,
      class EDAMSystemException < ::Thrift::Exception
        include ::Thrift::Struct, ::Thrift::Struct_Union
        ERRORCODE = 1
        MESSAGE = 2
        RATELIMITDURATION = 3

        FIELDS = {
          ERRORCODE => {:type => ::Thrift::Types::I32, :name => 'errorCode', :enum_class => ::Evernote::EDAM::Error::EDAMErrorCode},
          MESSAGE => {:type => ::Thrift::Types::STRING, :name => 'message', :optional => true},
          RATELIMITDURATION => {:type => ::Thrift::Types::I32, :name => 'rateLimitDuration', :optional => true}
        }

        def struct_fields; FIELDS; end

        def validate
          raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field errorCode is unset!') unless @errorCode
          unless @errorCode.nil? || ::Evernote::EDAM::Error::EDAMErrorCode::VALID_VALUES.include?(@errorCode)
            raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field errorCode!')
          end
        end

        ::Thrift::Struct.generate_accessors self
      end

      # This exception is thrown by EDAM procedures when a caller asks to perform
# an operation on an object that does not exist.  This may be thrown based on an invalid
# primary identifier (e.g. a bad GUID), or when the caller refers to an object
# by another unique identifier (e.g. a User's email address).
# 
# identifier:  A description of the object that was not found on the server.
#   For example, "Note.notebookGuid" when a caller attempts to create a note in a
#   notebook that does not exist in the user's account.
# 
# key:  The value passed from the client in the identifier, which was not
#   found. For example, the GUID that was not found.
      class EDAMNotFoundException < ::Thrift::Exception
        include ::Thrift::Struct, ::Thrift::Struct_Union
        IDENTIFIER = 1
        KEY = 2

        FIELDS = {
          IDENTIFIER => {:type => ::Thrift::Types::STRING, :name => 'identifier', :optional => true},
          KEY => {:type => ::Thrift::Types::STRING, :name => 'key', :optional => true}
        }

        def struct_fields; FIELDS; end

        def validate
        end

        ::Thrift::Struct.generate_accessors self
      end

    end
  end
end
