@azure-rest/communication-messages 2.0.1-alpha.20241119.1 → 2.0.1-alpha.20241203.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.
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.47.11"
8
+ "packageVersion": "7.48.0"
9
9
  }
10
10
  ]
11
11
  }
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.0.1-alpha.20241119.1",
5
+ "version": "2.0.1-alpha.20241203.1",
6
6
  "description": "Azure client library for Azure Communication Messages services",
7
7
  "keywords": [
8
8
  "node",
@@ -1,513 +0,0 @@
1
- import { Client } from '@azure-rest/core-client';
2
- import { ClientOptions } from '@azure-rest/core-client';
3
- import { ErrorResponse } from '@azure-rest/core-client';
4
- import { HttpResponse } from '@azure-rest/core-client';
5
- import type { KeyCredential } from '@azure/core-auth';
6
- import { Paged } from '@azure/core-paging';
7
- import { PagedAsyncIterableIterator } from '@azure/core-paging';
8
- import { PathUncheckedResponse } from '@azure-rest/core-client';
9
- import { RawHttpHeaders } from '@azure/core-rest-pipeline';
10
- import { RawHttpHeadersInput } from '@azure/core-rest-pipeline';
11
- import { RequestParameters } from '@azure-rest/core-client';
12
- import { StreamableMethod } from '@azure-rest/core-client';
13
- import type { TokenCredential } from '@azure/core-auth';
14
-
15
- /** A request to send an audio notification. */
16
- export declare interface AudioNotificationContent extends NotificationContentParent {
17
- /** Message notification type is audio. */
18
- kind: "audio";
19
- /** A media url for the file. Required if the type is one of the supported media types, e.g. image */
20
- mediaUri: string;
21
- }
22
-
23
- /** Alias for CommunicationMessageKind */
24
- export declare type CommunicationMessageKind = string;
25
-
26
- /** Alias for CommunicationMessagesChannelOutput */
27
- export declare type CommunicationMessagesChannelOutput = string;
28
-
29
- /**
30
- * Initialize a new instance of `MessagesServiceClient`
31
- * @param connectionString - The connectionString or url of your Communication Services resource.
32
- * @param options - the parameter for all optional parameters
33
- */
34
- declare function createClient(connectionString: string, options?: ClientOptions): MessagesServiceClient;
35
-
36
- /**
37
- * Initialize a new instance of `MessagesServiceClient`
38
- * @param endpoint - The endpoint of your Communication Services resource.
39
- * @param credential - The key or token credential.
40
- * @param options - the parameter for all optional parameters
41
- */
42
- declare function createClient(endpoint: string, credential: KeyCredential | TokenCredential, options?: ClientOptions): MessagesServiceClient;
43
- export default createClient;
44
-
45
- /** A request to send a document notification. */
46
- export declare interface DocumentNotificationContent extends NotificationContentParent {
47
- /** Message notification type is image. */
48
- kind: "document";
49
- /** Optional text content. */
50
- caption?: string;
51
- /** Optional name for the file. */
52
- fileName?: string;
53
- /** A media url for the file. Required if the type is one of the supported media types, e.g. image */
54
- mediaUri: string;
55
- }
56
-
57
- /**
58
- * Helper type to extract the type of an array
59
- */
60
- export declare type GetArrayType<T> = T extends Array<infer TData> ? TData : never;
61
-
62
- export declare interface GetMedia {
63
- /** Download the Media payload from a User to Business message. */
64
- get(options?: GetMediaParameters): StreamableMethod<GetMedia200Response | GetMediaDefaultResponse>;
65
- }
66
-
67
- export declare interface GetMedia200Headers {
68
- /** An opaque, globally-unique, client-generated string identifier for the request. */
69
- "x-ms-client-request-id"?: string;
70
- /** The stream content type. */
71
- "content-type": "application/octet-stream";
72
- }
73
-
74
- /** The request has succeeded. */
75
- export declare interface GetMedia200Response extends HttpResponse {
76
- status: "200";
77
- /** Value may contain any sequence of octets */
78
- body: Uint8Array;
79
- headers: RawHttpHeaders & GetMedia200Headers;
80
- }
81
-
82
- export declare interface GetMediaDefaultHeaders {
83
- /** String error code indicating what went wrong. */
84
- "x-ms-error-code"?: string;
85
- }
86
-
87
- export declare interface GetMediaDefaultResponse extends HttpResponse {
88
- status: string;
89
- body: ErrorResponse;
90
- headers: RawHttpHeaders & GetMediaDefaultHeaders;
91
- }
92
-
93
- export declare interface GetMediaHeaderParam {
94
- headers?: RawHttpHeadersInput & GetMediaHeaders;
95
- }
96
-
97
- export declare interface GetMediaHeaders {
98
- /** An opaque, globally-unique, client-generated string identifier for the request. */
99
- "x-ms-client-request-id"?: string;
100
- }
101
-
102
- export declare type GetMediaParameters = GetMediaHeaderParam & RequestParameters;
103
-
104
- /**
105
- * The type of a custom function that defines how to get a page and a link to the next one if any.
106
- */
107
- export declare type GetPage<TPage> = (pageLink: string, maxPageSize?: number) => Promise<{
108
- page: TPage;
109
- nextPageLink?: string;
110
- }>;
111
-
112
- /** A request to send an image notification. */
113
- export declare interface ImageNotificationContent extends NotificationContentParent {
114
- /** Message notification type is image. */
115
- kind: "image";
116
- /** Optional text content. */
117
- caption?: string;
118
- /** A media url for the file. Required if the type is one of the supported media types, e.g. image */
119
- mediaUri: string;
120
- }
121
-
122
- export declare function isUnexpected(response: GetMedia200Response | GetMediaDefaultResponse): response is GetMediaDefaultResponse;
123
-
124
- export declare function isUnexpected(response: Send202Response | SendDefaultResponse): response is SendDefaultResponse;
125
-
126
- export declare function isUnexpected(response: ListTemplates200Response | ListTemplatesDefaultResponse): response is ListTemplatesDefaultResponse;
127
-
128
- export declare interface ListTemplates {
129
- /** List all templates for given Azure Communication Services channel */
130
- get(options?: ListTemplatesParameters): StreamableMethod<ListTemplates200Response | ListTemplatesDefaultResponse>;
131
- }
132
-
133
- export declare interface ListTemplates200Headers {
134
- /** An opaque, globally-unique, client-generated string identifier for the request. */
135
- "x-ms-client-request-id"?: string;
136
- }
137
-
138
- /** The request has succeeded. */
139
- export declare interface ListTemplates200Response extends HttpResponse {
140
- status: "200";
141
- body: PagedMessageTemplateItemOutput;
142
- headers: RawHttpHeaders & ListTemplates200Headers;
143
- }
144
-
145
- export declare interface ListTemplatesDefaultHeaders {
146
- /** String error code indicating what went wrong. */
147
- "x-ms-error-code"?: string;
148
- }
149
-
150
- export declare interface ListTemplatesDefaultResponse extends HttpResponse {
151
- status: string;
152
- body: ErrorResponse;
153
- headers: RawHttpHeaders & ListTemplatesDefaultHeaders;
154
- }
155
-
156
- export declare interface ListTemplatesHeaderParam {
157
- headers?: RawHttpHeadersInput & ListTemplatesHeaders;
158
- }
159
-
160
- export declare interface ListTemplatesHeaders {
161
- /** An opaque, globally-unique, client-generated string identifier for the request. */
162
- "x-ms-client-request-id"?: string;
163
- }
164
-
165
- export declare type ListTemplatesParameters = ListTemplatesQueryParam & ListTemplatesHeaderParam & RequestParameters;
166
-
167
- export declare interface ListTemplatesQueryParam {
168
- queryParameters?: ListTemplatesQueryParamProperties;
169
- }
170
-
171
- export declare interface ListTemplatesQueryParamProperties {
172
- /** Number of objects to return per page. */
173
- maxpagesize?: number;
174
- }
175
-
176
- /** @deprecated A request to send an image notification. */
177
- export declare interface MediaNotificationContent extends NotificationContentParent {
178
- /** Message notification type is image. */
179
- kind: "image_v0";
180
- /** Optional text content. */
181
- content?: string;
182
- /** A media url for the file. Required if the type is one of the supported media types, e.g. image */
183
- mediaUri: string;
184
- }
185
-
186
- /** Receipt of the sending one message. */
187
- export declare interface MessageReceiptOutput {
188
- /** The message id. */
189
- messageId: string;
190
- /** The native external platform user identifier of the recipient. */
191
- to: string;
192
- }
193
-
194
- export declare type MessagesServiceClient = Client & {
195
- path: Routes;
196
- };
197
-
198
- /** The optional parameters for the client */
199
- export declare interface MessagesServiceClientOptions extends ClientOptions {
200
- /** The api version option of the client */
201
- apiVersion?: string;
202
- }
203
-
204
- /** The template object used to create templates. */
205
- export declare interface MessageTemplate {
206
- /** Name of the template. */
207
- name: string;
208
- /** The template's language, in the ISO 639 format, consist of a two-letter language code followed by an optional two-letter country code, e.g., 'en' or 'en_US'. */
209
- language: string;
210
- /** The template values. */
211
- values?: Array<MessageTemplateValue>;
212
- /** The binding object to link values to the template specific locations */
213
- bindings?: MessageTemplateBindings;
214
- }
215
-
216
- /** The binding object to link values to the template specific locations */
217
- export declare type MessageTemplateBindings = MessageTemplateBindingsParent | WhatsAppMessageTemplateBindings;
218
-
219
- /** Alias for MessageTemplateBindingsKind */
220
- export declare type MessageTemplateBindingsKind = string;
221
-
222
- /** The binding object to link values to the template specific locations */
223
- export declare interface MessageTemplateBindingsParent {
224
- kind: MessageTemplateBindingsKind;
225
- }
226
-
227
- /** The message template's document value information. */
228
- export declare interface MessageTemplateDocument extends MessageTemplateValueParent {
229
- /** Message parameter type is document. */
230
- kind: "document";
231
- /** The (public) URL of the media. */
232
- url: string;
233
- /** The [optional] caption of the media object. */
234
- caption?: string;
235
- /** The [optional] filename of the media file. */
236
- fileName?: string;
237
- }
238
-
239
- /** The message template's image value information. */
240
- export declare interface MessageTemplateImage extends MessageTemplateValueParent {
241
- /** Message parameter type is image. */
242
- kind: "image";
243
- /** The (public) URL of the media. */
244
- url: string;
245
- /** The [optional] caption of the media object. */
246
- caption?: string;
247
- /** The [optional] filename of the media file. */
248
- fileName?: string;
249
- }
250
-
251
- /** The message template as returned from the service. */
252
- export declare type MessageTemplateItemOutput = MessageTemplateItemOutputParent | WhatsAppMessageTemplateItemOutput;
253
-
254
- /** The message template as returned from the service. */
255
- export declare interface MessageTemplateItemOutputParent {
256
- /** The template's name. */
257
- readonly name: string;
258
- /** The template's language, in the ISO 639 format, consist of a two-letter language code followed by an optional two-letter country code, e.g., 'en' or 'en_US'. */
259
- language: string;
260
- /**
261
- * The aggregated template status.
262
- *
263
- * Possible values: "approved", "rejected", "pending", "paused"
264
- */
265
- status: MessageTemplateStatusOutput;
266
- kind: CommunicationMessagesChannelOutput;
267
- }
268
-
269
- /** The message template's location value information. */
270
- export declare interface MessageTemplateLocation extends MessageTemplateValueParent {
271
- /** Message parameter type is location. */
272
- kind: "location";
273
- /** The [Optional] name of the location. */
274
- locationName?: string;
275
- /** The [Optional] address of the location. */
276
- address?: string;
277
- /** The latitude of the location. */
278
- latitude: number;
279
- /** The longitude of the location. */
280
- longitude: number;
281
- }
282
-
283
- /** The message template's quick action value information. */
284
- export declare interface MessageTemplateQuickAction extends MessageTemplateValueParent {
285
- /** Message parameter type is quick action. */
286
- kind: "quickAction";
287
- /** The [Optional] quick action text */
288
- text?: string;
289
- /** The [Optional] quick action payload */
290
- payload?: string;
291
- }
292
-
293
- /** Alias for MessageTemplateStatusOutput */
294
- export declare type MessageTemplateStatusOutput = string;
295
-
296
- /** The message template's text value information. */
297
- export declare interface MessageTemplateText extends MessageTemplateValueParent {
298
- /** Message parameter type is text. */
299
- kind: "text";
300
- /** The text value. */
301
- text: string;
302
- }
303
-
304
- /** The class describes a parameter of a template. */
305
- export declare type MessageTemplateValue = MessageTemplateValueParent | MessageTemplateText | MessageTemplateImage | MessageTemplateDocument | MessageTemplateVideo | MessageTemplateLocation | MessageTemplateQuickAction;
306
-
307
- /** Alias for MessageTemplateValueKind */
308
- export declare type MessageTemplateValueKind = string;
309
-
310
- /** The class describes a parameter of a template. */
311
- export declare interface MessageTemplateValueParent {
312
- /** Template binding reference name */
313
- name: string;
314
- kind: MessageTemplateValueKind;
315
- }
316
-
317
- /** The message template's video value information. */
318
- export declare interface MessageTemplateVideo extends MessageTemplateValueParent {
319
- /** Message parameter type is video. */
320
- kind: "video";
321
- /** The (public) URL of the media. */
322
- url: string;
323
- /** The [optional] caption of the media object. */
324
- caption?: string;
325
- /** The [optional] filename of the media file. */
326
- fileName?: string;
327
- }
328
-
329
- /** Details of the message to send. */
330
- export declare type NotificationContent = NotificationContentParent | TextNotificationContent | MediaNotificationContent | ImageNotificationContent | DocumentNotificationContent | VideoNotificationContent | AudioNotificationContent | TemplateNotificationContent;
331
-
332
- /** Details of the message to send. */
333
- export declare interface NotificationContentParent {
334
- /** The Channel Registration ID for the Business Identifier. */
335
- channelRegistrationId: string;
336
- /** The native external platform user identifiers of the recipient. */
337
- to: string[];
338
- kind: CommunicationMessageKind;
339
- }
340
-
341
- /** Paged collection of MessageTemplateItem items */
342
- export declare type PagedMessageTemplateItemOutput = Paged<MessageTemplateItemOutput>;
343
-
344
- /**
345
- * Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension
346
- * @param client - Client to use for sending the next page requests
347
- * @param initialResponse - Initial response containing the nextLink and current page of elements
348
- * @param customGetPage - Optional - Function to define how to extract the page and next link to be used to paginate the results
349
- * @returns - PagedAsyncIterableIterator to iterate the elements
350
- */
351
- export declare function paginate<TResponse extends PathUncheckedResponse>(client: Client, initialResponse: TResponse, options?: PagingOptions<TResponse>): PagedAsyncIterableIterator<PaginateReturn<TResponse>>;
352
-
353
- /**
354
- * Helper type to infer the Type of the paged elements from the response type
355
- * This type is generated based on the swagger information for x-ms-pageable
356
- * specifically on the itemName property which indicates the property of the response
357
- * where the page items are found. The default value is `value`.
358
- * This type will allow us to provide strongly typed Iterator based on the response we get as second parameter
359
- */
360
- export declare type PaginateReturn<TResult> = TResult extends {
361
- body: {
362
- value?: infer TPage;
363
- };
364
- } ? GetArrayType<TPage> : Array<unknown>;
365
-
366
- /**
367
- * Options for the paging helper
368
- */
369
- export declare interface PagingOptions<TResponse> {
370
- /**
371
- * Custom function to extract pagination details for crating the PagedAsyncIterableIterator
372
- */
373
- customGetPage?: GetPage<PaginateReturn<TResponse>[]>;
374
- }
375
-
376
- /** Alias for RepeatabilityResultOutput */
377
- export declare type RepeatabilityResultOutput = "accepted" | "rejected";
378
-
379
- export declare interface Routes {
380
- /** Resource for '/messages/streams/\{id\}' has methods for the following verbs: get */
381
- (path: "/messages/streams/{id}", id: string): GetMedia;
382
- /** Resource for '/messages/notifications:send' has methods for the following verbs: post */
383
- (path: "/messages/notifications:send"): Send;
384
- /** Resource for '/messages/channels/\{channelId\}/templates' has methods for the following verbs: get */
385
- (path: "/messages/channels/{channelId}/templates", channelId: string): ListTemplates;
386
- }
387
-
388
- export declare interface Send {
389
- /** Sends a notification message from Business to User. */
390
- post(options: SendParameters): StreamableMethod<Send202Response | SendDefaultResponse>;
391
- }
392
-
393
- export declare interface Send202Headers {
394
- /** Indicates whether the repeatable request was accepted or rejected. */
395
- "repeatability-result"?: RepeatabilityResultOutput;
396
- /** An opaque, globally-unique, client-generated string identifier for the request. */
397
- "x-ms-client-request-id"?: string;
398
- }
399
-
400
- /** The request has been accepted for processing, but processing has not yet completed. */
401
- export declare interface Send202Response extends HttpResponse {
402
- status: "202";
403
- body: SendMessageResultOutput;
404
- headers: RawHttpHeaders & Send202Headers;
405
- }
406
-
407
- export declare interface SendBodyParam {
408
- /** Details of the message to send. */
409
- body: NotificationContent;
410
- }
411
-
412
- export declare interface SendDefaultHeaders {
413
- /** String error code indicating what went wrong. */
414
- "x-ms-error-code"?: string;
415
- }
416
-
417
- export declare interface SendDefaultResponse extends HttpResponse {
418
- status: string;
419
- body: ErrorResponse;
420
- headers: RawHttpHeaders & SendDefaultHeaders;
421
- }
422
-
423
- export declare interface SendHeaderParam {
424
- headers?: RawHttpHeadersInput & SendHeaders;
425
- }
426
-
427
- export declare interface SendHeaders {
428
- /** An opaque, globally-unique, client-generated string identifier for the request. */
429
- "Repeatability-Request-ID"?: string;
430
- /** Specifies the date and time at which the request was first created. */
431
- "Repeatability-First-Sent"?: string;
432
- /** An opaque, globally-unique, client-generated string identifier for the request. */
433
- "x-ms-client-request-id"?: string;
434
- }
435
-
436
- /** Result of the send message operation. */
437
- export declare interface SendMessageResultOutput {
438
- /** Receipts of the send message operation. */
439
- receipts: Array<MessageReceiptOutput>;
440
- }
441
-
442
- export declare type SendParameters = SendHeaderParam & SendBodyParam & RequestParameters;
443
-
444
- /** A request to send a template notification. */
445
- export declare interface TemplateNotificationContent extends NotificationContentParent {
446
- /** Message notification type is template. */
447
- kind: "template";
448
- /** The template object used to create templates. */
449
- template: MessageTemplate;
450
- }
451
-
452
- /** A request to send a text notification. */
453
- export declare interface TextNotificationContent extends NotificationContentParent {
454
- /** Message notification type is text. */
455
- kind: "text";
456
- /** Message content. */
457
- content: string;
458
- }
459
-
460
- /** A request to send a video notification. */
461
- export declare interface VideoNotificationContent extends NotificationContentParent {
462
- /** Message notification type is image. */
463
- kind: "video";
464
- /** Optional text content. */
465
- caption?: string;
466
- /** A media url for the file. Required if the type is one of the supported media types, e.g. image */
467
- mediaUri: string;
468
- }
469
-
470
- /** Alias for WhatsAppMessageButtonSubType */
471
- export declare type WhatsAppMessageButtonSubType = string;
472
-
473
- /** The template bindings for WhatsApp */
474
- export declare interface WhatsAppMessageTemplateBindings extends MessageTemplateBindingsParent {
475
- /** MessageTemplateBindings is whatsApp */
476
- kind: "whatsApp";
477
- /** The header template bindings */
478
- header?: Array<WhatsAppMessageTemplateBindingsComponent>;
479
- /** The body template bindings */
480
- body?: Array<WhatsAppMessageTemplateBindingsComponent>;
481
- /** The footer template bindings */
482
- footer?: Array<WhatsAppMessageTemplateBindingsComponent>;
483
- /** The button template bindings */
484
- buttons?: Array<WhatsAppMessageTemplateBindingsButton>;
485
- }
486
-
487
- /** The template bindings component button for WhatsApp */
488
- export declare interface WhatsAppMessageTemplateBindingsButton {
489
- /**
490
- * The WhatsApp button sub type
491
- *
492
- * Possible values: "quickReply", "url"
493
- */
494
- subType: WhatsAppMessageButtonSubType;
495
- /** The name of the referenced item in the template values. */
496
- refValue: string;
497
- }
498
-
499
- /** The template bindings component for WhatsApp */
500
- export declare interface WhatsAppMessageTemplateBindingsComponent {
501
- /** The name of the referenced item in the template values. */
502
- refValue: string;
503
- }
504
-
505
- /** The WhatsApp-specific template response contract */
506
- export declare interface WhatsAppMessageTemplateItemOutput extends MessageTemplateItemOutputParent {
507
- /** WhatsApp platform's template content. This is the payload returned from WhatsApp API. */
508
- content?: any;
509
- /** Message template response type is whatsApp. */
510
- kind: "whatsApp";
511
- }
512
-
513
- export { }