runapi-runway 0.2.6 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 136d7bef7e251f84697d1faec9be01a6771a3948f4c2df29711f8c5d335c2e42
4
- data.tar.gz: 76c88350d5408ce93c05ddb25e49e90429c5e5e76f540d8993eb3738ab5c2c94
3
+ metadata.gz: 59ad3e607d33dc4bb65bd09cbf86eaf3ff1de1c48c319db17a6ff01e28e506e1
4
+ data.tar.gz: bdb1f84d784e5edcb01566aafd8f82865c6b6cf2b2552464981c16d6e29745c5
5
5
  SHA512:
6
- metadata.gz: c850f59712359438aa95bd65cebfcd3149f2f5b80d45378978f2b7a47b0190b308e12b220a4329ffd88535da128080e40d4eb43faa45a890e9431c43d6a782a0
7
- data.tar.gz: adba718ecc15852b75fef465d757c9e6e6b922f68b5a2c91c4f83cb4b3fbeb517aa7718d3e25067c4abff473e5e38241647a0568f50c9165a9fc9384d9fc7f0d
6
+ metadata.gz: 0b0be7c1953ea69ff61be3c96c23fb5f615288da5d6e8f8b9f72e71eb748049c0eab3697dc9576c3549116ac9f1eae18fbc1662040c6097971b5289adb16efef
7
+ data.tar.gz: d88f0bf293488b0c5da4bd817578820525f8b7edb7a0ccffcb57044bb8f09030f6de5389fb2264108e1adcfd12d4f11d0ea9ae4e795dca7ea6f5a01cac75d91e
data/README.md CHANGED
@@ -24,6 +24,8 @@ status = client.text_to_video.get(task.id)
24
24
 
25
25
  Use `create` when you want to submit a task and return quickly, `get` when you need the latest task state, and `run` when a script should create and poll until completion. In web request handlers, prefer `create` plus webhook or later `get` polling so a worker is not held open.
26
26
 
27
+ RunAPI-generated file URLs are temporary. Download and store generated images, videos, audio, or other files in your own durable storage within 7 days; do not treat returned URLs as long-term assets.
28
+
27
29
  ## Language notes
28
30
 
29
31
  Use Ruby keyword arguments and the `RunApi::Runway` error classes when building video jobs, Rails workers, or scripts. The available resources are `text_to_video` and `extend_video`. Keep `RUNAPI_API_KEY` in the environment or your secret manager; never commit API keys or callback secrets.
@@ -2,14 +2,23 @@
2
2
 
3
3
  module RunApi
4
4
  module Runway
5
- class Client
6
- attr_reader :text_to_video, :extend_video
5
+ # Runway Gen-4 video generation API client.
6
+ #
7
+ # @example
8
+ # client = RunApi::Runway::Client.new(api_key: "your-api-key")
9
+ # result = client.text_to_video.run(
10
+ # prompt: "A timelapse of a city skyline at sunset",
11
+ # duration_seconds: 10,
12
+ # output_resolution: "720p"
13
+ # )
14
+ class Client < RunApi::Core::Client
15
+ # @return [Resources::TextToVideo] Text-to-video and image-to-video operations.
16
+ attr_reader :text_to_video
17
+ # @return [Resources::ExtendVideo] Extend-video operations.
18
+ attr_reader :extend_video
7
19
 
8
20
  def initialize(api_key: nil, **options)
9
- @api_key = Core::Auth.resolve_api_key(api_key)
10
-
11
- client_options = Core::ClientOptions.new(api_key: @api_key, **options)
12
- http = client_options.http_client || Core::HttpClient.new(client_options)
21
+ super
13
22
  @text_to_video = Resources::TextToVideo.new(http)
14
23
  @extend_video = Resources::ExtendVideo.new(http)
15
24
  end
@@ -3,6 +3,8 @@
3
3
  module RunApi
4
4
  module Runway
5
5
  module Resources
6
+ # Runway extend-video resource.
7
+ # Append additional footage to a previously generated video, continuing from where the source task left off.
6
8
  class ExtendVideo
7
9
  include RunApi::Core::ResourceHelpers
8
10
 
@@ -14,17 +16,33 @@ module RunApi
14
16
  @http = http
15
17
  end
16
18
 
19
+ # Extend a video and wait until complete.
20
+ #
21
+ # @param source_task_id [String] ID of the completed TextToVideo or ExtendVideo task to continue from
22
+ # @param prompt [String] prompt describing the continuation footage
23
+ # @param output_resolution [String] must match the resolution of the source task ("720p" or "1080p")
24
+ # @param watermark [String, nil] watermark text burned into the output
25
+ # @param callback_url [String, nil] webhook URL for completion notification
26
+ # @return [RunApi::Runway::Types::CompletedTaskResponse] completed task with videos
17
27
  def run(**params)
18
28
  task = create(**params)
19
29
  poll_until_complete { get(task.id) }
20
30
  end
21
31
 
