@azure-rest/communication-messages 2.1.0-alpha.20250331.1 → 2.1.0-alpha.20250403.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,57 @@
1
+ # Release History
2
+
3
+ ## 2.1.0-beta.2 (Unreleased)
4
+
5
+ ### Features Added
6
+
7
+ ### Breaking Changes
8
+
9
+ ### Bugs Fixed
10
+
11
+ ### Other Changes
12
+
13
+ ## 2.1.0-beta.1 (2025-02-11)
14
+
15
+ ### Features Added
16
+
17
+ - Added Interactive Message.
18
+ - Added Reaction Message.
19
+ - Added Sticker Message.
20
+
21
+ ## 2.0.0 (2024-10-23)
22
+
23
+ ### Features Added
24
+
25
+ - Added ImageNotificationContent to send image messgae.
26
+ - Added DocumentNotificationContent to send document message.
27
+ - Added VideoNotificationContent to send video message.
28
+ - Added AudioNotificationContent to send audio message.
29
+ - Deprecated MediaNotificationContent.
30
+
31
+ ### Breaking Changes
32
+
33
+ - MediaNotificationContent interface kind field is update with value "image_v0" from "image".
34
+
35
+ ## 1.0.1 (2024-03-07)
36
+
37
+ Using MessagesServiceClient:
38
+
39
+ - Send WhatsApp messages.
40
+ - Get Template List.
41
+ - Download media file from WhatsApp server for incoming media message.
42
+
43
+ ### Other Changes
44
+
45
+ - Fixed CI pipeline to publish MS doc.
46
+
47
+ ## 1.0.0 (2024-02-29)
48
+
49
+ ### Features Added
50
+
51
+ This is the initial release of the @azure-rest version of Azure Communication Messages Services.
52
+
53
+ Using MessagesServiceClient:
54
+
55
+ - Send WhatsApp messages.
56
+ - Get Template List.
57
+ - Download media file from WhatsApp server for incoming media message.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@azure-rest/communication-messages",
3
3
  "sdk-type": "client",
4
4
  "author": "Microsoft Corporation",
5
- "version": "2.1.0-alpha.20250331.1",
5
+ "version": "2.1.0-alpha.20250403.1",
6
6
  "description": "Azure client library for Azure Communication Messages services",
