Skip to content

Commit 2f21805

Browse files
authored
[communication-identity] Rename createUserWithToken to createUserAndToken (Azure#14078)
1 parent f08b33e commit 2f21805

File tree

9 files changed

+15
-14
lines changed

9 files changed

+15
-14
lines changed

sdk/communication/communication-chat/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
"@azure/core-paging": "^1.1.1"
7878
},
7979
"devDependencies": {
80-
"@azure/communication-identity": "1.0.0-beta.4",
80+
"@azure/communication-identity": "1.0.0-beta.5",
8181
"@azure/eslint-plugin-azure-sdk": "^3.0.0",
8282
"@azure/test-utils-recorder": "^1.0.0",
8383
"@microsoft/api-extractor": "7.7.11",

sdk/communication/communication-chat/test/utils/recordedClient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export const environmentSetup: RecorderEnvironmentSetup = {
4040

4141
export async function createTestUser(): Promise<CommunicationUserToken> {
4242
const identityClient = new CommunicationIdentityClient(env.COMMUNICATION_CONNECTION_STRING);
43-
return await identityClient.createUserWithToken(["chat"]);
43+
return await identityClient.createUserAndToken(["chat"]);
4444
}
4545

4646
export async function deleteTestUser(testUser: CommunicationUserIdentifier) {

sdk/communication/communication-identity/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Breaking Changes
66

77
- `CommunicationIdentityClient` method `issueToken` renamed to `getToken`.
8+
- `CommunicationIdentityClient` method `createUserWithToken` renamed to `createUserAndToken`.
89
- Renamed `CommunicationIdentityOptions` to `CommunicationIdentityClientOptions`.
910
- Removed `_response` from returned models.
1011

sdk/communication/communication-identity/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ To refresh the user token, issue another token with the same user.
9292
{ token } = await client.getToken(user, ["chat"]);
9393
```
9494

95-
### Creating a user together with a token in a single request
95+
### Creating a user and a token in a single request
9696

97-
For convenience, use `createUserWithToken` to create a new user and issue a token with one function call. This translates into a single web request as opposed to creating a user first and then issuing a token.
97+
For convenience, use `createUserAndToken` to create a new user and issue a token with one function call. This translates into a single web request as opposed to creating a user first and then issuing a token.
9898

9999
```typescript
100100
let { user, token } = await client.createUserWithToken(["chat"]);

sdk/communication/communication-identity/review/communication-identity.api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export class CommunicationIdentityClient {
2222
constructor(endpoint: string, credential: KeyCredential, options?: CommunicationIdentityClientOptions);
2323
constructor(endpoint: string, credential: TokenCredential, options?: CommunicationIdentityClientOptions);
2424
createUser(options?: OperationOptions): Promise<CommunicationUserIdentifier>;
25-
createUserWithToken(scopes: TokenScope[], options?: OperationOptions): Promise<CommunicationUserToken>;
25+
createUserAndToken(scopes: TokenScope[], options?: OperationOptions): Promise<CommunicationUserToken>;
2626
deleteUser(user: CommunicationUserIdentifier, options?: OperationOptions): Promise<void>;
2727
getToken(user: CommunicationUserIdentifier, scopes: TokenScope[], options?: OperationOptions): Promise<CommunicationAccessToken>;
2828
revokeTokens(user: CommunicationUserIdentifier, options?: OperationOptions): Promise<void>;

sdk/communication/communication-identity/src/communicationIdentityClient.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,12 +196,12 @@ export class CommunicationIdentityClient {
196196
* @param scopes - Scopes to include in the token.
197197
* @param options - Additional options for the request.
198198
*/
199-
public async createUserWithToken(
199+
public async createUserAndToken(
200200
scopes: TokenScope[],
201201
options: OperationOptions = {}
202202
): Promise<CommunicationUserToken> {
203203
const { span, updatedOptions } = createSpan(
204-
"CommunicationIdentity-createUserWithToken",
204+
"CommunicationIdentity-createUserAndToken",
205205
options
206206
);
207207
try {

sdk/communication/communication-identity/test/communicationIdentityClient.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ describe("CommunicationIdentityClient [Playback/Live]", function() {
3131
});
3232

3333
it("successfully creates a user and token", async function() {
34-
const { user: newUser, token } = await client.createUserWithToken(["voip"]);
34+
const { user: newUser, token } = await client.createUserAndToken(["voip"]);
3535
assert.isString(newUser.communicationUserId);
3636
assert.isString(token);
3737
});
@@ -49,7 +49,7 @@ describe("CommunicationIdentityClient [Playback/Live]", function() {
4949
});
5050

5151
it("successfully creates a user and gets a token in a single request", async function() {
52-
const { user: newUser, token, expiresOn } = await client.createUserWithToken(["chat", "voip"]);
52+
const { user: newUser, token, expiresOn } = await client.createUserAndToken(["chat", "voip"]);
5353
assert.isTrue(isCommunicationUserIdentifier(newUser));
5454
assert.isString(token);
5555
assert.instanceOf(expiresOn, Date);

sdk/communication/communication-identity/test/utils/mockHttpClients.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export const createUserHttpClient: HttpClient = createMockHttpClient<
4040
identity: { id: "identity" }
4141
});
4242

43-
export const createUserWithTokenHttpClient: HttpClient = createMockHttpClient<
43+
export const createUserAndTokenHttpClient: HttpClient = createMockHttpClient<
4444
CommunicationIdentityAccessTokenResult
4545
>(201, {
4646
identity: { id: "identity" },

sdk/communication/communication-identity/test/utils/testCommunicationIdentityClient.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
getTokenHttpClient,
1414
createUserHttpClient,
1515
revokeTokensHttpClient,
16-
createUserWithTokenHttpClient
16+
createUserAndTokenHttpClient
1717
} from "./mockHttpClients";
1818

1919
export class TestCommunicationIdentityClient {
@@ -49,13 +49,13 @@ export class TestCommunicationIdentityClient {
4949
return client.createUser(options);
5050
}
5151

52-
public async createUserWithTokenTest(
52+
public async createUserAndTokenTest(
5353
scopes: TokenScope[],
5454
options: OperationOptions = {}
5555
): Promise<CommunicationUserToken> {
5656
const client = new CommunicationIdentityClient(this.connectionString, {
57-
httpClient: createUserWithTokenHttpClient
57+
httpClient: createUserAndTokenHttpClient
5858
});
59-
return client.createUserWithToken(scopes, options);
59+
return client.createUserAndToken(scopes, options);
6060
}
6161
}

0 commit comments

Comments
 (0)