Table of Contents

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

reader Utf8JsonReader

The reader positioned at the value.

typeToConvert Type

The type being converted.

options JsonSerializerOptions

The 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

writer Utf8JsonWriter

The writer to write to.

value JobState

The value to write.

options JsonSerializerOptions

The serializer options.