abliteration 0.1.7 → 0.1.8

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.
@@ -0,0 +1,386 @@
1
+ =begin
2
+ #abliteration.org Public API
3
+
4
+ #Read access to the abliteration.org catalog: models and their method classification, alignment datasets and their passports, the M-code taxonomy, the four flagship indices and the curated field timeline. Every call is authenticated with a bearer key and metered in credits against the same wallet the Research Agent spends from. There is no free tier for machine traffic and no separate billing. Responses report `cost` and `credits_remaining` on every success. While `metering` reads `preview`, the cost shown is what the call will bill once metering is enabled and nothing is actually deducted; when it reads `billed`, it was.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.25.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Abliteration
17
+ class ListModelReadmeDrifts200Response < ApiModelBase
18
+ attr_accessor :data
19
+
20
+ # Credits this call costs.
21
+ attr_accessor :cost
22
+
23
+ # Wallet balance after the call. Unchanged while metering is preview.
24
+ attr_accessor :credits_remaining
25
+
26
+ # Ceiling for the current window. Also returned as X-RateLimit-Limit.
27
+ attr_accessor :rate_limit_limit
28
+
29
+ # Calls left in the current window for this key. Also returned as X-RateLimit-Remaining.
30
+ attr_accessor :rate_limit_remaining
31
+
32
+ # Unix seconds at which the window resets to full ceiling. Also returned as X-RateLimit-Reset.
33
+ attr_accessor :rate_limit_reset
34
+
35
+ # Whether cost was actually deducted.
36
+ attr_accessor :metering
37
+
38
+ # Also returned in the x-request-id header.
39
+ attr_accessor :request_id
40
+
41
+ class EnumAttributeValidator
42
+ attr_reader :datatype
43
+ attr_reader :allowable_values
44
+
45
+ def initialize(datatype, allowable_values)
46
+ @allowable_values = allowable_values.map do |value|
47
+ case datatype.to_s
48
+ when /Integer/i
49
+ value.to_i
50
+ when /Float/i
51
+ value.to_f
52
+ else
53
+ value
54
+ end
55
+ end
56
+ end
57
+
58
+ def valid?(value)
59
+ !value || allowable_values.include?(value)
60
+ end
61
+ end
62
+
63
+ # Attribute mapping from ruby-style variable name to JSON key.
64
+ def self.attribute_map
65
+ {
66
+ :'data' => :'data',
67
+ :'cost' => :'cost',
68
+ :'credits_remaining' => :'credits_remaining',
69
+ :'rate_limit_limit' => :'rate_limit_limit',
70
+ :'rate_limit_remaining' => :'rate_limit_remaining',
71
+ :'rate_limit_reset' => :'rate_limit_reset',
72
+ :'metering' => :'metering',
73
+ :'request_id' => :'request_id'
74
+ }
75
+ end
76
+
77
+ # Returns attribute mapping this model knows about
78
+ def self.acceptable_attribute_map
79
+ attribute_map
80
+ end
81
+
82
+ # Returns all the JSON keys this model knows about
83
+ def self.acceptable_attributes
84
+ acceptable_attribute_map.values
85
+ end
86
+
87
+ # Attribute type mapping.
88
+ def self.openapi_types
89
+ {
90
+ :'data' => :'Array<ReadmeDrift>',
91
+ :'cost' => :'Integer',
92
+ :'credits_remaining' => :'Integer',
93
+ :'rate_limit_limit' => :'Integer',
94
+ :'rate_limit_remaining' => :'Integer',
95
+ :'rate_limit_reset' => :'Integer',
96
+ :'metering' => :'String',
97
+ :'request_id' => :'String'
98
+ }
99
+ end
100
+
101
+ # List of attributes with nullable: true
102
+ def self.openapi_nullable
103
+ Set.new([
104
+ ])
105
+ end
106
+
107
+ # List of class defined in allOf (OpenAPI v3)
108
+ def self.openapi_all_of
109
+ [
110
+ :'Envelope'
111
+ ]
112
+ end
113
+
114
+ # Initializes the object
115
+ # @param [Hash] attributes Model attributes in the form of hash
116
+ def initialize(attributes = {})
117
+ if (!attributes.is_a?(Hash))
118
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Abliteration::ListModelReadmeDrifts200Response` initialize method"
119
+ end
120
+
121
+ # check to see if the attribute exists and convert string to symbol for hash key
122
+ acceptable_attribute_map = self.class.acceptable_attribute_map
123
+ attributes = attributes.each_with_object({}) { |(k, v), h|
124
+ if (!acceptable_attribute_map.key?(k.to_sym))
125
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Abliteration::ListModelReadmeDrifts200Response`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
126
+ end
127
+ h[k.to_sym] = v
128
+ }
129
+
130
+ if attributes.key?(:'data')
131
+ if (value = attributes[:'data']).is_a?(Array)
132
+ self.data = value
133
+ end
134
+ else
135
+ self.data = nil
136
+ end
137
+
138
+ if attributes.key?(:'cost')
139
+ self.cost = attributes[:'cost']
140
+ else
141
+ self.cost = nil
142
+ end
143
+
144
+ if attributes.key?(:'credits_remaining')
145
+ self.credits_remaining = attributes[:'credits_remaining']
146
+ else
147
+ self.credits_remaining = nil
148
+ end
149
+
150
+ if attributes.key?(:'rate_limit_limit')
151
+ self.rate_limit_limit = attributes[:'rate_limit_limit']
152
+ else
153
+ self.rate_limit_limit = nil
154
+ end
155
+
156
+ if attributes.key?(:'rate_limit_remaining')
157
+ self.rate_limit_remaining = attributes[:'rate_limit_remaining']
158
+ else
159
+ self.rate_limit_remaining = nil
160
+ end
161
+
162
+ if attributes.key?(:'rate_limit_reset')
163
+ self.rate_limit_reset = attributes[:'rate_limit_reset']
164
+ else
165
+ self.rate_limit_reset = nil
166
+ end
167
+
168
+ if attributes.key?(:'metering')
169
+ self.metering = attributes[:'metering']
170
+ else
171
+ self.metering = nil
172
+ end
173
+
174
+ if attributes.key?(:'request_id')
175
+ self.request_id = attributes[:'request_id']
176
+ else
177
+ self.request_id = nil
178
+ end
179
+ end
180
+
181
+ # Show invalid properties with the reasons. Usually used together with valid?
182
+ # @return Array for valid properties with the reasons
183
+ def list_invalid_properties
184
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
185
+ invalid_properties = Array.new
186
+ if @data.nil?
187
+ invalid_properties.push('invalid value for "data", data cannot be nil.')
188
+ end
189
+
190
+ if @cost.nil?
191
+ invalid_properties.push('invalid value for "cost", cost cannot be nil.')
192
+ end
193
+
194
+ if @credits_remaining.nil?
195
+ invalid_properties.push('invalid value for "credits_remaining", credits_remaining cannot be nil.')
196
+ end
197
+
198
+ if @rate_limit_limit.nil?
199
+ invalid_properties.push('invalid value for "rate_limit_limit", rate_limit_limit cannot be nil.')
200
+ end
201
+
202
+ if @rate_limit_remaining.nil?
203
+ invalid_properties.push('invalid value for "rate_limit_remaining", rate_limit_remaining cannot be nil.')
204
+ end
205
+
206
+ if @rate_limit_reset.nil?
207
+ invalid_properties.push('invalid value for "rate_limit_reset", rate_limit_reset cannot be nil.')
208
+ end
209
+
210
+ if @metering.nil?
211
+ invalid_properties.push('invalid value for "metering", metering cannot be nil.')
212
+ end
213
+
214
+ if @request_id.nil?
215
+ invalid_properties.push('invalid value for "request_id", request_id cannot be nil.')
216
+ end
217
+
218
+ invalid_properties
219
+ end
220
+
221
+ # Check to see if the all the properties in the model are valid
222
+ # @return true if the model is valid
223
+ def valid?
224
+ warn '[DEPRECATED] the `valid?` method is obsolete'
225
+ return false if @data.nil?
226
+ return false if @cost.nil?
227
+ return false if @credits_remaining.nil?
228
+ return false if @rate_limit_limit.nil?
229
+ return false if @rate_limit_remaining.nil?
230
+ return false if @rate_limit_reset.nil?
231
+ return false if @metering.nil?
232
+ metering_validator = EnumAttributeValidator.new('String', ["preview", "billed"])
233
+ return false unless metering_validator.valid?(@metering)
234
+ return false if @request_id.nil?
235
+ true
236
+ end
237
+
238
+ # Custom attribute writer method with validation
239
+ # @param [Object] data Value to be assigned
240
+ def data=(data)
241
+ if data.nil?
242
+ fail ArgumentError, 'data cannot be nil'
243
+ end
244
+
245
+ @data = data
246
+ end
247
+
248
+ # Custom attribute writer method with validation
249
+ # @param [Object] cost Value to be assigned
250
+ def cost=(cost)
251
+ if cost.nil?
252
+ fail ArgumentError, 'cost cannot be nil'
253
+ end
254
+
255
+ @cost = cost
256
+ end
257
+
258
+ # Custom attribute writer method with validation
259
+ # @param [Object] credits_remaining Value to be assigned
260
+ def credits_remaining=(credits_remaining)
261
+ if credits_remaining.nil?
262
+ fail ArgumentError, 'credits_remaining cannot be nil'
263
+ end
264
+
265
+ @credits_remaining = credits_remaining
266
+ end
267
+
268
+ # Custom attribute writer method with validation
269
+ # @param [Object] rate_limit_limit Value to be assigned
270
+ def rate_limit_limit=(rate_limit_limit)
271
+ if rate_limit_limit.nil?
272
+ fail ArgumentError, 'rate_limit_limit cannot be nil'
273
+ end
274
+
275
+ @rate_limit_limit = rate_limit_limit
276
+ end
277
+
278
+ # Custom attribute writer method with validation
279
+ # @param [Object] rate_limit_remaining Value to be assigned
280
+ def rate_limit_remaining=(rate_limit_remaining)
281
+ if rate_limit_remaining.nil?
282
+ fail ArgumentError, 'rate_limit_remaining cannot be nil'
283
+ end
284
+
285
+ @rate_limit_remaining = rate_limit_remaining
286
+ end
287
+
288
+ # Custom attribute writer method with validation
289
+ # @param [Object] rate_limit_reset Value to be assigned
290
+ def rate_limit_reset=(rate_limit_reset)
291
+ if rate_limit_reset.nil?
292
+ fail ArgumentError, 'rate_limit_reset cannot be nil'
293
+ end
294
+
295
+ @rate_limit_reset = rate_limit_reset
296
+ end
297
+
298
+ # Custom attribute writer method checking allowed values (enum).
299
+ # @param [Object] metering Object to be assigned
300
+ def metering=(metering)
301
+ validator = EnumAttributeValidator.new('String', ["preview", "billed"])
302
+ unless validator.valid?(metering)
303
+ fail ArgumentError, "invalid value for \"metering\", must be one of #{validator.allowable_values}."
304
+ end
305
+ @metering = metering
306
+ end
307
+
308
+ # Custom attribute writer method with validation
309
+ # @param [Object] request_id Value to be assigned
310
+ def request_id=(request_id)
311
+ if request_id.nil?
312
+ fail ArgumentError, 'request_id cannot be nil'
313
+ end
314
+
315
+ @request_id = request_id
316
+ end
317
+
318
+ # Checks equality by comparing each attribute.
319
+ # @param [Object] Object to be compared
320
+ def ==(o)
321
+ return true if self.equal?(o)
322
+ self.class == o.class &&
323
+ data == o.data &&
324
+ cost == o.cost &&
325
+ credits_remaining == o.credits_remaining &&
326
+ rate_limit_limit == o.rate_limit_limit &&
327
+ rate_limit_remaining == o.rate_limit_remaining &&
328
+ rate_limit_reset == o.rate_limit_reset &&
329
+ metering == o.metering &&
330
+ request_id == o.request_id
331
+ end
332
+
333
+ # @see the `==` method
334
+ # @param [Object] Object to be compared
335
+ def eql?(o)
336
+ self == o
337
+ end
338
+
339
+ # Calculates hash code according to all attributes.
340
+ # @return [Integer] Hash code
341
+ def hash
342
+ [data, cost, credits_remaining, rate_limit_limit, rate_limit_remaining, rate_limit_reset, metering, request_id].hash
343
+ end
344
+
345
+ # Builds the object from hash
346
+ # @param [Hash] attributes Model attributes in the form of hash
347
+ # @return [Object] Returns the model itself
348
+ def self.build_from_hash(attributes)
349
+ return nil unless attributes.is_a?(Hash)
350
+ attributes = attributes.transform_keys(&:to_sym)
351
+ transformed_hash = {}
352
+ openapi_types.each_pair do |key, type|
353
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
354
+ transformed_hash["#{key}"] = nil
355
+ elsif type =~ /\AArray<(.*)>/i
356
+ # check to ensure the input is an array given that the attribute
357
+ # is documented as an array but the input is not
358
+ if attributes[attribute_map[key]].is_a?(Array)
359
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
360
+ end
361
+ elsif !attributes[attribute_map[key]].nil?
362
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
363
+ end
364
+ end
365
+ new(transformed_hash)
366
+ end
367
+
368
+ # Returns the object in the form of hash
369
+ # @return [Hash] Returns the object in the form of hash
370
+ def to_hash
371
+ hash = {}
372
+ self.class.attribute_map.each_pair do |attr, param|
373
+ value = self.send(attr)
374
+ if value.nil?
375
+ is_nullable = self.class.openapi_nullable.include?(attr)
376
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
377
+ end
378
+
379
+ hash[param] = _to_hash(value)
380
+ end
381
+ hash
382
+ end
383
+
384
+ end
385
+
386
+ end
@@ -0,0 +1,169 @@
1
+ =begin
2
+ #abliteration.org Public API
3
+
4
+ #Read access to the abliteration.org catalog: models and their method classification, alignment datasets and their passports, the M-code taxonomy, the four flagship indices and the curated field timeline. Every call is authenticated with a bearer key and metered in credits against the same wallet the Research Agent spends from. There is no free tier for machine traffic and no separate billing. Responses report `cost` and `credits_remaining` on every success. While `metering` reads `preview`, the cost shown is what the call will bill once metering is enabled and nothing is actually deducted; when it reads `billed`, it was.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.25.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Abliteration
17
+ # Wayback-machine view: full README content at one commit.
18
+ class ReadmeAt < ApiModelBase
19
+ # Model id (author/name).
20
+ attr_accessor :id
21
+
22
+ # Commit sha (echoes the path param).
23
+ attr_accessor :commit
24
+
25
+ # Full README markdown at that commit. Up to ~100KB.
26
+ attr_accessor :content
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'id' => :'id',
32
+ :'commit' => :'commit',
33
+ :'content' => :'content'
34
+ }
35
+ end
36
+
37
+ # Returns attribute mapping this model knows about
38
+ def self.acceptable_attribute_map
39
+ attribute_map
40
+ end
41
+
42
+ # Returns all the JSON keys this model knows about
43
+ def self.acceptable_attributes
44
+ acceptable_attribute_map.values
45
+ end
46
+
47
+ # Attribute type mapping.
48
+ def self.openapi_types
49
+ {
50
+ :'id' => :'String',
51
+ :'commit' => :'String',
52
+ :'content' => :'String'
53
+ }
54
+ end
55
+
56
+ # List of attributes with nullable: true
57
+ def self.openapi_nullable
58
+ Set.new([
59
+ ])
60
+ end
61
+
62
+ # Initializes the object
63
+ # @param [Hash] attributes Model attributes in the form of hash
64
+ def initialize(attributes = {})
65
+ if (!attributes.is_a?(Hash))
66
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Abliteration::ReadmeAt` initialize method"
67
+ end
68
+
69
+ # check to see if the attribute exists and convert string to symbol for hash key
70
+ acceptable_attribute_map = self.class.acceptable_attribute_map
71
+ attributes = attributes.each_with_object({}) { |(k, v), h|
72
+ if (!acceptable_attribute_map.key?(k.to_sym))
73
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Abliteration::ReadmeAt`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
74
+ end
75
+ h[k.to_sym] = v
76
+ }
77
+
78
+ if attributes.key?(:'id')
79
+ self.id = attributes[:'id']
80
+ end
81
+
82
+ if attributes.key?(:'commit')
83
+ self.commit = attributes[:'commit']
84
+ end
85
+
86
+ if attributes.key?(:'content')
87
+ self.content = attributes[:'content']
88
+ end
89
+ end
90
+
91
+ # Show invalid properties with the reasons. Usually used together with valid?
92
+ # @return Array for valid properties with the reasons
93
+ def list_invalid_properties
94
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
95
+ invalid_properties = Array.new
96
+ invalid_properties
97
+ end
98
+
99
+ # Check to see if the all the properties in the model are valid
100
+ # @return true if the model is valid
101
+ def valid?
102
+ warn '[DEPRECATED] the `valid?` method is obsolete'
103
+ true
104
+ end
105
+
106
+ # Checks equality by comparing each attribute.
107
+ # @param [Object] Object to be compared
108
+ def ==(o)
109
+ return true if self.equal?(o)
110
+ self.class == o.class &&
111
+ id == o.id &&
112
+ commit == o.commit &&
113
+ content == o.content
114
+ end
115
+
116
+ # @see the `==` method
117
+ # @param [Object] Object to be compared
118
+ def eql?(o)
119
+ self == o
120
+ end
121
+
122
+ # Calculates hash code according to all attributes.
123
+ # @return [Integer] Hash code
124
+ def hash
125
+ [id, commit, content].hash
126
+ end
127
+
128
+ # Builds the object from hash
129
+ # @param [Hash] attributes Model attributes in the form of hash
130
+ # @return [Object] Returns the model itself
131
+ def self.build_from_hash(attributes)
132
+ return nil unless attributes.is_a?(Hash)
133
+ attributes = attributes.transform_keys(&:to_sym)
134
+ transformed_hash = {}
135
+ openapi_types.each_pair do |key, type|
136
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
137
+ transformed_hash["#{key}"] = nil
138
+ elsif type =~ /\AArray<(.*)>/i
139
+ # check to ensure the input is an array given that the attribute
140
+ # is documented as an array but the input is not
141
+ if attributes[attribute_map[key]].is_a?(Array)
142
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
143
+ end
144
+ elsif !attributes[attribute_map[key]].nil?
145
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
146
+ end
147
+ end
148
+ new(transformed_hash)
149
+ end
150
+
151
+ # Returns the object in the form of hash
152
+ # @return [Hash] Returns the object in the form of hash
153
+ def to_hash
154
+ hash = {}
155
+ self.class.attribute_map.each_pair do |attr, param|
156
+ value = self.send(attr)
157
+ if value.nil?
158
+ is_nullable = self.class.openapi_nullable.include?(attr)
159
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
160
+ end
161
+
162
+ hash[param] = _to_hash(value)
163
+ end
164
+ hash
165
+ end
166
+
167
+ end
168
+
169
+ end