carbon_ruby_sdk 0.2.41 → 0.2.43
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +273 -3
- data/lib/carbon_ruby_sdk/api/data_sources_api.rb +196 -0
- data/lib/carbon_ruby_sdk/api/files_api.rb +4 -4
- data/lib/carbon_ruby_sdk/api/integrations_api.rb +48 -16
- data/lib/carbon_ruby_sdk/api/users_api.rb +71 -0
- data/lib/carbon_ruby_sdk/api/white_label_api.rb +393 -0
- data/lib/carbon_ruby_sdk/models/add_data_source_tags_input.rb +234 -0
- data/lib/carbon_ruby_sdk/models/azure_blob_auth_request.rb +14 -4
- data/lib/carbon_ruby_sdk/models/cold_storage_props.rb +1 -1
- data/lib/carbon_ruby_sdk/models/credentials.rb +244 -0
- data/lib/carbon_ruby_sdk/models/delete_white_label_request.rb +222 -0
- data/lib/carbon_ruby_sdk/models/external_source_item.rb +11 -1
- data/lib/carbon_ruby_sdk/models/fresh_desk_connect_request.rb +15 -5
- data/lib/carbon_ruby_sdk/models/gitbook_connect_request.rb +15 -5
- data/lib/carbon_ruby_sdk/models/github_connect_request.rb +14 -4
- data/lib/carbon_ruby_sdk/models/google_drive_credentials.rb +254 -0
- data/lib/carbon_ruby_sdk/models/google_drive_white_label_input.rb +230 -0
- data/lib/carbon_ruby_sdk/models/guru_connect_request.rb +15 -5
- data/lib/carbon_ruby_sdk/models/list_white_label_request.rb +246 -0
- data/lib/carbon_ruby_sdk/models/o_auth_url_request.rb +15 -5
- data/lib/carbon_ruby_sdk/models/one_drive_sharepoint_credentials.rb +264 -0
- data/lib/carbon_ruby_sdk/models/one_drive_sharepoint_white_label_input.rb +234 -0
- data/lib/carbon_ruby_sdk/models/one_drive_sharepoint_white_label_input_data_source_type.rb +36 -0
- data/lib/carbon_ruby_sdk/models/organization_user_data_source_api.rb +15 -1
- data/lib/carbon_ruby_sdk/models/organization_user_data_source_filters.rb +12 -1
- data/lib/carbon_ruby_sdk/models/remove_data_source_tags_input.rb +242 -0
- data/lib/carbon_ruby_sdk/models/rss_feed_input.rb +15 -5
- data/lib/carbon_ruby_sdk/models/s3_auth_request.rb +15 -5
- data/lib/carbon_ruby_sdk/models/sync_options.rb +15 -5
- data/lib/carbon_ruby_sdk/models/user_response.rb +18 -4
- data/lib/carbon_ruby_sdk/models/white_label_create_request_inner.rb +255 -0
- data/lib/carbon_ruby_sdk/models/white_label_filters.rb +230 -0
- data/lib/carbon_ruby_sdk/models/white_label_input.rb +234 -0
- data/lib/carbon_ruby_sdk/models/white_label_input_data_source_type.rb +48 -0
- data/lib/carbon_ruby_sdk/models/white_label_order_by_columns.rb +36 -0
- data/lib/carbon_ruby_sdk/models/white_label_update_request.rb +255 -0
- data/lib/carbon_ruby_sdk/models/white_labeling_response.rb +18 -4
- data/lib/carbon_ruby_sdk/version.rb +1 -1
- data/lib/carbon_ruby_sdk.rb +19 -0
- data/spec/api/data_sources_api_spec.rb +22 -0
- data/spec/api/files_api_spec.rb +1 -1
- data/spec/api/users_api_spec.rb +10 -0
- data/spec/api/white_label_api_spec.rb +73 -0
- data/spec/models/add_data_source_tags_input_spec.rb +34 -0
- data/spec/models/azure_blob_auth_request_spec.rb +6 -0
- data/spec/models/credentials_spec.rb +40 -0
- data/spec/models/delete_white_label_request_spec.rb +28 -0
- data/spec/models/external_source_item_spec.rb +6 -0
- data/spec/models/fresh_desk_connect_request_spec.rb +6 -0
- data/spec/models/gitbook_connect_request_spec.rb +6 -0
- data/spec/models/github_connect_request_spec.rb +6 -0
- data/spec/models/google_drive_credentials_spec.rb +46 -0
- data/spec/models/google_drive_white_label_input_spec.rb +34 -0
- data/spec/models/guru_connect_request_spec.rb +6 -0
- data/spec/models/list_white_label_request_spec.rb +46 -0
- data/spec/models/o_auth_url_request_spec.rb +6 -0
- data/spec/models/one_drive_sharepoint_credentials_spec.rb +52 -0
- data/spec/models/one_drive_sharepoint_white_label_input_data_source_type_spec.rb +22 -0
- data/spec/models/one_drive_sharepoint_white_label_input_spec.rb +34 -0
- data/spec/models/organization_user_data_source_api_spec.rb +6 -0
- data/spec/models/organization_user_data_source_filters_spec.rb +6 -0
- data/spec/models/remove_data_source_tags_input_spec.rb +40 -0
- data/spec/models/rss_feed_input_spec.rb +6 -0
- data/spec/models/s3_auth_request_spec.rb +6 -0
- data/spec/models/sync_options_spec.rb +6 -0
- data/spec/models/user_response_spec.rb +6 -0
- data/spec/models/white_label_create_request_inner_spec.rb +34 -0
- data/spec/models/white_label_filters_spec.rb +34 -0
- data/spec/models/white_label_input_data_source_type_spec.rb +22 -0
- data/spec/models/white_label_input_spec.rb +34 -0
- data/spec/models/white_label_order_by_columns_spec.rb +22 -0
- data/spec/models/white_label_update_request_spec.rb +34 -0
- data/spec/models/white_labeling_response_spec.rb +6 -0
- metadata +53 -2
@@ -18,12 +18,16 @@ module Carbon
|
|
18
18
|
# Enabling this flag will fetch all available content from the source to be listed via list items endpoint
|
19
19
|
attr_accessor :sync_source_items
|
20
20
|
|
21
|
+
# Tags to be associated with the data source. If the data source already has tags set, then an upsert will be performed.
|
22
|
+
attr_accessor :data_source_tags
|
23
|
+
|
21
24
|
# Attribute mapping from ruby-style variable name to JSON key.
|
22
25
|
def self.attribute_map
|
23
26
|
{
|
24
27
|
:'username' => :'username',
|
25
28
|
:'access_token' => :'access_token',
|
26
|
-
:'sync_source_items' => :'sync_source_items'
|
29
|
+
:'sync_source_items' => :'sync_source_items',
|
30
|
+
:'data_source_tags' => :'data_source_tags'
|
27
31
|
}
|
28
32
|
end
|
29
33
|
|
@@ -37,7 +41,8 @@ module Carbon
|
|
37
41
|
{
|
38
42
|
:'username' => :'String',
|
39
43
|
:'access_token' => :'String',
|
40
|
-
:'sync_source_items' => :'Boolean'
|
44
|
+
:'sync_source_items' => :'Boolean',
|
45
|
+
:'data_source_tags' => :'Object'
|
41
46
|
}
|
42
47
|
end
|
43
48
|
|
@@ -75,6 +80,10 @@ module Carbon
|
|
75
80
|
else
|
76
81
|
self.sync_source_items = false
|
77
82
|
end
|
83
|
+
|
84
|
+
if attributes.key?(:'data_source_tags')
|
85
|
+
self.data_source_tags = attributes[:'data_source_tags']
|
86
|
+
end
|
78
87
|
end
|
79
88
|
|
80
89
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -107,7 +116,8 @@ module Carbon
|
|
107
116
|
self.class == o.class &&
|
108
117
|
username == o.username &&
|
109
118
|
access_token == o.access_token &&
|
110
|
-
sync_source_items == o.sync_source_items
|
119
|
+
sync_source_items == o.sync_source_items &&
|
120
|
+
data_source_tags == o.data_source_tags
|
111
121
|
end
|
112
122
|
|
113
123
|
# @see the `==` method
|
@@ -119,7 +129,7 @@ module Carbon
|
|
119
129
|
# Calculates hash code according to all attributes.
|
120
130
|
# @return [Integer] Hash code
|
121
131
|
def hash
|
122
|
-
[username, access_token, sync_source_items].hash
|
132
|
+
[username, access_token, sync_source_items, data_source_tags].hash
|
123
133
|
end
|
124
134
|
|
125
135
|
# Builds the object from hash
|
@@ -0,0 +1,254 @@
|
|
1
|
+
=begin
|
2
|
+
#Carbon
|
3
|
+
|
4
|
+
#Connect external data to LLMs, no matter the source.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
=end
|
8
|
+
|
9
|
+
require 'date'
|
10
|
+
require 'time'
|
11
|
+
|
12
|
+
module Carbon
|
13
|
+
class GoogleDriveCredentials
|
14
|
+
attr_accessor :client_id
|
15
|
+
|
16
|
+
attr_accessor :redirect_uri
|
17
|
+
|
18
|
+
attr_accessor :client_secret
|
19
|
+
|
20
|
+
attr_accessor :api_key
|
21
|
+
|
22
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
23
|
+
def self.attribute_map
|
24
|
+
{
|
25
|
+
:'client_id' => :'client_id',
|
26
|
+
:'redirect_uri' => :'redirect_uri',
|
27
|
+
:'client_secret' => :'client_secret',
|
28
|
+
:'api_key' => :'api_key'
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
# Returns all the JSON keys this model knows about
|
33
|
+
def self.acceptable_attributes
|
34
|
+
attribute_map.values
|
35
|
+
end
|
36
|
+
|
37
|
+
# Attribute type mapping.
|
38
|
+
def self.openapi_types
|
39
|
+
{
|
40
|
+
:'client_id' => :'String',
|
41
|
+
:'redirect_uri' => :'String',
|
42
|
+
:'client_secret' => :'String',
|
43
|
+
:'api_key' => :'String'
|
44
|
+
}
|
45
|
+
end
|
46
|
+
|
47
|
+
# List of attributes with nullable: true
|
48
|
+
def self.openapi_nullable
|
49
|
+
Set.new([
|
50
|
+
:'client_secret',
|
51
|
+
:'api_key'
|
52
|
+
])
|
53
|
+
end
|
54
|
+
|
55
|
+
# Initializes the object
|
56
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
57
|
+
def initialize(attributes = {})
|
58
|
+
if (!attributes.is_a?(Hash))
|
59
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Carbon::GoogleDriveCredentials` initialize method"
|
60
|
+
end
|
61
|
+
|
62
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
63
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
64
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
65
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Carbon::GoogleDriveCredentials`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
66
|
+
end
|
67
|
+
h[k.to_sym] = v
|
68
|
+
}
|
69
|
+
|
70
|
+
if attributes.key?(:'client_id')
|
71
|
+
self.client_id = attributes[:'client_id']
|
72
|
+
end
|
73
|
+
|
74
|
+
if attributes.key?(:'redirect_uri')
|
75
|
+
self.redirect_uri = attributes[:'redirect_uri']
|
76
|
+
end
|
77
|
+
|
78
|
+
if attributes.key?(:'client_secret')
|
79
|
+
self.client_secret = attributes[:'client_secret']
|
80
|
+
end
|
81
|
+
|
82
|
+
if attributes.key?(:'api_key')
|
83
|
+
self.api_key = attributes[:'api_key']
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
88
|
+
# @return Array for valid properties with the reasons
|
89
|
+
def list_invalid_properties
|
90
|
+
invalid_properties = Array.new
|
91
|
+
if @client_id.nil?
|
92
|
+
invalid_properties.push('invalid value for "client_id", client_id cannot be nil.')
|
93
|
+
end
|
94
|
+
|
95
|
+
if @redirect_uri.nil?
|
96
|
+
invalid_properties.push('invalid value for "redirect_uri", redirect_uri cannot be nil.')
|
97
|
+
end
|
98
|
+
|
99
|
+
invalid_properties
|
100
|
+
end
|
101
|
+
|
102
|
+
# Check to see if the all the properties in the model are valid
|
103
|
+
# @return true if the model is valid
|
104
|
+
def valid?
|
105
|
+
return false if @client_id.nil?
|
106
|
+
return false if @redirect_uri.nil?
|
107
|
+
true
|
108
|
+
end
|
109
|
+
|
110
|
+
# Checks equality by comparing each attribute.
|
111
|
+
# @param [Object] Object to be compared
|
112
|
+
def ==(o)
|
113
|
+
return true if self.equal?(o)
|
114
|
+
self.class == o.class &&
|
115
|
+
client_id == o.client_id &&
|
116
|
+
redirect_uri == o.redirect_uri &&
|
117
|
+
client_secret == o.client_secret &&
|
118
|
+
api_key == o.api_key
|
119
|
+
end
|
120
|
+
|
121
|
+
# @see the `==` method
|
122
|
+
# @param [Object] Object to be compared
|
123
|
+
def eql?(o)
|
124
|
+
self == o
|
125
|
+
end
|
126
|
+
|
127
|
+
# Calculates hash code according to all attributes.
|
128
|
+
# @return [Integer] Hash code
|
129
|
+
def hash
|
130
|
+
[client_id, redirect_uri, client_secret, api_key].hash
|
131
|
+
end
|
132
|
+
|
133
|
+
# Builds the object from hash
|
134
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
135
|
+
# @return [Object] Returns the model itself
|
136
|
+
def self.build_from_hash(attributes)
|
137
|
+
new.build_from_hash(attributes)
|
138
|
+
end
|
139
|
+
|
140
|
+
# Builds the object from hash
|
141
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
142
|
+
# @return [Object] Returns the model itself
|
143
|
+
def build_from_hash(attributes)
|
144
|
+
return nil unless attributes.is_a?(Hash)
|
145
|
+
attributes = attributes.transform_keys(&:to_sym)
|
146
|
+
self.class.openapi_types.each_pair do |key, type|
|
147
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
148
|
+
self.send("#{key}=", nil)
|
149
|
+
elsif type =~ /\AArray<(.*)>/i
|
150
|
+
# check to ensure the input is an array given that the attribute
|
151
|
+
# is documented as an array but the input is not
|
152
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
153
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
154
|
+
end
|
155
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
156
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
self
|
161
|
+
end
|
162
|
+
|
163
|
+
# Deserializes the data based on type
|
164
|
+
# @param string type Data type
|
165
|
+
# @param string value Value to be deserialized
|
166
|
+
# @return [Object] Deserialized data
|
167
|
+
def _deserialize(type, value)
|
168
|
+
case type.to_sym
|
169
|
+
when :Time
|
170
|
+
Time.parse(value)
|
171
|
+
when :Date
|
172
|
+
Date.parse(value)
|
173
|
+
when :String
|
174
|
+
value.to_s
|
175
|
+
when :Integer
|
176
|
+
value.to_i
|
177
|
+
when :Float
|
178
|
+
value.to_f
|
179
|
+
when :Boolean
|
180
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
181
|
+
true
|
182
|
+
else
|
183
|
+
false
|
184
|
+
end
|
185
|
+
when :Object
|
186
|
+
# generic object (usually a Hash), return directly
|
187
|
+
value
|
188
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
189
|
+
inner_type = Regexp.last_match[:inner_type]
|
190
|
+
value.map { |v| _deserialize(inner_type, v) }
|
191
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
192
|
+
k_type = Regexp.last_match[:k_type]
|
193
|
+
v_type = Regexp.last_match[:v_type]
|
194
|
+
{}.tap do |hash|
|
195
|
+
value.each do |k, v|
|
196
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
197
|
+
end
|
198
|
+
end
|
199
|
+
else # model
|
200
|
+
# models (e.g. Pet) or oneOf
|
201
|
+
klass = Carbon.const_get(type)
|
202
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
# Returns the string representation of the object
|
207
|
+
# @return [String] String presentation of the object
|
208
|
+
def to_s
|
209
|
+
to_hash.to_s
|
210
|
+
end
|
211
|
+
|
212
|
+
# to_body is an alias to to_hash (backward compatibility)
|
213
|
+
# @return [Hash] Returns the object in the form of hash
|
214
|
+
def to_body
|
215
|
+
to_hash
|
216
|
+
end
|
217
|
+
|
218
|
+
# Returns the object in the form of hash
|
219
|
+
# @return [Hash] Returns the object in the form of hash
|
220
|
+
def to_hash
|
221
|
+
hash = {}
|
222
|
+
self.class.attribute_map.each_pair do |attr, param|
|
223
|
+
value = self.send(attr)
|
224
|
+
if value.nil?
|
225
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
226
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
227
|
+
end
|
228
|
+
|
229
|
+
hash[param] = _to_hash(value)
|
230
|
+
end
|
231
|
+
hash
|
232
|
+
end
|
233
|
+
|
234
|
+
# Outputs non-array value in the form of hash
|
235
|
+
# For object, use to_hash. Otherwise, just return the value
|
236
|
+
# @param [Object] value Any valid value
|
237
|
+
# @return [Hash] Returns the value in the form of hash
|
238
|
+
def _to_hash(value)
|
239
|
+
if value.is_a?(Array)
|
240
|
+
value.compact.map { |v| _to_hash(v) }
|
241
|
+
elsif value.is_a?(Hash)
|
242
|
+
{}.tap do |hash|
|
243
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
244
|
+
end
|
245
|
+
elsif value.respond_to? :to_hash
|
246
|
+
value.to_hash
|
247
|
+
else
|
248
|
+
value
|
249
|
+
end
|
250
|
+
end
|
251
|
+
|
252
|
+
end
|
253
|
+
|
254
|
+
end
|
@@ -0,0 +1,230 @@
|
|
1
|
+
=begin
|
2
|
+
#Carbon
|
3
|
+
|
4
|
+
#Connect external data to LLMs, no matter the source.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
=end
|
8
|
+
|
9
|
+
require 'date'
|
10
|
+
require 'time'
|
11
|
+
|
12
|
+
module Carbon
|
13
|
+
class GoogleDriveWhiteLabelInput
|
14
|
+
attr_accessor :data_source_type
|
15
|
+
|
16
|
+
attr_accessor :credentials
|
17
|
+
|
18
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
19
|
+
def self.attribute_map
|
20
|
+
{
|
21
|
+
:'data_source_type' => :'data_source_type',
|
22
|
+
:'credentials' => :'credentials'
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
# Returns all the JSON keys this model knows about
|
27
|
+
def self.acceptable_attributes
|
28
|
+
attribute_map.values
|
29
|
+
end
|
30
|
+
|
31
|
+
# Attribute type mapping.
|
32
|
+
def self.openapi_types
|
33
|
+
{
|
34
|
+
:'data_source_type' => :'Object',
|
35
|
+
:'credentials' => :'GoogleDriveCredentials'
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# List of attributes with nullable: true
|
40
|
+
def self.openapi_nullable
|
41
|
+
Set.new([
|
42
|
+
:'data_source_type',
|
43
|
+
])
|
44
|
+
end
|
45
|
+
|
46
|
+
# Initializes the object
|
47
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
48
|
+
def initialize(attributes = {})
|
49
|
+
if (!attributes.is_a?(Hash))
|
50
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Carbon::GoogleDriveWhiteLabelInput` initialize method"
|
51
|
+
end
|
52
|
+
|
53
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
54
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
55
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
56
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Carbon::GoogleDriveWhiteLabelInput`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
57
|
+
end
|
58
|
+
h[k.to_sym] = v
|
59
|
+
}
|
60
|
+
|
61
|
+
if attributes.key?(:'data_source_type')
|
62
|
+
self.data_source_type = attributes[:'data_source_type']
|
63
|
+
end
|
64
|
+
|
65
|
+
if attributes.key?(:'credentials')
|
66
|
+
self.credentials = attributes[:'credentials']
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
71
|
+
# @return Array for valid properties with the reasons
|
72
|
+
def list_invalid_properties
|
73
|
+
invalid_properties = Array.new
|
74
|
+
if @credentials.nil?
|
75
|
+
invalid_properties.push('invalid value for "credentials", credentials cannot be nil.')
|
76
|
+
end
|
77
|
+
|
78
|
+
invalid_properties
|
79
|
+
end
|
80
|
+
|
81
|
+
# Check to see if the all the properties in the model are valid
|
82
|
+
# @return true if the model is valid
|
83
|
+
def valid?
|
84
|
+
return false if @credentials.nil?
|
85
|
+
true
|
86
|
+
end
|
87
|
+
|
88
|
+
# Checks equality by comparing each attribute.
|
89
|
+
# @param [Object] Object to be compared
|
90
|
+
def ==(o)
|
91
|
+
return true if self.equal?(o)
|
92
|
+
self.class == o.class &&
|
93
|
+
data_source_type == o.data_source_type &&
|
94
|
+
credentials == o.credentials
|
95
|
+
end
|
96
|
+
|
97
|
+
# @see the `==` method
|
98
|
+
# @param [Object] Object to be compared
|
99
|
+
def eql?(o)
|
100
|
+
self == o
|
101
|
+
end
|
102
|
+
|
103
|
+
# Calculates hash code according to all attributes.
|
104
|
+
# @return [Integer] Hash code
|
105
|
+
def hash
|
106
|
+
[data_source_type, credentials].hash
|
107
|
+
end
|
108
|
+
|
109
|
+
# Builds the object from hash
|
110
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
111
|
+
# @return [Object] Returns the model itself
|
112
|
+
def self.build_from_hash(attributes)
|
113
|
+
new.build_from_hash(attributes)
|
114
|
+
end
|
115
|
+
|
116
|
+
# Builds the object from hash
|
117
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
118
|
+
# @return [Object] Returns the model itself
|
119
|
+
def build_from_hash(attributes)
|
120
|
+
return nil unless attributes.is_a?(Hash)
|
121
|
+
attributes = attributes.transform_keys(&:to_sym)
|
122
|
+
self.class.openapi_types.each_pair do |key, type|
|
123
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
124
|
+
self.send("#{key}=", nil)
|
125
|
+
elsif type =~ /\AArray<(.*)>/i
|
126
|
+
# check to ensure the input is an array given that the attribute
|
127
|
+
# is documented as an array but the input is not
|
128
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
129
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
130
|
+
end
|
131
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
132
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
self
|
137
|
+
end
|
138
|
+
|
139
|
+
# Deserializes the data based on type
|
140
|
+
# @param string type Data type
|
141
|
+
# @param string value Value to be deserialized
|
142
|
+
# @return [Object] Deserialized data
|
143
|
+
def _deserialize(type, value)
|
144
|
+
case type.to_sym
|
145
|
+
when :Time
|
146
|
+
Time.parse(value)
|
147
|
+
when :Date
|
148
|
+
Date.parse(value)
|
149
|
+
when :String
|
150
|
+
value.to_s
|
151
|
+
when :Integer
|
152
|
+
value.to_i
|
153
|
+
when :Float
|
154
|
+
value.to_f
|
155
|
+
when :Boolean
|
156
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
157
|
+
true
|
158
|
+
else
|
159
|
+
false
|
160
|
+
end
|
161
|
+
when :Object
|
162
|
+
# generic object (usually a Hash), return directly
|
163
|
+
value
|
164
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
165
|
+
inner_type = Regexp.last_match[:inner_type]
|
166
|
+
value.map { |v| _deserialize(inner_type, v) }
|
167
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
168
|
+
k_type = Regexp.last_match[:k_type]
|
169
|
+
v_type = Regexp.last_match[:v_type]
|
170
|
+
{}.tap do |hash|
|
171
|
+
value.each do |k, v|
|
172
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
173
|
+
end
|
174
|
+
end
|
175
|
+
else # model
|
176
|
+
# models (e.g. Pet) or oneOf
|
177
|
+
klass = Carbon.const_get(type)
|
178
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
# Returns the string representation of the object
|
183
|
+
# @return [String] String presentation of the object
|
184
|
+
def to_s
|
185
|
+
to_hash.to_s
|
186
|
+
end
|
187
|
+
|
188
|
+
# to_body is an alias to to_hash (backward compatibility)
|
189
|
+
# @return [Hash] Returns the object in the form of hash
|
190
|
+
def to_body
|
191
|
+
to_hash
|
192
|
+
end
|
193
|
+
|
194
|
+
# Returns the object in the form of hash
|
195
|
+
# @return [Hash] Returns the object in the form of hash
|
196
|
+
def to_hash
|
197
|
+
hash = {}
|
198
|
+
self.class.attribute_map.each_pair do |attr, param|
|
199
|
+
value = self.send(attr)
|
200
|
+
if value.nil?
|
201
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
202
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
203
|
+
end
|
204
|
+
|
205
|
+
hash[param] = _to_hash(value)
|
206
|
+
end
|
207
|
+
hash
|
208
|
+
end
|
209
|
+
|
210
|
+
# Outputs non-array value in the form of hash
|
211
|
+
# For object, use to_hash. Otherwise, just return the value
|
212
|
+
# @param [Object] value Any valid value
|
213
|
+
# @return [Hash] Returns the value in the form of hash
|
214
|
+
def _to_hash(value)
|
215
|
+
if value.is_a?(Array)
|
216
|
+
value.compact.map { |v| _to_hash(v) }
|
217
|
+
elsif value.is_a?(Hash)
|
218
|
+
{}.tap do |hash|
|
219
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
220
|
+
end
|
221
|
+
elsif value.respond_to? :to_hash
|
222
|
+
value.to_hash
|
223
|
+
else
|
224
|
+
value
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
end
|
229
|
+
|
230
|
+
end
|
@@ -38,6 +38,9 @@ module Carbon
|
|
38
38
|
|
39
39
|
attr_accessor :file_sync_config
|
40
40
|
|
41
|
+
# Tags to be associated with the data source. If the data source already has tags set, then an upsert will be performed.
|
42
|
+
attr_accessor :data_source_tags
|
43
|
+
|
41
44
|
# Attribute mapping from ruby-style variable name to JSON key.
|
42
45
|
def self.attribute_map
|
43
46
|
{
|
@@ -53,7 +56,8 @@ module Carbon
|
|
53
56
|
:'sync_files_on_connection' => :'sync_files_on_connection',
|
54
57
|
:'request_id' => :'request_id',
|
55
58
|
:'sync_source_items' => :'sync_source_items',
|
56
|
-
:'file_sync_config' => :'file_sync_config'
|
59
|
+
:'file_sync_config' => :'file_sync_config',
|
60
|
+
:'data_source_tags' => :'data_source_tags'
|
57
61
|
}
|
58
62
|
end
|
59
63
|
|
@@ -77,7 +81,8 @@ module Carbon
|
|
77
81
|
:'sync_files_on_connection' => :'Boolean',
|
78
82
|
:'request_id' => :'String',
|
79
83
|
:'sync_source_items' => :'Boolean',
|
80
|
-
:'file_sync_config' => :'FileSyncConfigNullable'
|
84
|
+
:'file_sync_config' => :'FileSyncConfigNullable',
|
85
|
+
:'data_source_tags' => :'Object'
|
81
86
|
}
|
82
87
|
end
|
83
88
|
|
@@ -92,7 +97,7 @@ module Carbon
|
|
92
97
|
:'prepend_filename_to_chunks',
|
93
98
|
:'sync_files_on_connection',
|
94
99
|
:'request_id',
|
95
|
-
:'file_sync_config'
|
100
|
+
:'file_sync_config',
|
96
101
|
])
|
97
102
|
end
|
98
103
|
|
@@ -178,6 +183,10 @@ module Carbon
|
|
178
183
|
if attributes.key?(:'file_sync_config')
|
179
184
|
self.file_sync_config = attributes[:'file_sync_config']
|
180
185
|
end
|
186
|
+
|
187
|
+
if attributes.key?(:'data_source_tags')
|
188
|
+
self.data_source_tags = attributes[:'data_source_tags']
|
189
|
+
end
|
181
190
|
end
|
182
191
|
|
183
192
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -220,7 +229,8 @@ module Carbon
|
|
220
229
|
sync_files_on_connection == o.sync_files_on_connection &&
|
221
230
|
request_id == o.request_id &&
|
222
231
|
sync_source_items == o.sync_source_items &&
|
223
|
-
file_sync_config == o.file_sync_config
|
232
|
+
file_sync_config == o.file_sync_config &&
|
233
|
+
data_source_tags == o.data_source_tags
|
224
234
|
end
|
225
235
|
|
226
236
|
# @see the `==` method
|
@@ -232,7 +242,7 @@ module Carbon
|
|
232
242
|
# Calculates hash code according to all attributes.
|
233
243
|
# @return [Integer] Hash code
|
234
244
|
def hash
|
235
|
-
[tags, username, access_token, chunk_size, chunk_overlap, skip_embedding_generation, embedding_model, generate_sparse_vectors, prepend_filename_to_chunks, sync_files_on_connection, request_id, sync_source_items, file_sync_config].hash
|
245
|
+
[tags, username, access_token, chunk_size, chunk_overlap, skip_embedding_generation, embedding_model, generate_sparse_vectors, prepend_filename_to_chunks, sync_files_on_connection, request_id, sync_source_items, file_sync_config, data_source_tags].hash
|
236
246
|
end
|
237
247
|
|
238
248
|
# Builds the object from hash
|