Returns a list of files. Args: after: A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can i
(
self,
*,
after: str | Omit = omit,
limit: int | Omit = omit,
order: Literal["asc", "desc"] | Omit = omit,
purpose: str | Omit = omit,
# 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,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
)
| 189 | ) |
| 190 | |
| 191 | def list( |
| 192 | self, |
| 193 | *, |
| 194 | after: str | Omit = omit, |
| 195 | limit: int | Omit = omit, |
| 196 | order: Literal["asc", "desc"] | Omit = omit, |
| 197 | purpose: str | Omit = omit, |
| 198 | # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 199 | # The extra values given here take precedence over values defined on the client or passed to this method. |
| 200 | extra_headers: Headers | None = None, |
| 201 | extra_query: Query | None = None, |
| 202 | extra_body: Body | None = None, |
| 203 | timeout: float | httpx.Timeout | None | NotGiven = not_given, |
| 204 | ) -> SyncCursorPage[FileObject]: |
| 205 | """Returns a list of files. |
| 206 | |
| 207 | Args: |
| 208 | after: A cursor for use in pagination. |
| 209 | |
| 210 | `after` is an object ID that defines your place |
| 211 | in the list. For instance, if you make a list request and receive 100 objects, |
| 212 | ending with obj_foo, your subsequent call can include after=obj_foo in order to |
| 213 | fetch the next page of the list. |
| 214 | |
| 215 | limit: A limit on the number of objects to be returned. Limit can range between 1 and |
| 216 | 10,000, and the default is 10,000. |
| 217 | |
| 218 | order: Sort order by the `created_at` timestamp of the objects. `asc` for ascending |
| 219 | order and `desc` for descending order. |
| 220 | |
| 221 | purpose: Only return files with the given purpose. |
| 222 | |
| 223 | extra_headers: Send extra headers |
| 224 | |
| 225 | extra_query: Add additional query parameters to the request |
| 226 | |
| 227 | extra_body: Add additional JSON properties to the request |
| 228 | |
| 229 | timeout: Override the client-level default timeout for this request, in seconds |
| 230 | """ |
| 231 | return self._get_api_list( |
| 232 | "/files", |
| 233 | page=SyncCursorPage[FileObject], |
| 234 | options=make_request_options( |
| 235 | extra_headers=extra_headers, |
| 236 | extra_query=extra_query, |
| 237 | extra_body=extra_body, |
| 238 | timeout=timeout, |
| 239 | query=maybe_transform( |
| 240 | { |
| 241 | "after": after, |
| 242 | "limit": limit, |
| 243 | "order": order, |
| 244 | "purpose": purpose, |
| 245 | }, |
| 246 | file_list_params.FileListParams, |
| 247 | ), |
| 248 | security={"bearer_auth": True}, |