Skip to content

Latest commit

 

History

History

Groups

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

You have to be logged in and have relevant permissions.

GROUP LISTING

$listing = \ATDev\RocketChat\Groups\Group::listing();

if (!$listing) {
	// Log the error
	$error = \ATDev\RocketChat\Groups\Group::getError();
}

GROUP LIST ALL

$listAll = \ATDev\RocketChat\Groups\Group::listAll();

if (!$listAll) {
    $error = \ATDev\RocketChat\Groups\Group::getError();
}

CREATE GROUP

$group = new \ATDev\RocketChat\Groups\Group();
$group->setName("[GROUP-NAME-NO-SPACES]");
$group->setReadOnlyValue(true);

$result = $group->create();

if (!$result) {
	// Log the error
	$error = $group->getError();
}

GET GROUP INFO

$group = new \ATDev\RocketChat\Groups\Group("[GROUP ID]");

$result = $group->info();

if (!$result) {
	// Log the error
	$error = $group->getError();
}

DELETE GROUP

$group = new \ATDev\RocketChat\Groups\Group("[GROUP ID]");

$result = $group->delete();

if (!$result) {

	// Log the error
	$error = $group->getError();
}

OPEN GROUP

$group = new \ATDev\RocketChat\Groups\Group("[GROUP ID]");

$result = $group->open();

if (!$result) {

	// Log the error
	$error = $group->getError();
}

CLOSE GROUP

$group = new \ATDev\RocketChat\Groups\Group("[GROUP ID]");

$result = $group->close();

if (!$result) {

	// Log the error
	$error = $group->getError();
}

INVITE USER TO GROUP

$user = new \ATDev\RocketChat\Users\User("[USER ID]");
$group = new \ATDev\RocketChat\Groups\Group("[GROUP ID]");

$result = $group->invite($user);

if (!$result) {

	// Log the error
	$error = $group->getError();
}

KICK USER OUT OF GROUP

$user = new \ATDev\RocketChat\Users\User("[USER ID]");
$group = new \ATDev\RocketChat\Groups\Group("[GROUP ID]");

$result = $group->kick($user);

if (!$result) {

	// Log the error
	$error = $group->getError();
}

ADD OWNER TO GROUP

$user = new \ATDev\RocketChat\Users\User("[USER ID]");
$group = new \ATDev\RocketChat\Groups\Group("[GROUP ID]");

$result = $group->addOwner($user);

if (!$result) {

	// Log the error
	$error = $group->getError();
}

GROUP REMOVE OWNER

$user = new \ATDev\RocketChat\Users\User("[USER ID]");
$group = new \ATDev\RocketChat\Groups\Group("[GROUP ID]");

$result = $group->removeOwner($user);

if (!$result) {
	// Log the error
	$error = $group->getError();
}

REMOVE USER OUT OF GROUP

$user = new \ATDev\RocketChat\Users\User("[USER ID]");
$group = new \ATDev\RocketChat\Groups\Group("[GROUP ID]");

$result = $group->removeOwner($user);

if (!$result) {

	// Log the error
	$error = $group->getError();
}

LISTS ALL THE GROUP MESSAGES ON THE SERVER

$group = new \ATDev\RocketChat\Groups\Group("[GROUP ID]");
$result = $group->messages();

if (!$result) {
    // Log the error
    $error = $group->getError();
}

GROUP ADD LEADER

$group = new \ATDev\RocketChat\Groups\Group("[GROUP ID]");
$user = new \ATDev\RocketChat\Users\User("[USER ID]");
$result = $group->addLeader($user);

if (!$result) {
    $error = $group->getError();
}

GROUP REMOVE LEADER

$group = new \ATDev\RocketChat\Groups\Group("[GROUP ID]");
$user = new \ATDev\RocketChat\Users\User("[USER ID]");
$result = $group->removeLeader($user);

if (!$result) {
    $error = $group->getError();
}

GROUP ADD MODERATOR

$group = new \ATDev\RocketChat\Groups\Group("[GROUP ID]");
$user = new \ATDev\RocketChat\Users\User("[USER ID]");
$result = $group->addModerator($user);

