carbon_ruby_sdk 0.1.2 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +29 -6
- data/lib/carbon_ruby_sdk/api/files_api.rb +6 -2
- data/lib/carbon_ruby_sdk/api/integrations_api.rb +58 -10
- data/lib/carbon_ruby_sdk/models/delete_files_query_input.rb +15 -4
- data/lib/carbon_ruby_sdk/models/file_formats.rb +1 -2
- data/lib/carbon_ruby_sdk/models/file_formats_nullable.rb +1 -2
- data/lib/carbon_ruby_sdk/models/fresh_desk_connect_request.rb +17 -5
- data/lib/carbon_ruby_sdk/models/gitbook_connect_request.rb +97 -4
- data/lib/carbon_ruby_sdk/models/ids_property.rb +226 -0
- data/lib/carbon_ruby_sdk/models/o_auth_url_request.rb +1 -1
- data/lib/carbon_ruby_sdk/models/sync_files_ids.rb +234 -0
- data/lib/carbon_ruby_sdk/models/sync_files_request.rb +2 -4
- data/lib/carbon_ruby_sdk/version.rb +1 -1
- data/lib/carbon_ruby_sdk.rb +2 -0
- data/spec/api/integrations_api_spec.rb +1 -0
- data/spec/models/delete_files_query_input_spec.rb +6 -0
- data/spec/models/fresh_desk_connect_request_spec.rb +6 -0
- data/spec/models/gitbook_connect_request_spec.rb +48 -0
- data/spec/models/ids_property_spec.rb +22 -0
- data/spec/models/sync_files_ids_spec.rb +34 -0
- metadata +8 -2
@@ -11,15 +11,39 @@ require 'time'
|
|
11
11
|
|
12
12
|
module Carbon
|
13
13
|
class GitbookConnectRequest
|
14
|
+
attr_accessor :tags
|
15
|
+
|
14
16
|
attr_accessor :organization
|
15
17
|
|
16
18
|
attr_accessor :access_token
|
17
19
|
|
20
|
+
attr_accessor :chunk_size
|
21
|
+
|
22
|
+
attr_accessor :chunk_overlap
|
23
|
+
|
24
|
+
attr_accessor :skip_embedding_generation
|
25
|
+
|
26
|
+
attr_accessor :embedding_model
|
27
|
+
|
28
|
+
attr_accessor :generate_sparse_vectors
|
29
|
+
|
30
|
+
attr_accessor :prepend_filename_to_chunks
|
31
|
+
|
32
|
+
attr_accessor :sync_files_on_connection
|
33
|
+
|
18
34
|
# Attribute mapping from ruby-style variable name to JSON key.
|
19
35
|
def self.attribute_map
|
20
36
|
{
|
37
|
+
:'tags' => :'tags',
|
21
38
|
:'organization' => :'organization',
|
22
|
-
:'access_token' => :'access_token'
|
39
|
+
:'access_token' => :'access_token',
|
40
|
+
:'chunk_size' => :'chunk_size',
|
41
|
+
:'chunk_overlap' => :'chunk_overlap',
|
42
|
+
:'skip_embedding_generation' => :'skip_embedding_generation',
|
43
|
+
:'embedding_model' => :'embedding_model',
|
44
|
+
:'generate_sparse_vectors' => :'generate_sparse_vectors',
|
45
|
+
:'prepend_filename_to_chunks' => :'prepend_filename_to_chunks',
|
46
|
+
:'sync_files_on_connection' => :'sync_files_on_connection'
|
23
47
|
}
|
24
48
|
end
|
25
49
|
|
@@ -31,14 +55,29 @@ module Carbon
|
|
31
55
|
# Attribute type mapping.
|
32
56
|
def self.openapi_types
|
33
57
|
{
|
58
|
+
:'tags' => :'Object',
|
34
59
|
:'organization' => :'String',
|
35
|
-
:'access_token' => :'String'
|
60
|
+
:'access_token' => :'String',
|
61
|
+
:'chunk_size' => :'Integer',
|
62
|
+
:'chunk_overlap' => :'Integer',
|
63
|
+
:'skip_embedding_generation' => :'Boolean',
|
64
|
+
:'embedding_model' => :'EmbeddingGenerators',
|
65
|
+
:'generate_sparse_vectors' => :'Boolean',
|
66
|
+
:'prepend_filename_to_chunks' => :'Boolean',
|
67
|
+
:'sync_files_on_connection' => :'Boolean'
|
36
68
|
}
|
37
69
|
end
|
38
70
|
|
39
71
|
# List of attributes with nullable: true
|
40
72
|
def self.openapi_nullable
|
41
73
|
Set.new([
|
74
|
+
:'tags',
|
75
|
+
:'chunk_size',
|
76
|
+
:'chunk_overlap',
|
77
|
+
:'skip_embedding_generation',
|
78
|
+
:'generate_sparse_vectors',
|
79
|
+
:'prepend_filename_to_chunks',
|
80
|
+
:'sync_files_on_connection'
|
42
81
|
])
|
43
82
|
end
|
44
83
|
|
@@ -57,6 +96,10 @@ module Carbon
|
|
57
96
|
h[k.to_sym] = v
|
58
97
|
}
|
59
98
|
|
99
|
+
if attributes.key?(:'tags')
|
100
|
+
self.tags = attributes[:'tags']
|
101
|
+
end
|
102
|
+
|
60
103
|
if attributes.key?(:'organization')
|
61
104
|
self.organization = attributes[:'organization']
|
62
105
|
end
|
@@ -64,6 +107,48 @@ module Carbon
|
|
64
107
|
if attributes.key?(:'access_token')
|
65
108
|
self.access_token = attributes[:'access_token']
|
66
109
|
end
|
110
|
+
|
111
|
+
if attributes.key?(:'chunk_size')
|
112
|
+
self.chunk_size = attributes[:'chunk_size']
|
113
|
+
else
|
114
|
+
self.chunk_size = 1500
|
115
|
+
end
|
116
|
+
|
117
|
+
if attributes.key?(:'chunk_overlap')
|
118
|
+
self.chunk_overlap = attributes[:'chunk_overlap']
|
119
|
+
else
|
120
|
+
self.chunk_overlap = 20
|
121
|
+
end
|
122
|
+
|
123
|
+
if attributes.key?(:'skip_embedding_generation')
|
124
|
+
self.skip_embedding_generation = attributes[:'skip_embedding_generation']
|
125
|
+
else
|
126
|
+
self.skip_embedding_generation = false
|
127
|
+
end
|
128
|
+
|
129
|
+
if attributes.key?(:'embedding_model')
|
130
|
+
self.embedding_model = attributes[:'embedding_model']
|
131
|
+
else
|
132
|
+
self.embedding_model = 'OPENAI'
|
133
|
+
end
|
134
|
+
|
135
|
+
if attributes.key?(:'generate_sparse_vectors')
|
136
|
+
self.generate_sparse_vectors = attributes[:'generate_sparse_vectors']
|
137
|
+
else
|
138
|
+
self.generate_sparse_vectors = false
|
139
|
+
end
|
140
|
+
|
141
|
+
if attributes.key?(:'prepend_filename_to_chunks')
|
142
|
+
self.prepend_filename_to_chunks = attributes[:'prepend_filename_to_chunks']
|
143
|
+
else
|
144
|
+
self.prepend_filename_to_chunks = false
|
145
|
+
end
|
146
|
+
|
147
|
+
if attributes.key?(:'sync_files_on_connection')
|
148
|
+
self.sync_files_on_connection = attributes[:'sync_files_on_connection']
|
149
|
+
else
|
150
|
+
self.sync_files_on_connection = true
|
151
|
+
end
|
67
152
|
end
|
68
153
|
|
69
154
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -94,8 +179,16 @@ module Carbon
|
|
94
179
|
def ==(o)
|
95
180
|
return true if self.equal?(o)
|
96
181
|
self.class == o.class &&
|
182
|
+
tags == o.tags &&
|
97
183
|
organization == o.organization &&
|
98
|
-
access_token == o.access_token
|
184
|
+
access_token == o.access_token &&
|
185
|
+
chunk_size == o.chunk_size &&
|
186
|
+
chunk_overlap == o.chunk_overlap &&
|
187
|
+
skip_embedding_generation == o.skip_embedding_generation &&
|
188
|
+
embedding_model == o.embedding_model &&
|
189
|
+
generate_sparse_vectors == o.generate_sparse_vectors &&
|
190
|
+
prepend_filename_to_chunks == o.prepend_filename_to_chunks &&
|
191
|
+
sync_files_on_connection == o.sync_files_on_connection
|
99
192
|
end
|
100
193
|
|
101
194
|
# @see the `==` method
|
@@ -107,7 +200,7 @@ module Carbon
|
|
107
200
|
# Calculates hash code according to all attributes.
|
108
201
|
# @return [Integer] Hash code
|
109
202
|
def hash
|
110
|
-
[organization, access_token].hash
|
203
|
+
[tags, organization, access_token, chunk_size, chunk_overlap, skip_embedding_generation, embedding_model, generate_sparse_vectors, prepend_filename_to_chunks, sync_files_on_connection].hash
|
111
204
|
end
|
112
205
|
|
113
206
|
# Builds the object from hash
|
@@ -0,0 +1,226 @@
|
|
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 IdsProperty
|
14
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
15
|
+
def self.attribute_map
|
16
|
+
{
|
17
|
+
}
|
18
|
+
end
|
19
|
+
|
20
|
+
# Returns all the JSON keys this model knows about
|
21
|
+
def self.acceptable_attributes
|
22
|
+
attribute_map.values
|
23
|
+
end
|
24
|
+
|
25
|
+
# Attribute type mapping.
|
26
|
+
def self.openapi_types
|
27
|
+
{
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
# List of attributes with nullable: true
|
32
|
+
def self.openapi_nullable
|
33
|
+
Set.new([
|
34
|
+
])
|
35
|
+
end
|
36
|
+
|
37
|
+
# List of class defined in anyOf (OpenAPI v3)
|
38
|
+
def self.openapi_any_of
|
39
|
+
[
|
40
|
+
:'Array<String>',
|
41
|
+
:'Array<SyncFilesIds>'
|
42
|
+
]
|
43
|
+
end
|
44
|
+
|
45
|
+
# Initializes the object
|
46
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
47
|
+
def initialize(attributes = {})
|
48
|
+
if (!attributes.is_a?(Hash))
|
49
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Carbon::IdsProperty` initialize method"
|
50
|
+
end
|
51
|
+
|
52
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
53
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
54
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
55
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Carbon::IdsProperty`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
56
|
+
end
|
57
|
+
h[k.to_sym] = v
|
58
|
+
}
|
59
|
+
end
|
60
|
+
|
61
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
62
|
+
# @return Array for valid properties with the reasons
|
63
|
+
def list_invalid_properties
|
64
|
+
invalid_properties = Array.new
|
65
|
+
invalid_properties
|
66
|
+
end
|
67
|
+
|
68
|
+
# Check to see if the all the properties in the model are valid
|
69
|
+
# @return true if the model is valid
|
70
|
+
def valid?
|
71
|
+
_any_of_found = false
|
72
|
+
self.class.openapi_any_of.each do |_class|
|
73
|
+
_any_of = Carbon.const_get(_class).build_from_hash(self.to_hash)
|
74
|
+
if _any_of.valid?
|
75
|
+
_any_of_found = true
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
if !_any_of_found
|
80
|
+
return false
|
81
|
+
end
|
82
|
+
|
83
|
+
true
|
84
|
+
end
|
85
|
+
|
86
|
+
# Checks equality by comparing each attribute.
|
87
|
+
# @param [Object] Object to be compared
|
88
|
+
def ==(o)
|
89
|
+
return true if self.equal?(o)
|
90
|
+
self.class == o.class
|
91
|
+
end
|
92
|
+
|
93
|
+
# @see the `==` method
|
94
|
+
# @param [Object] Object to be compared
|
95
|
+
def eql?(o)
|
96
|
+
self == o
|
97
|
+
end
|
98
|
+
|
99
|
+
# Calculates hash code according to all attributes.
|
100
|
+
# @return [Integer] Hash code
|
101
|
+
def hash
|
102
|
+
[].hash
|
103
|
+
end
|
104
|
+
|
105
|
+
# Builds the object from hash
|
106
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
107
|
+
# @return [Object] Returns the model itself
|
108
|
+
def self.build_from_hash(attributes)
|
109
|
+
new.build_from_hash(attributes)
|
110
|
+
end
|
111
|
+
|
112
|
+
# Builds the object from hash
|
113
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
114
|
+
# @return [Object] Returns the model itself
|
115
|
+
def build_from_hash(attributes)
|
116
|
+
return nil unless attributes.is_a?(Hash)
|
117
|
+
attributes = attributes.transform_keys(&:to_sym)
|
118
|
+
self.class.openapi_types.each_pair do |key, type|
|
119
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
120
|
+
self.send("#{key}=", nil)
|
121
|
+
elsif type =~ /\AArray<(.*)>/i
|
122
|
+
# check to ensure the input is an array given that the attribute
|
123
|
+
# is documented as an array but the input is not
|
124
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
125
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
126
|
+
end
|
127
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
128
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
self
|
133
|
+
end
|
134
|
+
|
135
|
+
# Deserializes the data based on type
|
136
|
+
# @param string type Data type
|
137
|
+
# @param string value Value to be deserialized
|
138
|
+
# @return [Object] Deserialized data
|
139
|
+
def _deserialize(type, value)
|
140
|
+
case type.to_sym
|
141
|
+
when :Time
|
142
|
+
Time.parse(value)
|
143
|
+
when :Date
|
144
|
+
Date.parse(value)
|
145
|
+
when :String
|
146
|
+
value.to_s
|
147
|
+
when :Integer
|
148
|
+
value.to_i
|
149
|
+
when :Float
|
150
|
+
value.to_f
|
151
|
+
when :Boolean
|
152
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
153
|
+
true
|
154
|
+
else
|
155
|
+
false
|
156
|
+
end
|
157
|
+
when :Object
|
158
|
+
# generic object (usually a Hash), return directly
|
159
|
+
value
|
160
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
161
|
+
inner_type = Regexp.last_match[:inner_type]
|
162
|
+
value.map { |v| _deserialize(inner_type, v) }
|
163
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
164
|
+
k_type = Regexp.last_match[:k_type]
|
165
|
+
v_type = Regexp.last_match[:v_type]
|
166
|
+
{}.tap do |hash|
|
167
|
+
value.each do |k, v|
|
168
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
169
|
+
end
|
170
|
+
end
|
171
|
+
else # model
|
172
|
+
# models (e.g. Pet) or oneOf
|
173
|
+
klass = Carbon.const_get(type)
|
174
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
# Returns the string representation of the object
|
179
|
+
# @return [String] String presentation of the object
|
180
|
+
def to_s
|
181
|
+
to_hash.to_s
|
182
|
+
end
|
183
|
+
|
184
|
+
# to_body is an alias to to_hash (backward compatibility)
|
185
|
+
# @return [Hash] Returns the object in the form of hash
|
186
|
+
def to_body
|
187
|
+
to_hash
|
188
|
+
end
|
189
|
+
|
190
|
+
# Returns the object in the form of hash
|
191
|
+
# @return [Hash] Returns the object in the form of hash
|
192
|
+
def to_hash
|
193
|
+
hash = {}
|
194
|
+
self.class.attribute_map.each_pair do |attr, param|
|
195
|
+
value = self.send(attr)
|
196
|
+
if value.nil?
|
197
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
198
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
199
|
+
end
|
200
|
+
|
201
|
+
hash[param] = _to_hash(value)
|
202
|
+
end
|
203
|
+
hash
|
204
|
+
end
|
205
|
+
|
206
|
+
# Outputs non-array value in the form of hash
|
207
|
+
# For object, use to_hash. Otherwise, just return the value
|
208
|
+
# @param [Object] value Any valid value
|
209
|
+
# @return [Hash] Returns the value in the form of hash
|
210
|
+
def _to_hash(value)
|
211
|
+
if value.is_a?(Array)
|
212
|
+
value.compact.map { |v| _to_hash(v) }
|
213
|
+
elsif value.is_a?(Hash)
|
214
|
+
{}.tap do |hash|
|
215
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
216
|
+
end
|
217
|
+
elsif value.respond_to? :to_hash
|
218
|
+
value.to_hash
|
219
|
+
else
|
220
|
+
value
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
224
|
+
end
|
225
|
+
|
226
|
+
end
|
@@ -207,7 +207,7 @@ module Carbon
|
|
207
207
|
if attributes.key?(:'sync_files_on_connection')
|
208
208
|
self.sync_files_on_connection = attributes[:'sync_files_on_connection']
|
209
209
|
else
|
210
|
-
self.sync_files_on_connection =
|
210
|
+
self.sync_files_on_connection = true
|
211
211
|
end
|
212
212
|
|
213
213
|
if attributes.key?(:'set_page_as_boundary')
|
@@ -0,0 +1,234 @@
|
|
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 SyncFilesIds
|
14
|
+
attr_accessor :id
|
15
|
+
|
16
|
+
attr_accessor :root_id
|
17
|
+
|
18
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
19
|
+
def self.attribute_map
|
20
|
+
{
|
21
|
+
:'id' => :'id',
|
22
|
+
:'root_id' => :'root_id'
|
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
|
+
:'id' => :'String',
|
35
|
+
:'root_id' => :'String'
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# List of attributes with nullable: true
|
40
|
+
def self.openapi_nullable
|
41
|
+
Set.new([
|
42
|
+
])
|
43
|
+
end
|
44
|
+
|
45
|
+
# Initializes the object
|
46
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
47
|
+
def initialize(attributes = {})
|
48
|
+
if (!attributes.is_a?(Hash))
|
49
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Carbon::SyncFilesIds` initialize method"
|
50
|
+
end
|
51
|
+
|
52
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
53
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
54
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
55
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Carbon::SyncFilesIds`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
56
|
+
end
|
57
|
+
h[k.to_sym] = v
|
58
|
+
}
|
59
|
+
|
60
|
+
if attributes.key?(:'id')
|
61
|
+
self.id = attributes[:'id']
|
62
|
+
end
|
63
|
+
|
64
|
+
if attributes.key?(:'root_id')
|
65
|
+
self.root_id = attributes[:'root_id']
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
70
|
+
# @return Array for valid properties with the reasons
|
71
|
+
def list_invalid_properties
|
72
|
+
invalid_properties = Array.new
|
73
|
+
if @id.nil?
|
74
|
+
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
75
|
+
end
|
76
|
+
|
77
|
+
if @root_id.nil?
|
78
|
+
invalid_properties.push('invalid value for "root_id", root_id cannot be nil.')
|
79
|
+
end
|
80
|
+
|
81
|
+
invalid_properties
|
82
|
+
end
|
83
|
+
|
84
|
+
# Check to see if the all the properties in the model are valid
|
85
|
+
# @return true if the model is valid
|
86
|
+
def valid?
|
87
|
+
return false if @id.nil?
|
88
|
+
return false if @root_id.nil?
|
89
|
+
true
|
90
|
+
end
|
91
|
+
|
92
|
+
# Checks equality by comparing each attribute.
|
93
|
+
# @param [Object] Object to be compared
|
94
|
+
def ==(o)
|
95
|
+
return true if self.equal?(o)
|
96
|
+
self.class == o.class &&
|
97
|
+
id == o.id &&
|
98
|
+
root_id == o.root_id
|
99
|
+
end
|
100
|
+
|
101
|
+
# @see the `==` method
|
102
|
+
# @param [Object] Object to be compared
|
103
|
+
def eql?(o)
|
104
|
+
self == o
|
105
|
+
end
|
106
|
+
|
107
|
+
# Calculates hash code according to all attributes.
|
108
|
+
# @return [Integer] Hash code
|
109
|
+
def hash
|
110
|
+
[id, root_id].hash
|
111
|
+
end
|
112
|
+
|
113
|
+
# Builds the object from hash
|
114
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
115
|
+
# @return [Object] Returns the model itself
|
116
|
+
def self.build_from_hash(attributes)
|
117
|
+
new.build_from_hash(attributes)
|
118
|
+
end
|
119
|
+
|
120
|
+
# Builds the object from hash
|
121
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
122
|
+
# @return [Object] Returns the model itself
|
123
|
+
def build_from_hash(attributes)
|
124
|
+
return nil unless attributes.is_a?(Hash)
|
125
|
+
attributes = attributes.transform_keys(&:to_sym)
|
126
|
+
self.class.openapi_types.each_pair do |key, type|
|
127
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
128
|
+
self.send("#{key}=", nil)
|
129
|
+
elsif type =~ /\AArray<(.*)>/i
|
130
|
+
# check to ensure the input is an array given that the attribute
|
131
|
+
# is documented as an array but the input is not
|
132
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
133
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
134
|
+
end
|
135
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
136
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
self
|
141
|
+
end
|
142
|
+
|
143
|
+
# Deserializes the data based on type
|
144
|
+
# @param string type Data type
|
145
|
+
# @param string value Value to be deserialized
|
146
|
+
# @return [Object] Deserialized data
|
147
|
+
def _deserialize(type, value)
|
148
|
+
case type.to_sym
|
149
|
+
when :Time
|
150
|
+
Time.parse(value)
|
151
|
+
when :Date
|
152
|
+
Date.parse(value)
|
153
|
+
when :String
|
154
|
+
value.to_s
|
155
|
+
when :Integer
|
156
|
+
value.to_i
|
157
|
+
when :Float
|
158
|
+
value.to_f
|
159
|
+
when :Boolean
|
160
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
161
|
+
true
|
162
|
+
else
|
163
|
+
false
|
164
|
+
end
|
165
|
+
when :Object
|
166
|
+
# generic object (usually a Hash), return directly
|
167
|
+
value
|
168
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
169
|
+
inner_type = Regexp.last_match[:inner_type]
|
170
|
+
value.map { |v| _deserialize(inner_type, v) }
|
171
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
172
|
+
k_type = Regexp.last_match[:k_type]
|
173
|
+
v_type = Regexp.last_match[:v_type]
|
174
|
+
{}.tap do |hash|
|
175
|
+
value.each do |k, v|
|
176
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
177
|
+
end
|
178
|
+
end
|
179
|
+
else # model
|
180
|
+
# models (e.g. Pet) or oneOf
|
181
|
+
klass = Carbon.const_get(type)
|
182
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
# Returns the string representation of the object
|
187
|
+
# @return [String] String presentation of the object
|
188
|
+
def to_s
|
189
|
+
to_hash.to_s
|
190
|
+
end
|
191
|
+
|
192
|
+
# to_body is an alias to to_hash (backward compatibility)
|
193
|
+
# @return [Hash] Returns the object in the form of hash
|
194
|
+
def to_body
|
195
|
+
to_hash
|
196
|
+
end
|
197
|
+
|
198
|
+
# Returns the object in the form of hash
|
199
|
+
# @return [Hash] Returns the object in the form of hash
|
200
|
+
def to_hash
|
201
|
+
hash = {}
|
202
|
+
self.class.attribute_map.each_pair do |attr, param|
|
203
|
+
value = self.send(attr)
|
204
|
+
if value.nil?
|
205
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
206
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
207
|
+
end
|
208
|
+
|
209
|
+
hash[param] = _to_hash(value)
|
210
|
+
end
|
211
|
+
hash
|
212
|
+
end
|
213
|
+
|
214
|
+
# Outputs non-array value in the form of hash
|
215
|
+
# For object, use to_hash. Otherwise, just return the value
|
216
|
+
# @param [Object] value Any valid value
|
217
|
+
# @return [Hash] Returns the value in the form of hash
|
218
|
+
def _to_hash(value)
|
219
|
+
if value.is_a?(Array)
|
220
|
+
value.compact.map { |v| _to_hash(v) }
|
221
|
+
elsif value.is_a?(Hash)
|
222
|
+
{}.tap do |hash|
|
223
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
224
|
+
end
|
225
|
+
elsif value.respond_to? :to_hash
|
226
|
+
value.to_hash
|
227
|
+
else
|
228
|
+
value
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
232
|
+
end
|
233
|
+
|
234
|
+
end
|
@@ -60,7 +60,7 @@ module Carbon
|
|
60
60
|
{
|
61
61
|
:'tags' => :'Object',
|
62
62
|
:'data_source_id' => :'Integer',
|
63
|
-
:'ids' => :'
|
63
|
+
:'ids' => :'IdsProperty',
|
64
64
|
:'chunk_size' => :'Integer',
|
65
65
|
:'chunk_overlap' => :'Integer',
|
66
66
|
:'skip_embedding_generation' => :'Boolean',
|
@@ -110,9 +110,7 @@ module Carbon
|
|
110
110
|
end
|
111
111
|
|
112
112
|
if attributes.key?(:'ids')
|
113
|
-
|
114
|
-
self.ids = value
|
115
|
-
end
|
113
|
+
self.ids = attributes[:'ids']
|
116
114
|
end
|
117
115
|
|
118
116
|
if attributes.key?(:'chunk_size')
|
data/lib/carbon_ruby_sdk.rb
CHANGED
@@ -56,6 +56,7 @@ require 'carbon_ruby_sdk/models/gmail_sync_input'
|
|
56
56
|
require 'carbon_ruby_sdk/models/http_validation_error'
|
57
57
|
require 'carbon_ruby_sdk/models/hybrid_search_tuning_params'
|
58
58
|
require 'carbon_ruby_sdk/models/hybrid_search_tuning_params_nullable'
|
59
|
+
require 'carbon_ruby_sdk/models/ids_property'
|
59
60
|
require 'carbon_ruby_sdk/models/list_data_source_items_request'
|
60
61
|
require 'carbon_ruby_sdk/models/list_data_source_items_response'
|
61
62
|
require 'carbon_ruby_sdk/models/list_request'
|
@@ -91,6 +92,7 @@ require 'carbon_ruby_sdk/models/single_chunks_and_embeddings_upload_input'
|
|
91
92
|
require 'carbon_ruby_sdk/models/sitemap_scrape_request'
|
92
93
|
require 'carbon_ruby_sdk/models/source_property'
|
93
94
|
require 'carbon_ruby_sdk/models/sync_directory_request'
|
95
|
+
require 'carbon_ruby_sdk/models/sync_files_ids'
|
94
96
|
require 'carbon_ruby_sdk/models/sync_files_request'
|
95
97
|
require 'carbon_ruby_sdk/models/tags'
|
96
98
|
require 'carbon_ruby_sdk/models/tags1'
|
@@ -166,6 +166,7 @@ describe 'IntegrationsApi' do
|
|
166
166
|
|
167
167
|
# unit tests for sync_files
|
168
168
|
# Sync Files
|
169
|
+
# After listing files and folders via /integrations/items/sync and integrations/items/list, use the selected items' external ids as the ids in this endpoint to sync them into Carbon. Sharepoint items take an additional parameter root_id, which identifies the drive the file or folder is in and is stored in root_external_id. That additional paramter is optional and excluding it will tell the sync to assume the item is stored in the default Documents drive.
|
169
170
|
# @param sync_files_request
|
170
171
|
# @param [Hash] opts the optional parameters
|
171
172
|
# @return [GenericSuccessResponse]
|
@@ -43,4 +43,10 @@ describe Carbon::DeleteFilesQueryInput do
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
+
describe 'test attribute "delete_child_files"' do
|
47
|
+
it 'should work' do
|
48
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
46
52
|
end
|
@@ -73,4 +73,10 @@ describe Carbon::FreshDeskConnectRequest do
|
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
|
+
describe 'test attribute "sync_files_on_connection"' do
|
77
|
+
it 'should work' do
|
78
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
76
82
|
end
|