189 lines
5.3 KiB
PHP
189 lines
5.3 KiB
PHP
<?php
|
||
|
||
declare(strict_types=1);
|
||
|
||
/*
|
||
* This file is part of the "php-ipfs" package.
|
||
*
|
||
* (c) Robert Schönthal <robert.schoenthal@gmail.com>
|
||
*
|
||
* For the full copyright and license information, please view the LICENSE
|
||
* file that was distributed with this source code.
|
||
*/
|
||
|
||
namespace IPFS\Api;
|
||
|
||
use IPFS\Annotation\Api as Endpoint;
|
||
use IPFS\Command\Command;
|
||
|
||
/**
|
||
* @author Robert Schönthal <robert.schoenthal@gmail.com>
|
||
* @autogenerated
|
||
* @codeCoverageIgnore
|
||
*/
|
||
final class Files implements Api
|
||
{
|
||
/**
|
||
* Change the cid version or hash function of the root node of a given path.
|
||
*
|
||
* @Endpoint(name="files:chcid")
|
||
*
|
||
* @param string $arg path to change
|
||
* @param int $cidVersion cid version to use
|
||
* @param string $hash hash function to use
|
||
*
|
||
* @return Command
|
||
*/
|
||
public function chcid(string $arg = '/', int $cidVersion = 0, string $hash = null): Command
|
||
{
|
||
return new Command(__METHOD__, get_defined_vars());
|
||
}
|
||
|
||
/**
|
||
* Copy files into mfs.
|
||
*
|
||
* @Endpoint(name="files:cp")
|
||
*
|
||
* @param string $arg source object to copy
|
||
* @param string $arg1 destination to copy object to
|
||
*
|
||
* @return Command
|
||
*/
|
||
public function cp(string $arg, string $arg1): Command
|
||
{
|
||
return new Command(__METHOD__, get_defined_vars());
|
||
}
|
||
|
||
/**
|
||
* Flush a given path’s data to disk.
|
||
*
|
||
* @Endpoint(name="files:flush")
|
||
*
|
||
* @param string $arg path to flush
|
||
*
|
||
* @return Command
|
||
*/
|
||
public function flush(string $arg = '/'): Command
|
||
{
|
||
return new Command(__METHOD__, get_defined_vars());
|
||
}
|
||
|
||
/**
|
||
* List directories in the local mutable namespace.
|
||
*
|
||
* @Endpoint(name="files:ls")
|
||
*
|
||
* @param string $arg path to show listing for
|
||
* @param bool $l use long listing format
|
||
*
|
||
* @return Command
|
||
*/
|
||
public function ls(string $arg = '/', bool $l = false): Command
|
||
{
|
||
return new Command(__METHOD__, get_defined_vars());
|
||
}
|
||
|
||
/**
|
||
* Make directories.
|
||
*
|
||
* @Endpoint(name="files:mkdir")
|
||
*
|
||
* @param string $arg path to dir to make
|
||
* @param bool $parents no error if existing, make parent directories as needed
|
||
* @param int $cidVersion cid version to use
|
||
* @param string $hash hash function to use
|
||
*
|
||
* @return Command
|
||
*/
|
||
public function mkdir(string $arg, bool $parents = false, int $cidVersion = 0, string $hash = null): Command
|
||
{
|
||
return new Command(__METHOD__, get_defined_vars());
|
||
}
|
||
|
||
/**
|
||
* Move files.
|
||
*
|
||
* @Endpoint(name="files:mv")
|
||
*
|
||
* @param string $arg source file to move
|
||
* @param string $arg1 destination path for file to be moved to
|
||
*
|
||
* @return Command
|
||
*/
|
||
public function mv(string $arg, string $arg1): Command
|
||
{
|
||
return new Command(__METHOD__, get_defined_vars());
|
||
}
|
||
|
||
/**
|
||
* Read a file in a given mfs.
|
||
*
|
||
* @Endpoint(name="files:read")
|
||
*
|
||
* @param string $arg path to file to be read
|
||
* @param int $offset byte offset to begin reading from
|
||
* @param int $count maximum number of bytes to read
|
||
*
|
||
* @return Command
|
||
*/
|
||
public function read(string $arg, int $offset = 0, int $count = 0): Command
|
||
{
|
||
return new Command(__METHOD__, get_defined_vars());
|
||
}
|
||
|
||
/**
|
||
* Remove a file.
|
||
*
|
||
* @Endpoint(name="files:rm")
|
||
*
|
||
* @param string $arg file to remove
|
||
* @param bool $recursive recursively remove directories
|
||
*
|
||
* @return Command
|
||
*/
|
||
public function rm(string $arg, bool $recursive = false): Command
|
||
{
|
||
return new Command(__METHOD__, get_defined_vars());
|
||
}
|
||
|
||
/**
|
||
* Display file status.
|
||
*
|
||
* @Endpoint(name="files:stat")
|
||
*
|
||
* @param string $arg path to node to stat
|
||
* @param string $format print statistics in given format
|
||
* @param bool $hash print only hash
|
||
* @param bool $size print only size
|
||
* @param bool $withLocal compute the amount of the dag that is local, and if possible the total size
|
||
*
|
||
* @return Command
|
||
*/
|
||
public function stat(string $arg, string $format = null, bool $hash = false, bool $size = false, bool $withLocal = false): Command
|
||
{
|
||
return new Command(__METHOD__, get_defined_vars());
|
||
}
|
||
|
||
/**
|
||
* Write to a mutable file in a given filesystem.
|
||
*
|
||
* @Endpoint(name="files:write")
|
||
*
|
||
* @param string $arg path to write to
|
||
* @param string $file data to write
|
||
* @param int $offset byte offset to begin writing at
|
||
* @param bool $create create the file if it does not exist
|
||
* @param bool $truncate truncate the file to size zero before writing
|
||
* @param int $count maximum number of bytes to read
|
||
* @param bool $rawLeaves use raw blocks for newly created leaf nodes
|
||
* @param int $cidVersion cid version to use
|
||
* @param string $hash hash function to use
|
||
*
|
||
* @return Command
|
||
*/
|
||
public function write(string $arg, string $file, int $offset = 0, bool $create = false, bool $truncate = false, int $count = 0, bool $rawLeaves = false, int $cidVersion = 0, string $hash = null): Command
|
||
{
|
||
return new Command(__METHOD__, get_defined_vars());
|
||
}
|
||
}
|