Class: OpenApiOpenAIClient::UsageImagesResult
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- OpenApiOpenAIClient::UsageImagesResult
- Defined in:
- lib/openapi_openai/models/usage_images_result.rb
Overview
The aggregated images usage details of the specific time bucket.
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#api_key_id ⇒ Object
When ‘group_by=api_key_id`, this field provides the API key ID of the grouped usage result.
-
#images ⇒ Object
The number of images processed.
-
#model ⇒ Object
When ‘group_by=model`, this field provides the model name of the grouped usage result.
-
#num_model_requests ⇒ Object
The count of requests made to the model.
-
#object ⇒ Object
Returns the value of attribute object.
-
#project_id ⇒ Object
When ‘group_by=project_id`, this field provides the project ID of the grouped usage result.
-
#size ⇒ Object
When ‘group_by=size`, this field provides the image size of the grouped usage result.
-
#source ⇒ Object
When ‘group_by=source`, this field provides the source of the grouped usage result, possible values are
image.generation,image.edit,image.variation. -
#user_id ⇒ Object
When ‘group_by=user_id`, this field provides the user ID of the grouped usage result.
Class Method Summary collapse
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ UsageImagesResult
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Methods inherited from ApiModelBase
_deserialize, #_to_hash, #to_body, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ UsageImagesResult
Initializes the object
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 |
# File 'lib/openapi_openai/models/usage_images_result.rb', line 121 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `OpenApiOpenAIClient::UsageImagesResult` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| if (!acceptable_attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `OpenApiOpenAIClient::UsageImagesResult`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'object') self.object = attributes[:'object'] else self.object = nil end if attributes.key?(:'images') self.images = attributes[:'images'] else self.images = nil end if attributes.key?(:'num_model_requests') self.num_model_requests = attributes[:'num_model_requests'] else self.num_model_requests = nil end if attributes.key?(:'source') self.source = attributes[:'source'] end if attributes.key?(:'size') self.size = attributes[:'size'] end if attributes.key?(:'project_id') self.project_id = attributes[:'project_id'] end if attributes.key?(:'user_id') self.user_id = attributes[:'user_id'] end if attributes.key?(:'api_key_id') self.api_key_id = attributes[:'api_key_id'] end if attributes.key?(:'model') self.model = attributes[:'model'] end end |
Instance Attribute Details
#api_key_id ⇒ Object
When ‘group_by=api_key_id`, this field provides the API key ID of the grouped usage result.
40 41 42 |
# File 'lib/openapi_openai/models/usage_images_result.rb', line 40 def api_key_id @api_key_id end |
#images ⇒ Object
The number of images processed.
22 23 24 |
# File 'lib/openapi_openai/models/usage_images_result.rb', line 22 def images @images end |
#model ⇒ Object
When ‘group_by=model`, this field provides the model name of the grouped usage result.
43 44 45 |
# File 'lib/openapi_openai/models/usage_images_result.rb', line 43 def model @model end |
#num_model_requests ⇒ Object
The count of requests made to the model.
25 26 27 |
# File 'lib/openapi_openai/models/usage_images_result.rb', line 25 def num_model_requests @num_model_requests end |
#object ⇒ Object
Returns the value of attribute object.
19 20 21 |
# File 'lib/openapi_openai/models/usage_images_result.rb', line 19 def object @object end |
#project_id ⇒ Object
When ‘group_by=project_id`, this field provides the project ID of the grouped usage result.
34 35 36 |
# File 'lib/openapi_openai/models/usage_images_result.rb', line 34 def project_id @project_id end |
#size ⇒ Object
When ‘group_by=size`, this field provides the image size of the grouped usage result.
31 32 33 |
# File 'lib/openapi_openai/models/usage_images_result.rb', line 31 def size @size end |
#source ⇒ Object
When ‘group_by=source`, this field provides the source of the grouped usage result, possible values are image.generation, image.edit, image.variation.
28 29 30 |
# File 'lib/openapi_openai/models/usage_images_result.rb', line 28 def source @source end |
#user_id ⇒ Object
When ‘group_by=user_id`, this field provides the user ID of the grouped usage result.
37 38 39 |
# File 'lib/openapi_openai/models/usage_images_result.rb', line 37 def user_id @user_id end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
83 84 85 |
# File 'lib/openapi_openai/models/usage_images_result.rb', line 83 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
88 89 90 |
# File 'lib/openapi_openai/models/usage_images_result.rb', line 88 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/openapi_openai/models/usage_images_result.rb', line 68 def self.attribute_map { :'object' => :'object', :'images' => :'images', :'num_model_requests' => :'num_model_requests', :'source' => :'source', :'size' => :'size', :'project_id' => :'project_id', :'user_id' => :'user_id', :'api_key_id' => :'api_key_id', :'model' => :'model' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 |
# File 'lib/openapi_openai/models/usage_images_result.rb', line 271 def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) transformed_hash = {} openapi_types.each_pair do |key, type| if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = nil elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[attribute_map[key]].is_a?(Array) transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) end end new(transformed_hash) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
108 109 110 111 112 113 114 115 116 117 |
# File 'lib/openapi_openai/models/usage_images_result.rb', line 108 def self.openapi_nullable Set.new([ :'source', :'size', :'project_id', :'user_id', :'api_key_id', :'model' ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/openapi_openai/models/usage_images_result.rb', line 93 def self.openapi_types { :'object' => :'String', :'images' => :'Integer', :'num_model_requests' => :'Integer', :'source' => :'String', :'size' => :'String', :'project_id' => :'String', :'user_id' => :'String', :'api_key_id' => :'String', :'model' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
242 243 244 245 246 247 248 249 250 251 252 253 254 |
# File 'lib/openapi_openai/models/usage_images_result.rb', line 242 def ==(o) return true if self.equal?(o) self.class == o.class && object == o.object && images == o.images && num_model_requests == o.num_model_requests && source == o.source && size == o.size && project_id == o.project_id && user_id == o.user_id && api_key_id == o.api_key_id && model == o.model end |
#eql?(o) ⇒ Boolean
258 259 260 |
# File 'lib/openapi_openai/models/usage_images_result.rb', line 258 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
264 265 266 |
# File 'lib/openapi_openai/models/usage_images_result.rb', line 264 def hash [object, images, num_model_requests, source, size, project_id, user_id, api_key_id, model].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 |
# File 'lib/openapi_openai/models/usage_images_result.rb', line 180 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @object.nil? invalid_properties.push('invalid value for "object", object cannot be nil.') end if @images.nil? invalid_properties.push('invalid value for "images", images cannot be nil.') end if @num_model_requests.nil? invalid_properties.push('invalid value for "num_model_requests", num_model_requests cannot be nil.') end invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
293 294 295 296 297 298 299 300 301 302 303 304 305 |
# File 'lib/openapi_openai/models/usage_images_result.rb', line 293 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
200 201 202 203 204 205 206 207 208 |
# File 'lib/openapi_openai/models/usage_images_result.rb', line 200 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["organization.usage.images.result"]) return false unless object_validator.valid?(@object) return false if @images.nil? return false if @num_model_requests.nil? true end |