From e0d33fca18fc1dcb76ca83d5ebe90de5c5ee954a Mon Sep 17 00:00:00 2001 From: Jorge Beauregard Date: Wed, 3 Mar 2021 12:10:57 -0700 Subject: [PATCH] Renaming with_token identity function --- sdk/communication/azure-communication-identity/README.md | 4 ++-- .../identity/_communication_identity_client.py | 2 +- .../identity/aio/_communication_identity_client_async.py | 2 +- .../samples/identity_samples.py | 6 +++--- .../samples/identity_samples_async.py | 6 +++--- .../tests/test_communication_identity_client.py | 4 ++-- .../tests/test_communication_identity_client_async.py | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/sdk/communication/azure-communication-identity/README.md b/sdk/communication/azure-communication-identity/README.md index 0b1789845bd4f..d642f33efbcfd 100644 --- a/sdk/communication/azure-communication-identity/README.md +++ b/sdk/communication/azure-communication-identity/README.md @@ -57,11 +57,11 @@ user = identity_client.create_user() print("User created with id:" + user.identifier) ``` -Alternatively, use the `create_user_with_token` method to create a new user and issue a token for it.\ +Alternatively, use the `create_user_and_token` method to create a new user and issue a token for it.\ For this option, a list of `CommunicationTokenScope` must be defined (see "Issuing an access token" for more information) ```python -user, tokenresponse = identity_client.create_user_with_token(scopes=[CommunicationTokenScope.CHAT]) +user, tokenresponse = identity_client.create_user_and_token(scopes=[CommunicationTokenScope.CHAT]) print("User id:" + user.identifier) print("Token issued with value: " + tokenresponse.token) ``` diff --git a/sdk/communication/azure-communication-identity/azure/communication/identity/_communication_identity_client.py b/sdk/communication/azure-communication-identity/azure/communication/identity/_communication_identity_client.py index 182a6fe3699ea..9902cd6f25b80 100644 --- a/sdk/communication/azure-communication-identity/azure/communication/identity/_communication_identity_client.py +++ b/sdk/communication/azure-communication-identity/azure/communication/identity/_communication_identity_client.py @@ -90,7 +90,7 @@ def create_user(self, **kwargs): **kwargs) @distributed_trace - def create_user_with_token( + def create_user_and_token( self, scopes, # type: List[Union[str, "_model.CommunicationTokenScope"]] **kwargs # type: Any diff --git a/sdk/communication/azure-communication-identity/azure/communication/identity/aio/_communication_identity_client_async.py b/sdk/communication/azure-communication-identity/azure/communication/identity/aio/_communication_identity_client_async.py index 1d04c4c80314f..331e1d304770e 100644 --- a/sdk/communication/azure-communication-identity/azure/communication/identity/aio/_communication_identity_client_async.py +++ b/sdk/communication/azure-communication-identity/azure/communication/identity/aio/_communication_identity_client_async.py @@ -91,7 +91,7 @@ async def create_user(self, **kwargs): **kwargs) @distributed_trace_async - async def create_user_with_token( + async def create_user_and_token( self, scopes, # type: List[Union[str, "_model.CommunicationTokenScope"]] **kwargs # type: Any diff --git a/sdk/communication/azure-communication-identity/samples/identity_samples.py b/sdk/communication/azure-communication-identity/samples/identity_samples.py index 129442cfda626..c804976372c1e 100644 --- a/sdk/communication/azure-communication-identity/samples/identity_samples.py +++ b/sdk/communication/azure-communication-identity/samples/identity_samples.py @@ -73,7 +73,7 @@ def create_user(self): user = identity_client.create_user() print("User created with id:" + user.identifier) - def create_user_with_token(self): + def create_user_and_token(self): from azure.communication.identity import ( CommunicationIdentityClient, CommunicationTokenScope @@ -84,7 +84,7 @@ def create_user_with_token(self): else: identity_client = CommunicationIdentityClient.from_connection_string(self.connection_string) print("Creating new user with token") - user, tokenresponse = identity_client.create_user_with_token(scopes=[CommunicationTokenScope.CHAT]) + user, tokenresponse = identity_client.create_user_and_token(scopes=[CommunicationTokenScope.CHAT]) print("User created with id:" + user.identifier) print("Token issued with value: " + tokenresponse.token) @@ -104,7 +104,7 @@ def delete_user(self): if __name__ == '__main__': sample = CommunicationIdentityClientSamples() sample.create_user() - sample.create_user_with_token() + sample.create_user_and_token() sample.get_token() sample.revoke_tokens() sample.delete_user() diff --git a/sdk/communication/azure-communication-identity/samples/identity_samples_async.py b/sdk/communication/azure-communication-identity/samples/identity_samples_async.py index 6d905a49627bc..0f5e5ab151baf 100644 --- a/sdk/communication/azure-communication-identity/samples/identity_samples_async.py +++ b/sdk/communication/azure-communication-identity/samples/identity_samples_async.py @@ -75,7 +75,7 @@ async def create_user(self): user = await identity_client.create_user() print("User created with id:" + user.identifier) - async def create_user_with_token(self): + async def create_user_and_token(self): from azure.communication.identity.aio import CommunicationIdentityClient from azure.communication.identity import CommunicationTokenScope if self.client_id is not None and self.client_secret is not None and self.tenant_id is not None: @@ -86,7 +86,7 @@ async def create_user_with_token(self): async with identity_client: print("Creating new user with token") - user, tokenresponse = await identity_client.create_user_with_token(scopes=[CommunicationTokenScope.CHAT]) + user, tokenresponse = await identity_client.create_user_and_token(scopes=[CommunicationTokenScope.CHAT]) print("User created with id:" + user.identifier) print("Token issued with value: " + tokenresponse.token) @@ -107,7 +107,7 @@ async def delete_user(self): async def main(): sample = CommunicationIdentityClientSamples() await sample.create_user() - await sample.create_user_with_token() + await sample.create_user_and_token() await sample.get_token() await sample.revoke_tokens() await sample.delete_user() diff --git a/sdk/communication/azure-communication-identity/tests/test_communication_identity_client.py b/sdk/communication/azure-communication-identity/tests/test_communication_identity_client.py index 30d5cfdd72ff9..253c0b4d491d9 100644 --- a/sdk/communication/azure-communication-identity/tests/test_communication_identity_client.py +++ b/sdk/communication/azure-communication-identity/tests/test_communication_identity_client.py @@ -57,9 +57,9 @@ def test_create_user(self, connection_string): @ResourceGroupPreparer(random_name_enabled=True) @CommunicationServicePreparer() - def test_create_user_with_token(self, connection_string): + def test_create_user_and_token(self, connection_string): identity_client = CommunicationIdentityClient.from_connection_string(connection_string) - user, token_response = identity_client.create_user_with_token(scopes=[CommunicationTokenScope.CHAT]) + user, token_response = identity_client.create_user_and_token(scopes=[CommunicationTokenScope.CHAT]) assert user.identifier is not None assert token_response.token is not None diff --git a/sdk/communication/azure-communication-identity/tests/test_communication_identity_client_async.py b/sdk/communication/azure-communication-identity/tests/test_communication_identity_client_async.py index 58c8a550304b1..3f5a863320701 100644 --- a/sdk/communication/azure-communication-identity/tests/test_communication_identity_client_async.py +++ b/sdk/communication/azure-communication-identity/tests/test_communication_identity_client_async.py @@ -56,10 +56,10 @@ async def test_create_user(self, connection_string): @ResourceGroupPreparer(random_name_enabled=True) @CommunicationServicePreparer() - async def test_create_user_with_token(self, connection_string): + async def test_create_user_and_token(self, connection_string): identity_client = CommunicationIdentityClient.from_connection_string(connection_string) async with identity_client: - user, token_response = await identity_client.create_user_with_token(scopes=[CommunicationTokenScope.CHAT]) + user, token_response = await identity_client.create_user_and_token(scopes=[CommunicationTokenScope.CHAT]) assert user.identifier is not None assert token_response.token is not None