internal LabelingJobResource(string id, string name, string type, LabelingJob properties, SystemData systemData) { Id = id; Name = name; Type = type; Properties = properties; SystemData = systemData; }
public LabelingJobResource(LabelingJob properties) { if (properties == null) { throw new ArgumentNullException(nameof(properties)); } Properties = properties; }
internal static LabelingJobResource DeserializeLabelingJobResource(JsonElement element) { Optional <string> id = default; Optional <string> name = default; Optional <string> type = default; LabelingJob properties = default; Optional <SystemData> systemData = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id")) { id = property.Value.GetString(); continue; } if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("type")) { type = property.Value.GetString(); continue; } if (property.NameEquals("properties")) { properties = LabelingJob.DeserializeLabelingJob(property.Value); continue; } if (property.NameEquals("systemData")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } systemData = SystemData.DeserializeSystemData(property.Value); continue; } } return(new LabelingJobResource(id.Value, name.Value, type.Value, properties, systemData.Value)); }
internal static JobBase DeserializeJobBase(JsonElement element) { if (element.TryGetProperty("jobType", out JsonElement discriminator)) { switch (discriminator.GetString()) { case "Command": return(CommandJob.DeserializeCommandJob(element)); case "ComputeJobBase": return(ComputeJobBase.DeserializeComputeJobBase(element)); case "Labeling": return(LabelingJob.DeserializeLabelingJob(element)); case "Sweep": return(SweepJob.DeserializeSweepJob(element)); } } JobType jobType = default; Optional <JobBaseInteractionEndpoints> interactionEndpoints = default; Optional <string> description = default; Optional <IDictionary <string, string> > tags = default; Optional <IDictionary <string, string> > properties = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("jobType")) { jobType = new JobType(property.Value.GetString()); continue; } if (property.NameEquals("interactionEndpoints")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } interactionEndpoints = JobBaseInteractionEndpoints.DeserializeJobBaseInteractionEndpoints(property.Value); continue; } if (property.NameEquals("description")) { description = property.Value.GetString(); continue; } if (property.NameEquals("tags")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } Dictionary <string, string> dictionary = new Dictionary <string, string>(); foreach (var property0 in property.Value.EnumerateObject()) { dictionary.Add(property0.Name, property0.Value.GetString()); } tags = dictionary; continue; } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } Dictionary <string, string> dictionary = new Dictionary <string, string>(); foreach (var property0 in property.Value.EnumerateObject()) { dictionary.Add(property0.Name, property0.Value.GetString()); } properties = dictionary; continue; } } return(new JobBase(jobType, interactionEndpoints.Value, description.Value, Optional.ToDictionary(tags), Optional.ToDictionary(properties))); }