Class: Openai::Images::Create

Inherits:
Resource::Api show all
Defined in:
lib/openai/images/create.rb

Instance Attribute Summary

Attributes inherited from Resource::Api

#connection, #data, #path, #response

Instance Method Summary collapse

Constructor Details

#initializeCreate

Returns a new instance of Create.



6
7
8
9
# File 'lib/openai/images/create.rb', line 6

def initialize
  @path = "/v1/images/generations"
  super()
end

Instance Method Details

#requestObject



11
12
13
14
15
16
17
# File 'lib/openai/images/create.rb', line 11

def request(**)
  @response = @connection.post(
    path: @path,
    body: ::Openai::Request::Images::Create.new(**).to_json
  )
  @data = ::Openai::Mapper::Images::List.from_json(@response.body)
end