subscriptions

package
v0.0.0-...-9831a62 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2021 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAlreadyExists                = fmt.Errorf("subscription already exists")
	ErrFailedToDownloadSubscription = fmt.Errorf("failed to download subscription")
	ErrFailedToParseSubscription    = fmt.Errorf("failed to parse subscription")
)

Known errors.

Functions

This section is empty.

Types

type Config

type Config struct {
	Update *updateConfig `yaml:"update"`
}

Config is a subscriptions service configuration.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service allows to manage subscriptions resource.

func NewService

func NewService(db *sql.DB, crawler crawler, logger logger, cfg *Config, itemsService itemsService) *Service

NewService returns new subscriptions service.

func (*Service) Create

func (s *Service) Create(ctx context.Context, userID string, url *url.URL, tagIDs []string) (*Subscription, error)

Create creates a subscription from URL.

func (*Service) Get

func (s *Service) Get(ctx context.Context, id string, userID string) (*Subscription, error)

Get returns a subscription by it's id.

func (*Service) List

func (s *Service) List(ctx context.Context, userID string, pageSize int, createdLT *time.Time) ([]*Subscription, error)

List returns a list of user subscriptions.

func (*Service) Shutdown

func (s *Service) Shutdown(ctx context.Context) error

Shutdown stops background subscriptions updates.

func (*Service) Start

func (s *Service) Start(ctx context.Context) error

Start starts background subscriptions updates.

type Subscription

type Subscription struct {
	ID      string       `json:"id"`
	URL     string       `json:"url"`
	Title   string       `json:"title"`
	Created time.Time    `json:"created"`
	Updated *time.Time   `json:"updated,omitempty"`
	IconURL *string      `json:"icon_url,omitempty"`
	TagIDs  stringsArray `json:"tag_ids"`
}

Subscription is the subscription model.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL