carbon_ruby_sdk 0.2.38 → 0.2.40

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.
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,438 @@
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 PullRequest
14
+ attr_accessor :title
15
+
16
+ attr_accessor :id
17
+
18
+ attr_accessor :url
19
+
20
+ attr_accessor :number
21
+
22
+ attr_accessor :state
23
+
24
+ attr_accessor :user
25
+
26
+ attr_accessor :created_at
27
+
28
+ attr_accessor :updated_at
29
+
30
+ attr_accessor :closed_at
31
+
32
+ attr_accessor :merged_at
33
+
34
+ attr_accessor :requested_reviewers
35
+
36
+ attr_accessor :requested_teams
37
+
38
+ attr_accessor :labels
39
+
40
+ attr_accessor :draft
41
+
42
+ attr_accessor :head
43
+
44
+ attr_accessor :base
45
+
46
+ attr_accessor :remote_data
47
+
48
+ # Attribute mapping from ruby-style variable name to JSON key.
49
+ def self.attribute_map
50
+ {
51
+ :'title' => :'title',
52
+ :'id' => :'id',
53
+ :'url' => :'url',
54
+ :'number' => :'number',
55
+ :'state' => :'state',
56
+ :'user' => :'user',
57
+ :'created_at' => :'created_at',
58
+ :'updated_at' => :'updated_at',
59
+ :'closed_at' => :'closed_at',
60
+ :'merged_at' => :'merged_at',
61
+ :'requested_reviewers' => :'requested_reviewers',
62
+ :'requested_teams' => :'requested_teams',
63
+ :'labels' => :'labels',
64
+ :'draft' => :'draft',
65
+ :'head' => :'head',
66
+ :'base' => :'base',
67
+ :'remote_data' => :'remote_data'
68
+ }
69
+ end
70
+
71
+ # Returns all the JSON keys this model knows about
72
+ def self.acceptable_attributes
73
+ attribute_map.values
74
+ end
75
+
76
+ # Attribute type mapping.
77
+ def self.openapi_types
78
+ {
79
+ :'title' => :'String',
80
+ :'id' => :'Integer',
81
+ :'url' => :'String',
82
+ :'number' => :'Integer',
83
+ :'state' => :'PRState',
84
+ :'user' => :'User',
85
+ :'created_at' => :'String',
86
+ :'updated_at' => :'String',
87
+ :'closed_at' => :'String',
88
+ :'merged_at' => :'String',
89
+ :'requested_reviewers' => :'Array<User>',
90
+ :'requested_teams' => :'Array<Team>',
91
+ :'labels' => :'Array<Label>',
92
+ :'draft' => :'Boolean',
93
+ :'head' => :'HeadOrBase',
94
+ :'base' => :'HeadOrBase',
95
+ :'remote_data' => :'Object'
96
+ }
97
+ end
98
+
99
+ # List of attributes with nullable: true
100
+ def self.openapi_nullable
101
+ Set.new([
102
+ :'closed_at',
103
+ :'merged_at',
104
+ :'remote_data'
105
+ ])
106
+ end
107
+
108
+ # Initializes the object
109
+ # @param [Hash] attributes Model attributes in the form of hash
110
+ def initialize(attributes = {})
111
+ if (!attributes.is_a?(Hash))
112
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Carbon::PullRequest` initialize method"
113
+ end
114
+
115
+ # check to see if the attribute exists and convert string to symbol for hash key
116
+ attributes = attributes.each_with_object({}) { |(k, v), h|
117
+ if (!self.class.attribute_map.key?(k.to_sym))
118
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Carbon::PullRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
119
+ end
120
+ h[k.to_sym] = v
121
+ }
122
+
123
+ if attributes.key?(:'title')
124
+ self.title = attributes[:'title']
125
+ end
126
+
127
+ if attributes.key?(:'id')
128
+ self.id = attributes[:'id']
129
+ end
130
+
131
+ if attributes.key?(:'url')
132
+ self.url = attributes[:'url']
133
+ end
134
+
135
+ if attributes.key?(:'number')
136
+ self.number = attributes[:'number']
137
+ end
138
+
139
+ if attributes.key?(:'state')
140
+ self.state = attributes[:'state']
141
+ end
142
+
143
+ if attributes.key?(:'user')
144
+ self.user = attributes[:'user']
145
+ end
146
+
147
+ if attributes.key?(:'created_at')
148
+ self.created_at = attributes[:'created_at']
149
+ end
150
+
151
+ if attributes.key?(:'updated_at')
152
+ self.updated_at = attributes[:'updated_at']
153
+ end
154
+
155
+ if attributes.key?(:'closed_at')
156
+ self.closed_at = attributes[:'closed_at']
157
+ end
158
+
159
+ if attributes.key?(:'merged_at')
160
+ self.merged_at = attributes[:'merged_at']
161
+ end
162
+
163
+ if attributes.key?(:'requested_reviewers')
164
+ if (value = attributes[:'requested_reviewers']).is_a?(Array)
165
+ self.requested_reviewers = value
166
+ end
167
+ end
168
+
169
+ if attributes.key?(:'requested_teams')
170
+ if (value = attributes[:'requested_teams']).is_a?(Array)
171
+ self.requested_teams = value
172
+ end
173
+ end
174
+
175
+ if attributes.key?(:'labels')
176
+ if (value = attributes[:'labels']).is_a?(Array)
177
+ self.labels = value
178
+ end
179
+ end
180
+
181
+ if attributes.key?(:'draft')
182
+ self.draft = attributes[:'draft']
183
+ end
184
+
185
+ if attributes.key?(:'head')
186
+ self.head = attributes[:'head']
187
+ end
188
+
189
+ if attributes.key?(:'base')
190
+ self.base = attributes[:'base']
191
+ end
192
+
193
+ if attributes.key?(:'remote_data')
194
+ self.remote_data = attributes[:'remote_data']
195
+ end
196
+ end
197
+
198
+ # Show invalid properties with the reasons. Usually used together with valid?
199
+ # @return Array for valid properties with the reasons
200
+ def list_invalid_properties
201
+ invalid_properties = Array.new
202
+ if @title.nil?
203
+ invalid_properties.push('invalid value for "title", title cannot be nil.')
204
+ end
205
+
206
+ if @id.nil?
207
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
208
+ end
209
+
210
+ if @url.nil?
211
+ invalid_properties.push('invalid value for "url", url cannot be nil.')
212
+ end
213
+
214
+ if @number.nil?
215
+ invalid_properties.push('invalid value for "number", number cannot be nil.')
216
+ end
217
+
218
+ if @state.nil?
219
+ invalid_properties.push('invalid value for "state", state cannot be nil.')
220
+ end
221
+
222
+ if @user.nil?
223
+ invalid_properties.push('invalid value for "user", user cannot be nil.')
224
+ end
225
+
226
+ if @created_at.nil?
227
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
228
+ end
229
+
230
+ if @updated_at.nil?
231
+ invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
232
+ end
233
+
234
+ if @requested_reviewers.nil?
235
+ invalid_properties.push('invalid value for "requested_reviewers", requested_reviewers cannot be nil.')
236
+ end
237
+
238
+ if @requested_teams.nil?
239
+ invalid_properties.push('invalid value for "requested_teams", requested_teams cannot be nil.')
240
+ end
241
+
242
+ if @labels.nil?
243
+ invalid_properties.push('invalid value for "labels", labels cannot be nil.')
244
+ end
245
+
246
+ if @draft.nil?
247
+ invalid_properties.push('invalid value for "draft", draft cannot be nil.')
248
+ end
249
+
250
+ if @head.nil?
251
+ invalid_properties.push('invalid value for "head", head cannot be nil.')
252
+ end
253
+
254
+ if @base.nil?
255
+ invalid_properties.push('invalid value for "base", base cannot be nil.')
256
+ end
257
+
258
+ invalid_properties
259
+ end
260
+
261
+ # Check to see if the all the properties in the model are valid
262
+ # @return true if the model is valid
263
+ def valid?
264
+ return false if @title.nil?
265
+ return false if @id.nil?
266
+ return false if @url.nil?
267
+ return false if @number.nil?
268
+ return false if @state.nil?
269
+ return false if @user.nil?
270
+ return false if @created_at.nil?
271
+ return false if @updated_at.nil?
272
+ return false if @requested_reviewers.nil?
273
+ return false if @requested_teams.nil?
274
+ return false if @labels.nil?
275
+ return false if @draft.nil?
276
+ return false if @head.nil?
277
+ return false if @base.nil?
278
+ true
279
+ end
280
+
281
+ # Checks equality by comparing each attribute.
282
+ # @param [Object] Object to be compared
283
+ def ==(o)
284
+ return true if self.equal?(o)
285
+ self.class == o.class &&
286
+ title == o.title &&
287
+ id == o.id &&
288
+ url == o.url &&
289
+ number == o.number &&
290
+ state == o.state &&
291
+ user == o.user &&
292
+ created_at == o.created_at &&
293
+ updated_at == o.updated_at &&
294
+ closed_at == o.closed_at &&
295
+ merged_at == o.merged_at &&
296
+ requested_reviewers == o.requested_reviewers &&
297
+ requested_teams == o.requested_teams &&
298
+ labels == o.labels &&
299
+ draft == o.draft &&
300
+ head == o.head &&
301
+ base == o.base &&
302
+ remote_data == o.remote_data
303
+ end
304
+
305
+ # @see the `==` method
306
+ # @param [Object] Object to be compared
307
+ def eql?(o)
308
+ self == o
309
+ end
310
+
311
+ # Calculates hash code according to all attributes.
312
+ # @return [Integer] Hash code
313
+ def hash
314
+ [title, id, url, number, state, user, created_at, updated_at, closed_at, merged_at, requested_reviewers, requested_teams, labels, draft, head, base, remote_data].hash
315
+ end
316
+
317
+ # Builds the object from hash
318
+ # @param [Hash] attributes Model attributes in the form of hash
319
+ # @return [Object] Returns the model itself
320
+ def self.build_from_hash(attributes)
321
+ new.build_from_hash(attributes)
322
+ end
323
+
324
+ # Builds the object from hash
325
+ # @param [Hash] attributes Model attributes in the form of hash
326
+ # @return [Object] Returns the model itself
327
+ def build_from_hash(attributes)
328
+ return nil unless attributes.is_a?(Hash)
329
+ attributes = attributes.transform_keys(&:to_sym)
330
+ self.class.openapi_types.each_pair do |key, type|
331
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
332
+ self.send("#{key}=", nil)
333
+ elsif type =~ /\AArray<(.*)>/i
334
+ # check to ensure the input is an array given that the attribute
335
+ # is documented as an array but the input is not
336
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
337
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
338
+ end
339
+ elsif !attributes[self.class.attribute_map[key]].nil?
340
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
341
+ end
342
+ end
343
+
344
+ self
345
+ end
346
+
347
+ # Deserializes the data based on type
348
+ # @param string type Data type
349
+ # @param string value Value to be deserialized
350
+ # @return [Object] Deserialized data
351
+ def _deserialize(type, value)
352
+ case type.to_sym
353
+ when :Time
354
+ Time.parse(value)
355
+ when :Date
356
+ Date.parse(value)
357
+ when :String
358
+ value.to_s
359
+ when :Integer
360
+ value.to_i
361
+ when :Float
362
+ value.to_f
363
+ when :Boolean
364
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
365
+ true
366
+ else
367
+ false
368
+ end
369
+ when :Object
370
+ # generic object (usually a Hash), return directly
371
+ value
372
+ when /\AArray<(?<inner_type>.+)>\z/
373
+ inner_type = Regexp.last_match[:inner_type]
374
+ value.map { |v| _deserialize(inner_type, v) }
375
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
376
+ k_type = Regexp.last_match[:k_type]
377
+ v_type = Regexp.last_match[:v_type]
378
+ {}.tap do |hash|
379
+ value.each do |k, v|
380
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
381
+ end
382
+ end
383
+ else # model
384
+ # models (e.g. Pet) or oneOf
385
+ klass = Carbon.const_get(type)
386
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
387
+ end
388
+ end
389
+
390
+ # Returns the string representation of the object
391
+ # @return [String] String presentation of the object
392
+ def to_s
393
+ to_hash.to_s
394
+ end
395
+
396
+ # to_body is an alias to to_hash (backward compatibility)
397
+ # @return [Hash] Returns the object in the form of hash
398
+ def to_body
399
+ to_hash
400
+ end
401
+
402
+ # Returns the object in the form of hash
403
+ # @return [Hash] Returns the object in the form of hash
404
+ def to_hash
405
+ hash = {}
406
+ self.class.attribute_map.each_pair do |attr, param|
407
+ value = self.send(attr)
408
+ if value.nil?
409
+ is_nullable = self.class.openapi_nullable.include?(attr)
410
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
411
+ end
412
+
413
+ hash[param] = _to_hash(value)
414
+ end
415
+ hash
416
+ end
417
+
418
+ # Outputs non-array value in the form of hash
419
+ # For object, use to_hash. Otherwise, just return the value
420
+ # @param [Object] value Any valid value
421
+ # @return [Hash] Returns the value in the form of hash
422
+ def _to_hash(value)
423
+ if value.is_a?(Array)
424
+ value.compact.map { |v| _to_hash(v) }
425
+ elsif value.is_a?(Hash)
426
+ {}.tap do |hash|
427
+ value.each { |k, v| hash[k] = _to_hash(v) }
428
+ end
429
+ elsif value.respond_to? :to_hash
430
+ value.to_hash
431
+ else
432
+ value
433
+ end
434
+ end
435
+
436
+ end
437
+
438
+ end