lingara 0.1.0.pre.alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +21 -0
  3. data/README.md +142 -0
  4. data/lib/lingara/access_token.rb +47 -0
  5. data/lib/lingara/client.rb +182 -0
  6. data/lib/lingara/client_credentials.rb +176 -0
  7. data/lib/lingara/deprecation.rb +128 -0
  8. data/lib/lingara/errors.rb +162 -0
  9. data/lib/lingara/event_stream.rb +135 -0
  10. data/lib/lingara/models/allowance_row.rb +378 -0
  11. data/lib/lingara/models/create_lesson_plan_event_error.rb +287 -0
  12. data/lib/lingara/models/create_lesson_plan_event_phase.rb +287 -0
  13. data/lib/lingara/models/create_lesson_plan_event_result.rb +287 -0
  14. data/lib/lingara/models/create_lesson_plan_event_started.rb +287 -0
  15. data/lib/lingara/models/error_envelope.rb +264 -0
  16. data/lib/lingara/models/generate_vocabulary_event_done.rb +287 -0
  17. data/lib/lingara/models/generate_vocabulary_event_error.rb +287 -0
  18. data/lib/lingara/models/generate_vocabulary_event_item.rb +287 -0
  19. data/lib/lingara/models/generate_vocabulary_event_started.rb +287 -0
  20. data/lib/lingara/models/lesson_plan.rb +463 -0
  21. data/lib/lingara/models/lesson_plan_content.rb +305 -0
  22. data/lib/lingara/models/lesson_plan_create_request.rb +333 -0
  23. data/lib/lingara/models/notice.rb +263 -0
  24. data/lib/lingara/models/plan_pending.rb +285 -0
  25. data/lib/lingara/models/plan_phase.rb +281 -0
  26. data/lib/lingara/models/plan_question.rb +337 -0
  27. data/lib/lingara/models/plan_result.rb +237 -0
  28. data/lib/lingara/models/plan_set.rb +293 -0
  29. data/lib/lingara/models/plan_started.rb +237 -0
  30. data/lib/lingara/models/plan_status.rb +42 -0
  31. data/lib/lingara/models/plan_word.rb +273 -0
  32. data/lib/lingara/models/send_tutor_message_event_delta.rb +287 -0
  33. data/lib/lingara/models/send_tutor_message_event_done.rb +287 -0
  34. data/lib/lingara/models/send_tutor_message_event_error.rb +287 -0
  35. data/lib/lingara/models/send_tutor_message_event_notice.rb +287 -0
  36. data/lib/lingara/models/stream_error.rb +273 -0
  37. data/lib/lingara/models/stream_lesson_plan_event_error.rb +287 -0
  38. data/lib/lingara/models/stream_lesson_plan_event_pending.rb +287 -0
  39. data/lib/lingara/models/stream_lesson_plan_event_phase.rb +287 -0
  40. data/lib/lingara/models/stream_lesson_plan_event_result.rb +287 -0
  41. data/lib/lingara/models/stream_lesson_plan_event_started.rb +287 -0
  42. data/lib/lingara/models/turn_delta.rb +237 -0
  43. data/lib/lingara/models/turn_entry.rb +285 -0
  44. data/lib/lingara/models/turn_role.rb +41 -0
  45. data/lib/lingara/models/tutor_turn_request.rb +354 -0
  46. data/lib/lingara/models/usage.rb +250 -0
  47. data/lib/lingara/models/usage_ledger.rb +307 -0
  48. data/lib/lingara/models/version_detail.rb +415 -0
  49. data/lib/lingara/models/version_history_entry.rb +285 -0
  50. data/lib/lingara/models/version_list.rb +263 -0
  51. data/lib/lingara/models/version_spec.rb +249 -0
  52. data/lib/lingara/models/version_state.rb +44 -0
  53. data/lib/lingara/models/version_summary.rb +349 -0
  54. data/lib/lingara/models/vocab_example.rb +263 -0
  55. data/lib/lingara/models/vocab_item.rb +303 -0
  56. data/lib/lingara/models/vocab_meta.rb +394 -0
  57. data/lib/lingara/models/vocab_request.rb +341 -0
  58. data/lib/lingara/models/vocab_started.rb +237 -0
  59. data/lib/lingara/operations.rb +91 -0
  60. data/lib/lingara/response.rb +46 -0
  61. data/lib/lingara/retry.rb +88 -0
  62. data/lib/lingara/sse_decoder.rb +80 -0
  63. data/lib/lingara/streams.rb +104 -0
  64. data/lib/lingara/transport.rb +131 -0
  65. data/lib/lingara/user_agent.rb +24 -0
  66. data/lib/lingara/version.rb +13 -0
  67. data/lib/lingara.rb +23 -0
  68. data/sig/lingara.rbs +151 -0
  69. metadata +114 -0
