Skip to content

Commit

Permalink
update apis
Browse files Browse the repository at this point in the history
  • Loading branch information
digitalkaoz committed Feb 27, 2017
1 parent c589176 commit 2de65b5
Show file tree
Hide file tree
Showing 20 changed files with 344 additions and 110 deletions.
15 changes: 8 additions & 7 deletions src/Api/Basics.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
final class Basics implements Api
{
/**
* Add a file to ipfs.
* Add a file or directory to ipfs.
*
* @Endpoint(name="add")
*
* @param string $file the path to a file to be added to IPFS
* @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 $silent write no output
Expand All @@ -39,10 +39,11 @@ final class Basics implements Api
* @param bool $hidden include files that are hidden
* @param string $chunker chunking algorithm to use
* @param bool $pin pin this object when adding
* @param bool $rawLeaves use raw blocks for leaf nodes
*
* @return Command
*/
public function add(string $file, bool $recursive = false, bool $quiet = false, bool $silent = false, bool $progress = null, bool $trickle = false, bool $onlyHash = false, bool $wrapWithDirectory = false, bool $hidden = false, string $chunker = null, bool $pin = true): Command
public function add(string $file, bool $recursive = false, bool $quiet = null, bool $silent = null, bool $progress = null, bool $trickle = null, bool $onlyHash = null, bool $wrapWithDirectory = null, bool $hidden = null, string $chunker = null, bool $pin = true, bool $rawLeaves = null): Command
{
return new Command(__METHOD__, get_defined_vars());
}
Expand Down Expand Up @@ -76,7 +77,7 @@ public function commands(bool $flags = false): Command
}

/**
* DNS link resolver.
* Resolve DNS links.
*
* @Endpoint(name="dns")
*
Expand Down Expand Up @@ -109,7 +110,7 @@ public function get(string $arg, string $output = null, bool $archive = false, b
}

/**
* Show IPFS Node ID info.
* Show ipfs node id info.
*
* @Endpoint(name="id")
*
Expand All @@ -124,7 +125,7 @@ public function id(string $arg = null, string $format = null): Command
}

/**
* List links from an object.
* List directory contents for Unix filesystem objects.
*
* @Endpoint(name="ls")
*
Expand Down Expand Up @@ -197,7 +198,7 @@ public function update(string $arg = null): Command
}

/**
* Shows ipfs version information.
* Show ipfs version information.
*
* @Endpoint(name="version")
*
Expand Down
14 changes: 14 additions & 0 deletions src/Api/Bitswap.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,20 @@
*/
final class Bitswap implements Api
{
/**
* Show the current ledger for a peer.
*
* @Endpoint(name="bitswap:ledger")
*
* @param string $arg the PeerID (B58) of the ledger to inspect
*
* @return Command
*/
public function ledger(string $arg): Command
{
return new Command(__METHOD__, get_defined_vars());
}

/**
* Show some diagnostic information on the bitswap agent.
*
Expand Down
25 changes: 22 additions & 3 deletions src/Api/Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,34 @@ public function get(string $arg): Command
}

/**
* Stores input as an IPFS block.
* Store input as an IPFS block.
*
* @Endpoint(name="block:put")
*
* @param string $file the data to be stored as an IPFS block
* @param string $file the data to be stored as an IPFS block
* @param string $format cid format for blocks to be created with
* @param string $mhtype multihash hash function
* @param int $mhlen multihash hash length
*
* @return Command
*/
public function put(string $file): Command
public function put(string $file, string $format = 'v0', string $mhtype = 'sha2-256', int $mhlen = -1): Command
{
return new Command(__METHOD__, get_defined_vars());
}

/**
* Remove IPFS block(s).
*
* @Endpoint(name="block:rm")
*
* @param string $arg bash58 encoded multihash of block(s) to remove
* @param bool $force ignore nonexistent blocks
* @param bool $quiet write minimal output
*
* @return Command
*/
public function rm(string $arg, bool $force = false, bool $quiet = false): Command
{
return new Command(__METHOD__, get_defined_vars());
}
Expand Down
2 changes: 1 addition & 1 deletion src/Api/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function list(): Command
}

/**
* Removes all peers from the bootstrap list.
* Remove all peers from the bootstrap list.
*
* @Endpoint(name="bootstrap:rm:all")
*
Expand Down
6 changes: 3 additions & 3 deletions src/Api/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
final class Config implements Api
{
/**
* Opens the config file for editing in $EDITOR.
* Open the config file for editing in $EDITOR.
*
* @Endpoint(name="config:edit")
*
Expand All @@ -36,7 +36,7 @@ public function edit(): Command
}

/**
* Replaces the config with .
* Replace the config with .
*
* @Endpoint(name="config:replace")
*
Expand All @@ -50,7 +50,7 @@ public function replace(string $file): Command
}

/**
* Outputs the content of the config file.
* Output config file contents.
*
* @Endpoint(name="config:show")
*
Expand Down
55 changes: 55 additions & 0 deletions src/Api/Dag.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?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 Dag implements Api
{
/**
* Get a dag node from ipfs.
*
* @Endpoint(name="dag:get")
*
* @param string $arg the object to get Required:
*
* @return Command
*/
public function get(string $arg): Command
{
return new Command(__METHOD__, get_defined_vars());
}

