示例#1
0
        private bool EdgeFilter(NotionObject source, string propertyName, OneToManyRelationPropertyValue relationPropertyValue)
        {
            if (source is not PageObject page)
            {
                return(false);
            }

            if (!page.Container.HasValue)
            {
                return(false);
            }

            if (page.Container.Value is not DatabaseObject databaseContainer)
            {
                return(false);
            }

            if (!_edgeDirections.TryGetValue(databaseContainer.Id, out var acceptedTargets))
            {
                return(false);
            }

            if (!relationPropertyValue.Configuration.HasValue)
            {
                return(false);
            }

            if (relationPropertyValue.Configuration.Value is not RelationPropertyConfiguration relationPropertyConfiguration)
            {
                return(false);
            }

            var containerId = relationPropertyConfiguration.Configuration.DatabaseId;

            return(containerId != null &&
                   acceptedTargets.Any(ed =>
                                       ed.TargetContainer == containerId &&
                                       (ed.PropertyName is null || ed.PropertyName == propertyName)));
        }
示例#2
0
 private static bool NodeFilter(NotionObject node) =>
 node is PageObject;