コード例 #1
0
        internal static ApiListResultTaskStatusApiModel DeserializeApiListResultTaskStatusApiModel(JsonElement element)
        {
            Optional <long> count = default;
            Optional <IReadOnlyList <TaskStatusApiModel> > data = default;
            Optional <long> totalCount = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("count"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    count = property.Value.GetInt64();
                    continue;
                }
                if (property.NameEquals("data"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <TaskStatusApiModel> array = new List <TaskStatusApiModel>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(TaskStatusApiModel.DeserializeTaskStatusApiModel(item));
                    }
                    data = array;
                    continue;
                }
                if (property.NameEquals("totalCount"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    totalCount = property.Value.GetInt64();
                    continue;
                }
            }
            return(new ApiListResultTaskStatusApiModel(Optional.ToNullable(count), Optional.ToList(data), Optional.ToNullable(totalCount)));
        }
        internal static ApiResultTaskStatusApiModel DeserializeApiResultTaskStatusApiModel(JsonElement element)
        {
            Optional <TaskStatusApiModel> data = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("data"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    data = TaskStatusApiModel.DeserializeTaskStatusApiModel(property.Value);
                    continue;
                }
            }
            return(new ApiResultTaskStatusApiModel(data.Value));
        }
コード例 #3
0
        internal static ApiListResultTaskStatusApiModel DeserializeApiListResultTaskStatusApiModel(XElement element)
        {
            long?count      = default;
            long?totalCount = default;
            IReadOnlyList <TaskStatusApiModel> data = default;

            if (element.Element("count") is XElement countElement)
            {
                count = (long?)countElement;
            }
            if (element.Element("totalCount") is XElement totalCountElement)
            {
                totalCount = (long?)totalCountElement;
            }
            var array = new List <TaskStatusApiModel>();

            foreach (var e in element.Elements("TaskStatusApiModel"))
            {
                array.Add(TaskStatusApiModel.DeserializeTaskStatusApiModel(e));
            }
            data = array;
            return(new ApiListResultTaskStatusApiModel(count, data, totalCount));
        }