@@ -0,0 +1,394 @@
1
+ =begin
2
+ #Lingara API
3
+
4
+ #Generate vocabulary lists and lesson plans, and hold tutor conversations, in the languages Lingara teaches. Each call is paid for by the client that makes it: an `allowance` client spends its owner's allowance, and a `metered` client is billed for its usage.
5
+
6
+ The version of the OpenAPI document: 2026-09-glowing-hoatzin
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.14.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Lingara
17
+ class VocabMeta
18
+ attr_accessor :level
19
+
20
+ attr_accessor :source_lang
21
+
22
+ attr_accessor :target_lang
23
+
24
+ attr_accessor :framework
25
+
26
+ attr_accessor :count
27
+
28
+ attr_accessor :ai_generated
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'level' => :'level',
34
+ :'source_lang' => :'source_lang',
35
+ :'target_lang' => :'target_lang',
36
+ :'framework' => :'framework',
37
+ :'count' => :'count',
38
+ :'ai_generated' => :'ai_generated'
39
+ }
40
+ end
41
+
42
+ # Returns attribute mapping this model knows about
43
+ def self.acceptable_attribute_map
44
+ attribute_map
45
+ end
46
+
47
+ # Returns all the JSON keys this model knows about
48
+ def self.acceptable_attributes
49
+ acceptable_attribute_map.values
50
+ end
51
+
52
+ # Attribute type mapping.
53
+ def self.openapi_types
54
+ {
55
+ :'level' => :'Integer',
56
+ :'source_lang' => :'String',
57
+ :'target_lang' => :'String',
58
+ :'framework' => :'String',
59
+ :'count' => :'Integer',
60
+ :'ai_generated' => :'Boolean'
61
+ }
62
+ end
63
+
64
+ # List of attributes with nullable: true
65
+ def self.openapi_nullable
66
+ Set.new([
67
+ ])
68
+ end
69
+
70
+ # Initializes the object
71
+ # @param [Hash] attributes Model attributes in the form of hash
72
+ def initialize(attributes = {})
73
+ if (!attributes.is_a?(Hash))
74
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Lingara::VocabMeta` initialize method"
75
+ end
76
+
77
+ # check to see if the attribute exists and convert string to symbol for hash key
78
+ acceptable_attribute_map = self.class.acceptable_attribute_map
79
+ attributes = attributes.each_with_object({}) { |(k, v), h|
80
+ if (!acceptable_attribute_map.key?(k.to_sym))
81
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Lingara::VocabMeta`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
82
+ end
83
+ h[k.to_sym] = v
84
+ }
85
+
86
+ if attributes.key?(:'level')
87
+ self.level = attributes[:'level']
88
+ else
89
+ self.level = nil
90
+ end
91
+
92
+ if attributes.key?(:'source_lang')
93
+ self.source_lang = attributes[:'source_lang']
94
+ else
95
+ self.source_lang = nil
96
+ end
97
+
98
+ if attributes.key?(:'target_lang')
99
+ self.target_lang = attributes[:'target_lang']
100
+ else
101
+ self.target_lang = nil
102
+ end
103
+
104
+ if attributes.key?(:'framework')
105
+ self.framework = attributes[:'framework']
106
+ else
107
+ self.framework = nil
108
+ end
109
+
110
+ if attributes.key?(:'count')
111
+ self.count = attributes[:'count']
112
+ else
113
+ self.count = nil
114
+ end
115
+
116
+ if attributes.key?(:'ai_generated')
117
+ self.ai_generated = attributes[:'ai_generated']
118
+ else
119
+ self.ai_generated = nil
120
+ end
121
+ end
122
+
123
+ # Show invalid properties with the reasons. Usually used together with valid?
124
+ # @return Array for valid properties with the reasons
125
+ def list_invalid_properties
126
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
127
+ invalid_properties = Array.new
128
+ if @level.nil?
129
+ invalid_properties.push('invalid value for "level", level cannot be nil.')
130
+ end
131
+
132
+ if @level > 255
133
+ invalid_properties.push('invalid value for "level", must be smaller than or equal to 255.')
134
+ end
135
+
136
+ if @level < 0
137
+ invalid_properties.push('invalid value for "level", must be greater than or equal to 0.')
138
+ end
139
+
140
+ if @source_lang.nil?
141
+ invalid_properties.push('invalid value for "source_lang", source_lang cannot be nil.')
142
+ end
143
+
144
+ if @target_lang.nil?
145
+ invalid_properties.push('invalid value for "target_lang", target_lang cannot be nil.')
146
+ end
147
+
148
+ if @framework.nil?
149
+ invalid_properties.push('invalid value for "framework", framework cannot be nil.')
150
+ end
151
+
152
+ if @count.nil?
153
+ invalid_properties.push('invalid value for "count", count cannot be nil.')
154
+ end
155
+
156
+ if @count < 0
157
+ invalid_properties.push('invalid value for "count", must be greater than or equal to 0.')
158
+ end
159
+
160
+ if @ai_generated.nil?
161
+ invalid_properties.push('invalid value for "ai_generated", ai_generated cannot be nil.')
162
+ end
163
+
164
+ invalid_properties
165
+ end
166
+
167
+ # Check to see if the all the properties in the model are valid
168
+ # @return true if the model is valid
169
+ def valid?
170
+ warn '[DEPRECATED] the `valid?` method is obsolete'
171
+ return false if @level.nil?
172
+ return false if @level > 255
173
+ return false if @level < 0
174
+ return false if @source_lang.nil?
175
+ return false if @target_lang.nil?
176
+ return false if @framework.nil?
177
+ return false if @count.nil?
178
+ return false if @count < 0
179
+ return false if @ai_generated.nil?
180
+ true
181
+ end
182
+
183
+ # Custom attribute writer method with validation
184
+ # @param [Object] level Value to be assigned
185
+ def level=(level)
186
+ if level.nil?
187
+ fail ArgumentError, 'level cannot be nil'
188
+ end
189
+
190
+ if level > 255
191
+ fail ArgumentError, 'invalid value for "level", must be smaller than or equal to 255.'
192
+ end
193
+
194
+ if level < 0
195
+ fail ArgumentError, 'invalid value for "level", must be greater than or equal to 0.'
196
+ end
197
+
198
+ @level = level
199
+ end
200
+
201
+ # Custom attribute writer method with validation
202
+ # @param [Object] source_lang Value to be assigned
203
+ def source_lang=(source_lang)
204
+ if source_lang.nil?
205
+ fail ArgumentError, 'source_lang cannot be nil'
206
+ end
207
+
208
+ @source_lang = source_lang
209
+ end
210
+
211
+ # Custom attribute writer method with validation
212
+ # @param [Object] target_lang Value to be assigned
213
+ def target_lang=(target_lang)
214
+ if target_lang.nil?
215
+ fail ArgumentError, 'target_lang cannot be nil'
216
+ end
217
+
218
+ @target_lang = target_lang
219
+ end
220
+
221
+ # Custom attribute writer method with validation
222
+ # @param [Object] framework Value to be assigned
223
+ def framework=(framework)
224
+ if framework.nil?
225
+ fail ArgumentError, 'framework cannot be nil'
226
+ end
227
+
228
+ @framework = framework
229
+ end
230
+
231
+ # Custom attribute writer method with validation
232
+ # @param [Object] count Value to be assigned
233
+ def count=(count)
234
+ if count.nil?
235
+ fail ArgumentError, 'count cannot be nil'
236
+ end
237
+
238
+ if count < 0
239
+ fail ArgumentError, 'invalid value for "count", must be greater than or equal to 0.'
240
+ end
241
+
242
+ @count = count
243
+ end
244
+
245
+ # Custom attribute writer method with validation
246
+ # @param [Object] ai_generated Value to be assigned
247
+ def ai_generated=(ai_generated)
248
+ if ai_generated.nil?
249
+ fail ArgumentError, 'ai_generated cannot be nil'
250
+ end
251
+
252
+ @ai_generated = ai_generated
253
+ end
254
+
255
+ # Checks equality by comparing each attribute.
256
+ # @param [Object] Object to be compared
257
+ def ==(o)
258
+ return true if self.equal?(o)
259
+ self.class == o.class &&
260
+ level == o.level &&
261
+ source_lang == o.source_lang &&
262
+ target_lang == o.target_lang &&
263
+ framework == o.framework &&
264
+ count == o.count &&
265
+ ai_generated == o.ai_generated
266
+ end
267
+
268
+ # @see the `==` method
269
+ # @param [Object] Object to be compared
270
+ def eql?(o)
271
+ self == o
272
+ end
273
+
274
+ # Calculates hash code according to all attributes.
275
+ # @return [Integer] Hash code
276
+ def hash
277
+ [level, source_lang, target_lang, framework, count, ai_generated].hash
278
+ end
279
+
280
+ # Builds the object from hash
281
+ # @param [Hash] attributes Model attributes in the form of hash
282
+ # @return [Object] Returns the model itself
283
+ def self.build_from_hash(attributes)
284
+ return nil unless attributes.is_a?(Hash)
285
+ attributes = attributes.transform_keys(&:to_sym)
286
+ transformed_hash = {}
287
+ openapi_types.each_pair do |key, type|
288
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
289
+ transformed_hash["#{key}"] = nil
290
+ elsif type =~ /\AArray<(.*)>/i
291
+ # check to ensure the input is an array given that the attribute
292
+ # is documented as an array but the input is not
293
+ if attributes[attribute_map[key]].is_a?(Array)
294
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
295
+ end
296
+ elsif !attributes[attribute_map[key]].nil?
297
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
298
+ end
299
+ end
300
+ new(transformed_hash)
301
+ end
302
+
303
+ # Deserializes the data based on type
304
+ # @param string type Data type
305
+ # @param string value Value to be deserialized
306
+ # @return [Object] Deserialized data
307
+ def self._deserialize(type, value)
308
+ case type.to_sym
309
+ when :Time
310
+ Time.parse(value)
311
+ when :Date
312
+ Date.parse(value)
313
+ when :String
314
+ value.to_s
315
+ when :Integer
316
+ value.to_i
317
+ when :Float
318
+ value.to_f
319
+ when :Boolean
320
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
321
+ true
322
+ else
323
+ false
324
+ end
325
+ when :Object
326
+ # generic object (usually a Hash), return directly
327
+ value
328
+ when /\AArray<(?<inner_type>.+)>\z/
329
+ inner_type = Regexp.last_match[:inner_type]
330
+ value.map { |v| _deserialize(inner_type, v) }
331
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
332
+ k_type = Regexp.last_match[:k_type]
333
+ v_type = Regexp.last_match[:v_type]
334
+ {}.tap do |hash|
335
+ value.each do |k, v|
336
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
337
+ end
338
+ end
339
+ else # model
340
+ # models (e.g. Pet) or oneOf
341
+ klass = Lingara.const_get(type)
342
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
343
+ end
344
+ end
345
+
346
+ # Returns the string representation of the object
347
+ # @return [String] String presentation of the object
348
+ def to_s
349
+ to_hash.to_s
350
+ end
351
+
352
+ # to_body is an alias to to_hash (backward compatibility)
353
+ # @return [Hash] Returns the object in the form of hash
354
+ def to_body
355
+ to_hash
356
+ end
357
+
358
+ # Returns the object in the form of hash
359
+ # @return [Hash] Returns the object in the form of hash
360
+ def to_hash
361
+ hash = {}
362
+ self.class.attribute_map.each_pair do |attr, param|
363
+ value = self.send(attr)
364
+ if value.nil?
365
+ is_nullable = self.class.openapi_nullable.include?(attr)
366
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
367
+ end
368
+
369
+ hash[param] = _to_hash(value)
370
+ end
371
+ hash
372
+ end
373
+
374
+ # Outputs non-array value in the form of hash
375
+ # For object, use to_hash. Otherwise, just return the value
376
+ # @param [Object] value Any valid value
377
+ # @return [Hash] Returns the value in the form of hash
378
+ def _to_hash(value)
379
+ if value.is_a?(Array)
380
+ value.compact.map { |v| _to_hash(v) }
381
+ elsif value.is_a?(Hash)
382
+ {}.tap do |hash|
383
+ value.each { |k, v| hash[k] = _to_hash(v) }
384
+ end
385
+ elsif value.respond_to? :to_hash
386
+ value.to_hash
387
+ else
388
+ value
389
+ end
390
+ end
391
+
392
+ end
393
+
394
+ end