7
7
  "keywords": [
8
8
  "node",
@@ -23,7 +23,9 @@
23
23
  "files": [
24
24
  "dist/",
25
25
  "README.md",
26
- "LICENSE"
26
+ "LICENSE",
27
+ "review/",
28
+ "CHANGELOG.md"
27
29
  ],
28
30
  "engines": {
29
31
  "node": ">=18.0.0"
@@ -0,0 +1,595 @@
1
+ ## API Report File for "@azure-rest/communication-messages"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+
7
+ import type { Client } from '@azure-rest/core-client';
8
+ import type { ClientOptions } from '@azure-rest/core-client';
9
+ import type { ErrorResponse } from '@azure-rest/core-client';
10
+ import type { HttpResponse } from '@azure-rest/core-client';
11
+ import type { KeyCredential } from '@azure/core-auth';
12
+ import type { PathUncheckedResponse } from '@azure-rest/core-client';
13
+ import type { RawHttpHeaders } from '@azure/core-rest-pipeline';
14
+ import type { RawHttpHeadersInput } from '@azure/core-rest-pipeline';
15
+ import type { RequestParameters } from '@azure-rest/core-client';
16
+ import type { StreamableMethod } from '@azure-rest/core-client';
17
+ import type { TokenCredential } from '@azure/core-auth';
18
+
19
+ // @public
20
+ export type ActionBindings = ActionBindingsParent | WhatsAppListActionBindings | WhatsAppButtonActionBindings | WhatsAppUrlActionBindings;
21
+
22
+ // @public
23
+ export interface ActionBindingsParent {
24
+ // (undocumented)
25
+ kind: MessageActionBindingKind;
26
+ }
27
+
28
+ // @public
29
+ export interface ActionGroup {
30
+ items: Array<ActionGroupItem>;
31
+ title: string;
32
+ }
33
+
34
+ // @public
35
+ export interface ActionGroupContent extends MessageContentParent {
36
+ groups: Array<ActionGroup>;
37
+ kind: "group";
38
+ title: string;
39
+ }
40
+
41
+ // @public
42
+ export interface ActionGroupItem {
43
+ description: string;
44
+ id: string;
45
+ title: string;
46
+ }
47
+
48
+ // @public
49
+ export interface AudioNotificationContent extends NotificationContentParent {
50
+ kind: "audio";
51
+ mediaUri: string;
52
+ }
53
+
54
+ // @public
55
+ export interface ButtonContent {
56
+ id: string;
57
+ title: string;
58
+ }
59
+
60
+ // @public
61
+ export interface ButtonSetContent extends MessageContentParent {
62
+ buttons: Array<ButtonContent>;
63
+ kind: "buttonSet";
64
+ }
65
+
66
+ // @public
67
+ export type CommunicationMessageKind = string;
68
+
69
+ // @public
70
+ export type CommunicationMessagesChannelOutput = string;
71
+
72
+ // @public
73
+ function createClient(connectionString: string, options?: ClientOptions): MessagesServiceClient;
74
+
75
+ // @public
76
+ function createClient(endpoint: string, credential: KeyCredential | TokenCredential, options?: ClientOptions): MessagesServiceClient;
77
+ export default createClient;
78
+
79
+ // @public
80
+ export interface DocumentMessageContent extends MessageContentParent {
81
+ kind: "document";
82
+ mediaUri: string;
83
+ }
84
+
85
+ // @public
86
+ export interface DocumentNotificationContent extends NotificationContentParent {
87
+ caption?: string;
88
+ fileName?: string;
89
+ kind: "document";
90
+ mediaUri: string;
91
+ }
92
+
93
+ // @public
94
+ export type GetArrayType<T> = T extends Array<infer TData> ? TData : never;
95
+
96
+ // @public (undocumented)
97
+ export interface GetMedia {
98
+ get(options?: GetMediaParameters): StreamableMethod<GetMedia200Response | GetMediaDefaultResponse>;
99
+ }
100
+
101
+ // @public (undocumented)
102
+ export interface GetMedia200Headers {
103
+ "content-type": "application/octet-stream";
104
+ "x-ms-client-request-id"?: string;
105
+ }
106
+
107
+ // @public
108
+ export interface GetMedia200Response extends HttpResponse {
109
+ body: Uint8Array;
110
+ // (undocumented)
111
+ headers: RawHttpHeaders & GetMedia200Headers;
112
+ // (undocumented)
113
+ status: "200";
114
+ }
115
+
116
+ // @public (undocumented)
117
+ export interface GetMediaDefaultHeaders {
118
+ "x-ms-error-code"?: string;
119
+ }
120
+
121
+ // @public (undocumented)
122
+ export interface GetMediaDefaultResponse extends HttpResponse {
123
+ // (undocumented)
124
+ body: ErrorResponse;
125
+ // (undocumented)
126
+ headers: RawHttpHeaders & GetMediaDefaultHeaders;
127
+ // (undocumented)
128
+ status: string;
129
+ }
130
+
131
+ // @public (undocumented)
132
+ export interface GetMediaHeaderParam {
133
+ // (undocumented)
134
+ headers?: RawHttpHeadersInput & GetMediaHeaders;
135
+ }
136
+
137
+ // @public (undocumented)
138
+ export interface GetMediaHeaders {
139
+ "x-ms-client-request-id"?: string;
140
+ }
141
+
142
+ // @public (undocumented)
143
+ export type GetMediaParameters = GetMediaHeaderParam & RequestParameters;
144
+
145
+ // @public
146
+ export type GetPage<TPage> = (pageLink: string) => Promise<{
147
+ page: TPage;
148
+ nextPageLink?: string;
149
+ }>;
150
+
151
+ // @public
152
+ export interface ImageMessageContent extends MessageContentParent {
153
+ kind: "image";
154
+ mediaUri: string;
155
+ }
156
+
157
+ // @public
158
+ export interface ImageNotificationContent extends NotificationContentParent {
159
+ caption?: string;
160
+ kind: "image";
161
+ mediaUri: string;
162
+ }
163
+
164
+ // @public
165
+ export interface InteractiveMessage {
166
+ action: ActionBindings;
167
+ body: TextMessageContent;
168
+ footer?: TextMessageContent;
169
+ header?: MessageContent;
170
+ }
171
+
172
+ // @public
173
+ export interface InteractiveNotificationContent extends NotificationContentParent {
174
+ interactiveMessage: InteractiveMessage;
175
+ kind: "interactive";
176
+ }
177
+
178
+ // @public (undocumented)
179
+ export function isUnexpected(response: GetMedia200Response | GetMediaDefaultResponse): response is GetMediaDefaultResponse;
180
+
181
+ // @public (undocumented)
182
+ export function isUnexpected(response: Send202Response | SendDefaultResponse): response is SendDefaultResponse;
183
+
184
+ // @public (undocumented)
185
+ export function isUnexpected(response: ListTemplates200Response | ListTemplatesDefaultResponse): response is ListTemplatesDefaultResponse;
186
+
187
+ // @public
188
+ export interface LinkContent extends MessageContentParent {
189
+ kind: "url";
190
+ title: string;
191
+ url: string;
192
+ }
193
+
194
+ // @public (undocumented)
195
+ export interface ListTemplates {
196
+ get(options?: ListTemplatesParameters): StreamableMethod<ListTemplates200Response | ListTemplatesDefaultResponse>;
197
+ }
198
+
199
+ // @public (undocumented)
200
+ export interface ListTemplates200Headers {
201
+ "x-ms-client-request-id"?: string;
202
+ }
203
+
204
+ // @public
205
+ export interface ListTemplates200Response extends HttpResponse {
206
+ // (undocumented)
207
+ body: PagedMessageTemplateItemOutput;
208
+ // (undocumented)
209
+ headers: RawHttpHeaders & ListTemplates200Headers;
210
+ // (undocumented)
211
+ status: "200";
212
+ }
213
+
214
+ // @public (undocumented)
215
+ export interface ListTemplatesDefaultHeaders {
216
+ "x-ms-error-code"?: string;
217
+ }
218
+
219
+ // @public (undocumented)
220
+ export interface ListTemplatesDefaultResponse extends HttpResponse {
221
+ // (undocumented)
222
+ body: ErrorResponse;
223
+ // (undocumented)
224
+ headers: RawHttpHeaders & ListTemplatesDefaultHeaders;
225
+ // (undocumented)
226
+ status: string;
227
+ }
228
+
229
+ // @public (undocumented)
230
+ export interface ListTemplatesHeaderParam {
231
+ // (undocumented)
232
+ headers?: RawHttpHeadersInput & ListTemplatesHeaders;
233
+ }
234
+
235
+ // @public (undocumented)
236
+ export interface ListTemplatesHeaders {
237
+ "x-ms-client-request-id"?: string;
238
+ }
239
+
240
+ // @public (undocumented)
241
+ export type ListTemplatesParameters = ListTemplatesQueryParam & ListTemplatesHeaderParam & RequestParameters;
242
+
243
+ // @public (undocumented)
244
+ export interface ListTemplatesQueryParam {
245
+ // (undocumented)
246
+ queryParameters?: ListTemplatesQueryParamProperties;
247
+ }
248
+
249
+ // @public (undocumented)
250
+ export interface ListTemplatesQueryParamProperties {
251
+ maxpagesize?: number;
252
+ }
253
+
254
+ // @public @deprecated (undocumented)
255
+ export interface MediaNotificationContent extends NotificationContentParent {
256
+ content?: string;
257
+ kind: "image_v0";
258
+ mediaUri: string;
259
+ }
260
+
261
+ // @public
262
+ export type MessageActionBindingKind = string;
263
+
264
+ // @public
265
+ export type MessageContent = MessageContentParent | TextMessageContent | DocumentMessageContent | ImageMessageContent | VideoMessageContent | ButtonSetContent | LinkContent | ActionGroupContent;
266
+
267
+ // @public
268
+ export type MessageContentKind = string;
269
+
270
+ // @public
271
+ export interface MessageContentParent {
272
+ // (undocumented)
273
+ kind: MessageContentKind;
274
+ }
275
+
276
+ // @public
277
+ export interface MessageReceiptOutput {
278
+ messageId: string;
279
+ to: string;
280
+ }
281
+
282
+ // @public (undocumented)
283
+ export type MessagesServiceClient = Client & {
284
+ path: Routes;
285
+ };
286
+
287
+ // @public
288
+ export interface MessagesServiceClientOptions extends ClientOptions {
289
+ apiVersion?: string;
290
+ }
291
+
292
+ // @public
293
+ export interface MessageTemplate {
294
+ bindings?: MessageTemplateBindings;
295
+ language: string;
296
+ name: string;
297
+ values?: Array<MessageTemplateValue>;
298
+ }
299
+
300
+ // @public
301
+ export type MessageTemplateBindings = MessageTemplateBindingsParent | WhatsAppMessageTemplateBindings;
302
+
303
+ // @public
304
+ export type MessageTemplateBindingsKind = string;
305
+
306
+ // @public
307
+ export interface MessageTemplateBindingsParent {
308
+ // (undocumented)
309
+ kind: MessageTemplateBindingsKind;
310
+ }
311
+
312
+ // @public
313
+ export interface MessageTemplateDocument extends MessageTemplateValueParent {
314
+ caption?: string;
315
+ fileName?: string;
316
+ kind: "document";
317
+ url: string;
318
+ }
319
+
320
+ // @public
321
+ export interface MessageTemplateImage extends MessageTemplateValueParent {
322
+ caption?: string;
323
+ fileName?: string;
324
+ kind: "image";
325
+ url: string;
326
+ }
327
+
328
+ // @public
329
+ export type MessageTemplateItemOutput = MessageTemplateItemOutputParent | WhatsAppMessageTemplateItemOutput;
330
+
331
+ // @public
332
+ export interface MessageTemplateItemOutputParent {
333
+ // (undocumented)
334
+ kind: CommunicationMessagesChannelOutput;
335
+ language: string;
336
+ readonly name: string;
337
+ status: MessageTemplateStatusOutput;
338
+ }
339
+
340
+ // @public
341
+ export interface MessageTemplateLocation extends MessageTemplateValueParent {
342
+ address?: string;
343
+ kind: "location";
344
+ latitude: number;
345
+ locationName?: string;
346
+ longitude: number;
347
+ }
348
+
349
+ // @public
350
+ export interface MessageTemplateQuickAction extends MessageTemplateValueParent {
351
+ kind: "quickAction";
352
+ payload?: string;
353
+ text?: string;
354
+ }
355
+
356
+ // @public
357
+ export type MessageTemplateStatusOutput = string;
358
+
359
+ // @public
360
+ export interface MessageTemplateText extends MessageTemplateValueParent {
361
+ kind: "text";
362
+ text: string;
363
+ }
364
+
365
+ // @public
366
+ export type MessageTemplateValue = MessageTemplateValueParent | MessageTemplateText | MessageTemplateImage | MessageTemplateDocument | MessageTemplateVideo | MessageTemplateLocation | MessageTemplateQuickAction;
367
+
368
+ // @public
369
+ export type MessageTemplateValueKind = string;
370
+
371
+ // @public
372
+ export interface MessageTemplateValueParent {
373
+ // (undocumented)
374
+ kind: MessageTemplateValueKind;
375
+ name: string;
376
+ }
377
+
378
+ // @public
379
+ export interface MessageTemplateVideo extends MessageTemplateValueParent {
380
+ caption?: string;
381
+ fileName?: string;
382
+ kind: "video";
383
+ url: string;
384
+ }
385
+
386
+ // @public
387
+ export type NotificationContent = NotificationContentParent | TextNotificationContent | MediaNotificationContent | ImageNotificationContent | DocumentNotificationContent | VideoNotificationContent | AudioNotificationContent | ReactionNotificationContent | StickerNotificationContent | InteractiveNotificationContent | TemplateNotificationContent;
388
+
389
+ // @public
390
+ export interface NotificationContentParent {
391
+ channelRegistrationId: string;
392
+ // (undocumented)
393
+ kind: CommunicationMessageKind;
394
+ to: string[];
395
+ }
396
+
397
+ // @public
398
+ export interface PagedAsyncIterableIterator<TElement, TPage = TElement[], TPageSettings = PageSettings> {
399
+ [Symbol.asyncIterator](): PagedAsyncIterableIterator<TElement, TPage, TPageSettings>;
400
+ byPage: (settings?: TPageSettings) => AsyncIterableIterator<TPage>;
401
+ next(): Promise<IteratorResult<TElement>>;
402
+ }
403
+
404
+ // @public
405
+ export interface PagedMessageTemplateItemOutput {
406
+ nextLink?: string;
407
+ value: Array<MessageTemplateItemOutput>;
408
+ }
409
+
410
+ // @public
411
+ export interface PageSettings {
412
+ continuationToken?: string;
413
+ }
414
+
415
+ // @public
416
+ export function paginate<TResponse extends PathUncheckedResponse>(client: Client, initialResponse: TResponse, options?: PagingOptions<TResponse>): PagedAsyncIterableIterator<PaginateReturn<TResponse>>;
417
+
418
+ // @public
419
+ export type PaginateReturn<TResult> = TResult extends {
420
+ body: {
421
+ value?: infer TPage;
422
+ };
423
+ } ? GetArrayType<TPage> : Array<unknown>;
424
+
425
+ // @public
426
+ export interface PagingOptions<TResponse> {
427
+ customGetPage?: GetPage<PaginateReturn<TResponse>[]>;
428
+ }
429
+
430
+ // @public
431
+ export interface ReactionNotificationContent extends NotificationContentParent {
432
+ emoji: string;
433
+ kind: "reaction";
434
+ messageId: string;
435
+ }
436
+
437
+ // @public
438
+ export type RepeatabilityResultOutput = "accepted" | "rejected";
439
+
440
+ // @public (undocumented)
441
+ export interface Routes {
442
+ (path: "/messages/streams/{id}", id: string): GetMedia;
443
+ (path: "/messages/notifications:send"): Send;
444
+ (path: "/messages/channels/{channelId}/templates", channelId: string): ListTemplates;
445
+ }
446
+
447
+ // @public (undocumented)
448
+ export interface Send {
449
+ post(options: SendParameters): StreamableMethod<Send202Response | SendDefaultResponse>;
450
+ }
451
+
452
+ // @public (undocumented)
453
+ export interface Send202Headers {
454
+ "repeatability-result"?: RepeatabilityResultOutput;
455
+ "x-ms-client-request-id"?: string;
456
+ }
457
+
458
+ // @public
459
+ export interface Send202Response extends HttpResponse {
460
+ // (undocumented)
461
+ body: SendMessageResultOutput;
462
+ // (undocumented)
463
+ headers: RawHttpHeaders & Send202Headers;
464
+ // (undocumented)
465
+ status: "202";
466
+ }
467
+
468
+ // @public (undocumented)
469
+ export interface SendBodyParam {
470
+ body: NotificationContent;
471
+ }
472
+
473
+ // @public (undocumented)
474
+ export interface SendDefaultHeaders {
475
+ "x-ms-error-code"?: string;
476
+ }
477
+
478
+ // @public (undocumented)
479
+ export interface SendDefaultResponse extends HttpResponse {
480
+ // (undocumented)
481
+ body: ErrorResponse;
482
+ // (undocumented)
483
+ headers: RawHttpHeaders & SendDefaultHeaders;
484
+ // (undocumented)
485
+ status: string;
486
+ }
487
+
488
+ // @public (undocumented)
489
+ export interface SendHeaderParam {
490
+ // (undocumented)
491
+ headers?: RawHttpHeadersInput & SendHeaders;
492
+ }
493
+
494
+ // @public (undocumented)
495
+ export interface SendHeaders {
496
+ "Repeatability-First-Sent"?: string;
497
+ "Repeatability-Request-ID"?: string;
498
+ "x-ms-client-request-id"?: string;
499
+ }
500
+
501
+ // @public
502
+ export interface SendMessageResultOutput {
503
+ receipts: Array<MessageReceiptOutput>;
504
+ }
505
+
506
+ // @public (undocumented)
507
+ export type SendParameters = SendHeaderParam & SendBodyParam & RequestParameters;
508
+
509
+ // @public
510
+ export interface StickerNotificationContent extends NotificationContentParent {
511
+ kind: "sticker";
512
+ mediaUri: string;
513
+ }
514
+
515
+ // @public
516
+ export interface TemplateNotificationContent extends NotificationContentParent {
517
+ kind: "template";
518
+ template: MessageTemplate;
519
+ }
520
+
521
+ // @public
522
+ export interface TextMessageContent extends MessageContentParent {
523
+ kind: "text";
524
+ text: string;
525
+ }
526
+
527
+ // @public
528
+ export interface TextNotificationContent extends NotificationContentParent {
529
+ content: string;
530
+ kind: "text";
531
+ }
532
+
533
+ // @public
534
+ export interface VideoMessageContent extends MessageContentParent {
535
+ kind: "video";
536
+ mediaUri: string;
537
+ }
538
+
539
+ // @public
540
+ export interface VideoNotificationContent extends NotificationContentParent {
541
+ caption?: string;
542
+ kind: "video";
543
+ mediaUri: string;
544
+ }
545
+
546
+ // @public
547
+ export interface WhatsAppButtonActionBindings extends ActionBindingsParent {
548
+ content: ButtonSetContent;
549
+ kind: "whatsAppButtonAction";
550
+ }
551
+
552
+ // @public
553
+ export interface WhatsAppListActionBindings extends ActionBindingsParent {
554
+ content: ActionGroupContent;
555
+ kind: "whatsAppListAction";
556
+ }
557
+
558
+ // @public
559
+ export type WhatsAppMessageButtonSubType = string;
560
+
561
+ // @public
562
+ export interface WhatsAppMessageTemplateBindings extends MessageTemplateBindingsParent {
563
+ body?: Array<WhatsAppMessageTemplateBindingsComponent>;
564
+ buttons?: Array<WhatsAppMessageTemplateBindingsButton>;
565
+ footer?: Array<WhatsAppMessageTemplateBindingsComponent>;
566
+ header?: Array<WhatsAppMessageTemplateBindingsComponent>;
567
+ kind: "whatsApp";
568
+ }
569
+
570
+ // @public
571
+ export interface WhatsAppMessageTemplateBindingsButton {
572
+ refValue: string;
573
+ subType: WhatsAppMessageButtonSubType;
574
+ }
575
+
576
+ // @public
577
+ export interface WhatsAppMessageTemplateBindingsComponent {
578
+ refValue: string;
579
+ }
580
+
581
+ // @public
582
+ export interface WhatsAppMessageTemplateItemOutput extends MessageTemplateItemOutputParent {
583
+ content?: any;
584
+ kind: "whatsApp";
585
+ }
586
+
587
+ // @public
588
+ export interface WhatsAppUrlActionBindings extends ActionBindingsParent {
589
+ content: LinkContent;
590
+ kind: "whatsAppUrlAction";
591
+ }
592
+
593
+ // (No @packageDocumentation comment for this package)
594
+
595
+ ```