|
25 | 25 | RoomJoinPolicy
|
26 | 26 | )
|
27 | 27 |
|
28 |
| -from ._shared.utils import parse_connection_str |
| 28 | +from ._shared.utils import parse_connection_str, verify_datetime_format |
29 | 29 | from ._version import SDK_MONIKER
|
30 | 30 | from ._api_versions import DEFAULT_VERSION
|
31 | 31 |
|
@@ -117,23 +117,24 @@ def create_room(
|
117 | 117 | :rtype: ~azure.communication.rooms.CommunicationRoom
|
118 | 118 | :raises: ~azure.core.exceptions.HttpResponseError
|
119 | 119 | """
|
120 |
| - create_room_request = CreateRoomRequest( |
121 |
| - valid_from=valid_from, |
122 |
| - valid_until=valid_until, |
123 |
| - room_join_policy=room_join_policy, |
124 |
| - # pylint: disable=protected-access |
125 |
| - participants=[p._to_room_participant_internal() for p in participants] if participants else None |
126 |
| - ) |
127 |
| - |
128 |
| - repeatability_request_id = uuid.uuid1() |
129 |
| - repeatability_first_sent = datetime.utcnow() |
130 |
| - |
131 |
| - create_room_response = self._rooms_service_client.rooms.create_room( |
132 |
| - create_room_request=create_room_request, |
133 |
| - repeatability_request_id=repeatability_request_id, |
134 |
| - repeatability_first_sent=repeatability_first_sent, |
135 |
| - **kwargs) |
136 |
| - return CommunicationRoom._from_room_response(create_room_response) # pylint: disable=protected-access |
| 120 | + if verify_datetime_format(valid_from) and verify_datetime_format(valid_until): |
| 121 | + create_room_request = CreateRoomRequest( |
| 122 | + valid_from=valid_from, |
| 123 | + valid_until=valid_until, |
| 124 | + room_join_policy=room_join_policy, |
| 125 | + # pylint: disable=protected-access |
| 126 | + participants=[p._to_room_participant_internal() for p in participants] if participants else None |
| 127 | + ) |
| 128 | + |
| 129 | + repeatability_request_id = uuid.uuid1() |
| 130 | + repeatability_first_sent = datetime.utcnow() |
| 131 | + |
| 132 | + create_room_response = self._rooms_service_client.rooms.create_room( |
| 133 | + create_room_request=create_room_request, |
| 134 | + repeatability_request_id=repeatability_request_id, |
| 135 | + repeatability_first_sent=repeatability_first_sent, |
| 136 | + **kwargs) |
| 137 | + return CommunicationRoom._from_room_response(create_room_response) # pylint: disable=protected-access |
137 | 138 |
|
138 | 139 | @distributed_trace
|
139 | 140 | def delete_room(
|
@@ -182,18 +183,18 @@ def update_room(
|
182 | 183 | :raises: ~azure.core.exceptions.HttpResponseError, ValueError
|
183 | 184 |
|
184 | 185 | """
|
185 |
| - |
186 |
| - update_room_request = UpdateRoomRequest( |
187 |
| - valid_from=valid_from, |
188 |
| - valid_until=valid_until, |
189 |
| - room_join_policy=room_join_policy, |
| 186 | + if verify_datetime_format(valid_from) and verify_datetime_format(valid_until): |
| 187 | + update_room_request = UpdateRoomRequest( |
| 188 | + valid_from=valid_from, |
| 189 | + valid_until=valid_until, |
| 190 | + room_join_policy=room_join_policy, |
| 191 | + # pylint: disable=protected-access |
| 192 | + participants=[p._to_room_participant_internal() for p in participants] if participants else None |
| 193 | + ) |
| 194 | + update_room_response = self._rooms_service_client.rooms.update_room( |
| 195 | + room_id=room_id, patch_room_request=update_room_request, **kwargs) |
190 | 196 | # pylint: disable=protected-access
|
191 |
| - participants=[p._to_room_participant_internal() for p in participants] if participants else None |
192 |
| - ) |
193 |
| - update_room_response = self._rooms_service_client.rooms.update_room( |
194 |
| - room_id=room_id, patch_room_request=update_room_request, **kwargs) |
195 |
| - # pylint: disable=protected-access |
196 |
| - return CommunicationRoom._from_room_response(update_room_response) |
| 197 | + return CommunicationRoom._from_room_response(update_room_response) |
197 | 198 |
|
198 | 199 | @distributed_trace
|
199 | 200 | def get_room(
|
|
0 commit comments