Skip to content

Commit

Permalink
strict sphinx communication (#36111)
Browse files Browse the repository at this point in the history
* strict sphinx communication-messages

* sphinx callautomation

* sphinx identity

* jobrouter some fixes

* sphinx phonenumbers

* sphinx rooms

* sphinx sms

* fix
  • Loading branch information
kristapratico authored Jun 22, 2024
1 parent 444ed8b commit 6632e13
Show file tree
Hide file tree
Showing 30 changed files with 121 additions and 88 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,8 @@ def cancel_add_participant_operation(
**kwargs
) -> CancelAddParticipantOperationResult:
"""Cancel add participant request sent out to a participant.
:param invitation_id: The invitation ID that was used to add the participant.
:param invitation_id: The invitation ID that was used to add the participant.
:type invitation_id: str
:keyword operation_context: Value that can be used to track this call and its associated events.
:paramtype operation_context: str
Expand Down Expand Up @@ -877,19 +878,20 @@ def start_hold_music(
**kwargs
) -> None:
"""Hold participant from call while playing music.
:param play_source: A PlaySource representing the source to play.
:type play_source: ~azure.communication.callautomation.FileSource or
~azure.communication.callautomation.TextSource or
~azure.communication.callautomation.SsmlSource or
list[~azure.communication.callautomation.FileSource or
~azure.communication.callautomation.TextSource or
~azure.communication.callautomation.SsmlSource]
~azure.communication.callautomation.TextSource or
~azure.communication.callautomation.SsmlSource]
:param target_participant: The targets to play media to. Default value is 'all', to play media
to all participants in the call.
:type target_participant: list[~azure.communication.callautomation.CommunicationIdentifier]
:keyword loop: Whether the media should be repeated until stopped.
**DEPRECATED**: 'loop' has been deprecated and will be removed from future releases.
:paramtype loop: bool
**DEPRECATED**: 'loop' has been deprecated and will be removed from future releases.
:keyword operation_context: Value that can be used to track this call and its associated events.
:paramtype operation_context: str or None
:return: None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,8 @@ async def cancel_add_participant_operation(
**kwargs
) -> CancelAddParticipantOperationResult:
"""Cancel add participant request sent out to a participant.
:param invitation_id: The invitation ID that was used to add the participant.
:param invitation_id: The invitation ID that was used to add the participant.
:type invitation_id: str
:keyword operation_context: Value that can be used to track this call and its associated events.
:paramtype operation_context: str
Expand Down Expand Up @@ -883,19 +884,20 @@ async def start_hold_music(
**kwargs
) -> None:
"""Hold participant from call while playing music.
:param play_source: A PlaySource representing the source to play.
:type play_source: ~azure.communication.callautomation.FileSource or
~azure.communication.callautomation.TextSource or
~azure.communication.callautomation.SsmlSource or
list[~azure.communication.callautomation.FileSource or
~azure.communication.callautomation.TextSource or
~azure.communication.callautomation.SsmlSource]
~azure.communication.callautomation.TextSource or
~azure.communication.callautomation.SsmlSource]
:param target_participant: The targets to play media to. Default value is 'all', to play media
to all participants in the call.
:type target_participant: list[~azure.communication.callautomation.CommunicationIdentifier]
:keyword loop: Whether the media should be repeated until stopped.
**DEPRECATED**: 'loop' has been deprecated and will be removed from future releases.
:paramtype loop: bool
**DEPRECATED**: 'loop' has been deprecated and will be removed from future releases.
:keyword operation_context: Value that can be used to track this call and its associated events.
:paramtype operation_context: str or None
:return: None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ mypy = false
pyright = false
type_check_samples = false
verifytypes = false
strict_sphinx = true
4 changes: 2 additions & 2 deletions sdk/communication/azure-communication-identity/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ Azure Communication Identity client package is intended to be used to setup the
_Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_

# Getting started
### Prerequisites
## Prerequisites
- Python 3.8 or later is required to use this package.
- You must have an [Azure subscription](https://azure.microsoft.com/free/)
- A deployed Communication Services resource. You can use the [Azure Portal](https://docs.microsoft.com/azure/communication-services/quickstarts/create-communication-resource?tabs=windows&pivots=platform-azp) or the [Azure PowerShell](https://docs.microsoft.com/powershell/module/az.communication/new-azcommunicationservice) to set it up.
### Install the package
## Install the package
Install the Azure Communication Identity client library for Python with [pip](https://pypi.org/project/pip/):

```bash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class CommunicationIdentityClient(object):
.. literalinclude:: ../samples/identity_samples.py
:language: python
:dedent: 8
"""

def __init__(
Expand Down Expand Up @@ -75,15 +74,6 @@ def from_connection_string(
:param str conn_str: A connection string to an Azure Communication Service resource.
:returns: Instance of CommunicationIdentityClient.
:rtype: ~azure.communication.identity.CommunicationIdentityClient
.. admonition:: Example:
.. literalinclude:: ../samples/identity_samples.py
:start-after: [START auth_from_connection_string]
:end-before: [END auth_from_connection_string]
:language: python
:dedent: 8
:caption: Creating the CommunicationIdentityClient from a connection string.
"""
endpoint, access_key = parse_connection_str(conn_str)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@ class CommunicationIdentityClient:
.. admonition:: Example:
.. literalinclude:: ../../samples/identity_samples_async.py
.. literalinclude:: ../samples/identity_samples_async.py
:language: python
:dedent: 8
"""

def __init__(
Expand Down Expand Up @@ -78,15 +77,6 @@ def from_connection_string(
A connection string to an Azure Communication Service resource.
:returns: Instance of CommunicationIdentityClient.
:rtype: ~azure.communication.identity.aio.CommunicationIdentityClient
.. admonition:: Example:
.. literalinclude:: ../samples/identity_samples.py
:start-after: [START auth_from_connection_string]
:end-before: [END auth_from_connection_string]
:language: python
:dedent: 8
:caption: Creating the CommunicationIdentityClient from a connection string.
"""
endpoint, access_key = parse_connection_str(conn_str)

Expand All @@ -113,7 +103,8 @@ async def create_user(self, **kwargs) -> "CommunicationUserIdentifier":
async def create_user_and_token(
self, scopes: List[Union[str, "CommunicationTokenScope"]], **kwargs
) -> Tuple["CommunicationUserIdentifier", AccessToken]:
"""create a single Communication user with an identity token.
"""Create a single Communication user with an identity token.
:param scopes:
List of scopes to be added to the token.
:type scopes: list[str or ~azure.communication.identity.CommunicationTokenScope]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
pyright = false
type_check_samples = false
verifytypes = false
strict_sphinx = true
Original file line number Diff line number Diff line change
Expand Up @@ -1302,6 +1302,7 @@ def upsert_distribution_policy(
Example:
.. code-block:: python
# The response is polymorphic. The following are possible polymorphic responses based
off discriminator "kind":
Expand Down Expand Up @@ -1494,6 +1495,7 @@ def upsert_distribution_policy(
Example:
.. code-block:: python
# The response is polymorphic. The following are possible polymorphic responses based
off discriminator "kind":
Expand Down Expand Up @@ -2013,6 +2015,7 @@ def get_distribution_policy(self, distribution_policy_id: str, **kwargs: Any) ->
Example:
.. code-block:: python
# The response is polymorphic. The following are possible polymorphic responses based
off discriminator "kind":
Expand Down Expand Up @@ -2160,6 +2163,7 @@ def list_distribution_policies(self, **kwargs: Any) -> ItemPaged["_models.Distri
Example:
.. code-block:: python
# The response is polymorphic. The following are possible polymorphic responses based
off discriminator "kind":
Expand Down Expand Up @@ -2635,6 +2639,7 @@ def upsert_classification_policy(
Example:
.. code-block:: python
# The response is polymorphic. The following are possible polymorphic responses based
off discriminator "kind":
Expand Down Expand Up @@ -2791,6 +2796,7 @@ def upsert_classification_policy(
Example:
.. code-block:: python
# The response is polymorphic. The following are possible polymorphic responses based
off discriminator "kind":
Expand Down Expand Up @@ -3223,6 +3229,7 @@ def get_classification_policy(self, classification_policy_id: str, **kwargs: Any
Example:
.. code-block:: python
# The response is polymorphic. The following are possible polymorphic responses based
off discriminator "kind":
Expand Down Expand Up @@ -3356,6 +3363,7 @@ def list_classification_policies(self, **kwargs: Any) -> ItemPaged["_models.Clas
Example:
.. code-block:: python
# The response is polymorphic. The following are possible polymorphic responses based
off discriminator "kind":
Expand Down Expand Up @@ -5030,6 +5038,7 @@ def upsert_job(
Example:
.. code-block:: python
# The response is polymorphic. The following are possible polymorphic responses based
off discriminator "kind":
Expand Down Expand Up @@ -5202,6 +5211,7 @@ def upsert_job(
Example:
.. code-block:: python
# The response is polymorphic. The following are possible polymorphic responses based
off discriminator "kind":
Expand Down Expand Up @@ -5714,6 +5724,7 @@ def get_job(self, job_id: str, **kwargs: Any) -> _models.RouterJob:
Example:
.. code-block:: python
# The response is polymorphic. The following are possible polymorphic responses based
off discriminator "kind":
Expand Down Expand Up @@ -6469,6 +6480,7 @@ def list_jobs(
Example:
.. code-block:: python
# The response is polymorphic. The following are possible polymorphic responses based
off discriminator "kind":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ async def upsert_distribution_policy(
Example:
.. code-block:: python
# The response is polymorphic. The following are possible polymorphic responses based
off discriminator "kind":
Expand Down Expand Up @@ -585,6 +586,7 @@ async def upsert_distribution_policy(
Example:
.. code-block:: python
# The response is polymorphic. The following are possible polymorphic responses based
off discriminator "kind":
Expand Down Expand Up @@ -1104,6 +1106,7 @@ async def get_distribution_policy(self, distribution_policy_id: str, **kwargs: A
Example:
.. code-block:: python
# The response is polymorphic. The following are possible polymorphic responses based
off discriminator "kind":
Expand Down Expand Up @@ -1252,6 +1255,7 @@ def list_distribution_policies(self, **kwargs: Any) -> AsyncItemPaged["_models.D
Example:
.. code-block:: python
# The response is polymorphic. The following are possible polymorphic responses based
off discriminator "kind":
Expand Down Expand Up @@ -1727,6 +1731,7 @@ async def upsert_classification_policy(
Example:
.. code-block:: python
# The response is polymorphic. The following are possible polymorphic responses based
off discriminator "kind":
Expand Down Expand Up @@ -1883,6 +1888,7 @@ async def upsert_classification_policy(
Example:
.. code-block:: python
# The response is polymorphic. The following are possible polymorphic responses based
off discriminator "kind":
Expand Down Expand Up @@ -2317,6 +2323,7 @@ async def get_classification_policy(
Example:
.. code-block:: python
# The response is polymorphic. The following are possible polymorphic responses based
off discriminator "kind":
Expand Down Expand Up @@ -2450,6 +2457,7 @@ def list_classification_policies(self, **kwargs: Any) -> AsyncItemPaged["_models
Example:
.. code-block:: python
# The response is polymorphic. The following are possible polymorphic responses based
off discriminator "kind":
Expand Down Expand Up @@ -4128,6 +4136,7 @@ async def upsert_job(
Example:
.. code-block:: python
# The response is polymorphic. The following are possible polymorphic responses based
off discriminator "kind":
Expand Down Expand Up @@ -4300,6 +4309,7 @@ async def upsert_job(
Example:
.. code-block:: python
# The response is polymorphic. The following are possible polymorphic responses based
off discriminator "kind":
Expand Down Expand Up @@ -4812,6 +4822,7 @@ async def get_job(self, job_id: str, **kwargs: Any) -> _models.RouterJob:
Example:
.. code-block:: python
# The response is polymorphic. The following are possible polymorphic responses based
off discriminator "kind":
Expand Down Expand Up @@ -5568,6 +5579,7 @@ def list_jobs(
Example:
.. code-block:: python
# The response is polymorphic. The following are possible polymorphic responses based
off discriminator "kind":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def from_connection_string(cls, conn_str: str, **kwargs: Any) -> "JobRouterClien
.. admonition:: Example:
.. literalinclude:: ../samples/sample_authentication.py
.. literalinclude:: ../samples/sample_authentication_async.py
:start-after: [START auth_from_connection_string_async]
:end-before: [END auth_from_connection_string_async]
:language: python
Expand Down Expand Up @@ -141,7 +141,7 @@ def from_connection_string(cls, conn_str: str, **kwargs: Any) -> "JobRouterAdmin
.. admonition:: Example:
.. literalinclude:: ../samples/sample_authentication.py
.. literalinclude:: ../samples/sample_authentication_async.py
:start-after: [START admin_auth_from_connection_string_async]
:end-before: [END admin_auth_from_connection_string_async]
:language: python
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,7 @@ def list_templates(
Example:
.. code-block:: python
# The response is polymorphic. The following are possible polymorphic responses based
off discriminator "kind":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def __init__(self, endpoint: str, credential: Union[TokenCredential, AzureKeyCre
@classmethod
def from_connection_string(cls, conn_str: str, **kwargs: Any) -> "NotificationMessagesClient":
"""Create NotificationMessagesClient from a Connection String.
:param conn_str: Azure communication service connection string. Required.
:type conn_str: str
:return: instance of NotificationMessagesClient
Expand Down Expand Up @@ -115,11 +116,12 @@ def __init__(self, endpoint: str, credential: Union[TokenCredential, AzureKeyCre
@classmethod
def from_connection_string(cls, conn_str: str, **kwargs: Any) -> "MessageTemplateClient":
"""Create MessageTemplateClient from a Connection String.
:param conn_str: Azure communication service connection string. Required.
:type conn_str: str
:return: instance of MessageTemplateClient
:rtype:
~azure.communication.messages.messagetemplateclient
~azure.communication.messages.MessageTemplateClient
"""
endpoint, access_key = parse_connection_str(conn_str)
return cls(endpoint, AzureKeyCredential(access_key), **kwargs)
Expand Down
Loading

0 comments on commit 6632e13

Please sign in to comment.