lingara 0.1.0.pre.alpha.13 → 0.2.0.pre.alpha.3

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 (97) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +74 -2
  3. data/lib/lingara/client.rb +78 -10
  4. data/lib/lingara/events/catalogue.rb +20 -2
  5. data/lib/lingara/minted_token.rb +73 -0
  6. data/lib/lingara/models/allowance_row.rb +1 -1
  7. data/lib/lingara/models/app_context_slice.rb +1 -1
  8. data/lib/lingara/models/app_disabled_data.rb +263 -0
  9. data/lib/lingara/models/app_enabled_data.rb +263 -0
  10. data/lib/lingara/models/app_installed_data.rb +1 -1
  11. data/lib/lingara/models/app_uninstalled_data.rb +1 -1
  12. data/lib/lingara/models/create_lesson_plan_event_error.rb +1 -1
  13. data/lib/lingara/models/create_lesson_plan_event_phase.rb +1 -1
  14. data/lib/lingara/models/create_lesson_plan_event_result.rb +1 -1
  15. data/lib/lingara/models/create_lesson_plan_event_started.rb +1 -1
  16. data/lib/lingara/models/dialogue_entry.rb +303 -0
  17. data/lib/lingara/models/dialogue_turn_request.rb +442 -0
  18. data/lib/lingara/models/embed_player_link.rb +427 -0
  19. data/lib/lingara/models/embed_token.rb +379 -0
  20. data/lib/lingara/models/embed_token_request.rb +331 -0
  21. data/lib/lingara/models/error_envelope.rb +1 -1
  22. data/lib/lingara/models/event_envelope.rb +1 -1
  23. data/lib/lingara/models/event_page.rb +1 -1
  24. data/lib/lingara/models/generate_vocabulary_event_done.rb +1 -1
  25. data/lib/lingara/models/generate_vocabulary_event_error.rb +1 -1
  26. data/lib/lingara/models/generate_vocabulary_event_item.rb +1 -1
  27. data/lib/lingara/models/generate_vocabulary_event_started.rb +1 -1
  28. data/lib/lingara/models/inbound_event_accepted.rb +1 -1
  29. data/lib/lingara/models/lesson_plan.rb +1 -1
  30. data/lib/lingara/models/lesson_plan_content.rb +1 -1
  31. data/lib/lingara/models/lesson_plan_create_request.rb +1 -1
  32. data/lib/lingara/models/lesson_plan_failed_data.rb +1 -1
  33. data/lib/lingara/models/lesson_plan_ready_data.rb +1 -1
  34. data/lib/lingara/models/link_status.rb +41 -0
  35. data/lib/lingara/models/notice.rb +1 -1
  36. data/lib/lingara/models/npc.rb +1 -1
  37. data/lib/lingara/models/plan_fail_reason.rb +1 -1
  38. data/lib/lingara/models/plan_pending.rb +1 -1
  39. data/lib/lingara/models/plan_phase.rb +1 -1
  40. data/lib/lingara/models/plan_question.rb +1 -1
  41. data/lib/lingara/models/plan_ready_status.rb +1 -1
  42. data/lib/lingara/models/plan_result.rb +1 -1
  43. data/lib/lingara/models/plan_set.rb +1 -1
  44. data/lib/lingara/models/plan_started.rb +1 -1
  45. data/lib/lingara/models/plan_status.rb +1 -1
  46. data/lib/lingara/models/plan_word.rb +1 -1
  47. data/lib/lingara/models/practice_completed_data.rb +291 -0
  48. data/lib/lingara/models/practice_item.rb +347 -0
  49. data/lib/lingara/models/practice_outcome.rb +45 -0
  50. data/lib/lingara/models/reaction_report.rb +1 -1
  51. data/lib/lingara/models/reaction_status.rb +1 -1
  52. data/lib/lingara/models/send_dialogue_turn_event_delta.rb +287 -0
  53. data/lib/lingara/models/send_dialogue_turn_event_done.rb +287 -0
  54. data/lib/lingara/models/send_dialogue_turn_event_error.rb +287 -0
  55. data/lib/lingara/models/send_dialogue_turn_event_notice.rb +287 -0
  56. data/lib/lingara/models/send_tutor_message_event_delta.rb +1 -1
  57. data/lib/lingara/models/send_tutor_message_event_done.rb +1 -1
  58. data/lib/lingara/models/send_tutor_message_event_error.rb +1 -1
  59. data/lib/lingara/models/send_tutor_message_event_notice.rb +1 -1
  60. data/lib/lingara/models/speaker.rb +41 -0
  61. data/lib/lingara/models/stream_error.rb +1 -1
  62. data/lib/lingara/models/stream_events_event_done.rb +1 -1
  63. data/lib/lingara/models/stream_events_event_error.rb +1 -1
  64. data/lib/lingara/models/stream_events_event_event.rb +1 -1
  65. data/lib/lingara/models/stream_lesson_plan_event_error.rb +1 -1
  66. data/lib/lingara/models/stream_lesson_plan_event_pending.rb +1 -1
  67. data/lib/lingara/models/stream_lesson_plan_event_phase.rb +1 -1
  68. data/lib/lingara/models/stream_lesson_plan_event_result.rb +1 -1
  69. data/lib/lingara/models/stream_lesson_plan_event_started.rb +1 -1
  70. data/lib/lingara/models/threshold_scope.rb +1 -1
  71. data/lib/lingara/models/turn_delta.rb +1 -1
  72. data/lib/lingara/models/turn_entry.rb +1 -1
  73. data/lib/lingara/models/turn_role.rb +1 -1
  74. data/lib/lingara/models/tutor_turn_request.rb +1 -1
  75. data/lib/lingara/models/usage.rb +1 -1
  76. data/lib/lingara/models/usage_ledger.rb +1 -1
  77. data/lib/lingara/models/usage_threshold_reached_data.rb +1 -1
  78. data/lib/lingara/models/version_detail.rb +1 -1
  79. data/lib/lingara/models/version_history_entry.rb +1 -1
  80. data/lib/lingara/models/version_list.rb +1 -1
  81. data/lib/lingara/models/version_spec.rb +1 -1
  82. data/lib/lingara/models/version_state.rb +1 -1
  83. data/lib/lingara/models/version_summary.rb +1 -1
  84. data/lib/lingara/models/vocab_example.rb +1 -1
  85. data/lib/lingara/models/vocab_item.rb +1 -1
  86. data/lib/lingara/models/vocab_meta.rb +1 -1
  87. data/lib/lingara/models/vocab_request.rb +1 -1
  88. data/lib/lingara/models/vocab_started.rb +1 -1
  89. data/lib/lingara/models/world_context_changed.rb +1 -1
  90. data/lib/lingara/models/world_practice_completed.rb +294 -0
  91. data/lib/lingara/models/world_practice_requested.rb +1 -1
  92. data/lib/lingara/operations.rb +45 -0
  93. data/lib/lingara/streams.rb +25 -0
  94. data/lib/lingara/version.rb +3 -3
  95. data/lib/lingara.rb +1 -0
  96. data/sig/lingara.rbs +36 -0
  97. metadata +20 -2
