Esempio n. 1
0
        internal static MediaInput DeserializeMediaInput(JsonElement element)
        {
            Optional <GroupCall>        groupCall    = default;
            Optional <GroupCall>        room         = default;
            Optional <TeamsMeeting>     teamsMeeting = default;
            Optional <RtmpStream>       rtmp         = default;
            Optional <SrtStream>        srt          = default;
            Optional <ParticipantInput> participant  = default;
            Optional <CommunicationCallIdentifierModel> activePresenter = default;
            Optional <CommunicationCallIdentifierModel> dominantSpeaker = default;
            Optional <CommunicationCallIdentifierModel> screenShare     = default;
            Optional <ImageInput>     image = default;
            Optional <MediaInputType> kind  = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("groupCall"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    groupCall = GroupCall.DeserializeGroupCall(property.Value);
                    continue;
                }
                if (property.NameEquals("room"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    room = GroupCall.DeserializeGroupCall(property.Value);
                    continue;
                }
                if (property.NameEquals("teamsMeeting"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    teamsMeeting = TeamsMeeting.DeserializeTeamsMeeting(property.Value);
                    continue;
                }
                if (property.NameEquals("rtmp"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    rtmp = RtmpStream.DeserializeRtmpStream(property.Value);
                    continue;
                }
                if (property.NameEquals("srt"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    srt = SrtStream.DeserializeSrtStream(property.Value);
                    continue;
                }
                if (property.NameEquals("participant"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    participant = ParticipantInput.DeserializeParticipantInput(property.Value);
                    continue;
                }
                if (property.NameEquals("activePresenter"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    activePresenter = CommunicationCallIdentifierModel.DeserializeCommunicationCallIdentifierModel(property.Value);
                    continue;
                }
                if (property.NameEquals("dominantSpeaker"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    dominantSpeaker = CommunicationCallIdentifierModel.DeserializeCommunicationCallIdentifierModel(property.Value);
                    continue;
                }
                if (property.NameEquals("screenShare"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    screenShare = CommunicationCallIdentifierModel.DeserializeCommunicationCallIdentifierModel(property.Value);
                    continue;
                }
                if (property.NameEquals("image"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    image = ImageInput.DeserializeImageInput(property.Value);
                    continue;
                }
                if (property.NameEquals("kind"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    kind = new MediaInputType(property.Value.GetString());
                    continue;
                }
            }
            return(new MediaInput(groupCall.Value, room.Value, teamsMeeting.Value, rtmp.Value, srt.Value, participant.Value, activePresenter.Value, dominantSpeaker.Value, screenShare.Value, image.Value, Optional.ToNullable(kind)));
        }
Esempio n. 2
0
        internal static MediaOutput DeserializeMediaOutput(JsonElement element)
        {
            Optional <GroupCall>       groupCall    = default;
            Optional <GroupCall>       room         = default;
            Optional <TeamsMeeting>    teamsMeeting = default;
            Optional <RtmpStream>      rtmp         = default;
            Optional <SrtStream>       srt          = default;
            Optional <MediaOutputType> kind         = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("groupCall"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    groupCall = GroupCall.DeserializeGroupCall(property.Value);
                    continue;
                }
                if (property.NameEquals("room"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    room = GroupCall.DeserializeGroupCall(property.Value);
                    continue;
                }
                if (property.NameEquals("teamsMeeting"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    teamsMeeting = TeamsMeeting.DeserializeTeamsMeeting(property.Value);
                    continue;
                }
                if (property.NameEquals("rtmp"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    rtmp = RtmpStream.DeserializeRtmpStream(property.Value);
                    continue;
                }
                if (property.NameEquals("srt"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    srt = SrtStream.DeserializeSrtStream(property.Value);
                    continue;
                }
                if (property.NameEquals("kind"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    kind = new MediaOutputType(property.Value.GetString());
                    continue;
                }
            }
            return(new MediaOutput(groupCall.Value, room.Value, teamsMeeting.Value, rtmp.Value, srt.Value, Optional.ToNullable(kind)));
        }