Class: RunApi::QwenImage::Resources::EditImage
- Inherits:
-
Object
- Object
- RunApi::QwenImage::Resources::EditImage
- Includes:
- Core::ResourceHelpers
- Defined in:
- lib/runapi/qwen_image/resources/edit_image.rb
Overview
QwenImage edit-image resource. Edits images with natural-language prompts.
Constant Summary collapse
- ENDPOINT =
"/api/v1/qwen_image/edit_image"- RESPONSE_CLASS =
Types::EditImageResponse
- COMPLETED_RESPONSE_CLASS =
Types::CompletedEditImageResponse
Instance Method Summary collapse
-
#create(options: nil, **params) ⇒ RunApi::QwenImage::Types::EditImageResponse
Create an edit-image task.
-
#get(id, options: nil) ⇒ RunApi::QwenImage::Types::EditImageResponse
Get edit-image status by task ID.
-
#initialize(http) ⇒ EditImage
constructor
A new instance of EditImage.
-
#run(options: nil, **params) ⇒ RunApi::QwenImage::Types::CompletedEditImageResponse
Edit an image and wait until complete.
Constructor Details
#initialize(http) ⇒ EditImage
Returns a new instance of EditImage.
15 16 17 |
# File 'lib/runapi/qwen_image/resources/edit_image.rb', line 15 def initialize(http) @http = http end |
Instance Method Details
#create(options: nil, **params) ⇒ RunApi::QwenImage::Types::EditImageResponse
Create an edit-image task.
32 33 34 35 36 |
# File 'lib/runapi/qwen_image/resources/edit_image.rb', line 32 def create(options: nil, **params) params = compact_params(params) validate_contract!(CONTRACT["edit-image"], params) request(:post, ENDPOINT, body: params, options: ) end |
#get(id, options: nil) ⇒ RunApi::QwenImage::Types::EditImageResponse
Get edit-image status by task ID.
42 43 44 |
# File 'lib/runapi/qwen_image/resources/edit_image.rb', line 42 def get(id, options: nil) request(:get, "#{ENDPOINT}/#{id}", options: ) end |
#run(options: nil, **params) ⇒ RunApi::QwenImage::Types::CompletedEditImageResponse
Edit an image and wait until complete.
23 24 25 26 |
# File 'lib/runapi/qwen_image/resources/edit_image.rb', line 23 def run(options: nil, **params) task = create(options: , **params) poll_until_complete { get(task.id, options: ) } end |