@@ -0,0 +1,442 @@
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-10-virile-dragon
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 DialogueTurnRequest
18
+ attr_accessor :npc
19
+
20
+ attr_accessor :scene
21
+
22
+ attr_accessor :source_lang
23
+
24
+ attr_accessor :target_lang
25
+
26
+ attr_accessor :level
27
+
28
+ attr_accessor :line
29
+
30
+ # The conversation so far, oldest first, at most 12 lines. You keep the window: Lingara stores nothing between turns. Send each NPC reply back cut to its first 500 characters.
31
+ attr_accessor :history
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'npc' => :'npc',
37
+ :'scene' => :'scene',
38
+ :'source_lang' => :'source_lang',
39
+ :'target_lang' => :'target_lang',
40
+ :'level' => :'level',
41
+ :'line' => :'line',
42
+ :'history' => :'history'
43
+ }
44
+ end
45
+
46
+ # Returns attribute mapping this model knows about
47
+ def self.acceptable_attribute_map
48
+ attribute_map
49
+ end
50
+
51
+ # Returns all the JSON keys this model knows about
52
+ def self.acceptable_attributes
53
+ acceptable_attribute_map.values
54
+ end
55
+
56
+ # Attribute type mapping.
57
+ def self.openapi_types
58
+ {
59
+ :'npc' => :'Npc',
60
+ :'scene' => :'String',
61
+ :'source_lang' => :'String',
62
+ :'target_lang' => :'String',
63
+ :'level' => :'Integer',
64
+ :'line' => :'String',
65
+ :'history' => :'Array<DialogueEntry>'
66
+ }
67
+ end
68
+
69
+ # List of attributes with nullable: true
70
+ def self.openapi_nullable
71
+ Set.new([
72
+ :'scene',
73
+ ])
74
+ end
75
+
76
+ # Initializes the object
77
+ # @param [Hash] attributes Model attributes in the form of hash
78
+ def initialize(attributes = {})
79
+ if (!attributes.is_a?(Hash))
80
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Lingara::DialogueTurnRequest` initialize method"
81
+ end
82
+
83
+ # check to see if the attribute exists and convert string to symbol for hash key
84
+ acceptable_attribute_map = self.class.acceptable_attribute_map
85
+ attributes = attributes.each_with_object({}) { |(k, v), h|
86
+ if (!acceptable_attribute_map.key?(k.to_sym))
87
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Lingara::DialogueTurnRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
88
+ end
89
+ h[k.to_sym] = v
90
+ }
91
+
92
+ if attributes.key?(:'npc')
93
+ self.npc = attributes[:'npc']
94
+ else
95
+ self.npc = nil
96
+ end
97
+
98
+ if attributes.key?(:'scene')
99
+ self.scene = attributes[:'scene']
100
+ end
101
+
102
+ if attributes.key?(:'source_lang')
103
+ self.source_lang = attributes[:'source_lang']
104
+ else
105
+ self.source_lang = nil
106
+ end
107
+
108
+ if attributes.key?(:'target_lang')
109
+ self.target_lang = attributes[:'target_lang']
110
+ else
111
+ self.target_lang = nil
112
+ end
113
+
114
+ if attributes.key?(:'level')
115
+ self.level = attributes[:'level']
116
+ else
117
+ self.level = nil
118
+ end
119
+
120
+ if attributes.key?(:'line')
121
+ self.line = attributes[:'line']
122
+ else
123
+ self.line = nil
124
+ end
125
+
126
+ if attributes.key?(:'history')
127
+ if (value = attributes[:'history']).is_a?(Array)
128
+ self.history = value
129
+ end
130
+ end
131
+ end
132
+
133
+ # Show invalid properties with the reasons. Usually used together with valid?
134
+ # @return Array for valid properties with the reasons
135
+ def list_invalid_properties
136
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
137
+ invalid_properties = Array.new
138
+ if @npc.nil?
139
+ invalid_properties.push('invalid value for "npc", npc cannot be nil.')
140
+ end
141
+
142
+ if !@scene.nil? && @scene.to_s.length > 160
143
+ invalid_properties.push('invalid value for "scene", the character length must be smaller than or equal to 160.')
144
+ end
145
+
146
+ if !@scene.nil? && @scene.to_s.length < 1
147
+ invalid_properties.push('invalid value for "scene", the character length must be greater than or equal to 1.')
148
+ end
149
+
150
+ if @source_lang.nil?
151
+ invalid_properties.push('invalid value for "source_lang", source_lang cannot be nil.')
152
+ end
153
+
154
+ if @target_lang.nil?
155
+ invalid_properties.push('invalid value for "target_lang", target_lang cannot be nil.')
156
+ end
157
+
158
+ if @level.nil?
159
+ invalid_properties.push('invalid value for "level", level cannot be nil.')
160
+ end
161
+
162
+ if @level > 9
163
+ invalid_properties.push('invalid value for "level", must be smaller than or equal to 9.')
164
+ end
165
+
166
+ if @level < 1
167
+ invalid_properties.push('invalid value for "level", must be greater than or equal to 1.')
168
+ end
169
+
170
+ if @line.nil?
171
+ invalid_properties.push('invalid value for "line", line cannot be nil.')
172
+ end
173
+
174
+ if @line.to_s.length > 500
175
+ invalid_properties.push('invalid value for "line", the character length must be smaller than or equal to 500.')
176
+ end
177
+
178
+ if @line.to_s.length < 1
179
+ invalid_properties.push('invalid value for "line", the character length must be greater than or equal to 1.')
180
+ end
181
+
182
+ if !@history.nil? && @history.length > 12
183
+ invalid_properties.push('invalid value for "history", number of items must be less than or equal to 12.')
184
+ end
185
+
186
+ invalid_properties
187
+ end
188
+
189
+ # Check to see if the all the properties in the model are valid
190
+ # @return true if the model is valid
191
+ def valid?
192
+ warn '[DEPRECATED] the `valid?` method is obsolete'
193
+ return false if @npc.nil?
194
+ return false if !@scene.nil? && @scene.to_s.length > 160
195
+ return false if !@scene.nil? && @scene.to_s.length < 1
196
+ return false if @source_lang.nil?
197
+ return false if @target_lang.nil?
198
+ return false if @level.nil?
199
+ return false if @level > 9
200
+ return false if @level < 1
201
+ return false if @line.nil?
202
+ return false if @line.to_s.length > 500
203
+ return false if @line.to_s.length < 1
204
+ return false if !@history.nil? && @history.length > 12
205
+ true
206
+ end
207
+
208
+ # Custom attribute writer method with validation
209
+ # @param [Object] npc Value to be assigned
210
+ def npc=(npc)
211
+ if npc.nil?
212
+ fail ArgumentError, 'npc cannot be nil'
213
+ end
214
+
215
+ @npc = npc
216
+ end
217
+
218
+ # Custom attribute writer method with validation
219
+ # @param [Object] scene Value to be assigned
220
+ def scene=(scene)
221
+ if !scene.nil? && scene.to_s.length > 160
222
+ fail ArgumentError, 'invalid value for "scene", the character length must be smaller than or equal to 160.'
223
+ end
224
+
225
+ if !scene.nil? && scene.to_s.length < 1
226
+ fail ArgumentError, 'invalid value for "scene", the character length must be greater than or equal to 1.'
227
+ end
228
+
229
+ @scene = scene
230
+ end
231
+
232
+ # Custom attribute writer method with validation
233
+ # @param [Object] source_lang Value to be assigned
234
+ def source_lang=(source_lang)
235
+ if source_lang.nil?
236
+ fail ArgumentError, 'source_lang cannot be nil'
237
+ end
238
+
239
+ @source_lang = source_lang
240
+ end
241
+
242
+ # Custom attribute writer method with validation
243
+ # @param [Object] target_lang Value to be assigned
244
+ def target_lang=(target_lang)
245
+ if target_lang.nil?
246
+ fail ArgumentError, 'target_lang cannot be nil'
247
+ end
248
+
249
+ @target_lang = target_lang
250
+ end
251
+
252
+ # Custom attribute writer method with validation
253
+ # @param [Object] level Value to be assigned
254
+ def level=(level)
255
+ if level.nil?
256
+ fail ArgumentError, 'level cannot be nil'
257
+ end
258
+
259
+ if level > 9
260
+ fail ArgumentError, 'invalid value for "level", must be smaller than or equal to 9.'
261
+ end
262
+
263
+ if level < 1
264
+ fail ArgumentError, 'invalid value for "level", must be greater than or equal to 1.'
265
+ end
266
+
267
+ @level = level
268
+ end
269
+
270
+ # Custom attribute writer method with validation
271
+ # @param [Object] line Value to be assigned
272
+ def line=(line)
273
+ if line.nil?
274
+ fail ArgumentError, 'line cannot be nil'
275
+ end
276
+
277
+ if line.to_s.length > 500
278
+ fail ArgumentError, 'invalid value for "line", the character length must be smaller than or equal to 500.'
279
+ end
280
+
281
+ if line.to_s.length < 1
282
+ fail ArgumentError, 'invalid value for "line", the character length must be greater than or equal to 1.'
283
+ end
284
+
285
+ @line = line
286
+ end
287
+
288
+ # Custom attribute writer method with validation
289
+ # @param [Object] history Value to be assigned
290
+ def history=(history)
291
+ if history.nil?
292
+ fail ArgumentError, 'history cannot be nil'
293
+ end
294
+
295
+ if history.length > 12
296
+ fail ArgumentError, 'invalid value for "history", number of items must be less than or equal to 12.'
297
+ end
298
+
299
+ @history = history
300
+ end
301
+
302
+ # Checks equality by comparing each attribute.
303
+ # @param [Object] Object to be compared
304
+ def ==(o)
305
+ return true if self.equal?(o)
306
+ self.class == o.class &&
307
+ npc == o.npc &&
308
+ scene == o.scene &&
309
+ source_lang == o.source_lang &&
310
+ target_lang == o.target_lang &&
311
+ level == o.level &&
312
+ line == o.line &&
313
+ history == o.history
314
+ end
315
+
316
+ # @see the `==` method
317
+ # @param [Object] Object to be compared
318
+ def eql?(o)
319
+ self == o
320
+ end
321
+
322
+ # Calculates hash code according to all attributes.
323
+ # @return [Integer] Hash code
324
+ def hash
325
+ [npc, scene, source_lang, target_lang, level, line, history].hash
326
+ end
327
+
328
+ # Builds the object from hash
329
+ # @param [Hash] attributes Model attributes in the form of hash
330
+ # @return [Object] Returns the model itself
331
+ def self.build_from_hash(attributes)
332
+ return nil unless attributes.is_a?(Hash)
333
+ attributes = attributes.transform_keys(&:to_sym)
334
+ transformed_hash = {}
335
+ openapi_types.each_pair do |key, type|
336
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
337
+ transformed_hash["#{key}"] = nil
338
+ elsif type =~ /\AArray<(.*)>/i
339
+ # check to ensure the input is an array given that the attribute
340
+ # is documented as an array but the input is not
341
+ if attributes[attribute_map[key]].is_a?(Array)
342
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
343
+ end
344
+ elsif !attributes[attribute_map[key]].nil?
345
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
346
+ end
347
+ end
348
+ new(transformed_hash)
349
+ end
350
+
351
+ # Deserializes the data based on type
352
+ # @param string type Data type
353
+ # @param string value Value to be deserialized
354
+ # @return [Object] Deserialized data
355
+ def self._deserialize(type, value)
356
+ case type.to_sym
357
+ when :Time
358
+ Time.parse(value)
359
+ when :Date
360
+ Date.parse(value)
361
+ when :String
362
+ value.to_s
363
+ when :Integer
364
+ value.to_i
365
+ when :Float
366
+ value.to_f
367
+ when :Boolean
368
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
369
+ true
370
+ else
371
+ false
372
+ end
373
+ when :Object
374
+ # generic object (usually a Hash), return directly
375
+ value
376
+ when /\AArray<(?<inner_type>.+)>\z/
377
+ inner_type = Regexp.last_match[:inner_type]
378
+ value.map { |v| _deserialize(inner_type, v) }
379
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
380
+ k_type = Regexp.last_match[:k_type]
381
+ v_type = Regexp.last_match[:v_type]
382
+ {}.tap do |hash|
383
+ value.each do |k, v|
384
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
385
+ end
386
+ end
387
+ else # model
388
+ # models (e.g. Pet) or oneOf
389
+ klass = Lingara.const_get(type)
390
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
391
+ end
392
+ end
393
+
394
+ # Returns the string representation of the object
395
+ # @return [String] String presentation of the object
396
+ def to_s
397
+ to_hash.to_s
398
+ end
399
+
400
+ # to_body is an alias to to_hash (backward compatibility)
401
+ # @return [Hash] Returns the object in the form of hash
402
+ def to_body
403
+ to_hash
404
+ end
405
+
406
+ # Returns the object in the form of hash
407
+ # @return [Hash] Returns the object in the form of hash
408
+ def to_hash
409
+ hash = {}
410
+ self.class.attribute_map.each_pair do |attr, param|
411
+ value = self.send(attr)
412
+ if value.nil?
413
+ is_nullable = self.class.openapi_nullable.include?(attr)
414
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
415
+ end
416
+
417
+ hash[param] = _to_hash(value)
418
+ end
419
+ hash
420
+ end
421
+
422
+ # Outputs non-array value in the form of hash
423
+ # For object, use to_hash. Otherwise, just return the value
424
+ # @param [Object] value Any valid value
425
+ # @return [Hash] Returns the value in the form of hash
426
+ def _to_hash(value)
427
+ if value.is_a?(Array)
428
+ value.compact.map { |v| _to_hash(v) }
429
+ elsif value.is_a?(Hash)
430
+ {}.tap do |hash|
431
+ value.each { |k, v| hash[k] = _to_hash(v) }
432
+ end
433
+ elsif value.respond_to? :to_hash
434
+ value.to_hash
435
+ else
436
+ value
437
+ end
438
+ end
439
+
440
+ end
441
+
442
+ end