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
JobIdGuidThe unique job identifier. Maps to JSON property "jobId".
CostdecimalThe Buzz cost incurred for this job. Maps to JSON property "cost".
ResultJobResultThe result information for this job. Maps to JSON property "result".
ScheduledboolIndicates 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.
PropertiesIReadOnlyDictionary<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.
ServiceProvidersJsonElement?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.
Positionint?The queue position when the job is waiting. Maps to JSON property "position".
JobJsonElement?Optional job definition payload. Maps to JSON property "job". This is returned when queries are performed with the "detailed" flag.
LastEventJobEventThe 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
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
JobId
The unique job identifier. Maps to JSON property "jobId".
[JsonPropertyName("jobId")]
public Guid JobId { get; init; }
Property Value
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
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
Result
The result information for this job. Maps to JSON property "result".
[JsonPropertyName("result")]
public JobResult? Result { get; init; }
Property Value
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
ServiceProviderStatuses
Attempts to parse ServiceProviders into a strongly-typed dictionary.
[JsonIgnore]
public IReadOnlyDictionary<string, ProviderJobStatus> ServiceProviderStatuses { get; }
Property Value
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; }