Skip to content
Browse files

initial commit

  • Loading branch information...
0 parents commit 3f33fc16d956e02d0b0c1ba51de9a4f37dc26d4c Puraumu committed
Showing with 16,217 additions and 0 deletions.
  1. +7 −0 .gitignore
  2. +18 −0 Rakefile
  3. +387 −0 coffee/script.coffee
  4. +27 −0 config.rb
  5. +24 −0 config.ru
  6. +16 −0 evernote-sdk-ruby/client.rb
  7. +23 −0 evernote-sdk-ruby/debug.rb
  8. +138 −0 evernote-sdk-ruby/en-sql.rb
  9. +137 −0 evernote-sdk-ruby/enclient.rb
  10. +14 −0 evernote-sdk-ruby/lib/Evernote/EDAM/errors_constants.rb
  11. +128 −0 evernote-sdk-ruby/lib/Evernote/EDAM/errors_types.rb
  12. +240 −0 evernote-sdk-ruby/lib/Evernote/EDAM/limits_constants.rb
  13. +13 −0 evernote-sdk-ruby/lib/Evernote/EDAM/limits_types.rb
  14. +5,487 −0 evernote-sdk-ruby/lib/Evernote/EDAM/note_store.rb
  15. +14 −0 evernote-sdk-ruby/lib/Evernote/EDAM/note_store_constants.rb
  16. +1,012 −0 evernote-sdk-ruby/lib/Evernote/EDAM/note_store_types.rb
  17. +20 −0 evernote-sdk-ruby/lib/Evernote/EDAM/types_constants.rb
  18. +1,792 −0 evernote-sdk-ruby/lib/Evernote/EDAM/types_types.rb
  19. +549 −0 evernote-sdk-ruby/lib/Evernote/EDAM/user_store.rb
  20. +18 −0 evernote-sdk-ruby/lib/Evernote/EDAM/user_store_constants.rb
  21. +415 −0 evernote-sdk-ruby/lib/Evernote/EDAM/user_store_types.rb
  22. +64 −0 evernote-sdk-ruby/lib/thrift.rb
  23. +62 −0 evernote-sdk-ruby/lib/thrift/client.rb
  24. +23 −0 evernote-sdk-ruby/lib/thrift/core_ext.rb
  25. +29 −0 evernote-sdk-ruby/lib/thrift/core_ext/fixnum.rb
  26. +84 −0 evernote-sdk-ruby/lib/thrift/exceptions.rb
  27. +57 −0 evernote-sdk-ruby/lib/thrift/processor.rb
  28. +290 −0 evernote-sdk-ruby/lib/thrift/protocol/base_protocol.rb
  29. +229 −0 evernote-sdk-ruby/lib/thrift/protocol/binary_protocol.rb
  30. +39 −0 evernote-sdk-ruby/lib/thrift/protocol/binary_protocol_accelerated.rb
  31. +426 −0 evernote-sdk-ruby/lib/thrift/protocol/compact_protocol.rb
  32. +33 −0 evernote-sdk-ruby/lib/thrift/serializer/deserializer.rb
  33. +34 −0 evernote-sdk-ruby/lib/thrift/serializer/serializer.rb
  34. +31 −0 evernote-sdk-ruby/lib/thrift/server/base_server.rb
  35. +58 −0 evernote-sdk-ruby/lib/thrift/server/mongrel_http_server.rb
  36. +305 −0 evernote-sdk-ruby/lib/thrift/server/nonblocking_server.rb
  37. +43 −0 evernote-sdk-ruby/lib/thrift/server/simple_server.rb
  38. +75 −0 evernote-sdk-ruby/lib/thrift/server/thread_pool_server.rb
  39. +47 −0 evernote-sdk-ruby/lib/thrift/server/threaded_server.rb
  40. +237 −0 evernote-sdk-ruby/lib/thrift/struct.rb
  41. +192 −0 evernote-sdk-ruby/lib/thrift/struct_union.rb
  42. +24 −0 evernote-sdk-ruby/lib/thrift/thrift_native.rb
  43. +37 −0 evernote-sdk-ruby/lib/thrift/transport/base_server_transport.rb
  44. +107 −0 evernote-sdk-ruby/lib/thrift/transport/base_transport.rb
  45. +108 −0 evernote-sdk-ruby/lib/thrift/transport/buffered_transport.rb
  46. +116 −0 evernote-sdk-ruby/lib/thrift/transport/framed_transport.rb
  47. +51 −0 evernote-sdk-ruby/lib/thrift/transport/http_client_transport.rb
  48. +39 −0 evernote-sdk-ruby/lib/thrift/transport/io_stream_transport.rb
  49. +125 −0 evernote-sdk-ruby/lib/thrift/transport/memory_buffer_transport.rb
  50. +63 −0 evernote-sdk-ruby/lib/thrift/transport/server_socket.rb
  51. +137 −0 evernote-sdk-ruby/lib/thrift/transport/socket.rb
  52. +60 −0 evernote-sdk-ruby/lib/thrift/transport/unix_server_socket.rb
  53. +40 −0 evernote-sdk-ruby/lib/thrift/transport/unix_socket.rb
  54. +101 −0 evernote-sdk-ruby/lib/thrift/types.rb
  55. +179 −0 evernote-sdk-ruby/lib/thrift/union.rb
  56. +132 −0 evernote-sdk-ruby/sample/client/EDAMTest.rb
  57. BIN evernote-sdk-ruby/sample/client/enlogo.png
  58. +33 −0 evernote-sdk-ruby/sample/oauth/evernote_config.rb
  59. +288 −0 evernote-sdk-ruby/sample/oauth/evernote_oauth.rb
  60. +186 −0 evernote-sdk-ruby/sample/oauth/evernote_oauth_simple.rb
  61. +15 −0 public/css/calendar.css
  62. +1,327 −0 public/css/colorbrewer.css
  63. BIN public/img/glyphicons-halflings-white.png
  64. BIN public/img/glyphicons-halflings.png
  65. +97 −0 public/index.html
  66. +17 −0 public/js/d3.scales.js
  67. +98 −0 public/js/dji.js
