Documentation ¶
Overview ¶
Package bookmarks provides ways to interact with the bookmarks, such as adding a new bookmark
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotAuthorized = errors.New("user does not have permission to create bookmark on collection")
ErrNotAuthorized an error when user is not authorized to perform an action
Functions ¶
Types ¶
type Bookmark ¶
type Bookmark struct { models.BaseModel Collection string `db:"collection" json:"collection"` Favourite bool `db:"favourite" json:"favourite"` CustomOrder int `db:"custom_order" json:"custom_order"` BookmarkMetadata string `db:"bookmark_metadata" json:"bookmark_metadata"` User string `db:"user" json:"user"` }
Bookmark models the data in the `bookmarks` collection.
type BookmarkMetaData ¶
type BookmarkMetaData struct { models.BaseModel URL string `db:"url" json:"url"` Description string `db:"description" json:"description"` Title string `db:"title" json:"title"` Image string `db:"image" json:"image"` }
BookmarkMetaData is model the represents data related to URL
func (*BookmarkMetaData) TableName ¶
func (m *BookmarkMetaData) TableName() string
TableName returns the name of the model in PocketBase.
type CollectionService ¶
type CollectionService interface {
IsCollectionOwnedBy(collectionID string, userID string) (bool, error)
}
CollectionService is used to interact with the collection service
type GetURLMetadata ¶
type GetURLMetadata struct {
URL string `json:"url" validate:"required,url"`
}
GetURLMetadata struct contains all the fields used to create a new Bookmark
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler are all the HTTP handlers
func NewTransport ¶
NewTransport returns a new Transport struct to call methods in this module
func (Handler) CreateBookmark ¶
CreateBookmark used to create a new bookmark in the app
func (Handler) GetURLMetadata ¶
GetURLMetadata gets the metadata associated with a URL
type NewBookmark ¶
type NewBookmark struct {
URL string `json:"url" validate:"required,url"`
}
NewBookmark struct contains all the fields used to create a new Bookmark
type Repository ¶
type Repository interface { Create(metadata *BookmarkMetaData, collectionID string, userID string) error GetByURL(url string) (*BookmarkMetaData, error) }
Repository is an interface for interacting with the database
type SQLiteStore ¶
type SQLiteStore struct {
// contains filtered or unexported fields
}
SQLiteStore used to interact with DB
func NewStore ¶
func NewStore(app core.App) SQLiteStore
NewStore returns a new store to interact with the database
func (SQLiteStore) Create ¶
func (s SQLiteStore) Create(metadata *BookmarkMetaData, collectionID string, userID string) error
Create creates a new Bookmark and BookmarkMeta entry in the database
func (SQLiteStore) GetByURL ¶
func (s SQLiteStore) GetByURL(url string) (*BookmarkMetaData, error)
GetByURL get metadata info from the databas
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service used to interact with the bookmark
func NewService ¶
func NewService(repo Repository, srv CollectionService) Service
NewService returns a new struct used to interact with this module
func (Service) GetMetadata ¶
func (s Service) GetMetadata(url string) (*BookmarkMetaData, error)
GetMetadata returns the metadata for a URL.