Skip to content
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: 4 additions & 3 deletions src/hydroserverpy/api/services/iam/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,15 @@ 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."""

path = f"/{self.client.base_route}/{self.model.get_route()}/{str(uid)}/collaborators"
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(
Expand Down Expand Up @@ -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 = ...,
Expand All @@ -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,
Expand Down
19 changes: 14 additions & 5 deletions src/hydroserverpy/api/services/sta/datastream.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ...,
Expand Down Expand Up @@ -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,
Expand Down
Loading