Skip to content

feat: add files api support#38

Merged
StevanFreeborn merged 21 commits intomainfrom
stevanfreeborn/feat/add-files-api
Jul 15, 2025
Merged

feat: add files api support#38
StevanFreeborn merged 21 commits intomainfrom
stevanfreeborn/feat/add-files-api

Conversation

@StevanFreeborn
Copy link
Owner

closes #35

  • feat: initial implementation of creating a file via the Files API
  • fix: remove unnecessary usings
  • tests: add create file request tests
  • docs: fix xml comments
  • tests: add integration test for creating file
  • tests: add end to end test
  • docs: add note about files beta status
  • tests: add tests for anthropic file model
  • feat: implement listing a page of files
  • feat: implement list all files method
  • feat: implement GetFileInfoAsync, GetFileAsync, and DeleteFileAsync
  • tests: add tests for sad path in new files methods
  • refactor: remove unnecessary if checks and add test to handle getting null file

@codecov
Copy link

codecov bot commented Jul 15, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.01%. Comparing base (e351823) to head (8d2b023).
Report is 25 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #38      +/-   ##
==========================================
+ Coverage   98.94%   99.01%   +0.06%     
==========================================
  Files          93       98       +5     
  Lines        1619     1733     +114     
  Branches      137      143       +6     
==========================================
+ Hits         1602     1716     +114     
  Misses          5        5              
  Partials       12       12              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@StevanFreeborn StevanFreeborn requested a review from Copilot July 15, 2025 00:24
@StevanFreeborn StevanFreeborn self-assigned this Jul 15, 2025
@StevanFreeborn StevanFreeborn added the enhancement New feature or request label Jul 15, 2025

This comment was marked as outdated.

@StevanFreeborn StevanFreeborn requested a review from Copilot July 15, 2025 00:38

This comment was marked as outdated.

@StevanFreeborn StevanFreeborn requested a review from Copilot July 15, 2025 04:04
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds beta support for the Anthropic Files API, including client implementation, models, converters, tests, and documentation.

  • Introduces new file-related models and updates JSON source converter
  • Implements CreateFileAsync, ListFilesAsync, ListAllFilesAsync, GetFileInfoAsync, GetFileAsync, and DeleteFileAsync (with multipart upload support)
  • Provides unit, integration, and end-to-end tests for the new functionality and updates the README with usage examples

Reviewed Changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/AnthropicClient.Tests/Unit/Models/UrlSourceTests.cs Adds serialization and constructor tests for UrlSource
tests/AnthropicClient.Tests/Unit/Models/ImageContentTests.cs Expands unit tests for ImageContent constructors
src/AnthropicClient/Models/UrlSource.cs Implements UrlSource model
src/AnthropicClient/Models/CreateFileRequest.cs Introduces CreateFileRequest with validation
src/AnthropicClient/AnthropicApiClient.cs Adds file endpoints and SendFileRequestAsync logic
README.md Documents Files API usage and beta header requirement
Comments suppressed due to low confidence (2)

tests/AnthropicClient.Tests/Unit/Models/ImageContentTests.cs:134

  • [nitpick] The test name says 'NullException' but asserts ArgumentNullException. Rename the method to ItShouldThrowArgumentNullException for clarity and consistency with other tests.
  public void Constructor_WhenCacheControlIsNull_ItShouldThrowNullException()

src/AnthropicClient/Models/UrlSource.cs:16

  • [nitpick] Constructors don't have return values; remove the <returns> tag and move any descriptive text into the <summary> or a <remarks> section to adhere to XML comment conventions.
  /// <returns>A new instance of <see cref="UrlSource"/> with the type set to "url".</returns>

@StevanFreeborn StevanFreeborn merged commit b859859 into main Jul 15, 2025
5 of 6 checks passed
@StevanFreeborn StevanFreeborn deleted the stevanfreeborn/feat/add-files-api branch July 15, 2025 04:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT]: Add support for files

1 participant