Skip to content

Conversation

@Mewyk
Copy link
Owner

@Mewyk Mewyk commented Dec 7, 2025

No description provided.

Mewyk added 17 commits December 6, 2025 13:59
Added <IsTrimmable>true</IsTrimmable> to Core, Sdk, and Tools .csproj files to support trimming and reduce application size for publish scenarios.
Renamed ICivitaiSdkClient to ISdkClient, CivitaiSdkClient to SdkClient, and CivitaiSdkClientOptions to SdkClientOptions for improved naming consistency and clarity. Updated exception documentation to distinguish between ArgumentNullException and ArgumentException where appropriate.
Replaces CivitaiSdkClientOptions with SdkClientOptions.
Introduces a Validate() method to ImageJobControlNet to ensure that exactly one of ImageUrl or Image is provided. JobsService now calls this validation for ControlNet configurations in job requests to prevent invalid input.
Introduces MinModifier and MaxModifier constants to define valid range for priority modifier. The Priority constructor now throws ArgumentOutOfRangeException if the modifier is outside the allowed range, improving input validation and robustness.
Replaces string-based AIR source with the AirSource enum throughout the SDK for improved type safety and intellisense. Adds AirBuilder for fluent, immutable AIR construction. Updates parsing, serialization, and service interfaces to use AirIdentifier and AirSource. Documentation and JSON converters are updated to reflect the new types and usage patterns.
Renamed CivitaiSdkClientOptionsTests to SdkClientOptionsTests and updated references to SdkClientOptions. Updated AirIdentifierTests to use AirSource enum instead of string for source, removed string source validation tests, and expanded parsing tests to cover all AirSource values. Added comprehensive AirBuilderTests for builder behavior and immutability. Added ToolsTestFixture to Tools test project for shared test setup.
Introduces a comprehensive guide for the AIR Builder, detailing its fluent API for constructing AIR identifiers. Updates AIR identifier documentation to use strongly-typed classes and enums, adds builder pattern examples, and clarifies supported sources. Refactors references from ICivitaiSdkClient to ISdkClient and updates configuration and SDK introduction docs for consistency. Enhances tools introduction with AIR Builder feature.
Introduces immutable builder classes for constructing ImageJobControlNet, ImageJobNetworkParams, ImageJobParams, and TextToImageJobRequest objects. These builders provide a fluent API for configuring image generation jobs, including support for additional networks, ControlNet, and job submission via IJobsService.
Refactored CoverageService, JobsService, and UsageService to use C# primary constructors, removing explicit field assignments and constructor logic. Updated Priority struct to use a primary constructor. Added CreateTextToImage builder method to IJobsService and JobsService for fluent job creation.
Updated XML documentation for NullableControlNetPreprocessorConverter and NullableSchedulerConverter to specify handling of null values during JSON serialization and deserialization.
Changed BatchJobRequest from internal to public to allow usage outside its assembly. Also removed unnecessary JsonSerializable attribute for nullable Priority in SdkJsonContext.
Changed Priority from a readonly struct to a sealed record for improved immutability and clarity.
Improves and clarifies XML documentation comments across QueryStringBuilder, ISdkClient, SdkClientOptions, ICoverageService, IJobsService, and IUsageService. Updates include more concise summaries, improved parameter and return descriptions, and an added usage example for QueryStringBuilder.
@Mewyk Mewyk marked this pull request as ready for review December 12, 2025 07:45
Copilot AI review requested due to automatic review settings December 12, 2025 07:45
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

This pull request represents a significant refactoring of the SDK with improvements to type safety, API design, and developer experience. The changes introduce strongly-typed AIR identifiers, fluent builder patterns for job creation, and modernize the codebase with primary constructors and record types.

Key Changes:

  • Refactored AIR identifiers from string-based to enum-based sources (AirSource enum)
  • Introduced fluent builder APIs (TextToImageJobBuilder, ImageJobParamsBuilder, etc.) for job creation
  • Renamed SDK classes for consistency (CivitaiSdkClient → SdkClient, CivitaiSdkClientOptions → SdkClientOptions)
  • Converted Priority from struct to record and added validation constants
  • Modernized service constructors using primary constructor syntax
  • Added comprehensive test coverage for new builder classes

Reviewed changes

Copilot reviewed 48 out of 48 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
Sdk/Air/AirIdentifier.cs Refactored source from string to AirSource enum for type safety
Sdk/Air/AirSource.cs New enum defining supported platforms (Civitai, HuggingFace, OpenAI, Leonardo)
Sdk/Air/AirBuilder.cs New immutable builder for constructing AIR identifiers with validation
Sdk/Request/TextToImageJobBuilder.cs New fluent builder for text-to-image job requests
Sdk/Request/ImageJobParamsBuilder.cs New fluent builder for image generation parameters
Sdk/Request/ImageJobNetworkParamsBuilder.cs New fluent builder for additional network parameters
Sdk/Request/ImageJobControlNetBuilder.cs New fluent builder for ControlNet configurations
Sdk/SdkClient.cs Renamed from CivitaiSdkClient for consistency
Sdk/SdkClientOptions.cs Renamed from CivitaiSdkClientOptions with improved documentation
Sdk/Services/*.cs Refactored to use primary constructors and updated to reference renamed types
Sdk/Models/Jobs/Priority.cs Converted from struct to record with added validation constants
Sdk/Models/Jobs/ImageJobControlNet.cs Added Validate method for ControlNet image source validation
Sdk/Json/Converters/AirIdentifierConverter.cs New JSON converter for AirIdentifier serialization
Tests/**/*Tests.cs Comprehensive test coverage for all new builder classes and updated tests for renamed types
Documentation/Guides/air-builder.md New guide for AirBuilder usage (contains documentation issues)
Documentation/Guides/*.md Updated documentation to reflect API changes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Mewyk and others added 2 commits December 15, 2025 19:05
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Repository owner deleted a comment from Copilot AI Dec 16, 2025
Mewyk and others added 3 commits December 15, 2025 19:10
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Repository owner deleted a comment from Copilot AI Dec 16, 2025
Repository owner deleted a comment from Copilot AI Dec 16, 2025
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Repository owner deleted a comment from Copilot AI Dec 16, 2025
@Mewyk Mewyk marked this pull request as draft December 16, 2025 03:14
Repository owner deleted a comment from Copilot AI Dec 16, 2025
Repository owner deleted a comment from Copilot AI Dec 16, 2025
Repository owner deleted a comment from Copilot AI Dec 16, 2025
Repository owner deleted a comment from Copilot AI Dec 16, 2025
Repository owner deleted a comment from Copilot AI Dec 16, 2025
Repository owner deleted a comment from Copilot AI Dec 16, 2025
@Mewyk Mewyk marked this pull request as ready for review December 16, 2025 04:05
@Mewyk Mewyk merged commit cb6abc3 into alpha Dec 16, 2025
1 check passed
@Mewyk Mewyk deleted the development branch December 16, 2025 04:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants