Skip to content

Commit 5e2b957

Browse files
[Communication] SMS 1:N Messages, Custom Tags and Idempotency Functionality (Azure#13927)
* Code gen with new swagger * Modified the Api to be pagedIterable * Rename model to SendSmsResult * Swagger changes * Exporting SendSmsResult * Samples * Formatting * update swagger + auto-gen * update method signature + tests * formatting * First cut - update tests * add livetest recordings * workaround to mock uuid for browser tests * update recordings * conceal repeatibilityResult * rename request and options * update sample * make options bag optional * use fake timers and check repeatability on fail * update mocked test fix unhandled promise warning * clean up mock * remove unnecessary import * update md file * refactor + update tests to support recording * formatting * skip token test if browser * update recordings * formatting * update recordings * update hash + changelog * change how we assign date for idempotency * update tests * change how we skip browser token test * remove test that is failing intermittently * make samples prettier * change how sample is printed * refactor client * formatting * update tests from pr comments and re-record * re-record and generate after PR feedback * update tests because of service deployment * add filter after rebase Co-authored-by: Ankit Arora <ankita@microsoft.com>
1 parent e662b30 commit 5e2b957

28 files changed

+792
-359
lines changed

sdk/communication/communication-sms/CHANGELOG.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,23 @@
66

77
- `SmsClient` added a constructor that supports `TokenCredential`.
88

9+
### Breaking Changes
10+
11+
- `SendRequest` renamed to `SmsSendRequest`.
12+
- `SendOptions` renamed to `SmsSendOptions` and now has an additional field `tag` to add a custom tag to delivery reports (when enabled).
13+
- `send` no longer returns `RestResponse`, now returns an array of `SmsSendResults`. This contains fields to validate success/failure of each sent message.
14+
915
## 1.0.0-beta.3 (2020-11-16)
1016

1117
Updated `@azure/communication-sms` version.
1218

1319
## 1.0.0-beta.2 (2020-10-06)
1420

15-
Updated `@azure/communication-sms` version
21+
Updated `@azure/communication-sms` version.
1622

1723
## 1.0.0-beta.1 (2020-09-22)
1824

1925
The first preview of the Azure Communication Sms Client has the following features:
2026

21-
- send a SMS message from an acquired phone number
22-
- optionally enable delivery reports
27+
- send a SMS message from an acquired phone number.
28+
- optionally enable delivery reports.

sdk/communication/communication-sms/recordings/browsers/smsclient/recording_sends_a_sms_message.json

Lines changed: 0 additions & 22 deletions
This file was deleted.

sdk/communication/communication-sms/recordings/browsers/smsclient/recording_sends_a_sms_message_to_multiple_recipients.json

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/communication/communication-sms/recordings/browsers/smsclient/recording_throws_an_exception_when_sending_from_a_number_you_dont_own.json

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/communication/communication-sms/recordings/node/smsclient/recording_sends_a_sms_message.js

Lines changed: 0 additions & 25 deletions
This file was deleted.

sdk/communication/communication-sms/recordings/node/smsclient/recording_sends_a_sms_message_to_multiple_recipients.js

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/communication/communication-sms/recordings/node/smsclient/recording_throws_an_exception_when_sending_from_a_number_you_dont_own.js

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/communication/communication-sms/recordings/node/smsclientwithtoken_playbacklive/recording_sends_a_sms_when_url_and_token_credential_are_provided.js

Lines changed: 60 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/communication/communication-sms/recordings/node/smsclientwithtoken_playbacklive/recording_successfully_issues_a_token_for_a_user.js

Lines changed: 16 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,40 @@
77
import { KeyCredential } from '@azure/core-auth';
88
import { OperationOptions } from '@azure/core-http';
99
import { PipelineOptions } from '@azure/core-http';
10-
import { RestResponse } from '@azure/core-http';
1110
import { TokenCredential } from '@azure/core-auth';
1211

1312
// @public
14-
export interface SendOptions extends OperationOptions {
15-
enableDeliveryReport?: boolean;
13+
export class SmsClient {
14+
constructor(connectionString: string, options?: SmsClientOptions);
15+
constructor(endpoint: string, credential: KeyCredential, options?: SmsClientOptions);
16+
constructor(endpoint: string, credential: TokenCredential, options?: SmsClientOptions);
17+
send(sendRequest: SmsSendRequest, options?: SmsSendOptions): Promise<SmsSendResult[]>;
1618
}
1719

1820
// @public
19-
export interface SendRequest {
20-
from: string;
21-
message: string;
22-
to: string[];
21+
export interface SmsClientOptions extends PipelineOptions {
2322
}
2423

2524
// @public
26-
export class SmsClient {
27-
constructor(connectionString: string, options?: SmsClientOptions);
28-
constructor(url: string, credential: KeyCredential, options?: SmsClientOptions);
29-
constructor(url: string, credential: TokenCredential, options?: SmsClientOptions);
30-
send(sendRequest: SendRequest, options?: SendOptions): Promise<RestResponse>;
25+
export interface SmsSendOptions extends OperationOptions {
26+
enableDeliveryReport?: boolean;
27+
tag?: string;
3128
}
3229

3330
// @public
34-
export interface SmsClientOptions extends PipelineOptions {
31+
export interface SmsSendRequest {
32+
from: string;
33+
message: string;
34+
to: string[];
35+
}
36+
37+
// @public (undocumented)
38+
export interface SmsSendResult {
39+
errorMessage?: string;
40+
httpStatusCode: number;
41+
messageId?: string;
42+
successful: boolean;
43+
to: string;
3544
}
3645

3746

0 commit comments

Comments
 (0)