View Source Bonfire.Social.Bookmarks (Bonfire v0.9.10-classic-beta.169)
Mutate or query bookmarks (similar to likes but only visible to the creator of the bookmark)
Bookmarks are implemented on top of the Bonfire.Data.Edges.Edge
schema (see Bonfire.Social.Edges
for shared functions)
Summary
Functions
Bookmarks an object for a user.
Checks if a user has bookmarked an object.
Retrieves bookmark(er)s for an object.
Retrieves bookmarked objects by a subject.
Counts bookmarks based on filters and options.
Retrieves a bookmark by subject and object.
Retrieves a bookmark edge, raising an error if not found.
Lists bookmarks by a specific user.
Lists the current user's bookmarks.
Lists bookmark(er)s of a specific object or objects.
Callback implementation for Bonfire.Common.ContextModule.query_module/0
.
Callback implementation for Bonfire.Common.ContextModule.schema_module/0
.
Removes a bookmark from an object for a user, if one exists
Functions
Bookmarks an object for a user.
Examples
iex> Bonfire.Social.Bookmarks.bookmark(user, object)
{:ok, %Bonfire.Data.Social.Bookmark{}}
Checks if a user has bookmarked an object.
Examples
iex> Bonfire.Social.Bookmarks.bookmarked?(user, object)
true
Retrieves bookmark(er)s for an object.
Examples
iex> Bonfire.Social.Bookmarks.by_bookmarked(object)
[%Bonfire.Data.Social.Bookmark{}, ...]
Retrieves bookmarked objects by a subject.
Examples
iex> Bonfire.Social.Bookmarks.by_bookmarker(user)
[%Bonfire.Data.Social.Bookmark{}, ...]
Counts bookmarks based on filters and options.
Examples
iex> Bonfire.Social.Bookmarks.count([subject: user_id], [])
5
iex> Bonfire.Social.Bookmarks.count(user, object)
1
iex> Bonfire.Social.Bookmarks.count(object, [])
10
Retrieves a bookmark by subject and object.
Examples
iex> Bonfire.Social.Bookmarks.get(user, object)
{:ok, %Bonfire.Data.Social.Bookmark{}}
Retrieves a bookmark edge, raising an error if not found.
Lists bookmarks by a specific user.
Examples
iex> Bonfire.Social.Bookmarks.list_by(user_id, current_user: me)
[%Bonfire.Data.Social.Bookmark{}, ...]
Lists the current user's bookmarks.
Examples
iex> Bonfire.Social.Bookmarks.list_my(current_user: me)
[%Bonfire.Data.Social.Bookmark{}, ...]
Lists bookmark(er)s of a specific object or objects.
Examples
iex> Bonfire.Social.Bookmarks.list_of(object_id)
[%Bonfire.Data.Social.Bookmark{}, ...]
Callback implementation for Bonfire.Common.ContextModule.query_module/0
.
Callback implementation for Bonfire.Common.ContextModule.schema_module/0
.
Removes a bookmark from an object for a user, if one exists
Examples
iex> Bonfire.Social.Bookmarks.unbookmark(user, object)
:ok