Sorry, we could not display the entire diff because it was too big.
7 .gitignore
@@ -0,0 +1,7 @@
+.sass-cache/
+evernote-sdk-ruby/out.json
+public/css/style.css
+public/css/bootstrap/responsive.css
+public/js/script.js
+public/static/evernote.csv
+public/static/evernote.json
18 Rakefile
@@ -0,0 +1,18 @@
+server_port = 9292
+public_dir = "public"
+
+coffee_out = "#{public_dir}/js"
+coffee_src = "coffee"
+
+task :server do
+ puts "Run Rackup Server"
+ rackupPid = Process.spawn("rackup --port #{server_port}")
+ coffeePid = Process.spawn("coffee --watch --compile --output #{coffee_out} #{coffee_src}")
+ compassPid = Process.spawn("compass watch")
+ trap("INT") {
+ [compassPid, coffeePid, rackupPid].each { |pid| Process.kill(9, pid) rescue Errno::ESRCH }
+ exit 0
+ }
+ [compassPid, coffeePid, rackupPid].each { |pid| Process.wait(pid) }
+end
+
387 coffee/script.coffee
@@ -0,0 +1,387 @@
+# === Controller ===
+
+rerender = () ->
+ resetCoordinate()
+ initializeConf()
+ dynamicRenderer()
+
+d3.select('#view-mode').on('change', () ->
+ mode = this.value
+ Conf.viewMode = 'day_view' if mode is 'day-mode'
+ Conf.viewMode = 'week_view' if mode is 'week-mode'
+ Conf.viewMode = 'month_view' if mode is 'month-mode'
+ rerender()
+)
+
+d3.select('#yaxis').on('change', () ->
+ yaxis = this.value
+ Conf.yaxis = 'tag' if yaxis is 'tag'
+ Conf.yaxis = 'notebook' if yaxis is 'notebook'
+ rerender()
+)
+
+d3.select('#go').on('click', () ->
+ year = d3.select('#year').node().value
+ month = d3.select('#month').node().value
+ Conf.start = new Date(year, month)
+ rerender()
+)
+
+d3.select('#choose-color').on('change', () ->
+ val = this.value
+ d3.select('#right').select('svg').attr('class', "#{val}")
+ d3.select('#sample').attr('class', "#{val}")
+ Conf.color = val
+)
+
+mouseover = (p) ->
+ right = d3.select('#right')[0][0]
+ left = right.scrollLeft
+ top = right.scrollTop
+ pop = d3.select('#pop')
+ date = Conf.x_days[p.x]
+ name = Conf.y_names[p.y]
+ x = p.x * Posi.tile() + Posi.rowHead + Posi.rowHeadMargin - left
+ y = p.y * Posi.tile() + Posi.dateMargin - Posi.cellSize
+
+ pop.classed('hide', false)
+ pop.style('left', "#{x}px").style('top', "#{y}px")
+ pop.select('.date').text("#{date}")
+ pop.select('.name').text("#{name}")
+ pop.select('.value').text("#{p.z}")
+
+mouseout = (p) ->
+ pop = d3.select('#pop')
+ pop.classed('hide', true)
+
+# === /Controller ===
+
+###
+=== DATA ===
+###
+# all DATA should Global access. dynamicRenderer() and Controller would access
+# following these variables.
+# == static ==
+month_format = d3.time.format("%Y-%m")
+week_format = (date) ->
+ out = Math.round((date.getDate() + 7 - date.getDay()) / 7)
+ out = 1 if out is 0
+ out = '1st' if out is 1
+ out = '2nd' if out is 2
+ out = '3rd' if out is 3
+ out = "#{out}th" if out > 3
+ "#{month_format date}-#{out}"
+day_format = d3.time.format("%Y-%m-%d")
+
+Disp = d3.select('#display')
+# == /static ==
+
+# -- dynamic
+X_disp = Disp
+Y_disp = Disp
+Cells = Disp
+
+# -- dynamic
+Conf =
+ start: do ->
+ latest = new Date().getTime()
+ half = 1 * 30 * 24 * 60 * 60 * 1000 # 30 days * 24h * 60min * 60sec
+ new Date(latest - half)
+ end: new Date()
+ color: "YlGn"
+ # color: "PuBu"
+ json: []
+ x_days: []
+ y_names: []
+ # yaxis: "notebook"
+ yaxis: "tag"
+ viewMode: 'day_view' # day_view => .day_view
+ # viewMode: 'week_view' # week_view => .week_view
+ # viewMode: 'month_view' # month_view => .month_view
+
+# -- dynamic
+Posi =
+ dateMargin: 70
+ rowHeadMargin: 7
+ rowHead: 100
+ width: 940
+ displayWidth: () ->
+ Posi.width - Posi.rowHead
+ cellSize: 18
+ cellMargin: 2
+ tile: () ->
+ Posi.cellSize + Posi.cellMargin
+
+# -- dynamic
+initializeConf = () ->
+ sta = Conf.start.getTime()
+ end = Conf.end.getTime()
+ # sta = Math.round sta
+ # end = Math.round end
+
+ if Conf.yaxis is 'notebook'
+ foo = {}
+ for item in Conf.json
+ time = item.created
+ if sta < time and time < end
+ foo[item.notebook] = null
+ Conf.y_names = Object.keys(foo).sort()
+
+ if Conf.yaxis is 'tag'
+ foo = {}
+ for item in Conf.json
+ time = item.created
+ if sta < time and time < end
+ for tag in item.tags
+ foo[tag] = null
+ Conf.y_names = Object.keys(foo).sort()
+
+ if Conf.viewMode is 'day_view'
+ Conf.x_days = d3.time.days(Conf.start, Conf.end).map((d) -> day_format d)
+ if Conf.viewMode is 'week_view'
+ Conf.x_days = d3.time.weeks(Conf.start, Conf.end).map((d) -> week_format d)
+ if Conf.viewMode is 'month_view'
+ Conf.x_days = d3.time.months(Conf.start, Conf.end).map((d) -> month_format d)
+
+ left = Disp.select('#left').append('svg')
+ .attr('width', Posi.rowHead)
+ .attr('height', Conf.y_names.length * Posi.tile() + Posi.dateMargin)
+ right = Disp.select('#right').append('svg')
+ .attr('width', () ->
+ width = Conf.x_days.length * Posi.tile() + Posi.tile() * 2
+ if width < Posi.displayWidth()
+ return Posi.displayWidth() - Posi.rowHeadMargin
+ else
+ return width )
+ .attr('height', Conf.y_names.length * Posi.tile() + Posi.dateMargin)
+ .attr('class', "#{Conf.color}")
+
+ right.append('rect')
+ .attr('x', 0)
+ .attr('y', Posi.dateMargin)
+ .attr('height', Conf.y_names.length * Posi.tile())
+ .attr('width', Conf.x_days.length * Posi.tile())
+ .attr('class', "q0-9")
+
+ X_disp = right.append('g')
+ .attr('id', 'X-disp')
+ .attr("transform", "translate(#{0}, #{Posi.dateMargin})")
+ Y_disp = left.append('g')
+ .attr('id', 'Y-disp')
+ .attr("transform", "translate(#{Posi.rowHead}, #{Posi.dateMargin + Posi.cellSize - 3})")
+ Cells = right.append('g')
+ .attr('id', 'Cells')
+ .attr("transform", "translate(#{0}, #{Posi.dateMargin})")
+
+console.log Conf
+# return false
+###
+=== /DATA ===
+###
+
+###
+=== Renderer ===
+###
+
+resetCoordinate = () ->
+ Disp.select('#left').select('svg').remove()
+ Disp.select('#right').select('svg').remove()
+ d3.select('#sample').select('g').remove()
+
+dynamicRenderer = () ->
+ ###
+ === Positioning ===
+ ###
+ # -- sample color
+ colorbrewer = d3.range(9)
+ sample = d3.select('#sample')
+ .attr('class', "#{Conf.color}")
+ .attr('width', colorbrewer.length * Posi.tile())
+ .attr('height', Posi.tile() * 1.0)
+ sample.append('g').selectAll('rect')
+ .data(colorbrewer)
+ .enter().append('rect')
+ .attr('x', (d) -> d * Posi.tile())
+ .attr('y', 0)
+ .attr('height', Posi.cellSize)
+ .attr('width', Posi.cellSize)
+ .attr('class', (d) -> "q#{d}-9")
+
+ # dynamic local settings
+ # -- dynamic
+ date_list = Conf.x_days
+ name_list = Conf.y_names
+ usm_width = 1
+ matrix = []
+
+ if Conf.viewMode is 'day_view'
+ format = day_format
+ if Conf.viewMode is 'week_view'
+ format = week_format
+ if Conf.viewMode is 'month_view'
+ format = month_format
+
+ for item,i in name_list
+ matrix[i] = d3.range(date_list.length).map((x) -> {x:x, y:i, z:0})
+
+ if Conf.yaxis is 'notebook'
+ for item in Conf.json
+ f = format new Date(item.created)
+ x = date_list.indexOf f
+ if x is -1
+ continue
+ y = name_list.indexOf item.notebook
+ if y is -1
+ continue
+ matrix[y][x].z += 1
+
+ if Conf.yaxis is 'tag'
+ for item in Conf.json
+ f = format new Date(item.created)
+ x = date_list.indexOf f
+ if x is -1
+ continue
+ for tag in item.tags
+ y = name_list.indexOf tag
+ if y is -1
+ continue
+ matrix[y][x].z += 1
+
+ row = Cells.selectAll('g')
+ .data(matrix)
+ .enter().append('g')
+ .attr("transform", (d,i) -> "translate(0, #{i * Posi.tile()})")
+
+ # X ->
+ row.append('line')
+ .attr('x1', 0)
+ .attr('x2', () -> Posi.tile() * date_list.length - 1)
+ .attr('y1', Posi.cellSize + usm_width * 0.5)
+ .attr('y2', Posi.cellSize + usm_width * 0.5)
+ .attr('stroke', 'deepskyblue')
+ .attr('stroke-width', usm_width)
+ row.append('line')
+ .attr('x1', 0)
+ .attr('x2', () -> Posi.tile() * date_list.length - 1)
+ .attr('y1', (Posi.cellSize + usm_width) + usm_width * 0.5)
+ .attr('y2', (Posi.cellSize + usm_width) + usm_width * 0.5)
+ .attr('stroke', 'white')
+ .attr('stroke-width', usm_width)
+
+ # Y |||
+ X_disp.selectAll('.shadow')
+ .data(d3.range(date_list.length + 1))
+ .enter().append('line')
+ .attr('class', 'shadow')
+ .attr('x1', (d) -> d * Posi.tile() - usm_width * 1.5)
+ .attr('x2', (d) -> d * Posi.tile() - usm_width * 1.5)
+ .attr('y1', 0)
+ .attr('y2', (d) -> Posi.tile() * Conf.y_names.length - 1)
+ .attr('stroke', 'deepskyblue')
+ .attr('stroke-width', usm_width)
+ Cells.selectAll('.back')
+ .data(d3.range(date_list.length + 1))
+ .enter().append('line')
+ .attr('class', 'back')
+ .attr('x1', (d) -> (d * Posi.tile() + usm_width) - usm_width * 1.5)
+ .attr('x2', (d) -> (d * Posi.tile() + usm_width) - usm_width * 1.5)
+ .attr('y1', 0)
+ .attr('y2', (d) -> Posi.tile() * Conf.y_names.length - 1)
+ .attr('stroke', 'white')
+ .attr('stroke-width', usm_width)
+
+ X_disp.selectAll('g')
+ .data(date_list)
+ .enter().append('g')
+ .attr("transform", (d,i) -> "translate(#{Posi.tile() * i + 10}, 0)")
+ .append('text')
+ .attr("transform", "translate(0, 0)rotate(-50)")
+ .attr('fill', "#333")
+ .style('font-size', 13)
+ .text((d) -> d)
+
+ Y_disp.selectAll('text')
+ .data(name_list)
+ .enter().append('text')
+ .attr('y', (d,i) -> Posi.tile() * i)
+ .attr('text-anchor', "end")
+ .attr('fill', "#333")
+ .style('font-size', 13)
+ .text((d) -> d)
+
+ if Conf.viewMode is 'day_view'
+ domain = [0,10]
+ if Conf.viewMode is 'week_view'
+ domain = [0,20]
+ if Conf.viewMode is 'month_view'
+ domain = [0,50]
+ scale_down = (n) ->
+ return 0 if n is 0
+ linear = d3.scale.linear()
+ .domain(domain)
+ .range([1,8])
+ out = linear(n)
+ if out > 8
+ return 8
+ else
+ return Math.round out
+ row.each((d) ->
+ d3.select(this).selectAll('rect')
+ .data(d.filter((j) -> j.z > 0))
+ .enter().append('rect')
+ .attr('class', (d) -> "#{Conf.viewMode} q#{scale_down d.z}-9")
+ .attr('height', Posi.cellSize)
+ .attr('width', Posi.cellSize)
+ .attr('x', (d,i) -> Posi.tile() * d.x)
+ .attr('y', 0) )
+
+ ###
+ === /Positioning ===
+ ###
+ ###
+ === Coloring ===
+ ###
+
+ # TODO
+ # Y
+ # -- dynamic
+ # Controller
+ Cells.selectAll('rect')
+ .on('mouseover', mouseover)
+ .on('mouseout', mouseout)
+
+ ###
+ === /Coloring ===
+ ###
+###
+=== /Renderer ===
+###
+
+###
+=== Only Once, Initialize ===
+###
+
+year_selection = () ->
+ this_year = new Date().getFullYear()
+ day_list = []
+ for item in Conf.json
+ day_list.push item.created
+ oldest = day_list.sort()[0]
+ year_range = this_year - new Date(oldest).getFullYear() + 1
+ year_range = d3.range(year_range).map((i) -> this_year - i)
+ d3.select('#year').selectAll('option')
+ .data(year_range)
+ .enter().append('option')
+ .attr('value', (d) -> d)
+ .text((d) -> d)
+
+json_url = "/static/evernote.json"
+d3.json json_url, (json) ->
+ Conf.json = json
+ initializeConf()
+ year_selection()
+ dynamicRenderer()
+
+###
+=== /Only Once, Initialize ===
+###
27 config.rb
@@ -0,0 +1,27 @@
+# Require any additional compass plugins here.
+project_type = :stand_alone
+
+# Set this to the root of your project when deployed:
+http_path = "/"
+css_dir = "public/css"
+sass_dir = "sass"
+images_dir = "public/img"
+javascripts_dir = "public/js"
+
+# You can select your preferred output style here (can be overridden via the command line):
+# output_style = :expanded or :nested or :compact or :compressed
+output_style = :compressed
+
+# To enable relative paths to assets via compass helper functions. Uncomment:
+# relative_assets = true
+
+# To disable debugging comments that display the original location of your selectors. Uncomment:
+# line_comments = false
+line_comments = false
+
+
+# If you prefer the indented syntax, you might want to regenerate this
+# project again passing --syntax sass, or you can uncomment this:
+# preferred_syntax = :sass
+# and then run:
+# sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass
24 config.ru
@@ -0,0 +1,24 @@
+require 'sinatra/base'
+
+# The project root directory
+$root = ::File.dirname(__FILE__)
+
+class SinatraStaticServer < Sinatra::Base
+
+ get(/.+/) do
+ send_sinatra_file(request.path) {404}
+ end
+
+ not_found do
+ send_sinatra_file('404.html') {"Sorry, I cannot find #{request.path}"}
+ end
+
+ def send_sinatra_file(path, &missing_file_block)
+ file_path = File.join(File.dirname(__FILE__), 'public', path)
+ file_path = File.join(file_path, 'index.html') unless file_path =~ /\.[a-z]+$/i
+ File.exist?(file_path) ? send_file(file_path) : missing_file_block.call
+ end
+
+end
+
+run SinatraStaticServer
16 evernote-sdk-ruby/client.rb
@@ -0,0 +1,16 @@
+require 'json'
+require './enclient'
+require '~/scripts/rubylibs/util'
+
+src = "../../personal/evernote-heatmap.json"
+out = '../public/static/evernote.json'
+# out = './out.json'
+
+obj = JSON.parse Util.read_file(src)
+client = ENClient.new(obj["authToken"])
+# p client
+# exit
+oo = client.guid_name
+# p oo
+# Util.write_file(out, client.guid_name.to_json)
+Util.write_file(out, oo.to_json)
23 evernote-sdk-ruby/debug.rb
@@ -0,0 +1,23 @@
+oo.each do |note|
+ begin
+ p note.to_json
+ rescue Encoding::UndefinedConversionError
+ puts "=== Error ==="
+ # p note
+ p note['tags'][0].force_encoding('utf-8').encoding
+ # p note['tags'][0].encode('utf-8', 'ascii-8bit')
+ end
+end
+
+Encoding.name_list.each do |codec|
+ begin
+ puts '---'
+ p codec
+ p s.encode(codec)
+ rescue
+ # rescue Encoding::UndefinedConversionError
+ puts "=== Error ==="
+ p codec
+ end
+end
+
138 evernote-sdk-ruby/en-sql.rb
@@ -0,0 +1,138 @@
+require 'sqlite3'
+require 'csv'
+require '~/scripts/rubylibs/util'
+
+# user settings
+csv_out = './evernote.csv'
+user_name = 'NAME'
+db_path = "#{Dir.home()}/Library/Application Support/Evernote/accounts/Evernote/#{user_name}/Evernote.sql"
+# End of user settings
+
+def bind_row(bef, aft)
+ unless bef.class == Array and aft.class == Array
+ raise TypeError
+ end
+ bef + aft
+end
+
+def add_row(bef, aft)
+ unless bef.class == Array and aft.class == Array
+ raise TypeError
+ end
+ bef + [aft]
+end
+
+def exec(db, query)
+ out = []
+ db.execute query do |row|
+ out = add_row out, row
+ end
+ out
+end
+
+def list_names(pk_list)
+ out = []
+ pk_list.each do |row|
+ out = bind_row out, [row[1]]
+ end
+ out
+end
+
+q_tags = <<-EOF
+SELECT
+Z_PK, ZNAME2
+FROM ZENATTRIBUTEDENTITY
+WHERE Z_ENT=17
+EOF
+
+q_notebooks = <<-EOF
+SELECT
+Z_PK, ZNAME
+FROM ZENATTRIBUTEDENTITY
+WHERE Z_ENT=13
+EOF
+
+q_all_notes = <<-EOF
+SELECT
+Z_PK, ZNOTEBOOK1, ZCREATED
+FROM ZENATTRIBUTEDENTITY
+WHERE Z_ENT=12
+EOF
+
+q_tags_and_notebook = <<-EOF
+SELECT
+Z_12NOTES, Z_17TAGS
+FROM Z_12TAGS
+EOF
+
+db = SQLite3::Database.new db_path
+csv = ['PK', 'Date', 'Name']
+csv_string = ''
+pk_tags = exec(db, q_tags)
+pk_notebooks = exec(db, q_notebooks)
+pk_all_notes = exec(db, q_all_notes)
+tags_and_notebook = exec(db, q_tags_and_notebook)
+tag_names = list_names pk_tags
+notebook_names = list_names pk_notebooks
+
+# main
+def find_pk_name(pk_list, pk)
+ out = nil
+ pk_list.each do |row|
+ if row[0] == pk
+ name = row[1]
+ out = name
+ break
+ end
+ end
+ out
+end
+
+def fill_row(name_lists, name)
+ row = []
+ name_lists.each do |n|
+ if n == name
+ row = bind_row(row, [1])
+ else
+ row = bind_row(row, [0])
+ end
+ end
+ row
+end
+
+def std_stamp(time)
+ (time + 978307200).round
+end
+
+csv = add_row([], csv)
+# csv = bind_row(csv, notebook_names)
+# csv = add_row([], csv)
+
+pk_all_notes.each do |note_row|
+ row = []
+ pk = note_row[0]
+ notebook = note_row[1]
+ created = note_row[2]
+ row = bind_row(row, [pk])
+ row = bind_row(row, [std_stamp(created)])
+
+ row = bind_row(row, [find_pk_name(pk_notebooks, notebook)])
+
+ # notebook looping
+ # name = find_pk_name(pk_notebooks, notebook)
+ # row = bind_row(row, fill_row(notebook_names, name))
+
+ csv = add_row(csv, row)
+end
+
+csv.map do |row|
+ p row[1]
+end
+p 'hello'
+p csv
+
+# csv.each do |row|
+ # csv_string = csv_string << row.to_csv
+# end
+
+# Util.write_file(csv_out, csv_string)
137 evernote-sdk-ruby/enclient.rb
@@ -0,0 +1,137 @@
+# Add the Thrift & Evernote Ruby libraries to the load path.
+# This will only work if you run this application from the ruby/sample/client
+# directory of the Evernote API SDK.
+dir = File.expand_path(File.dirname(__FILE__))
+$LOAD_PATH.push("#{dir}/lib")
+$LOAD_PATH.push("#{dir}/lib/thrift")
+$LOAD_PATH.push("#{dir}/lib/Evernote/EDAM")
+
+require "thrift/types"
+require "thrift/struct"
+require "thrift/protocol/base_protocol"
+require "thrift/protocol/binary_protocol"
+require "thrift/transport/base_transport"
+require "thrift/transport/http_client_transport"
+require "Evernote/EDAM/user_store"
+require "Evernote/EDAM/user_store_constants.rb"
+require "Evernote/EDAM/note_store"
+require "Evernote/EDAM/limits_constants.rb"
+
+class ENClient
+ attr_accessor :token, :noteStore, :tags, :notebooks
+ # attr_accessor :token, :evernoteHost, :userStoreUrl,
+ # :userStoreTransport, :userStoreProtocol, :userStore,
+ # :notesStoreTransport, :notesStoreProtocol, :notesStore
+
+ # Pbublic: Initialize a new client.
+ #
+ # authToken - Developer Token.
+ def initialize(authToken)
+ if (authToken == "your developer token" or authToken == "")
+ puts "Please fill in your developer token"
+ puts "To get a developer token, visit https://sandbox.evernote.com/api/DeveloperToken.action"
+ exit(1)
+ end
+
+ # Initial development is performed on our sandbox server. To use the production
+ # service, change "sandbox.evernote.com" to "www.evernote.com" and replace your
+ # developer token above with a token from
+ # https://www.evernote.com/api/DeveloperToken.action
+ evernoteHost = "www.evernote.com"
+ userStoreUrl = "https://#{evernoteHost}/edam/user"
+
+ userStoreTransport = Thrift::HTTPClientTransport.new(userStoreUrl)
+ userStoreProtocol = Thrift::BinaryProtocol.new(userStoreTransport)
+ userStore = Evernote::EDAM::UserStore::UserStore::Client.new(userStoreProtocol)
+
+ versionOK = userStore.checkVersion("Evernote EDAMTest (Ruby)",
+ Evernote::EDAM::UserStore::EDAM_VERSION_MAJOR,
+ Evernote::EDAM::UserStore::EDAM_VERSION_MINOR)
+ if (!versionOK)
+ puts "Is my Evernote API version up to date? #{versionOK}"
+ exit(1)
+ end
+
+ # Get the URL used to interact with the contents of the user's account
+ # When your application authenticates using OAuth, the NoteStore URL will
+ # be returned along with the auth token in the final OAuth request.
+ # In that case, you don't need to make this call.
+ noteStoreUrl = userStore.getNoteStoreUrl(authToken)
+
+ noteStoreTransport = Thrift::HTTPClientTransport.new(noteStoreUrl)
+ noteStoreProtocol = Thrift::BinaryProtocol.new(noteStoreTransport)
+ noteStore = Evernote::EDAM::NoteStore::NoteStore::Client.new(noteStoreProtocol)
+
+ self.token = authToken
+ self.noteStore = noteStore
+ self.notebooks = self.all_notebooks
+ self.tags = self.all_tags
+ end
+
+ def all_notebooks
+ out = {}
+ self.noteStore.listNotebooks(self.token).each do |notebook|
+ out[notebook.guid] = notebook.name
+ end
+ out
+ end
+
+ def all_tags
+ out = {}
+ self.noteStore.listTags(self.token).each do |tag|
+ out[tag.guid] = tag.name
+ end
+ out
+ end
+
+ def all_notes
+ out = []
+ notebooks = self.noteStore.listNotebooks(self.token)
+ notebooks.each do |notebook|
+ offset = 0
+ pageSize = 100
+
+ filter = Evernote::EDAM::NoteStore::NoteFilter.new
+ filter.notebookGuid = notebook.guid
+
+ spec = Evernote::EDAM::NoteStore::NotesMetadataResultSpec.new
+ spec.includeNotebookGuid = true
+ spec.includeTitle = true
+ spec.includeCreated = true
+ spec.includeTagGuids = true
+
+ noteList = self.noteStore.findNotesMetadata(self.token, filter, offset, pageSize, spec)
+ while 0 <= (noteList.totalNotes - (noteList.startIndex + noteList.notes.length))
+ noteList.notes.each do |meta|
+ out.push meta
+ end
+ offset = offset + pageSize
+ noteList = self.noteStore.findNotesMetadata(self.token, filter, offset, pageSize, spec)
+ end
+ end
+ out
+ end
+
+ def guid_name
+ out = []
+ self.all_notes.each do |note|
+ hash = {"guid" => "", "created" => 0, "notebook" => "", "tags" => []}
+ hash["guid"] = note.guid
+ hash["created"] = note.created
+ hash["notebook"] = self.notebooks[note.notebookGuid].force_encoding('utf-8')
+ tags = []
+ unless note.tagGuids == nil
+ note.tagGuids.each do |guid|
+ tags.push self.tags[guid].force_encoding('utf-8')
+ end
+ end
+ hash['tags'] = tags
+ out.push hash
+ end
+ out
+ end
+
+end # /ENClient
+
+# client = ENClient.new(authToken)
+# notes = client.all_notes
14 evernote-sdk-ruby/lib/Evernote/EDAM/errors_constants.rb
@@ -0,0 +1,14 @@
+#
+# 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
128 evernote-sdk-ruby/lib/Evernote/EDAM/errors_types.rb
@@ -0,0 +1,128 @@
+#
+# 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
240 evernote-sdk-ruby/lib/Evernote/EDAM/limits_constants.rb
@@ -0,0 +1,240 @@
+#
+# 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"
+
+ end
+ end
+end
13 evernote-sdk-ruby/lib/Evernote/EDAM/limits_types.rb
@@ -0,0 +1,13 @@
+#
+# 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
5,487 evernote-sdk-ruby/lib/Evernote/EDAM/note_store.rb
5,487 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
14 evernote-sdk-ruby/lib/Evernote/EDAM/note_store_constants.rb
@@ -0,0 +1,14 @@
+#
+# 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
1,012 evernote-sdk-ruby/lib/Evernote/EDAM/note_store_types.rb
@@ -0,0 +1,1012 @@
+#
+# 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>