internal static DocumentStockControlledInfoApiModel DeserializeDocumentStockControlledInfoApiModel(XElement element) { DocumentStockControlledInfoApiModelDocumentType?documentType = default; long? id = default; string number = default; if (element.Element("documentType") is XElement documentTypeElement) { documentType = new DocumentStockControlledInfoApiModelDocumentType(documentTypeElement.Value); } if (element.Element("id") is XElement idElement) { id = (long?)idElement; } if (element.Element("number") is XElement numberElement) { number = (string)numberElement; } return(new DocumentStockControlledInfoApiModel(documentType, id, number)); }
internal static DocumentStockControlledInfoApiModel DeserializeDocumentStockControlledInfoApiModel(JsonElement element) { Optional <DocumentStockControlledInfoApiModelDocumentType> documentType = default; Optional <long> id = default; Optional <string> number = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("documentType")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } documentType = new DocumentStockControlledInfoApiModelDocumentType(property.Value.GetString()); continue; } if (property.NameEquals("id")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } id = property.Value.GetInt64(); continue; } if (property.NameEquals("number")) { number = property.Value.GetString(); continue; } } return(new DocumentStockControlledInfoApiModel(Optional.ToNullable(documentType), Optional.ToNullable(id), number.Value)); }