evernote 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,363 @@
1
+ #
2
+ # Autogenerated by Thrift
3
+ #
4
+ # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
+ #
6
+
7
+ require 'thrift'
8
+ require 'user_store_types'
9
+
10
+ module Evernote
11
+ module EDAM
12
+ module UserStore
13
+ module UserStore
14
+ class Client
15
+ include ::Thrift::Client
16
+
17
+ def checkVersion(clientName, edamVersionMajor, edamVersionMinor)
18
+ send_checkVersion(clientName, edamVersionMajor, edamVersionMinor)
19
+ return recv_checkVersion()
20
+ end
21
+
22
+ def send_checkVersion(clientName, edamVersionMajor, edamVersionMinor)
23
+ send_message('checkVersion', CheckVersion_args, :clientName => clientName, :edamVersionMajor => edamVersionMajor, :edamVersionMinor => edamVersionMinor)
24
+ end
25
+
26
+ def recv_checkVersion()
27
+ result = receive_message(CheckVersion_result)
28
+ return result.success unless result.success.nil?
29
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'checkVersion failed: unknown result')
30
+ end
31
+
32
+ def authenticate(username, password, consumerKey, consumerSecret)
33
+ send_authenticate(username, password, consumerKey, consumerSecret)
34
+ return recv_authenticate()
35
+ end
36
+
37
+ def send_authenticate(username, password, consumerKey, consumerSecret)
38
+ send_message('authenticate', Authenticate_args, :username => username, :password => password, :consumerKey => consumerKey, :consumerSecret => consumerSecret)
39
+ end
40
+
41
+ def recv_authenticate()
42
+ result = receive_message(Authenticate_result)
43
+ return result.success unless result.success.nil?
44
+ raise result.userException unless result.userException.nil?
45
+ raise result.systemException unless result.systemException.nil?
46
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'authenticate failed: unknown result')
47
+ end
48
+
49
+ def refreshAuthentication(authenticationToken)
50
+ send_refreshAuthentication(authenticationToken)
51
+ return recv_refreshAuthentication()
52
+ end
53
+
54
+ def send_refreshAuthentication(authenticationToken)
55
+ send_message('refreshAuthentication', RefreshAuthentication_args, :authenticationToken => authenticationToken)
56
+ end
57
+
58
+ def recv_refreshAuthentication()
59
+ result = receive_message(RefreshAuthentication_result)
60
+ return result.success unless result.success.nil?
61
+ raise result.userException unless result.userException.nil?
62
+ raise result.systemException unless result.systemException.nil?
63
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'refreshAuthentication failed: unknown result')
64
+ end
65
+
66
+ def getUser(authenticationToken)
67
+ send_getUser(authenticationToken)
68
+ return recv_getUser()
69
+ end
70
+
71
+ def send_getUser(authenticationToken)
72
+ send_message('getUser', GetUser_args, :authenticationToken => authenticationToken)
73
+ end
74
+
75
+ def recv_getUser()
76
+ result = receive_message(GetUser_result)
77
+ return result.success unless result.success.nil?
78
+ raise result.userException unless result.userException.nil?
79
+ raise result.systemException unless result.systemException.nil?
80
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getUser failed: unknown result')
81
+ end
82
+
83
+ def getPublicUserInfo(username)
84
+ send_getPublicUserInfo(username)
85
+ return recv_getPublicUserInfo()
86
+ end
87
+
88
+ def send_getPublicUserInfo(username)
89
+ send_message('getPublicUserInfo', GetPublicUserInfo_args, :username => username)
90
+ end
91
+
92
+ def recv_getPublicUserInfo()
93
+ result = receive_message(GetPublicUserInfo_result)
94
+ return result.success unless result.success.nil?
95
+ raise result.notFoundException unless result.notFoundException.nil?
96
+ raise result.systemException unless result.systemException.nil?
97
+ raise result.userException unless result.userException.nil?
98
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getPublicUserInfo failed: unknown result')
99
+ end
100
+
101
+ end
102
+
103
+ class Processor
104
+ include ::Thrift::Processor
105
+
106
+ def process_checkVersion(seqid, iprot, oprot)
107
+ args = read_args(iprot, CheckVersion_args)
108
+ result = CheckVersion_result.new()
109
+ result.success = @handler.checkVersion(args.clientName, args.edamVersionMajor, args.edamVersionMinor)
110
+ write_result(result, oprot, 'checkVersion', seqid)
111
+ end
112
+
113
+ def process_authenticate(seqid, iprot, oprot)
114
+ args = read_args(iprot, Authenticate_args)
115
+ result = Authenticate_result.new()
116
+ begin
117
+ result.success = @handler.authenticate(args.username, args.password, args.consumerKey, args.consumerSecret)
118
+ rescue Evernote::EDAM::Error::EDAMUserException => userException
119
+ result.userException = userException
120
+ rescue Evernote::EDAM::Error::EDAMSystemException => systemException
121
+ result.systemException = systemException
122
+ end
123
+ write_result(result, oprot, 'authenticate', seqid)
124
+ end
125
+
126
+ def process_refreshAuthentication(seqid, iprot, oprot)
127
+ args = read_args(iprot, RefreshAuthentication_args)
128
+ result = RefreshAuthentication_result.new()
129
+ begin
130
+ result.success = @handler.refreshAuthentication(args.authenticationToken)
131
+ rescue Evernote::EDAM::Error::EDAMUserException => userException
132
+ result.userException = userException
133
+ rescue Evernote::EDAM::Error::EDAMSystemException => systemException
134
+ result.systemException = systemException
135
+ end
136
+ write_result(result, oprot, 'refreshAuthentication', seqid)
137
+ end
138
+
139
+ def process_getUser(seqid, iprot, oprot)
140
+ args = read_args(iprot, GetUser_args)
141
+ result = GetUser_result.new()
142
+ begin
143
+ result.success = @handler.getUser(args.authenticationToken)
144
+ rescue Evernote::EDAM::Error::EDAMUserException => userException
145
+ result.userException = userException
146
+ rescue Evernote::EDAM::Error::EDAMSystemException => systemException
147
+ result.systemException = systemException
148
+ end
149
+ write_result(result, oprot, 'getUser', seqid)
150
+ end
151
+
152
+ def process_getPublicUserInfo(seqid, iprot, oprot)
153
+ args = read_args(iprot, GetPublicUserInfo_args)
154
+ result = GetPublicUserInfo_result.new()
155
+ begin
156
+ result.success = @handler.getPublicUserInfo(args.username)
157
+ rescue Evernote::EDAM::Error::EDAMNotFoundException => notFoundException
158
+ result.notFoundException = notFoundException
159
+ rescue Evernote::EDAM::Error::EDAMSystemException => systemException
160
+ result.systemException = systemException
161
+ rescue Evernote::EDAM::Error::EDAMUserException => userException
162
+ result.userException = userException
163
+ end
164
+ write_result(result, oprot, 'getPublicUserInfo', seqid)
165
+ end
166
+
167
+ end
168
+
169
+ # HELPER FUNCTIONS AND STRUCTURES
170
+
171
+ class CheckVersion_args
172
+ include ::Thrift::Struct
173
+ CLIENTNAME = 1
174
+ EDAMVERSIONMAJOR = 2
175
+ EDAMVERSIONMINOR = 3
176
+
177
+ ::Thrift::Struct.field_accessor self, :clientName, :edamVersionMajor, :edamVersionMinor
178
+ FIELDS = {
179
+ CLIENTNAME => {:type => ::Thrift::Types::STRING, :name => 'clientName'},
180
+ EDAMVERSIONMAJOR => {:type => ::Thrift::Types::I16, :name => 'edamVersionMajor', :default => 1},
181
+ EDAMVERSIONMINOR => {:type => ::Thrift::Types::I16, :name => 'edamVersionMinor', :default => 14}
182
+ }
183
+
184
+ def struct_fields; FIELDS; end
185
+
186
+ def validate
187
+ end
188
+
189
+ end
190
+
191
+ class CheckVersion_result
192
+ include ::Thrift::Struct
193
+ SUCCESS = 0
194
+
195
+ ::Thrift::Struct.field_accessor self, :success
196
+ FIELDS = {
197
+ SUCCESS => {:type => ::Thrift::Types::BOOL, :name => 'success'}
198
+ }
199
+
200
+ def struct_fields; FIELDS; end
201
+
202
+ def validate
203
+ end
204
+
205
+ end
206
+
207
+ class Authenticate_args
208
+ include ::Thrift::Struct
209
+ USERNAME = 1
210
+ PASSWORD = 2
211
+ CONSUMERKEY = 3
212
+ CONSUMERSECRET = 4
213
+
214
+ ::Thrift::Struct.field_accessor self, :username, :password, :consumerKey, :consumerSecret
215
+ FIELDS = {
216
+ USERNAME => {:type => ::Thrift::Types::STRING, :name => 'username'},
217
+ PASSWORD => {:type => ::Thrift::Types::STRING, :name => 'password'},
218
+ CONSUMERKEY => {:type => ::Thrift::Types::STRING, :name => 'consumerKey'},
219
+ CONSUMERSECRET => {:type => ::Thrift::Types::STRING, :name => 'consumerSecret'}
220
+ }
221
+
222
+ def struct_fields; FIELDS; end
223
+
224
+ def validate
225
+ end
226
+
227
+ end
228
+
229
+ class Authenticate_result
230
+ include ::Thrift::Struct
231
+ SUCCESS = 0
232
+ USEREXCEPTION = 1
233
+ SYSTEMEXCEPTION = 2
234
+
235
+ ::Thrift::Struct.field_accessor self, :success, :userException, :systemException
236
+ FIELDS = {
237
+ SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => Evernote::EDAM::UserStore::AuthenticationResult},
238
+ USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException},
239
+ SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}
240
+ }
241
+
242
+ def struct_fields; FIELDS; end
243
+
244
+ def validate
245
+ end
246
+
247
+ end
248
+
249
+ class RefreshAuthentication_args
250
+ include ::Thrift::Struct
251
+ AUTHENTICATIONTOKEN = 1
252
+
253
+ ::Thrift::Struct.field_accessor self, :authenticationToken
254
+ FIELDS = {
255
+ AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}
256
+ }
257
+
258
+ def struct_fields; FIELDS; end
259
+
260
+ def validate
261
+ end
262
+
263
+ end
264
+
265
+ class RefreshAuthentication_result
266
+ include ::Thrift::Struct
267
+ SUCCESS = 0
268
+ USEREXCEPTION = 1
269
+ SYSTEMEXCEPTION = 2
270
+
271
+ ::Thrift::Struct.field_accessor self, :success, :userException, :systemException
272
+ FIELDS = {
273
+ SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => Evernote::EDAM::UserStore::AuthenticationResult},
274
+ USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException},
275
+ SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}
276
+ }
277
+
278
+ def struct_fields; FIELDS; end
279
+
280
+ def validate
281
+ end
282
+
283
+ end
284
+
285
+ class GetUser_args
286
+ include ::Thrift::Struct
287
+ AUTHENTICATIONTOKEN = 1
288
+
289
+ ::Thrift::Struct.field_accessor self, :authenticationToken
290
+ FIELDS = {
291
+ AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'}
292
+ }
293
+
294
+ def struct_fields; FIELDS; end
295
+
296
+ def validate
297
+ end
298
+
299
+ end
300
+
301
+ class GetUser_result
302
+ include ::Thrift::Struct
303
+ SUCCESS = 0
304
+ USEREXCEPTION = 1
305
+ SYSTEMEXCEPTION = 2
306
+
307
+ ::Thrift::Struct.field_accessor self, :success, :userException, :systemException
308
+ FIELDS = {
309
+ SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => Evernote::EDAM::Type::User},
310
+ USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException},
311
+ SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException}
312
+ }
313
+
314
+ def struct_fields; FIELDS; end
315
+
316
+ def validate
317
+ end
318
+
319
+ end
320
+
321
+ class GetPublicUserInfo_args
322
+ include ::Thrift::Struct
323
+ USERNAME = 1
324
+
325
+ ::Thrift::Struct.field_accessor self, :username
326
+ FIELDS = {
327
+ USERNAME => {:type => ::Thrift::Types::STRING, :name => 'username'}
328
+ }
329
+
330
+ def struct_fields; FIELDS; end
331
+
332
+ def validate
333
+ end
334
+
335
+ end
336
+
337
+ class GetPublicUserInfo_result
338
+ include ::Thrift::Struct
339
+ SUCCESS = 0
340
+ NOTFOUNDEXCEPTION = 1
341
+ SYSTEMEXCEPTION = 2
342
+ USEREXCEPTION = 3
343
+
344
+ ::Thrift::Struct.field_accessor self, :success, :notFoundException, :systemException, :userException
345
+ FIELDS = {
346
+ SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => Evernote::EDAM::UserStore::PublicUserInfo},
347
+ NOTFOUNDEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'notFoundException', :class => Evernote::EDAM::Error::EDAMNotFoundException},
348
+ SYSTEMEXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'systemException', :class => Evernote::EDAM::Error::EDAMSystemException},
349
+ USEREXCEPTION => {:type => ::Thrift::Types::STRUCT, :name => 'userException', :class => Evernote::EDAM::Error::EDAMUserException}
350
+ }
351
+
352
+ def struct_fields; FIELDS; end
353
+
354
+ def validate
355
+ end
356
+
357
+ end
358
+
359
+ end
360
+
361
+ end
362
+ end
363
+ end
@@ -0,0 +1,18 @@
1
+ #
2
+ # Autogenerated by Thrift
3
+ #
4
+ # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
+ #
6
+
7
+ require 'user_store_types'
8
+
9
+ module Evernote
10
+ module EDAM
11
+ module UserStore
12
+ EDAM_VERSION_MAJOR = 1
13
+
14
+ EDAM_VERSION_MINOR = 14
15
+
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,123 @@
1
+ #
2
+ # Autogenerated by Thrift
3
+ #
4
+ # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
+ #
6
+
7
+ require 'types_types'
8
+ require 'errors_types'
9
+
10
+
11
+ module Evernote
12
+ module EDAM
13
+ module UserStore
14
+ # This structure is used to provide publicly-available user information
15
+ # about a particular account.
16
+ # <dl>
17
+ # <dt>userId:</dt>
18
+ # <dd>
19
+ # The unique numeric user identifier for the user account.
20
+ # </dd>
21
+ # <dt>shardId:</dt>
22
+ # <dd>
23
+ # The name of the virtual server that manages the state of
24
+ # this user. This value is used internally to determine which system should
25
+ # service requests about this user's data. It is also used to construct
26
+ # the appropriate URL to make requests from the NoteStore.
27
+ # </dd>
28
+ # <dt>privilege:</dt>
29
+ # <dd>
30
+ # The privilege level of the account, to determine whether
31
+ # this is a Premium or Free account.
32
+ # </dd>
33
+ # </dl>
34
+ class PublicUserInfo
35
+ include ::Thrift::Struct
36
+ USERID = 1
37
+ SHARDID = 2
38
+ PRIVILEGE = 3
39
+ USERNAME = 4
40
+
41
+ ::Thrift::Struct.field_accessor self, :userId, :shardId, :privilege, :username
42
+ FIELDS = {
43
+ USERID => {:type => ::Thrift::Types::I32, :name => 'userId'},
44
+ SHARDID => {:type => ::Thrift::Types::STRING, :name => 'shardId'},
45
+ PRIVILEGE => {:type => ::Thrift::Types::I32, :name => 'privilege', :optional => true, :enum_class => Evernote::EDAM::Type::PrivilegeLevel},
46
+ USERNAME => {:type => ::Thrift::Types::STRING, :name => 'username', :optional => true}
47
+ }
48
+
49
+ def struct_fields; FIELDS; end
50
+
51
+ def validate
52
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field userId is unset!') unless @userId
53
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field shardId is unset!') unless @shardId
54
+ unless @privilege.nil? || Evernote::EDAM::Type::PrivilegeLevel::VALID_VALUES.include?(@privilege)
55
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field privilege!')
56
+ end
57
+ end
58
+
59
+ end
60
+
61
+ # When an authentication (or re-authentication) is performed, this structure
62
+ # provides the result to the client.
63
+ # <dl>
64
+ # <dt>currentTime:</dt>
65
+ # <dd>
66
+ # The server-side date and time when this result was
67
+ # generated.
68
+ # </dd>
69
+ # <dt>authenticationToken:</dt>
70
+ # <dd>
71
+ # Holds an opaque, ASCII-encoded token that can be
72
+ # used by the client to perform actions on a NoteStore.
73
+ # </dd>
74
+ # <dt>expiration:</dt>
75
+ # <dd>
76
+ # Holds the server-side date and time when the
77
+ # authentication token will expire.
78
+ # This time can be compared to "currentTime" to produce an expiration
79
+ # time that can be reconciled with the client's local clock.
80
+ # </dd>
81
+ # <dt>user:</dt>
82
+ # <dd>
83
+ # Holds the information about the account which was
84
+ # authenticated if this was a full authentication. May be absent if this
85
+ # particular authentication did not require user information.
86
+ # </dd>
87
+ # <dt>publicUserInfo:</dt>
88
+ # <dd>
89
+ # If this authentication result was achieved without full permissions to
90
+ # access the full User structure, this field may be set to give back
91
+ # a more limited public set of data.
92
+ # </dd>
93
+ # </dl>
94
+ class AuthenticationResult
95
+ include ::Thrift::Struct
96
+ CURRENTTIME = 1
97
+ AUTHENTICATIONTOKEN = 2
98
+ EXPIRATION = 3
99
+ USER = 4
100
+ PUBLICUSERINFO = 5
101
+
102
+ ::Thrift::Struct.field_accessor self, :currentTime, :authenticationToken, :expiration, :user, :publicUserInfo
103
+ FIELDS = {
104
+ CURRENTTIME => {:type => ::Thrift::Types::I64, :name => 'currentTime'},
105
+ AUTHENTICATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'authenticationToken'},
106
+ EXPIRATION => {:type => ::Thrift::Types::I64, :name => 'expiration'},
107
+ USER => {:type => ::Thrift::Types::STRUCT, :name => 'user', :class => Evernote::EDAM::Type::User, :optional => true},
108
+ PUBLICUSERINFO => {:type => ::Thrift::Types::STRUCT, :name => 'publicUserInfo', :class => Evernote::EDAM::UserStore::PublicUserInfo, :optional => true}
109
+ }
110
+
111
+ def struct_fields; FIELDS; end
112
+
113
+ def validate
114
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field currentTime is unset!') unless @currentTime
115
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field authenticationToken is unset!') unless @authenticationToken
116
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field expiration is unset!') unless @expiration
117
+ end
118
+
119
+ end
120
+
121
+ end
122
+ end
123
+ end