internal static CreateChatThreadErrors DeserializeCreateChatThreadErrors(JsonElement element)
        {
            Optional <IReadOnlyList <CommunicationError> > invalidParticipants = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("invalidParticipants"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <CommunicationError> array = new List <CommunicationError>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(CommunicationError.DeserializeCommunicationError(item));
                        }
                    }
                    invalidParticipants = array;
                    continue;
                }
            }
            return(new CreateChatThreadErrors(Optional.ToList(invalidParticipants)));
        }
Ejemplo n.º 2
0
        internal static AddChatParticipantsErrors DeserializeAddChatParticipantsErrors(JsonElement element)
        {
            IReadOnlyList <CommunicationError> invalidParticipants = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("invalidParticipants"))
                {
                    List <CommunicationError> array = new List <CommunicationError>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(CommunicationError.DeserializeCommunicationError(item));
                        }
                    }
                    invalidParticipants = array;
                    continue;
                }
            }
            return(new AddChatParticipantsErrors(invalidParticipants));
        }
Ejemplo n.º 3
0
 internal CommunicationError(string code, string message, string target, IReadOnlyList <CommunicationError> details, CommunicationError innerError)
 {
     Code       = code;
     Message    = message;
     Target     = target;
     Details    = details;
     InnerError = innerError;
 }
        internal CommunicationErrorResponse(CommunicationError error)
        {
            if (error == null)
            {
                throw new ArgumentNullException(nameof(error));
            }

            Error = error;
        }
        internal static CommunicationErrorResponse DeserializeCommunicationErrorResponse(JsonElement element)
        {
            CommunicationError error = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("error"))
                {
                    error = CommunicationError.DeserializeCommunicationError(property.Value);
                    continue;
                }
            }
            return(new CommunicationErrorResponse(error));
        }