trieve_ruby_client 0.3.5 → 0.5.0

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 (217) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +78 -74
  3. data/docs/AddChunkToGroupData.md +1 -1
  4. data/docs/AuthApi.md +28 -34
  5. data/docs/AuthQuery.md +22 -0
  6. data/docs/BatchQueuedChunkResponse.md +20 -0
  7. data/docs/ChunkApi.md +69 -147
  8. data/docs/ChunkData.md +42 -0
  9. data/docs/ChunkGroupApi.md +168 -90
  10. data/docs/CreateChunkData.md +41 -34
  11. data/docs/DatasetApi.md +31 -31
  12. data/docs/EventsApi.md +13 -13
  13. data/docs/FileApi.md +21 -21
  14. data/docs/GetEventsData.md +22 -0
  15. data/docs/HealthApi.md +6 -4
  16. data/docs/InvitationApi.md +6 -6
  17. data/docs/MessageApi.md +21 -21
  18. data/docs/OrganizationApi.md +31 -31
  19. data/docs/ReturnQueuedChunk.md +39 -10
  20. data/docs/SingleQueuedChunkResponse.md +20 -0
  21. data/docs/StripeApi.md +21 -13
  22. data/docs/TopicApi.md +21 -21
  23. data/docs/UserApi.md +16 -16
  24. data/lib/trieve_ruby_client/api/auth_api.rb +27 -34
  25. data/lib/trieve_ruby_client/api/chunk_api.rb +64 -143
  26. data/lib/trieve_ruby_client/api/chunk_group_api.rb +153 -75
  27. data/lib/trieve_ruby_client/api/dataset_api.rb +25 -25
  28. data/lib/trieve_ruby_client/api/events_api.rb +21 -16
  29. data/lib/trieve_ruby_client/api/file_api.rb +17 -17
  30. data/lib/trieve_ruby_client/api/health_api.rb +5 -1
  31. data/lib/trieve_ruby_client/api/invitation_api.rb +5 -5
  32. data/lib/trieve_ruby_client/api/message_api.rb +17 -17
  33. data/lib/trieve_ruby_client/api/organization_api.rb +25 -25
  34. data/lib/trieve_ruby_client/api/stripe_api.rb +17 -1
  35. data/lib/trieve_ruby_client/api/topic_api.rb +17 -17
  36. data/lib/trieve_ruby_client/api/user_api.rb +13 -13
  37. data/lib/trieve_ruby_client/api_client.rb +1 -1
  38. data/lib/trieve_ruby_client/api_error.rb +1 -1
  39. data/lib/trieve_ruby_client/configuration.rb +8 -4
  40. data/lib/trieve_ruby_client/models/add_chunk_to_group_data.rb +2 -2
  41. data/lib/trieve_ruby_client/models/api_key_dto.rb +1 -1
  42. data/lib/trieve_ruby_client/models/{stripe_subscription.rb → auth_query.rb} +23 -96
  43. data/lib/trieve_ruby_client/models/batch_queued_chunk_response.rb +240 -0
  44. data/lib/trieve_ruby_client/models/bookmark_data.rb +1 -1
  45. data/lib/trieve_ruby_client/models/bookmark_group_result.rb +1 -1
  46. data/lib/trieve_ruby_client/models/chat_message_proxy.rb +1 -1
  47. data/lib/trieve_ruby_client/models/chunk_data.rb +356 -0
  48. data/lib/trieve_ruby_client/models/chunk_filter.rb +1 -1
  49. data/lib/trieve_ruby_client/models/chunk_group.rb +1 -1
  50. data/lib/trieve_ruby_client/models/chunk_group_and_file.rb +1 -1
  51. data/lib/trieve_ruby_client/models/chunk_metadata.rb +1 -1
  52. data/lib/trieve_ruby_client/models/chunk_metadata_with_file_data.rb +1 -1
  53. data/lib/trieve_ruby_client/models/client_dataset_configuration.rb +1 -1
  54. data/lib/trieve_ruby_client/models/create_chunk_data.rb +79 -330
  55. data/lib/trieve_ruby_client/models/create_chunk_group_data.rb +1 -1
  56. data/lib/trieve_ruby_client/models/create_dataset_request.rb +1 -1
  57. data/lib/trieve_ruby_client/models/create_message_data.rb +1 -1
  58. data/lib/trieve_ruby_client/models/create_organization_data.rb +1 -1
  59. data/lib/trieve_ruby_client/models/create_topic_data.rb +1 -1
  60. data/lib/trieve_ruby_client/models/dataset.rb +1 -1
  61. data/lib/trieve_ruby_client/models/dataset_and_usage.rb +1 -1
  62. data/lib/trieve_ruby_client/models/dataset_dto.rb +1 -1
  63. data/lib/trieve_ruby_client/models/dataset_usage_count.rb +1 -1
  64. data/lib/trieve_ruby_client/models/delete_dataset_request.rb +1 -1
  65. data/lib/trieve_ruby_client/models/delete_topic_data.rb +1 -1
  66. data/lib/trieve_ruby_client/models/delete_user_api_key_request.rb +1 -1
  67. data/lib/trieve_ruby_client/models/edit_message_data.rb +1 -1
  68. data/lib/trieve_ruby_client/models/error_response_body.rb +1 -1
  69. data/lib/trieve_ruby_client/models/event.rb +1 -1
  70. data/lib/trieve_ruby_client/models/event_return.rb +1 -1
  71. data/lib/trieve_ruby_client/models/field_condition.rb +1 -1
  72. data/lib/trieve_ruby_client/models/file.rb +1 -1
  73. data/lib/trieve_ruby_client/models/file_dto.rb +1 -1
  74. data/lib/trieve_ruby_client/models/generate_chunks_request.rb +1 -1
  75. data/lib/trieve_ruby_client/models/get_events_data.rb +240 -0
  76. data/lib/trieve_ruby_client/models/get_groups_for_chunks_data.rb +1 -1
  77. data/lib/trieve_ruby_client/models/group_data.rb +1 -1
  78. data/lib/trieve_ruby_client/models/group_score_chunk_dto.rb +1 -1
  79. data/lib/trieve_ruby_client/models/invitation_data.rb +1 -1
  80. data/lib/trieve_ruby_client/models/match_condition.rb +1 -1
  81. data/lib/trieve_ruby_client/models/message.rb +1 -1
  82. data/lib/trieve_ruby_client/models/organization.rb +1 -1
  83. data/lib/trieve_ruby_client/models/organization_usage_count.rb +1 -1
  84. data/lib/trieve_ruby_client/models/range.rb +1 -1
  85. data/lib/trieve_ruby_client/models/reccomend_group_chunks_request.rb +1 -1
  86. data/lib/trieve_ruby_client/models/recommend_chunks_request.rb +1 -1
  87. data/lib/trieve_ruby_client/models/regenerate_message_data.rb +1 -1
  88. data/lib/trieve_ruby_client/models/return_queued_chunk.rb +75 -207
  89. data/lib/trieve_ruby_client/models/score_chunk_dto.rb +1 -1
  90. data/lib/trieve_ruby_client/models/search_chunk_data.rb +1 -1
  91. data/lib/trieve_ruby_client/models/search_chunk_query_response_body.rb +1 -1
  92. data/lib/trieve_ruby_client/models/search_groups_result.rb +1 -1
  93. data/lib/trieve_ruby_client/models/search_over_groups_data.rb +1 -1
  94. data/lib/trieve_ruby_client/models/search_over_groups_response_body.rb +1 -1
  95. data/lib/trieve_ruby_client/models/search_within_group_data.rb +1 -1
  96. data/lib/trieve_ruby_client/models/set_user_api_key_request.rb +1 -1
  97. data/lib/trieve_ruby_client/models/set_user_api_key_response.rb +1 -1
  98. data/lib/trieve_ruby_client/models/single_queued_chunk_response.rb +238 -0
  99. data/lib/trieve_ruby_client/models/slim_group.rb +1 -1
  100. data/lib/trieve_ruby_client/models/slim_user.rb +1 -1
  101. data/lib/trieve_ruby_client/models/stripe_plan.rb +1 -1
  102. data/lib/trieve_ruby_client/models/suggested_queries_request.rb +1 -1
  103. data/lib/trieve_ruby_client/models/suggested_queries_response.rb +1 -1
  104. data/lib/trieve_ruby_client/models/topic.rb +1 -1
  105. data/lib/trieve_ruby_client/models/update_chunk_by_tracking_id_data.rb +1 -1
  106. data/lib/trieve_ruby_client/models/update_chunk_data.rb +1 -1
  107. data/lib/trieve_ruby_client/models/update_chunk_group_data.rb +1 -1
  108. data/lib/trieve_ruby_client/models/update_dataset_request.rb +1 -1
  109. data/lib/trieve_ruby_client/models/update_group_by_tracking_id_data.rb +1 -1
  110. data/lib/trieve_ruby_client/models/update_organization_data.rb +1 -1
  111. data/lib/trieve_ruby_client/models/update_topic_data.rb +1 -1
  112. data/lib/trieve_ruby_client/models/update_user_data.rb +1 -1
  113. data/lib/trieve_ruby_client/models/upload_file_data.rb +1 -1
  114. data/lib/trieve_ruby_client/models/upload_file_result.rb +1 -1
  115. data/lib/trieve_ruby_client/models/user_organization.rb +1 -1
  116. data/lib/trieve_ruby_client/version.rb +2 -2
  117. data/lib/trieve_ruby_client.rb +6 -2
  118. data/openapi-generator.yaml +1 -1
  119. data/openapi.json +1196 -849
  120. data/spec/api/auth_api_spec.rb +16 -18
  121. data/spec/api/chunk_api_spec.rb +30 -43
  122. data/spec/api/chunk_group_api_spec.rb +54 -33
  123. data/spec/api/dataset_api_spec.rb +19 -19
  124. data/spec/api/events_api_spec.rb +10 -10
  125. data/spec/api/file_api_spec.rb +15 -15
  126. data/spec/api/health_api_spec.rb +9 -7
  127. data/spec/api/invitation_api_spec.rb +9 -9
  128. data/spec/api/message_api_spec.rb +15 -15
  129. data/spec/api/organization_api_spec.rb +19 -19
  130. data/spec/api/stripe_api_spec.rb +15 -7
  131. data/spec/api/topic_api_spec.rb +15 -15
  132. data/spec/api/user_api_spec.rb +13 -13
  133. data/spec/models/add_chunk_to_group_data_spec.rb +8 -8
  134. data/spec/models/api_key_dto_spec.rb +8 -8
  135. data/spec/models/auth_query_spec.rb +48 -0
  136. data/spec/models/batch_queued_chunk_response_spec.rb +42 -0
  137. data/spec/models/bookmark_data_spec.rb +8 -8
  138. data/spec/models/bookmark_group_result_spec.rb +8 -8
  139. data/spec/models/chat_message_proxy_spec.rb +8 -8
  140. data/spec/models/chunk_data_spec.rb +108 -0
  141. data/spec/models/chunk_filter_spec.rb +8 -8
  142. data/spec/models/chunk_group_and_file_spec.rb +8 -8
  143. data/spec/models/chunk_group_spec.rb +8 -8
  144. data/spec/models/chunk_metadata_spec.rb +8 -8
  145. data/spec/models/chunk_metadata_with_file_data_spec.rb +8 -8
  146. data/spec/models/client_dataset_configuration_spec.rb +8 -8
  147. data/spec/models/create_chunk_data_spec.rb +11 -87
  148. data/spec/models/create_chunk_group_data_spec.rb +8 -8
  149. data/spec/models/create_dataset_request_spec.rb +8 -8
  150. data/spec/models/create_message_data_spec.rb +8 -8
  151. data/spec/models/create_organization_data_spec.rb +8 -8
  152. data/spec/models/create_topic_data_spec.rb +8 -8
  153. data/spec/models/dataset_and_usage_spec.rb +8 -8
  154. data/spec/models/dataset_dto_spec.rb +8 -8
  155. data/spec/models/dataset_spec.rb +8 -8
  156. data/spec/models/dataset_usage_count_spec.rb +8 -8
  157. data/spec/models/delete_dataset_request_spec.rb +8 -8
  158. data/spec/models/delete_topic_data_spec.rb +8 -8
  159. data/spec/models/delete_user_api_key_request_spec.rb +8 -8
  160. data/spec/models/edit_message_data_spec.rb +8 -8
  161. data/spec/models/error_response_body_spec.rb +8 -8
  162. data/spec/models/event_return_spec.rb +8 -8
  163. data/spec/models/event_spec.rb +8 -8
  164. data/spec/models/field_condition_spec.rb +8 -8
  165. data/spec/models/file_dto_spec.rb +8 -8
  166. data/spec/models/file_spec.rb +8 -8
  167. data/spec/models/generate_chunks_request_spec.rb +8 -8
  168. data/spec/models/get_events_data_spec.rb +48 -0
  169. data/spec/models/get_groups_for_chunks_data_spec.rb +8 -8
  170. data/spec/models/group_data_spec.rb +8 -8
  171. data/spec/models/group_score_chunk_dto_spec.rb +8 -8
  172. data/spec/models/invitation_data_spec.rb +8 -8
  173. data/spec/models/match_condition_spec.rb +6 -6
  174. data/spec/models/message_spec.rb +8 -8
  175. data/spec/models/organization_spec.rb +8 -8
  176. data/spec/models/organization_usage_count_spec.rb +8 -8
  177. data/spec/models/range_spec.rb +8 -8
  178. data/spec/models/reccomend_group_chunks_request_spec.rb +8 -8
  179. data/spec/models/recommend_chunks_request_spec.rb +8 -8
  180. data/spec/models/regenerate_message_data_spec.rb +8 -8
  181. data/spec/models/return_queued_chunk_spec.rb +11 -21
  182. data/spec/models/score_chunk_dto_spec.rb +8 -8
  183. data/spec/models/search_chunk_data_spec.rb +8 -8
  184. data/spec/models/search_chunk_query_response_body_spec.rb +8 -8
  185. data/spec/models/search_groups_result_spec.rb +8 -8
  186. data/spec/models/search_over_groups_data_spec.rb +8 -8
  187. data/spec/models/search_over_groups_response_body_spec.rb +8 -8
  188. data/spec/models/search_within_group_data_spec.rb +8 -8
  189. data/spec/models/set_user_api_key_request_spec.rb +8 -8
  190. data/spec/models/set_user_api_key_response_spec.rb +8 -8
  191. data/spec/models/single_queued_chunk_response_spec.rb +42 -0
  192. data/spec/models/slim_group_spec.rb +8 -8
  193. data/spec/models/slim_user_spec.rb +8 -8
  194. data/spec/models/stripe_plan_spec.rb +8 -8
  195. data/spec/models/suggested_queries_request_spec.rb +8 -8
  196. data/spec/models/suggested_queries_response_spec.rb +8 -8
  197. data/spec/models/topic_spec.rb +8 -8
  198. data/spec/models/update_chunk_by_tracking_id_data_spec.rb +20 -8
  199. data/spec/models/update_chunk_data_spec.rb +20 -8
  200. data/spec/models/update_chunk_group_data_spec.rb +14 -8
  201. data/spec/models/update_dataset_request_spec.rb +8 -8
  202. data/spec/models/update_group_by_tracking_id_data_spec.rb +8 -8
  203. data/spec/models/update_organization_data_spec.rb +8 -8
  204. data/spec/models/update_topic_data_spec.rb +8 -8
  205. data/spec/models/update_user_data_spec.rb +8 -8
  206. data/spec/models/upload_file_data_spec.rb +8 -8
  207. data/spec/models/upload_file_result_spec.rb +8 -8
  208. data/spec/models/user_organization_spec.rb +8 -8
  209. data/spec/spec_helper.rb +1 -1
  210. data/trieve_ruby_client-0.3.5.gem +0 -0
  211. data/trieve_ruby_client-0.4.0.gem +0 -0
  212. data/trieve_ruby_client.gemspec +1 -1
  213. metadata +24 -8
  214. data/docs/StripeSubscription.md +0 -30
  215. data/spec/models/stripe_subscription_spec.rb +0 -72
  216. data/trieve_ruby_client-0.3.4.gem +0 -0
  217. data/trieve_ruby_client-0.3.41.gem +0 -0
