carbon_ruby_sdk 0.2.38 → 0.2.39
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 +310 -2
- data/lib/carbon_ruby_sdk/api/github_api.rb +825 -0
- data/lib/carbon_ruby_sdk/models/comments_input.rb +330 -0
- data/lib/carbon_ruby_sdk/models/comments_order_by.rb +36 -0
- data/lib/carbon_ruby_sdk/models/comments_response.rb +232 -0
- data/lib/carbon_ruby_sdk/models/commit.rb +282 -0
- data/lib/carbon_ruby_sdk/models/commit_user.rb +234 -0
- data/lib/carbon_ruby_sdk/models/commit_user_nullable.rb +234 -0
- data/lib/carbon_ruby_sdk/models/commits_input.rb +307 -0
- data/lib/carbon_ruby_sdk/models/commits_response.rb +232 -0
- data/lib/carbon_ruby_sdk/models/file_status.rb +41 -0
- data/lib/carbon_ruby_sdk/models/files_input.rb +307 -0
- data/lib/carbon_ruby_sdk/models/files_response.rb +232 -0
- data/lib/carbon_ruby_sdk/models/head_or_base.rb +248 -0
- data/lib/carbon_ruby_sdk/models/issue.rb +434 -0
- data/lib/carbon_ruby_sdk/models/issue_pr.rb +230 -0
- data/lib/carbon_ruby_sdk/models/issue_pr_nullable.rb +230 -0
- data/lib/carbon_ruby_sdk/models/issues_filter.rb +217 -0
- data/lib/carbon_ruby_sdk/models/issues_input.rb +325 -0
- data/lib/carbon_ruby_sdk/models/issues_order_by.rb +37 -0
- data/lib/carbon_ruby_sdk/models/issues_response.rb +232 -0
- data/lib/carbon_ruby_sdk/models/label.rb +234 -0
- data/lib/carbon_ruby_sdk/models/pr_comment.rb +358 -0
- data/lib/carbon_ruby_sdk/models/pr_commit.rb +264 -0
- data/lib/carbon_ruby_sdk/models/pr_file.rb +342 -0
- data/lib/carbon_ruby_sdk/models/pr_order_by.rb +37 -0
- data/lib/carbon_ruby_sdk/models/pr_state.rb +36 -0
- data/lib/carbon_ruby_sdk/models/pr_state_input.rb +37 -0
- data/lib/carbon_ruby_sdk/models/pull_request.rb +438 -0
- data/lib/carbon_ruby_sdk/models/pull_request_extended.rb +536 -0
- data/lib/carbon_ruby_sdk/models/pull_request_filters.rb +239 -0
- data/lib/carbon_ruby_sdk/models/pull_request_response.rb +232 -0
- data/lib/carbon_ruby_sdk/models/pull_requests_input.rb +325 -0
- data/lib/carbon_ruby_sdk/models/team.rb +234 -0
- data/lib/carbon_ruby_sdk/models/tree.rb +234 -0
- data/lib/carbon_ruby_sdk/models/user.rb +234 -0
- data/lib/carbon_ruby_sdk/models/user_nullable.rb +234 -0
- data/lib/carbon_ruby_sdk/version.rb +1 -1
- data/lib/carbon_ruby_sdk.rb +38 -0
- data/spec/api/github_api_spec.rb +112 -0
- data/spec/models/comments_input_spec.rb +76 -0
- data/spec/models/comments_order_by_spec.rb +22 -0
- data/spec/models/comments_response_spec.rb +34 -0
- data/spec/models/commit_spec.rb +58 -0
- data/spec/models/commit_user_nullable_spec.rb +34 -0
- data/spec/models/commit_user_spec.rb +34 -0
- data/spec/models/commits_input_spec.rb +64 -0
- data/spec/models/commits_response_spec.rb +34 -0
- data/spec/models/file_status_spec.rb +22 -0
- data/spec/models/files_input_spec.rb +64 -0
- data/spec/models/files_response_spec.rb +34 -0
- data/spec/models/head_or_base_spec.rb +40 -0
- data/spec/models/issue_pr_nullable_spec.rb +34 -0
- data/spec/models/issue_pr_spec.rb +34 -0
- data/spec/models/issue_spec.rb +124 -0
- data/spec/models/issues_filter_spec.rb +28 -0
- data/spec/models/issues_input_spec.rb +76 -0
- data/spec/models/issues_order_by_spec.rb +22 -0
- data/spec/models/issues_response_spec.rb +34 -0
- data/spec/models/label_spec.rb +34 -0
- data/spec/models/pr_comment_spec.rb +94 -0
- data/spec/models/pr_commit_spec.rb +52 -0
- data/spec/models/pr_file_spec.rb +82 -0
- data/spec/models/pr_order_by_spec.rb +22 -0
- data/spec/models/pr_state_input_spec.rb +22 -0
- data/spec/models/pr_state_spec.rb +22 -0
- data/spec/models/pull_request_extended_spec.rb +166 -0
- data/spec/models/pull_request_filters_spec.rb +40 -0
- data/spec/models/pull_request_response_spec.rb +34 -0
- data/spec/models/pull_request_spec.rb +124 -0
- data/spec/models/pull_requests_input_spec.rb +76 -0
- data/spec/models/team_spec.rb +34 -0
- data/spec/models/tree_spec.rb +34 -0
- data/spec/models/user_nullable_spec.rb +34 -0
- data/spec/models/user_spec.rb +34 -0
- metadata +301 -193
@@ -0,0 +1,264 @@
|
|
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 PRCommit
|
14
|
+
attr_accessor :commit
|
15
|
+
|
16
|
+
attr_accessor :url
|
17
|
+
|
18
|
+
attr_accessor :author
|
19
|
+
|
20
|
+
attr_accessor :committer
|
21
|
+
|
22
|
+
attr_accessor :remote_data
|
23
|
+
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
25
|
+
def self.attribute_map
|
26
|
+
{
|
27
|
+
:'commit' => :'commit',
|
28
|
+
:'url' => :'url',
|
29
|
+
:'author' => :'author',
|
30
|
+
:'committer' => :'committer',
|
31
|
+
:'remote_data' => :'remote_data'
|
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
|
+
:'commit' => :'Commit',
|
44
|
+
:'url' => :'String',
|
45
|
+
:'author' => :'UserNullable',
|
46
|
+
:'committer' => :'UserNullable',
|
47
|
+
:'remote_data' => :'Object'
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
51
|
+
# List of attributes with nullable: true
|
52
|
+
def self.openapi_nullable
|
53
|
+
Set.new([
|
54
|
+
:'author',
|
55
|
+
:'committer',
|
56
|
+
:'remote_data'
|
57
|
+
])
|
58
|
+
end
|
59
|
+
|
60
|
+
# Initializes the object
|
61
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
62
|
+
def initialize(attributes = {})
|
63
|
+
if (!attributes.is_a?(Hash))
|
64
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Carbon::PRCommit` initialize method"
|
65
|
+
end
|
66
|
+
|
67
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
68
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
69
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
70
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Carbon::PRCommit`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
71
|
+
end
|
72
|
+
h[k.to_sym] = v
|
73
|
+
}
|
74
|
+
|
75
|
+
if attributes.key?(:'commit')
|
76
|
+
self.commit = attributes[:'commit']
|
77
|
+
end
|
78
|
+
|
79
|
+
if attributes.key?(:'url')
|
80
|
+
self.url = attributes[:'url']
|
81
|
+
end
|
82
|
+
|
83
|
+
if attributes.key?(:'author')
|
84
|
+
self.author = attributes[:'author']
|
85
|
+
end
|
86
|
+
|
87
|
+
if attributes.key?(:'committer')
|
88
|
+
self.committer = attributes[:'committer']
|
89
|
+
end
|
90
|
+
|
91
|
+
if attributes.key?(:'remote_data')
|
92
|
+
self.remote_data = attributes[:'remote_data']
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
97
|
+
# @return Array for valid properties with the reasons
|
98
|
+
def list_invalid_properties
|
99
|
+
invalid_properties = Array.new
|
100
|
+
if @commit.nil?
|
101
|
+
invalid_properties.push('invalid value for "commit", commit cannot be nil.')
|
102
|
+
end
|
103
|
+
|
104
|
+
if @url.nil?
|
105
|
+
invalid_properties.push('invalid value for "url", url cannot be nil.')
|
106
|
+
end
|
107
|
+
|
108
|
+
invalid_properties
|
109
|
+
end
|
110
|
+
|
111
|
+
# Check to see if the all the properties in the model are valid
|
112
|
+
# @return true if the model is valid
|
113
|
+
def valid?
|
114
|
+
return false if @commit.nil?
|
115
|
+
return false if @url.nil?
|
116
|
+
true
|
117
|
+
end
|
118
|
+
|
119
|
+
# Checks equality by comparing each attribute.
|
120
|
+
# @param [Object] Object to be compared
|
121
|
+
def ==(o)
|
122
|
+
return true if self.equal?(o)
|
123
|
+
self.class == o.class &&
|
124
|
+
commit == o.commit &&
|
125
|
+
url == o.url &&
|
126
|
+
author == o.author &&
|
127
|
+
committer == o.committer &&
|
128
|
+
remote_data == o.remote_data
|
129
|
+
end
|
130
|
+
|
131
|
+
# @see the `==` method
|
132
|
+
# @param [Object] Object to be compared
|
133
|
+
def eql?(o)
|
134
|
+
self == o
|
135
|
+
end
|
136
|
+
|
137
|
+
# Calculates hash code according to all attributes.
|
138
|
+
# @return [Integer] Hash code
|
139
|
+
def hash
|
140
|
+
[commit, url, author, committer, remote_data].hash
|
141
|
+
end
|
142
|
+
|
143
|
+
# Builds the object from hash
|
144
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
145
|
+
# @return [Object] Returns the model itself
|
146
|
+
def self.build_from_hash(attributes)
|
147
|
+
new.build_from_hash(attributes)
|
148
|
+
end
|
149
|
+
|
150
|
+
# Builds the object from hash
|
151
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
152
|
+
# @return [Object] Returns the model itself
|
153
|
+
def build_from_hash(attributes)
|
154
|
+
return nil unless attributes.is_a?(Hash)
|
155
|
+
attributes = attributes.transform_keys(&:to_sym)
|
156
|
+
self.class.openapi_types.each_pair do |key, type|
|
157
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
158
|
+
self.send("#{key}=", nil)
|
159
|
+
elsif type =~ /\AArray<(.*)>/i
|
160
|
+
# check to ensure the input is an array given that the attribute
|
161
|
+
# is documented as an array but the input is not
|
162
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
163
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
164
|
+
end
|
165
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
166
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
self
|
171
|
+
end
|
172
|
+
|
173
|
+
# Deserializes the data based on type
|
174
|
+
# @param string type Data type
|
175
|
+
# @param string value Value to be deserialized
|
176
|
+
# @return [Object] Deserialized data
|
177
|
+
def _deserialize(type, value)
|
178
|
+
case type.to_sym
|
179
|
+
when :Time
|
180
|
+
Time.parse(value)
|
181
|
+
when :Date
|
182
|
+
Date.parse(value)
|
183
|
+
when :String
|
184
|
+
value.to_s
|
185
|
+
when :Integer
|
186
|
+
value.to_i
|
187
|
+
when :Float
|
188
|
+
value.to_f
|
189
|
+
when :Boolean
|
190
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
191
|
+
true
|
192
|
+
else
|
193
|
+
false
|
194
|
+
end
|
195
|
+
when :Object
|
196
|
+
# generic object (usually a Hash), return directly
|
197
|
+
value
|
198
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
199
|
+
inner_type = Regexp.last_match[:inner_type]
|
200
|
+
value.map { |v| _deserialize(inner_type, v) }
|
201
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
202
|
+
k_type = Regexp.last_match[:k_type]
|
203
|
+
v_type = Regexp.last_match[:v_type]
|
204
|
+
{}.tap do |hash|
|
205
|
+
value.each do |k, v|
|
206
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
207
|
+
end
|
208
|
+
end
|
209
|
+
else # model
|
210
|
+
# models (e.g. Pet) or oneOf
|
211
|
+
klass = Carbon.const_get(type)
|
212
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
# Returns the string representation of the object
|
217
|
+
# @return [String] String presentation of the object
|
218
|
+
def to_s
|
219
|
+
to_hash.to_s
|
220
|
+
end
|
221
|
+
|
222
|
+
# to_body is an alias to to_hash (backward compatibility)
|
223
|
+
# @return [Hash] Returns the object in the form of hash
|
224
|
+
def to_body
|
225
|
+
to_hash
|
226
|
+
end
|
227
|
+
|
228
|
+
# Returns the object in the form of hash
|
229
|
+
# @return [Hash] Returns the object in the form of hash
|
230
|
+
def to_hash
|
231
|
+
hash = {}
|
232
|
+
self.class.attribute_map.each_pair do |attr, param|
|
233
|
+
value = self.send(attr)
|
234
|
+
if value.nil?
|
235
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
236
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
237
|
+
end
|
238
|
+
|
239
|
+
hash[param] = _to_hash(value)
|
240
|
+
end
|
241
|
+
hash
|
242
|
+
end
|
243
|
+
|
244
|
+
# Outputs non-array value in the form of hash
|
245
|
+
# For object, use to_hash. Otherwise, just return the value
|
246
|
+
# @param [Object] value Any valid value
|
247
|
+
# @return [Hash] Returns the value in the form of hash
|
248
|
+
def _to_hash(value)
|
249
|
+
if value.is_a?(Array)
|
250
|
+
value.compact.map { |v| _to_hash(v) }
|
251
|
+
elsif value.is_a?(Hash)
|
252
|
+
{}.tap do |hash|
|
253
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
254
|
+
end
|
255
|
+
elsif value.respond_to? :to_hash
|
256
|
+
value.to_hash
|
257
|
+
else
|
258
|
+
value
|
259
|
+
end
|
260
|
+
end
|
261
|
+
|
262
|
+
end
|
263
|
+
|
264
|
+
end
|
@@ -0,0 +1,342 @@
|
|
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 PRFile
|
14
|
+
attr_accessor :sha
|
15
|
+
|
16
|
+
attr_accessor :filename
|
17
|
+
|
18
|
+
attr_accessor :status
|
19
|
+
|
20
|
+
attr_accessor :additions
|
21
|
+
|
22
|
+
attr_accessor :deletions
|
23
|
+
|
24
|
+
attr_accessor :changes
|
25
|
+
|
26
|
+
attr_accessor :blob_url
|
27
|
+
|
28
|
+
attr_accessor :raw_url
|
29
|
+
|
30
|
+
attr_accessor :contents_url
|
31
|
+
|
32
|
+
attr_accessor :remote_data
|
33
|
+
|
34
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
35
|
+
def self.attribute_map
|
36
|
+
{
|
37
|
+
:'sha' => :'sha',
|
38
|
+
:'filename' => :'filename',
|
39
|
+
:'status' => :'status',
|
40
|
+
:'additions' => :'additions',
|
41
|
+
:'deletions' => :'deletions',
|
42
|
+
:'changes' => :'changes',
|
43
|
+
:'blob_url' => :'blob_url',
|
44
|
+
:'raw_url' => :'raw_url',
|
45
|
+
:'contents_url' => :'contents_url',
|
46
|
+
:'remote_data' => :'remote_data'
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
# Returns all the JSON keys this model knows about
|
51
|
+
def self.acceptable_attributes
|
52
|
+
attribute_map.values
|
53
|
+
end
|
54
|
+
|
55
|
+
# Attribute type mapping.
|
56
|
+
def self.openapi_types
|
57
|
+
{
|
58
|
+
:'sha' => :'String',
|
59
|
+
:'filename' => :'String',
|
60
|
+
:'status' => :'FileStatus',
|
61
|
+
:'additions' => :'Integer',
|
62
|
+
:'deletions' => :'Integer',
|
63
|
+
:'changes' => :'Integer',
|
64
|
+
:'blob_url' => :'String',
|
65
|
+
:'raw_url' => :'String',
|
66
|
+
:'contents_url' => :'String',
|
67
|
+
:'remote_data' => :'Object'
|
68
|
+
}
|
69
|
+
end
|
70
|
+
|
71
|
+
# List of attributes with nullable: true
|
72
|
+
def self.openapi_nullable
|
73
|
+
Set.new([
|
74
|
+
:'remote_data'
|
75
|
+
])
|
76
|
+
end
|
77
|
+
|
78
|
+
# Initializes the object
|
79
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
80
|
+
def initialize(attributes = {})
|
81
|
+
if (!attributes.is_a?(Hash))
|
82
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Carbon::PRFile` initialize method"
|
83
|
+
end
|
84
|
+
|
85
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
86
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
87
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
88
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Carbon::PRFile`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
89
|
+
end
|
90
|
+
h[k.to_sym] = v
|
91
|
+
}
|
92
|
+
|
93
|
+
if attributes.key?(:'sha')
|
94
|
+
self.sha = attributes[:'sha']
|
95
|
+
end
|
96
|
+
|
97
|
+
if attributes.key?(:'filename')
|
98
|
+
self.filename = attributes[:'filename']
|
99
|
+
end
|
100
|
+
|
101
|
+
if attributes.key?(:'status')
|
102
|
+
self.status = attributes[:'status']
|
103
|
+
end
|
104
|
+
|
105
|
+
if attributes.key?(:'additions')
|
106
|
+
self.additions = attributes[:'additions']
|
107
|
+
end
|
108
|
+
|
109
|
+
if attributes.key?(:'deletions')
|
110
|
+
self.deletions = attributes[:'deletions']
|
111
|
+
end
|
112
|
+
|
113
|
+
if attributes.key?(:'changes')
|
114
|
+
self.changes = attributes[:'changes']
|
115
|
+
end
|
116
|
+
|
117
|
+
if attributes.key?(:'blob_url')
|
118
|
+
self.blob_url = attributes[:'blob_url']
|
119
|
+
end
|
120
|
+
|
121
|
+
if attributes.key?(:'raw_url')
|
122
|
+
self.raw_url = attributes[:'raw_url']
|
123
|
+
end
|
124
|
+
|
125
|
+
if attributes.key?(:'contents_url')
|
126
|
+
self.contents_url = attributes[:'contents_url']
|
127
|
+
end
|
128
|
+
|
129
|
+
if attributes.key?(:'remote_data')
|
130
|
+
self.remote_data = attributes[:'remote_data']
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
135
|
+
# @return Array for valid properties with the reasons
|
136
|
+
def list_invalid_properties
|
137
|
+
invalid_properties = Array.new
|
138
|
+
if @sha.nil?
|
139
|
+
invalid_properties.push('invalid value for "sha", sha cannot be nil.')
|
140
|
+
end
|
141
|
+
|
142
|
+
if @filename.nil?
|
143
|
+
invalid_properties.push('invalid value for "filename", filename cannot be nil.')
|
144
|
+
end
|
145
|
+
|
146
|
+
if @status.nil?
|
147
|
+
invalid_properties.push('invalid value for "status", status cannot be nil.')
|
148
|
+
end
|
149
|
+
|
150
|
+
if @additions.nil?
|
151
|
+
invalid_properties.push('invalid value for "additions", additions cannot be nil.')
|
152
|
+
end
|
153
|
+
|
154
|
+
if @deletions.nil?
|
155
|
+
invalid_properties.push('invalid value for "deletions", deletions cannot be nil.')
|
156
|
+
end
|
157
|
+
|
158
|
+
if @changes.nil?
|
159
|
+
invalid_properties.push('invalid value for "changes", changes cannot be nil.')
|
160
|
+
end
|
161
|
+
|
162
|
+
if @blob_url.nil?
|
163
|
+
invalid_properties.push('invalid value for "blob_url", blob_url cannot be nil.')
|
164
|
+
end
|
165
|
+
|
166
|
+
if @raw_url.nil?
|
167
|
+
invalid_properties.push('invalid value for "raw_url", raw_url cannot be nil.')
|
168
|
+
end
|
169
|
+
|
170
|
+
if @contents_url.nil?
|
171
|
+
invalid_properties.push('invalid value for "contents_url", contents_url cannot be nil.')
|
172
|
+
end
|
173
|
+
|
174
|
+
invalid_properties
|
175
|
+
end
|
176
|
+
|
177
|
+
# Check to see if the all the properties in the model are valid
|
178
|
+
# @return true if the model is valid
|
179
|
+
def valid?
|
180
|
+
return false if @sha.nil?
|
181
|
+
return false if @filename.nil?
|
182
|
+
return false if @status.nil?
|
183
|
+
return false if @additions.nil?
|
184
|
+
return false if @deletions.nil?
|
185
|
+
return false if @changes.nil?
|
186
|
+
return false if @blob_url.nil?
|
187
|
+
return false if @raw_url.nil?
|
188
|
+
return false if @contents_url.nil?
|
189
|
+
true
|
190
|
+
end
|
191
|
+
|
192
|
+
# Checks equality by comparing each attribute.
|
193
|
+
# @param [Object] Object to be compared
|
194
|
+
def ==(o)
|
195
|
+
return true if self.equal?(o)
|
196
|
+
self.class == o.class &&
|
197
|
+
sha == o.sha &&
|
198
|
+
filename == o.filename &&
|
199
|
+
status == o.status &&
|
200
|
+
additions == o.additions &&
|
201
|
+
deletions == o.deletions &&
|
202
|
+
changes == o.changes &&
|
203
|
+
blob_url == o.blob_url &&
|
204
|
+
raw_url == o.raw_url &&
|
205
|
+
contents_url == o.contents_url &&
|
206
|
+
remote_data == o.remote_data
|
207
|
+
end
|
208
|
+
|
209
|
+
# @see the `==` method
|
210
|
+
# @param [Object] Object to be compared
|
211
|
+
def eql?(o)
|
212
|
+
self == o
|
213
|
+
end
|
214
|
+
|
215
|
+
# Calculates hash code according to all attributes.
|
216
|
+
# @return [Integer] Hash code
|
217
|
+
def hash
|
218
|
+
[sha, filename, status, additions, deletions, changes, blob_url, raw_url, contents_url, remote_data].hash
|
219
|
+
end
|
220
|
+
|
221
|
+
# Builds the object from hash
|
222
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
223
|
+
# @return [Object] Returns the model itself
|
224
|
+
def self.build_from_hash(attributes)
|
225
|
+
new.build_from_hash(attributes)
|
226
|
+
end
|
227
|
+
|
228
|
+
# Builds the object from hash
|
229
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
230
|
+
# @return [Object] Returns the model itself
|
231
|
+
def build_from_hash(attributes)
|
232
|
+
return nil unless attributes.is_a?(Hash)
|
233
|
+
attributes = attributes.transform_keys(&:to_sym)
|
234
|
+
self.class.openapi_types.each_pair do |key, type|
|
235
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
236
|
+
self.send("#{key}=", nil)
|
237
|
+
elsif type =~ /\AArray<(.*)>/i
|
238
|
+
# check to ensure the input is an array given that the attribute
|
239
|
+
# is documented as an array but the input is not
|
240
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
241
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
242
|
+
end
|
243
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
244
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
245
|
+
end
|
246
|
+
end
|
247
|
+
|
248
|
+
self
|
249
|
+
end
|
250
|
+
|
251
|
+
# Deserializes the data based on type
|
252
|
+
# @param string type Data type
|
253
|
+
# @param string value Value to be deserialized
|
254
|
+
# @return [Object] Deserialized data
|
255
|
+
def _deserialize(type, value)
|
256
|
+
case type.to_sym
|
257
|
+
when :Time
|
258
|
+
Time.parse(value)
|
259
|
+
when :Date
|
260
|
+
Date.parse(value)
|
261
|
+
when :String
|
262
|
+
value.to_s
|
263
|
+
when :Integer
|
264
|
+
value.to_i
|
265
|
+
when :Float
|
266
|
+
value.to_f
|
267
|
+
when :Boolean
|
268
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
269
|
+
true
|
270
|
+
else
|
271
|
+
false
|
272
|
+
end
|
273
|
+
when :Object
|
274
|
+
# generic object (usually a Hash), return directly
|
275
|
+
value
|
276
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
277
|
+
inner_type = Regexp.last_match[:inner_type]
|
278
|
+
value.map { |v| _deserialize(inner_type, v) }
|
279
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
280
|
+
k_type = Regexp.last_match[:k_type]
|
281
|
+
v_type = Regexp.last_match[:v_type]
|
282
|
+
{}.tap do |hash|
|
283
|
+
value.each do |k, v|
|
284
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
285
|
+
end
|
286
|
+
end
|
287
|
+
else # model
|
288
|
+
# models (e.g. Pet) or oneOf
|
289
|
+
klass = Carbon.const_get(type)
|
290
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
291
|
+
end
|
292
|
+
end
|
293
|
+
|
294
|
+
# Returns the string representation of the object
|
295
|
+
# @return [String] String presentation of the object
|
296
|
+
def to_s
|
297
|
+
to_hash.to_s
|
298
|
+
end
|
299
|
+
|
300
|
+
# to_body is an alias to to_hash (backward compatibility)
|
301
|
+
# @return [Hash] Returns the object in the form of hash
|
302
|
+
def to_body
|
303
|
+
to_hash
|
304
|
+
end
|
305
|
+
|
306
|
+
# Returns the object in the form of hash
|
307
|
+
# @return [Hash] Returns the object in the form of hash
|
308
|
+
def to_hash
|
309
|
+
hash = {}
|
310
|
+
self.class.attribute_map.each_pair do |attr, param|
|
311
|
+
value = self.send(attr)
|
312
|
+
if value.nil?
|
313
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
314
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
315
|
+
end
|
316
|
+
|
317
|
+
hash[param] = _to_hash(value)
|
318
|
+
end
|
319
|
+
hash
|
320
|
+
end
|
321
|
+
|
322
|
+
# Outputs non-array value in the form of hash
|
323
|
+
# For object, use to_hash. Otherwise, just return the value
|
324
|
+
# @param [Object] value Any valid value
|
325
|
+
# @return [Hash] Returns the value in the form of hash
|
326
|
+
def _to_hash(value)
|
327
|
+
if value.is_a?(Array)
|
328
|
+
value.compact.map { |v| _to_hash(v) }
|
329
|
+
elsif value.is_a?(Hash)
|
330
|
+
{}.tap do |hash|
|
331
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
332
|
+
end
|
333
|
+
elsif value.respond_to? :to_hash
|
334
|
+
value.to_hash
|
335
|
+
else
|
336
|
+
value
|
337
|
+
end
|
338
|
+
end
|
339
|
+
|
340
|
+
end
|
341
|
+
|
342
|
+
end
|
@@ -0,0 +1,37 @@
|
|
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 PROrderBy
|
14
|
+
CREATED = "created".freeze
|
15
|
+
UPDATED = "updated".freeze
|
16
|
+
POPULARITY = "popularity".freeze
|
17
|
+
|
18
|
+
def self.all_vars
|
19
|
+
@all_vars ||= [CREATED, UPDATED, POPULARITY].freeze
|
20
|
+
end
|
21
|
+
|
22
|
+
# Builds the enum from string
|
23
|
+
# @param [String] The enum value in the form of the string
|
24
|
+
# @return [String] The enum value
|
25
|
+
def self.build_from_hash(value)
|
26
|
+
new.build_from_hash(value)
|
27
|
+
end
|
28
|
+
|
29
|
+
# Builds the enum from string
|
30
|
+
# @param [String] The enum value in the form of the string
|
31
|
+
# @return [String] The enum value
|
32
|
+
def build_from_hash(value)
|
33
|
+
return value if PROrderBy.all_vars.include?(value)
|
34
|
+
raise "Invalid ENUM value #{value} for class #PROrderBy"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,36 @@
|
|
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 PRState
|
14
|
+
CLOSED = "closed".freeze
|
15
|
+
OPEN = "open".freeze
|
16
|
+
|
17
|
+
def self.all_vars
|
18
|
+
@all_vars ||= [CLOSED, OPEN].freeze
|
19
|
+
end
|
20
|
+
|
21
|
+
# Builds the enum from string
|
22
|
+
# @param [String] The enum value in the form of the string
|
23
|
+
# @return [String] The enum value
|
24
|
+
def self.build_from_hash(value)
|
25
|
+
new.build_from_hash(value)
|
26
|
+
end
|
27
|
+
|
28
|
+
# Builds the enum from string
|
29
|
+
# @param [String] The enum value in the form of the string
|
30
|
+
# @return [String] The enum value
|
31
|
+
def build_from_hash(value)
|
32
|
+
return value if PRState.all_vars.include?(value)
|
33
|
+
raise "Invalid ENUM value #{value} for class #PRState"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,37 @@
|
|
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 PRStateInput
|
14
|
+
CLOSED = "closed".freeze
|
15
|
+
OPEN = "open".freeze
|
16
|
+
ALL = "all".freeze
|
17
|
+
|
18
|
+
def self.all_vars
|
19
|
+
@all_vars ||= [CLOSED, OPEN, ALL].freeze
|
20
|
+
end
|
21
|
+
|
22
|
+
# Builds the enum from string
|
23
|
+
# @param [String] The enum value in the form of the string
|
24
|
+
# @return [String] The enum value
|
25
|
+
def self.build_from_hash(value)
|
26
|
+
new.build_from_hash(value)
|
27
|
+
end
|
28
|
+
|
29
|
+
# Builds the enum from string
|
30
|
+
# @param [String] The enum value in the form of the string
|
31
|
+
# @return [String] The enum value
|
32
|
+
def build_from_hash(value)
|
33
|
+
return value if PRStateInput.all_vars.include?(value)
|
34
|
+
raise "Invalid ENUM value #{value} for class #PRStateInput"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|