CatBox Client Abstraction & Error Handling#4
Merged
ChaseDRedmon merged 43 commits intomainfrom Nov 24, 2025
Merged
Conversation
Owner
ChaseDRedmon
commented
May 6, 2023
- Organize Requests and Clients into subfolders;
- Rename CreateAlbumRequest.cs to RemoteCreateAlbumRequest.cs.
- Add LocalCreateAlbumRequest.cs to create albums on catbox while uploading local files.
- Create abstraction for Local and Remote Requests: AlbumCreationRequest.cs.
- Begin work on CatBox client abstraction layer and created a method to upload files and create an album in one step.
- Working on better error handling from the API side of things.
…est.cs to RemoteCreateAlbumRequest.cs. Add LocalCreateAlbumRequest.cs to create albums on catbox while uploading local files. Create abstraction for Local and Remote Requests: AlbumCreationRequest.cs. Begin work on CatBox client abstraction layer and created a method to upload files and create an album in one step. Working on better error handling from the API side of things.
…thods for uploading files and creating albums.
…t doesn't already exist
…matting, variable renaming, etc. Add upload to album request type. Renamed some request types. Trying out AnyOf request type to simplify API usage
…aks to Delegating Handler for exception throwing
…eter code. Remove ToRequest methods that converted Enums to API equivalent request values. Add AddHttpClientWithMessageHandler extension method to clean up service registration. Code comments. Code organization.
…f union type. Add AnyOf dependency. Add IAlbumUploadRequest.cs to abstract CreateAlbumRequest.cs and UploadToAlbumRequest.cs. Remove redundant upload methods in CatBox.cs. Rename Upload methods in CatBoxClient.cs. Change return type CatBoxClient.UplaodImage to IAsyncEnumerable<string?> instead of Task<string?>.
Owner
Author
Will work on a list of breaking changes from 0.3 -> 0.4 later on |
formlesstree4
requested changes
Aug 23, 2023
src/CatBox.NET/Throw.cs
Outdated
Comment on lines
17
to
20
| public static void IfNull([DoesNotReturnIf(true)] object? s, [CallerArgumentExpression("s")] string memberName = "") | ||
| { | ||
| if (s is null) throw new ArgumentNullException(memberName, "Argument cannot be null"); | ||
| } |
Collaborator
There was a problem hiding this comment.
Could just do
public static void IfNull([DoesNotReturnIf(true)] object? s, [CallerArgumentExpression("s")] string memberName = "")
{
ArgumentNullException.ThrowIfNull(s, memberName);
}
Owner
Author
There was a problem hiding this comment.
Since the library includes a minimum target to .NET Standard 2.1 (the minimum version for C# 8 to support async-enumerables), the ArgumentNullException.ThrowIfNull isn't present in the BCL at this point. That was added in a later version of .NET
Owner
Author
|
Latest feedback has been taken into consideration and committed into codebase |
Standardizes base class naming by adding "Base" suffix to abstract request classes. This improves code clarity by making inheritance hierarchies more explicit. Changes: - Rename AlbumCreationRequest → AlbumCreationRequestBase - Rename Album → AlbumBase - Rename UploadRequest → UploadRequestBase - Rename TemporaryRequest → TemporaryRequestBase - Update all derived classes to reference new base class names 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Removes interface abstractions for client classes, transitioning to direct concrete type registration. This simplifies the architecture by eliminating unnecessary abstraction layers. Changes: - Remove ICatBox, ICatBoxClient, and ILitterboxClient interfaces - Update DI registration to use concrete types directly - Aligns with modern DI practices where interfaces are only needed for multiple implementations 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Moves Throw helper class from root namespace to CatBox.NET.Client namespace for better logical organization. The class contains HTTP client-specific validation helpers for file size limits and album operations. Changes: - Move src/CatBox.NET/Throw.cs → src/CatBox.NET/Client/Throw.cs - Add AssemblyInfo.cs with InternalsVisibleTo attribute for test projects - Improves code organization by placing validation helpers near their usage 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Refactors client implementation code to utilize the new Throw helper methods, improving error handling consistency. Updates method signatures to work with renamed base classes and enhances validation logic throughout upload and album management operations. Changes: - Update CatBox.cs, CatBoxClient.cs, and LitterboxClient.cs with improved validation - Streamline file processing in both CatBox and Litterbox clients - Enhance error handling consistency using centralized Throw helpers - Update method signatures for renamed base classes 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Removes custom ApiValueAttribute in favor of Intellenum source generator pattern. Refactors RequestType and ExpireAfter enums to use Intellenum's built-in value mapping, eliminating the need for custom attribute reflection. Changes: - Delete src/CatBox.NET/Attributes/ApiValueAttribute.cs - Refactor RequestType and ExpireAfter to use Intellenum - Update RequestParameters enum implementation - Improves performance by leveraging modern C# source generation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Enhances exception classes with more descriptive error messages and improved property names. Updates logger extensions for better diagnostic information and provides clearer feedback when API errors occur. Changes: - Enhance CatBoxAPIExceptions with better error messages - Update exception properties for clarity - Improve logger extensions with better diagnostics - Add detailed messages for file size limit violations and invalid request types 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Updates request model classes with improved validation using the refactored Throw helper. Enhances documentation on request properties and standardizes null checks and parameter validation across all request types. Changes: - Update IAlbumUploadRequest, EditAlbumRequest, and ModifyAlbumImagesRequest - Enhance validation in DeleteFileRequest, FileUploadRequest, and StreamUploadRequest - Update UrlUploadRequest with improved validation - Ensure consistent error messaging for invalid inputs 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Updates project file with new dependencies and build configuration. Removes TaskAsyncEnumerableExtensions.cs as async enumerable handling is now integrated directly into client methods. Updates options class for improved configuration validation. Changes: - Update CatBox.NET.csproj with dependency changes - Delete Extensions/TaskAsyncEnumerableExtensions.cs (functionality moved to clients) - Update CatboxOptions.cs with improved validation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Implements comprehensive test coverage including unit tests with mocked HTTP responses and integration tests against live APIs. Adds test helper classes for creating mock HTTP clients and managing test configuration. Changes: - Add CatBoxClientTests.cs and CatBoxClientIntegrationTests.cs - Add LitterboxClientTests.cs and LitterboxClientIntegrationTests.cs - Add CommonTests.cs for utility function testing - Create test helpers (HttpClientTestHelper, IntegrationTestConfig) - Include test image assets (test-file.png, test-file.svg) - Add comprehensive test documentation in README - Remove unused Usings.cs global using directives file - Update test project configuration 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Updates the sample application to demonstrate the refactored API. Shows usage of new request patterns, concrete client types, and enhanced error handling. Updates project dependencies to match library changes and provides practical examples of album creation, file uploads, and error scenarios. Changes: - Update Program.cs with examples using refactored API - Demonstrate new request patterns and error handling - Update SampleApp.csproj dependencies - Add practical usage examples for library consumers 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Transitions from legacy .sln format to modern XML-based .slnx solution file format. This provides better merge conflict resolution and human-readability for the solution configuration. Changes: - Delete CatBox.NET.sln (legacy format) - Add CatBox.NET.slnx (modern XML format) - Improves version control friendliness 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Adds IDE-specific configuration files for Claude Code, JetBrains Rider, and Visual Studio Code. Configures workspace settings, project structure preferences, and code style rules to improve developer experience across different IDEs. Changes: - Add .claude/settings.local.json for Claude Code configuration - Add .idea/.idea.CatBox.NET/.idea/projectSettingsUpdater.xml for Rider - Add .vscode/settings.json for Visual Studio Code - Standardizes development environment setup 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Updates main README to reflect the architectural changes, including removal of interfaces, new request patterns, and updated usage examples. Documents breaking changes and provides migration guidance for users upgrading from previous versions. Changes: - Update README with refactored API examples - Document breaking changes (interface removal, renamed base classes) - Add migration guidance for existing users - Update usage examples to reflect new patterns 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
* Add qodana.yaml file * Add github workflow file --------- Co-authored-by: Qodana Application <qodana-support@jetbrains.com>
41827f0 to
9667abe
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.