carbon_ruby_sdk 0.2.5 → 0.2.7
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +99 -7
- data/lib/carbon_ruby_sdk/api/integrations_api.rb +261 -8
- data/lib/carbon_ruby_sdk/models/data_source_type.rb +2 -1
- data/lib/carbon_ruby_sdk/models/data_source_type_nullable.rb +2 -1
- data/lib/carbon_ruby_sdk/models/file_formats.rb +2 -1
- data/lib/carbon_ruby_sdk/models/file_formats_nullable.rb +2 -1
- data/lib/carbon_ruby_sdk/models/file_sync_config.rb +16 -4
- data/lib/carbon_ruby_sdk/models/file_sync_config_nullable.rb +16 -4
- data/lib/carbon_ruby_sdk/models/o_auth_url_request.rb +2 -2
- data/lib/carbon_ruby_sdk/models/simple_o_auth_data_sources.rb +2 -1
- data/lib/carbon_ruby_sdk/models/slack_filters.rb +232 -0
- data/lib/carbon_ruby_sdk/models/slack_sync_request.rb +321 -0
- data/lib/carbon_ruby_sdk/models/sync_files_request.rb +1 -1
- data/lib/carbon_ruby_sdk/models/sync_options.rb +1 -1
- data/lib/carbon_ruby_sdk/models/user_file.rb +15 -1
- data/lib/carbon_ruby_sdk/version.rb +1 -1
- data/lib/carbon_ruby_sdk.rb +2 -0
- data/spec/api/integrations_api_spec.rb +27 -0
- data/spec/models/file_sync_config_nullable_spec.rb +6 -0
- data/spec/models/file_sync_config_spec.rb +6 -0
- data/spec/models/slack_filters_spec.rb +34 -0
- data/spec/models/slack_sync_request_spec.rb +82 -0
- data/spec/models/user_file_spec.rb +6 -0
- metadata +8 -2
@@ -37,6 +37,7 @@ module Carbon
|
|
37
37
|
GITBOOK = "GITBOOK".freeze
|
38
38
|
SALESFORCE = "SALESFORCE".freeze
|
39
39
|
GITHUB = "GITHUB".freeze
|
40
|
+
SLACK = "SLACK".freeze
|
40
41
|
JPG = "JPG".freeze
|
41
42
|
PNG = "PNG".freeze
|
42
43
|
MP3 = "MP3".freeze
|
@@ -59,7 +60,7 @@ module Carbon
|
|
59
60
|
WEBM = "WEBM".freeze
|
60
61
|
|
61
62
|
def self.all_vars
|
62
|
-
@all_vars ||= [TXT, CSV, TSV, PDF, DOCX, PPTX, XLSX, MD, RTF, JSON, HTML, NOTION, GOOGLE_DOCS, GOOGLE_SHEETS, GOOGLE_SLIDES, INTERCOM, CONFLUENCE, RSS_FEED, GMAIL, OUTLOOK, ZENDESK, FRESHDESK, WEB_SCRAPE, GITBOOK, SALESFORCE, GITHUB, JPG, PNG, MP3, MP2, AAC, WAV, FLAC, PCM, M4_A, OGG, OPUS, MPEG, MPG, MP4, WMV, AVI, MOV, MKV, FLV, WEBM].freeze
|
63
|
+
@all_vars ||= [TXT, CSV, TSV, PDF, DOCX, PPTX, XLSX, MD, RTF, JSON, HTML, NOTION, GOOGLE_DOCS, GOOGLE_SHEETS, GOOGLE_SLIDES, INTERCOM, CONFLUENCE, RSS_FEED, GMAIL, OUTLOOK, ZENDESK, FRESHDESK, WEB_SCRAPE, GITBOOK, SALESFORCE, GITHUB, SLACK, JPG, PNG, MP3, MP2, AAC, WAV, FLAC, PCM, M4_A, OGG, OPUS, MPEG, MPG, MP4, WMV, AVI, MOV, MKV, FLV, WEBM].freeze
|
63
64
|
end
|
64
65
|
|
65
66
|
# Builds the enum from string
|
@@ -20,12 +20,16 @@ module Carbon
|
|
20
20
|
# Detect audio language before transcription for audio files
|
21
21
|
attr_accessor :detect_audio_language
|
22
22
|
|
23
|
+
# Whether to split tabular rows into chunks. Currently only valid for CSV, TSV, and XLSX files.
|
24
|
+
attr_accessor :split_rows
|
25
|
+
|
23
26
|
# Attribute mapping from ruby-style variable name to JSON key.
|
24
27
|
def self.attribute_map
|
25
28
|
{
|
26
29
|
:'auto_synced_source_types' => :'auto_synced_source_types',
|
27
30
|
:'sync_attachments' => :'sync_attachments',
|
28
|
-
:'detect_audio_language' => :'detect_audio_language'
|
31
|
+
:'detect_audio_language' => :'detect_audio_language',
|
32
|
+
:'split_rows' => :'split_rows'
|
29
33
|
}
|
30
34
|
end
|
31
35
|
|
@@ -39,7 +43,8 @@ module Carbon
|
|
39
43
|
{
|
40
44
|
:'auto_synced_source_types' => :'Array<HelpdeskFileTypes>',
|
41
45
|
:'sync_attachments' => :'Boolean',
|
42
|
-
:'detect_audio_language' => :'Boolean'
|
46
|
+
:'detect_audio_language' => :'Boolean',
|
47
|
+
:'split_rows' => :'Boolean'
|
43
48
|
}
|
44
49
|
end
|
45
50
|
|
@@ -81,6 +86,12 @@ module Carbon
|
|
81
86
|
else
|
82
87
|
self.detect_audio_language = false
|
83
88
|
end
|
89
|
+
|
90
|
+
if attributes.key?(:'split_rows')
|
91
|
+
self.split_rows = attributes[:'split_rows']
|
92
|
+
else
|
93
|
+
self.split_rows = false
|
94
|
+
end
|
84
95
|
end
|
85
96
|
|
86
97
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -103,7 +114,8 @@ module Carbon
|
|
103
114
|
self.class == o.class &&
|
104
115
|
auto_synced_source_types == o.auto_synced_source_types &&
|
105
116
|
sync_attachments == o.sync_attachments &&
|
106
|
-
detect_audio_language == o.detect_audio_language
|
117
|
+
detect_audio_language == o.detect_audio_language &&
|
118
|
+
split_rows == o.split_rows
|
107
119
|
end
|
108
120
|
|
109
121
|
# @see the `==` method
|
@@ -115,7 +127,7 @@ module Carbon
|
|
115
127
|
# Calculates hash code according to all attributes.
|
116
128
|
# @return [Integer] Hash code
|
117
129
|
def hash
|
118
|
-
[auto_synced_source_types, sync_attachments, detect_audio_language].hash
|
130
|
+
[auto_synced_source_types, sync_attachments, detect_audio_language, split_rows].hash
|
119
131
|
end
|
120
132
|
|
121
133
|
# Builds the object from hash
|
@@ -21,12 +21,16 @@ module Carbon
|
|
21
21
|
# Detect audio language before transcription for audio files
|
22
22
|
attr_accessor :detect_audio_language
|
23
23
|
|
24
|
+
# Whether to split tabular rows into chunks. Currently only valid for CSV, TSV, and XLSX files.
|
25
|
+
attr_accessor :split_rows
|
26
|
+
|
24
27
|
# Attribute mapping from ruby-style variable name to JSON key.
|
25
28
|
def self.attribute_map
|
26
29
|
{
|
27
30
|
:'auto_synced_source_types' => :'auto_synced_source_types',
|
28
31
|
:'sync_attachments' => :'sync_attachments',
|
29
|
-
:'detect_audio_language' => :'detect_audio_language'
|
32
|
+
:'detect_audio_language' => :'detect_audio_language',
|
33
|
+
:'split_rows' => :'split_rows'
|
30
34
|
}
|
31
35
|
end
|
32
36
|
|
@@ -40,7 +44,8 @@ module Carbon
|
|
40
44
|
{
|
41
45
|
:'auto_synced_source_types' => :'Array<HelpdeskFileTypes>',
|
42
46
|
:'sync_attachments' => :'Boolean',
|
43
|
-
:'detect_audio_language' => :'Boolean'
|
47
|
+
:'detect_audio_language' => :'Boolean',
|
48
|
+
:'split_rows' => :'Boolean'
|
44
49
|
}
|
45
50
|
end
|
46
51
|
|
@@ -82,6 +87,12 @@ module Carbon
|
|
82
87
|
else
|
83
88
|
self.detect_audio_language = false
|
84
89
|
end
|
90
|
+
|
91
|
+
if attributes.key?(:'split_rows')
|
92
|
+
self.split_rows = attributes[:'split_rows']
|
93
|
+
else
|
94
|
+
self.split_rows = false
|
95
|
+
end
|
85
96
|
end
|
86
97
|
|
87
98
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -104,7 +115,8 @@ module Carbon
|
|
104
115
|
self.class == o.class &&
|
105
116
|
auto_synced_source_types == o.auto_synced_source_types &&
|
106
117
|
sync_attachments == o.sync_attachments &&
|
107
|
-
detect_audio_language == o.detect_audio_language
|
118
|
+
detect_audio_language == o.detect_audio_language &&
|
119
|
+
split_rows == o.split_rows
|
108
120
|
end
|
109
121
|
|
110
122
|
# @see the `==` method
|
@@ -116,7 +128,7 @@ module Carbon
|
|
116
128
|
# Calculates hash code according to all attributes.
|
117
129
|
# @return [Integer] Hash code
|
118
130
|
def hash
|
119
|
-
[auto_synced_source_types, sync_attachments, detect_audio_language].hash
|
131
|
+
[auto_synced_source_types, sync_attachments, detect_audio_language, split_rows].hash
|
120
132
|
end
|
121
133
|
|
122
134
|
# Builds the object from hash
|
@@ -61,7 +61,7 @@ module Carbon
|
|
61
61
|
|
62
62
|
attr_accessor :parse_pdf_tables_with_ocr
|
63
63
|
|
64
|
-
# Enable integration's file picker for sources that support it. Supported sources:
|
64
|
+
# Enable integration's file picker for sources that support it. Supported sources: DROPBOX, ONEDRIVE, SHAREPOINT, GOOGLE_DRIVE, BOX
|
65
65
|
attr_accessor :enable_file_picker
|
66
66
|
|
67
67
|
# Enabling this flag will fetch all available content from the source to be listed via list items endpoint
|
@@ -279,7 +279,7 @@ module Carbon
|
|
279
279
|
if attributes.key?(:'request_id')
|
280
280
|
self.request_id = attributes[:'request_id']
|
281
281
|
else
|
282
|
-
self.request_id = '
|
282
|
+
self.request_id = '229bd6e7-4931-4900-8f58-0e4071e45b25'
|
283
283
|
end
|
284
284
|
|
285
285
|
if attributes.key?(:'use_ocr')
|
@@ -18,9 +18,10 @@ module Carbon
|
|
18
18
|
BOX = "BOX".freeze
|
19
19
|
GMAIL = "GMAIL".freeze
|
20
20
|
OUTLOOK = "OUTLOOK".freeze
|
21
|
+
SLACK = "SLACK".freeze
|
21
22
|
|
22
23
|
def self.all_vars
|
23
|
-
@all_vars ||= [GOOGLE_DRIVE, INTERCOM, DROPBOX, ONEDRIVE, BOX, GMAIL, OUTLOOK].freeze
|
24
|
+
@all_vars ||= [GOOGLE_DRIVE, INTERCOM, DROPBOX, ONEDRIVE, BOX, GMAIL, OUTLOOK, SLACK].freeze
|
24
25
|
end
|
25
26
|
|
26
27
|
# Builds the enum from string
|
@@ -0,0 +1,232 @@
|
|
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 SlackFilters
|
14
|
+
# Conversation ID from slack, can be obtained from Carbon with slack conversations endpoint
|
15
|
+
attr_accessor :conversation_id
|
16
|
+
|
17
|
+
# Only messages after this date will be included in results. If not set, all messages will be included. Should be entered in YYYY/mm/dd format
|
18
|
+
attr_accessor :after
|
19
|
+
|
20
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
21
|
+
def self.attribute_map
|
22
|
+
{
|
23
|
+
:'conversation_id' => :'conversation_id',
|
24
|
+
:'after' => :'after'
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
# Returns all the JSON keys this model knows about
|
29
|
+
def self.acceptable_attributes
|
30
|
+
attribute_map.values
|
31
|
+
end
|
32
|
+
|
33
|
+
# Attribute type mapping.
|
34
|
+
def self.openapi_types
|
35
|
+
{
|
36
|
+
:'conversation_id' => :'String',
|
37
|
+
:'after' => :'String'
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
# List of attributes with nullable: true
|
42
|
+
def self.openapi_nullable
|
43
|
+
Set.new([
|
44
|
+
:'after'
|
45
|
+
])
|
46
|
+
end
|
47
|
+
|
48
|
+
# Initializes the object
|
49
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
50
|
+
def initialize(attributes = {})
|
51
|
+
if (!attributes.is_a?(Hash))
|
52
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Carbon::SlackFilters` initialize method"
|
53
|
+
end
|
54
|
+
|
55
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
56
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
57
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
58
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Carbon::SlackFilters`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
59
|
+
end
|
60
|
+
h[k.to_sym] = v
|
61
|
+
}
|
62
|
+
|
63
|
+
if attributes.key?(:'conversation_id')
|
64
|
+
self.conversation_id = attributes[:'conversation_id']
|
65
|
+
end
|
66
|
+
|
67
|
+
if attributes.key?(:'after')
|
68
|
+
self.after = attributes[:'after']
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
73
|
+
# @return Array for valid properties with the reasons
|
74
|
+
def list_invalid_properties
|
75
|
+
invalid_properties = Array.new
|
76
|
+
if @conversation_id.nil?
|
77
|
+
invalid_properties.push('invalid value for "conversation_id", conversation_id cannot be nil.')
|
78
|
+
end
|
79
|
+
|
80
|
+
invalid_properties
|
81
|
+
end
|
82
|
+
|
83
|
+
# Check to see if the all the properties in the model are valid
|
84
|
+
# @return true if the model is valid
|
85
|
+
def valid?
|
86
|
+
return false if @conversation_id.nil?
|
87
|
+
true
|
88
|
+
end
|
89
|
+
|
90
|
+
# Checks equality by comparing each attribute.
|
91
|
+
# @param [Object] Object to be compared
|
92
|
+
def ==(o)
|
93
|
+
return true if self.equal?(o)
|
94
|
+
self.class == o.class &&
|
95
|
+
conversation_id == o.conversation_id &&
|
96
|
+
after == o.after
|
97
|
+
end
|
98
|
+
|
99
|
+
# @see the `==` method
|
100
|
+
# @param [Object] Object to be compared
|
101
|
+
def eql?(o)
|
102
|
+
self == o
|
103
|
+
end
|
104
|
+
|
105
|
+
# Calculates hash code according to all attributes.
|
106
|
+
# @return [Integer] Hash code
|
107
|
+
def hash
|
108
|
+
[conversation_id, after].hash
|
109
|
+
end
|
110
|
+
|
111
|
+
# Builds the object from hash
|
112
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
113
|
+
# @return [Object] Returns the model itself
|
114
|
+
def self.build_from_hash(attributes)
|
115
|
+
new.build_from_hash(attributes)
|
116
|
+
end
|
117
|
+
|
118
|
+
# Builds the object from hash
|
119
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
120
|
+
# @return [Object] Returns the model itself
|
121
|
+
def build_from_hash(attributes)
|
122
|
+
return nil unless attributes.is_a?(Hash)
|
123
|
+
attributes = attributes.transform_keys(&:to_sym)
|
124
|
+
self.class.openapi_types.each_pair do |key, type|
|
125
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
126
|
+
self.send("#{key}=", nil)
|
127
|
+
elsif type =~ /\AArray<(.*)>/i
|
128
|
+
# check to ensure the input is an array given that the attribute
|
129
|
+
# is documented as an array but the input is not
|
130
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
131
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
132
|
+
end
|
133
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
134
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
self
|
139
|
+
end
|
140
|
+
|
141
|
+
# Deserializes the data based on type
|
142
|
+
# @param string type Data type
|
143
|
+
# @param string value Value to be deserialized
|
144
|
+
# @return [Object] Deserialized data
|
145
|
+
def _deserialize(type, value)
|
146
|
+
case type.to_sym
|
147
|
+
when :Time
|
148
|
+
Time.parse(value)
|
149
|
+
when :Date
|
150
|
+
Date.parse(value)
|
151
|
+
when :String
|
152
|
+
value.to_s
|
153
|
+
when :Integer
|
154
|
+
value.to_i
|
155
|
+
when :Float
|
156
|
+
value.to_f
|
157
|
+
when :Boolean
|
158
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
159
|
+
true
|
160
|
+
else
|
161
|
+
false
|
162
|
+
end
|
163
|
+
when :Object
|
164
|
+
# generic object (usually a Hash), return directly
|
165
|
+
value
|
166
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
167
|
+
inner_type = Regexp.last_match[:inner_type]
|
168
|
+
value.map { |v| _deserialize(inner_type, v) }
|
169
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
170
|
+
k_type = Regexp.last_match[:k_type]
|
171
|
+
v_type = Regexp.last_match[:v_type]
|
172
|
+
{}.tap do |hash|
|
173
|
+
value.each do |k, v|
|
174
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
175
|
+
end
|
176
|
+
end
|
177
|
+
else # model
|
178
|
+
# models (e.g. Pet) or oneOf
|
179
|
+
klass = Carbon.const_get(type)
|
180
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
# Returns the string representation of the object
|
185
|
+
# @return [String] String presentation of the object
|
186
|
+
def to_s
|
187
|
+
to_hash.to_s
|
188
|
+
end
|
189
|
+
|
190
|
+
# to_body is an alias to to_hash (backward compatibility)
|
191
|
+
# @return [Hash] Returns the object in the form of hash
|
192
|
+
def to_body
|
193
|
+
to_hash
|
194
|
+
end
|
195
|
+
|
196
|
+
# Returns the object in the form of hash
|
197
|
+
# @return [Hash] Returns the object in the form of hash
|
198
|
+
def to_hash
|
199
|
+
hash = {}
|
200
|
+
self.class.attribute_map.each_pair do |attr, param|
|
201
|
+
value = self.send(attr)
|
202
|
+
if value.nil?
|
203
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
204
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
205
|
+
end
|
206
|
+
|
207
|
+
hash[param] = _to_hash(value)
|
208
|
+
end
|
209
|
+
hash
|
210
|
+
end
|
211
|
+
|
212
|
+
# Outputs non-array value in the form of hash
|
213
|
+
# For object, use to_hash. Otherwise, just return the value
|
214
|
+
# @param [Object] value Any valid value
|
215
|
+
# @return [Hash] Returns the value in the form of hash
|
216
|
+
def _to_hash(value)
|
217
|
+
if value.is_a?(Array)
|
218
|
+
value.compact.map { |v| _to_hash(v) }
|
219
|
+
elsif value.is_a?(Hash)
|
220
|
+
{}.tap do |hash|
|
221
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
222
|
+
end
|
223
|
+
elsif value.respond_to? :to_hash
|
224
|
+
value.to_hash
|
225
|
+
else
|
226
|
+
value
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
230
|
+
end
|
231
|
+
|
232
|
+
end
|