Пример #1
0
        internal static PhonePlanGroup DeserializePhonePlanGroup(JsonElement element)
        {
            string phonePlanGroupId = default;
            Optional <PhoneNumberType> phoneNumberType = default;
            string localizedName        = default;
            string localizedDescription = default;
            Optional <CarrierDetails>  carrierDetails  = default;
            Optional <RateInformation> rateInformation = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("phonePlanGroupId"))
                {
                    phonePlanGroupId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("phoneNumberType"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    phoneNumberType = new PhoneNumberType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("localizedName"))
                {
                    localizedName = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("localizedDescription"))
                {
                    localizedDescription = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("carrierDetails"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    carrierDetails = CarrierDetails.DeserializeCarrierDetails(property.Value);
                    continue;
                }
                if (property.NameEquals("rateInformation"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    rateInformation = RateInformation.DeserializeRateInformation(property.Value);
                    continue;
                }
            }
            return(new PhonePlanGroup(phonePlanGroupId, Optional.ToNullable(phoneNumberType), localizedName, localizedDescription, carrierDetails.Value, rateInformation.Value));
        }
Пример #2
0
 internal PhonePlanGroup(string phonePlanGroupId, PhoneNumberType?phoneNumberType, string localizedName, string localizedDescription, CarrierDetails carrierDetails, RateInformation rateInformation)
 {
     PhonePlanGroupId     = phonePlanGroupId;
     PhoneNumberType      = phoneNumberType;
     LocalizedName        = localizedName;
     LocalizedDescription = localizedDescription;
     CarrierDetails       = carrierDetails;
     RateInformation      = rateInformation;
 }