internal static ToneReceivedEvent DeserializeToneReceivedEvent(JsonElement element)
        {
            Optional <ToneInfo> toneInfo  = default;
            Optional <string>   callLegId = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("toneInfo"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    toneInfo = ToneInfo.DeserializeToneInfo(property.Value);
                    continue;
                }
                if (property.NameEquals("callLegId"))
                {
                    callLegId = property.Value.GetString();
                    continue;
                }
            }
            return(new ToneReceivedEvent(toneInfo.Value, callLegId.Value));
        }
Exemplo n.º 2
0
        internal static ToneReceivedEvent DeserializeToneReceivedEvent(JsonElement element)
        {
            ToneInfo          toneInfo         = default;
            Optional <string> callConnectionId = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("toneInfo"))
                {
                    toneInfo = ToneInfo.DeserializeToneInfo(property.Value);
                    continue;
                }
                if (property.NameEquals("callConnectionId"))
                {
                    callConnectionId = property.Value.GetString();
                    continue;
                }
            }
            return(new ToneReceivedEvent(toneInfo, callConnectionId.Value));
        }