status-go/services/browsers/api.go

27 lines
504 B
Go
Raw Normal View History

package browsers
import (
"context"
)
2019-07-25 05:35:09 +00:00
func NewAPI(db *Database) *API {
return &API{db: db}
}
// API is class with methods available over RPC.
type API struct {
2019-07-25 05:35:09 +00:00
db *Database
}
func (api *API) AddBrowser(ctx context.Context, browser Browser) error {
2019-07-25 05:35:09 +00:00
return api.db.InsertBrowser(browser)
}
func (api *API) GetBrowsers(ctx context.Context) ([]*Browser, error) {
2019-07-25 05:35:09 +00:00
return api.db.GetBrowsers()
}
func (api *API) DeleteBrowser(ctx context.Context, id string) error {
2019-07-25 05:35:09 +00:00
return api.db.DeleteBrowser(id)
}