Table of Contents

Class JobsBuilder

Namespace
CivitaiSharp.Sdk.Request
Assembly
CivitaiSharp.Sdk.dll

Entry point for job creation and querying operations. Provides factory methods for creating new jobs and a fluent query builder for retrieving job status.

public sealed record JobsBuilder : IEquatable<JobsBuilder>
Inheritance
JobsBuilder
Implements
Inherited Members

Properties

Query

Gets a cached, immutable, thread-safe query builder for retrieving and managing job status.

public JobQueryBuilder Query { get; }

Property Value

JobQueryBuilder

Examples

// Query by ID with detailed information
var result = await sdkClient.Jobs.Query
    .WithDetailed()
    .GetByIdAsync(jobId);

// Wait for completion
var result = await sdkClient.Jobs.Query
    .WithWait()
    .GetByTokenAsync(token);

// Query by custom properties
var result = await sdkClient.Jobs.Query
    .WhereProperty("userId", JsonSerializer.SerializeToElement("12345"))
    .ExecuteAsync();

Remarks

This property returns a cached builder instance that can be safely reused. Each fluent method on the builder returns a new instance with the updated configuration.

Methods

CreateImage()

Creates a new image generation job builder for submitting generation requests. Supports both text-to-image and image-to-image generation modes.

public ImageGenerationBuilder CreateImage()

Returns

ImageGenerationBuilder

A new ImageGenerationBuilder instance.

Examples

// Text-to-image
var result = await sdkClient.Jobs
    .CreateImage()
    .WithAir(new AirIdentifier("sdxl", AirAssetType.Checkpoint, "civitai", 4201, 130072))
    .WithPositivePrompt("a beautiful landscape")
    .WithDimensions(1024, 1024)
    .ExecuteAsync();

// Image-to-image
var result = await sdkClient.Jobs
    .CreateImage()
    .WithAir(new AirIdentifier("sdxl", AirAssetType.Checkpoint, "civitai", 4201, 130072))
    .WithPositivePrompt("add dramatic sunset lighting")
    .WithSourceImageUrl("https://example.com/source.jpg")
    .WithDenoisingStrength(0.7m)
    .ExecuteAsync();

Remarks

Use the returned builder to configure generation parameters (AIR identifier, positive prompt, dimensions, etc.) and call ExecuteAsync(CancellationToken) to submit the job. For image-to-image generation, also use WithSourceImageUrl(string) and WithDenoisingStrength(decimal).