astrXbian/www/multitube/vendor/ipfs/php-client/src/Api/Pubsub.php

82 lines
1.9 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 Pubsub implements Api
{
/**
* List subscribed topics by name.
*
* @Endpoint(name="pubsub:ls")
*
* @return Command
*/
public function ls(): Command
{
return new Command(__METHOD__, get_defined_vars());
}
/**
* List peers we are currently pubsubbing with.
*
* @Endpoint(name="pubsub:peers")
*
* @param string $arg topic to list connected peers of Required: no
*
* @return Command
*/
public function peers(string $arg = null): Command
{
return new Command(__METHOD__, get_defined_vars());
}
/**
* Publish a message to a given pubsub topic.
*
* @Endpoint(name="pubsub:pub")
*
* @param string $arg topic to publish to
* @param string $arg1 payload of message to publish
*
* @return Command
*/
public function pub(string $arg, string $arg1): Command
{
return new Command(__METHOD__, get_defined_vars());
}
/**
* Subscribe to messages on a given topic.
*
* @Endpoint(name="pubsub:sub")
*
* @param string $arg string name of topic to subscribe to
* @param bool $discover try to discover other peers subscribed to the same topic
*
* @return Command
*/
public function sub(string $arg, bool $discover = false): Command
{
return new Command(__METHOD__, get_defined_vars());
}
}