Skip to content

Commit db12b70

Browse files
author
stlc-bot
committed
Build SDK
Stainless-Generated-From: e926a98
1 parent ccb8bff commit db12b70

5 files changed

Lines changed: 134 additions & 74 deletions

File tree

‎src/imagekitio/resources/named_transformations.py‎

Lines changed: 86 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def create(
4747
*,
4848
name: str,
4949
transformation: str,
50-
disabled: bool | Omit = omit,
50+
enabled: bool | Omit = omit,
5151
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
5252
# The extra values given here take precedence over values defined on the client or passed to this method.
5353
extra_headers: Headers | None = None,
@@ -65,18 +65,24 @@ def create(
6565
Learn more about
6666
[named transformations](https://imagekit.io/docs/transformations#named-transformations).
6767
68+
**Note:** You can create up to 250 named transformations per account. Once this
69+
limit is reached, the request fails with a `400` error.
70+
6871
Args:
6972
name: Name of the named transformation. This is the alias used to refer to the
7073
transformation string in image and video URLs, for example `tr:n-<name>`. Can
71-
only contain alphanumeric characters, `_` and `-`, and must be unique for your
72-
account (case-insensitive).
73-
74-
transformation: The transformation string this name refers to. It must start with `tr:` followed
75-
by one or more transformation parameters, for example
76-
`tr:w-150,h-150,fo-center,cm-resize`. Learn more about the
74+
only contain alphanumeric characters or `_` (hyphens are not allowed), and must
75+
be unique for your account. Name matching is case-sensitive, so
76+
`Small_Thumbnail` and `small_thumbnail` are treated as different names.
77+
78+
transformation: The transformation this name refers to, expressed as one or more comma-separated
79+
transformation parameters, for example `w-150,h-150,fo-center,cm-resize`. You do
80+
not need to prefix this with `tr:` — it is added automatically. If you do
81+
include it, it must appear in lowercase at the start of the string, or the
82+
request is rejected. Learn more about the
7783
[transformation syntax](https://imagekit.io/docs/transformations).
7884
79-
disabled: Whether this named transformation is disabled. Set to `true` to temporarily
85+
enabled: Whether this named transformation is enabled. Set to `false` to temporarily
8086
disable it without deleting it — requests using a disabled named transformation
8187
fail at delivery time.
8288
@@ -94,7 +100,7 @@ def create(
94100
{
95101
"name": name,
96102
"transformation": transformation,
97-
"disabled": disabled,
103+
"enabled": enabled,
98104
},
99105
named_transformation_create_params.NamedTransformationCreateParams,
100106
),
@@ -108,7 +114,7 @@ def update(
108114
self,
109115
id: str,
110116
*,
111-
disabled: bool | Omit = omit,
117+
enabled: bool | Omit = omit,
112118
name: str | Omit = omit,
113119
transformation: str | Omit = omit,
114120
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -123,14 +129,30 @@ def update(
123129
object. Only the fields present in the request body are updated; omitted fields
124130
are left unchanged.
125131
132+
**Note:**
133+
134+
- If you rename this named transformation, or set `enabled` to `false`, and
135+
another _enabled_ named transformation, or your account's upload
136+
pre-transformation/post-transformation settings, reference it (via the
137+
`n-<name>` token), the request fails with a `409` error whose `message`
138+
describes what it is referenced by. A reference from a named transformation
139+
that is itself disabled does not block this request. Remove or disable those
140+
references first, then retry. This is a best-effort check and cannot detect
141+
references baked into your own application code or previously generated URLs.
142+
126143
Args:
127-
disabled: Whether this named transformation is disabled.
144+
enabled: Whether this named transformation is enabled. If omitted, the existing value is
145+
left unchanged.
128146
129147
name: Updated name of the named transformation. Can only contain alphanumeric
130-
characters, `_` and `-`, and must be unique for your account (case-insensitive).
148+
characters and `_`, and must be unique for your account. Name matching is
149+
case-sensitive, so `Small_Thumbnail` and `small_thumbnail` are treated as
150+
different names.
131151
132-
transformation: Updated transformation string. It must start with `tr:` followed by one or more
133-
transformation parameters.
152+
transformation: Updated transformation, expressed as one or more comma-separated transformation
153+
parameters. You do not need to prefix this with `tr:` — it is added
154+
automatically. If you do include it, it must appear in lowercase at the start of
155+
the string, or the request is rejected.
134156
135157
extra_headers: Send extra headers
136158
@@ -146,7 +168,7 @@ def update(
146168
path_template("/v1/named-transformations/{id}", id=id),
147169
body=maybe_transform(
148170
{
149-
"disabled": disabled,
171+
"enabled": enabled,
150172
"name": name,
151173
"transformation": transformation,
152174
},
@@ -194,13 +216,14 @@ def delete(
194216
195217
**Note:**
196218
197-
- If another named transformation, or your account's upload
219+
- If another _enabled_ named transformation, or your account's upload
198220
pre-transformation/post-transformation settings, reference this named
199221
transformation (via the `n-<name>` token), the request fails with a `409`
200-
error whose `message` describes what it is referenced by. Remove those
201-
references first, then retry the deletion. This is a best-effort check and
202-
cannot detect references baked into your own application code or previously
203-
generated URLs.
222+
error whose `message` describes what it is referenced by. A reference from a
223+
named transformation that is itself disabled does not block this request.
224+
Remove or disable those references first, then retry the deletion. This is a
225+
best-effort check and cannot detect references baked into your own application
226+
code or previously generated URLs.
204227
205228
Args:
206229
extra_headers: Send extra headers
@@ -280,7 +303,7 @@ async def create(
280303
*,
281304
name: str,
282305
transformation: str,
283-
disabled: bool | Omit = omit,
306+
enabled: bool | Omit = omit,
284307
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
285308
# The extra values given here take precedence over values defined on the client or passed to this method.
286309
extra_headers: Headers | None = None,
@@ -298,18 +321,24 @@ async def create(
298321
Learn more about
299322
[named transformations](https://imagekit.io/docs/transformations#named-transformations).
300323
324+
**Note:** You can create up to 250 named transformations per account. Once this
325+
limit is reached, the request fails with a `400` error.
326+
301327
Args:
302328
name: Name of the named transformation. This is the alias used to refer to the
303329
transformation string in image and video URLs, for example `tr:n-<name>`. Can
304-
only contain alphanumeric characters, `_` and `-`, and must be unique for your
305-
account (case-insensitive).
306-
307-
transformation: The transformation string this name refers to. It must start with `tr:` followed
308-
by one or more transformation parameters, for example
309-
`tr:w-150,h-150,fo-center,cm-resize`. Learn more about the
330+
only contain alphanumeric characters or `_` (hyphens are not allowed), and must
331+
be unique for your account. Name matching is case-sensitive, so
332+
`Small_Thumbnail` and `small_thumbnail` are treated as different names.
333+
334+
transformation: The transformation this name refers to, expressed as one or more comma-separated
335+
transformation parameters, for example `w-150,h-150,fo-center,cm-resize`. You do
336+
not need to prefix this with `tr:` — it is added automatically. If you do
337+
include it, it must appear in lowercase at the start of the string, or the
338+
request is rejected. Learn more about the
310339
[transformation syntax](https://imagekit.io/docs/transformations).
311340
312-
disabled: Whether this named transformation is disabled. Set to `true` to temporarily
341+
enabled: Whether this named transformation is enabled. Set to `false` to temporarily
313342
disable it without deleting it — requests using a disabled named transformation
314343
fail at delivery time.
315344
@@ -327,7 +356,7 @@ async def create(
327356
{
328357
"name": name,
329358
"transformation": transformation,
330-
"disabled": disabled,
359+
"enabled": enabled,
331360
},
332361
named_transformation_create_params.NamedTransformationCreateParams,
333362
),
@@ -341,7 +370,7 @@ async def update(
341370
self,
342371
id: str,
343372
*,
344-
disabled: bool | Omit = omit,
373+
enabled: bool | Omit = omit,
345374
name: str | Omit = omit,
346375
transformation: str | Omit = omit,
347376
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -356,14 +385,30 @@ async def update(
356385
object. Only the fields present in the request body are updated; omitted fields
357386
are left unchanged.
358387
388+
**Note:**
389+
390+
- If you rename this named transformation, or set `enabled` to `false`, and
391+
another _enabled_ named transformation, or your account's upload
392+
pre-transformation/post-transformation settings, reference it (via the
393+
`n-<name>` token), the request fails with a `409` error whose `message`
394+
describes what it is referenced by. A reference from a named transformation
395+
that is itself disabled does not block this request. Remove or disable those
396+
references first, then retry. This is a best-effort check and cannot detect
397+
references baked into your own application code or previously generated URLs.
398+
359399
Args:
360-
disabled: Whether this named transformation is disabled.
400+
enabled: Whether this named transformation is enabled. If omitted, the existing value is
401+
left unchanged.
361402
362403
name: Updated name of the named transformation. Can only contain alphanumeric
363-
characters, `_` and `-`, and must be unique for your account (case-insensitive).
404+
characters and `_`, and must be unique for your account. Name matching is
405+
case-sensitive, so `Small_Thumbnail` and `small_thumbnail` are treated as
406+
different names.
364407
365-
transformation: Updated transformation string. It must start with `tr:` followed by one or more
366-
transformation parameters.
408+
transformation: Updated transformation, expressed as one or more comma-separated transformation
409+
parameters. You do not need to prefix this with `tr:` — it is added
410+
automatically. If you do include it, it must appear in lowercase at the start of
411+
the string, or the request is rejected.
367412
368413
extra_headers: Send extra headers
369414
@@ -379,7 +424,7 @@ async def update(
379424
path_template("/v1/named-transformations/{id}", id=id),
380425
body=await async_maybe_transform(
381426
{
382-
"disabled": disabled,
427+
"enabled": enabled,
383428
"name": name,
384429
"transformation": transformation,
385430
},
@@ -427,13 +472,14 @@ async def delete(
427472
428473
**Note:**
429474
430-
- If another named transformation, or your account's upload
475+
- If another _enabled_ named transformation, or your account's upload
431476
pre-transformation/post-transformation settings, reference this named
432477
transformation (via the `n-<name>` token), the request fails with a `409`
433-
error whose `message` describes what it is referenced by. Remove those
434-
references first, then retry the deletion. This is a best-effort check and
435-
cannot detect references baked into your own application code or previously
436-
generated URLs.
478+
error whose `message` describes what it is referenced by. A reference from a
479+
named transformation that is itself disabled does not block this request.
480+
Remove or disable those references first, then retry the deletion. This is a
481+
best-effort check and cannot detect references baked into your own application
482+
code or previously generated URLs.
437483
438484
Args:
439485
extra_headers: Send extra headers

‎src/imagekitio/types/named_transformation_create_params.py‎

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,25 @@ class NamedTransformationCreateParams(TypedDict, total=False):
1212
"""Name of the named transformation.
1313
1414
This is the alias used to refer to the transformation string in image and video
15-
URLs, for example `tr:n-<name>`. Can only contain alphanumeric characters, `_`
16-
and `-`, and must be unique for your account (case-insensitive).
15+
URLs, for example `tr:n-<name>`. Can only contain alphanumeric characters or `_`
16+
(hyphens are not allowed), and must be unique for your account. Name matching is
17+
case-sensitive, so `Small_Thumbnail` and `small_thumbnail` are treated as
18+
different names.
1719
"""
1820

1921
transformation: Required[str]
20-
"""The transformation string this name refers to.
21-
22-
It must start with `tr:` followed by one or more transformation parameters, for
23-
example `tr:w-150,h-150,fo-center,cm-resize`. Learn more about the
22+
"""
23+
The transformation this name refers to, expressed as one or more comma-separated
24+
transformation parameters, for example `w-150,h-150,fo-center,cm-resize`. You do
25+
not need to prefix this with `tr:` — it is added automatically. If you do
26+
include it, it must appear in lowercase at the start of the string, or the
27+
request is rejected. Learn more about the
2428
[transformation syntax](https://imagekit.io/docs/transformations).
2529
"""
2630

27-
disabled: bool
28-
"""Whether this named transformation is disabled.
31+
enabled: bool
32+
"""Whether this named transformation is enabled.
2933
30-
Set to `true` to temporarily disable it without deleting it — requests using a
34+
Set to `false` to temporarily disable it without deleting it — requests using a
3135
disabled named transformation fail at delivery time.
3236
"""

‎src/imagekitio/types/named_transformation_update_params.py‎

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,24 @@
88

99

1010
class NamedTransformationUpdateParams(TypedDict, total=False):
11-
disabled: bool
12-
"""Whether this named transformation is disabled."""
11+
enabled: bool
12+
"""Whether this named transformation is enabled.
13+
14+
If omitted, the existing value is left unchanged.
15+
"""
1316

1417
name: str
1518
"""Updated name of the named transformation.
1619
17-
Can only contain alphanumeric characters, `_` and `-`, and must be unique for
18-
your account (case-insensitive).
20+
Can only contain alphanumeric characters and `_`, and must be unique for your
21+
account. Name matching is case-sensitive, so `Small_Thumbnail` and
22+
`small_thumbnail` are treated as different names.
1923
"""
2024

2125
transformation: str
22-
"""Updated transformation string.
23-
24-
It must start with `tr:` followed by one or more transformation parameters.
26+
"""
27+
Updated transformation, expressed as one or more comma-separated transformation
28+
parameters. You do not need to prefix this with `tr:` — it is added
29+
automatically. If you do include it, it must appear in lowercase at the start of
30+
the string, or the request is rejected.
2531
"""

‎src/imagekitio/types/shared/named_transformation.py‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,19 @@ class NamedTransformation(BaseModel):
2222
"""
2323

2424
created_at: Optional[datetime] = FieldInfo(alias="createdAt", default=None)
25-
"""Timestamp when the named transformation was created."""
25+
"""Timestamp (ISO string) when the named transformation was created."""
2626

27-
disabled: Optional[bool] = None
28-
"""Whether this named transformation is currently disabled."""
27+
enabled: Optional[bool] = None
28+
"""Whether this named transformation is currently enabled."""
2929

3030
name: Optional[str] = None
3131
"""
3232
Name of the named transformation, used as `tr:n-<name>` in image and video URLs.
3333
"""
3434

3535
transformation: Optional[str] = None
36-
"""The transformation string this name refers to."""
36+
"""The transformation this name refers to.
37+
38+
Always returned with the `tr:` prefix included, regardless of whether you
39+
supplied it when creating or updating the named transformation.
40+
"""

0 commit comments

Comments
 (0)