Skip to content

Commit c57c9c6

Browse files
committed
fix(types): fix type casting for generic document types
1 parent be3428e commit c57c9c6

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/typesense/async_/document.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,13 @@ async def retrieve(
7676
Returns:
7777
TDoc: The retrieved document.
7878
"""
79-
response: TDoc = await self.api_call.get(
79+
response = await self.api_call.get(
8080
endpoint=self._endpoint_path,
81-
entity_type=typing.Dict[str, str],
81+
entity_type=dict,
8282
as_json=True,
8383
params=retrieve_parameters,
8484
)
85-
return response
85+
return typing.cast(TDoc, response)
8686

8787
async def update(
8888
self,
@@ -104,7 +104,7 @@ async def update(
104104
self._endpoint_path,
105105
body=document,
106106
params=dirty_values_parameters,
107-
entity_type=typing.Dict[str, str],
107+
entity_type=dict,
108108
)
109109
return typing.cast(TDoc, response)
110110

@@ -122,12 +122,12 @@ async def delete(
122122
Returns:
123123
TDoc: The deleted document.
124124
"""
125-
response: TDoc = await self.api_call.delete(
125+
response = await self.api_call.delete(
126126
self._endpoint_path,
127-
entity_type=typing.Dict[str, str],
127+
entity_type=dict,
128128
params=delete_parameters,
129129
)
130-
return response
130+
return typing.cast(TDoc, response)
131131

132132
@property
133133
def _endpoint_path(self) -> str:

src/typesense/async_/documents.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,14 @@ async def create(
127127
"""
128128
dirty_values_parameters = dirty_values_parameters or {}
129129
dirty_values_parameters["action"] = "create"
130-
response: TDoc = await self.api_call.post(
130+
response = await self.api_call.post(
131131
self._endpoint_path(),
132132
body=document,
133133
params=dirty_values_parameters,
134134
as_json=True,
135-
entity_type=typing.Dict[str, str],
135+
entity_type=dict,
136136
)
137-
return response
137+
return typing.cast(TDoc, response)
138138

139139
async def create_many(
140140
self,
@@ -174,14 +174,14 @@ async def upsert(
174174
"""
175175
dirty_values_parameters = dirty_values_parameters or {}
176176
dirty_values_parameters["action"] = "upsert"
177-
response: TDoc = await self.api_call.post(
177+
response = await self.api_call.post(
178178
self._endpoint_path(),
179179
body=document,
180180
params=dirty_values_parameters,
181181
as_json=True,
182-
entity_type=typing.Dict[str, str],
182+
entity_type=dict,
183183
)
184-
return response
184+
return typing.cast(TDoc, response)
185185

186186
async def update(
187187
self,

0 commit comments

Comments
 (0)