Sunspear Client¶
sunspear.clients¶
-
class
sunspear.clients.
SunspearClient
(backend, **kwargs)¶ The class is used to create, delete, remove and update activity stream items. This is the main class you use to interact with
sunspear
-
clear_all
()¶ Deletes all activity stream data
-
clear_all_activities
()¶ Deletes all activities data
-
clear_all_objects
()¶ Deletes all objects data
-
create_activity
(actstream_dict)¶ Creates an activity. You can provide objects for activities as dictionaries or as ids for already existing objects.
If you provide a dictionary for an object, it is saved as a new object. If you provide an object id and the object does not exist, it is saved anyway, and returned as an empty dictionary when retriving the activity.
Parameters: actstream_dict (dict) – a dictionary representing the activity
we want to store in the backend.
-
create_like
(activity, actor, content='', extra={}, **kwargs)¶ Creates a
like
for an activity.Parameters: - activity (a string or dict) – the activity we want to create the sub-item for
- actor (a string or dict) – the
object
creating the sub-activity - content (a string or dict) – a string or an
object
representing the content of the sub-activity - extra (dict) – additional data the is to be included as part of the
sub-activity
activity
-
create_object
(object_dict)¶ Creates an object that can be used as part of an activity. If you specific and object with an id that already exists, that object is overidden.
Parameters: object_dict (dict) – a dictionary representing the object we want to store in the backend.
-
create_reply
(activity, actor, content, extra={}, **kwargs)¶ Creates a
reply
for an activity.Parameters: - activity (a string or dict) – the activity we want to create the sub-item for
- actor (a string or dict) – the
object
creating the sub-activity - content (a string or dict) – a string or an
object
representing the content of the sub-activity - extra (dict) – additional data the is to be included as part of the
sub-activity
activity
-
delete_activity
(activity_id, **kwargs)¶ Deletes an activity item and all associated sub items
Parameters: activity_id (string) – The id of the activity we want to create a reply for
-
delete_like
(activity_id, **kwargs)¶ Deletes a
like
made on an activity. This will also update the corresponding activity.Parameters: activity_id (string) – the id of the like activity to delete.
-
delete_reply
(activity_id, **kwargs)¶ Deletes a
reply
made on an activity. This will also update the corresponding activity.Parameters: activity_id (string) – the id of the reply activity to delete.
-
get_activities
(activity_ids=[], **kwargs)¶ Gets a list of activities. Specific backends may support other arguments. Please see reference of the specific backends to see all
kwargs
supported.Parameters: activity_ids (list) – The list of activities you want to retrieve
-
get_backend
()¶ The backend the client was initialized with.
Returns: reference to the backend the client was initialized with.
-
get_objects
(object_ids=[])¶ Gets a list of objects by object_ids.
Parameters: object_ids (list) – a list of objects
-