internal static DefaultErrorResponse DeserializeDefaultErrorResponse(XElement element)
        {
            DefaultErrorResponseError error = default;

            if (element.Element("error") is XElement errorElement)
            {
                error = DefaultErrorResponseError.DeserializeDefaultErrorResponseError(errorElement);
            }
            return(new DefaultErrorResponse(error));
        }
        internal static DefaultErrorResponse DeserializeDefaultErrorResponse(JsonElement element)
        {
            Optional <DefaultErrorResponseError> error = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("error"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    error = DefaultErrorResponseError.DeserializeDefaultErrorResponseError(property.Value);
                    continue;
                }
            }
            return(new DefaultErrorResponse(error.Value));
        }