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/graph.go

55 lines
3.0 KiB
Go
Raw Normal View History

2024-02-16 21:05:11 +00:00
package graph
2024-02-16 14:16:50 +00:00
import (
"context"
2024-02-16 20:51:09 +00:00
"git.dragse.it/anthrove/otter-space-sdk/pkg/models"
2024-02-16 14:16:50 +00:00
)
type OtterSpace interface {
2024-02-16 14:16:50 +00:00
// 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
// 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
// AddSource uploads an Anthrove source to the graph
AddSource(ctx context.Context, anthroveSource *models.AnthroveSource) error
2024-02-16 14:16:50 +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
// 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
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
// CheckUserPostLink checks if a link between a user and a post exists in the graph
CheckUserPostLink(ctx context.Context, anthroveUserID models.AnthroveUserID, sourcePostID string, sourceUrl 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
2024-02-16 20:19:27 +00:00
CheckPostNodeExistsByAnthroveID(ctx context.Context, anthrovePost *models.AnthrovePost) (*models.AnthrovePost, bool, error)
2024-02-16 14:16:50 +00:00
// CheckPostNodeExistsBySourceURL checks if an Anthrove post node exists in the graph by its source URL
2024-02-16 20:19:27 +00:00
CheckPostNodeExistsBySourceURL(ctx context.Context, sourceUrl string) (*models.AnthrovePost, bool, error)
2024-02-16 14:16:50 +00:00
// CheckPostNodeExistsBySourceID checks if an Anthrove post node exists in the graph by its source ID
2024-02-16 20:19:27 +00:00
CheckPostNodeExistsBySourceID(ctx context.Context, sourcePostID string) (*models.AnthrovePost, bool, error)
2024-02-16 14:16:50 +00:00
// GetUserFavoriteCount retrieves the count of user's favorite posts
GetUserFavoriteCount(ctx context.Context, anthroveUserID models.AnthroveUserID) (int64, error)
2024-02-16 14:16:50 +00:00
// GetUserSourceLinks retrieves the links between a user and sources in the graph
2024-02-16 20:33:46 +00:00
GetUserSourceLinks(ctx context.Context, anthroveUserID models.AnthroveUserID) (map[string]models.AnthroveUserRelationship, error)
2024-02-16 14:16:50 +00:00
// GetAnthroveUser retrieves an Anthrove user from the graph by their ID
GetAnthroveUser(ctx context.Context, anthroveUserID models.AnthroveUserID) (*models.AnthroveUser, error)
2024-02-16 14:16:50 +00:00
// GetAllAnthroveUserIDs retrieves all Anthrove user IDs from the graph
GetAllAnthroveUserIDs(ctx context.Context) ([]models.AnthroveUserID, error)
}