runapi-topaz 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: 40f94d07e2d993a379822f44b3a4c56e630472b9ec8a0a882c38d746f223206f
4
- data.tar.gz: f8649bed0ba63f962c14e335546b81dc2d6ec61304b51976309d5bd076e39f23
3
+ metadata.gz: 8bb62f2b5c763e463433c6a31953baaf2f0f6fe9d2586898149e759b2b7a4544
4
+ data.tar.gz: 2890b5d76de93833bb898c9d2ad25eee601dc3597db7d35e1f332f3d3499b199
5
5
  SHA512:
6
- metadata.gz: 59b8eee6de311173b3cd3159918352d2a6ae98714e3ec99d730dfaad9d27e3be87ac185fd76a6a9f20e2cfcbf3fa04f4a86cd6001c5c44474ee997164f27b3fb
7
- data.tar.gz: 196b238d9eb37a8aecc2574515778dd46469ad2239d9015731cb2599db57e9aadacabfaebedb5797a0930f1fca120d07ea4a352721b7896989ca30139e3401ac
6
+ metadata.gz: 52ede417926cb5fffe3af6af0dd5e5a9e00ccb2cbb73ca86be7b963a94ee1dd04c913b4c05817a0ab34c9eafcca34c90bf936fef8fa21ef8f575d3ed03abaf34
7
+ data.tar.gz: 4d0496f468fd8c1277420c461cb7856e61efe269dc17614836c25da379104f42e9574b4b04f8d69885e458956ab60b52e3d1febaf3e62bf22edddc40f3192bf9
data/README.md CHANGED
@@ -24,6 +24,8 @@ status = client.image_upscales.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::Topaz` error classes when building upscaling jobs, Rails workers, or scripts. The available resources include image upscales, and video upscales. Keep `RUNAPI_API_KEY` in the environment or your secret manager; never commit API keys or callback secrets.
@@ -2,14 +2,24 @@
2
2
 
3
3
  module RunApi
4
4
  module Topaz
5
- class Client
6
- attr_reader :upscale_image, :upscale_video
5
+ # Topaz AI upscaling client for increasing image and video resolution.
6
+ #
7
+ # @example
8
+ # client = RunApi::Topaz::Client.new(api_key: "sk-...")
9
+ # result = client.upscale_image.run(
10
+ # model: "topaz-upscale-image",
11
+ # source_image_url: "https://example.com/photo.jpg",
12
+ # upscale_factor: 2
13
+ # )
14
+ # puts result.images.first.url
15
+ class Client < RunApi::Core::Client
16
+ # @return [Resources::UpscaleImage] AI-powered image upscaling (1x, 2x, 4x, 8x).
17
+ attr_reader :upscale_image
18
+ # @return [Resources::UpscaleVideo] AI-powered video upscaling (1x, 2x, 4x).
19
+ attr_reader :upscale_video
7
20
 
8
21
  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)
22
+ super
13
23
  @upscale_image = Resources::UpscaleImage.new(http)
14
24
  @upscale_video = Resources::UpscaleVideo.new(http)
15
25
  end
@@ -3,6 +3,8 @@
3
3
  module RunApi
4
4
  module Topaz
5
5
  module Resources
6
+ # AI-powered image upscaling resource.
7
+ # Supports upscale factors of 1x, 2x, 4x, and 8x.
6
8
  class UpscaleImage
7
9
  include RunApi::Core::ResourceHelpers
8
10
 
@@ -3,6 +3,8 @@
3
3
  module RunApi
4
4
  module Topaz
5
5
  module Resources
6
+ # AI-powered video upscaling resource.
7
+ # Supports upscale factors of 1x, 2x, and 4x.
6
8
  class UpscaleVideo
7
9
  include RunApi::Core::ResourceHelpers
8
10
 
@@ -2,20 +2,28 @@
2
2
 
3
3
  module RunApi
4
4
  module Topaz
5
+ # Type definitions and constants for the Topaz upscaling API.
5
6
  module Types
7
+ # Image upscaling model slug.
6
8
  UPSCALE_IMAGE_MODEL = "topaz-upscale-image"
9
+ # Video upscaling model slug.
7
10
  UPSCALE_VIDEO_MODEL = "topaz-upscale-video"
11
+ # Allowed image upscale factors. Higher factors produce larger output but take longer.
8
12
  UPSCALE_IMAGE_FACTORS = [1, 2, 4, 8].freeze
13
+ # Allowed video upscale factors. Max 4x (8x is not supported for video).
9
14
  UPSCALE_VIDEO_FACTORS = [1, 2, 4].freeze
10
15
 
16
+ # URL to an upscaled image.
11
17
  class Image < RunApi::Core::BaseModel
12
18
  optional :url, String
13
19
  end
14
20
 
21
+ # URL to an upscaled video.
15
22
  class Video < RunApi::Core::BaseModel
16
23
  optional :url, String
17
24
  end
18
25
 
26
+ # Async image upscaling task result with lifecycle status.
19
27
  class UpscaleImageResponse < RunApi::Core::TaskResponse
20
28
  required :id, String
21
29
  optional :status, String, enum: -> { RunApi::Core::TaskResponse::Status::ALL }
@@ -23,6 +31,7 @@ module RunApi
23
31
  optional :error, String
24
32
  end
25
33
 
34
+ # Async video upscaling task result with lifecycle status.
26
35
  class UpscaleVideoResponse < RunApi::Core::TaskResponse
27
36
  required :id, String
28
37
  optional :status, String, enum: -> { RunApi::Core::TaskResponse::Status::ALL }
@@ -30,10 +39,14 @@ module RunApi
30
39
  optional :error, String
31
40
  end
32
41
 
42
+ # Narrowed response returned by +run+ once polling confirms completion.
43
+ # Images are guaranteed present.
33
44
  class CompletedUpscaleImageResponse < UpscaleImageResponse
34
45
  required :images, [-> { Image }]
35
46
  end
36
47
 
48
+ # Narrowed response returned by +run+ once polling confirms completion.
49
+ # Videos are guaranteed present.
37
50
  class CompletedUpscaleVideoResponse < UpscaleVideoResponse
38
51
  required :videos, [-> { Video }]
39
52
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runapi-topaz
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 topaz api Ruby SDK is the language-specific package for Topaz on
27
27
  RunAPI. Use this topaz api package for image upscale, video upscale, restoration,
28
28
  and production cleanup flows when your application needs JSON request bodies, task