internal DetectionResultSummary(DetectionStatus status, IReadOnlyList <ErrorResponse> errors, IReadOnlyList <VariableState> variableStates, DetectionRequest setupInfo) { Status = status; Errors = errors; VariableStates = variableStates; SetupInfo = setupInfo; }
internal DetectionResultSummary(DetectionStatus status, DetectionRequest setupInfo) { if (setupInfo == null) { throw new ArgumentNullException(nameof(setupInfo)); } Status = status; Errors = new ChangeTrackingList <ErrorResponse>(); VariableStates = new ChangeTrackingList <VariableState>(); SetupInfo = setupInfo; }
internal static DetectionResultSummary DeserializeDetectionResultSummary(JsonElement element) { DetectionStatus status = default; Optional <IReadOnlyList <ErrorResponse> > errors = default; Optional <IReadOnlyList <VariableState> > variableStates = default; DetectionRequest setupInfo = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status")) { status = property.Value.GetString().ToDetectionStatus(); continue; } if (property.NameEquals("errors")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <ErrorResponse> array = new List <ErrorResponse>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(ErrorResponse.DeserializeErrorResponse(item)); } errors = array; continue; } if (property.NameEquals("variableStates")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <VariableState> array = new List <VariableState>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(VariableState.DeserializeVariableState(item)); } variableStates = array; continue; } if (property.NameEquals("setupInfo")) { setupInfo = DetectionRequest.DeserializeDetectionRequest(property.Value); continue; } } return(new DetectionResultSummary(status, Optional.ToList(errors), Optional.ToList(variableStates), setupInfo)); }
public static DetectionResultSummary DetectionResultSummary(DetectionStatus status = default, IEnumerable <ErrorResponse> errors = null, IEnumerable <VariableState> variableStates = null, DetectionRequest setupInfo = null) { errors ??= new List <ErrorResponse>(); variableStates ??= new List <VariableState>(); return(new DetectionResultSummary(status, errors?.ToList(), variableStates?.ToList(), setupInfo)); }