id = $id; } public function create(array $users, $owner = null, $name = null) { $params = [ 'userlist' => $users, ]; if ($name) { $params['name'] = $name; } if ($owner) { $params['owner'] = $owner; } if ($this->id != null) { $params['chatid'] = $this->id; } $request = $this->transformForJsonRequest('POST', 'appchat/create', $params); $resp = $this->client->send($request); return json_decode($resp->getBody(), true); } public function get($chatId) { $request = $this->transformForJsonRequest('GET', 'appchat/get?chatid=' . $chatId); $resp = $this->client->send($request); return json_decode($resp->getBody(), true); } public function send(Message $message) { $request = $this->transformForJsonRequest('POST', 'appchat/send', array_merge(['chatid' => $this->id], $message->toArray())); $resp = $this->client->send($request); return json_decode($resp->getBody(), true); } public function update($chatId, array $add = null, array $del = null, $name = null, $owner = null) { $params = [ 'chatid' => $chatId, ]; if ($name) { $params['name'] = $name; } if ($owner) { $params['owner'] = $owner; } if ($add) { $params['add_user_list'] = $add; } if ($del) { $params['del_user_list'] = $del; } $request = $this->transformForJsonRequest('POST', 'appchat/update', $params); $resp = $this->client->send($request); return json_decode($resp->getBody(), true); } }