CommonSense PHP API Library
Group Class Reference

List of all members.

Public Member Functions

 Group (stdClass $data, Api $api)
 getID ()
 getName ()
 getEmail ()
 update ($email, $username, $password, $name)
 delete ()
 getUsers ()
 addUser ($userID, $userName)
 addSensors ($sensor_ids)
 listSensors ($page, $perPage, $shared, $owned, $physical)
 listSensorTags ($details=NULL, $namespace=NULL, $sensor_owner=NULL, $page=-1, $per_page=-1)
 findSensorsByTagsInGroup ($filter, $details=NULL, $namespace=NULL, $sensor_owner=NULL, $page=-1, $per_page=-1)

Detailed Description

sense dashboard - Group.php

This file is part of sense dashboard.

Author:
Remi Appels <remi@sense-os.nl> The class Group handels all the group actions

public

Author:
Remi Appels <remi@sense-os.nl>

Member Function Documentation

Group::addSensors ( sensor_ids)

This method will add sensors to the group.

public

Parameters:
arraysensor_ids
Returns:
mixed
Group::addUser ( userID,
userName 
)

This method will add a user to the group. To add a user at least a username or user_id must be specified. Only members of the group can add a user to the group.

public

Parameters:
intuserID
stringuserName
Returns:
mixed

This method deletes the group if the group has no other members. If the group has other members then the current user will be removed from the group.

public

Returns:
json object
Group::findSensorsByTagsInGroup ( filter,
details = NULL,
namespace = NULL,
sensor_owner = NULL,
page = -1,
per_page = -1 
)

Finding sensors by metatags

Via this method a list of sensors can be selected based on a set of conditions. Supported operators are “equal”, “in”, and “is_set”. All string comparisons are case INsensitive. Currently supported are two types of statement groups. The first is "metatag_statement_groups" which allows to find sensors based on their metatags. The second is "sensor_statement_groups" which allows to find sensors based on their own properties. Supported properties are id, name, type, device_type, data_type_id, pager_type, display_name and use_data_storage.

public

Parameters:
intgroup_id The group identifier
arrayfilter {"filter":{"metatag_statement_groups":[[{"metatag_name":"greenhouse_number","operator":"equal","value":"1"},{"metatag_name":"greenhouse_number","operator":"equal","value":"2"}],[{"metatag_name":"color","operator":"equal","value":"green"}]],"sensor_statement_groups":[[{"sensor_property":"id","operator":"in","value":"1,2,3,4,5,6,7,8,9,10"}]]}}
stringdetails (optional) To get all the related data as name, display_name, type, device_type, data_typ_id, pager_type, data_type and data_structure the parameter details=full can be used. If only a list of sensor id's is needed then details=no can be used.
stringnamespace (optional) Find metatags within the given namespace. If not given “default” is assumed as the namepace.
stringsensor_owner (optional) “me” only return metatags of sensors owned by the current user. “shared” only return sensors shared with me. "all” return all sensors owned by me or shared with me. When not given “me” is assumed
intpage (optional) This parameter specifies which page of the results must be retrieved. The page offset starts at 0.
intper_page (optional) This parameter specifies the amount of sensors that must be received at once. The maximum amount is 1000 items

This methods returns the members of the group as a list of users. Only group members can perform this action.

public

Returns:
mixed
Group::Group ( stdClass $  data,
Api api 
)
Group::listSensors ( page,
perPage,
shared,
owned,
physical 
)

This method returns a list of sensors of a group.

public

Parameters:
intpage
intperPage
Booleanshared
Booleanowned
Booleanphysical
Booleandetails
Returns:
mixed
Group::listSensorTags ( details = NULL,
namespace = NULL,
sensor_owner = NULL,
page = -1,
per_page = -1 
)

List sensor tags within a group

This method will return a list of sensors with their metatags in the given group.

public

Parameters:
stringdetails To get all the related data as name, display_name, type, device_type, data_typ_id, pager_type, data_type and data_structure the parameter details=full can be used. If only a list of sensor id's is needed then details=no can be used.
stringnamespace Find metatags within the given namespace. If not given “default” is assumed as the namepace.
stringsensor_owner “me” only return metatags of sensors owned by the current user. “shared” only return sensors shared with me. "all” return all sensors owned by me or shared with me. When not given “me” is assumed
intpage This parameter specifies which page of the results must be retrieved. The page offset starts at 0.
intper_page This parameter specifies the amount of sensors that must be received at once. The maximum amount is 1000 items
Group::update ( email,
username,
password,
name 
)

This method will update the details of a group. Only the values specified as input will be updates. Every member of the group can update the group details

public

Parameters:
stringemail
stringusername
stringpassword
stringname
Returns:
json object

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables