コード例 #1
0
 /**
  * Update a user setting
  *
  * @param Token $token Access token
  * @param string $name Setting name
  * @param string $value Possible values are available in /settings
  */
 public function __construct(Token $token, $name, $value)
 {
     parent::__construct();
     $this->setToken($token);
     $this->addToBody('setting_name', $name);
     $this->addToBody('setting_value', $value);
 }
コード例 #2
0
 /**
  * Select files of a torrent to start it
  *
  * Warning: To get file IDs, use /torrents/info/{id}
  * @param Token $token Access token
  * @param string $id Torrent ID
  * @param array $files Array of selected files IDs
  */
 public function __construct(Token $token, $id, array $files)
 {
     parent::__construct();
     $this->setToken($token);
     $this->id = $id;
     $this->addToBody('files', count($files) > 0 ? implode(',', $files) : 'all');
 }
コード例 #3
0
 /**
  * Check if a file is downloadable on the concerned hoster
  *
  * @param string $link The original hoster link
  * @param string|null $password Password to unlock the file access hoster side
  */
 public function __construct($link, $password = null)
 {
     parent::__construct();
     $this->addToBody('link', $link);
     if (!empty($password)) {
         $this->addToBody('password', $password);
     }
 }
コード例 #4
0
 /**
  * Get traffic details on each hoster used during a defined period
  *
  * @param Token $token Access token
  * @param Carbon $start Start period, default: a week ago
  * @param Carbon $end End period, default: today
  */
 public function __construct(Token $token, Carbon $start = null, Carbon $end = null)
 {
     parent::__construct();
     $this->setToken($token);
     if (!is_null($start)) {
         $this->addQueryParam('start', $start->format('Y-m-d'));
     }
     if (!is_null($end)) {
         $this->addQueryParam('end', $start->format('Y-m-d'));
     }
 }
コード例 #5
0
 /**
  * Add a magnet link to download
  *
  * The files must be selected with the selectFiles method to start the torrent
  * @param Token $token Access token
  * @param string $magnet Magnet link
  * @param int|null $host Hoster domain (retrieved from /torrents/availableHosts)
  * @param int|null $split Split size (under max_split_size of concerned hoster retrieved from /torrents/availableHosts)
  */
 public function __construct(Token $token, $magnet, $host = null, $split = null)
 {
     parent::__construct();
     $this->setToken($token);
     $this->addToBody('magnet', $magnet);
     if (!empty($host)) {
         $this->addToBody('host', $host);
     }
     if (!empty($host) && !empty($split)) {
         $this->addToBody('split', $split);
     }
 }
コード例 #6
0
 /**
  * Unrestrict a hoster link and get a new unrestricted link
  *
  * @param Token $token Access token
  * @param string $link The original hoster link
  * @param string|null $password Password to unlock the file access hoster side
  * @param string|null $remote Use Remote traffic, dedicated servers and account sharing protections lifted
  */
 public function __construct(Token $token, $link, $password = null, $remote = null)
 {
     parent::__construct();
     $this->setToken($token);
     $this->addToBody('link', $link);
     if (!empty($password)) {
         $this->addToBody('password', $password);
     }
     if (!empty($remote)) {
         $this->addToBody('remote', $remote);
     }
 }
コード例 #7
0
 /**
  * Get user downloads list
  *
  * Warning: You can not use both offset and page at the same time, page is prioritized in case it happens.
  * @param Token $token Access token
  * @param int $page Pagination system
  * @param int $limit Entries returned per page / request (must be within 0 and 100, default: 50)
  * @param int $offset Starting offset (must be within 0 and X-Total-Count HTTP header)
  */
 public function __construct(Token $token, $page, $limit, $offset)
 {
     parent::__construct();
     $this->setToken($token);
     if (!is_null($page)) {
         $this->addQueryParam('page', $page);
     }
     $this->addQueryParam('limit', $limit);
     if (!is_null($offset) && is_null($page)) {
         $this->addQueryParam('offset', $offset);
     }
 }
コード例 #8
0
 /**
  * Upload a new user avatar image
  *
  * @param Token $token Access token
  * @param string $path File to the avatar file
  */
 public function __construct(Token $token, $path)
 {
     parent::__construct();
     $this->setToken($token);
     $this->setFilePath($path);
 }
コード例 #9
0
 /**
  * Get available hosts to upload the torrent to
  *
  * @param Token $token Access token
  */
 public function __construct(Token $token)
 {
     parent::__construct();
     $this->setToken($token);
 }
コード例 #10
0
 /**
  * Unrestrict a hoster folder link and get individual links
  *
  * @param Token $token Access token
  * @param string $link The hoster folder link
  */
 public function __construct(Token $token, $link)
 {
     parent::__construct();
     $this->setToken($token);
     $this->addToBody('link', $link);
 }
コード例 #11
0
 /**
  * Get supported hosts
  */
 public function __construct()
 {
     parent::__construct();
 }