Skip to content

Commit 9ea439a

Browse files
feat(api): add GetImageAttributesOptions and ResponsiveImageAttributes schemas; update resource references in main.yaml; remove dummy endpoint
1 parent de606ba commit 9ea439a

File tree

4 files changed

+83
-3
lines changed

4 files changed

+83
-3
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

api.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ Types:
44

55
- <code><a href="./src/resources/shared.ts">BaseOverlay</a></code>
66
- <code><a href="./src/resources/shared.ts">Extensions</a></code>
7+
- <code><a href="./src/resources/shared.ts">GetImageAttributesOptions</a></code>
78
- <code><a href="./src/resources/shared.ts">ImageOverlay</a></code>
89
- <code><a href="./src/resources/shared.ts">Overlay</a></code>
910
- <code><a href="./src/resources/shared.ts">OverlayPosition</a></code>
1011
- <code><a href="./src/resources/shared.ts">OverlayTiming</a></code>
12+
- <code><a href="./src/resources/shared.ts">ResponsiveImageAttributes</a></code>
1113
- <code><a href="./src/resources/shared.ts">SolidColorOverlay</a></code>
1214
- <code><a href="./src/resources/shared.ts">SolidColorOverlayTransformation</a></code>
1315
- <code><a href="./src/resources/shared.ts">SrcOptions</a></code>

src/client.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -911,10 +911,12 @@ export declare namespace ImageKit {
911911

912912
export type BaseOverlay = API.BaseOverlay;
913913
export type Extensions = API.Extensions;
914+
export type GetImageAttributesOptions = API.GetImageAttributesOptions;
914915
export type ImageOverlay = API.ImageOverlay;
915916
export type Overlay = API.Overlay;
916917
export type OverlayPosition = API.OverlayPosition;
917918
export type OverlayTiming = API.OverlayTiming;
919+
export type ResponsiveImageAttributes = API.ResponsiveImageAttributes;
918920
export type SolidColorOverlay = API.SolidColorOverlay;
919921
export type SolidColorOverlayTransformation = API.SolidColorOverlayTransformation;
920922
export type SrcOptions = API.SrcOptions;

src/resources/shared.ts

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,54 @@ export namespace Extensions {
7878
}
7979
}
8080

81+
/**
82+
* Options for generating responsive image attributes including `src`, `srcSet`,
83+
* and `sizes` for HTML `<img>` elements. This schema extends `SrcOptions` to add
84+
* support for responsive image generation with breakpoints.
85+
*/
86+
export interface GetImageAttributesOptions extends SrcOptions {
87+
/**
88+
* Custom list of **device-width breakpoints** in pixels. These define common
89+
* screen widths for responsive image generation.
90+
*
91+
* Defaults to `[640, 750, 828, 1080, 1200, 1920, 2048, 3840]`. Sorted
92+
* automatically.
93+
*/
94+
deviceBreakpoints?: Array<number>;
95+
96+
/**
97+
* Custom list of **image-specific breakpoints** in pixels. Useful for generating
98+
* small variants (e.g., placeholders or thumbnails).
99+
*
100+
* Merged with `deviceBreakpoints` before calculating `srcSet`. Defaults to
101+
* `[16, 32, 48, 64, 96, 128, 256, 384]`. Sorted automatically.
102+
*/
103+
imageBreakpoints?: Array<number>;
104+
105+
/**
106+
* The value for the HTML `sizes` attribute (e.g., `"100vw"` or
107+
* `"(min-width:768px) 50vw, 100vw"`).
108+
*
109+
* - If it includes one or more `vw` units, breakpoints smaller than the
110+
* corresponding percentage of the smallest device width are excluded.
111+
* - If it contains no `vw` units, the full breakpoint list is used.
112+
*
113+
* Enables a width-based strategy and generates `w` descriptors in `srcSet`.
114+
*/
115+
sizes?: string;
116+
117+
/**
118+
* The intended display width of the image in pixels, used **only when the `sizes`
119+
* attribute is not provided**.
120+
*
121+
* Triggers a DPR-based strategy (1x and 2x variants) and generates `x` descriptors
122+
* in `srcSet`.
123+
*
124+
* Ignored if `sizes` is present.
125+
*/
126+
width?: number;
127+
}
128+
81129
export interface ImageOverlay extends BaseOverlay {
82130
/**
83131
* Specifies the relative path to the image used as an overlay.
@@ -175,6 +223,34 @@ export interface OverlayTiming {
175223
start?: number | string;
176224
}
177225

226+
/**
227+
* Resulting set of attributes suitable for an HTML `<img>` element. Useful for
228+
* enabling responsive image loading with `srcSet` and `sizes`.
229+
*/
230+
export interface ResponsiveImageAttributes {
231+
/**
232+
* URL for the _largest_ candidate (assigned to plain `src`).
233+
*/
234+
src: string;
235+
236+
/**
237+
* `sizes` returned (or synthesised as `100vw`). The value for the HTML `sizes`
238+
* attribute.
239+
*/
240+
sizes?: string;
241+
242+
/**
243+
* Candidate set with `w` or `x` descriptors. Multiple image URLs separated by
244+
* commas, each with a descriptor.
245+
*/
246+
srcSet?: string;
247+
248+
/**
249+
* Width as a number (if `width` was provided in the input options).
250+
*/
251+
width?: number;
252+
}
253+
178254
export interface SolidColorOverlay extends BaseOverlay {
179255
/**
180256
* Specifies the color of the block using an RGB hex code (e.g., `FF0000`), an RGBA

0 commit comments

Comments
 (0)