Skip to content

Add documentation and fixture for alerts endpoint #1540

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/endpoints.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,16 @@ This is a list of the endpoints available, and their characteristics.
.. _Contributor Guide: contributing.html


Vehicle information endpoints
----------------------

.. include:: endpoints/vehicle_data.alerts.rst


Vehicle data endpoints
----------------------

.. include:: endpoints/vehicle_data.alerts.rst
.. include:: endpoints/vehicle_data.battery-status.rst
.. include:: endpoints/vehicle_data.charge-history.rst
.. include:: endpoints/vehicle_data.charge-mode.rst
Expand Down
11 changes: 11 additions & 0 deletions docs/endpoints/vehicle_data.alerts.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
alerts
''''''''''''''

.. rst-class:: endpoint

Base url:
``/commerce/v1/accounts/{account_id}/kamereon/vehicles/{vin}/alerts``

Sample return:
.. literalinclude:: /../tests/fixtures/kamereon/vehicle_info/alerts.json
:language: JSON
1 change: 1 addition & 0 deletions src/renault_api/kamereon/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
}

_DEFAULT_ENDPOINTS: dict[str, str] = {
"alerts": "/vehicles/{vin}/alerts",
"battery-status": "/kca/car-adapter/v2/cars/{vin}/battery-status",
"charge-history": "/kca/car-adapter/v1/cars/{vin}/charge-history",
"charge-mode": "/kca/car-adapter/v1/cars/{vin}/charge-mode",
Expand Down
5 changes: 5 additions & 0 deletions tests/__snapshots__/test_renault_vehicle.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# ---
# name: test_get_endpoints[tests/fixtures/kamereon/vehicles/duster.1.json]
dict({
'alerts': '/vehicles/{vin}/alerts',
'battery-status': '/kca/car-adapter/v2/cars/{vin}/battery-status',
'charge-history': '/kca/car-adapter/v1/cars/{vin}/charge-history',
'charge-mode': '/kca/car-adapter/v1/cars/{vin}/charge-mode',
Expand Down Expand Up @@ -45,6 +46,7 @@
# ---
# name: test_get_endpoints[tests/fixtures/kamereon/vehicles/renault_5.1.json]
dict({
'alerts': '/vehicles/{vin}/alerts',
'battery-status': '/kca/car-adapter/v2/cars/{vin}/battery-status',
'charge-history': '/kca/car-adapter/v1/cars/{vin}/charge-history',
'charge-mode': '/kca/car-adapter/v1/cars/{vin}/charge-mode',
Expand All @@ -64,6 +66,7 @@
# ---
# name: test_get_endpoints[tests/fixtures/kamereon/vehicles/spring.1.json]
dict({
'alerts': '/vehicles/{vin}/alerts',
'battery-status': '/kca/car-adapter/v2/cars/{vin}/battery-status',
'charge-history': '/kca/car-adapter/v1/cars/{vin}/charge-history',
'charge-mode': '/kca/car-adapter/v1/cars/{vin}/charge-mode',
Expand All @@ -83,6 +86,7 @@
# ---
# name: test_get_endpoints[tests/fixtures/kamereon/vehicles/twingo_ze.1.json]
dict({
'alerts': '/vehicles/{vin}/alerts',
'battery-status': '/kca/car-adapter/v2/cars/{vin}/battery-status',
'charge-history': '/kca/car-adapter/v1/cars/{vin}/charge-history',
'charge-mode': '/kca/car-adapter/v1/cars/{vin}/charge-mode',
Expand Down Expand Up @@ -126,6 +130,7 @@
# ---
# name: test_get_endpoints[tests/fixtures/kamereon/vehicles/zoe_50.1.json]
dict({
'alerts': '/vehicles/{vin}/alerts',
'battery-status': '/kca/car-adapter/v2/cars/{vin}/battery-status',
'charge-history': '/kca/car-adapter/v1/cars/{vin}/charge-history',
'charge-mode': '/kca/car-adapter/v1/cars/{vin}/charge-mode',
Expand Down
77 changes: 77 additions & 0 deletions tests/fixtures/kamereon/vehicle_info/alerts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
[
{
"id": "xxxxxxxxxx",
"alertType": "proactive",
"canArchitecture": "204",
"alertCode": "crashairbagmalfunction",
"trueValues": "1",
"priority": 0,
"minAge": 1,
"minMileage": 100,
"generateTime": 1440,
"generateMileage": 15,
"closeTime": 1440,
"closeMileage": 36,
"criticity": 3,
"generateOccurrence": 3,
"closeOccurrence": 10,
"generateLead": 1,
"notifSMS": 0,
"notifMail": 1,
"notifMybrand": 1,
"notifSourceEvent": "CRIT3.RDVDEALER",
"leadContactDays": 90,
"notifContactDays": 5,
"notifReminderDay": 15,
"notifReminderCount": 0,
"notifReminderCounter": 0,
"notifReminderDate": "2024-03-15T00:00:00.000Z",
"vin": "xxxxxxxxxxx",
"registrationNumber": "xxxxxxxxxxxx",
"countryCode": "IT",
"deliveryDate": "2020-10-30T00:00:00.000Z",
"brandComCode": "REN",
"modelCode": "HJB",
"partyId": "xxxxxxxxxxxxxxx",
"partyCountry": "IT",
"partyOrg": 0,
"partyStaff": 0,
"partyPhone": 1,
"partySms": null,
"partyMail": null,
"partyPostal": null,
"localeDefault": "it-IT",
"dealerNumber": "xxxxxxxxxxx",
"dealerNumberOrigin": "dealer_myr",
"isConnected": 1,
"mileageDate": "2024-02-29T00:00:00.000Z",
"mileage": 63593,
"yearMileage": 16064,
"operationCode": null,
"operationName": null,
"operationType": null,
"nextDate": null,
"nextMileage": null,
"reconductCount": 0,
"isConnectedOperation": 0,
"genReason": null,
"endMileage": 70068,
"status": 0,
"creationDateTime": "2024-02-29T14:21:02.382Z",
"lastUpdateDateTime": "2024-10-29T02:08:45.671Z",
"inVehicleDateTime": "2024-02-29T14:21:15.000Z",
"closureReason": "archived",
"function": "the airbag",
"shortDescription": "WARNING: Check Airbag",
"longDescription": "WARNING: Check Airbag",
"criticityName": "Major alert",
"alertCodeTitle": "Defective airbag",
"alertCodeSubTitle": "Details of the event",
"alertCodeDescription": "The airbag must be inspected",
"alertCodeDetailDescription": "We have detected a malfunction in your airbag system.\nYou must inspect it to ensure that the front passengers are protected if there is an impact. For further information, refer to the user manual of your vehicle below.",
"iconUrl": "https://cap-static-medias.ope.apps.renault.com/images/crashAirbag.png",
"detailImageUrl": "https://cap-static-medias.ope.apps.renault.com/images/crashAirbag.png",
"userGuideUrl": "https://it.e-guide.renault.com/ita/",
"mileageUnit": "km"
}
]