carbon_ruby_sdk 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 208f842d56562784069b36ce636c7616cc35334d0328e9d7c3efa231daa22093
4
- data.tar.gz: c147cb461965777d3858768ec576334730640545d7a5b4c86e9ec532bfc43df1
3
+ metadata.gz: e19f8989c416d45b0cf4dc8a5b261b1f0b37d5111084c20bd48dac1f3a8ae795
4
+ data.tar.gz: be5d4f7386b026b0dd0810f65ff4b916bcad4aeacb3105b513611814cdfe2524
5
5
  SHA512:
6
- metadata.gz: ea914376a5de27deba807520f683534d72e400fff865d38920351b23b7010c2199c61e99b1b51af6fd004bf8036d45227481af7c0a272bf8fd4af390c3d2df0d
7
- data.tar.gz: 91db65ec36d8609d8b222450246ed94389bb666d8d97a2066c6557d2b8bc1ee43725b6fcd0f2c0de793fd3eb2f8c8560ca43140efa7ac217ed38b69cb2b5ddb0
6
+ metadata.gz: f5a05f4d3880897ddffc218c189009c0fecf396d14b7c3634951e2a24d508824a99f8e5f2eb107207d7cd157dc289ac2cb0feb4686aac5e68d237d0c9c2962d8
7
+ data.tar.gz: 494d7bb4ecaff69ce143ad63e4285d7c2a1c91bdde8b62d9231c3bb00f29ebcc013bc1ccdc27316518032143ab56772ff70e7d5593fe35d8a21e6ccdbad88cae
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- carbon_ruby_sdk (0.1.3)
4
+ carbon_ruby_sdk (0.1.4)
5
5
  faraday (>= 1.0.1, < 3.0)
6
6
  faraday-multipart (~> 1.0, >= 1.0.4)
7
7
 
data/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  Connect external data to LLMs, no matter the source.
8
8
 