32
+ # Create an extend-video task without waiting for completion.
33
+ #
34
+ # @param params [Hash] extend-video parameters (see {#run} for details)
35
+ # @return [RunApi::Runway::Types::TaskCreateResponse] task creation result with id
22
36
  def create(**params)
23
37
  params = compact_params(params)
24
38
  validate_params!(params)
25
39
  request(:post, ENDPOINT, body: params)
26
40
  end
27
41
 
42
+ # Get extend-video task status by task ID.
43
+ #
44
+ # @param id [String] task ID
45
+ # @return [RunApi::Runway::Types::TaskResponse] current task status
28
46
  def get(id)
29
47
  request(:get, "#{ENDPOINT}/#{id}")
30
48
  end
@@ -3,6 +3,8 @@
3
3
  module RunApi
4
4
  module Runway
5
5
  module Resources
6
+ # Runway text-to-video resource.
7
+ # Generate video from a text prompt, optionally using a first-frame image for image-to-video generation.
6
8
  class TextToVideo
7
9
  include RunApi::Core::ResourceHelpers
8
10
 
@@ -14,17 +16,35 @@ module RunApi
14
16
  @http = http
15
17
  end
16
18
 
19
+ # Create a text-to-video task and wait until complete.
20
+ #
21
+ # @param prompt [String] video description prompt
22
+ # @param duration_seconds [Integer] video length: 5 or 10
23
+ # @param output_resolution [String] "720p" or "1080p"
24
+ # @param first_frame_image_url [String, nil] opening frame image URL for image-to-video
25
+ # @param aspect_ratio [String, nil] only for pure text-to-video (no first-frame image)
26
+ # @param watermark [String, nil] watermark text burned into the output
27
+ # @param callback_url [String, nil] webhook URL for completion notification
28
+ # @return [RunApi::Runway::Types::CompletedTaskResponse] completed task with videos
17
29
  def run(**params)
18
30
  task = create(**params)
19
31
  poll_until_complete { get(task.id) }
20
32
  end
21
33
 
34
+ # Create a text-to-video task without waiting for completion.
35
+ #
36
+ # @param params [Hash] text-to-video parameters (see {#run} for details)
37
+ # @return [RunApi::Runway::Types::TaskCreateResponse] task creation result with id
22
38
  def create(**params)
23
39
  params = compact_params(params)
24
40
  validate_params!(params)
25
41
  request(:post, ENDPOINT, body: params)
26
42
  end
27
43
 
44
+ # Get text-to-video task status by task ID.
45
+ #
46
+ # @param id [String] task ID
47
+ # @return [RunApi::Runway::Types::TaskResponse] current task status
28
48
  def get(id)
29
49
  request(:get, "#{ENDPOINT}/#{id}")
30
50
  end
@@ -2,19 +2,27 @@
2
2
 
3
3
  module RunApi
4
4
  module Runway
5
+ # Type definitions and constants for Runway Gen-4 video generation.
5
6
  module Types
7
+ # Output resolution. 720p (1280x720) is faster and lower cost;
8
+ # 1080p (1920x1080) produces higher detail at higher cost.
6
9
  OUTPUT_RESOLUTIONS = %w[720p 1080p].freeze
10
+
11
+ # Aspect ratio for pure text-to-video. Ignored when a first-frame image is provided.
7
12
  ASPECT_RATIOS = %w[16:9 9:16 1:1 4:3 3:4].freeze
8
13
 
14
+ # A generated video file with a download URL.
9
15
  class Video < RunApi::Core::BaseModel
10
16
  optional :id, String
11
17
  required :url, String
12
18
  end
13
19
 
20
+ # A generated image file with a download URL.
14
21
  class Image < RunApi::Core::BaseModel
15
22
  required :url, String
16
23
  end
17
24
 
25
+ # Full task response returned by polling. Contains output media once the task completes.
18
26
  class TaskResponse < RunApi::Core::TaskResponse
19
27
  required :id, String
20
28
  optional :status, String, enum: -> { RunApi::Core::TaskResponse::Status::ALL }
@@ -24,8 +32,11 @@ module RunApi
24
32
  optional :error, String
25
33
  end
26
34
 
35
+ # Response returned when a task is first created, before polling begins.
27
36
  class TaskCreateResponse < TaskResponse; end
28
37
 
38
+ # Narrowed response returned by +run()+ once polling observes completion.
39
+ # +videos+ is guaranteed present so consumers never need to null-check.
29
40
  class CompletedTaskResponse < TaskResponse
30
41
  required :videos, [-> { Video }]
31
42
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runapi-runway
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - RunAPI
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - "~>"
17
17
  - !ruby/object:Gem::Version
18
- version: 0.2.5
18
+ version: 0.2.6
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - "~>"
24
24
  - !ruby/object:Gem::Version
25
- version: 0.2.5
25
+ version: 0.2.6
26
26
  description: The runway api Ruby SDK is the language-specific package for Runway on
27
27
  RunAPI. Use this runway api package for text-to-video, image-to-video, video editing,
28
28
  and animation flows when your application needs JSON request bodies, task status