@azure/communication-email 1.0.0-alpha.20220524.1 → 1.0.0-alpha.20220630.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.
Files changed (40) hide show
  1. package/README.md +15 -21
  2. package/dist/index.js +138 -76
  3. package/dist/index.js.map +1 -1
  4. package/dist-esm/samples-dev/checkMessageStatus.js +1 -6
  5. package/dist-esm/samples-dev/checkMessageStatus.js.map +1 -1
  6. package/dist-esm/samples-dev/sendEmailMultipleRecipients.js +5 -20
  7. package/dist-esm/samples-dev/sendEmailMultipleRecipients.js.map +1 -1
  8. package/dist-esm/samples-dev/sendEmailSingleRecipient.js +1 -6
  9. package/dist-esm/samples-dev/sendEmailSingleRecipient.js.map +1 -1
  10. package/dist-esm/samples-dev/sendEmailWithAttachments.js +1 -6
  11. package/dist-esm/samples-dev/sendEmailWithAttachments.js.map +1 -1
  12. package/dist-esm/src/emailClient.js +4 -16
  13. package/dist-esm/src/emailClient.js.map +1 -1
  14. package/dist-esm/src/generated/src/emailRestApiClient.js +53 -10
  15. package/dist-esm/src/generated/src/emailRestApiClient.js.map +1 -1
  16. package/dist-esm/src/generated/src/index.js +11 -0
  17. package/dist-esm/src/generated/src/index.js.map +1 -0
  18. package/dist-esm/src/generated/src/models/index.js +80 -1
  19. package/dist-esm/src/generated/src/models/index.js.map +1 -1
  20. package/dist-esm/src/generated/src/models/mappers.js +69 -10
  21. package/dist-esm/src/generated/src/models/mappers.js.map +1 -1
  22. package/dist-esm/src/generated/src/models/parameters.js +11 -0
  23. package/dist-esm/src/generated/src/models/parameters.js.map +1 -1
  24. package/dist-esm/src/generated/src/operations/email.js +10 -17
  25. package/dist-esm/src/generated/src/operations/email.js.map +1 -1
  26. package/dist-esm/src/generated/src/operationsInterfaces/email.js +9 -0
  27. package/dist-esm/src/generated/src/operationsInterfaces/email.js.map +1 -0
  28. package/dist-esm/src/generated/src/operationsInterfaces/index.js +9 -0
  29. package/dist-esm/src/generated/src/operationsInterfaces/index.js.map +1 -0
  30. package/dist-esm/src/models.js.map +1 -1
  31. package/dist-esm/test/public/emailClient.spec.js +122 -127
  32. package/dist-esm/test/public/emailClient.spec.js.map +1 -1
  33. package/dist-esm/test/public/utils/recordedClient.js +49 -31
  34. package/dist-esm/test/public/utils/recordedClient.js.map +1 -1
  35. package/package.json +10 -7
  36. package/types/communication-email.d.ts +84 -101
  37. package/dist-esm/src/constants.js +0 -4
  38. package/dist-esm/src/constants.js.map +0 -1
  39. package/dist-esm/src/generated/src/emailRestApiClientContext.js +0 -38
  40. package/dist-esm/src/generated/src/emailRestApiClientContext.js.map +0 -1
@@ -1,48 +1,65 @@
1
+ import { CommonClientOptions } from '@azure/core-client';
1
2
  import { KeyCredential } from '@azure/core-auth';
2
- import { PipelineOptions } from '@azure/core-http';
3
3
 
4
- /**
5
- * An object representing the email address and its display name
6
- */
4
+ /** An object representing the email address and its display name */
7
5
  export declare interface EmailAddress {
8
- /**
9
- * Email address.
10
- */
6
+ /** Email address. */
11
7
  email: string;
12
- /**
13
- * Email display name.
14
- */
8
+ /** Email display name. */
15
9
  displayName?: string;
16
10
  }
17
11
 
