1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* This file is part of the "php-ipfs" package. |
7
|
|
|
* |
8
|
|
|
* (c) Robert Schönthal <[email protected]> |
9
|
|
|
* |
10
|
|
|
* For the full copyright and license information, please view the LICENSE |
11
|
|
|
* file that was distributed with this source code. |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
namespace IPFS\Api; |
15
|
|
|
|
16
|
|
|
use IPFS\Annotation\Api as Endpoint; |
17
|
|
|
use IPFS\Command\Command; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @author Robert Schönthal <[email protected]> |
21
|
|
|
* @autogenerated |
22
|
|
|
* @codeCoverageIgnore |
23
|
|
|
*/ |
24
|
|
|
final class Block implements Api |
25
|
|
|
{ |
26
|
|
|
/** |
27
|
|
|
* Get a raw IPFS block. |
28
|
|
|
* |
29
|
|
|
* @Endpoint(name="block:get") |
30
|
|
|
* |
31
|
|
|
* @param string $arg the base58 multihash of an existing block to get |
32
|
|
|
* |
33
|
|
|
* @return Command |
34
|
|
|
*/ |
35
|
|
|
public function get(string $arg): Command |
36
|
|
|
{ |
37
|
|
|
return new Command(__METHOD__, get_defined_vars()); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* Store input as an IPFS block. |
42
|
|
|
* |
43
|
|
|
* @Endpoint(name="block:put") |
44
|
|
|
* |
45
|
|
|
* @param string $file the data to be stored as an IPFS block |
46
|
|
|
* @param string $format cid format for blocks to be created with |
47
|
|
|
* @param string $mhtype multihash hash function |
48
|
|
|
* @param int $mhlen multihash hash length |
49
|
|
|
* |
50
|
|
|
* @return Command |
51
|
|
|
*/ |
52
|
|
|
public function put(string $file, string $format = 'v0', string $mhtype = 'sha2-256', int $mhlen = -1): Command |
53
|
|
|
{ |
54
|
|
|
return new Command(__METHOD__, get_defined_vars()); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* Remove IPFS block(s). |
59
|
|
|
* |
60
|
|
|
* @Endpoint(name="block:rm") |
61
|
|
|
* |
62
|
|
|
* @param string $arg bash58 encoded multihash of block(s) to remove |
63
|
|
|
* @param bool $force ignore nonexistent blocks |
64
|
|
|
* @param bool $quiet write minimal output |
65
|
|
|
* |
66
|
|
|
* @return Command |
67
|
|
|
*/ |
68
|
|
|
public function rm(string $arg, bool $force = false, bool $quiet = false): Command |
69
|
|
|
{ |
70
|
|
|
return new Command(__METHOD__, get_defined_vars()); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* Print information of a raw IPFS block. |
75
|
|
|
* |
76
|
|
|
* @Endpoint(name="block:stat") |
77
|
|
|
* |
78
|
|
|
* @param string $arg the base58 multihash of an existing block to stat |
79
|
|
|
* |
80
|
|
|
* @return Command |
81
|
|
|
*/ |
82
|
|
|
public function stat(string $arg): Command |
83
|
|
|
{ |
84
|
|
|
return new Command(__METHOD__, get_defined_vars()); |
85
|
|
|
} |
86
|
|
|
} |
87
|
|
|
|