2024-02-16 14:54:36 +00:00
|
|
|
package pkg
|
2024-02-16 14:16:50 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"git.dragse.it/anthrove/anthrove-graph-sdk.git/pkg/models"
|
|
|
|
)
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2024-02-16 15:16:57 +00:00
|
|
|
// AddUserWithRelationToSource uploads an Anthrove user to the graph
|
|
|
|
AddUserWithRelationToSource(ctx context.Context, anthroveUserID models.AnthroveUserID, sourceDomain string, userID string, username string) (*models.AnthroveUser, error)
|
2024-02-16 14:16:50 +00:00
|
|
|
|
2024-02-16 15:16:57 +00:00
|
|
|
// AddSource uploads an Anthrove source to the graph
|
|
|
|
AddSource(ctx context.Context, anthroveSource *models.AnthroveSource) error
|
2024-02-16 14:16:50 +00:00
|
|
|
|
2024-02-16 15:16:57 +00:00
|
|
|
// AddPost uploads an Anthrove post to the graph
|
|
|
|
AddPost(ctx context.Context, anthrovePost *models.AnthrovePost) error
|
2024-02-16 14:16:50 +00:00
|
|
|
|
2024-02-16 15:16:57 +00:00
|
|
|
// AddTagWithRelationToPost uploads a tag associated with an Anthrove post to the graph
|
|
|
|
AddTagWithRelationToPost(ctx context.Context, anthrovePostID *models.AnthrovePostID, anthroveTag *models.AnthroveTag) error
|
2024-02-16 14:16:50 +00:00
|
|
|
|
|
|
|
// LinkPostWithSource establishes a link between a post and a source in the graph
|
2024-02-16 16:21:26 +00:00
|
|
|
LinkPostWithSource(ctx context.Context, anthrovePostID models.AnthrovePostID, anthroveSourceDomain string, anthrovePostRelationship *models.AnthrovePostRelationship) error
|
2024-02-16 14:16:50 +00:00
|
|
|
|
|
|
|
// LinkUserWithPost establishes a link between a user and a post in the graph
|
|
|
|
LinkUserWithPost(ctx context.Context, anthroveUser *models.AnthroveUser, anthrovePost *models.AnthrovePost) error
|
|
|
|
|
2024-02-16 17:07:34 +00:00
|
|
|
// CheckUserPostLink checks if a link between a user and a post exists in the graph
|
|
|
|
CheckUserPostLink(ctx context.Context, anthroveUserID models.AnthroveUserID, sourcePostID string, sourcePostUrl string) (bool, error)
|
2024-02-16 14:16:50 +00:00
|
|
|
|
|
|
|
// 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)
|
|
|
|
}
|