Class: RunApi::Midjourney::Resources::ExtendVideo
- Inherits:
-
Object
- Object
- RunApi::Midjourney::Resources::ExtendVideo
- Includes:
- Core::ResourceHelpers
- Defined in:
- lib/runapi/midjourney/resources/extend_video.rb
Overview
Extends the first video from a completed Midjourney image-to-video task.
Constant Summary collapse
- ENDPOINT =
"/api/v1/midjourney/extend_video"- MODEL =
"midjourney-image-to-video"- RESPONSE_CLASS =
Types::VideoTaskResponse
- COMPLETED_RESPONSE_CLASS =
Types::CompletedVideoTaskResponse
Instance Method Summary collapse
- #create(options: nil, **params) ⇒ Object
- #get(id, options: nil) ⇒ Object
-
#initialize(http) ⇒ ExtendVideo
constructor
A new instance of ExtendVideo.
- #run(options: nil, **params) ⇒ Object
Constructor Details
#initialize(http) ⇒ ExtendVideo
Returns a new instance of ExtendVideo.
15 |
# File 'lib/runapi/midjourney/resources/extend_video.rb', line 15 def initialize(http) = (@http = http) |
Instance Method Details
#create(options: nil, **params) ⇒ Object
22 23 24 25 26 |
# File 'lib/runapi/midjourney/resources/extend_video.rb', line 22 def create(options: nil, **params) params = compact_params(params) validate_contract!(CONTRACT["extend-video"], params.merge(model: MODEL)) request(:post, ENDPOINT, body: params, options: ) end |
#get(id, options: nil) ⇒ Object
28 29 30 |
# File 'lib/runapi/midjourney/resources/extend_video.rb', line 28 def get(id, options: nil) request(:get, "#{ENDPOINT}/#{id}", options: ) end |
#run(options: nil, **params) ⇒ Object
17 18 19 20 |
# File 'lib/runapi/midjourney/resources/extend_video.rb', line 17 def run(options: nil, **params) task = create(options: , **params) poll_until_complete { get(task.id, options: ) } end |