MCPcopy
hub / github.com/anthropics/anthropic-sdk-python / list

Method list

src/anthropic/resources/beta/files.py:63–136  ·  view source on GitHub ↗

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,
    )

Source from the content-addressed store, hash-verified

61 return FilesWithStreamingResponse(self)
62
63 def list(
64 self,
65 *,
66 after_id: str | Omit = omit,
67 before_id: str | Omit = omit,
68 limit: int | Omit = omit,
69 scope_id: str | Omit = omit,
70 betas: List[AnthropicBetaParam] | Omit = omit,
71 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
72 # The extra values given here take precedence over values defined on the client or passed to this method.
73 extra_headers: Headers | None = None,
74 extra_query: Query | None = None,
75 extra_body: Body | None = None,
76 timeout: float | httpx.Timeout | None | NotGiven = not_given,
77 ) -> SyncPage[FileMetadata]:
78 """List Files
79
80 Args:
81 after_id: ID of the object to use as a cursor for pagination.
82
83 When provided, returns the
84 page of results immediately after this object.
85
86 before_id: ID of the object to use as a cursor for pagination. When provided, returns the
87 page of results immediately before this object.
88
89 limit: Number of items to return per page.
90
91 Defaults to `20`. Ranges from `1` to `1000`.
92
93 scope_id: Filter by scope ID. Only returns files associated with the specified scope
94 (e.g., a session ID).
95
96 betas: Optional header to specify the beta version(s) you want to use.
97
98 extra_headers: Send extra headers
99
100 extra_query: Add additional query parameters to the request
101
102 extra_body: Add additional JSON properties to the request
103
104 timeout: Override the client-level default timeout for this request, in seconds
105 """
106 extra_headers = {
107 **strip_not_given(
108 {
109 "anthropic-beta": ",".join(chain((str(e) for e in betas), ["files-api-2025-04-14"]))
110 if is_given(betas)
111 else not_given
112 }
113 ),
114 **(extra_headers or {}),
115 }
116 extra_headers = {"anthropic-beta": "files-api-2025-04-14", **(extra_headers or {})}
117 return self._get_api_list(
118 "/v1/files?beta=true",
119 page=SyncPage[FileMetadata],
120 options=make_request_options(

Callers

nothing calls this directly

Calls 4

strip_not_givenFunction · 0.85
is_givenFunction · 0.85
make_request_optionsFunction · 0.85
maybe_transformFunction · 0.85

Tested by

no test coverage detected