carbon_ruby_sdk 0.2.38 → 0.2.40

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +310 -2
  4. data/lib/carbon_ruby_sdk/api/github_api.rb +825 -0
  5. data/lib/carbon_ruby_sdk/models/comments_input.rb +330 -0
  6. data/lib/carbon_ruby_sdk/models/comments_order_by.rb +36 -0
  7. data/lib/carbon_ruby_sdk/models/comments_response.rb +232 -0
  8. data/lib/carbon_ruby_sdk/models/commit.rb +282 -0
  9. data/lib/carbon_ruby_sdk/models/commit_user.rb +234 -0
  10. data/lib/carbon_ruby_sdk/models/commit_user_nullable.rb +234 -0
  11. data/lib/carbon_ruby_sdk/models/commits_input.rb +307 -0
  12. data/lib/carbon_ruby_sdk/models/commits_response.rb +232 -0
  13. data/lib/carbon_ruby_sdk/models/file_status.rb +41 -0
  14. data/lib/carbon_ruby_sdk/models/files_input.rb +307 -0
  15. data/lib/carbon_ruby_sdk/models/files_response.rb +232 -0
  16. data/lib/carbon_ruby_sdk/models/head_or_base.rb +248 -0
  17. data/lib/carbon_ruby_sdk/models/issue.rb +434 -0
  18. data/lib/carbon_ruby_sdk/models/issue_pr.rb +230 -0
  19. data/lib/carbon_ruby_sdk/models/issue_pr_nullable.rb +230 -0
  20. data/lib/carbon_ruby_sdk/models/issues_filter.rb +217 -0
  21. data/lib/carbon_ruby_sdk/models/issues_input.rb +325 -0
  22. data/lib/carbon_ruby_sdk/models/issues_order_by.rb +37 -0
  23. data/lib/carbon_ruby_sdk/models/issues_response.rb +232 -0
  24. data/lib/carbon_ruby_sdk/models/label.rb +234 -0
  25. data/lib/carbon_ruby_sdk/models/organization_user_files_to_sync_filters.rb +29 -1
  26. data/lib/carbon_ruby_sdk/models/pr_comment.rb +358 -0
  27. data/lib/carbon_ruby_sdk/models/pr_commit.rb +264 -0
  28. data/lib/carbon_ruby_sdk/models/pr_file.rb +342 -0
  29. data/lib/carbon_ruby_sdk/models/pr_order_by.rb +37 -0
  30. data/lib/carbon_ruby_sdk/models/pr_state.rb +36 -0
  31. data/lib/carbon_ruby_sdk/models/pr_state_input.rb +37 -0
  32. data/lib/carbon_ruby_sdk/models/pull_request.rb +438 -0
  33. data/lib/carbon_ruby_sdk/models/pull_request_extended.rb +536 -0
  34. data/lib/carbon_ruby_sdk/models/pull_request_filters.rb +239 -0
  35. data/lib/carbon_ruby_sdk/models/pull_request_response.rb +232 -0
  36. data/lib/carbon_ruby_sdk/models/pull_requests_input.rb +325 -0
  37. data/lib/carbon_ruby_sdk/models/sent_webhook_payload.rb +2 -2
  38. data/lib/carbon_ruby_sdk/models/team.rb +234 -0
  39. data/lib/carbon_ruby_sdk/models/tree.rb +234 -0
  40. data/lib/carbon_ruby_sdk/models/user.rb +234 -0
  41. data/lib/carbon_ruby_sdk/models/user_file.rb +11 -1
  42. data/lib/carbon_ruby_sdk/models/user_nullable.rb +234 -0
  43. data/lib/carbon_ruby_sdk/version.rb +1 -1
  44. data/lib/carbon_ruby_sdk.rb +38 -0
  45. data/spec/api/github_api_spec.rb +112 -0
  46. data/spec/models/comments_input_spec.rb +76 -0
  47. data/spec/models/comments_order_by_spec.rb +22 -0
  48. data/spec/models/comments_response_spec.rb +34 -0
  49. data/spec/models/commit_spec.rb +58 -0
  50. data/spec/models/commit_user_nullable_spec.rb +34 -0
  51. data/spec/models/commit_user_spec.rb +34 -0
  52. data/spec/models/commits_input_spec.rb +64 -0
  53. data/spec/models/commits_response_spec.rb +34 -0
  54. data/spec/models/file_status_spec.rb +22 -0
  55. data/spec/models/files_input_spec.rb +64 -0
  56. data/spec/models/files_response_spec.rb +34 -0
  57. data/spec/models/head_or_base_spec.rb +40 -0
  58. data/spec/models/issue_pr_nullable_spec.rb +34 -0
  59. data/spec/models/issue_pr_spec.rb +34 -0
  60. data/spec/models/issue_spec.rb +124 -0
  61. data/spec/models/issues_filter_spec.rb +28 -0
  62. data/spec/models/issues_input_spec.rb +76 -0
  63. data/spec/models/issues_order_by_spec.rb +22 -0
  64. data/spec/models/issues_response_spec.rb +34 -0
  65. data/spec/models/label_spec.rb +34 -0
  66. data/spec/models/organization_user_files_to_sync_filters_spec.rb +6 -0
  67. data/spec/models/pr_comment_spec.rb +94 -0
  68. data/spec/models/pr_commit_spec.rb +52 -0
  69. data/spec/models/pr_file_spec.rb +82 -0
  70. data/spec/models/pr_order_by_spec.rb +22 -0
  71. data/spec/models/pr_state_input_spec.rb +22 -0
  72. data/spec/models/pr_state_spec.rb +22 -0
  73. data/spec/models/pull_request_extended_spec.rb +166 -0
  74. data/spec/models/pull_request_filters_spec.rb +40 -0
  75. data/spec/models/pull_request_response_spec.rb +34 -0
  76. data/spec/models/pull_request_spec.rb +124 -0
  77. data/spec/models/pull_requests_input_spec.rb +76 -0
  78. data/spec/models/sent_webhook_payload_spec.rb +1 -1
  79. data/spec/models/team_spec.rb +34 -0
  80. data/spec/models/tree_spec.rb +34 -0
  81. data/spec/models/user_file_spec.rb +6 -0
  82. data/spec/models/user_nullable_spec.rb +34 -0
  83. data/spec/models/user_spec.rb +34 -0
  84. metadata +301 -193
