Skip to content

Commit 08560d4

Browse files
feat(api): add GetImageAttributesOptions and ResponsiveImageAttributes schemas; update resource references in main.yaml; remove dummy endpoint
1 parent 13edc3d commit 08560d4

21 files changed

+514
-70
lines changed

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 42
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-c7ad6f552b38f2145781847f8b390fa1ec43068d64e45a33012a97a9299edc10.yml
3-
openapi_spec_hash: 50f281e91210ad5018ac7e4eee216f56
4-
config_hash: 74a8263b80c732a2b016177e7d56bb9c
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-0e4fa3c1f9d8cafecb9671fa76c0ff9156c643e05837804679e5e336bad8f4c1.yml
3+
openapi_spec_hash: 4544b950730b721c252eb519358b8609
4+
config_hash: 3d7a0bc2844e9fb4797149b233e85770

lib/imagekit.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
require_relative "imagekit/models/accounts/url_endpoint_request"
5757
require_relative "imagekit/models/update_file_request"
5858
require_relative "imagekit/models/file"
59+
require_relative "imagekit/models/src_options"
5960
require_relative "imagekit/models/base_overlay"
6061
require_relative "imagekit/models/base_webhook_event"
6162
require_relative "imagekit/models/accounts/origin_create_params"
@@ -131,14 +132,15 @@
131132
require_relative "imagekit/models/folder_rename_response"
132133
require_relative "imagekit/models/folders/job_get_params"
133134
require_relative "imagekit/models/folders/job_get_response"
135+
require_relative "imagekit/models/get_image_attributes_options"
134136
require_relative "imagekit/models/image_overlay"
135137
require_relative "imagekit/models/metadata"
136138
require_relative "imagekit/models/overlay"
137139
require_relative "imagekit/models/overlay_position"
138140
require_relative "imagekit/models/overlay_timing"
141+
require_relative "imagekit/models/responsive_image_attributes"
139142
require_relative "imagekit/models/solid_color_overlay"
140143
require_relative "imagekit/models/solid_color_overlay_transformation"
141-
require_relative "imagekit/models/src_options"
142144
require_relative "imagekit/models/streaming_resolution"
143145
require_relative "imagekit/models/subtitle_overlay"
144146
require_relative "imagekit/models/subtitle_overlay_transformation"

lib/imagekit/models.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ module Imagekit
9898

9999
Folders = Imagekit::Models::Folders
100100

101+
GetImageAttributesOptions = Imagekit::Models::GetImageAttributesOptions
102+
101103
ImageOverlay = Imagekit::Models::ImageOverlay
102104

103105
Metadata = Imagekit::Models::Metadata
@@ -108,6 +110,8 @@ module Imagekit
108110

109111
OverlayTiming = Imagekit::Models::OverlayTiming
110112

113+
ResponsiveImageAttributes = Imagekit::Models::ResponsiveImageAttributes
114+
111115
SolidColorOverlay = Imagekit::Models::SolidColorOverlay
112116

