|
31 | 31 | This PHP package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: |
32 | 32 |
|
33 | 33 | - API version: 3 |
34 | | - - Package version: dev-0.3.0-4 |
| 34 | + - Package version: dev-0.3.0-7 |
35 | 35 | - Build package: io.swagger.codegen.v3.generators.php.PhpClientCodegen |
36 | 36 |
|
37 | 37 | ## Requirements |
38 | 38 |
|
39 | | -PHP 5.5 and later |
| 39 | +PHP 7.1 and later |
40 | 40 |
|
41 | 41 | ## Installation & Usage |
42 | 42 | ### Composer |
@@ -82,60 +82,71 @@ Please follow the [installation procedure](#installation--usage) and then run th |
82 | 82 |
|
83 | 83 | ```php |
84 | 84 | <?php |
| 85 | + |
85 | 86 | require_once(__DIR__ . '/vendor/autoload.php'); |
86 | 87 |
|
87 | | -// Configure API key authorization: ApiKeyHeader |
88 | | -$config = Fingerprint\ServerAPI\Configuration::getDefaultConfiguration()->setApiKey('Auth-API-Key', 'YOUR_API_KEY'); |
89 | | -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed |
90 | | -// $config = Fingerprint\ServerAPI\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Auth-API-Key', 'Bearer'); |
91 | | -// Configure API key authorization: ApiKeyQuery |
92 | | -$config = Fingerprint\ServerAPI\Configuration::getDefaultConfiguration()->setApiKey('api_key', 'YOUR_API_KEY'); |
93 | | -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed |
94 | | -// $config = Fingerprint\ServerAPI\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api_key', 'Bearer'); |
95 | | - |
96 | | -$apiInstance = new Fingerprint\ServerAPI\Api\FingerprintApi( |
97 | | -// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. |
98 | | -// This is optional, `GuzzleHttp\Client` will be used as default. |
99 | | - new GuzzleHttp\Client(), |
| 88 | +// Our Fingerprint API Secret |
| 89 | +const FPJS_API_SECRET = "YOUR SECRET KEY COMES HERE"; |
| 90 | +// A Request ID that made by a specific visitor |
| 91 | +const FPJS_REQUEST_ID = "REQUEST ID"; // Change this value with your request id |
| 92 | +// A Visitor ID of a specific visitor |
| 93 | +const FPJS_VISITOR_ID = "VISITOR ID"; // Change this value with your visitor id |
| 94 | + |
| 95 | +// Linked id of the visit |
| 96 | +const FPJS_LINKED_ID = "LINKED ID"; // Change this value with your linked id |
| 97 | +// How many items to fetch, while paginating |
| 98 | +const LIMIT = 10; |
| 99 | +// How many items to skip, while paginating |
| 100 | +const BEFORE = 1; |
| 101 | + |
| 102 | +// Import Fingerprint Classes and Guzzle Http Client |
| 103 | +use Fingerprint\ServerAPI\Api\FingerprintApi; |
| 104 | +use Fingerprint\ServerAPI\Configuration; |
| 105 | +use GuzzleHttp\Client; |
| 106 | + |
| 107 | +// Create new Configuration instance with defaultValues, added our API Secret and our Region |
| 108 | +$config = Configuration::getDefaultConfiguration(FPJS_API_SECRET, Configuration::REGION_EUROPE); |
| 109 | +$client = new FingerprintApi( |
| 110 | + new Client(), |
100 | 111 | $config |
101 | 112 | ); |
102 | | -$request_id = "request_id_example"; // string | Request ID |
103 | 113 |
|
| 114 | +// Let's try to get an event with given Request ID |
104 | 115 | try { |
105 | | - $result = $apiInstance->getEvent($request_id); |
106 | | - print_r($result); |
| 116 | + // Fetch event with given Request ID |
| 117 | + $response = $client->getEvent(FPJS_REQUEST_ID); |
| 118 | + echo "<pre>" . $response->__toString() . "</pre>"; |
107 | 119 | } catch (Exception $e) { |
108 | 120 | echo 'Exception when calling FingerprintApi->getEvent: ', $e->getMessage(), PHP_EOL; |
109 | 121 | } |
110 | 122 |
|
111 | | -// Configure API key authorization: ApiKeyHeader |
112 | | -$config = Fingerprint\ServerAPI\Configuration::getDefaultConfiguration()->setApiKey('Auth-API-Key', 'YOUR_API_KEY'); |
113 | | -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed |
114 | | -// $config = Fingerprint\ServerAPI\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Auth-API-Key', 'Bearer'); |
115 | | -// Configure API key authorization: ApiKeyQuery |
116 | | -$config = Fingerprint\ServerAPI\Configuration::getDefaultConfiguration()->setApiKey('api_key', 'YOUR_API_KEY'); |
117 | | -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed |
118 | | -// $config = Fingerprint\ServerAPI\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api_key', 'Bearer'); |
119 | | - |
120 | | -$apiInstance = new Fingerprint\ServerAPI\Api\FingerprintApi( |
121 | | -// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. |
122 | | -// This is optional, `GuzzleHttp\Client` will be used as default. |
123 | | - new GuzzleHttp\Client(), |
124 | | - $config |
125 | | -); |
126 | | -$visitor_id = "visitor_id_example"; // string | |
127 | | -$request_id = "request_id_example"; // string | Filter events by requestId |
128 | | -$linked_id = "linked_id_example"; // string | Filter events by custom identifier |
129 | | -$limit = 56; // int | Limit scanned results |
130 | | -$before = 56; // int | Used to paginate results |
| 123 | +// Let's try to get a specific visitor's all visits |
| 124 | +try { |
| 125 | + // Fetch all visits with given Visitor ID, with a page limit |
| 126 | + $response = $client->getVisits(FPJS_VISITOR_ID, null, null, LIMIT); |
| 127 | + echo "<pre>" . $response->__toString() . "</pre>"; |
| 128 | +} catch (Exception $e) { |
| 129 | + echo 'Exception when calling FingerprintApi->getEvent: ', $e->getMessage(), PHP_EOL; |
| 130 | +} |
131 | 131 |
|
| 132 | +// Let's try to get a specific visitor's all visits with linked id |
132 | 133 | try { |
133 | | - $result = $apiInstance->getVisits($visitor_id, $request_id, $linked_id, $limit, $before); |
134 | | - print_r($result); |
| 134 | + // Fetch all visits with given Visitor ID, with a page limit, skipping first the first visit |
| 135 | + $response = $client->getVisits(FPJS_VISITOR_ID, null, FPJS_LINKED_ID, LIMIT, BEFORE); |
| 136 | + echo "<pre>" . $response->__toString() . "</pre>"; |
135 | 137 | } catch (Exception $e) { |
136 | | - echo 'Exception when calling FingerprintApi->getVisits: ', $e->getMessage(), PHP_EOL; |
| 138 | + echo 'Exception when calling FingerprintApi->getEvent: ', $e->getMessage(), PHP_EOL; |
137 | 139 | } |
138 | | -?> |
| 140 | + |
| 141 | +// Let's use all the parameters on getVisits |
| 142 | +try { |
| 143 | + // We fetch the visitor's all visits with given Request ID, Linked ID with a page limit while skipping first visit |
| 144 | + $response = $client->getVisits(FPJS_VISITOR_ID, FPJS_REQUEST_ID, FPJS_LINKED_ID, LIMIT, BEFORE); |
| 145 | + echo "<pre>" . $response->__toString() . "</pre>"; |
| 146 | +} catch (Exception $e) { |
| 147 | + echo 'Exception when calling FingerprintApi->getEvent: ', $e->getMessage(), PHP_EOL; |
| 148 | +} |
| 149 | + |
139 | 150 | ``` |
140 | 151 |
|
141 | 152 | ## Documentation for API Endpoints |
|
0 commit comments