Example #1
0
        OrderItemResource IOperationSource <OrderItemResource> .CreateResult(Response response, CancellationToken cancellationToken)
        {
            using var document = JsonDocument.Parse(response.ContentStream);
            var data = OrderItemResourceData.DeserializeOrderItemResourceData(document.RootElement);

            return(new OrderItemResource(_armClient, data));
        }
Example #2
0
        internal static OrderItemResourceList DeserializeOrderItemResourceList(JsonElement element)
        {
            Optional <IReadOnlyList <OrderItemResourceData> > value = default;
            Optional <string> nextLink = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("value"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <OrderItemResourceData> array = new List <OrderItemResourceData>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(OrderItemResourceData.DeserializeOrderItemResourceData(item));
                    }
                    value = array;
                    continue;
                }
                if (property.NameEquals("nextLink"))
                {
                    nextLink = property.Value.GetString();
                    continue;
                }
            }
            return(new OrderItemResourceList(Optional.ToList(value), nextLink.Value));
        }