internal static Model DeserializeModel(JsonElement element) { Guid modelId = default; DateTimeOffset createdTime = default; DateTimeOffset lastUpdatedTime = default; Optional <ModelInfo> modelInfo = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("modelId")) { modelId = property.Value.GetGuid(); continue; } if (property.NameEquals("createdTime")) { createdTime = property.Value.GetDateTimeOffset("O"); continue; } if (property.NameEquals("lastUpdatedTime")) { lastUpdatedTime = property.Value.GetDateTimeOffset("O"); continue; } if (property.NameEquals("modelInfo")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } modelInfo = ModelInfo.DeserializeModelInfo(property.Value); continue; } } return(new Model(modelId, createdTime, lastUpdatedTime, modelInfo.Value)); }
public static Model Model(Guid modelId = default, DateTimeOffset createdTime = default, DateTimeOffset lastUpdatedTime = default, ModelInfo modelInfo = null) { return(new Model(modelId, createdTime, lastUpdatedTime, modelInfo)); }
internal Model(Guid modelId, DateTimeOffset createdTime, DateTimeOffset lastUpdatedTime, ModelInfo modelInfo) { ModelId = modelId; CreatedTime = createdTime; LastUpdatedTime = lastUpdatedTime; ModelInfo = modelInfo; }