-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
217 additions
and
15 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,31 @@ | ||
<?php | ||
|
||
namespace Chadicus\Marvel\Api; | ||
|
||
/** | ||
* PHP Client for the Marvel API. | ||
*/ | ||
interface ClientInterface | ||
{ | ||
/** | ||
* Execute a search request against the Marvel API. | ||
* | ||
* @param string $resource The API resource to search for. | ||
* @param array $filters Array of search criteria to use in request. | ||
* | ||
* @return ResponseInterface | ||
* | ||
* @throws \InvalidArgumentException Thrown if $resource is empty or not a string. | ||
*/ | ||
public function search($resource, array $filters = []); | ||
|
||
/** | ||
* Execute a GET request against the Marvel API for a single resource. | ||
* | ||
* @param string $resource The API resource to search for. | ||
* @param integer $id The id of the API resource. | ||
* | ||
* @return ResponseInterface | ||
*/ | ||
public function get($resource, $id); | ||
} |
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,42 @@ | ||
<?php | ||
|
||
namespace Chadicus\Marvel\Api; | ||
|
||
interface DataContainerInterface | ||
{ | ||
|
||
/** | ||
* Returns The requested offset (number of skipped results) of the call. | ||
* | ||
* @return integer | ||
*/ | ||
public function getOffset(); | ||
|
||
/** | ||
* Returns The requested result limit. | ||
* | ||
* @return integer | ||
*/ | ||
public function getLimit(); | ||
|
||
/** | ||
* Returns The total number of resources available given the current filter set. | ||
* | ||
* @return integer | ||
*/ | ||
public function getTotal(); | ||
|
||
/** | ||
* Returns The total number of results returned by this call. | ||
* | ||
* @return integer | ||
*/ | ||
public function getCount(); | ||
|
||
/** | ||
* Returns The list of creators returned by the call. | ||
* | ||
* @return EntityInterface[] | ||
*/ | ||
public function getResults(); | ||
} |
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,55 @@ | ||
<?php | ||
|
||
namespace Chadicus\Marvel\Api; | ||
|
||
interface DataWrapperInterface | ||
{ | ||
/** | ||
* Returns the HTTP status code of the returned result. | ||
* | ||
* @return integer | ||
*/ | ||
public function getCode(); | ||
|
||
/** | ||
* Returns A string description of the call status. | ||
* | ||
* @return string | ||
*/ | ||
public function getStatus(); | ||
|
||
/** | ||
* Returns the copyright notice for the returned result. | ||
* | ||
* @return string | ||
*/ | ||
public function getCopyright(); | ||
|
||
/** | ||
* Returns the attribution notice for this result | ||
* | ||
* @return string | ||
*/ | ||
public function getAttributionText(); | ||
|
||
/** | ||
* Returns an HTML representation of the attribution notice for this result. | ||
* | ||
* @return string | ||
*/ | ||
public function getAttributionHTML(); | ||
|
||
/** | ||
* Returns a digest value of the content returned by the call. | ||
* | ||
* @return string | ||
*/ | ||
public function getEtag(); | ||
|
||
/** | ||
* Returns the results returned by the call. | ||
* | ||
* @return DataContainerInterface | ||
*/ | ||
public function getData(); | ||
} |
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,37 @@ | ||
<?php | ||
|
||
namespace Chadicus\Marvel\Api; | ||
|
||
/** | ||
* Represents a request to the Marvel API. | ||
*/ | ||
interface RequestInterface | ||
{ | ||
/** | ||
* Get the url of this request. | ||
* | ||
* @return string | ||
*/ | ||
public function getUrl(); | ||
|
||
/** | ||
* Get the method of this request. | ||
* | ||
* @return string | ||
*/ | ||
public function getMethod(); | ||
|
||
/** | ||
* Get the body of this request. | ||
* | ||
* @return array | ||
*/ | ||
public function getBody(); | ||
|
||
/** | ||
* Get the headers of this request. | ||
* | ||
* @return array | ||
*/ | ||
public function getHeaders(); | ||
} |
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,37 @@ | ||
<?php | ||
|
||
namespace Chadicus\Marvel\Api; | ||
|
||
/** | ||
* Represents a response from the Marvel API. | ||
*/ | ||
interface ResponseInterface | ||
{ | ||
/** | ||
* Returns the HTTP status code of the response. | ||
* | ||
* @return integer | ||
*/ | ||
public function getHttpCode(); | ||
|
||
/** | ||
* Returns the response body. | ||
* | ||
* @return array | ||
*/ | ||
public function getBody(); | ||
|
||
/** | ||
* Returns response headers. | ||
* | ||
* @return array | ||
*/ | ||
public function getHeaders(); | ||
|
||
/** | ||
* Returns the parsed API response. | ||
* | ||
* @return DataWrapperInterface | ||
*/ | ||
public function getDataWrapper(); | ||
} |