/** * Set Metadata */ protected function setMetadata() { $metadata = $this->getDataProperty('metadata'); if (is_array($metadata)) { $this->metadata = ModelFactory::make($metadata); } }
/** * Save Copy Reference * * @param string $path Path to the file or folder to get a copy reference to * @param string $copyReference Copy reference returned by getCopyReference * * @link https://www.dropbox.com/developers/documentation/http/documentation#files-copy_reference-save * * @return \Kunnu\Dropbox\Models\FileMetadata|\Kunnu\Dropbox\Models\FolderMetadata */ public function saveCopyReference($path, $copyReference) { //Path and Copy Reference cannot be null if (is_null($path) || is_null($copyReference)) { throw new DropboxClientException("Path and Copy Reference cannot be null."); } //Save Copy Reference $response = $this->postToAPI('/files/copy_reference/save', ['path' => $path, 'copy_reference' => $copyReference]); $body = $response->getDecodedBody(); //Response doesn't have Metadata if (!isset($body['metadata']) || !is_array($body['metadata'])) { throw new DropboxClientException("Invalid Response."); } //Make and return the Model return ModelFactory::make($body['metadata']); }