Table of Contents

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

ImageUrl string
BlobKey string
Preprocessor ControlNetPreprocessor?
Weight decimal?
StartStep decimal?
EndStep decimal?

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

string

EndStep

public decimal? EndStep { get; init; }

Property Value

decimal?

ImageUrl

public string? ImageUrl { get; init; }

Property Value

string

Preprocessor

public ControlNetPreprocessor? Preprocessor { get; init; }

Property Value

ControlNetPreprocessor?

StartStep

public decimal? StartStep { get; init; }

Property Value

decimal?

Weight

public decimal? Weight { get; init; }

Property Value

decimal?

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

blobKey string

The 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

endStep decimal

The 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

imageUrl string

The 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

preprocessor ControlNetPreprocessor

The 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

startStep decimal

The 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

startStep decimal

The start step. Range: 0.0-1.0.

endStep decimal

The end step. Range: 0.0-1.0.

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

weight decimal

The weight value. Range: 0.0-2.0, default: 1.0.

Returns

ControlNetBuilder

A new builder instance with the updated weight.