113117
SolidColorOverlayTransformation = Imagekit::Models::SolidColorOverlayTransformation
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# frozen_string_literal: true
2+
3+
module Imagekit
4+
module Models
5+
class GetImageAttributesOptions < Imagekit::Models::SrcOptions
6+
# @!attribute device_breakpoints
7+
# Custom list of **device-width breakpoints** in pixels. These define common
8+
# screen widths for responsive image generation.
9+
#
10+
# Defaults to `[640, 750, 828, 1080, 1200, 1920, 2048, 3840]`. Sorted
11+
# automatically.
12+
#
13+
# @return [Array<Float>, nil]
14+
optional :device_breakpoints, Imagekit::Internal::Type::ArrayOf[Float], api_name: :deviceBreakpoints
15+
16+
# @!attribute image_breakpoints
17+
# Custom list of **image-specific breakpoints** in pixels. Useful for generating
18+
# small variants (e.g., placeholders or thumbnails).
19+
#
20+
# Merged with `deviceBreakpoints` before calculating `srcSet`. Defaults to
21+
# `[16, 32, 48, 64, 96, 128, 256, 384]`. Sorted automatically.
22+
#
23+
# @return [Array<Float>, nil]
24+
optional :image_breakpoints, Imagekit::Internal::Type::ArrayOf[Float], api_name: :imageBreakpoints
25+
26+
# @!attribute sizes
27+
# The value for the HTML `sizes` attribute (e.g., `"100vw"` or
28+
# `"(min-width:768px) 50vw, 100vw"`).
29+
#
30+
# - If it includes one or more `vw` units, breakpoints smaller than the
31+
# corresponding percentage of the smallest device width are excluded.
32+
# - If it contains no `vw` units, the full breakpoint list is used.
33+
#
34+
# Enables a width-based strategy and generates `w` descriptors in `srcSet`.
35+
#
36+
# @return [String, nil]
37+
optional :sizes, String
38+
39+
# @!attribute width
40+
# The intended display width of the image in pixels, used **only when the `sizes`
41+
# attribute is not provided**.
42+
#
43+
# Triggers a DPR-based strategy (1x and 2x variants) and generates `x` descriptors
44+
# in `srcSet`.
45+
#
46+
# Ignored if `sizes` is present.
47+
#
48+
# @return [Float, nil]
49+
optional :width, Float
50+
51+
# @!method initialize(device_breakpoints: nil, image_breakpoints: nil, sizes: nil, width: nil)
52+
# Some parameter documentations has been truncated, see
53+
# {Imagekit::Models::GetImageAttributesOptions} for more details.
54+
#
55+
# Options for generating responsive image attributes including `src`, `srcSet`,
56+
# and `sizes` for HTML `<img>` elements. This schema extends `SrcOptions` to add
57+
# support for responsive image generation with breakpoints.
58+
#
59+
# @param device_breakpoints [Array<Float>] Custom list of **device-width breakpoints** in pixels.
60+
#
61+
# @param image_breakpoints [Array<Float>] Custom list of **image-specific breakpoints** in pixels.
62+
#
63+
# @param sizes [String] The value for the HTML `sizes` attribute
64+
#
65+
# @param width [Float] The intended display width of the image in pixels,
66+
end
67+
end
68+
end
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# frozen_string_literal: true
2+
3+
module Imagekit
4+
module Models
5+
class ResponsiveImageAttributes < Imagekit::Internal::Type::BaseModel
6+
# @!attribute src
7+
# URL for the _largest_ candidate (assigned to plain `src`).
8+
#
9+
# @return [String]
10+
required :src, String
11+
12+
# @!attribute sizes
13+
# `sizes` returned (or synthesised as `100vw`). The value for the HTML `sizes`
14+
# attribute.
15+
#
16+
# @return [String, nil]
17+
optional :sizes, String
18+
19+
# @!attribute src_set
20+
# Candidate set with `w` or `x` descriptors. Multiple image URLs separated by
21+
# commas, each with a descriptor.
22+
#
23+
# @return [String, nil]
24+
optional :src_set, String, api_name: :srcSet
25+
26+
# @!attribute width
27+
# Width as a number (if `width` was provided in the input options).
28+
#
29+
# @return [Float, nil]
30+
optional :width, Float
31+
32+
# @!method initialize(src:, sizes: nil, src_set: nil, width: nil)
33+
# Some parameter documentations has been truncated, see
34+
# {Imagekit::Models::ResponsiveImageAttributes} for more details.
35+
#
36+
# Resulting set of attributes suitable for an HTML `<img>` element. Useful for
37+
# enabling responsive image loading with `srcSet` and `sizes`.
38+
#
39+
# @param src [String] URL for the _largest_ candidate (assigned to plain `src`).
40+
#
41+
# @param sizes [String] `sizes` returned (or synthesised as `100vw`).
42+
#
43+
# @param src_set [String] Candidate set with `w` or `x` descriptors.
44+
#
45+
# @param width [Float] Width as a number (if `width` was provided in the input options).
46+
end
47+
end
48+
end

