Skip to content

Commit 945a3d1

Browse files
committed
Formatting changes
1 parent be9f7ef commit 945a3d1

File tree

1 file changed

+25
-11
lines changed

1 file changed

+25
-11
lines changed

garminconnect/__init__.py

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2025,36 +2025,50 @@ def get_gear_activities(
20252025

20262026
return self.connectapi(url)
20272027

2028-
def add_gear_to_activity(self, gear_uid: str, activity_id: int) -> dict[str, Any]:
2028+
def add_gear_to_activity(
2029+
self, gearUUID: str, activity_id: int | str
2030+
) -> dict[str, Any]:
20292031
"""
2030-
Associates gear with an activity. Requires a gear_uid and an activity_id
2032+
Associates gear with an activity. Requires a gearUUID and an activity_id
20312033
20322034
Args:
2033-
gear_uid: UID for gear to add to activity. Findable though the get_gear function
2035+
gearUUID: UID for gear to add to activity. Findable though the get_gear function
20342036
activity_id: Integer ID for the activity to add the gear to
20352037
20362038
Returns:
20372039
Dictionary containing information for the added gear
2038-
20392040
"""
20402041

2041-
url = f"{self.garmin_connect_gear_baseurl}/link/{gear_uid}/activity/{activity_id}"
2042+
gearUUID = str(gearUUID)
2043+
activity_id = _validate_positive_integer(int(activity_id), "activity_id")
2044+
2045+
url = (
2046+
f"{self.garmin_connect_gear_baseurl}/link/{gearUUID}/activity/{activity_id}"
2047+
)
2048+
logger.debug("Linking gear %s to activity %s", gearUUID, activity_id)
2049+
20422050
return self.garth.put("connectapi", url).json()
20432051

2044-
def remove_gear_from_activity(self, gear_uid: str, activity_id: int) -> dict[str, Any]:
2052+
def remove_gear_from_activity(
2053+
self, gearUUID: str, activity_id: int | str
2054+
) -> dict[str, Any]:
20452055
"""
2046-
Removes gear from an activity. Requires a gear_uid and an activity_id
2056+
Removes gear from an activity. Requires a gearUUID and an activity_id
20472057
20482058
Args:
2049-
gear_uid: UID for gear to remove from activity. Findable though the get_gear method.
2059+
gearUUID: UID for gear to remove from activity. Findable though the get_gear method.
20502060
activity_id: Integer ID for the activity to remove the gear from
20512061
20522062
Returns:
2053-
Dictionary containing information for the added gear
2054-
2063+
Dictionary containing information about the removed gear
20552064
"""
20562065

2057-
url = f"{self.garmin_connect_gear_baseurl}/unlink/{gear_uid}/activity/{activity_id}"
2066+
gearUUID = str(gearUUID)
2067+
activity_id = _validate_positive_integer(int(activity_id), "activity_id")
2068+
2069+
url = f"{self.garmin_connect_gear_baseurl}/unlink/{gearUUID}/activity/{activity_id}"
2070+
logger.debug("Unlinking gear %s from activity %s", gearUUID, activity_id)
2071+
20582072
return self.garth.put("connectapi", url).json()
20592073

20602074
def get_user_profile(self) -> dict[str, Any]:

0 commit comments

Comments
 (0)