You are here

public function Channel::getChannelTypeName in Rocket.Chat 8.2

Get Channel Type (channels|groups) or (public | private type.

Return value

string

Throws

\Exception

5 calls to Channel::getChannelTypeName()
Channel::addMember in modules/rocket_chat_api/src/RocketChat/Element/Channel.php
Channel::changeChannelName in modules/rocket_chat_api/src/RocketChat/Element/Channel.php
Channel::getAllChannelMembersBatched in modules/rocket_chat_api/src/RocketChat/Element/Channel.php
Retrieve Chat Private Groups list. (in batch size)
Channel::getChannelProxy in modules/rocket_chat_api/src/RocketChat/Element/Channel.php
Retrieve the Proxy, create the Channel / Group if needed.
Channel::removeMember in modules/rocket_chat_api/src/RocketChat/Element/Channel.php

File

modules/rocket_chat_api/src/RocketChat/Element/Channel.php, line 412

Class

Channel

Namespace

Drupal\rocket_chat_api\RocketChat\Element

Code

public function getChannelTypeName() {
  if ($this
    ->hasType(Channel::PUBLIC_CHANNEL)) {
    $methodBase = "channels";

    //Public Channel
  }
  elseif ($this
    ->hasType(Channel::PRIVATE_CHANNEL)) {
    $methodBase = "groups";

    //Private Group
  }
  else {

    //TODO report this fial state better!
    throw new Exception("ERROR!");
  }
  return $methodBase;
}