Skip to content

Commit 94fdff8

Browse files
committed
implement 'update' methods
1 parent 58f9bef commit 94fdff8

File tree

1 file changed

+72
-4
lines changed

1 file changed

+72
-4
lines changed

src/viam/app/app_client.py

+72-4
Original file line numberDiff line numberDiff line change
@@ -142,15 +142,23 @@
142142
UnshareLocationRequest,
143143
UpdateFragmentRequest,
144144
UpdateFragmentResponse,
145+
UpdateLocationMetadataRequest,
146+
UpdateLocationMetadataResponse,
145147
UpdateLocationRequest,
146148
UpdateLocationResponse,
147149
UpdateModuleRequest,
148150
UpdateModuleResponse,
149151
UpdateOrganizationInviteAuthorizationsRequest,
150152
UpdateOrganizationInviteAuthorizationsResponse,
153+
UpdateOrganizationMetadataRequest,
154+
UpdateOrganizationMetadataResponse,
151155
UpdateOrganizationRequest,
152156
UpdateOrganizationResponse,
153157
UpdateRegistryItemRequest,
158+
UpdateRobotMetadataRequest,
159+
UpdateRobotMetadataResponse,
160+
UpdateRobotPartMetadataRequest,
161+
UpdateRobotPartMetadataResponse,
154162
UpdateRobotPartRequest,
155163
UpdateRobotPartResponse,
156164
UpdateRobotRequest,
@@ -2550,6 +2558,21 @@ async def get_organization_metadata(self, org_id: str) -> Mapping[str, Any]:
25502558
response: GetOrganizationMetadataResponse = await self._app_client.GetOrganizationMetadata(request)
25512559
return struct_to_dict(response.data)
25522560

2561+
async def update_organization_metadata(self, org_id: str, metadata: Mapping[str, Any]) -> None:
2562+
"""Update an organization's user-defined metadata.
2563+
2564+
::
2565+
2566+
await cloud.update_organization_metadata(org_id="<YOUR-ORG-ID>", metadata=)
2567+
2568+
Args:
2569+
organization_id (str): The ID of the organization with which to associate the user-defined metadata.
2570+
You can obtain your organization ID from the Viam app's organization settings page.
2571+
metadata (Mapping[str, Any]): The user-defined metadata to upload as a Python dictionary.
2572+
"""
2573+
request = UpdateOrganizationMetadataRequest(organization_id=org_id, data=dict_to_struct(metadata))
2574+
_: UpdateOrganizationMetadataResponse = await self._app_client.UpdateOrganizationMetadata(request)
2575+
25532576
async def get_location_metadata(self, location_id: str) -> Mapping[str, Any]:
25542577
"""Get a location's user-defined metadata.
25552578
@@ -2562,12 +2585,27 @@ async def get_location_metadata(self, location_id: str) -> Mapping[str, Any]:
25622585
You can obtain your location ID from the Viam app's locations page.
25632586
25642587
Returns:
2565-
Mapping[str, Any]: The user-defined metadata converted from JSON to a Python dictionary
2588+
Mapping[str, Any]: The user-defined metadata converted from JSON to a Python dictionary.
25662589
"""
25672590
request = GetLocationMetadataRequest(location_id=location_id)
25682591
response: GetLocationMetadataResponse = await self._app_client.GetLocationMetadata(request)
25692592
return struct_to_dict(response.data)
25702593

2594+
async def update_location_metadata(self, location_id: str, metadata: Mapping[str, Any]) -> None:
2595+
"""Update a location's user-defined metadata.
2596+
2597+
::
2598+
2599+
await cloud.update_location_metadata(location_id="<YOUR-LOCATION-ID>", metadata=)
2600+
2601+
Args:
2602+
location_id (str): The ID of the location with which to associate the user-defined metadata.
2603+
You can obtain your location ID from the Viam app's locations page.
2604+
metadata (Mapping[str, Any]): The user-defined metadata converted from JSON to a Python dictionary.
2605+
"""
2606+
request = UpdateLocationMetadataRequest(location_id=location_id, data=dict_to_struct(metadata))
2607+
_: UpdateLocationMetadataResponse = await self._app_client.UpdateLocationMetadata(request)
2608+
25712609
async def get_robot_metadata(self, robot_id: str) -> Mapping[str, Any]:
25722610
"""Get a robot's user-defined metadata.
25732611
@@ -2580,12 +2618,27 @@ async def get_robot_metadata(self, robot_id: str) -> Mapping[str, Any]:
25802618
You can obtain your robot ID from the Viam app's machine page.
25812619
25822620
Returns:
2583-
Mapping[str, Any]: The user-defined metadata converted from JSON to a Python dictionary
2621+
Mapping[str, Any]: The user-defined metadata converted from JSON to a Python dictionary.
25842622
"""
25852623
request = GetRobotMetadataRequest(id=robot_id)
25862624
response: GetRobotMetadataResponse = await self._app_client.GetRobotMetadata(request)
25872625
return struct_to_dict(response.data)
25882626

2627+
async def update_robot_metadata(self, robot_id: str, metadata: Mapping[str, Any]) -> None:
2628+
"""Update a robot's user-defined metadata.
2629+
2630+
::
2631+
2632+
await cloud.update_robot_metadata(robot_id="<YOUR-ROBOT-ID>", metadata=)
2633+
2634+
Args:
2635+
robot_id (str): The ID of the robot with which to associate the user-defined metadata.
2636+
You can obtain your robot ID from the Viam app's machine page.
2637+
metadata (Mapping[str, Any]): The user-defined metadata converted from JSON to a Python dictionary.
2638+
"""
2639+
request = UpdateRobotMetadataRequest(id=robot_id, data=dict_to_struct(metadata))
2640+
_: UpdateRobotMetadataResponse = await self._app_client.UpdateRobotMetadata(request)
2641+
25892642
async def get_robot_part_metadata(self, robot_part_id: str) -> Mapping[str, Any]:
25902643
"""Get a robot part's user-defined metadata.
25912644
@@ -2595,11 +2648,26 @@ async def get_robot_part_metadata(self, robot_part_id: str) -> Mapping[str, Any]
25952648
25962649
Args:
25972650
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.
2651+
You can obtain your robot part ID from the Viam app's machine page.
25992652
26002653
Returns:
2601-
Mapping[str, Any]: The user-defined metadata converted from JSON to a Python dictionary
2654+
Mapping[str, Any]: The user-defined metadata converted from JSON to a Python dictionary.
26022655
"""
26032656
request = GetRobotPartMetadataRequest(id=robot_part_id)
26042657
response: GetRobotPartMetadataResponse = await self._app_client.GetRobotPartMetadata(request)
26052658
return struct_to_dict(response.data)
2659+
2660+
async def update_robot_part_metadata(self, robot_part_id: str, metadata: Mapping[str, Any]) -> None:
2661+
"""Update a robot part's user-defined metadata.
2662+
2663+
::
2664+
2665+
await cloud.update_robot_part_metadata(robot_part_id="<YOUR-ROBOT-PART-ID>", metadata=)
2666+
2667+
Args:
2668+
robot_id (str): The ID of the robot part with which to associate the user-defined metadata.
2669+
You can obtain your robot part ID from the Viam app's machine page.
2670+
metadata (Mapping[str, Any]): The user-defined metadata converted from JSON to a Python dictionary.
2671+
"""
2672+
request = UpdateRobotPartMetadataRequest(id=robot_part_id, data=dict_to_struct(metadata))
2673+
_: UpdateRobotPartMetadataResponse = await self._app_client.UpdateRobotPartMetadata(request)

0 commit comments

Comments
 (0)