List Files Args: after_id: ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object. before_id: ID of the object to use as a cursor for pagination. When provided, returns the
(
self,
*,
after_id: str | Omit = omit,
before_id: str | Omit = omit,
limit: int | Omit = omit,
scope_id: str | Omit = omit,
betas: List[AnthropicBetaParam] | 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,
)
| 361 | return AsyncFilesWithStreamingResponse(self) |
| 362 | |
| 363 | def list( |
| 364 | self, |
| 365 | *, |
| 366 | after_id: str | Omit = omit, |
| 367 | before_id: str | Omit = omit, |
| 368 | limit: int | Omit = omit, |
| 369 | scope_id: str | Omit = omit, |
| 370 | betas: List[AnthropicBetaParam] | Omit = omit, |
| 371 | # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 372 | # The extra values given here take precedence over values defined on the client or passed to this method. |
| 373 | extra_headers: Headers | None = None, |
| 374 | extra_query: Query | None = None, |
| 375 | extra_body: Body | None = None, |
| 376 | timeout: float | httpx.Timeout | None | NotGiven = not_given, |
| 377 | ) -> AsyncPaginator[FileMetadata, AsyncPage[FileMetadata]]: |
| 378 | """List Files |
| 379 | |
| 380 | Args: |
| 381 | after_id: ID of the object to use as a cursor for pagination. |
| 382 | |
| 383 | When provided, returns the |
| 384 | page of results immediately after this object. |
| 385 | |
| 386 | before_id: ID of the object to use as a cursor for pagination. When provided, returns the |
| 387 | page of results immediately before this object. |
| 388 | |
| 389 | limit: Number of items to return per page. |
| 390 | |
| 391 | Defaults to `20`. Ranges from `1` to `1000`. |
| 392 | |
| 393 | scope_id: Filter by scope ID. Only returns files associated with the specified scope |
| 394 | (e.g., a session ID). |
| 395 | |
| 396 | betas: Optional header to specify the beta version(s) you want to use. |
| 397 | |
| 398 | extra_headers: Send extra headers |
| 399 | |
| 400 | extra_query: Add additional query parameters to the request |
| 401 | |
| 402 | extra_body: Add additional JSON properties to the request |
| 403 | |
| 404 | timeout: Override the client-level default timeout for this request, in seconds |
| 405 | """ |
| 406 | extra_headers = { |
| 407 | **strip_not_given( |
| 408 | { |
| 409 | "anthropic-beta": ",".join(chain((str(e) for e in betas), ["files-api-2025-04-14"])) |
| 410 | if is_given(betas) |
| 411 | else not_given |
| 412 | } |
| 413 | ), |
| 414 | **(extra_headers or {}), |
| 415 | } |
| 416 | extra_headers = {"anthropic-beta": "files-api-2025-04-14", **(extra_headers or {})} |
| 417 | return self._get_api_list( |
| 418 | "/v1/files?beta=true", |
| 419 | page=AsyncPage[FileMetadata], |
| 420 | options=make_request_options( |
nothing calls this directly
no test coverage detected