internal static RestError DeserializeRestError(JsonElement element) { Optional <ErrorData> error = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("error")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } error = ErrorData.DeserializeErrorData(property.Value); continue; } } return(new RestError(error.Value)); }
internal static JobDetails DeserializeJobDetails(JsonElement element) { Optional <string> id = default; Optional <string> name = default; string containerUri = default; Optional <string> inputDataUri = default; string inputDataFormat = default; Optional <object> inputParams = default; string providerId = default; string target = default; Optional <IDictionary <string, string> > metadata = default; Optional <string> outputDataUri = default; Optional <string> outputDataFormat = default; Optional <JobStatus> status = default; Optional <DateTimeOffset> creationTime = default; Optional <DateTimeOffset?> beginExecutionTime = default; Optional <DateTimeOffset?> endExecutionTime = default; Optional <DateTimeOffset?> cancellationTime = default; Optional <ErrorData> errorData = 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("containerUri")) { containerUri = property.Value.GetString(); continue; } if (property.NameEquals("inputDataUri")) { inputDataUri = property.Value.GetString(); continue; } if (property.NameEquals("inputDataFormat")) { inputDataFormat = property.Value.GetString(); continue; } if (property.NameEquals("inputParams")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } inputParams = property.Value.GetObject(); continue; } if (property.NameEquals("providerId")) { providerId = property.Value.GetString(); continue; } if (property.NameEquals("target")) { target = property.Value.GetString(); continue; } if (property.NameEquals("metadata")) { if (property.Value.ValueKind == JsonValueKind.Null) { metadata = null; continue; } Dictionary <string, string> dictionary = new Dictionary <string, string>(); foreach (var property0 in property.Value.EnumerateObject()) { dictionary.Add(property0.Name, property0.Value.GetString()); } metadata = dictionary; continue; } if (property.NameEquals("outputDataUri")) { outputDataUri = property.Value.GetString(); continue; } if (property.NameEquals("outputDataFormat")) { outputDataFormat = property.Value.GetString(); continue; } if (property.NameEquals("status")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } status = new JobStatus(property.Value.GetString()); continue; } if (property.NameEquals("creationTime")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } creationTime = property.Value.GetDateTimeOffset("O"); continue; } if (property.NameEquals("beginExecutionTime")) { if (property.Value.ValueKind == JsonValueKind.Null) { beginExecutionTime = null; continue; } beginExecutionTime = property.Value.GetDateTimeOffset("O"); continue; } if (property.NameEquals("endExecutionTime")) { if (property.Value.ValueKind == JsonValueKind.Null) { endExecutionTime = null; continue; } endExecutionTime = property.Value.GetDateTimeOffset("O"); continue; } if (property.NameEquals("cancellationTime")) { if (property.Value.ValueKind == JsonValueKind.Null) { cancellationTime = null; continue; } cancellationTime = property.Value.GetDateTimeOffset("O"); continue; } if (property.NameEquals("errorData")) { if (property.Value.ValueKind == JsonValueKind.Null) { errorData = null; continue; } errorData = ErrorData.DeserializeErrorData(property.Value); continue; } } return(new JobDetails(id.Value, name.Value, containerUri, inputDataUri.Value, inputDataFormat, inputParams.Value, providerId, target, Optional.ToDictionary(metadata), outputDataUri.Value, outputDataFormat.Value, Optional.ToNullable(status), Optional.ToNullable(creationTime), Optional.ToNullable(beginExecutionTime), Optional.ToNullable(endExecutionTime), Optional.ToNullable(cancellationTime), errorData.Value)); }