rbi/imagekit/models.rbi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ module Imagekit
6464

6565
Folders = Imagekit::Models::Folders
6666

67+
GetImageAttributesOptions = Imagekit::Models::GetImageAttributesOptions
68+
6769
ImageOverlay = Imagekit::Models::ImageOverlay
6870

6971
Metadata = Imagekit::Models::Metadata
@@ -74,6 +76,8 @@ module Imagekit
7476

7577
OverlayTiming = Imagekit::Models::OverlayTiming
7678

79+
ResponsiveImageAttributes = Imagekit::Models::ResponsiveImageAttributes
80+
7781
SolidColorOverlay = Imagekit::Models::SolidColorOverlay
7882

7983
SolidColorOverlayTransformation =
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# typed: strong
2+
3+
module Imagekit
4+
module Models
5+
class GetImageAttributesOptions < Imagekit::Models::SrcOptions
6+
OrHash =
7+
T.type_alias do
8+
T.any(
9+
Imagekit::GetImageAttributesOptions,
10+
Imagekit::Internal::AnyHash
11+
)
12+
end
13+
14+
# Custom list of **device-width breakpoints** in pixels. These define common
15+
# screen widths for responsive image generation.
16+
#
17+
# Defaults to `[640, 750, 828, 1080, 1200, 1920, 2048, 3840]`. Sorted
18+
# automatically.
19+
sig { returns(T.nilable(T::Array[Float])) }
20+
attr_reader :device_breakpoints
21+
22+
sig { params(device_breakpoints: T::Array[Float]).void }
23+
attr_writer :device_breakpoints
24+
25+
# Custom list of **image-specific breakpoints** in pixels. Useful for generating
26+
# small variants (e.g., placeholders or thumbnails).
27+
#
28+
# Merged with `deviceBreakpoints` before calculating `srcSet`. Defaults to
29+
# `[16, 32, 48, 64, 96, 128, 256, 384]`. Sorted automatically.
30+
sig { returns(T.nilable(T::Array[Float])) }
31+
attr_reader :image_breakpoints
32+
33+
sig { params(image_breakpoints: T::Array[Float]).void }
34+
attr_writer :image_breakpoints
35+
36+
# The value for the HTML `sizes` attribute (e.g., `"100vw"` or
37+
# `"(min-width:768px) 50vw, 100vw"`).
38+
#
39+
# - If it includes one or more `vw` units, breakpoints smaller than the
40+
# corresponding percentage of the smallest device width are excluded.
41+
# - If it contains no `vw` units, the full breakpoint list is used.
42+
#
43+
# Enables a width-based strategy and generates `w` descriptors in `srcSet`.
44+
sig { returns(T.nilable(String)) }
45+
attr_reader :sizes
46+
47+
sig { params(sizes: String).void }
48+
attr_writer :sizes
49+
50+
# The intended display width of the image in pixels, used **only when the `sizes`
51+
# attribute is not provided**.
52+
#
53+
# Triggers a DPR-based strategy (1x and 2x variants) and generates `x` descriptors
54+
# in `srcSet`.
55+
#
56+
# Ignored if `sizes` is present.
57+
sig { returns(T.nilable(Float)) }
58+
attr_reader :width
59+
60+
sig { params(width: Float).void }
61+
attr_writer :width
62+
63+
# Options for generating responsive image attributes including `src`, `srcSet`,
64+
# and `sizes` for HTML `<img>` elements. This schema extends `SrcOptions` to add
65+
# support for responsive image generation with breakpoints.
66+
sig do
67+
params(
68+
device_breakpoints: T::Array[Float],
69+
image_breakpoints: T::Array[Float],
70+
sizes: String,
71+
width: Float
72+
).returns(T.attached_class)
73+
end
74+
def self.new(
75+
# Custom list of **device-width breakpoints** in pixels. These define common
76+
# screen widths for responsive image generation.
77+
#
78+
# Defaults to `[640, 750, 828, 1080, 1200, 1920, 2048, 3840]`. Sorted
79+
# automatically.
80+
device_breakpoints: nil,
81+
# Custom list of **image-specific breakpoints** in pixels. Useful for generating
82+
# small variants (e.g., placeholders or thumbnails).
83+
#
84+
# Merged with `deviceBreakpoints` before calculating `srcSet`. Defaults to
85+
# `[16, 32, 48, 64, 96, 128, 256, 384]`. Sorted automatically.
86+
image_breakpoints: nil,
87+
# The value for the HTML `sizes` attribute (e.g., `"100vw"` or
88+
# `"(min-width:768px) 50vw, 100vw"`).
89+
#
90+
# - If it includes one or more `vw` units, breakpoints smaller than the
91+
# corresponding percentage of the smallest device width are excluded.
92+
# - If it contains no `vw` units, the full breakpoint list is used.
93+
#
94+
# Enables a width-based strategy and generates `w` descriptors in `srcSet`.
95+
sizes: nil,
96+
# The intended display width of the image in pixels, used **only when the `sizes`
97+
# attribute is not provided**.
98+
#
99+
# Triggers a DPR-based strategy (1x and 2x variants) and generates `x` descriptors
100+
# in `srcSet`.
101+
#
102+
# Ignored if `sizes` is present.
103+
width: nil
104+
)
105+
end
106+
107+
sig do
108+
override.returns(
109+
{
110+
device_breakpoints: T::Array[Float],
111+
image_breakpoints: T::Array[Float],
112+
sizes: String,
113+
width: Float
114+
}
115+
)
116+
end
117+
def to_hash
118+
end
119+
end
120+
end
121+
end

