Documentation
¶
Index ¶
- type ArticleService
- func (s *ArticleService) FetchAndSaveArticles(ctx context.Context, feedID uint) ([]*models.Article, error)
- func (s *ArticleService) GetArticleByID(ctx context.Context, userID, articleID uint) (*models.Article, error)
- func (s *ArticleService) HandleArticleProcessed(ctx context.Context, event *article_eventspb.ArticleProcessedEvent) error
- func (s *ArticleService) ListArticlesByFeedID(ctx context.Context, userID, feedID uint) ([]*models.Article, error)
- func (s *ArticleService) ListArticlesToCheck(ctx context.Context, publishedSince, lastCheckedBefore time.Time, pageSize int, ...) ([]repository.ArticleCheckCandidate, string, error)
- type ArticleServiceInterface
- type ArticleUpdateChecker
- type ArticleUpdateConfig
- type BatchSubscribeResult
- type FeedService
- func (s *FeedService) AddFeedByURL(ctx context.Context, url string) (*models.Feed, error)
- func (s *FeedService) BatchSubscribeToFeeds(ctx context.Context, userID uint, urls []string) ([]BatchSubscribeResult, error)
- func (s *FeedService) IsUserSubscribed(ctx context.Context, userID, feedID uint) (bool, error)
- func (s *FeedService) ListAllFeeds(ctx context.Context) ([]*models.Feed, error)
- func (s *FeedService) ListUserFeeds(ctx context.Context, userID uint) ([]*models.UserFeed, error)
- func (s *FeedService) SubscribeToFeed(ctx context.Context, userID uint, url string) (*models.Feed, error)
- func (s *FeedService) UnsubscribeFromFeed(ctx context.Context, userID, feedID uint) error
- func (s *FeedService) UpdateFeedCustomTitle(ctx context.Context, userID, feedID uint, customTitle *string) (*models.UserFeed, error)
- type FeedServiceInterface
- type RobotsClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArticleService ¶
type ArticleService struct {
// contains filtered or unexported fields
}
func NewArticleService ¶
func NewArticleService(feedRepo *repository.FeedRepository, articleRepo *repository.ArticleRepository, eventProducer events.ArticleEventProducer, logger *slog.Logger) *ArticleService
func (*ArticleService) FetchAndSaveArticles ¶
func (*ArticleService) GetArticleByID ¶
func (*ArticleService) HandleArticleProcessed ¶
func (s *ArticleService) HandleArticleProcessed(ctx context.Context, event *article_eventspb.ArticleProcessedEvent) error
HandleArticleProcessed handles an ArticleProcessedEvent by updating the article with AI data
func (*ArticleService) ListArticlesByFeedID ¶
func (*ArticleService) ListArticlesToCheck ¶
func (s *ArticleService) ListArticlesToCheck(ctx context.Context, publishedSince, lastCheckedBefore time.Time, pageSize int, pageToken string) ([]repository.ArticleCheckCandidate, string, error)
type ArticleServiceInterface ¶
type ArticleServiceInterface interface {
FetchAndSaveArticles(ctx context.Context, feedID uint) ([]*models.Article, error)
ListArticlesByFeedID(ctx context.Context, userID, feedID uint) ([]*models.Article, error)
GetArticleByID(ctx context.Context, userID, articleID uint) (*models.Article, error)
HandleArticleProcessed(ctx context.Context, event *article_eventspb.ArticleProcessedEvent) error
ListArticlesToCheck(ctx context.Context, publishedSince, lastCheckedBefore time.Time, pageSize int, pageToken string) ([]repository.ArticleCheckCandidate, string, error)
}
type ArticleUpdateChecker ¶
type ArticleUpdateChecker struct {
// contains filtered or unexported fields
}
func NewArticleUpdateChecker ¶
func NewArticleUpdateChecker(repo *repository.ArticleRepository, logger *slog.Logger, httpClient *http.Client, robots *RobotsClient, cfg ArticleUpdateConfig) *ArticleUpdateChecker
func (*ArticleUpdateChecker) HandleEvent ¶
func (c *ArticleUpdateChecker) HandleEvent(ctx context.Context, event events.ArticleCheckEvent) error
type ArticleUpdateConfig ¶
type BatchSubscribeResult ¶
BatchSubscribeResult represents the result of a single feed subscription attempt
type FeedService ¶
type FeedService struct {
// contains filtered or unexported fields
}
func NewFeedService ¶
func NewFeedService(repo *repository.FeedRepository, logger *slog.Logger, producer events.Producer) *FeedService
NewFeedService creates a FeedService. Producer can be nil (sync mode).
func (*FeedService) AddFeedByURL ¶
func (*FeedService) BatchSubscribeToFeeds ¶
func (s *FeedService) BatchSubscribeToFeeds(ctx context.Context, userID uint, urls []string) ([]BatchSubscribeResult, error)
BatchSubscribeToFeeds subscribes a user to multiple feeds in a single batch operation.
func (*FeedService) IsUserSubscribed ¶
IsUserSubscribed check if a user is subscribed to a feed
func (*FeedService) ListAllFeeds ¶
func (*FeedService) ListUserFeeds ¶
func (*FeedService) SubscribeToFeed ¶
func (*FeedService) UnsubscribeFromFeed ¶
func (s *FeedService) UnsubscribeFromFeed(ctx context.Context, userID, feedID uint) error
func (*FeedService) UpdateFeedCustomTitle ¶
type FeedServiceInterface ¶
type FeedServiceInterface interface {
AddFeedByURL(ctx context.Context, url string) (*models.Feed, error)
ListAllFeeds(ctx context.Context) ([]*models.Feed, error)
SubscribeToFeed(ctx context.Context, userID uint, url string) (*models.Feed, error)
BatchSubscribeToFeeds(ctx context.Context, userID uint, urls []string) ([]BatchSubscribeResult, error)
ListUserFeeds(ctx context.Context, userID uint) ([]*models.UserFeed, error)
UnsubscribeFromFeed(ctx context.Context, userID, feedID uint) error
IsUserSubscribed(ctx context.Context, userID, feedID uint) (bool, error)
UpdateFeedCustomTitle(ctx context.Context, userID, feedID uint, customTitle *string) (*models.UserFeed, error)
}
type RobotsClient ¶
type RobotsClient struct {
// contains filtered or unexported fields
}
func NewRobotsClient ¶
Click to show internal directories.
Click to hide internal directories.