Skip to content

Commit 3facfda

Browse files
[Communication] Rename CommunicationIdentityClient.IssueToken to GetToken (Azure#18816)
* [Communication] Rename CommunicationIdentityClient.IssueToken to GetToken * Record the livetests
1 parent 33ca046 commit 3facfda

File tree

37 files changed

+1222
-207
lines changed

37 files changed

+1222
-207
lines changed

sdk/communication/Azure.Communication.Chat/tests/ChatClients/ChatClientsLiveTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ public async Task ReadReceiptGSAsync()
404404
{
405405
Response<CommunicationUserIdentifier> user = communicationIdentityClient.CreateUser();
406406
IEnumerable<CommunicationTokenScope> scopes = new[] { CommunicationTokenScope.Chat };
407-
Response<AccessToken> tokenResponseUser = communicationIdentityClient.IssueToken(user.Value, scopes);
407+
Response<AccessToken> tokenResponseUser = communicationIdentityClient.GetToken(user.Value, scopes);
408408

409409
return (user, tokenResponseUser.Value.Token);
410410
}
@@ -413,7 +413,7 @@ public async Task ReadReceiptGSAsync()
413413
{
414414
Response<CommunicationUserIdentifier> user = await communicationIdentityClient.CreateUserAsync();
415415
IEnumerable<CommunicationTokenScope> scopes = new[] { CommunicationTokenScope.Chat };
416-
Response<AccessToken> tokenResponseUser = await communicationIdentityClient.IssueTokenAsync(user.Value, scopes);
416+
Response<AccessToken> tokenResponseUser = await communicationIdentityClient.GetTokenAsync(user.Value, scopes);
417417

418418
return (user, tokenResponseUser.Value.Token);
419419
}

sdk/communication/Azure.Communication.Chat/tests/samples/Sample1_ThreadOperations.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public async Task CreateGetUpdateDeleteThreadAsync()
1919
CommunicationIdentityClient communicationIdentityClient = new CommunicationIdentityClient(TestEnvironment.ConnectionString);
2020
Response<CommunicationUserIdentifier> threadCreatorIdentifier = await communicationIdentityClient.CreateUserAsync();
2121
CommunicationUserIdentifier kimberly = await communicationIdentityClient.CreateUserAsync();
22-
AccessToken communicationUserToken = await communicationIdentityClient.IssueTokenAsync(threadCreatorIdentifier.Value, new[] { CommunicationTokenScope.Chat });
22+
AccessToken communicationUserToken = await communicationIdentityClient.GetTokenAsync(threadCreatorIdentifier.Value, new[] { CommunicationTokenScope.Chat });
2323
string userToken = communicationUserToken.Token;
2424
string endpoint = TestEnvironment.ChatApiUrl();
2525

sdk/communication/Azure.Communication.Chat/tests/samples/Sample2_MessagingOperations.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public async Task SendGetUpdateDeleteMessagesSendNotificationReadReceiptsAsync()
1818
{
1919
CommunicationIdentityClient communicationIdentityClient = new CommunicationIdentityClient(TestEnvironment.ConnectionString);
2020
Response<CommunicationUserIdentifier> threadMember = await communicationIdentityClient.CreateUserAsync();
21-
AccessToken communicationUserToken = await communicationIdentityClient.IssueTokenAsync(threadMember.Value, new[] { CommunicationTokenScope.Chat });
21+
AccessToken communicationUserToken = await communicationIdentityClient.GetTokenAsync(threadMember.Value, new[] { CommunicationTokenScope.Chat });
2222
string userToken = communicationUserToken.Token;
2323
string endpoint = TestEnvironment.ChatApiUrl();
2424
string theadCreatorMemberId = threadMember.Value.Id;

sdk/communication/Azure.Communication.Chat/tests/samples/Sample3_ParticipantOperations.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public async Task GetAddRemoveMembersAsync()
2424
Response<CommunicationUserIdentifier> amyResponse = await communicationIdentityClient.CreateUserAsync();
2525
CommunicationUserIdentifier amy = amyResponse.Value;
2626

27-
AccessToken joshTokenResponse = await communicationIdentityClient.IssueTokenAsync(josh, new[] { CommunicationTokenScope.Chat });
27+
AccessToken joshTokenResponse = await communicationIdentityClient.GetTokenAsync(josh, new[] { CommunicationTokenScope.Chat });
2828

2929
ChatClient chatClient = new ChatClient(
3030
new Uri(TestEnvironment.ChatApiUrl()),

sdk/communication/Azure.Communication.Chat/tests/samples/Sample4_KeyConcepts.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public async Task Threads_Async()
2121
{
2222
CommunicationIdentityClient communicationIdentityClient = new CommunicationIdentityClient(TestEnvironment.ConnectionString);
2323
Response<CommunicationUserIdentifier> threadCreatorIdentifier = await communicationIdentityClient.CreateUserAsync();
24-
AccessToken communicationUserToken = await communicationIdentityClient.IssueTokenAsync(threadCreatorIdentifier.Value, new[] { CommunicationTokenScope.Chat });
24+
AccessToken communicationUserToken = await communicationIdentityClient.GetTokenAsync(threadCreatorIdentifier.Value, new[] { CommunicationTokenScope.Chat });
2525
string userToken = communicationUserToken.Token;
2626
string endpoint = TestEnvironment.ChatApiUrl();
2727

@@ -60,7 +60,7 @@ public async Task MessagesNotificationsReadReceipts_Async()
6060
{
6161
CommunicationIdentityClient communicationIdentityClient = new CommunicationIdentityClient(TestEnvironment.ConnectionString);
6262
Response<CommunicationUserIdentifier> threadCreatorIdentifier = await communicationIdentityClient.CreateUserAsync();
63-
AccessToken communicationUserToken = await communicationIdentityClient.IssueTokenAsync(threadCreatorIdentifier.Value, new[] { CommunicationTokenScope.Chat });
63+
AccessToken communicationUserToken = await communicationIdentityClient.GetTokenAsync(threadCreatorIdentifier.Value, new[] { CommunicationTokenScope.Chat });
6464
string userToken = communicationUserToken.Token;
6565
string endpoint = TestEnvironment.ChatApiUrl();
6666

@@ -110,7 +110,7 @@ public async Task Participants_Async()
110110
CommunicationIdentityClient communicationIdentityClient = new CommunicationIdentityClient(TestEnvironment.ConnectionString);
111111
Response<CommunicationUserIdentifier> threadCreatorIdentifier = await communicationIdentityClient.CreateUserAsync();
112112
Response<CommunicationUserIdentifier> participantIdentifier = await communicationIdentityClient.CreateUserAsync();
113-
AccessToken communicationUserToken = await communicationIdentityClient.IssueTokenAsync(threadCreatorIdentifier.Value, new[] { CommunicationTokenScope.Chat });
113+
AccessToken communicationUserToken = await communicationIdentityClient.GetTokenAsync(threadCreatorIdentifier.Value, new[] { CommunicationTokenScope.Chat });
114114
string userToken = communicationUserToken.Token;
115115
string endpoint = TestEnvironment.ChatApiUrl();
116116

sdk/communication/Azure.Communication.Identity/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Release History
22

33
## 1.0.0-beta.5 (Unreleased)
4-
4+
### Breaking
5+
- CommunicationIdentityClient.IssueToken and CommunicationIdentityClient.IssueTokenAsync are renamed to GetToken and GetTokenAsync, respectively.
56

67
## 1.0.0-beta.4 (2021-02-09)
78

sdk/communication/Azure.Communication.Identity/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ CommunicationUserIdentifier user = userResponse.Value;
8585
Console.WriteLine($"User id: {user.Id}");
8686
```
8787

88-
### Issuing a token for an existing user
88+
### Getting a token for an existing user
8989

9090
```C# Snippet:CreateCommunicationTokenAsync
91-
Response<AccessToken> tokenResponse = await client.IssueTokenAsync(user, scopes: new[] { CommunicationTokenScope.Chat });
91+
Response<AccessToken> tokenResponse = await client.GetTokenAsync(user, scopes: new[] { CommunicationTokenScope.Chat });
9292
string token = tokenResponse.Value.Token;
9393
DateTimeOffset expiresOn = tokenResponse.Value.ExpiresOn;
9494
Console.WriteLine($"Token: {token}");

sdk/communication/Azure.Communication.Identity/api/Azure.Communication.Identity.netstandard2.0.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ public CommunicationIdentityClient(System.Uri endpoint, Azure.Core.TokenCredenti
1313
public virtual System.Threading.Tasks.Task<Azure.Response<(Azure.Communication.CommunicationUserIdentifier user, Azure.Core.AccessToken token)>> CreateUserWithTokenAsync(System.Collections.Generic.IEnumerable<Azure.Communication.Identity.CommunicationTokenScope> scopes, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
1414
public virtual Azure.Response DeleteUser(Azure.Communication.CommunicationUserIdentifier communicationUser, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
1515
public virtual System.Threading.Tasks.Task<Azure.Response> DeleteUserAsync(Azure.Communication.CommunicationUserIdentifier communicationUser, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
16-
public virtual Azure.Response<Azure.Core.AccessToken> IssueToken(Azure.Communication.CommunicationUserIdentifier communicationUser, System.Collections.Generic.IEnumerable<Azure.Communication.Identity.CommunicationTokenScope> scopes, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
17-
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Core.AccessToken>> IssueTokenAsync(Azure.Communication.CommunicationUserIdentifier communicationUser, System.Collections.Generic.IEnumerable<Azure.Communication.Identity.CommunicationTokenScope> scopes, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
16+
public virtual Azure.Response<Azure.Core.AccessToken> GetToken(Azure.Communication.CommunicationUserIdentifier communicationUser, System.Collections.Generic.IEnumerable<Azure.Communication.Identity.CommunicationTokenScope> scopes, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
17+
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Core.AccessToken>> GetTokenAsync(Azure.Communication.CommunicationUserIdentifier communicationUser, System.Collections.Generic.IEnumerable<Azure.Communication.Identity.CommunicationTokenScope> scopes, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
1818
public virtual Azure.Response RevokeTokens(Azure.Communication.CommunicationUserIdentifier communicationUser, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
1919
public virtual System.Threading.Tasks.Task<Azure.Response> RevokeTokensAsync(Azure.Communication.CommunicationUserIdentifier communicationUser, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
2020
}

sdk/communication/Azure.Communication.Identity/samples/Sample1_CommunicationIdentityClient.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ var client = new CommunicationIdentityClient(endpoint, tokenCredential);
3636

3737
## Create a user
3838

39-
The `CommunicationIdentityClient` can be used to create users and issue tokens.
39+
The `CommunicationIdentityClient` can be used to create users and get tokens.
4040

4141
```C# Snippet:CreateCommunicationUser
4242
Response<CommunicationUserIdentifier> userResponse = client.CreateUser();
@@ -56,7 +56,7 @@ so the token generated by Azure Communication Services is authorized only to do
5656
Every token generated has an expiry date stamped on it. Once the token is expired, you can renew the token by calling the same method.
5757

5858
```C# Snippet:CreateCommunicationToken
59-
Response<AccessToken> tokenResponse = client.IssueToken(user, scopes: new[] { CommunicationTokenScope.Chat });
59+
Response<AccessToken> tokenResponse = client.GetToken(user, scopes: new[] { CommunicationTokenScope.Chat });
6060
string token = tokenResponse.Value.Token;
6161
DateTimeOffset expiresOn = tokenResponse.Value.ExpiresOn;
6262
Console.WriteLine($"Token: {token}");

sdk/communication/Azure.Communication.Identity/samples/Sample1_CommunicationIdentityClientAsync.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ var client = new CommunicationIdentityClient(endpoint, tokenCredential);
3636

3737
## Create a user
3838

39-
The `CommunicationIdentityClient` can be used to create users and issue tokens.
39+
The `CommunicationIdentityClient` can be used to create users and get tokens.
4040

4141
```C# Snippet:CreateCommunicationUserAsync
4242
Response<CommunicationUserIdentifier> userResponse = await client.CreateUserAsync();
@@ -58,7 +58,7 @@ so the token generated by Azure Communication Services is authorized only to do
5858
Every token generated has an expiry date stamped on it. Once the token is expired, you can renew the token by calling the same method.
5959

6060
```C# Snippet:CreateCommunicationTokenAsync
61-
Response<AccessToken> tokenResponse = await client.IssueTokenAsync(user, scopes: new[] { CommunicationTokenScope.Chat });
61+
Response<AccessToken> tokenResponse = await client.GetTokenAsync(user, scopes: new[] { CommunicationTokenScope.Chat });
6262
string token = tokenResponse.Value.Token;
6363
DateTimeOffset expiresOn = tokenResponse.Value.ExpiresOn;
6464
Console.WriteLine($"Token: {token}");

0 commit comments

Comments
 (0)