Skip to content

Commit 1d0cd71

Browse files
feat(api): manual updates
1 parent cc31c09 commit 1d0cd71

File tree

4 files changed

+21
-41
lines changed

4 files changed

+21
-41
lines changed

.stats.yml

Lines changed: 2 additions & 2 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-eab9713fd85da68b41e881dfd9cd71f654e8620132da2023bab7dd01e5f7852e.yml
3-
openapi_spec_hash: b5037b26fbe7360c6bfaf9947a65bb85
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-911102f2eaf3be4b34381f6ba089330bed099bb72eb93667ce2f6e72b5934c8c.yml
3+
openapi_spec_hash: 637ad417a580137914441bd790b04cc2
44
config_hash: 70f9408b8d1dfbcf262a20d6eed50e1c

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ from imagekit import ImageKit
138138
client = ImageKit()
139139

140140
response = client.files.upload(
141-
file="https://www.example.com/path/to-image.jpg",
141+
file="file",
142142
file_name="fileName",
143143
transformation={
144144
"post": [

tests/api_resources/test_files.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ def test_streaming_response_rename(self, client: ImageKit) -> None:
326326
@parametrize
327327
def test_method_upload(self, client: ImageKit) -> None:
328328
file = client.files.upload(
329-
file="https://www.example.com/path/to-image.jpg",
329+
file="file",
330330
file_name="fileName",
331331
)
332332
assert_matches_type(FileUploadResponse, file, path=["response"])
@@ -335,7 +335,7 @@ def test_method_upload(self, client: ImageKit) -> None:
335335
@parametrize
336336
def test_method_upload_with_all_params(self, client: ImageKit) -> None:
337337
file = client.files.upload(
338-
file="https://www.example.com/path/to-image.jpg",
338+
file="file",
339339
file_name="fileName",
340340
token="token",
341341
checks='"request.folder" : "marketing/"\n',
@@ -397,7 +397,7 @@ def test_method_upload_with_all_params(self, client: ImageKit) -> None:
397397
@parametrize
398398
def test_raw_response_upload(self, client: ImageKit) -> None:
399399
response = client.files.with_raw_response.upload(
400-
file="https://www.example.com/path/to-image.jpg",
400+
file="file",
401401
file_name="fileName",
402402
)
403403

@@ -410,7 +410,7 @@ def test_raw_response_upload(self, client: ImageKit) -> None:
410410
@parametrize
411411
def test_streaming_response_upload(self, client: ImageKit) -> None:
412412
with client.files.with_streaming_response.upload(
413-
file="https://www.example.com/path/to-image.jpg",
413+
file="file",
414414
file_name="fileName",
415415
) as response:
416416
assert not response.is_closed
@@ -729,7 +729,7 @@ async def test_streaming_response_rename(self, async_client: AsyncImageKit) -> N
729729
@parametrize
730730
async def test_method_upload(self, async_client: AsyncImageKit) -> None:
731731
file = await async_client.files.upload(
732-
file="https://www.example.com/path/to-image.jpg",
732+
file="file",
733733
file_name="fileName",
734734
)
735735
assert_matches_type(FileUploadResponse, file, path=["response"])
@@ -738,7 +738,7 @@ async def test_method_upload(self, async_client: AsyncImageKit) -> None:
738738
@parametrize
739739
async def test_method_upload_with_all_params(self, async_client: AsyncImageKit) -> None:
740740
file = await async_client.files.upload(
741-
file="https://www.example.com/path/to-image.jpg",
741+
file="file",
742742
file_name="fileName",
743743
token="token",
744744
checks='"request.folder" : "marketing/"\n',
@@ -800,7 +800,7 @@ async def test_method_upload_with_all_params(self, async_client: AsyncImageKit)
800800
@parametrize
801801
async def test_raw_response_upload(self, async_client: AsyncImageKit) -> None:
802802
response = await async_client.files.with_raw_response.upload(
803-
file="https://www.example.com/path/to-image.jpg",
803+
file="file",
804804
file_name="fileName",
805805
)
806806

@@ -813,7 +813,7 @@ async def test_raw_response_upload(self, async_client: AsyncImageKit) -> None:
813813
@parametrize
814814
async def test_streaming_response_upload(self, async_client: AsyncImageKit) -> None:
815815
async with async_client.files.with_streaming_response.upload(
816-
file="https://www.example.com/path/to-image.jpg",
816+
file="file",
817817
file_name="fileName",
818818
) as response:
819819
assert not response.is_closed

tests/test_client.py

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -806,9 +806,7 @@ def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter, clien
806806
respx_mock.post("/api/v1/files/upload").mock(side_effect=httpx.TimeoutException("Test timeout error"))
807807

808808
with pytest.raises(APITimeoutError):
809-
client.files.with_streaming_response.upload(
810-
file="https://www.example.com/path/to-image.jpg", file_name="fileName"
811-
).__enter__()
809+
client.files.with_streaming_response.upload(file="file", file_name="fileName").__enter__()
812810

813811
assert _get_open_connections(self.client) == 0
814812

@@ -818,9 +816,7 @@ def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter, client
818816
respx_mock.post("/api/v1/files/upload").mock(return_value=httpx.Response(500))
819817

820818
with pytest.raises(APIStatusError):
821-
client.files.with_streaming_response.upload(
822-
file="https://www.example.com/path/to-image.jpg", file_name="fileName"
823-
).__enter__()
819+
client.files.with_streaming_response.upload(file="file", file_name="fileName").__enter__()
824820
assert _get_open_connections(self.client) == 0
825821

826822
@pytest.mark.parametrize("failures_before_success", [0, 2, 4])
@@ -849,9 +845,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
849845

850846
respx_mock.post("/api/v1/files/upload").mock(side_effect=retry_handler)
851847

852-
response = client.files.with_raw_response.upload(
853-
file="https://www.example.com/path/to-image.jpg", file_name="fileName"
854-
)
848+
response = client.files.with_raw_response.upload(file="file", file_name="fileName")
855849

856850
assert response.retries_taken == failures_before_success
857851
assert int(response.http_request.headers.get("x-stainless-retry-count")) == failures_before_success
@@ -876,9 +870,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
876870
respx_mock.post("/api/v1/files/upload").mock(side_effect=retry_handler)
877871

878872
response = client.files.with_raw_response.upload(
879-
file="https://www.example.com/path/to-image.jpg",
880-
file_name="fileName",
881-
extra_headers={"x-stainless-retry-count": Omit()},
873+
file="file", file_name="fileName", extra_headers={"x-stainless-retry-count": Omit()}
882874
)
883875

884876
assert len(response.http_request.headers.get_list("x-stainless-retry-count")) == 0
@@ -903,9 +895,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
903895
respx_mock.post("/api/v1/files/upload").mock(side_effect=retry_handler)
904896

905897
response = client.files.with_raw_response.upload(
906-
file="https://www.example.com/path/to-image.jpg",
907-
file_name="fileName",
908-
extra_headers={"x-stainless-retry-count": "42"},
898+
file="file", file_name="fileName", extra_headers={"x-stainless-retry-count": "42"}
909899
)
910900

911901
assert response.http_request.headers.get("x-stainless-retry-count") == "42"
@@ -1715,9 +1705,7 @@ async def test_retrying_timeout_errors_doesnt_leak(
17151705
respx_mock.post("/api/v1/files/upload").mock(side_effect=httpx.TimeoutException("Test timeout error"))
17161706

17171707
with pytest.raises(APITimeoutError):
1718-
await async_client.files.with_streaming_response.upload(
1719-
file="https://www.example.com/path/to-image.jpg", file_name="fileName"
1720-
).__aenter__()
1708+
await async_client.files.with_streaming_response.upload(file="file", file_name="fileName").__aenter__()
17211709

17221710
assert _get_open_connections(self.client) == 0
17231711

@@ -1729,9 +1717,7 @@ async def test_retrying_status_errors_doesnt_leak(
17291717
respx_mock.post("/api/v1/files/upload").mock(return_value=httpx.Response(500))
17301718

17311719
with pytest.raises(APIStatusError):
1732-
await async_client.files.with_streaming_response.upload(
1733-
file="https://www.example.com/path/to-image.jpg", file_name="fileName"
1734-
).__aenter__()
1720+
await async_client.files.with_streaming_response.upload(file="file", file_name="fileName").__aenter__()
17351721
assert _get_open_connections(self.client) == 0
17361722

17371723
@pytest.mark.parametrize("failures_before_success", [0, 2, 4])
@@ -1761,9 +1747,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
17611747

17621748
respx_mock.post("/api/v1/files/upload").mock(side_effect=retry_handler)
17631749

1764-
response = await client.files.with_raw_response.upload(
1765-
file="https://www.example.com/path/to-image.jpg", file_name="fileName"
1766-
)
1750+
response = await client.files.with_raw_response.upload(file="file", file_name="fileName")
17671751

17681752
assert response.retries_taken == failures_before_success
17691753
assert int(response.http_request.headers.get("x-stainless-retry-count")) == failures_before_success
@@ -1789,9 +1773,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
17891773
respx_mock.post("/api/v1/files/upload").mock(side_effect=retry_handler)
17901774

17911775
response = await client.files.with_raw_response.upload(
1792-
file="https://www.example.com/path/to-image.jpg",
1793-
file_name="fileName",
1794-
extra_headers={"x-stainless-retry-count": Omit()},
1776+
file="file", file_name="fileName", extra_headers={"x-stainless-retry-count": Omit()}
17951777
)
17961778

17971779
assert len(response.http_request.headers.get_list("x-stainless-retry-count")) == 0
@@ -1817,9 +1799,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
18171799
respx_mock.post("/api/v1/files/upload").mock(side_effect=retry_handler)
18181800

18191801
response = await client.files.with_raw_response.upload(
1820-
file="https://www.example.com/path/to-image.jpg",
1821-
file_name="fileName",
1822-
extra_headers={"x-stainless-retry-count": "42"},
1802+
file="file", file_name="fileName", extra_headers={"x-stainless-retry-count": "42"}
18231803
)
18241804

18251805
assert response.http_request.headers.get("x-stainless-retry-count") == "42"

0 commit comments

Comments
 (0)