Esempio n. 1
0
        internal static TimeSeriesHierarchyOrError DeserializeTimeSeriesHierarchyOrError(JsonElement element)
        {
            Optional <TimeSeriesHierarchy>      hierarchy = default;
            Optional <TimeSeriesOperationError> error     = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("hierarchy"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    hierarchy = TimeSeriesHierarchy.DeserializeTimeSeriesHierarchy(property.Value);
                    continue;
                }
                if (property.NameEquals("error"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    error = TimeSeriesOperationError.DeserializeTimeSeriesOperationError(property.Value);
                    continue;
                }
            }
            return(new TimeSeriesHierarchyOrError(hierarchy.Value, error.Value));
        }
        internal static GetHierarchiesPage DeserializeGetHierarchiesPage(JsonElement element)
        {
            Optional <IReadOnlyList <TimeSeriesHierarchy> > hierarchies = default;
            Optional <string> continuationToken = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("hierarchies"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <TimeSeriesHierarchy> array = new List <TimeSeriesHierarchy>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(TimeSeriesHierarchy.DeserializeTimeSeriesHierarchy(item));
                    }
                    hierarchies = array;
                    continue;
                }
                if (property.NameEquals("continuationToken"))
                {
                    continuationToken = property.Value.GetString();
                    continue;
                }
            }
            return(new GetHierarchiesPage(continuationToken.Value, Optional.ToList(hierarchies)));
        }
Esempio n. 3
0
 public static TimeSeriesHierarchyOperationResult TimeSeriesHierarchyOperationResult(TimeSeriesHierarchy hierarchy = default, TimeSeriesOperationError error = default)
 {
     return(new TimeSeriesHierarchyOperationResult(hierarchy, error));
 }