runapi-midjourney 0.2.0 → 0.3.0

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: 06e85132c76348835ae96514c74883406ea74865d9d11525d7577e17c88f8e6f
4
- data.tar.gz: 84922384c8d30f48b9798a0b0299e6ff4be448f44819cd955fe3aba2b54ef398
3
+ metadata.gz: bfcf5c59fb468df9e281eabae122c846e841a4c44bd96dda204cdf6f9219f04b
4
+ data.tar.gz: ef3eb0931f37a7a7017635bc8a6262865235cd3d90346b220798e1aac65d454c
5
5
  SHA512:
6
- metadata.gz: 3e364a667e6b92db66d620c123d2fcf645d5a6c1af7342c8e209e5599129e720fb181603853158081cd4c45ebcfd26565a9ef11855c44b710b4cc0748c612572
7
- data.tar.gz: 9651d5a10d8eb4d6024dca341b307445bf57a4864e8ebdd62a9b43995a55eadb64a138f8363ff0ef6047b7518a9021e8accae2a90325c6296cfc2b3e48a58a28
6
+ metadata.gz: 9950b3b115ecca08aed539df9d48128c6e90416704825602a5b8105c97cae0efa385280d8412b5cced037cb8ef67ac111e8edc94a5d340cd6e8ceb7a1068efb6
7
+ data.tar.gz: 001bf9d79b15d649b86675bf3fd82cb7294dc71e173d395bcc5c45c078b10f386d78448c3fdf377c4e7a75618c0593b7d40a26a20908a1d025e212b08663479e
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Midjourney Ruby SDK for RunAPI
2
2
 
3
- Use `runapi-midjourney` for Midjourney image generation, editing, image-to-video, image-to-prompt, prompt shortening, and seed lookup in Ruby applications and workers.
3
+ Use `runapi-midjourney` for Midjourney image generation, editing, image-to-video, first-video extension, image-to-prompt, prompt shortening, and seed lookup in Ruby applications and workers.
4
4
 
5
5
  ## Install
6
6
 
@@ -21,7 +21,7 @@ result = client.text_to_image.run(
21
21
  puts result.images.first.url
22
22
  ```
23
23
 
24
- Use `create`, `get`, and `run` for `text_to_image`, `edit_image`, and `image_to_video`. Use `run` directly for `image_to_prompt`, `shorten_prompt`, and `get_seed`. Generated media URLs are temporary and should be stored in durable storage.
24
+ Use `create`, `get`, and `run` for `text_to_image`, `edit_image`, `image_to_video`, and `extend_video`. `extend_video` accepts the task ID of an account-owned completed direct image-to-video task and continues its first video; extension tasks cannot be chained. Use `run` directly for `image_to_prompt`, `shorten_prompt`, and `get_seed`. Generated media URLs are temporary and should be stored in durable storage.
25
25
 
26
26
  ## Links
27
27
 
@@ -4,13 +4,14 @@ module RunApi
4
4
  module Midjourney
5
5
  # Midjourney image generation, editing, image-to-video, and helper client.
6
6
  class Client < RunApi::Core::Client
7
- attr_reader :text_to_image, :edit_image, :image_to_video, :image_to_prompt, :shorten_prompt, :get_seed
7
+ attr_reader :text_to_image, :edit_image, :image_to_video, :extend_video, :image_to_prompt, :shorten_prompt, :get_seed
8
8
 
9
9
  def initialize(api_key: nil, **options)
10
10
  super
11
11
  @text_to_image = Resources::TextToImage.new(http)
12
12
  @edit_image = Resources::EditImage.new(http)
13
13
  @image_to_video = Resources::ImageToVideo.new(http)
14
+ @extend_video = Resources::ExtendVideo.new(http)
14
15
  @image_to_prompt = Resources::ImageToPrompt.new(http)
15
16
  @shorten_prompt = Resources::ShortenPrompt.new(http)
16
17
  @get_seed = Resources::GetSeed.new(http)
@@ -16,6 +16,16 @@ module RunApi
16
16
  }
17
17
  }
18
18
  },
19
+ "extend-video" => {
20
+ "models" => ["midjourney-image-to-video"],
21
+ "fields_by_model" => {
22
+ "midjourney-image-to-video" => {
23
+ "source_task_id" => {
24
+ "required" => true
25
+ }
26
+ }
27
+ }
28
+ },
19
29
  "get-seed" => {
20
30
  "models" => [],
21
31
  "fields_by_model" => {
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RunApi
4
+ module Midjourney
5
+ module Resources
6
+ # Extends the first video from a completed Midjourney image-to-video task.
7
+ class ExtendVideo
8
+ include RunApi::Core::ResourceHelpers
9
+
10
+ ENDPOINT = "/api/v1/midjourney/extend_video"
11
+ MODEL = "midjourney-image-to-video"
12
+ RESPONSE_CLASS = Types::VideoTaskResponse
13
+ COMPLETED_RESPONSE_CLASS = Types::CompletedVideoTaskResponse
14
+
15
+ def initialize(http) = (@http = http)
16
+
17
+ def run(options: nil, **params)
18
+ task = create(options: options, **params)
19
+ poll_until_complete { get(task.id, options: options) }
20
+ end
21
+
22
+ def create(options: nil, **params)
23
+ params = compact_params(params)
24
+ validate_contract!(CONTRACT["extend-video"], params.merge(model: MODEL))
25
+ request(:post, ENDPOINT, body: params, options: options)
26
+ end
27
+
28
+ def get(id, options: nil)
29
+ request(:get, "#{ENDPOINT}/#{id}", options: options)
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -6,6 +6,7 @@ require_relative "midjourney/contract_gen"
6
6
  require_relative "midjourney/resources/text_to_image"
7
7
  require_relative "midjourney/resources/edit_image"
8
8
  require_relative "midjourney/resources/image_to_video"
9
+ require_relative "midjourney/resources/extend_video"
9
10
  require_relative "midjourney/resources/image_to_prompt"
10
11
  require_relative "midjourney/resources/shorten_prompt"
11
12
  require_relative "midjourney/resources/get_seed"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runapi-midjourney
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - RunAPI
@@ -15,16 +15,17 @@ dependencies:
15
15
  requirements:
16
16
  - - "~>"
17
17
  - !ruby/object:Gem::Version
18
- version: 0.2.13
18
+ version: 0.2.14
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.13
25
+ version: 0.2.14
26
26
  description: Use `runapi-midjourney` for Midjourney image generation, editing, image-to-video,
27
- image-to-prompt, prompt shortening, and seed lookup in Ruby applications and workers.
27
+ first-video extension, image-to-prompt, prompt shortening, and seed lookup in Ruby
28
+ applications and workers.
28
29
  email:
29
30
  - contact@runapi.ai
30
31
  executables: []
@@ -39,6 +40,7 @@ files:
39
40
  - lib/runapi/midjourney/client.rb
40
41
  - lib/runapi/midjourney/contract_gen.rb
41
42
  - lib/runapi/midjourney/resources/edit_image.rb
43
+ - lib/runapi/midjourney/resources/extend_video.rb
42
44
  - lib/runapi/midjourney/resources/get_seed.rb
43
45
  - lib/runapi/midjourney/resources/image_to_prompt.rb
44
46
  - lib/runapi/midjourney/resources/image_to_video.rb