Class ControlNetBuilder
- Namespace
- CivitaiSharp.Sdk.Request
- Assembly
- CivitaiSharp.Sdk.dll
Fluent builder for constructing ImageJobControlNet instances.
public sealed record ControlNetBuilder : IEquatable<ControlNetBuilder>
- Inheritance
-
ControlNetBuilder
- Implements
- Inherited Members
Remarks
This builder follows an immutable design pattern. Each method returns a new instance with the updated configuration, making it thread-safe and cacheable.
Constructors
ControlNetBuilder(string?, string?, ControlNetPreprocessor?, decimal?, decimal?, decimal?)
Fluent builder for constructing ImageJobControlNet instances.
public ControlNetBuilder(string? ImageUrl = null, string? BlobKey = null, ControlNetPreprocessor? Preprocessor = null, decimal? Weight = null, decimal? StartStep = null, decimal? EndStep = null)
Parameters
ImageUrlstringBlobKeystringPreprocessorControlNetPreprocessor?Weightdecimal?StartStepdecimal?EndStepdecimal?
Remarks
This builder follows an immutable design pattern. Each method returns a new instance with the updated configuration, making it thread-safe and cacheable.
Properties
BlobKey
public string? BlobKey { get; init; }
Property Value
EndStep
public decimal? EndStep { get; init; }
Property Value
ImageUrl
public string? ImageUrl { get; init; }
Property Value
Preprocessor
public ControlNetPreprocessor? Preprocessor { get; init; }
Property Value
StartStep
public decimal? StartStep { get; init; }
Property Value
Weight
public decimal? Weight { get; init; }
Property Value
Methods
Build()
Builds the ImageJobControlNet instance.
public ImageJobControlNet Build()
Returns
- ImageJobControlNet
The configured ImageJobControlNet.
Exceptions
- InvalidOperationException
Thrown when neither or both image source properties are provided.
Create()
Creates a new ControlNetBuilder instance.
public static ControlNetBuilder Create()
Returns
- ControlNetBuilder
A new builder instance.
WithBlobKey(string)
Sets the blob key referencing a pre-uploaded control image.
public ControlNetBuilder WithBlobKey(string blobKey)
Parameters
blobKeystringThe blob storage key for the control image.
Returns
- ControlNetBuilder
A new builder instance with the updated blob key.
Remarks
Provide either this or WithImageUrl(string), not both. Use this when the control image has been pre-uploaded to Civitai's blob storage.
WithEndStep(decimal)
Sets the ending step for ControlNet influence.
public ControlNetBuilder WithEndStep(decimal endStep)
Parameters
endStepdecimalThe end step. Range: 0.0-1.0.
Returns
- ControlNetBuilder
A new builder instance with the updated end step.
WithImageUrl(string)
Sets the URL of the control image.
public ControlNetBuilder WithImageUrl(string imageUrl)
Parameters
imageUrlstringThe control image URL.
Returns
- ControlNetBuilder
A new builder instance with the updated image URL.
Remarks
Provide either this or WithBlobKey(string), not both.
WithPreprocessor(ControlNetPreprocessor)
Sets the preprocessor to apply to the control image.
public ControlNetBuilder WithPreprocessor(ControlNetPreprocessor preprocessor)
Parameters
preprocessorControlNetPreprocessorThe preprocessor type.
Returns
- ControlNetBuilder
A new builder instance with the updated preprocessor.
WithStartStep(decimal)
Sets the starting step for ControlNet influence.
public ControlNetBuilder WithStartStep(decimal startStep)
Parameters
startStepdecimalThe start step. Range: 0.0-1.0.
Returns
- ControlNetBuilder
A new builder instance with the updated start step.
WithStepRange(decimal, decimal)
Sets the step range for ControlNet influence.
public ControlNetBuilder WithStepRange(decimal startStep, decimal endStep)
Parameters
Returns
- ControlNetBuilder
A new builder instance with the updated step range.
WithWeight(decimal)
Sets the weight/influence of this ControlNet.
public ControlNetBuilder WithWeight(decimal weight)
Parameters
weightdecimalThe weight value. Range: 0.0-2.0, default: 1.0.
Returns
- ControlNetBuilder
A new builder instance with the updated weight.