/**
* Add a dag node to ipfs.
*
* @Endpoint(name="dag:put")
*
* @param string $file the object to put Required:
* @param string $format format that the object will be added as
* @param string $inputEnc format that the input object will be
*
* @return Command
*/
public function put(string $file, string $format = 'cbor', string $inputEnc = 'json'): Command
{
return new Command(__METHOD__, get_defined_vars());
}
}
136 changes: 68 additions & 68 deletions src/Api/Dht.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
<?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.
*/

declare (strict_types=1);
namespace IPFS\Api;

use IPFS\Annotation\Api as Endpoint;
use IPFS\Command\Command;

/**
* @author Robert Schönthal <robert.schoenthal@gmail.com>
* @autogenerated
Expand All @@ -24,78 +13,89 @@
final class Dht implements Api
{
/**
* Query the DHT for all of the multiaddresses associated with a Peer ID.
*
* @Endpoint(name="dht:findpeer")
*
* @param string $arg the ID of the peer to search for
* @param bool $verbose print extra information
*
* @return Command
*/
public function findpeer(string $arg, bool $verbose = false): Command
* Query the DHT for all of the multiaddresses associated with a Peer ID.
*
* @Endpoint(name="dht:findpeer")
*
* @param string $arg The ID of the peer to search for.
* @param bool $verbose Print extra information.
*
* @return Command
*/
public function findpeer(string $arg, bool $verbose = false) : Command
{
return new Command(__METHOD__, get_defined_vars());
}

/**
* Find peers in the DHT that can provide a specific value, given a key.
*
* @Endpoint(name="dht:findprovs")
*
* @param string $arg the key to find providers for
* @param bool $verbose print extra information
*
* @return Command
*/
public function findprovs(string $arg, bool $verbose = false): Command
* Find peers in the DHT that can provide a specific value, given a key.
*
* @Endpoint(name="dht:findprovs")
*
* @param string $arg The key to find providers for.
* @param bool $verbose Print extra information.
*
* @return Command
*/
public function findprovs(string $arg, bool $verbose = false) : Command
{
return new Command(__METHOD__, get_defined_vars());
}

/**
* Given a key, query the DHT for its best value.
*
* @Endpoint(name="dht:get")
*
* @param string $arg the key to find a value for
* @param bool $verbose print extra information
*
* @return Command
*/
public function get(string $arg, bool $verbose = false): Command
* Given a key, query the DHT for its best value.
*
* @Endpoint(name="dht:get")
*
* @param string $arg The key to find a value for.
* @param bool $verbose Print extra information.
*
* @return Command
*/
public function get(string $arg, bool $verbose = false) : Command
{
return new Command(__METHOD__, get_defined_vars());
}

/**
* Write a key/value pair to the DHT.
*
* @Endpoint(name="dht:put")
*
* @param string $arg the key to store the value at
* @param string $arg1 the value to store
* @param bool $verbose print extra information
*
* @return Command
*/
public function put(string $arg, string $arg1, bool $verbose = false): Command
* Announce to the network that you are providing given values.
*
* @Endpoint(name="dht:provide")
*
* @param string]: The key[s $arg The key[s] to send provide records for.
* @param bool $verbose Print extra information.
* @param bool $recursive Recursively provide entire graph.
*
* @return Command
*/
public function provide(string]: The key[s $arg, bool $verbose = false, bool $recursive = false) : Command
{
return new Command(__METHOD__, get_defined_vars());
}
/**
* Write a key/value pair to the DHT.
*
* @Endpoint(name="dht:put")
*
* @param string $arg The key to store the value at.
* @param string $arg1 The value to store.
* @param bool $verbose Print extra information.
*
* @return Command
*/
public function put(string $arg, string $arg1, bool $verbose = false) : Command
{
return new Command(__METHOD__, get_defined_vars());
}

/**
* Find the closest Peer IDs to a given Peer ID by querying the DHT.
*
* @Endpoint(name="dht:query")
*
* @param string $arg the peerID to run the query against
* @param bool $verbose print extra information
*
* @return Command
*/
public function query(string $arg, bool $verbose = false): Command
* Find the closest Peer IDs to a given Peer ID by querying the DHT.
*
* @Endpoint(name="dht:query")
*
* @param string $arg The peerID to run the query against.
* @param bool $verbose Print extra information.
*
* @return Command
*/
public function query(string $arg, bool $verbose = false) : Command
{
return new Command(__METHOD__, get_defined_vars());
}
}
}
Loading

0 comments on commit 2de65b5

Please sign in to comment.