18
- /**
19
- * Attachment to the email.
20
- */
12
+ /** Attachment to the email. */
21
13
  export declare interface EmailAttachment {
22
- /**
23
- * Name of the attachment
24
- */
14
+ /** Name of the attachment */
25
15
  name: string;
26
- /**
27
- * The type of attachment file.
28
- */
16
+ /** The type of attachment file. */
29
17
  attachmentType: EmailAttachmentType;
30
- /**
31
- * Base64 encoded contents of the attachment
32
- */
18
+ /** Base64 encoded contents of the attachment */
33
19
  contentBytesBase64: string;
34
20
  }
35
21
 
36
22
  /**
37
- * Defines values for EmailAttachmentType.
23
+ * Defines values for EmailAttachmentType. \
24
+ * {@link KnownEmailAttachmentType} can be used interchangeably with EmailAttachmentType,
25
+ * this enum contains the known values that the service supports.
26
+ * ### Known values supported by the service
27
+ * **avi** \
28
+ * **bmp** \
29
+ * **doc** \
30
+ * **docm** \
31
+ * **docx** \
32
+ * **gif** \
33
+ * **jpeg** \
34
+ * **mp3** \
35
+ * **one** \
36
+ * **pdf** \
37
+ * **png** \
38
+ * **ppsm** \
39
+ * **ppsx** \
40
+ * **ppt** \
41
+ * **pptm** \
42
+ * **pptx** \
43
+ * **pub** \
44
+ * **rpmsg** \
45
+ * **rtf** \
46
+ * **tif** \
47
+ * **txt** \
48
+ * **vsd** \
49
+ * **wav** \
50
+ * **wma** \
51
+ * **xls** \
52
+ * **xlsb** \
53
+ * **xlsm** \
54
+ * **xlsx**
38
55
  */
39
- export declare type EmailAttachmentType = "avi" | "bmp" | "doc" | "docm" | "docx" | "gif" | "jpeg" | "mp3" | "one" | "pdf" | "png" | "ppsm" | "ppsx" | "ppt" | "pptm" | "pptx" | "pub" | "rpmsg" | "rtf" | "tif" | "txt" | "vsd" | "wav" | "wma" | "xls" | "xlsb" | "xlsm" | "xlsx";
56
+ export declare type EmailAttachmentType = string;
40
57
 
41
58
  /**
42
59
  * The Email service client.
43
60
  */
