Skip to content

Commit 58f9bef

Browse files
committed
implement method for robot parts
1 parent 2f895a7 commit 58f9bef

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/viam/app/app_client.py

+20
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@
7474
GetRobotPartHistoryResponse,
7575
GetRobotPartLogsRequest,
7676
GetRobotPartLogsResponse,
77+
GetRobotPartMetadataRequest,
78+
GetRobotPartMetadataResponse,
7779
GetRobotPartRequest,
7880
GetRobotPartResponse,
7981
GetRobotPartsRequest,
@@ -2583,3 +2585,21 @@ async def get_robot_metadata(self, robot_id: str) -> Mapping[str, Any]:
25832585
request = GetRobotMetadataRequest(id=robot_id)
25842586
response: GetRobotMetadataResponse = await self._app_client.GetRobotMetadata(request)
25852587
return struct_to_dict(response.data)
2588+
2589+
async def get_robot_part_metadata(self, robot_part_id: str) -> Mapping[str, Any]:
2590+
"""Get a robot part's user-defined metadata.
2591+
2592+
::
2593+
2594+
metadata = await cloud.get_robot_part_metadata(robot_part_id="<YOUR-ROBOT-PART-ID>")
2595+
2596+
Args:
2597+
robot_part_id (str): The ID of the robot part with which the user-defined metadata is associated.
2598+
You can obtain your robot ID from the Viam app's machine page.
2599+
2600+
Returns:
2601+
Mapping[str, Any]: The user-defined metadata converted from JSON to a Python dictionary
2602+
"""
2603+
request = GetRobotPartMetadataRequest(id=robot_part_id)
2604+
response: GetRobotPartMetadataResponse = await self._app_client.GetRobotPartMetadata(request)
2605+
return struct_to_dict(response.data)

0 commit comments

Comments
 (0)