Skip to content

Commit

Permalink
refactor: add descriptions to methods and properties
Browse files Browse the repository at this point in the history
  • Loading branch information
Orkuncakilkaya committed Aug 9, 2024
1 parent 1840ba6 commit 7a209f8
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 2 deletions.
18 changes: 18 additions & 0 deletions src/Api/FingerprintApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ public function getConfig(): Configuration
*
* Get event by requestId
*
* @param string $request_id The unique [identifier](https://dev.fingerprint.com/docs/js-agent#requestid) of each analysis request. (required)
*
* @return array{ null|\Fingerprint\ServerAPI\Model\EventResponse, \Psr\Http\Message\ResponseInterface }
*
* @throws \InvalidArgumentException
Expand Down Expand Up @@ -162,6 +164,8 @@ public function getEvent(string $request_id): array
*
* Get event by requestId
*
* @param string $request_id The unique [identifier](https://dev.fingerprint.com/docs/js-agent#requestid) of each analysis request. (required)
*
* @throws \InvalidArgumentException
* @throws SerializationException
*/
Expand Down Expand Up @@ -237,6 +241,13 @@ function ($e) {
*
* Get visits by visitorId
*
* @param string $visitor_id Unique identifier of the visitor issued by Fingerprint Pro. (required)
* @param string $request_id Filter visits by `requestId`. Every identification request has a unique identifier associated with it called `requestId`. This identifier is returned to the client in the identification [result](https://dev.fingerprint.com/docs/js-agent#requestid). When you filter visits by `requestId`, only one visit will be returned. (optional)
* @param string $linked_id Filter visits by your custom identifier. You can use [`linkedId`](https://dev.fingerprint.com/docs/js-agent#linkedid) to associate identification requests with your own identifier, for example: session ID, purchase ID, or transaction ID. You can then use this `linked_id` parameter to retrieve all events associated with your custom identifier. (optional)
* @param int $limit Limit scanned results. For performance reasons, the API first scans some number of events before filtering them. Use `limit` to specify how many events are scanned before they are filtered by `requestId` or `linkedId`. Results are always returned sorted by the timestamp (most recent first). By default, the most recent 100 visits are scanned, the maximum is 500. (optional)
* @param string $pagination_key Use `paginationKey` to get the next page of results. When more results are available (e.g., you requested 200 results using `limit` parameter, but a total of 600 results are available), the `paginationKey` top-level attribute is added to the response. The key corresponds to the `requestId` of the last returned event. In the following request, use that value in the `paginationKey` parameter to get the next page of results: 1. First request, returning most recent 200 events: `GET api-base-url/visitors/:visitorId?limit=200` 2. Use `response.paginationKey` to get the next page of results: `GET api-base-url/visitors/:visitorId?limit=200&paginationKey=1683900801733.Ogvu1j` Pagination happens during scanning and before filtering, so you can get less visits than the `limit` you specified with more available on the next page. When there are no more results available for scanning, the `paginationKey` attribute is not returned. (optional)
* @param int $before ⚠️ Deprecated pagination method, please use `paginationKey` instead. Timestamp (in milliseconds since epoch) used to paginate results. (optional)
*
* @return array{ null|\Fingerprint\ServerAPI\Model\Response, \Psr\Http\Message\ResponseInterface }
*
* @throws \InvalidArgumentException
Expand Down Expand Up @@ -324,6 +335,13 @@ public function getVisits(string $visitor_id, ?string $request_id = null, ?strin
*
* Get visits by visitorId
*
* @param string $visitor_id Unique identifier of the visitor issued by Fingerprint Pro. (required)
* @param string $request_id Filter visits by `requestId`. Every identification request has a unique identifier associated with it called `requestId`. This identifier is returned to the client in the identification [result](https://dev.fingerprint.com/docs/js-agent#requestid). When you filter visits by `requestId`, only one visit will be returned. (optional)
* @param string $linked_id Filter visits by your custom identifier. You can use [`linkedId`](https://dev.fingerprint.com/docs/js-agent#linkedid) to associate identification requests with your own identifier, for example: session ID, purchase ID, or transaction ID. You can then use this `linked_id` parameter to retrieve all events associated with your custom identifier. (optional)
* @param int $limit Limit scanned results. For performance reasons, the API first scans some number of events before filtering them. Use `limit` to specify how many events are scanned before they are filtered by `requestId` or `linkedId`. Results are always returned sorted by the timestamp (most recent first). By default, the most recent 100 visits are scanned, the maximum is 500. (optional)
* @param string $pagination_key Use `paginationKey` to get the next page of results. When more results are available (e.g., you requested 200 results using `limit` parameter, but a total of 600 results are available), the `paginationKey` top-level attribute is added to the response. The key corresponds to the `requestId` of the last returned event. In the following request, use that value in the `paginationKey` parameter to get the next page of results: 1. First request, returning most recent 200 events: `GET api-base-url/visitors/:visitorId?limit=200` 2. Use `response.paginationKey` to get the next page of results: `GET api-base-url/visitors/:visitorId?limit=200&paginationKey=1683900801733.Ogvu1j` Pagination happens during scanning and before filtering, so you can get less visits than the `limit` you specified with more available on the next page. When there are no more results available for scanning, the `paginationKey` attribute is not returned. (optional)
* @param int $before ⚠️ Deprecated pagination method, please use `paginationKey` instead. Timestamp (in milliseconds since epoch) used to paginate results. (optional)
*
* @throws \InvalidArgumentException
* @throws SerializationException
*/
Expand Down
3 changes: 3 additions & 0 deletions src/ApiException.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ public function __construct(?string $message = '', ?int $code = 0)
parent::__construct($message, $code);
}

/**
* Sets the deseralized response object (during deserialization).
*/
public function setResponseObject(ResponseInterface $obj): void
{
$this->responseObject = $obj;
Expand Down
2 changes: 1 addition & 1 deletion src/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public function setApiKey(string $apiKeyIdentifier, string $key): self
*
* @return null|string API key or token
*/
public function getApiKey($apiKeyIdentifier): ?string
public function getApiKey(string $apiKeyIdentifier): ?string
{
return isset($this->apiKeys[$apiKeyIdentifier]) ? $this->apiKeys[$apiKeyIdentifier] : null;
}
Expand Down
3 changes: 3 additions & 0 deletions template/ApiException.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ class ApiException extends Exception
}


/**
* Sets the deseralized response object (during deserialization)
*/
public function setResponseObject(ResponseInterface $obj): void
{
$this->responseObject = $obj;
Expand Down
2 changes: 1 addition & 1 deletion template/Configuration.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class Configuration
*
* @return string|null API key or token
*/
public function getApiKey($apiKeyIdentifier): ?string
public function getApiKey(string $apiKeyIdentifier): ?string
{
return isset($this->apiKeys[$apiKeyIdentifier]) ? $this->apiKeys[$apiKeyIdentifier] : null;
}
Expand Down
6 changes: 6 additions & 0 deletions template/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ use \GuzzleHttp\Exception\GuzzleException;
* {{.}}
*
{{/description}}
{{#parameters}}
* @param {{dataType}} ${{paramName}}{{#description}} {{{description}}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}
{{/parameters}}
* @throws \InvalidArgumentException
* @throws SerializationException
* @throws GuzzleException
Expand Down Expand Up @@ -148,6 +151,9 @@ use \GuzzleHttp\Exception\GuzzleException;
* {{.}}
*
{{/description}}
{{#parameters}}
* @param {{dataType}} ${{paramName}}{{#description}} {{{description}}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}
{{/parameters}}
*
* @throws \InvalidArgumentException
* @throws SerializationException
Expand Down

0 comments on commit 7a209f8

Please sign in to comment.