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 Cobject implements Api |
25
|
|
|
{ |
26
|
|
|
/** |
27
|
|
|
* Output the raw bytes of an IPFS object. |
28
|
|
|
* |
29
|
|
|
* @Endpoint(name="object:data") |
30
|
|
|
* |
31
|
|
|
* @param string $arg key of the object to retrieve, in base58-encoded multihash format |
32
|
|
|
* |
33
|
|
|
* @return Command |
34
|
|
|
*/ |
35
|
|
|
public function data(string $arg): Command |
36
|
|
|
{ |
37
|
|
|
return new Command(__METHOD__, get_defined_vars()); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* Display the diff between two ipfs objects. |
42
|
|
|
* |
43
|
|
|
* @Endpoint(name="object:diff") |
44
|
|
|
* |
45
|
|
|
* @param string $arg object to diff against |
46
|
|
|
* @param string $arg1 object to diff |
47
|
|
|
* @param bool $verbose print extra information |
48
|
|
|
* |
49
|
|
|
* @return Command |
50
|
|
|
*/ |
51
|
|
|
public function diff(string $arg, string $arg1, bool $verbose = false): Command |
52
|
|
|
{ |
53
|
|
|
return new Command(__METHOD__, get_defined_vars()); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* Get and serialize the DAG node named by . |
58
|
|
|
* |
59
|
|
|
* @Endpoint(name="object:get") |
60
|
|
|
* |
61
|
|
|
* @param string $arg key of the object to retrieve, in base58-encoded multihash format |
62
|
|
|
* |
63
|
|
|
* @return Command |
64
|
|
|
*/ |
65
|
|
|
public function get(string $arg): Command |
66
|
|
|
{ |
67
|
|
|
return new Command(__METHOD__, get_defined_vars()); |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* Output the links pointed to by the specified object. |
72
|
|
|
* |
73
|
|
|
* @Endpoint(name="object:links") |
74
|
|
|
* |
75
|
|
|
* @param string $arg key of the object to retrieve, in base58-encoded multihash format |
76
|
|
|
* @param bool $headers print table headers (Hash, Size, Name) |
77
|
|
|
* |
78
|
|
|
* @return Command |
79
|
|
|
*/ |
80
|
|
|
public function links(string $arg, bool $headers = false): Command |
81
|
|
|
{ |
82
|
|
|
return new Command(__METHOD__, get_defined_vars()); |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* Create a new object from an ipfs template. |
87
|
|
|
* |
88
|
|
|
* @Endpoint(name="object:new") |
89
|
|
|
* |
90
|
|
|
* @param string $arg template to use |
91
|
|
|
* |
92
|
|
|
* @return Command |
93
|
|
|
*/ |
94
|
|
|
public function new(string $arg = null): Command |
95
|
|
|
{ |
96
|
|
|
return new Command(__METHOD__, get_defined_vars()); |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* Add a link to a given object. |
101
|
|
|
* |
102
|
|
|
* @Endpoint(name="object:patch:add-link") |
103
|
|
|
* |
104
|
|
|
* @param string $arg the hash of the node to modify |
105
|
|
|
* @param string $arg1 name of link to create |
106
|
|
|
* @param string $arg2 IPFS object to add link to |
107
|
|
|
* @param bool $create create intermediary nodes |
108
|
|
|
* |
109
|
|
|
* @return Command |
110
|
|
|
*/ |
111
|
|
|
public function patchAddLink(string $arg, string $arg1, string $arg2, bool $create = false): Command |
112
|
|
|
{ |
113
|
|
|
return new Command(__METHOD__, get_defined_vars()); |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* Append data to the data segment of a dag node. |
118
|
|
|
* |
119
|
|
|
* @Endpoint(name="object:patch:append-data") |
120
|
|
|
* |
121
|
|
|
* @param string $arg the hash of the node to modify |
122
|
|
|
* @param string $file data to append |
123
|
|
|
* |
124
|
|
|
* @return Command |
125
|
|
|
*/ |
126
|
|
|
public function patchAppendData(string $arg, string $file): Command |
127
|
|
|
{ |
128
|
|
|
return new Command(__METHOD__, get_defined_vars()); |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* Remove a link from an object. |
133
|
|
|
* |
134
|
|
|
* @Endpoint(name="object:patch:rm-link") |
135
|
|
|
* |
136
|
|
|
* @param string $arg the hash of the node to modify |
137
|
|
|
* @param string $arg1 name of the link to remove |
138
|
|
|
* |
139
|
|
|
* @return Command |
140
|
|
|
*/ |
141
|
|
|
public function patchRmLink(string $arg, string $arg1): Command |
142
|
|
|
{ |
143
|
|
|
return new Command(__METHOD__, get_defined_vars()); |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
/** |
147
|
|
|
* Set the data field of an IPFS object. |
148
|
|
|
* |
149
|
|
|
* @Endpoint(name="object:patch:set-data") |
150
|
|
|
* |
151
|
|
|
* @param string $arg the hash of the node to modify |
152
|
|
|
* @param string $file the data to set the object to |
153
|
|
|
* |
154
|
|
|
* @return Command |
155
|
|
|
*/ |
156
|
|
|
public function patchSetData(string $arg, string $file): Command |
157
|
|
|
{ |
158
|
|
|
return new Command(__METHOD__, get_defined_vars()); |
159
|
|
|
} |
160
|
|
|
|
161
|
|
|
/** |
162
|
|
|
* Store input as a DAG object, print its key. |
163
|
|
|
* |
164
|
|
|
* @Endpoint(name="object:put") |
165
|
|
|
* |
166
|
|
|
* @param string $file data to be stored as a DAG object |
167
|
|
|
* @param string $inputenc encoding type of input data |
168
|
|
|
* @param string $datafieldenc encoding type of the data field, either “text” or “base64” |
169
|
|
|
* @param bool $pin pin this object when adding |
170
|
|
|
* @param bool $quiet write minimal output |
171
|
|
|
* |
172
|
|
|
* @return Command |
173
|
|
|
*/ |
174
|
|
|
public function put(string $file, string $inputenc = 'json', string $datafieldenc = 'text', bool $pin = false, bool $quiet = false): Command |
175
|
|
|
{ |
176
|
|
|
return new Command(__METHOD__, get_defined_vars()); |
177
|
|
|
} |
178
|
|
|
|
179
|
|
|
/** |
180
|
|
|
* Get stats for the DAG node named by . |
181
|
|
|
* |
182
|
|
|
* @Endpoint(name="object:stat") |
183
|
|
|
* |
184
|
|
|
* @param string $arg key of the object to retrieve, in base58-encoded multihash format |
185
|
|
|
* |
186
|
|
|
* @return Command |
187
|
|
|
*/ |
188
|
|
|
public function stat(string $arg): Command |
189
|
|
|
{ |
190
|
|
|
return new Command(__METHOD__, get_defined_vars()); |
191
|
|
|
} |
192
|
|
|
} |
193
|
|
|
|