44
61
  export declare class EmailClient {
45
- private readonly api;
62
+ private readonly generatedClient;
46
63
  /**
47
64
  * Initializes a new instance of the EmailClient class.
48
65
  * @param connectionString - Connection string to connect to an Azure Communication Service resource.
@@ -72,100 +89,66 @@ export declare class EmailClient {
72
89
  /**
73
90
  * Client options used to configure SMS Client API requests.
74
91
  */
75
- export declare interface EmailClientOptions extends PipelineOptions {
92
+ export declare interface EmailClientOptions extends CommonClientOptions {
76
93
  }
77
94
 
78
- /**
79
- * Content of the email.
80
- */
95
+ /** Content of the email. */
81
96
  export declare interface EmailContent {
82
- /**
83
- * Subject of the email message
84
- */
97
+ /** Subject of the email message */
85
98
  subject: string;
86
- /**
87
- * Plain text version of the email message.
88
- */
99
+ /** Plain text version of the email message. */
89
100
  plainText?: string;
90
- /**
91
- * Html version of the email message.
92
- */
101
+ /** Html version of the email message. */
93
102
  html?: string;
94
103
  }
95
104
 
96
- /**
97
- * Custom header for email.
98
- */
105
+ /** Custom header for email. */
99
106
  export declare interface EmailCustomHeader {
100
- /**
101
- * Header name.
102
- */
107
+ /** Header name. */
103
108
  name: string;
104
- /**
105
- * Header value.
106
- */
109
+ /** Header value. */
107
110
  value: string;
108
111
  }
109
112
 
110
113
  /**
111
- * Defines values for EmailImportance.
114
+ * Defines values for EmailImportance. \
115
+ * {@link KnownEmailImportance} can be used interchangeably with EmailImportance,
116
+ * this enum contains the known values that the service supports.
117
+ * ### Known values supported by the service
118
+ * **high** \
119
+ * **normal** \
120
+ * **low**
112
121
  */
113
- export declare type EmailImportance = "high" | "normal" | "low";
122
+ export declare type EmailImportance = string;
114
123
 
115
- /**
116
- * Message payload for sending an email
117
- */
124
+ /** Message payload for sending an email */
118
125
  export declare interface EmailMessage {
119
- /**
120
- * Custom email headers to be passed.
121
- */
126
+ /** Custom email headers to be passed. */
122
127
  customHeaders?: EmailCustomHeader[];
123
- /**
124
- * Sender email address from a verified domain.
125
- */
128
+ /** Sender email address from a verified domain. */
126
129
  sender: string;
127
- /**
128
- * Email content to be sent.
129
- */
130
+ /** Email content to be sent. */
130
131
  content: EmailContent;
131
- /**
132
- * The importance type for the email.
133
- */
132
+ /** The importance type for the email. */
134
133
  importance?: EmailImportance;
135
- /**
136
- * Recipients for the email.
137
- */
134
+ /** Recipients for the email. */
138
135
  recipients: EmailRecipients;
139
- /**
140
- * list of attachments
141
- */
136
+ /** list of attachments */
142
137
  attachments?: EmailAttachment[];
143
- /**
144
- * Email addresses where recipients' replies will be sent to.
145
- */
138
+ /** Email addresses where recipients' replies will be sent to. */
146
139
  replyTo?: EmailAddress[];
147
- /**
148
- * Indicates whether user engagement tracking should be disabled for this request if the resource-level user engagement tracking setting was already enabled in the control plane.
149
- */
140
+ /** Indicates whether user engagement tracking should be disabled for this request if the resource-level user engagement tracking setting was already enabled in the control plane. */
150
141
  disableUserEngagementTracking?: boolean;
151
142
  }
152
143
 
153
- /**
154
- * Recipients of the email
155
- */
144
+ /** Recipients of the email */
156
145
  export declare interface EmailRecipients {
157
- /**
158
- * Email to recipients
159
- */
146
+ /** Email To recipients */
160
147
  to: EmailAddress[];
161
- /**
162
- * Email cc recipients
163
- */
164
- cC?: EmailAddress[];
165
- /**
166
- * Email bcc recipients
167
- */
168
- bCC?: EmailAddress[];
148
+ /** Email CC recipients */
149
+ cc?: EmailAddress[];
150
+ /** Email BCC recipients */
151
+ bcc?: EmailAddress[];
169
152
  }
170
153
 
171
154
  /**
@@ -179,21 +162,21 @@ export declare interface SendEmailResult {
179
162
  }
180
163
 
181
164
  /**
182
- * Defines values for SendStatus.
165
+ * Defines values for SendStatus. \
166
+ * {@link KnownSendStatus} can be used interchangeably with SendStatus,
167
+ * this enum contains the known values that the service supports.
168
+ * ### Known values supported by the service
169
+ * **queued**: The message has passed basic validations and has been queued to be processed further. \
170
+ * **outForDelivery**: The message has been processed and is now out for delivery. \
171
+ * **dropped**: The message could not be processed and was dropped.
183
172
  */
184
- export declare type SendStatus = "queued" | "outForDelivery" | "dropped";
173
+ export declare type SendStatus = string;
185
174
 
186
- /**
187
- * Status of an email message that was sent previously.
188
- */
175
+ /** Status of an email message that was sent previously. */
189
176
  export declare interface SendStatusResult {
190
- /**
191
- * System generated id of an email message sent.
192
- */
177
+ /** System generated id of an email message sent. */
193
178
  messageId: string;
194
- /**
195
- * The type indicating the status of a request.
196
- */
179
+ /** The type indicating the status of a request. */
197
180
  status: SendStatus;
198
181
  }
199
182
 
@@ -1,4 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- export const SDK_VERSION = "1.0.0-beta.1";
4
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,MAAM,CAAC,MAAM,WAAW,GAAW,cAAc,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport const SDK_VERSION: string = \"1.0.0-beta.1\";\n"]}
@@ -1,38 +0,0 @@
1
- /*
2
- * Copyright (c) Microsoft Corporation.
3
- * Licensed under the MIT License.
4
- *
5
- * Code generated by Microsoft (R) AutoRest Code Generator.
6
- * Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
- */
8
- import * as coreHttp from "@azure/core-http";
9
- const packageName = "@azure/communication-email";
10
- const packageVersion = "1.0.0-beta.1";
11
- export class EmailRestApiClientContext extends coreHttp.ServiceClient {
12
- /**
13
- * Initializes a new instance of the EmailRestApiClientContext class.
14
- * @param endpoint The communication resource, for example https://my-resource.communication.azure.com
15
- * @param options The parameter options
16
- */
17
- constructor(endpoint, options) {
18
- if (endpoint === undefined) {
19
- throw new Error("'endpoint' cannot be null");
20
- }
21
- // Initializing default values for options
22
- if (!options) {
23
- options = {};
24
- }
25
- if (!options.userAgent) {
26
- const defaultUserAgent = coreHttp.getDefaultUserAgentValue();
27
- options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`;
28
- }
29
- super(undefined, options);
30
- this.requestContentType = "application/json; charset=utf-8";
31
- this.baseUri = options.endpoint || "{endpoint}";
32
- // Parameter assignments
33
- this.endpoint = endpoint;
34
- // Assigning values to Constant parameters
35
- this.apiVersion = options.apiVersion || "2021-10-01-preview";
36
- }
37
- }
38
- //# sourceMappingURL=emailRestApiClientContext.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"emailRestApiClientContext.js","sourceRoot":"","sources":["../../../../src/generated/src/emailRestApiClientContext.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAG7C,MAAM,WAAW,GAAG,4BAA4B,CAAC;AACjD,MAAM,cAAc,GAAG,cAAc,CAAC;AAEtC,MAAM,OAAO,yBAA0B,SAAQ,QAAQ,CAAC,aAAa;IAInE;;;;OAIG;IACH,YAAY,QAAgB,EAAE,OAA0C;QACtE,IAAI,QAAQ,KAAK,SAAS,EAAE;YAC1B,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;SAC9C;QAED,0CAA0C;QAC1C,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO,GAAG,EAAE,CAAC;SACd;QAED,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE;YACtB,MAAM,gBAAgB,GAAG,QAAQ,CAAC,wBAAwB,EAAE,CAAC;YAC7D,OAAO,CAAC,SAAS,GAAG,GAAG,WAAW,IAAI,cAAc,IAAI,gBAAgB,EAAE,CAAC;SAC5E;QAED,KAAK,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAE1B,IAAI,CAAC,kBAAkB,GAAG,iCAAiC,CAAC;QAE5D,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,QAAQ,IAAI,YAAY,CAAC;QAEhD,wBAAwB;QACxB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAEzB,0CAA0C;QAC1C,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,oBAAoB,CAAC;IAC/D,CAAC;CACF","sourcesContent":["/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * Code generated by Microsoft (R) AutoRest Code Generator.\n * Changes may cause incorrect behavior and will be lost if the code is regenerated.\n */\n\nimport * as coreHttp from \"@azure/core-http\";\nimport { EmailRestApiClientOptionalParams } from \"./models\";\n\nconst packageName = \"@azure/communication-email\";\nconst packageVersion = \"1.0.0-beta.1\";\n\nexport class EmailRestApiClientContext extends coreHttp.ServiceClient {\n endpoint: string;\n apiVersion: string;\n\n /**\n * Initializes a new instance of the EmailRestApiClientContext class.\n * @param endpoint The communication resource, for example https://my-resource.communication.azure.com\n * @param options The parameter options\n */\n constructor(endpoint: string, options?: EmailRestApiClientOptionalParams) {\n if (endpoint === undefined) {\n throw new Error(\"'endpoint' cannot be null\");\n }\n\n // Initializing default values for options\n if (!options) {\n options = {};\n }\n\n if (!options.userAgent) {\n const defaultUserAgent = coreHttp.getDefaultUserAgentValue();\n options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`;\n }\n\n super(undefined, options);\n\n this.requestContentType = \"application/json; charset=utf-8\";\n\n this.baseUri = options.endpoint || \"{endpoint}\";\n\n // Parameter assignments\n this.endpoint = endpoint;\n\n // Assigning values to Constant parameters\n this.apiVersion = options.apiVersion || \"2021-10-01-preview\";\n }\n}\n"]}