Skip to content

Commit e12f3e0

Browse files
minnieliuMinnie Liu
andauthored
[Communication] - Common - Adding Identifier Suffix to all Identifier types (Azure#17608)
* Adding Identifier Suffix to all Identifier types * Update generated files * Fix minor issues * Update changelog Co-authored-by: Minnie Liu <peiliu@microsoft.com>
1 parent cc2262b commit e12f3e0

32 files changed

+169
-166
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ var client = new CommunicationIdentityClient(connectionString);
4848

4949
### Create a new identity
5050
```C# Snippet:CreateCommunicationUserAsync
51-
Response<CommunicationUser> userResponse = await client.CreateUserAsync();
52-
CommunicationUser user = userResponse.Value;
51+
Response<CommunicationUserIdentifier> userResponse = await client.CreateUserAsync();
52+
CommunicationUserIdentifier user = userResponse.Value;
5353
Console.WriteLine($"User id: {user.Id}");
5454
```
5555

@@ -85,7 +85,7 @@ var client = new CommunicationIdentityClient(connectionString);
8585

8686
try
8787
{
88-
Response<CommunicationUser> response = await client.CreateUserAsync();
88+
Response<CommunicationUserIdentifier> response = await client.CreateUserAsync();
8989
}
9090
catch (RequestFailedException ex)
9191
{

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

Lines changed: 19 additions & 19 deletions
Large diffs are not rendered by default.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ var client = new CommunicationIdentityClient(connectionString);
2020
The `CommunicationIdentityClient` can be used to create users and issue tokens.
2121

2222
```C# Snippet:CreateCommunicationUser
23-
Response<CommunicationUser> userResponse = client.CreateUser();
24-
CommunicationUser user = userResponse.Value;
23+
Response<CommunicationUserIdentifier> userResponse = client.CreateUser();
24+
CommunicationUserIdentifier user = userResponse.Value;
2525
Console.WriteLine($"User id: {user.Id}");
2626
```
2727

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ var client = new CommunicationIdentityClient(connectionString);
2020
The `CommunicationIdentityClient` can be used to create users and issue tokens.
2121

2222
```C# Snippet:CreateCommunicationUserAsync
23-
Response<CommunicationUser> userResponse = await client.CreateUserAsync();
24-
CommunicationUser user = userResponse.Value;
23+
Response<CommunicationUserIdentifier> userResponse = await client.CreateUserAsync();
24+
CommunicationUserIdentifier user = userResponse.Value;
2525
Console.WriteLine($"User id: {user.Id}");
2626
```
2727

sdk/communication/Azure.Communication.Administration/samples/Sample2_PhoneNumberAdministrationClient.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ If you no longer need a phone number you can release it.
189189

190190
```C# Snippet:ReleasePhoneNumbers
191191
var acquiredPhoneNumber = "<acquired_phone_number>";
192-
var releaseOperation = client.StartReleasePhoneNumber(new PhoneNumber(acquiredPhoneNumber));
192+
var releaseOperation = client.StartReleasePhoneNumber(new PhoneNumberIdentifier(acquiredPhoneNumber));
193193

194194
while (!releaseOperation.HasCompleted)
195195
{

sdk/communication/Azure.Communication.Administration/samples/Sample2_PhoneNumberAdministrationClientAsync.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,6 @@ If you no longer need a phone number you can release it.
171171

172172
```C# Snippet:ReleasePhoneNumbersAsync
173173
var acquiredPhoneNumber = "<acquired_phone_number>";
174-
var releaseOperation = client.StartReleasePhoneNumber(new PhoneNumber(acquiredPhoneNumber));
174+
var releaseOperation = client.StartReleasePhoneNumber(new PhoneNumberIdentifier(acquiredPhoneNumber));
175175
await releaseOperation.WaitForCompletionAsync();
176176
```

sdk/communication/Azure.Communication.Administration/src/CommunicationIdentityClient.cs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,16 @@ protected CommunicationIdentityClient()
6464
RestClient = null!;
6565
}
6666

67-
/// <summary>Asynchronously creates a new <see cref="CommunicationUser"/>.</summary>
67+
/// <summary>Asynchronously creates a new <see cref="CommunicationUserIdentifier"/>.</summary>
6868
/// <param name="cancellationToken">The cancellation token to use.</param>
69-
public virtual async Task<Response<CommunicationUser>> CreateUserAsync(CancellationToken cancellationToken = default)
69+
public virtual async Task<Response<CommunicationUserIdentifier>> CreateUserAsync(CancellationToken cancellationToken = default)
7070
{
7171
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CommunicationIdentityClient)}.{nameof(CreateUser)}");
7272
scope.Start();
7373
try
7474
{
7575
Response<CommunicationIdentity> response = await RestClient.CreateAsync(cancellationToken).ConfigureAwait(false);
76-
return Response.FromValue(new CommunicationUser(response.Value.Id), response.GetRawResponse());
76+
return Response.FromValue(new CommunicationUserIdentifier(response.Value.Id), response.GetRawResponse());
7777
}
7878
catch (Exception ex)
7979
{
@@ -82,18 +82,18 @@ public virtual async Task<Response<CommunicationUser>> CreateUserAsync(Cancellat
8282
}
8383
}
8484

85-
/// <summary>Creates a new <see cref="CommunicationUser"/>.</summary>
86-
/// <returns>A <see cref="Response{CommunicationUser}"/>.</returns>
85+
/// <summary>Creates a new <see cref="CommunicationUserIdentifier"/>.</summary>
86+
/// <returns>A <see cref="Response{CommunicationUserIdentifier}"/>.</returns>
8787
/// <param name="cancellationToken">The cancellation token to use.</param>
8888
/// <exception cref="RequestFailedException">The server returned an error.</exception>
89-
public virtual Response<CommunicationUser> CreateUser(CancellationToken cancellationToken = default)
89+
public virtual Response<CommunicationUserIdentifier> CreateUser(CancellationToken cancellationToken = default)
9090
{
9191
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CommunicationIdentityClient)}.{nameof(CreateUser)}");
9292
scope.Start();
9393
try
9494
{
9595
Response<CommunicationIdentity> response = RestClient.Create(cancellationToken);
96-
return Response.FromValue(new CommunicationUser(response.Value.Id), response.GetRawResponse());
96+
return Response.FromValue(new CommunicationUserIdentifier(response.Value.Id), response.GetRawResponse());
9797
}
9898
catch (Exception ex)
9999
{
@@ -102,10 +102,10 @@ public virtual Response<CommunicationUser> CreateUser(CancellationToken cancella
102102
}
103103
}
104104

105-
/// <summary>Asynchronously deletes a <see cref="CommunicationUser"/>, revokes its tokens and deletes its data.</summary>
105+
/// <summary>Asynchronously deletes a <see cref="CommunicationUserIdentifier"/>, revokes its tokens and deletes its data.</summary>
106106
/// <param name="communicationUser"> The user to be deleted.</param>
107107
/// <param name="cancellationToken"> The cancellation token to use.</param>
108-
public virtual async Task<Response> DeleteUserAsync(CommunicationUser communicationUser, CancellationToken cancellationToken = default)
108+
public virtual async Task<Response> DeleteUserAsync(CommunicationUserIdentifier communicationUser, CancellationToken cancellationToken = default)
109109
{
110110
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CommunicationIdentityClient)}.{nameof(DeleteUser)}");
111111
scope.Start();
@@ -120,11 +120,11 @@ public virtual async Task<Response> DeleteUserAsync(CommunicationUser communicat
120120
}
121121
}
122122

123-
/// <summary>Asynchronously deletes a <see cref="CommunicationUser"/>, revokes its tokens and deletes its data.</summary>
123+
/// <summary>Asynchronously deletes a <see cref="CommunicationUserIdentifier"/>, revokes its tokens and deletes its data.</summary>
124124
/// <param name="communicationUser"> The user to be deleted.</param>
125125
/// <param name="cancellationToken"> The cancellation token to use.</param>
126126
/// <exception cref="RequestFailedException">The server returned an error.</exception>
127-
public virtual Response DeleteUser(CommunicationUser communicationUser, CancellationToken cancellationToken = default)
127+
public virtual Response DeleteUser(CommunicationUserIdentifier communicationUser, CancellationToken cancellationToken = default)
128128
{
129129
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CommunicationIdentityClient)}.{nameof(DeleteUser)}");
130130
scope.Start();
@@ -139,11 +139,11 @@ public virtual Response DeleteUser(CommunicationUser communicationUser, Cancella
139139
}
140140
}
141141

142-
/// <summary>Asynchronously revokes all the tokens created for a <see cref="CommunicationUser"/>.</summary>
143-
/// <param name="communicationUser">The <see cref="CommunicationUser"/> whose tokens should get revoked.</param>
142+
/// <summary>Asynchronously revokes all the tokens created for a <see cref="CommunicationUserIdentifier"/>.</summary>
143+
/// <param name="communicationUser">The <see cref="CommunicationUserIdentifier"/> whose tokens should get revoked.</param>
144144
/// <param name="issuedBefore">All tokens that are issued prior to this time will be revoked.</param>
145145
/// <param name="cancellationToken">The cancellation token to use.</param>
146-
public virtual async Task<Response> RevokeTokensAsync(CommunicationUser communicationUser, DateTimeOffset? issuedBefore = default, CancellationToken cancellationToken = default)
146+
public virtual async Task<Response> RevokeTokensAsync(CommunicationUserIdentifier communicationUser, DateTimeOffset? issuedBefore = default, CancellationToken cancellationToken = default)
147147
{
148148
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CommunicationIdentityClient)}.{nameof(RevokeTokens)}");
149149
scope.Start();
@@ -159,11 +159,11 @@ public virtual async Task<Response> RevokeTokensAsync(CommunicationUser communic
159159
}
160160

161161
/// <summary>Revokes all the tokens created for a user.</summary>
162-
/// <param name="communicationUser">The <see cref="CommunicationUser"/> whose tokens will be revoked.</param>
162+
/// <param name="communicationUser">The <see cref="CommunicationUserIdentifier"/> whose tokens will be revoked.</param>
163163
/// <param name="issuedBefore">All tokens that are issued prior to this time should get revoked.</param>
164164
/// <param name="cancellationToken">The cancellation token to use.</param>
165165
/// <exception cref="RequestFailedException">The server returned an error.</exception>
166-
public virtual Response RevokeTokens(CommunicationUser communicationUser, DateTimeOffset? issuedBefore = default, CancellationToken cancellationToken = default)
166+
public virtual Response RevokeTokens(CommunicationUserIdentifier communicationUser, DateTimeOffset? issuedBefore = default, CancellationToken cancellationToken = default)
167167
{
168168
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CommunicationIdentityClient)}.{nameof(RevokeTokens)}");
169169
scope.Start();
@@ -178,11 +178,11 @@ public virtual Response RevokeTokens(CommunicationUser communicationUser, DateTi
178178
}
179179
}
180180

181-
/// <summary>Asynchronously issues a token for a <see cref="CommunicationUser"/>.</summary>
181+
/// <summary>Asynchronously issues a token for a <see cref="CommunicationUserIdentifier"/>.</summary>
182182
/// <param name="scopes">The scopes that the token should have.</param>
183-
/// <param name="communicationUser">The <see cref="CommunicationUser"/> for whom to issue a token.</param>
183+
/// <param name="communicationUser">The <see cref="CommunicationUserIdentifier"/> for whom to issue a token.</param>
184184
/// <param name="cancellationToken">The cancellation token to use.</param>
185-
public virtual async Task<Response<CommunicationUserToken>> IssueTokenAsync(CommunicationUser communicationUser, IEnumerable<CommunicationTokenScope> scopes, CancellationToken cancellationToken = default)
185+
public virtual async Task<Response<CommunicationUserToken>> IssueTokenAsync(CommunicationUserIdentifier communicationUser, IEnumerable<CommunicationTokenScope> scopes, CancellationToken cancellationToken = default)
186186
{
187187
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CommunicationIdentityClient)}.{nameof(IssueToken)}");
188188
scope.Start();
@@ -197,12 +197,12 @@ public virtual async Task<Response<CommunicationUserToken>> IssueTokenAsync(Comm
197197
}
198198
}
199199

200-
/// <summary>Issues a token for a <see cref="CommunicationUser"/>.</summary>
200+
/// <summary>Issues a token for a <see cref="CommunicationUserIdentifier"/>.</summary>
201201
/// <param name="scopes">The scopes that the token should have.</param>
202-
/// <param name="communicationUser">The <see cref="CommunicationUser"/> for whom to issue a token.</param>
202+
/// <param name="communicationUser">The <see cref="CommunicationUserIdentifier"/> for whom to issue a token.</param>
203203
/// <param name="cancellationToken">The cancellation token to use.</param>
204204
/// <exception cref="RequestFailedException">The server returned an error.</exception>
205-
public virtual Response<CommunicationUserToken> IssueToken(CommunicationUser communicationUser, IEnumerable<CommunicationTokenScope> scopes, CancellationToken cancellationToken = default)
205+
public virtual Response<CommunicationUserToken> IssueToken(CommunicationUserIdentifier communicationUser, IEnumerable<CommunicationTokenScope> scopes, CancellationToken cancellationToken = default)
206206
{
207207
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CommunicationIdentityClient)}.{nameof(IssueToken)}");
208208
scope.Start();

sdk/communication/Azure.Communication.Administration/src/Models/CommunicationUserToken.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ public partial class CommunicationUserToken
1212
internal CommunicationUserToken(string id, string token, DateTimeOffset expiresOn)
1313
{
1414
Id = id;
15-
User = new CommunicationUser(id);
15+
User = new CommunicationUserIdentifier(id);
1616
Token = token;
1717
ExpiresOn = expiresOn;
1818
}
1919

2020
/// <summary>
21-
/// The <see cref="CommunicationUser" /> for which the token is being issued.
21+
/// The <see cref="CommunicationUserIdentifier" /> for which the token is being issued.
2222
/// </summary>
23-
public CommunicationUser User { get; }
23+
public CommunicationUserIdentifier User { get; }
2424
internal string Id { get; }
2525
}
2626
}

0 commit comments

Comments
 (0)