rbi/imagekit/models/image_overlay.rbi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module Imagekit
2020
# format automatically. To always use base64 encoding (`ie-{base64}`), set this
2121
# parameter to `base64`. To always use plain text (`i-{input}`), set it to
2222
# `plain`.
23-
sig { returns(T.nilable(Imagekit::ImageOverlay::Encoding::OrSymbol)) }
23+
sig { returns(T.nilable(Imagekit::ImageOverlay::Encoding::TaggedSymbol)) }
2424
attr_reader :encoding
2525

2626
sig { params(encoding: Imagekit::ImageOverlay::Encoding::OrSymbol).void }
@@ -69,7 +69,7 @@ module Imagekit
6969
{
7070
input: String,
7171
type: Symbol,
72-
encoding: Imagekit::ImageOverlay::Encoding::OrSymbol,
72+
encoding: Imagekit::ImageOverlay::Encoding::TaggedSymbol,
7373
transformation: T::Array[Imagekit::Transformation]
7474
}
7575
)

rbi/imagekit/models/overlay_position.rbi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module Imagekit
1010

1111
# Specifies the position of the overlay relative to the parent image or video.
1212
# Maps to `lfo` in the URL.
13-
sig { returns(T.nilable(Imagekit::OverlayPosition::Focus::OrSymbol)) }
13+
sig { returns(T.nilable(Imagekit::OverlayPosition::Focus::TaggedSymbol)) }
1414
attr_reader :focus
1515

1616
sig { params(focus: Imagekit::OverlayPosition::Focus::OrSymbol).void }
@@ -67,7 +67,7 @@ module Imagekit
6767
sig do
6868
override.returns(
6969
{
70-
focus: Imagekit::OverlayPosition::Focus::OrSymbol,
70+
focus: Imagekit::OverlayPosition::Focus::TaggedSymbol,
7171
x: Imagekit::OverlayPosition::X::Variants,
7272
y_: Imagekit::OverlayPosition::Y::Variants
7373
}

0 commit comments

Comments
 (0)