@@ -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 FilesResponse
14
+ attr_accessor :data
15
+
16
+ attr_accessor :next_cursor
17
+
18
+ # Attribute mapping from ruby-style variable name to JSON key.
19
+ def self.attribute_map
20
+ {
21
+ :'data' => :'data',
22
+ :'next_cursor' => :'next_cursor'
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
+ :'data' => :'Array<PRFile>',
35
+ :'next_cursor' => :'String'
36
+ }
37
+ end
38
+
39
+ # List of attributes with nullable: true
40
+ def self.openapi_nullable
41
+ Set.new([
42
+ :'next_cursor'
43
+ ])
44
+ end
45
+
46
+ # Initializes the object
47
+ # @param [Hash] attributes Model attributes in the form of hash
48
+ def initialize(attributes = {})
49
+ if (!attributes.is_a?(Hash))
50
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Carbon::FilesResponse` initialize method"
51
+ end
52
+
53
+ # check to see if the attribute exists and convert string to symbol for hash key
54
+ attributes = attributes.each_with_object({}) { |(k, v), h|
55
+ if (!self.class.attribute_map.key?(k.to_sym))
56
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Carbon::FilesResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
+ end
58
+ h[k.to_sym] = v
59
+ }
60
+
61
+ if attributes.key?(:'data')
62
+ if (value = attributes[:'data']).is_a?(Array)
63
+ self.data = value
64
+ end
65
+ end
66
+
67
+ if attributes.key?(:'next_cursor')
68
+ self.next_cursor = attributes[:'next_cursor']
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 @data.nil?
77
+ invalid_properties.push('invalid value for "data", data 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 @data.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
+ data == o.data &&
96
+ next_cursor == o.next_cursor
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
+ [data, next_cursor].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
@@ -0,0 +1,248 @@
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 HeadOrBase
14
+ attr_accessor :label
15
+
16
+ attr_accessor :ref
17
+
18
+ attr_accessor :sha
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'label' => :'label',
24
+ :'ref' => :'ref',
25
+ :'sha' => :'sha'
26
+ }
27
+ end
28
+
29
+ # Returns all the JSON keys this model knows about
30
+ def self.acceptable_attributes
31
+ attribute_map.values
32
+ end
33
+
34
+ # Attribute type mapping.
35
+ def self.openapi_types
36
+ {
37
+ :'label' => :'String',
38
+ :'ref' => :'String',
39
+ :'sha' => :'String'
40
+ }
41
+ end
42
+
43
+ # List of attributes with nullable: true
44
+ def self.openapi_nullable
45
+ Set.new([
46
+ ])
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ if (!attributes.is_a?(Hash))
53
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Carbon::HeadOrBase` initialize method"
54
+ end
55
+
56
+ # check to see if the attribute exists and convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}) { |(k, v), h|
58
+ if (!self.class.attribute_map.key?(k.to_sym))
59
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Carbon::HeadOrBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
60
+ end
61
+ h[k.to_sym] = v
62
+ }
63
+
64
+ if attributes.key?(:'label')
65
+ self.label = attributes[:'label']
66
+ end
67
+
68
+ if attributes.key?(:'ref')
69
+ self.ref = attributes[:'ref']
70
+ end
71
+
72
+ if attributes.key?(:'sha')
73
+ self.sha = attributes[:'sha']
74
+ end
75
+ end
76
+
77
+ # Show invalid properties with the reasons. Usually used together with valid?
78
+ # @return Array for valid properties with the reasons
79
+ def list_invalid_properties
80
+ invalid_properties = Array.new
81
+ if @label.nil?
82
+ invalid_properties.push('invalid value for "label", label cannot be nil.')
83
+ end
84
+
85
+ if @ref.nil?
86
+ invalid_properties.push('invalid value for "ref", ref cannot be nil.')
87
+ end
88
+
89
+ if @sha.nil?
90
+ invalid_properties.push('invalid value for "sha", sha cannot be nil.')
91
+ end
92
+
93
+ invalid_properties
94
+ end
95
+
96
+ # Check to see if the all the properties in the model are valid
97
+ # @return true if the model is valid
98
+ def valid?
99
+ return false if @label.nil?
100
+ return false if @ref.nil?
101
+ return false if @sha.nil?
102
+ true
103
+ end
104
+
105
+ # Checks equality by comparing each attribute.
106
+ # @param [Object] Object to be compared
107
+ def ==(o)
108
+ return true if self.equal?(o)
109
+ self.class == o.class &&
110
+ label == o.label &&
111
+ ref == o.ref &&
112
+ sha == o.sha
113
+ end
114
+
115
+ # @see the `==` method
116
+ # @param [Object] Object to be compared
117
+ def eql?(o)
118
+ self == o
119
+ end
120
+
121
+ # Calculates hash code according to all attributes.
122
+ # @return [Integer] Hash code
123
+ def hash
124
+ [label, ref, sha].hash
125
+ end
126
+
127
+ # Builds the object from hash
128
+ # @param [Hash] attributes Model attributes in the form of hash
129
+ # @return [Object] Returns the model itself
130
+ def self.build_from_hash(attributes)
131
+ new.build_from_hash(attributes)
132
+ end
133
+
134
+ # Builds the object from hash
135
+ # @param [Hash] attributes Model attributes in the form of hash
136
+ # @return [Object] Returns the model itself
137
+ def build_from_hash(attributes)
138
+ return nil unless attributes.is_a?(Hash)
139
+ attributes = attributes.transform_keys(&:to_sym)
140
+ self.class.openapi_types.each_pair do |key, type|
141
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
142
+ self.send("#{key}=", nil)
143
+ elsif type =~ /\AArray<(.*)>/i
144
+ # check to ensure the input is an array given that the attribute
145
+ # is documented as an array but the input is not
146
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
147
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
148
+ end
149
+ elsif !attributes[self.class.attribute_map[key]].nil?
150
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
151
+ end
152
+ end
153
+
154
+ self
155
+ end
156
+
157
+ # Deserializes the data based on type
158
+ # @param string type Data type
159
+ # @param string value Value to be deserialized
160
+ # @return [Object] Deserialized data
161
+ def _deserialize(type, value)
162
+ case type.to_sym
163
+ when :Time
164
+ Time.parse(value)
165
+ when :Date
166
+ Date.parse(value)
167
+ when :String
168
+ value.to_s
169
+ when :Integer
170
+ value.to_i
171
+ when :Float
172
+ value.to_f
173
+ when :Boolean
174
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
175
+ true
176
+ else
177
+ false
178
+ end
179
+ when :Object
180
+ # generic object (usually a Hash), return directly
181
+ value
182
+ when /\AArray<(?<inner_type>.+)>\z/
183
+ inner_type = Regexp.last_match[:inner_type]
184
+ value.map { |v| _deserialize(inner_type, v) }
185
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
186
+ k_type = Regexp.last_match[:k_type]
187
+ v_type = Regexp.last_match[:v_type]
188
+ {}.tap do |hash|
189
+ value.each do |k, v|
190
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
191
+ end
192
+ end
193
+ else # model
194
+ # models (e.g. Pet) or oneOf
195
+ klass = Carbon.const_get(type)
196
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
197
+ end
198
+ end
199
+
200
+ # Returns the string representation of the object
201
+ # @return [String] String presentation of the object
202
+ def to_s
203
+ to_hash.to_s
204
+ end
205
+
206
+ # to_body is an alias to to_hash (backward compatibility)
207
+ # @return [Hash] Returns the object in the form of hash
208
+ def to_body
209
+ to_hash
210
+ end
211
+
212
+ # Returns the object in the form of hash
213
+ # @return [Hash] Returns the object in the form of hash
214
+ def to_hash
215
+ hash = {}
216
+ self.class.attribute_map.each_pair do |attr, param|
217
+ value = self.send(attr)
218
+ if value.nil?
219
+ is_nullable = self.class.openapi_nullable.include?(attr)
220
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
221
+ end
222
+
223
+ hash[param] = _to_hash(value)
224
+ end
225
+ hash
226
+ end
227
+
228
+ # Outputs non-array value in the form of hash
229
+ # For object, use to_hash. Otherwise, just return the value
230
+ # @param [Object] value Any valid value
231
+ # @return [Hash] Returns the value in the form of hash
232
+ def _to_hash(value)
233
+ if value.is_a?(Array)
234
+ value.compact.map { |v| _to_hash(v) }
235
+ elsif value.is_a?(Hash)
236
+ {}.tap do |hash|
237
+ value.each { |k, v| hash[k] = _to_hash(v) }
238
+ end
239
+ elsif value.respond_to? :to_hash
240
+ value.to_hash
241
+ else
242
+ value
243
+ end
244
+ end
245
+
246
+ end
247
+
248
+ end