Skip to content

Commit 7272bb5

Browse files
authored
Renamed issue token to get token (#16773)
1 parent 6f66e0f commit 7272bb5

12 files changed

+31
-25
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Release History
22

3+
## 1.0.0-beta.5 (Unreleased)
4+
5+
### Breaking
6+
- CommunicationIdentityClient's (synchronous and asynchronous) `issue_token` function is now renamed to `get_token`.
7+
38
## 1.0.0b4 (2021-02-09)
49

510
### Added

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ print("Token issued with value: " + tokenresponse.token)
6565

6666
### Issuing or Refreshing an access token for a user
6767

68-
Use the `issue_token` method to issue or refresh a scoped access token for the user. \
68+
Use the `get_token` method to issue or refresh a scoped access token for the user. \
6969
Pass in the user object as a parameter, and a list of `CommunicationTokenScope`. Scope options are:
7070
- `CHAT` (Chat)
7171
- `VOIP` (VoIP)
7272

7373
```python
74-
tokenresponse = identity_client.issue_token(user, scopes=[CommunicationTokenScope.CHAT])
74+
tokenresponse = identity_client.get_token(user, scopes=[CommunicationTokenScope.CHAT])
7575
print("Token issued with value: " + tokenresponse.token)
7676
```
7777

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def delete_user(
129129
communication_user.identifier, **kwargs)
130130

131131
@distributed_trace
132-
def issue_token(
132+
def get_token(
133133
self,
134134
user, # type: CommunicationUserIdentifier
135135
scopes, # List[Union[str, "_model.CommunicationTokenScope"]]

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ async def delete_user(
130130
communication_user.identifier, **kwargs)
131131

132132
@distributed_trace_async
133-
async def issue_token(
133+
async def get_token(
134134
self,
135135
user, # type: CommunicationUserIdentifier
136136
scopes, # type: List[Union[str, "_model.CommunicationTokenScope"]]

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def __init__(self):
2828
self.client_secret = os.getenv('AZURE_CLIENT_SECRET')
2929
self.tenant_id = os.getenv('AZURE_TENANT_ID')
3030

31-
def issue_token(self):
31+
def get_token(self):
3232
from azure.communication.identity import (
3333
CommunicationIdentityClient,
3434
CommunicationTokenScope
@@ -40,8 +40,8 @@ def issue_token(self):
4040
else:
4141
identity_client = CommunicationIdentityClient.from_connection_string(self.connection_string)
4242
user = identity_client.create_user()
43-
print("Issuing token for: " + user.identifier)
44-
tokenresponse = identity_client.issue_token(user, scopes=[CommunicationTokenScope.CHAT])
43+
print("Getting token for: " + user.identifier)
44+
tokenresponse = identity_client.get_token(user, scopes=[CommunicationTokenScope.CHAT])
4545
print("Token issued with value: " + tokenresponse.token)
4646

4747
def revoke_tokens(self):
@@ -56,7 +56,7 @@ def revoke_tokens(self):
5656
else:
5757
identity_client = CommunicationIdentityClient.from_connection_string(self.connection_string)
5858
user = identity_client.create_user()
59-
tokenresponse = identity_client.issue_token(user, scopes=[CommunicationTokenScope.CHAT])
59+
tokenresponse = identity_client.get_token(user, scopes=[CommunicationTokenScope.CHAT])
6060
print("Revoking token: " + tokenresponse.token)
6161
identity_client.revoke_tokens(user)
6262
print(tokenresponse.token + " revoked successfully")
@@ -105,6 +105,6 @@ def delete_user(self):
105105
sample = CommunicationIdentityClientSamples()
106106
sample.create_user()
107107
sample.create_user_with_token()
108-
sample.issue_token()
108+
sample.get_token()
109109
sample.revoke_tokens()
110110
sample.delete_user()

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def __init__(self):
3131
self.client_secret = os.getenv('AZURE_CLIENT_SECRET')
3232
self.tenant_id = os.getenv('AZURE_TENANT_ID')
3333

34-
async def issue_token(self):
34+
async def get_token(self):
3535
from azure.communication.identity.aio import CommunicationIdentityClient
3636
from azure.communication.identity import CommunicationTokenScope
3737
if self.client_id is not None and self.client_secret is not None and self.tenant_id is not None:
@@ -43,7 +43,7 @@ async def issue_token(self):
4343
async with identity_client:
4444
user = await identity_client.create_user()
4545
print("Issuing token for: " + user.identifier)
46-
tokenresponse = await identity_client.issue_token(user, scopes=[CommunicationTokenScope.CHAT])
46+
tokenresponse = await identity_client.get_token(user, scopes=[CommunicationTokenScope.CHAT])
4747
print("Token issued with value: " + tokenresponse.token)
4848

4949
async def revoke_tokens(self):
@@ -57,7 +57,7 @@ async def revoke_tokens(self):
5757

5858
async with identity_client:
5959
user = await identity_client.create_user()
60-
tokenresponse = await identity_client.issue_token(user, scopes=[CommunicationTokenScope.CHAT])
60+
tokenresponse = await identity_client.get_token(user, scopes=[CommunicationTokenScope.CHAT])
6161
print("Revoking token: " + tokenresponse.token)
6262
await identity_client.revoke_tokens(user)
6363
print(tokenresponse.token + " revoked successfully")
@@ -108,7 +108,7 @@ async def main():
108108
sample = CommunicationIdentityClientSamples()
109109
await sample.create_user()
110110
await sample.create_user_with_token()
111-
await sample.issue_token()
111+
await sample.get_token()
112112
await sample.revoke_tokens()
113113
await sample.delete_user()
114114

0 commit comments

Comments
 (0)