238 lines
7.5 KiB
PHP
238 lines
7.5 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 Basics implements Api
|
|
{
|
|
/**
|
|
* Add a file or directory to ipfs.
|
|
*
|
|
* @Endpoint(name="add")
|
|
*
|
|
* @param string $file the path to a file to be added to ipfs
|
|
* @param bool $recursive add directory paths recursively
|
|
* @param bool $quiet write minimal output
|
|
* @param bool $quieter write only final hash
|
|
* @param bool $silent write no output
|
|
* @param bool $progress stream progress data
|
|
* @param bool $trickle use trickle-dag format for dag generation
|
|
* @param bool $onlyHash only chunk and hash - do not write to disk
|
|
* @param bool $wrapWithDirectory wrap files with a directory object
|
|
* @param bool $hidden include files that are hidden
|
|
* @param string $chunker chunking algorithm, size-[bytes] or rabin-[min]-[avg]-[max]
|
|
* @param bool $pin pin this object when adding
|
|
* @param bool $rawLeaves use raw blocks for leaf nodes
|
|
* @param bool $nocopy add the file using filestore
|
|
* @param bool $fscache check the filestore for pre-existing blocks
|
|
* @param int $cidVersion CID version
|
|
* @param string $hash hash function to use
|
|
*
|
|
* @return Command
|
|
*/
|
|
public function add(string $file, bool $recursive = false, bool $quiet = false, bool $quieter = false, bool $silent = false, bool $progress = false, bool $trickle = false, bool $onlyHash = false, bool $wrapWithDirectory = false, bool $hidden = false, string $chunker = 'size-262144', bool $pin = true, bool $rawLeaves = false, bool $nocopy = false, bool $fscache = false, int $cidVersion = 0, string $hash = 'sha2-256'): Command
|
|
{
|
|
return new Command(__METHOD__, get_defined_vars());
|
|
}
|
|
|
|
/**
|
|
* Show IPFS object data.
|
|
*
|
|
* @Endpoint(name="cat")
|
|
*
|
|
* @param string $arg the path to the IPFS object(s) to be outputted
|
|
* @param int $offset byte offset to begin reading from
|
|
* @param int $length maximum number of bytes to read
|
|
*
|
|
* @return Command
|
|
*/
|
|
public function cat(string $arg, int $offset = 0, int $length = 0): Command
|
|
{
|
|
return new Command(__METHOD__, get_defined_vars());
|
|
}
|
|
|
|
/**
|
|
* List all available commands.
|
|
*
|
|
* @Endpoint(name="commands")
|
|
*
|
|
* @param bool $flags show command flags
|
|
*
|
|
* @return Command
|
|
*/
|
|
public function commands(bool $flags = false): Command
|
|
{
|
|
return new Command(__METHOD__, get_defined_vars());
|
|
}
|
|
|
|
/**
|
|
* Resolve DNS links.
|
|
*
|
|
* @Endpoint(name="dns")
|
|
*
|
|
* @param string $arg the domain-name name to resolve
|
|
* @param bool $recursive resolve until the result is not a DNS link
|
|
*
|
|
* @return Command
|
|
*/
|
|
public function dns(string $arg, bool $recursive = false): Command
|
|
{
|
|
return new Command(__METHOD__, get_defined_vars());
|
|
}
|
|
|
|
/**
|
|
* Download IPFS objects.
|
|
*
|
|
* @Endpoint(name="get")
|
|
*
|
|
* @param string $arg the path to the IPFS object(s) to be outputted
|
|
* @param string $output the path where the output should be stored
|
|
* @param bool $archive output a TAR archive
|
|
* @param bool $compress compress the output with GZIP compression
|
|
* @param int $compressionLevel the level of compression (1-9)
|
|
*
|
|
* @return Command
|
|
*/
|
|
public function get(string $arg, string $output = null, bool $archive = false, bool $compress = false, int $compressionLevel = 0): Command
|
|
{
|
|
return new Command(__METHOD__, get_defined_vars());
|
|
}
|
|
|
|
/**
|
|
* Show ipfs node id info.
|
|
*
|
|
* @Endpoint(name="id")
|
|
*
|
|
* @param string $arg peer
|
|
* @param string $format optional output format
|
|
*
|
|
* @return Command
|
|
*/
|
|
public function id(string $arg = null, string $format = null): Command
|
|
{
|
|
return new Command(__METHOD__, get_defined_vars());
|
|
}
|
|
|
|
/**
|
|
* List directory contents for Unix filesystem objects.
|
|
*
|
|
* @Endpoint(name="ls")
|
|
*
|
|
* @param string $arg the path to the IPFS object(s) to list links from
|
|
* @param bool $headers print table headers (Hash, Size, Name)
|
|
* @param bool $resolveType resolve linked objects to find out their types
|
|
*
|
|
* @return Command
|
|
*/
|
|
public function ls(string $arg, bool $headers = false, bool $resolveType = true): Command
|
|
{
|
|
return new Command(__METHOD__, get_defined_vars());
|
|
}
|
|
|
|
/**
|
|
* Mounts IPFS to the filesystem (read-only).
|
|
*
|
|
* @Endpoint(name="mount")
|
|
*
|
|
* @param string $ipfsPath the path where IPFS should be mounted
|
|
* @param string $ipnsPath the path where IPNS should be mounted
|
|
*
|
|
* @return Command
|
|
*/
|
|
public function mount(string $ipfsPath = null, string $ipnsPath = null): Command
|
|
{
|
|
return new Command(__METHOD__, get_defined_vars());
|
|
}
|
|
|
|
/**
|
|
* Send echo request packets to IPFS hosts.
|
|
*
|
|
* @Endpoint(name="ping")
|
|
*
|
|
* @param string $arg ID of peer to be pinged
|
|
* @param int $count number of ping messages to send
|
|
*
|
|
* @return Command
|
|
*/
|
|
public function ping(string $arg, int $count = 10): Command
|
|
{
|
|
return new Command(__METHOD__, get_defined_vars());
|
|
}
|
|
|
|
/**
|
|
* Resolve the value of names to IPFS.
|
|
*
|
|
* @Endpoint(name="resolve")
|
|
*
|
|
* @param string $arg the name to resolve
|
|
* @param bool $recursive resolve until the result is an IPFS name
|
|
* @param uint $dhtRecordCount number of records to request for DHT resolution
|
|
* @param string $dhtTimeout max time to collect values during DHT resolution eg “30s”
|
|
*
|
|
* @return Command
|
|
*/
|
|
public function resolve(string $arg, bool $recursive = false, uint $dhtRecordCount = null, string $dhtTimeout = null): Command
|
|
{
|
|
return new Command(__METHOD__, get_defined_vars());
|
|
}
|
|
|
|
/**
|
|
* Shut down the ipfs daemon.
|
|
*
|
|
* @Endpoint(name="shutdown")
|
|
*
|
|
* @return Command
|
|
*/
|
|
public function shutdown(): Command
|
|
{
|
|
return new Command(__METHOD__, get_defined_vars());
|
|
}
|
|
|
|
/**
|
|
* @Endpoint(name="update")
|
|
*
|
|
* @param string $arg arguments for subcommand
|
|
*
|
|
* @return Command
|
|
*/
|
|
public function update(string $arg = null): Command
|
|
{
|
|
return new Command(__METHOD__, get_defined_vars());
|
|
}
|
|
|
|
/**
|
|
* Show ipfs version information.
|
|
*
|
|
* @Endpoint(name="version")
|
|
*
|
|
* @param bool $number only show the version number
|
|
* @param bool $commit show the commit hash
|
|
* @param bool $repo show repo version
|
|
* @param bool $all show all version information
|
|
*
|
|
* @return Command
|
|
*/
|
|
public function version(bool $number = false, bool $commit = false, bool $repo = false, bool $all = false): Command
|
|
{
|
|
return new Command(__METHOD__, get_defined_vars());
|
|
}
|
|
}
|