Class: RunApi::Wan::Resources::TextToVideo
- Inherits:
-
Object
- Object
- RunApi::Wan::Resources::TextToVideo
- Includes:
- Core::ResourceHelpers
- Defined in:
- lib/runapi/wan/resources/text_to_video.rb
Overview
Generates videos from text prompts. Supports turbo (2.2) through 2.7 with progressive feature upgrades including negative prompts, watermark control, background audio, and R2V multi-reference inputs.
Constant Summary collapse
- ENDPOINT =
"/api/v1/wan/text_to_video"- RESPONSE_CLASS =
Types::VideoTaskResponse
- COMPLETED_RESPONSE_CLASS =
Types::CompletedVideoTaskResponse
Instance Method Summary collapse
-
#create(**params) ⇒ RunApi::Wan::Types::VideoTaskResponse
Create a text-to-video generation task.
-
#get(id) ⇒ RunApi::Wan::Types::VideoTaskResponse
Get text-to-video status by task ID.
-
#initialize(http) ⇒ TextToVideo
constructor
A new instance of TextToVideo.
-
#run(**params) ⇒ RunApi::Wan::Types::CompletedVideoTaskResponse
Generate a video and wait until complete.
Constructor Details
#initialize(http) ⇒ TextToVideo
Returns a new instance of TextToVideo.
16 17 18 |
# File 'lib/runapi/wan/resources/text_to_video.rb', line 16 def initialize(http) @http = http end |
Instance Method Details
#create(**params) ⇒ RunApi::Wan::Types::VideoTaskResponse
Create a text-to-video generation task.
33 34 35 36 37 |
# File 'lib/runapi/wan/resources/text_to_video.rb', line 33 def create(**params) params = compact_params(params) validate_params!(params) request(:post, ENDPOINT, body: params) end |
#get(id) ⇒ RunApi::Wan::Types::VideoTaskResponse
Get text-to-video status by task ID.
43 44 45 |
# File 'lib/runapi/wan/resources/text_to_video.rb', line 43 def get(id) request(:get, "#{ENDPOINT}/#{id}") end |
#run(**params) ⇒ RunApi::Wan::Types::CompletedVideoTaskResponse
Generate a video and wait until complete.
24 25 26 27 |
# File 'lib/runapi/wan/resources/text_to_video.rb', line 24 def run(**params) task = create(**params) poll_until_complete { get(task.id) } end |