-
Notifications
You must be signed in to change notification settings - Fork 1
feat: add files api support #38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 19 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
018264d
feat: initial implementation of creating a file via the Files API
StevanFreeborn ab6d455
fix: remove unnecessary usings
StevanFreeborn 31539a8
tests: add create file request tests
StevanFreeborn 94c3028
docs: fix xml comments
StevanFreeborn a5746a0
tests: add integration test for creating file
StevanFreeborn 98236bb
tests: add end to end test
StevanFreeborn a5eaa4b
docs: add note about files beta status
StevanFreeborn 09f56c4
tests: add tests for anthropic file model
StevanFreeborn 26908d3
feat: implement listing a page of files
StevanFreeborn 9cf50e1
feat: implement list all files method
StevanFreeborn 63278bb
feat: implement `GetFileInfoAsync`, `GetFileAsync`, and `DeleteFileAs…
StevanFreeborn 3a50c06
tests: add tests for sad path in new files methods
StevanFreeborn 0a2514f
refactor: remove unnecessary if checks and add test to handle getting…
StevanFreeborn e821b35
chore: run dotnet format
StevanFreeborn 1f304b8
fix: use sync copy to method
StevanFreeborn 348976d
docs: update files api section with examples for each method
StevanFreeborn e0c6e59
tests: remove unnecessary reason string
StevanFreeborn 45df2db
feat: add support for file source and url source
StevanFreeborn 3c03e70
tests: add test for file source constructor with id
StevanFreeborn 3dd6d6c
chore: run dotnet format
StevanFreeborn 8d2b023
feat: add missing model constants
StevanFreeborn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| using System.Text.Json.Serialization; | ||
|
|
||
| namespace AnthropicClient.Models; | ||
|
|
||
| /// <summary> | ||
| /// Represents a file object from the Anthropic Files API. | ||
| /// </summary> | ||
| public class AnthropicFile | ||
| { | ||
| /// <summary> | ||
| /// Unique object identifier. | ||
| /// </summary> | ||
| [JsonPropertyName("id")] | ||
| public string Id { get; init; } = string.Empty; | ||
|
|
||
| /// <summary> | ||
| /// Object type. | ||
| /// </summary> | ||
| [JsonPropertyName("type")] | ||
| public string Type { get; init; } = string.Empty; | ||
|
|
||
| /// <summary> | ||
| /// Original filename of the uploaded file. | ||
| /// </summary> | ||
| [JsonPropertyName("filename")] | ||
| public string Name { get; init; } = string.Empty; | ||
|
|
||
| /// <summary> | ||
| /// Date file was created. | ||
| /// </summary> | ||
| [JsonPropertyName("created_at")] | ||
| public DateTimeOffset CreatedAt { get; init; } | ||
|
|
||
| /// <summary> | ||
| /// Size of the file in bytes. | ||
| /// </summary> | ||
| [JsonPropertyName("size_bytes")] | ||
| public long Size { get; init; } | ||
|
|
||
| /// <summary> | ||
| /// MIME type of the file. | ||
| /// </summary> | ||
| [JsonPropertyName("mime_type")] | ||
| public string MimeType { get; init; } = string.Empty; | ||
|
|
||
| /// <summary> | ||
| /// Whether the file can be downloaded. | ||
| /// </summary> | ||
| [JsonPropertyName("downloadable")] | ||
| public bool Downloadable { get; init; } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| namespace AnthropicClient.Models; | ||
|
|
||
| /// <summary> | ||
| /// Represents the response from deleting a file in the Anthropic API. | ||
| /// </summary> | ||
| public class AnthropicFileDeleteResponse | ||
| { | ||
| /// <summary> | ||
| /// Gets or sets the ID of the file that was deleted. | ||
| /// </summary> | ||
| public string Id { get; init; } = string.Empty; | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the response type | ||
| /// </summary> | ||
| public string Type { get; init; } = string.Empty; | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.