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,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 TurnDelta
18
+ attr_accessor :text
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'text' => :'text'
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
+ :'text' => :'String'
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::TurnDelta` 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::TurnDelta`. 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?(:'text')
67
+ self.text = attributes[:'text']
68
+ else
69
+ self.text = 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 @text.nil?
79
+ invalid_properties.push('invalid value for "text", text 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 @text.nil?
90
+ true
91
+ end
92
+
93
+ # Custom attribute writer method with validation
94
+ # @param [Object] text Value to be assigned
95
+ def text=(text)
96
+ if text.nil?
97
+ fail ArgumentError, 'text cannot be nil'
98
+ end
99
+
100
+ @text = text
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
+ text == o.text
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
+ [text].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,285 @@
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 TurnEntry
18
+ attr_accessor :role
19
+
20
+ attr_accessor :content
21
+
22
+ class EnumAttributeValidator
23
+ attr_reader :datatype
24
+ attr_reader :allowable_values
25
+
26
+ def initialize(datatype, allowable_values)
27
+ @allowable_values = allowable_values.map do |value|
28
+ case datatype.to_s
29
+ when /Integer/i
30
+ value.to_i
31
+ when /Float/i
32
+ value.to_f
33
+ else
34
+ value
35
+ end
36
+ end
37
+ end
38
+
39
+ def valid?(value)
40
+ !value || allowable_values.include?(value)
41
+ end
42
+ end
43
+
44
+ # Attribute mapping from ruby-style variable name to JSON key.
45
+ def self.attribute_map
46
+ {
47
+ :'role' => :'role',
48
+ :'content' => :'content'
49
+ }
50
+ end
51
+
52
+ # Returns attribute mapping this model knows about
53
+ def self.acceptable_attribute_map
54
+ attribute_map
55
+ end
56
+
57
+ # Returns all the JSON keys this model knows about
58
+ def self.acceptable_attributes
59
+ acceptable_attribute_map.values
60
+ end
61
+
62
+ # Attribute type mapping.
63
+ def self.openapi_types
64
+ {
65
+ :'role' => :'TurnRole',
66
+ :'content' => :'String'
67
+ }
68
+ end
69
+
70
+ # List of attributes with nullable: true
71
+ def self.openapi_nullable
72
+ Set.new([
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::TurnEntry` 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::TurnEntry`. 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?(:'role')
93
+ self.role = attributes[:'role']
94
+ else
95
+ self.role = nil
96
+ end
97
+
98
+ if attributes.key?(:'content')
99
+ self.content = attributes[:'content']
100
+ else
101
+ self.content = nil
102
+ end
103
+ end
104
+
105
+ # Show invalid properties with the reasons. Usually used together with valid?
106
+ # @return Array for valid properties with the reasons
107
+ def list_invalid_properties
108
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
109
+ invalid_properties = Array.new
110
+ if @role.nil?
111
+ invalid_properties.push('invalid value for "role", role cannot be nil.')
112
+ end
113
+
114
+ if @content.nil?
115
+ invalid_properties.push('invalid value for "content", content cannot be nil.')
116
+ end
117
+
118
+ invalid_properties
119
+ end
120
+
121
+ # Check to see if the all the properties in the model are valid
122
+ # @return true if the model is valid
123
+ def valid?
124
+ warn '[DEPRECATED] the `valid?` method is obsolete'
125
+ return false if @role.nil?
126
+ return false if @content.nil?
127
+ true
128
+ end
129
+
130
+ # Custom attribute writer method with validation
131
+ # @param [Object] role Value to be assigned
132
+ def role=(role)
133
+ if role.nil?
134
+ fail ArgumentError, 'role cannot be nil'
135
+ end
136
+
137
+ @role = role
138
+ end
139
+
140
+ # Custom attribute writer method with validation
141
+ # @param [Object] content Value to be assigned
142
+ def content=(content)
143
+ if content.nil?
144
+ fail ArgumentError, 'content cannot be nil'
145
+ end
146
+
147
+ @content = content
148
+ end
149
+
150
+ # Checks equality by comparing each attribute.
151
+ # @param [Object] Object to be compared
152
+ def ==(o)
153
+ return true if self.equal?(o)
154
+ self.class == o.class &&
155
+ role == o.role &&
156
+ content == o.content
157
+ end
158
+
159
+ # @see the `==` method
160
+ # @param [Object] Object to be compared
161
+ def eql?(o)
162
+ self == o
163
+ end
164
+
165
+ # Calculates hash code according to all attributes.
166
+ # @return [Integer] Hash code
167
+ def hash
168
+ [role, content].hash
169
+ end
170
+
171
+ # Builds the object from hash
172
+ # @param [Hash] attributes Model attributes in the form of hash
173
+ # @return [Object] Returns the model itself
174
+ def self.build_from_hash(attributes)
175
+ return nil unless attributes.is_a?(Hash)
176
+ attributes = attributes.transform_keys(&:to_sym)
177
+ transformed_hash = {}
178
+ openapi_types.each_pair do |key, type|
179
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
180
+ transformed_hash["#{key}"] = nil
181
+ elsif type =~ /\AArray<(.*)>/i
182
+ # check to ensure the input is an array given that the attribute
183
+ # is documented as an array but the input is not
184
+ if attributes[attribute_map[key]].is_a?(Array)
185
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
186
+ end
187
+ elsif !attributes[attribute_map[key]].nil?
188
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
189
+ end
190
+ end
191
+ new(transformed_hash)
192
+ end
193
+
194
+ # Deserializes the data based on type
195
+ # @param string type Data type
196
+ # @param string value Value to be deserialized
197
+ # @return [Object] Deserialized data
198
+ def self._deserialize(type, value)
199
+ case type.to_sym
200
+ when :Time
201
+ Time.parse(value)
202
+ when :Date
203
+ Date.parse(value)
204
+ when :String
205
+ value.to_s
206
+ when :Integer
207
+ value.to_i
208
+ when :Float
209
+ value.to_f
210
+ when :Boolean
211
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
212
+ true
213
+ else
214
+ false
215
+ end
216
+ when :Object
217
+ # generic object (usually a Hash), return directly
218
+ value
219
+ when /\AArray<(?<inner_type>.+)>\z/
220
+ inner_type = Regexp.last_match[:inner_type]
221
+ value.map { |v| _deserialize(inner_type, v) }
222
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
223
+ k_type = Regexp.last_match[:k_type]
224
+ v_type = Regexp.last_match[:v_type]
225
+ {}.tap do |hash|
226
+ value.each do |k, v|
227
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
228
+ end
229
+ end
230
+ else # model
231
+ # models (e.g. Pet) or oneOf
232
+ klass = Lingara.const_get(type)
233
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
234
+ end
235
+ end
236
+
237
+ # Returns the string representation of the object
238
+ # @return [String] String presentation of the object
239
+ def to_s
240
+ to_hash.to_s
241
+ end
242
+
243
+ # to_body is an alias to to_hash (backward compatibility)
244
+ # @return [Hash] Returns the object in the form of hash
245
+ def to_body
246
+ to_hash
247
+ end
248
+
249
+ # Returns the object in the form of hash
250
+ # @return [Hash] Returns the object in the form of hash
251
+ def to_hash
252
+ hash = {}
253
+ self.class.attribute_map.each_pair do |attr, param|
254
+ value = self.send(attr)
255
+ if value.nil?
256
+ is_nullable = self.class.openapi_nullable.include?(attr)
257
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
258
+ end
259
+
260
+ hash[param] = _to_hash(value)
261
+ end
262
+ hash
263
+ end
264
+
265
+ # Outputs non-array value in the form of hash
266
+ # For object, use to_hash. Otherwise, just return the value
267
+ # @param [Object] value Any valid value
268
+ # @return [Hash] Returns the value in the form of hash
269
+ def _to_hash(value)
270
+ if value.is_a?(Array)
271
+ value.compact.map { |v| _to_hash(v) }
272
+ elsif value.is_a?(Hash)
273
+ {}.tap do |hash|
274
+ value.each { |k, v| hash[k] = _to_hash(v) }
275
+ end
276
+ elsif value.respond_to? :to_hash
277
+ value.to_hash
278
+ else
279
+ value
280
+ end
281
+ end
282
+
283
+ end
284
+
285
+ end
@@ -0,0 +1,41 @@
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 TurnRole
18
+ USER = "user".freeze
19
+ ASSISTANT = "assistant".freeze
20
+ UNKNOWN_DEFAULT_OPEN_API = "unknown_default_open_api".freeze
21
+
22
+ def self.all_vars
23
+ @all_vars ||= [USER, ASSISTANT, UNKNOWN_DEFAULT_OPEN_API].freeze
24
+ end
25
+
26
+ # Builds the enum from string
27
+ # @param [String] The enum value in the form of the string
28
+ # @return [String] The enum value
29
+ def self.build_from_hash(value)
30
+ new.build_from_hash(value)
31
+ end
32
+
33
+ # Builds the enum from string
34
+ # @param [String] The enum value in the form of the string
35
+ # @return [String] The enum value
36
+ def build_from_hash(value)
37
+ return value if TurnRole.all_vars.include?(value)
38
+ raise "Invalid ENUM value #{value} for class #TurnRole"
39
+ end
40
+ end
41
+ end