`pylibrelinkup` is a Python client for the LibreLinkUp API, which allows you to interact with the LibreLinkUp service to retrieve glucose data and other related information. This project is a Python implementation inspired by the [libre-link-up-api-client](https://github.com/DiaKEM/libre-link-up-api-client) project.
This pull request introduces several new features and improvements to the pylibrelinkup library, including the addition of new response models, authentication decorators, and utility functions. It also includes updates to the tests to accommodate these changes.
New Features and Improvements:
Authentication Decorator:
Added an authenticated decorator to ensure that API calls are made only when the client is authenticated. (src/pylibrelinkup/decorators.py)
New Response Models:
Introduced GraphResponse and LogbookResponse models to handle different types of API responses. (src/pylibrelinkup/models/connection.py) [1][2][3]
Utility Function:
Added a coerce_patient_id utility function to standardize patient identifier handling. (src/pylibrelinkup/utilities.py)
Client Methods:
Refactored the client class to include new methods for fetching graph data, latest glucose measurement, and logbook data. Deprecated the read method in favor of these new methods. (src/pylibrelinkup/pylibrelinkup.py) [1][2][3]
Test Updates:
New Test Fixtures and Data:
Added new test fixtures and data for LogbookResponse. (tests/conftest.py, tests/data/logbook_response.json) [1][2]
Test Cases:
Updated and added new test cases to validate the new client methods and ensure proper functionality. (tests/test_client_graph.py, tests/test_client_latest.py) [1][2]
This pull request introduces several new features and improvements to the
pylibrelinkup
library, including the addition of new response models, authentication decorators, and utility functions. It also includes updates to the tests to accommodate these changes.New Features and Improvements:
Authentication Decorator:
authenticated
decorator to ensure that API calls are made only when the client is authenticated. (src/pylibrelinkup/decorators.py
)New Response Models:
GraphResponse
andLogbookResponse
models to handle different types of API responses. (src/pylibrelinkup/models/connection.py
) [1] [2] [3]Utility Function:
coerce_patient_id
utility function to standardize patient identifier handling. (src/pylibrelinkup/utilities.py
)Client Methods:
read
method in favor of these new methods. (src/pylibrelinkup/pylibrelinkup.py
) [1] [2] [3]Test Updates:
New Test Fixtures and Data:
LogbookResponse
. (tests/conftest.py
,tests/data/logbook_response.json
) [1] [2]Test Cases:
tests/test_client_graph.py
,tests/test_client_latest.py
) [1] [2]