carbon_ruby_sdk 0.1.6 → 0.1.8
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 +57 -3
- data/lib/carbon_ruby_sdk/api/files_api.rb +6 -6
- data/lib/carbon_ruby_sdk/api/integrations_api.rb +104 -8
- data/lib/carbon_ruby_sdk/models/authentication_property.rb +436 -0
- data/lib/carbon_ruby_sdk/models/confluence_authentication.rb +254 -0
- data/lib/carbon_ruby_sdk/models/connect_data_source_input.rb +229 -0
- data/lib/carbon_ruby_sdk/models/connect_data_source_response.rb +230 -0
- data/lib/carbon_ruby_sdk/models/freskdesk_authentication.rb +244 -0
- data/lib/carbon_ruby_sdk/models/gitbook_authetication.rb +244 -0
- data/lib/carbon_ruby_sdk/models/notion_authentication.rb +244 -0
- data/lib/carbon_ruby_sdk/models/o_auth_authentication.rb +244 -0
- data/lib/carbon_ruby_sdk/models/o_auth_url_request.rb +1 -0
- data/lib/carbon_ruby_sdk/models/organization_user_data_source_api.rb +11 -1
- data/lib/carbon_ruby_sdk/models/s3_authentication.rb +244 -0
- data/lib/carbon_ruby_sdk/models/s3_file_sync_input.rb +1 -0
- data/lib/carbon_ruby_sdk/models/salesforce_authentication.rb +254 -0
- data/lib/carbon_ruby_sdk/models/sharepoint_authentication.rb +268 -0
- data/lib/carbon_ruby_sdk/models/simple_o_auth_data_sources.rb +41 -0
- data/lib/carbon_ruby_sdk/models/sitemap_scrape_request.rb +15 -0
- data/lib/carbon_ruby_sdk/models/sync_files_request.rb +1 -0
- data/lib/carbon_ruby_sdk/models/sync_options.rb +323 -0
- data/lib/carbon_ruby_sdk/models/upload_file_from_url_input.rb +1 -0
- data/lib/carbon_ruby_sdk/models/webscrape_request.rb +30 -0
- data/lib/carbon_ruby_sdk/models/zendesk_authentication.rb +244 -0
- data/lib/carbon_ruby_sdk/models/zotero_authentication.rb +272 -0
- data/lib/carbon_ruby_sdk/version.rb +1 -1
- data/lib/carbon_ruby_sdk.rb +15 -0
- data/spec/api/files_api_spec.rb +1 -1
- data/spec/api/integrations_api_spec.rb +11 -0
- data/spec/models/authentication_property_spec.rb +112 -0
- data/spec/models/confluence_authentication_spec.rb +46 -0
- data/spec/models/connect_data_source_input_spec.rb +34 -0
- data/spec/models/connect_data_source_response_spec.rb +34 -0
- data/spec/models/freskdesk_authentication_spec.rb +40 -0
- data/spec/models/gitbook_authetication_spec.rb +40 -0
- data/spec/models/notion_authentication_spec.rb +40 -0
- data/spec/models/o_auth_authentication_spec.rb +40 -0
- data/spec/models/organization_user_data_source_api_spec.rb +6 -0
- data/spec/models/s3_authentication_spec.rb +40 -0
- data/spec/models/salesforce_authentication_spec.rb +46 -0
- data/spec/models/sharepoint_authentication_spec.rb +52 -0
- data/spec/models/simple_o_auth_data_sources_spec.rb +22 -0
- data/spec/models/sync_options_spec.rb +82 -0
- data/spec/models/zendesk_authentication_spec.rb +40 -0
- data/spec/models/zotero_authentication_spec.rb +52 -0
- metadata +47 -2
@@ -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 SalesforceAuthentication
|
14
|
+
attr_accessor :source
|
15
|
+
|
16
|
+
attr_accessor :access_token
|
17
|
+
|
18
|
+
attr_accessor :refresh_token
|
19
|
+
|
20
|
+
attr_accessor :domain
|
21
|
+
|
22
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
23
|
+
def self.attribute_map
|
24
|
+
{
|
25
|
+
:'source' => :'source',
|
26
|
+
:'access_token' => :'access_token',
|
27
|
+
:'refresh_token' => :'refresh_token',
|
28
|
+
:'domain' => :'domain'
|
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
|
+
:'source' => :'Object',
|
41
|
+
:'access_token' => :'String',
|
42
|
+
:'refresh_token' => :'String',
|
43
|
+
:'domain' => :'String'
|
44
|
+
}
|
45
|
+
end
|
46
|
+
|
47
|
+
# List of attributes with nullable: true
|
48
|
+
def self.openapi_nullable
|
49
|
+
Set.new([
|
50
|
+
:'source',
|
51
|
+
:'refresh_token',
|
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::SalesforceAuthentication` 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::SalesforceAuthentication`. 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?(:'source')
|
71
|
+
self.source = attributes[:'source']
|
72
|
+
end
|
73
|
+
|
74
|
+
if attributes.key?(:'access_token')
|
75
|
+
self.access_token = attributes[:'access_token']
|
76
|
+
end
|
77
|
+
|
78
|
+
if attributes.key?(:'refresh_token')
|
79
|
+
self.refresh_token = attributes[:'refresh_token']
|
80
|
+
end
|
81
|
+
|
82
|
+
if attributes.key?(:'domain')
|
83
|
+
self.domain = attributes[:'domain']
|
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 @access_token.nil?
|
92
|
+
invalid_properties.push('invalid value for "access_token", access_token cannot be nil.')
|
93
|
+
end
|
94
|
+
|
95
|
+
if @domain.nil?
|
96
|
+
invalid_properties.push('invalid value for "domain", domain 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 @access_token.nil?
|
106
|
+
return false if @domain.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
|
+
source == o.source &&
|
116
|
+
access_token == o.access_token &&
|
117
|
+
refresh_token == o.refresh_token &&
|
118
|
+
domain == o.domain
|
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
|
+
[source, access_token, refresh_token, domain].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,268 @@
|
|
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 SharepointAuthentication
|
14
|
+
attr_accessor :source
|
15
|
+
|
16
|
+
attr_accessor :access_token
|
17
|
+
|
18
|
+
attr_accessor :refresh_token
|
19
|
+
|
20
|
+
attr_accessor :tenant_name
|
21
|
+
|
22
|
+
attr_accessor :site_name
|
23
|
+
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
25
|
+
def self.attribute_map
|
26
|
+
{
|
27
|
+
:'source' => :'source',
|
28
|
+
:'access_token' => :'access_token',
|
29
|
+
:'refresh_token' => :'refresh_token',
|
30
|
+
:'tenant_name' => :'tenant_name',
|
31
|
+
:'site_name' => :'site_name'
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
# Returns all the JSON keys this model knows about
|
36
|
+
def self.acceptable_attributes
|
37
|
+
attribute_map.values
|
38
|
+
end
|
39
|
+
|
40
|
+
# Attribute type mapping.
|
41
|
+
def self.openapi_types
|
42
|
+
{
|
43
|
+
:'source' => :'Object',
|
44
|
+
:'access_token' => :'String',
|
45
|
+
:'refresh_token' => :'String',
|
46
|
+
:'tenant_name' => :'String',
|
47
|
+
:'site_name' => :'String'
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
51
|
+
# List of attributes with nullable: true
|
52
|
+
def self.openapi_nullable
|
53
|
+
Set.new([
|
54
|
+
:'source',
|
55
|
+
:'refresh_token',
|
56
|
+
])
|
57
|
+
end
|
58
|
+
|
59
|
+
# Initializes the object
|
60
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
61
|
+
def initialize(attributes = {})
|
62
|
+
if (!attributes.is_a?(Hash))
|
63
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Carbon::SharepointAuthentication` initialize method"
|
64
|
+
end
|
65
|
+
|
66
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
67
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
68
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
69
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Carbon::SharepointAuthentication`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
70
|
+
end
|
71
|
+
h[k.to_sym] = v
|
72
|
+
}
|
73
|
+
|
74
|
+
if attributes.key?(:'source')
|
75
|
+
self.source = attributes[:'source']
|
76
|
+
end
|
77
|
+
|
78
|
+
if attributes.key?(:'access_token')
|
79
|
+
self.access_token = attributes[:'access_token']
|
80
|
+
end
|
81
|
+
|
82
|
+
if attributes.key?(:'refresh_token')
|
83
|
+
self.refresh_token = attributes[:'refresh_token']
|
84
|
+
end
|
85
|
+
|
86
|
+
if attributes.key?(:'tenant_name')
|
87
|
+
self.tenant_name = attributes[:'tenant_name']
|
88
|
+
end
|
89
|
+
|
90
|
+
if attributes.key?(:'site_name')
|
91
|
+
self.site_name = attributes[:'site_name']
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
96
|
+
# @return Array for valid properties with the reasons
|
97
|
+
def list_invalid_properties
|
98
|
+
invalid_properties = Array.new
|
99
|
+
if @access_token.nil?
|
100
|
+
invalid_properties.push('invalid value for "access_token", access_token cannot be nil.')
|
101
|
+
end
|
102
|
+
|
103
|
+
if @tenant_name.nil?
|
104
|
+
invalid_properties.push('invalid value for "tenant_name", tenant_name cannot be nil.')
|
105
|
+
end
|
106
|
+
|
107
|
+
if @site_name.nil?
|
108
|
+
invalid_properties.push('invalid value for "site_name", site_name cannot be nil.')
|
109
|
+
end
|
110
|
+
|
111
|
+
invalid_properties
|
112
|
+
end
|
113
|
+
|
114
|
+
# Check to see if the all the properties in the model are valid
|
115
|
+
# @return true if the model is valid
|
116
|
+
def valid?
|
117
|
+
return false if @access_token.nil?
|
118
|
+
return false if @tenant_name.nil?
|
119
|
+
return false if @site_name.nil?
|
120
|
+
true
|
121
|
+
end
|
122
|
+
|
123
|
+
# Checks equality by comparing each attribute.
|
124
|
+
# @param [Object] Object to be compared
|
125
|
+
def ==(o)
|
126
|
+
return true if self.equal?(o)
|
127
|
+
self.class == o.class &&
|
128
|
+
source == o.source &&
|
129
|
+
access_token == o.access_token &&
|
130
|
+
refresh_token == o.refresh_token &&
|
131
|
+
tenant_name == o.tenant_name &&
|
132
|
+
site_name == o.site_name
|
133
|
+
end
|
134
|
+
|
135
|
+
# @see the `==` method
|
136
|
+
# @param [Object] Object to be compared
|
137
|
+
def eql?(o)
|
138
|
+
self == o
|
139
|
+
end
|
140
|
+
|
141
|
+
# Calculates hash code according to all attributes.
|
142
|
+
# @return [Integer] Hash code
|
143
|
+
def hash
|
144
|
+
[source, access_token, refresh_token, tenant_name, site_name].hash
|
145
|
+
end
|
146
|
+
|
147
|
+
# Builds the object from hash
|
148
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
149
|
+
# @return [Object] Returns the model itself
|
150
|
+
def self.build_from_hash(attributes)
|
151
|
+
new.build_from_hash(attributes)
|
152
|
+
end
|
153
|
+
|
154
|
+
# Builds the object from hash
|
155
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
156
|
+
# @return [Object] Returns the model itself
|
157
|
+
def build_from_hash(attributes)
|
158
|
+
return nil unless attributes.is_a?(Hash)
|
159
|
+
attributes = attributes.transform_keys(&:to_sym)
|
160
|
+
self.class.openapi_types.each_pair do |key, type|
|
161
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
162
|
+
self.send("#{key}=", nil)
|
163
|
+
elsif type =~ /\AArray<(.*)>/i
|
164
|
+
# check to ensure the input is an array given that the attribute
|
165
|
+
# is documented as an array but the input is not
|
166
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
167
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
168
|
+
end
|
169
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
170
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
self
|
175
|
+
end
|
176
|
+
|
177
|
+
# Deserializes the data based on type
|
178
|
+
# @param string type Data type
|
179
|
+
# @param string value Value to be deserialized
|
180
|
+
# @return [Object] Deserialized data
|
181
|
+
def _deserialize(type, value)
|
182
|
+
case type.to_sym
|
183
|
+
when :Time
|
184
|
+
Time.parse(value)
|
185
|
+
when :Date
|
186
|
+
Date.parse(value)
|
187
|
+
when :String
|
188
|
+
value.to_s
|
189
|
+
when :Integer
|
190
|
+
value.to_i
|
191
|
+
when :Float
|
192
|
+
value.to_f
|
193
|
+
when :Boolean
|
194
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
195
|
+
true
|
196
|
+
else
|
197
|
+
false
|
198
|
+
end
|
199
|
+
when :Object
|
200
|
+
# generic object (usually a Hash), return directly
|
201
|
+
value
|
202
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
203
|
+
inner_type = Regexp.last_match[:inner_type]
|
204
|
+
value.map { |v| _deserialize(inner_type, v) }
|
205
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
206
|
+
k_type = Regexp.last_match[:k_type]
|
207
|
+
v_type = Regexp.last_match[:v_type]
|
208
|
+
{}.tap do |hash|
|
209
|
+
value.each do |k, v|
|
210
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
211
|
+
end
|
212
|
+
end
|
213
|
+
else # model
|
214
|
+
# models (e.g. Pet) or oneOf
|
215
|
+
klass = Carbon.const_get(type)
|
216
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
# Returns the string representation of the object
|
221
|
+
# @return [String] String presentation of the object
|
222
|
+
def to_s
|
223
|
+
to_hash.to_s
|
224
|
+
end
|
225
|
+
|
226
|
+
# to_body is an alias to to_hash (backward compatibility)
|
227
|
+
# @return [Hash] Returns the object in the form of hash
|
228
|
+
def to_body
|
229
|
+
to_hash
|
230
|
+
end
|
231
|
+
|
232
|
+
# Returns the object in the form of hash
|
233
|
+
# @return [Hash] Returns the object in the form of hash
|
234
|
+
def to_hash
|
235
|
+
hash = {}
|
236
|
+
self.class.attribute_map.each_pair do |attr, param|
|
237
|
+
value = self.send(attr)
|
238
|
+
if value.nil?
|
239
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
240
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
241
|
+
end
|
242
|
+
|
243
|
+
hash[param] = _to_hash(value)
|
244
|
+
end
|
245
|
+
hash
|
246
|
+
end
|
247
|
+
|
248
|
+
# Outputs non-array value in the form of hash
|
249
|
+
# For object, use to_hash. Otherwise, just return the value
|
250
|
+
# @param [Object] value Any valid value
|
251
|
+
# @return [Hash] Returns the value in the form of hash
|
252
|
+
def _to_hash(value)
|
253
|
+
if value.is_a?(Array)
|
254
|
+
value.compact.map { |v| _to_hash(v) }
|
255
|
+
elsif value.is_a?(Hash)
|
256
|
+
{}.tap do |hash|
|
257
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
258
|
+
end
|
259
|
+
elsif value.respond_to? :to_hash
|
260
|
+
value.to_hash
|
261
|
+
else
|
262
|
+
value
|
263
|
+
end
|
264
|
+
end
|
265
|
+
|
266
|
+
end
|
267
|
+
|
268
|
+
end
|
@@ -0,0 +1,41 @@
|
|
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 SimpleOAuthDataSources
|
14
|
+
GOOGLE_DRIVE = "GOOGLE_DRIVE".freeze
|
15
|
+
INTERCOM = "INTERCOM".freeze
|
16
|
+
DROPBOX = "DROPBOX".freeze
|
17
|
+
ONEDRIVE = "ONEDRIVE".freeze
|
18
|
+
BOX = "BOX".freeze
|
19
|
+
GMAIL = "GMAIL".freeze
|
20
|
+
OUTLOOK = "OUTLOOK".freeze
|
21
|
+
|
22
|
+
def self.all_vars
|
23
|
+
@all_vars ||= [GOOGLE_DRIVE, INTERCOM, DROPBOX, ONEDRIVE, BOX, GMAIL, OUTLOOK].freeze
|
24
|
+
end
|
25
|
+
|
26
|
+
# Builds the enum from string
|
27
|
+
# @param [String] The enum value in the form of the string
|
28
|
+
# @return [String] The enum value
|
29
|
+
def self.build_from_hash(value)
|
30
|
+
new.build_from_hash(value)
|
31
|
+
end
|
32
|
+
|
33
|
+
# Builds the enum from string
|
34
|
+
# @param [String] The enum value in the form of the string
|
35
|
+
# @return [String] The enum value
|
36
|
+
def build_from_hash(value)
|
37
|
+
return value if SimpleOAuthDataSources.all_vars.include?(value)
|
38
|
+
raise "Invalid ENUM value #{value} for class #SimpleOAuthDataSources"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -195,6 +195,10 @@ module Carbon
|
|
195
195
|
invalid_properties.push('invalid value for "url", url cannot be nil.')
|
196
196
|
end
|
197
197
|
|
198
|
+
if !@max_pages_to_scrape.nil? && @max_pages_to_scrape < 1
|
199
|
+
invalid_properties.push('invalid value for "max_pages_to_scrape", must be greater than or equal to 1.')
|
200
|
+
end
|
201
|
+
|
198
202
|
invalid_properties
|
199
203
|
end
|
200
204
|
|
@@ -202,9 +206,20 @@ module Carbon
|
|
202
206
|
# @return true if the model is valid
|
203
207
|
def valid?
|
204
208
|
return false if @url.nil?
|
209
|
+
return false if !@max_pages_to_scrape.nil? && @max_pages_to_scrape < 1
|
205
210
|
true
|
206
211
|
end
|
207
212
|
|
213
|
+
# Custom attribute writer method with validation
|
214
|
+
# @param [Object] max_pages_to_scrape Value to be assigned
|
215
|
+
def max_pages_to_scrape=(max_pages_to_scrape)
|
216
|
+
if !max_pages_to_scrape.nil? && max_pages_to_scrape < 1
|
217
|
+
fail ArgumentError, 'invalid value for "max_pages_to_scrape", must be greater than or equal to 1.'
|
218
|
+
end
|
219
|
+
|
220
|
+
@max_pages_to_scrape = max_pages_to_scrape
|
221
|
+
end
|
222
|
+
|
208
223
|
# Checks equality by comparing each attribute.
|
209
224
|
# @param [Object] Object to be compared
|
210
225
|
def ==(o)
|