@@ -0,0 +1,240 @@
1
+ =begin
2
+ #Trieve API
3
+
4
+ #Trieve OpenAPI Specification. This document describes all of the operations available through the Trieve API.
5
+
6
+ The version of the OpenAPI document: 0.5.0
7
+ Contact: developers@trieve.ai
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.4.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module TrieveRubyClient
17
+ class GetEventsData
18
+ # The types of events to get. Any combination of file_uploaded, card_uploaded, card_action_failed, or card_updated. Leave undefined to get all events.
19
+ attr_accessor :event_types
20
+
21
+ # The page number to get. Default is 1.
22
+ attr_accessor :page
23
+
24
+ # The number of items per page. Default is 10.
25
+ attr_accessor :page_size
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'event_types' => :'event_types',
31
+ :'page' => :'page',
32
+ :'page_size' => :'page_size'
33
+ }
34
+ end
35
+
36
+ # Returns all the JSON keys this model knows about
37
+ def self.acceptable_attributes
38
+ attribute_map.values
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.openapi_types
43
+ {
44
+ :'event_types' => :'Array<String>',
45
+ :'page' => :'Integer',
46
+ :'page_size' => :'Integer'
47
+ }
48
+ end
49
+
50
+ # List of attributes with nullable: true
51
+ def self.openapi_nullable
52
+ Set.new([
53
+ :'event_types',
54
+ :'page',
55
+ :'page_size'
56
+ ])
57
+ end
58
+
59
+ # Initializes the object
60
+ # @param [Hash] attributes Model attributes in the form of hash
61
+ def initialize(attributes = {})
62
+ if (!attributes.is_a?(Hash))
63
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TrieveRubyClient::GetEventsData` initialize method"
64
+ end
65
+
66
+ # check to see if the attribute exists and convert string to symbol for hash key
67
+ attributes = attributes.each_with_object({}) { |(k, v), h|
68
+ if (!self.class.attribute_map.key?(k.to_sym))
69
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TrieveRubyClient::GetEventsData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
70
+ end
71
+ h[k.to_sym] = v
72
+ }
73
+
74
+ if attributes.key?(:'event_types')
75
+ if (value = attributes[:'event_types']).is_a?(Array)
76
+ self.event_types = value
77
+ end
78
+ end
79
+
80
+ if attributes.key?(:'page')
81
+ self.page = attributes[:'page']
82
+ end
83
+
84
+ if attributes.key?(:'page_size')
85
+ self.page_size = attributes[:'page_size']
86
+ end
87
+ end
88
+
89
+ # Show invalid properties with the reasons. Usually used together with valid?
90
+ # @return Array for valid properties with the reasons
91
+ def list_invalid_properties
92
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
93
+ invalid_properties = Array.new
94
+ invalid_properties
95
+ end
96
+
97
+ # Check to see if the all the properties in the model are valid
98
+ # @return true if the model is valid
99
+ def valid?
100
+ warn '[DEPRECATED] the `valid?` method is obsolete'
101
+ true
102
+ end
103
+
104
+ # Checks equality by comparing each attribute.
105
+ # @param [Object] Object to be compared
106
+ def ==(o)
107
+ return true if self.equal?(o)
108
+ self.class == o.class &&
109
+ event_types == o.event_types &&
110
+ page == o.page &&
111
+ page_size == o.page_size
112
+ end
113
+
114
+ # @see the `==` method
115
+ # @param [Object] Object to be compared
116
+ def eql?(o)
117
+ self == o
118
+ end
119
+
120
+ # Calculates hash code according to all attributes.
121
+ # @return [Integer] Hash code
122
+ def hash
123
+ [event_types, page, page_size].hash
124
+ end
125
+
126
+ # Builds the object from hash
127
+ # @param [Hash] attributes Model attributes in the form of hash
128
+ # @return [Object] Returns the model itself
129
+ def self.build_from_hash(attributes)
130
+ return nil unless attributes.is_a?(Hash)
131
+ attributes = attributes.transform_keys(&:to_sym)
132
+ transformed_hash = {}
133
+ openapi_types.each_pair do |key, type|
134
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
135
+ transformed_hash["#{key}"] = nil
136
+ elsif type =~ /\AArray<(.*)>/i
137
+ # check to ensure the input is an array given that the attribute
138
+ # is documented as an array but the input is not
139
+ if attributes[attribute_map[key]].is_a?(Array)
140
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
141
+ end
142
+ elsif !attributes[attribute_map[key]].nil?
143
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
144
+ end
145
+ end
146
+ new(transformed_hash)
147
+ end
148
+
149
+ # Deserializes the data based on type
150
+ # @param string type Data type
151
+ # @param string value Value to be deserialized
152
+ # @return [Object] Deserialized data
153
+ def self._deserialize(type, value)
154
+ case type.to_sym
155
+ when :Time
156
+ Time.parse(value)
157
+ when :Date
158
+ Date.parse(value)
159
+ when :String
160
+ value.to_s
161
+ when :Integer
162
+ value.to_i
163
+ when :Float
164
+ value.to_f
165
+ when :Boolean
166
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
167
+ true
168
+ else
169
+ false
170
+ end
171
+ when :Object
172
+ # generic object (usually a Hash), return directly
173
+ value
174
+ when /\AArray<(?<inner_type>.+)>\z/
175
+ inner_type = Regexp.last_match[:inner_type]
176
+ value.map { |v| _deserialize(inner_type, v) }
177
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
178
+ k_type = Regexp.last_match[:k_type]
179
+ v_type = Regexp.last_match[:v_type]
180
+ {}.tap do |hash|
181
+ value.each do |k, v|
182
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
183
+ end
184
+ end
185
+ else # model
186
+ # models (e.g. Pet) or oneOf
187
+ klass = TrieveRubyClient.const_get(type)
188
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
189
+ end
190
+ end
191
+
192
+ # Returns the string representation of the object
193
+ # @return [String] String presentation of the object
194
+ def to_s
195
+ to_hash.to_s
196
+ end
197
+
198
+ # to_body is an alias to to_hash (backward compatibility)
199
+ # @return [Hash] Returns the object in the form of hash
200
+ def to_body
201
+ to_hash
202
+ end
203
+
204
+ # Returns the object in the form of hash
205
+ # @return [Hash] Returns the object in the form of hash
206
+ def to_hash
207
+ hash = {}
208
+ self.class.attribute_map.each_pair do |attr, param|
209
+ value = self.send(attr)
210
+ if value.nil?
211
+ is_nullable = self.class.openapi_nullable.include?(attr)
212
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
213
+ end
214
+
215
+ hash[param] = _to_hash(value)
216
+ end
217
+ hash
218
+ end
219
+
220
+ # Outputs non-array value in the form of hash
221
+ # For object, use to_hash. Otherwise, just return the value
222
+ # @param [Object] value Any valid value
223
+ # @return [Hash] Returns the value in the form of hash
224
+ def _to_hash(value)
225
+ if value.is_a?(Array)
226
+ value.compact.map { |v| _to_hash(v) }
227
+ elsif value.is_a?(Hash)
228
+ {}.tap do |hash|
229
+ value.each { |k, v| hash[k] = _to_hash(v) }
230
+ end
231
+ elsif value.respond_to? :to_hash
232
+ value.to_hash
233
+ else
234
+ value
235
+ end
236
+ end
237
+
238
+ end
239
+
240
+ end
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Trieve OpenAPI Specification. This document describes all of the operations available through the Trieve API.
5
5
 
6
- The version of the OpenAPI document: 0.3.5
6
+ The version of the OpenAPI document: 0.5.0
7
7
  Contact: developers@trieve.ai
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.4.0
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Trieve OpenAPI Specification. This document describes all of the operations available through the Trieve API.
5
5
 
6
- The version of the OpenAPI document: 0.3.5
6
+ The version of the OpenAPI document: 0.5.0
7
7
  Contact: developers@trieve.ai
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.4.0
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Trieve OpenAPI Specification. This document describes all of the operations available through the Trieve API.
5
5
 
6
- The version of the OpenAPI document: 0.3.5
6
+ The version of the OpenAPI document: 0.5.0
7
7
  Contact: developers@trieve.ai
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.4.0
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Trieve OpenAPI Specification. This document describes all of the operations available through the Trieve API.
5
5
 
6
- The version of the OpenAPI document: 0.3.5
6
+ The version of the OpenAPI document: 0.5.0
7
7
  Contact: developers@trieve.ai
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.4.0
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Trieve OpenAPI Specification. This document describes all of the operations available through the Trieve API.
5
5
 
6
- The version of the OpenAPI document: 0.3.5
6
+ The version of the OpenAPI document: 0.5.0
7
7
  Contact: developers@trieve.ai
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.4.0
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Trieve OpenAPI Specification. This document describes all of the operations available through the Trieve API.
5
5
 
6
- The version of the OpenAPI document: 0.3.5
6
+ The version of the OpenAPI document: 0.5.0
7
7
  Contact: developers@trieve.ai
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.4.0
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Trieve OpenAPI Specification. This document describes all of the operations available through the Trieve API.
5
5
 
6
- The version of the OpenAPI document: 0.3.5
6
+ The version of the OpenAPI document: 0.5.0
7
7
  Contact: developers@trieve.ai
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.4.0
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Trieve OpenAPI Specification. This document describes all of the operations available through the Trieve API.
5
5
 
6
- The version of the OpenAPI document: 0.3.5
6
+ The version of the OpenAPI document: 0.5.0
7
7
  Contact: developers@trieve.ai
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.4.0
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Trieve OpenAPI Specification. This document describes all of the operations available through the Trieve API.
5
5
 
6
- The version of the OpenAPI document: 0.3.5
6
+ The version of the OpenAPI document: 0.5.0
7
7
  Contact: developers@trieve.ai
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.4.0
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Trieve OpenAPI Specification. This document describes all of the operations available through the Trieve API.
5
5
 
6
- The version of the OpenAPI document: 0.3.5
6
+ The version of the OpenAPI document: 0.5.0
7
7
  Contact: developers@trieve.ai
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.4.0
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Trieve OpenAPI Specification. This document describes all of the operations available through the Trieve API.
5
5
 
6
- The version of the OpenAPI document: 0.3.5
6
+ The version of the OpenAPI document: 0.5.0
7
7
  Contact: developers@trieve.ai
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.4.0
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Trieve OpenAPI Specification. This document describes all of the operations available through the Trieve API.
5
5
 
6
- The version of the OpenAPI document: 0.3.5
6
+ The version of the OpenAPI document: 0.5.0
7
7
  Contact: developers@trieve.ai
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.4.0
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Trieve OpenAPI Specification. This document describes all of the operations available through the Trieve API.
5
5
 
6
- The version of the OpenAPI document: 0.3.5
6
+ The version of the OpenAPI document: 0.5.0
7
7
  Contact: developers@trieve.ai
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.4.0
@@ -14,224 +14,92 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module TrieveRubyClient
17
- class ReturnQueuedChunk
18
- attr_accessor :chunk_metadata
19
-
20
- attr_accessor :pos_in_queue
21
-
22
- # Attribute mapping from ruby-style variable name to JSON key.
23
- def self.attribute_map
24
- {
25
- :'chunk_metadata' => :'chunk_metadata',
26
- :'pos_in_queue' => :'pos_in_queue'
27
- }
28
- end
29
-
30
- # Returns all the JSON keys this model knows about
31
- def self.acceptable_attributes
32
- attribute_map.values
33
- end
34
-
35
- # Attribute type mapping.
36
- def self.openapi_types
37
- {
38
- :'chunk_metadata' => :'ChunkMetadata',
39
- :'pos_in_queue' => :'Integer'
40
- }
41
- end
42
-
43
- # List of attributes with nullable: true
44
- def self.openapi_nullable
45
- Set.new([
46
- ])
47
- end
48
-
49
- # Initializes the object
50
- # @param [Hash] attributes Model attributes in the form of hash
51
- def initialize(attributes = {})
52
- if (!attributes.is_a?(Hash))
53
- fail ArgumentError, "The input argument (attributes) must be a hash in `TrieveRubyClient::ReturnQueuedChunk` initialize method"
17
+ module ReturnQueuedChunk
18
+ class << self
19
+ # List of class defined in oneOf (OpenAPI v3)
20
+ def openapi_one_of
21
+ [
22
+ :'BatchQueuedChunkResponse',
23
+ :'SingleQueuedChunkResponse'
24
+ ]
54
25
  end
55
26
 
56
- # check to see if the attribute exists and convert string to symbol for hash key
57
- attributes = attributes.each_with_object({}) { |(k, v), h|
58
- if (!self.class.attribute_map.key?(k.to_sym))
59
- fail ArgumentError, "`#{k}` is not a valid attribute in `TrieveRubyClient::ReturnQueuedChunk`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
27
+ # Builds the object
28
+ # @param [Mixed] Data to be matched against the list of oneOf items
29
+ # @return [Object] Returns the model or the data itself
30
+ def build(data)
31
+ # Go through the list of oneOf items and attempt to identify the appropriate one.
32
+ # Note:
33
+ # - We do not attempt to check whether exactly one item matches.
34
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
35
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
36
+ # - TODO: scalar values are de facto behaving as if they were nullable.
37
+ # - TODO: logging when debugging is set.
38
+ openapi_one_of.each do |klass|
39
+ begin
40
+ next if klass == :AnyType # "nullable: true"
41
+ typed_data = find_and_cast_into_type(klass, data)
42
+ return typed_data if typed_data
43
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
44
+ end
60
45
  end
