Files
Igor Sirotin f9cc782a6f refactor: move services to pkg/services
Part of the Go project layout migration, item 31.

Pure move plus import-path rewrite across 687 files. No API or behaviour
change.

The services keep their grouping under pkg/services/<name> rather than
being promoted to pkg/<name>: 27 top-level directories in pkg/ would read
worse than what we have, and the grouping is what makes "an RPC service"
identifiable at a glance.

Paths that follow the move: the logosstorage test target and generate
step, the two wallet token-list tools, the migration-order check (and the
pre-rebase hook symlinked to it), and the storage env helper.

refs #7067
2026-08-21 10:11:05 +02:00

54 lines
1.7 KiB
Go

package browsers
import (
"context"
"go.uber.org/zap"
"github.com/status-im/status-go/internal/logutils"
)
func NewAPI(db *Database) *API {
return &API{db: db}
}
// API is class with methods available over RPC.
type API struct {
db *Database
}
func (api *API) GetBookmarks(ctx context.Context) ([]*Bookmark, error) {
logutils.ZapLogger().Debug("call to get bookmarks")
rst, err := api.db.GetBookmarks()
logutils.ZapLogger().Debug("result from database for bookmarks", zap.Int("len", len(rst)))
return rst, err
}
func (api *API) StoreBookmark(ctx context.Context, bookmark Bookmark) (Bookmark, error) {
logutils.ZapLogger().Debug("call to create a bookmark")
bookmarkResult, err := api.db.StoreBookmark(bookmark)
logutils.ZapLogger().Debug("result from database for creating a bookmark", zap.Error(err))
return bookmarkResult, err
}
func (api *API) UpdateBookmark(ctx context.Context, originalURL string, bookmark Bookmark) error {
logutils.ZapLogger().Debug("call to update a bookmark")
err := api.db.UpdateBookmark(originalURL, bookmark)
logutils.ZapLogger().Debug("result from database for updating a bookmark", zap.Error(err))
return err
}
func (api *API) DeleteBookmark(ctx context.Context, url string) error {
logutils.ZapLogger().Debug("call to remove a bookmark")
err := api.db.DeleteBookmark(url)
logutils.ZapLogger().Debug("result from database for remove a bookmark", zap.Error(err))
return err
}
func (api *API) RemoveBookmark(ctx context.Context, url string) error {
logutils.ZapLogger().Debug("call to remove a bookmark logically")
err := api.db.RemoveBookmark(url)
logutils.ZapLogger().Debug("result from database for remove a bookmark logically", zap.Error(err))
return err
}