This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
otter-space-sdk/pkg/graph.go

56 lines
3.0 KiB
Go

package pkg
import (
"context"
"git.dragse.it/anthrove/anthrove-graph-sdk.git/pkg/models"
"github.com/neo4j/neo4j-go-driver/v5/neo4j"
)
type Graph interface {
// Connect sets up a connection to the endpoint using the provided username and password
Connect(ctx context.Context, endpoint string, username string, password string) error
// AddUserToGraph uploads an Anthrove user to the graph
AddUserToGraph(ctx context.Context, driver neo4j.DriverWithContext, anthroveUserID models.AnthroveUserID, sourceDomain string, userID string, username string) (*models.AnthroveUser, error)
// AddSourceToGraph uploads an Anthrove source to the graph
AddSourceToGraph(ctx context.Context, anthroveSource *models.AnthroveSource) error
// AddPostToGraph uploads an Anthrove post to the graph
AddPostToGraph(ctx context.Context, anthrovePost *models.AnthrovePost) error
// AddTagToGraph uploads a tag associated with an Anthrove post to the graph
AddTagToGraph(ctx context.Context, anthrovePost *models.AnthrovePost, anthroveTag *models.AnthroveTag) error
// LinkPostWithSource establishes a link between a post and a source in the graph
LinkPostWithSource(ctx context.Context, anthrovePost *models.AnthrovePost, anthrovePostRelationship *models.AnthrovePostRelationship, anthroveSource *models.AnthroveSource) error
// LinkUserWithPost establishes a link between a user and a post in the graph
LinkUserWithPost(ctx context.Context, anthroveUser *models.AnthroveUser, anthrovePost *models.AnthrovePost) error
// VerifyUserPostLink checks if a link between a user and a post exists in the graph
VerifyUserPostLink(ctx context.Context, anthrovePost *models.AnthrovePost, anthroveUser *models.AnthroveUser) (bool, error)
// CheckPostNodeExistsByAnthroveID checks if an Anthrove post node exists in the graph by its Anthrove ID
CheckPostNodeExistsByAnthroveID(ctx context.Context, anthrovePost *models.AnthrovePost) (bool, error)
// CheckPostNodeExistsBySourceURL checks if an Anthrove post node exists in the graph by its source URL
CheckPostNodeExistsBySourceURL(ctx context.Context, anthroveSource *models.AnthroveSource) (bool, error)
// CheckPostNodeExistsBySourceID checks if an Anthrove post node exists in the graph by its source ID
CheckPostNodeExistsBySourceID(ctx context.Context, anthroveSource *models.AnthroveSource) (bool, error)
// GetUserFavoriteCount retrieves the count of user's favorite posts
GetUserFavoriteCount(ctx context.Context, anthroveUser *models.AnthroveUser) (int64, error)
// GetUserSourceLinks retrieves the links between a user and sources in the graph
GetUserSourceLinks(ctx context.Context, anthroveUser *models.AnthroveUser) (map[string]models.AnthroveUserRelationship, error)
// GetAnthroveUser retrieves an Anthrove user from the graph by their ID
GetAnthroveUser(ctx context.Context, anthroveUser *models.AnthroveUser) (*models.AnthroveUser, error)
// GetAllAnthroveUserIDs retrieves all Anthrove user IDs from the graph
GetAllAnthroveUserIDs(ctx context.Context) ([]models.AnthroveUserID, error)
}