for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Polidog\Chatwork\Api\Rooms;
use Polidog\Chatwork\Client\ClientInterface;
use Polidog\Chatwork\Entity\Collection\CollectionInterface;
use Polidog\Chatwork\Entity\Factory\FileFactory;
use Polidog\Chatwork\Entity\File;
/**
* Class Files.
*/
class Files
{
* @var ClientInterface
private $client;
* @var FileFactory
private $factory;
* @var int
private $roomId;
* Files constructor.
*
* @param ClientInterface $client
* @param FileFactory $factory
* @param int $roomId
public function __construct(ClientInterface $client, FileFactory $factory, int $roomId)
$this->client = $client;
$this->factory = $factory;
$this->roomId = $roomId;
}
* @param null $accountId
$accountId
null
* @return CollectionInterface
public function show($accountId = null)
$options = [
];
if (!is_null($accountId)) {
is_null($accountId)
true
$options['account_id'] = $accountId;
return $this->factory->collection(
$this->client->get(
"rooms/{$this->roomId}/files",
$options
)
);
* @param $id
* @param $downloadLink
* @return File
public function detail($id, $downloadLink = false)
return $this->factory->entity(
"rooms/{$this->roomId}/files/{$id}",
[
'create_download_url' => (int) $downloadLink,
]