Skip to content

Commit

Permalink
feat: better typing by generating from updated schema, update usage e…
Browse files Browse the repository at this point in the history
…xamples
  • Loading branch information
ilfa committed Jul 29, 2022
1 parent 5db8fdc commit cb5208d
Show file tree
Hide file tree
Showing 23 changed files with 180 additions and 478 deletions.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ Please follow the [installation procedure](#installation--usage) and then run th
```python
from __future__ import print_function
import swagger_client
from swagger_client import Response
from swagger_client.rest import ApiException
from pprint import pprint

Expand All @@ -81,7 +82,7 @@ limit = 10 # int | Limit scanned results (optional)
#before = 56 # int | Used to paginate results (optional)

try:
api_response = api_instance.visitors_visitor_id_get(visitor_id, limit=limit)
api_response: Response = api_instance.get_visits(visitor_id, limit=2)
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->visitors_visitor_id_get: %s\n" % e)
Expand All @@ -97,15 +98,12 @@ Class | Method | HTTP request | Description

## Documentation For Models

- [BaseResponse](docs/BaseResponse.md)
- [BrowserDetails](docs/BrowserDetails.md)
- [Confidence](docs/Confidence.md)
- [IPLocation](docs/IPLocation.md)
- [IPLocationCity](docs/IPLocationCity.md)
- [Location](docs/Location.md)
- [ManyRequestsResponse](docs/ManyRequestsResponse.md)
- [OneOfResponse](docs/OneOfResponse.md)
- [PaginatedResponse](docs/PaginatedResponse.md)
- [Response](docs/Response.md)
- [StSeenAt](docs/StSeenAt.md)
- [Subdivision](docs/Subdivision.md)
Expand Down
10 changes: 0 additions & 10 deletions docs/BaseResponse.md

This file was deleted.

2 changes: 1 addition & 1 deletion docs/Confidence.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**score** | **float** | |
**score** | **float** | The confidence score is a floating-point number between 0 and 1 that represents the probability of accurate identification. |

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

3 changes: 2 additions & 1 deletion docs/FingerprintApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ This endpoint allows you to get a history of visits with all available informati
```python
from __future__ import print_function
import swagger_client
from swagger_client import Response
from swagger_client.rest import ApiException
from pprint import pprint

Expand All @@ -33,7 +34,7 @@ limit = 10 # int | Limit scanned results (optional)
#before = 56 # int | Used to paginate results (optional)

try:
api_response = api_instance.visitors_visitor_id_get(visitor_id, limit=limit)
api_response: Response = api_instance.get_visits(visitor_id, limit=2)
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->visitors_visitor_id_get: %s\n" % e)
Expand Down
2 changes: 1 addition & 1 deletion docs/ManyRequestsResponse.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**error** | **str** | |
**error** | **str** | Error text. |

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

8 changes: 0 additions & 8 deletions docs/OneOfResponse.md

This file was deleted.

12 changes: 0 additions & 12 deletions docs/PaginatedResponse.md

This file was deleted.

4 changes: 4 additions & 0 deletions docs/Response.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**visitor_id** | **str** | |
**visits** | [**list[Visit]**](Visit.md) | |
**last_timestamp** | **int** | When more results are available (e.g., you scanned 200 results using `limit` parameter, but a total of 600 results are available), a special `lastTimestamp` top-level attribute is added to the response. If you want to paginate the results further in the past, you should use the value of this attribute. | [optional]
**pagination_key** | **str** | Visit's `requestId` of the last visit in the current page. | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

16 changes: 8 additions & 8 deletions docs/Visit.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**request_id** | **str** | |
**request_id** | **str** | Unique identifier of the user's identification request. |
**browser_details** | [**BrowserDetails**](BrowserDetails.md) | |
**incognito** | **bool** | |
**incognito** | **bool** | Flag if user used incognito session. |
**ip** | **str** | |
**ip_location** | [**IPLocation**](IPLocation.md) | |
**timestamp** | **int** | |
**time** | **datetime** | |
**url** | **str** | |
**tag** | **dict(str, object)** | |
**linked_id** | **str** | | [optional]
**timestamp** | **int** | Timestamp of the event with millisecond precision in Unix time. |
**time** | **datetime** | Time expressed according to ISO 8601 in UTC format. |
**url** | **str** | Page URL from which identification request was sent. |
**tag** | **dict(str, object)** | A customer-provided value or an object that was sent with identification request. |
**linked_id** | **str** | A customer-provided id that was sent with identification request. | [optional]
**confidence** | [**Confidence**](Confidence.md) | |
**visitor_found** | **bool** | |
**visitor_found** | **bool** | Attribute represents if a visitor had been identified before. |
**first_seen_at** | **object** | |
**last_seen_at** | **object** | |

Expand Down
16 changes: 8 additions & 8 deletions docs/WebhookVisit.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**request_id** | **str** | |
**request_id** | **str** | Unique identifier of the user's identification request. |
**browser_details** | [**BrowserDetails**](BrowserDetails.md) | |
**incognito** | **bool** | |
**incognito** | **bool** | Flag if user used incognito session. |
**ip** | **str** | |
**ip_location** | [**IPLocation**](IPLocation.md) | |
**timestamp** | **int** | |
**time** | **datetime** | |
**url** | **str** | |
**tag** | **dict(str, object)** | |
**linked_id** | **str** | | [optional]
**timestamp** | **int** | Timestamp of the event with millisecond precision in Unix time. |
**time** | **datetime** | Time expressed according to ISO 8601 in UTC format. |
**url** | **str** | Page URL from which identification request was sent. |
**tag** | **dict(str, object)** | A customer-provided value or an object that was sent with identification request. |
**linked_id** | **str** | A customer-provided id that was sent with identification request. | [optional]
**confidence** | [**Confidence**](Confidence.md) | |
**visitor_found** | **bool** | |
**visitor_found** | **bool** | Attribute represents if a visitor had been identified before. |
**first_seen_at** | **object** | |
**last_seen_at** | **object** | |

Expand Down
5 changes: 3 additions & 2 deletions run_checks.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import print_function
import swagger_client
from swagger_client import Response
from swagger_client.rest import ApiException
from pprint import pprint
import os
Expand All @@ -16,8 +17,8 @@
# before = 56 # int | Used to paginate results (optional)

try:
api_response = api_instance.get_visits(visitor_id, limit=2)
pprint(api_response['visitorId'])
api_response: Response = api_instance.get_visits(visitor_id, limit=2)
pprint(api_response.visitor_id)
except ApiException as e:
print("Exception when calling DefaultApi->visitors_visitor_id_get: %s\n" % e)

Expand Down
3 changes: 0 additions & 3 deletions swagger_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,12 @@
from swagger_client.api_client import ApiClient
from swagger_client.configuration import Configuration
# import models into sdk package
from swagger_client.models.base_response import BaseResponse
from swagger_client.models.browser_details import BrowserDetails
from swagger_client.models.confidence import Confidence
from swagger_client.models.ip_location import IPLocation
from swagger_client.models.ip_location_city import IPLocationCity
from swagger_client.models.location import Location
from swagger_client.models.many_requests_response import ManyRequestsResponse
from swagger_client.models.one_of_response import OneOfResponse
from swagger_client.models.paginated_response import PaginatedResponse
from swagger_client.models.response import Response
from swagger_client.models.st_seen_at import StSeenAt
from swagger_client.models.subdivision import Subdivision
Expand Down
3 changes: 0 additions & 3 deletions swagger_client/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,12 @@
from __future__ import absolute_import

# import models into model package
from swagger_client.models.base_response import BaseResponse
from swagger_client.models.browser_details import BrowserDetails
from swagger_client.models.confidence import Confidence
from swagger_client.models.ip_location import IPLocation
from swagger_client.models.ip_location_city import IPLocationCity
from swagger_client.models.location import Location
from swagger_client.models.many_requests_response import ManyRequestsResponse
from swagger_client.models.one_of_response import OneOfResponse
from swagger_client.models.paginated_response import PaginatedResponse
from swagger_client.models.response import Response
from swagger_client.models.st_seen_at import StSeenAt
from swagger_client.models.subdivision import Subdivision
Expand Down
138 changes: 0 additions & 138 deletions swagger_client/models/base_response.py

This file was deleted.

2 changes: 2 additions & 0 deletions swagger_client/models/confidence.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def __init__(self, score=None): # noqa: E501
def score(self):
"""Gets the score of this Confidence. # noqa: E501
The confidence score is a floating-point number between 0 and 1 that represents the probability of accurate identification. # noqa: E501
:return: The score of this Confidence. # noqa: E501
:rtype: float
Expand All @@ -55,6 +56,7 @@ def score(self):
def score(self, score):
"""Sets the score of this Confidence.
The confidence score is a floating-point number between 0 and 1 that represents the probability of accurate identification. # noqa: E501
:param score: The score of this Confidence. # noqa: E501
:type: float
Expand Down
2 changes: 2 additions & 0 deletions swagger_client/models/many_requests_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def __init__(self, error=None): # noqa: E501
def error(self):
"""Gets the error of this ManyRequestsResponse. # noqa: E501
Error text. # noqa: E501
:return: The error of this ManyRequestsResponse. # noqa: E501
:rtype: str
Expand All @@ -55,6 +56,7 @@ def error(self):
def error(self, error):
"""Sets the error of this ManyRequestsResponse.
Error text. # noqa: E501
:param error: The error of this ManyRequestsResponse. # noqa: E501
:type: str
Expand Down
Loading

0 comments on commit cb5208d

Please sign in to comment.