1. Go to this page and download the library: Download serwisant/serwisant-api library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
serwisant / serwisant-api example snippets
use Serwisant\SerwisantApi;
// get own client and secret by creating an application via webpage
$access_token = new SerwisantApi\AccessTokenOauth('client', 'secret', 'public', (new SerwisantApi\AccessTokenContainerEncryptedFile('some_string_as_encryption_key')));
$api = new SerwisantApi\Api();
$api->setAccessToken($access_token);
use Serwisant\SerwisantApi;
/* @var SerwisantApi\Api $api */
/* please note __typename at each type - it's status {
__typename
displayName
}
}
}';
/* @var SerwisantApi\Types\SchemaPublic\Repair $repair */
$repair = $api->publicQuery()->newRequest()->set($query, ['token' => 'abc-def'])->execute()->fetch();
echo $repair->displayName;
echo $repair->status->displayName;
use Serwisant\SerwisantApi;
/* @var SerwisantApi\Api $api */
// tell SerwisantApi\Api where to look for files with queries, mutations, etc. It can be done once, in 1. example.
$api->addLoadPath('/full/path/to/queries/SchemaPublic');
/* @var SerwisantApi\Types\SchemaPublic\PublicQuery $query */
$query = $api->publicQuery();
/* @var SerwisantApi\Types\SchemaPublic\Repair $repair */
$repair = $query->repairByToken('abc-def'); // abc-def is a token form repair fetched from user input
echo $repair->displayName;
echo $repair->status->displayName;