if (!$result) {
    $error = $group->getError();
}

GROUP REMOVE MODERATOR

$group = new \ATDev\RocketChat\Groups\Group("[GROUP ID]");
$user = new \ATDev\RocketChat\Users\User("[USER ID]");
$result = $group->removeModerator($user);

if (!$result) {
    $error = $group->getError();
}

GROUP MODERATORS LIST

$group = new \ATDev\RocketChat\Groups\Group("[GROUP ID]");

$result = $group->moderators();
if (!$result) {
	$error = $group->getError();
}

GROUP LEAVE

$group = new \ATDev\RocketChat\Groups\Group("[GROUP ID]");

$result = $group->leave();
if (!$result) {
	$error = $group->getError();
}

GROUP MEMBERS LIST

$group = new \ATDev\RocketChat\Groups\Group("[GROUP ID]");

$result = $group->members();
if (!$result) {
	$error = $group->getError();
}

GROUP COUNTERS

$group = new \ATDev\RocketChat\Groups\Group("[GROUP ID]");

$result = $group->counters();
if (!$result) {
	$error = $group->getError();
}

GROUP ARCHIVE

$group = new \ATDev\RocketChat\Groups\Group("[GROUP ID]");

$result = $group->archive();
if (!$result) {
    $error = $group->getError();
}

GROUP UNARCHIVE

$group = new \ATDev\RocketChat\Groups\Group("[GROUP ID]");

$result = $group->unarchive();
if (!$result) {
    $error = $group->getError();
}

GROUP RENAME

$group = new \ATDev\RocketChat\Groups\Group("[GROUP ID]");

$result = $group->rename("[NEW-GROUP-NAME]");
if (!$result) {
    $error = $group->getError();
}

GROUP SET DESCRIPTION

$group = new \ATDev\RocketChat\Groups\Group("[GROUP ID]");
$result = $group->setDescription("[GROUP DESCRIPTION]");
if (!$result) {
    $error = $group->getError();
}

GROUP SET ANNOUNCEMENT

$group = new \ATDev\RocketChat\Groups\Group("[GROUP ID]");
$result = $group->setAnnouncement("[GROUP ANNOUNCEMENT]");
if (!$result) {
    $error = $group->getError();
}

GROUP SET CUSTOM FIELDS

$group = new \ATDev\RocketChat\Groups\Group("[GROUP ID]");
$result = $group->setCustomFields(["CUSTOM-FIELD" => "VALUE"]);
if (!$result) {
    $error = $group->getError();
}

GROUP SET READ ONLY

$group = new \ATDev\RocketChat\Groups\Group("[GROUP ID]");
$result = $group->setReadOnly(true);
if (!$result) {
    $error = $group->getError();
}

GROUP SET TOPIC

$group = new \ATDev\RocketChat\Groups\Group("[GROUP ID]");
$result = $group->setTopic("[NEW GROUP TOPIC]");
if (!$result) {
    $error = $group->getError();
}

GROUP SET TYPE

$group = new \ATDev\RocketChat\Groups\Group("[GROUP ID]");

$result = $group->setType("c");
if (!$result) {
    $error = $group->getError();
}

GROUP ROLES

$group = new \ATDev\RocketChat\Groups\Group("[GROUP ID]");

$roles = $group->roles();
if (!$roles) {
	$error = $group->getError();
} else {
    $roles->first()->getRoles();
}

GROUP HISTORY

$group = new \ATDev\RocketChat\Groups\Group("[GROUP ID]");

$result = $group->history([
    "latest" => "2016-09-30T13:42:25.304Z",
    "oldest" => "2016-05-30T13:42:25.304Z",
    "inclusive" => true,
    "unreads" => true
]);
if (!$result) {
	$error = $group->getError();
}

GROUP FILES

$group = new \ATDev\RocketChat\Groups\Group("[GROUP ID]");

$result = $group->files(10, 20);
if (!$result) {
	$error = $group->getError();
}