Skip to content

Commit 73fb0c1

Browse files
Renaming with_token identity function
1 parent 303ff1f commit 73fb0c1

9 files changed

+14
-14
lines changed

sdk/communication/azure-communication-identity/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ user = identity_client.create_user()
5757
print("User created with id:" + user.identifier)
5858
```
5959

60-
Alternatively, use the `create_user_with_token` method to create a new user and issue a token for it.\
60+
Alternatively, use the `create_user_and_token` method to create a new user and issue a token for it.\
6161
For this option, a list of `CommunicationTokenScope` must be defined (see "Issuing an access token" for more information)
6262

6363
```python
64-
user, tokenresponse = identity_client.create_user_with_token(scopes=[CommunicationTokenScope.CHAT])
64+
user, tokenresponse = identity_client.create_user_and_token(scopes=[CommunicationTokenScope.CHAT])
6565
print("User id:" + user.identifier)
6666
print("Token issued with value: " + tokenresponse.token)
6767
```

sdk/communication/azure-communication-identity/azure/communication/identity/_communication_identity_client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def create_user(self, **kwargs):
9090
**kwargs)
9191

9292
@distributed_trace
93-
def create_user_with_token(
93+
def create_user_and_token(
9494
self,
9595
scopes, # type: List[Union[str, "_model.CommunicationTokenScope"]]
9696
**kwargs # type: Any

sdk/communication/azure-communication-identity/azure/communication/identity/aio/_communication_identity_client_async.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ async def create_user(self, **kwargs):
9191
**kwargs)
9292

9393
@distributed_trace_async
94-
async def create_user_with_token(
94+
async def create_user_and_token(
9595
self,
9696
scopes, # type: List[Union[str, "_model.CommunicationTokenScope"]]
9797
**kwargs # type: Any

sdk/communication/azure-communication-identity/samples/identity_samples.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def create_user(self):
7373
user = identity_client.create_user()
7474
print("User created with id:" + user.identifier)
7575

76-
def create_user_with_token(self):
76+
def create_user_and_token(self):
7777
from azure.communication.identity import (
7878
CommunicationIdentityClient,
7979
CommunicationTokenScope
@@ -84,7 +84,7 @@ def create_user_with_token(self):
8484
else:
8585
identity_client = CommunicationIdentityClient.from_connection_string(self.connection_string)
8686
print("Creating new user with token")
87-
user, tokenresponse = identity_client.create_user_with_token(scopes=[CommunicationTokenScope.CHAT])
87+
user, tokenresponse = identity_client.create_user_and_token(scopes=[CommunicationTokenScope.CHAT])
8888
print("User created with id:" + user.identifier)
8989
print("Token issued with value: " + tokenresponse.token)
9090

@@ -104,7 +104,7 @@ def delete_user(self):
104104
if __name__ == '__main__':
105105
sample = CommunicationIdentityClientSamples()
106106
sample.create_user()
107-
sample.create_user_with_token()
107+
sample.create_user_and_token()
108108
sample.get_token()
109109
sample.revoke_tokens()
110110
sample.delete_user()

sdk/communication/azure-communication-identity/samples/identity_samples_async.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ async def create_user(self):
7575
user = await identity_client.create_user()
7676
print("User created with id:" + user.identifier)
7777

78-
async def create_user_with_token(self):
78+
async def create_user_and_token(self):
7979
from azure.communication.identity.aio import CommunicationIdentityClient
8080
from azure.communication.identity import CommunicationTokenScope
8181
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):
8686

8787
async with identity_client:
8888
print("Creating new user with token")
89-
user, tokenresponse = await identity_client.create_user_with_token(scopes=[CommunicationTokenScope.CHAT])
89+
user, tokenresponse = await identity_client.create_user_and_token(scopes=[CommunicationTokenScope.CHAT])
9090
print("User created with id:" + user.identifier)
9191
print("Token issued with value: " + tokenresponse.token)
9292

@@ -107,7 +107,7 @@ async def delete_user(self):
107107
async def main():
108108
sample = CommunicationIdentityClientSamples()
109109
await sample.create_user()
110-
await sample.create_user_with_token()
110+
await sample.create_user_and_token()
111111
await sample.get_token()
112112
await sample.revoke_tokens()
113113
await sample.delete_user()

sdk/communication/azure-communication-identity/tests/test_communication_identity_client.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ def test_create_user(self, connection_string):
5757

5858
@ResourceGroupPreparer(random_name_enabled=True)
5959
@CommunicationServicePreparer()
60-
def test_create_user_with_token(self, connection_string):
60+
def test_create_user_and_token(self, connection_string):
6161
identity_client = CommunicationIdentityClient.from_connection_string(connection_string)
62-
user, token_response = identity_client.create_user_with_token(scopes=[CommunicationTokenScope.CHAT])
62+
user, token_response = identity_client.create_user_and_token(scopes=[CommunicationTokenScope.CHAT])
6363

6464
assert user.identifier is not None
6565
assert token_response.token is not None

sdk/communication/azure-communication-identity/tests/test_communication_identity_client_async.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ async def test_create_user(self, connection_string):
5656

5757
@ResourceGroupPreparer(random_name_enabled=True)
5858
@CommunicationServicePreparer()
59-
async def test_create_user_with_token(self, connection_string):
59+
async def test_create_user_and_token(self, connection_string):
6060
identity_client = CommunicationIdentityClient.from_connection_string(connection_string)
6161
async with identity_client:
62-
user, token_response = await identity_client.create_user_with_token(scopes=[CommunicationTokenScope.CHAT])
62+
user, token_response = await identity_client.create_user_and_token(scopes=[CommunicationTokenScope.CHAT])
6363

6464
assert user.identifier is not None
6565
assert token_response.token is not None

0 commit comments

Comments
 (0)