Skip to content

Commit

Permalink
chore(internal): codegen related update (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Aug 14, 2024
1 parent 0a92c06 commit a154150
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 20 deletions.
14 changes: 2 additions & 12 deletions src/writerai/resources/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ def upload(
*,
content: FileTypes,
content_disposition: str,
content_type: str,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand All @@ -231,11 +230,7 @@ def upload(
timeout: Override the client-level default timeout for this request, in seconds
"""
extra_headers = {
"Content-Disposition": content_disposition,
"Content-Type": content_type,
**(extra_headers or {}),
}
extra_headers = {"Content-Disposition": content_disposition, **(extra_headers or {})}
return self._post(
"/v1/files",
options=make_request_options(
Expand Down Expand Up @@ -424,7 +419,6 @@ async def upload(
*,
content: FileTypes,
content_disposition: str,
content_type: str,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand All @@ -444,11 +438,7 @@ async def upload(
timeout: Override the client-level default timeout for this request, in seconds
"""
extra_headers = {
"Content-Disposition": content_disposition,
"Content-Type": content_type,
**(extra_headers or {}),
}
extra_headers = {"Content-Disposition": content_disposition, **(extra_headers or {})}
return await self._post(
"/v1/files",
options=make_request_options(
Expand Down
2 changes: 0 additions & 2 deletions src/writerai/types/file_upload_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,3 @@ class FileUploadParams(TypedDict, total=False):
content: Required[FileTypes]

content_disposition: Required[Annotated[str, PropertyInfo(alias="Content-Disposition")]]

content_type: Required[Annotated[str, PropertyInfo(alias="Content-Type")]]
6 changes: 0 additions & 6 deletions tests/api_resources/test_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ def test_method_upload(self, client: Writer) -> None:
file = client.files.upload(
content=b"raw file contents",
content_disposition="Content-Disposition",
content_type="Content-Type",
)
assert_matches_type(File, file, path=["response"])

Expand All @@ -208,7 +207,6 @@ def test_raw_response_upload(self, client: Writer) -> None:
response = client.files.with_raw_response.upload(
content=b"raw file contents",
content_disposition="Content-Disposition",
content_type="Content-Type",
)

assert response.is_closed is True
Expand All @@ -222,7 +220,6 @@ def test_streaming_response_upload(self, client: Writer) -> None:
with client.files.with_streaming_response.upload(
content=b"raw file contents",
content_disposition="Content-Disposition",
content_type="Content-Type",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
Expand Down Expand Up @@ -408,7 +405,6 @@ async def test_method_upload(self, async_client: AsyncWriter) -> None:
file = await async_client.files.upload(
content=b"raw file contents",
content_disposition="Content-Disposition",
content_type="Content-Type",
)
assert_matches_type(File, file, path=["response"])

Expand All @@ -418,7 +414,6 @@ async def test_raw_response_upload(self, async_client: AsyncWriter) -> None:
response = await async_client.files.with_raw_response.upload(
content=b"raw file contents",
content_disposition="Content-Disposition",
content_type="Content-Type",
)

assert response.is_closed is True
Expand All @@ -432,7 +427,6 @@ async def test_streaming_response_upload(self, async_client: AsyncWriter) -> Non
async with async_client.files.with_streaming_response.upload(
content=b"raw file contents",
content_disposition="Content-Disposition",
content_type="Content-Type",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
Expand Down

0 comments on commit a154150

Please sign in to comment.