44
55import httpx
66
7- from ..types import file_search_params
7+ from ..types import file_read_params
88from .._types import NOT_GIVEN , Body , Query , Headers , NotGiven
99from .._utils import maybe_transform , async_maybe_transform
1010from .._compat import cached_property
1616 async_to_streamed_response_wrapper ,
1717)
1818from .._base_client import make_request_options
19- from ..types .file_search_response import FileSearchResponse
19+ from ..types .file_read_response import FileReadResponse
20+ from ..types .file_status_response import FileStatusResponse
2021
2122__all__ = ["FileResource" , "AsyncFileResource" ]
2223
@@ -41,19 +42,19 @@ def with_streaming_response(self) -> FileResourceWithStreamingResponse:
4142 """
4243 return FileResourceWithStreamingResponse (self )
4344
44- def search (
45+ def read (
4546 self ,
4647 * ,
47- query : str ,
48+ path : str ,
4849 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
4950 # The extra values given here take precedence over values defined on the client or passed to this method.
5051 extra_headers : Headers | None = None ,
5152 extra_query : Query | None = None ,
5253 extra_body : Body | None = None ,
5354 timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
54- ) -> FileSearchResponse :
55+ ) -> FileReadResponse :
5556 """
56- Search for files
57+ Read a file
5758
5859 Args:
5960 extra_headers: Send extra headers
@@ -71,9 +72,28 @@ def search(
7172 extra_query = extra_query ,
7273 extra_body = extra_body ,
7374 timeout = timeout ,
74- query = maybe_transform ({"query " : query }, file_search_params . FileSearchParams ),
75+ query = maybe_transform ({"path " : path }, file_read_params . FileReadParams ),
7576 ),
76- cast_to = FileSearchResponse ,
77+ cast_to = FileReadResponse ,
78+ )
79+
80+ def status (
81+ self ,
82+ * ,
83+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
84+ # The extra values given here take precedence over values defined on the client or passed to this method.
85+ extra_headers : Headers | None = None ,
86+ extra_query : Query | None = None ,
87+ extra_body : Body | None = None ,
88+ timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
89+ ) -> FileStatusResponse :
90+ """Get file status"""
91+ return self ._get (
92+ "/file/status" ,
93+ options = make_request_options (
94+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
95+ ),
96+ cast_to = FileStatusResponse ,
7797 )
7898
7999
@@ -97,19 +117,19 @@ def with_streaming_response(self) -> AsyncFileResourceWithStreamingResponse:
97117 """
98118 return AsyncFileResourceWithStreamingResponse (self )
99119
100- async def search (
120+ async def read (
101121 self ,
102122 * ,
103- query : str ,
123+ path : str ,
104124 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
105125 # The extra values given here take precedence over values defined on the client or passed to this method.
106126 extra_headers : Headers | None = None ,
107127 extra_query : Query | None = None ,
108128 extra_body : Body | None = None ,
109129 timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
110- ) -> FileSearchResponse :
130+ ) -> FileReadResponse :
111131 """
112- Search for files
132+ Read a file
113133
114134 Args:
115135 extra_headers: Send extra headers
@@ -127,43 +147,74 @@ async def search(
127147 extra_query = extra_query ,
128148 extra_body = extra_body ,
129149 timeout = timeout ,
130- query = await async_maybe_transform ({"query" : query }, file_search_params .FileSearchParams ),
150+ query = await async_maybe_transform ({"path" : path }, file_read_params .FileReadParams ),
151+ ),
152+ cast_to = FileReadResponse ,
153+ )
154+
155+ async def status (
156+ self ,
157+ * ,
158+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
159+ # The extra values given here take precedence over values defined on the client or passed to this method.
160+ extra_headers : Headers | None = None ,
161+ extra_query : Query | None = None ,
162+ extra_body : Body | None = None ,
163+ timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
164+ ) -> FileStatusResponse :
165+ """Get file status"""
166+ return await self ._get (
167+ "/file/status" ,
168+ options = make_request_options (
169+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
131170 ),
132- cast_to = FileSearchResponse ,
171+ cast_to = FileStatusResponse ,
133172 )
134173
135174
136175class FileResourceWithRawResponse :
137176 def __init__ (self , file : FileResource ) -> None :
138177 self ._file = file
139178
140- self .search = to_raw_response_wrapper (
141- file .search ,
179+ self .read = to_raw_response_wrapper (
180+ file .read ,
181+ )
182+ self .status = to_raw_response_wrapper (
183+ file .status ,
142184 )
143185
144186
145187class AsyncFileResourceWithRawResponse :
146188 def __init__ (self , file : AsyncFileResource ) -> None :
147189 self ._file = file
148190
149- self .search = async_to_raw_response_wrapper (
150- file .search ,
191+ self .read = async_to_raw_response_wrapper (
192+ file .read ,
193+ )
194+ self .status = async_to_raw_response_wrapper (
195+ file .status ,
151196 )
152197
153198
154199class FileResourceWithStreamingResponse :
155200 def __init__ (self , file : FileResource ) -> None :
156201 self ._file = file
157202
158- self .search = to_streamed_response_wrapper (
159- file .search ,
203+ self .read = to_streamed_response_wrapper (
204+ file .read ,
205+ )
206+ self .status = to_streamed_response_wrapper (
207+ file .status ,
160208 )
161209
162210
163211class AsyncFileResourceWithStreamingResponse :
164212 def __init__ (self , file : AsyncFileResource ) -> None :
165213 self ._file = file
166214
167- self .search = async_to_streamed_response_wrapper (
168- file .search ,
215+ self .read = async_to_streamed_response_wrapper (
216+ file .read ,
217+ )
218+ self .status = async_to_streamed_response_wrapper (
219+ file .status ,
169220 )
0 commit comments