-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the `custom` method on the Tourware Client to allow fetching the object relation from tourware.
- Loading branch information
Showing
4 changed files
with
56 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tourware\Entities; | ||
|
||
use Adbar\Dot; | ||
use GuzzleHttp\Client as Http; | ||
use Tourware\Clients\WriteClient as WriteClient; | ||
use Tourware\Contracts\WriteClient as WriteClientInterface; | ||
use Tourware\Requests\ApiRequest; | ||
use Tourware\Shared\SendRequest; | ||
use GuzzleHttp\Psr7\Request; | ||
|
||
class Custom | ||
{ | ||
use SendRequest; | ||
|
||
protected string $endpoint; | ||
|
||
protected string $method; | ||
|
||
protected ?array $body; | ||
|
||
public function __construct(Http $http, string $endpoint, string $method, ?array $body = null) | ||
{ | ||
$this->http = $http; | ||
$this->body = $body; | ||
$this->endpoint = $endpoint; | ||
$this->method = $method; | ||
} | ||
|
||
public function call(): Dot | ||
{ | ||
$request = new Request( | ||
$this->method, | ||
$this->endpoint, | ||
$this->body | ||
); | ||
|
||
return $this->sendRequest($request); | ||
} | ||
} |