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
- MODEL =
"runway"
Instance Method Summary collapse
-
#create(options: nil, **params) ⇒ RunApi::Runway::Types::TaskCreateResponse
Create a text-to-video task without waiting for completion.
-
#get(id, options: nil) ⇒ RunApi::Runway::Types::TaskResponse
Get text-to-video task status by task ID.
-
#initialize(http) ⇒ TextToVideo
constructor
A new instance of TextToVideo.
-
#run(options: nil, **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.
16 17 18 |
# File 'lib/runapi/runway/resources/text_to_video.rb', line 16 def initialize(http) @http = http end |
Instance Method Details
#create(options: nil, **params) ⇒ RunApi::Runway::Types::TaskCreateResponse
Create a text-to-video task without waiting for completion.
39 40 41 42 43 |
# File 'lib/runapi/runway/resources/text_to_video.rb', line 39 def create(options: nil, **params) params = compact_params(params) validate_contract!(CONTRACT["text-to-video"], params.merge(model: MODEL)) request(:post, ENDPOINT, body: params, options: ) end |
#get(id, options: nil) ⇒ RunApi::Runway::Types::TaskResponse
Get text-to-video task status by task ID.
49 50 51 |
# File 'lib/runapi/runway/resources/text_to_video.rb', line 49 def get(id, options: nil) request(:get, "#{ENDPOINT}/#{id}", options: ) end |
#run(options: nil, **params) ⇒ RunApi::Runway::Types::CompletedTaskResponse
Create a text-to-video task and wait until complete.
30 31 32 33 |
# File 'lib/runapi/runway/resources/text_to_video.rb', line 30 def run(options: nil, **params) task = create(options: , **params) poll_until_complete { get(task.id, options: ) } end |