AnthropicFiles class
Anthropic Files API implementation
API Documentation:
- Create File: https://docs.anthropic.com/en/api/files-create
- List Files: https://docs.anthropic.com/en/api/files-list
- Get Metadata: https://docs.anthropic.com/en/api/files-metadata
- Download File: https://docs.anthropic.com/en/api/files-content
- Delete File: https://docs.anthropic.com/en/api/files-delete
This module handles file upload, listing, retrieval, and deletion
for Anthropic providers. Note that Anthropic's Files API is currently
in beta and requires the anthropic-beta: files-api-2025-04-14
header.
- Implemented types
Constructors
- AnthropicFiles.new(AnthropicClient client, AnthropicConfig config)
Properties
- client → AnthropicClient
-
final
- config → AnthropicConfig
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
deleteFile(
String fileId) → Future< FileDeleteResponse> -
Delete a file
override
-
deleteFiles(
List< String> fileIds) → Future<Map< String, bool> > - Batch delete multiple files
-
fileExists(
String fileId) → Future< bool> - Check if a file exists
-
getFileContent(
String fileId) → Future< List< int> > -
Get file metadata
override
-
getFileContentAsString(
String fileId) → Future< String> - Get file content as string (for text files)
-
getTotalStorageUsed(
) → Future< int> - Get total storage used by all files
-
listFiles(
[FileListQuery? query]) → Future< FileListResponse> -
List files
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
retrieveFile(
String fileId) → Future< FileObject> -
List files in the workspace
override
-
toString(
) → String -
A string representation of this object.
inherited
-
uploadFile(
FileUploadRequest request) → Future< FileObject> -
Upload a file to Anthropic
override
-
uploadFileFromBytes(
List< int> bytes, {String? filename}) → Future<FileObject> - Upload file from bytes with automatic filename
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited