@azure/communication-email 1.0.0-alpha.20230301.3 → 1.0.0-alpha.20230303.3
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +32 -24
- package/dist/index.js +155 -220
- package/dist/index.js.map +1 -1
- package/dist-esm/samples-dev/checkMessageStatus.js +41 -0
- package/dist-esm/samples-dev/checkMessageStatus.js.map +1 -0
- package/dist-esm/samples-dev/sendEmailMultipleRecipients.js +8 -10
- package/dist-esm/samples-dev/sendEmailMultipleRecipients.js.map +1 -1
- package/dist-esm/samples-dev/sendEmailSingleRecipient.js +5 -7
- package/dist-esm/samples-dev/sendEmailSingleRecipient.js.map +1 -1
- package/dist-esm/samples-dev/sendEmailWithAttachments.js +7 -9
- package/dist-esm/samples-dev/sendEmailWithAttachments.js.map +1 -1
- package/dist-esm/src/emailClient.js +19 -4
- package/dist-esm/src/emailClient.js.map +1 -1
- package/dist-esm/src/generated/src/emailRestApiClient.js +1 -1
- package/dist-esm/src/generated/src/emailRestApiClient.js.map +1 -1
- package/dist-esm/src/generated/src/models/index.js +80 -14
- package/dist-esm/src/generated/src/models/index.js.map +1 -1
- package/dist-esm/src/generated/src/models/mappers.js +87 -77
- package/dist-esm/src/generated/src/models/mappers.js.map +1 -1
- package/dist-esm/src/generated/src/models/parameters.js +16 -14
- package/dist-esm/src/generated/src/models/parameters.js.map +1 -1
- package/dist-esm/src/generated/src/operations/email.js +26 -72
- package/dist-esm/src/generated/src/operations/email.js.map +1 -1
- package/dist-esm/src/generated/src/operationsInterfaces/email.js.map +1 -1
- package/dist-esm/src/models.js +1 -1
- package/dist-esm/src/models.js.map +1 -1
- package/dist-esm/test/public/emailClient.spec.js +74 -24
- package/dist-esm/test/public/emailClient.spec.js.map +1 -1
- package/dist-esm/test/public/utils/recordedClient.js +13 -9
- package/dist-esm/test/public/utils/recordedClient.js.map +1 -1
- package/package.json +1 -2
- package/types/communication-email.d.ts +110 -132
- package/dist-esm/src/generated/src/lroImpl.js +0 -25
- package/dist-esm/src/generated/src/lroImpl.js.map +0 -1
package/dist/index.js
CHANGED
@@ -5,9 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
var coreAuth = require('@azure/core-auth');
|
6
6
|
var communicationCommon = require('@azure/communication-common');
|
7
7
|
var coreClient = require('@azure/core-client');
|
8
|
-
var coreLro = require('@azure/core-lro');
|
9
|
-
var tslib = require('tslib');
|
10
8
|
var logger$1 = require('@azure/logger');
|
9
|
+
var uuid = require('uuid');
|
11
10
|
|
12
11
|
function _interopNamespace(e) {
|
13
12
|
if (e && e.__esModule) return e;
|
@@ -36,13 +35,13 @@ var coreClient__namespace = /*#__PURE__*/_interopNamespace(coreClient);
|
|
36
35
|
* Code generated by Microsoft (R) AutoRest Code Generator.
|
37
36
|
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
38
37
|
*/
|
39
|
-
const
|
38
|
+
const SendStatusResult = {
|
40
39
|
type: {
|
41
40
|
name: "Composite",
|
42
|
-
className: "
|
41
|
+
className: "SendStatusResult",
|
43
42
|
modelProperties: {
|
44
|
-
|
45
|
-
serializedName: "
|
43
|
+
messageId: {
|
44
|
+
serializedName: "messageId",
|
46
45
|
required: true,
|
47
46
|
type: {
|
48
47
|
name: "String"
|
@@ -54,32 +53,40 @@ const EmailSendResult = {
|
|
54
53
|
type: {
|
55
54
|
name: "String"
|
56
55
|
}
|
57
|
-
}
|
56
|
+
}
|
57
|
+
}
|
58
|
+
}
|
59
|
+
};
|
60
|
+
const CommunicationErrorResponse = {
|
61
|
+
type: {
|
62
|
+
name: "Composite",
|
63
|
+
className: "CommunicationErrorResponse",
|
64
|
+
modelProperties: {
|
58
65
|
error: {
|
59
66
|
serializedName: "error",
|
60
67
|
type: {
|
61
68
|
name: "Composite",
|
62
|
-
className: "
|
69
|
+
className: "CommunicationError"
|
63
70
|
}
|
64
71
|
}
|
65
72
|
}
|
66
73
|
}
|
67
74
|
};
|
68
|
-
const
|
75
|
+
const CommunicationError = {
|
69
76
|
type: {
|
70
77
|
name: "Composite",
|
71
|
-
className: "
|
78
|
+
className: "CommunicationError",
|
72
79
|
modelProperties: {
|
73
80
|
code: {
|
74
81
|
serializedName: "code",
|
75
|
-
|
82
|
+
required: true,
|
76
83
|
type: {
|
77
84
|
name: "String"
|
78
85
|
}
|
79
86
|
},
|
80
87
|
message: {
|
81
88
|
serializedName: "message",
|
82
|
-
|
89
|
+
required: true,
|
83
90
|
type: {
|
84
91
|
name: "String"
|
85
92
|
}
|
@@ -99,60 +106,16 @@ const ErrorDetail = {
|
|
99
106
|
element: {
|
100
107
|
type: {
|
101
108
|
name: "Composite",
|
102
|
-
className: "
|
109
|
+
className: "CommunicationError"
|
103
110
|
}
|
104
111
|
}
|
105
112
|
}
|
106
113
|
},
|
107
|
-
|
108
|
-
serializedName: "
|
109
|
-
readOnly: true,
|
110
|
-
type: {
|
111
|
-
name: "Sequence",
|
112
|
-
element: {
|
113
|
-
type: {
|
114
|
-
name: "Composite",
|
115
|
-
className: "ErrorAdditionalInfo"
|
116
|
-
}
|
117
|
-
}
|
118
|
-
}
|
119
|
-
}
|
120
|
-
}
|
121
|
-
}
|
122
|
-
};
|
123
|
-
const ErrorAdditionalInfo = {
|
124
|
-
type: {
|
125
|
-
name: "Composite",
|
126
|
-
className: "ErrorAdditionalInfo",
|
127
|
-
modelProperties: {
|
128
|
-
type: {
|
129
|
-
serializedName: "type",
|
130
|
-
readOnly: true,
|
131
|
-
type: {
|
132
|
-
name: "String"
|
133
|
-
}
|
134
|
-
},
|
135
|
-
info: {
|
136
|
-
serializedName: "info",
|
137
|
-
readOnly: true,
|
138
|
-
type: {
|
139
|
-
name: "Dictionary",
|
140
|
-
value: { type: { name: "any" } }
|
141
|
-
}
|
142
|
-
}
|
143
|
-
}
|
144
|
-
}
|
145
|
-
};
|
146
|
-
const ErrorResponse = {
|
147
|
-
type: {
|
148
|
-
name: "Composite",
|
149
|
-
className: "ErrorResponse",
|
150
|
-
modelProperties: {
|
151
|
-
error: {
|
152
|
-
serializedName: "error",
|
114
|
+
innerError: {
|
115
|
+
serializedName: "innererror",
|
153
116
|
type: {
|
154
117
|
name: "Composite",
|
155
|
-
className: "
|
118
|
+
className: "CommunicationError"
|
156
119
|
}
|
157
120
|
}
|
158
121
|
}
|
@@ -163,15 +126,20 @@ const EmailMessage = {
|
|
163
126
|
name: "Composite",
|
164
127
|
className: "EmailMessage",
|
165
128
|
modelProperties: {
|
166
|
-
|
129
|
+
customHeaders: {
|
167
130
|
serializedName: "headers",
|
168
131
|
type: {
|
169
|
-
name: "
|
170
|
-
|
132
|
+
name: "Sequence",
|
133
|
+
element: {
|
134
|
+
type: {
|
135
|
+
name: "Composite",
|
136
|
+
className: "EmailCustomHeader"
|
137
|
+
}
|
138
|
+
}
|
171
139
|
}
|
172
140
|
},
|
173
|
-
|
174
|
-
serializedName: "
|
141
|
+
sender: {
|
142
|
+
serializedName: "sender",
|
175
143
|
required: true,
|
176
144
|
type: {
|
177
145
|
name: "String"
|
@@ -184,6 +152,13 @@ const EmailMessage = {
|
|
184
152
|
className: "EmailContent"
|
185
153
|
}
|
186
154
|
},
|
155
|
+
importance: {
|
156
|
+
defaultValue: "normal",
|
157
|
+
serializedName: "importance",
|
158
|
+
type: {
|
159
|
+
name: "String"
|
160
|
+
}
|
161
|
+
},
|
187
162
|
recipients: {
|
188
163
|
serializedName: "recipients",
|
189
164
|
type: {
|
@@ -215,8 +190,8 @@ const EmailMessage = {
|
|
215
190
|
}
|
216
191
|
}
|
217
192
|
},
|
218
|
-
|
219
|
-
serializedName: "
|
193
|
+
disableUserEngagementTracking: {
|
194
|
+
serializedName: "disableUserEngagementTracking",
|
220
195
|
type: {
|
221
196
|
name: "Boolean"
|
222
197
|
}
|
@@ -224,6 +199,28 @@ const EmailMessage = {
|
|
224
199
|
}
|
225
200
|
}
|
226
201
|
};
|
202
|
+
const EmailCustomHeader = {
|
203
|
+
type: {
|
204
|
+
name: "Composite",
|
205
|
+
className: "EmailCustomHeader",
|
206
|
+
modelProperties: {
|
207
|
+
name: {
|
208
|
+
serializedName: "name",
|
209
|
+
required: true,
|
210
|
+
type: {
|
211
|
+
name: "String"
|
212
|
+
}
|
213
|
+
},
|
214
|
+
value: {
|
215
|
+
serializedName: "value",
|
216
|
+
required: true,
|
217
|
+
type: {
|
218
|
+
name: "String"
|
219
|
+
}
|
220
|
+
}
|
221
|
+
}
|
222
|
+
}
|
223
|
+
};
|
227
224
|
const EmailContent = {
|
228
225
|
type: {
|
229
226
|
name: "Composite",
|
@@ -269,7 +266,7 @@ const EmailRecipients = {
|
|
269
266
|
}
|
270
267
|
},
|
271
268
|
cc: {
|
272
|
-
serializedName: "
|
269
|
+
serializedName: "CC",
|
273
270
|
type: {
|
274
271
|
name: "Sequence",
|
275
272
|
element: {
|
@@ -281,7 +278,7 @@ const EmailRecipients = {
|
|
281
278
|
}
|
282
279
|
},
|
283
280
|
bcc: {
|
284
|
-
serializedName: "
|
281
|
+
serializedName: "bCC",
|
285
282
|
type: {
|
286
283
|
name: "Sequence",
|
287
284
|
element: {
|
@@ -300,8 +297,8 @@ const EmailAddress = {
|
|
300
297
|
name: "Composite",
|
301
298
|
className: "EmailAddress",
|
302
299
|
modelProperties: {
|
303
|
-
|
304
|
-
serializedName: "
|
300
|
+
email: {
|
301
|
+
serializedName: "email",
|
305
302
|
required: true,
|
306
303
|
type: {
|
307
304
|
name: "String"
|
@@ -328,15 +325,15 @@ const EmailAttachment = {
|
|
328
325
|
name: "String"
|
329
326
|
}
|
330
327
|
},
|
331
|
-
|
332
|
-
serializedName: "
|
328
|
+
attachmentType: {
|
329
|
+
serializedName: "attachmentType",
|
333
330
|
required: true,
|
334
331
|
type: {
|
335
332
|
name: "String"
|
336
333
|
}
|
337
334
|
},
|
338
|
-
|
339
|
-
serializedName: "
|
335
|
+
contentBytesBase64: {
|
336
|
+
serializedName: "contentBytesBase64",
|
340
337
|
required: true,
|
341
338
|
type: {
|
342
339
|
name: "String"
|
@@ -345,10 +342,10 @@ const EmailAttachment = {
|
|
345
342
|
}
|
346
343
|
}
|
347
344
|
};
|
348
|
-
const
|
345
|
+
const EmailGetSendStatusHeaders = {
|
349
346
|
type: {
|
350
347
|
name: "Composite",
|
351
|
-
className: "
|
348
|
+
className: "EmailGetSendStatusHeaders",
|
352
349
|
modelProperties: {
|
353
350
|
retryAfter: {
|
354
351
|
serializedName: "retry-after",
|
@@ -359,10 +356,10 @@ const EmailGetSendResultHeaders = {
|
|
359
356
|
}
|
360
357
|
}
|
361
358
|
};
|
362
|
-
const
|
359
|
+
const EmailGetSendStatusExceptionHeaders = {
|
363
360
|
type: {
|
364
361
|
name: "Composite",
|
365
|
-
className: "
|
362
|
+
className: "EmailGetSendStatusExceptionHeaders",
|
366
363
|
modelProperties: {
|
367
364
|
xMsErrorCode: {
|
368
365
|
serializedName: "x-ms-error-code",
|
@@ -378,6 +375,12 @@ const EmailSendHeaders = {
|
|
378
375
|
name: "Composite",
|
379
376
|
className: "EmailSendHeaders",
|
380
377
|
modelProperties: {
|
378
|
+
repeatabilityResult: {
|
379
|
+
serializedName: "repeatability-result",
|
380
|
+
type: {
|
381
|
+
name: "String"
|
382
|
+
}
|
383
|
+
},
|
381
384
|
operationLocation: {
|
382
385
|
serializedName: "operation-location",
|
383
386
|
type: {
|
@@ -389,6 +392,12 @@ const EmailSendHeaders = {
|
|
389
392
|
type: {
|
390
393
|
name: "Number"
|
391
394
|
}
|
395
|
+
},
|
396
|
+
xMsRequestId: {
|
397
|
+
serializedName: "x-ms-request-id",
|
398
|
+
type: {
|
399
|
+
name: "String"
|
400
|
+
}
|
392
401
|
}
|
393
402
|
}
|
394
403
|
}
|
@@ -410,17 +419,17 @@ const EmailSendExceptionHeaders = {
|
|
410
419
|
|
411
420
|
var Mappers = /*#__PURE__*/Object.freeze({
|
412
421
|
__proto__: null,
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
ErrorResponse: ErrorResponse,
|
422
|
+
SendStatusResult: SendStatusResult,
|
423
|
+
CommunicationErrorResponse: CommunicationErrorResponse,
|
424
|
+
CommunicationError: CommunicationError,
|
417
425
|
EmailMessage: EmailMessage,
|
426
|
+
EmailCustomHeader: EmailCustomHeader,
|
418
427
|
EmailContent: EmailContent,
|
419
428
|
EmailRecipients: EmailRecipients,
|
420
429
|
EmailAddress: EmailAddress,
|
421
430
|
EmailAttachment: EmailAttachment,
|
422
|
-
|
423
|
-
|
431
|
+
EmailGetSendStatusHeaders: EmailGetSendStatusHeaders,
|
432
|
+
EmailGetSendStatusExceptionHeaders: EmailGetSendStatusExceptionHeaders,
|
424
433
|
EmailSendHeaders: EmailSendHeaders,
|
425
434
|
EmailSendExceptionHeaders: EmailSendExceptionHeaders
|
426
435
|
});
|
@@ -454,10 +463,10 @@ const endpoint = {
|
|
454
463
|
},
|
455
464
|
skipEncoding: true
|
456
465
|
};
|
457
|
-
const
|
458
|
-
parameterPath: "
|
466
|
+
const messageId = {
|
467
|
+
parameterPath: "messageId",
|
459
468
|
mapper: {
|
460
|
-
serializedName: "
|
469
|
+
serializedName: "messageId",
|
461
470
|
required: true,
|
462
471
|
type: {
|
463
472
|
name: "String"
|
@@ -467,7 +476,7 @@ const operationId = {
|
|
467
476
|
const apiVersion = {
|
468
477
|
parameterPath: "apiVersion",
|
469
478
|
mapper: {
|
470
|
-
defaultValue: "
|
479
|
+
defaultValue: "2021-10-01-preview",
|
471
480
|
isConstant: true,
|
472
481
|
serializedName: "api-version",
|
473
482
|
type: {
|
@@ -486,53 +495,31 @@ const contentType = {
|
|
486
495
|
}
|
487
496
|
}
|
488
497
|
};
|
489
|
-
const
|
490
|
-
parameterPath: "
|
498
|
+
const emailMessage = {
|
499
|
+
parameterPath: "emailMessage",
|
491
500
|
mapper: EmailMessage
|
492
501
|
};
|
493
|
-
const
|
494
|
-
parameterPath:
|
502
|
+
const repeatabilityRequestId = {
|
503
|
+
parameterPath: "repeatabilityRequestId",
|
495
504
|
mapper: {
|
496
|
-
serializedName: "
|
505
|
+
serializedName: "repeatability-request-id",
|
506
|
+
required: true,
|
497
507
|
type: {
|
498
|
-
name: "
|
508
|
+
name: "String"
|
499
509
|
}
|
500
510
|
}
|
501
511
|
};
|
502
|
-
const
|
503
|
-
parameterPath:
|
512
|
+
const repeatabilityFirstSent = {
|
513
|
+
parameterPath: "repeatabilityFirstSent",
|
504
514
|
mapper: {
|
505
|
-
serializedName: "
|
515
|
+
serializedName: "repeatability-first-sent",
|
516
|
+
required: true,
|
506
517
|
type: {
|
507
|
-
name: "
|
518
|
+
name: "String"
|
508
519
|
}
|
509
520
|
}
|
510
521
|
};
|
511
522
|
|
512
|
-
/*
|
513
|
-
* Copyright (c) Microsoft Corporation.
|
514
|
-
* Licensed under the MIT License.
|
515
|
-
*
|
516
|
-
* Code generated by Microsoft (R) AutoRest Code Generator.
|
517
|
-
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
518
|
-
*/
|
519
|
-
class LroImpl {
|
520
|
-
constructor(sendOperationFn, args, spec, requestPath = spec.path, requestMethod = spec.httpMethod) {
|
521
|
-
this.sendOperationFn = sendOperationFn;
|
522
|
-
this.args = args;
|
523
|
-
this.spec = spec;
|
524
|
-
this.requestPath = requestPath;
|
525
|
-
this.requestMethod = requestMethod;
|
526
|
-
}
|
527
|
-
async sendInitialRequest() {
|
528
|
-
return this.sendOperationFn(this.args, this.spec);
|
529
|
-
}
|
530
|
-
async sendPollRequest(path) {
|
531
|
-
const _a = this.spec, restSpec = tslib.__rest(_a, ["requestBody"]);
|
532
|
-
return this.sendOperationFn(this.args, Object.assign(Object.assign({}, restSpec), { path, httpMethod: "GET" }));
|
533
|
-
}
|
534
|
-
}
|
535
|
-
|
536
523
|
/*
|
537
524
|
* Copyright (c) Microsoft Corporation.
|
538
525
|
* Licensed under the MIT License.
|
@@ -550,78 +537,47 @@ class EmailImpl {
|
|
550
537
|
this.client = client;
|
551
538
|
}
|
552
539
|
/**
|
553
|
-
* Gets the status of
|
554
|
-
* @param
|
555
|
-
* email
|
556
|
-
* @param options The options parameters.
|
557
|
-
*/
|
558
|
-
getSendResult(operationId, options) {
|
559
|
-
return this.client.sendOperationRequest({ operationId, options }, getSendResultOperationSpec);
|
560
|
-
}
|
561
|
-
/**
|
562
|
-
* Queues an email message to be sent to one or more recipients
|
563
|
-
* @param message Message payload for sending an email
|
540
|
+
* Gets the status of a message sent previously.
|
541
|
+
* @param messageId System generated message id (GUID) returned from a previous call to send email
|
564
542
|
* @param options The options parameters.
|
565
543
|
*/
|
566
|
-
|
567
|
-
|
568
|
-
return this.client.sendOperationRequest(args, spec);
|
569
|
-
};
|
570
|
-
const sendOperation = async (args, spec) => {
|
571
|
-
var _a;
|
572
|
-
let currentRawResponse = undefined;
|
573
|
-
const providedCallback = (_a = args.options) === null || _a === void 0 ? void 0 : _a.onResponse;
|
574
|
-
const callback = (rawResponse, flatResponse) => {
|
575
|
-
currentRawResponse = rawResponse;
|
576
|
-
providedCallback === null || providedCallback === void 0 ? void 0 : providedCallback(rawResponse, flatResponse);
|
577
|
-
};
|
578
|
-
const updatedArgs = Object.assign(Object.assign({}, args), { options: Object.assign(Object.assign({}, args.options), { onResponse: callback }) });
|
579
|
-
const flatResponse = await directSendOperation(updatedArgs, spec);
|
580
|
-
return {
|
581
|
-
flatResponse,
|
582
|
-
rawResponse: {
|
583
|
-
statusCode: currentRawResponse.status,
|
584
|
-
body: currentRawResponse.parsedBody,
|
585
|
-
headers: currentRawResponse.headers.toJSON()
|
586
|
-
}
|
587
|
-
};
|
588
|
-
};
|
589
|
-
const lro = new LroImpl(sendOperation, { message, options }, sendOperationSpec);
|
590
|
-
const poller = new coreLro.LroEngine(lro, {
|
591
|
-
resumeFrom: options === null || options === void 0 ? void 0 : options.resumeFrom,
|
592
|
-
intervalInMs: options === null || options === void 0 ? void 0 : options.updateIntervalInMs,
|
593
|
-
lroResourceLocationConfig: "azure-async-operation"
|
594
|
-
});
|
595
|
-
await poller.poll();
|
596
|
-
return poller;
|
544
|
+
getSendStatus(messageId, options) {
|
545
|
+
return this.client.sendOperationRequest({ messageId, options }, getSendStatusOperationSpec);
|
597
546
|
}
|
598
547
|
/**
|
599
548
|
* Queues an email message to be sent to one or more recipients
|
600
|
-
* @param
|
549
|
+
* @param repeatabilityRequestId If specified, the client directs that the request is repeatable; that
|
550
|
+
* is, that the client can make the request multiple times with the same Repeatability-Request-Id and
|
551
|
+
* get back an appropriate response without the server executing the request multiple times. The value
|
552
|
+
* of the Repeatability-Request-Id is an opaque string representing a client-generated, globally unique
|
553
|
+
* for all time, identifier for the request. It is recommended to use version 4 (random) UUIDs.
|
554
|
+
* @param repeatabilityFirstSent Must be sent by clients to specify that a request is repeatable.
|
555
|
+
* Repeatability-First-Sent is used to specify the date and time at which the request was first created
|
556
|
+
* in the IMF-fix date form of HTTP-date as defined in RFC7231. eg- Tue, 26 Mar 2019 16:06:51 GMT
|
557
|
+
* @param emailMessage Message payload for sending an email
|
601
558
|
* @param options The options parameters.
|
602
559
|
*/
|
603
|
-
|
604
|
-
|
605
|
-
return poller.pollUntilDone();
|
560
|
+
send(repeatabilityRequestId, repeatabilityFirstSent, emailMessage, options) {
|
561
|
+
return this.client.sendOperationRequest({ repeatabilityRequestId, repeatabilityFirstSent, emailMessage, options }, sendOperationSpec);
|
606
562
|
}
|
607
563
|
}
|
608
564
|
// Operation Specifications
|
609
565
|
const serializer = coreClient__namespace.createSerializer(Mappers, /* isXml */ false);
|
610
|
-
const
|
611
|
-
path: "/emails/
|
566
|
+
const getSendStatusOperationSpec = {
|
567
|
+
path: "/emails/{messageId}/status",
|
612
568
|
httpMethod: "GET",
|
613
569
|
responses: {
|
614
570
|
200: {
|
615
|
-
bodyMapper:
|
616
|
-
headersMapper:
|
571
|
+
bodyMapper: SendStatusResult,
|
572
|
+
headersMapper: EmailGetSendStatusHeaders
|
617
573
|
},
|
618
574
|
default: {
|
619
|
-
bodyMapper:
|
620
|
-
headersMapper:
|
575
|
+
bodyMapper: CommunicationErrorResponse,
|
576
|
+
headersMapper: EmailGetSendStatusExceptionHeaders
|
621
577
|
}
|
622
578
|
},
|
623
579
|
queryParameters: [apiVersion],
|
624
|
-
urlParameters: [endpoint,
|
580
|
+
urlParameters: [endpoint, messageId],
|
625
581
|
headerParameters: [accept],
|
626
582
|
serializer
|
627
583
|
};
|
@@ -629,35 +585,22 @@ const sendOperationSpec = {
|
|
629
585
|
path: "/emails:send",
|
630
586
|
httpMethod: "POST",
|
631
587
|
responses: {
|
632
|
-
200: {
|
633
|
-
bodyMapper: EmailSendResult,
|
634
|
-
headersMapper: EmailSendHeaders
|
635
|
-
},
|
636
|
-
201: {
|
637
|
-
bodyMapper: EmailSendResult,
|
638
|
-
headersMapper: EmailSendHeaders
|
639
|
-
},
|
640
588
|
202: {
|
641
|
-
bodyMapper: EmailSendResult,
|
642
|
-
headersMapper: EmailSendHeaders
|
643
|
-
},
|
644
|
-
204: {
|
645
|
-
bodyMapper: EmailSendResult,
|
646
589
|
headersMapper: EmailSendHeaders
|
647
590
|
},
|
648
591
|
default: {
|
649
|
-
bodyMapper:
|
592
|
+
bodyMapper: CommunicationErrorResponse,
|
650
593
|
headersMapper: EmailSendExceptionHeaders
|
651
594
|
}
|
652
595
|
},
|
653
|
-
requestBody:
|
596
|
+
requestBody: emailMessage,
|
654
597
|
queryParameters: [apiVersion],
|
655
598
|
urlParameters: [endpoint],
|
656
599
|
headerParameters: [
|
657
600
|
accept,
|
658
601
|
contentType,
|
659
|
-
|
660
|
-
|
602
|
+
repeatabilityRequestId,
|
603
|
+
repeatabilityFirstSent
|
661
604
|
],
|
662
605
|
mediaType: "json",
|
663
606
|
serializer
|
@@ -699,7 +642,7 @@ class EmailRestApiClient extends coreClient__namespace.ServiceClient {
|
|
699
642
|
// Parameter assignments
|
700
643
|
this.endpoint = endpoint;
|
701
644
|
// Assigning values to Constant parameters
|
702
|
-
this.apiVersion = options.apiVersion || "
|
645
|
+
this.apiVersion = options.apiVersion || "2021-10-01-preview";
|
703
646
|
this.email = new EmailImpl(this);
|
704
647
|
this.addCustomApiVersionPolicy(options.apiVersion);
|
705
648
|
}
|
@@ -761,35 +704,27 @@ class EmailClient {
|
|
761
704
|
}
|
762
705
|
/**
|
763
706
|
* Queues an email message to be sent to one or more recipients
|
764
|
-
* @param
|
765
|
-
|
707
|
+
* @param emailMessage - Message payload for sending an email
|
708
|
+
*/
|
709
|
+
async send(emailMessage) {
|
710
|
+
var _a;
|
711
|
+
const response = await this.generatedClient.email.send(uuid.v4(), new Date().toUTCString(), emailMessage);
|
712
|
+
return {
|
713
|
+
messageId: (_a = response.xMsRequestId) !== null && _a !== void 0 ? _a : "",
|
714
|
+
};
|
715
|
+
}
|
716
|
+
/**
|
717
|
+
* Gets the status of a message sent previously.
|
718
|
+
* @param messageId - System generated message id (GUID) returned from a previous call to send email
|
766
719
|
*/
|
767
|
-
|
768
|
-
|
720
|
+
async getSendStatus(messageId) {
|
721
|
+
const response = await this.generatedClient.email.getSendStatus(messageId);
|
722
|
+
return {
|
723
|
+
messageId: response.messageId,
|
724
|
+
status: response.status,
|
725
|
+
};
|
769
726
|
}
|
770
727
|
}
|
771
728
|
|
772
|
-
/*
|
773
|
-
* Copyright (c) Microsoft Corporation.
|
774
|
-
* Licensed under the MIT License.
|
775
|
-
*
|
776
|
-
* Code generated by Microsoft (R) AutoRest Code Generator.
|
777
|
-
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
778
|
-
*/
|
779
|
-
/** Known values of {@link EmailSendStatus} that the service accepts. */
|
780
|
-
exports.KnownEmailSendStatus = void 0;
|
781
|
-
(function (KnownEmailSendStatus) {
|
782
|
-
/** NotStarted */
|
783
|
-
KnownEmailSendStatus["NotStarted"] = "NotStarted";
|
784
|
-
/** Running */
|
785
|
-
KnownEmailSendStatus["Running"] = "Running";
|
786
|
-
/** Succeeded */
|
787
|
-
KnownEmailSendStatus["Succeeded"] = "Succeeded";
|
788
|
-
/** Failed */
|
789
|
-
KnownEmailSendStatus["Failed"] = "Failed";
|
790
|
-
/** Canceled */
|
791
|
-
KnownEmailSendStatus["Canceled"] = "Canceled";
|
792
|
-
})(exports.KnownEmailSendStatus || (exports.KnownEmailSendStatus = {}));
|
793
|
-
|
794
729
|
exports.EmailClient = EmailClient;
|
795
730
|
//# sourceMappingURL=index.js.map
|