Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from smartsendio/develop
v0.2.0
- Loading branch information
Showing
47 changed files
with
1,370 additions
and
804 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?php | ||
|
||
namespace Smartsendio\Api; | ||
|
||
use Psr\Http\Message\ResponseInterface as Psr7ResponseInterface; | ||
use Smartsendio\Api\Contracts\ApiErrorInterface; | ||
use Smartsendio\Api\Contracts\ApiResponseInterface; | ||
|
||
abstract class AbstractApiResponse implements ApiResponseInterface | ||
{ | ||
/** @var ApiResponseInterface */ | ||
protected $api_response; | ||
|
||
public function __construct(ApiResponseInterface $api_response) | ||
{ | ||
$this->api_response = $api_response; | ||
} | ||
|
||
public function getDecodedData(): array | ||
{ | ||
return $this->api_response->getDecodedData(); | ||
} | ||
|
||
public function isSuccessful(): bool | ||
{ | ||
return $this->api_response->isSuccessful(); | ||
} | ||
|
||
public function getResponse(): Psr7ResponseInterface | ||
{ | ||
return $this->api_response->getResponse(); | ||
} | ||
|
||
public function hasData(): bool | ||
{ | ||
return $this->api_response->hasData(); | ||
} | ||
|
||
public function hasLinks(): bool | ||
{ | ||
return $this->api_response->hasData(); | ||
} | ||
|
||
public function getLinks(): array | ||
{ | ||
return $this->api_response->getLinks(); | ||
} | ||
|
||
public function hasMeta(): bool | ||
{ | ||
return $this->api_response->hasMeta(); | ||
} | ||
|
||
public function getMeta(): array | ||
{ | ||
return $this->api_response->getMeta(); | ||
} | ||
|
||
public function getError(): ApiErrorInterface | ||
{ | ||
return $this->api_response->getError(); | ||
} | ||
} |
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,21 @@ | ||
<?php | ||
|
||
namespace Smartsendio\Api; | ||
|
||
use Smartsendio\Api\Contracts\AgentApiResponseInterface; | ||
use Smartsendio\Api\Data\Responses\AgentResponse; | ||
|
||
class AgentApiResponse extends AbstractApiResponse implements AgentApiResponseInterface | ||
{ | ||
/** @var AgentResponse */ | ||
protected $data; | ||
|
||
public function getData(): AgentResponse | ||
{ | ||
if (empty($this->data)) { | ||
$this->data = new AgentResponse($this->api_response->getDecodedData()); | ||
} | ||
|
||
return $this->data; | ||
} | ||
} |
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
Oops, something went wrong.