Remove all "FileHasObject" edge reads and writes
[phabricator.git] / src / applications / files / conduit / FileQueryChunksConduitAPIMethod.php
blobe0929ef8c4c09c0d2569132539b6a946ae7a3bc6
1 <?php
3 final class FileQueryChunksConduitAPIMethod
4 extends FileConduitAPIMethod {
6 public function getAPIMethodName() {
7 return 'file.querychunks';
10 public function getMethodDescription() {
11 return pht('Get information about file chunks.');
14 protected function defineParamTypes() {
15 return array(
16 'filePHID' => 'phid',
20 protected function defineReturnType() {
21 return 'list<wild>';
24 protected function execute(ConduitAPIRequest $request) {
25 $viewer = $request->getUser();
27 $file_phid = $request->getValue('filePHID');
28 $file = $this->loadFileByPHID($viewer, $file_phid);
29 $chunks = $this->loadFileChunks($viewer, $file);
31 $results = array();
32 foreach ($chunks as $chunk) {
33 $results[] = array(
34 'byteStart' => $chunk->getByteStart(),
35 'byteEnd' => $chunk->getByteEnd(),
36 'complete' => (bool)$chunk->getDataFilePHID(),
40 return $results;