Skip to content

Commit 7a0c7b2

Browse files
feat(api): manual updates
1 parent 5460097 commit 7a0c7b2

File tree

7 files changed

+24
-77
lines changed

7 files changed

+24
-77
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-bc7c0d27962b30c19c778656988e154b54696819389289f34420a5e5fdfbd3b8.yml
3-
openapi_spec_hash: 1bfde02a63416c036e9545927f727459
4-
config_hash: b415c06a3b29485af4601beb94ae1aeb
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-dd864816d7f4316ae89f57394da2fd1926166d4704db5a0bb5d23461d2d75e49.yml
3+
openapi_spec_hash: 7f7c416563a15bbaea98804ecdc1a8f9
4+
config_hash: 54c05a157f2cc730fac9e1df5dc3ca29

api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ from imagekit.types import (
5050
File,
5151
Folder,
5252
Metadata,
53-
UpdateFileDetailsRequest,
53+
UpdateFileRequest,
5454
FileUpdateResponse,
5555
FileCopyResponse,
5656
FileMoveResponse,

src/imagekit/resources/files/files.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def update(
172172
self,
173173
file_id: str,
174174
*,
175-
publish: file_update_params.ChangePublicationStatusPublish | Omit = omit,
175+
body: object,
176176
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
177177
# The extra values given here take precedence over values defined on the client or passed to this method.
178178
extra_headers: Headers | None = None,
@@ -186,8 +186,6 @@ def update(
186186
status, remove existing `AITags` and apply extensions using this API.
187187
188188
Args:
189-
publish: Configure the publication status of a file and its versions.
190-
191189
extra_headers: Send extra headers
192190
193191
extra_query: Add additional query parameters to the request
@@ -209,7 +207,7 @@ def update(
209207
remove_ai_tags: Union[SequenceNotStr[str], Literal["all"]] | Omit = omit,
210208
tags: Optional[SequenceNotStr[str]] | Omit = omit,
211209
webhook_url: str | Omit = omit,
212-
publish: file_update_params.ChangePublicationStatusPublish | Omit = omit,
210+
body: object | Omit = omit,
213211
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
214212
# The extra values given here take precedence over values defined on the client or passed to this method.
215213
extra_headers: Headers | None = None,
@@ -230,7 +228,7 @@ def update(
230228
"remove_ai_tags": remove_ai_tags,
231229
"tags": tags,
232230
"webhook_url": webhook_url,
233-
"publish": publish,
231+
"body": body,
234232
},
235233
file_update_params.FileUpdateParams,
236234
),
@@ -843,7 +841,7 @@ async def update(
843841
self,
844842
file_id: str,
845843
*,
846-
publish: file_update_params.ChangePublicationStatusPublish | Omit = omit,
844+
body: object,
847845
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
848846
# The extra values given here take precedence over values defined on the client or passed to this method.
849847
extra_headers: Headers | None = None,
@@ -857,8 +855,6 @@ async def update(
857855
status, remove existing `AITags` and apply extensions using this API.
858856
859857
Args:
860-
publish: Configure the publication status of a file and its versions.
861-
862858
extra_headers: Send extra headers
863859
864860
extra_query: Add additional query parameters to the request
@@ -880,7 +876,7 @@ async def update(
880876
remove_ai_tags: Union[SequenceNotStr[str], Literal["all"]] | Omit = omit,
881877
tags: Optional[SequenceNotStr[str]] | Omit = omit,
882878
webhook_url: str | Omit = omit,
883-
publish: file_update_params.ChangePublicationStatusPublish | Omit = omit,
879+
body: object | Omit = omit,
884880
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
885881
# The extra values given here take precedence over values defined on the client or passed to this method.
886882
extra_headers: Headers | None = None,
@@ -901,7 +897,7 @@ async def update(
901897
"remove_ai_tags": remove_ai_tags,
902898
"tags": tags,
903899
"webhook_url": webhook_url,
904-
"publish": publish,
900+
"body": body,
905901
},
906902
file_update_params.FileUpdateParams,
907903
),

src/imagekit/types/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@
5151
from .folder_create_response import FolderCreateResponse as FolderCreateResponse
5252
from .folder_delete_response import FolderDeleteResponse as FolderDeleteResponse
5353
from .folder_rename_response import FolderRenameResponse as FolderRenameResponse
54+
from .update_file_request_param import UpdateFileRequestParam as UpdateFileRequestParam
5455
from .unsafe_unwrap_webhook_event import UnsafeUnwrapWebhookEvent as UnsafeUnwrapWebhookEvent
5556
from .upload_pre_transform_error_event import UploadPreTransformErrorEvent as UploadPreTransformErrorEvent
5657
from .video_transformation_error_event import VideoTransformationErrorEvent as VideoTransformationErrorEvent
5758
from .video_transformation_ready_event import VideoTransformationReadyEvent as VideoTransformationReadyEvent
5859
from .custom_metadata_field_list_params import CustomMetadataFieldListParams as CustomMetadataFieldListParams
59-
from .update_file_details_request_param import UpdateFileDetailsRequestParam as UpdateFileDetailsRequestParam
6060
from .upload_post_transform_error_event import UploadPostTransformErrorEvent as UploadPostTransformErrorEvent
6161
from .upload_pre_transform_success_event import UploadPreTransformSuccessEvent as UploadPreTransformSuccessEvent
6262
from .custom_metadata_field_create_params import CustomMetadataFieldCreateParams as CustomMetadataFieldCreateParams

src/imagekit/types/file_update_params.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from .._utils import PropertyInfo
1010
from .shared_params.extensions import Extensions
1111

12-
__all__ = ["FileUpdateParams", "UpdateFileDetails", "ChangePublicationStatus", "ChangePublicationStatusPublish"]
12+
__all__ = ["FileUpdateParams", "UpdateFileDetails", "ChangePublicationStatus"]
1313

1414

1515
class UpdateFileDetails(TypedDict, total=False):
@@ -65,19 +65,7 @@ class UpdateFileDetails(TypedDict, total=False):
6565

6666

6767
class ChangePublicationStatus(TypedDict, total=False):
68-
publish: ChangePublicationStatusPublish
69-
"""Configure the publication status of a file and its versions."""
70-
71-
72-
class ChangePublicationStatusPublish(TypedDict, total=False):
73-
is_published: Required[Annotated[bool, PropertyInfo(alias="isPublished")]]
74-
"""Set to `true` to publish the file. Set to `false` to unpublish the file."""
75-
76-
include_file_versions: Annotated[bool, PropertyInfo(alias="includeFileVersions")]
77-
"""Set to `true` to publish/unpublish all versions of the file.
78-
79-
Set to `false` to publish/unpublish only the current version of the file.
80-
"""
68+
body: Required[object]
8169

8270

8371
FileUpdateParams: TypeAlias = Union[UpdateFileDetails, ChangePublicationStatus]

src/imagekit/types/update_file_details_request_param.py renamed to src/imagekit/types/update_file_request_param.py

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,13 @@
33
from __future__ import annotations
44

55
from typing import Dict, Union, Optional
6-
from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict
6+
from typing_extensions import Literal, Annotated, TypeAlias, TypedDict
77

88
from .._types import SequenceNotStr
99
from .._utils import PropertyInfo
1010
from .shared_params.extensions import Extensions
1111

12-
__all__ = [
13-
"UpdateFileDetailsRequestParam",
14-
"UpdateFileDetails",
15-
"ChangePublicationStatus",
16-
"ChangePublicationStatusPublish",
17-
]
12+
__all__ = ["UpdateFileRequestParam", "UpdateFileDetails"]
1813

1914

2015
class UpdateFileDetails(TypedDict, total=False):
@@ -69,20 +64,4 @@ class UpdateFileDetails(TypedDict, total=False):
6964
"""
7065

7166

72-
class ChangePublicationStatusPublish(TypedDict, total=False):
73-
is_published: Required[Annotated[bool, PropertyInfo(alias="isPublished")]]
74-
"""Set to `true` to publish the file. Set to `false` to unpublish the file."""
75-
76-
include_file_versions: Annotated[bool, PropertyInfo(alias="includeFileVersions")]
77-
"""Set to `true` to publish/unpublish all versions of the file.
78-
79-
Set to `false` to publish/unpublish only the current version of the file.
80-
"""
81-
82-
83-
class ChangePublicationStatus(TypedDict, total=False):
84-
publish: ChangePublicationStatusPublish
85-
"""Configure the publication status of a file and its versions."""
86-
87-
88-
UpdateFileDetailsRequestParam: TypeAlias = Union[UpdateFileDetails, ChangePublicationStatus]
67+
UpdateFileRequestParam: TypeAlias = Union[UpdateFileDetails, object]

tests/api_resources/test_files.py

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -102,18 +102,7 @@ def test_path_params_update_overload_1(self, client: ImageKit) -> None:
102102
def test_method_update_overload_2(self, client: ImageKit) -> None:
103103
file = client.files.update(
104104
file_id="fileId",
105-
)
106-
assert_matches_type(FileUpdateResponse, file, path=["response"])
107-
108-
@pytest.mark.skip(reason="Prism tests are disabled")
109-
@parametrize
110-
def test_method_update_with_all_params_overload_2(self, client: ImageKit) -> None:
111-
file = client.files.update(
112-
file_id="fileId",
113-
publish={
114-
"is_published": True,
115-
"include_file_versions": True,
116-
},
105+
body={},
117106
)
118107
assert_matches_type(FileUpdateResponse, file, path=["response"])
119108

@@ -122,6 +111,7 @@ def test_method_update_with_all_params_overload_2(self, client: ImageKit) -> Non
122111
def test_raw_response_update_overload_2(self, client: ImageKit) -> None:
123112
response = client.files.with_raw_response.update(
124113
file_id="fileId",
114+
body={},
125115
)
126116

127117
assert response.is_closed is True
@@ -134,6 +124,7 @@ def test_raw_response_update_overload_2(self, client: ImageKit) -> None:
134124
def test_streaming_response_update_overload_2(self, client: ImageKit) -> None:
135125
with client.files.with_streaming_response.update(
136126
file_id="fileId",
127+
body={},
137128
) as response:
138129
assert not response.is_closed
139130
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -149,6 +140,7 @@ def test_path_params_update_overload_2(self, client: ImageKit) -> None:
149140
with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"):
150141
client.files.with_raw_response.update(
151142
file_id="",
143+
body={},
152144
)
153145

154146
@pytest.mark.skip(reason="Prism tests are disabled")
@@ -549,18 +541,7 @@ async def test_path_params_update_overload_1(self, async_client: AsyncImageKit)
549541
async def test_method_update_overload_2(self, async_client: AsyncImageKit) -> None:
550542
file = await async_client.files.update(
551543
file_id="fileId",
552-
)
553-
assert_matches_type(FileUpdateResponse, file, path=["response"])
554-
555-
@pytest.mark.skip(reason="Prism tests are disabled")
556-
@parametrize
557-
async def test_method_update_with_all_params_overload_2(self, async_client: AsyncImageKit) -> None:
558-
file = await async_client.files.update(
559-
file_id="fileId",
560-
publish={
561-
"is_published": True,
562-
"include_file_versions": True,
563-
},
544+
body={},
564545
)
565546
assert_matches_type(FileUpdateResponse, file, path=["response"])
566547

@@ -569,6 +550,7 @@ async def test_method_update_with_all_params_overload_2(self, async_client: Asyn
569550
async def test_raw_response_update_overload_2(self, async_client: AsyncImageKit) -> None:
570551
response = await async_client.files.with_raw_response.update(
571552
file_id="fileId",
553+
body={},
572554
)
573555

574556
assert response.is_closed is True
@@ -581,6 +563,7 @@ async def test_raw_response_update_overload_2(self, async_client: AsyncImageKit)
581563
async def test_streaming_response_update_overload_2(self, async_client: AsyncImageKit) -> None:
582564
async with async_client.files.with_streaming_response.update(
583565
file_id="fileId",
566+
body={},
584567
) as response:
585568
assert not response.is_closed
586569
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -596,6 +579,7 @@ async def test_path_params_update_overload_2(self, async_client: AsyncImageKit)
596579
with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"):
597580
await async_client.files.with_raw_response.update(
598581
file_id="",
582+
body={},
599583
)
600584

601585
@pytest.mark.skip(reason="Prism tests are disabled")

0 commit comments

Comments
 (0)