runapi-z-image 0.2.5 → 0.2.6

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: 8d5897ea70dd32d8d473283b3fc553f9b0ef44b45b861548476fe0c291ba011f
4
- data.tar.gz: 8f35b13c1a81f908672f11fdaf0ba5381f7a61635f8c2cf36e6a15337b5bf856
3
+ metadata.gz: e0cc4cee5277c6f3caf58569a36a33c9f3a697637917c9091f4f42a6eaf5ebf3
4
+ data.tar.gz: da3efb2dada6fed4c156cf49401d49daa1ffcdeaf7013a8082e9f5c2d5c310f4
5
5
  SHA512:
6
- metadata.gz: 559123b0ae56392d7e330ba32292f0279f9b574e5623ed74ffa86502a7c59e0db683e98f814c84843f451abdd5753cce3b91699defd57f8df29a798870bb94cd
7
- data.tar.gz: '09f5c253adb7fdcf239e6e7905cbc699172a7dc1d2e6f8653f794a1f023400920e87ce9b7f05bfa9681d6043c0c8baf9e4be6b2070c5e3b935bc15a4d428ed50'
6
+ metadata.gz: 75846ad36c5f89f307132964b79bea2b0a8fb05b1ee7774262263e8fc948e785f54af2da3ff9502e0f09c605de728cc7abdbe8339daf57386e3572297bfa5634
7
+ data.tar.gz: f5ac2d339056d52006b69cdc5871f0ba024a4e546c9b3db8b7359ca5fb14d5716d2b625d90f46ac28ef6706a92dc5452c45e49bc3d9d95b04c5830d261371c86
data/README.md CHANGED
@@ -24,6 +24,8 @@ status = client.generations.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::ZImage` error classes when building image jobs, Rails workers, or scripts. The available resources include generations. Keep `RUNAPI_API_KEY` in the environment or your secret manager; never commit API keys or callback secrets.
@@ -2,14 +2,22 @@
2
2
 
3
3
  module RunApi
4
4
  module ZImage
5
- class Client
5
+ # Z-Image text-to-image generation client.
6
+ #
7
+ # @example
8
+ # client = RunApi::ZImage::Client.new(api_key: "sk-...")
9
+ # result = client.text_to_image.run(
10
+ # model: "z-image",
11
+ # prompt: "A serene Japanese garden at sunrise",
12
+ # aspect_ratio: "16:9"
13
+ # )
14
+ # puts result.images.first.url
15
+ class Client < RunApi::Core::Client
16
+ # @return [Resources::TextToImage] Text-to-image generation with configurable aspect ratio and safety filtering.
6
17
  attr_reader :text_to_image
7
18
 
8
19
  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)
20
+ super
13
21
  @text_to_image = Resources::TextToImage.new(http)
14
22
  end
15
23
  end
@@ -3,6 +3,7 @@
3
3
  module RunApi
4
4
  module ZImage
5
5
  module Resources
6
+ # Generates images from text prompts with configurable aspect ratio and safety filtering.
6
7
  class TextToImage
7
8
  include RunApi::Core::ResourceHelpers
8
9
 
@@ -2,14 +2,19 @@
2
2
 
3
3
  module RunApi
4
4
  module ZImage
5
+ # Type definitions and constants for the Z-Image text-to-image API.
5
6
  module Types
7
+ # Z-Image model slug.
6
8
  MODELS = %w[z-image].freeze
9
+ # Output aspect ratios controlling generated image dimensions.
7
10
  ASPECT_RATIOS = %w[1:1 4:3 3:4 16:9 9:16].freeze
8
11
 
12
+ # URL to a generated image.
9
13
  class Image < RunApi::Core::BaseModel
10
14
  optional :url, String
11
15
  end
12
16
 
17
+ # Async text-to-image task result with lifecycle status.
13
18
  class TextToImageResponse < RunApi::Core::TaskResponse
14
19
  required :id, String
15
20
  optional :status, String, enum: -> { RunApi::Core::TaskResponse::Status::ALL }
@@ -17,6 +22,8 @@ module RunApi
17
22
  optional :error, String
18
23
  end
19
24
 
25
+ # Narrowed response returned by +run+ once polling confirms completion.
26
+ # Images are guaranteed present.
20
27
  class CompletedTextToImageResponse < TextToImageResponse
21
28
  required :images, [-> { Image }]
22
29
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runapi-z-image
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
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 z-image api Ruby SDK is the language-specific package for Z-Image
27
27
  on RunAPI. Use this z-image api package for text-to-image, image editing, and creative
28
28
  production flows when your application needs JSON request bodies, task status lookup,