Skip to content

Commit

Permalink
chore: regenerate example
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
  • Loading branch information
sagikazarmark committed May 12, 2021
1 parent a9dfbcf commit 12adf96
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,17 @@ abstract class HaberdasherAbstractClient
*/
protected $streamFactory;

/**
* @var string
*/
protected $prefix;

public function __construct(
$addr,
ClientInterface $httpClient = null,
RequestFactoryInterface $requestFactory = null,
StreamFactoryInterface $streamFactory = null
StreamFactoryInterface $streamFactory = null,
string $prefix = '/twirp'
) {
if ($httpClient === null) {
$httpClient = Psr18ClientDiscovery::find();
Expand All @@ -68,6 +74,7 @@ public function __construct(
$this->httpClient = $httpClient;
$this->requestFactory = $requestFactory;
$this->streamFactory = $streamFactory;
$this->prefix = ltrim(rtrim($prefix, '/'), '/');
}

/**
Expand All @@ -81,7 +88,12 @@ public function MakeHat(array $ctx, \Twitch\Twirp\Example\Size $in): \Twitch\Twi

$out = new \Twitch\Twirp\Example\Hat();

$url = $this->addr.'/twirp/twitch.twirp.example.Haberdasher/MakeHat';
$url = $this->addr;
if (empty($this->prefix)) {
$url = $url.'/twitch.twirp.example.Haberdasher/MakeHat';
} else {
$url = $url.'/'.$this->prefix.'/twitch.twirp.example.Haberdasher/MakeHat';
}

$this->doRequest($ctx, $url, $in, $out);

Expand Down

0 comments on commit 12adf96

Please sign in to comment.