# -*- coding: utf-8 -*-
from setuptools import setup

package_dir = \
{'': 'src'}

packages = \
['lojack_clients',
 'lojack_clients.automotive',
 'lojack_clients.automotive.api',
 'lojack_clients.automotive.api.default',
 'lojack_clients.automotive.models',
 'lojack_clients.identity',
 'lojack_clients.identity.api',
 'lojack_clients.identity.api.default',
 'lojack_clients.identity.models',
 'lojack_clients.maintenance',
 'lojack_clients.maintenance.api',
 'lojack_clients.maintenance.api.default',
 'lojack_clients.maintenance.models',
 'lojack_clients.services',
 'lojack_clients.services.api',
 'lojack_clients.services.api.default',
 'lojack_clients.services.models']

package_data = \
{'': ['*']}

install_requires = \
['attrs>=21.3.0',
 'httpx>=0.15.4,<0.23.0',
 'python-dateutil>=2.8.0,<3.0.0',
 'uuid']

setup_kwargs = {
    'name': 'lojack-clients',
    'version': '1.0.1',
    'description': "A collection of unofficial client libraries for accessing Spireon's LoJack APIs",
    'long_description': "[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\n# lojack-clients\nA collection of client libraries and OpenAPI documentation files for accessing Spireon LoJack's APIs.\n\n## Description\nThis package first and foremost contains unofficial OpenAPI documentation for the APIs that are used for the Spireon LoJack's application. There are four different services that have been identified, each with an API that has its own subdomain. These include `identity`, `automotive`, `maintenance`, and `services`.\n\nThe OpenAPI documentation files can be found under the `openapi` directory. Each service has their own subdirectory which contains only a single `openapi.yaml` file documenting the services' API.\n\nAdditionally, this package contains Python client libraries that have been generated from the OpenAPI documentation using the [openapi-generators/openapi-python-client](https://github.com/openapi-generators/openapi-python-client). Everything inside the `lojack_clients` directory has been generated using the client generator. There are however some minor customizations made to the templates that the generator uses to generate the client classes. These customizations were necessary to make the client work with the APIs' authentication schemes.\n\n### Services\nEach different service has its own purpose with separate endpoints. You will likely primarily be interacting with the `identity` and `services` services. It is likely that there are more services and endpoints that exist, however these ones listed are only the ones that have been discovered so far.\n\n#### identity\nThis service contains a single endpoint which is used for authenticating and generating an access token that can be used with other services.\n\n#### automotive\nThis service contains a single endpoint used to get information about the dealership that your account is associated with.\n\n#### maintenance\nThis service contains two endpoints that relate to maintenance of your car, one for getting repair orders and another for getting a vehicle's suggested maintenance schedule.\n\n#### services\nThis service contains several endpoints which are responsible for the vast majority of the functionality within the LoJack application.\n\n## Usage\nEach service acts as its own library with its own client class.\n\nFirst, you will need to instantiate the identity client which you will use to generate an access token. You should use the `from_login` class factory method to instantiate the identity client.\n\n```python\nfrom lojack_clients.identity import AuthenticatedClient as IdentityClient\n\nidentity_client = IdentityClient.from_login(username, password)\n```\nHere the `AuthenticatedClient` import is aliased as `IdentityClient` to avoid conflicts with `AuthenticatedClient` classes from the other services' client libraries.\n\nAll endpoints require authentication so you will only use the `AuthenticatedClient`. \n\nNext, you will need to call the get_identity_token endpoint to retrieve an access token:\n\n```python\nfrom lojack_clients.identity.models import GetIdentityTokenResponse200\nfrom lojack_clients.identity.api.default import get_identity_token\nfrom lojack_clients.identity.types import Response as IdentityResponse\n\ntoken_response: GetIdentityTokenResponse200 = get_identity_token.sync(client=identity_client)\n# or if you need more info (e.g. status_code)\ntoken_response: Response[GetIdentityTokenResponse200] = get_identity_token.sync_detailed(client=identity_client)\n```\n\nOr do the same thing with an async version:\n\n```python\nfrom lojack_clients.identity.models import GetIdentityTokenResponse200\nfrom lojack_clients.identity.api.default import get_identity_token\nfrom lojack_clients.identity.types import Response as IdentityResponse\n\ntoken_response: GetIdentityTokenResponse200 = await get_identity_token.asyncio(client=identity_client)\n# or if you need more info (e.g. status_code)\ntoken_response: Response[GetIdentityTokenResponse200] = await get_identity_token.asyncio_detailed(client=identity_client)\n```\n\nHere the `Response` import is aliased as `IdentityResponse` to avoid conflicts with `Response` classes from the other services' client libraries.\n\n*Because each of the client libraries are automatically generated, the `Response` classes for each library are all the same and interchangeable.*\n\nYou can then instantiate any of the other three clients using the access token found in the identity response. You should use the `from_token` class factory method to instantiate any of the other three clients.\n\n```python\nfrom lojack_clients.services import AuthenticatedClient as ServicesClient\n\n# if you used the sync or asyncio methods\nservices_client = ServicesClient.from_token(token_response.token)\n\n# or if you used sync_detailed or asyncio_detailed methods\nservices_client = ServicesClient.from_token(token_response.parsed.token)\n```\n\nYou can now use this client to call any of the other endpoints from within the service, similar to how the identity client was used to call the get_identity_token endpoint.\n\n```python\nfrom lojack_clients.services.models import GetAllUserAssetsResponse200\nfrom lojack_clients.services.api.default import get_all_user_assets\nfrom lojack_clients.services.types import Response as ServicesResponse\n\nassets_response: GetAllUserAssetsResponse200 = get_all_user_assets.sync(client=services_client)\n```\n\nJust as the endpoint before, you can use `sync_detailed` if you need more information about the response, and `asyncio` / `asyncio_detailed` to do the same with async calls.\n\nPutting all the steps together, this is what it would look like to authenticate and make a call to retrieve all user assets.\n\n```python\nfrom lojack_clients.identity import AuthenticatedClient as IdentityClient\nfrom lojack_clients.identity.models import GetIdentityTokenResponse200\nfrom lojack_clients.identity.api.default import get_identity_token\nfrom lojack_clients.identity.types import Response as IdentityResponse\nfrom lojack_clients.services import AuthenticatedClient as ServicesClient\nfrom lojack_clients.services.models import GetAllUserAssetsResponse200\nfrom lojack_clients.services.api.default import get_all_user_assets\nfrom lojack_clients.services.types import Response as ServicesResponse\n\nidentity_client = IdentityClient.from_login(username, password)\ntoken_response: GetIdentityTokenResponse200 = get_identity_token.sync(client=identity_client)\n\nservices_client = ServicesClient.from_token(token_response.token)\nassets_response: GetAllUserAssetsResponse200 = get_all_user_assets.sync(client=services_client)\n```\n\nThings to know:\n1. Every path/method combo becomes a Python module with four functions:\n    1. `sync`: Blocking request that returns parsed data (if successful) or `None`\n    1. `sync_detailed`: Blocking request that always returns a `Request`, optionally with `parsed` set if the request was successful.\n    1. `asyncio`: Like `sync` but the async instead of blocking\n    1. `asyncio_detailed`: Like `sync_detailed` by async instead of blocking\n\n1. All path/query params, and bodies become method arguments.\n1. All endpoints can be found under `lojack_clients/{service}/api/default/{endpoint}.py`.\n1. Endpoint file names are generated using the request's `operationId` key in the OpenAPI documentation (converted to snake_case).\n\n## Development\nAll code inside the `lojack_clients` directory is automatically generated. If any changes are made to any of the services' openapi.yaml file, you can update the service's client library by running `./scripts/build_api_clients`. You can pass in specific services that you want to build libraries for, or you can call it without any arguments to build client libraries for all four services. For eg. `./scripts/build_api_clients services identity` would build the libraries for only the `services` and `identity` clients.\n\nCustomized template files for the client libraries exist under `./client-generator/templates/{service}`. If you need to customize some of the generated code you can add or modify Jinja template files there.\n\nOther information about how the code is generated and how it can be configured can be found within the [openapi-generators/openapi-python-client](https://github.com/openapi-generators/openapi-python-client) project on GitHub.\n\n## Contributing\nIf you know of any endpoints or services that aren't disclosed here you're welcome to open up a pull request to add them to the OpenAPI documentation. If there are any other improvements or suggestions, feel free to open a pull request or an issue.\n\n## Disclaimer\nThis project is not affiliated, associated, authorized, endorsed by, or in any way officially connected with Spireon, Inc. The names Spireon and LoJack are trademarks or registered trademarks of Spireon and its subsidiaries. Any related names, marks, emblems and images are registered trademarks of their respective owners. This project has been developed entirely through the use and observation of publicly available information. Use of this project or information within this project comes with no guarantees or warranties. Whenever using or interacting with any services from Spireon, Inc. you must ensure that you are following the Spireon, Inc. terms of service agreement as well as any other agreements that may apply. If you are associated with Spireon, inc and have any questions or concerns, please [submit an issue](https://github.com/scorgn/lojack-clients/issues/new) on the GitHub repository.\n",
    'author': 'Shawn Corrigan',
    'author_email': 'sha.wnja.mesc@gmail.com',
    'maintainer': None,
    'maintainer_email': None,
    'url': None,
    'package_dir': package_dir,
    'packages': packages,
    'package_data': package_data,
    'install_requires': install_requires,
    'python_requires': '>=3.7,<4.0',
}


setup(**setup_kwargs)
