Class: RunApi::Kling::Resources::MotionControl
- Inherits:
-
Object
- Object
- RunApi::Kling::Resources::MotionControl
- Includes:
- Core::ResourceHelpers
- Defined in:
- lib/runapi/kling/resources/motion_control.rb
Overview
Kling motion control resource. Generate videos with motion transfer from reference videos.
Constant Summary collapse
- ENDPOINT =
"/api/v1/kling/motion_control"- RESPONSE_CLASS =
Types::MotionControlResponse
- COMPLETED_RESPONSE_CLASS =
Types::CompletedMotionControlResponse
Instance Method Summary collapse
-
#create(**params) ⇒ RunApi::Kling::Types::MotionControlResponse
Create a motion control generation task.
-
#get(id) ⇒ RunApi::Kling::Types::MotionControlResponse
Get motion control task status by task ID.
-
#initialize(http) ⇒ MotionControl
constructor
A new instance of MotionControl.
-
#run(**params) ⇒ RunApi::Kling::Types::CompletedMotionControlResponse
Generate a motion control video and wait until complete.
Constructor Details
#initialize(http) ⇒ MotionControl
Returns a new instance of MotionControl.
16 17 18 |
# File 'lib/runapi/kling/resources/motion_control.rb', line 16 def initialize(http) @http = http end |
Instance Method Details
#create(**params) ⇒ RunApi::Kling::Types::MotionControlResponse
Create a motion control generation task.
33 34 35 36 37 |
# File 'lib/runapi/kling/resources/motion_control.rb', line 33 def create(**params) params = compact_params(params) validate_params!(params) request(:post, ENDPOINT, body: params) end |
#get(id) ⇒ RunApi::Kling::Types::MotionControlResponse
Get motion control task status by task ID.
43 44 45 |
# File 'lib/runapi/kling/resources/motion_control.rb', line 43 def get(id) request(:get, "#{ENDPOINT}/#{id}") end |
#run(**params) ⇒ RunApi::Kling::Types::CompletedMotionControlResponse
Generate a motion control video and wait until complete.
24 25 26 27 |
# File 'lib/runapi/kling/resources/motion_control.rb', line 24 def run(**params) task = create(**params) poll_until_complete { get(task.id) } end |