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,427 @@
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 EmbedPlayerLink
18
+ attr_accessor :status
19
+
20
+ # The account's `lgr_sub_`: what this player's events carry from now on.
21
+ attr_accessor :subject
22
+
23
+ # The guest's `lgr_sub_`: what the player's earlier events keep. Route both to the same `player_ref`.
24
+ attr_accessor :previous_subject
25
+
26
+ # When the link was made. On an `existing` answer, the first call's time.
27
+ attr_accessor :linked_at
28
+
29
+ # The most a token for this player can now hold: what the account granted, of the scopes a player's token can carry.
30
+ attr_accessor :scopes
31
+
32
+ # Rows this call moved to the account, per table. Only tables with a count appear.
33
+ attr_accessor :carried
34
+
35
+ # Rows this call left with the guest, per table: a plan still being written, or a row the account already had. Call again once `lesson_plans` here has a plan that has finished.
36
+ attr_accessor :kept
37
+
38
+ class EnumAttributeValidator
39
+ attr_reader :datatype
40
+ attr_reader :allowable_values
41
+
42
+ def initialize(datatype, allowable_values)
43
+ @allowable_values = allowable_values.map do |value|
44
+ case datatype.to_s
45
+ when /Integer/i
46
+ value.to_i
47
+ when /Float/i
48
+ value.to_f
49
+ else
50
+ value
51
+ end
52
+ end
53
+ end
54
+
55
+ def valid?(value)
56
+ !value || allowable_values.include?(value)
57
+ end
58
+ end
59
+
60
+ # Attribute mapping from ruby-style variable name to JSON key.
61
+ def self.attribute_map
62
+ {
63
+ :'status' => :'status',
64
+ :'subject' => :'subject',
65
+ :'previous_subject' => :'previous_subject',
66
+ :'linked_at' => :'linked_at',
67
+ :'scopes' => :'scopes',
68
+ :'carried' => :'carried',
69
+ :'kept' => :'kept'
70
+ }
71
+ end
72
+
73
+ # Returns attribute mapping this model knows about
74
+ def self.acceptable_attribute_map
75
+ attribute_map
76
+ end
77
+
78
+ # Returns all the JSON keys this model knows about
79
+ def self.acceptable_attributes
80
+ acceptable_attribute_map.values
81
+ end
82
+
83
+ # Attribute type mapping.
84
+ def self.openapi_types
85
+ {
86
+ :'status' => :'LinkStatus',
87
+ :'subject' => :'String',
88
+ :'previous_subject' => :'String',
89
+ :'linked_at' => :'Time',
90
+ :'scopes' => :'Array<String>',
91
+ :'carried' => :'Hash<String, Integer>',
92
+ :'kept' => :'Hash<String, Integer>'
93
+ }
94
+ end
95
+
96
+ # List of attributes with nullable: true
97
+ def self.openapi_nullable
98
+ Set.new([
99
+ ])
100
+ end
101
+
102
+ # Initializes the object
103
+ # @param [Hash] attributes Model attributes in the form of hash
104
+ def initialize(attributes = {})
105
+ if (!attributes.is_a?(Hash))
106
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Lingara::EmbedPlayerLink` initialize method"
107
+ end
108
+
109
+ # check to see if the attribute exists and convert string to symbol for hash key
110
+ acceptable_attribute_map = self.class.acceptable_attribute_map
111
+ attributes = attributes.each_with_object({}) { |(k, v), h|
112
+ if (!acceptable_attribute_map.key?(k.to_sym))
113
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Lingara::EmbedPlayerLink`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
114
+ end
115
+ h[k.to_sym] = v
116
+ }
117
+
118
+ if attributes.key?(:'status')
119
+ self.status = attributes[:'status']
120
+ else
121
+ self.status = nil
122
+ end
123
+
124
+ if attributes.key?(:'subject')
125
+ self.subject = attributes[:'subject']
126
+ else
127
+ self.subject = nil
128
+ end
129
+
130
+ if attributes.key?(:'previous_subject')
131
+ self.previous_subject = attributes[:'previous_subject']
132
+ else
133
+ self.previous_subject = nil
134
+ end
135
+
136
+ if attributes.key?(:'linked_at')
137
+ self.linked_at = attributes[:'linked_at']
138
+ else
139
+ self.linked_at = nil
140
+ end
141
+
142
+ if attributes.key?(:'scopes')
143
+ if (value = attributes[:'scopes']).is_a?(Array)
144
+ self.scopes = value
145
+ end
146
+ else
147
+ self.scopes = nil
148
+ end
149
+
150
+ if attributes.key?(:'carried')
151
+ if (value = attributes[:'carried']).is_a?(Hash)
152
+ self.carried = value
153
+ end
154
+ else
155
+ self.carried = nil
156
+ end
157
+
158
+ if attributes.key?(:'kept')
159
+ if (value = attributes[:'kept']).is_a?(Hash)
160
+ self.kept = value
161
+ end
162
+ else
163
+ self.kept = nil
164
+ end
165
+ end
166
+
167
+ # Show invalid properties with the reasons. Usually used together with valid?
168
+ # @return Array for valid properties with the reasons
169
+ def list_invalid_properties
170
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
171
+ invalid_properties = Array.new
172
+ if @status.nil?
173
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
174
+ end
175
+
176
+ if @subject.nil?
177
+ invalid_properties.push('invalid value for "subject", subject cannot be nil.')
178
+ end
179
+
180
+ if @previous_subject.nil?
181
+ invalid_properties.push('invalid value for "previous_subject", previous_subject cannot be nil.')
182
+ end
183
+
184
+ if @linked_at.nil?
185
+ invalid_properties.push('invalid value for "linked_at", linked_at cannot be nil.')
186
+ end
187
+
188
+ if @scopes.nil?
189
+ invalid_properties.push('invalid value for "scopes", scopes cannot be nil.')
190
+ end
191
+
192
+ if @carried.nil?
193
+ invalid_properties.push('invalid value for "carried", carried cannot be nil.')
194
+ end
195
+
196
+ if @kept.nil?
197
+ invalid_properties.push('invalid value for "kept", kept cannot be nil.')
198
+ end
199
+
200
+ invalid_properties
201
+ end
202
+
203
+ # Check to see if the all the properties in the model are valid
204
+ # @return true if the model is valid
205
+ def valid?
206
+ warn '[DEPRECATED] the `valid?` method is obsolete'
207
+ return false if @status.nil?
208
+ return false if @subject.nil?
209
+ return false if @previous_subject.nil?
210
+ return false if @linked_at.nil?
211
+ return false if @scopes.nil?
212
+ return false if @carried.nil?
213
+ return false if @kept.nil?
214
+ true
215
+ end
216
+
217
+ # Custom attribute writer method with validation
218
+ # @param [Object] status Value to be assigned
219
+ def status=(status)
220
+ if status.nil?
221
+ fail ArgumentError, 'status cannot be nil'
222
+ end
223
+
224
+ @status = status
225
+ end
226
+
227
+ # Custom attribute writer method with validation
228
+ # @param [Object] subject Value to be assigned
229
+ def subject=(subject)
230
+ if subject.nil?
231
+ fail ArgumentError, 'subject cannot be nil'
232
+ end
233
+
234
+ @subject = subject
235
+ end
236
+
237
+ # Custom attribute writer method with validation
238
+ # @param [Object] previous_subject Value to be assigned
239
+ def previous_subject=(previous_subject)
240
+ if previous_subject.nil?
241
+ fail ArgumentError, 'previous_subject cannot be nil'
242
+ end
243
+
244
+ @previous_subject = previous_subject
245
+ end
246
+
247
+ # Custom attribute writer method with validation
248
+ # @param [Object] linked_at Value to be assigned
249
+ def linked_at=(linked_at)
250
+ if linked_at.nil?
251
+ fail ArgumentError, 'linked_at cannot be nil'
252
+ end
253
+
254
+ @linked_at = linked_at
255
+ end
256
+
257
+ # Custom attribute writer method with validation
258
+ # @param [Object] scopes Value to be assigned
259
+ def scopes=(scopes)
260
+ if scopes.nil?
261
+ fail ArgumentError, 'scopes cannot be nil'
262
+ end
263
+
264
+ @scopes = scopes
265
+ end
266
+
267
+ # Custom attribute writer method with validation
268
+ # @param [Object] carried Value to be assigned
269
+ def carried=(carried)
270
+ if carried.nil?
271
+ fail ArgumentError, 'carried cannot be nil'
272
+ end
273
+
274
+ @carried = carried
275
+ end
276
+
277
+ # Custom attribute writer method with validation
278
+ # @param [Object] kept Value to be assigned
279
+ def kept=(kept)
280
+ if kept.nil?
281
+ fail ArgumentError, 'kept cannot be nil'
282
+ end
283
+
284
+ @kept = kept
285
+ end
286
+
287
+ # Checks equality by comparing each attribute.
288
+ # @param [Object] Object to be compared
289
+ def ==(o)
290
+ return true if self.equal?(o)
291
+ self.class == o.class &&
292
+ status == o.status &&
293
+ subject == o.subject &&
294
+ previous_subject == o.previous_subject &&
295
+ linked_at == o.linked_at &&
296
+ scopes == o.scopes &&
297
+ carried == o.carried &&
298
+ kept == o.kept
299
+ end
300
+
301
+ # @see the `==` method
302
+ # @param [Object] Object to be compared
303
+ def eql?(o)
304
+ self == o
305
+ end
306
+
307
+ # Calculates hash code according to all attributes.
308
+ # @return [Integer] Hash code
309
+ def hash
310
+ [status, subject, previous_subject, linked_at, scopes, carried, kept].hash
311
+ end
312
+
313
+ # Builds the object from hash
314
+ # @param [Hash] attributes Model attributes in the form of hash
315
+ # @return [Object] Returns the model itself
316
+ def self.build_from_hash(attributes)
317
+ return nil unless attributes.is_a?(Hash)
318
+ attributes = attributes.transform_keys(&:to_sym)
319
+ transformed_hash = {}
320
+ openapi_types.each_pair do |key, type|
321
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
322
+ transformed_hash["#{key}"] = nil
323
+ elsif type =~ /\AArray<(.*)>/i
324
+ # check to ensure the input is an array given that the attribute
325
+ # is documented as an array but the input is not
326
+ if attributes[attribute_map[key]].is_a?(Array)
327
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
328
+ end
329
+ elsif !attributes[attribute_map[key]].nil?
330
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
331
+ end
332
+ end
333
+ new(transformed_hash)
334
+ end
335
+
336
+ # Deserializes the data based on type
337
+ # @param string type Data type
338
+ # @param string value Value to be deserialized
339
+ # @return [Object] Deserialized data
340
+ def self._deserialize(type, value)
341
+ case type.to_sym
342
+ when :Time
343
+ Time.parse(value)
344
+ when :Date
345
+ Date.parse(value)
346
+ when :String
347
+ value.to_s
348
+ when :Integer
349
+ value.to_i
350
+ when :Float
351
+ value.to_f
352
+ when :Boolean
353
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
354
+ true
355
+ else
356
+ false
357
+ end
358
+ when :Object
359
+ # generic object (usually a Hash), return directly
360
+ value
361
+ when /\AArray<(?<inner_type>.+)>\z/
362
+ inner_type = Regexp.last_match[:inner_type]
363
+ value.map { |v| _deserialize(inner_type, v) }
364
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
365
+ k_type = Regexp.last_match[:k_type]
366
+ v_type = Regexp.last_match[:v_type]
367
+ {}.tap do |hash|
368
+ value.each do |k, v|
369
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
370
+ end
371
+ end
372
+ else # model
373
+ # models (e.g. Pet) or oneOf
374
+ klass = Lingara.const_get(type)
375
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
376
+ end
377
+ end
378
+
379
+ # Returns the string representation of the object
380
+ # @return [String] String presentation of the object
381
+ def to_s
382
+ to_hash.to_s
383
+ end
384
+
385
+ # to_body is an alias to to_hash (backward compatibility)
386
+ # @return [Hash] Returns the object in the form of hash
387
+ def to_body
388
+ to_hash
389
+ end
390
+
391
+ # Returns the object in the form of hash
392
+ # @return [Hash] Returns the object in the form of hash
393
+ def to_hash
394
+ hash = {}
395
+ self.class.attribute_map.each_pair do |attr, param|
396
+ value = self.send(attr)
397
+ if value.nil?
398
+ is_nullable = self.class.openapi_nullable.include?(attr)
399
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
400
+ end
401
+
402
+ hash[param] = _to_hash(value)
403
+ end
404
+ hash
405
+ end
406
+
407
+ # Outputs non-array value in the form of hash
408
+ # For object, use to_hash. Otherwise, just return the value
409
+ # @param [Object] value Any valid value
410
+ # @return [Hash] Returns the value in the form of hash
411
+ def _to_hash(value)
412
+ if value.is_a?(Array)
413
+ value.compact.map { |v| _to_hash(v) }
414
+ elsif value.is_a?(Hash)
415
+ {}.tap do |hash|
416
+ value.each { |k, v| hash[k] = _to_hash(v) }
417
+ end
418
+ elsif value.respond_to? :to_hash
419
+ value.to_hash
420
+ else
421
+ value
422
+ end
423
+ end
424
+
425
+ end
426
+
427
+ end