Exemplo n.º 1
0
        internal static ApiListResultUserCompanyInfoApiModel DeserializeApiListResultUserCompanyInfoApiModel(JsonElement element)
        {
            Optional <long> count = default;
            Optional <IReadOnlyList <UserCompanyInfoApiModel> > 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 <UserCompanyInfoApiModel> array = new List <UserCompanyInfoApiModel>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(UserCompanyInfoApiModel.DeserializeUserCompanyInfoApiModel(item));
                    }
                    data = array;
                    continue;
                }
                if (property.NameEquals("totalCount"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    totalCount = property.Value.GetInt64();
                    continue;
                }
            }
            return(new ApiListResultUserCompanyInfoApiModel(Optional.ToNullable(count), Optional.ToList(data), Optional.ToNullable(totalCount)));
        }
Exemplo n.º 2
0
        internal static ApiListResultUserCompanyInfoApiModel DeserializeApiListResultUserCompanyInfoApiModel(XElement element)
        {
            long?count      = default;
            long?totalCount = default;
            IReadOnlyList <UserCompanyInfoApiModel> 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 <UserCompanyInfoApiModel>();

            foreach (var e in element.Elements("UserCompanyInfoApiModel"))
            {
                array.Add(UserCompanyInfoApiModel.DeserializeUserCompanyInfoApiModel(e));
            }
            data = array;
            return(new ApiListResultUserCompanyInfoApiModel(count, data, totalCount));
        }