Table of Contents

Class JobStatus

Namespace
CivitaiSharp.Sdk.Models.Results
Assembly
CivitaiSharp.Sdk.dll

Status information for an individual job.

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

Constructors

JobStatus(Guid, decimal, JobResult?, bool, IReadOnlyDictionary<string, JsonElement>?, JsonElement?, int?, JsonElement?, JobEvent?)

Status information for an individual job.

public JobStatus(Guid JobId, decimal Cost, JobResult? Result, bool Scheduled, IReadOnlyDictionary<string, JsonElement>? Properties, JsonElement? ServiceProviders, int? Position, JsonElement? Job = null, JobEvent? LastEvent = null)

Parameters

JobId Guid

The unique job identifier. Maps to JSON property "jobId".

Cost decimal

The Buzz cost incurred for this job. Maps to JSON property "cost".

Result JobResult

The result information for this job. Maps to JSON property "result".

Scheduled bool

Indicates whether the job is still being processed. Maps to JSON property "scheduled". When true, the job is queued or processing. When false, the job is complete - check LastEvent to determine success or failure.

Properties IReadOnlyDictionary<string, JsonElement>

The custom properties from the original request. Maps to JSON property "properties". Values are JsonElement because properties can contain any JSON type. Use TryGetProperty(string, out JsonElement) and type accessors to extract values.

ServiceProviders JsonElement?

Information about the service providers handling this job. Maps to JSON property "serviceProviders". This property uses JsonElement because the API returns variable structures for service provider information. Use TryGetProperty(string, out JsonElement) to safely access nested values.

Position int?

The queue position when the job is waiting. Maps to JSON property "position".

Job JsonElement?

Optional job definition payload. Maps to JSON property "job". This is returned when queries are performed with the "detailed" flag.

LastEvent JobEvent

The most recent job lifecycle event. Maps to JSON property "lastEvent". Check Type to determine if the job succeeded or failed. The API does not provide an ErrorMessage property - use Context for error details.

Properties

Cost

The Buzz cost incurred for this job. Maps to JSON property "cost".

[JsonPropertyName("cost")]
public decimal Cost { get; init; }

Property Value

decimal

Job

Optional job definition payload. Maps to JSON property "job". This is returned when queries are performed with the "detailed" flag.

[JsonPropertyName("job")]
public JsonElement? Job { get; init; }

Property Value

JsonElement?

JobId

The unique job identifier. Maps to JSON property "jobId".

[JsonPropertyName("jobId")]
public Guid JobId { get; init; }

Property Value

Guid

LastEvent

The most recent job lifecycle event. Maps to JSON property "lastEvent". Check Type to determine if the job succeeded or failed. The API does not provide an ErrorMessage property - use Context for error details.

[JsonPropertyName("lastEvent")]
public JobEvent? LastEvent { get; init; }

Property Value

JobEvent

Position

The queue position when the job is waiting. Maps to JSON property "position".

[JsonPropertyName("position")]
public int? Position { get; init; }

Property Value

int?

Properties

The custom properties from the original request. Maps to JSON property "properties". Values are JsonElement because properties can contain any JSON type. Use TryGetProperty(string, out JsonElement) and type accessors to extract values.

[JsonPropertyName("properties")]
public IReadOnlyDictionary<string, JsonElement>? Properties { get; init; }

Property Value

IReadOnlyDictionary<string, JsonElement>

Result

The result information for this job. Maps to JSON property "result".

[JsonPropertyName("result")]
public JobResult? Result { get; init; }

Property Value

JobResult

Scheduled

Indicates whether the job is still being processed. Maps to JSON property "scheduled". When true, the job is queued or processing. When false, the job is complete - check LastEvent to determine success or failure.

[JsonPropertyName("scheduled")]
public bool Scheduled { get; init; }

Property Value

bool

ServiceProviderStatuses

Attempts to parse ServiceProviders into a strongly-typed dictionary.

[JsonIgnore]
public IReadOnlyDictionary<string, ProviderJobStatus> ServiceProviderStatuses { get; }

Property Value

IReadOnlyDictionary<string, ProviderJobStatus>

Remarks

The official OpenAPI schema models serviceProviders as a mapping of provider name to provider-specific status. This helper returns an empty dictionary when the payload is missing or not an object. If the payload is present but cannot be parsed, a JsonException is thrown.

ServiceProviders

Information about the service providers handling this job. Maps to JSON property "serviceProviders". This property uses JsonElement because the API returns variable structures for service provider information. Use TryGetProperty(string, out JsonElement) to safely access nested values.

[JsonPropertyName("serviceProviders")]
public JsonElement? ServiceProviders { get; init; }

Property Value

JsonElement?