diff --git a/src/hydroserverpy/api/services/iam/workspace.py b/src/hydroserverpy/api/services/iam/workspace.py index c113646..4d535fb 100644 --- a/src/hydroserverpy/api/services/iam/workspace.py +++ b/src/hydroserverpy/api/services/iam/workspace.py @@ -87,7 +87,7 @@ def add_collaborator( ) def edit_collaborator_role( - self, uid: Union[UUID, str], email: EmailStr, role: Union["Role", UUID, str] + self, uid: Union[UUID, str], email: EmailStr, role: Union["Role", UUID, str], role_id: UUID ) -> "Collaborator": """Edit the role of a collaborator in a workspace.""" @@ -95,7 +95,7 @@ def edit_collaborator_role( headers = {"Content-type": "application/json"} body = { "email": email, - "roleId": normalize_uuid(role) + "roleId": normalize_uuid(role if role is not ... else role_id) } response = self.client.request( @@ -165,6 +165,7 @@ def update_api_key( uid: Union[UUID, str], api_key_id: Union[UUID, str], role: Union["Role", UUID, str] = ..., + role_id: UUID = ..., name: str = ..., description: Optional[str] = ..., is_active: bool = ..., @@ -175,7 +176,7 @@ def update_api_key( path = f"/{self.client.base_route}/{self.model.get_route()}/{str(uid)}/api-keys/{api_key_id}" headers = {"Content-type": "application/json"} body = { - "roleId": normalize_uuid(role), + "roleId": normalize_uuid(role if role is not ... else role_id), "name": name, "description": description, "isActive": is_active, diff --git a/src/hydroserverpy/api/services/sta/datastream.py b/src/hydroserverpy/api/services/sta/datastream.py index cec227c..b95c7d0 100644 --- a/src/hydroserverpy/api/services/sta/datastream.py +++ b/src/hydroserverpy/api/services/sta/datastream.py @@ -155,10 +155,15 @@ def update( name: str = ..., description: str = ..., thing: Union["Thing", UUID, str] = ..., + thing_id: UUID = ..., sensor: Union["Sensor", UUID, str] = ..., + sensor_id: UUID = ..., observed_property: Union["ObservedProperty", UUID, str] = ..., + observed_property_id: UUID = ..., processing_level: Union["ProcessingLevel", UUID, str] = ..., + processing_level_id: UUID = ..., unit: Union["Unit", UUID, str] = ..., + unit_id: UUID = ..., observation_type: str = ..., result_type: str = ..., sampled_medium: str = ..., @@ -186,11 +191,15 @@ def update( body = { "name": name, "description": description, - "thingId": normalize_uuid(thing), - "sensorId": normalize_uuid(sensor), - "observedPropertyId": normalize_uuid(observed_property), - "processingLevelId": normalize_uuid(processing_level), - "unitId": normalize_uuid(unit), + "thingId": normalize_uuid(thing if thing is not ... else thing_id), + "sensorId": normalize_uuid(sensor if sensor is not ... else sensor_id), + "observedPropertyId": normalize_uuid( + observed_property if observed_property is not ... else observed_property_id + ), + "processingLevelId": normalize_uuid( + processing_level if processing_level is not ... else processing_level_id + ), + "unitId": normalize_uuid(unit if unit is not ... else unit_id), "observationType": observation_type, "resultType": result_type, "sampledMedium": sampled_medium,