61
- h[k.to_sym] = v
62
- }
63
-
64
- if attributes.key?(:'chunk_metadata')
65
- self.chunk_metadata = attributes[:'chunk_metadata']
66
- else
67
- self.chunk_metadata = nil
68
- end
69
-
70
- if attributes.key?(:'pos_in_queue')
71
- self.pos_in_queue = attributes[:'pos_in_queue']
72
- else
73
- self.pos_in_queue = nil
74
- end
75
- end
76
-
77
- # Show invalid properties with the reasons. Usually used together with valid?
78
- # @return Array for valid properties with the reasons
79
- def list_invalid_properties
80
- warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
81
- invalid_properties = Array.new
82
- if @chunk_metadata.nil?
83
- invalid_properties.push('invalid value for "chunk_metadata", chunk_metadata cannot be nil.')
84
- end
85
46
 
86
- if @pos_in_queue.nil?
87
- invalid_properties.push('invalid value for "pos_in_queue", pos_in_queue cannot be nil.')
47
+ openapi_one_of.include?(:AnyType) ? data : nil
88
48
  end
89
49
 
90
- invalid_properties
91
- end
92
-
93
- # Check to see if the all the properties in the model are valid
94
- # @return true if the model is valid
95
- def valid?
96
- warn '[DEPRECATED] the `valid?` method is obsolete'
97
- return false if @chunk_metadata.nil?
98
- return false if @pos_in_queue.nil?
99
- true
100
- end
101
-
102
- # Checks equality by comparing each attribute.
103
- # @param [Object] Object to be compared
104
- def ==(o)
105
- return true if self.equal?(o)
106
- self.class == o.class &&
107
- chunk_metadata == o.chunk_metadata &&
108
- pos_in_queue == o.pos_in_queue
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
- [chunk_metadata, pos_in_queue].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) }
50
+ private
51
+
52
+ SchemaMismatchError = Class.new(StandardError)
53
+
54
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
55
+ def find_and_cast_into_type(klass, data)
56
+ return if data.nil?
57
+
58
+ case klass.to_s
59
+ when 'Boolean'
60
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
61
+ when 'Float'
62
+ return data if data.instance_of?(Float)
63
+ when 'Integer'
64
+ return data if data.instance_of?(Integer)
65
+ when 'Time'
66
+ return Time.parse(data)
67
+ when 'Date'
68
+ return Date.parse(data)
69
+ when 'String'
70
+ return data if data.instance_of?(String)
71
+ when 'Object' # "type: object"
72
+ return data if data.instance_of?(Hash)
73
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
74
+ if data.instance_of?(Array)
75
+ sub_type = Regexp.last_match[:sub_type]
76
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
138
77
  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)
78
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
79
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
80
+ sub_type = Regexp.last_match[:sub_type]
81
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
82
+ end
83
+ else # model
84
+ const = TrieveRubyClient.const_get(klass)
85
+ if const
86
+ if const.respond_to?(:openapi_one_of) # nested oneOf model
87
+ model = const.build(data)
88
+ return model if model
89
+ else
90
+ # raise if data contains keys that are not known to the model
91
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
92
+ model = const.build_from_hash(data)
93
+ return model if model
94
+ end
180
95
  end
181
- end
182
- else # model
183
- # models (e.g. Pet) or oneOf
184
- klass = TrieveRubyClient.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
96
  end
211
97
 
212
- hash[param] = _to_hash(value)
98
+ raise # if no match by now, raise
99
+ rescue
100
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
213
101
  end
214
- hash
215
102
  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
103
  end
236
104
 
237
105
  end
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Trieve OpenAPI Specification. This document describes all of the operations available through the Trieve API.
5
5
 
6
- The version of the OpenAPI document: 0.3.5
6
+ The version of the OpenAPI document: 0.5.0
7
7
  Contact: developers@trieve.ai
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.4.0