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,341 @@
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 VocabRequest
18
+ attr_accessor :level
19
+
20
+ attr_accessor :source_lang
21
+
22
+ attr_accessor :target_lang
23
+
24
+ attr_accessor :count
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'level' => :'level',
30
+ :'source_lang' => :'source_lang',
31
+ :'target_lang' => :'target_lang',
32
+ :'count' => :'count'
33
+ }
34
+ end
35
+
36
+ # Returns attribute mapping this model knows about
37
+ def self.acceptable_attribute_map
38
+ attribute_map
39
+ end
40
+
41
+ # Returns all the JSON keys this model knows about
42
+ def self.acceptable_attributes
43
+ acceptable_attribute_map.values
44
+ end
45
+
46
+ # Attribute type mapping.
47
+ def self.openapi_types
48
+ {
49
+ :'level' => :'Integer',
50
+ :'source_lang' => :'String',
51
+ :'target_lang' => :'String',
52
+ :'count' => :'Integer'
53
+ }
54
+ end
55
+
56
+ # List of attributes with nullable: true
57
+ def self.openapi_nullable
58
+ Set.new([
59
+ :'count'
60
+ ])
61
+ end
62
+
63
+ # Initializes the object
64
+ # @param [Hash] attributes Model attributes in the form of hash
65
+ def initialize(attributes = {})
66
+ if (!attributes.is_a?(Hash))
67
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Lingara::VocabRequest` initialize method"
68
+ end
69
+
70
+ # check to see if the attribute exists and convert string to symbol for hash key
71
+ acceptable_attribute_map = self.class.acceptable_attribute_map
72
+ attributes = attributes.each_with_object({}) { |(k, v), h|
73
+ if (!acceptable_attribute_map.key?(k.to_sym))
74
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Lingara::VocabRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
75
+ end
76
+ h[k.to_sym] = v
77
+ }
78
+
79
+ if attributes.key?(:'level')
80
+ self.level = attributes[:'level']
81
+ else
82
+ self.level = nil
83
+ end
84
+
85
+ if attributes.key?(:'source_lang')
86
+ self.source_lang = attributes[:'source_lang']
87
+ else
88
+ self.source_lang = nil
89
+ end
90
+
91
+ if attributes.key?(:'target_lang')
92
+ self.target_lang = attributes[:'target_lang']
93
+ else
94
+ self.target_lang = nil
95
+ end
96
+
97
+ if attributes.key?(:'count')
98
+ self.count = attributes[:'count']
99
+ end
100
+ end
101
+
102
+ # Show invalid properties with the reasons. Usually used together with valid?
103
+ # @return Array for valid properties with the reasons
104
+ def list_invalid_properties
105
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
106
+ invalid_properties = Array.new
107
+ if @level.nil?
108
+ invalid_properties.push('invalid value for "level", level cannot be nil.')
109
+ end
110
+
111
+ if @level > 255
112
+ invalid_properties.push('invalid value for "level", must be smaller than or equal to 255.')
113
+ end
114
+
115
+ if @level < 0
116
+ invalid_properties.push('invalid value for "level", must be greater than or equal to 0.')
117
+ end
118
+
119
+ if @source_lang.nil?
120
+ invalid_properties.push('invalid value for "source_lang", source_lang cannot be nil.')
121
+ end
122
+
123
+ if @target_lang.nil?
124
+ invalid_properties.push('invalid value for "target_lang", target_lang cannot be nil.')
125
+ end
126
+
127
+ if !@count.nil? && @count > 20
128
+ invalid_properties.push('invalid value for "count", must be smaller than or equal to 20.')
129
+ end
130
+
131
+ if !@count.nil? && @count < 1
132
+ invalid_properties.push('invalid value for "count", must be greater than or equal to 1.')
133
+ end
134
+
135
+ invalid_properties
136
+ end
137
+
138
+ # Check to see if the all the properties in the model are valid
139
+ # @return true if the model is valid
140
+ def valid?
141
+ warn '[DEPRECATED] the `valid?` method is obsolete'
142
+ return false if @level.nil?
143
+ return false if @level > 255
144
+ return false if @level < 0
145
+ return false if @source_lang.nil?
146
+ return false if @target_lang.nil?
147
+ return false if !@count.nil? && @count > 20
148
+ return false if !@count.nil? && @count < 1
149
+ true
150
+ end
151
+
152
+ # Custom attribute writer method with validation
153
+ # @param [Object] level Value to be assigned
154
+ def level=(level)
155
+ if level.nil?
156
+ fail ArgumentError, 'level cannot be nil'
157
+ end
158
+
159
+ if level > 255
160
+ fail ArgumentError, 'invalid value for "level", must be smaller than or equal to 255.'
161
+ end
162
+
163
+ if level < 0
164
+ fail ArgumentError, 'invalid value for "level", must be greater than or equal to 0.'
165
+ end
166
+
167
+ @level = level
168
+ end
169
+
170
+ # Custom attribute writer method with validation
171
+ # @param [Object] source_lang Value to be assigned
172
+ def source_lang=(source_lang)
173
+ if source_lang.nil?
174
+ fail ArgumentError, 'source_lang cannot be nil'
175
+ end
176
+
177
+ @source_lang = source_lang
178
+ end
179
+
180
+ # Custom attribute writer method with validation
181
+ # @param [Object] target_lang Value to be assigned
182
+ def target_lang=(target_lang)
183
+ if target_lang.nil?
184
+ fail ArgumentError, 'target_lang cannot be nil'
185
+ end
186
+
187
+ @target_lang = target_lang
188
+ end
189
+
190
+ # Custom attribute writer method with validation
191
+ # @param [Object] count Value to be assigned
192
+ def count=(count)
193
+ if !count.nil? && count > 20
194
+ fail ArgumentError, 'invalid value for "count", must be smaller than or equal to 20.'
195
+ end
196
+
197
+ if !count.nil? && count < 1
198
+ fail ArgumentError, 'invalid value for "count", must be greater than or equal to 1.'
199
+ end
200
+
201
+ @count = count
202
+ end
203
+
204
+ # Checks equality by comparing each attribute.
205
+ # @param [Object] Object to be compared
206
+ def ==(o)
207
+ return true if self.equal?(o)
208
+ self.class == o.class &&
209
+ level == o.level &&
210
+ source_lang == o.source_lang &&
211
+ target_lang == o.target_lang &&
212
+ count == o.count
213
+ end
214
+
215
+ # @see the `==` method
216
+ # @param [Object] Object to be compared
217
+ def eql?(o)
218
+ self == o
219
+ end
220
+
221
+ # Calculates hash code according to all attributes.
222
+ # @return [Integer] Hash code
223
+ def hash
224
+ [level, source_lang, target_lang, count].hash
225
+ end
226
+
227
+ # Builds the object from hash
228
+ # @param [Hash] attributes Model attributes in the form of hash
229
+ # @return [Object] Returns the model itself
230
+ def self.build_from_hash(attributes)
231
+ return nil unless attributes.is_a?(Hash)
232
+ attributes = attributes.transform_keys(&:to_sym)
233
+ transformed_hash = {}
234
+ openapi_types.each_pair do |key, type|
235
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
236
+ transformed_hash["#{key}"] = nil
237
+ elsif type =~ /\AArray<(.*)>/i
238
+ # check to ensure the input is an array given that the attribute
239
+ # is documented as an array but the input is not
240
+ if attributes[attribute_map[key]].is_a?(Array)
241
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
242
+ end
243
+ elsif !attributes[attribute_map[key]].nil?
244
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
245
+ end
246
+ end
247
+ new(transformed_hash)
248
+ end
249
+
250
+ # Deserializes the data based on type
251
+ # @param string type Data type
252
+ # @param string value Value to be deserialized
253
+ # @return [Object] Deserialized data
254
+ def self._deserialize(type, value)
255
+ case type.to_sym
256
+ when :Time
257
+ Time.parse(value)
258
+ when :Date
259
+ Date.parse(value)
260
+ when :String
261
+ value.to_s
262
+ when :Integer
263
+ value.to_i
264
+ when :Float
265
+ value.to_f
266
+ when :Boolean
267
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
268
+ true
269
+ else
270
+ false
271
+ end
272
+ when :Object
273
+ # generic object (usually a Hash), return directly
274
+ value
275
+ when /\AArray<(?<inner_type>.+)>\z/
276
+ inner_type = Regexp.last_match[:inner_type]
277
+ value.map { |v| _deserialize(inner_type, v) }
278
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
279
+ k_type = Regexp.last_match[:k_type]
280
+ v_type = Regexp.last_match[:v_type]
281
+ {}.tap do |hash|
282
+ value.each do |k, v|
283
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
284
+ end
285
+ end
286
+ else # model
287
+ # models (e.g. Pet) or oneOf
288
+ klass = Lingara.const_get(type)
289
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
290
+ end
291
+ end
292
+
293
+ # Returns the string representation of the object
294
+ # @return [String] String presentation of the object
295
+ def to_s
296
+ to_hash.to_s
297
+ end
298
+
299
+ # to_body is an alias to to_hash (backward compatibility)
300
+ # @return [Hash] Returns the object in the form of hash
301
+ def to_body
302
+ to_hash
303
+ end
304
+
305
+ # Returns the object in the form of hash
306
+ # @return [Hash] Returns the object in the form of hash
307
+ def to_hash
308
+ hash = {}
309
+ self.class.attribute_map.each_pair do |attr, param|
310
+ value = self.send(attr)
311
+ if value.nil?
312
+ is_nullable = self.class.openapi_nullable.include?(attr)
313
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
314
+ end
315
+
316
+ hash[param] = _to_hash(value)
317
+ end
318
+ hash
319
+ end
320
+
321
+ # Outputs non-array value in the form of hash
322
+ # For object, use to_hash. Otherwise, just return the value
323
+ # @param [Object] value Any valid value
324
+ # @return [Hash] Returns the value in the form of hash
325
+ def _to_hash(value)
326
+ if value.is_a?(Array)
327
+ value.compact.map { |v| _to_hash(v) }
328
+ elsif value.is_a?(Hash)
329
+ {}.tap do |hash|
330
+ value.each { |k, v| hash[k] = _to_hash(v) }
331
+ end
332
+ elsif value.respond_to? :to_hash
333
+ value.to_hash
334
+ else
335
+ value
336
+ end
337
+ end
338
+
339
+ end
340
+
341
+ end
@@ -0,0 +1,237 @@
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 VocabStarted
18
+ attr_accessor :meta
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'meta' => :'meta'
24
+ }
25
+ end
26
+
27
+ # Returns attribute mapping this model knows about
28
+ def self.acceptable_attribute_map
29
+ attribute_map
30
+ end
31
+
32
+ # Returns all the JSON keys this model knows about
33
+ def self.acceptable_attributes
34
+ acceptable_attribute_map.values
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.openapi_types
39
+ {
40
+ :'meta' => :'VocabMeta'
41
+ }
42
+ end
43
+
44
+ # List of attributes with nullable: true
45
+ def self.openapi_nullable
46
+ Set.new([
47
+ ])
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ if (!attributes.is_a?(Hash))
54
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Lingara::VocabStarted` initialize method"
55
+ end
56
+
57
+ # check to see if the attribute exists and convert string to symbol for hash key
58
+ acceptable_attribute_map = self.class.acceptable_attribute_map
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!acceptable_attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Lingara::VocabStarted`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'meta')
67
+ self.meta = attributes[:'meta']
68
+ else
69
+ self.meta = nil
70
+ end
71
+ end
72
+
73
+ # Show invalid properties with the reasons. Usually used together with valid?
74
+ # @return Array for valid properties with the reasons
75
+ def list_invalid_properties
76
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
77
+ invalid_properties = Array.new
78
+ if @meta.nil?
79
+ invalid_properties.push('invalid value for "meta", meta cannot be nil.')
80
+ end
81
+
82
+ invalid_properties
83
+ end
84
+
85
+ # Check to see if the all the properties in the model are valid
86
+ # @return true if the model is valid
87
+ def valid?
88
+ warn '[DEPRECATED] the `valid?` method is obsolete'
89
+ return false if @meta.nil?
90
+ true
91
+ end
92
+
93
+ # Custom attribute writer method with validation
94
+ # @param [Object] meta Value to be assigned
95
+ def meta=(meta)
96
+ if meta.nil?
97
+ fail ArgumentError, 'meta cannot be nil'
98
+ end
99
+
100
+ @meta = meta
101
+ end
102
+
103
+ # Checks equality by comparing each attribute.
104
+ # @param [Object] Object to be compared
105
+ def ==(o)
106
+ return true if self.equal?(o)
107
+ self.class == o.class &&
108
+ meta == o.meta
109
+ end
110
+
111
+ # @see the `==` method
112
+ # @param [Object] Object to be compared
113
+ def eql?(o)
114
+ self == o
115
+ end
116
+
117
+ # Calculates hash code according to all attributes.
118
+ # @return [Integer] Hash code
119
+ def hash
120
+ [meta].hash
121
+ end
122
+
123
+ # Builds the object from hash
124
+ # @param [Hash] attributes Model attributes in the form of hash
125
+ # @return [Object] Returns the model itself
126
+ def self.build_from_hash(attributes)
127
+ return nil unless attributes.is_a?(Hash)
128
+ attributes = attributes.transform_keys(&:to_sym)
129
+ transformed_hash = {}
130
+ openapi_types.each_pair do |key, type|
131
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
132
+ transformed_hash["#{key}"] = nil
133
+ elsif type =~ /\AArray<(.*)>/i
134
+ # check to ensure the input is an array given that the attribute
135
+ # is documented as an array but the input is not
136
+ if attributes[attribute_map[key]].is_a?(Array)
137
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
138
+ end
139
+ elsif !attributes[attribute_map[key]].nil?
140
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
141
+ end
142
+ end
143
+ new(transformed_hash)
144
+ end
145
+
146
+ # Deserializes the data based on type
147
+ # @param string type Data type
148
+ # @param string value Value to be deserialized
149
+ # @return [Object] Deserialized data
150
+ def self._deserialize(type, value)
151
+ case type.to_sym
152
+ when :Time
153
+ Time.parse(value)
154
+ when :Date
155
+ Date.parse(value)
156
+ when :String
157
+ value.to_s
158
+ when :Integer
159
+ value.to_i
160
+ when :Float
161
+ value.to_f
162
+ when :Boolean
163
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
164
+ true
165
+ else
166
+ false
167
+ end
168
+ when :Object
169
+ # generic object (usually a Hash), return directly
170
+ value
171
+ when /\AArray<(?<inner_type>.+)>\z/
172
+ inner_type = Regexp.last_match[:inner_type]
173
+ value.map { |v| _deserialize(inner_type, v) }
174
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
175
+ k_type = Regexp.last_match[:k_type]
176
+ v_type = Regexp.last_match[:v_type]
177
+ {}.tap do |hash|
178
+ value.each do |k, v|
179
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
180
+ end
181
+ end
182
+ else # model
183
+ # models (e.g. Pet) or oneOf
184
+ klass = Lingara.const_get(type)
185
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
186
+ end
187
+ end
188
+
189
+ # Returns the string representation of the object
190
+ # @return [String] String presentation of the object
191
+ def to_s
192
+ to_hash.to_s
193
+ end
194
+
195
+ # to_body is an alias to to_hash (backward compatibility)
196
+ # @return [Hash] Returns the object in the form of hash
197
+ def to_body
198
+ to_hash
199
+ end
200
+
201
+ # Returns the object in the form of hash
202
+ # @return [Hash] Returns the object in the form of hash
203
+ def to_hash
204
+ hash = {}
205
+ self.class.attribute_map.each_pair do |attr, param|
206
+ value = self.send(attr)
207
+ if value.nil?
208
+ is_nullable = self.class.openapi_nullable.include?(attr)
209
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
210
+ end
211
+
212
+ hash[param] = _to_hash(value)
213
+ end
214
+ hash
215
+ end
216
+
217
+ # Outputs non-array value in the form of hash
218
+ # For object, use to_hash. Otherwise, just return the value
219
+ # @param [Object] value Any valid value
220
+ # @return [Hash] Returns the value in the form of hash
221
+ def _to_hash(value)
222
+ if value.is_a?(Array)
223
+ value.compact.map { |v| _to_hash(v) }
224
+ elsif value.is_a?(Hash)
225
+ {}.tap do |hash|
226
+ value.each { |k, v| hash[k] = _to_hash(v) }
227
+ end
228
+ elsif value.respond_to? :to_hash
229
+ value.to_hash
230
+ else
231
+ value
232
+ end
233
+ end
234
+
235
+ end
236
+
237
+ end
@@ -0,0 +1,91 @@
1
+ # Generated by ruby/codegen/generate.rb from the generator view. DO NOT EDIT.
2
+
3
+ module Lingara
4
+ # Every operation's route, keyed by operationId: from `paths` for a JSON
5
+ # operation and from `x-lingara-streams` for a stream. A stream's `ends`
6
+ # is its terminal table: :yield (yielded, then the stream ends), :quiet
7
+ # (a Done payload, never yielded) and :raise (the error event).
8
+ OPERATIONS = {
9
+ "createLessonPlan" => {
10
+ method: "POST",
11
+ path: "/v1/lesson-plans",
12
+ path_params: [].freeze,
13
+ needs_token: true,
14
+ request_body: "LessonPlanCreateRequest",
15
+ response: nil,
16
+ stream: {union: "CreateLessonPlanEvent", events: {"started" => "CreateLessonPlanEventStarted", "phase" => "CreateLessonPlanEventPhase", "result" => "CreateLessonPlanEventResult", "error" => "CreateLessonPlanEventError"}.freeze, ends: {"result" => :yield, "error" => :raise}.freeze}.freeze
17
+ }.freeze,
18
+ "generateVocabulary" => {
19
+ method: "POST",
20
+ path: "/v1/vocab/stream",
21
+ path_params: [].freeze,
22
+ needs_token: true,
23
+ request_body: "VocabRequest",
24
+ response: nil,
25
+ stream: {union: "GenerateVocabularyEvent", events: {"started" => "GenerateVocabularyEventStarted", "item" => "GenerateVocabularyEventItem", "done" => "GenerateVocabularyEventDone", "error" => "GenerateVocabularyEventError"}.freeze, ends: {"done" => :quiet, "error" => :raise}.freeze}.freeze
26
+ }.freeze,
27
+ "getApiVersion" => {
28
+ method: "GET",
29
+ path: "/v1/versions/{id}",
30
+ path_params: ["id"].freeze,
31
+ needs_token: false,
32
+ request_body: nil,
33
+ response: "VersionDetail",
34
+ stream: nil
35
+ }.freeze,
36
+ "getLessonPlan" => {
37
+ method: "GET",
38
+ path: "/v1/lesson-plans/{id}",
39
+ path_params: ["id"].freeze,
40
+ needs_token: true,
41
+ request_body: nil,
42
+ response: "LessonPlan",
43
+ stream: nil
44
+ }.freeze,
45
+ "getOpenApiDocument" => {
46
+ method: "GET",
47
+ path: "/v1/openapi.json",
48
+ path_params: [].freeze,
49
+ needs_token: false,
50
+ request_body: nil,
51
+ response: nil,
52
+ stream: nil
53
+ }.freeze,
54
+ "getUsage" => {
55
+ method: "GET",
56
+ path: "/v1/usage",
57
+ path_params: [].freeze,
58
+ needs_token: true,
59
+ request_body: nil,
60
+ response: "Usage",
61
+ stream: nil
62
+ }.freeze,
63
+ "listApiVersions" => {
64
+ method: "GET",
65
+ path: "/v1/versions",
66
+ path_params: [].freeze,
67
+ needs_token: false,
68
+ request_body: nil,
69
+ response: "VersionList",
70
+ stream: nil
71
+ }.freeze,
72
+ "sendTutorMessage" => {
73
+ method: "POST",
74
+ path: "/v1/tutor/message",
75
+ path_params: [].freeze,
76
+ needs_token: true,
77
+ request_body: "TutorTurnRequest",
78
+ response: nil,
79
+ stream: {union: "SendTutorMessageEvent", events: {"delta" => "SendTutorMessageEventDelta", "notice" => "SendTutorMessageEventNotice", "done" => "SendTutorMessageEventDone", "error" => "SendTutorMessageEventError"}.freeze, ends: {"done" => :quiet, "error" => :raise}.freeze}.freeze
80
+ }.freeze,
81
+ "streamLessonPlan" => {
82
+ method: "GET",
83
+ path: "/v1/lesson-plans/{id}/stream",
84
+ path_params: ["id"].freeze,
85
+ needs_token: true,
86
+ request_body: nil,
87
+ response: nil,
88
+ stream: {union: "StreamLessonPlanEvent", events: {"started" => "StreamLessonPlanEventStarted", "phase" => "StreamLessonPlanEventPhase", "result" => "StreamLessonPlanEventResult", "pending" => "StreamLessonPlanEventPending", "error" => "StreamLessonPlanEventError"}.freeze, ends: {"result" => :yield, "pending" => :yield, "error" => :raise}.freeze}.freeze
89
+ }.freeze
90
+ }.freeze
91
+ end