Documentation ¶
Overview ¶
Package api implements http REST API compatible with xBrowserSync service.
Handlers implemented by api package are completly indepedent of used http router. It is up to implementing person to choose proper http router.
See xBrowserSync documentation for further information about what it is and how it works.
Index ¶
- Variables
- func Bookmarks(storage BookmarksStorage, params QueryParameters) http.HandlerFunc
- func CreateBookmarks(storage BookmarksStorage) http.HandlerFunc
- func Info(location, msg, version string) http.HandlerFunc
- func LastUpdated(storage BookmarksStorage, params QueryParameters) http.HandlerFunc
- func UpdateBookmarks(storage BookmarksStorage, params QueryParameters) http.HandlerFunc
- func Version(storage BookmarksStorage, params QueryParameters) http.HandlerFunc
- type BookmarksStorage
- type QueryParameters
Constants ¶
This section is empty.
Variables ¶
ErrBookmarksNotFound is returned by BookmarksStorage when there is no bookmarks with given ID in storage.
Functions ¶
func Bookmarks ¶
func Bookmarks(storage BookmarksStorage, params QueryParameters) http.HandlerFunc
Bookmarks retrieves the bookmark sync corresponding to the provided sync ID.
func CreateBookmarks ¶
func CreateBookmarks(storage BookmarksStorage) http.HandlerFunc
CreateBookmarks creates a new (empty) bookmark sync and returns the corresponding ID.
func Info ¶
func Info(location, msg, version string) http.HandlerFunc
Info retrieves information describing the xBrowserSync service.
func LastUpdated ¶
func LastUpdated(storage BookmarksStorage, params QueryParameters) http.HandlerFunc
LastUpdated retrieves the bookmark sync last updated timestamp corresponding to the provided sync ID.
func UpdateBookmarks ¶
func UpdateBookmarks(storage BookmarksStorage, params QueryParameters) http.HandlerFunc
UpdateBookmarks updates the bookmark sync data corresponding to the provided sync ID with the provided encrypted bookmarks data.
func Version ¶
func Version(storage BookmarksStorage, params QueryParameters) http.HandlerFunc
Version retrieves the bookmark sync version number of the xBrowserSync client used to create the bookmarks sync corresponding to the provided sync ID.
Types ¶
type BookmarksStorage ¶
type BookmarksStorage interface { // SetBookmarks method stores given encrypted Bookmarks // in database. SetBookmarks(ctx context.Context, b models.Bookmarks) error // GetBookmarks retrieves encrypted Bookmarks with given id // from database. GetBookmarks(ctx context.Context, id string) (*models.Bookmarks, error) }
BookmarksStorage describes methods required for storing and retrieving bookmarks from data source. It has to be thread safe.