Class: RunApi::Runway::Resources::TextToVideo
- Inherits:
-
Object
- Object
- RunApi::Runway::Resources::TextToVideo
- Includes:
- Core::ResourceHelpers
- Defined in:
- lib/runapi/runway/resources/text_to_video.rb
Overview
Runway text-to-video resource. Generate video from a text prompt, optionally using a first-frame image for image-to-video generation.
Constant Summary collapse
- ENDPOINT =
"/api/v1/runway/text_to_video"- RESPONSE_CLASS =
Types::TaskCreateResponse
- COMPLETED_RESPONSE_CLASS =
Types::CompletedTaskResponse
Instance Method Summary collapse
-
#create(**params) ⇒ RunApi::Runway::Types::TaskCreateResponse
Create a text-to-video task without waiting for completion.
-
#get(id) ⇒ RunApi::Runway::Types::TaskResponse
Get text-to-video task status by task ID.
-
#initialize(http) ⇒ TextToVideo
constructor
A new instance of TextToVideo.
-
#run(**params) ⇒ RunApi::Runway::Types::CompletedTaskResponse
Create a text-to-video task and wait until complete.
Constructor Details
#initialize(http) ⇒ TextToVideo
Returns a new instance of TextToVideo.
15 16 17 |
# File 'lib/runapi/runway/resources/text_to_video.rb', line 15 def initialize(http) @http = http end |
Instance Method Details
#create(**params) ⇒ RunApi::Runway::Types::TaskCreateResponse
Create a text-to-video task without waiting for completion.
38 39 40 41 42 |
# File 'lib/runapi/runway/resources/text_to_video.rb', line 38 def create(**params) params = compact_params(params) validate_params!(params) request(:post, ENDPOINT, body: params) end |
#get(id) ⇒ RunApi::Runway::Types::TaskResponse
Get text-to-video task status by task ID.
48 49 50 |
# File 'lib/runapi/runway/resources/text_to_video.rb', line 48 def get(id) request(:get, "#{ENDPOINT}/#{id}") end |
#run(**params) ⇒ RunApi::Runway::Types::CompletedTaskResponse
Create a text-to-video task and wait until complete.
29 30 31 32 |
# File 'lib/runapi/runway/resources/text_to_video.rb', line 29 def run(**params) task = create(**params) poll_until_complete { get(task.id) } end |