@azure/communication-email 1.0.0-alpha.20230209.1 → 1.0.0-alpha.20230224.2
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +24 -32
- package/dist/index.js +220 -155
- package/dist/index.js.map +1 -1
- package/dist-esm/samples-dev/sendEmailMultipleRecipients.js +10 -8
- package/dist-esm/samples-dev/sendEmailMultipleRecipients.js.map +1 -1
- package/dist-esm/samples-dev/sendEmailSingleRecipient.js +7 -5
- package/dist-esm/samples-dev/sendEmailSingleRecipient.js.map +1 -1
- package/dist-esm/samples-dev/sendEmailWithAttachments.js +9 -7
- package/dist-esm/samples-dev/sendEmailWithAttachments.js.map +1 -1
- package/dist-esm/src/emailClient.js +4 -19
- 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/lroImpl.js +25 -0
- package/dist-esm/src/generated/src/lroImpl.js.map +1 -0
- package/dist-esm/src/generated/src/models/index.js +14 -80
- package/dist-esm/src/generated/src/models/index.js.map +1 -1
- package/dist-esm/src/generated/src/models/mappers.js +77 -87
- package/dist-esm/src/generated/src/models/mappers.js.map +1 -1
- package/dist-esm/src/generated/src/models/parameters.js +14 -16
- package/dist-esm/src/generated/src/models/parameters.js.map +1 -1
- package/dist-esm/src/generated/src/operations/email.js +72 -26
- 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 +24 -74
- package/dist-esm/test/public/emailClient.spec.js.map +1 -1
- package/dist-esm/test/public/utils/recordedClient.js +9 -13
- package/dist-esm/test/public/utils/recordedClient.js.map +1 -1
- package/package.json +2 -1
- package/types/communication-email.d.ts +136 -104
- package/dist-esm/samples-dev/checkMessageStatus.js +0 -41
- package/dist-esm/samples-dev/checkMessageStatus.js.map +0 -1
package/dist/index.js
CHANGED
@@ -5,8 +5,9 @@ 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');
|
8
10
|
var logger$1 = require('@azure/logger');
|
9
|
-
var uuid = require('uuid');
|
10
11
|
|
11
12
|
function _interopNamespace(e) {
|
12
13
|
if (e && e.__esModule) return e;
|
@@ -35,13 +36,13 @@ var coreClient__namespace = /*#__PURE__*/_interopNamespace(coreClient);
|
|
35
36
|
* Code generated by Microsoft (R) AutoRest Code Generator.
|
36
37
|
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
37
38
|
*/
|
38
|
-
const
|
39
|
+
const EmailSendResult = {
|
39
40
|
type: {
|
40
41
|
name: "Composite",
|
41
|
-
className: "
|
42
|
+
className: "EmailSendResult",
|
42
43
|
modelProperties: {
|
43
|
-
|
44
|
-
serializedName: "
|
44
|
+
id: {
|
45
|
+
serializedName: "id",
|
45
46
|
required: true,
|
46
47
|
type: {
|
47
48
|
name: "String"
|
@@ -53,40 +54,32 @@ const SendStatusResult = {
|
|
53
54
|
type: {
|
54
55
|
name: "String"
|
55
56
|
}
|
56
|
-
}
|
57
|
-
}
|
58
|
-
}
|
59
|
-
};
|
60
|
-
const CommunicationErrorResponse = {
|
61
|
-
type: {
|
62
|
-
name: "Composite",
|
63
|
-
className: "CommunicationErrorResponse",
|
64
|
-
modelProperties: {
|
57
|
+
},
|
65
58
|
error: {
|
66
59
|
serializedName: "error",
|
67
60
|
type: {
|
68
61
|
name: "Composite",
|
69
|
-
className: "
|
62
|
+
className: "ErrorDetail"
|
70
63
|
}
|
71
64
|
}
|
72
65
|
}
|
73
66
|
}
|
74
67
|
};
|
75
|
-
const
|
68
|
+
const ErrorDetail = {
|
76
69
|
type: {
|
77
70
|
name: "Composite",
|
78
|
-
className: "
|
71
|
+
className: "ErrorDetail",
|
79
72
|
modelProperties: {
|
80
73
|
code: {
|
81
74
|
serializedName: "code",
|
82
|
-
|
75
|
+
readOnly: true,
|
83
76
|
type: {
|
84
77
|
name: "String"
|
85
78
|
}
|
86
79
|
},
|
87
80
|
message: {
|
88
81
|
serializedName: "message",
|
89
|
-
|
82
|
+
readOnly: true,
|
90
83
|
type: {
|
91
84
|
name: "String"
|
92
85
|
}
|
@@ -106,16 +99,60 @@ const CommunicationError = {
|
|
106
99
|
element: {
|
107
100
|
type: {
|
108
101
|
name: "Composite",
|
109
|
-
className: "
|
102
|
+
className: "ErrorDetail"
|
110
103
|
}
|
111
104
|
}
|
112
105
|
}
|
113
106
|
},
|
114
|
-
|
115
|
-
serializedName: "
|
107
|
+
additionalInfo: {
|
108
|
+
serializedName: "additionalInfo",
|
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",
|
116
153
|
type: {
|
117
154
|
name: "Composite",
|
118
|
-
className: "
|
155
|
+
className: "ErrorDetail"
|
119
156
|
}
|
120
157
|
}
|
121
158
|
}
|
@@ -126,20 +163,15 @@ const EmailMessage = {
|
|
126
163
|
name: "Composite",
|
127
164
|
className: "EmailMessage",
|
128
165
|
modelProperties: {
|
129
|
-
|
166
|
+
headers: {
|
130
167
|
serializedName: "headers",
|
131
168
|
type: {
|
132
|
-
name: "
|
133
|
-
|
134
|
-
type: {
|
135
|
-
name: "Composite",
|
136
|
-
className: "EmailCustomHeader"
|
137
|
-
}
|
138
|
-
}
|
169
|
+
name: "Dictionary",
|
170
|
+
value: { type: { name: "String" } }
|
139
171
|
}
|
140
172
|
},
|
141
|
-
|
142
|
-
serializedName: "
|
173
|
+
senderAddress: {
|
174
|
+
serializedName: "senderAddress",
|
143
175
|
required: true,
|
144
176
|
type: {
|
145
177
|
name: "String"
|
@@ -152,13 +184,6 @@ const EmailMessage = {
|
|
152
184
|
className: "EmailContent"
|
153
185
|
}
|
154
186
|
},
|
155
|
-
importance: {
|
156
|
-
defaultValue: "normal",
|
157
|
-
serializedName: "importance",
|
158
|
-
type: {
|
159
|
-
name: "String"
|
160
|
-
}
|
161
|
-
},
|
162
187
|
recipients: {
|
163
188
|
serializedName: "recipients",
|
164
189
|
type: {
|
@@ -190,8 +215,8 @@ const EmailMessage = {
|
|
190
215
|
}
|
191
216
|
}
|
192
217
|
},
|
193
|
-
|
194
|
-
serializedName: "
|
218
|
+
userEngagementTrackingDisabled: {
|
219
|
+
serializedName: "userEngagementTrackingDisabled",
|
195
220
|
type: {
|
196
221
|
name: "Boolean"
|
197
222
|
}
|
@@ -199,28 +224,6 @@ const EmailMessage = {
|
|
199
224
|
}
|
200
225
|
}
|
201
226
|
};
|
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
|
-
};
|
224
227
|
const EmailContent = {
|
225
228
|
type: {
|
226
229
|
name: "Composite",
|
@@ -266,7 +269,7 @@ const EmailRecipients = {
|
|
266
269
|
}
|
267
270
|
},
|
268
271
|
cc: {
|
269
|
-
serializedName: "
|
272
|
+
serializedName: "cc",
|
270
273
|
type: {
|
271
274
|
name: "Sequence",
|
272
275
|
element: {
|
@@ -278,7 +281,7 @@ const EmailRecipients = {
|
|
278
281
|
}
|
279
282
|
},
|
280
283
|
bcc: {
|
281
|
-
serializedName: "
|
284
|
+
serializedName: "bcc",
|
282
285
|
type: {
|
283
286
|
name: "Sequence",
|
284
287
|
element: {
|
@@ -297,8 +300,8 @@ const EmailAddress = {
|
|
297
300
|
name: "Composite",
|
298
301
|
className: "EmailAddress",
|
299
302
|
modelProperties: {
|
300
|
-
|
301
|
-
serializedName: "
|
303
|
+
address: {
|
304
|
+
serializedName: "address",
|
302
305
|
required: true,
|
303
306
|
type: {
|
304
307
|
name: "String"
|
@@ -325,15 +328,15 @@ const EmailAttachment = {
|
|
325
328
|
name: "String"
|
326
329
|
}
|
327
330
|
},
|
328
|
-
|
329
|
-
serializedName: "
|
331
|
+
contentType: {
|
332
|
+
serializedName: "contentType",
|
330
333
|
required: true,
|
331
334
|
type: {
|
332
335
|
name: "String"
|
333
336
|
}
|
334
337
|
},
|
335
|
-
|
336
|
-
serializedName: "
|
338
|
+
contentInBase64: {
|
339
|
+
serializedName: "contentInBase64",
|
337
340
|
required: true,
|
338
341
|
type: {
|
339
342
|
name: "String"
|
@@ -342,10 +345,10 @@ const EmailAttachment = {
|
|
342
345
|
}
|
343
346
|
}
|
344
347
|
};
|
345
|
-
const
|
348
|
+
const EmailGetSendResultHeaders = {
|
346
349
|
type: {
|
347
350
|
name: "Composite",
|
348
|
-
className: "
|
351
|
+
className: "EmailGetSendResultHeaders",
|
349
352
|
modelProperties: {
|
350
353
|
retryAfter: {
|
351
354
|
serializedName: "retry-after",
|
@@ -356,10 +359,10 @@ const EmailGetSendStatusHeaders = {
|
|
356
359
|
}
|
357
360
|
}
|
358
361
|
};
|
359
|
-
const
|
362
|
+
const EmailGetSendResultExceptionHeaders = {
|
360
363
|
type: {
|
361
364
|
name: "Composite",
|
362
|
-
className: "
|
365
|
+
className: "EmailGetSendResultExceptionHeaders",
|
363
366
|
modelProperties: {
|
364
367
|
xMsErrorCode: {
|
365
368
|
serializedName: "x-ms-error-code",
|
@@ -375,12 +378,6 @@ const EmailSendHeaders = {
|
|
375
378
|
name: "Composite",
|
376
379
|
className: "EmailSendHeaders",
|
377
380
|
modelProperties: {
|
378
|
-
repeatabilityResult: {
|
379
|
-
serializedName: "repeatability-result",
|
380
|
-
type: {
|
381
|
-
name: "String"
|
382
|
-
}
|
383
|
-
},
|
384
381
|
operationLocation: {
|
385
382
|
serializedName: "operation-location",
|
386
383
|
type: {
|
@@ -392,12 +389,6 @@ const EmailSendHeaders = {
|
|
392
389
|
type: {
|
393
390
|
name: "Number"
|
394
391
|
}
|
395
|
-
},
|
396
|
-
xMsRequestId: {
|
397
|
-
serializedName: "x-ms-request-id",
|
398
|
-
type: {
|
399
|
-
name: "String"
|
400
|
-
}
|
401
392
|
}
|
402
393
|
}
|
403
394
|
}
|
@@ -419,17 +410,17 @@ const EmailSendExceptionHeaders = {
|
|
419
410
|
|
420
411
|
var Mappers = /*#__PURE__*/Object.freeze({
|
421
412
|
__proto__: null,
|
422
|
-
|
423
|
-
|
424
|
-
|
413
|
+
EmailSendResult: EmailSendResult,
|
414
|
+
ErrorDetail: ErrorDetail,
|
415
|
+
ErrorAdditionalInfo: ErrorAdditionalInfo,
|
416
|
+
ErrorResponse: ErrorResponse,
|
425
417
|
EmailMessage: EmailMessage,
|
426
|
-
EmailCustomHeader: EmailCustomHeader,
|
427
418
|
EmailContent: EmailContent,
|
428
419
|
EmailRecipients: EmailRecipients,
|
429
420
|
EmailAddress: EmailAddress,
|
430
421
|
EmailAttachment: EmailAttachment,
|
431
|
-
|
432
|
-
|
422
|
+
EmailGetSendResultHeaders: EmailGetSendResultHeaders,
|
423
|
+
EmailGetSendResultExceptionHeaders: EmailGetSendResultExceptionHeaders,
|
433
424
|
EmailSendHeaders: EmailSendHeaders,
|
434
425
|
EmailSendExceptionHeaders: EmailSendExceptionHeaders
|
435
426
|
});
|
@@ -463,10 +454,10 @@ const endpoint = {
|
|
463
454
|
},
|
464
455
|
skipEncoding: true
|
465
456
|
};
|
466
|
-
const
|
467
|
-
parameterPath: "
|
457
|
+
const operationId = {
|
458
|
+
parameterPath: "operationId",
|
468
459
|
mapper: {
|
469
|
-
serializedName: "
|
460
|
+
serializedName: "operationId",
|
470
461
|
required: true,
|
471
462
|
type: {
|
472
463
|
name: "String"
|
@@ -476,7 +467,7 @@ const messageId = {
|
|
476
467
|
const apiVersion = {
|
477
468
|
parameterPath: "apiVersion",
|
478
469
|
mapper: {
|
479
|
-
defaultValue: "
|
470
|
+
defaultValue: "2023-01-15-preview",
|
480
471
|
isConstant: true,
|
481
472
|
serializedName: "api-version",
|
482
473
|
type: {
|
@@ -495,31 +486,53 @@ const contentType = {
|
|
495
486
|
}
|
496
487
|
}
|
497
488
|
};
|
498
|
-
const
|
499
|
-
parameterPath: "
|
489
|
+
const message = {
|
490
|
+
parameterPath: "message",
|
500
491
|
mapper: EmailMessage
|
501
492
|
};
|
502
|
-
const
|
503
|
-
parameterPath: "
|
493
|
+
const operationId1 = {
|
494
|
+
parameterPath: ["options", "operationId"],
|
504
495
|
mapper: {
|
505
|
-
serializedName: "
|
506
|
-
required: true,
|
496
|
+
serializedName: "Operation-Id",
|
507
497
|
type: {
|
508
|
-
name: "
|
498
|
+
name: "Uuid"
|
509
499
|
}
|
510
500
|
}
|
511
501
|
};
|
512
|
-
const
|
513
|
-
parameterPath: "
|
502
|
+
const clientRequestId = {
|
503
|
+
parameterPath: ["options", "clientRequestId"],
|
514
504
|
mapper: {
|
515
|
-
serializedName: "
|
516
|
-
required: true,
|
505
|
+
serializedName: "x-ms-client-request-id",
|
517
506
|
type: {
|
518
|
-
name: "
|
507
|
+
name: "Uuid"
|
519
508
|
}
|
520
509
|
}
|
521
510
|
};
|
522
511
|
|
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
|
+
|
523
536
|
/*
|
524
537
|
* Copyright (c) Microsoft Corporation.
|
525
538
|
* Licensed under the MIT License.
|
@@ -537,47 +550,78 @@ class EmailImpl {
|
|
537
550
|
this.client = client;
|
538
551
|
}
|
539
552
|
/**
|
540
|
-
* Gets the status of
|
541
|
-
* @param
|
553
|
+
* Gets the status of the email send operation.
|
554
|
+
* @param operationId ID of the long running operation (GUID) returned from a previous call to send
|
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
|
542
564
|
* @param options The options parameters.
|
543
565
|
*/
|
544
|
-
|
545
|
-
|
566
|
+
async beginSend(message, options) {
|
567
|
+
const directSendOperation = async (args, spec) => {
|
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;
|
546
597
|
}
|
547
598
|
/**
|
548
599
|
* Queues an email message to be sent to one or more recipients
|
549
|
-
* @param
|
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
|
600
|
+
* @param message Message payload for sending an email
|
558
601
|
* @param options The options parameters.
|
559
602
|
*/
|
560
|
-
|
561
|
-
|
603
|
+
async beginSendAndWait(message, options) {
|
604
|
+
const poller = await this.beginSend(message, options);
|
605
|
+
return poller.pollUntilDone();
|
562
606
|
}
|
563
607
|
}
|
564
608
|
// Operation Specifications
|
565
609
|
const serializer = coreClient__namespace.createSerializer(Mappers, /* isXml */ false);
|
566
|
-
const
|
567
|
-
path: "/emails/{
|
610
|
+
const getSendResultOperationSpec = {
|
611
|
+
path: "/emails/operations/{operationId}",
|
568
612
|
httpMethod: "GET",
|
569
613
|
responses: {
|
570
614
|
200: {
|
571
|
-
bodyMapper:
|
572
|
-
headersMapper:
|
615
|
+
bodyMapper: EmailSendResult,
|
616
|
+
headersMapper: EmailGetSendResultHeaders
|
573
617
|
},
|
574
618
|
default: {
|
575
|
-
bodyMapper:
|
576
|
-
headersMapper:
|
619
|
+
bodyMapper: ErrorResponse,
|
620
|
+
headersMapper: EmailGetSendResultExceptionHeaders
|
577
621
|
}
|
578
622
|
},
|
579
623
|
queryParameters: [apiVersion],
|
580
|
-
urlParameters: [endpoint,
|
624
|
+
urlParameters: [endpoint, operationId],
|
581
625
|
headerParameters: [accept],
|
582
626
|
serializer
|
583
627
|
};
|
@@ -585,22 +629,35 @@ const sendOperationSpec = {
|
|
585
629
|
path: "/emails:send",
|
586
630
|
httpMethod: "POST",
|
587
631
|
responses: {
|
632
|
+
200: {
|
633
|
+
bodyMapper: EmailSendResult,
|
634
|
+
headersMapper: EmailSendHeaders
|
635
|
+
},
|
636
|
+
201: {
|
637
|
+
bodyMapper: EmailSendResult,
|
638
|
+
headersMapper: EmailSendHeaders
|
639
|
+
},
|
588
640
|
202: {
|
641
|
+
bodyMapper: EmailSendResult,
|
642
|
+
headersMapper: EmailSendHeaders
|
643
|
+
},
|
644
|
+
204: {
|
645
|
+
bodyMapper: EmailSendResult,
|
589
646
|
headersMapper: EmailSendHeaders
|
590
647
|
},
|
591
648
|
default: {
|
592
|
-
bodyMapper:
|
649
|
+
bodyMapper: ErrorResponse,
|
593
650
|
headersMapper: EmailSendExceptionHeaders
|
594
651
|
}
|
595
652
|
},
|
596
|
-
requestBody:
|
653
|
+
requestBody: message,
|
597
654
|
queryParameters: [apiVersion],
|
598
655
|
urlParameters: [endpoint],
|
599
656
|
headerParameters: [
|
600
657
|
accept,
|
601
658
|
contentType,
|
602
|
-
|
603
|
-
|
659
|
+
operationId1,
|
660
|
+
clientRequestId
|
604
661
|
],
|
605
662
|
mediaType: "json",
|
606
663
|
serializer
|
@@ -642,7 +699,7 @@ class EmailRestApiClient extends coreClient__namespace.ServiceClient {
|
|
642
699
|
// Parameter assignments
|
643
700
|
this.endpoint = endpoint;
|
644
701
|
// Assigning values to Constant parameters
|
645
|
-
this.apiVersion = options.apiVersion || "
|
702
|
+
this.apiVersion = options.apiVersion || "2023-01-15-preview";
|
646
703
|
this.email = new EmailImpl(this);
|
647
704
|
this.addCustomApiVersionPolicy(options.apiVersion);
|
648
705
|
}
|
@@ -704,27 +761,35 @@ class EmailClient {
|
|
704
761
|
}
|
705
762
|
/**
|
706
763
|
* Queues an email message to be sent to one or more recipients
|
707
|
-
* @param
|
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
|
764
|
+
* @param message - Message payload for sending an email
|
765
|
+
* @param options - The options parameters.
|
719
766
|
*/
|
720
|
-
|
721
|
-
|
722
|
-
return {
|
723
|
-
messageId: response.messageId,
|
724
|
-
status: response.status,
|
725
|
-
};
|
767
|
+
beginSend(message, options) {
|
768
|
+
return this.generatedClient.email.beginSend(message, options);
|
726
769
|
}
|
727
770
|
}
|
728
771
|
|
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
|
+
|
729
794
|
exports.EmailClient = EmailClient;
|
730
795
|
//# sourceMappingURL=index.js.map
|