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/post.go
SoXX fc73377d86 chore(post): code & folder restructure
Signed-off-by: SoXX <soxx@fenpa.ws>
2024-05-31 15:08:24 +02:00

32 lines
1.7 KiB
Go

package graph
import (
"context"
"git.dragse.it/anthrove/otter-space-sdk/pkg/models"
)
type Post interface {
// CreatePost will always create a new node, it does not check if the node with the corresponding post_id and rating exists.
CreatePost(ctx context.Context, anthrovePost *models.AnthrovePost) error
// DeletePost will always delete a node, it only needs the anthrovePost.PostID filled out.
DeletePost(ctx context.Context, anthrovePost *models.AnthrovePost) error
// CheckPostNodeExistsBySourceID checks if a post node exists in the OtterSpace graph by its source ID.
// It returns the post if it exists, a boolean indicating whether the post was found, and an error if the operation fails.
CheckPostNodeExistsBySourceID(ctx context.Context, sourcePostID string) (*models.AnthrovePost, bool, error)
// CheckPostNodeExistsByAnthroveID checks if a post node exists in the OtterSpace graph by its Anthrove ID.
// It returns the post if it exists, a boolean indicating whether the post was found, and an error if the operation fails.
CheckPostNodeExistsByAnthroveID(ctx context.Context, anthrovePost *models.AnthrovePost) (*models.AnthrovePost, bool, error)
// CheckPostNodeExistsBySourceURL checks if a post node exists in the OtterSpace graph by its source URL.
// It returns the post if it exists, a boolean indicating whether the post was found, and an error if the operation fails.
CheckPostNodeExistsBySourceURL(ctx context.Context, sourceUrl string) (*models.AnthrovePost, bool, error)
// LinkPostWithSource establishes a link between a post and a source in the OtterSpace graph.
LinkPostWithSource(ctx context.Context, anthrovePostID models.AnthrovePostID, anthroveSourceDomain string, anthrovePostRelationship *models.AnthrovePostRelationship) error
}