Class JobStateConverter
- Namespace
- GenerativeAI.Types
- Assembly
- GenerativeAI.dll
JSON converter for JobState that handles both BATCH_STATE_* and JOB_STATE_* formats. Google AI uses BATCH_STATE_* which is converted to JOB_STATE_* for consistency.
public class JobStateConverter : JsonConverter<JobState>
- Inheritance
-
JobStateConverter
- Inherited Members
- Extension Methods
Methods
Read(ref Utf8JsonReader, Type, JsonSerializerOptions)
Reads a JobState value, accepting both BATCH_STATE_* and JOB_STATE_* names.
public override JobState Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
Parameters
readerUtf8JsonReaderThe reader positioned at the value.
typeToConvertTypeThe type being converted.
optionsJsonSerializerOptionsThe serializer options.
Returns
- JobState
The parsed state, or JOB_STATE_UNSPECIFIED for unknown values.
Write(Utf8JsonWriter, JobState, JsonSerializerOptions)
Writes a JobState value as its JOB_STATE_* name.
public override void Write(Utf8JsonWriter writer, JobState value, JsonSerializerOptions options)
Parameters
writerUtf8JsonWriterThe writer to write to.
valueJobStateThe value to write.
optionsJsonSerializerOptionsThe serializer options.