/** * Gets the download link to a particular file. You will need to manually pass in * the authentication token for the download link to work. * @param Client $box A reference to the client library. * @param int $version The version number of the file to download, leave blank if you want to download the latest version. * @return string $url The url link to the download */ public function getDownloadUrl(Client $box, $version = 0) { $url = Client::BASE_URL . '/' . Client::API_VERSION; $authToken = $box->getAuthToken(); if ($version == 0) { // not a specific version download $url .= '/download/' . $authToken . '/' . $this->attribute('id'); } else { // downloading a certain version $url .= '/download_version/' . $authToken . '/' . $this->attribute('id') . '/' . $version; } return $url; }