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/source.go
SoXX c242a2b57a refactor(model): changed types of model
Signed-off-by: SoXX <soxx@fenpa.ws>
2024-05-31 16:05:27 +02:00

31 lines
1.5 KiB
Go

package graph
import (
"context"
"git.dragse.it/anthrove/otter-space-sdk/pkg/models"
)
type Source interface {
// CreateSource will always create a new node, it checks if a node with the same url exits and merges it.
CreateSource(ctx context.Context, anthroveSource *models.AnthroveSource) error
// DeleteSource will delete a node with a given Domain
DeleteSource(ctx context.Context, anthroveSource *models.AnthroveSource) error
// GetSourceByURL returns the first models.AnthroveSource provided by the database
GetSourceByURL(ctx context.Context, sourceUrl models.AnthroveSourceDomain) (*models.AnthroveSource, error)
// GetSourceLinkForUser retrieves the links between a user and sources in the OtterSpace graph.
// It returns a map of source domains to user-source relationships, and an error if the operation fails.
GetSourceLinkForUser(ctx context.Context, anthroveUserID models.AnthroveUserID) (map[string]models.AnthroveUserRelationship, error)
// GetSourceLinkForSpecifiedUser GetSourceLinkForUser retrieves the links between a user and a specific source in the OtterSpace graph.
// It returns a map of source domains to user-source relationships, and an error if the operation fails.
GetSourceLinkForSpecifiedUser(ctx context.Context, anthroveUserID models.AnthroveUserID, sourceDisplayName models.AnthroveSourceDisplayName) (map[string]models.AnthroveUserRelationship, error)
// GetAllSources returns a list of Sources in the database
GetAllSources(ctx context.Context) ([]models.AnthroveSource, error)
}