Skip to content

Commit 67384df

Browse files
updated per-action callback URI override naming~ (Azure#31335)
1 parent 6849888 commit 67384df

File tree

7 files changed

+169
-51
lines changed

7 files changed

+169
-51
lines changed

sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_call_connection_client.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ def transfer_call_to_participant(
245245
sip_headers: Optional[Dict[str, str]] = None,
246246
voip_headers: Optional[Dict[str, str]] = None,
247247
operation_context: Optional[str] = None,
248-
callback_url_override: Optional[str] = None,
248+
callback_url: Optional[str] = None,
249249
transferee: Optional['CommunicationIdentifier'] = None,
250250
**kwargs
251251
) -> TransferCallResult:
@@ -259,8 +259,10 @@ def transfer_call_to_participant(
259259
:paramtype voip_headers: dict[str, str]
260260
:keyword operation_context: Value that can be used to track this call and its associated events.
261261
:paramtype operation_context: str
262-
:keyword callback_url_override: Url that overrides original callback URI for this request.
263-
:paramtype callback_url_override: str
262+
:keyword callback_url: Url that overrides original callback URI for this request.
263+
:paramtype callback_url: str
264+
:keyword transferee: Url that overrides original callback URI for this request.
265+
:paramtype transferee: ~azure.communication.callautomation.CommunicationIdentifier
264266
:return: TransferCallResult
265267
:rtype: ~azure.communication.callautomation.TransferCallResult
266268
:raises ~azure.core.exceptions.HttpResponseError:
@@ -273,7 +275,7 @@ def transfer_call_to_participant(
273275
target_participant=serialize_identifier(target_participant),
274276
custom_context=user_custom_context,
275277
operation_context=operation_context,
276-
callback_uri_override=callback_url_override
278+
callback_uri=callback_url
277279
)
278280
process_repeatability_first_sent(kwargs)
279281
if transferee:
@@ -296,7 +298,7 @@ def add_participant(
296298
voip_headers: Optional[Dict[str, str]] = None,
297299
source_caller_id_number: Optional['PhoneNumberIdentifier'] = None,
298300
source_display_name: Optional[str] = None,
299-
callback_url_override: Optional[str] = None,
301+
callback_url: Optional[str] = None,
300302
**kwargs
301303
) -> AddParticipantResult:
302304
"""Add a participant to this call.
@@ -318,8 +320,8 @@ def add_participant(
318320
:paramtype source_caller_id_number: ~azure.communication.callautomation.PhoneNumberIdentifier or None
319321
:keyword source_display_name: Display name of the caller.
320322
:paramtype source_display_name: str or None
321-
:keyword callback_url_override: Url that overrides original callback URI for this request.
322-
:paramtype callback_url_override: str or None
323+
:keyword callback_url: Url that overrides original callback URI for this request.
324+
:paramtype callback_url: str or None
323325
:return: AddParticipantResult
324326
:rtype: ~azure.communication.callautomation.AddParticipantResult
325327
:raises ~azure.core.exceptions.HttpResponseError:
@@ -345,7 +347,7 @@ def add_participant(
345347
custom_context=user_custom_context,
346348
invitation_timeout=invitation_timeout,
347349
operation_context=operation_context,
348-
callback_uri_override=callback_url_override
350+
callback_uri=callback_url
349351
)
350352
process_repeatability_first_sent(kwargs)
351353
response = self._call_connection_client.add_participant(
@@ -361,7 +363,7 @@ def remove_participant(
361363
target_participant: 'CommunicationIdentifier',
362364
*,
363365
operation_context: Optional[str] = None,
364-
callback_url_override: Optional[str] = None,
366+
callback_url: Optional[str] = None,
365367
**kwargs
366368
) -> RemoveParticipantResult:
367369
"""Remove a participant from this call.
@@ -370,15 +372,16 @@ def remove_participant(
370372
:type target_participant: ~azure.communication.callautomation.CommunicationIdentifier
371373
:keyword operation_context: Value that can be used to track this call and its associated events.
372374
:paramtype operation_context: str
373-
:keyword callback_url_override: Url that overrides original callback URI for this request.
374-
:paramtype callback_url_override: str
375+
:keyword callback_url: Url that overrides original callback URI for this request.
376+
:paramtype callback_url: str
375377
:return: RemoveParticipantResult
376378
:rtype: ~azure.communication.callautomation.RemoveParticipantResult
377379
:raises ~azure.core.exceptions.HttpResponseError:
378380
"""
379381
remove_participant_request = RemoveParticipantRequest(
380382
participant_to_remove=serialize_identifier(target_participant),
381-
operation_context=operation_context, callback_uri_override=callback_url_override)
383+
operation_context=operation_context,
384+
callback_uri=callback_url)
382385

383386
process_repeatability_first_sent(kwargs)
384387

sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/_serialization.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,8 @@ def query(self, name, data, data_type, **kwargs):
742742
743743
:param data: The data to be serialized.
744744
:param str data_type: The type to be serialized from.
745+
:keyword bool skip_quote: Whether to skip quote the serialized result.
746+
Defaults to False.
745747
:rtype: str
746748
:raises: TypeError if serialization fails.
747749
:raises: ValueError if data is None
@@ -750,10 +752,8 @@ def query(self, name, data, data_type, **kwargs):
750752
# Treat the list aside, since we don't want to encode the div separator
751753
if data_type.startswith("["):
752754
internal_data_type = data_type[1:-1]
753-
data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data]
754-
if not kwargs.get("skip_quote", False):
755-
data = [quote(str(d), safe="") for d in data]
756-
return str(self.serialize_iter(data, internal_data_type, **kwargs))
755+
do_quote = not kwargs.get("skip_quote", False)
756+
return str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs))
757757

758758
# Not a list, regular serialization
759759
output = self.serialize_data(data, data_type, **kwargs)
@@ -892,6 +892,8 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs):
892892
not be None or empty.
893893
:param str div: If set, this str will be used to combine the elements
894894
in the iterable into a combined string. Default is 'None'.
895+
:keyword bool do_quote: Whether to quote the serialized result of each iterable element.
896+
Defaults to False.
895897
:rtype: list, str
896898
"""
897899
if isinstance(data, str):
@@ -909,6 +911,9 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs):
909911
raise
910912
serialized.append(None)
911913

914+
if kwargs.get("do_quote", False):
915+
serialized = ["" if s is None else quote(str(s), safe="") for s in serialized]
916+
912917
if div:
913918
serialized = ["" if s is None else str(s) for s in serialized]
914919
serialized = div.join(serialized)

0 commit comments

Comments
 (0)