Class: RunApi::QwenImage::Resources::RemixImage

Inherits:
Object
  • Object
show all
Includes:
Core::ResourceHelpers
Defined in:
lib/runapi/qwen_image/resources/remix_image.rb

Overview

QwenImage remix-image resource. Creates prompt-guided variations from a source image.

Constant Summary collapse

ENDPOINT =
"/api/v1/qwen_image/remix_image"
RESPONSE_CLASS =
Types::RemixImageResponse
COMPLETED_RESPONSE_CLASS =
Types::CompletedRemixImageResponse

Instance Method Summary collapse

Constructor Details

#initialize(http) ⇒ RemixImage

Returns a new instance of RemixImage.



15
16
17
# File 'lib/runapi/qwen_image/resources/remix_image.rb', line 15

def initialize(http)
  @http = http
end

Instance Method Details

#create(options: nil, **params) ⇒ RunApi::QwenImage::Types::RemixImageResponse

Create a remix-image task.

Parameters:

  • params (Hash)

    remix-image parameters

Returns:



32
33
34
35
36
# File 'lib/runapi/qwen_image/resources/remix_image.rb', line 32

def create(options: nil, **params)
  params = compact_params(params)
  validate_contract!(CONTRACT["remix-image"], params)
  request(:post, ENDPOINT, body: params, options: options)
end

#get(id, options: nil) ⇒ RunApi::QwenImage::Types::RemixImageResponse

Get remix-image status by task ID.

Parameters:

  • id (String)

    task ID

Returns:



42
43
44
# File 'lib/runapi/qwen_image/resources/remix_image.rb', line 42

def get(id, options: nil)
  request(:get, "#{ENDPOINT}/#{id}", options: options)
end

#run(options: nil, **params) ⇒ RunApi::QwenImage::Types::CompletedRemixImageResponse

Remix an image and wait until complete.

Parameters:

  • params (Hash)

    remix-image parameters

Returns:



23
24
25
26
# File 'lib/runapi/qwen_image/resources/remix_image.rb', line 23

def run(options: nil, **params)
  task = create(options: options, **params)
  poll_until_complete { get(task.id, options: options) }
end