9
- [![npm](https://img.shields.io/badge/gem-v0.1.3-blue)](https://rubygems.org/gems/carbon_ruby_sdk/versions/0.1.3)
9
+ [![npm](https://img.shields.io/badge/gem-v0.1.4-blue)](https://rubygems.org/gems/carbon_ruby_sdk/versions/0.1.4)
10
10
 
11
11
  </div>
12
12
 
@@ -77,7 +77,7 @@ Connect external data to LLMs, no matter the source.
77
77
  Add to Gemfile:
78
78
 
79
79
  ```ruby
80
- gem 'carbon_ruby_sdk', '~> 0.1.3'
80
+ gem 'carbon_ruby_sdk', '~> 0.1.4'
81
81
  ```
82
82
 
83
83
  ## Getting Started<a id="getting-started"></a>
@@ -643,6 +643,7 @@ result = carbon.files.delete_many(
643
643
  ],
644
644
  delete_non_synced_only: false,
645
645
  send_webhook: false,
646
+ delete_child_files: false,
646
647
  )
647
648
  p result
648
649
  ```
@@ -653,6 +654,7 @@ p result
653
654
  ##### sync_statuses: Array<[`ExternalFileSyncStatuses`](./lib/carbon_ruby_sdk/models/external_file_sync_statuses.rb)><a id="sync_statuses-array"></a>
654
655
  ##### delete_non_synced_only: `Boolean`<a id="delete_non_synced_only-boolean"></a>
655
656
  ##### send_webhook: `Boolean`<a id="send_webhook-boolean"></a>
657
+ ##### delete_child_files: `Boolean`<a id="delete_child_files-boolean"></a>
656
658
  #### 🔄 Return<a id="🔄-return"></a>
657
659
 
658
660
  [GenericSuccessResponse](./lib/carbon_ruby_sdk/models/generic_success_response.rb)
@@ -1498,7 +1500,7 @@ p result
1498
1500
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1499
1501
 
1500
1502
  ##### data_source_id: `Integer`<a id="data_source_id-integer"></a>
1501
- ##### ids: Array<`String`><a id="ids-array"></a>
1503
+ ##### ids: [`IdsProperty`](./lib/carbon_ruby_sdk/models/ids_property.rb)<a id="ids-idspropertylibcarbon_ruby_sdkmodelsids_propertyrb"></a>
1502
1504
  ##### tags: `Object`<a id="tags-object"></a>
1503
1505
  ##### chunk_size: `Integer`<a id="chunk_size-integer"></a>
1504
1506
  ##### chunk_overlap: `Integer`<a id="chunk_overlap-integer"></a>
@@ -1552,7 +1554,10 @@ p result
1552
1554
 
1553
1555
  ### `carbon.integrations.sync_files`<a id="carbonintegrationssync_files"></a>
1554
1556
 
1555
- Sync Files
1557
+ After listing files and folders via /integrations/items/sync and integrations/items/list, use the selected items' external ids
1558
+ as the ids in this endpoint to sync them into Carbon. Sharepoint items take an additional parameter root_id, which identifies
1559
+ the drive the file or folder is in and is stored in root_external_id. That additional paramter is optional and excluding it will
1560
+ tell the sync to assume the item is stored in the default Documents drive.
1556
1561
 
1557
1562
  #### 🛠️ Usage<a id="🛠️-usage"></a>
1558
1563
 
@@ -1578,7 +1583,7 @@ p result
1578
1583
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1579
1584
 
1580
1585
  ##### data_source_id: `Integer`<a id="data_source_id-integer"></a>
1581
- ##### ids: Array<`String`><a id="ids-array"></a>
1586
+ ##### ids: [`IdsProperty`](./lib/carbon_ruby_sdk/models/ids_property.rb)<a id="ids-idspropertylibcarbon_ruby_sdkmodelsids_propertyrb"></a>
1582
1587
  ##### tags: `Object`<a id="tags-object"></a>
1583
1588
  ##### chunk_size: `Integer`<a id="chunk_size-integer"></a>
1584
1589
  ##### chunk_overlap: `Integer`<a id="chunk_overlap-integer"></a>
@@ -319,14 +319,16 @@ module Carbon
319
319
  # @param sync_statuses [Array<ExternalFileSyncStatuses>]
320
320
  # @param delete_non_synced_only [Boolean]
321
321
  # @param send_webhook [Boolean]
322
+ # @param delete_child_files [Boolean]
322
323
  # @param body [DeleteFilesQueryInput]
323
324
  # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
324
- def delete_many(file_ids: SENTINEL, sync_statuses: SENTINEL, delete_non_synced_only: false, send_webhook: false, extra: {})
325
+ def delete_many(file_ids: SENTINEL, sync_statuses: SENTINEL, delete_non_synced_only: false, send_webhook: false, delete_child_files: false, extra: {})
325
326
  _body = {}
326
327
  _body[:file_ids] = file_ids if file_ids != SENTINEL
327
328
  _body[:sync_statuses] = sync_statuses if sync_statuses != SENTINEL
328
329
  _body[:delete_non_synced_only] = delete_non_synced_only if delete_non_synced_only != SENTINEL
329
330
  _body[:send_webhook] = send_webhook if send_webhook != SENTINEL
331
+ _body[:delete_child_files] = delete_child_files if delete_child_files != SENTINEL
330
332
  delete_files_query_input = _body
331
333
  api_response = delete_many_with_http_info_impl(delete_files_query_input, extra)
332
334
  api_response.data
@@ -338,14 +340,16 @@ module Carbon
338
340
  # @param sync_statuses [Array<ExternalFileSyncStatuses>]
339
341
  # @param delete_non_synced_only [Boolean]
340
342
  # @param send_webhook [Boolean]
343
+ # @param delete_child_files [Boolean]
341
344
  # @param body [DeleteFilesQueryInput]
342
345
  # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
343
- def delete_many_with_http_info(file_ids: SENTINEL, sync_statuses: SENTINEL, delete_non_synced_only: false, send_webhook: false, extra: {})
346
+ def delete_many_with_http_info(file_ids: SENTINEL, sync_statuses: SENTINEL, delete_non_synced_only: false, send_webhook: false, delete_child_files: false, extra: {})
344
347
  _body = {}
345
348
  _body[:file_ids] = file_ids if file_ids != SENTINEL
346
349
  _body[:sync_statuses] = sync_statuses if sync_statuses != SENTINEL
347
350
  _body[:delete_non_synced_only] = delete_non_synced_only if delete_non_synced_only != SENTINEL
348
351
  _body[:send_webhook] = send_webhook if send_webhook != SENTINEL
352
+ _body[:delete_child_files] = delete_child_files if delete_child_files != SENTINEL
349
353
  delete_files_query_input = _body
350
354
  delete_many_with_http_info_impl(delete_files_query_input, extra)
351
355
  end
@@ -1113,7 +1113,7 @@ module Carbon
1113
1113
  # pages or alter the behavior of the sync.
1114
1114
  #
1115
1115
  # @param data_source_id [Integer]
1116
- # @param ids [Array<String>]
1116
+ # @param ids [IdsProperty]
1117
1117
  # @param tags [Object]
1118
1118
  # @param chunk_size [Integer]
1119
1119
  # @param chunk_overlap [Integer]
@@ -1151,7 +1151,7 @@ module Carbon
1151
1151
  # pages or alter the behavior of the sync.
1152
1152
  #
1153
1153
  # @param data_source_id [Integer]
1154
- # @param ids [Array<String>]
1154
+ # @param ids [IdsProperty]
1155
1155
  # @param tags [Object]
1156
1156
  # @param chunk_size [Integer]
1157
1157
  # @param chunk_overlap [Integer]
@@ -1343,8 +1343,13 @@ module Carbon
1343
1343
 
1344
1344
  # Sync Files
1345
1345
  #
1346
+ # After listing files and folders via /integrations/items/sync and integrations/items/list, use the selected items' external ids
1347
+ # as the ids in this endpoint to sync them into Carbon. Sharepoint items take an additional parameter root_id, which identifies
1348
+ # the drive the file or folder is in and is stored in root_external_id. That additional paramter is optional and excluding it will
1349
+ # tell the sync to assume the item is stored in the default Documents drive.
1350
+ #
1346
1351
  # @param data_source_id [Integer]
1347
- # @param ids [Array<String>]
1352
+ # @param ids [IdsProperty]
1348
1353
  # @param tags [Object]
1349
1354
  # @param chunk_size [Integer]
1350
1355
  # @param chunk_overlap [Integer]
@@ -1376,8 +1381,13 @@ module Carbon
1376
1381
 
1377
1382
  # Sync Files
1378
1383
  #
1384
+ # After listing files and folders via /integrations/items/sync and integrations/items/list, use the selected items' external ids
1385
+ # as the ids in this endpoint to sync them into Carbon. Sharepoint items take an additional parameter root_id, which identifies
1386
+ # the drive the file or folder is in and is stored in root_external_id. That additional paramter is optional and excluding it will
1387
+ # tell the sync to assume the item is stored in the default Documents drive.
1388
+ #
1379
1389
  # @param data_source_id [Integer]
1380
- # @param ids [Array<String>]
1390
+ # @param ids [IdsProperty]
1381
1391
  # @param tags [Object]
1382
1392
  # @param chunk_size [Integer]
1383
1393
  # @param chunk_overlap [Integer]
@@ -1407,6 +1417,7 @@ module Carbon
1407
1417
  end
1408
1418
 
1409
1419
  # Sync Files
1420
+ # 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.
1410
1421
  # @param sync_files_request [SyncFilesRequest]
1411
1422
  # @param [Hash] opts the optional parameters
1412
1423
  # @return [GenericSuccessResponse]
@@ -1416,6 +1427,7 @@ module Carbon
1416
1427
  end
1417
1428
 
1418
1429
  # Sync Files
1430
+ # After listing files and folders via /integrations/items/sync and integrations/items/list, use the selected items&#39; 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.
1419
1431
  # @param sync_files_request [SyncFilesRequest]
1420
1432
  # @param [Hash] opts the optional parameters
1421
1433
  # @return [APIResponse] data is GenericSuccessResponse, status code, headers and response
@@ -19,13 +19,16 @@ module Carbon
19
19
 
20
20
  attr_accessor :send_webhook
21
21
 
22
+ attr_accessor :delete_child_files
23
+
22
24
  # Attribute mapping from ruby-style variable name to JSON key.
23
25
  def self.attribute_map
24
26
  {
25
27
  :'file_ids' => :'file_ids',
26
28
  :'sync_statuses' => :'sync_statuses',
27
29
  :'delete_non_synced_only' => :'delete_non_synced_only',
28
- :'send_webhook' => :'send_webhook'
30
+ :'send_webhook' => :'send_webhook',
31
+ :'delete_child_files' => :'delete_child_files'
29
32
  }
30
33
  end
31
34
 
@@ -40,7 +43,8 @@ module Carbon
40
43
  :'file_ids' => :'Array<Integer>',
41
44
  :'sync_statuses' => :'Array<ExternalFileSyncStatuses>',
42
45
  :'delete_non_synced_only' => :'Boolean',
43
- :'send_webhook' => :'Boolean'
46
+ :'send_webhook' => :'Boolean',
47
+ :'delete_child_files' => :'Boolean'
44
48
  }
45
49
  end
46
50
 
@@ -90,6 +94,12 @@ module Carbon
90
94
  else
91
95
  self.send_webhook = false
92
96
  end
97
+
98
+ if attributes.key?(:'delete_child_files')
99
+ self.delete_child_files = attributes[:'delete_child_files']
100
+ else
101
+ self.delete_child_files = false
102
+ end
93
103
  end
94
104
 
95
105
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -113,7 +123,8 @@ module Carbon
113
123
  file_ids == o.file_ids &&
114
124
  sync_statuses == o.sync_statuses &&
115
125
  delete_non_synced_only == o.delete_non_synced_only &&
116
- send_webhook == o.send_webhook
126
+ send_webhook == o.send_webhook &&
127
+ delete_child_files == o.delete_child_files
117
128
  end
118
129
 
119
130
  # @see the `==` method
@@ -125,7 +136,7 @@ module Carbon
125
136
  # Calculates hash code according to all attributes.
126
137
  # @return [Integer] Hash code
127
138
  def hash
128
- [file_ids, sync_statuses, delete_non_synced_only, send_webhook].hash
139
+ [file_ids, sync_statuses, delete_non_synced_only, send_webhook, delete_child_files].hash
129
140
  end
130
141
 
131
142
  # 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
@@ -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' => :'Array<String>',
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
- if (value = attributes[:'ids']).is_a?(Array)
114
- self.ids = value
115
- end
113
+ self.ids = attributes[:'ids']
116
114
  end
117
115
 
118
116
  if attributes.key?(:'chunk_size')
@@ -7,5 +7,5 @@ The version of the OpenAPI document: 1.0.0
7
7
  =end
8
8
 
9
9
  module Carbon
10
- VERSION = '0.1.3'
10
+ VERSION = '0.1.4'
11
11
  end
@@ -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&#39; 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
@@ -0,0 +1,22 @@
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 'spec_helper'
10
+ require 'json'
11
+ require 'date'
12
+
13
+ # Unit tests for Carbon::IdsProperty
14
+ describe Carbon::IdsProperty do
15
+ let(:instance) { Carbon::IdsProperty.new }
16
+
17
+ describe 'test an instance of IdsProperty' do
18
+ it 'should create an instance of IdsProperty' do
19
+ expect(instance).to be_instance_of(Carbon::IdsProperty)
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,34 @@
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 'spec_helper'
10
+ require 'json'
11
+ require 'date'
12
+
13
+ # Unit tests for Carbon::SyncFilesIds
14
+ describe Carbon::SyncFilesIds do
15
+ let(:instance) { Carbon::SyncFilesIds.new }
16
+
17
+ describe 'test an instance of SyncFilesIds' do
18
+ it 'should create an instance of SyncFilesIds' do
19
+ expect(instance).to be_instance_of(Carbon::SyncFilesIds)
20
+ end
21
+ end
22
+ describe 'test attribute "id"' do
23
+ it 'should work' do
24
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
25
+ end
26
+ end
27
+
28
+ describe 'test attribute "root_id"' do
29
+ it 'should work' do
30
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
31
+ end
32
+ end
33
+
34
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carbon_ruby_sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konfig
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-05 00:00:00.000000000 Z
11
+ date: 2024-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -139,6 +139,7 @@ files:
139
139
  - lib/carbon_ruby_sdk/models/http_validation_error.rb
140
140
  - lib/carbon_ruby_sdk/models/hybrid_search_tuning_params.rb
141
141
  - lib/carbon_ruby_sdk/models/hybrid_search_tuning_params_nullable.rb
142
+ - lib/carbon_ruby_sdk/models/ids_property.rb
142
143
  - lib/carbon_ruby_sdk/models/list_data_source_items_request.rb
143
144
  - lib/carbon_ruby_sdk/models/list_data_source_items_response.rb
144
145
  - lib/carbon_ruby_sdk/models/list_request.rb
@@ -174,6 +175,7 @@ files:
174
175
  - lib/carbon_ruby_sdk/models/sitemap_scrape_request.rb
175
176
  - lib/carbon_ruby_sdk/models/source_property.rb
176
177
  - lib/carbon_ruby_sdk/models/sync_directory_request.rb
178
+ - lib/carbon_ruby_sdk/models/sync_files_ids.rb
177
179
  - lib/carbon_ruby_sdk/models/sync_files_request.rb
178
180
  - lib/carbon_ruby_sdk/models/tags.rb
179
181
  - lib/carbon_ruby_sdk/models/tags1.rb
@@ -249,6 +251,7 @@ files:
249
251
  - spec/models/http_validation_error_spec.rb
250
252
  - spec/models/hybrid_search_tuning_params_nullable_spec.rb
251
253
  - spec/models/hybrid_search_tuning_params_spec.rb
254
+ - spec/models/ids_property_spec.rb
252
255
  - spec/models/list_data_source_items_request_spec.rb
253
256
  - spec/models/list_data_source_items_response_spec.rb
254
257
  - spec/models/list_request_spec.rb
@@ -284,6 +287,7 @@ files:
284
287
  - spec/models/sitemap_scrape_request_spec.rb
285
288
  - spec/models/source_property_spec.rb
286
289
  - spec/models/sync_directory_request_spec.rb
290
+ - spec/models/sync_files_ids_spec.rb
287
291
  - spec/models/sync_files_request_spec.rb
288
292
  - spec/models/tags1_spec.rb
289
293
  - spec/models/tags_spec.rb
@@ -393,10 +397,12 @@ test_files:
393
397
  - spec/models/external_file_sync_statuses_spec.rb
394
398
  - spec/models/list_request_spec.rb
395
399
  - spec/models/webhook_filters_spec.rb
400
+ - spec/models/ids_property_spec.rb
396
401
  - spec/models/body_create_upload_file_uploadfile_post_spec.rb
397
402
  - spec/models/location_property_inner_spec.rb
398
403
  - spec/models/source_property_spec.rb
399
404
  - spec/models/chunks_and_embeddings_spec.rb
405
+ - spec/models/sync_files_ids_spec.rb
400
406
  - spec/models/s3_get_file_input_spec.rb
401
407
  - spec/models/upload_file_from_url_input_spec.rb
402
408
  - spec/models/gitbook_sync_request_spec.rb