dev-master
9999999-devClient API SDK
The Requires
- php >=5.3.3
- lib-curl *
The Development Requires
Client API SDK
Create a new instance:, (*1)
$ihasco = Ihasco\ClientSDK\Manager::create('your-api-key');
All calls to the API return either a Ihasco\ClientSDK\Responses\Response
object or throw a Ihasco\ClientSDK\Exceptions\Exception
., (*2)
$response = $ihasco->programmes->all(); $allProgrammes = $response->getData();
Returns an array of Ihasco\ClientSDK\Responses\Programme
objects, (*3)
$response = $ihasco->programmes->one(int $programmeId); $oneProgramme = $response->getData();
Returns a single Ihasco\ClientSDK\Responses\Programme
object, (*4)
$response = $ihasco->results->all(); $allResults = $response->getData();
Returns an array of Ihasco\ClientSDK\Responses\Result
objects, (*5)
$response = $ihasco->results->one(int $resultId); $oneResult = $response->getData();
Returns a single Ihasco\ClientSDK\Responses\Result
object, (*6)
$response = $ihasco->users->all(); $allUsers = $response->getData();
Returns an array of Ihasco\ClientSDK\Responses\User
objects, (*7)
Supply a userId or email address, (*8)
$response = $ihasco->users->one(mixed $userId); $oneUser = $response->getData();
Returns a single Ihasco\ClientSDK\Responses\User
object, (*9)
$response = $ihasco->users->results(mixed $resultId, int $cursor = null); $allResults = $response->getData();
Returns an array of Ihasco\ClientSDK\Responses\Result
objects, (*10)
Send data as per api spec, (*11)
$response = $ihasco->users->create(array $userData); $oneUser = $response->getData();
Returns a single Ihasco\ClientSDK\Responses\User
object, (*12)
Send data as per api spec, (*13)
$response = $ihasco->users->update(int $userId, array $userData); $oneUser = $response->getData();
Returns a single Ihasco\ClientSDK\Responses\User
object, (*14)
$response = $users->delete(int $id);
Anything other than a 2xx response will result in a Ihasco\ClientSDK\Exceptions\Exception
being thrown. Possible exceptions are as follows:, (*15)
try { $response = $ihasco->programmes->all(); } catch(Ihasco\ClientSDK\Exceptions\CannotConnect $e) { // Cannot connect to server } catch(Ihasco\ClientSDK\Exceptions\CannotAuthenticate $e) { // Bad API key } catch(Ihasco\ClientSDK\Exceptions\InvalidResource $e) { // Non-existent resource } catch(Ihasco\ClientSDK\Exceptions\ServerError $e) { // Something went wrong on the server } catch(Ihasco\ClientSDK\Exceptions\BadMethod $e) { // Invalid HTTP method } catch(Ihasco\ClientSDK\Exceptions\ValidationError $e) { // Something wrong with your submission var_dump($e->getErrors()); } catch(Exception $e) { // something else }
$hasPagination = $response->hasPagination(); // boolean $nextPage = $response->getNextPage(); // Response or null $prevPage = $response->getPrevPage(); // Response or null
Client API SDK