diff options
64 files changed, 2 insertions, 16070 deletions
diff --git a/evernote.gemspec b/evernote.gemspec index 288feae..e6ec144 100644 --- a/evernote.gemspec +++ b/evernote.gemspec @@ -22,6 +22,8 @@ Gem::Specification.new do |s| s.add_development_dependency "rspec" s.add_development_dependency "yard" + s.add_dependency "thrift_client", ">= 0.9.1" + s.extensions = ['ext/extconf.rb'] s.files = Dir.glob("{lib,spec,vendor}/**/*") + Dir.glob('ext/**/*.{c,h,rb}') + diff --git a/ext/binary_protocol_accelerated.c b/ext/binary_protocol_accelerated.c deleted file mode 100644 index bd1c2da..0000000 --- a/ext/binary_protocol_accelerated.c +++ /dev/null @@ -1,441 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#include <ruby.h> -#include <stdbool.h> -#include <stdint.h> -#include <constants.h> -#include <struct.h> -#include "macros.h" - -VALUE rb_thrift_binary_proto_native_qmark(VALUE self) { - return Qtrue; -} - - - -static int VERSION_1; -static int VERSION_MASK; -static int TYPE_MASK; -static int BAD_VERSION; -static ID rbuf_ivar_id; - -static void write_byte_direct(VALUE trans, int8_t b) { - WRITE(trans, (char*)&b, 1); -} - -static void write_i16_direct(VALUE trans, int16_t value) { - char data[2]; - - data[1] = value; - data[0] = (value >> 8); - - WRITE(trans, data, 2); -} - -static void write_i32_direct(VALUE trans, int32_t value) { - char data[4]; - - data[3] = value; - data[2] = (value >> 8); - data[1] = (value >> 16); - data[0] = (value >> 24); - - WRITE(trans, data, 4); -} - - -static void write_i64_direct(VALUE trans, int64_t value) { - char data[8]; - - data[7] = value; - data[6] = (value >> 8); - data[5] = (value >> 16); - data[4] = (value >> 24); - data[3] = (value >> 32); - data[2] = (value >> 40); - data[1] = (value >> 48); - data[0] = (value >> 56); - - WRITE(trans, data, 8); -} - -static void write_string_direct(VALUE trans, VALUE str) { - if (TYPE(str) != T_STRING) { - rb_raise(rb_eStandardError, "Value should be a string"); - } - write_i32_direct(trans, RSTRING_LEN(str)); - rb_funcall(trans, write_method_id, 1, str); -} - -//-------------------------------- -// interface writing methods -//-------------------------------- - -VALUE rb_thrift_binary_proto_write_message_end(VALUE self) { - return Qnil; -} - -VALUE rb_thrift_binary_proto_write_struct_begin(VALUE self, VALUE name) { - return Qnil; -} - -VALUE rb_thrift_binary_proto_write_struct_end(VALUE self) { - return Qnil; -} - -VALUE rb_thrift_binary_proto_write_field_end(VALUE self) { - return Qnil; -} - -VALUE rb_thrift_binary_proto_write_map_end(VALUE self) { - return Qnil; -} - -VALUE rb_thrift_binary_proto_write_list_end(VALUE self) { - return Qnil; -} - -VALUE rb_thrift_binary_proto_write_set_end(VALUE self) { - return Qnil; -} - -VALUE rb_thrift_binary_proto_write_message_begin(VALUE self, VALUE name, VALUE type, VALUE seqid) { - VALUE trans = GET_TRANSPORT(self); - VALUE strict_write = GET_STRICT_WRITE(self); - - if (strict_write == Qtrue) { - write_i32_direct(trans, VERSION_1 | FIX2INT(type)); - write_string_direct(trans, name); - write_i32_direct(trans, FIX2INT(seqid)); - } else { - write_string_direct(trans, name); - write_byte_direct(trans, FIX2INT(type)); - write_i32_direct(trans, FIX2INT(seqid)); - } - - return Qnil; -} - -VALUE rb_thrift_binary_proto_write_field_begin(VALUE self, VALUE name, VALUE type, VALUE id) { - VALUE trans = GET_TRANSPORT(self); - write_byte_direct(trans, FIX2INT(type)); - write_i16_direct(trans, FIX2INT(id)); - - return Qnil; -} - -VALUE rb_thrift_binary_proto_write_field_stop(VALUE self) { - write_byte_direct(GET_TRANSPORT(self), TTYPE_STOP); - return Qnil; -} - -VALUE rb_thrift_binary_proto_write_map_begin(VALUE self, VALUE ktype, VALUE vtype, VALUE size) { - VALUE trans = GET_TRANSPORT(self); - write_byte_direct(trans, FIX2INT(ktype)); - write_byte_direct(trans, FIX2INT(vtype)); - write_i32_direct(trans, FIX2INT(size)); - - return Qnil; -} - -VALUE rb_thrift_binary_proto_write_list_begin(VALUE self, VALUE etype, VALUE size) { - VALUE trans = GET_TRANSPORT(self); - write_byte_direct(trans, FIX2INT(etype)); - write_i32_direct(trans, FIX2INT(size)); - - return Qnil; -} - -VALUE rb_thrift_binary_proto_write_set_begin(VALUE self, VALUE etype, VALUE size) { - rb_thrift_binary_proto_write_list_begin(self, etype, size); - return Qnil; -} - -VALUE rb_thrift_binary_proto_write_bool(VALUE self, VALUE b) { - write_byte_direct(GET_TRANSPORT(self), RTEST(b) ? 1 : 0); - return Qnil; -} - -VALUE rb_thrift_binary_proto_write_byte(VALUE self, VALUE byte) { - CHECK_NIL(byte); - write_byte_direct(GET_TRANSPORT(self), NUM2INT(byte)); - return Qnil; -} - -VALUE rb_thrift_binary_proto_write_i16(VALUE self, VALUE i16) { - CHECK_NIL(i16); - write_i16_direct(GET_TRANSPORT(self), FIX2INT(i16)); - return Qnil; -} - -VALUE rb_thrift_binary_proto_write_i32(VALUE self, VALUE i32) { - CHECK_NIL(i32); - write_i32_direct(GET_TRANSPORT(self), NUM2INT(i32)); - return Qnil; -} - -VALUE rb_thrift_binary_proto_write_i64(VALUE self, VALUE i64) { - CHECK_NIL(i64); - write_i64_direct(GET_TRANSPORT(self), NUM2LL(i64)); - return Qnil; -} - -VALUE rb_thrift_binary_proto_write_double(VALUE self, VALUE dub) { - CHECK_NIL(dub); - // Unfortunately, bitwise_cast doesn't work in C. Bad C! - union { - double f; - int64_t t; - } transfer; - transfer.f = RFLOAT_VALUE(rb_Float(dub)); - write_i64_direct(GET_TRANSPORT(self), transfer.t); - - return Qnil; -} - -VALUE rb_thrift_binary_proto_write_string(VALUE self, VALUE str) { - CHECK_NIL(str); - VALUE trans = GET_TRANSPORT(self); - write_string_direct(trans, str); - return Qnil; -} - -//--------------------------------------- -// interface reading methods -//--------------------------------------- - -VALUE rb_thrift_binary_proto_read_string(VALUE self); -VALUE rb_thrift_binary_proto_read_byte(VALUE self); -VALUE rb_thrift_binary_proto_read_i32(VALUE self); -VALUE rb_thrift_binary_proto_read_i16(VALUE self); - -static char read_byte_direct(VALUE self) { - VALUE byte = rb_funcall(GET_TRANSPORT(self), read_byte_method_id, 0); - return (char)(FIX2INT(byte)); -} - -static int16_t read_i16_direct(VALUE self) { - VALUE rbuf = rb_ivar_get(self, rbuf_ivar_id); - rb_funcall(GET_TRANSPORT(self), read_into_buffer_method_id, 2, rbuf, INT2FIX(2)); - return (int16_t)(((uint8_t)(RSTRING_PTR(rbuf)[1])) | ((uint16_t)((RSTRING_PTR(rbuf)[0]) << 8))); -} - -static int32_t read_i32_direct(VALUE self) { - VALUE rbuf = rb_ivar_get(self, rbuf_ivar_id); - rb_funcall(GET_TRANSPORT(self), read_into_buffer_method_id, 2, rbuf, INT2FIX(4)); - return ((uint8_t)(RSTRING_PTR(rbuf)[3])) | - (((uint8_t)(RSTRING_PTR(rbuf)[2])) << 8) | - (((uint8_t)(RSTRING_PTR(rbuf)[1])) << 16) | - (((uint8_t)(RSTRING_PTR(rbuf)[0])) << 24); -} - -static int64_t read_i64_direct(VALUE self) { - VALUE rbuf = rb_ivar_get(self, rbuf_ivar_id); - rb_funcall(GET_TRANSPORT(self), read_into_buffer_method_id, 2, rbuf, INT2FIX(8)); - uint64_t hi = ((uint8_t)(RSTRING_PTR(rbuf)[3])) | - (((uint8_t)(RSTRING_PTR(rbuf)[2])) << 8) | - (((uint8_t)(RSTRING_PTR(rbuf)[1])) << 16) | - (((uint8_t)(RSTRING_PTR(rbuf)[0])) << 24); - uint32_t lo = ((uint8_t)(RSTRING_PTR(rbuf)[7])) | - (((uint8_t)(RSTRING_PTR(rbuf)[6])) << 8) | - (((uint8_t)(RSTRING_PTR(rbuf)[5])) << 16) | - (((uint8_t)(RSTRING_PTR(rbuf)[4])) << 24); - return (hi << 32) | lo; -} - -static VALUE get_protocol_exception(VALUE code, VALUE message) { - VALUE args[2]; - args[0] = code; - args[1] = message; - return rb_class_new_instance(2, (VALUE*)&args, protocol_exception_class); -} - -VALUE rb_thrift_binary_proto_read_message_end(VALUE self) { - return Qnil; -} - -VALUE rb_thift_binary_proto_read_struct_begin(VALUE self) { - return Qnil; -} - -VALUE rb_thift_binary_proto_read_struct_end(VALUE self) { - return Qnil; -} - -VALUE rb_thift_binary_proto_read_field_end(VALUE self) { - return Qnil; -} - -VALUE rb_thift_binary_proto_read_map_end(VALUE self) { - return Qnil; -} - -VALUE rb_thift_binary_proto_read_list_end(VALUE self) { - return Qnil; -} - -VALUE rb_thift_binary_proto_read_set_end(VALUE self) { - return Qnil; -} - -VALUE rb_thrift_binary_proto_read_message_begin(VALUE self) { - VALUE strict_read = GET_STRICT_READ(self); - VALUE name, seqid; - int type; - - int version = read_i32_direct(self); - - if (version < 0) { - if ((version & VERSION_MASK) != VERSION_1) { - rb_exc_raise(get_protocol_exception(INT2FIX(BAD_VERSION), rb_str_new2("Missing version identifier"))); - } - type = version & TYPE_MASK; - name = rb_thrift_binary_proto_read_string(self); - seqid = rb_thrift_binary_proto_read_i32(self); - } else { - if (strict_read == Qtrue) { - rb_exc_raise(get_protocol_exception(INT2FIX(BAD_VERSION), rb_str_new2("No version identifier, old protocol client?"))); - } - name = READ(self, version); - type = read_byte_direct(self); - seqid = rb_thrift_binary_proto_read_i32(self); - } - - return rb_ary_new3(3, name, INT2FIX(type), seqid); -} - -VALUE rb_thrift_binary_proto_read_field_begin(VALUE self) { - int type = read_byte_direct(self); - if (type == TTYPE_STOP) { - return rb_ary_new3(3, Qnil, INT2FIX(type), INT2FIX(0)); - } else { - VALUE id = rb_thrift_binary_proto_read_i16(self); - return rb_ary_new3(3, Qnil, INT2FIX(type), id); - } -} - -VALUE rb_thrift_binary_proto_read_map_begin(VALUE self) { - VALUE ktype = rb_thrift_binary_proto_read_byte(self); - VALUE vtype = rb_thrift_binary_proto_read_byte(self); - VALUE size = rb_thrift_binary_proto_read_i32(self); - return rb_ary_new3(3, ktype, vtype, size); -} - -VALUE rb_thrift_binary_proto_read_list_begin(VALUE self) { - VALUE etype = rb_thrift_binary_proto_read_byte(self); - VALUE size = rb_thrift_binary_proto_read_i32(self); - return rb_ary_new3(2, etype, size); -} - -VALUE rb_thrift_binary_proto_read_set_begin(VALUE self) { - return rb_thrift_binary_proto_read_list_begin(self); -} - -VALUE rb_thrift_binary_proto_read_bool(VALUE self) { - char byte = read_byte_direct(self); - return byte != 0 ? Qtrue : Qfalse; -} - -VALUE rb_thrift_binary_proto_read_byte(VALUE self) { - return INT2FIX(read_byte_direct(self)); -} - -VALUE rb_thrift_binary_proto_read_i16(VALUE self) { - return INT2FIX(read_i16_direct(self)); -} - -VALUE rb_thrift_binary_proto_read_i32(VALUE self) { - return INT2NUM(read_i32_direct(self)); -} - -VALUE rb_thrift_binary_proto_read_i64(VALUE self) { - return LL2NUM(read_i64_direct(self)); -} - -VALUE rb_thrift_binary_proto_read_double(VALUE self) { - union { - double f; - int64_t t; - } transfer; - transfer.t = read_i64_direct(self); - return rb_float_new(transfer.f); -} - -VALUE rb_thrift_binary_proto_read_string(VALUE self) { - int size = read_i32_direct(self); - return READ(self, size); -} - -void Init_binary_protocol_accelerated() { - VALUE thrift_binary_protocol_class = rb_const_get(thrift_module, rb_intern("BinaryProtocol")); - - VERSION_1 = rb_num2ll(rb_const_get(thrift_binary_protocol_class, rb_intern("VERSION_1"))); - VERSION_MASK = rb_num2ll(rb_const_get(thrift_binary_protocol_class, rb_intern("VERSION_MASK"))); - TYPE_MASK = rb_num2ll(rb_const_get(thrift_binary_protocol_class, rb_intern("TYPE_MASK"))); - - VALUE bpa_class = rb_define_class_under(thrift_module, "BinaryProtocolAccelerated", thrift_binary_protocol_class); - - rb_define_method(bpa_class, "native?", rb_thrift_binary_proto_native_qmark, 0); - - rb_define_method(bpa_class, "write_message_begin", rb_thrift_binary_proto_write_message_begin, 3); - rb_define_method(bpa_class, "write_field_begin", rb_thrift_binary_proto_write_field_begin, 3); - rb_define_method(bpa_class, "write_field_stop", rb_thrift_binary_proto_write_field_stop, 0); - rb_define_method(bpa_class, "write_map_begin", rb_thrift_binary_proto_write_map_begin, 3); - rb_define_method(bpa_class, "write_list_begin", rb_thrift_binary_proto_write_list_begin, 2); - rb_define_method(bpa_class, "write_set_begin", rb_thrift_binary_proto_write_set_begin, 2); - rb_define_method(bpa_class, "write_byte", rb_thrift_binary_proto_write_byte, 1); - rb_define_method(bpa_class, "write_bool", rb_thrift_binary_proto_write_bool, 1); - rb_define_method(bpa_class, "write_i16", rb_thrift_binary_proto_write_i16, 1); - rb_define_method(bpa_class, "write_i32", rb_thrift_binary_proto_write_i32, 1); - rb_define_method(bpa_class, "write_i64", rb_thrift_binary_proto_write_i64, 1); - rb_define_method(bpa_class, "write_double", rb_thrift_binary_proto_write_double, 1); - rb_define_method(bpa_class, "write_string", rb_thrift_binary_proto_write_string, 1); - // unused methods - rb_define_method(bpa_class, "write_message_end", rb_thrift_binary_proto_write_message_end, 0); - rb_define_method(bpa_class, "write_struct_begin", rb_thrift_binary_proto_write_struct_begin, 1); - rb_define_method(bpa_class, "write_struct_end", rb_thrift_binary_proto_write_struct_end, 0); - rb_define_method(bpa_class, "write_field_end", rb_thrift_binary_proto_write_field_end, 0); - rb_define_method(bpa_class, "write_map_end", rb_thrift_binary_proto_write_map_end, 0); - rb_define_method(bpa_class, "write_list_end", rb_thrift_binary_proto_write_list_end, 0); - rb_define_method(bpa_class, "write_set_end", rb_thrift_binary_proto_write_set_end, 0); - - rb_define_method(bpa_class, "read_message_begin", rb_thrift_binary_proto_read_message_begin, 0); - rb_define_method(bpa_class, "read_field_begin", rb_thrift_binary_proto_read_field_begin, 0); - rb_define_method(bpa_class, "read_map_begin", rb_thrift_binary_proto_read_map_begin, 0); - rb_define_method(bpa_class, "read_list_begin", rb_thrift_binary_proto_read_list_begin, 0); - rb_define_method(bpa_class, "read_set_begin", rb_thrift_binary_proto_read_set_begin, 0); - rb_define_method(bpa_class, "read_byte", rb_thrift_binary_proto_read_byte, 0); - rb_define_method(bpa_class, "read_bool", rb_thrift_binary_proto_read_bool, 0); - rb_define_method(bpa_class, "read_i16", rb_thrift_binary_proto_read_i16, 0); - rb_define_method(bpa_class, "read_i32", rb_thrift_binary_proto_read_i32, 0); - rb_define_method(bpa_class, "read_i64", rb_thrift_binary_proto_read_i64, 0); - rb_define_method(bpa_class, "read_double", rb_thrift_binary_proto_read_double, 0); - rb_define_method(bpa_class, "read_string", rb_thrift_binary_proto_read_string, 0); - // unused methods - rb_define_method(bpa_class, "read_message_end", rb_thrift_binary_proto_read_message_end, 0); - rb_define_method(bpa_class, "read_struct_begin", rb_thift_binary_proto_read_struct_begin, 0); - rb_define_method(bpa_class, "read_struct_end", rb_thift_binary_proto_read_struct_end, 0); - rb_define_method(bpa_class, "read_field_end", rb_thift_binary_proto_read_field_end, 0); - rb_define_method(bpa_class, "read_map_end", rb_thift_binary_proto_read_map_end, 0); - rb_define_method(bpa_class, "read_list_end", rb_thift_binary_proto_read_list_end, 0); - rb_define_method(bpa_class, "read_set_end", rb_thift_binary_proto_read_set_end, 0); - - rbuf_ivar_id = rb_intern("@rbuf"); -} diff --git a/ext/binary_protocol_accelerated.h b/ext/binary_protocol_accelerated.h deleted file mode 100644 index 37baf41..0000000 --- a/ext/binary_protocol_accelerated.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -void Init_binary_protocol_accelerated(); diff --git a/ext/compact_protocol.c b/ext/compact_protocol.c deleted file mode 100644 index a47fe6c..0000000 --- a/ext/compact_protocol.c +++ /dev/null @@ -1,618 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#include <ruby.h> -#include <stdbool.h> -#include <stdint.h> -#include "constants.h" -#include "struct.h" -#include "macros.h" - -#define LAST_ID(obj) FIX2INT(rb_ary_pop(rb_ivar_get(obj, last_field_id))) -#define SET_LAST_ID(obj, val) rb_ary_push(rb_ivar_get(obj, last_field_id), val) - -VALUE rb_thrift_compact_proto_native_qmark(VALUE self) { - return Qtrue; -} - -static ID last_field_id; -static ID boolean_field_id; -static ID bool_value_id; -static ID rbuf_ivar_id; - -static int VERSION; -static int VERSION_MASK; -static int TYPE_MASK; -static int TYPE_SHIFT_AMOUNT; -static int PROTOCOL_ID; - -static VALUE thrift_compact_protocol_class; - -static int CTYPE_BOOLEAN_TRUE = 0x01; -static int CTYPE_BOOLEAN_FALSE = 0x02; -static int CTYPE_BYTE = 0x03; -static int CTYPE_I16 = 0x04; -static int CTYPE_I32 = 0x05; -static int CTYPE_I64 = 0x06; -static int CTYPE_DOUBLE = 0x07; -static int CTYPE_BINARY = 0x08; -static int CTYPE_LIST = 0x09; -static int CTYPE_SET = 0x0A; -static int CTYPE_MAP = 0x0B; -static int CTYPE_STRUCT = 0x0C; - -VALUE rb_thrift_compact_proto_write_i16(VALUE self, VALUE i16); - -// TODO: implement this -static int get_compact_type(VALUE type_value) { - int type = FIX2INT(type_value); - if (type == TTYPE_BOOL) { - return CTYPE_BOOLEAN_TRUE; - } else if (type == TTYPE_BYTE) { - return CTYPE_BYTE; - } else if (type == TTYPE_I16) { - return CTYPE_I16; - } else if (type == TTYPE_I32) { - return CTYPE_I32; - } else if (type == TTYPE_I64) { - return CTYPE_I64; - } else if (type == TTYPE_DOUBLE) { - return CTYPE_DOUBLE; - } else if (type == TTYPE_STRING) { - return CTYPE_BINARY; - } else if (type == TTYPE_LIST) { - return CTYPE_LIST; - } else if (type == TTYPE_SET) { - return CTYPE_SET; - } else if (type == TTYPE_MAP) { - return CTYPE_MAP; - } else if (type == TTYPE_STRUCT) { - return CTYPE_STRUCT; - } else { - char str[50]; - sprintf(str, "don't know what type: %d", type); - rb_raise(rb_eStandardError, "%s", str); - return 0; - } -} - -static void write_byte_direct(VALUE transport, int8_t b) { - WRITE(transport, (char*)&b, 1); -} - -static void write_field_begin_internal(VALUE self, VALUE type, VALUE id_value, VALUE type_override) { - int id = FIX2INT(id_value); - int last_id = LAST_ID(self); - VALUE transport = GET_TRANSPORT(self); - - // if there's a type override, use that. - int8_t type_to_write = RTEST(type_override) ? FIX2INT(type_override) : get_compact_type(type); - // check if we can use delta encoding for the field id - int diff = id - last_id; - if (diff > 0 && diff <= 15) { - // write them together - write_byte_direct(transport, diff << 4 | (type_to_write & 0x0f)); - } else { - // write them separate - write_byte_direct(transport, type_to_write & 0x0f); - rb_thrift_compact_proto_write_i16(self, id_value); - } - - SET_LAST_ID(self, id_value); -} - -static int32_t int_to_zig_zag(int32_t n) { - return (n << 1) ^ (n >> 31); -} - -static uint64_t ll_to_zig_zag(int64_t n) { - return (n << 1) ^ (n >> 63); -} - -static void write_varint32(VALUE transport, uint32_t n) { - while (true) { - if ((n & ~0x7F) == 0) { - write_byte_direct(transport, n & 0x7f); - break; - } else { - write_byte_direct(transport, (n & 0x7F) | 0x80); - n = n >> 7; - } - } -} - -static void write_varint64(VALUE transport, uint64_t n) { - while (true) { - if ((n & ~0x7F) == 0) { - write_byte_direct(transport, n & 0x7f); - break; - } else { - write_byte_direct(transport, (n & 0x7F) | 0x80); - n = n >> 7; - } - } -} - -static void write_collection_begin(VALUE transport, VALUE elem_type, VALUE size_value) { - int size = FIX2INT(size_value); - if (size <= 14) { - write_byte_direct(transport, size << 4 | get_compact_type(elem_type)); - } else { - write_byte_direct(transport, 0xf0 | get_compact_type(elem_type)); - write_varint32(transport, size); - } -} - - -//-------------------------------- -// interface writing methods -//-------------------------------- - -VALUE rb_thrift_compact_proto_write_i32(VALUE self, VALUE i32); -VALUE rb_thrift_compact_proto_write_string(VALUE self, VALUE str); - -VALUE rb_thrift_compact_proto_write_message_end(VALUE self) { - return Qnil; -} - -VALUE rb_thrift_compact_proto_write_struct_begin(VALUE self, VALUE name) { - rb_ary_push(rb_ivar_get(self, last_field_id), INT2FIX(0)); - return Qnil; -} - -VALUE rb_thrift_compact_proto_write_struct_end(VALUE self) { - rb_ary_pop(rb_ivar_get(self, last_field_id)); - return Qnil; -} - -VALUE rb_thrift_compact_proto_write_field_end(VALUE self) { - return Qnil; -} - -VALUE rb_thrift_compact_proto_write_map_end(VALUE self) { - return Qnil; -} - -VALUE rb_thrift_compact_proto_write_list_end(VALUE self) { - return Qnil; -} - -VALUE rb_thrift_compact_proto_write_set_end(VALUE self) { - return Qnil; -} - -VALUE rb_thrift_compact_proto_write_message_begin(VALUE self, VALUE name, VALUE type, VALUE seqid) { - VALUE transport = GET_TRANSPORT(self); - write_byte_direct(transport, PROTOCOL_ID); - write_byte_direct(transport, (VERSION & VERSION_MASK) | ((FIX2INT(type) << TYPE_SHIFT_AMOUNT) & TYPE_MASK)); - write_varint32(transport, FIX2INT(seqid)); - rb_thrift_compact_proto_write_string(self, name); - - return Qnil; -} - -VALUE rb_thrift_compact_proto_write_field_begin(VALUE self, VALUE name, VALUE type, VALUE id) { - if (FIX2INT(type) == TTYPE_BOOL) { - // we want to possibly include the value, so we'll wait. - rb_ivar_set(self, boolean_field_id, rb_ary_new3(2, type, id)); - } else { - write_field_begin_internal(self, type, id, Qnil); - } - - return Qnil; -} - -VALUE rb_thrift_compact_proto_write_field_stop(VALUE self) { - write_byte_direct(GET_TRANSPORT(self), TTYPE_STOP); - return Qnil; -} - -VALUE rb_thrift_compact_proto_write_map_begin(VALUE self, VALUE ktype, VALUE vtype, VALUE size_value) { - int size = FIX2INT(size_value); - VALUE transport = GET_TRANSPORT(self); - if (size == 0) { - write_byte_direct(transport, 0); - } else { - write_varint32(transport, size); - write_byte_direct(transport, get_compact_type(ktype) << 4 | get_compact_type(vtype)); - } - return Qnil; -} - -VALUE rb_thrift_compact_proto_write_list_begin(VALUE self, VALUE etype, VALUE size) { - write_collection_begin(GET_TRANSPORT(self), etype, size); - return Qnil; -} - -VALUE rb_thrift_compact_proto_write_set_begin(VALUE self, VALUE etype, VALUE size) { - write_collection_begin(GET_TRANSPORT(self), etype, size); - return Qnil; -} - -VALUE rb_thrift_compact_proto_write_bool(VALUE self, VALUE b) { - int8_t type = b == Qtrue ? CTYPE_BOOLEAN_TRUE : CTYPE_BOOLEAN_FALSE; - VALUE boolean_field = rb_ivar_get(self, boolean_field_id); - if (NIL_P(boolean_field)) { - // we're not part of a field, so just write the value. - write_byte_direct(GET_TRANSPORT(self), type); - } else { - // we haven't written the field header yet - write_field_begin_internal(self, rb_ary_entry(boolean_field, 0), rb_ary_entry(boolean_field, 1), INT2FIX(type)); - rb_ivar_set(self, boolean_field_id, Qnil); - } - return Qnil; -} - -VALUE rb_thrift_compact_proto_write_byte(VALUE self, VALUE byte) { - CHECK_NIL(byte); - write_byte_direct(GET_TRANSPORT(self), FIX2INT(byte)); - return Qnil; -} - -VALUE rb_thrift_compact_proto_write_i16(VALUE self, VALUE i16) { - rb_thrift_compact_proto_write_i32(self, i16); - return Qnil; -} - -VALUE rb_thrift_compact_proto_write_i32(VALUE self, VALUE i32) { - CHECK_NIL(i32); - write_varint32(GET_TRANSPORT(self), int_to_zig_zag(NUM2INT(i32))); - return Qnil; -} - -VALUE rb_thrift_compact_proto_write_i64(VALUE self, VALUE i64) { - CHECK_NIL(i64); - write_varint64(GET_TRANSPORT(self), ll_to_zig_zag(NUM2LL(i64))); - return Qnil; -} - -VALUE rb_thrift_compact_proto_write_double(VALUE self, VALUE dub) { - CHECK_NIL(dub); - // Unfortunately, bitwise_cast doesn't work in C. Bad C! - union { - double f; - int64_t l; - } transfer; - transfer.f = RFLOAT_VALUE(rb_Float(dub)); - char buf[8]; - buf[0] = transfer.l & 0xff; - buf[1] = (transfer.l >> 8) & 0xff; - buf[2] = (transfer.l >> 16) & 0xff; - buf[3] = (transfer.l >> 24) & 0xff; - buf[4] = (transfer.l >> 32) & 0xff; - buf[5] = (transfer.l >> 40) & 0xff; - buf[6] = (transfer.l >> 48) & 0xff; - buf[7] = (transfer.l >> 56) & 0xff; - WRITE(GET_TRANSPORT(self), buf, 8); - return Qnil; -} - -VALUE rb_thrift_compact_proto_write_string(VALUE self, VALUE str) { - VALUE transport = GET_TRANSPORT(self); - write_varint32(transport, RSTRING_LEN(str)); - WRITE(transport, RSTRING_PTR(str), RSTRING_LEN(str)); - return Qnil; -} - -//--------------------------------------- -// interface reading methods -//--------------------------------------- - -#define is_bool_type(ctype) (((ctype) & 0x0F) == CTYPE_BOOLEAN_TRUE || ((ctype) & 0x0F) == CTYPE_BOOLEAN_FALSE) - -VALUE rb_thrift_compact_proto_read_string(VALUE self); -VALUE rb_thrift_compact_proto_read_byte(VALUE self); -VALUE rb_thrift_compact_proto_read_i32(VALUE self); -VALUE rb_thrift_compact_proto_read_i16(VALUE self); - -static int8_t get_ttype(int8_t ctype) { - if (ctype == TTYPE_STOP) { - return TTYPE_STOP; - } else if (ctype == CTYPE_BOOLEAN_TRUE || ctype == CTYPE_BOOLEAN_FALSE) { - return TTYPE_BOOL; - } else if (ctype == CTYPE_BYTE) { - return TTYPE_BYTE; - } else if (ctype == CTYPE_I16) { - return TTYPE_I16; - } else if (ctype == CTYPE_I32) { - return TTYPE_I32; - } else if (ctype == CTYPE_I64) { - return TTYPE_I64; - } else if (ctype == CTYPE_DOUBLE) { - return TTYPE_DOUBLE; - } else if (ctype == CTYPE_BINARY) { - return TTYPE_STRING; - } else if (ctype == CTYPE_LIST) { - return TTYPE_LIST; - } else if (ctype == CTYPE_SET) { - return TTYPE_SET; - } else if (ctype == CTYPE_MAP) { - return TTYPE_MAP; - } else if (ctype == CTYPE_STRUCT) { - return TTYPE_STRUCT; - } else { - char str[50]; - sprintf(str, "don't know what type: %d", ctype); - rb_raise(rb_eStandardError, "%s", str); - return 0; - } -} - -static char read_byte_direct(VALUE self) { - VALUE byte = rb_funcall(GET_TRANSPORT(self), read_byte_method_id, 0); - return (char)(FIX2INT(byte)); -} - -static int64_t zig_zag_to_ll(int64_t n) { - return (((uint64_t)n) >> 1) ^ -(n & 1); -} - -static int32_t zig_zag_to_int(int32_t n) { - return (((uint32_t)n) >> 1) ^ -(n & 1); -} - -static int64_t read_varint64(VALUE self) { - int shift = 0; - int64_t result = 0; - while (true) { - int8_t b = read_byte_direct(self); - result = result | ((uint64_t)(b & 0x7f) << shift); - if ((b & 0x80) != 0x80) { - break; - } - shift += 7; - } - return result; -} - -static int16_t read_i16(VALUE self) { - return zig_zag_to_int((int32_t)read_varint64(self)); -} - -static VALUE get_protocol_exception(VALUE code, VALUE message) { - VALUE args[2]; - args[0] = code; - args[1] = message; - return rb_class_new_instance(2, (VALUE*)&args, protocol_exception_class); -} - -VALUE rb_thrift_compact_proto_read_message_end(VALUE self) { - return Qnil; -} - -VALUE rb_thrift_compact_proto_read_struct_begin(VALUE self) { - rb_ary_push(rb_ivar_get(self, last_field_id), INT2FIX(0)); - return Qnil; -} - -VALUE rb_thrift_compact_proto_read_struct_end(VALUE self) { - rb_ary_pop(rb_ivar_get(self, last_field_id)); - return Qnil; -} - -VALUE rb_thrift_compact_proto_read_field_end(VALUE self) { - return Qnil; -} - -VALUE rb_thrift_compact_proto_read_map_end(VALUE self) { - return Qnil; -} - -VALUE rb_thrift_compact_proto_read_list_end(VALUE self) { - return Qnil; -} - -VALUE rb_thrift_compact_proto_read_set_end(VALUE self) { - return Qnil; -} - -VALUE rb_thrift_compact_proto_read_message_begin(VALUE self) { - int8_t protocol_id = read_byte_direct(self); - if (protocol_id != PROTOCOL_ID) { - char buf[100]; - int len = sprintf(buf, "Expected protocol id %d but got %d", PROTOCOL_ID, protocol_id); - buf[len] = 0; - rb_exc_raise(get_protocol_exception(INT2FIX(-1), rb_str_new2(buf))); - } - - int8_t version_and_type = read_byte_direct(self); - int8_t version = version_and_type & VERSION_MASK; - if (version != VERSION) { - char buf[100]; - int len = sprintf(buf, "Expected version id %d but got %d", version, VERSION); - buf[len] = 0; - rb_exc_raise(get_protocol_exception(INT2FIX(-1), rb_str_new2(buf))); - } - - int8_t type = (version_and_type >> TYPE_SHIFT_AMOUNT) & 0x03; - int32_t seqid = read_varint64(self); - VALUE messageName = rb_thrift_compact_proto_read_string(self); - return rb_ary_new3(3, messageName, INT2FIX(type), INT2NUM(seqid)); -} - -VALUE rb_thrift_compact_proto_read_field_begin(VALUE self) { - int8_t type = read_byte_direct(self); - // if it's a stop, then we can return immediately, as the struct is over. - if ((type & 0x0f) == TTYPE_STOP) { - return rb_ary_new3(3, Qnil, INT2FIX(0), INT2FIX(0)); - } else { - int field_id = 0; - - // mask off the 4 MSB of the type header. it could contain a field id delta. - uint8_t modifier = ((type & 0xf0) >> 4); - - if (modifier == 0) { - // not a delta. look ahead for the zigzag varint field id. - (void) LAST_ID(self); - field_id = read_i16(self); - } else { - // has a delta. add the delta to the last read field id. - field_id = LAST_ID(self) + modifier; - } - - // if this happens to be a boolean field, the value is encoded in the type - if (is_bool_type(type)) { - // save the boolean value in a special instance variable. - rb_ivar_set(self, bool_value_id, (type & 0x0f) == CTYPE_BOOLEAN_TRUE ? Qtrue : Qfalse); - } - - // push the new field onto the field stack so we can keep the deltas going. - SET_LAST_ID(self, INT2FIX(field_id)); - return rb_ary_new3(3, Qnil, INT2FIX(get_ttype(type & 0x0f)), INT2FIX(field_id)); - } -} - -VALUE rb_thrift_compact_proto_read_map_begin(VALUE self) { - int32_t size = read_varint64(self); - uint8_t key_and_value_type = size == 0 ? 0 : read_byte_direct(self); - return rb_ary_new3(3, INT2FIX(get_ttype(key_and_value_type >> 4)), INT2FIX(get_ttype(key_and_value_type & 0xf)), INT2FIX(size)); -} - -VALUE rb_thrift_compact_proto_read_list_begin(VALUE self) { - uint8_t size_and_type = read_byte_direct(self); - int32_t size = (size_and_type >> 4) & 0x0f; - if (size == 15) { - size = read_varint64(self); - } - uint8_t type = get_ttype(size_and_type & 0x0f); - return rb_ary_new3(2, INT2FIX(type), INT2FIX(size)); -} - -VALUE rb_thrift_compact_proto_read_set_begin(VALUE self) { - return rb_thrift_compact_proto_read_list_begin(self); -} - -VALUE rb_thrift_compact_proto_read_bool(VALUE self) { - VALUE bool_value = rb_ivar_get(self, bool_value_id); - if (NIL_P(bool_value)) { - return read_byte_direct(self) == CTYPE_BOOLEAN_TRUE ? Qtrue : Qfalse; - } else { - rb_ivar_set(self, bool_value_id, Qnil); - return bool_value; - } -} - -VALUE rb_thrift_compact_proto_read_byte(VALUE self) { - return INT2FIX(read_byte_direct(self)); -} - -VALUE rb_thrift_compact_proto_read_i16(VALUE self) { - return INT2FIX(read_i16(self)); -} - -VALUE rb_thrift_compact_proto_read_i32(VALUE self) { - return INT2NUM(zig_zag_to_int(read_varint64(self))); -} - -VALUE rb_thrift_compact_proto_read_i64(VALUE self) { - return LL2NUM(zig_zag_to_ll(read_varint64(self))); -} - -VALUE rb_thrift_compact_proto_read_double(VALUE self) { - union { - double f; - int64_t l; - } transfer; - VALUE rbuf = rb_ivar_get(self, rbuf_ivar_id); - rb_funcall(GET_TRANSPORT(self), read_into_buffer_method_id, 2, rbuf, INT2FIX(8)); - uint32_t lo = ((uint8_t)(RSTRING_PTR(rbuf)[0])) - | (((uint8_t)(RSTRING_PTR(rbuf)[1])) << 8) - | (((uint8_t)(RSTRING_PTR(rbuf)[2])) << 16) - | (((uint8_t)(RSTRING_PTR(rbuf)[3])) << 24); - uint64_t hi = (((uint8_t)(RSTRING_PTR(rbuf)[4]))) - | (((uint8_t)(RSTRING_PTR(rbuf)[5])) << 8) - | (((uint8_t)(RSTRING_PTR(rbuf)[6])) << 16) - | (((uint8_t)(RSTRING_PTR(rbuf)[7])) << 24); - transfer.l = (hi << 32) | lo; - - return rb_float_new(transfer.f); -} - -VALUE rb_thrift_compact_proto_read_string(VALUE self) { - int64_t size = read_varint64(self); - return READ(self, size); -} - -static void Init_constants() { - thrift_compact_protocol_class = rb_const_get(thrift_module, rb_intern("CompactProtocol")); - - VERSION = rb_num2ll(rb_const_get(thrift_compact_protocol_class, rb_intern("VERSION"))); - VERSION_MASK = rb_num2ll(rb_const_get(thrift_compact_protocol_class, rb_intern("VERSION_MASK"))); - TYPE_MASK = rb_num2ll(rb_const_get(thrift_compact_protocol_class, rb_intern("TYPE_MASK"))); - TYPE_SHIFT_AMOUNT = FIX2INT(rb_const_get(thrift_compact_protocol_class, rb_intern("TYPE_SHIFT_AMOUNT"))); - PROTOCOL_ID = FIX2INT(rb_const_get(thrift_compact_protocol_class, rb_intern("PROTOCOL_ID"))); - - last_field_id = rb_intern("@last_field"); - boolean_field_id = rb_intern("@boolean_field"); - bool_value_id = rb_intern("@bool_value"); - rbuf_ivar_id = rb_intern("@rbuf"); -} - -static void Init_rb_methods() { - rb_define_method(thrift_compact_protocol_class, "native?", rb_thrift_compact_proto_native_qmark, 0); - - rb_define_method(thrift_compact_protocol_class, "write_message_begin", rb_thrift_compact_proto_write_message_begin, 3); - rb_define_method(thrift_compact_protocol_class, "write_field_begin", rb_thrift_compact_proto_write_field_begin, 3); - rb_define_method(thrift_compact_protocol_class, "write_field_stop", rb_thrift_compact_proto_write_field_stop, 0); - rb_define_method(thrift_compact_protocol_class, "write_map_begin", rb_thrift_compact_proto_write_map_begin, 3); - rb_define_method(thrift_compact_protocol_class, "write_list_begin", rb_thrift_compact_proto_write_list_begin, 2); - rb_define_method(thrift_compact_protocol_class, "write_set_begin", rb_thrift_compact_proto_write_set_begin, 2); - rb_define_method(thrift_compact_protocol_class, "write_byte", rb_thrift_compact_proto_write_byte, 1); - rb_define_method(thrift_compact_protocol_class, "write_bool", rb_thrift_compact_proto_write_bool, 1); - rb_define_method(thrift_compact_protocol_class, "write_i16", rb_thrift_compact_proto_write_i16, 1); - rb_define_method(thrift_compact_protocol_class, "write_i32", rb_thrift_compact_proto_write_i32, 1); - rb_define_method(thrift_compact_protocol_class, "write_i64", rb_thrift_compact_proto_write_i64, 1); - rb_define_method(thrift_compact_protocol_class, "write_double", rb_thrift_compact_proto_write_double, 1); - rb_define_method(thrift_compact_protocol_class, "write_string", rb_thrift_compact_proto_write_string, 1); - - rb_define_method(thrift_compact_protocol_class, "write_message_end", rb_thrift_compact_proto_write_message_end, 0); - rb_define_method(thrift_compact_protocol_class, "write_struct_begin", rb_thrift_compact_proto_write_struct_begin, 1); - rb_define_method(thrift_compact_protocol_class, "write_struct_end", rb_thrift_compact_proto_write_struct_end, 0); - rb_define_method(thrift_compact_protocol_class, "write_field_end", rb_thrift_compact_proto_write_field_end, 0); - rb_define_method(thrift_compact_protocol_class, "write_map_end", rb_thrift_compact_proto_write_map_end, 0); - rb_define_method(thrift_compact_protocol_class, "write_list_end", rb_thrift_compact_proto_write_list_end, 0); - rb_define_method(thrift_compact_protocol_class, "write_set_end", rb_thrift_compact_proto_write_set_end, 0); - - - rb_define_method(thrift_compact_protocol_class, "read_message_begin", rb_thrift_compact_proto_read_message_begin, 0); - rb_define_method(thrift_compact_protocol_class, "read_field_begin", rb_thrift_compact_proto_read_field_begin, 0); - rb_define_method(thrift_compact_protocol_class, "read_map_begin", rb_thrift_compact_proto_read_map_begin, 0); - rb_define_method(thrift_compact_protocol_class, "read_list_begin", rb_thrift_compact_proto_read_list_begin, 0); - rb_define_method(thrift_compact_protocol_class, "read_set_begin", rb_thrift_compact_proto_read_set_begin, 0); - rb_define_method(thrift_compact_protocol_class, "read_byte", rb_thrift_compact_proto_read_byte, 0); - rb_define_method(thrift_compact_protocol_class, "read_bool", rb_thrift_compact_proto_read_bool, 0); - rb_define_method(thrift_compact_protocol_class, "read_i16", rb_thrift_compact_proto_read_i16, 0); - rb_define_method(thrift_compact_protocol_class, "read_i32", rb_thrift_compact_proto_read_i32, 0); - rb_define_method(thrift_compact_protocol_class, "read_i64", rb_thrift_compact_proto_read_i64, 0); - rb_define_method(thrift_compact_protocol_class, "read_double", rb_thrift_compact_proto_read_double, 0); - rb_define_method(thrift_compact_protocol_class, "read_string", rb_thrift_compact_proto_read_string, 0); - - rb_define_method(thrift_compact_protocol_class, "read_message_end", rb_thrift_compact_proto_read_message_end, 0); - rb_define_method(thrift_compact_protocol_class, "read_struct_begin", rb_thrift_compact_proto_read_struct_begin, 0); - rb_define_method(thrift_compact_protocol_class, "read_struct_end", rb_thrift_compact_proto_read_struct_end, 0); - rb_define_method(thrift_compact_protocol_class, "read_field_end", rb_thrift_compact_proto_read_field_end, 0); - rb_define_method(thrift_compact_protocol_class, "read_map_end", rb_thrift_compact_proto_read_map_end, 0); - rb_define_method(thrift_compact_protocol_class, "read_list_end", rb_thrift_compact_proto_read_list_end, 0); - rb_define_method(thrift_compact_protocol_class, "read_set_end", rb_thrift_compact_proto_read_set_end, 0); -} - -void Init_compact_protocol() { - Init_constants(); - Init_rb_methods(); -} diff --git a/ext/compact_protocol.h b/ext/compact_protocol.h deleted file mode 100644 index 163915e..0000000 --- a/ext/compact_protocol.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -void Init_compact_protocol(); diff --git a/ext/constants.h b/ext/constants.h deleted file mode 100644 index 9ea00d2..0000000 --- a/ext/constants.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -extern int TTYPE_STOP; -extern int TTYPE_BOOL; -extern int TTYPE_BYTE; -extern int TTYPE_I16; -extern int TTYPE_I32; -extern int TTYPE_I64; -extern int TTYPE_DOUBLE; -extern int TTYPE_STRING; -extern int TTYPE_MAP; -extern int TTYPE_SET; -extern int TTYPE_LIST; -extern int TTYPE_STRUCT; - -extern ID validate_method_id; -extern ID write_struct_begin_method_id; -extern ID write_struct_end_method_id; -extern ID write_field_begin_method_id; -extern ID write_field_end_method_id; -extern ID write_boolean_method_id; -extern ID write_byte_method_id; -extern ID write_i16_method_id; -extern ID write_i32_method_id; -extern ID write_i64_method_id; -extern ID write_double_method_id; -extern ID write_string_method_id; -extern ID write_map_begin_method_id; -extern ID write_map_end_method_id; -extern ID write_list_begin_method_id; -extern ID write_list_end_method_id; -extern ID write_set_begin_method_id; -extern ID write_set_end_method_id; -extern ID size_method_id; -extern ID read_bool_method_id; -extern ID read_byte_method_id; -extern ID read_i16_method_id; -extern ID read_i32_method_id; -extern ID read_i64_method_id; -extern ID read_string_method_id; -extern ID read_double_method_id; -extern ID read_map_begin_method_id; -extern ID read_map_end_method_id; -extern ID read_list_begin_method_id; -extern ID read_list_end_method_id; -extern ID read_set_begin_method_id; -extern ID read_set_end_method_id; -extern ID read_struct_begin_method_id; -extern ID read_struct_end_method_id; -extern ID read_field_begin_method_id; -extern ID read_field_end_method_id; -extern ID keys_method_id; -extern ID entries_method_id; -extern ID name_method_id; -extern ID sort_method_id; -extern ID write_field_stop_method_id; -extern ID skip_method_id; -extern ID write_method_id; -extern ID read_all_method_id; -extern ID read_into_buffer_method_id; -extern ID native_qmark_method_id; - -extern ID fields_const_id; -extern ID transport_ivar_id; -extern ID strict_read_ivar_id; -extern ID strict_write_ivar_id; - -extern VALUE type_sym; -extern VALUE name_sym; -extern VALUE key_sym; -extern VALUE value_sym; -extern VALUE element_sym; -extern VALUE class_sym; - -extern VALUE rb_cSet; -extern VALUE thrift_module; -extern VALUE thrift_types_module; -extern VALUE class_thrift_protocol; -extern VALUE protocol_exception_class; diff --git a/ext/extconf.rb b/ext/extconf.rb deleted file mode 100644 index 36dac9b..0000000 --- a/ext/extconf.rb +++ /dev/null @@ -1,30 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -if defined?(RUBY_ENGINE) && RUBY_ENGINE =~ /jruby/ - File.open('Makefile', 'w'){|f| f.puts "all:\n\ninstall:\n" } -else - require 'mkmf' - - $CFLAGS = "-g -O2 -Wall -Werror" - - have_func("strlcpy", "string.h") - - create_makefile 'thrift_native' -end diff --git a/ext/macros.h b/ext/macros.h deleted file mode 100644 index 265f693..0000000 --- a/ext/macros.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#define GET_TRANSPORT(obj) rb_ivar_get(obj, transport_ivar_id) -#define GET_STRICT_READ(obj) rb_ivar_get(obj, strict_read_ivar_id) -#define GET_STRICT_WRITE(obj) rb_ivar_get(obj, strict_write_ivar_id) -#define WRITE(obj, data, length) rb_funcall(obj, write_method_id, 1, rb_str_new(data, length)) -#define CHECK_NIL(obj) if (NIL_P(obj)) { rb_raise(rb_eStandardError, "nil argument not allowed!");} -#define READ(obj, length) rb_funcall(GET_TRANSPORT(obj), read_all_method_id, 1, INT2FIX(length)) - -#ifndef RFLOAT_VALUE -# define RFLOAT_VALUE(v) RFLOAT(rb_Float(v))->value -#endif - -#ifndef RSTRING_LEN -# define RSTRING_LEN(v) RSTRING(rb_String(v))->len -#endif - -#ifndef RSTRING_PTR -# define RSTRING_PTR(v) RSTRING(rb_String(v))->ptr -#endif - -#ifndef RARRAY_LEN -# define RARRAY_LEN(v) RARRAY(rb_Array(v))->len -#endif diff --git a/ext/memory_buffer.c b/ext/memory_buffer.c deleted file mode 100644 index bd1bac8..0000000 --- a/ext/memory_buffer.c +++ /dev/null @@ -1,131 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#include <ruby.h> -#include <constants.h> -#include "macros.h" - -ID buf_ivar_id; -ID index_ivar_id; - -ID slice_method_id; - -int GARBAGE_BUFFER_SIZE; - -#define GET_BUF(self) rb_ivar_get(self, buf_ivar_id) - -VALUE rb_thrift_memory_buffer_write(VALUE self, VALUE str); -VALUE rb_thrift_memory_buffer_read(VALUE self, VALUE length_value); -VALUE rb_thrift_memory_buffer_read_byte(VALUE self); -VALUE rb_thrift_memory_buffer_read_into_buffer(VALUE self, VALUE buffer_value, VALUE size_value); - -VALUE rb_thrift_memory_buffer_write(VALUE self, VALUE str) { - VALUE buf = GET_BUF(self); - rb_str_buf_cat(buf, RSTRING_PTR(str), RSTRING_LEN(str)); - return Qnil; -} - -VALUE rb_thrift_memory_buffer_read(VALUE self, VALUE length_value) { - int length = FIX2INT(length_value); - - VALUE index_value = rb_ivar_get(self, index_ivar_id); - int index = FIX2INT(index_value); - - VALUE buf = GET_BUF(self); - VALUE data = rb_funcall(buf, slice_method_id, 2, index_value, length_value); - - index += length; - if (index > RSTRING_LEN(buf)) { - index = RSTRING_LEN(buf); - } - if (index >= GARBAGE_BUFFER_SIZE) { - rb_ivar_set(self, buf_ivar_id, rb_funcall(buf, slice_method_id, 2, INT2FIX(index), INT2FIX(RSTRING_LEN(buf) - 1))); - index = 0; - } - rb_ivar_set(self, index_ivar_id, INT2FIX(index)); - - if (RSTRING_LEN(data) < length) { - rb_raise(rb_eEOFError, "Not enough bytes remain in memory buffer"); - } - - return data; -} - -VALUE rb_thrift_memory_buffer_read_byte(VALUE self) { - VALUE index_value = rb_ivar_get(self, index_ivar_id); - int index = FIX2INT(index_value); - - VALUE buf = GET_BUF(self); - if (index >= RSTRING_LEN(buf)) { - rb_raise(rb_eEOFError, "Not enough bytes remain in memory buffer"); - } - char byte = RSTRING_PTR(buf)[index++]; - - if (index >= GARBAGE_BUFFER_SIZE) { - rb_ivar_set(self, buf_ivar_id, rb_funcall(buf, slice_method_id, 2, INT2FIX(index), INT2FIX(RSTRING_LEN(buf) - 1))); - index = 0; - } - rb_ivar_set(self, index_ivar_id, INT2FIX(index)); - - int result = (int) byte; - return INT2FIX(result); -} - -VALUE rb_thrift_memory_buffer_read_into_buffer(VALUE self, VALUE buffer_value, VALUE size_value) { - int i = 0; - int size = FIX2INT(size_value); - int index; - VALUE buf = GET_BUF(self); - - while (i < size) { - index = FIX2INT(rb_ivar_get(self, index_ivar_id)); - if (index >= RSTRING_LEN(buf)) { - rb_raise(rb_eEOFError, "Not enough bytes remain in memory buffer"); - } - char byte = RSTRING_PTR(buf)[index++]; - - if (index >= GARBAGE_BUFFER_SIZE) { - rb_ivar_set(self, buf_ivar_id, rb_funcall(buf, slice_method_id, 2, INT2FIX(index), INT2FIX(RSTRING_LEN(buf) - 1))); - index = 0; - } - rb_ivar_set(self, index_ivar_id, INT2FIX(index)); - - if (i >= RSTRING_LEN(buffer_value)) { - rb_raise(rb_eIndexError, "index %d out of string", i); - } - ((char*)RSTRING_PTR(buffer_value))[i] = byte; - i++; - } - return INT2FIX(i); -} - -void Init_memory_buffer() { - VALUE thrift_memory_buffer_class = rb_const_get(thrift_module, rb_intern("MemoryBufferTransport")); - rb_define_method(thrift_memory_buffer_class, "write", rb_thrift_memory_buffer_write, 1); - rb_define_method(thrift_memory_buffer_class, "read", rb_thrift_memory_buffer_read, 1); - rb_define_method(thrift_memory_buffer_class, "read_byte", rb_thrift_memory_buffer_read_byte, 0); - rb_define_method(thrift_memory_buffer_class, "read_into_buffer", rb_thrift_memory_buffer_read_into_buffer, 2); - - buf_ivar_id = rb_intern("@buf"); - index_ivar_id = rb_intern("@index"); - - slice_method_id = rb_intern("slice"); - - GARBAGE_BUFFER_SIZE = FIX2INT(rb_const_get(thrift_memory_buffer_class, rb_intern("GARBAGE_BUFFER_SIZE"))); -} diff --git a/ext/memory_buffer.h b/ext/memory_buffer.h deleted file mode 100644 index b277fa6..0000000 --- a/ext/memory_buffer.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -void Init_memory_buffer(); diff --git a/ext/protocol.c b/ext/protocol.c deleted file mode 100644 index c187654..0000000 --- a/ext/protocol.c +++ /dev/null @@ -1,185 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#include <ruby.h> -#include <protocol.h> -#include <stdbool.h> -#include <constants.h> -#include <struct.h> - -static VALUE skip(VALUE self, int ttype) { - if (ttype == TTYPE_STOP) { - return Qnil; - } else if (ttype == TTYPE_BOOL) { - rb_funcall(self, read_bool_method_id, 0); - } else if (ttype == TTYPE_BYTE) { - rb_funcall(self, read_byte_method_id, 0); - } else if (ttype == TTYPE_I16) { - rb_funcall(self, read_i16_method_id, 0); - } else if (ttype == TTYPE_I32) { - rb_funcall(self, read_i32_method_id, 0); - } else if (ttype == TTYPE_I64) { - rb_funcall(self, read_i64_method_id, 0); - } else if (ttype == TTYPE_DOUBLE) { - rb_funcall(self, read_double_method_id, 0); - } else if (ttype == TTYPE_STRING) { - rb_funcall(self, read_string_method_id, 0); - } else if (ttype == TTYPE_STRUCT) { - rb_funcall(self, read_struct_begin_method_id, 0); - while (true) { - VALUE field_header = rb_funcall(self, read_field_begin_method_id, 0); - if (NIL_P(field_header) || FIX2INT(rb_ary_entry(field_header, 1)) == TTYPE_STOP ) { - break; - } - skip(self, FIX2INT(rb_ary_entry(field_header, 1))); - rb_funcall(self, read_field_end_method_id, 0); - } - rb_funcall(self, read_struct_end_method_id, 0); - } else if (ttype == TTYPE_MAP) { - int i; - VALUE map_header = rb_funcall(self, read_map_begin_method_id, 0); - int ktype = FIX2INT(rb_ary_entry(map_header, 0)); - int vtype = FIX2INT(rb_ary_entry(map_header, 1)); - int size = FIX2INT(rb_ary_entry(map_header, 2)); - - for (i = 0; i < size; i++) { - skip(self, ktype); - skip(self, vtype); - } - rb_funcall(self, read_map_end_method_id, 0); - } else if (ttype == TTYPE_LIST || ttype == TTYPE_SET) { - int i; - VALUE collection_header = rb_funcall(self, ttype == TTYPE_LIST ? read_list_begin_method_id : read_set_begin_method_id, 0); - int etype = FIX2INT(rb_ary_entry(collection_header, 0)); - int size = FIX2INT(rb_ary_entry(collection_header, 1)); - for (i = 0; i < size; i++) { - skip(self, etype); - } - rb_funcall(self, ttype == TTYPE_LIST ? read_list_end_method_id : read_set_end_method_id, 0); - } else { - rb_raise(rb_eNotImpError, "don't know how to skip type %d", ttype); - } - - return Qnil; -} - -VALUE rb_thrift_protocol_native_qmark(VALUE self) { - return Qfalse; -} - -VALUE rb_thrift_protocol_skip(VALUE protocol, VALUE ttype) { - return skip(protocol, FIX2INT(ttype)); -} - -VALUE rb_thrift_write_message_end(VALUE self) { - return Qnil; -} - -VALUE rb_thrift_write_struct_begin(VALUE self, VALUE name) { - return Qnil; -} - -VALUE rb_thrift_write_struct_end(VALUE self) { - return Qnil; -} - -VALUE rb_thrift_write_field_end(VALUE self) { - return Qnil; -} - -VALUE rb_thrift_write_map_end(VALUE self) { - return Qnil; -} - -VALUE rb_thrift_write_list_end(VALUE self) { - return Qnil; -} - -VALUE rb_thrift_write_set_end(VALUE self) { - return Qnil; -} - -VALUE rb_thrift_read_message_end(VALUE self) { - return Qnil; -} - -VALUE rb_thift_read_struct_begin(VALUE self) { - return Qnil; -} - -VALUE rb_thift_read_struct_end(VALUE self) { - return Qnil; -} - -VALUE rb_thift_read_field_end(VALUE self) { - return Qnil; -} - -VALUE rb_thift_read_map_end(VALUE self) { - return Qnil; -} - -VALUE rb_thift_read_list_end(VALUE self) { - return Qnil; -} - -VALUE rb_thift_read_set_end(VALUE self) { - return Qnil; -} - -void Init_protocol() { - VALUE c_protocol = rb_const_get(thrift_module, rb_intern("BaseProtocol")); - - rb_define_method(c_protocol, "skip", rb_thrift_protocol_skip, 1); - rb_define_method(c_protocol, "write_message_end", rb_thrift_write_message_end, 0); - rb_define_method(c_protocol, "write_struct_begin", rb_thrift_write_struct_begin, 1); - rb_define_method(c_protocol, "write_struct_end", rb_thrift_write_struct_end, 0); - rb_define_method(c_protocol, "write_field_end", rb_thrift_write_field_end, 0); - rb_define_method(c_protocol, "write_map_end", rb_thrift_write_map_end, 0); - rb_define_method(c_protocol, "write_list_end", rb_thrift_write_list_end, 0); - rb_define_method(c_protocol, "write_set_end", rb_thrift_write_set_end, 0); - rb_define_method(c_protocol, "read_message_end", rb_thrift_read_message_end, 0); - rb_define_method(c_protocol, "read_struct_begin", rb_thift_read_struct_begin, 0); - rb_define_method(c_protocol, "read_struct_end", rb_thift_read_struct_end, 0); - rb_define_method(c_protocol, "read_field_end", rb_thift_read_field_end, 0); - rb_define_method(c_protocol, "read_map_end", rb_thift_read_map_end, 0); - rb_define_method(c_protocol, "read_list_end", rb_thift_read_list_end, 0); - rb_define_method(c_protocol, "read_set_end", rb_thift_read_set_end, 0); - rb_define_method(c_protocol, "native?", rb_thrift_protocol_native_qmark, 0); - - // native_proto_method_table *npmt; - // npmt = ALLOC(native_proto_method_table); - // npmt->write_message_end = rb_thrift_write_message_end; - // npmt->write_struct_begin = rb_thrift_write_struct_begin; - // npmt->write_struct_end = rb_thrift_write_struct_end; - // npmt->write_field_end = rb_thrift_write_field_end; - // npmt->write_map_end = rb_thrift_write_map_end; - // npmt->write_list_end = rb_thrift_write_list_end; - // npmt->write_set_end = rb_thrift_write_set_end; - // npmt->read_message_end = rb_thrift_read_message_end; - // npmt->read_struct_begin = rb_thift_read_struct_begin; - // npmt->read_struct_end = rb_thift_read_struct_end; - // npmt->read_field_end = rb_thift_read_field_end; - // npmt->read_map_end = rb_thift_read_map_end; - // npmt->read_list_end = rb_thift_read_list_end; - // npmt->read_set_end = rb_thift_read_set_end; - // - // VALUE method_table_object = Data_Wrap_Struct(rb_cObject, 0, free, npmt); - // rb_const_set(c_protocol, rb_intern("@native_method_table"), method_table_object); -} diff --git a/ext/protocol.h b/ext/protocol.h deleted file mode 100644 index 5369530..0000000 --- a/ext/protocol.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -void Init_protocol(); diff --git a/ext/strlcpy.c b/ext/strlcpy.c deleted file mode 100644 index 6700ff2..0000000 --- a/ext/strlcpy.c +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#include "strlcpy.h" - -#ifndef HAVE_STRLCPY -#define HAVE_STRLCPY -size_t -strlcpy (char *dst, const char *src, size_t dst_sz) -{ - size_t n; - - for (n = 0; n < dst_sz; n++) { - if ((*dst++ = *src++) == '\0') - break; - } - - if (n < dst_sz) - return n; - if (n > 0) - *(dst - 1) = '\0'; - return n + strlen (src); -} -#endif - diff --git a/ext/strlcpy.h b/ext/strlcpy.h deleted file mode 100644 index c6f508f..0000000 --- a/ext/strlcpy.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - - -#include <sys/types.h> -#include <string.h> - -#ifndef HAVE_STRLCPY -size_t -strlcpy (char *dst, const char *src, size_t dst_sz); -#else -extern size_t strlcpy(char *, const char *, size_t); -#endif - diff --git a/ext/struct.c b/ext/struct.c deleted file mode 100644 index 5a9a679..0000000 --- a/ext/struct.c +++ /dev/null @@ -1,691 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#include "struct.h" -#include "constants.h" -#include "macros.h" -#include "strlcpy.h" - -VALUE thrift_union_class; - -ID setfield_id; -ID setvalue_id; - -ID to_s_method_id; -ID name_to_id_method_id; -static ID sorted_field_ids_method_id; - -#define IS_CONTAINER(ttype) ((ttype) == TTYPE_MAP || (ttype) == TTYPE_LIST || (ttype) == TTYPE_SET) -#define STRUCT_FIELDS(obj) rb_const_get(CLASS_OF(obj), fields_const_id) - -//------------------------------------------- -// Writing section -//------------------------------------------- - -// default fn pointers for protocol stuff here - -VALUE default_write_bool(VALUE protocol, VALUE value) { - rb_funcall(protocol, write_boolean_method_id, 1, value); - return Qnil; -} - -VALUE default_write_byte(VALUE protocol, VALUE value) { - rb_funcall(protocol, write_byte_method_id, 1, value); - return Qnil; -} - -VALUE default_write_i16(VALUE protocol, VALUE value) { - rb_funcall(protocol, write_i16_method_id, 1, value); - return Qnil; -} - -VALUE default_write_i32(VALUE protocol, VALUE value) { - rb_funcall(protocol, write_i32_method_id, 1, value); - return Qnil; -} - -VALUE default_write_i64(VALUE protocol, VALUE value) { - rb_funcall(protocol, write_i64_method_id, 1, value); - return Qnil; -} - -VALUE default_write_double(VALUE protocol, VALUE value) { - rb_funcall(protocol, write_double_method_id, 1, value); - return Qnil; -} - -VALUE default_write_string(VALUE protocol, VALUE value) { - rb_funcall(protocol, write_string_method_id, 1, value); - return Qnil; -} - -VALUE default_write_list_begin(VALUE protocol, VALUE etype, VALUE length) { - rb_funcall(protocol, write_list_begin_method_id, 2, etype, length); - return Qnil; -} - -VALUE default_write_list_end(VALUE protocol) { - rb_funcall(protocol, write_list_end_method_id, 0); - return Qnil; -} - -VALUE default_write_set_begin(VALUE protocol, VALUE etype, VALUE length) { - rb_funcall(protocol, write_set_begin_method_id, 2, etype, length); - return Qnil; -} - -VALUE default_write_set_end(VALUE protocol) { - rb_funcall(protocol, write_set_end_method_id, 0); - return Qnil; -} - -VALUE default_write_map_begin(VALUE protocol, VALUE ktype, VALUE vtype, VALUE length) { - rb_funcall(protocol, write_map_begin_method_id, 3, ktype, vtype, length); - return Qnil; -} - -VALUE default_write_map_end(VALUE protocol) { - rb_funcall(protocol, write_map_end_method_id, 0); - return Qnil; -} - -VALUE default_write_struct_begin(VALUE protocol, VALUE struct_name) { - rb_funcall(protocol, write_struct_begin_method_id, 1, struct_name); - return Qnil; -} - -VALUE default_write_struct_end(VALUE protocol) { - rb_funcall(protocol, write_struct_end_method_id, 0); - return Qnil; -} - -VALUE default_write_field_begin(VALUE protocol, VALUE name, VALUE type, VALUE id) { - rb_funcall(protocol, write_field_begin_method_id, 3, name, type, id); - return Qnil; -} - -VALUE default_write_field_end(VALUE protocol) { - rb_funcall(protocol, write_field_end_method_id, 0); - return Qnil; -} - -VALUE default_write_field_stop(VALUE protocol) { - rb_funcall(protocol, write_field_stop_method_id, 0); - return Qnil; -} - -VALUE default_read_field_begin(VALUE protocol) { - return rb_funcall(protocol, read_field_begin_method_id, 0); -} - -VALUE default_read_field_end(VALUE protocol) { - return rb_funcall(protocol, read_field_end_method_id, 0); -} - -VALUE default_read_map_begin(VALUE protocol) { - return rb_funcall(protocol, read_map_begin_method_id, 0); -} - -VALUE default_read_map_end(VALUE protocol) { - return rb_funcall(protocol, read_map_end_method_id, 0); -} - -VALUE default_read_list_begin(VALUE protocol) { - return rb_funcall(protocol, read_list_begin_method_id, 0); -} - -VALUE default_read_list_end(VALUE protocol) { - return rb_funcall(protocol, read_list_end_method_id, 0); -} - -VALUE default_read_set_begin(VALUE protocol) { - return rb_funcall(protocol, read_set_begin_method_id, 0); -} - -VALUE default_read_set_end(VALUE protocol) { - return rb_funcall(protocol, read_set_end_method_id, 0); -} - -VALUE default_read_byte(VALUE protocol) { - return rb_funcall(protocol, read_byte_method_id, 0); -} - -VALUE default_read_bool(VALUE protocol) { - return rb_funcall(protocol, read_bool_method_id, 0); -} - -VALUE default_read_i16(VALUE protocol) { - return rb_funcall(protocol, read_i16_method_id, 0); -} - -VALUE default_read_i32(VALUE protocol) { - return rb_funcall(protocol, read_i32_method_id, 0); -} - -VALUE default_read_i64(VALUE protocol) { - return rb_funcall(protocol, read_i64_method_id, 0); -} - -VALUE default_read_double(VALUE protocol) { - return rb_funcall(protocol, read_double_method_id, 0); -} - -VALUE default_read_string(VALUE protocol) { - return rb_funcall(protocol, read_string_method_id, 0); -} - -VALUE default_read_struct_begin(VALUE protocol) { - return rb_funcall(protocol, read_struct_begin_method_id, 0); -} - -VALUE default_read_struct_end(VALUE protocol) { - return rb_funcall(protocol, read_struct_end_method_id, 0); -} - -// end default protocol methods - -static VALUE rb_thrift_union_write (VALUE self, VALUE protocol); -static VALUE rb_thrift_struct_write(VALUE self, VALUE protocol); -static void write_anything(int ttype, VALUE value, VALUE protocol, VALUE field_info); - -VALUE get_field_value(VALUE obj, VALUE field_name) { - char name_buf[RSTRING_LEN(field_name) + 2]; - - name_buf[0] = '@'; - strlcpy(&name_buf[1], RSTRING_PTR(field_name), RSTRING_LEN(field_name) + 1); - - VALUE value = rb_ivar_get(obj, rb_intern(name_buf)); - - return value; -} - -static void write_container(int ttype, VALUE field_info, VALUE value, VALUE protocol) { - int sz, i; - - if (ttype == TTYPE_MAP) { - VALUE keys; - VALUE key; - VALUE val; - - Check_Type(value, T_HASH); - - VALUE key_info = rb_hash_aref(field_info, key_sym); - VALUE keytype_value = rb_hash_aref(key_info, type_sym); - int keytype = FIX2INT(keytype_value); - - VALUE value_info = rb_hash_aref(field_info, value_sym); - VALUE valuetype_value = rb_hash_aref(value_info, type_sym); - int valuetype = FIX2INT(valuetype_value); - - keys = rb_funcall(value, keys_method_id, 0); - - sz = RARRAY_LEN(keys); - - default_write_map_begin(protocol, keytype_value, valuetype_value, INT2FIX(sz)); - - for (i = 0; i < sz; i++) { - key = rb_ary_entry(keys, i); - val = rb_hash_aref(value, key); - - if (IS_CONTAINER(keytype)) { - write_container(keytype, key_info, key, protocol); - } else { - write_anything(keytype, key, protocol, key_info); - } - - if (IS_CONTAINER(valuetype)) { - write_container(valuetype, value_info, val, protocol); - } else { - write_anything(valuetype, val, protocol, value_info); - } - } - - default_write_map_end(protocol); - } else if (ttype == TTYPE_LIST) { - Check_Type(value, T_ARRAY); - - sz = RARRAY_LEN(value); - - VALUE element_type_info = rb_hash_aref(field_info, element_sym); - VALUE element_type_value = rb_hash_aref(element_type_info, type_sym); - int element_type = FIX2INT(element_type_value); - - default_write_list_begin(protocol, element_type_value, INT2FIX(sz)); - for (i = 0; i < sz; ++i) { - VALUE val = rb_ary_entry(value, i); - if (IS_CONTAINER(element_type)) { - write_container(element_type, element_type_info, val, protocol); - } else { - write_anything(element_type, val, protocol, element_type_info); - } - } - default_write_list_end(protocol); - } else if (ttype == TTYPE_SET) { - VALUE items; - - if (TYPE(value) == T_ARRAY) { - items = value; - } else { - if (rb_cSet == CLASS_OF(value)) { - items = rb_funcall(value, entries_method_id, 0); - } else { - Check_Type(value, T_HASH); - items = rb_funcall(value, keys_method_id, 0); - } - } - - sz = RARRAY_LEN(items); - - VALUE element_type_info = rb_hash_aref(field_info, element_sym); - VALUE element_type_value = rb_hash_aref(element_type_info, type_sym); - int element_type = FIX2INT(element_type_value); - - default_write_set_begin(protocol, element_type_value, INT2FIX(sz)); - - for (i = 0; i < sz; i++) { - VALUE val = rb_ary_entry(items, i); - if (IS_CONTAINER(element_type)) { - write_container(element_type, element_type_info, val, protocol); - } else { - write_anything(element_type, val, protocol, element_type_info); - } - } - - default_write_set_end(protocol); - } else { - rb_raise(rb_eNotImpError, "can't write container of type: %d", ttype); - } -} - -static void write_anything(int ttype, VALUE value, VALUE protocol, VALUE field_info) { - if (ttype == TTYPE_BOOL) { - default_write_bool(protocol, value); - } else if (ttype == TTYPE_BYTE) { - default_write_byte(protocol, value); - } else if (ttype == TTYPE_I16) { - default_write_i16(protocol, value); - } else if (ttype == TTYPE_I32) { - default_write_i32(protocol, value); - } else if (ttype == TTYPE_I64) { - default_write_i64(protocol, value); - } else if (ttype == TTYPE_DOUBLE) { - default_write_double(protocol, value); - } else if (ttype == TTYPE_STRING) { - default_write_string(protocol, value); - } else if (IS_CONTAINER(ttype)) { - write_container(ttype, field_info, value, protocol); - } else if (ttype == TTYPE_STRUCT) { - if (rb_obj_is_kind_of(value, thrift_union_class)) { - rb_thrift_union_write(value, protocol); - } else { - rb_thrift_struct_write(value, protocol); - } - } else { - rb_raise(rb_eNotImpError, "Unknown type for binary_encoding: %d", ttype); - } -} - -static VALUE rb_thrift_struct_write(VALUE self, VALUE protocol) { - // call validate - rb_funcall(self, validate_method_id, 0); - - // write struct begin - default_write_struct_begin(protocol, rb_class_name(CLASS_OF(self))); - - // iterate through all the fields here - VALUE struct_fields = STRUCT_FIELDS(self); - VALUE sorted_field_ids = rb_funcall(self, sorted_field_ids_method_id, 0); - - int i = 0; - for (i=0; i < RARRAY_LEN(sorted_field_ids); i++) { - VALUE field_id = rb_ary_entry(sorted_field_ids, i); - - VALUE field_info = rb_hash_aref(struct_fields, field_id); - - VALUE ttype_value = rb_hash_aref(field_info, type_sym); - int ttype = FIX2INT(ttype_value); - VALUE field_name = rb_hash_aref(field_info, name_sym); - - VALUE field_value = get_field_value(self, field_name); - - if (!NIL_P(field_value)) { - default_write_field_begin(protocol, field_name, ttype_value, field_id); - - write_anything(ttype, field_value, protocol, field_info); - - default_write_field_end(protocol); - } - } - - default_write_field_stop(protocol); - - // write struct end - default_write_struct_end(protocol); - - return Qnil; -} - -//------------------------------------------- -// Reading section -//------------------------------------------- - -static VALUE rb_thrift_union_read(VALUE self, VALUE protocol); -static VALUE rb_thrift_struct_read(VALUE self, VALUE protocol); -static void skip_map_contents(VALUE protocol, VALUE key_type_value, VALUE value_type_value, int size); -static void skip_list_or_set_contents(VALUE protocol, VALUE element_type_value, int size); - -static void set_field_value(VALUE obj, VALUE field_name, VALUE value) { - char name_buf[RSTRING_LEN(field_name) + 2]; - - name_buf[0] = '@'; - strlcpy(&name_buf[1], RSTRING_PTR(field_name), RSTRING_LEN(field_name)+1); - - rb_ivar_set(obj, rb_intern(name_buf), value); -} - -// Helper method to skip the contents of a map (assumes the map header has been read). -static void skip_map_contents(VALUE protocol, VALUE key_type_value, VALUE value_type_value, int size) { - int i; - for (i = 0; i < size; i++) { - rb_funcall(protocol, skip_method_id, 1, key_type_value); - rb_funcall(protocol, skip_method_id, 1, value_type_value); - } -} - -// Helper method to skip the contents of a list or set (assumes the list/set header has been read). -static void skip_list_or_set_contents(VALUE protocol, VALUE element_type_value, int size) { - int i; - for (i = 0; i < size; i++) { - rb_funcall(protocol, skip_method_id, 1, element_type_value); - } -} - -static VALUE read_anything(VALUE protocol, int ttype, VALUE field_info) { - VALUE result = Qnil; - - if (ttype == TTYPE_BOOL) { - result = default_read_bool(protocol); - } else if (ttype == TTYPE_BYTE) { - result = default_read_byte(protocol); - } else if (ttype == TTYPE_I16) { - result = default_read_i16(protocol); - } else if (ttype == TTYPE_I32) { - result = default_read_i32(protocol); - } else if (ttype == TTYPE_I64) { - result = default_read_i64(protocol); - } else if (ttype == TTYPE_STRING) { - result = default_read_string(protocol); - } else if (ttype == TTYPE_DOUBLE) { - result = default_read_double(protocol); - } else if (ttype == TTYPE_STRUCT) { - VALUE klass = rb_hash_aref(field_info, class_sym); - result = rb_class_new_instance(0, NULL, klass); - - if (rb_obj_is_kind_of(result, thrift_union_class)) { - rb_thrift_union_read(result, protocol); - } else { - rb_thrift_struct_read(result, protocol); - } - } else if (ttype == TTYPE_MAP) { - int i; - - VALUE map_header = default_read_map_begin(protocol); - int key_ttype = FIX2INT(rb_ary_entry(map_header, 0)); - int value_ttype = FIX2INT(rb_ary_entry(map_header, 1)); - int num_entries = FIX2INT(rb_ary_entry(map_header, 2)); - - // Check the declared key and value types against the expected ones and skip the map contents - // if the types don't match. - VALUE key_info = rb_hash_aref(field_info, key_sym); - VALUE value_info = rb_hash_aref(field_info, value_sym); - - if (!NIL_P(key_info) && !NIL_P(value_info)) { - int specified_key_type = FIX2INT(rb_hash_aref(key_info, type_sym)); - int specified_value_type = FIX2INT(rb_hash_aref(value_info, type_sym)); - if (num_entries == 0 || (specified_key_type == key_ttype && specified_value_type == value_ttype)) { - result = rb_hash_new(); - - for (i = 0; i < num_entries; ++i) { - VALUE key, val; - - key = read_anything(protocol, key_ttype, key_info); - val = read_anything(protocol, value_ttype, value_info); - - rb_hash_aset(result, key, val); - } - } else { - skip_map_contents(protocol, INT2FIX(key_ttype), INT2FIX(value_ttype), num_entries); - } - } else { - skip_map_contents(protocol, INT2FIX(key_ttype), INT2FIX(value_ttype), num_entries); - } - - default_read_map_end(protocol); - } else if (ttype == TTYPE_LIST) { - int i; - - VALUE list_header = default_read_list_begin(protocol); - int element_ttype = FIX2INT(rb_ary_entry(list_header, 0)); - int num_elements = FIX2INT(rb_ary_entry(list_header, 1)); - - // Check the declared element type against the expected one and skip the list contents - // if the types don't match. - VALUE element_info = rb_hash_aref(field_info, element_sym); - if (!NIL_P(element_info)) { - int specified_element_type = FIX2INT(rb_hash_aref(element_info, type_sym)); - if (specified_element_type == element_ttype) { - result = rb_ary_new2(num_elements); - - for (i = 0; i < num_elements; ++i) { - rb_ary_push(result, read_anything(protocol, element_ttype, rb_hash_aref(field_info, element_sym))); - } - } else { - skip_list_or_set_contents(protocol, INT2FIX(element_ttype), num_elements); - } - } else { - skip_list_or_set_contents(protocol, INT2FIX(element_ttype), num_elements); - } - - default_read_list_end(protocol); - } else if (ttype == TTYPE_SET) { - VALUE items; - int i; - - VALUE set_header = default_read_set_begin(protocol); - int element_ttype = FIX2INT(rb_ary_entry(set_header, 0)); - int num_elements = FIX2INT(rb_ary_entry(set_header, 1)); - - // Check the declared element type against the expected one and skip the set contents - // if the types don't match. - VALUE element_info = rb_hash_aref(field_info, element_sym); - if (!NIL_P(element_info)) { - int specified_element_type = FIX2INT(rb_hash_aref(element_info, type_sym)); - if (specified_element_type == element_ttype) { - items = rb_ary_new2(num_elements); - - for (i = 0; i < num_elements; ++i) { - rb_ary_push(items, read_anything(protocol, element_ttype, rb_hash_aref(field_info, element_sym))); - } - - result = rb_class_new_instance(1, &items, rb_cSet); - } else { - skip_list_or_set_contents(protocol, INT2FIX(element_ttype), num_elements); - } - } else { - skip_list_or_set_contents(protocol, INT2FIX(element_ttype), num_elements); - } - - default_read_set_end(protocol); - } else { - rb_raise(rb_eNotImpError, "read_anything not implemented for type %d!", ttype); - } - - return result; -} - -static VALUE rb_thrift_struct_read(VALUE self, VALUE protocol) { - // read struct begin - default_read_struct_begin(protocol); - - VALUE struct_fields = STRUCT_FIELDS(self); - - // read each field - while (true) { - VALUE field_header = default_read_field_begin(protocol); - VALUE field_type_value = rb_ary_entry(field_header, 1); - int field_type = FIX2INT(field_type_value); - - if (field_type == TTYPE_STOP) { - break; - } - - // make sure we got a type we expected - VALUE field_info = rb_hash_aref(struct_fields, rb_ary_entry(field_header, 2)); - - if (!NIL_P(field_info)) { - int specified_type = FIX2INT(rb_hash_aref(field_info, type_sym)); - if (field_type == specified_type) { - // read the value - VALUE name = rb_hash_aref(field_info, name_sym); - set_field_value(self, name, read_anything(protocol, field_type, field_info)); - } else { - rb_funcall(protocol, skip_method_id, 1, field_type_value); - } - } else { - rb_funcall(protocol, skip_method_id, 1, field_type_value); - } - - // read field end - default_read_field_end(protocol); - } - - // read struct end - default_read_struct_end(protocol); - - // call validate - rb_funcall(self, validate_method_id, 0); - - return Qnil; -} - - -// -------------------------------- -// Union section -// -------------------------------- - -static VALUE rb_thrift_union_read(VALUE self, VALUE protocol) { - // read struct begin - default_read_struct_begin(protocol); - - VALUE struct_fields = STRUCT_FIELDS(self); - - VALUE field_header = default_read_field_begin(protocol); - VALUE field_type_value = rb_ary_entry(field_header, 1); - int field_type = FIX2INT(field_type_value); - - // make sure we got a type we expected - VALUE field_info = rb_hash_aref(struct_fields, rb_ary_entry(field_header, 2)); - - if (!NIL_P(field_info)) { - int specified_type = FIX2INT(rb_hash_aref(field_info, type_sym)); - if (field_type == specified_type) { - // read the value - VALUE name = rb_hash_aref(field_info, name_sym); - rb_iv_set(self, "@setfield", ID2SYM(rb_intern(RSTRING_PTR(name)))); - rb_iv_set(self, "@value", read_anything(protocol, field_type, field_info)); - } else { - rb_funcall(protocol, skip_method_id, 1, field_type_value); - } - } else { - rb_funcall(protocol, skip_method_id, 1, field_type_value); - } - - // read field end - default_read_field_end(protocol); - - field_header = default_read_field_begin(protocol); - field_type_value = rb_ary_entry(field_header, 1); - field_type = FIX2INT(field_type_value); - - if (field_type != TTYPE_STOP) { - rb_raise(rb_eRuntimeError, "too many fields in union!"); - } - - // read field end - default_read_field_end(protocol); - - // read struct end - default_read_struct_end(protocol); - - // call validate - rb_funcall(self, validate_method_id, 0); - - return Qnil; -} - -static VALUE rb_thrift_union_write(VALUE self, VALUE protocol) { - // call validate - rb_funcall(self, validate_method_id, 0); - - // write struct begin - default_write_struct_begin(protocol, rb_class_name(CLASS_OF(self))); - - VALUE struct_fields = STRUCT_FIELDS(self); - - VALUE setfield = rb_ivar_get(self, setfield_id); - VALUE setvalue = rb_ivar_get(self, setvalue_id); - VALUE field_id = rb_funcall(self, name_to_id_method_id, 1, rb_funcall(setfield, to_s_method_id, 0)); - - VALUE field_info = rb_hash_aref(struct_fields, field_id); - - VALUE ttype_value = rb_hash_aref(field_info, type_sym); - int ttype = FIX2INT(ttype_value); - - default_write_field_begin(protocol, setfield, ttype_value, field_id); - - write_anything(ttype, setvalue, protocol, field_info); - - default_write_field_end(protocol); - - default_write_field_stop(protocol); - - // write struct end - default_write_struct_end(protocol); - - return Qnil; -} - -void Init_struct() { - VALUE struct_module = rb_const_get(thrift_module, rb_intern("Struct")); - - rb_define_method(struct_module, "write", rb_thrift_struct_write, 1); - rb_define_method(struct_module, "read", rb_thrift_struct_read, 1); - - thrift_union_class = rb_const_get(thrift_module, rb_intern("Union")); - - rb_define_method(thrift_union_class, "write", rb_thrift_union_write, 1); - rb_define_method(thrift_union_class, "read", rb_thrift_union_read, 1); - - setfield_id = rb_intern("@setfield"); - setvalue_id = rb_intern("@value"); - - to_s_method_id = rb_intern("to_s"); - name_to_id_method_id = rb_intern("name_to_id"); - sorted_field_ids_method_id = rb_intern("sorted_field_ids"); -} diff --git a/ext/struct.h b/ext/struct.h deleted file mode 100644 index 4748be5..0000000 --- a/ext/struct.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - - -#include <stdbool.h> -#include <ruby.h> - -void Init_struct(); -void Init_union(); diff --git a/ext/thrift_native.c b/ext/thrift_native.c deleted file mode 100644 index 2f6bb1a..0000000 --- a/ext/thrift_native.c +++ /dev/null @@ -1,196 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#include <ruby.h> -#include <struct.h> -#include <binary_protocol_accelerated.h> -#include <compact_protocol.h> -#include <protocol.h> -#include <memory_buffer.h> - -// cached classes/modules -VALUE rb_cSet; -VALUE thrift_module; -VALUE thrift_types_module; - -// TType constants -int TTYPE_STOP; -int TTYPE_BOOL; -int TTYPE_BYTE; -int TTYPE_I16; -int TTYPE_I32; -int TTYPE_I64; -int TTYPE_DOUBLE; -int TTYPE_STRING; -int TTYPE_MAP; -int TTYPE_SET; -int TTYPE_LIST; -int TTYPE_STRUCT; - -// method ids -ID validate_method_id; -ID write_struct_begin_method_id; -ID write_struct_end_method_id; -ID write_field_begin_method_id; -ID write_field_end_method_id; -ID write_boolean_method_id; -ID write_byte_method_id; -ID write_i16_method_id; -ID write_i32_method_id; -ID write_i64_method_id; -ID write_double_method_id; -ID write_string_method_id; -ID write_map_begin_method_id; -ID write_map_end_method_id; -ID write_list_begin_method_id; -ID write_list_end_method_id; -ID write_set_begin_method_id; -ID write_set_end_method_id; -ID size_method_id; -ID read_bool_method_id; -ID read_byte_method_id; -ID read_i16_method_id; -ID read_i32_method_id; -ID read_i64_method_id; -ID read_string_method_id; -ID read_double_method_id; -ID read_map_begin_method_id; -ID read_map_end_method_id; -ID read_list_begin_method_id; -ID read_list_end_method_id; -ID read_set_begin_method_id; -ID read_set_end_method_id; -ID read_struct_begin_method_id; -ID read_struct_end_method_id; -ID read_field_begin_method_id; -ID read_field_end_method_id; -ID keys_method_id; -ID entries_method_id; -ID name_method_id; -ID sort_method_id; -ID write_field_stop_method_id; -ID skip_method_id; -ID write_method_id; -ID read_all_method_id; -ID read_into_buffer_method_id; -ID native_qmark_method_id; - -// constant ids -ID fields_const_id; -ID transport_ivar_id; -ID strict_read_ivar_id; -ID strict_write_ivar_id; - -// cached symbols -VALUE type_sym; -VALUE name_sym; -VALUE key_sym; -VALUE value_sym; -VALUE element_sym; -VALUE class_sym; -VALUE protocol_exception_class; - -void Init_thrift_native() { - // cached classes - thrift_module = rb_const_get(rb_cObject, rb_intern("Thrift")); - thrift_types_module = rb_const_get(thrift_module, rb_intern("Types")); - rb_cSet = rb_const_get(rb_cObject, rb_intern("Set")); - protocol_exception_class = rb_const_get(thrift_module, rb_intern("ProtocolException")); - - // Init ttype constants - TTYPE_BOOL = FIX2INT(rb_const_get(thrift_types_module, rb_intern("BOOL"))); - TTYPE_BYTE = FIX2INT(rb_const_get(thrift_types_module, rb_intern("BYTE"))); - TTYPE_I16 = FIX2INT(rb_const_get(thrift_types_module, rb_intern("I16"))); - TTYPE_I32 = FIX2INT(rb_const_get(thrift_types_module, rb_intern("I32"))); - TTYPE_I64 = FIX2INT(rb_const_get(thrift_types_module, rb_intern("I64"))); - TTYPE_DOUBLE = FIX2INT(rb_const_get(thrift_types_module, rb_intern("DOUBLE"))); - TTYPE_STRING = FIX2INT(rb_const_get(thrift_types_module, rb_intern("STRING"))); - TTYPE_MAP = FIX2INT(rb_const_get(thrift_types_module, rb_intern("MAP"))); - TTYPE_SET = FIX2INT(rb_const_get(thrift_types_module, rb_intern("SET"))); - TTYPE_LIST = FIX2INT(rb_const_get(thrift_types_module, rb_intern("LIST"))); - TTYPE_STRUCT = FIX2INT(rb_const_get(thrift_types_module, rb_intern("STRUCT"))); - - // method ids - validate_method_id = rb_intern("validate"); - write_struct_begin_method_id = rb_intern("write_struct_begin"); - write_struct_end_method_id = rb_intern("write_struct_end"); - write_field_begin_method_id = rb_intern("write_field_begin"); - write_field_end_method_id = rb_intern("write_field_end"); - write_boolean_method_id = rb_intern("write_bool"); - write_byte_method_id = rb_intern("write_byte"); - write_i16_method_id = rb_intern("write_i16"); - write_i32_method_id = rb_intern("write_i32"); - write_i64_method_id = rb_intern("write_i64"); - write_double_method_id = rb_intern("write_double"); - write_string_method_id = rb_intern("write_string"); - write_map_begin_method_id = rb_intern("write_map_begin"); - write_map_end_method_id = rb_intern("write_map_end"); - write_list_begin_method_id = rb_intern("write_list_begin"); - write_list_end_method_id = rb_intern("write_list_end"); - write_set_begin_method_id = rb_intern("write_set_begin"); - write_set_end_method_id = rb_intern("write_set_end"); - size_method_id = rb_intern("size"); - read_bool_method_id = rb_intern("read_bool"); - read_byte_method_id = rb_intern("read_byte"); - read_i16_method_id = rb_intern("read_i16"); - read_i32_method_id = rb_intern("read_i32"); - read_i64_method_id = rb_intern("read_i64"); - read_string_method_id = rb_intern("read_string"); - read_double_method_id = rb_intern("read_double"); - read_map_begin_method_id = rb_intern("read_map_begin"); - read_map_end_method_id = rb_intern("read_map_end"); - read_list_begin_method_id = rb_intern("read_list_begin"); - read_list_end_method_id = rb_intern("read_list_end"); - read_set_begin_method_id = rb_intern("read_set_begin"); - read_set_end_method_id = rb_intern("read_set_end"); - read_struct_begin_method_id = rb_intern("read_struct_begin"); - read_struct_end_method_id = rb_intern("read_struct_end"); - read_field_begin_method_id = rb_intern("read_field_begin"); - read_field_end_method_id = rb_intern("read_field_end"); - keys_method_id = rb_intern("keys"); - entries_method_id = rb_intern("entries"); - name_method_id = rb_intern("name"); - sort_method_id = rb_intern("sort"); - write_field_stop_method_id = rb_intern("write_field_stop"); - skip_method_id = rb_intern("skip"); - write_method_id = rb_intern("write"); - read_all_method_id = rb_intern("read_all"); - read_into_buffer_method_id = rb_intern("read_into_buffer"); - native_qmark_method_id = rb_intern("native?"); - - // constant ids - fields_const_id = rb_intern("FIELDS"); - transport_ivar_id = rb_intern("@trans"); - strict_read_ivar_id = rb_intern("@strict_read"); - strict_write_ivar_id = rb_intern("@strict_write"); - - // cached symbols - type_sym = ID2SYM(rb_intern("type")); - name_sym = ID2SYM(rb_intern("name")); - key_sym = ID2SYM(rb_intern("key")); - value_sym = ID2SYM(rb_intern("value")); - element_sym = ID2SYM(rb_intern("element")); - class_sym = ID2SYM(rb_intern("class")); - - Init_protocol(); - Init_struct(); - Init_binary_protocol_accelerated(); - Init_compact_protocol(); - Init_memory_buffer(); -} diff --git a/lib/thrift.rb b/lib/thrift.rb deleted file mode 100644 index 02d67b8..0000000 --- a/lib/thrift.rb +++ /dev/null @@ -1,64 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -# Contains some contributions under the Thrift Software License. -# Please see doc/old-thrift-license.txt in the Thrift distribution for -# details. - -$:.unshift File.dirname(__FILE__) - -require 'thrift/core_ext' -require 'thrift/exceptions' -require 'thrift/types' -require 'thrift/processor' -require 'thrift/client' -require 'thrift/struct' -require 'thrift/union' -require 'thrift/struct_union' - -# serializer -require 'thrift/serializer/serializer' -require 'thrift/serializer/deserializer' - -# protocol -require 'thrift/protocol/base_protocol' -require 'thrift/protocol/binary_protocol' -require 'thrift/protocol/binary_protocol_accelerated' -require 'thrift/protocol/compact_protocol' - -# transport -require 'thrift/transport/base_transport' -require 'thrift/transport/base_server_transport' -require 'thrift/transport/socket' -require 'thrift/transport/server_socket' -require 'thrift/transport/unix_socket' -require 'thrift/transport/unix_server_socket' -require 'thrift/transport/buffered_transport' -require 'thrift/transport/framed_transport' -require 'thrift/transport/http_client_transport' -require 'thrift/transport/io_stream_transport' -require 'thrift/transport/memory_buffer_transport' - -# server -require 'thrift/server/base_server' -require 'thrift/server/nonblocking_server' -require 'thrift/server/simple_server' -require 'thrift/server/threaded_server' -require 'thrift/server/thread_pool_server' - -require 'thrift/thrift_native' diff --git a/vendor/gen-rb/evernote.rb b/vendor/gen-rb/evernote.rb deleted file mode 100644 index 3b5c68b..0000000 --- a/vendor/gen-rb/evernote.rb +++ /dev/null @@ -1,12 +0,0 @@ -require 'set' -require 'errors_types' -require 'limits_constants' -require 'limits_types' -require 'note_store' -require 'note_store_constants' -require 'note_store_types' -require 'types_constants' -require 'types_types' -require 'user_store' -require 'user_store_constants' -require 'user_store_types'
\ No newline at end of file diff --git a/vendor/gen-rb/evernote/edam/errors_constants.rb b/vendor/gen-rb/evernote/edam/errors_constants.rb deleted file mode 100644 index 4ebe97c..0000000 --- a/vendor/gen-rb/evernote/edam/errors_constants.rb +++ /dev/null @@ -1,14 +0,0 @@ -# -# Autogenerated by Thrift Compiler (0.8.0) -# -# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING -# - -require 'errors_types' - - module Evernote - module EDAM - module Error - end - end -end diff --git a/vendor/gen-rb/evernote/edam/errors_types.rb b/vendor/gen-rb/evernote/edam/errors_types.rb deleted file mode 100644 index cc99888..0000000 --- a/vendor/gen-rb/evernote/edam/errors_types.rb +++ /dev/null @@ -1,128 +0,0 @@ -# -# Autogenerated by Thrift Compiler (0.8.0) -# -# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING -# - - -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 - 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"} - 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]).freeze - end - - # This exception is thrown by EDAM procedures when a call fails as a result of - # a problem that a user 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 - # an a problem in the service that could not be changed through user 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 - class EDAMSystemException < ::Thrift::Exception - include ::Thrift::Struct, ::Thrift::Struct_Union - ERRORCODE = 1 - MESSAGE = 2 - - FIELDS = { - ERRORCODE => {:type => ::Thrift::Types::I32, :name => 'errorCode', :enum_class => Evernote::EDAM::Error::EDAMErrorCode}, - MESSAGE => {:type => ::Thrift::Types::STRING, :name => 'message', :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 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: the object identifier that was not found on the server. - # - # key: the value passed from the client in the identifier, which was not - # found. E.g. the GUID of an object 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 diff --git a/vendor/gen-rb/evernote/edam/limits_constants.rb b/vendor/gen-rb/evernote/edam/limits_constants.rb deleted file mode 100644 index 05a6438..0000000 --- a/vendor/gen-rb/evernote/edam/limits_constants.rb +++ /dev/null @@ -1,252 +0,0 @@ -# -# Autogenerated by Thrift Compiler (0.8.0) -# -# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING -# - -require 'limits_types' - - module Evernote - module EDAM - module Limits - EDAM_ATTRIBUTE_LEN_MIN = 1 - - EDAM_ATTRIBUTE_LEN_MAX = 4096 - - EDAM_ATTRIBUTE_REGEX = %q"^[^\\p{Cc}\\p{Zl}\\p{Zp}]{1,4096}$" - - EDAM_ATTRIBUTE_LIST_MAX = 100 - - EDAM_ATTRIBUTE_MAP_MAX = 100 - - EDAM_GUID_LEN_MIN = 36 - - EDAM_GUID_LEN_MAX = 36 - - EDAM_GUID_REGEX = %q"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$" - - EDAM_EMAIL_LEN_MIN = 6 - - EDAM_EMAIL_LEN_MAX = 255 - - EDAM_EMAIL_LOCAL_REGEX = %q"^[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+(\\.[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+)*$" - - EDAM_EMAIL_DOMAIN_REGEX = %q"^[A-Za-z0-9-]+(\\.[A-Za-z0-9-]+)*\\.([A-Za-z]{2,})$" - - EDAM_EMAIL_REGEX = %q"^[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+(\\.[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9-]+)*\\.([A-Za-z]{2,})$" - - EDAM_TIMEZONE_LEN_MIN = 1 - - EDAM_TIMEZONE_LEN_MAX = 32 - - EDAM_TIMEZONE_REGEX = %q"^([A-Za-z_-]+(/[A-Za-z_-]+)*)|(GMT(-|\\+)[0-9]{1,2}(:[0-9]{2})?)$" - - EDAM_MIME_LEN_MIN = 3 - - EDAM_MIME_LEN_MAX = 255 - - EDAM_MIME_REGEX = %q"^[A-Za-z]+/[A-Za-z0-9._+-]+$" - - EDAM_MIME_TYPE_GIF = %q"image/gif" - - EDAM_MIME_TYPE_JPEG = %q"image/jpeg" - - EDAM_MIME_TYPE_PNG = %q"image/png" - - EDAM_MIME_TYPE_WAV = %q"audio/wav" - - EDAM_MIME_TYPE_MP3 = %q"audio/mpeg" - - EDAM_MIME_TYPE_AMR = %q"audio/amr" - - EDAM_MIME_TYPE_MP4_VIDEO = %q"video/mp4" - - EDAM_MIME_TYPE_INK = %q"application/vnd.evernote.ink" - - EDAM_MIME_TYPE_PDF = %q"application/pdf" - - EDAM_MIME_TYPE_DEFAULT = %q"application/octet-stream" - - EDAM_MIME_TYPES = Set.new([ - %q"image/gif", - %q"image/jpeg", - %q"image/png", - %q"audio/wav", - %q"audio/mpeg", - %q"audio/amr", - %q"application/vnd.evernote.ink", - %q"application/pdf", - %q"video/mp4", - ]) - - EDAM_COMMERCE_SERVICE_GOOGLE = %q"Google" - - EDAM_COMMERCE_SERVICE_PAYPAL = %q"Paypal" - - EDAM_COMMERCE_SERVICE_GIFT = %q"Gift" - - EDAM_COMMERCE_SERVICE_TRIALPAY = %q"TrialPay" - - EDAM_COMMERCE_SERVICE_TRIAL = %q"Trial" - - EDAM_COMMERCE_SERVICE_GROUP = %q"Group" - - EDAM_COMMERCE_SERVICE_CYBERSOURCE = %q"CYBERSRC" - - EDAM_COMMERCE_DEFAULT_CURRENCY_COUNTRY_CODE = %q"USD" - - EDAM_SEARCH_QUERY_LEN_MIN = 0 - - EDAM_SEARCH_QUERY_LEN_MAX = 1024 - - EDAM_SEARCH_QUERY_REGEX = %q"^[^\\p{Cc}\\p{Zl}\\p{Zp}]{0,1024}$" - - EDAM_HASH_LEN = 16 - - EDAM_USER_USERNAME_LEN_MIN = 1 - - EDAM_USER_USERNAME_LEN_MAX = 64 - - EDAM_USER_USERNAME_REGEX = %q"^[a-z0-9]([a-z0-9_-]{0,62}[a-z0-9])?$" - - EDAM_USER_NAME_LEN_MIN = 1 - - EDAM_USER_NAME_LEN_MAX = 255 - - EDAM_USER_NAME_REGEX = %q"^[^\\p{Cc}\\p{Zl}\\p{Zp}]{1,255}$" - - EDAM_TAG_NAME_LEN_MIN = 1 - - EDAM_TAG_NAME_LEN_MAX = 100 - - EDAM_TAG_NAME_REGEX = %q"^[^,\\p{Cc}\\p{Z}]([^,\\p{Cc}\\p{Zl}\\p{Zp}]{0,98}[^,\\p{Cc}\\p{Z}])?$" - - EDAM_NOTE_TITLE_LEN_MIN = 1 - - EDAM_NOTE_TITLE_LEN_MAX = 255 - - EDAM_NOTE_TITLE_REGEX = %q"^[^\\p{Cc}\\p{Z}]([^\\p{Cc}\\p{Zl}\\p{Zp}]{0,253}[^\\p{Cc}\\p{Z}])?$" - - EDAM_NOTE_CONTENT_LEN_MIN = 0 - - EDAM_NOTE_CONTENT_LEN_MAX = 5242880 - - EDAM_APPLICATIONDATA_NAME_LEN_MIN = 3 - - EDAM_APPLICATIONDATA_NAME_LEN_MAX = 32 - - EDAM_APPLICATIONDATA_VALUE_LEN_MIN = 0 - - EDAM_APPLICATIONDATA_VALUE_LEN_MAX = 4092 - - EDAM_APPLICATIONDATA_ENTRY_LEN_MAX = 4095 - - EDAM_APPLICATIONDATA_NAME_REGEX = %q"^[A-Za-z0-9_.-]{3,32}$" - - EDAM_APPLICATIONDATA_VALUE_REGEX = %q"^[^\\p{Cc}]{0,4092}$" - - EDAM_NOTEBOOK_NAME_LEN_MIN = 1 - - EDAM_NOTEBOOK_NAME_LEN_MAX = 100 - - EDAM_NOTEBOOK_NAME_REGEX = %q"^[^\\p{Cc}\\p{Z}]([^\\p{Cc}\\p{Zl}\\p{Zp}]{0,98}[^\\p{Cc}\\p{Z}])?$" - - EDAM_NOTEBOOK_STACK_LEN_MIN = 1 - - EDAM_NOTEBOOK_STACK_LEN_MAX = 100 - - EDAM_NOTEBOOK_STACK_REGEX = %q"^[^\\p{Cc}\\p{Z}]([^\\p{Cc}\\p{Zl}\\p{Zp}]{0,98}[^\\p{Cc}\\p{Z}])?$" - - EDAM_PUBLISHING_URI_LEN_MIN = 1 - - EDAM_PUBLISHING_URI_LEN_MAX = 255 - - EDAM_PUBLISHING_URI_REGEX = %q"^[a-zA-Z0-9.~_+-]{1,255}$" - - EDAM_PUBLISHING_URI_PROHIBITED = Set.new([ - %q"..", - ]) - - EDAM_PUBLISHING_DESCRIPTION_LEN_MIN = 1 - - EDAM_PUBLISHING_DESCRIPTION_LEN_MAX = 200 - - EDAM_PUBLISHING_DESCRIPTION_REGEX = %q"^[^\\p{Cc}\\p{Z}]([^\\p{Cc}\\p{Zl}\\p{Zp}]{0,198}[^\\p{Cc}\\p{Z}])?$" - - EDAM_SAVED_SEARCH_NAME_LEN_MIN = 1 - - EDAM_SAVED_SEARCH_NAME_LEN_MAX = 100 - - EDAM_SAVED_SEARCH_NAME_REGEX = %q"^[^\\p{Cc}\\p{Z}]([^\\p{Cc}\\p{Zl}\\p{Zp}]{0,98}[^\\p{Cc}\\p{Z}])?$" - - EDAM_USER_PASSWORD_LEN_MIN = 6 - - EDAM_USER_PASSWORD_LEN_MAX = 64 - - EDAM_USER_PASSWORD_REGEX = %q"^[A-Za-z0-9!#$%&'()*+,./:;<=>?@^_`{|}~\\[\\]\\\\-]{6,64}$" - - EDAM_NOTE_TAGS_MAX = 100 - - EDAM_NOTE_RESOURCES_MAX = 1000 - - EDAM_USER_TAGS_MAX = 100000 - - EDAM_USER_SAVED_SEARCHES_MAX = 100 - - EDAM_USER_NOTES_MAX = 100000 - - EDAM_USER_NOTEBOOKS_MAX = 250 - - EDAM_USER_RECENT_MAILED_ADDRESSES_MAX = 10 - - EDAM_USER_MAIL_LIMIT_DAILY_FREE = 50 - - EDAM_USER_MAIL_LIMIT_DAILY_PREMIUM = 200 - - EDAM_USER_UPLOAD_LIMIT_FREE = 62914560 - - EDAM_USER_UPLOAD_LIMIT_PREMIUM = 1073741824 - - EDAM_NOTE_SIZE_MAX_FREE = 26214400 - - EDAM_NOTE_SIZE_MAX_PREMIUM = 52428800 - - EDAM_RESOURCE_SIZE_MAX_FREE = 26214400 - - EDAM_RESOURCE_SIZE_MAX_PREMIUM = 52428800 - - EDAM_USER_LINKED_NOTEBOOK_MAX = 100 - - EDAM_NOTEBOOK_SHARED_NOTEBOOK_MAX = 250 - - EDAM_NOTE_CONTENT_CLASS_LEN_MIN = 3 - - EDAM_NOTE_CONTENT_CLASS_LEN_MAX = 32 - - EDAM_HELLO_APP_CONTENT_CLASS_PREFIX = %q"evernote.hello." - - EDAM_FOOD_APP_CONTENT_CLASS_PREFIX = %q"evernote.food." - - EDAM_NOTE_CONTENT_CLASS_REGEX = %q"^[A-Za-z0-9_.-]{3,32}$" - - EDAM_CONTENT_CLASS_HELLO_ENCOUNTER = %q"evernote.hello.encounter" - - EDAM_CONTENT_CLASS_HELLO_PROFILE = %q"evernote.hello.profile" - - EDAM_CONTENT_CLASS_FOOD_MEAL = %q"evernote.food.meal" - - EDAM_CONTENT_CLASS_SKITCH = %q"evernote.skitch" - - EDAM_RELATED_PLAINTEXT_LEN_MIN = 1 - - EDAM_RELATED_PLAINTEXT_LEN_MAX = 131072 - - EDAM_RELATED_MAX_NOTES = 25 - - EDAM_RELATED_MAX_NOTEBOOKS = 1 - - EDAM_RELATED_MAX_TAGS = 25 - - end - end -end diff --git a/vendor/gen-rb/evernote/edam/limits_types.rb b/vendor/gen-rb/evernote/edam/limits_types.rb deleted file mode 100644 index 48536c1..0000000 --- a/vendor/gen-rb/evernote/edam/limits_types.rb +++ /dev/null @@ -1,13 +0,0 @@ -# -# Autogenerated by Thrift Compiler (0.8.0) -# -# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING -# - - -module Evernote - module EDAM - module Limits - end - end - end diff --git a/vendor/gen-rb/evernote/edam/note_store.rb b/vendor/gen-rb/evernote/edam/note_store.rb deleted file mode 100644 index ae18068..0000000 --- a/vendor/gen-rb/evernote/edam/note_store.rb +++ /dev/null @@ -1,5562 +0,0 @@ -# -# Autogenerated by Thrift Compiler (0.8.0) -# -# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING -# - -require 'thrift' -require 'note_store_types' - - module Evernote - module EDAM - module NoteStore - module NoteStore - class Client - include ::Thrift::Client - - def getSyncState(authenticationToken) - send_getSyncState(authenticationToken) - return recv_getSyncState() - end - - def send_getSyncState(authenticationToken) - send_message('getSyncState', GetSyncState_args, :authenticationToken => authenticationToken) - end - - def recv_getSyncState() - result = receive_message(GetSyncState_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getSyncState failed: unknown result') - end - - def getSyncStateWithMetrics(authenticationToken, clientMetrics) - send_getSyncStateWithMetrics(authenticationToken, clientMetrics) - return recv_getSyncStateWithMetrics() - end - - def send_getSyncStateWithMetrics(authenticationToken, clientMetrics) - send_message('getSyncStateWithMetrics', GetSyncStateWithMetrics_args, :authenticationToken => authenticationToken, :clientMetrics => clientMetrics) - end - - def recv_getSyncStateWithMetrics() - result = receive_message(GetSyncStateWithMetrics_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getSyncStateWithMetrics failed: unknown result') - end - - def getSyncChunk(authenticationToken, afterUSN, maxEntries, fullSyncOnly) - send_getSyncChunk(authenticationToken, afterUSN, maxEntries, fullSyncOnly) - return recv_getSyncChunk() - end - - def send_getSyncChunk(authenticationToken, afterUSN, maxEntries, fullSyncOnly) - send_message('getSyncChunk', GetSyncChunk_args, :authenticationToken => authenticationToken, :afterUSN => afterUSN, :maxEntries => maxEntries, :fullSyncOnly => fullSyncOnly) - end - - def recv_getSyncChunk() - result = receive_message(GetSyncChunk_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getSyncChunk failed: unknown result') - end - - def getFilteredSyncChunk(authenticationToken, afterUSN, maxEntries, filter) - send_getFilteredSyncChunk(authenticationToken, afterUSN, maxEntries, filter) - return recv_getFilteredSyncChunk() - end - - def send_getFilteredSyncChunk(authenticationToken, afterUSN, maxEntries, filter) - send_message('getFilteredSyncChunk', GetFilteredSyncChunk_args, :authenticationToken => authenticationToken, :afterUSN => afterUSN, :maxEntries => maxEntries, :filter => filter) - end - - def recv_getFilteredSyncChunk() - result = receive_message(GetFilteredSyncChunk_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getFilteredSyncChunk failed: unknown result') - end - - def getLinkedNotebookSyncState(authenticationToken, linkedNotebook) - send_getLinkedNotebookSyncState(authenticationToken, linkedNotebook) - return recv_getLinkedNotebookSyncState() - end - - def send_getLinkedNotebookSyncState(authenticationToken, linkedNotebook) - send_message('getLinkedNotebookSyncState', GetLinkedNotebookSyncState_args, :authenticationToken => authenticationToken, :linkedNotebook => linkedNotebook) - end - - def recv_getLinkedNotebookSyncState() - result = receive_message(GetLinkedNotebookSyncState_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getLinkedNotebookSyncState failed: unknown result') - end - - def getLinkedNotebookSyncChunk(authenticationToken, linkedNotebook, afterUSN, maxEntries, fullSyncOnly) - send_getLinkedNotebookSyncChunk(authenticationToken, linkedNotebook, afterUSN, maxEntries, fullSyncOnly) - return recv_getLinkedNotebookSyncChunk() - end - - def send_getLinkedNotebookSyncChunk(authenticationToken, linkedNotebook, afterUSN, maxEntries, fullSyncOnly) - send_message('getLinkedNotebookSyncChunk', GetLinkedNotebookSyncChunk_args, :authenticationToken => authenticationToken, :linkedNotebook => linkedNotebook, :afterUSN => afterUSN, :maxEntries => maxEntries, :fullSyncOnly => fullSyncOnly) - end - - def recv_getLinkedNotebookSyncChunk() - result = receive_message(GetLinkedNotebookSyncChunk_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getLinkedNotebookSyncChunk failed: unknown result') - end - - def listNotebooks(authenticationToken) - send_listNotebooks(authenticationToken) - return recv_listNotebooks() - end - - def send_listNotebooks(authenticationToken) - send_message('listNotebooks', ListNotebooks_args, :authenticationToken => authenticationToken) - end - - def recv_listNotebooks() - result = receive_message(ListNotebooks_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'listNotebooks failed: unknown result') - end - - def getNotebook(authenticationToken, guid) - send_getNotebook(authenticationToken, guid) - return recv_getNotebook() - end - - def send_getNotebook(authenticationToken, guid) - send_message('getNotebook', GetNotebook_args, :authenticationToken => authenticationToken, :guid => guid) - end - - def recv_getNotebook() - result = receive_message(GetNotebook_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getNotebook failed: unknown result') - end - - def getDefaultNotebook(authenticationToken) - send_getDefaultNotebook(authenticationToken) - return recv_getDefaultNotebook() - end - - def send_getDefaultNotebook(authenticationToken) - send_message('getDefaultNotebook', GetDefaultNotebook_args, :authenticationToken => authenticationToken) - end - - def recv_getDefaultNotebook() - result = receive_message(GetDefaultNotebook_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getDefaultNotebook failed: unknown result') - end - - def createNotebook(authenticationToken, notebook) - send_createNotebook(authenticationToken, notebook) - return recv_createNotebook() - end - - def send_createNotebook(authenticationToken, notebook) - send_message('createNotebook', CreateNotebook_args, :authenticationToken => authenticationToken, :notebook => notebook) - end - - def recv_createNotebook() - result = receive_message(CreateNotebook_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'createNotebook failed: unknown result') - end - - def updateNotebook(authenticationToken, notebook) - send_updateNotebook(authenticationToken, notebook) - return recv_updateNotebook() - end - - def send_updateNotebook(authenticationToken, notebook) - send_message('updateNotebook', UpdateNotebook_args, :authenticationToken => authenticationToken, :notebook => notebook) - end - - def recv_updateNotebook() - result = receive_message(UpdateNotebook_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'updateNotebook failed: unknown result') - end - - def expungeNotebook(authenticationToken, guid) - send_expungeNotebook(authenticationToken, guid) - return recv_expungeNotebook() - end - - def send_expungeNotebook(authenticationToken, guid) - send_message('expungeNotebook', ExpungeNotebook_args, :authenticationToken => authenticationToken, :guid => guid) - end - - def recv_expungeNotebook() - result = receive_message(ExpungeNotebook_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'expungeNotebook failed: unknown result') - end - - def listTags(authenticationToken) - send_listTags(authenticationToken) - return recv_listTags() - end - - def send_listTags(authenticationToken) - send_message('listTags', ListTags_args, :authenticationToken => authenticationToken) - end - - def recv_listTags() - result = receive_message(ListTags_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'listTags failed: unknown result') - end - - def listTagsByNotebook(authenticationToken, notebookGuid) - send_listTagsByNotebook(authenticationToken, notebookGuid) - return recv_listTagsByNotebook() - end - - def send_listTagsByNotebook(authenticationToken, notebookGuid) - send_message('listTagsByNotebook', ListTagsByNotebook_args, :authenticationToken => authenticationToken, :notebookGuid => notebookGuid) - end - - def recv_listTagsByNotebook() - result = receive_message(ListTagsByNotebook_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'listTagsByNotebook failed: unknown result') - end - - def getTag(authenticationToken, guid) - send_getTag(authenticationToken, guid) - return recv_getTag() - end - - def send_getTag(authenticationToken, guid) - send_message('getTag', GetTag_args, :authenticationToken => authenticationToken, :guid => guid) - end - - def recv_getTag() - result = receive_message(GetTag_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getTag failed: unknown result') - end - - def createTag(authenticationToken, tag) - send_createTag(authenticationToken, tag) - return recv_createTag() - end - - def send_createTag(authenticationToken, tag) - send_message('createTag', CreateTag_args, :authenticationToken => authenticationToken, :tag => tag) - end - - def recv_createTag() - result = receive_message(CreateTag_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'createTag failed: unknown result') - end - - def updateTag(authenticationToken, tag) - send_updateTag(authenticationToken, tag) - return recv_updateTag() - end - - def send_updateTag(authenticationToken, tag) - send_message('updateTag', UpdateTag_args, :authenticationToken => authenticationToken, :tag => tag) - end - - def recv_updateTag() - result = receive_message(UpdateTag_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'updateTag failed: unknown result') - end - - def untagAll(authenticationToken, guid) - send_untagAll(authenticationToken, guid) - recv_untagAll() - end - - def send_untagAll(authenticationToken, guid) - send_message('untagAll', UntagAll_args, :authenticationToken => authenticationToken, :guid => guid) - end - - def recv_untagAll() - result = receive_message(UntagAll_result) - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise result.notFoundException unless result.notFoundException.nil? - return - end - - def expungeTag(authenticationToken, guid) - send_expungeTag(authenticationToken, guid) - return recv_expungeTag() - end - - def send_expungeTag(authenticationToken, guid) - send_message('expungeTag', ExpungeTag_args, :authenticationToken => authenticationToken, :guid => guid) - end - - def recv_expungeTag() - result = receive_message(ExpungeTag_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'expungeTag failed: unknown result') - end - - def listSearches(authenticationToken) - send_listSearches(authenticationToken) - return recv_listSearches() - end - - def send_listSearches(authenticationToken) - send_message('listSearches', ListSearches_args, :authenticationToken => authenticationToken) - end - - def recv_listSearches() - result = receive_message(ListSearches_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'listSearches failed: unknown result') - end - - def getSearch(authenticationToken, guid) - send_getSearch(authenticationToken, guid) - return recv_getSearch() - end - - def send_getSearch(authenticationToken, guid) - send_message('getSearch', GetSearch_args, :authenticationToken => authenticationToken, :guid => guid) - end - - def recv_getSearch() - result = receive_message(GetSearch_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getSearch failed: unknown result') - end - - def createSearch(authenticationToken, search) - send_createSearch(authenticationToken, search) - return recv_createSearch() - end - - def send_createSearch(authenticationToken, search) - send_message('createSearch', CreateSearch_args, :authenticationToken => authenticationToken, :search => search) - end - - def recv_createSearch() - result = receive_message(CreateSearch_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'createSearch failed: unknown result') - end - - def updateSearch(authenticationToken, search) - send_updateSearch(authenticationToken, search) - return recv_updateSearch() - end - - def send_updateSearch(authenticationToken, search) - send_message('updateSearch', UpdateSearch_args, :authenticationToken => authenticationToken, :search => search) - end - - def recv_updateSearch() - result = receive_message(UpdateSearch_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'updateSearch failed: unknown result') - end - - def expungeSearch(authenticationToken, guid) - send_expungeSearch(authenticationToken, guid) - return recv_expungeSearch() - end - - def send_expungeSearch(authenticationToken, guid) - send_message('expungeSearch', ExpungeSearch_args, :authenticationToken => authenticationToken, :guid => guid) - end - - def recv_expungeSearch() - result = receive_message(ExpungeSearch_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'expungeSearch failed: unknown result') - end - - def findNotes(authenticationToken, filter, offset, maxNotes) - send_findNotes(authenticationToken, filter, offset, maxNotes) - return recv_findNotes() - end - - def send_findNotes(authenticationToken, filter, offset, maxNotes) - send_message('findNotes', FindNotes_args, :authenticationToken => authenticationToken, :filter => filter, :offset => offset, :maxNotes => maxNotes) - end - - def recv_findNotes() - result = receive_message(FindNotes_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'findNotes failed: unknown result') - end - - def findNoteOffset(authenticationToken, filter, guid) - send_findNoteOffset(authenticationToken, filter, guid) - return recv_findNoteOffset() - end - - def send_findNoteOffset(authenticationToken, filter, guid) - send_message('findNoteOffset', FindNoteOffset_args, :authenticationToken => authenticationToken, :filter => filter, :guid => guid) - end - - def recv_findNoteOffset() - result = receive_message(FindNoteOffset_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'findNoteOffset failed: unknown result') - end - - def findNotesMetadata(authenticationToken, filter, offset, maxNotes, resultSpec) - send_findNotesMetadata(authenticationToken, filter, offset, maxNotes, resultSpec) - return recv_findNotesMetadata() - end - - def send_findNotesMetadata(authenticationToken, filter, offset, maxNotes, resultSpec) - send_message('findNotesMetadata', FindNotesMetadata_args, :authenticationToken => authenticationToken, :filter => filter, :offset => offset, :maxNotes => maxNotes, :resultSpec => resultSpec) - end - - def recv_findNotesMetadata() - result = receive_message(FindNotesMetadata_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'findNotesMetadata failed: unknown result') - end - - def findNoteCounts(authenticationToken, filter, withTrash) - send_findNoteCounts(authenticationToken, filter, withTrash) - return recv_findNoteCounts() - end - - def send_findNoteCounts(authenticationToken, filter, withTrash) - send_message('findNoteCounts', FindNoteCounts_args, :authenticationToken => authenticationToken, :filter => filter, :withTrash => withTrash) - end - - def recv_findNoteCounts() - result = receive_message(FindNoteCounts_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'findNoteCounts failed: unknown result') - end - - def getNote(authenticationToken, guid, withContent, withResourcesData, withResourcesRecognition, withResourcesAlternateData) - send_getNote(authenticationToken, guid, withContent, withResourcesData, withResourcesRecognition, withResourcesAlternateData) - return recv_getNote() - end - - def send_getNote(authenticationToken, guid, withContent, withResourcesData, withResourcesRecognition, withResourcesAlternateData) - send_message('getNote', GetNote_args, :authenticationToken => authenticationToken, :guid => guid, :withContent => withContent, :withResourcesData => withResourcesData, :withResourcesRecognition => withResourcesRecognition, :withResourcesAlternateData => withResourcesAlternateData) - end - - def recv_getNote() - result = receive_message(GetNote_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getNote failed: unknown result') - end - - def getNoteApplicationData(authenticationToken, guid) - send_getNoteApplicationData(authenticationToken, guid) - return recv_getNoteApplicationData() - end - - def send_getNoteApplicationData(authenticationToken, guid) - send_message('getNoteApplicationData', GetNoteApplicationData_args, :authenticationToken => authenticationToken, :guid => guid) - end - - def recv_getNoteApplicationData() - result = receive_message(GetNoteApplicationData_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getNoteApplicationData failed: unknown result') - end - - def getNoteApplicationDataEntry(authenticationToken, guid, key) - send_getNoteApplicationDataEntry(authenticationToken, guid, key) - return recv_getNoteApplicationDataEntry() - end - - def send_getNoteApplicationDataEntry(authenticationToken, guid, key) - send_message('getNoteApplicationDataEntry', GetNoteApplicationDataEntry_args, :authenticationToken => authenticationToken, :guid => guid, :key => key) - end - - def recv_getNoteApplicationDataEntry() - result = receive_message(GetNoteApplicationDataEntry_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getNoteApplicationDataEntry failed: unknown result') - end - - def setNoteApplicationDataEntry(authenticationToken, guid, key, value) - send_setNoteApplicationDataEntry(authenticationToken, guid, key, value) - return recv_setNoteApplicationDataEntry() - end - - def send_setNoteApplicationDataEntry(authenticationToken, guid, key, value) - send_message('setNoteApplicationDataEntry', SetNoteApplicationDataEntry_args, :authenticationToken => authenticationToken, :guid => guid, :key => key, :value => value) - end - - def recv_setNoteApplicationDataEntry() - result = receive_message(SetNoteApplicationDataEntry_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'setNoteApplicationDataEntry failed: unknown result') - end - - def unsetNoteApplicationDataEntry(authenticationToken, guid, key) - send_unsetNoteApplicationDataEntry(authenticationToken, guid, key) - return recv_unsetNoteApplicationDataEntry() - end - - def send_unsetNoteApplicationDataEntry(authenticationToken, guid, key) - send_message('unsetNoteApplicationDataEntry', UnsetNoteApplicationDataEntry_args, :authenticationToken => authenticationToken, :guid => guid, :key => key) - end - - def recv_unsetNoteApplicationDataEntry() - result = receive_message(UnsetNoteApplicationDataEntry_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'unsetNoteApplicationDataEntry failed: unknown result') - end - - def getNoteContent(authenticationToken, guid) - send_getNoteContent(authenticationToken, guid) - return recv_getNoteContent() - end - - def send_getNoteContent(authenticationToken, guid) - send_message('getNoteContent', GetNoteContent_args, :authenticationToken => authenticationToken, :guid => guid) - end - - def recv_getNoteContent() - result = receive_message(GetNoteContent_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getNoteContent failed: unknown result') - end - - def getNoteSearchText(authenticationToken, guid, noteOnly, tokenizeForIndexing) - send_getNoteSearchText(authenticationToken, guid, noteOnly, tokenizeForIndexing) - return recv_getNoteSearchText() - end - - def send_getNoteSearchText(authenticationToken, guid, noteOnly, tokenizeForIndexing) - send_message('getNoteSearchText', GetNoteSearchText_args, :authenticationToken => authenticationToken, :guid => guid, :noteOnly => noteOnly, :tokenizeForIndexing => tokenizeForIndexing) - end - - def recv_getNoteSearchText() - result = receive_message(GetNoteSearchText_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getNoteSearchText failed: unknown result') - end - - def getResourceSearchText(authenticationToken, guid) - send_getResourceSearchText(authenticationToken, guid) - return recv_getResourceSearchText() - end - - def send_getResourceSearchText(authenticationToken, guid) - send_message('getResourceSearchText', GetResourceSearchText_args, :authenticationToken => authenticationToken, :guid => guid) - end - - def recv_getResourceSearchText() - result = receive_message(GetResourceSearchText_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getResourceSearchText failed: unknown result') - end - - def getNoteTagNames(authenticationToken, guid) - send_getNoteTagNames(authenticationToken, guid) - return recv_getNoteTagNames() - end - - def send_getNoteTagNames(authenticationToken, guid) - send_message('getNoteTagNames', GetNoteTagNames_args, :authenticationToken => authenticationToken, :guid => guid) - end - - def recv_getNoteTagNames() - result = receive_message(GetNoteTagNames_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getNoteTagNames failed: unknown result') - end - - def createNote(authenticationToken, note) - send_createNote(authenticationToken, note) - return recv_createNote() - end - - def send_createNote(authenticationToken, note) - send_message('createNote', CreateNote_args, :authenticationToken => authenticationToken, :note => note) - end - - def recv_createNote() - result = receive_message(CreateNote_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'createNote failed: unknown result') - end - - def updateNote(authenticationToken, note) - send_updateNote(authenticationToken, note) - return recv_updateNote() - end - - def send_updateNote(authenticationToken, note) - send_message('updateNote', UpdateNote_args, :authenticationToken => authenticationToken, :note => note) - end - - def recv_updateNote() - result = receive_message(UpdateNote_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'updateNote failed: unknown result') - end - - def deleteNote(authenticationToken, guid) - send_deleteNote(authenticationToken, guid) - return recv_deleteNote() - end - - def send_deleteNote(authenticationToken, guid) - send_message('deleteNote', DeleteNote_args, :authenticationToken => authenticationToken, :guid => guid) - end - - def recv_deleteNote() - result = receive_message(DeleteNote_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'deleteNote failed: unknown result') - end - - def expungeNote(authenticationToken, guid) - send_expungeNote(authenticationToken, guid) - return recv_expungeNote() - end - - def send_expungeNote(authenticationToken, guid) - send_message('expungeNote', ExpungeNote_args, :authenticationToken => authenticationToken, :guid => guid) - end - - def recv_expungeNote() - result = receive_message(ExpungeNote_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'expungeNote failed: unknown result') - end - - def expungeNotes(authenticationToken, noteGuids) - send_expungeNotes(authenticationToken, noteGuids) - return recv_expungeNotes() - end - - def send_expungeNotes(authenticationToken, noteGuids) - send_message('expungeNotes', ExpungeNotes_args, :authenticationToken => authenticationToken, :noteGuids => noteGuids) - end - - def recv_expungeNotes() - result = receive_message(ExpungeNotes_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'expungeNotes failed: unknown result') - end - - def expungeInactiveNotes(authenticationToken) - send_expungeInactiveNotes(authenticationToken) - return recv_expungeInactiveNotes() - end - - def send_expungeInactiveNotes(authenticationToken) - send_message('expungeInactiveNotes', ExpungeInactiveNotes_args, :authenticationToken => authenticationToken) - end - - def recv_expungeInactiveNotes() - result = receive_message(ExpungeInactiveNotes_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'expungeInactiveNotes failed: unknown result') - end - - def copyNote(authenticationToken, noteGuid, toNotebookGuid) - send_copyNote(authenticationToken, noteGuid, toNotebookGuid) - return recv_copyNote() - end - - def send_copyNote(authenticationToken, noteGuid, toNotebookGuid) - send_message('copyNote', CopyNote_args, :authenticationToken => authenticationToken, :noteGuid => noteGuid, :toNotebookGuid => toNotebookGuid) - end - - def recv_copyNote() - result = receive_message(CopyNote_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'copyNote failed: unknown result') - end - - def listNoteVersions(authenticationToken, noteGuid) - send_listNoteVersions(authenticationToken, noteGuid) - return recv_listNoteVersions() - end - - def send_listNoteVersions(authenticationToken, noteGuid) - send_message('listNoteVersions', ListNoteVersions_args, :authenticationToken => authenticationToken, :noteGuid => noteGuid) - end - - def recv_listNoteVersions() - result = receive_message(ListNoteVersions_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'listNoteVersions failed: unknown result') - end - - def getNoteVersion(authenticationToken, noteGuid, updateSequenceNum, withResourcesData, withResourcesRecognition, withResourcesAlternateData) - send_getNoteVersion(authenticationToken, noteGuid, updateSequenceNum, withResourcesData, withResourcesRecognition, withResourcesAlternateData) - return recv_getNoteVersion() - end - - def send_getNoteVersion(authenticationToken, noteGuid, updateSequenceNum, withResourcesData, withResourcesRecognition, withResourcesAlternateData) - send_message('getNoteVersion', GetNoteVersion_args, :authenticationToken => authenticationToken, :noteGuid => noteGuid, :updateSequenceNum => updateSequenceNum, :withResourcesData => withResourcesData, :withResourcesRecognition => withResourcesRecognition, :withResourcesAlternateData => withResourcesAlternateData) - end - - def recv_getNoteVersion() - result = receive_message(GetNoteVersion_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getNoteVersion failed: unknown result') - end - - def getResource(authenticationToken, guid, withData, withRecognition, withAttributes, withAlternateData) - send_getResource(authenticationToken, guid, withData, withRecognition, withAttributes, withAlternateData) - return recv_getResource() - end - - def send_getResource(authenticationToken, guid, withData, withRecognition, withAttributes, withAlternateData) - send_message('getResource', GetResource_args, :authenticationToken => authenticationToken, :guid => guid, :withData => withData, :withRecognition => withRecognition, :withAttributes => withAttributes, :withAlternateData => withAlternateData) - end - - def recv_getResource() - result = receive_message(GetResource_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getResource failed: unknown result') - end - - def getResourceApplicationData(authenticationToken, guid) - send_getResourceApplicationData(authenticationToken, guid) - return recv_getResourceApplicationData() - end - - def send_getResourceApplicationData(authenticationToken, guid) - send_message('getResourceApplicationData', GetResourceApplicationData_args, :authenticationToken => authenticationToken, :guid => guid) - end - - def recv_getResourceApplicationData() - result = receive_message(GetResourceApplicationData_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getResourceApplicationData failed: unknown result') - end - - def getResourceApplicationDataEntry(authenticationToken, guid, key) - send_getResourceApplicationDataEntry(authenticationToken, guid, key) - return recv_getResourceApplicationDataEntry() - end - - def send_getResourceApplicationDataEntry(authenticationToken, guid, key) - send_message('getResourceApplicationDataEntry', GetResourceApplicationDataEntry_args, :authenticationToken => authenticationToken, :guid => guid, :key => key) - end - - def recv_getResourceApplicationDataEntry() - result = receive_message(GetResourceApplicationDataEntry_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getResourceApplicationDataEntry failed: unknown result') - end - - def setResourceApplicationDataEntry(authenticationToken, guid, key, value) - send_setResourceApplicationDataEntry(authenticationToken, guid, key, value) - return recv_setResourceApplicationDataEntry() - end - - def send_setResourceApplicationDataEntry(authenticationToken, guid, key, value) - send_message('setResourceApplicationDataEntry', SetResourceApplicationDataEntry_args, :authenticationToken => authenticationToken, :guid => guid, :key => key, :value => value) - end - - def recv_setResourceApplicationDataEntry() - result = receive_message(SetResourceApplicationDataEntry_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'setResourceApplicationDataEntry failed: unknown result') - end - - def unsetResourceApplicationDataEntry(authenticationToken, guid, key) - send_unsetResourceApplicationDataEntry(authenticationToken, guid, key) - return recv_unsetResourceApplicationDataEntry() - end - - def send_unsetResourceApplicationDataEntry(authenticationToken, guid, key) - send_message('unsetResourceApplicationDataEntry', UnsetResourceApplicationDataEntry_args, :authenticationToken => authenticationToken, :guid => guid, :key => key) - end - - def recv_unsetResourceApplicationDataEntry() - result = receive_message(UnsetResourceApplicationDataEntry_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'unsetResourceApplicationDataEntry failed: unknown result') - end - - def updateResource(authenticationToken, resource) - send_updateResource(authenticationToken, resource) - return recv_updateResource() - end - - def send_updateResource(authenticationToken, resource) - send_message('updateResource', UpdateResource_args, :authenticationToken => authenticationToken, :resource => resource) - end - - def recv_updateResource() - result = receive_message(UpdateResource_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'updateResource failed: unknown result') - end - - def getResourceData(authenticationToken, guid) - send_getResourceData(authenticationToken, guid) - return recv_getResourceData() - end - - def send_getResourceData(authenticationToken, guid) - send_message('getResourceData', GetResourceData_args, :authenticationToken => authenticationToken, :guid => guid) - end - - def recv_getResourceData() - result = receive_message(GetResourceData_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getResourceData failed: unknown result') - end - - def getResourceByHash(authenticationToken, noteGuid, contentHash, withData, withRecognition, withAlternateData) - send_getResourceByHash(authenticationToken, noteGuid, contentHash, withData, withRecognition, withAlternateData) - return recv_getResourceByHash() - end - - def send_getResourceByHash(authenticationToken, noteGuid, contentHash, withData, withRecognition, withAlternateData) - send_message('getResourceByHash', GetResourceByHash_args, :authenticationToken => authenticationToken, :noteGuid => noteGuid, :contentHash => contentHash, :withData => withData, :withRecognition => withRecognition, :withAlternateData => withAlternateData) - end - - def recv_getResourceByHash() - result = receive_message(GetResourceByHash_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getResourceByHash failed: unknown result') - end - - def getResourceRecognition(authenticationToken, guid) - send_getResourceRecognition(authenticationToken, guid) - return recv_getResourceRecognition() - end - - def send_getResourceRecognition(authenticationToken, guid) - send_message('getResourceRecognition', GetResourceRecognition_args, :authenticationToken => authenticationToken, :guid => guid) - end - - def recv_getResourceRecognition() - result = receive_message(GetResourceRecognition_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getResourceRecognition failed: unknown result') - end - - def getResourceAlternateData(authenticationToken, guid) - send_getResourceAlternateData(authenticationToken, guid) - return recv_getResourceAlternateData() - end - - def send_getResourceAlternateData(authenticationToken, guid) - send_message('getResourceAlternateData', GetResourceAlternateData_args, :authenticationToken => authenticationToken, :guid => guid) - end - - def recv_getResourceAlternateData() - result = receive_message(GetResourceAlternateData_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getResourceAlternateData failed: unknown result') - end - - def getResourceAttributes(authenticationToken, guid) - send_getResourceAttributes(authenticationToken, guid) - return recv_getResourceAttributes() - end - - def send_getResourceAttributes(authenticationToken, guid) - send_message('getResourceAttributes', GetResourceAttributes_args, :authenticationToken => authenticationToken, :guid => guid) - end - - def recv_getResourceAttributes() - result = receive_message(GetResourceAttributes_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getResourceAttributes failed: unknown result') - end - - def getAccountSize(authenticationToken) - send_getAccountSize(authenticationToken) - return recv_getAccountSize() - end - - def send_getAccountSize(authenticationToken) - send_message('getAccountSize', GetAccountSize_args, :authenticationToken => authenticationToken) - end - - def recv_getAccountSize() - result = receive_message(GetAccountSize_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getAccountSize failed: unknown result') - end - - def getAds(authenticationToken, adParameters) - send_getAds(authenticationToken, adParameters) - return recv_getAds() - end - - def send_getAds(authenticationToken, adParameters) - send_message('getAds', GetAds_args, :authenticationToken => authenticationToken, :adParameters => adParameters) - end - - def recv_getAds() - result = receive_message(GetAds_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getAds failed: unknown result') - end - - def getRandomAd(authenticationToken, adParameters) - send_getRandomAd(authenticationToken, adParameters) - return recv_getRandomAd() - end - - def send_getRandomAd(authenticationToken, adParameters) - send_message('getRandomAd', GetRandomAd_args, :authenticationToken => authenticationToken, :adParameters => adParameters) - end - - def recv_getRandomAd() - result = receive_message(GetRandomAd_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getRandomAd failed: unknown result') - end - - def getPublicNotebook(userId, publicUri) - send_getPublicNotebook(userId, publicUri) - return recv_getPublicNotebook() - end - - def send_getPublicNotebook(userId, publicUri) - send_message('getPublicNotebook', GetPublicNotebook_args, :userId => userId, :publicUri => publicUri) - end - - def recv_getPublicNotebook() - result = receive_message(GetPublicNotebook_result) - return result.success unless result.success.nil? - raise result.systemException unless result.systemException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getPublicNotebook failed: unknown result') - end - - def createSharedNotebook(authenticationToken, sharedNotebook) - send_createSharedNotebook(authenticationToken, sharedNotebook) - return recv_createSharedNotebook() - end - - def send_createSharedNotebook(authenticationToken, sharedNotebook) - send_message('createSharedNotebook', CreateSharedNotebook_args, :authenticationToken => authenticationToken, :sharedNotebook => sharedNotebook) - end - - def recv_createSharedNotebook() - result = receive_message(CreateSharedNotebook_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise result.systemException unless result.systemException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'createSharedNotebook failed: unknown result') - end - - def sendMessageToSharedNotebookMembers(authenticationToken, notebookGuid, messageText, recipients) - send_sendMessageToSharedNotebookMembers(authenticationToken, notebookGuid, messageText, recipients) - return recv_sendMessageToSharedNotebookMembers() - end - - def send_sendMessageToSharedNotebookMembers(authenticationToken, notebookGuid, messageText, recipients) - send_message('sendMessageToSharedNotebookMembers', SendMessageToSharedNotebookMembers_args, :authenticationToken => authenticationToken, :notebookGuid => notebookGuid, :messageText => messageText, :recipients => recipients) - end - - def recv_sendMessageToSharedNotebookMembers() - result = receive_message(SendMessageToSharedNotebookMembers_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise result.systemException unless result.systemException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'sendMessageToSharedNotebookMembers failed: unknown result') - end - - def listSharedNotebooks(authenticationToken) - send_listSharedNotebooks(authenticationToken) - return recv_listSharedNotebooks() - end - - def send_listSharedNotebooks(authenticationToken) - send_message('listSharedNotebooks', ListSharedNotebooks_args, :authenticationToken => authenticationToken) - end - - def recv_listSharedNotebooks() - result = receive_message(ListSharedNotebooks_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise result.systemException unless result.systemException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'listSharedNotebooks failed: unknown result') - end - - def expungeSharedNotebooks(authenticationToken, sharedNotebookIds) - send_expungeSharedNotebooks(authenticationToken, sharedNotebookIds) - return recv_expungeSharedNotebooks() - end - - def send_expungeSharedNotebooks(authenticationToken, sharedNotebookIds) - send_message('expungeSharedNotebooks', ExpungeSharedNotebooks_args, :authenticationToken => authenticationToken, :sharedNotebookIds => sharedNotebookIds) - end - - def recv_expungeSharedNotebooks() - result = receive_message(ExpungeSharedNotebooks_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise result.systemException unless result.systemException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'expungeSharedNotebooks failed: unknown result') - end - - def createLinkedNotebook(authenticationToken, linkedNotebook) - send_createLinkedNotebook(authenticationToken, linkedNotebook) - return recv_createLinkedNotebook() - end - - def send_createLinkedNotebook(authenticationToken, linkedNotebook) - send_message('createLinkedNotebook', CreateLinkedNotebook_args, :authenticationToken => authenticationToken, :linkedNotebook => linkedNotebook) - end - - def recv_createLinkedNotebook() - result = receive_message(CreateLinkedNotebook_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise result.systemException unless result.systemException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'createLinkedNotebook failed: unknown result') - end - - def updateLinkedNotebook(authenticationToken, linkedNotebook) - send_updateLinkedNotebook(authenticationToken, linkedNotebook) - return recv_updateLinkedNotebook() - end - - def send_updateLinkedNotebook(authenticationToken, linkedNotebook) - send_message('updateLinkedNotebook', UpdateLinkedNotebook_args, :authenticationToken => authenticationToken, :linkedNotebook => linkedNotebook) - end - - def recv_updateLinkedNotebook() - result = receive_message(UpdateLinkedNotebook_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise result.systemException unless result.systemException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'updateLinkedNotebook failed: unknown result') - end - - def listLinkedNotebooks(authenticationToken) - send_listLinkedNotebooks(authenticationToken) - return recv_listLinkedNotebooks() - end - - def send_listLinkedNotebooks(authenticationToken) - send_message('listLinkedNotebooks', ListLinkedNotebooks_args, :authenticationToken => authenticationToken) - end - - def recv_listLinkedNotebooks() - result = receive_message(ListLinkedNotebooks_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise result.systemException unless result.systemException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'listLinkedNotebooks failed: unknown result') - end - - def expungeLinkedNotebook(authenticationToken, guid) - send_expungeLinkedNotebook(authenticationToken, guid) - return recv_expungeLinkedNotebook() - end - - def send_expungeLinkedNotebook(authenticationToken, guid) - send_message('expungeLinkedNotebook', ExpungeLinkedNotebook_args, :authenticationToken => authenticationToken, :guid => guid) - end - - def recv_expungeLinkedNotebook() - result = receive_message(ExpungeLinkedNotebook_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise result.systemException unless result.systemException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'expungeLinkedNotebook failed: unknown result') - end - - def authenticateToSharedNotebook(shareKey, authenticationToken) - send_authenticateToSharedNotebook(shareKey, authenticationToken) - return recv_authenticateToSharedNotebook() - end - - def send_authenticateToSharedNotebook(shareKey, authenticationToken) - send_message('authenticateToSharedNotebook', AuthenticateToSharedNotebook_args, :shareKey => shareKey, :authenticationToken => authenticationToken) - end - - def recv_authenticateToSharedNotebook() - result = receive_message(AuthenticateToSharedNotebook_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise result.systemException unless result.systemException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'authenticateToSharedNotebook failed: unknown result') - end - - def getSharedNotebookByAuth(authenticationToken) - send_getSharedNotebookByAuth(authenticationToken) - return recv_getSharedNotebookByAuth() - end - - def send_getSharedNotebookByAuth(authenticationToken) - send_message('getSharedNotebookByAuth', GetSharedNotebookByAuth_args, :authenticationToken => authenticationToken) - end - - def recv_getSharedNotebookByAuth() - result = receive_message(GetSharedNotebookByAuth_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise result.systemException unless result.systemException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getSharedNotebookByAuth failed: unknown result') - end - - def emailNote(authenticationToken, parameters) - send_emailNote(authenticationToken, parameters) - recv_emailNote() - end - - def send_emailNote(authenticationToken, parameters) - send_message('emailNote', EmailNote_args, :authenticationToken => authenticationToken, :parameters => parameters) - end - - def recv_emailNote() - result = receive_message(EmailNote_result) - raise result.userException unless result.userException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise result.systemException unless result.systemException.nil? - return - end - - def shareNote(authenticationToken, guid) - send_shareNote(authenticationToken, guid) - return recv_shareNote() - end - - def send_shareNote(authenticationToken, guid) - send_message('shareNote', ShareNote_args, :authenticationToken => authenticationToken, :guid => guid) - end - - def recv_shareNote() - result = receive_message(ShareNote_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise result.systemException unless result.systemException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'shareNote failed: unknown result') - end - - def stopSharingNote(authenticationToken, guid) - send_stopSharingNote(authenticationToken, guid) - recv_stopSharingNote() - end - - def send_stopSharingNote(authenticationToken, guid) - send_message('stopSharingNote', StopSharingNote_args, :authenticationToken => authenticationToken, :guid => guid) - end - - def recv_stopSharingNote() - result = receive_message(StopSharingNote_result) - raise result.userException unless result.userException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise result.systemException unless result.systemException.nil? - return - end - - def authenticateToSharedNote(guid, noteKey) - send_authenticateToSharedNote(guid, noteKey) - return recv_authenticateToSharedNote() - end - - def send_authenticateToSharedNote(guid, noteKey) - send_message('authenticateToSharedNote', AuthenticateToSharedNote_args, :guid => guid, :noteKey => noteKey) - end - - def recv_authenticateToSharedNote() - result = receive_message(AuthenticateToSharedNote_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise result.systemException unless result.systemException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'authenticateToSharedNote failed: unknown result') - end - - def findRelated(authenticationToken, query, resultSpec) - send_findRelated(authenticationToken, query, resultSpec) - return recv_findRelated() - end - - def send_findRelated(authenticationToken, query, resultSpec) - send_message('findRelated', FindRelated_args, :authenticationToken => authenticationToken, :query => query, :resultSpec => resultSpec) - end - - def recv_findRelated() - result = receive_message(FindRelated_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'findRelated failed: unknown result') - end - - end - - class Processor - include ::Thrift::Processor - - def process_getSyncState(seqid, iprot, oprot) - args = read_args(iprot, GetSyncState_args) - result = GetSyncState_result.new() - begin - result.success = @handler.getSyncState(args.authenticationToken) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - end - write_result(result, oprot, 'getSyncState', seqid) - end - - def process_getSyncStateWithMetrics(seqid, iprot, oprot) - args = read_args(iprot, GetSyncStateWithMetrics_args) - result = GetSyncStateWithMetrics_result.new() - begin - result.success = @handler.getSyncStateWithMetrics(args.authenticationToken, args.clientMetrics) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - end - write_result(result, oprot, 'getSyncStateWithMetrics', seqid) - end - - def process_getSyncChunk(seqid, iprot, oprot) - args = read_args(iprot, GetSyncChunk_args) - result = GetSyncChunk_result.new() - begin - result.success = @handler.getSyncChunk(args.authenticationToken, args.afterUSN, args.maxEntries, args.fullSyncOnly) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - end - write_result(result, oprot, 'getSyncChunk', seqid) - end - - def process_getFilteredSyncChunk(seqid, iprot, oprot) - args = read_args(iprot, GetFilteredSyncChunk_args) - result = GetFilteredSyncChunk_result.new() - begin - result.success = @handler.getFilteredSyncChunk(args.authenticationToken, args.afterUSN, args.maxEntries, args.filter) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - end - write_result(result, oprot, 'getFilteredSyncChunk', seqid) - end - - def process_getLinkedNotebookSyncState(seqid, iprot, oprot) - args = read_args(iprot, GetLinkedNotebookSyncState_args) - result = GetLinkedNotebookSyncState_result.new() - begin - result.success = @handler.getLinkedNotebookSyncState(args.authenticationToken, args.linkedNotebook) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - end - write_result(result, oprot, 'getLinkedNotebookSyncState', seqid) - end - - def process_getLinkedNotebookSyncChunk(seqid, iprot, oprot) - args = read_args(iprot, GetLinkedNotebookSyncChunk_args) - result = GetLinkedNotebookSyncChunk_result.new() - begin - result.success = @handler.getLinkedNotebookSyncChunk(args.authenticationToken, args.linkedNotebook, args.afterUSN, args.maxEntries, args.fullSyncOnly) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - end - write_result(result, oprot, 'getLinkedNotebookSyncChunk', seqid) - end - - def process_listNotebooks(seqid, iprot, oprot) - args = read_args(iprot, ListNotebooks_args) - result = ListNotebooks_result.new() - begin - result.success = @handler.listNotebooks(args.authenticationToken) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - end - write_result(result, oprot, 'listNotebooks', seqid) - end - - def process_getNotebook(seqid, iprot, oprot) - args = read_args(iprot, GetNotebook_args) - result = GetNotebook_result.new() - begin - result.success = @handler.getNotebook(args.authenticationToken, args.guid) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - end - write_result(result, oprot, 'getNotebook', seqid) - end - - def process_getDefaultNotebook(seqid, iprot, oprot) - args = read_args(iprot, GetDefaultNotebook_args) - result = GetDefaultNotebook_result.new() - begin - result.success = @handler.getDefaultNotebook(args.authenticationToken) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - end - write_result(result, oprot, 'getDefaultNotebook', seqid) - end - - def process_createNotebook(seqid, iprot, oprot) - args = read_args(iprot, CreateNotebook_args) - result = CreateNotebook_result.new() - begin - result.success = @handler.createNotebook(args.authenticationToken, args.notebook) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - end - write_result(result, oprot, 'createNotebook', seqid) - end - - def process_updateNotebook(seqid, iprot, oprot) - args = read_args(iprot, UpdateNotebook_args) - result = UpdateNotebook_result.new() - begin - result.success = @handler.updateNotebook(args.authenticationToken, args.notebook) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - end - write_result(result, oprot, 'updateNotebook', seqid) - end - - def process_expungeNotebook(seqid, iprot, oprot) - args = read_args(iprot, ExpungeNotebook_args) - result = ExpungeNotebook_result.new() - begin - result.success = @handler.expungeNotebook(args.authenticationToken, args.guid) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - end - write_result(result, oprot, 'expungeNotebook', seqid) - end - - def process_listTags(seqid, iprot, oprot) - args = read_args(iprot, ListTags_args) - result = ListTags_result.new() - begin - result.success = @handler.listTags(args.authenticationToken) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - end - write_result(result, oprot, 'listTags', seqid) - end - - def process_listTagsByNotebook(seqid, iprot, oprot) - args = read_args(iprot, ListTagsByNotebook_args) - result = ListTagsByNotebook_result.new() - begin - result.success = @handler.listTagsByNotebook(args.authenticationToken, args.notebookGuid) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - end - write_result(result, oprot, 'listTagsByNotebook', seqid) - end - - def process_getTag(seqid, iprot, oprot) - args = read_args(iprot, GetTag_args) - result = GetTag_result.new() - begin - result.success = @handler.getTag(args.authenticationToken, args.guid) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - end - write_result(result, oprot, 'getTag', seqid) - end - - def process_createTag(seqid, iprot, oprot) - args = read_args(iprot, CreateTag_args) - result = CreateTag_result.new() - begin - result.success = @handler.createTag(args.authenticationToken, args.tag) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - end - write_result(result, oprot, 'createTag', seqid) - end - - def process_updateTag(seqid, iprot, oprot) - args = read_args(iprot, UpdateTag_args) - result = UpdateTag_result.new() - begin - result.success = @handler.updateTag(args.authenticationToken, args.tag) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - end - write_result(result, oprot, 'updateTag', seqid) - end - - def process_untagAll(seqid, iprot, oprot) - args = read_args(iprot, UntagAll_args) - result = UntagAll_result.new() - begin - @handler.untagAll(args.authenticationToken, args.guid) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - end - write_result(result, oprot, 'untagAll', seqid) - end - - def process_expungeTag(seqid, iprot, oprot) - args = read_args(iprot, ExpungeTag_args) - result = ExpungeTag_result.new() - begin - result.success = @handler.expungeTag(args.authenticationToken, args.guid) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - end - write_result(result, oprot, 'expungeTag', seqid) - end - - def process_listSearches(seqid, iprot, oprot) - args = read_args(iprot, ListSearches_args) - result = ListSearches_result.new() - begin - result.success = @handler.listSearches(args.authenticationToken) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - end - write_result(result, oprot, 'listSearches', seqid) - end - - def process_getSearch(seqid, iprot, oprot) - args = read_args(iprot, GetSearch_args) - result = GetSearch_result.new() - begin - result.success = @handler.getSearch(args.authenticationToken, args.guid) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - end - write_result(result, oprot, 'getSearch', seqid) - end - - def process_createSearch(seqid, iprot, oprot) - args = read_args(iprot, CreateSearch_args) - result = CreateSearch_result.new() - begin - result.success = @handler.createSearch(args.authenticationToken, args.search) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - end - write_result(result, oprot, 'createSearch', seqid) - end - - def process_updateSearch(seqid, iprot, oprot) - args = read_args(iprot, UpdateSearch_args) - result = UpdateSearch_result.new() - begin - result.success = @handler.updateSearch(args.authenticationToken, args.search) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - end - write_result(result, oprot, 'updateSearch', seqid) - end - - def process_expungeSearch(seqid, iprot, oprot) - args = read_args(iprot, ExpungeSearch_args) - result = ExpungeSearch_result.new() - begin - result.success = @handler.expungeSearch(args.authenticationToken, args.guid) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - end - write_result(result, oprot, 'expungeSearch', seqid) - end - - def process_findNotes(seqid, iprot, oprot) - args = read_args(iprot, FindNotes_args) - result = FindNotes_result.new() - begin - result.success = @handler.findNotes(args.authenticationToken, args.filter, args.offset, args.maxNotes) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - end - write_result(result, oprot, 'findNotes', seqid) - end - - def process_findNoteOffset(seqid, iprot, oprot) - args = read_args(iprot, FindNoteOffset_args) - result = FindNoteOffset_result.new() - begin - result.success = @handler.findNoteOffset(args.authenticationToken, args.filter, args.guid) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - end - write_result(result, oprot, 'findNoteOffset', seqid) - end - - def process_findNotesMetadata(seqid, iprot, oprot) - args = read_args(iprot, FindNotesMetadata_args) - result = FindNotesMetadata_result.new() - begin - result.success = @handler.findNotesMetadata(args.authenticationToken, args.filter, args.offset, args.maxNotes, args.resultSpec) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - end - write_result(result, oprot, 'findNotesMetadata', seqid) - end - - def process_findNoteCounts(seqid, iprot, oprot) - args = read_args(iprot, FindNoteCounts_args) - result = FindNoteCounts_result.new() - begin - result.success = @handler.findNoteCounts(args.authenticationToken, args.filter, args.withTrash) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - end - write_result(result, oprot, 'findNoteCounts', seqid) - end - - def process_getNote(seqid, iprot, oprot) - args = read_args(iprot, GetNote_args) - result = GetNote_result.new() - begin - result.success = @handler.getNote(args.authenticationToken, args.guid, args.withContent, args.withResourcesData, args.withResourcesRecognition, args.withResourcesAlternateData) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - end - write_result(result, oprot, 'getNote', seqid) - end - - def process_getNoteApplicationData(seqid, iprot, oprot) - args = read_args(iprot, GetNoteApplicationData_args) - result = GetNoteApplicationData_result.new() - begin - result.success = @handler.getNoteApplicationData(args.authenticationToken, args.guid) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - end - write_result(result, oprot, 'getNoteApplicationData', seqid) - end - - def process_getNoteApplicationDataEntry(seqid, iprot, oprot) - args = read_args(iprot, GetNoteApplicationDataEntry_args) - result = GetNoteApplicationDataEntry_result.new() - begin - result.success = @handler.getNoteApplicationDataEntry(args.authenticationToken, args.guid, args.key) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - end - write_result(result, oprot, 'getNoteApplicationDataEntry', seqid) - end - - def process_setNoteApplicationDataEntry(seqid, iprot, oprot) - args = read_args(iprot, SetNoteApplicationDataEntry_args) - result = SetNoteApplicationDataEntry_result.new() - begin - result.success = @handler.setNoteApplicationDataEntry(args.authenticationToken, args.guid, args.key, args.value) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - end - write_result(result, oprot, 'setNoteApplicationDataEntry', seqid) - end - - def process_unsetNoteApplicationDataEntry(seqid, iprot, oprot) - args = read_args(iprot, UnsetNoteApplicationDataEntry_args) - result = UnsetNoteApplicationDataEntry_result.new() - begin - result.success = @handler.unsetNoteApplicationDataEntry(args.authenticationToken, args.guid, args.key) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - end - write_result(result, oprot, 'unsetNoteApplicationDataEntry', seqid) - end - - def process_getNoteContent(seqid, iprot, oprot) - args = read_args(iprot, GetNoteContent_args) - result = GetNoteContent_result.new() - begin - result.success = @handler.getNoteContent(args.authenticationToken, args.guid) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - end - write_result(result, oprot, 'getNoteContent', seqid) - end - - def process_getNoteSearchText(seqid, iprot, oprot) - args = read_args(iprot, GetNoteSearchText_args) - result = GetNoteSearchText_result.new() - begin - result.success = @handler.getNoteSearchText(args.authenticationToken, args.guid, args.noteOnly, args.tokenizeForIndexing) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - end - write_result(result, oprot, 'getNoteSearchText', seqid) - end - - def process_getResourceSearchText(seqid, iprot, oprot) - args = read_args(iprot, GetResourceSearchText_args) - result = GetResourceSearchText_result.new() - begin - result.success = @handler.getResourceSearchText(args.authenticationToken, args.guid) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - end - write_result(result, oprot, 'getResourceSearchText', seqid) - end - - def process_getNoteTagNames(seqid, iprot, oprot) - args = read_args(iprot, GetNoteTagNames_args) - result = GetNoteTagNames_result.new() - begin - result.success = @handler.getNoteTagNames(args.authenticationToken, args.guid) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - end - write_result(result, oprot, 'getNoteTagNames', seqid) - end - - def process_createNote(seqid, iprot, oprot) - args = read_args(iprot, CreateNote_args) - result = CreateNote_result.new() - begin - result.success = @handler.createNote(args.authenticationToken, args.note) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - end - write_result(result, oprot, 'createNote', seqid) - end - - def process_updateNote(seqid, iprot, oprot) - args = read_args(iprot, UpdateNote_args) - result = UpdateNote_result.new() - begin - result.success = @handler.updateNote(args.authenticationToken, args.note) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - end - write_result(result, oprot, 'updateNote', seqid) - end - - def process_deleteNote(seqid, iprot, oprot) - args = read_args(iprot, DeleteNote_args) - result = DeleteNote_result.new() - begin - result.success = @handler.deleteNote(args.authenticationToken, args.guid) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - end - write_result(result, oprot, 'deleteNote', seqid) - end - - def process_expungeNote(seqid, iprot, oprot) - args = read_args(iprot, ExpungeNote_args) - result = ExpungeNote_result.new() - begin - result.success = @handler.expungeNote(args.authenticationToken, args.guid) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - end - write_result(result, oprot, 'expungeNote', seqid) - end - - def process_expungeNotes(seqid, iprot, oprot) - args = read_args(iprot, ExpungeNotes_args) - result = ExpungeNotes_result.new() - begin - result.success = @handler.expungeNotes(args.authenticationToken, args.noteGuids) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - end - write_result(result, oprot, 'expungeNotes', seqid) - end - - def process_expungeInactiveNotes(seqid, iprot, oprot) - args = read_args(iprot, ExpungeInactiveNotes_args) - result = ExpungeInactiveNotes_result.new() - begin - result.success = @handler.expungeInactiveNotes(args.authenticationToken) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - end - write_result(result, oprot, 'expungeInactiveNotes', seqid) - end - - def process_copyNote(seqid, iprot, oprot) - args = read_args(iprot, CopyNote_args) - result = CopyNote_result.new() - begin - result.success = @handler.copyNote(args.authenticationToken, args.noteGuid, args.toNotebookGuid) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - end - write_result(result, oprot, 'copyNote', seqid) - end - - def process_listNoteVersions(seqid, iprot, oprot) - args = read_args(iprot, ListNoteVersions_args) - result = ListNoteVersions_result.new() - begin - result.success = @handler.listNoteVersions(args.authenticationToken, args.noteGuid) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - end - write_result(result, oprot, 'listNoteVersions', seqid) - end - - def process_getNoteVersion(seqid, iprot, oprot) - args = read_args(iprot, GetNoteVersion_args) - result = GetNoteVersion_result.new() - begin - result.success = @handler.getNoteVersion(args.authenticationToken, args.noteGuid, args.updateSequenceNum, args.withResourcesData, args.withResourcesRecognition, args.withResourcesAlternateData) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - end - write_result(result, oprot, 'getNoteVersion', seqid) - end - - def process_getResource(seqid, iprot, oprot) - args = read_args(iprot, GetResource_args) - result = GetResource_result.new() - begin - result.success = @handler.getResource(args.authenticationToken, args.guid, args.withData, args.withRecognition, args.withAttributes, args.withAlternateData) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - end - write_result(result, oprot, 'getResource', seqid) - end - - def process_getResourceApplicationData(seqid, iprot, oprot) - args = read_args(iprot, GetResourceApplicationData_args) - result = GetResourceApplicationData_result.new() - begin - result.success = @handler.getResourceApplicationData(args.authenticationToken, args.guid) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - end - write_result(result, oprot, 'getResourceApplicationData', seqid) - end - - def process_getResourceApplicationDataEntry(seqid, iprot, oprot) - args = read_args(iprot, GetResourceApplicationDataEntry_args) - result = GetResourceApplicationDataEntry_result.new() - begin - result.success = @handler.getResourceApplicationDataEntry(args.authenticationToken, args.guid, args.key) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - end - write_result(result, oprot, 'getResourceApplicationDataEntry', seqid) - end - - def process_setResourceApplicationDataEntry(seqid, iprot, oprot) - args = read_args(iprot, SetResourceApplicationDataEntry_args) - result = SetResourceApplicationDataEntry_result.new() - begin - result.success = @handler.setResourceApplicationDataEntry(args.authenticationToken, args.guid, args.key, args.value) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - end - write_result(result, oprot, 'setResourceApplicationDataEntry', seqid) - end - - def process_unsetResourceApplicationDataEntry(seqid, iprot, oprot) - args = read_args(iprot, UnsetResourceApplicationDataEntry_args) - result = UnsetResourceApplicationDataEntry_result.new() - begin - result.success = @handler.unsetResourceApplicationDataEntry(args.authenticationToken, args.guid, args.key) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - end - write_result(result, oprot, 'unsetResourceApplicationDataEntry', seqid) - end - - def process_updateResource(seqid, iprot, oprot) - args = read_args(iprot, UpdateResource_args) - result = UpdateResource_result.new() - begin - result.success = @handler.updateResource(args.authenticationToken, args.resource) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - end - write_result(result, oprot, 'updateResource', seqid) - end - - def process_getResourceData(seqid, iprot, oprot) - args = read_args(iprot, GetResourceData_args) - result = GetResourceData_result.new() - begin - result.success = @handler.getResourceData(args.authenticationToken, args.guid) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - end - write_result(result, oprot, 'getResourceData', seqid) - end - - def process_getResourceByHash(seqid, iprot, oprot) - args = read_args(iprot, GetResourceByHash_args) - result = GetResourceByHash_result.new() - begin - result.success = @handler.getResourceByHash(args.authenticationToken, args.noteGuid, args.contentHash, args.withData, args.withRecognition, args.withAlternateData) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - end - write_result(result, oprot, 'getResourceByHash', seqid) - end - - def process_getResourceRecognition(seqid, iprot, oprot) - args = read_args(iprot, GetResourceRecognition_args) - result = GetResourceRecognition_result.new() - begin - result.success = @handler.getResourceRecognition(args.authenticationToken, args.guid) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - end - write_result(result, oprot, 'getResourceRecognition', seqid) - end - - def process_getResourceAlternateData(seqid, iprot, oprot) - args = read_args(iprot, GetResourceAlternateData_args) - result = GetResourceAlternateData_result.new() - begin - result.success = @handler.getResourceAlternateData(args.authenticationToken, args.guid) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - end - write_result(result, oprot, 'getResourceAlternateData', seqid) - end - - def process_getResourceAttributes(seqid, iprot, oprot) - args = read_args(iprot, GetResourceAttributes_args) - result = GetResourceAttributes_result.new() - begin - result.success = @handler.getResourceAttributes(args.authenticationToken, args.guid) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - end - write_result(result, oprot, 'getResourceAttributes', seqid) - end - - def process_getAccountSize(seqid, iprot, oprot) - args = read_args(iprot, GetAccountSize_args) - result = GetAccountSize_result.new() - begin - result.success = @handler.getAccountSize(args.authenticationToken) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - end - write_result(result, oprot, 'getAccountSize', seqid) - end - - def process_getAds(seqid, iprot, oprot) - args = read_args(iprot, GetAds_args) - result = GetAds_result.new() - begin - result.success = @handler.getAds(args.authenticationToken, args.adParameters) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - end - write_result(result, oprot, 'getAds', seqid) - end - - def process_getRandomAd(seqid, iprot, oprot) - args = read_args(iprot, GetRandomAd_args) - result = GetRandomAd_result.new() - begin - result.success = @handler.getRandomAd(args.authenticationToken, args.adParameters) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - end - write_result(result, oprot, 'getRandomAd', seqid) - end - - def process_getPublicNotebook(seqid, iprot, oprot) - args = read_args(iprot, GetPublicNotebook_args) - result = GetPublicNotebook_result.new() - begin - result.success = @handler.getPublicNotebook(args.userId, args.publicUri) - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - end - write_result(result, oprot, 'getPublicNotebook', seqid) - end - - def process_createSharedNotebook(seqid, iprot, oprot) - args = read_args(iprot, CreateSharedNotebook_args) - result = CreateSharedNotebook_result.new() - begin - result.success = @handler.createSharedNotebook(args.authenticationToken, args.sharedNotebook) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - end - write_result(result, oprot, 'createSharedNotebook', seqid) - end - - def process_sendMessageToSharedNotebookMembers(seqid, iprot, oprot) - args = read_args(iprot, SendMessageToSharedNotebookMembers_args) - result = SendMessageToSharedNotebookMembers_result.new() - begin - result.success = @handler.sendMessageToSharedNotebookMembers(args.authenticationToken, args.notebookGuid, args.messageText, args.recipients) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - end - write_result(result, oprot, 'sendMessageToSharedNotebookMembers', seqid) - end - - def process_listSharedNotebooks(seqid, iprot, oprot) - args = read_args(iprot, ListSharedNotebooks_args) - result = ListSharedNotebooks_result.new() - begin - result.success = @handler.listSharedNotebooks(args.authenticationToken) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - end - write_result(result, oprot, 'listSharedNotebooks', seqid) - end - - def process_expungeSharedNotebooks(seqid, iprot, oprot) - args = read_args(iprot, ExpungeSharedNotebooks_args) - result = ExpungeSharedNotebooks_result.new() - begin - result.success = @handler.expungeSharedNotebooks(args.authenticationToken, args.sharedNotebookIds) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - end - write_result(result, oprot, 'expungeSharedNotebooks', seqid) - end - - def process_createLinkedNotebook(seqid, iprot, oprot) - args = read_args(iprot, CreateLinkedNotebook_args) - result = CreateLinkedNotebook_result.new() - begin - result.success = @handler.createLinkedNotebook(args.authenticationToken, args.linkedNotebook) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - end - write_result(result, oprot, 'createLinkedNotebook', seqid) - end - - def process_updateLinkedNotebook(seqid, iprot, oprot) - args = read_args(iprot, UpdateLinkedNotebook_args) - result = UpdateLinkedNotebook_result.new() - begin - result.success = @handler.updateLinkedNotebook(args.authenticationToken, args.linkedNotebook) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - end - write_result(result, oprot, 'updateLinkedNotebook', seqid) - end - - def process_listLinkedNotebooks(seqid, iprot, oprot) - args = read_args(iprot, ListLinkedNotebooks_args) - result = ListLinkedNotebooks_result.new() - begin - result.success = @handler.listLinkedNotebooks(args.authenticationToken) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - end - write_result(result, oprot, 'listLinkedNotebooks', seqid) - end - - def process_expungeLinkedNotebook(seqid, iprot, oprot) - args = read_args(iprot, ExpungeLinkedNotebook_args) - result = ExpungeLinkedNotebook_result.new() - begin - result.success = @handler.expungeLinkedNotebook(args.authenticationToken, args.guid) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - end - write_result(result, oprot, 'expungeLinkedNotebook', seqid) - end - - def process_authenticateToSharedNotebook(seqid, iprot, oprot) - args = read_args(iprot, AuthenticateToSharedNotebook_args) - result = AuthenticateToSharedNotebook_result.new() - begin - result.success = @handler.authenticateToSharedNotebook(args.shareKey, args.authenticationToken) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - end - write_result(result, oprot, 'authenticateToSharedNotebook', seqid) - end - - def process_getSharedNotebookByAuth(seqid, iprot, oprot) - args = read_args(iprot, GetSharedNotebookByAuth_args) - result = GetSharedNotebookByAuth_result.new() - begin - result.success = @handler.getSharedNotebookByAuth(args.authenticationToken) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - end - write_result(result, oprot, 'getSharedNotebookByAuth', seqid) - end - - def process_emailNote(seqid, iprot, oprot) - args = read_args(iprot, EmailNote_args) - result = EmailNote_result.new() - begin - @handler.emailNote(args.authenticationToken, args.parameters) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - end - write_result(result, oprot, 'emailNote', seqid) - end - - def process_shareNote(seqid, iprot, oprot) - args = read_args(iprot, ShareNote_args) - result = ShareNote_result.new() - begin - result.success = @handler.shareNote(args.authenticationToken, args.guid) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - end - write_result(result, oprot, 'shareNote', seqid) - end - - def process_stopSharingNote(seqid, iprot, oprot) - args = read_args(iprot, StopSharingNote_args) - result = StopSharingNote_result.new() - begin - @handler.stopSharingNote(args.authenticationToken, args.guid) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - end - write_result(result, oprot, 'stopSharingNote', seqid) - end - - def process_authenticateToSharedNote(seqid, iprot, oprot) - args = read_args(iprot, AuthenticateToSharedNote_args) - result = AuthenticateToSharedNote_result.new() - begin - result.success = @handler.authenticateToSharedNote(args.guid, args.noteKey) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - end - write_result(result, oprot, 'authenticateToSharedNote', seqid) - end - - def process_findRelated(seqid, iprot, oprot) - args = read_args(iprot, FindRelated_args) - result = FindRelated_result.new() - begin - result.success = @handler.findRelated(args.authenticationToken, args.query, args.resultSpec) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - end - write_result(result, oprot, 'findRelated', seqid) - end - - end - - # HELPER FUNCTIONS AND STRUCTURES - - class GetSyncState_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetSyncState_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => Evernote::EDAM::NoteStore::SyncState}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetSyncStateWithMetrics_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - CLIENTMETRICS = 2 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - CLIENTMETRICS => {:type => ::Thrift::Types::STRUCT, :name => 'clientMetrics', :class => Evernote::EDAM::NoteStore::ClientUsageMetrics} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetSyncStateWithMetrics_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => Evernote::EDAM::NoteStore::SyncState}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetSyncChunk_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - AFTERUSN = 2 - MAXENTRIES = 3 - FULLSYNCONLY = 4 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - AFTERUSN => {:type => ::Thrift::Types::I32, :name => 'afterUSN'}, - MAXENTRIES => {:type => ::Thrift::Types::I32, :name => 'maxEntries'}, - FULLSYNCONLY => {:type => ::Thrift::Types::BOOL, :name => 'fullSyncOnly'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetSyncChunk_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => Evernote::EDAM::NoteStore::SyncChunk}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetFilteredSyncChunk_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - AFTERUSN = 2 - MAXENTRIES = 3 - FILTER = 4 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - AFTERUSN => {:type => ::Thrift::Types::I32, :name => 'afterUSN'}, - MAXENTRIES => {:type => ::Thrift::Types::I32, :name => 'maxEntries'}, - FILTER => {:type => ::Thrift::Types::STRUCT, :name => 'filter', :class => Evernote::EDAM::NoteStore::SyncChunkFilter} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetFilteredSyncChunk_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => Evernote::EDAM::NoteStore::SyncChunk}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetLinkedNotebookSyncState_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - LINKEDNOTEBOOK = 2 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - LINKEDNOTEBOOK => {:type => ::Thrift::Types::STRUCT, :name => 'linkedNotebook', :class => Evernote::EDAM::Type::LinkedNotebook} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetLinkedNotebookSyncState_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - NOTFOUNDEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => Evernote::EDAM::NoteStore::SyncState}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetLinkedNotebookSyncChunk_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - LINKEDNOTEBOOK = 2 - AFTERUSN = 3 - MAXENTRIES = 4 - FULLSYNCONLY = 5 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - LINKEDNOTEBOOK => {:type => ::Thrift::Types::STRUCT, :name => 'linkedNotebook', :class => Evernote::EDAM::Type::LinkedNotebook}, - AFTERUSN => {:type => ::Thrift::Types::I32, :name => 'afterUSN'}, - MAXENTRIES => {:type => ::Thrift::Types::I32, :name => 'maxEntries'}, - FULLSYNCONLY => {:type => ::Thrift::Types::BOOL, :name => 'fullSyncOnly'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetLinkedNotebookSyncChunk_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - NOTFOUNDEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => Evernote::EDAM::NoteStore::SyncChunk}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class ListNotebooks_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class ListNotebooks_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => Evernote::EDAM::Type::Notebook}}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetNotebook_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - GUID = 2 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - GUID => {:type => ::Thrift::Types::STRING, :name => 'guid'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetNotebook_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - NOTFOUNDEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => Evernote::EDAM::Type::Notebook}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetDefaultNotebook_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetDefaultNotebook_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => Evernote::EDAM::Type::Notebook}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class CreateNotebook_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - NOTEBOOK = 2 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - NOTEBOOK => {:type => ::Thrift::Types::STRUCT, :name => 'notebook', :class => Evernote::EDAM::Type::Notebook} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class CreateNotebook_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => Evernote::EDAM::Type::Notebook}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class UpdateNotebook_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - NOTEBOOK = 2 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - NOTEBOOK => {:type => ::Thrift::Types::STRUCT, :name => 'notebook', :class => Evernote::EDAM::Type::Notebook} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class UpdateNotebook_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - NOTFOUNDEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::I32, :name => 'success'}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class ExpungeNotebook_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - GUID = 2 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - GUID => {:type => ::Thrift::Types::STRING, :name => 'guid'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class ExpungeNotebook_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - NOTFOUNDEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::I32, :name => 'success'}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class ListTags_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class ListTags_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => Evernote::EDAM::Type::Tag}}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class ListTagsByNotebook_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - NOTEBOOKGUID = 2 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - NOTEBOOKGUID => {:type => ::Thrift::Types::STRING, :name => 'notebookGuid'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class ListTagsByNotebook_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - NOTFOUNDEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => Evernote::EDAM::Type::Tag}}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetTag_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - GUID = 2 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - GUID => {:type => ::Thrift::Types::STRING, :name => 'guid'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetTag_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - NOTFOUNDEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => Evernote::EDAM::Type::Tag}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class CreateTag_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - TAG = 2 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - TAG => {:type => ::Thrift::Types::STRUCT, :name => 'tag', :class => Evernote::EDAM::Type::Tag} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class CreateTag_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - NOTFOUNDEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => Evernote::EDAM::Type::Tag}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class UpdateTag_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - TAG = 2 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - TAG => {:type => ::Thrift::Types::STRUCT, :name => 'tag', :class => Evernote::EDAM::Type::Tag} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class UpdateTag_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - NOTFOUNDEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::I32, :name => 'success'}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class UntagAll_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - GUID = 2 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - GUID => {:type => ::Thrift::Types::STRING, :name => 'guid'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class UntagAll_result - include ::Thrift::Struct, ::Thrift::Struct_Union - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - NOTFOUNDEXCEPTION = 3 - - FIELDS = { - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class ExpungeTag_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - GUID = 2 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - GUID => {:type => ::Thrift::Types::STRING, :name => 'guid'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class ExpungeTag_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - NOTFOUNDEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::I32, :name => 'success'}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class ListSearches_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class ListSearches_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => Evernote::EDAM::Type::SavedSearch}}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetSearch_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - GUID = 2 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - GUID => {:type => ::Thrift::Types::STRING, :name => 'guid'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetSearch_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - NOTFOUNDEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => Evernote::EDAM::Type::SavedSearch}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class CreateSearch_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - SEARCH = 2 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - SEARCH => {:type => ::Thrift::Types::STRUCT, :name => 'search', :class => Evernote::EDAM::Type::SavedSearch} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class CreateSearch_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => Evernote::EDAM::Type::SavedSearch}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class UpdateSearch_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - SEARCH = 2 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - SEARCH => {:type => ::Thrift::Types::STRUCT, :name => 'search', :class => Evernote::EDAM::Type::SavedSearch} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class UpdateSearch_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - NOTFOUNDEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::I32, :name => 'success'}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class ExpungeSearch_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - GUID = 2 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - GUID => {:type => ::Thrift::Types::STRING, :name => 'guid'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class ExpungeSearch_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - NOTFOUNDEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::I32, :name => 'success'}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class FindNotes_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - FILTER = 2 - OFFSET = 3 - MAXNOTES = 4 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - FILTER => {:type => ::Thrift::Types::STRUCT, :name => 'filter', :class => Evernote::EDAM::NoteStore::NoteFilter}, - OFFSET => {:type => ::Thrift::Types::I32, :name => 'offset'}, - MAXNOTES => {:type => ::Thrift::Types::I32, :name => 'maxNotes'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class FindNotes_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - NOTFOUNDEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => Evernote::EDAM::NoteStore::NoteList}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class FindNoteOffset_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - FILTER = 2 - GUID = 3 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - FILTER => {:type => ::Thrift::Types::STRUCT, :name => 'filter', :class => Evernote::EDAM::NoteStore::NoteFilter}, - GUID => {:type => ::Thrift::Types::STRING, :name => 'guid'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class FindNoteOffset_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - NOTFOUNDEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::I32, :name => 'success'}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class FindNotesMetadata_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - FILTER = 2 - OFFSET = 3 - MAXNOTES = 4 - RESULTSPEC = 5 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - FILTER => {:type => ::Thrift::Types::STRUCT, :name => 'filter', :class => Evernote::EDAM::NoteStore::NoteFilter}, - OFFSET => {:type => ::Thrift::Types::I32, :name => 'offset'}, - MAXNOTES => {:type => ::Thrift::Types::I32, :name => 'maxNotes'}, - RESULTSPEC => {:type => ::Thrift::Types::STRUCT, :name => 'resultSpec', :class => Evernote::EDAM::NoteStore::NotesMetadataResultSpec} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class FindNotesMetadata_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - NOTFOUNDEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => Evernote::EDAM::NoteStore::NotesMetadataList}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class FindNoteCounts_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - FILTER = 2 - WITHTRASH = 3 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - FILTER => {:type => ::Thrift::Types::STRUCT, :name => 'filter', :class => Evernote::EDAM::NoteStore::NoteFilter}, - WITHTRASH => {:type => ::Thrift::Types::BOOL, :name => 'withTrash'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class FindNoteCounts_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - NOTFOUNDEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => Evernote::EDAM::NoteStore::NoteCollectionCounts}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetNote_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - GUID = 2 - WITHCONTENT = 3 - WITHRESOURCESDATA = 4 - WITHRESOURCESRECOGNITION = 5 - WITHRESOURCESALTERNATEDATA = 6 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - GUID => {:type => ::Thrift::Types::STRING, :name => 'guid'}, - WITHCONTENT => {:type => ::Thrift::Types::BOOL, :name => 'withContent'}, - WITHRESOURCESDATA => {:type => ::Thrift::Types::BOOL, :name => 'withResourcesData'}, - WITHRESOURCESRECOGNITION => {:type => ::Thrift::Types::BOOL, :name => 'withResourcesRecognition'}, - WITHRESOURCESALTERNATEDATA => {:type => ::Thrift::Types::BOOL, :name => 'withResourcesAlternateData'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetNote_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - NOTFOUNDEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => Evernote::EDAM::Type::Note}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetNoteApplicationData_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - GUID = 2 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - GUID => {:type => ::Thrift::Types::STRING, :name => 'guid'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetNoteApplicationData_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - NOTFOUNDEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => Evernote::EDAM::Type::LazyMap}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetNoteApplicationDataEntry_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - GUID = 2 - KEY = 3 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - GUID => {:type => ::Thrift::Types::STRING, :name => 'guid'}, - KEY => {:type => ::Thrift::Types::STRING, :name => 'key'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetNoteApplicationDataEntry_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - NOTFOUNDEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRING, :name => 'success'}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class SetNoteApplicationDataEntry_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - GUID = 2 - KEY = 3 - VALUE = 4 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - GUID => {:type => ::Thrift::Types::STRING, :name => 'guid'}, - KEY => {:type => ::Thrift::Types::STRING, :name => 'key'}, - VALUE => {:type => ::Thrift::Types::STRING, :name => 'value'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class SetNoteApplicationDataEntry_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - NOTFOUNDEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::I32, :name => 'success'}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class UnsetNoteApplicationDataEntry_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - GUID = 2 - KEY = 3 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - GUID => {:type => ::Thrift::Types::STRING, :name => 'guid'}, - KEY => {:type => ::Thrift::Types::STRING, :name => 'key'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class UnsetNoteApplicationDataEntry_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - NOTFOUNDEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::I32, :name => 'success'}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetNoteContent_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - GUID = 2 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - GUID => {:type => ::Thrift::Types::STRING, :name => 'guid'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetNoteContent_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - NOTFOUNDEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRING, :name => 'success'}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetNoteSearchText_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - GUID = 2 - NOTEONLY = 3 - TOKENIZEFORINDEXING = 4 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - GUID => {:type => ::Thrift::Types::STRING, :name => 'guid'}, - NOTEONLY => {:type => ::Thrift::Types::BOOL, :name => 'noteOnly'}, - TOKENIZEFORINDEXING => {:type => ::Thrift::Types::BOOL, :name => 'tokenizeForIndexing'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetNoteSearchText_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - NOTFOUNDEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRING, :name => 'success'}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetResourceSearchText_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - GUID = 2 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - GUID => {:type => ::Thrift::Types::STRING, :name => 'guid'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetResourceSearchText_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - NOTFOUNDEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRING, :name => 'success'}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetNoteTagNames_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - GUID = 2 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - GUID => {:type => ::Thrift::Types::STRING, :name => 'guid'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetNoteTagNames_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - NOTFOUNDEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRING}}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class CreateNote_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - NOTE = 2 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - NOTE => {:type => ::Thrift::Types::STRUCT, :name => 'note', :class => Evernote::EDAM::Type::Note} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class CreateNote_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - NOTFOUNDEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => Evernote::EDAM::Type::Note}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class UpdateNote_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - NOTE = 2 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - NOTE => {:type => ::Thrift::Types::STRUCT, :name => 'note', :class => Evernote::EDAM::Type::Note} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class UpdateNote_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - NOTFOUNDEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => Evernote::EDAM::Type::Note}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class DeleteNote_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - GUID = 2 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - GUID => {:type => ::Thrift::Types::STRING, :name => 'guid'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class DeleteNote_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - NOTFOUNDEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::I32, :name => 'success'}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class ExpungeNote_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - GUID = 2 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - GUID => {:type => ::Thrift::Types::STRING, :name => 'guid'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class ExpungeNote_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - NOTFOUNDEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::I32, :name => 'success'}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class ExpungeNotes_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - NOTEGUIDS = 2 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - NOTEGUIDS => {:type => ::Thrift::Types::LIST, :name => 'noteGuids', :element => {:type => ::Thrift::Types::STRING}} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class ExpungeNotes_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - NOTFOUNDEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::I32, :name => 'success'}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class ExpungeInactiveNotes_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class ExpungeInactiveNotes_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::I32, :name => 'success'}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class CopyNote_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - NOTEGUID = 2 - TONOTEBOOKGUID = 3 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - NOTEGUID => {:type => ::Thrift::Types::STRING, :name => 'noteGuid'}, - TONOTEBOOKGUID => {:type => ::Thrift::Types::STRING, :name => 'toNotebookGuid'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class CopyNote_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - NOTFOUNDEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => Evernote::EDAM::Type::Note}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class ListNoteVersions_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - NOTEGUID = 2 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - NOTEGUID => {:type => ::Thrift::Types::STRING, :name => 'noteGuid'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class ListNoteVersions_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - NOTFOUNDEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => Evernote::EDAM::NoteStore::NoteVersionId}}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetNoteVersion_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - NOTEGUID = 2 - UPDATESEQUENCENUM = 3 - WITHRESOURCESDATA = 4 - WITHRESOURCESRECOGNITION = 5 - WITHRESOURCESALTERNATEDATA = 6 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - NOTEGUID => {:type => ::Thrift::Types::STRING, :name => 'noteGuid'}, - UPDATESEQUENCENUM => {:type => ::Thrift::Types::I32, :name => 'updateSequenceNum'}, - WITHRESOURCESDATA => {:type => ::Thrift::Types::BOOL, :name => 'withResourcesData'}, - WITHRESOURCESRECOGNITION => {:type => ::Thrift::Types::BOOL, :name => 'withResourcesRecognition'}, - WITHRESOURCESALTERNATEDATA => {:type => ::Thrift::Types::BOOL, :name => 'withResourcesAlternateData'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetNoteVersion_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - NOTFOUNDEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => Evernote::EDAM::Type::Note}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetResource_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - GUID = 2 - WITHDATA = 3 - WITHRECOGNITION = 4 - WITHATTRIBUTES = 5 - WITHALTERNATEDATA = 6 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - GUID => {:type => ::Thrift::Types::STRING, :name => 'guid'}, - WITHDATA => {:type => ::Thrift::Types::BOOL, :name => 'withData'}, - WITHRECOGNITION => {:type => ::Thrift::Types::BOOL, :name => 'withRecognition'}, - WITHATTRIBUTES => {:type => ::Thrift::Types::BOOL, :name => 'withAttributes'}, - WITHALTERNATEDATA => {:type => ::Thrift::Types::BOOL, :name => 'withAlternateData'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetResource_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - NOTFOUNDEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => Evernote::EDAM::Type::Resource}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetResourceApplicationData_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - GUID = 2 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - GUID => {:type => ::Thrift::Types::STRING, :name => 'guid'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetResourceApplicationData_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - NOTFOUNDEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => Evernote::EDAM::Type::LazyMap}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetResourceApplicationDataEntry_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - GUID = 2 - KEY = 3 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - GUID => {:type => ::Thrift::Types::STRING, :name => 'guid'}, - KEY => {:type => ::Thrift::Types::STRING, :name => 'key'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetResourceApplicationDataEntry_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - NOTFOUNDEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRING, :name => 'success'}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class SetResourceApplicationDataEntry_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - GUID = 2 - KEY = 3 - VALUE = 4 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - GUID => {:type => ::Thrift::Types::STRING, :name => 'guid'}, - KEY => {:type => ::Thrift::Types::STRING, :name => 'key'}, - VALUE => {:type => ::Thrift::Types::STRING, :name => 'value'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class SetResourceApplicationDataEntry_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - NOTFOUNDEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::I32, :name => 'success'}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class UnsetResourceApplicationDataEntry_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - GUID = 2 - KEY = 3 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - GUID => {:type => ::Thrift::Types::STRING, :name => 'guid'}, - KEY => {:type => ::Thrift::Types::STRING, :name => 'key'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class UnsetResourceApplicationDataEntry_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - NOTFOUNDEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::I32, :name => 'success'}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class UpdateResource_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - RESOURCE = 2 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - RESOURCE => {:type => ::Thrift::Types::STRUCT, :name => 'resource', :class => Evernote::EDAM::Type::Resource} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class UpdateResource_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - NOTFOUNDEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::I32, :name => 'success'}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetResourceData_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - GUID = 2 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - GUID => {:type => ::Thrift::Types::STRING, :name => 'guid'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetResourceData_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - NOTFOUNDEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRING, :name => 'success', :binary => true}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetResourceByHash_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - NOTEGUID = 2 - CONTENTHASH = 3 - WITHDATA = 4 - WITHRECOGNITION = 5 - WITHALTERNATEDATA = 6 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - NOTEGUID => {:type => ::Thrift::Types::STRING, :name => 'noteGuid'}, - CONTENTHASH => {:type => ::Thrift::Types::STRING, :name => 'contentHash', :binary => true}, - WITHDATA => {:type => ::Thrift::Types::BOOL, :name => 'withData'}, - WITHRECOGNITION => {:type => ::Thrift::Types::BOOL, :name => 'withRecognition'}, - WITHALTERNATEDATA => {:type => ::Thrift::Types::BOOL, :name => 'withAlternateData'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetResourceByHash_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - NOTFOUNDEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => Evernote::EDAM::Type::Resource}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetResourceRecognition_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - GUID = 2 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - GUID => {:type => ::Thrift::Types::STRING, :name => 'guid'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetResourceRecognition_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - NOTFOUNDEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRING, :name => 'success', :binary => true}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetResourceAlternateData_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - GUID = 2 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - GUID => {:type => ::Thrift::Types::STRING, :name => 'guid'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetResourceAlternateData_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - NOTFOUNDEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRING, :name => 'success', :binary => true}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetResourceAttributes_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - GUID = 2 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - GUID => {:type => ::Thrift::Types::STRING, :name => 'guid'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetResourceAttributes_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - NOTFOUNDEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => Evernote::EDAM::Type::ResourceAttributes}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetAccountSize_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetAccountSize_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::I64, :name => 'success'}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetAds_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - ADPARAMETERS = 2 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - ADPARAMETERS => {:type => ::Thrift::Types::STRUCT, :name => 'adParameters', :class => Evernote::EDAM::NoteStore::AdParameters} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetAds_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => Evernote::EDAM::Type::Ad}}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetRandomAd_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - ADPARAMETERS = 2 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - ADPARAMETERS => {:type => ::Thrift::Types::STRUCT, :name => 'adParameters', :class => Evernote::EDAM::NoteStore::AdParameters} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetRandomAd_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => Evernote::EDAM::Type::Ad}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetPublicNotebook_args - include ::Thrift::Struct, ::Thrift::Struct_Union - USERID = 1 - PUBLICURI = 2 - - FIELDS = { - USERID => {:type => ::Thrift::Types::I32, :name => 'userId'}, - PUBLICURI => {:type => ::Thrift::Types::STRING, :name => 'publicUri'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetPublicNotebook_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - SYSTEMEXCEPTION = 1 - NOTFOUNDEXCEPTION = 2 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => Evernote::EDAM::Type::Notebook}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class CreateSharedNotebook_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - SHAREDNOTEBOOK = 2 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - SHAREDNOTEBOOK => {:type => ::Thrift::Types::STRUCT, :name => 'sharedNotebook', :class => Evernote::EDAM::Type::SharedNotebook} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class CreateSharedNotebook_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - NOTFOUNDEXCEPTION = 2 - SYSTEMEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => Evernote::EDAM::Type::SharedNotebook}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class SendMessageToSharedNotebookMembers_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - NOTEBOOKGUID = 2 - MESSAGETEXT = 3 - RECIPIENTS = 4 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - NOTEBOOKGUID => {:type => ::Thrift::Types::STRING, :name => 'notebookGuid'}, - MESSAGETEXT => {:type => ::Thrift::Types::STRING, :name => 'messageText'}, - RECIPIENTS => {:type => ::Thrift::Types::LIST, :name => 'recipients', :element => {:type => ::Thrift::Types::STRING}} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class SendMessageToSharedNotebookMembers_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - NOTFOUNDEXCEPTION = 2 - SYSTEMEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::I32, :name => 'success'}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class ListSharedNotebooks_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class ListSharedNotebooks_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - NOTFOUNDEXCEPTION = 2 - SYSTEMEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => Evernote::EDAM::Type::SharedNotebook}}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class ExpungeSharedNotebooks_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - SHAREDNOTEBOOKIDS = 2 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - SHAREDNOTEBOOKIDS => {:type => ::Thrift::Types::LIST, :name => 'sharedNotebookIds', :element => {:type => ::Thrift::Types::I64}} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class ExpungeSharedNotebooks_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - NOTFOUNDEXCEPTION = 2 - SYSTEMEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::I32, :name => 'success'}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class CreateLinkedNotebook_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - LINKEDNOTEBOOK = 2 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - LINKEDNOTEBOOK => {:type => ::Thrift::Types::STRUCT, :name => 'linkedNotebook', :class => Evernote::EDAM::Type::LinkedNotebook} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class CreateLinkedNotebook_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - NOTFOUNDEXCEPTION = 2 - SYSTEMEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => Evernote::EDAM::Type::LinkedNotebook}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class UpdateLinkedNotebook_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - LINKEDNOTEBOOK = 2 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - LINKEDNOTEBOOK => {:type => ::Thrift::Types::STRUCT, :name => 'linkedNotebook', :class => Evernote::EDAM::Type::LinkedNotebook} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class UpdateLinkedNotebook_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - NOTFOUNDEXCEPTION = 2 - SYSTEMEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::I32, :name => 'success'}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class ListLinkedNotebooks_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class ListLinkedNotebooks_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - NOTFOUNDEXCEPTION = 2 - SYSTEMEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => Evernote::EDAM::Type::LinkedNotebook}}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class ExpungeLinkedNotebook_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - GUID = 2 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - GUID => {:type => ::Thrift::Types::STRING, :name => 'guid'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class ExpungeLinkedNotebook_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - NOTFOUNDEXCEPTION = 2 - SYSTEMEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::I32, :name => 'success'}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class AuthenticateToSharedNotebook_args - include ::Thrift::Struct, ::Thrift::Struct_Union - SHAREKEY = 1 - AUTHENTICATIONTOKEN = 2 - - FIELDS = { - SHAREKEY => {:type => ::Thrift::Types::STRING, :name => 'shareKey'}, - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class AuthenticateToSharedNotebook_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - NOTFOUNDEXCEPTION = 2 - SYSTEMEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => Evernote::EDAM::UserStore::AuthenticationResult}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetSharedNotebookByAuth_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetSharedNotebookByAuth_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - NOTFOUNDEXCEPTION = 2 - SYSTEMEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => Evernote::EDAM::Type::SharedNotebook}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class EmailNote_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - PARAMETERS = 2 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - PARAMETERS => {:type => ::Thrift::Types::STRUCT, :name => 'parameters', :class => Evernote::EDAM::NoteStore::NoteEmailParameters} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class EmailNote_result - include ::Thrift::Struct, ::Thrift::Struct_Union - USEREXCEPTION = 1 - NOTFOUNDEXCEPTION = 2 - SYSTEMEXCEPTION = 3 - - FIELDS = { - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class ShareNote_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - GUID = 2 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - GUID => {:type => ::Thrift::Types::STRING, :name => 'guid'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class ShareNote_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - NOTFOUNDEXCEPTION = 2 - SYSTEMEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRING, :name => 'success'}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class StopSharingNote_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - GUID = 2 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - GUID => {:type => ::Thrift::Types::STRING, :name => 'guid'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class StopSharingNote_result - include ::Thrift::Struct, ::Thrift::Struct_Union - USEREXCEPTION = 1 - NOTFOUNDEXCEPTION = 2 - SYSTEMEXCEPTION = 3 - - FIELDS = { - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class AuthenticateToSharedNote_args - include ::Thrift::Struct, ::Thrift::Struct_Union - GUID = 1 - NOTEKEY = 2 - - FIELDS = { - GUID => {:type => ::Thrift::Types::STRING, :name => 'guid'}, - NOTEKEY => {:type => ::Thrift::Types::STRING, :name => 'noteKey'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class AuthenticateToSharedNote_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - NOTFOUNDEXCEPTION = 2 - SYSTEMEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => Evernote::EDAM::UserStore::AuthenticationResult}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class FindRelated_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - QUERY = 2 - RESULTSPEC = 3 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - QUERY => {:type => ::Thrift::Types::STRUCT, :name => 'query', :class => Evernote::EDAM::NoteStore::RelatedQuery}, - RESULTSPEC => {:type => ::Thrift::Types::STRUCT, :name => 'resultSpec', :class => Evernote::EDAM::NoteStore::RelatedResultSpec} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class FindRelated_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - NOTFOUNDEXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => Evernote::EDAM::NoteStore::RelatedResult}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - end - - end - end - end diff --git a/vendor/gen-rb/evernote/edam/note_store_constants.rb b/vendor/gen-rb/evernote/edam/note_store_constants.rb deleted file mode 100644 index f167b02..0000000 --- a/vendor/gen-rb/evernote/edam/note_store_constants.rb +++ /dev/null @@ -1,14 +0,0 @@ -# -# Autogenerated by Thrift Compiler (0.8.0) -# -# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING -# - -require 'note_store_types' - - module Evernote - module EDAM - module NoteStore - end - end -end diff --git a/vendor/gen-rb/evernote/edam/note_store_types.rb b/vendor/gen-rb/evernote/edam/note_store_types.rb deleted file mode 100644 index 3884236..0000000 --- a/vendor/gen-rb/evernote/edam/note_store_types.rb +++ /dev/null @@ -1,1127 +0,0 @@ -# -# Autogenerated by Thrift Compiler (0.8.0) -# -# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING -# - -require 'user_store_types' -require 'types_types' -require 'errors_types' -require 'limits_types' - - -module Evernote - module EDAM - module NoteStore - # This structure encapsulates the information about the state of the - # user's account for the purpose of "state based" synchronization. - # <dl> - # <dt>currentTime</dt> - # <dd> - # The server's current date and time. - # </dd> - # - # <dt>fullSyncBefore</dt> - # <dd> - # The cutoff date and time for client caches to be - # updated via incremental synchronization. Any clients that were last - # synched with the server before this date/time must do a full resync of all - # objects. This cutoff point will change over time as archival data is - # deleted or special circumstances on the service require resynchronization. - # </dd> - # - # <dt>updateCount</dt> - # <dd> - # Indicates the total number of transactions that have - # been committed within the account. This reflects (for example) the - # number of discrete additions or modifications that have been made to - # the data in this account (tags, notes, resources, etc.). - # This number is the "high water mark" for Update Sequence Numbers (USN) - # within the account. - # </dd> - # - # <dt>uploaded</dt> - # <dd> - # The total number of bytes that have been uploaded to - # this account in the current monthly period. This can be compared against - # Accounting.uploadLimit (from the UserStore) to determine how close the user - # is to their monthly upload limit. - # This value may not be present if the SyncState has been retrieved by - # a caller that only has read access to the account. - # </dd> - # </dl> - class SyncState - include ::Thrift::Struct, ::Thrift::Struct_Union - CURRENTTIME = 1 - FULLSYNCBEFORE = 2 - UPDATECOUNT = 3 - UPLOADED = 4 - - FIELDS = { - CURRENTTIME => {:type => ::Thrift::Types::I64, :name => 'currentTime'}, - FULLSYNCBEFORE => {:type => ::Thrift::Types::I64, :name => 'fullSyncBefore'}, - UPDATECOUNT => {:type => ::Thrift::Types::I32, :name => 'updateCount'}, - UPLOADED => {:type => ::Thrift::Types::I64, :name => 'uploaded', :optional => true} - } - - def struct_fields; FIELDS; end - - def validate - raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field currentTime is unset!') unless @currentTime - raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field fullSyncBefore is unset!') unless @fullSyncBefore - raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field updateCount is unset!') unless @updateCount - end - - ::Thrift::Struct.generate_accessors self - end - - # This structure is given out by the NoteStore when a client asks to - # receive the current state of an account. The client asks for the server's - # state one chunk at a time in order to allow clients to retrieve the state - # of a large account without needing to transfer the entire account in - # a single message. - # - # The server always gives SyncChunks using an ascending series of Update - # Sequence Numbers (USNs). - # - # <dl> - # <dt>currentTime</dt> - # <dd> - # The server's current date and time. - # </dd> - # - # <dt>chunkHighUSN</dt> - # <dd> - # The highest USN for any of the data objects represented - # in this sync chunk. If there are no objects in the chunk, this will not be - # set. - # </dd> - # - # <dt>updateCount</dt> - # <dd> - # The total number of updates that have been performed in - # the service for this account. This is equal to the highest USN within the - # account at the point that this SyncChunk was generated. If updateCount - # and chunkHighUSN are identical, that means that this is the last chunk - # in the account ... there is no more recent information. - # </dd> - # - # <dt>notes</dt> - # <dd> - # If present, this is a list of non-expunged notes that - # have a USN in this chunk. This will include notes that are "deleted" - # but not expunged (i.e. in the trash). The notes will include their list - # of tags and resources, but the resource content and recognition data - # will not be supplied. - # </dd> - # - # <dt>notebooks</dt> - # <dd> - # If present, this is a list of non-expunged notebooks that - # have a USN in this chunk. This will include notebooks that are "deleted" - # but not expunged (i.e. in the trash). - # </dd> - # - # <dt>tags</dt> - # <dd> - # If present, this is a list of the non-expunged tags that have a - # USN in this chunk. - # </dd> - # - # <dt>searches</dt> - # <dd> - # If present, this is a list of non-expunged searches that - # have a USN in this chunk. - # </dd> - # - # <dt>resources</dt> - # <dd> - # If present, this is a list of the non-expunged resources - # that have a USN in this chunk. This will include the metadata for each - # resource, but not its binary contents or recognition data, which must be - # retrieved separately. - # </dd> - # - # <dt>expungedNotes</dt> - # <dd> - # If present, the GUIDs of all of the notes that were - # permanently expunged in this chunk. - # </dd> - # - # <dt>expungedNotebooks</dt> - # <dd> - # If present, the GUIDs of all of the notebooks that - # were permanently expunged in this chunk. When a notebook is expunged, - # this implies that all of its child notes (and their resources) were - # also expunged. - # </dd> - # - # <dt>expungedTags</dt> - # <dd> - # If present, the GUIDs of all of the tags that were - # permanently expunged in this chunk. - # </dd> - # - # <dt>expungedSearches</dt> - # <dd> - # If present, the GUIDs of all of the saved searches - # that were permanently expunged in this chunk. - # </dd> - # - # <dt>linkedNotebooks</dt> - # <dd> - # If present, this is a list of non-expunged LinkedNotebooks that - # have a USN in this chunk. - # </dd> - # - # <dt>expungedLinkedNotebooks</dt> - # <dd> - # If present, the GUIDs of all of the LinkedNotebooks - # that were permanently expunged in this chunk. - # </dd> - # </dl> - class SyncChunk - include ::Thrift::Struct, ::Thrift::Struct_Union - CURRENTTIME = 1 - CHUNKHIGHUSN = 2 - UPDATECOUNT = 3 - NOTES = 4 - NOTEBOOKS = 5 - TAGS = 6 - SEARCHES = 7 - RESOURCES = 8 - EXPUNGEDNOTES = 9 - EXPUNGEDNOTEBOOKS = 10 - EXPUNGEDTAGS = 11 - EXPUNGEDSEARCHES = 12 - LINKEDNOTEBOOKS = 13 - EXPUNGEDLINKEDNOTEBOOKS = 14 - - FIELDS = { - CURRENTTIME => {:type => ::Thrift::Types::I64, :name => 'currentTime'}, - CHUNKHIGHUSN => {:type => ::Thrift::Types::I32, :name => 'chunkHighUSN', :optional => true}, - UPDATECOUNT => {:type => ::Thrift::Types::I32, :name => 'updateCount'}, - NOTES => {:type => ::Thrift::Types::LIST, :name => 'notes', :element => {:type => ::Thrift::Types::STRUCT, :class => Evernote::EDAM::Type::Note}, :optional => true}, - NOTEBOOKS => {:type => ::Thrift::Types::LIST, :name => 'notebooks', :element => {:type => ::Thrift::Types::STRUCT, :class => Evernote::EDAM::Type::Notebook}, :optional => true}, - TAGS => {:type => ::Thrift::Types::LIST, :name => 'tags', :element => {:type => ::Thrift::Types::STRUCT, :class => Evernote::EDAM::Type::Tag}, :optional => true}, - SEARCHES => {:type => ::Thrift::Types::LIST, :name => 'searches', :element => {:type => ::Thrift::Types::STRUCT, :class => Evernote::EDAM::Type::SavedSearch}, :optional => true}, - RESOURCES => {:type => ::Thrift::Types::LIST, :name => 'resources', :element => {:type => ::Thrift::Types::STRUCT, :class => Evernote::EDAM::Type::Resource}, :optional => true}, - EXPUNGEDNOTES => {:type => ::Thrift::Types::LIST, :name => 'expungedNotes', :element => {:type => ::Thrift::Types::STRING}, :optional => true}, - EXPUNGEDNOTEBOOKS => {:type => ::Thrift::Types::LIST, :name => 'expungedNotebooks', :element => {:type => ::Thrift::Types::STRING}, :optional => true}, - EXPUNGEDTAGS => {:type => ::Thrift::Types::LIST, :name => 'expungedTags', :element => {:type => ::Thrift::Types::STRING}, :optional => true}, - EXPUNGEDSEARCHES => {:type => ::Thrift::Types::LIST, :name => 'expungedSearches', :element => {:type => ::Thrift::Types::STRING}, :optional => true}, - LINKEDNOTEBOOKS => {:type => ::Thrift::Types::LIST, :name => 'linkedNotebooks', :element => {:type => ::Thrift::Types::STRUCT, :class => Evernote::EDAM::Type::LinkedNotebook}, :optional => true}, - EXPUNGEDLINKEDNOTEBOOKS => {:type => ::Thrift::Types::LIST, :name => 'expungedLinkedNotebooks', :element => {:type => ::Thrift::Types::STRING}, :optional => true} - } - - def struct_fields; FIELDS; end - - def validate - raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field currentTime is unset!') unless @currentTime - raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field updateCount is unset!') unless @updateCount - end - - ::Thrift::Struct.generate_accessors self - end - - # This structure is used with the 'getFilteredSyncChunk' call to provide - # fine-grained control over the data that's returned when a client needs - # to synchronize with the service. Each flag in this structure specifies - # whether to include one class of data in the results of that call. - # - # <dl> - # <dt>includeNotes</dt> - # <dd> - # If true, then the server will include the SyncChunks.notes field - # </dd> - # - # <dt>includeNoteResources</dt> - # <dd> - # If true, then the server will include the 'resources' field on all of - # the Notes that are in SyncChunk.notes. - # If 'includeNotes' is false, then this will have no effect. - # </dd> - # - # <dt>includeNoteAttributes</dt> - # <dd> - # If true, then the server will include the 'attributes' field on all of - # the Notes that are in SyncChunks.notes. - # If 'includeNotes' is false, then this will have no effect. - # </dd> - # - # <dt>includeNotebooks</dt> - # <dd> - # If true, then the server will include the SyncChunks.notebooks field - # </dd> - # - # <dt>includeTags</dt> - # <dd> - # If true, then the server will include the SyncChunks.tags field - # </dd> - # - # <dt>includeSearches</dt> - # <dd> - # If true, then the server will include the SyncChunks.searches field - # </dd> - # - # <dt>includeResources</dt> - # <dd> - # If true, then the server will include the SyncChunks.resources field. - # Since the Resources are also provided with their Note - # (in the Notes.resources list), this is primarily useful for clients that - # want to watch for changes to individual Resources due to recognition data - # being added. - # </dd> - # - # <dt>includeLinkedNotebooks</dt> - # <dd> - # If true, then the server will include the SyncChunks.linkedNotebooks field. - # </dd> - # - # <dt>includeExpunged</dt> - # <dd> - # If true, then the server will include the 'expunged' data for any type - # of included data. For example, if 'includeTags' and 'includeExpunged' - # are both true, then the SyncChunks.expungedTags field will be set with - # the GUIDs of tags that have been expunged from the server. - # </dd> - # - # <dt>includeNoteApplicationDataFullMap</dt> - # <dd> - # If true, then the values for the applicationData map will be filled - # in, assuming notes and note attributes are being returned. Otherwise, - # only the keysOnly field will be filled in. - # </dd> - # - # <dt>includeResourceApplicationDataFullMap</dt> - # <dd> - # If true, then the fullMap values for the applicationData map will be - # filled in, assuming resources and resource attributes are being returned - # (includeResources is true). Otherwise, only the keysOnly field will be - # filled in. - # </dd> - # - # <dt>includeNoteResourceApplicationDataFullMap</dt> - # <dd> - # If true, then the fullMap values for the applicationData map will be - # filled in for resources found inside of notes, assuming resources are - # being returned in notes (includeNoteResources is true). Otherwise, - # only the keysOnly field will be filled in. - # </dd> - # - # <dt>requireNoteContentClass</dt> - # <dd> - # If set, then only send notes whose content class matches this value. - # The value can be a literal match or, if the last character is an - # asterisk, a prefix match. - # </dd> - # - # </dl> - class SyncChunkFilter - include ::Thrift::Struct, ::Thrift::Struct_Union - INCLUDENOTES = 1 - INCLUDENOTERESOURCES = 2 - INCLUDENOTEATTRIBUTES = 3 - INCLUDENOTEBOOKS = 4 - INCLUDETAGS = 5 - INCLUDESEARCHES = 6 - INCLUDERESOURCES = 7 - INCLUDELINKEDNOTEBOOKS = 8 - INCLUDEEXPUNGED = 9 - INCLUDENOTEAPPLICATIONDATAFULLMAP = 10 - INCLUDERESOURCEAPPLICATIONDATAFULLMAP = 12 - INCLUDENOTERESOURCEAPPLICATIONDATAFULLMAP = 13 - REQUIRENOTECONTENTCLASS = 11 - - FIELDS = { - INCLUDENOTES => {:type => ::Thrift::Types::BOOL, :name => 'includeNotes', :optional => true}, - INCLUDENOTERESOURCES => {:type => ::Thrift::Types::BOOL, :name => 'includeNoteResources', :optional => true}, - INCLUDENOTEATTRIBUTES => {:type => ::Thrift::Types::BOOL, :name => 'includeNoteAttributes', :optional => true}, - INCLUDENOTEBOOKS => {:type => ::Thrift::Types::BOOL, :name => 'includeNotebooks', :optional => true}, - INCLUDETAGS => {:type => ::Thrift::Types::BOOL, :name => 'includeTags', :optional => true}, - INCLUDESEARCHES => {:type => ::Thrift::Types::BOOL, :name => 'includeSearches', :optional => true}, - INCLUDERESOURCES => {:type => ::Thrift::Types::BOOL, :name => 'includeResources', :optional => true}, - INCLUDELINKEDNOTEBOOKS => {:type => ::Thrift::Types::BOOL, :name => 'includeLinkedNotebooks', :optional => true}, - INCLUDEEXPUNGED => {:type => ::Thrift::Types::BOOL, :name => 'includeExpunged', :optional => true}, - INCLUDENOTEAPPLICATIONDATAFULLMAP => {:type => ::Thrift::Types::BOOL, :name => 'includeNoteApplicationDataFullMap', :optional => true}, - INCLUDERESOURCEAPPLICATIONDATAFULLMAP => {:type => ::Thrift::Types::BOOL, :name => 'includeResourceApplicationDataFullMap', :optional => true}, - INCLUDENOTERESOURCEAPPLICATIONDATAFULLMAP => {:type => ::Thrift::Types::BOOL, :name => 'includeNoteResourceApplicationDataFullMap', :optional => true}, - REQUIRENOTECONTENTCLASS => {:type => ::Thrift::Types::STRING, :name => 'requireNoteContentClass', :optional => true} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - # A list of criteria that are used to indicate which notes are desired from - # the account. This is used in queries to the NoteStore to determine - # which notes should be retrieved. - # - # <dl> - # <dt>order</dt> - # <dd> - # The NoteSortOrder value indicating what criterion should be - # used to sort the results of the filter. - # </dd> - # - # <dt>ascending</dt> - # <dd> - # If true, the results will be ascending in the requested - # sort order. If false, the results will be descending. - # </dd> - # - # <dt>words</dt> - # <dd> - # If present, a search query string that will filter the set of notes to be returned. - # Accepts the full search grammar documented in the Evernote API Overview. - # </dd> - # - # <dt>notebookGuid</dt> - # <dd> - # If present, the Guid of the notebook that must contain - # the notes. - # </dd> - # - # <dt>tagGuids</dt> - # <dd> - # If present, the list of tags (by GUID) that must be present - # on the notes. - # </dd> - # - # <dt>timeZone</dt> - # <dd> - # The zone ID for the user, which will be used to interpret - # any dates or times in the queries that do not include their desired zone - # information. - # For example, if a query requests notes created "yesterday", this - # will be evaluated from the provided time zone, if provided. - # The format must be encoded as a standard zone ID such as - # "America/Los_Angeles". - # </dd> - # - # <dt>inactive</dt> - # <dd> - # If true, then only notes that are not active (i.e. notes in - # the Trash) will be returned. Otherwise, only active notes will be returned. - # There is no way to find both active and inactive notes in a single query. - # </dd> - # </dl> - class NoteFilter - include ::Thrift::Struct, ::Thrift::Struct_Union - ORDER = 1 - ASCENDING = 2 - WORDS = 3 - NOTEBOOKGUID = 4 - TAGGUIDS = 5 - TIMEZONE = 6 - INACTIVE = 7 - - FIELDS = { - ORDER => {:type => ::Thrift::Types::I32, :name => 'order', :optional => true}, - ASCENDING => {:type => ::Thrift::Types::BOOL, :name => 'ascending', :optional => true}, - WORDS => {:type => ::Thrift::Types::STRING, :name => 'words', :optional => true}, - NOTEBOOKGUID => {:type => ::Thrift::Types::STRING, :name => 'notebookGuid', :optional => true}, - TAGGUIDS => {:type => ::Thrift::Types::LIST, :name => 'tagGuids', :element => {:type => ::Thrift::Types::STRING}, :optional => true}, - TIMEZONE => {:type => ::Thrift::Types::STRING, :name => 'timeZone', :optional => true}, - INACTIVE => {:type => ::Thrift::Types::BOOL, :name => 'inactive', :optional => true} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - # A small structure for returning a list of notes out of a larger set. - # - # <dl> - # <dt>startIndex</dt> - # <dd> - # The starting index within the overall set of notes. This - # is also the number of notes that are "before" this list in the set. - # </dd> - # - # <dt>totalNotes</dt> - # <dd> - # The number of notes in the larger set. This can be used - # to calculate how many notes are "after" this note in the set. - # (I.e. remaining = totalNotes - (startIndex + notes.length) ) - # </dd> - # - # <dt>notes</dt> - # <dd> - # The list of notes from this range. The Notes will include all - # metadata (attributes, resources, etc.), but will not include the ENML - # content of the note or the binary contents of any resources. - # </dd> - # - # <dt>stoppedWords</dt> - # <dd> - # If the NoteList was produced using a text based search - # query that included words that are not indexed or searched by the service, - # this will include a list of those ignored words. - # </dd> - # - # <dt>searchedWords</dt> - # <dd> - # If the NoteList was produced using a text based search - # query that included viable search words or quoted expressions, this will - # include a list of those words. Any stopped words will not be included - # in this list. - # </dd> - # - # <dt>updateCount</dt> - # <dd> - # Indicates the total number of transactions that have - # been committed within the account. This reflects (for example) the - # number of discrete additions or modifications that have been made to - # the data in this account (tags, notes, resources, etc.). - # This number is the "high water mark" for Update Sequence Numbers (USN) - # within the account. - # </dd> - # </dl> - class NoteList - include ::Thrift::Struct, ::Thrift::Struct_Union - STARTINDEX = 1 - TOTALNOTES = 2 - NOTES = 3 - STOPPEDWORDS = 4 - SEARCHEDWORDS = 5 - UPDATECOUNT = 6 - - FIELDS = { - STARTINDEX => {:type => ::Thrift::Types::I32, :name => 'startIndex'}, - TOTALNOTES => {:type => ::Thrift::Types::I32, :name => 'totalNotes'}, - NOTES => {:type => ::Thrift::Types::LIST, :name => 'notes', :element => {:type => ::Thrift::Types::STRUCT, :class => Evernote::EDAM::Type::Note}}, - STOPPEDWORDS => {:type => ::Thrift::Types::LIST, :name => 'stoppedWords', :element => {:type => ::Thrift::Types::STRING}, :optional => true}, - SEARCHEDWORDS => {:type => ::Thrift::Types::LIST, :name => 'searchedWords', :element => {:type => ::Thrift::Types::STRING}, :optional => true}, - UPDATECOUNT => {:type => ::Thrift::Types::I32, :name => 'updateCount', :optional => true} - } - - def struct_fields; FIELDS; end - - def validate - raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field startIndex is unset!') unless @startIndex - raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field totalNotes is unset!') unless @totalNotes - raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field notes is unset!') unless @notes - end - - ::Thrift::Struct.generate_accessors self - end - - # This structure is used in the set of results returned by the - # findNotesMetadata function. It represents the high-level information about - # a single Note, without some of the larger deep structure. This allows - # for the information about a list of Notes to be returned relatively quickly - # with less marshalling and data transfer to remote clients. - # Most fields in this structure are identical to the corresponding field in - # the Note structure, with the exception of: - # - # <dl> - # <dt>largestResourceMime</dt> - # <dd>If set, then this will contain the MIME type of the largest Resource - # (in bytes) within the Note. This may be useful, for example, to choose - # an appropriate icon or thumbnail to represent the Note. - # </dd> - # - # <dt>largestResourceSize</dt> - # <dd>If set, this will contain the size of the largest Resource file, in - # bytes, within the Note. This may be useful, for example, to decide whether - # to ask the server for a thumbnail to represent the Note. - # </dd> - # </dl> - class NoteMetadata - include ::Thrift::Struct, ::Thrift::Struct_Union - GUID = 1 - TITLE = 2 - CONTENTLENGTH = 5 - CREATED = 6 - UPDATED = 7 - UPDATESEQUENCENUM = 10 - NOTEBOOKGUID = 11 - TAGGUIDS = 12 - ATTRIBUTES = 14 - LARGESTRESOURCEMIME = 20 - LARGESTRESOURCESIZE = 21 - - FIELDS = { - GUID => {:type => ::Thrift::Types::STRING, :name => 'guid'}, - TITLE => {:type => ::Thrift::Types::STRING, :name => 'title', :optional => true}, - CONTENTLENGTH => {:type => ::Thrift::Types::I32, :name => 'contentLength', :optional => true}, - CREATED => {:type => ::Thrift::Types::I64, :name => 'created', :optional => true}, - UPDATED => {:type => ::Thrift::Types::I64, :name => 'updated', :optional => true}, - UPDATESEQUENCENUM => {:type => ::Thrift::Types::I32, :name => 'updateSequenceNum', :optional => true}, - NOTEBOOKGUID => {:type => ::Thrift::Types::STRING, :name => 'notebookGuid', :optional => true}, - TAGGUIDS => {:type => ::Thrift::Types::LIST, :name => 'tagGuids', :element => {:type => ::Thrift::Types::STRING}, :optional => true}, - ATTRIBUTES => {:type => ::Thrift::Types::STRUCT, :name => 'attributes', :class => Evernote::EDAM::Type::NoteAttributes, :optional => true}, - LARGESTRESOURCEMIME => {:type => ::Thrift::Types::STRING, :name => 'largestResourceMime', :optional => true}, - LARGESTRESOURCESIZE => {:type => ::Thrift::Types::I32, :name => 'largestResourceSize', :optional => true} - } - - def struct_fields; FIELDS; end - - def validate - raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field guid is unset!') unless @guid - end - - ::Thrift::Struct.generate_accessors self - end - - # This structure is returned from calls to the findNotesMetadata function to - # give the high-level metadata about a subset of Notes that are found to - # match a specified NoteFilter in a search. - # - # <dl> - # <dt>startIndex</dt> - # <dd> - # The starting index within the overall set of notes. This - # is also the number of notes that are "before" this list in the set. - # </dd> - # - # <dt>totalNotes</dt> - # <dd> - # The number of notes in the larger set. This can be used - # to calculate how many notes are "after" this note in the set. - # (I.e. remaining = totalNotes - (startIndex + notes.length) ) - # </dd> - # - # <dt>notes</dt> - # <dd> - # The list of metadata for Notes in this range. The set of optional fields - # that are set in each metadata structure will depend on the - # NotesMetadataResultSpec provided by the caller when the search was - # performed. Only the 'guid' field will be guaranteed to be set in each - # Note. - # </dd> - # - # <dt>stoppedWords</dt> - # <dd> - # If the NoteList was produced using a text based search - # query that included words that are not indexed or searched by the service, - # this will include a list of those ignored words. - # </dd> - # - # <dt>searchedWords</dt> - # <dd> - # If the NoteList was produced using a text based search - # query that included viable search words or quoted expressions, this will - # include a list of those words. Any stopped words will not be included - # in this list. - # </dd> - # - # <dt>updateCount</dt> - # <dd> - # Indicates the total number of transactions that have - # been committed within the account. This reflects (for example) the - # number of discrete additions or modifications that have been made to - # the data in this account (tags, notes, resources, etc.). - # This number is the "high water mark" for Update Sequence Numbers (USN) - # within the account. - # </dd> - # </dl> - class NotesMetadataList - include ::Thrift::Struct, ::Thrift::Struct_Union - STARTINDEX = 1 - TOTALNOTES = 2 - NOTES = 3 - STOPPEDWORDS = 4 - SEARCHEDWORDS = 5 - UPDATECOUNT = 6 - - FIELDS = { - STARTINDEX => {:type => ::Thrift::Types::I32, :name => 'startIndex'}, - TOTALNOTES => {:type => ::Thrift::Types::I32, :name => 'totalNotes'}, - NOTES => {:type => ::Thrift::Types::LIST, :name => 'notes', :element => {:type => ::Thrift::Types::STRUCT, :class => Evernote::EDAM::NoteStore::NoteMetadata}}, - STOPPEDWORDS => {:type => ::Thrift::Types::LIST, :name => 'stoppedWords', :element => {:type => ::Thrift::Types::STRING}, :optional => true}, - SEARCHEDWORDS => {:type => ::Thrift::Types::LIST, :name => 'searchedWords', :element => {:type => ::Thrift::Types::STRING}, :optional => true}, - UPDATECOUNT => {:type => ::Thrift::Types::I32, :name => 'updateCount', :optional => true} - } - - def struct_fields; FIELDS; end - - def validate - raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field startIndex is unset!') unless @startIndex - raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field totalNotes is unset!') unless @totalNotes - raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field notes is unset!') unless @notes - end - - ::Thrift::Struct.generate_accessors self - end - - # This structure is provided to the findNotesMetadata function to specify - # the subset of fields that should be included in each NoteMetadata element - # that is returned in the NotesMetadataList. - # Each field on this structure is a boolean flag that indicates whether the - # corresponding field should be included in the NoteMetadata structure when - # it is returned. For example, if the 'includeTitle' field is set on this - # structure when calling findNotesMetadata, then each NoteMetadata in the - # list should have its 'title' field set. - # If one of the fields in this spec is not set, then it will be treated as - # 'false' by the server, so the default behavior is to include nothing in - # replies (but the mandatory GUID) - class NotesMetadataResultSpec - include ::Thrift::Struct, ::Thrift::Struct_Union - INCLUDETITLE = 2 - INCLUDECONTENTLENGTH = 5 - INCLUDECREATED = 6 - INCLUDEUPDATED = 7 - INCLUDEUPDATESEQUENCENUM = 10 - INCLUDENOTEBOOKGUID = 11 - INCLUDETAGGUIDS = 12 - INCLUDEATTRIBUTES = 14 - INCLUDELARGESTRESOURCEMIME = 20 - INCLUDELARGESTRESOURCESIZE = 21 - - FIELDS = { - INCLUDETITLE => {:type => ::Thrift::Types::BOOL, :name => 'includeTitle', :optional => true}, - INCLUDECONTENTLENGTH => {:type => ::Thrift::Types::BOOL, :name => 'includeContentLength', :optional => true}, - INCLUDECREATED => {:type => ::Thrift::Types::BOOL, :name => 'includeCreated', :optional => true}, - INCLUDEUPDATED => {:type => ::Thrift::Types::BOOL, :name => 'includeUpdated', :optional => true}, - INCLUDEUPDATESEQUENCENUM => {:type => ::Thrift::Types::BOOL, :name => 'includeUpdateSequenceNum', :optional => true}, - INCLUDENOTEBOOKGUID => {:type => ::Thrift::Types::BOOL, :name => 'includeNotebookGuid', :optional => true}, - INCLUDETAGGUIDS => {:type => ::Thrift::Types::BOOL, :name => 'includeTagGuids', :optional => true}, - INCLUDEATTRIBUTES => {:type => ::Thrift::Types::BOOL, :name => 'includeAttributes', :optional => true}, - INCLUDELARGESTRESOURCEMIME => {:type => ::Thrift::Types::BOOL, :name => 'includeLargestResourceMime', :optional => true}, - INCLUDELARGESTRESOURCESIZE => {:type => ::Thrift::Types::BOOL, :name => 'includeLargestResourceSize', :optional => true} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - # A data structure representing the number of notes for each notebook - # and tag with a non-zero set of applicable notes. - # - # <dl> - # <dt>notebookCounts</dt> - # <dd> - # A mapping from the Notebook GUID to the number of - # notes (from some selection) that are in the corresponding notebook. - # </dd> - # - # <dt>tagCounts</dt> - # <dd> - # A mapping from the Tag GUID to the number of notes (from some - # selection) that have the corresponding tag. - # </dd> - # - # <dt>trashCount</dt> - # <dd> - # If this is set, then this is the number of notes that are in the trash. - # If this is not set, then the number of notes in the trash hasn't been - # reported. (I.e. if there are no notes in the trash, this will be set - # to 0.) - # </dd> - # </dl> - class NoteCollectionCounts - include ::Thrift::Struct, ::Thrift::Struct_Union - NOTEBOOKCOUNTS = 1 - TAGCOUNTS = 2 - TRASHCOUNT = 3 - - FIELDS = { - NOTEBOOKCOUNTS => {:type => ::Thrift::Types::MAP, :name => 'notebookCounts', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::I32}, :optional => true}, - TAGCOUNTS => {:type => ::Thrift::Types::MAP, :name => 'tagCounts', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::I32}, :optional => true}, - TRASHCOUNT => {:type => ::Thrift::Types::I32, :name => 'trashCount', :optional => true} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - # Information for tracking the display of a particular ad by a client. - # - # <dl> - # <dt>adId</dt> - # <dd> - # The identifier for this ad, from a previous Ad.id given to the client - # </dd> - # - # <dt>impressionCount</dt> - # <dd> - # The number of times this ad was displayed since the last successful - # ad retrieval. The client should only report times the ad was selected - # when the client was visible. - # </dd> - # - # <dt>impressionTime</dt> - # <dd> - # The number of seconds that the client displayed the advertisement since - # the last successful ad retrieval. This corresponds to the seconds that - # the client application was visible. - # </dd> - # </dl> - class AdImpressions - include ::Thrift::Struct, ::Thrift::Struct_Union - ADID = 1 - IMPRESSIONCOUNT = 2 - IMPRESSIONTIME = 3 - - FIELDS = { - ADID => {:type => ::Thrift::Types::I32, :name => 'adId'}, - IMPRESSIONCOUNT => {:type => ::Thrift::Types::I32, :name => 'impressionCount'}, - IMPRESSIONTIME => {:type => ::Thrift::Types::I32, :name => 'impressionTime'} - } - - def struct_fields; FIELDS; end - - def validate - raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field adId is unset!') unless @adId - raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field impressionCount is unset!') unless @impressionCount - raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field impressionTime is unset!') unless @impressionTime - end - - ::Thrift::Struct.generate_accessors self - end - - # Parameters that will be given by a client to the service when it requests - # a set of advertisements to display. If any of these values are omitted, - # the service will use default values. - # - # <dl> - # <dt>clientLanguage</dt> - # <dd> - # The ISO 639-1 language code for the primary language for the client. - # If omitted, English will be assumed ('en'). - # </dd> - # - # <dt>impressions</dt> - # <dd> - # A list of the impression counts and total display time for the ads - # that were displayed in the last day. - # </dd> - # - # <dt>supportHtml</dt> - # <dd> - # If true, the client requesting the ads supports ads specified via - # general HTML (with rich media, Javascript, etc.). - # </dd> - # - # <dt>clientProperties</dt> - # <dd> - # If provided, this may contain a set of key/value pairs that identify - # the characteristics of a particular client that may be used to help - # determine appropriate ads for that client. These tuples may be used - # either to reduce or increase the likelihood that each ad will be - # returned. - # </dd> - # </dl> - class AdParameters - include ::Thrift::Struct, ::Thrift::Struct_Union - CLIENTLANGUAGE = 2 - IMPRESSIONS = 4 - SUPPORTHTML = 5 - CLIENTPROPERTIES = 6 - - FIELDS = { - CLIENTLANGUAGE => {:type => ::Thrift::Types::STRING, :name => 'clientLanguage', :optional => true}, - IMPRESSIONS => {:type => ::Thrift::Types::LIST, :name => 'impressions', :element => {:type => ::Thrift::Types::STRUCT, :class => Evernote::EDAM::NoteStore::AdImpressions}, :optional => true}, - SUPPORTHTML => {:type => ::Thrift::Types::BOOL, :name => 'supportHtml', :optional => true}, - CLIENTPROPERTIES => {:type => ::Thrift::Types::MAP, :name => 'clientProperties', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::STRING}, :optional => true} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - # Parameters that must be given to the NoteStore emailNote call. These allow - # the caller to specify the note to send, the recipient addresses, etc. - # - # <dl> - # <dt>guid</dt> - # <dd> - # If set, this must be the GUID of a note within the user's account that - # should be retrieved from the service and sent as email. If not set, - # the 'note' field must be provided instead. - # </dd> - # - # <dt>note</dt> - # <dd> - # If the 'guid' field is not set, this field must be provided, including - # the full contents of the note note (and all of its Resources) to send. - # This can be used for a Note that as not been created in the service, - # for example by a local client with local notes. - # </dd> - # - # <dt>toAddresses</dt> - # <dd> - # If provided, this should contain a list of the SMTP email addresses - # that should be included in the "To:" line of the email. - # Callers must specify at least one "to" or "cc" email address. - # </dd> - # - # <dt>ccAddresses</dt> - # <dd> - # If provided, this should contain a list of the SMTP email addresses - # that should be included in the "Cc:" line of the email. - # Callers must specify at least one "to" or "cc" email address. - # </dd> - # - # <dt>subject</dt> - # <dd> - # If provided, this should contain the subject line of the email that - # will be sent. If not provided, the title of the note will be used - # as the subject of the email. - # </dd> - # - # <dt>message</dt> - # <dd> - # If provided, this is additional personal text that should be included - # into the email as a message from the owner to the recipient(s). - # </dd> - # </dl> - class NoteEmailParameters - include ::Thrift::Struct, ::Thrift::Struct_Union - GUID = 1 - NOTE = 2 - TOADDRESSES = 3 - CCADDRESSES = 4 - SUBJECT = 5 - MESSAGE = 6 - - FIELDS = { - GUID => {:type => ::Thrift::Types::STRING, :name => 'guid', :optional => true}, - NOTE => {:type => ::Thrift::Types::STRUCT, :name => 'note', :class => Evernote::EDAM::Type::Note, :optional => true}, - TOADDRESSES => {:type => ::Thrift::Types::LIST, :name => 'toAddresses', :element => {:type => ::Thrift::Types::STRING}, :optional => true}, - CCADDRESSES => {:type => ::Thrift::Types::LIST, :name => 'ccAddresses', :element => {:type => ::Thrift::Types::STRING}, :optional => true}, - SUBJECT => {:type => ::Thrift::Types::STRING, :name => 'subject', :optional => true}, - MESSAGE => {:type => ::Thrift::Types::STRING, :name => 'message', :optional => true} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - # Identifying information about previous versions of a note that are backed up - # within Evernote's servers. Used in the return value of the listNoteVersions - # call. - # - # <dl> - # <dt>updateSequenceNum</dt> - # <dd> - # The update sequence number for the Note when it last had this content. - # This serves to uniquely identify each version of the note, since USN - # values are unique within an account for each update. - # </dd> - # <dt>updated</dt> - # <dd> - # The 'updated' time that was set on the Note when it had this version - # of the content. This is the user-modifiable modification time on the - # note, so it's not reliable for guaranteeing the order of various - # versions. (E.g. if someone modifies the note, then changes this time - # manually into the past and then updates the note again.) - # </dd> - # <dt>saved</dt> - # <dd> - # A timestamp that holds the date and time when this version of the note - # was backed up by Evernote's servers. This - # </dd> - # <dt>title</dt> - # <dd> - # The title of the note when this particular version was saved. (The - # current title of the note may differ from this value.) - # </dd> - # </dl> - class NoteVersionId - include ::Thrift::Struct, ::Thrift::Struct_Union - UPDATESEQUENCENUM = 1 - UPDATED = 2 - SAVED = 3 - TITLE = 4 - - FIELDS = { - UPDATESEQUENCENUM => {:type => ::Thrift::Types::I32, :name => 'updateSequenceNum'}, - UPDATED => {:type => ::Thrift::Types::I64, :name => 'updated'}, - SAVED => {:type => ::Thrift::Types::I64, :name => 'saved'}, - TITLE => {:type => ::Thrift::Types::STRING, :name => 'title'} - } - - def struct_fields; FIELDS; end - - def validate - raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field updateSequenceNum is unset!') unless @updateSequenceNum - raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field updated is unset!') unless @updated - raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field saved is unset!') unless @saved - raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field title is unset!') unless @title - end - - ::Thrift::Struct.generate_accessors self - end - - # This structure is passed from clients to the Evernote service when they wish - # to relay coarse-grained usage metrics to the service to help improve - # products. - # - # <dl> - # <dt>sessions</dt> - # <dd> - # This field contains a count of the number of usage "sessions" that have - # occurred with this client which have not previously been reported to - # the service. - # A "session" is defined as one of the 96 fifteen-minute intervals of the - # day when someone used Evernote's interface at least once. - # So if a user interacts with an Evernote client at 12:18, 12:24, and 12:36, - # and then the client synchronizes at 12:39, it would report that there were - # two previously-unreported sessions (one session for the 12:15-12:30 time - # period, and one for the 12:30-12:45 period). - # If the user used Evernote again at 12:41 and synchronized at 12:43, it - # would not report any new sessions, because the 12:30-12:45 session had - # already been reported. - # </dd> - # </dl> - class ClientUsageMetrics - include ::Thrift::Struct, ::Thrift::Struct_Union - SESSIONS = 1 - - FIELDS = { - SESSIONS => {:type => ::Thrift::Types::I32, :name => 'sessions', :optional => true} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - # A description of the thing for which we are searching for related - # entities. You must choose exactly one field. - # - # <dl> - # <dt>noteGuid</dt> - # <dd>The GUID of an existing note in your account for which related - # entities will be found.</dd> - # - # <dt>plainText</dt> - # <dd>A string of plain text for which to find related entities. - # You should provide a text block with a number of characters between - # EDAM_RELATED_PLAINTEXT_LEN_MIN and EDAM_RELATED_PLAINTEXT_LEN_MAX. - # </dd> - # </dl> - class RelatedQuery - include ::Thrift::Struct, ::Thrift::Struct_Union - NOTEGUID = 1 - PLAINTEXT = 2 - - FIELDS = { - NOTEGUID => {:type => ::Thrift::Types::STRING, :name => 'noteGuid', :optional => true}, - PLAINTEXT => {:type => ::Thrift::Types::STRING, :name => 'plainText', :optional => true} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - # The result of calling findRelated(). The contents of the notes, - # notebooks, and tags fields will be in decreasing order of expected - # relevance. It is possible that fewer results than requested will be - # returned even if there are enough distinct entities in the account - # in cases where the relevance is estimated to be low. - # - # <dl> - # <dt>notes</dt> - # <dd>If notes have been requested to be included, this will be the - # list of notes.</dd> - # - # <dt>notebooks</dt> - # <dd>If notebooks have been requested to be included, this will be the - # list of notebooks.</dd> - # - # <dt>tags</dt> - # <dd>If tags have been requested to be included, this will be the list - # of tags.</dd> - # </dl> - class RelatedResult - include ::Thrift::Struct, ::Thrift::Struct_Union - NOTES = 1 - NOTEBOOKS = 2 - TAGS = 3 - - FIELDS = { - NOTES => {:type => ::Thrift::Types::LIST, :name => 'notes', :element => {:type => ::Thrift::Types::STRUCT, :class => Evernote::EDAM::Type::Note}, :optional => true}, - NOTEBOOKS => {:type => ::Thrift::Types::LIST, :name => 'notebooks', :element => {:type => ::Thrift::Types::STRUCT, :class => Evernote::EDAM::Type::Notebook}, :optional => true}, - TAGS => {:type => ::Thrift::Types::LIST, :name => 'tags', :element => {:type => ::Thrift::Types::STRUCT, :class => Evernote::EDAM::Type::Tag}, :optional => true} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - # A description of the thing for which the service will find related - # entities, via findRelated(), together with a description of what - # type of entities and how many you are seeking in the - # RelatednessResult. - # - # <dl> - # <dt>maxNotes</dt> - # <dd>Return notes that are related to the query, but no more than - # this many. Any value greater than EDAM_RELATED_MAX_NOTES - # will be silently capped. If you do not set this field, then - # no notes will be returned.</dd> - # - # <dt>maxNotebooks</dt> - # <dd>Return notebooks that are related to the query, but no more than - # this many. Any value greater than EDAM_RELATED_MAX_NOTEBOOKS - # will be silently capped. If you do not set this field, then - # no notebooks will be returned.</dd> - # - # <dt>maxTags</dt> - # <dd>Return tags that are related to the query, but no more than - # this many. Any value greater than EDAM_RELATED_MAX_TAGS - # will be silently capped. If you do not set this field, then - # no tags will be returned.</dd> - # </dl> - class RelatedResultSpec - include ::Thrift::Struct, ::Thrift::Struct_Union - MAXNOTES = 1 - MAXNOTEBOOKS = 2 - MAXTAGS = 3 - - FIELDS = { - MAXNOTES => {:type => ::Thrift::Types::I32, :name => 'maxNotes', :optional => true}, - MAXNOTEBOOKS => {:type => ::Thrift::Types::I32, :name => 'maxNotebooks', :optional => true}, - MAXTAGS => {:type => ::Thrift::Types::I32, :name => 'maxTags', :optional => true} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - end - end - end diff --git a/vendor/gen-rb/evernote/edam/types_constants.rb b/vendor/gen-rb/evernote/edam/types_constants.rb deleted file mode 100644 index 1bc5423..0000000 --- a/vendor/gen-rb/evernote/edam/types_constants.rb +++ /dev/null @@ -1,20 +0,0 @@ -# -# Autogenerated by Thrift Compiler (0.8.0) -# -# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING -# - -require 'types_types' - - module Evernote - module EDAM - module Type - EDAM_NOTE_SOURCE_WEB_CLIP = %q"web.clip" - - EDAM_NOTE_SOURCE_MAIL_CLIP = %q"mail.clip" - - EDAM_NOTE_SOURCE_MAIL_SMTP_GATEWAY = %q"mail.smtp" - - end - end -end diff --git a/vendor/gen-rb/evernote/edam/types_types.rb b/vendor/gen-rb/evernote/edam/types_types.rb deleted file mode 100644 index 39ee984..0000000 --- a/vendor/gen-rb/evernote/edam/types_types.rb +++ /dev/null @@ -1,1792 +0,0 @@ -# -# Autogenerated by Thrift Compiler (0.8.0) -# -# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING -# - -require 'limits_types' - - -module Evernote - module EDAM - module Type - module PrivilegeLevel - NORMAL = 1 - PREMIUM = 3 - MANAGER = 7 - SUPPORT = 8 - ADMIN = 9 - VALUE_MAP = {1 => "NORMAL", 3 => "PREMIUM", 7 => "MANAGER", 8 => "SUPPORT", 9 => "ADMIN"} - VALID_VALUES = Set.new([NORMAL, PREMIUM, MANAGER, SUPPORT, ADMIN]).freeze - end - - module QueryFormat - USER = 1 - SEXP = 2 - VALUE_MAP = {1 => "USER", 2 => "SEXP"} - VALID_VALUES = Set.new([USER, SEXP]).freeze - end - - module NoteSortOrder - CREATED = 1 - UPDATED = 2 - RELEVANCE = 3 - UPDATE_SEQUENCE_NUMBER = 4 - TITLE = 5 - VALUE_MAP = {1 => "CREATED", 2 => "UPDATED", 3 => "RELEVANCE", 4 => "UPDATE_SEQUENCE_NUMBER", 5 => "TITLE"} - VALID_VALUES = Set.new([CREATED, UPDATED, RELEVANCE, UPDATE_SEQUENCE_NUMBER, TITLE]).freeze - end - - module PremiumOrderStatus - NONE = 0 - PENDING = 1 - ACTIVE = 2 - FAILED = 3 - CANCELLATION_PENDING = 4 - CANCELED = 5 - VALUE_MAP = {0 => "NONE", 1 => "PENDING", 2 => "ACTIVE", 3 => "FAILED", 4 => "CANCELLATION_PENDING", 5 => "CANCELED"} - VALID_VALUES = Set.new([NONE, PENDING, ACTIVE, FAILED, CANCELLATION_PENDING, CANCELED]).freeze - end - - # In several places, EDAM exchanges blocks of bytes of data for a component - # which may be relatively large. For example: the contents of a clipped - # HTML note, the bytes of an embedded image, or the recognition XML for - # a large image. This structure is used in the protocol to represent - # any of those large blocks of data when they are transmitted or when - # they are only referenced their metadata. - # - # <dl> - # <dt>bodyHash</dt> - # <dd>This field carries a one-way hash of the contents of the - # data body, in binary form. The hash function is MD5<br/> - # Length: EDAM_HASH_LEN (exactly) - # </dd> - # - # <dt>size</dt> - # <dd>The length, in bytes, of the data body. - # </dd> - # - # <dt>body</dt> - # <dd>This field is set to contain the binary contents of the data - # whenever the resource is being transferred. If only metadata is - # being exchanged, this field will be empty. For example, a client could - # notify the service about the change to an attribute for a resource - # without transmitting the binary resource contents. - # </dd> - # </dl> - class Data - include ::Thrift::Struct, ::Thrift::Struct_Union - BODYHASH = 1 - SIZE = 2 - BODY = 3 - - FIELDS = { - BODYHASH => {:type => ::Thrift::Types::STRING, :name => 'bodyHash', :binary => true, :optional => true}, - SIZE => {:type => ::Thrift::Types::I32, :name => 'size', :optional => true}, - BODY => {:type => ::Thrift::Types::STRING, :name => 'body', :binary => true, :optional => true} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - # A structure holding the optional attributes that can be stored - # on a User. These are generally less critical than the core User fields. - # - # <dl> - # <dt>defaultLocationName</dt> - # <dd>the location string that should be associated - # with the user in order to determine where notes are taken if not otherwise - # specified.<br/> - # Length: EDAM_ATTRIBUTE_LEN_MIN - EDAM_ATTRIBUTE_LEN_MAX - # </dd> - # - # <dt>defaultLatitude</dt> - # <dd>if set, this is the latitude that should be - # assigned to any notes that have no other latitude information. - # </dd> - # - # <dt>defaultLongitude</dt> - # <dd>if set, this is the longitude that should be - # assigned to any notes that have no other longitude information. - # </dd> - # - # <dt>preactivation</dt> - # <dd>if set, the user account is not yet confirmed for - # login. I.e. the account has been created, but we are still waiting for - # the user to complete the activation step. - # </dd> - # - # <dt>viewedPromotions</dt> - # <dd>a list of promotions the user has seen. - # This list may occasionally be modified by the system when promotions are - # no longer available.<br/> - # Length: EDAM_ATTRIBUTE_LEN_MIN - EDAM_ATTRIBUTE_LEN_MAX - # </dd> - # - # <dt>incomingEmailAddress</dt> - # <dd>if set, this is the email address that the - # user may send email to in order to add an email note directly into the - # account via the SMTP email gateway. This is the part of the email - # address before the '@' symbol ... our domain is not included. - # If this is not set, the user may not add notes via the gateway.<br/> - # Length: EDAM_ATTRIBUTE_LEN_MIN - EDAM_ATTRIBUTE_LEN_MAX - # </dd> - # - # <dt>recentMailedAddresses</dt> - # <dd>if set, this will contain a list of email - # addresses that have recently been used as recipients - # of outbound emails by the user. This can be used to pre-populate a - # list of possible destinations when a user wishes to send a note via - # email.<br/> - # Length: EDAM_ATTRIBUTE_LEN_MIN - EDAM_ATTRIBUTE_LEN_MAX each<br/> - # Max: EDAM_USER_RECENT_MAILED_ADDRESSES_MAX entries - # </dd> - # - # <dt>comments</dt> - # <dd>Free-form text field that may hold general support - # information, etc.<br/> - # Length: EDAM_ATTRIBUTE_LEN_MIN - EDAM_ATTRIBUTE_LEN_MAX - # </dd> - # - # <dt>dateAgreedToTermsOfService</dt> - # <dd>The date/time when the user agreed to - # the terms of service. This can be used as the effective "start date" - # for the account. - # </dd> - # - # <dt>maxReferrals</dt> - # <dd>The number of referrals that the user is permitted - # to make. - # </dd> - # - # <dt>referralCount</dt> - # <dd>The number of referrals sent from this account. - # </dd> - # - # <dt>refererCode</dt> - # <dd>A code indicating where the user was sent from. AKA - # promotion code - # </dd> - # - # <dt>sentEmailDate</dt> - # <dd>The most recent date when the user sent outbound - # emails from the service. Used with sentEmailCount to limit the number - # of emails that can be sent per day. - # </dd> - # - # <dt>sentEmailCount</dt> - # <dd>The number of emails that were sent from the user - # via the service on sentEmailDate. Used to enforce a limit on the number - # of emails per user per day to prevent spamming. - # </dd> - # - # <dt>dailyEmailLimit</dt> - # <dd>If set, this is the maximum number of emails that - # may be sent in a given day from this account. If unset, the server will - # use the configured default limit. - # </dd> - # - # <dt>emailOptOutDate</dt> - # <dd>If set, this is the date when the user asked - # to be excluded from offers and promotions sent by Evernote. If not set, - # then the user currently agrees to receive these messages. - # </dd> - # - # <dt>partnerEmailOptInDate</dt> - # <dd>If set, this is the date when the user asked - # to be included in offers and promotions sent by Evernote's partners. - # If not sent, then the user currently does not agree to receive these - # emails. - # </dd> - # - # <dt>preferredLanguage</dt> - # <dd>a 2 character language codes based on: - # http://ftp.ics.uci.edu/pub/ietf/http/related/iso639.txt used for - # localization purposes to determine what language to use for the web - # interface and for other direct communication (e.g. emails). - # </dd> - # - # <dt>preferredCountry</dt> - # <dd>Preferred country code based on ISO 3166-1-alpha-2 indicating the - # users preferred country</dd> - # - # <dt>clipFullPage</dt> - # <dd>Boolean flag set to true if the user wants to clip full pages by - # default when they use the web clipper without a selection.</dd> - # - # <dt>twitterUserName</dt> - # <dd>The username of the account of someone who has chosen to enable - # Twittering into Evernote. This value is subject to change, since users - # may change their Twitter user name.</dd> - # - # <dt>twitterId</dt> - # <dd>The unique identifier of the user's Twitter account if that user - # has chosen to enable Twittering into Evernote.</dd> - # - # <dt>groupName</dt> - # <dd>A name identifier used to identify a particular set of branding and - # light customization.</dd> - # - # <dt>recognitionLanguage</dt> - # <dd>a 2 character language codes based on: - # http://ftp.ics.uci.edu/pub/ietf/http/related/iso639.txt - # If set, this is used to determine the language that should be used - # when processing images and PDF files to find text. - # If not set, then the 'preferredLanguage' will be used. - # </dd> - # - # <dt>customerProfileId</dt> - # <dd>a numeric identified which provides a linkage between the user record - # and the direct credit card payment creditcard profile. - # </dd> - # - # <dt>educationalInstitution</dt> - # <dd>a flag indicating that the user is part of an educational institution which - # makes them eligible for discounts on bulk purchases - # </dd> - # - # <dt>businessAddress</dt> - # <dd>A string recording the business address of a Sponsored Account user who has requested invoicing. - # </dd> - # </dl> - # - # <dt>hideSponsorBilling</dt> - # <dd>A flag indicating whether to hide the billing information on a sponsored - # account owner's settings page - # </dd> - # </dl> - class UserAttributes - include ::Thrift::Struct, ::Thrift::Struct_Union - DEFAULTLOCATIONNAME = 1 - DEFAULTLATITUDE = 2 - DEFAULTLONGITUDE = 3 - PREACTIVATION = 4 - VIEWEDPROMOTIONS = 5 - INCOMINGEMAILADDRESS = 6 - RECENTMAILEDADDRESSES = 7 - COMMENTS = 9 - DATEAGREEDTOTERMSOFSERVICE = 11 - MAXREFERRALS = 12 - REFERRALCOUNT = 13 - REFERERCODE = 14 - SENTEMAILDATE = 15 - SENTEMAILCOUNT = 16 - DAILYEMAILLIMIT = 17 - EMAILOPTOUTDATE = 18 - PARTNEREMAILOPTINDATE = 19 - PREFERREDLANGUAGE = 20 - PREFERREDCOUNTRY = 21 - CLIPFULLPAGE = 22 - TWITTERUSERNAME = 23 - TWITTERID = 24 - GROUPNAME = 25 - RECOGNITIONLANGUAGE = 26 - CUSTOMERPROFILEID = 27 - REFERRALPROOF = 28 - EDUCATIONALDISCOUNT = 29 - BUSINESSADDRESS = 30 - HIDESPONSORBILLING = 31 - - FIELDS = { - DEFAULTLOCATIONNAME => {:type => ::Thrift::Types::STRING, :name => 'defaultLocationName', :optional => true}, - DEFAULTLATITUDE => {:type => ::Thrift::Types::DOUBLE, :name => 'defaultLatitude', :optional => true}, - DEFAULTLONGITUDE => {:type => ::Thrift::Types::DOUBLE, :name => 'defaultLongitude', :optional => true}, - PREACTIVATION => {:type => ::Thrift::Types::BOOL, :name => 'preactivation', :optional => true}, - VIEWEDPROMOTIONS => {:type => ::Thrift::Types::LIST, :name => 'viewedPromotions', :element => {:type => ::Thrift::Types::STRING}, :optional => true}, - INCOMINGEMAILADDRESS => {:type => ::Thrift::Types::STRING, :name => 'incomingEmailAddress', :optional => true}, - RECENTMAILEDADDRESSES => {:type => ::Thrift::Types::LIST, :name => 'recentMailedAddresses', :element => {:type => ::Thrift::Types::STRING}, :optional => true}, - COMMENTS => {:type => ::Thrift::Types::STRING, :name => 'comments', :optional => true}, - DATEAGREEDTOTERMSOFSERVICE => {:type => ::Thrift::Types::I64, :name => 'dateAgreedToTermsOfService', :optional => true}, - MAXREFERRALS => {:type => ::Thrift::Types::I32, :name => 'maxReferrals', :optional => true}, - REFERRALCOUNT => {:type => ::Thrift::Types::I32, :name => 'referralCount', :optional => true}, - REFERERCODE => {:type => ::Thrift::Types::STRING, :name => 'refererCode', :optional => true}, - SENTEMAILDATE => {:type => ::Thrift::Types::I64, :name => 'sentEmailDate', :optional => true}, - SENTEMAILCOUNT => {:type => ::Thrift::Types::I32, :name => 'sentEmailCount', :optional => true}, - DAILYEMAILLIMIT => {:type => ::Thrift::Types::I32, :name => 'dailyEmailLimit', :optional => true}, - EMAILOPTOUTDATE => {:type => ::Thrift::Types::I64, :name => 'emailOptOutDate', :optional => true}, - PARTNEREMAILOPTINDATE => {:type => ::Thrift::Types::I64, :name => 'partnerEmailOptInDate', :optional => true}, - PREFERREDLANGUAGE => {:type => ::Thrift::Types::STRING, :name => 'preferredLanguage', :optional => true}, - PREFERREDCOUNTRY => {:type => ::Thrift::Types::STRING, :name => 'preferredCountry', :optional => true}, - CLIPFULLPAGE => {:type => ::Thrift::Types::BOOL, :name => 'clipFullPage', :optional => true}, - TWITTERUSERNAME => {:type => ::Thrift::Types::STRING, :name => 'twitterUserName', :optional => true}, - TWITTERID => {:type => ::Thrift::Types::STRING, :name => 'twitterId', :optional => true}, - GROUPNAME => {:type => ::Thrift::Types::STRING, :name => 'groupName', :optional => true}, - RECOGNITIONLANGUAGE => {:type => ::Thrift::Types::STRING, :name => 'recognitionLanguage', :optional => true}, - CUSTOMERPROFILEID => {:type => ::Thrift::Types::I64, :name => 'customerProfileId', :optional => true}, - REFERRALPROOF => {:type => ::Thrift::Types::STRING, :name => 'referralProof', :optional => true}, - EDUCATIONALDISCOUNT => {:type => ::Thrift::Types::BOOL, :name => 'educationalDiscount', :optional => true}, - BUSINESSADDRESS => {:type => ::Thrift::Types::STRING, :name => 'businessAddress', :optional => true}, - HIDESPONSORBILLING => {:type => ::Thrift::Types::BOOL, :name => 'hideSponsorBilling', :optional => true} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - # This represents the bookkeeping information for the user's subscription. - # - # <dl> - # <dt>uploadLimit</dt> - # <dd>The number of bytes that can be uploaded to the account - # in the current month. For new notes that are created, this is the length - # of the note content (in Unicode characters) plus the size of each resource - # (in bytes). For edited notes, this is the the difference between the old - # length and the new length (if this is greater than 0) plus the size of - # each new resource. - # </dd> - # <dt>uploadLimitEnd</dt> - # <dd>The date and time when the current upload limit - # expires. At this time, the monthly upload count reverts to 0 and a new - # limit is imposed. This date and time is exclusive, so this is effectively - # the start of the new month. - # </dd> - # <dt>uploadLimitNextMonth</dt> - # <dd> When uploadLimitEnd is reached, the service - # will change uploadLimit to uploadLimitNextMonth. If a premium account is - # canceled, this mechanism will reset the quota appropriately. - # </dd> - # <dt>premiumServiceStatus</dt> - # <dd>Indicates the phases of a premium account - # during the billing process. - # </dd> - # <dt>premiumOrderNumber</dt> - # <dd>The order number used by the commerce system to - # process recurring payments - # </dd> - # <dt>premiumServiceStart</dt> - # <dd>The start date when this premium promotion - # began (this number will get overwritten if a premium service is canceled - # and then re-activated). - # </dd> - # <dt>premiumCommerceService</dt> - # <dd>The commerce system used (paypal, Google - # checkout, etc) - # </dd> - # <dt>premiumServiceSKU</dt> - # <dd>The code associated with the purchase eg. monthly - # or annual purchase. Clients should interpret this value and localize it. - # </dd> - # <dt>lastSuccessfulCharge</dt> - # <dd>Date the last time the user was charged. - # Null if never charged. - # </dd> - # <dt>lastFailedCharge</dt> - # <dd>Date the last time a charge was attempted and - # failed. - # </dd> - # <dt>lastFailedChargeReason</dt> - # <dd>Reason provided for the charge failure - # </dd> - # <dt>nextPaymentDue</dt> - # <dd>The end of the billing cycle. This could be in the - # past if there are failed charges. - # </dd> - # <dt>premiumLockUntil</dt> - # <dd>An internal variable to manage locking operations - # on the commerce variables. - # </dd> - # <dt>updated</dt> - # <dd>The date any modification where made to this record. - # </dd> - # <dt>premiumSubscriptionNumber</dt> - # <dd>The number number identifying the - # recurring subscription used to make the recurring charges. - # </dd> - # <dt>lastRequestedCharge</dt> - # <dd>Date charge last attempted</dd> - # <dt>currency</dt> - # <dd>ISO 4217 currency code</dd> - # <dt>unitPrice</dt> - # <dd>charge in the smallest unit of the currency (e.g. cents for USD)</dd> - # </dl> - class Accounting - include ::Thrift::Struct, ::Thrift::Struct_Union - UPLOADLIMIT = 1 - UPLOADLIMITEND = 2 - UPLOADLIMITNEXTMONTH = 3 - PREMIUMSERVICESTATUS = 4 - PREMIUMORDERNUMBER = 5 - PREMIUMCOMMERCESERVICE = 6 - PREMIUMSERVICESTART = 7 - PREMIUMSERVICESKU = 8 - LASTSUCCESSFULCHARGE = 9 - LASTFAILEDCHARGE = 10 - LASTFAILEDCHARGEREASON = 11 - NEXTPAYMENTDUE = 12 - PREMIUMLOCKUNTIL = 13 - UPDATED = 14 - PREMIUMSUBSCRIPTIONNUMBER = 16 - LASTREQUESTEDCHARGE = 17 - CURRENCY = 18 - UNITPRICE = 19 - - FIELDS = { - UPLOADLIMIT => {:type => ::Thrift::Types::I64, :name => 'uploadLimit', :optional => true}, - UPLOADLIMITEND => {:type => ::Thrift::Types::I64, :name => 'uploadLimitEnd', :optional => true}, - UPLOADLIMITNEXTMONTH => {:type => ::Thrift::Types::I64, :name => 'uploadLimitNextMonth', :optional => true}, - PREMIUMSERVICESTATUS => {:type => ::Thrift::Types::I32, :name => 'premiumServiceStatus', :optional => true, :enum_class => Evernote::EDAM::Type::PremiumOrderStatus}, - PREMIUMORDERNUMBER => {:type => ::Thrift::Types::STRING, :name => 'premiumOrderNumber', :optional => true}, - PREMIUMCOMMERCESERVICE => {:type => ::Thrift::Types::STRING, :name => 'premiumCommerceService', :optional => true}, - PREMIUMSERVICESTART => {:type => ::Thrift::Types::I64, :name => 'premiumServiceStart', :optional => true}, - PREMIUMSERVICESKU => {:type => ::Thrift::Types::STRING, :name => 'premiumServiceSKU', :optional => true}, - LASTSUCCESSFULCHARGE => {:type => ::Thrift::Types::I64, :name => 'lastSuccessfulCharge', :optional => true}, - LASTFAILEDCHARGE => {:type => ::Thrift::Types::I64, :name => 'lastFailedCharge', :optional => true}, - LASTFAILEDCHARGEREASON => {:type => ::Thrift::Types::STRING, :name => 'lastFailedChargeReason', :optional => true}, - NEXTPAYMENTDUE => {:type => ::Thrift::Types::I64, :name => 'nextPaymentDue', :optional => true}, - PREMIUMLOCKUNTIL => {:type => ::Thrift::Types::I64, :name => 'premiumLockUntil', :optional => true}, - UPDATED => {:type => ::Thrift::Types::I64, :name => 'updated', :optional => true}, - PREMIUMSUBSCRIPTIONNUMBER => {:type => ::Thrift::Types::STRING, :name => 'premiumSubscriptionNumber', :optional => true}, - LASTREQUESTEDCHARGE => {:type => ::Thrift::Types::I64, :name => 'lastRequestedCharge', :optional => true}, - CURRENCY => {:type => ::Thrift::Types::STRING, :name => 'currency', :optional => true}, - UNITPRICE => {:type => ::Thrift::Types::I32, :name => 'unitPrice', :optional => true} - } - - def struct_fields; FIELDS; end - - def validate - unless @premiumServiceStatus.nil? || Evernote::EDAM::Type::PremiumOrderStatus::VALID_VALUES.include?(@premiumServiceStatus) - raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field premiumServiceStatus!') - end - end - - ::Thrift::Struct.generate_accessors self - end - - # This represents the information about a single user account. - # <dl> - # <dt>id</dt> - # <dd>The unique numeric identifier for the account, which will not - # change for the lifetime of the account. - # </dd> - # - # <dt>username</dt> - # <dd>The name that the user provides to log in to their - # account. In the future, this may be empty for some accounts if their login - # process is indirect (e.g. via social networks, etc.). - # May only contain a-z, 0-9, or '-', and may not start or end with the '-' - # <br/> - # Length: EDAM_USER_USERNAME_LEN_MIN - EDAM_USER_USERNAME_LEN_MAX - # <br/> - # Regex: EDAM_USER_USERNAME_REGEX - # </dd> - # - # <dt>email</dt> - # <dd>The email address registered for the user. Must comply with - # RFC 2821 and RFC 2822.<br/> - # Length: EDAM_EMAIL_LEN_MIN - EDAM_EMAIL_LEN_MAX - # <br/> - # Regex: EDAM_EMAIL_REGEX - # </dd> - # - # <dt>name</dt> - # <dd>The printable name of the user, which may be a combination - # of given and family names. This is used instead of separate "first" - # and "last" names due to variations in international name format/order. - # May not start or end with a whitespace character. May contain any - # character but carriage return or newline (Unicode classes Zl and Zp). - # <br/> - # Length: EDAM_USER_NAME_LEN_MIN - EDAM_USER_NAME_LEN_MAX - # <br/> - # Regex: EDAM_USER_NAME_REGEX - # </dd> - # - # <dt>timezone</dt> - # <dd>The zone ID for the user's default location. If present, - # this may be used to localize the display of any timestamp for which no - # other timezone is available - for example, an note that arrives via - # a micro-browser may not contain enough information to display its - # local time, so this default timezone may be assigned to the note. - # The format must be encoded as a standard zone ID such as - # "America/Los_Angeles" or "GMT+08:00" - # <br/> - # Length: EDAM_TIMEZONE_LEN_MIN - EDAM_TIMEZONE_LEN_MAX - # <br/> - # Regex: EDAM_TIMEZONE_REGEX - # </dd> - # - # <dt>privilege</dt> - # <dd>The level of access permitted for the user. - # </dd> - # - # <dt>created</dt> - # <dd>The date and time when this user account was created in the - # service. - # </dd> - # - # <dt>updated</dt> - # <dd>The date and time when this user account was last modified - # in the service. - # </dd> - # - # <dt>deleted</dt> - # <dd>If the account has been deleted from the system (e.g. as - # the result of a legal request by the user), the date and time of the - # deletion will be represented here. If not, this value will not be set. - # </dd> - # - # <dt>active</dt> - # <dd>If the user account is available for login and - # synchronization, this flag will be set to true. - # </dd> - # - # <dt>shardId</dt> - # <dd>The name of the virtual server that manages the state of - # this user. This value is used internally to determine which system should - # service requests about this user's data. - # </dd> - # - # <dt>attributes</dt> - # <dd>If present, this will contain a list of the attributes - # for this user account. - # </dd> - # - # <dt>accounting</dt> - # <dd>Bookkeeping information for the user's subscription. - # </dd> - # </dl> - class User - include ::Thrift::Struct, ::Thrift::Struct_Union - ID = 1 - USERNAME = 2 - EMAIL = 3 - NAME = 4 - TIMEZONE = 6 - PRIVILEGE = 7 - CREATED = 9 - UPDATED = 10 - DELETED = 11 - ACTIVE = 13 - SHARDID = 14 - ATTRIBUTES = 15 - ACCOUNTING = 16 - - FIELDS = { - ID => {:type => ::Thrift::Types::I32, :name => 'id', :optional => true}, - USERNAME => {:type => ::Thrift::Types::STRING, :name => 'username', :optional => true}, - EMAIL => {:type => ::Thrift::Types::STRING, :name => 'email', :optional => true}, - NAME => {:type => ::Thrift::Types::STRING, :name => 'name', :optional => true}, - TIMEZONE => {:type => ::Thrift::Types::STRING, :name => 'timezone', :optional => true}, - PRIVILEGE => {:type => ::Thrift::Types::I32, :name => 'privilege', :optional => true, :enum_class => Evernote::EDAM::Type::PrivilegeLevel}, - CREATED => {:type => ::Thrift::Types::I64, :name => 'created', :optional => true}, - UPDATED => {:type => ::Thrift::Types::I64, :name => 'updated', :optional => true}, - DELETED => {:type => ::Thrift::Types::I64, :name => 'deleted', :optional => true}, - ACTIVE => {:type => ::Thrift::Types::BOOL, :name => 'active', :optional => true}, - SHARDID => {:type => ::Thrift::Types::STRING, :name => 'shardId', :optional => true}, - ATTRIBUTES => {:type => ::Thrift::Types::STRUCT, :name => 'attributes', :class => Evernote::EDAM::Type::UserAttributes, :optional => true}, - ACCOUNTING => {:type => ::Thrift::Types::STRUCT, :name => 'accounting', :class => Evernote::EDAM::Type::Accounting, :optional => true} - } - - def struct_fields; FIELDS; end - - def validate - unless @privilege.nil? || Evernote::EDAM::Type::PrivilegeLevel::VALID_VALUES.include?(@privilege) - raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field privilege!') - end - end - - ::Thrift::Struct.generate_accessors self - end - - # A tag within a user's account is a unique name which may be organized - # a simple hierarchy. - # <dl> - # <dt>guid</dt> - # <dd>The unique identifier of this tag. Will be set by the service, - # so may be omitted by the client when creating the Tag. - # <br/> - # Length: EDAM_GUID_LEN_MIN - EDAM_GUID_LEN_MAX - # <br/> - # Regex: EDAM_GUID_REGEX - # </dd> - # - # <dt>name</dt> - # <dd>A sequence of characters representing the tag's identifier. - # Case is preserved, but is ignored for comparisons. - # This means that an account may only have one tag with a given name, via - # case-insensitive comparison, so an account may not have both "food" and - # "Food" tags. - # May not contain a comma (','), and may not begin or end with a space. - # <br/> - # Length: EDAM_TAG_NAME_LEN_MIN - EDAM_TAG_NAME_LEN_MAX - # <br/> - # Regex: EDAM_TAG_NAME_REGEX - # </dd> - # - # <dt>parentGuid</dt> - # <dd>If this is set, then this is the GUID of the tag that - # holds this tag within the tag organizational hierarchy. If this is - # not set, then the tag has no parent and it is a "top level" tag. - # Cycles are not allowed (e.g. a->parent->parent == a) and will be - # rejected by the service. - # <br/> - # Length: EDAM_GUID_LEN_MIN - EDAM_GUID_LEN_MAX - # <br/> - # Regex: EDAM_GUID_REGEX - # </dd> - # - # <dt>updateSequenceNum</dt> - # <dd>A number identifying the last transaction to - # modify the state of this object. The USN values are sequential within an - # account, and can be used to compare the order of modifications within the - # service. - # </dd> - # </dl> - class Tag - include ::Thrift::Struct, ::Thrift::Struct_Union - GUID = 1 - NAME = 2 - PARENTGUID = 3 - UPDATESEQUENCENUM = 4 - - FIELDS = { - GUID => {:type => ::Thrift::Types::STRING, :name => 'guid', :optional => true}, - NAME => {:type => ::Thrift::Types::STRING, :name => 'name', :optional => true}, - PARENTGUID => {:type => ::Thrift::Types::STRING, :name => 'parentGuid', :optional => true}, - UPDATESEQUENCENUM => {:type => ::Thrift::Types::I32, :name => 'updateSequenceNum', :optional => true} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - # A structure that wraps a map of name/value pairs whose values are not - # always present in the structure in order to reduce space when obtaining - # batches of entities that contain the map. - # - # When the server provides the client with a LazyMap, it will fill in either - # the keysOnly field or the fullMap field, but never both, based on the API - # and parameters. - # - # When a client provides a LazyMap to the server as part of an update to - # an object, the server will only update the LazyMap if the fullMap field is - # set. If the fullMap field is not set, the server will not make any changes - # to the map. - # - # Check the API documentation of the individual calls involving the LazyMap - # for full details including the constraints of the names and values of the - # map. - # - # <dl> - # <dt>keysOnly</dt> - # <dd>The set of keys for the map. This field is ignored by the - # server when set. - # </dd> - # - # <dt>fullMap</dt> - # <dd>The complete map, including all keys and values. - # </dd> - # </dl> - class LazyMap - include ::Thrift::Struct, ::Thrift::Struct_Union - KEYSONLY = 1 - FULLMAP = 2 - - FIELDS = { - KEYSONLY => {:type => ::Thrift::Types::SET, :name => 'keysOnly', :element => {:type => ::Thrift::Types::STRING}, :optional => true}, - FULLMAP => {:type => ::Thrift::Types::MAP, :name => 'fullMap', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::STRING}, :optional => true} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - # Structure holding the optional attributes of a Resource - # <dl> - # <dt>sourceURL</dt> - # <dd>the original location where the resource was hosted - # <br/> - # Length: EDAM_ATTRIBUTE_LEN_MIN - EDAM_ATTRIBUTE_LEN_MAX - # </dd> - # - # <dt>timestamp</dt> - # <dd>the date and time that is associated with this resource - # (e.g. the time embedded in an image from a digital camera with a clock) - # </dd> - # - # <dt>latitude</dt> - # <dd>the latitude where the resource was captured - # </dd> - # - # <dt>longitude</dt> - # <dd>the longitude where the resource was captured - # </dd> - # - # <dt>altitude</dt> - # <dd>the altitude where the resource was captured - # </dd> - # - # <dt>cameraMake</dt> - # <dd>information about an image's camera, e.g. as embedded in - # the image's EXIF data - # <br/> - # Length: EDAM_ATTRIBUTE_LEN_MIN - EDAM_ATTRIBUTE_LEN_MAX - # </dd> - # - # <dt>cameraModel</dt> - # <dd>information about an image's camera, e.g. as embedded - # in the image's EXIF data - # <br/> - # Length: EDAM_ATTRIBUTE_LEN_MIN - EDAM_ATTRIBUTE_LEN_MAX - # </dd> - # - # <dt>clientWillIndex</dt> - # <dd>if true, then the original client that submitted - # the resource plans to submit the recognition index for this resource at a - # later time. - # </dd> - # - # <dt>recoType</dt> - # <dd>DEPRECATED - this field is no longer set by the service, so should - # be ignored. - # </dd> - # - # <dt>fileName</dt> - # <dd>if the resource came from a source that provided an - # explicit file name, the original name will be stored here. Many resources - # come from unnamed sources, so this will not always be set. - # </dd> - # - # <dt>attachment</dt> - # <dd>this will be true if the resource should be displayed as an attachment, - # or false if the resource should be displayed inline (if possible). - # </dd> - # - # <dt>applicationData</dt> - # <dd>Provides a location for applications to store a relatively small - # (4kb) blob of data associated with a Resource that is not visible to the user - # and that is opaque to the Evernote service. A single application may use at most - # one entry in this map, using its API consumer key as the map key. See the - # documentation for LazyMap for a description of when the actual map values - # are returned by the service. - # <p>To safely add or modify your application's entry in the map, use - # NoteStore.setResourceApplicationDataEntry. To safely remove your application's - # entry from the map, use NoteStore.unsetResourceApplicationDataEntry.</p> - # Minimum length of a name (key): EDAM_APPLICATIONDATA_NAME_LEN_MIN - # <br/> - # Sum max size of key and value: EDAM_APPLICATIONDATA_ENTRY_LEN_MAX - # <br/> - # Syntax regex for name (key): EDAM_APPLICATIONDATA_NAME_REGEX - # </dd> - # - # </dl> - class ResourceAttributes - include ::Thrift::Struct, ::Thrift::Struct_Union - SOURCEURL = 1 - TIMESTAMP = 2 - LATITUDE = 3 - LONGITUDE = 4 - ALTITUDE = 5 - CAMERAMAKE = 6 - CAMERAMODEL = 7 - CLIENTWILLINDEX = 8 - RECOTYPE = 9 - FILENAME = 10 - ATTACHMENT = 11 - APPLICATIONDATA = 12 - - FIELDS = { - SOURCEURL => {:type => ::Thrift::Types::STRING, :name => 'sourceURL', :optional => true}, - TIMESTAMP => {:type => ::Thrift::Types::I64, :name => 'timestamp', :optional => true}, - LATITUDE => {:type => ::Thrift::Types::DOUBLE, :name => 'latitude', :optional => true}, - LONGITUDE => {:type => ::Thrift::Types::DOUBLE, :name => 'longitude', :optional => true}, - ALTITUDE => {:type => ::Thrift::Types::DOUBLE, :name => 'altitude', :optional => true}, - CAMERAMAKE => {:type => ::Thrift::Types::STRING, :name => 'cameraMake', :optional => true}, - CAMERAMODEL => {:type => ::Thrift::Types::STRING, :name => 'cameraModel', :optional => true}, - CLIENTWILLINDEX => {:type => ::Thrift::Types::BOOL, :name => 'clientWillIndex', :optional => true}, - RECOTYPE => {:type => ::Thrift::Types::STRING, :name => 'recoType', :optional => true}, - FILENAME => {:type => ::Thrift::Types::STRING, :name => 'fileName', :optional => true}, - ATTACHMENT => {:type => ::Thrift::Types::BOOL, :name => 'attachment', :optional => true}, - APPLICATIONDATA => {:type => ::Thrift::Types::STRUCT, :name => 'applicationData', :class => Evernote::EDAM::Type::LazyMap, :optional => true} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - # Every media file that is embedded or attached to a note is represented - # through a Resource entry. - # <dl> - # <dt>guid</dt> - # <dd>The unique identifier of this resource. Will be set whenever - # a resource is retrieved from the service, but may be null when a client - # is creating a resource. - # <br/> - # Length: EDAM_GUID_LEN_MIN - EDAM_GUID_LEN_MAX - # <br/> - # Regex: EDAM_GUID_REGEX - # </dd> - # - # <dt>noteGuid</dt> - # <dd>The unique identifier of the Note that holds this - # Resource. Will be set whenever the resource is retrieved from the service, - # but may be null when a client is creating a resource. - # <br/> - # Length: EDAM_GUID_LEN_MIN - EDAM_GUID_LEN_MAX - # <br/> - # Regex: EDAM_GUID_REGEX - # </dd> - # - # <dt>data</dt> - # <dd>The contents of the resource. - # Maximum length: The data.body is limited to EDAM_RESOURCE_SIZE_MAX_FREE - # for free accounts and EDAM_RESOURCE_SIZE_MAX_PREMIUM for premium accounts. - # </dd> - # - # <dt>mime</dt> - # <dd>The MIME type for the embedded resource. E.g. "image/gif" - # <br/> - # Length: EDAM_MIME_LEN_MIN - EDAM_MIME_LEN_MAX - # <br/> - # Regex: EDAM_MIME_REGEX - # </dd> - # - # <dt>width</dt> - # <dd>If set, this contains the display width of this resource, in - # pixels. - # </dd> - # - # <dt>height</dt> - # <dd>If set, this contains the display height of this resource, - # in pixels. - # </dd> - # - # <dt>duration</dt> - # <dd>DEPRECATED: ignored. - # </dd> - # - # <dt>active</dt> - # <dd>DEPRECATED: ignored. - # </dd> - # - # <dt>recognition</dt> - # <dd>If set, this will hold the encoded data that provides - # information on search and recognition within this resource. - # </dd> - # - # <dt>attributes</dt> - # <dd>A list of the attributes for this resource. - # </dd> - # - # <dt>updateSequenceNum</dt> - # <dd>A number identifying the last transaction to - # modify the state of this object. The USN values are sequential within an - # account, and can be used to compare the order of modifications within the - # service. - # </dd> - # - # <dt>alternateData</dt> - # <dd>Some Resources may be assigned an alternate data format by the service - # which may be more appropriate for indexing or rendering than the original - # data provided by the user. In these cases, the alternate data form will - # be available via this Data element. If a Resource has no alternate form, - # this field will be unset.</dd> - # </dl> - class Resource - include ::Thrift::Struct, ::Thrift::Struct_Union - GUID = 1 - NOTEGUID = 2 - DATA = 3 - MIME = 4 - WIDTH = 5 - HEIGHT = 6 - DURATION = 7 - ACTIVE = 8 - RECOGNITION = 9 - ATTRIBUTES = 11 - UPDATESEQUENCENUM = 12 - ALTERNATEDATA = 13 - - FIELDS = { - GUID => {:type => ::Thrift::Types::STRING, :name => 'guid', :optional => true}, - NOTEGUID => {:type => ::Thrift::Types::STRING, :name => 'noteGuid', :optional => true}, - DATA => {:type => ::Thrift::Types::STRUCT, :name => 'data', :class => Evernote::EDAM::Type::Data, :optional => true}, - MIME => {:type => ::Thrift::Types::STRING, :name => 'mime', :optional => true}, - WIDTH => {:type => ::Thrift::Types::I16, :name => 'width', :optional => true}, - HEIGHT => {:type => ::Thrift::Types::I16, :name => 'height', :optional => true}, - DURATION => {:type => ::Thrift::Types::I16, :name => 'duration', :optional => true}, - ACTIVE => {:type => ::Thrift::Types::BOOL, :name => 'active', :optional => true}, - RECOGNITION => {:type => ::Thrift::Types::STRUCT, :name => 'recognition', :class => Evernote::EDAM::Type::Data, :optional => true}, - ATTRIBUTES => {:type => ::Thrift::Types::STRUCT, :name => 'attributes', :class => Evernote::EDAM::Type::ResourceAttributes, :optional => true}, - UPDATESEQUENCENUM => {:type => ::Thrift::Types::I32, :name => 'updateSequenceNum', :optional => true}, - ALTERNATEDATA => {:type => ::Thrift::Types::STRUCT, :name => 'alternateData', :class => Evernote::EDAM::Type::Data, :optional => true} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - # The list of optional attributes that can be stored on a note. - # <dl> - # <dt>subjectDate</dt> - # <dd>time that the note refers to - # </dd> - # - # <dt>latitude</dt> - # <dd>the latitude where the note was taken - # </dd> - # - # <dt>longitude</dt> - # <dd>the longitude where the note was taken - # </dd> - # - # <dt>altitude</dt> - # <dd>the altitude where the note was taken - # </dd> - # - # <dt>author</dt> - # <dd>the author of the content of the note - # <br/> - # Length: EDAM_ATTRIBUTE_LEN_MIN - EDAM_ATTRIBUTE_LEN_MAX - # </dd> - # - # <dt>source</dt> - # <dd>the method that the note was added to the account, if the - # note wasn't directly authored in an Evernote desktop client. - # <br/> - # Length: EDAM_ATTRIBUTE_LEN_MIN - EDAM_ATTRIBUTE_LEN_MAX - # </dd> - # - # <dt>sourceURL</dt> - # <dd>the original location where the resource was hosted. For web clips, - # this will be the URL of the page that was clipped. - # <br/> - # Length: EDAM_ATTRIBUTE_LEN_MIN - EDAM_ATTRIBUTE_LEN_MAX - # </dd> - # - # <dt>sourceApplication</dt> - # <dd>an identifying string for the application that - # created this note. This string does not have a guaranteed syntax or - # structure -- it is intended for human inspection and tracking. - # <br/> - # Length: EDAM_ATTRIBUTE_LEN_MIN - EDAM_ATTRIBUTE_LEN_MAX - # </dd> - # - # <dt>shareDate</dt> - # <dd>The date and time when this note was directly shared via its own URL. - # This is only set on notes that were individually shared - it is independent - # of any notebook-level sharing of the containing notepbook. This field - # is treated as "read-only" for clients; the server will ignore changes - # to this field from an external client. - # </dd> - # - # <dt>placeName</dt> - # <dd>Allows the user to assign a human-readable location name associated - # with a note. Users may assign values like 'Home' and 'Work'. Place - # names may also be populated with values from geonames database - # (e.g., a restaurant name). Applications are encouraged to normalize values - # so that grouping values by place name provides a useful result. Applications - # MUST NOT automatically add place name values based on geolocation without - # confirmation from the user; that is, the value in this field should be - # more useful than a simple automated lookup based on the note's latitude - # and longitude.</dd> - # - # <dt>contentClass</dt> - # <dd>The class (or type) of note. This field is used to indicate to - # clients that special structured information is represented within - # the note such that special rules apply when making - # modifications. If contentClass is set and the client - # application does not specifically support the specified class, - # the client MUST treat the note as read-only. In this case, the - # client MAY modify the note's notebook and tags via the - # Note.notebookGuid and Note.tagGuids fields. - # <p>Applications should set contentClass only when they are creating notes - # that contain structured information that needs to be maintained in order - # for the user to be able to use the note within that application. - # Setting contentClass makes a note read-only in other applications, so - # there is a trade-off when an application chooses to use contentClass. - # Applications that set contentClass when creating notes must use a contentClass - # string of the form <i>CompanyName.ApplicationName</i> to ensure uniqueness.</p> - # Length restrictions: EDAM_NOTE_CONTENT_CLASS_LEN_MIN, EDAM_NOTE_CONTENT_CLASS_LEN_MAX - # <br/> - # Regex: EDAM_NOTE_CONTENT_CLASS_REGEX - # </dd> - # - # <dt>applicationData</dt> - # <dd>Provides a location for applications to store a relatively small - # (4kb) blob of data that is not meant to be visible to the user and - # that is opaque to the Evernote service. A single application may use at most - # one entry in this map, using its API consumer key as the map key. See the - # documentation for LazyMap for a description of when the actual map values - # are returned by the service. - # <p>To safely add or modify your application's entry in the map, use - # NoteStore.setNoteApplicationDataEntry. To safely remove your application's - # entry from the map, use NoteStore.unsetNoteApplicationDataEntry.</p> - # Minimum length of a name (key): EDAM_APPLICATIONDATA_NAME_LEN_MIN - # <br/> - # Sum max size of key and value: EDAM_APPLICATIONDATA_ENTRY_LEN_MAX - # <br/> - # Syntax regex for name (key): EDAM_APPLICATIONDATA_NAME_REGEX - # </dd> - # - # <dt>lastEditedBy</dt> - # <dd>An indication of who made the last change to the note. If you are - # accessing the note via a shared notebook to which you have modification - # rights, or if you are the owner of the notebook to which the note belongs, - # then you have access to the value. In this case, the value will be - # unset if the owner of the notebook containing the note was the last to - # make the modification, else it will be a string describing the - # guest who made the last edit. If you do not have access to this value, - # it will be left unset. This field is read-only by clients. The server - # will ignore all values set by clients into this field.</dd> - # - # </dl> - class NoteAttributes - include ::Thrift::Struct, ::Thrift::Struct_Union - SUBJECTDATE = 1 - LATITUDE = 10 - LONGITUDE = 11 - ALTITUDE = 12 - AUTHOR = 13 - SOURCE = 14 - SOURCEURL = 15 - SOURCEAPPLICATION = 16 - SHAREDATE = 17 - PLACENAME = 21 - CONTENTCLASS = 22 - APPLICATIONDATA = 23 - LASTEDITEDBY = 24 - - FIELDS = { - SUBJECTDATE => {:type => ::Thrift::Types::I64, :name => 'subjectDate', :optional => true}, - LATITUDE => {:type => ::Thrift::Types::DOUBLE, :name => 'latitude', :optional => true}, - LONGITUDE => {:type => ::Thrift::Types::DOUBLE, :name => 'longitude', :optional => true}, - ALTITUDE => {:type => ::Thrift::Types::DOUBLE, :name => 'altitude', :optional => true}, - AUTHOR => {:type => ::Thrift::Types::STRING, :name => 'author', :optional => true}, - SOURCE => {:type => ::Thrift::Types::STRING, :name => 'source', :optional => true}, - SOURCEURL => {:type => ::Thrift::Types::STRING, :name => 'sourceURL', :optional => true}, - SOURCEAPPLICATION => {:type => ::Thrift::Types::STRING, :name => 'sourceApplication', :optional => true}, - SHAREDATE => {:type => ::Thrift::Types::I64, :name => 'shareDate', :optional => true}, - PLACENAME => {:type => ::Thrift::Types::STRING, :name => 'placeName', :optional => true}, - CONTENTCLASS => {:type => ::Thrift::Types::STRING, :name => 'contentClass', :optional => true}, - APPLICATIONDATA => {:type => ::Thrift::Types::STRUCT, :name => 'applicationData', :class => Evernote::EDAM::Type::LazyMap, :optional => true}, - LASTEDITEDBY => {:type => ::Thrift::Types::STRING, :name => 'lastEditedBy', :optional => true} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - # Represents a single note in the user's account. - # - # <dl> - # <dt>guid</dt> - # <dd>The unique identifier of this note. Will be set by the - # server, but will be omitted by clients calling NoteStore.createNote() - # <br/> - # Length: EDAM_GUID_LEN_MIN - EDAM_GUID_LEN_MAX - # <br/> - # Regex: EDAM_GUID_REGEX - # </dd> - # - # <dt>title</dt> - # <dd>The subject of the note. Can't begin or end with a space. - # <br/> - # Length: EDAM_NOTE_TITLE_LEN_MIN - EDAM_NOTE_TITLE_LEN_MAX - # <br/> - # Regex: EDAM_NOTE_TITLE_REGEX - # </dd> - # - # <dt>content</dt> - # <dd>The XHTML block that makes up the note. This is - # the canonical form of the note's contents, so will include abstract - # Evernote tags for internal resource references. A client may create - # a separate transformed version of this content for internal presentation, - # but the same canonical bytes should be used for transmission and - # comparison unless the user chooses to modify their content. - # <br/> - # Length: EDAM_NOTE_CONTENT_LEN_MIN - EDAM_NOTE_CONTENT_LEN_MAX - # </dd> - # - # <dt>contentHash</dt> - # <dd>The binary MD5 checksum of the UTF-8 encoded content - # body. This will always be set by the server, but clients may choose to omit - # this when they submit a note with content. - # <br/> - # Length: EDAM_HASH_LEN (exactly) - # </dd> - # - # <dt>contentLength</dt> - # <dd>The number of Unicode characters in the content of - # the note. This will always be set by the service, but clients may choose - # to omit this value when they submit a Note. - # </dd> - # - # <dt>created</dt> - # <dd>The date and time when the note was created in one of the - # clients. In most cases, this will match the user's sense of when - # the note was created, and ordering between notes will be based on - # ordering of this field. However, this is not a "reliable" timestamp - # if a client has an incorrect clock, so it cannot provide a true absolute - # ordering between notes. Notes created directly through the service - # (e.g. via the web GUI) will have an absolutely ordered "created" value. - # </dd> - # - # <dt>updated</dt> - # <dd>The date and time when the note was last modified in one of - # the clients. In most cases, this will match the user's sense of when - # the note was modified, but this field may not be absolutely reliable - # due to the possibility of client clock errors. - # </dd> - # - # <dt>deleted</dt> - # <dd>If present, the note is considered "deleted", and this - # stores the date and time when the note was deleted by one of the clients. - # In most cases, this will match the user's sense of when the note was - # deleted, but this field may be unreliable due to the possibility of - # client clock errors. - # </dd> - # - # <dt>active</dt> - # <dd>If the note is available for normal actions and viewing, - # this flag will be set to true. - # </dd> - # - # <dt>updateSequenceNum</dt> - # <dd>A number identifying the last transaction to - # modify the state of this note (including changes to the note's attributes - # or resources). The USN values are sequential within an account, - # and can be used to compare the order of modifications within the service. - # </dd> - # - # <dt>notebookGuid</dt> - # <dd>The unique identifier of the notebook that contains - # this note. If no notebookGuid is provided on a call to createNote(), the - # default notebook will be used instead. - # <br/> - # Length: EDAM_GUID_LEN_MIN - EDAM_GUID_LEN_MAX - # <br/> - # Regex: EDAM_GUID_REGEX - # </dd> - # - # <dt>tagGuids</dt> - # <dd>A list of the GUID identifiers for tags that are applied to this note. - # This may be provided in a call to createNote() to unambiguously declare - # the tags that should be assigned to the new note. Alternately, clients - # may pass the names of desired tags via the 'tagNames' field during - # note creation. - # If the list of tags are omitted on a call to createNote(), then - # the server will assume that no changes have been made to the resources. - # Maximum: EDAM_NOTE_TAGS_MAX tags per note - # </dd> - # - # <dt>resources</dt> - # <dd>The list of resources that are embedded within this note. - # If the list of resources are omitted on a call to updateNote(), then - # the server will assume that no changes have been made to the resources. - # The binary contents of the resources must be provided when the resource - # is first sent to the service, but it will be omitted by the service when - # the Note is returned in the future. - # Maximum: EDAM_NOTE_RESOURCES_MAX resources per note - # </dd> - # - # <dt>attributes</dt> - # <dd>A list of the attributes for this note. - # If the list of attributes are omitted on a call to updateNote(), then - # the server will assume that no changes have been made to the resources. - # </dd> - # - # <dt>tagNames</dt> - # <dd>May be provided by clients during calls to createNote() as an - # alternative to providing the tagGuids of existing tags. If any tagNames - # are provided during createNote(), these will be found, or created if they - # don't already exist. Created tags will have no parent (they will be at - # the top level of the tag panel). - # </dd> - # </dl> - class Note - include ::Thrift::Struct, ::Thrift::Struct_Union - GUID = 1 - TITLE = 2 - CONTENT = 3 - CONTENTHASH = 4 - CONTENTLENGTH = 5 - CREATED = 6 - UPDATED = 7 - DELETED = 8 - ACTIVE = 9 - UPDATESEQUENCENUM = 10 - NOTEBOOKGUID = 11 - TAGGUIDS = 12 - RESOURCES = 13 - ATTRIBUTES = 14 - TAGNAMES = 15 - - FIELDS = { - GUID => {:type => ::Thrift::Types::STRING, :name => 'guid', :optional => true}, - TITLE => {:type => ::Thrift::Types::STRING, :name => 'title', :optional => true}, - CONTENT => {:type => ::Thrift::Types::STRING, :name => 'content', :optional => true}, - CONTENTHASH => {:type => ::Thrift::Types::STRING, :name => 'contentHash', :binary => true, :optional => true}, - CONTENTLENGTH => {:type => ::Thrift::Types::I32, :name => 'contentLength', :optional => true}, - CREATED => {:type => ::Thrift::Types::I64, :name => 'created', :optional => true}, - UPDATED => {:type => ::Thrift::Types::I64, :name => 'updated', :optional => true}, - DELETED => {:type => ::Thrift::Types::I64, :name => 'deleted', :optional => true}, - ACTIVE => {:type => ::Thrift::Types::BOOL, :name => 'active', :optional => true}, - UPDATESEQUENCENUM => {:type => ::Thrift::Types::I32, :name => 'updateSequenceNum', :optional => true}, - NOTEBOOKGUID => {:type => ::Thrift::Types::STRING, :name => 'notebookGuid', :optional => true}, - TAGGUIDS => {:type => ::Thrift::Types::LIST, :name => 'tagGuids', :element => {:type => ::Thrift::Types::STRING}, :optional => true}, - RESOURCES => {:type => ::Thrift::Types::LIST, :name => 'resources', :element => {:type => ::Thrift::Types::STRUCT, :class => Evernote::EDAM::Type::Resource}, :optional => true}, - ATTRIBUTES => {:type => ::Thrift::Types::STRUCT, :name => 'attributes', :class => Evernote::EDAM::Type::NoteAttributes, :optional => true}, - TAGNAMES => {:type => ::Thrift::Types::LIST, :name => 'tagNames', :element => {:type => ::Thrift::Types::STRING}, :optional => true} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - # If a Notebook has been opened to the public, the Notebook will have a - # reference to one of these structures, which gives the location and optional - # description of the externally-visible public Notebook. - # <dl> - # <dt>uri</dt> - # <dd>If this field is present, then the notebook is published for - # mass consumption on the Internet under the provided URI, which is - # relative to a defined base publishing URI defined by the service. - # This field can only be modified via the web service GUI ... publishing - # cannot be modified via an offline client. - # <br/> - # Length: EDAM_PUBLISHING_URI_LEN_MIN - EDAM_PUBLISHING_URI_LEN_MAX - # <br/> - # Regex: EDAM_PUBLISHING_URI_REGEX - # </dd> - # - # <dt>order</dt> - # <dd>When the notes are publicly displayed, they will be sorted - # based on the requested criteria. - # </dd> - # - # <dt>ascending</dt> - # <dd>If this is set to true, then the public notes will be - # displayed in ascending order (e.g. from oldest to newest). Otherwise, - # the notes will be displayed in descending order (e.g. newest to oldest). - # </dd> - # - # <dt>publicDescription</dt> - # <dd>This field may be used to provide a short - # description of the notebook, which may be displayed when (e.g.) the - # notebook is shown in a public view. Can't begin or end with a space. - # <br/> - # Length: EDAM_PUBLISHING_DESCRIPTION_LEN_MIN - - # EDAM_PUBLISHING_DESCRIPTION_LEN_MAX - # <br/> - # Regex: EDAM_PUBLISHING_DESCRIPTION_REGEX - # </dd> - # </dl> - class Publishing - include ::Thrift::Struct, ::Thrift::Struct_Union - URI = 1 - ORDER = 2 - ASCENDING = 3 - PUBLICDESCRIPTION = 4 - - FIELDS = { - URI => {:type => ::Thrift::Types::STRING, :name => 'uri', :optional => true}, - ORDER => {:type => ::Thrift::Types::I32, :name => 'order', :optional => true, :enum_class => Evernote::EDAM::Type::NoteSortOrder}, - ASCENDING => {:type => ::Thrift::Types::BOOL, :name => 'ascending', :optional => true}, - PUBLICDESCRIPTION => {:type => ::Thrift::Types::STRING, :name => 'publicDescription', :optional => true} - } - - def struct_fields; FIELDS; end - - def validate - unless @order.nil? || Evernote::EDAM::Type::NoteSortOrder::VALID_VALUES.include?(@order) - raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field order!') - end - end - - ::Thrift::Struct.generate_accessors self - end - - # A named search associated with the account that can be quickly re-used. - # <dl> - # <dt>guid</dt> - # <dd>The unique identifier of this search. Will be set by the - # service, so may be omitted by the client when creating. - # <br/> - # Length: EDAM_GUID_LEN_MIN - EDAM_GUID_LEN_MAX - # <br/> - # Regex: EDAM_GUID_REGEX - # </dd> - # - # <dt>name</dt> - # <dd>The name of the saved search to display in the GUI. The - # account may only contain one search with a given name (case-insensitive - # compare). Can't begin or end with a space. - # <br/> - # Length: EDAM_SAVED_SEARCH_NAME_LEN_MIN - EDAM_SAVED_SEARCH_NAME_LEN_MAX - # <br/> - # Regex: EDAM_SAVED_SEARCH_NAME_REGEX - # </dd> - # - # <dt>query</dt> - # <dd>A string expressing the search to be performed. - # <br/> - # Length: EDAM_SAVED_SEARCH_QUERY_LEN_MIN - EDAM_SAVED_SEARCH_QUERY_LEN_MAX - # </dd> - # - # <dt>format</dt> - # <dd>The format of the query string, to determine how to parse - # and process it. - # </dd> - # - # <dt>updateSequenceNum</dt> - # <dd>A number identifying the last transaction to - # modify the state of this object. The USN values are sequential within an - # account, and can be used to compare the order of modifications within the - # service. - # </dd> - # </dl> - class SavedSearch - include ::Thrift::Struct, ::Thrift::Struct_Union - GUID = 1 - NAME = 2 - QUERY = 3 - FORMAT = 4 - UPDATESEQUENCENUM = 5 - - FIELDS = { - GUID => {:type => ::Thrift::Types::STRING, :name => 'guid', :optional => true}, - NAME => {:type => ::Thrift::Types::STRING, :name => 'name', :optional => true}, - QUERY => {:type => ::Thrift::Types::STRING, :name => 'query', :optional => true}, - FORMAT => {:type => ::Thrift::Types::I32, :name => 'format', :optional => true, :enum_class => Evernote::EDAM::Type::QueryFormat}, - UPDATESEQUENCENUM => {:type => ::Thrift::Types::I32, :name => 'updateSequenceNum', :optional => true} - } - - def struct_fields; FIELDS; end - - def validate - unless @format.nil? || Evernote::EDAM::Type::QueryFormat::VALID_VALUES.include?(@format) - raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field format!') - end - end - - ::Thrift::Struct.generate_accessors self - end - - # An advertisement that may be displayed within an Evernote client. - # Advertisements are either a snippet of HTML or else they - # are an image (of type: JPEG, GIF, PNG) with an associated destination URL. - # - # <dl> - # <dt>id</dt> - # <dd>The unique identifier of this advertisement within Evernote's ad - # inventory. - # </dd> - # - # <dt>width</dt> - # <dd>This ad should be displayed within a rectangle that is this wide, - # in pixels. - # </dd> - # - # <dt>height</dt> - # <dd>This ad should be displayed within a rectangle that is this high, - # in pixels. - # </dd> - # - # <dt>advertiserName</dt> - # <dd>A string containing a readable version of the name of this advertiser. - # </dd> - # - # <dt>imageUrl</dt> - # <dd>The location of the image to display for this ad.</dd> - # - # <dt>destinationUrl</dt> - # <dd>When a user clicks on the ad, this is the destination they should be - # sent to in a browser.</dd> - # - # <dt>displaySeconds</dt> - # <dd>The number of seconds that the ad should be displayed before it is - # replaced with a different ad.</dd> - # - # <dt>score</dt> - # <dd>A numeric indicator of the relative value of this ad, which can be - # compared against other ads from the same day. - # </dd> - # - # <dt>image</dt> - # <dd>If present, this is the raw image bits of the image file to display - # for the ad. If not present, the imageUrl should be retrieved directly. - # </dd> - # - # <dt>imageMime</dt> - # <dd>The MIME type of the 'image' bytes, if those are set.</dd> - # - # <dt>html</dt> - # <dd>The exact HTML to display for this ad, to support rich or external - # advertisements.</dd> - # - # <dt>displayFrequency</dt> - # <dd>If this value is set, this is the relatively frequency that this - # ad should be displayed in the daily set of ads, relative to a base - # frequency of 1.0. I.e. an ad with a frequency of 3.0 should be displayed - # three times more frequently than an ad with a frequency of 1.0.</dd> - # - # <dt>openInTrunk</dt> - # <dd>If true, the ad should be opened in the embedded Trunk window by - # clients with Trunk support.</dd> - # </dl> - class Ad - include ::Thrift::Struct, ::Thrift::Struct_Union - ID = 1 - WIDTH = 2 - HEIGHT = 3 - ADVERTISERNAME = 4 - IMAGEURL = 5 - DESTINATIONURL = 6 - DISPLAYSECONDS = 7 - SCORE = 8 - IMAGE = 9 - IMAGEMIME = 10 - HTML = 11 - DISPLAYFREQUENCY = 12 - OPENINTRUNK = 13 - - FIELDS = { - ID => {:type => ::Thrift::Types::I32, :name => 'id', :optional => true}, - WIDTH => {:type => ::Thrift::Types::I16, :name => 'width', :optional => true}, - HEIGHT => {:type => ::Thrift::Types::I16, :name => 'height', :optional => true}, - ADVERTISERNAME => {:type => ::Thrift::Types::STRING, :name => 'advertiserName', :optional => true}, - IMAGEURL => {:type => ::Thrift::Types::STRING, :name => 'imageUrl', :optional => true}, - DESTINATIONURL => {:type => ::Thrift::Types::STRING, :name => 'destinationUrl', :optional => true}, - DISPLAYSECONDS => {:type => ::Thrift::Types::I16, :name => 'displaySeconds', :optional => true}, - SCORE => {:type => ::Thrift::Types::DOUBLE, :name => 'score', :optional => true}, - IMAGE => {:type => ::Thrift::Types::STRING, :name => 'image', :binary => true, :optional => true}, - IMAGEMIME => {:type => ::Thrift::Types::STRING, :name => 'imageMime', :optional => true}, - HTML => {:type => ::Thrift::Types::STRING, :name => 'html', :optional => true}, - DISPLAYFREQUENCY => {:type => ::Thrift::Types::DOUBLE, :name => 'displayFrequency', :optional => true}, - OPENINTRUNK => {:type => ::Thrift::Types::BOOL, :name => 'openInTrunk', :optional => true} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - # Shared notebooks represent a relationship between a notebook and a single - # share invitation recipient. - # <dl> - # <dt>id</dt> - # <dd>the primary identifier of the share</dd> - # - # <dt>userId</dt> - # <dd>the user id of the owner of the notebook</dd> - # - # <dt>notebookGuid</dt> - # <dd>the GUID of the associated notebook shared.</dd> - # - # <dt>email</dt> - # <dd>the email address of the recipient - used by the notebook - # owner to identify who they shared with.</dd> - # - # <dt>notebookModifiable</dt> - # <dd>a flag indicating the share is read/write -otherwise it's read only</dd> - # - # <dt>requireLogin</dt> - # <dd>indicates that a user must login to access the share</dd> - # - # <dt>serviceCreated</dt> - # <dd>the date the owner first created the share with the specific email - # address</dd> - # - # <dt>serviceUpdated</dt> - # <dd>the date the shared notebook was last updated on the service. This - # will be updated when authenticateToSharedNotebook is called the first - # time with a shared notebook requiring login (i.e. when the username is - # bound to that shared notebook).</dd> - # - # <dt>username</dt> - # <dd>the username of the user who can access this share. - # Once it's assigned it cannot be changed.</dd> - # </dl> - class SharedNotebook - include ::Thrift::Struct, ::Thrift::Struct_Union - ID = 1 - USERID = 2 - NOTEBOOKGUID = 3 - EMAIL = 4 - NOTEBOOKMODIFIABLE = 5 - REQUIRELOGIN = 6 - SERVICECREATED = 7 - SERVICEUPDATED = 10 - SHAREKEY = 8 - USERNAME = 9 - - FIELDS = { - ID => {:type => ::Thrift::Types::I64, :name => 'id', :optional => true}, - USERID => {:type => ::Thrift::Types::I32, :name => 'userId', :optional => true}, - NOTEBOOKGUID => {:type => ::Thrift::Types::STRING, :name => 'notebookGuid', :optional => true}, - EMAIL => {:type => ::Thrift::Types::STRING, :name => 'email', :optional => true}, - NOTEBOOKMODIFIABLE => {:type => ::Thrift::Types::BOOL, :name => 'notebookModifiable', :optional => true}, - REQUIRELOGIN => {:type => ::Thrift::Types::BOOL, :name => 'requireLogin', :optional => true}, - SERVICECREATED => {:type => ::Thrift::Types::I64, :name => 'serviceCreated', :optional => true}, - SERVICEUPDATED => {:type => ::Thrift::Types::I64, :name => 'serviceUpdated', :optional => true}, - SHAREKEY => {:type => ::Thrift::Types::STRING, :name => 'shareKey', :optional => true}, - USERNAME => {:type => ::Thrift::Types::STRING, :name => 'username', :optional => true} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - # A unique container for a set of notes. - # <dl> - # <dt>guid</dt> - # <dd>The unique identifier of this notebook. - # <br/> - # Length: EDAM_GUID_LEN_MIN - EDAM_GUID_LEN_MAX - # <br/> - # Regex: EDAM_GUID_REGEX - # </dd> - # - # <dt>name</dt> - # <dd>A sequence of characters representing the name of the - # notebook. May be changed by clients, but the account may not contain two - # notebooks with names that are equal via a case-insensitive comparison. - # Can't begin or end with a space. - # <br/> - # Length: EDAM_NOTEBOOK_NAME_LEN_MIN - EDAM_NOTEBOOK_NAME_LEN_MAX - # <br/> - # Regex: EDAM_NOTEBOOK_NAME_REGEX - # </dd> - # - # <dt>updateSequenceNum</dt> - # <dd>A number identifying the last transaction to - # modify the state of this object. The USN values are sequential within an - # account, and can be used to compare the order of modifications within the - # service. - # </dd> - # - # <dt>defaultNotebook</dt> - # <dd>If true, this notebook should be used for new notes - # whenever the user has not (or cannot) specify a desired target notebook. - # For example, if a note is submitted via SMTP email. - # The service will maintain at most one defaultNotebook per account. - # If a second notebook is created or updated with defaultNotebook set to - # true, the service will automatically update the prior notebook's - # defaultNotebook field to false. If the default notebook is deleted - # (i.e. "active" set to false), the "defaultNotebook" field will be - # set to false by the service. If the account has no default notebook - # set, the service will use the most recent notebook as the default. - # </dd> - # - # <dt>serviceCreated</dt> - # <dd>The time when this notebook was created on the - # service. This will be set on the service during creation, and the service - # will provide this value when it returns a Notebook to a client. - # The service will ignore this value if it is sent by clients. - # </dd> - # - # <dt>serviceUpdated</dt> - # <dd>The time when this notebook was last modified on the - # service. This will be set on the service during creation, and the service - # will provide this value when it returns a Notebook to a client. - # The service will ignore this value if it is sent by clients. - # </dd> - # - # <dt>publishing</dt> - # <dd>If the Notebook has been opened for public access (i.e. - # if 'published' is set to true), then this will point to the set of - # publishing information for the Notebook (URI, description, etc.). A - # Notebook cannot be published without providing this information, but it - # will persist for later use if publishing is ever disabled on the Notebook. - # Clients that do not wish to change the publishing behavior of a Notebook - # should not set this value when calling NoteStore.updateNotebook(). - # </dd> - # - # <dt>published</dt> - # <dd>If this is set to true, then the Notebook will be - # accessible to the public via the 'publishing' specification, which must - # also be set. If this is set to false, the Notebook will not be available - # to the public. - # Clients that do not wish to change the publishing behavior of a Notebook - # should not set this value when calling NoteStore.updateNotebook(). - # </dd> - # - # <dt>stack</dt> - # <dd>If this is set, then the notebook is visually contained within a stack - # of notebooks with this name. All notebooks in the same account with the - # same 'stack' field are considered to be in the same stack. - # Notebooks with no stack set are "top level" and not contained within a - # stack. - # </dd> - # - # <dt>sharedNotebookIds</dt> - # <dd><i>DEPRECATED</i> - replaced by sharedNotebooks.</dd> - # - # <dt>sharedNotebooks</dt> - # <dd>The list of recipients to whom this notebook has been shared - # (one SharedNotebook object per recipient email address). This field will - # be unset if you do not have permission to access this data. If you are - # accessing the notebook as the owner or via a shared notebook that is - # modifiable, then you have access to this data and the value will be set. - # This field is read-only. Clients may not make changes to shared notebooks - # via this field. - # </dd> - # - # </dl> - class Notebook - include ::Thrift::Struct, ::Thrift::Struct_Union - GUID = 1 - NAME = 2 - UPDATESEQUENCENUM = 5 - DEFAULTNOTEBOOK = 6 - SERVICECREATED = 7 - SERVICEUPDATED = 8 - PUBLISHING = 10 - PUBLISHED = 11 - STACK = 12 - SHAREDNOTEBOOKIDS = 13 - SHAREDNOTEBOOKS = 14 - - FIELDS = { - GUID => {:type => ::Thrift::Types::STRING, :name => 'guid', :optional => true}, - NAME => {:type => ::Thrift::Types::STRING, :name => 'name', :optional => true}, - UPDATESEQUENCENUM => {:type => ::Thrift::Types::I32, :name => 'updateSequenceNum', :optional => true}, - DEFAULTNOTEBOOK => {:type => ::Thrift::Types::BOOL, :name => 'defaultNotebook', :optional => true}, - SERVICECREATED => {:type => ::Thrift::Types::I64, :name => 'serviceCreated', :optional => true}, - SERVICEUPDATED => {:type => ::Thrift::Types::I64, :name => 'serviceUpdated', :optional => true}, - PUBLISHING => {:type => ::Thrift::Types::STRUCT, :name => 'publishing', :class => Evernote::EDAM::Type::Publishing, :optional => true}, - PUBLISHED => {:type => ::Thrift::Types::BOOL, :name => 'published', :optional => true}, - STACK => {:type => ::Thrift::Types::STRING, :name => 'stack', :optional => true}, - SHAREDNOTEBOOKIDS => {:type => ::Thrift::Types::LIST, :name => 'sharedNotebookIds', :element => {:type => ::Thrift::Types::I64}, :optional => true}, - SHAREDNOTEBOOKS => {:type => ::Thrift::Types::LIST, :name => 'sharedNotebooks', :element => {:type => ::Thrift::Types::STRUCT, :class => Evernote::EDAM::Type::SharedNotebook}, :optional => true} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - # A link in an users account that refers them to a public or individual share in - # another user's account. - # - # <dl> - # <dt>shareName</dt> - # <dd>the display name of the shared notebook. - # The link owner can change this.</dd> - # - # <dt>username</dt> - # <dd>the username of the user who owns the shared or public notebook</dd> - # - # <dt>shardId</dt> - # <dd>the shard ID of the notebook if the notebook is not public</dt> - # - # <dt>shareKey</dt> - # <dd>the secret key that provides access to the shared notebook</dd> - # - # <dt>uri</dt> - # <dd>the identifier of the public notebook</dd> - # - # <dt>guid</dt> - # <dd>The unique identifier of this linked notebook. Will be set whenever - # a resource is retrieved from the service, but may be null when a client - # is creating a resource. - # <br/> - # Length: EDAM_GUID_LEN_MIN - EDAM_GUID_LEN_MAX - # <br/> - # Regex: EDAM_GUID_REGEX - # </dd> - # - # <dt>updateSequenceNum</dt> - # <dd>A number identifying the last transaction to - # modify the state of this object. The USN values are sequential within an - # account, and can be used to compare the order of modifications within the - # service. - # </dd> - # - # <dt>noteStoreUrl</dt> - # <dd> - # This field will contain the full URL that clients should use to make - # NoteStore requests to the server shard that contains that notebook's data. - # I.e. this is the URL that should be used to create the Thrift HTTP client - # transport to send messages to the NoteStore service for the account. - # </dd> - # - # <dt>webApiUrlPrefix:</dt> - # <dd> - # This field will contain the initial part of the URLs that should be used - # to make requests to Evernote's thin client "web API", which provide - # optimized operations for clients that aren't capable of manipulating - # the full contents of accounts via the full Thrift data model. Clients - # should concatenate the relative path for the various servlets onto the - # end of this string to construct the full URL, as documented on our - # developer web site. - # </dd> - # </dl> - class LinkedNotebook - include ::Thrift::Struct, ::Thrift::Struct_Union - SHARENAME = 2 - USERNAME = 3 - SHARDID = 4 - SHAREKEY = 5 - URI = 6 - GUID = 7 - UPDATESEQUENCENUM = 8 - NOTESTOREURL = 9 - WEBAPIURLPREFIX = 10 - - FIELDS = { - SHARENAME => {:type => ::Thrift::Types::STRING, :name => 'shareName', :optional => true}, - USERNAME => {:type => ::Thrift::Types::STRING, :name => 'username', :optional => true}, - SHARDID => {:type => ::Thrift::Types::STRING, :name => 'shardId', :optional => true}, - SHAREKEY => {:type => ::Thrift::Types::STRING, :name => 'shareKey', :optional => true}, - URI => {:type => ::Thrift::Types::STRING, :name => 'uri', :optional => true}, - GUID => {:type => ::Thrift::Types::STRING, :name => 'guid', :optional => true}, - UPDATESEQUENCENUM => {:type => ::Thrift::Types::I32, :name => 'updateSequenceNum', :optional => true}, - NOTESTOREURL => {:type => ::Thrift::Types::STRING, :name => 'noteStoreUrl', :optional => true}, - WEBAPIURLPREFIX => {:type => ::Thrift::Types::STRING, :name => 'webApiUrlPrefix', :optional => true} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - end - end - end diff --git a/vendor/gen-rb/evernote/edam/user_store.rb b/vendor/gen-rb/evernote/edam/user_store.rb deleted file mode 100644 index 0262626..0000000 --- a/vendor/gen-rb/evernote/edam/user_store.rb +++ /dev/null @@ -1,549 +0,0 @@ -# -# Autogenerated by Thrift Compiler (0.8.0) -# -# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING -# - -require 'thrift' -require 'user_store_types' - - module Evernote - module EDAM - module UserStore - module UserStore - class Client - include ::Thrift::Client - - def checkVersion(clientName, edamVersionMajor, edamVersionMinor) - send_checkVersion(clientName, edamVersionMajor, edamVersionMinor) - return recv_checkVersion() - end - - def send_checkVersion(clientName, edamVersionMajor, edamVersionMinor) - send_message('checkVersion', CheckVersion_args, :clientName => clientName, :edamVersionMajor => edamVersionMajor, :edamVersionMinor => edamVersionMinor) - end - - def recv_checkVersion() - result = receive_message(CheckVersion_result) - return result.success unless result.success.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'checkVersion failed: unknown result') - end - - def getBootstrapInfo(locale) - send_getBootstrapInfo(locale) - return recv_getBootstrapInfo() - end - - def send_getBootstrapInfo(locale) - send_message('getBootstrapInfo', GetBootstrapInfo_args, :locale => locale) - end - - def recv_getBootstrapInfo() - result = receive_message(GetBootstrapInfo_result) - return result.success unless result.success.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getBootstrapInfo failed: unknown result') - end - - def authenticate(username, password, consumerKey, consumerSecret) - send_authenticate(username, password, consumerKey, consumerSecret) - return recv_authenticate() - end - - def send_authenticate(username, password, consumerKey, consumerSecret) - send_message('authenticate', Authenticate_args, :username => username, :password => password, :consumerKey => consumerKey, :consumerSecret => consumerSecret) - end - - def recv_authenticate() - result = receive_message(Authenticate_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'authenticate failed: unknown result') - end - - def refreshAuthentication(authenticationToken) - send_refreshAuthentication(authenticationToken) - return recv_refreshAuthentication() - end - - def send_refreshAuthentication(authenticationToken) - send_message('refreshAuthentication', RefreshAuthentication_args, :authenticationToken => authenticationToken) - end - - def recv_refreshAuthentication() - result = receive_message(RefreshAuthentication_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'refreshAuthentication failed: unknown result') - end - - def getUser(authenticationToken) - send_getUser(authenticationToken) - return recv_getUser() - end - - def send_getUser(authenticationToken) - send_message('getUser', GetUser_args, :authenticationToken => authenticationToken) - end - - def recv_getUser() - result = receive_message(GetUser_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getUser failed: unknown result') - end - - def getPublicUserInfo(username) - send_getPublicUserInfo(username) - return recv_getPublicUserInfo() - end - - def send_getPublicUserInfo(username) - send_message('getPublicUserInfo', GetPublicUserInfo_args, :username => username) - end - - def recv_getPublicUserInfo() - result = receive_message(GetPublicUserInfo_result) - return result.success unless result.success.nil? - raise result.notFoundException unless result.notFoundException.nil? - raise result.systemException unless result.systemException.nil? - raise result.userException unless result.userException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getPublicUserInfo failed: unknown result') - end - - def getPremiumInfo(authenticationToken) - send_getPremiumInfo(authenticationToken) - return recv_getPremiumInfo() - end - - def send_getPremiumInfo(authenticationToken) - send_message('getPremiumInfo', GetPremiumInfo_args, :authenticationToken => authenticationToken) - end - - def recv_getPremiumInfo() - result = receive_message(GetPremiumInfo_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getPremiumInfo failed: unknown result') - end - - def getNoteStoreUrl(authenticationToken) - send_getNoteStoreUrl(authenticationToken) - return recv_getNoteStoreUrl() - end - - def send_getNoteStoreUrl(authenticationToken) - send_message('getNoteStoreUrl', GetNoteStoreUrl_args, :authenticationToken => authenticationToken) - end - - def recv_getNoteStoreUrl() - result = receive_message(GetNoteStoreUrl_result) - return result.success unless result.success.nil? - raise result.userException unless result.userException.nil? - raise result.systemException unless result.systemException.nil? - raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getNoteStoreUrl failed: unknown result') - end - - end - - class Processor - include ::Thrift::Processor - - def process_checkVersion(seqid, iprot, oprot) - args = read_args(iprot, CheckVersion_args) - result = CheckVersion_result.new() - result.success = @handler.checkVersion(args.clientName, args.edamVersionMajor, args.edamVersionMinor) - write_result(result, oprot, 'checkVersion', seqid) - end - - def process_getBootstrapInfo(seqid, iprot, oprot) - args = read_args(iprot, GetBootstrapInfo_args) - result = GetBootstrapInfo_result.new() - result.success = @handler.getBootstrapInfo(args.locale) - write_result(result, oprot, 'getBootstrapInfo', seqid) - end - - def process_authenticate(seqid, iprot, oprot) - args = read_args(iprot, Authenticate_args) - result = Authenticate_result.new() - begin - result.success = @handler.authenticate(args.username, args.password, args.consumerKey, args.consumerSecret) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - end - write_result(result, oprot, 'authenticate', seqid) - end - - def process_refreshAuthentication(seqid, iprot, oprot) - args = read_args(iprot, RefreshAuthentication_args) - result = RefreshAuthentication_result.new() - begin - result.success = @handler.refreshAuthentication(args.authenticationToken) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - end - write_result(result, oprot, 'refreshAuthentication', seqid) - end - - def process_getUser(seqid, iprot, oprot) - args = read_args(iprot, GetUser_args) - result = GetUser_result.new() - begin - result.success = @handler.getUser(args.authenticationToken) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - end - write_result(result, oprot, 'getUser', seqid) - end - - def process_getPublicUserInfo(seqid, iprot, oprot) - args = read_args(iprot, GetPublicUserInfo_args) - result = GetPublicUserInfo_result.new() - begin - result.success = @handler.getPublicUserInfo(args.username) - rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException - result.notFoundException = notFoundException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - end - write_result(result, oprot, 'getPublicUserInfo', seqid) - end - - def process_getPremiumInfo(seqid, iprot, oprot) - args = read_args(iprot, GetPremiumInfo_args) - result = GetPremiumInfo_result.new() - begin - result.success = @handler.getPremiumInfo(args.authenticationToken) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - end - write_result(result, oprot, 'getPremiumInfo', seqid) - end - - def process_getNoteStoreUrl(seqid, iprot, oprot) - args = read_args(iprot, GetNoteStoreUrl_args) - result = GetNoteStoreUrl_result.new() - begin - result.success = @handler.getNoteStoreUrl(args.authenticationToken) - rescue Evernote::EDAM::Error::EDAMUserException => userException - result.userException = userException - rescue Evernote::EDAM::Error::EDAMSystemException => systemException - result.systemException = systemException - end - write_result(result, oprot, 'getNoteStoreUrl', seqid) - end - - end - - # HELPER FUNCTIONS AND STRUCTURES - - class CheckVersion_args - include ::Thrift::Struct, ::Thrift::Struct_Union - CLIENTNAME = 1 - EDAMVERSIONMAJOR = 2 - EDAMVERSIONMINOR = 3 - - FIELDS = { - CLIENTNAME => {:type => ::Thrift::Types::STRING, :name => 'clientName'}, - EDAMVERSIONMAJOR => {:type => ::Thrift::Types::I16, :name => 'edamVersionMajor', :default => 1}, - EDAMVERSIONMINOR => {:type => ::Thrift::Types::I16, :name => 'edamVersionMinor', :default => 22} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class CheckVersion_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::BOOL, :name => 'success'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetBootstrapInfo_args - include ::Thrift::Struct, ::Thrift::Struct_Union - LOCALE = 1 - - FIELDS = { - LOCALE => {:type => ::Thrift::Types::STRING, :name => 'locale'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetBootstrapInfo_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => Evernote::EDAM::UserStore::BootstrapInfo} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class Authenticate_args - include ::Thrift::Struct, ::Thrift::Struct_Union - USERNAME = 1 - PASSWORD = 2 - CONSUMERKEY = 3 - CONSUMERSECRET = 4 - - FIELDS = { - USERNAME => {:type => ::Thrift::Types::STRING, :name => 'username'}, - PASSWORD => {:type => ::Thrift::Types::STRING, :name => 'password'}, - CONSUMERKEY => {:type => ::Thrift::Types::STRING, :name => 'consumerKey'}, - CONSUMERSECRET => {:type => ::Thrift::Types::STRING, :name => 'consumerSecret'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class Authenticate_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => Evernote::EDAM::UserStore::AuthenticationResult}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class RefreshAuthentication_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class RefreshAuthentication_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => Evernote::EDAM::UserStore::AuthenticationResult}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetUser_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetUser_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => Evernote::EDAM::Type::User}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetPublicUserInfo_args - include ::Thrift::Struct, ::Thrift::Struct_Union - USERNAME = 1 - - FIELDS = { - USERNAME => {:type => ::Thrift::Types::STRING, :name => 'username'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetPublicUserInfo_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - NOTFOUNDEXCEPTION = 1 - SYSTEMEXCEPTION = 2 - USEREXCEPTION = 3 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => Evernote::EDAM::UserStore::PublicUserInfo}, - NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetPremiumInfo_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetPremiumInfo_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => Evernote::EDAM::UserStore::PremiumInfo}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetNoteStoreUrl_args - include ::Thrift::Struct, ::Thrift::Struct_Union - AUTHENTICATIONTOKEN = 1 - - FIELDS = { - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - class GetNoteStoreUrl_result - include ::Thrift::Struct, ::Thrift::Struct_Union - SUCCESS = 0 - USEREXCEPTION = 1 - SYSTEMEXCEPTION = 2 - - FIELDS = { - SUCCESS => {:type => ::Thrift::Types::STRING, :name => 'success'}, - USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}, - SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException} - } - - def struct_fields; FIELDS; end - - def validate - end - - ::Thrift::Struct.generate_accessors self - end - - end - - end - end - end diff --git a/vendor/gen-rb/evernote/edam/user_store_constants.rb b/vendor/gen-rb/evernote/edam/user_store_constants.rb deleted file mode 100644 index 9ecdb3f..0000000 --- a/vendor/gen-rb/evernote/edam/user_store_constants.rb +++ /dev/null @@ -1,18 +0,0 @@ -# -# Autogenerated by Thrift Compiler (0.8.0) -# -# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING -# - -require 'user_store_types' - - module Evernote - module EDAM - module UserStore - EDAM_VERSION_MAJOR = 1 - - EDAM_VERSION_MINOR = 22 - - end - end -end diff --git a/vendor/gen-rb/evernote/edam/user_store_types.rb b/vendor/gen-rb/evernote/edam/user_store_types.rb deleted file mode 100644 index e04f692..0000000 --- a/vendor/gen-rb/evernote/edam/user_store_types.rb +++ /dev/null @@ -1,417 +0,0 @@ -# -# Autogenerated by Thrift Compiler (0.8.0) -# -# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING -# - -require 'types_types' -require 'errors_types' - - -module Evernote - module EDAM - module UserStore - module SponsoredGroupRole - GROUP_MEMBER = 1 - GROUP_ADMIN = 2 - GROUP_OWNER = 3 - VALUE_MAP = {1 => "GROUP_MEMBER", 2 => "GROUP_ADMIN", 3 => "GROUP_OWNER"} - VALID_VALUES = Set.new([GROUP_MEMBER, GROUP_ADMIN, GROUP_OWNER]).freeze - end - - # This structure is used to provide publicly-available user information - # about a particular account. - # <dl> - # <dt>userId:</dt> - # <dd> - # The unique numeric user identifier for the user account. - # </dd> - # <dt>shardId:</dt> - # <dd> - # The name of the virtual server that manages the state of - # this user. This value is used internally to determine which system should - # service requests about this user's data. - # </dd> - # <dt>privilege:</dt> - # <dd> - # The privilege level of the account, to determine whether - # this is a Premium or Free account. - # </dd> - # <dt>noteStoreUrl:</dt> - # <dd> - # This field will contain the full URL that clients should use to make - # NoteStore requests to the server shard that contains that user's data. - # I.e. this is the URL that should be used to create the Thrift HTTP client - # transport to send messages to the NoteStore service for the account. - # </dd> - # </dl> - class PublicUserInfo - include ::Thrift::Struct, ::Thrift::Struct_Union - USERID = 1 - SHARDID = 2 - PRIVILEGE = 3 - USERNAME = 4 - NOTESTOREURL = 5 - - FIELDS = { - USERID => {:type => ::Thrift::Types::I32, :name => 'userId'}, - SHARDID => {:type => ::Thrift::Types::STRING, :name => 'shardId'}, - PRIVILEGE => {:type => ::Thrift::Types::I32, :name => 'privilege', :optional => true, :enum_class => Evernote::EDAM::Type::PrivilegeLevel}, - USERNAME => {:type => ::Thrift::Types::STRING, :name => 'username', :optional => true}, - NOTESTOREURL => {:type => ::Thrift::Types::STRING, :name => 'noteStoreUrl', :optional => true} - } - - def struct_fields; FIELDS; end - - def validate - raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field userId is unset!') unless @userId - raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field shardId is unset!') unless @shardId - unless @privilege.nil? || Evernote::EDAM::Type::PrivilegeLevel::VALID_VALUES.include?(@privilege) - raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field privilege!') - end - end - - ::Thrift::Struct.generate_accessors self - end - - # This structure is used to provide information about a user's Premium account. - # <dl> - # <dt>currentTime:</dt> - # <dd> - # The server-side date and time when this data was generated. - # </dd> - # <dt>premium:</dt> - # <dd> - # True if the user's account is Premium. - # </dd> - # <dt>premiumRecurring</dt> - # <dd> - # True if the user's account is Premium and has a recurring payment method. - # </dd> - # <dt>premiumExpirationDate:</dt> - # <dd> - # The date when the user's Premium account expires, or the date when the - # user's account will be charged if it has a recurring payment method. - # </dd> - # <dt>premiumExtendable:</dt> - # <dd> - # True if the user is eligible for purchasing Premium account extensions. - # </dd> - # <dt>premiumPending:</dt> - # <dd> - # True if the user's Premium account is pending payment confirmation - # </dd> - # <dt>premiumCancellationPending:</dt> - # <dd> - # True if the user has requested that no further charges to be made; the - # Premium account will remain active until it expires. - # </dd> - # <dt>canPurchaseUploadAllowance:</dt> - # <dd> - # True if the user is eligible for purchasing additional upload allowance. - # </dd> - # <dt>sponsoredGroupName:</dt> - # <dd> - # The name of the sponsored group that the user is part of. - # </dd> - # <dt>sponsoredGroupRole:</dt> - # <dd> - # The role of the user within a sponsored group. - # </dd> - # <dt>businessName:</dt> - # <dd> - # The name of the business that the user is associated with. - # </dd> - # <dt>businessAdmin:</dt> - # <dd> - # True if the user is the administrator of the business. - # </dd> - # </dl> - class PremiumInfo - include ::Thrift::Struct, ::Thrift::Struct_Union - CURRENTTIME = 1 - PREMIUM = 2 - PREMIUMRECURRING = 3 - PREMIUMEXPIRATIONDATE = 4 - PREMIUMEXTENDABLE = 5 - PREMIUMPENDING = 6 - PREMIUMCANCELLATIONPENDING = 7 - CANPURCHASEUPLOADALLOWANCE = 8 - SPONSOREDGROUPNAME = 9 - SPONSOREDGROUPROLE = 10 - BUSINESSNAME = 11 - BUSINESSADMIN = 12 - - FIELDS = { - CURRENTTIME => {:type => ::Thrift::Types::I64, :name => 'currentTime'}, - PREMIUM => {:type => ::Thrift::Types::BOOL, :name => 'premium'}, - PREMIUMRECURRING => {:type => ::Thrift::Types::BOOL, :name => 'premiumRecurring'}, - PREMIUMEXPIRATIONDATE => {:type => ::Thrift::Types::I64, :name => 'premiumExpirationDate', :optional => true}, - PREMIUMEXTENDABLE => {:type => ::Thrift::Types::BOOL, :name => 'premiumExtendable'}, - PREMIUMPENDING => {:type => ::Thrift::Types::BOOL, :name => 'premiumPending'}, - PREMIUMCANCELLATIONPENDING => {:type => ::Thrift::Types::BOOL, :name => 'premiumCancellationPending'}, - CANPURCHASEUPLOADALLOWANCE => {:type => ::Thrift::Types::BOOL, :name => 'canPurchaseUploadAllowance'}, - SPONSOREDGROUPNAME => {:type => ::Thrift::Types::STRING, :name => 'sponsoredGroupName', :optional => true}, - SPONSOREDGROUPROLE => {:type => ::Thrift::Types::I32, :name => 'sponsoredGroupRole', :optional => true, :enum_class => Evernote::EDAM::UserStore::SponsoredGroupRole}, - BUSINESSNAME => {:type => ::Thrift::Types::STRING, :name => 'businessName', :optional => true}, - BUSINESSADMIN => {:type => ::Thrift::Types::BOOL, :name => 'businessAdmin', :optional => true} - } - - def struct_fields; FIELDS; end - - def validate - raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field currentTime is unset!') unless @currentTime - raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field premium is unset!') if @premium.nil? - raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field premiumRecurring is unset!') if @premiumRecurring.nil? - raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field premiumExtendable is unset!') if @premiumExtendable.nil? - raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field premiumPending is unset!') if @premiumPending.nil? - raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field premiumCancellationPending is unset!') if @premiumCancellationPending.nil? - raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field canPurchaseUploadAllowance is unset!') if @canPurchaseUploadAllowance.nil? - unless @sponsoredGroupRole.nil? || Evernote::EDAM::UserStore::SponsoredGroupRole::VALID_VALUES.include?(@sponsoredGroupRole) - raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field sponsoredGroupRole!') - end - end - - ::Thrift::Struct.generate_accessors self - end - - # When an authentication (or re-authentication) is performed, this structure - # provides the result to the client. - # <dl> - # <dt>currentTime:</dt> - # <dd> - # The server-side date and time when this result was - # generated. - # </dd> - # <dt>authenticationToken:</dt> - # <dd> - # Holds an opaque, ASCII-encoded token that can be - # used by the client to perform actions on a NoteStore. - # </dd> - # <dt>expiration:</dt> - # <dd> - # Holds the server-side date and time when the - # authentication token will expire. - # This time can be compared to "currentTime" to produce an expiration - # time that can be reconciled with the client's local clock. - # </dd> - # <dt>user:</dt> - # <dd> - # Holds the information about the account which was - # authenticated if this was a full authentication. May be absent if this - # particular authentication did not require user information. - # </dd> - # <dt>publicUserInfo:</dt> - # <dd> - # If this authentication result was achieved without full permissions to - # access the full User structure, this field may be set to give back - # a more limited public set of data. - # </dd> - # <dt>noteStoreUrl:</dt> - # <dd> - # This field will contain the full URL that clients should use to make - # NoteStore requests to the server shard that contains that user's data. - # I.e. this is the URL that should be used to create the Thrift HTTP client - # transport to send messages to the NoteStore service for the account. - # </dd> - # <dt>webApiUrlPrefix:</dt> - # <dd> - # This field will contain the initial part of the URLs that should be used - # to make requests to Evernote's thin client "web API", which provide - # optimized operations for clients that aren't capable of manipulating - # the full contents of accounts via the full Thrift data model. Clients - # should concatenate the relative path for the various servlets onto the - # end of this string to construct the full URL, as documented on our - # developer web site. - # </dd> - # </dl> - class AuthenticationResult - include ::Thrift::Struct, ::Thrift::Struct_Union - CURRENTTIME = 1 - AUTHENTICATIONTOKEN = 2 - EXPIRATION = 3 - USER = 4 - PUBLICUSERINFO = 5 - NOTESTOREURL = 6 - WEBAPIURLPREFIX = 7 - - FIELDS = { - CURRENTTIME => {:type => ::Thrift::Types::I64, :name => 'currentTime'}, - AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}, - EXPIRATION => {:type => ::Thrift::Types::I64, :name => 'expiration'}, - USER => {:type => ::Thrift::Types::STRUCT, :name => 'user', :class => Evernote::EDAM::Type::User, :optional => true}, - PUBLICUSERINFO => {:type => ::Thrift::Types::STRUCT, :name => 'publicUserInfo', :class => Evernote::EDAM::UserStore::PublicUserInfo, :optional => true}, - NOTESTOREURL => {:type => ::Thrift::Types::STRING, :name => 'noteStoreUrl', :optional => true}, - WEBAPIURLPREFIX => {:type => ::Thrift::Types::STRING, :name => 'webApiUrlPrefix', :optional => true} - } - - def struct_fields; FIELDS; end - - def validate - raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field currentTime is unset!') unless @currentTime - raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field authenticationToken is unset!') unless @authenticationToken - raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field expiration is unset!') unless @expiration - end - - ::Thrift::Struct.generate_accessors self - end - - # This structure describes a collection of bootstrap settings. - # <dl> - # <dt>serviceHost:</dt> - # <dd> - # The hostname and optional port for composing Evernote web service URLs. - # This URL can be used to access the UserStore and related services, - # but must not be used to compose the NoteStore URL. Client applications - # must handle serviceHost values that include only the hostname - # (e.g. www.evernote.com) or both the hostname and port (e.g. www.evernote.com:8080). - # If no port is specified, or if port 443 is specified, client applications must - # use the scheme "https" when composing URLs. Otherwise, a client must use the - # scheme "http". - # </dd> - # <dt>marketingUrl:</dt> - # <dd> - # The URL stem for the Evernote corporate marketing website, e.g. http://www.evernote.com. - # This stem can be used to compose website URLs. For example, the URL of the Evernote - # Trunk is composed by appending "/about/trunk/" to the value of marketingUrl. - # </dd> - # <dt>supportUrl:</dt> - # <dd> - # The full URL for the Evernote customer support website, e.g. https://support.evernote.com. - # </dd> - # <dt>accountEmailDomain:</dt> - # <dd> - # The domain used for an Evernote user's incoming email address, which allows notes to - # be emailed into an account. E.g. m.evernote.com. - # </dd> - # <dt>enableFacebookSharing:</dt> - # <dd> - # Whether the client application should enable sharing of notes on Facebook. - # </dd> - # <dt>enableGiftSubscriptions:</dt> - # <dd> - # Whether the client application should enable gift subscriptions. - # </dd> - # <dt>enableSupportTickets:</dt> - # <dd> - # Whether the client application should enable in-client creation of support tickets. - # </dd> - # <dt>enableSharedNotebooks:</dt> - # <dd> - # Whether the client application should enable shared notebooks. - # </dd> - # <dt>enableSingleNoteSharing:</dt> - # <dd> - # Whether the client application should enable single note sharing. - # </dd> - # <dt>enableSponsoredAccounts:</dt> - # <dd> - # Whether the client application should enable sponsored accounts. - # </dd> - # <dt>enableTwitterSharing:</dt> - # <dd> - # Whether the client application should enable sharing of notes on Twitter. - # </dd> - # </dl> - class BootstrapSettings - include ::Thrift::Struct, ::Thrift::Struct_Union - SERVICEHOST = 1 - MARKETINGURL = 2 - SUPPORTURL = 3 - ACCOUNTEMAILDOMAIN = 4 - ENABLEFACEBOOKSHARING = 5 - ENABLEGIFTSUBSCRIPTIONS = 6 - ENABLESUPPORTTICKETS = 7 - ENABLESHAREDNOTEBOOKS = 8 - ENABLESINGLENOTESHARING = 9 - ENABLESPONSOREDACCOUNTS = 10 - ENABLETWITTERSHARING = 11 - ENABLELINKEDINSHARING = 12 - - FIELDS = { - SERVICEHOST => {:type => ::Thrift::Types::STRING, :name => 'serviceHost'}, - MARKETINGURL => {:type => ::Thrift::Types::STRING, :name => 'marketingUrl'}, - SUPPORTURL => {:type => ::Thrift::Types::STRING, :name => 'supportUrl'}, - ACCOUNTEMAILDOMAIN => {:type => ::Thrift::Types::STRING, :name => 'accountEmailDomain'}, - ENABLEFACEBOOKSHARING => {:type => ::Thrift::Types::BOOL, :name => 'enableFacebookSharing', :optional => true}, - ENABLEGIFTSUBSCRIPTIONS => {:type => ::Thrift::Types::BOOL, :name => 'enableGiftSubscriptions', :optional => true}, - ENABLESUPPORTTICKETS => {:type => ::Thrift::Types::BOOL, :name => 'enableSupportTickets', :optional => true}, - ENABLESHAREDNOTEBOOKS => {:type => ::Thrift::Types::BOOL, :name => 'enableSharedNotebooks', :optional => true}, - ENABLESINGLENOTESHARING => {:type => ::Thrift::Types::BOOL, :name => 'enableSingleNoteSharing', :optional => true}, - ENABLESPONSOREDACCOUNTS => {:type => ::Thrift::Types::BOOL, :name => 'enableSponsoredAccounts', :optional => true}, - ENABLETWITTERSHARING => {:type => ::Thrift::Types::BOOL, :name => 'enableTwitterSharing', :optional => true}, - ENABLELINKEDINSHARING => {:type => ::Thrift::Types::BOOL, :name => 'enableLinkedInSharing', :optional => true} - } - - def struct_fields; FIELDS; end - - def validate - raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field serviceHost is unset!') unless @serviceHost - raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field marketingUrl is unset!') unless @marketingUrl - raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field supportUrl is unset!') unless @supportUrl - raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field accountEmailDomain is unset!') unless @accountEmailDomain - end - - ::Thrift::Struct.generate_accessors self - end - - # This structure describes a collection of bootstrap settings. - # <dl> - # <dt>name:</dt> - # <dd> - # The unique name of the profile, which is guaranteed to remain consistent across - # calls to getBootstrapInfo. - # </dd> - # <dt>settings:</dt> - # <dd> - # The settings for this profile. - # </dd> - # </dl> - class BootstrapProfile - include ::Thrift::Struct, ::Thrift::Struct_Union - NAME = 1 - SETTINGS = 2 - - FIELDS = { - NAME => {:type => ::Thrift::Types::STRING, :name => 'name'}, - SETTINGS => {:type => ::Thrift::Types::STRUCT, :name => 'settings', :class => Evernote::EDAM::UserStore::BootstrapSettings} - } - - def struct_fields; FIELDS; end - - def validate - raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field name is unset!') unless @name - raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field settings is unset!') unless @settings - end - - ::Thrift::Struct.generate_accessors self - end - - # This structure describes a collection of bootstrap profiles. - # <dl> - # <dt>profiles:</dt> - # <dd> - # List of one or more bootstrap profiles, in descending - # preference order. - # </dd> - # </dl> - class BootstrapInfo - include ::Thrift::Struct, ::Thrift::Struct_Union - PROFILES = 1 - - FIELDS = { - PROFILES => {:type => ::Thrift::Types::LIST, :name => 'profiles', :element => {:type => ::Thrift::Types::STRUCT, :class => Evernote::EDAM::UserStore::BootstrapProfile}} - } - - def struct_fields; FIELDS; end - - def validate - raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field profiles is unset!') unless @profiles - end - - ::Thrift::Struct.generate_accessors self - end - - end - end - end diff --git a/vendor/thrift/client.rb b/vendor/thrift/client.rb deleted file mode 100644 index 5b30f01..0000000 --- a/vendor/thrift/client.rb +++ /dev/null @@ -1,62 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -module Thrift - module Client - def initialize(iprot, oprot=nil) - @iprot = iprot - @oprot = oprot || iprot - @seqid = 0 - end - - def send_message(name, args_class, args = {}) - @oprot.write_message_begin(name, MessageTypes::CALL, @seqid) - data = args_class.new - args.each do |k, v| - data.send("#{k.to_s}=", v) - end - begin - data.write(@oprot) - rescue StandardError => e - @oprot.trans.close - raise e - end - @oprot.write_message_end - @oprot.trans.flush - end - - def receive_message(result_klass) - fname, mtype, rseqid = @iprot.read_message_begin - handle_exception(mtype) - result = result_klass.new - result.read(@iprot) - @iprot.read_message_end - result - end - - def handle_exception(mtype) - if mtype == MessageTypes::EXCEPTION - x = ApplicationException.new - x.read(@iprot) - @iprot.read_message_end - raise x - end - end - end -end diff --git a/vendor/thrift/core_ext.rb b/vendor/thrift/core_ext.rb deleted file mode 100644 index f763cd5..0000000 --- a/vendor/thrift/core_ext.rb +++ /dev/null @@ -1,23 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -Dir[File.dirname(__FILE__) + "/core_ext/*.rb"].each do |file| - name = File.basename(file, '.rb') - require "thrift/core_ext/#{name}" -end diff --git a/vendor/thrift/core_ext/fixnum.rb b/vendor/thrift/core_ext/fixnum.rb deleted file mode 100644 index b4fc90d..0000000 --- a/vendor/thrift/core_ext/fixnum.rb +++ /dev/null @@ -1,29 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -# Versions of ruby pre 1.8.7 do not have an .ord method available in the Fixnum -# class. -# -if RUBY_VERSION < "1.8.7" - class Fixnum - def ord - self - end - end -end
\ No newline at end of file diff --git a/vendor/thrift/exceptions.rb b/vendor/thrift/exceptions.rb deleted file mode 100644 index 2ccc7ce..0000000 --- a/vendor/thrift/exceptions.rb +++ /dev/null @@ -1,84 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -module Thrift - class Exception < StandardError - def initialize(message) - super - @message = message - end - - attr_reader :message - end - - class ApplicationException < Exception - - UNKNOWN = 0 - UNKNOWN_METHOD = 1 - INVALID_MESSAGE_TYPE = 2 - WRONG_METHOD_NAME = 3 - BAD_SEQUENCE_ID = 4 - MISSING_RESULT = 5 - INTERNAL_ERROR = 6 - PROTOCOL_ERROR = 7 - - attr_reader :type - - def initialize(type=UNKNOWN, message=nil) - super(message) - @type = type - end - - def read(iprot) - iprot.read_struct_begin - while true - fname, ftype, fid = iprot.read_field_begin - if ftype == Types::STOP - break - end - if fid == 1 and ftype == Types::STRING - @message = iprot.read_string - elsif fid == 2 and ftype == Types::I32 - @type = iprot.read_i32 - else - iprot.skip(ftype) - end - iprot.read_field_end - end - iprot.read_struct_end - end - - def write(oprot) - oprot.write_struct_begin('Thrift::ApplicationException') - unless @message.nil? - oprot.write_field_begin('message', Types::STRING, 1) - oprot.write_string(@message) - oprot.write_field_end - end - unless @type.nil? - oprot.write_field_begin('type', Types::I32, 2) - oprot.write_i32(@type) - oprot.write_field_end - end - oprot.write_field_stop - oprot.write_struct_end - end - - end -end diff --git a/vendor/thrift/processor.rb b/vendor/thrift/processor.rb deleted file mode 100644 index 5d9e0a1..0000000 --- a/vendor/thrift/processor.rb +++ /dev/null @@ -1,57 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -module Thrift - module Processor - def initialize(handler) - @handler = handler - end - - def process(iprot, oprot) - name, type, seqid = iprot.read_message_begin - if respond_to?("process_#{name}") - send("process_#{name}", seqid, iprot, oprot) - true - else - iprot.skip(Types::STRUCT) - iprot.read_message_end - x = ApplicationException.new(ApplicationException::UNKNOWN_METHOD, 'Unknown function '+name) - oprot.write_message_begin(name, MessageTypes::EXCEPTION, seqid) - x.write(oprot) - oprot.write_message_end - oprot.trans.flush - false - end - end - - def read_args(iprot, args_class) - args = args_class.new - args.read(iprot) - iprot.read_message_end - args - end - - def write_result(result, oprot, name, seqid) - oprot.write_message_begin(name, MessageTypes::REPLY, seqid) - result.write(oprot) - oprot.write_message_end - oprot.trans.flush - end - end -end diff --git a/vendor/thrift/protocol/base_protocol.rb b/vendor/thrift/protocol/base_protocol.rb deleted file mode 100644 index b19909d..0000000 --- a/vendor/thrift/protocol/base_protocol.rb +++ /dev/null @@ -1,290 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -# this require is to make generated struct definitions happy -require 'set' - -module Thrift - class ProtocolException < Exception - - UNKNOWN = 0 - INVALID_DATA = 1 - NEGATIVE_SIZE = 2 - SIZE_LIMIT = 3 - BAD_VERSION = 4 - - attr_reader :type - - def initialize(type=UNKNOWN, message=nil) - super(message) - @type = type - end - end - - class BaseProtocol - - attr_reader :trans - - def initialize(trans) - @trans = trans - end - - def native? - puts "wrong method is being called!" - false - end - - def write_message_begin(name, type, seqid) - raise NotImplementedError - end - - def write_message_end; nil; end - - def write_struct_begin(name) - raise NotImplementedError - end - - def write_struct_end; nil; end - - def write_field_begin(name, type, id) - raise NotImplementedError - end - - def write_field_end; nil; end - - def write_field_stop - raise NotImplementedError - end - - def write_map_begin(ktype, vtype, size) - raise NotImplementedError - end - - def write_map_end; nil; end - - def write_list_begin(etype, size) - raise NotImplementedError - end - - def write_list_end; nil; end - - def write_set_begin(etype, size) - raise NotImplementedError - end - - def write_set_end; nil; end - - def write_bool(bool) - raise NotImplementedError - end - - def write_byte(byte) - raise NotImplementedError - end - - def write_i16(i16) - raise NotImplementedError - end - - def write_i32(i32) - raise NotImplementedError - end - - def write_i64(i64) - raise NotImplementedError - end - - def write_double(dub) - raise NotImplementedError - end - - def write_string(str) - raise NotImplementedError - end - - def read_message_begin - raise NotImplementedError - end - - def read_message_end; nil; end - - def read_struct_begin - raise NotImplementedError - end - - def read_struct_end; nil; end - - def read_field_begin - raise NotImplementedError - end - - def read_field_end; nil; end - - def read_map_begin - raise NotImplementedError - end - - def read_map_end; nil; end - - def read_list_begin - raise NotImplementedError - end - - def read_list_end; nil; end - - def read_set_begin - raise NotImplementedError - end - - def read_set_end; nil; end - - def read_bool - raise NotImplementedError - end - - def read_byte - raise NotImplementedError - end - - def read_i16 - raise NotImplementedError - end - - def read_i32 - raise NotImplementedError - end - - def read_i64 - raise NotImplementedError - end - - def read_double - raise NotImplementedError - end - - def read_string - raise NotImplementedError - end - - def write_field(name, type, fid, value) - write_field_begin(name, type, fid) - write_type(type, value) - write_field_end - end - - def write_type(type, value) - case type - when Types::BOOL - write_bool(value) - when Types::BYTE - write_byte(value) - when Types::DOUBLE - write_double(value) - when Types::I16 - write_i16(value) - when Types::I32 - write_i32(value) - when Types::I64 - write_i64(value) - when Types::STRING - write_string(value) - when Types::STRUCT - value.write(self) - else - raise NotImplementedError - end - end - - def read_type(type) - case type - when Types::BOOL - read_bool - when Types::BYTE - read_byte - when Types::DOUBLE - read_double - when Types::I16 - read_i16 - when Types::I32 - read_i32 - when Types::I64 - read_i64 - when Types::STRING - read_string - else - raise NotImplementedError - end - end - - def skip(type) - case type - when Types::STOP - nil - when Types::BOOL - read_bool - when Types::BYTE - read_byte - when Types::I16 - read_i16 - when Types::I32 - read_i32 - when Types::I64 - read_i64 - when Types::DOUBLE - read_double - when Types::STRING - read_string - when Types::STRUCT - read_struct_begin - while true - name, type, id = read_field_begin - break if type == Types::STOP - skip(type) - read_field_end - end - read_struct_end - when Types::MAP - ktype, vtype, size = read_map_begin - size.times do - skip(ktype) - skip(vtype) - end - read_map_end - when Types::SET - etype, size = read_set_begin - size.times do - skip(etype) - end - read_set_end - when Types::LIST - etype, size = read_list_begin - size.times do - skip(etype) - end - read_list_end - end - end - end - - class BaseProtocolFactory - def get_protocol(trans) - raise NotImplementedError - end - end -end
\ No newline at end of file diff --git a/vendor/thrift/protocol/binary_protocol.rb b/vendor/thrift/protocol/binary_protocol.rb deleted file mode 100644 index f9adb20..0000000 --- a/vendor/thrift/protocol/binary_protocol.rb +++ /dev/null @@ -1,229 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -module Thrift - class BinaryProtocol < BaseProtocol - VERSION_MASK = 0xffff0000 - VERSION_1 = 0x80010000 - TYPE_MASK = 0x000000ff - - attr_reader :strict_read, :strict_write - - def initialize(trans, strict_read=true, strict_write=true) - super(trans) - @strict_read = strict_read - @strict_write = strict_write - - # Pre-allocated read buffer for fixed-size read methods. Needs to be at least 8 bytes long for - # read_i64() and read_double(). - @rbuf = "\0" * 8 - @rbuf.force_encoding("BINARY") if @rbuf.respond_to?(:force_encoding) - end - - def write_message_begin(name, type, seqid) - # this is necessary because we added (needed) bounds checking to - # write_i32, and 0x80010000 is too big for that. - if strict_write - write_i16(VERSION_1 >> 16) - write_i16(type) - write_string(name) - write_i32(seqid) - else - write_string(name) - write_byte(type) - write_i32(seqid) - end - end - - def write_struct_begin(name); nil; end - - def write_field_begin(name, type, id) - write_byte(type) - write_i16(id) - end - - def write_field_stop - write_byte(Thrift::Types::STOP) - end - - def write_map_begin(ktype, vtype, size) - write_byte(ktype) - write_byte(vtype) - write_i32(size) - end - - def write_list_begin(etype, size) - write_byte(etype) - write_i32(size) - end - - def write_set_begin(etype, size) - write_byte(etype) - write_i32(size) - end - - def write_bool(bool) - write_byte(bool ? 1 : 0) - end - - def write_byte(byte) - raise RangeError if byte < -2**31 || byte >= 2**32 - trans.write([byte].pack('c')) - end - - def write_i16(i16) - trans.write([i16].pack('n')) - end - - def write_i32(i32) - raise RangeError if i32 < -2**31 || i32 >= 2**31 - trans.write([i32].pack('N')) - end - - def write_i64(i64) - raise RangeError if i64 < -2**63 || i64 >= 2**64 - hi = i64 >> 32 - lo = i64 & 0xffffffff - trans.write([hi, lo].pack('N2')) - end - - def write_double(dub) - trans.write([dub].pack('G')) - end - - def write_string(str) - write_i32(str.length) - trans.write(str) - end - - def read_message_begin - version = read_i32 - if version < 0 - if (version & VERSION_MASK != VERSION_1) - raise ProtocolException.new(ProtocolException::BAD_VERSION, 'Missing version identifier') - end - type = version & TYPE_MASK - name = read_string - seqid = read_i32 - [name, type, seqid] - else - if strict_read - raise ProtocolException.new(ProtocolException::BAD_VERSION, 'No version identifier, old protocol client?') - end - name = trans.read_all(version) - type = read_byte - seqid = read_i32 - [name, type, seqid] - end - end - - def read_struct_begin; nil; end - - def read_field_begin - type = read_byte - if (type == Types::STOP) - [nil, type, 0] - else - id = read_i16 - [nil, type, id] - end - end - - def read_map_begin - ktype = read_byte - vtype = read_byte - size = read_i32 - [ktype, vtype, size] - end - - def read_list_begin - etype = read_byte - size = read_i32 - [etype, size] - end - - def read_set_begin - etype = read_byte - size = read_i32 - [etype, size] - end - - def read_bool - byte = read_byte - byte != 0 - end - - def read_byte - val = trans.read_byte - if (val > 0x7f) - val = 0 - ((val - 1) ^ 0xff) - end - val - end - - def read_i16 - trans.read_into_buffer(@rbuf, 2) - val, = @rbuf.unpack('n') - if (val > 0x7fff) - val = 0 - ((val - 1) ^ 0xffff) - end - val - end - - def read_i32 - trans.read_into_buffer(@rbuf, 4) - val, = @rbuf.unpack('N') - if (val > 0x7fffffff) - val = 0 - ((val - 1) ^ 0xffffffff) - end - val - end - - def read_i64 - trans.read_into_buffer(@rbuf, 8) - hi, lo = @rbuf.unpack('N2') - if (hi > 0x7fffffff) - hi ^= 0xffffffff - lo ^= 0xffffffff - 0 - (hi << 32) - lo - 1 - else - (hi << 32) + lo - end - end - - def read_double - trans.read_into_buffer(@rbuf, 8) - val = @rbuf.unpack('G').first - val - end - - def read_string - sz = read_i32 - dat = trans.read_all(sz) - dat - end - - end - - class BinaryProtocolFactory < BaseProtocolFactory - def get_protocol(trans) - return Thrift::BinaryProtocol.new(trans) - end - end -end diff --git a/vendor/thrift/protocol/binary_protocol_accelerated.rb b/vendor/thrift/protocol/binary_protocol_accelerated.rb deleted file mode 100644 index 70ea652..0000000 --- a/vendor/thrift/protocol/binary_protocol_accelerated.rb +++ /dev/null @@ -1,39 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -=begin -The only change required for a transport to support BinaryProtocolAccelerated is to implement 2 methods: - * borrow(size), which takes an optional argument and returns atleast _size_ bytes from the transport, - or the default buffer size if no argument is given - * consume!(size), which removes size bytes from the front of the buffer - -See MemoryBuffer and BufferedTransport for examples. -=end - -module Thrift - class BinaryProtocolAcceleratedFactory < BaseProtocolFactory - def get_protocol(trans) - if (defined? BinaryProtocolAccelerated) - BinaryProtocolAccelerated.new(trans) - else - BinaryProtocol.new(trans) - end - end - end -end diff --git a/vendor/thrift/protocol/compact_protocol.rb b/vendor/thrift/protocol/compact_protocol.rb deleted file mode 100644 index ede82f2..0000000 --- a/vendor/thrift/protocol/compact_protocol.rb +++ /dev/null @@ -1,426 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -module Thrift - class CompactProtocol < BaseProtocol - - PROTOCOL_ID = [0x82].pack('c').unpack('c').first - VERSION = 1 - VERSION_MASK = 0x1f - TYPE_MASK = 0xE0 - TYPE_SHIFT_AMOUNT = 5 - - TSTOP = ["", Types::STOP, 0] - - # - # All of the on-wire type codes. - # - class CompactTypes - BOOLEAN_TRUE = 0x01 - BOOLEAN_FALSE = 0x02 - BYTE = 0x03 - I16 = 0x04 - I32 = 0x05 - I64 = 0x06 - DOUBLE = 0x07 - BINARY = 0x08 - LIST = 0x09 - SET = 0x0A - MAP = 0x0B - STRUCT = 0x0C - - def self.is_bool_type?(b) - (b & 0x0f) == BOOLEAN_TRUE || (b & 0x0f) == BOOLEAN_FALSE - end - - COMPACT_TO_TTYPE = { - Types::STOP => Types::STOP, - BOOLEAN_FALSE => Types::BOOL, - BOOLEAN_TRUE => Types::BOOL, - BYTE => Types::BYTE, - I16 => Types::I16, - I32 => Types::I32, - I64 => Types::I64, - DOUBLE => Types::DOUBLE, - BINARY => Types::STRING, - LIST => Types::LIST, - SET => Types::SET, - MAP => Types::MAP, - STRUCT => Types::STRUCT - } - - TTYPE_TO_COMPACT = { - Types::STOP => Types::STOP, - Types::BOOL => BOOLEAN_TRUE, - Types::BYTE => BYTE, - Types::I16 => I16, - Types::I32 => I32, - Types::I64 => I64, - Types::DOUBLE => DOUBLE, - Types::STRING => BINARY, - Types::LIST => LIST, - Types::SET => SET, - Types::MAP => MAP, - Types::STRUCT => STRUCT - } - - def self.get_ttype(compact_type) - val = COMPACT_TO_TTYPE[compact_type & 0x0f] - raise "don't know what type: #{compact_type & 0x0f}" unless val - val - end - - def self.get_compact_type(ttype) - val = TTYPE_TO_COMPACT[ttype] - raise "don't know what type: #{ttype & 0x0f}" unless val - val - end - end - - def initialize(transport) - super(transport) - - @last_field = [0] - @boolean_value = nil - - # Pre-allocated read buffer for read_double(). - @rbuf = "\0" * 8 - @rbuf.force_encoding("BINARY") if @rbuf.respond_to?(:force_encoding) - end - - def write_message_begin(name, type, seqid) - write_byte(PROTOCOL_ID) - write_byte((VERSION & VERSION_MASK) | ((type << TYPE_SHIFT_AMOUNT) & TYPE_MASK)) - write_varint32(seqid) - write_string(name) - nil - end - - def write_struct_begin(name) - @last_field.push(0) - nil - end - - def write_struct_end - @last_field.pop - nil - end - - def write_field_begin(name, type, id) - if type == Types::BOOL - # we want to possibly include the value, so we'll wait. - @boolean_field = [type, id] - else - write_field_begin_internal(type, id) - end - nil - end - - # - # The workhorse of writeFieldBegin. It has the option of doing a - # 'type override' of the type header. This is used specifically in the - # boolean field case. - # - def write_field_begin_internal(type, id, type_override=nil) - last_id = @last_field.pop - - # if there's a type override, use that. - typeToWrite = type_override || CompactTypes.get_compact_type(type) - - # check if we can use delta encoding for the field id - if id > last_id && id - last_id <= 15 - # write them together - write_byte((id - last_id) << 4 | typeToWrite) - else - # write them separate - write_byte(typeToWrite) - write_i16(id) - end - - @last_field.push(id) - nil - end - - def write_field_stop - write_byte(Types::STOP) - end - - def write_map_begin(ktype, vtype, size) - if (size == 0) - write_byte(0) - else - write_varint32(size) - write_byte(CompactTypes.get_compact_type(ktype) << 4 | CompactTypes.get_compact_type(vtype)) - end - end - - def write_list_begin(etype, size) - write_collection_begin(etype, size) - end - - def write_set_begin(etype, size) - write_collection_begin(etype, size); - end - - def write_bool(bool) - type = bool ? CompactTypes::BOOLEAN_TRUE : CompactTypes::BOOLEAN_FALSE - unless @boolean_field.nil? - # we haven't written the field header yet - write_field_begin_internal(@boolean_field.first, @boolean_field.last, type) - @boolean_field = nil - else - # we're not part of a field, so just write the value. - write_byte(type) - end - end - - def write_byte(byte) - @trans.write([byte].pack('c')) - end - - def write_i16(i16) - write_varint32(int_to_zig_zag(i16)) - end - - def write_i32(i32) - write_varint32(int_to_zig_zag(i32)) - end - - def write_i64(i64) - write_varint64(long_to_zig_zag(i64)) - end - - def write_double(dub) - @trans.write([dub].pack("G").reverse) - end - - def write_string(str) - write_varint32(str.length) - @trans.write(str) - end - - def read_message_begin - protocol_id = read_byte() - if protocol_id != PROTOCOL_ID - raise ProtocolException.new("Expected protocol id #{PROTOCOL_ID} but got #{protocol_id}") - end - - version_and_type = read_byte() - version = version_and_type & VERSION_MASK - if (version != VERSION) - raise ProtocolException.new("Expected version #{VERSION} but got #{version}"); - end - - type = (version_and_type >> TYPE_SHIFT_AMOUNT) & 0x03 - seqid = read_varint32() - messageName = read_string() - [messageName, type, seqid] - end - - def read_struct_begin - @last_field.push(0) - "" - end - - def read_struct_end - @last_field.pop() - nil - end - - def read_field_begin - type = read_byte() - - # if it's a stop, then we can return immediately, as the struct is over. - if (type & 0x0f) == Types::STOP - TSTOP - else - field_id = nil - - # mask off the 4 MSB of the type header. it could contain a field id delta. - modifier = (type & 0xf0) >> 4 - if modifier == 0 - # not a delta. look ahead for the zigzag varint field id. - @last_field.pop - field_id = read_i16() - else - # has a delta. add the delta to the last read field id. - field_id = @last_field.pop + modifier - end - - # if this happens to be a boolean field, the value is encoded in the type - if CompactTypes.is_bool_type?(type) - # save the boolean value in a special instance variable. - @bool_value = (type & 0x0f) == CompactTypes::BOOLEAN_TRUE - end - - # push the new field onto the field stack so we can keep the deltas going. - @last_field.push(field_id) - ["", CompactTypes.get_ttype(type & 0x0f), field_id] - end - end - - def read_map_begin - size = read_varint32() - key_and_value_type = size == 0 ? 0 : read_byte() - [CompactTypes.get_ttype(key_and_value_type >> 4), CompactTypes.get_ttype(key_and_value_type & 0xf), size] - end - - def read_list_begin - size_and_type = read_byte() - size = (size_and_type >> 4) & 0x0f - if size == 15 - size = read_varint32() - end - type = CompactTypes.get_ttype(size_and_type) - [type, size] - end - - def read_set_begin - read_list_begin - end - - def read_bool - unless @bool_value.nil? - bv = @bool_value - @bool_value = nil - bv - else - read_byte() == CompactTypes::BOOLEAN_TRUE - end - end - - def read_byte - val = trans.read_byte - if (val > 0x7f) - val = 0 - ((val - 1) ^ 0xff) - end - val - end - - def read_i16 - zig_zag_to_int(read_varint32()) - end - - def read_i32 - zig_zag_to_int(read_varint32()) - end - - def read_i64 - zig_zag_to_long(read_varint64()) - end - - def read_double - trans.read_into_buffer(@rbuf, 8) - val = @rbuf.reverse.unpack('G').first - val - end - - def read_string - size = read_varint32() - trans.read_all(size) - end - - - private - - # - # Abstract method for writing the start of lists and sets. List and sets on - # the wire differ only by the type indicator. - # - def write_collection_begin(elem_type, size) - if size <= 14 - write_byte(size << 4 | CompactTypes.get_compact_type(elem_type)) - else - write_byte(0xf0 | CompactTypes.get_compact_type(elem_type)) - write_varint32(size) - end - end - - def write_varint32(n) - # int idx = 0; - while true - if (n & ~0x7F) == 0 - # i32buf[idx++] = (byte)n; - write_byte(n) - break - # return; - else - # i32buf[idx++] = (byte)((n & 0x7F) | 0x80); - write_byte((n & 0x7F) | 0x80) - n = n >> 7 - end - end - # trans_.write(i32buf, 0, idx); - end - - SEVEN_BIT_MASK = 0x7F - EVERYTHING_ELSE_MASK = ~SEVEN_BIT_MASK - - def write_varint64(n) - while true - if (n & EVERYTHING_ELSE_MASK) == 0 #TODO need to find a way to make this into a long... - write_byte(n) - break - else - write_byte((n & SEVEN_BIT_MASK) | 0x80) - n >>= 7 - end - end - end - - def read_varint32() - read_varint64() - end - - def read_varint64() - shift = 0 - result = 0 - while true - b = read_byte() - result |= (b & 0x7f) << shift - break if (b & 0x80) != 0x80 - shift += 7 - end - result - end - - def int_to_zig_zag(n) - (n << 1) ^ (n >> 31) - end - - def long_to_zig_zag(l) - # puts "zz encoded #{l} to #{(l << 1) ^ (l >> 63)}" - (l << 1) ^ (l >> 63) - end - - def zig_zag_to_int(n) - (n >> 1) ^ -(n & 1) - end - - def zig_zag_to_long(n) - (n >> 1) ^ -(n & 1) - end - end - - class CompactProtocolFactory < BaseProtocolFactory - def get_protocol(trans) - CompactProtocol.new(trans) - end - end -end diff --git a/vendor/thrift/serializer/deserializer.rb b/vendor/thrift/serializer/deserializer.rb deleted file mode 100644 index d2ee325..0000000 --- a/vendor/thrift/serializer/deserializer.rb +++ /dev/null @@ -1,33 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -module Thrift - class Deserializer - def initialize(protocol_factory = BinaryProtocolFactory.new) - @transport = MemoryBufferTransport.new - @protocol = protocol_factory.get_protocol(@transport) - end - - def deserialize(base, buffer) - @transport.reset_buffer(buffer) - base.read(@protocol) - base - end - end -end
\ No newline at end of file diff --git a/vendor/thrift/serializer/serializer.rb b/vendor/thrift/serializer/serializer.rb deleted file mode 100644 index 2231639..0000000 --- a/vendor/thrift/serializer/serializer.rb +++ /dev/null @@ -1,34 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -module Thrift - class Serializer - def initialize(protocol_factory = BinaryProtocolFactory.new) - @transport = MemoryBufferTransport.new - @protocol = protocol_factory.get_protocol(@transport) - end - - def serialize(base) - @transport.reset_buffer - base.write(@protocol) - @transport.read(@transport.available) - end - end -end - diff --git a/vendor/thrift/server/base_server.rb b/vendor/thrift/server/base_server.rb deleted file mode 100644 index 1ee1213..0000000 --- a/vendor/thrift/server/base_server.rb +++ /dev/null @@ -1,31 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -module Thrift - class BaseServer - def initialize(processor, server_transport, transport_factory=nil, protocol_factory=nil) - @processor = processor - @server_transport = server_transport - @transport_factory = transport_factory ? transport_factory : Thrift::BaseTransportFactory.new - @protocol_factory = protocol_factory ? protocol_factory : Thrift::BinaryProtocolFactory.new - end - - def serve; nil; end - end -end
\ No newline at end of file diff --git a/vendor/thrift/server/mongrel_http_server.rb b/vendor/thrift/server/mongrel_http_server.rb deleted file mode 100644 index 84eacf0..0000000 --- a/vendor/thrift/server/mongrel_http_server.rb +++ /dev/null @@ -1,58 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -require 'mongrel' - -## Sticks a service on a URL, using mongrel to do the HTTP work -module Thrift - class MongrelHTTPServer < BaseServer - class Handler < Mongrel::HttpHandler - def initialize(processor, protocol_factory) - @processor = processor - @protocol_factory = protocol_factory - end - - def process(request, response) - if request.params["REQUEST_METHOD"] == "POST" - response.start(200) do |head, out| - head["Content-Type"] = "application/x-thrift" - transport = IOStreamTransport.new request.body, out - protocol = @protocol_factory.get_protocol transport - @processor.process protocol, protocol - end - else - response.start(404) { } - end - end - end - - def initialize(processor, opts={}) - port = opts[:port] || 80 - ip = opts[:ip] || "0.0.0.0" - path = opts[:path] || "" - protocol_factory = opts[:protocol_factory] || BinaryProtocolFactory.new - @server = Mongrel::HttpServer.new ip, port - @server.register "/#{path}", Handler.new(processor, protocol_factory) - end - - def serve - @server.run.join - end - end -end diff --git a/vendor/thrift/server/nonblocking_server.rb b/vendor/thrift/server/nonblocking_server.rb deleted file mode 100644 index 740f341..0000000 --- a/vendor/thrift/server/nonblocking_server.rb +++ /dev/null @@ -1,305 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -require 'logger' -require 'thread' - -module Thrift - # this class expects to always use a FramedTransport for reading messages - class NonblockingServer < BaseServer - def initialize(processor, server_transport, transport_factory=nil, protocol_factory=nil, num=20, logger=nil) - super(processor, server_transport, transport_factory, protocol_factory) - @num_threads = num - if logger.nil? - @logger = Logger.new(STDERR) - @logger.level = Logger::WARN - else - @logger = logger - end - @shutdown_semaphore = Mutex.new - @transport_semaphore = Mutex.new - end - - def serve - @logger.info "Starting #{self}" - @server_transport.listen - @io_manager = start_io_manager - - begin - loop do - break if @server_transport.closed? - begin - rd, = select([@server_transport], nil, nil, 0.1) - rescue Errno::EBADF => e - # In Ruby 1.9, calling @server_transport.close in shutdown paths causes the select() to raise an - # Errno::EBADF. If this happens, ignore it and retry the loop. - break - end - next if rd.nil? - socket = @server_transport.accept - @logger.debug "Accepted socket: #{socket.inspect}" - @io_manager.add_connection socket - end - rescue IOError => e - end - # we must be shutting down - @logger.info "#{self} is shutting down, goodbye" - ensure - @transport_semaphore.synchronize do - @server_transport.close - end - @io_manager.ensure_closed unless @io_manager.nil? - end - - def shutdown(timeout = 0, block = true) - @shutdown_semaphore.synchronize do - return if @is_shutdown - @is_shutdown = true - end - # nonblocking is intended for calling from within a Handler - # but we can't change the order of operations here, so lets thread - shutdown_proc = lambda do - @io_manager.shutdown(timeout) - @transport_semaphore.synchronize do - @server_transport.close # this will break the accept loop - end - end - if block - shutdown_proc.call - else - Thread.new &shutdown_proc - end - end - - private - - def start_io_manager - iom = IOManager.new(@processor, @server_transport, @transport_factory, @protocol_factory, @num_threads, @logger) - iom.spawn - iom - end - - class IOManager # :nodoc: - DEFAULT_BUFFER = 2**20 - - def initialize(processor, server_transport, transport_factory, protocol_factory, num, logger) - @processor = processor - @server_transport = server_transport - @transport_factory = transport_factory - @protocol_factory = protocol_factory - @num_threads = num - @logger = logger - @connections = [] - @buffers = Hash.new { |h,k| h[k] = '' } - @signal_queue = Queue.new - @signal_pipes = IO.pipe - @signal_pipes[1].sync = true - @worker_queue = Queue.new - @shutdown_queue = Queue.new - end - - def add_connection(socket) - signal [:connection, socket] - end - - def spawn - @iom_thread = Thread.new do - @logger.debug "Starting #{self}" - run - end - end - - def shutdown(timeout = 0) - @logger.debug "#{self} is shutting down workers" - @worker_queue.clear - @num_threads.times { @worker_queue.push [:shutdown] } - signal [:shutdown, timeout] - @shutdown_queue.pop - @signal_pipes[0].close - @signal_pipes[1].close - @logger.debug "#{self} is shutting down, goodbye" - end - - def ensure_closed - kill_worker_threads if @worker_threads - @iom_thread.kill - end - - private - - def run - spin_worker_threads - - loop do - rd, = select([@signal_pipes[0], *@connections]) - if rd.delete @signal_pipes[0] - break if read_signals == :shutdown - end - rd.each do |fd| - begin - if fd.handle.eof? - remove_connection fd - else - read_connection fd - end - rescue Errno::ECONNRESET - remove_connection fd - end - end - end - join_worker_threads(@shutdown_timeout) - ensure - @shutdown_queue.push :shutdown - end - - def read_connection(fd) - @buffers[fd] << fd.read(DEFAULT_BUFFER) - while(frame = slice_frame!(@buffers[fd])) - @logger.debug "#{self} is processing a frame" - @worker_queue.push [:frame, fd, frame] - end - end - - def spin_worker_threads - @logger.debug "#{self} is spinning up worker threads" - @worker_threads = [] - @num_threads.times do - @worker_threads << spin_thread - end - end - - def spin_thread - Worker.new(@processor, @transport_factory, @protocol_factory, @logger, @worker_queue).spawn - end - - def signal(msg) - @signal_queue << msg - @signal_pipes[1].write " " - end - - def read_signals - # clear the signal pipe - # note that since read_nonblock is broken in jruby, - # we can only read up to a set number of signals at once - sigstr = @signal_pipes[0].readpartial(1024) - # now read the signals - begin - sigstr.length.times do - signal, obj = @signal_queue.pop(true) - case signal - when :connection - @connections << obj - when :shutdown - @shutdown_timeout = obj - return :shutdown - end - end - rescue ThreadError - # out of signals - # note that in a perfect world this would never happen, since we're - # only reading the number of signals pushed on the pipe, but given the lack - # of locks, in theory we could clear the pipe/queue while a new signal is being - # placed on the pipe, at which point our next read_signals would hit this error - end - end - - def remove_connection(fd) - # don't explicitly close it, a thread may still be writing to it - @connections.delete fd - @buffers.delete fd - end - - def join_worker_threads(shutdown_timeout) - start = Time.now - @worker_threads.each do |t| - if shutdown_timeout > 0 - timeout = (start + shutdown_timeout) - Time.now - break if timeout <= 0 - t.join(timeout) - else - t.join - end - end - kill_worker_threads - end - - def kill_worker_threads - @worker_threads.each do |t| - t.kill if t.status - end - @worker_threads.clear - end - - def slice_frame!(buf) - if buf.length >= 4 - size = buf.unpack('N').first - if buf.length >= size + 4 - buf.slice!(0, size + 4) - else - nil - end - else - nil - end - end - - class Worker # :nodoc: - def initialize(processor, transport_factory, protocol_factory, logger, queue) - @processor = processor - @transport_factory = transport_factory - @protocol_factory = protocol_factory - @logger = logger - @queue = queue - end - - def spawn - Thread.new do - @logger.debug "#{self} is spawning" - run - end - end - - private - - def run - loop do - cmd, *args = @queue.pop - case cmd - when :shutdown - @logger.debug "#{self} is shutting down, goodbye" - break - when :frame - fd, frame = args - begin - otrans = @transport_factory.get_transport(fd) - oprot = @protocol_factory.get_protocol(otrans) - membuf = MemoryBufferTransport.new(frame) - itrans = @transport_factory.get_transport(membuf) - iprot = @protocol_factory.get_protocol(itrans) - @processor.process(iprot, oprot) - rescue => e - @logger.error "#{Thread.current.inspect} raised error: #{e.inspect}\n#{e.backtrace.join("\n")}" - end - end - end - end - end - end - end -end diff --git a/vendor/thrift/server/simple_server.rb b/vendor/thrift/server/simple_server.rb deleted file mode 100644 index 21e8659..0000000 --- a/vendor/thrift/server/simple_server.rb +++ /dev/null @@ -1,43 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -module Thrift - class SimpleServer < BaseServer - def serve - begin - @server_transport.listen - loop do - client = @server_transport.accept - trans = @transport_factory.get_transport(client) - prot = @protocol_factory.get_protocol(trans) - begin - loop do - @processor.process(prot, prot) - end - rescue Thrift::TransportException, Thrift::ProtocolException - ensure - trans.close - end - end - ensure - @server_transport.close - end - end - end -end
\ No newline at end of file diff --git a/vendor/thrift/server/thread_pool_server.rb b/vendor/thrift/server/thread_pool_server.rb deleted file mode 100644 index 8cec805..0000000 --- a/vendor/thrift/server/thread_pool_server.rb +++ /dev/null @@ -1,75 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -require 'thread' - -module Thrift - class ThreadPoolServer < BaseServer - def initialize(processor, server_transport, transport_factory=nil, protocol_factory=nil, num=20) - super(processor, server_transport, transport_factory, protocol_factory) - @thread_q = SizedQueue.new(num) - @exception_q = Queue.new - @running = false - end - - ## exceptions that happen in worker threads will be relayed here and - ## must be caught. 'retry' can be used to continue. (threads will - ## continue to run while the exception is being handled.) - def rescuable_serve - Thread.new { serve } unless @running - @running = true - raise @exception_q.pop - end - - ## exceptions that happen in worker threads simply cause that thread - ## to die and another to be spawned in its place. - def serve - @server_transport.listen - - begin - loop do - @thread_q.push(:token) - Thread.new do - begin - loop do - client = @server_transport.accept - trans = @transport_factory.get_transport(client) - prot = @protocol_factory.get_protocol(trans) - begin - loop do - @processor.process(prot, prot) - end - rescue Thrift::TransportException, Thrift::ProtocolException => e - ensure - trans.close - end - end - rescue => e - @exception_q.push(e) - ensure - @thread_q.pop # thread died! - end - end - end - ensure - @server_transport.close - end - end - end -end
\ No newline at end of file diff --git a/vendor/thrift/server/threaded_server.rb b/vendor/thrift/server/threaded_server.rb deleted file mode 100644 index a2c917c..0000000 --- a/vendor/thrift/server/threaded_server.rb +++ /dev/null @@ -1,47 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -require 'thread' - -module Thrift - class ThreadedServer < BaseServer - def serve - begin - @server_transport.listen - loop do - client = @server_transport.accept - trans = @transport_factory.get_transport(client) - prot = @protocol_factory.get_protocol(trans) - Thread.new(prot, trans) do |p, t| - begin - loop do - @processor.process(p, p) - end - rescue Thrift::TransportException, Thrift::ProtocolException - ensure - t.close - end - end - end - ensure - @server_transport.close - end - end - end -end
\ No newline at end of file diff --git a/vendor/thrift/struct.rb b/vendor/thrift/struct.rb deleted file mode 100644 index 3512463..0000000 --- a/vendor/thrift/struct.rb +++ /dev/null @@ -1,237 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -require 'set' - -module Thrift - module Struct - def initialize(d={}, &block) - # get a copy of the default values to work on, removing defaults in favor of arguments - fields_with_defaults = fields_with_default_values.dup - - # check if the defaults is empty, or if there are no parameters for this - # instantiation, and if so, don't bother overriding defaults. - unless fields_with_defaults.empty? || d.empty? - d.each_key do |name| - fields_with_defaults.delete(name.to_s) - end - end - - # assign all the user-specified arguments - unless d.empty? - d.each do |name, value| - unless name_to_id(name.to_s) - raise Exception, "Unknown key given to #{self.class}.new: #{name}" - end - Thrift.check_type(value, struct_fields[name_to_id(name.to_s)], name) if Thrift.type_checking - instance_variable_set("@#{name}", value) - end - end - - # assign all the default values - unless fields_with_defaults.empty? - fields_with_defaults.each do |name, default_value| - instance_variable_set("@#{name}", (default_value.dup rescue default_value)) - end - end - - yield self if block_given? - end - - def fields_with_default_values - fields_with_default_values = self.class.instance_variable_get(:@fields_with_default_values) - unless fields_with_default_values - fields_with_default_values = {} - struct_fields.each do |fid, field_def| - unless field_def[:default].nil? - fields_with_default_values[field_def[:name]] = field_def[:default] - end - end - self.class.instance_variable_set(:@fields_with_default_values, fields_with_default_values) - end - fields_with_default_values - end - - def inspect(skip_optional_nulls = true) - fields = [] - each_field do |fid, field_info| - name = field_info[:name] - value = instance_variable_get("@#{name}") - unless skip_optional_nulls && field_info[:optional] && value.nil? - fields << "#{name}:#{inspect_field(value, field_info)}" - end - end - "<#{self.class} #{fields.join(", ")}>" - end - - def read(iprot) - iprot.read_struct_begin - loop do - fname, ftype, fid = iprot.read_field_begin - break if (ftype == Types::STOP) - handle_message(iprot, fid, ftype) - iprot.read_field_end - end - iprot.read_struct_end - validate - end - - def write(oprot) - validate - oprot.write_struct_begin(self.class.name) - each_field do |fid, field_info| - name = field_info[:name] - type = field_info[:type] - value = instance_variable_get("@#{name}") - unless value.nil? - if is_container? type - oprot.write_field_begin(name, type, fid) - write_container(oprot, value, field_info) - oprot.write_field_end - else - oprot.write_field(name, type, fid, value) - end - end - end - oprot.write_field_stop - oprot.write_struct_end - end - - def ==(other) - return false if other.nil? - each_field do |fid, field_info| - name = field_info[:name] - return false unless other.respond_to?(name) && self.send(name) == other.send(name) - end - true - end - - def eql?(other) - self.class == other.class && self == other - end - - # This implementation of hash() is inspired by Apache's Java HashCodeBuilder class. - def hash - total = 17 - each_field do |fid, field_info| - name = field_info[:name] - value = self.send(name) - total = (total * 37 + value.hash) & 0xffffffff - end - total - end - - def differences(other) - diffs = [] - unless other.is_a?(self.class) - diffs << "Different class!" - else - each_field do |fid, field_info| - name = field_info[:name] - diffs << "#{name} differs!" unless self.instance_variable_get("@#{name}") == other.instance_variable_get("@#{name}") - end - end - diffs - end - - def self.field_accessor(klass, field_info) - field_name_sym = field_info[:name].to_sym - klass.send :attr_reader, field_name_sym - klass.send :define_method, "#{field_info[:name]}=" do |value| - Thrift.check_type(value, field_info, field_info[:name]) if Thrift.type_checking - instance_variable_set("@#{field_name_sym}", value) - end - end - - def self.generate_accessors(klass) - klass::FIELDS.values.each do |field_info| - field_accessor(klass, field_info) - qmark_isset_method(klass, field_info) - end - end - - def self.qmark_isset_method(klass, field_info) - klass.send :define_method, "#{field_info[:name]}?" do - !self.send(field_info[:name].to_sym).nil? - end - end - - def <=>(other) - if self.class == other.class - each_field do |fid, field_info| - v1 = self.send(field_info[:name]) - v1_set = !v1.nil? - v2 = other.send(field_info[:name]) - v2_set = !v2.nil? - if v1_set && !v2_set - return -1 - elsif !v1_set && v2_set - return 1 - elsif v1_set && v2_set - cmp = v1 <=> v2 - if cmp != 0 - return cmp - end - end - end - 0 - else - self.class <=> other.class - end - end - - protected - - def self.append_features(mod) - if mod.ancestors.include? ::Exception - mod.send :class_variable_set, :'@@__thrift_struct_real_initialize', mod.instance_method(:initialize) - super - # set up our custom initializer so `raise Xception, 'message'` works - mod.send :define_method, :struct_initialize, mod.instance_method(:initialize) - mod.send :define_method, :initialize, mod.instance_method(:exception_initialize) - else - super - end - end - - def exception_initialize(*args, &block) - if args.size == 1 and args.first.is_a? Hash - # looks like it's a regular Struct initialize - method(:struct_initialize).call(args.first) - else - # call the Struct initializer first with no args - # this will set our field default values - method(:struct_initialize).call() - # now give it to the exception - self.class.send(:class_variable_get, :'@@__thrift_struct_real_initialize').bind(self).call(*args, &block) if args.size > 0 - # self.class.instance_method(:initialize).bind(self).call(*args, &block) - end - end - - def handle_message(iprot, fid, ftype) - field = struct_fields[fid] - if field and field[:type] == ftype - value = read_field(iprot, field) - instance_variable_set("@#{field[:name]}", value) - else - iprot.skip(ftype) - end - end - end -end diff --git a/vendor/thrift/struct_union.rb b/vendor/thrift/struct_union.rb deleted file mode 100644 index 4e0afcf..0000000 --- a/vendor/thrift/struct_union.rb +++ /dev/null @@ -1,192 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -require 'set' - -module Thrift - module Struct_Union - def name_to_id(name) - names_to_ids = self.class.instance_variable_get(:@names_to_ids) - unless names_to_ids - names_to_ids = {} - struct_fields.each do |fid, field_def| - names_to_ids[field_def[:name]] = fid - end - self.class.instance_variable_set(:@names_to_ids, names_to_ids) - end - names_to_ids[name] - end - - def sorted_field_ids - sorted_field_ids = self.class.instance_variable_get(:@sorted_field_ids) - unless sorted_field_ids - sorted_field_ids = struct_fields.keys.sort - self.class.instance_variable_set(:@sorted_field_ids, sorted_field_ids) - end - sorted_field_ids - end - - def each_field - sorted_field_ids.each do |fid| - data = struct_fields[fid] - yield fid, data - end - end - - def read_field(iprot, field = {}) - case field[:type] - when Types::STRUCT - value = field[:class].new - value.read(iprot) - when Types::MAP - key_type, val_type, size = iprot.read_map_begin - # Skip the map contents if the declared key or value types don't match the expected ones. - if (size != 0 && (key_type != field[:key][:type] || val_type != field[:value][:type])) - size.times do - iprot.skip(key_type) - iprot.skip(val_type) - end - value = nil - else - value = {} - size.times do - k = read_field(iprot, field_info(field[:key])) - v = read_field(iprot, field_info(field[:value])) - value[k] = v - end - end - iprot.read_map_end - when Types::LIST - e_type, size = iprot.read_list_begin - # Skip the list contents if the declared element type doesn't match the expected one. - if (e_type != field[:element][:type]) - size.times do - iprot.skip(e_type) - end - value = nil - else - value = Array.new(size) do |n| - read_field(iprot, field_info(field[:element])) - end - end - iprot.read_list_end - when Types::SET - e_type, size = iprot.read_set_begin - # Skip the set contents if the declared element type doesn't match the expected one. - if (e_type != field[:element][:type]) - size.times do - iprot.skip(e_type) - end - else - value = Set.new - size.times do - element = read_field(iprot, field_info(field[:element])) - value << element - end - end - iprot.read_set_end - else - value = iprot.read_type(field[:type]) - end - value - end - - def write_data(oprot, value, field) - if is_container? field[:type] - write_container(oprot, value, field) - else - oprot.write_type(field[:type], value) - end - end - - def write_container(oprot, value, field = {}) - case field[:type] - when Types::MAP - oprot.write_map_begin(field[:key][:type], field[:value][:type], value.size) - value.each do |k, v| - write_data(oprot, k, field[:key]) - write_data(oprot, v, field[:value]) - end - oprot.write_map_end - when Types::LIST - oprot.write_list_begin(field[:element][:type], value.size) - value.each do |elem| - write_data(oprot, elem, field[:element]) - end - oprot.write_list_end - when Types::SET - oprot.write_set_begin(field[:element][:type], value.size) - value.each do |v,| # the , is to preserve compatibility with the old Hash-style sets - write_data(oprot, v, field[:element]) - end - oprot.write_set_end - else - raise "Not a container type: #{field[:type]}" - end - end - - CONTAINER_TYPES = [] - CONTAINER_TYPES[Types::LIST] = true - CONTAINER_TYPES[Types::MAP] = true - CONTAINER_TYPES[Types::SET] = true - def is_container?(type) - CONTAINER_TYPES[type] - end - - def field_info(field) - { :type => field[:type], - :class => field[:class], - :key => field[:key], - :value => field[:value], - :element => field[:element] } - end - - def inspect_field(value, field_info) - if enum_class = field_info[:enum_class] - "#{enum_class.const_get(:VALUE_MAP)[value]} (#{value})" - elsif value.is_a? Hash - if field_info[:type] == Types::MAP - map_buf = [] - value.each do |k, v| - map_buf << inspect_field(k, field_info[:key]) + ": " + inspect_field(v, field_info[:value]) - end - "{" + map_buf.join(", ") + "}" - else - # old-style set - inspect_collection(value.keys, field_info) - end - elsif value.is_a? Array - inspect_collection(value, field_info) - elsif value.is_a? Set - inspect_collection(value, field_info) - elsif value.is_a?(String) && field_info[:binary] - value.unpack("H*").first - else - value.inspect - end - end - - def inspect_collection(collection, field_info) - buf = [] - collection.each do |k| - buf << inspect_field(k, field_info[:element]) - end - "[" + buf.join(", ") + "]" - end - end -end
\ No newline at end of file diff --git a/vendor/thrift/thrift_native.rb b/vendor/thrift/thrift_native.rb deleted file mode 100644 index 4d8df61..0000000 --- a/vendor/thrift/thrift_native.rb +++ /dev/null @@ -1,24 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -begin - require "thrift_native" -rescue LoadError - puts "Unable to load thrift_native extension. Defaulting to pure Ruby libraries." -end
\ No newline at end of file diff --git a/vendor/thrift/transport/base_server_transport.rb b/vendor/thrift/transport/base_server_transport.rb deleted file mode 100644 index 68c5af0..0000000 --- a/vendor/thrift/transport/base_server_transport.rb +++ /dev/null @@ -1,37 +0,0 @@ -# encoding: ascii-8bit -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -module Thrift - class BaseServerTransport - def listen - raise NotImplementedError - end - - def accept - raise NotImplementedError - end - - def close; nil; end - - def closed? - raise NotImplementedError - end - end -end
\ No newline at end of file diff --git a/vendor/thrift/transport/base_transport.rb b/vendor/thrift/transport/base_transport.rb deleted file mode 100644 index 0a12cea..0000000 --- a/vendor/thrift/transport/base_transport.rb +++ /dev/null @@ -1,107 +0,0 @@ -# encoding: ascii-8bit -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -module Thrift - class TransportException < Exception - UNKNOWN = 0 - NOT_OPEN = 1 - ALREADY_OPEN = 2 - TIMED_OUT = 3 - END_OF_FILE = 4 - - attr_reader :type - - def initialize(type=UNKNOWN, message=nil) - super(message) - @type = type - end - end - - module TransportUtils - if RUBY_VERSION >= '1.9' - def self.get_string_byte(string, index) - string.getbyte(index) - end - - def self.set_string_byte(string, index, byte) - string.setbyte(index, byte) - end - else - def self.get_string_byte(string, index) - string[index] - end - - def self.set_string_byte(string, index, byte) - string[index] = byte - end - end - end - - class BaseTransport - def open?; end - - def open; end - - def close; end - - def read(sz) - raise NotImplementedError - end - - # Returns an unsigned byte as a Fixnum in the range (0..255). - def read_byte - buf = read_all(1) - return ::Thrift::TransportUtils.get_string_byte(buf, 0) - end - - # Reads size bytes and copies them into buffer[0..size]. - def read_into_buffer(buffer, size) - tmp = read_all(size) - i = 0 - tmp.each_byte do |byte| - ::Thrift::TransportUtils.set_string_byte(buffer, i, byte) - i += 1 - end - i - end - - def read_all(size) - return '' if size <= 0 - buf = read(size) - while (buf.length < size) - chunk = read(size - buf.length) - buf << chunk - end - - buf - end - - def write(buf); end - alias_method :<<, :write - - def flush; end - end - - class BaseTransportFactory - def get_transport(trans) - return trans - end - end -end
\ No newline at end of file diff --git a/vendor/thrift/transport/buffered_transport.rb b/vendor/thrift/transport/buffered_transport.rb deleted file mode 100644 index 676a4d3..0000000 --- a/vendor/thrift/transport/buffered_transport.rb +++ /dev/null @@ -1,108 +0,0 @@ -# encoding: ascii-8bit -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -module Thrift - class BufferedTransport < BaseTransport - DEFAULT_BUFFER = 4096 - - def initialize(transport) - @transport = transport - @wbuf = '' - @rbuf = '' - @index = 0 - end - - def open? - return @transport.open? - end - - def open - @transport.open - end - - def close - flush - @transport.close - end - - def read(sz) - @index += sz - ret = @rbuf.slice(@index - sz, sz) || '' - - if ret.length == 0 - @rbuf = @transport.read([sz, DEFAULT_BUFFER].max) - @index = sz - ret = @rbuf.slice(0, sz) || '' - end - - ret - end - - def read_byte - # If the read buffer is exhausted, try to read up to DEFAULT_BUFFER more bytes into it. - if @index >= @rbuf.size - @rbuf = @transport.read(DEFAULT_BUFFER) - @index = 0 - end - - # The read buffer has some data now, read a single byte. Using get_string_byte() avoids - # allocating a temp string of size 1 unnecessarily. - @index += 1 - return ::Thrift::TransportUtils.get_string_byte(@rbuf, @index - 1) - end - - def read_into_buffer(buffer, size) - i = 0 - while i < size - # If the read buffer is exhausted, try to read up to DEFAULT_BUFFER more bytes into it. - if @index >= @rbuf.size - @rbuf = @transport.read(DEFAULT_BUFFER) - @index = 0 - end - - # The read buffer has some data now, so copy bytes over to the output buffer. - byte = ::Thrift::TransportUtils.get_string_byte(@rbuf, @index) - ::Thrift::TransportUtils.set_string_byte(buffer, i, byte) - @index += 1 - i += 1 - end - i - end - - def write(buf) - @wbuf << buf - end - - def flush - if @wbuf != '' - @transport.write(@wbuf) - @wbuf = '' - end - - @transport.flush - end - end - - class BufferedTransportFactory < BaseTransportFactory - def get_transport(transport) - return BufferedTransport.new(transport) - end - end -end
\ No newline at end of file diff --git a/vendor/thrift/transport/framed_transport.rb b/vendor/thrift/transport/framed_transport.rb deleted file mode 100644 index e7630d0..0000000 --- a/vendor/thrift/transport/framed_transport.rb +++ /dev/null @@ -1,116 +0,0 @@ -# encoding: ascii-8bit -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -module Thrift - class FramedTransport < BaseTransport - def initialize(transport, read=true, write=true) - @transport = transport - @rbuf = '' - @wbuf = '' - @read = read - @write = write - @index = 0 - end - - def open? - @transport.open? - end - - def open - @transport.open - end - - def close - @transport.close - end - - def read(sz) - return @transport.read(sz) unless @read - - return '' if sz <= 0 - - read_frame if @index >= @rbuf.length - - @index += sz - @rbuf.slice(@index - sz, sz) || '' - end - - def read_byte - return @transport.read_byte() unless @read - - read_frame if @index >= @rbuf.length - - # The read buffer has some data now, read a single byte. Using get_string_byte() avoids - # allocating a temp string of size 1 unnecessarily. - @index += 1 - return ::Thrift::TransportUtils.get_string_byte(@rbuf, @index - 1) - end - - def read_into_buffer(buffer, size) - i = 0 - while i < size - read_frame if @index >= @rbuf.length - - # The read buffer has some data now, so copy bytes over to the output buffer. - byte = ::Thrift::TransportUtils.get_string_byte(@rbuf, @index) - ::Thrift::TransportUtils.set_string_byte(buffer, i, byte) - @index += 1 - i += 1 - end - i - end - - - def write(buf,sz=nil) - return @transport.write(buf) unless @write - - @wbuf << (sz ? buf[0...sz] : buf) - end - - # - # Writes the output buffer to the stream in the format of a 4-byte length - # followed by the actual data. - # - def flush - return @transport.flush unless @write - - out = [@wbuf.length].pack('N') - out << @wbuf - @transport.write(out) - @transport.flush - @wbuf = '' - end - - private - - def read_frame - sz = @transport.read_all(4).unpack('N').first - - @index = 0 - @rbuf = @transport.read_all(sz) - end - end - - class FramedTransportFactory < BaseTransportFactory - def get_transport(transport) - return FramedTransport.new(transport) - end - end -end
\ No newline at end of file diff --git a/vendor/thrift/transport/http_client_transport.rb b/vendor/thrift/transport/http_client_transport.rb deleted file mode 100644 index 1bce6e1..0000000 --- a/vendor/thrift/transport/http_client_transport.rb +++ /dev/null @@ -1,53 +0,0 @@ -# encoding: ascii-8bit -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -require 'net/http' -require 'net/https' -require 'uri' -require 'stringio' - -module Thrift - class HTTPClientTransport < BaseTransport - - def initialize(url, proxy_addr = nil, proxy_port = nil) - @url = URI url - @headers = {'Content-Type' => 'application/x-thrift'} - @outbuf = "" - @proxy_addr = proxy_addr - @proxy_port = proxy_port - end - - def open?; true end - def read(sz); @inbuf.read sz end - def write(buf); @outbuf << buf end - - def add_headers(headers) - @headers = @headers.merge(headers) - end - - def flush - http = Net::HTTP.new @url.host, @url.port, @proxy_addr, @proxy_port - http.use_ssl = @url.scheme == "https" - resp = http.post(@url.request_uri, @outbuf, @headers) - @inbuf = StringIO.new resp.body - @outbuf = "" - end - end -end diff --git a/vendor/thrift/transport/io_stream_transport.rb b/vendor/thrift/transport/io_stream_transport.rb deleted file mode 100644 index be348aa..0000000 --- a/vendor/thrift/transport/io_stream_transport.rb +++ /dev/null @@ -1,39 +0,0 @@ -# encoding: ascii-8bit -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -# Very very simple implementation of wrapping two objects, one with a #read -# method and one with a #write method, into a transport for thrift. -# -# Assumes both objects are open, remain open, don't require flushing, etc. -# -module Thrift - class IOStreamTransport < BaseTransport - def initialize(input, output) - @input = input - @output = output - end - - def open?; not @input.closed? or not @output.closed? end - def read(sz); @input.read(sz) end - def write(buf); @output.write(buf) end - def close; @input.close; @output.close end - def to_io; @input end # we're assuming this is used in a IO.select for reading - end -end
\ No newline at end of file diff --git a/vendor/thrift/transport/memory_buffer_transport.rb b/vendor/thrift/transport/memory_buffer_transport.rb deleted file mode 100644 index 62c5292..0000000 --- a/vendor/thrift/transport/memory_buffer_transport.rb +++ /dev/null @@ -1,125 +0,0 @@ -# encoding: ascii-8bit -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -module Thrift - class MemoryBufferTransport < BaseTransport - GARBAGE_BUFFER_SIZE = 4*(2**10) # 4kB - - # If you pass a string to this, you should #dup that string - # unless you want it to be modified by #read and #write - #-- - # this behavior is no longer required. If you wish to change it - # go ahead, just make sure the specs pass - def initialize(buffer = nil) - @buf = buffer || '' - @index = 0 - end - - def open? - return true - end - - def open - end - - def close - end - - def peek - @index < @buf.size - end - - # this method does not use the passed object directly but copies it - def reset_buffer(new_buf = '') - @buf.replace new_buf - @index = 0 - end - - def available - @buf.length - @index - end - - def read(len) - data = @buf.slice(@index, len) - @index += len - @index = @buf.size if @index > @buf.size - if @index >= GARBAGE_BUFFER_SIZE - @buf = @buf.slice(@index..-1) - @index = 0 - end - if data.size < len - raise EOFError, "Not enough bytes remain in buffer" - end - data - end - - def read_byte - raise EOFError.new("Not enough bytes remain in buffer") if @index >= @buf.size - val = ::Thrift::TransportUtils.get_string_byte(@buf, @index) - @index += 1 - if @index >= GARBAGE_BUFFER_SIZE - @buf = @buf.slice(@index..-1) - @index = 0 - end - val - end - - def read_into_buffer(buffer, size) - i = 0 - while i < size - raise EOFError.new("Not enough bytes remain in buffer") if @index >= @buf.size - - # The read buffer has some data now, so copy bytes over to the output buffer. - byte = ::Thrift::TransportUtils.get_string_byte(@buf, @index) - ::Thrift::TransportUtils.set_string_byte(buffer, i, byte) - @index += 1 - i += 1 - end - if @index >= GARBAGE_BUFFER_SIZE - @buf = @buf.slice(@index..-1) - @index = 0 - end - i - end - - def write(wbuf) - @buf << wbuf - end - - def flush - end - - def inspect_buffer - out = [] - for idx in 0...(@buf.size) - # if idx != 0 - # out << " " - # end - - if idx == @index - out << ">" - end - - out << @buf[idx].ord.to_s(16) - end - out.join(" ") - end - end -end diff --git a/vendor/thrift/transport/server_socket.rb b/vendor/thrift/transport/server_socket.rb deleted file mode 100644 index 7feb9ab..0000000 --- a/vendor/thrift/transport/server_socket.rb +++ /dev/null @@ -1,63 +0,0 @@ -# encoding: ascii-8bit -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -require 'socket' - -module Thrift - class ServerSocket < BaseServerTransport - # call-seq: initialize(host = nil, port) - def initialize(host_or_port, port = nil) - if port - @host = host_or_port - @port = port - else - @host = nil - @port = host_or_port - end - @handle = nil - end - - attr_reader :handle - - def listen - @handle = TCPServer.new(@host, @port) - end - - def accept - unless @handle.nil? - sock = @handle.accept - trans = Socket.new - trans.handle = sock - trans - end - end - - def close - @handle.close unless @handle.nil? or @handle.closed? - @handle = nil - end - - def closed? - @handle.nil? or @handle.closed? - end - - alias to_io handle - end -end
\ No newline at end of file diff --git a/vendor/thrift/transport/socket.rb b/vendor/thrift/transport/socket.rb deleted file mode 100644 index 9bb2036..0000000 --- a/vendor/thrift/transport/socket.rb +++ /dev/null @@ -1,137 +0,0 @@ -# encoding: ascii-8bit -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -require 'socket' - -module Thrift - class Socket < BaseTransport - def initialize(host='localhost', port=9090, timeout=nil) - @host = host - @port = port - @timeout = timeout - @desc = "#{host}:#{port}" - @handle = nil - end - - attr_accessor :handle, :timeout - - def open - begin - addrinfo = ::Socket::getaddrinfo(@host, @port).first - @handle = ::Socket.new(addrinfo[4], ::Socket::SOCK_STREAM, 0) - sockaddr = ::Socket.sockaddr_in(addrinfo[1], addrinfo[3]) - begin - @handle.connect_nonblock(sockaddr) - rescue Errno::EINPROGRESS - unless IO.select(nil, [ @handle ], nil, @timeout) - raise TransportException.new(TransportException::NOT_OPEN, "Connection timeout to #{@desc}") - end - begin - @handle.connect_nonblock(sockaddr) - rescue Errno::EISCONN - end - end - @handle - rescue StandardError => e - raise TransportException.new(TransportException::NOT_OPEN, "Could not connect to #{@desc}: #{e}") - end - end - - def open? - !@handle.nil? and !@handle.closed? - end - - def write(str) - raise IOError, "closed stream" unless open? - begin - if @timeout.nil? or @timeout == 0 - @handle.write(str) - else - len = 0 - start = Time.now - while Time.now - start < @timeout - rd, wr, = IO.select(nil, [@handle], nil, @timeout) - if wr and not wr.empty? - len += @handle.write_nonblock(str[len..-1]) - break if len >= str.length - end - end - if len < str.length - raise TransportException.new(TransportException::TIMED_OUT, "Socket: Timed out writing #{str.length} bytes to #{@desc}") - else - len - end - end - rescue TransportException => e - # pass this on - raise e - rescue StandardError => e - @handle.close - @handle = nil - raise TransportException.new(TransportException::NOT_OPEN, e.message) - end - end - - def read(sz) - raise IOError, "closed stream" unless open? - - begin - if @timeout.nil? or @timeout == 0 - data = @handle.readpartial(sz) - else - # it's possible to interrupt select for something other than the timeout - # so we need to ensure we've waited long enough, but not too long - start = Time.now - timespent = 0 - rd = loop do - rd, = IO.select([@handle], nil, nil, @timeout - timespent) - timespent = Time.now - start - break rd if (rd and not rd.empty?) or timespent >= @timeout - end - if rd.nil? or rd.empty? - raise TransportException.new(TransportException::TIMED_OUT, "Socket: Timed out reading #{sz} bytes from #{@desc}") - else - data = @handle.readpartial(sz) - end - end - rescue TransportException => e - # don't let this get caught by the StandardError handler - raise e - rescue StandardError => e - @handle.close unless @handle.closed? - @handle = nil - raise TransportException.new(TransportException::NOT_OPEN, e.message) - end - if (data.nil? or data.length == 0) - raise TransportException.new(TransportException::UNKNOWN, "Socket: Could not read #{sz} bytes from #{@desc}") - end - data - end - - def close - @handle.close unless @handle.nil? or @handle.closed? - @handle = nil - end - - def to_io - @handle - end - end -end
\ No newline at end of file diff --git a/vendor/thrift/transport/unix_server_socket.rb b/vendor/thrift/transport/unix_server_socket.rb deleted file mode 100644 index a135d25..0000000 --- a/vendor/thrift/transport/unix_server_socket.rb +++ /dev/null @@ -1,60 +0,0 @@ -# encoding: ascii-8bit -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -require 'socket' - -module Thrift - class UNIXServerSocket < BaseServerTransport - def initialize(path) - @path = path - @handle = nil - end - - attr_accessor :handle - - def listen - @handle = ::UNIXServer.new(@path) - end - - def accept - unless @handle.nil? - sock = @handle.accept - trans = UNIXSocket.new(nil) - trans.handle = sock - trans - end - end - - def close - if @handle - @handle.close unless @handle.closed? - @handle = nil - # UNIXServer doesn't delete the socket file, so we have to do it ourselves - File.delete(@path) - end - end - - def closed? - @handle.nil? or @handle.closed? - end - - alias to_io handle - end -end
\ No newline at end of file diff --git a/vendor/thrift/transport/unix_socket.rb b/vendor/thrift/transport/unix_socket.rb deleted file mode 100644 index 8f692e4..0000000 --- a/vendor/thrift/transport/unix_socket.rb +++ /dev/null @@ -1,40 +0,0 @@ -# encoding: ascii-8bit -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -require 'socket' - -module Thrift - class UNIXSocket < Socket - def initialize(path, timeout=nil) - @path = path - @timeout = timeout - @desc = @path # for read()'s error - @handle = nil - end - - def open - begin - @handle = ::UNIXSocket.new(@path) - rescue StandardError - raise TransportException.new(TransportException::NOT_OPEN, "Could not open UNIX socket at #{@path}") - end - end - end -end
\ No newline at end of file diff --git a/vendor/thrift/types.rb b/vendor/thrift/types.rb deleted file mode 100644 index cac5269..0000000 --- a/vendor/thrift/types.rb +++ /dev/null @@ -1,101 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -require 'set' - -module Thrift - module Types - STOP = 0 - VOID = 1 - BOOL = 2 - BYTE = 3 - DOUBLE = 4 - I16 = 6 - I32 = 8 - I64 = 10 - STRING = 11 - STRUCT = 12 - MAP = 13 - SET = 14 - LIST = 15 - end - - class << self - attr_accessor :type_checking - end - - class TypeError < Exception - end - - def self.check_type(value, field, name, skip_nil=true) - return if value.nil? and skip_nil - klasses = case field[:type] - when Types::VOID - NilClass - when Types::BOOL - [TrueClass, FalseClass] - when Types::BYTE, Types::I16, Types::I32, Types::I64 - Integer - when Types::DOUBLE - Float - when Types::STRING - String - when Types::STRUCT - [Struct, Union] - when Types::MAP - Hash - when Types::SET - Set - when Types::LIST - Array - end - valid = klasses && [*klasses].any? { |klass| klass === value } - raise TypeError, "Expected #{type_name(field[:type])}, received #{value.class} for field #{name}" unless valid - # check elements now - case field[:type] - when Types::MAP - value.each_pair do |k,v| - check_type(k, field[:key], "#{name}.key", false) - check_type(v, field[:value], "#{name}.value", false) - end - when Types::SET, Types::LIST - value.each do |el| - check_type(el, field[:element], "#{name}.element", false) - end - when Types::STRUCT - raise TypeError, "Expected #{field[:class]}, received #{value.class} for field #{name}" unless field[:class] == value.class - end - end - - def self.type_name(type) - Types.constants.each do |const| - return "Types::#{const}" if Types.const_get(const) == type - end - nil - end - - module MessageTypes - CALL = 1 - REPLY = 2 - EXCEPTION = 3 - ONEWAY = 4 - end -end - -Thrift.type_checking = false if Thrift.type_checking.nil? diff --git a/vendor/thrift/union.rb b/vendor/thrift/union.rb deleted file mode 100644 index a7058f2..0000000 --- a/vendor/thrift/union.rb +++ /dev/null @@ -1,179 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -module Thrift - class Union - def initialize(name=nil, value=nil) - if name - if name.is_a? Hash - if name.size > 1 - raise "#{self.class} cannot be instantiated with more than one field!" - end - - name, value = name.keys.first, name.values.first - end - - if Thrift.type_checking - raise Exception, "#{self.class} does not contain a field named #{name}!" unless name_to_id(name.to_s) - end - - if value.nil? - raise Exception, "Union #{self.class} cannot be instantiated with setfield and nil value!" - end - - Thrift.check_type(value, struct_fields[name_to_id(name.to_s)], name) if Thrift.type_checking - elsif !value.nil? - raise Exception, "Value provided, but no name!" - end - @setfield = name - @value = value - end - - def inspect - if get_set_field - "<#{self.class} #{@setfield}: #{inspect_field(@value, struct_fields[name_to_id(@setfield.to_s)])}>" - else - "<#{self.class} >" - end - end - - def read(iprot) - iprot.read_struct_begin - fname, ftype, fid = iprot.read_field_begin - handle_message(iprot, fid, ftype) - iprot.read_field_end - - fname, ftype, fid = iprot.read_field_begin - raise "Too many fields for union" unless (ftype == Types::STOP) - - iprot.read_struct_end - validate - end - - def write(oprot) - validate - oprot.write_struct_begin(self.class.name) - - fid = self.name_to_id(@setfield.to_s) - - field_info = struct_fields[fid] - type = field_info[:type] - if is_container? type - oprot.write_field_begin(@setfield, type, fid) - write_container(oprot, @value, field_info) - oprot.write_field_end - else - oprot.write_field(@setfield, type, fid, @value) - end - - oprot.write_field_stop - oprot.write_struct_end - end - - def ==(other) - other != nil && @setfield == other.get_set_field && @value == other.get_value - end - - def eql?(other) - self.class == other.class && self == other - end - - def hash - [self.class.name, @setfield, @value].hash - end - - def self.field_accessor(klass, field_info) - klass.send :define_method, field_info[:name] do - if field_info[:name].to_sym == @setfield - @value - else - raise RuntimeError, "#{field_info[:name]} is not union's set field." - end - end - - klass.send :define_method, "#{field_info[:name]}=" do |value| - Thrift.check_type(value, field_info, field_info[:name]) if Thrift.type_checking - @setfield = field_info[:name].to_sym - @value = value - end - end - - def self.qmark_isset_method(klass, field_info) - klass.send :define_method, "#{field_info[:name]}?" do - get_set_field == field_info[:name].to_sym && !get_value.nil? - end - end - - def self.generate_accessors(klass) - klass::FIELDS.values.each do |field_info| - field_accessor(klass, field_info) - qmark_isset_method(klass, field_info) - end - end - - # get the symbol that indicates what the currently set field type is. - def get_set_field - @setfield - end - - # get the current value of this union, regardless of what the set field is. - # generally, you should only use this method when you don't know in advance - # what field to expect. - def get_value - @value - end - - def <=>(other) - if self.class == other.class - if get_set_field == other.get_set_field - if get_set_field.nil? - 0 - else - get_value <=> other.get_value - end - else - if get_set_field && other.get_set_field.nil? - -1 - elsif get_set_field.nil? && other.get_set_field - 1 - elsif get_set_field.nil? && other.get_set_field.nil? - 0 - else - name_to_id(get_set_field.to_s) <=> name_to_id(other.get_set_field.to_s) - end - end - else - self.class <=> other.class - end - end - - protected - - def handle_message(iprot, fid, ftype) - field = struct_fields[fid] - if field and field[:type] == ftype - @value = read_field(iprot, field) - name = field[:name].to_sym - @setfield = name - else - iprot.skip(ftype) - end - end - end -end
\ No newline at end of file |
