@azure/communication-email 1.0.0-alpha.20221107.1 → 1.0.0-alpha.20221124.1

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -31,6 +31,24 @@ const connectionString = `endpoint=https://<resource-name>.communication.azure.c
31
31
  const client = new EmailClient(connectionString);
32
32
  ```
33
33
 
34
+ You can also authenticate with Azure Active Directory using the [Azure Identity library][azure_identity]. To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the [`@azure/identity`][azure_identity] package:
35
+
36
+ ```bash
37
+ npm install @azure/identity
38
+ ```
39
+
40
+ The [`@azure/identity`][azure_identity] package provides a variety of credential types that your application can use to do this. The README for @azure/identity provides more details and samples to get you started.
41
+ AZURE_CLIENT_SECRET, AZURE_CLIENT_ID and AZURE_TENANT_ID environment variables are needed to create a DefaultAzureCredential object.
42
+
43
+ ```typescript
44
+ import { DefaultAzureCredential } from "@azure/identity";
45
+ import { SmsClient } from "@azure/communication-email";
46
+
47
+ const endpoint = "https://<resource-name>.communication.azure.com";
48
+ let credential = new DefaultAzureCredential();
49
+ const client = new EmailClient(endpoint, credential);
50
+ ```
51
+
34
52
  ### Send an Email Message
35
53
 
36
54
  To send an email message, call the `send` function from the `EmailClient`.
@@ -164,6 +182,8 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m
164
182
  [coc]: https://opensource.microsoft.com/codeofconduct/
165
183
  [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/
166
184
  [coc_contact]: mailto:opencode@microsoft.com
185
+ [defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential
186
+ [azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity
167
187
  [communication_resource_docs]: https://docs.microsoft.com/azure/communication-services/quickstarts/create-communication-resource?tabs=windows&pivots=platform-azp
168
188
  [email_resource_docs]: https://aka.ms/acsemail/createemailresource
169
189
  [communication_resource_create_portal]: https://docs.microsoft.com/azure/communication-services/quickstarts/create-communication-resource?tabs=windows&pivots=platform-azp
package/dist/index.js CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var coreAuth = require('@azure/core-auth');
5
6
  var communicationCommon = require('@azure/communication-common');
6
7
  var coreClient = require('@azure/core-client');
7
8
  var logger$1 = require('@azure/logger');
@@ -254,7 +255,6 @@ const EmailRecipients = {
254
255
  modelProperties: {
255
256
  to: {
256
257
  serializedName: "to",
257
- required: true,
258
258
  type: {
259
259
  name: "Sequence",
260
260
  element: {
@@ -685,7 +685,7 @@ const logger = logger$1.createClientLogger("communication-email");
685
685
  *
686
686
  * @param options - The value being checked.
687
687
  */
688
- const isEmailClientOptions = (options) => !!options && !communicationCommon.isKeyCredential(options);
688
+ const isEmailClientOptions = (options) => !!options && !coreAuth.isTokenCredential(options) && !communicationCommon.isKeyCredential(options);
689
689
  /**
690
690
  * The Email service client.
691
691
  */
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/generated/src/models/mappers.ts","../src/generated/src/models/parameters.ts","../src/generated/src/operations/email.ts","../src/generated/src/emailRestApiClient.ts","../src/logger.ts","../src/emailClient.ts"],"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 coreClient from \"@azure/core-client\";\n\nexport const SendStatusResult: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"SendStatusResult\",\n modelProperties: {\n messageId: {\n serializedName: \"messageId\",\n required: true,\n type: {\n name: \"String\"\n }\n },\n status: {\n serializedName: \"status\",\n required: true,\n type: {\n name: \"String\"\n }\n }\n }\n }\n};\n\nexport const CommunicationErrorResponse: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"CommunicationErrorResponse\",\n modelProperties: {\n error: {\n serializedName: \"error\",\n type: {\n name: \"Composite\",\n className: \"CommunicationError\"\n }\n }\n }\n }\n};\n\nexport const CommunicationError: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"CommunicationError\",\n modelProperties: {\n code: {\n serializedName: \"code\",\n required: true,\n type: {\n name: \"String\"\n }\n },\n message: {\n serializedName: \"message\",\n required: true,\n type: {\n name: \"String\"\n }\n },\n target: {\n serializedName: \"target\",\n readOnly: true,\n type: {\n name: \"String\"\n }\n },\n details: {\n serializedName: \"details\",\n readOnly: true,\n type: {\n name: \"Sequence\",\n element: {\n type: {\n name: \"Composite\",\n className: \"CommunicationError\"\n }\n }\n }\n },\n innerError: {\n serializedName: \"innererror\",\n type: {\n name: \"Composite\",\n className: \"CommunicationError\"\n }\n }\n }\n }\n};\n\nexport const EmailMessage: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"EmailMessage\",\n modelProperties: {\n customHeaders: {\n serializedName: \"headers\",\n type: {\n name: \"Sequence\",\n element: {\n type: {\n name: \"Composite\",\n className: \"EmailCustomHeader\"\n }\n }\n }\n },\n sender: {\n serializedName: \"sender\",\n required: true,\n type: {\n name: \"String\"\n }\n },\n content: {\n serializedName: \"content\",\n type: {\n name: \"Composite\",\n className: \"EmailContent\"\n }\n },\n importance: {\n defaultValue: \"normal\",\n serializedName: \"importance\",\n type: {\n name: \"String\"\n }\n },\n recipients: {\n serializedName: \"recipients\",\n type: {\n name: \"Composite\",\n className: \"EmailRecipients\"\n }\n },\n attachments: {\n serializedName: \"attachments\",\n type: {\n name: \"Sequence\",\n element: {\n type: {\n name: \"Composite\",\n className: \"EmailAttachment\"\n }\n }\n }\n },\n replyTo: {\n serializedName: \"replyTo\",\n type: {\n name: \"Sequence\",\n element: {\n type: {\n name: \"Composite\",\n className: \"EmailAddress\"\n }\n }\n }\n },\n disableUserEngagementTracking: {\n serializedName: \"disableUserEngagementTracking\",\n type: {\n name: \"Boolean\"\n }\n }\n }\n }\n};\n\nexport const EmailCustomHeader: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"EmailCustomHeader\",\n modelProperties: {\n name: {\n serializedName: \"name\",\n required: true,\n type: {\n name: \"String\"\n }\n },\n value: {\n serializedName: \"value\",\n required: true,\n type: {\n name: \"String\"\n }\n }\n }\n }\n};\n\nexport const EmailContent: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"EmailContent\",\n modelProperties: {\n subject: {\n serializedName: \"subject\",\n required: true,\n type: {\n name: \"String\"\n }\n },\n plainText: {\n serializedName: \"plainText\",\n type: {\n name: \"String\"\n }\n },\n html: {\n serializedName: \"html\",\n type: {\n name: \"String\"\n }\n }\n }\n }\n};\n\nexport const EmailRecipients: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"EmailRecipients\",\n modelProperties: {\n to: {\n serializedName: \"to\",\n required: true,\n type: {\n name: \"Sequence\",\n element: {\n type: {\n name: \"Composite\",\n className: \"EmailAddress\"\n }\n }\n }\n },\n cc: {\n serializedName: \"CC\",\n type: {\n name: \"Sequence\",\n element: {\n type: {\n name: \"Composite\",\n className: \"EmailAddress\"\n }\n }\n }\n },\n bcc: {\n serializedName: \"bCC\",\n type: {\n name: \"Sequence\",\n element: {\n type: {\n name: \"Composite\",\n className: \"EmailAddress\"\n }\n }\n }\n }\n }\n }\n};\n\nexport const EmailAddress: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"EmailAddress\",\n modelProperties: {\n email: {\n serializedName: \"email\",\n required: true,\n type: {\n name: \"String\"\n }\n },\n displayName: {\n serializedName: \"displayName\",\n type: {\n name: \"String\"\n }\n }\n }\n }\n};\n\nexport const EmailAttachment: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"EmailAttachment\",\n modelProperties: {\n name: {\n serializedName: \"name\",\n required: true,\n type: {\n name: \"String\"\n }\n },\n attachmentType: {\n serializedName: \"attachmentType\",\n required: true,\n type: {\n name: \"String\"\n }\n },\n contentBytesBase64: {\n serializedName: \"contentBytesBase64\",\n required: true,\n type: {\n name: \"String\"\n }\n }\n }\n }\n};\n\nexport const EmailGetSendStatusHeaders: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"EmailGetSendStatusHeaders\",\n modelProperties: {\n retryAfter: {\n serializedName: \"retry-after\",\n type: {\n name: \"Number\"\n }\n }\n }\n }\n};\n\nexport const EmailGetSendStatusExceptionHeaders: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"EmailGetSendStatusExceptionHeaders\",\n modelProperties: {\n xMsErrorCode: {\n serializedName: \"x-ms-error-code\",\n type: {\n name: \"String\"\n }\n }\n }\n }\n};\n\nexport const EmailSendHeaders: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"EmailSendHeaders\",\n modelProperties: {\n repeatabilityResult: {\n serializedName: \"repeatability-result\",\n type: {\n name: \"String\"\n }\n },\n operationLocation: {\n serializedName: \"operation-location\",\n type: {\n name: \"String\"\n }\n },\n retryAfter: {\n serializedName: \"retry-after\",\n type: {\n name: \"Number\"\n }\n },\n xMsRequestId: {\n serializedName: \"x-ms-request-id\",\n type: {\n name: \"String\"\n }\n }\n }\n }\n};\n\nexport const EmailSendExceptionHeaders: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"EmailSendExceptionHeaders\",\n modelProperties: {\n xMsErrorCode: {\n serializedName: \"x-ms-error-code\",\n type: {\n name: \"String\"\n }\n }\n }\n }\n};\n","/*\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 {\n OperationParameter,\n OperationURLParameter,\n OperationQueryParameter\n} from \"@azure/core-client\";\nimport { EmailMessage as EmailMessageMapper } from \"../models/mappers\";\n\nexport const accept: OperationParameter = {\n parameterPath: \"accept\",\n mapper: {\n defaultValue: \"application/json\",\n isConstant: true,\n serializedName: \"Accept\",\n type: {\n name: \"String\"\n }\n }\n};\n\nexport const endpoint: OperationURLParameter = {\n parameterPath: \"endpoint\",\n mapper: {\n serializedName: \"endpoint\",\n required: true,\n type: {\n name: \"String\"\n }\n },\n skipEncoding: true\n};\n\nexport const messageId: OperationURLParameter = {\n parameterPath: \"messageId\",\n mapper: {\n serializedName: \"messageId\",\n required: true,\n type: {\n name: \"String\"\n }\n }\n};\n\nexport const apiVersion: OperationQueryParameter = {\n parameterPath: \"apiVersion\",\n mapper: {\n defaultValue: \"2021-10-01-preview\",\n isConstant: true,\n serializedName: \"api-version\",\n type: {\n name: \"String\"\n }\n }\n};\n\nexport const contentType: OperationParameter = {\n parameterPath: [\"options\", \"contentType\"],\n mapper: {\n defaultValue: \"application/json\",\n isConstant: true,\n serializedName: \"Content-Type\",\n type: {\n name: \"String\"\n }\n }\n};\n\nexport const emailMessage: OperationParameter = {\n parameterPath: \"emailMessage\",\n mapper: EmailMessageMapper\n};\n\nexport const repeatabilityRequestId: OperationParameter = {\n parameterPath: \"repeatabilityRequestId\",\n mapper: {\n serializedName: \"repeatability-request-id\",\n required: true,\n type: {\n name: \"String\"\n }\n }\n};\n\nexport const repeatabilityFirstSent: OperationParameter = {\n parameterPath: \"repeatabilityFirstSent\",\n mapper: {\n serializedName: \"repeatability-first-sent\",\n required: true,\n type: {\n name: \"String\"\n }\n }\n};\n","/*\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 { Email } from \"../operationsInterfaces\";\nimport * as coreClient from \"@azure/core-client\";\nimport * as Mappers from \"../models/mappers\";\nimport * as Parameters from \"../models/parameters\";\nimport { EmailRestApiClient } from \"../emailRestApiClient\";\nimport {\n EmailGetSendStatusOptionalParams,\n EmailGetSendStatusResponse,\n EmailMessage,\n EmailSendOptionalParams,\n EmailSendResponse\n} from \"../models\";\n\n/** Class containing Email operations. */\nexport class EmailImpl implements Email {\n private readonly client: EmailRestApiClient;\n\n /**\n * Initialize a new instance of the class Email class.\n * @param client Reference to the service client\n */\n constructor(client: EmailRestApiClient) {\n this.client = client;\n }\n\n /**\n * Gets the status of a message sent previously.\n * @param messageId System generated message id (GUID) returned from a previous call to send email\n * @param options The options parameters.\n */\n getSendStatus(\n messageId: string,\n options?: EmailGetSendStatusOptionalParams\n ): Promise<EmailGetSendStatusResponse> {\n return this.client.sendOperationRequest(\n { messageId, options },\n getSendStatusOperationSpec\n );\n }\n\n /**\n * Queues an email message to be sent to one or more recipients\n * @param repeatabilityRequestId If specified, the client directs that the request is repeatable; that\n * is, that the client can make the request multiple times with the same Repeatability-Request-Id and\n * get back an appropriate response without the server executing the request multiple times. The value\n * of the Repeatability-Request-Id is an opaque string representing a client-generated, globally unique\n * for all time, identifier for the request. It is recommended to use version 4 (random) UUIDs.\n * @param repeatabilityFirstSent Must be sent by clients to specify that a request is repeatable.\n * Repeatability-First-Sent is used to specify the date and time at which the request was first created\n * in the IMF-fix date form of HTTP-date as defined in RFC7231. eg- Tue, 26 Mar 2019 16:06:51 GMT\n * @param emailMessage Message payload for sending an email\n * @param options The options parameters.\n */\n send(\n repeatabilityRequestId: string,\n repeatabilityFirstSent: string,\n emailMessage: EmailMessage,\n options?: EmailSendOptionalParams\n ): Promise<EmailSendResponse> {\n return this.client.sendOperationRequest(\n { repeatabilityRequestId, repeatabilityFirstSent, emailMessage, options },\n sendOperationSpec\n );\n }\n}\n// Operation Specifications\nconst serializer = coreClient.createSerializer(Mappers, /* isXml */ false);\n\nconst getSendStatusOperationSpec: coreClient.OperationSpec = {\n path: \"/emails/{messageId}/status\",\n httpMethod: \"GET\",\n responses: {\n 200: {\n bodyMapper: Mappers.SendStatusResult,\n headersMapper: Mappers.EmailGetSendStatusHeaders\n },\n default: {\n bodyMapper: Mappers.CommunicationErrorResponse,\n headersMapper: Mappers.EmailGetSendStatusExceptionHeaders\n }\n },\n queryParameters: [Parameters.apiVersion],\n urlParameters: [Parameters.endpoint, Parameters.messageId],\n headerParameters: [Parameters.accept],\n serializer\n};\nconst sendOperationSpec: coreClient.OperationSpec = {\n path: \"/emails:send\",\n httpMethod: \"POST\",\n responses: {\n 202: {\n headersMapper: Mappers.EmailSendHeaders\n },\n default: {\n bodyMapper: Mappers.CommunicationErrorResponse,\n headersMapper: Mappers.EmailSendExceptionHeaders\n }\n },\n requestBody: Parameters.emailMessage,\n queryParameters: [Parameters.apiVersion],\n urlParameters: [Parameters.endpoint],\n headerParameters: [\n Parameters.accept,\n Parameters.contentType,\n Parameters.repeatabilityRequestId,\n Parameters.repeatabilityFirstSent\n ],\n mediaType: \"json\",\n serializer\n};\n","/*\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 coreClient from \"@azure/core-client\";\nimport {\n PipelineRequest,\n PipelineResponse,\n SendRequest\n} from \"@azure/core-rest-pipeline\";\nimport { EmailImpl } from \"./operations\";\nimport { Email } from \"./operationsInterfaces\";\nimport { EmailRestApiClientOptionalParams } from \"./models\";\n\nexport class EmailRestApiClient extends coreClient.ServiceClient {\n endpoint: string;\n apiVersion: string;\n\n /**\n * Initializes a new instance of the EmailRestApiClient 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 const defaults: EmailRestApiClientOptionalParams = {\n requestContentType: \"application/json; charset=utf-8\"\n };\n\n const packageDetails = `azsdk-js-communication-email/1.0.0-beta.2`;\n const userAgentPrefix =\n options.userAgentOptions && options.userAgentOptions.userAgentPrefix\n ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`\n : `${packageDetails}`;\n\n const optionsWithDefaults = {\n ...defaults,\n ...options,\n userAgentOptions: {\n userAgentPrefix\n },\n baseUri: options.endpoint ?? options.baseUri ?? \"{endpoint}\"\n };\n super(optionsWithDefaults);\n // Parameter assignments\n this.endpoint = endpoint;\n\n // Assigning values to Constant parameters\n this.apiVersion = options.apiVersion || \"2021-10-01-preview\";\n this.email = new EmailImpl(this);\n this.addCustomApiVersionPolicy(options.apiVersion);\n }\n\n /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */\n private addCustomApiVersionPolicy(apiVersion?: string) {\n if (!apiVersion) {\n return;\n }\n const apiVersionPolicy = {\n name: \"CustomApiVersionPolicy\",\n async sendRequest(\n request: PipelineRequest,\n next: SendRequest\n ): Promise<PipelineResponse> {\n const param = request.url.split(\"?\");\n if (param.length > 1) {\n const newParams = param[1].split(\"&\").map((item) => {\n if (item.indexOf(\"api-version\") > -1) {\n return \"api-version=\" + apiVersion;\n } else {\n return item;\n }\n });\n request.url = param[0] + \"?\" + newParams.join(\"&\");\n }\n return next(request);\n }\n };\n this.pipeline.addPolicy(apiVersionPolicy);\n }\n\n email: Email;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createClientLogger } from \"@azure/logger\";\n\n/**\n * The \\@azure/logger configuration for this package.\n */\nexport const logger = createClientLogger(\"communication-email\");\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { EmailClientOptions, EmailMessage, SendEmailResult, SendStatusResult } from \"./models\";\nimport {\n createCommunicationAuthPolicy,\n isKeyCredential,\n parseClientArguments,\n} from \"@azure/communication-common\";\nimport { EmailRestApiClient } from \"./generated/src/emailRestApiClient\";\nimport { InternalPipelineOptions } from \"@azure/core-rest-pipeline\";\nimport { KeyCredential } from \"@azure/core-auth\";\nimport { logger } from \"./logger\";\nimport { v4 as uuid } from \"uuid\";\n\n/**\n * Checks whether the type of a value is EmailClientOptions or not.\n *\n * @param options - The value being checked.\n */\nconst isEmailClientOptions = (options: any): options is EmailClientOptions =>\n !!options && !isKeyCredential(options);\n\n/**\n * The Email service client.\n */\nexport class EmailClient {\n private readonly generatedClient: EmailRestApiClient;\n\n /**\n * Initializes a new instance of the EmailClient class.\n * @param connectionString - Connection string to connect to an Azure Communication Service resource.\n * Example: \"endpoint=https://contoso.eastus.communications.azure.net/;accesskey=secret\";\n * @param options - Optional. Options to configure the HTTP pipeline.\n */\n constructor(connectionString: string, options?: EmailClientOptions);\n\n /**\n * Initializes a new instance of the EmailClient class using an Azure KeyCredential.\n * @param endpoint - The endpoint of the service (ex: https://contoso.eastus.communications.azure.net).\n * @param credential - An object that is used to authenticate requests to the service. Use the Azure KeyCredential or `@azure/identity` to create a credential.\n * @param options - Optional. Options to configure the HTTP pipeline.\n */\n constructor(endpoint: string, credential: KeyCredential, options?: EmailClientOptions);\n\n constructor(\n connectionStringOrUrl: string,\n credentialOrOptions?: EmailClientOptions | KeyCredential,\n maybeOptions: EmailClientOptions = {}\n ) {\n const { url, credential } = parseClientArguments(connectionStringOrUrl, credentialOrOptions);\n const options = isEmailClientOptions(credentialOrOptions) ? credentialOrOptions : maybeOptions;\n\n const internalPipelineOptions: InternalPipelineOptions = {\n ...options,\n ...{\n loggingOptions: {\n logger: logger.info,\n },\n },\n };\n\n const authPolicy = createCommunicationAuthPolicy(credential);\n this.generatedClient = new EmailRestApiClient(url, internalPipelineOptions);\n this.generatedClient.pipeline.addPolicy(authPolicy);\n }\n\n /**\n * Queues an email message to be sent to one or more recipients\n * @param emailMessage - Message payload for sending an email\n */\n public async send(emailMessage: EmailMessage): Promise<SendEmailResult> {\n const response = await this.generatedClient.email.send(\n uuid(),\n new Date().toUTCString(),\n emailMessage\n );\n\n return {\n messageId: response.xMsRequestId ?? \"\",\n };\n }\n\n /**\n * Gets the status of a message sent previously.\n * @param messageId - System generated message id (GUID) returned from a previous call to send email\n */\n public async getSendStatus(messageId: string): Promise<SendStatusResult> {\n const response = await this.generatedClient.email.getSendStatus(messageId);\n\n return {\n messageId: response.messageId,\n status: response.status,\n };\n }\n}\n"],"names":["EmailMessageMapper","coreClient","Mappers.SendStatusResult","Mappers.EmailGetSendStatusHeaders","Mappers.CommunicationErrorResponse","Mappers.EmailGetSendStatusExceptionHeaders","Parameters.apiVersion","Parameters.endpoint","Parameters.messageId","Parameters.accept","Mappers.EmailSendHeaders","Mappers.EmailSendExceptionHeaders","Parameters.emailMessage","Parameters.contentType","Parameters.repeatabilityRequestId","Parameters.repeatabilityFirstSent","createClientLogger","isKeyCredential","parseClientArguments","createCommunicationAuthPolicy","uuid"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;AAMG;AAII,MAAM,gBAAgB,GAA+B;AAC1D,IAAA,IAAI,EAAE;AACJ,QAAA,IAAI,EAAE,WAAW;AACjB,QAAA,SAAS,EAAE,kBAAkB;AAC7B,QAAA,eAAe,EAAE;AACf,YAAA,SAAS,EAAE;AACT,gBAAA,cAAc,EAAE,WAAW;AAC3B,gBAAA,QAAQ,EAAE,IAAI;AACd,gBAAA,IAAI,EAAE;AACJ,oBAAA,IAAI,EAAE,QAAQ;AACf,iBAAA;AACF,aAAA;AACD,YAAA,MAAM,EAAE;AACN,gBAAA,cAAc,EAAE,QAAQ;AACxB,gBAAA,QAAQ,EAAE,IAAI;AACd,gBAAA,IAAI,EAAE;AACJ,oBAAA,IAAI,EAAE,QAAQ;AACf,iBAAA;AACF,aAAA;AACF,SAAA;AACF,KAAA;CACF,CAAC;AAEK,MAAM,0BAA0B,GAA+B;AACpE,IAAA,IAAI,EAAE;AACJ,QAAA,IAAI,EAAE,WAAW;AACjB,QAAA,SAAS,EAAE,4BAA4B;AACvC,QAAA,eAAe,EAAE;AACf,YAAA,KAAK,EAAE;AACL,gBAAA,cAAc,EAAE,OAAO;AACvB,gBAAA,IAAI,EAAE;AACJ,oBAAA,IAAI,EAAE,WAAW;AACjB,oBAAA,SAAS,EAAE,oBAAoB;AAChC,iBAAA;AACF,aAAA;AACF,SAAA;AACF,KAAA;CACF,CAAC;AAEK,MAAM,kBAAkB,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AAe,CAAC,KAAK,CAAC,IAAI,CACpDC,OAAI,EAAE,EACN,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EACxB,YAAY,CACb,CAAC;QAEF,OAAO;AACL,YAAA,SAAS,EAAE,CAAA,EAAA,GAAA,QAAQ,CAAC,YAAY,mCAAI,EAAE;SACvC,CAAC;KACH;AAED;;;AAGG;IACI,MAAM,aAAa,CAAC,SAAiB,EAAA;AAC1C,QAAA,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;QAE3E,OAAO;YACL,SAAS,EAAE,QAAQ,CAAC,SAAS;YAC7B,MAAM,EAAE,QAAQ,CAAC,MAAM;SACxB,CAAC;KACH;AACF;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../src/generated/src/models/mappers.ts","../src/generated/src/models/parameters.ts","../src/generated/src/operations/email.ts","../src/generated/src/emailRestApiClient.ts","../src/logger.ts","../src/emailClient.ts"],"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 coreClient from \"@azure/core-client\";\n\nexport const SendStatusResult: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"SendStatusResult\",\n modelProperties: {\n messageId: {\n serializedName: \"messageId\",\n required: true,\n type: {\n name: \"String\"\n }\n },\n status: {\n serializedName: \"status\",\n required: true,\n type: {\n name: \"String\"\n }\n }\n }\n }\n};\n\nexport const CommunicationErrorResponse: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"CommunicationErrorResponse\",\n modelProperties: {\n error: {\n serializedName: \"error\",\n type: {\n name: \"Composite\",\n className: \"CommunicationError\"\n }\n }\n }\n }\n};\n\nexport const CommunicationError: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"CommunicationError\",\n modelProperties: {\n code: {\n serializedName: \"code\",\n required: true,\n type: {\n name: \"String\"\n }\n },\n message: {\n serializedName: \"message\",\n required: true,\n type: {\n name: \"String\"\n }\n },\n target: {\n serializedName: \"target\",\n readOnly: true,\n type: {\n name: \"String\"\n }\n },\n details: {\n serializedName: \"details\",\n readOnly: true,\n type: {\n name: \"Sequence\",\n element: {\n type: {\n name: \"Composite\",\n className: \"CommunicationError\"\n }\n }\n }\n },\n innerError: {\n serializedName: \"innererror\",\n type: {\n name: \"Composite\",\n className: \"CommunicationError\"\n }\n }\n }\n }\n};\n\nexport const EmailMessage: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"EmailMessage\",\n modelProperties: {\n customHeaders: {\n serializedName: \"headers\",\n type: {\n name: \"Sequence\",\n element: {\n type: {\n name: \"Composite\",\n className: \"EmailCustomHeader\"\n }\n }\n }\n },\n sender: {\n serializedName: \"sender\",\n required: true,\n type: {\n name: \"String\"\n }\n },\n content: {\n serializedName: \"content\",\n type: {\n name: \"Composite\",\n className: \"EmailContent\"\n }\n },\n importance: {\n defaultValue: \"normal\",\n serializedName: \"importance\",\n type: {\n name: \"String\"\n }\n },\n recipients: {\n serializedName: \"recipients\",\n type: {\n name: \"Composite\",\n className: \"EmailRecipients\"\n }\n },\n attachments: {\n serializedName: \"attachments\",\n type: {\n name: \"Sequence\",\n element: {\n type: {\n name: \"Composite\",\n className: \"EmailAttachment\"\n }\n }\n }\n },\n replyTo: {\n serializedName: \"replyTo\",\n type: {\n name: \"Sequence\",\n element: {\n type: {\n name: \"Composite\",\n className: \"EmailAddress\"\n }\n }\n }\n },\n disableUserEngagementTracking: {\n serializedName: \"disableUserEngagementTracking\",\n type: {\n name: \"Boolean\"\n }\n }\n }\n }\n};\n\nexport const EmailCustomHeader: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"EmailCustomHeader\",\n modelProperties: {\n name: {\n serializedName: \"name\",\n required: true,\n type: {\n name: \"String\"\n }\n },\n value: {\n serializedName: \"value\",\n required: true,\n type: {\n name: \"String\"\n }\n }\n }\n }\n};\n\nexport const EmailContent: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"EmailContent\",\n modelProperties: {\n subject: {\n serializedName: \"subject\",\n required: true,\n type: {\n name: \"String\"\n }\n },\n plainText: {\n serializedName: \"plainText\",\n type: {\n name: \"String\"\n }\n },\n html: {\n serializedName: \"html\",\n type: {\n name: \"String\"\n }\n }\n }\n }\n};\n\nexport const EmailRecipients: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"EmailRecipients\",\n modelProperties: {\n to: {\n serializedName: \"to\",\n type: {\n name: \"Sequence\",\n element: {\n type: {\n name: \"Composite\",\n className: \"EmailAddress\"\n }\n }\n }\n },\n cc: {\n serializedName: \"CC\",\n type: {\n name: \"Sequence\",\n element: {\n type: {\n name: \"Composite\",\n className: \"EmailAddress\"\n }\n }\n }\n },\n bcc: {\n serializedName: \"bCC\",\n type: {\n name: \"Sequence\",\n element: {\n type: {\n name: \"Composite\",\n className: \"EmailAddress\"\n }\n }\n }\n }\n }\n }\n};\n\nexport const EmailAddress: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"EmailAddress\",\n modelProperties: {\n email: {\n serializedName: \"email\",\n required: true,\n type: {\n name: \"String\"\n }\n },\n displayName: {\n serializedName: \"displayName\",\n type: {\n name: \"String\"\n }\n }\n }\n }\n};\n\nexport const EmailAttachment: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"EmailAttachment\",\n modelProperties: {\n name: {\n serializedName: \"name\",\n required: true,\n type: {\n name: \"String\"\n }\n },\n attachmentType: {\n serializedName: \"attachmentType\",\n required: true,\n type: {\n name: \"String\"\n }\n },\n contentBytesBase64: {\n serializedName: \"contentBytesBase64\",\n required: true,\n type: {\n name: \"String\"\n }\n }\n }\n }\n};\n\nexport const EmailGetSendStatusHeaders: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"EmailGetSendStatusHeaders\",\n modelProperties: {\n retryAfter: {\n serializedName: \"retry-after\",\n type: {\n name: \"Number\"\n }\n }\n }\n }\n};\n\nexport const EmailGetSendStatusExceptionHeaders: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"EmailGetSendStatusExceptionHeaders\",\n modelProperties: {\n xMsErrorCode: {\n serializedName: \"x-ms-error-code\",\n type: {\n name: \"String\"\n }\n }\n }\n }\n};\n\nexport const EmailSendHeaders: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"EmailSendHeaders\",\n modelProperties: {\n repeatabilityResult: {\n serializedName: \"repeatability-result\",\n type: {\n name: \"String\"\n }\n },\n operationLocation: {\n serializedName: \"operation-location\",\n type: {\n name: \"String\"\n }\n },\n retryAfter: {\n serializedName: \"retry-after\",\n type: {\n name: \"Number\"\n }\n },\n xMsRequestId: {\n serializedName: \"x-ms-request-id\",\n type: {\n name: \"String\"\n }\n }\n }\n }\n};\n\nexport const EmailSendExceptionHeaders: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"EmailSendExceptionHeaders\",\n modelProperties: {\n xMsErrorCode: {\n serializedName: \"x-ms-error-code\",\n type: {\n name: \"String\"\n }\n }\n }\n }\n};\n","/*\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 {\n OperationParameter,\n OperationURLParameter,\n OperationQueryParameter\n} from \"@azure/core-client\";\nimport { EmailMessage as EmailMessageMapper } from \"../models/mappers\";\n\nexport const accept: OperationParameter = {\n parameterPath: \"accept\",\n mapper: {\n defaultValue: \"application/json\",\n isConstant: true,\n serializedName: \"Accept\",\n type: {\n name: \"String\"\n }\n }\n};\n\nexport const endpoint: OperationURLParameter = {\n parameterPath: \"endpoint\",\n mapper: {\n serializedName: \"endpoint\",\n required: true,\n type: {\n name: \"String\"\n }\n },\n skipEncoding: true\n};\n\nexport const messageId: OperationURLParameter = {\n parameterPath: \"messageId\",\n mapper: {\n serializedName: \"messageId\",\n required: true,\n type: {\n name: \"String\"\n }\n }\n};\n\nexport const apiVersion: OperationQueryParameter = {\n parameterPath: \"apiVersion\",\n mapper: {\n defaultValue: \"2021-10-01-preview\",\n isConstant: true,\n serializedName: \"api-version\",\n type: {\n name: \"String\"\n }\n }\n};\n\nexport const contentType: OperationParameter = {\n parameterPath: [\"options\", \"contentType\"],\n mapper: {\n defaultValue: \"application/json\",\n isConstant: true,\n serializedName: \"Content-Type\",\n type: {\n name: \"String\"\n }\n }\n};\n\nexport const emailMessage: OperationParameter = {\n parameterPath: \"emailMessage\",\n mapper: EmailMessageMapper\n};\n\nexport const repeatabilityRequestId: OperationParameter = {\n parameterPath: \"repeatabilityRequestId\",\n mapper: {\n serializedName: \"repeatability-request-id\",\n required: true,\n type: {\n name: \"String\"\n }\n }\n};\n\nexport const repeatabilityFirstSent: OperationParameter = {\n parameterPath: \"repeatabilityFirstSent\",\n mapper: {\n serializedName: \"repeatability-first-sent\",\n required: true,\n type: {\n name: \"String\"\n }\n }\n};\n","/*\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 { Email } from \"../operationsInterfaces\";\nimport * as coreClient from \"@azure/core-client\";\nimport * as Mappers from \"../models/mappers\";\nimport * as Parameters from \"../models/parameters\";\nimport { EmailRestApiClient } from \"../emailRestApiClient\";\nimport {\n EmailGetSendStatusOptionalParams,\n EmailGetSendStatusResponse,\n EmailMessage,\n EmailSendOptionalParams,\n EmailSendResponse\n} from \"../models\";\n\n/** Class containing Email operations. */\nexport class EmailImpl implements Email {\n private readonly client: EmailRestApiClient;\n\n /**\n * Initialize a new instance of the class Email class.\n * @param client Reference to the service client\n */\n constructor(client: EmailRestApiClient) {\n this.client = client;\n }\n\n /**\n * Gets the status of a message sent previously.\n * @param messageId System generated message id (GUID) returned from a previous call to send email\n * @param options The options parameters.\n */\n getSendStatus(\n messageId: string,\n options?: EmailGetSendStatusOptionalParams\n ): Promise<EmailGetSendStatusResponse> {\n return this.client.sendOperationRequest(\n { messageId, options },\n getSendStatusOperationSpec\n );\n }\n\n /**\n * Queues an email message to be sent to one or more recipients\n * @param repeatabilityRequestId If specified, the client directs that the request is repeatable; that\n * is, that the client can make the request multiple times with the same Repeatability-Request-Id and\n * get back an appropriate response without the server executing the request multiple times. The value\n * of the Repeatability-Request-Id is an opaque string representing a client-generated, globally unique\n * for all time, identifier for the request. It is recommended to use version 4 (random) UUIDs.\n * @param repeatabilityFirstSent Must be sent by clients to specify that a request is repeatable.\n * Repeatability-First-Sent is used to specify the date and time at which the request was first created\n * in the IMF-fix date form of HTTP-date as defined in RFC7231. eg- Tue, 26 Mar 2019 16:06:51 GMT\n * @param emailMessage Message payload for sending an email\n * @param options The options parameters.\n */\n send(\n repeatabilityRequestId: string,\n repeatabilityFirstSent: string,\n emailMessage: EmailMessage,\n options?: EmailSendOptionalParams\n ): Promise<EmailSendResponse> {\n return this.client.sendOperationRequest(\n { repeatabilityRequestId, repeatabilityFirstSent, emailMessage, options },\n sendOperationSpec\n );\n }\n}\n// Operation Specifications\nconst serializer = coreClient.createSerializer(Mappers, /* isXml */ false);\n\nconst getSendStatusOperationSpec: coreClient.OperationSpec = {\n path: \"/emails/{messageId}/status\",\n httpMethod: \"GET\",\n responses: {\n 200: {\n bodyMapper: Mappers.SendStatusResult,\n headersMapper: Mappers.EmailGetSendStatusHeaders\n },\n default: {\n bodyMapper: Mappers.CommunicationErrorResponse,\n headersMapper: Mappers.EmailGetSendStatusExceptionHeaders\n }\n },\n queryParameters: [Parameters.apiVersion],\n urlParameters: [Parameters.endpoint, Parameters.messageId],\n headerParameters: [Parameters.accept],\n serializer\n};\nconst sendOperationSpec: coreClient.OperationSpec = {\n path: \"/emails:send\",\n httpMethod: \"POST\",\n responses: {\n 202: {\n headersMapper: Mappers.EmailSendHeaders\n },\n default: {\n bodyMapper: Mappers.CommunicationErrorResponse,\n headersMapper: Mappers.EmailSendExceptionHeaders\n }\n },\n requestBody: Parameters.emailMessage,\n queryParameters: [Parameters.apiVersion],\n urlParameters: [Parameters.endpoint],\n headerParameters: [\n Parameters.accept,\n Parameters.contentType,\n Parameters.repeatabilityRequestId,\n Parameters.repeatabilityFirstSent\n ],\n mediaType: \"json\",\n serializer\n};\n","/*\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 coreClient from \"@azure/core-client\";\nimport {\n PipelineRequest,\n PipelineResponse,\n SendRequest\n} from \"@azure/core-rest-pipeline\";\nimport { EmailImpl } from \"./operations\";\nimport { Email } from \"./operationsInterfaces\";\nimport { EmailRestApiClientOptionalParams } from \"./models\";\n\nexport class EmailRestApiClient extends coreClient.ServiceClient {\n endpoint: string;\n apiVersion: string;\n\n /**\n * Initializes a new instance of the EmailRestApiClient 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 const defaults: EmailRestApiClientOptionalParams = {\n requestContentType: \"application/json; charset=utf-8\"\n };\n\n const packageDetails = `azsdk-js-communication-email/1.0.0-beta.2`;\n const userAgentPrefix =\n options.userAgentOptions && options.userAgentOptions.userAgentPrefix\n ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`\n : `${packageDetails}`;\n\n const optionsWithDefaults = {\n ...defaults,\n ...options,\n userAgentOptions: {\n userAgentPrefix\n },\n baseUri: options.endpoint ?? options.baseUri ?? \"{endpoint}\"\n };\n super(optionsWithDefaults);\n // Parameter assignments\n this.endpoint = endpoint;\n\n // Assigning values to Constant parameters\n this.apiVersion = options.apiVersion || \"2021-10-01-preview\";\n this.email = new EmailImpl(this);\n this.addCustomApiVersionPolicy(options.apiVersion);\n }\n\n /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */\n private addCustomApiVersionPolicy(apiVersion?: string) {\n if (!apiVersion) {\n return;\n }\n const apiVersionPolicy = {\n name: \"CustomApiVersionPolicy\",\n async sendRequest(\n request: PipelineRequest,\n next: SendRequest\n ): Promise<PipelineResponse> {\n const param = request.url.split(\"?\");\n if (param.length > 1) {\n const newParams = param[1].split(\"&\").map((item) => {\n if (item.indexOf(\"api-version\") > -1) {\n return \"api-version=\" + apiVersion;\n } else {\n return item;\n }\n });\n request.url = param[0] + \"?\" + newParams.join(\"&\");\n }\n return next(request);\n }\n };\n this.pipeline.addPolicy(apiVersionPolicy);\n }\n\n email: Email;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createClientLogger } from \"@azure/logger\";\n\n/**\n * The \\@azure/logger configuration for this package.\n */\nexport const logger = createClientLogger(\"communication-email\");\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { EmailClientOptions, EmailMessage, SendEmailResult, SendStatusResult } from \"./models\";\nimport { KeyCredential, TokenCredential, isTokenCredential } from \"@azure/core-auth\";\nimport {\n createCommunicationAuthPolicy,\n isKeyCredential,\n parseClientArguments,\n} from \"@azure/communication-common\";\nimport { EmailRestApiClient } from \"./generated/src/emailRestApiClient\";\nimport { InternalPipelineOptions } from \"@azure/core-rest-pipeline\";\nimport { logger } from \"./logger\";\nimport { v4 as uuid } from \"uuid\";\n\n/**\n * Checks whether the type of a value is EmailClientOptions or not.\n *\n * @param options - The value being checked.\n */\nconst isEmailClientOptions = (options: any): options is EmailClientOptions =>\n !!options && !isTokenCredential(options) && !isKeyCredential(options);\n\n/**\n * The Email service client.\n */\nexport class EmailClient {\n private readonly generatedClient: EmailRestApiClient;\n\n /**\n * Initializes a new instance of the EmailClient class.\n * @param connectionString - Connection string to connect to an Azure Communication Service resource.\n * Example: \"endpoint=https://contoso.eastus.communications.azure.net/;accesskey=secret\";\n * @param options - Optional. Options to configure the HTTP pipeline.\n */\n constructor(connectionString: string, options?: EmailClientOptions);\n\n /**\n * Initializes a new instance of the EmailClient class using an Azure KeyCredential.\n * @param endpoint - The endpoint of the service (ex: https://contoso.eastus.communications.azure.net).\n * @param credential - An object that is used to authenticate requests to the service. Use the Azure KeyCredential or `@azure/identity` to create a credential.\n * @param options - Optional. Options to configure the HTTP pipeline.\n */\n constructor(endpoint: string, credential: KeyCredential, options?: EmailClientOptions);\n\n /**\n * Initializes a new instance of the EmailClient class using a TokenCredential.\n * @param endpoint - The endpoint of the service (ex: https://contoso.eastus.communications.azure.net).\n * @param credential - TokenCredential that is used to authenticate requests to the service. Use the Azure KeyCredential or `@azure/identity` to create a credential.\n * @param options - Optional. Options to configure the HTTP pipeline.\n */\n constructor(endpoint: string, credential: TokenCredential, options?: EmailClientOptions);\n\n constructor(\n connectionStringOrUrl: string,\n credentialOrOptions?: EmailClientOptions | TokenCredential | KeyCredential,\n maybeOptions: EmailClientOptions = {}\n ) {\n const { url, credential } = parseClientArguments(connectionStringOrUrl, credentialOrOptions);\n const options = isEmailClientOptions(credentialOrOptions) ? credentialOrOptions : maybeOptions;\n\n const internalPipelineOptions: InternalPipelineOptions = {\n ...options,\n ...{\n loggingOptions: {\n logger: logger.info,\n },\n },\n };\n\n const authPolicy = createCommunicationAuthPolicy(credential);\n this.generatedClient = new EmailRestApiClient(url, internalPipelineOptions);\n this.generatedClient.pipeline.addPolicy(authPolicy);\n }\n\n /**\n * Queues an email message to be sent to one or more recipients\n * @param emailMessage - Message payload for sending an email\n */\n public async send(emailMessage: EmailMessage): Promise<SendEmailResult> {\n const response = await this.generatedClient.email.send(\n uuid(),\n new Date().toUTCString(),\n emailMessage\n );\n\n return {\n messageId: response.xMsRequestId ?? \"\",\n };\n }\n\n /**\n * Gets the status of a message sent previously.\n * @param messageId - System generated message id (GUID) returned from a previous call to send email\n */\n public async getSendStatus(messageId: string): Promise<SendStatusResult> {\n const response = await this.generatedClient.email.getSendStatus(messageId);\n\n return {\n messageId: response.messageId,\n status: response.status,\n };\n }\n}\n"],"names":["EmailMessageMapper","coreClient","Mappers.SendStatusResult","Mappers.EmailGetSendStatusHeaders","Mappers.CommunicationErrorResponse","Mappers.EmailGetSendStatusExceptionHeaders","Parameters.apiVersion","Parameters.endpoint","Parameters.messageId","Parameters.accept","Mappers.EmailSendHeaders","Mappers.EmailSendExceptionHeaders","Parameters.emailMessage","Parameters.contentType","Parameters.repeatabilityRequestId","Parameters.repeatabilityFirstSent","createClientLogger","isTokenCredential","isKeyCredential","parseClientArguments","createCommunicationAuthPolicy","uuid"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;AAMG;AAII,MAAM,gBAAgB,GAA+B;AAC1D,IAAA,IAAI,EAAE;AACJ,QAAA,IAAI,EAAE,WAAW;AACjB,QAAA,SAAS,EAAE,kBAAkB;AAC7B,QAAA,eAAe,EAAE;AACf,YAAA,SAAS,EAAE;AACT,gBAAA,cAAc,EAAE,WAAW;AAC3B,gBAAA,QAAQ,EAAE,IAAI;AACd,gBAAA,IAAI,EAAE;AACJ,oBAAA,IAAI,EAAE,QAAQ;AACf,iBAAA;AACF,aAAA;AACD,YAAA,MAAM,EAAE;AACN,gBAAA,cAAc,EAAE,QAAQ;AACxB,gBAAA,QAAQ,EAAE,IAAI;AACd,gBAAA,IAAI,EAAE;AACJ,oBAAA,IAAI,EAAE,QAAQ;AACf,iBAAA;AACF,aAAA;AACF,SAAA;AACF,KAAA;CACF,CAAC;AAEK,MAAM,0BAA0B,GAA+B;AACpE,IAAA,IAAI,EAAE;AACJ,QAAA,IAAI,EAAE,WAAW;AACjB,QAAA,SAAS,EAAE,4BAA4B;AACvC,QAAA,eAAe,EAAE;AACf,YAAA,KAAK,EAAE;AACL,gBAAA,cAAc,EAAE,OAAO;AACvB,gBAAA,IAAI,EAAE;AACJ,oBAA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AAC,SAAS,CAAC,UAAU,CAAC,CAAC;KACrD;AAED;;;AAGG;IACI,MAAM,IAAI,CAAC,YAA0B,EAAA;;QAC1C,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,IAAI,CACpDC,OAAI,EAAE,EACN,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EACxB,YAAY,CACb,CAAC;QAEF,OAAO;AACL,YAAA,SAAS,EAAE,CAAA,EAAA,GAAA,QAAQ,CAAC,YAAY,mCAAI,EAAE;SACvC,CAAC;KACH;AAED;;;AAGG;IACI,MAAM,aAAa,CAAC,SAAiB,EAAA;AAC1C,QAAA,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;QAE3E,OAAO;YACL,SAAS,EAAE,QAAQ,CAAC,SAAS;YAC7B,MAAM,EAAE,QAAQ,CAAC,MAAM;SACxB,CAAC;KACH;AACF;;;;"}
@@ -1,5 +1,6 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT license.
3
+ import { isTokenCredential } from "@azure/core-auth";
3
4
  import { createCommunicationAuthPolicy, isKeyCredential, parseClientArguments, } from "@azure/communication-common";
4
5
  import { EmailRestApiClient } from "./generated/src/emailRestApiClient";
5
6
  import { logger } from "./logger";
@@ -9,7 +10,7 @@ import { v4 as uuid } from "uuid";
9
10
  *
10
11
  * @param options - The value being checked.
11
12
  */
12
- const isEmailClientOptions = (options) => !!options && !isKeyCredential(options);
13
+ const isEmailClientOptions = (options) => !!options && !isTokenCredential(options) && !isKeyCredential(options);
13
14
  /**
14
15
  * The Email service client.
15
16
  */
@@ -1 +1 @@
1
- {"version":3,"file":"emailClient.js","sourceRoot":"","sources":["../../src/emailClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EACL,6BAA6B,EAC7B,eAAe,EACf,oBAAoB,GACrB,MAAM,6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,CAAC;IACJ,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,aAAa,CAAC,SAAiB;QAC1C,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;QAE3E,OAAO;YACL,SAAS,EAAE,QAAQ,CAAC,SAAS;YAC7B,MAAM,EAAE,QAAQ,CAAC,MAAM;SACxB,CAAC;IACJ,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { EmailClientOptions, EmailMessage, SendEmailResult, SendStatusResult } from \"./models\";\nimport {\n createCommunicationAuthPolicy,\n isKeyCredential,\n parseClientArguments,\n} from \"@azure/communication-common\";\nimport { EmailRestApiClient } from \"./generated/src/emailRestApiClient\";\nimport { InternalPipelineOptions } from \"@azure/core-rest-pipeline\";\nimport { KeyCredential } from \"@azure/core-auth\";\nimport { logger } from \"./logger\";\nimport { v4 as uuid } from \"uuid\";\n\n/**\n * Checks whether the type of a value is EmailClientOptions or not.\n *\n * @param options - The value being checked.\n */\nconst isEmailClientOptions = (options: any): options is EmailClientOptions =>\n !!options && !isKeyCredential(options);\n\n/**\n * The Email service client.\n */\nexport class EmailClient {\n private readonly generatedClient: EmailRestApiClient;\n\n /**\n * Initializes a new instance of the EmailClient class.\n * @param connectionString - Connection string to connect to an Azure Communication Service resource.\n * Example: \"endpoint=https://contoso.eastus.communications.azure.net/;accesskey=secret\";\n * @param options - Optional. Options to configure the HTTP pipeline.\n */\n constructor(connectionString: string, options?: EmailClientOptions);\n\n /**\n * Initializes a new instance of the EmailClient class using an Azure KeyCredential.\n * @param endpoint - The endpoint of the service (ex: https://contoso.eastus.communications.azure.net).\n * @param credential - An object that is used to authenticate requests to the service. Use the Azure KeyCredential or `@azure/identity` to create a credential.\n * @param options - Optional. Options to configure the HTTP pipeline.\n */\n constructor(endpoint: string, credential: KeyCredential, options?: EmailClientOptions);\n\n constructor(\n connectionStringOrUrl: string,\n credentialOrOptions?: EmailClientOptions | KeyCredential,\n maybeOptions: EmailClientOptions = {}\n ) {\n const { url, credential } = parseClientArguments(connectionStringOrUrl, credentialOrOptions);\n const options = isEmailClientOptions(credentialOrOptions) ? credentialOrOptions : maybeOptions;\n\n const internalPipelineOptions: InternalPipelineOptions = {\n ...options,\n ...{\n loggingOptions: {\n logger: logger.info,\n },\n },\n };\n\n const authPolicy = createCommunicationAuthPolicy(credential);\n this.generatedClient = new EmailRestApiClient(url, internalPipelineOptions);\n this.generatedClient.pipeline.addPolicy(authPolicy);\n }\n\n /**\n * Queues an email message to be sent to one or more recipients\n * @param emailMessage - Message payload for sending an email\n */\n public async send(emailMessage: EmailMessage): Promise<SendEmailResult> {\n const response = await this.generatedClient.email.send(\n uuid(),\n new Date().toUTCString(),\n emailMessage\n );\n\n return {\n messageId: response.xMsRequestId ?? \"\",\n };\n }\n\n /**\n * Gets the status of a message sent previously.\n * @param messageId - System generated message id (GUID) returned from a previous call to send email\n */\n public async getSendStatus(messageId: string): Promise<SendStatusResult> {\n const response = await this.generatedClient.email.getSendStatus(messageId);\n\n return {\n messageId: response.messageId,\n status: response.status,\n };\n }\n}\n"]}
1
+ {"version":3,"file":"emailClient.js","sourceRoot":"","sources":["../../src/emailClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAkC,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrF,OAAO,EACL,6BAA6B,EAC7B,eAAe,EACf,oBAAoB,GACrB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAExE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAElC;;;;GAIG;AACH,MAAM,oBAAoB,GAAG,CAAC,OAAY,EAAiC,EAAE,CAC3E,CAAC,CAAC,OAAO,IAAI,CAAC,iBAAi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C,MAAM;SACxB,CAAC;IACJ,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { EmailClientOptions, EmailMessage, SendEmailResult, SendStatusResult } from \"./models\";\nimport { KeyCredential, TokenCredential, isTokenCredential } from \"@azure/core-auth\";\nimport {\n createCommunicationAuthPolicy,\n isKeyCredential,\n parseClientArguments,\n} from \"@azure/communication-common\";\nimport { EmailRestApiClient } from \"./generated/src/emailRestApiClient\";\nimport { InternalPipelineOptions } from \"@azure/core-rest-pipeline\";\nimport { logger } from \"./logger\";\nimport { v4 as uuid } from \"uuid\";\n\n/**\n * Checks whether the type of a value is EmailClientOptions or not.\n *\n * @param options - The value being checked.\n */\nconst isEmailClientOptions = (options: any): options is EmailClientOptions =>\n !!options && !isTokenCredential(options) && !isKeyCredential(options);\n\n/**\n * The Email service client.\n */\nexport class EmailClient {\n private readonly generatedClient: EmailRestApiClient;\n\n /**\n * Initializes a new instance of the EmailClient class.\n * @param connectionString - Connection string to connect to an Azure Communication Service resource.\n * Example: \"endpoint=https://contoso.eastus.communications.azure.net/;accesskey=secret\";\n * @param options - Optional. Options to configure the HTTP pipeline.\n */\n constructor(connectionString: string, options?: EmailClientOptions);\n\n /**\n * Initializes a new instance of the EmailClient class using an Azure KeyCredential.\n * @param endpoint - The endpoint of the service (ex: https://contoso.eastus.communications.azure.net).\n * @param credential - An object that is used to authenticate requests to the service. Use the Azure KeyCredential or `@azure/identity` to create a credential.\n * @param options - Optional. Options to configure the HTTP pipeline.\n */\n constructor(endpoint: string, credential: KeyCredential, options?: EmailClientOptions);\n\n /**\n * Initializes a new instance of the EmailClient class using a TokenCredential.\n * @param endpoint - The endpoint of the service (ex: https://contoso.eastus.communications.azure.net).\n * @param credential - TokenCredential that is used to authenticate requests to the service. Use the Azure KeyCredential or `@azure/identity` to create a credential.\n * @param options - Optional. Options to configure the HTTP pipeline.\n */\n constructor(endpoint: string, credential: TokenCredential, options?: EmailClientOptions);\n\n constructor(\n connectionStringOrUrl: string,\n credentialOrOptions?: EmailClientOptions | TokenCredential | KeyCredential,\n maybeOptions: EmailClientOptions = {}\n ) {\n const { url, credential } = parseClientArguments(connectionStringOrUrl, credentialOrOptions);\n const options = isEmailClientOptions(credentialOrOptions) ? credentialOrOptions : maybeOptions;\n\n const internalPipelineOptions: InternalPipelineOptions = {\n ...options,\n ...{\n loggingOptions: {\n logger: logger.info,\n },\n },\n };\n\n const authPolicy = createCommunicationAuthPolicy(credential);\n this.generatedClient = new EmailRestApiClient(url, internalPipelineOptions);\n this.generatedClient.pipeline.addPolicy(authPolicy);\n }\n\n /**\n * Queues an email message to be sent to one or more recipients\n * @param emailMessage - Message payload for sending an email\n */\n public async send(emailMessage: EmailMessage): Promise<SendEmailResult> {\n const response = await this.generatedClient.email.send(\n uuid(),\n new Date().toUTCString(),\n emailMessage\n );\n\n return {\n messageId: response.xMsRequestId ?? \"\",\n };\n }\n\n /**\n * Gets the status of a message sent previously.\n * @param messageId - System generated message id (GUID) returned from a previous call to send email\n */\n public async getSendStatus(messageId: string): Promise<SendStatusResult> {\n const response = await this.generatedClient.email.getSendStatus(messageId);\n\n return {\n messageId: response.messageId,\n status: response.status,\n };\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/generated/src/models/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAyIH,mEAAmE;AACnE,MAAM,CAAN,IAAY,eAOX;AAPD,WAAY,eAAe;IACzB,4FAA4F;IAC5F,oCAAiB,CAAA;IACjB,kEAAkE;IAClE,oDAAiC,CAAA;IACjC,0DAA0D;IAC1D,sCAAmB,CAAA;AACrB,CAAC,EAPW,eAAe,KAAf,eAAe,QAO1B;AAaD,wEAAwE;AACxE,MAAM,CAAN,IAAY,oBAOX;AAPD,WAAY,oBAAoB;IAC9B,WAAW;IACX,qCAAa,CAAA;IACb,aAAa;IACb,yCAAiB,CAAA;IACjB,UAAU;IACV,mCAAW,CAAA;AACb,CAAC,EAPW,oBAAoB,KAApB,oBAAoB,QAO/B;AAaD,4EAA4E;AAC5E,MAAM,CAAN,IAAY,wBAyDX;AAzDD,WAAY,wBAAwB;IAClC,UAAU;IACV,uCAAW,CAAA;IACX,UAAU;IACV,uCAAW,CAAA;IACX,UAAU;IACV,uCAAW,CAAA;IACX,WAAW;IACX,yCAAa,CAAA;IACb,WAAW;IACX,yCAAa,CAAA;IACb,UAAU;IACV,uCAAW,CAAA;IACX,WAAW;IACX,yCAAa,CAAA;IACb,UAAU;IACV,uCAAW,CAAA;IACX,UAAU;IACV,uCAAW,CAAA;IACX,UAAU;IACV,uCAAW,CAAA;IACX,UAAU;IACV,uCAAW,CAAA;IACX,WAAW;IACX,yCAAa,CAAA;IACb,WAAW;IACX,yCAAa,CAAA;IACb,UAAU;IACV,uCAAW,CAAA;IACX,WAAW;IACX,yCAAa,CAAA;IACb,WAAW;IACX,yCAAa,CAAA;IACb,UAAU;IACV,uCAAW,CAAA;IACX,YAAY;IACZ,2CAAe,CAAA;IACf,UAAU;IACV,uCAAW,CAAA;IACX,UAAU;IACV,uCAAW,CAAA;IACX,UAAU;IACV,uCAAW,CAAA;IACX,UAAU;IACV,uCAAW,CAAA;IACX,UAAU;IACV,uCAAW,CAAA;IACX,UAAU;IACV,uCAAW,CAAA;IACX,UAAU;IACV,uCAAW,CAAA;IACX,WAAW;IACX,yCAAa,CAAA;IACb,WAAW;IACX,yCAAa,CAAA;IACb,WAAW;IACX,yCAAa,CAAA;AACf,CAAC,EAzDW,wBAAwB,KAAxB,wBAAwB,QAyDnC","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 coreClient from \"@azure/core-client\";\n\n/** Status of an email message that was sent previously. */\nexport interface SendStatusResult {\n /** System generated id of an email message sent. */\n messageId: string;\n /** The type indicating the status of a request. */\n status: SendStatus;\n}\n\n/** The Communication Services error. */\nexport interface CommunicationErrorResponse {\n /** The Communication Services error. */\n error: CommunicationError;\n}\n\n/** The Communication Services error. */\nexport interface CommunicationError {\n /** The error code. */\n code: string;\n /** The error message. */\n message: string;\n /**\n * The error target.\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly target?: string;\n /**\n * Further details about specific errors that led to this error.\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly details?: CommunicationError[];\n /**\n * The inner error if any.\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly innerError?: CommunicationError;\n}\n\n/** Message payload for sending an email */\nexport interface EmailMessage {\n /** Custom email headers to be passed. */\n customHeaders?: EmailCustomHeader[];\n /** Sender email address from a verified domain. */\n sender: string;\n /** Email content to be sent. */\n content: EmailContent;\n /** The importance type for the email. */\n importance?: EmailImportance;\n /** Recipients for the email. */\n recipients: EmailRecipients;\n /** list of attachments */\n attachments?: EmailAttachment[];\n /** Email addresses where recipients' replies will be sent to. */\n replyTo?: EmailAddress[];\n /** 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. */\n disableUserEngagementTracking?: boolean;\n}\n\n/** Custom header for email. */\nexport interface EmailCustomHeader {\n /** Header name. */\n name: string;\n /** Header value. */\n value: string;\n}\n\n/** Content of the email. */\nexport interface EmailContent {\n /** Subject of the email message */\n subject: string;\n /** Plain text version of the email message. */\n plainText?: string;\n /** Html version of the email message. */\n html?: string;\n}\n\n/** Recipients of the email */\nexport interface EmailRecipients {\n /** Email To recipients */\n to: EmailAddress[];\n /** Email CC recipients */\n cc?: EmailAddress[];\n /** Email BCC recipients */\n bcc?: EmailAddress[];\n}\n\n/** An object representing the email address and its display name */\nexport interface EmailAddress {\n /** Email address. */\n email: string;\n /** Email display name. */\n displayName?: string;\n}\n\n/** Attachment to the email. */\nexport interface EmailAttachment {\n /** Name of the attachment */\n name: string;\n /** The type of attachment file. */\n attachmentType: EmailAttachmentType;\n /** Base64 encoded contents of the attachment */\n contentBytesBase64: string;\n}\n\n/** Defines headers for Email_getSendStatus operation. */\nexport interface EmailGetSendStatusHeaders {\n /** Amount of time client should wait before retrying the request, specified in seconds */\n retryAfter?: number;\n}\n\n/** Defines headers for Email_getSendStatus operation. */\nexport interface EmailGetSendStatusExceptionHeaders {\n /** Error code - this will be the same as the code in the error property in the response body. */\n xMsErrorCode?: string;\n}\n\n/** Defines headers for Email_send operation. */\nexport interface EmailSendHeaders {\n /** Status of a repeatable request. */\n repeatabilityResult?: string;\n /** Location url of where to poll the status of this message from. */\n operationLocation?: string;\n /** Amount of time client should wait before retrying the request, specified in seconds */\n retryAfter?: number;\n /** System generated GUID indicating the id of this specific message, to be used for tracking purposes. */\n xMsRequestId?: string;\n}\n\n/** Defines headers for Email_send operation. */\nexport interface EmailSendExceptionHeaders {\n /** Error code - this will be the same as the code in the error property in the response body. */\n xMsErrorCode?: string;\n}\n\n/** Known values of {@link SendStatus} that the service accepts. */\nexport enum KnownSendStatus {\n /** The message has passed basic validations and has been queued to be processed further. */\n Queued = \"queued\",\n /** The message has been processed and is now out for delivery. */\n OutForDelivery = \"outForDelivery\",\n /** The message could not be processed and was dropped. */\n Dropped = \"dropped\"\n}\n\n/**\n * Defines values for SendStatus. \\\n * {@link KnownSendStatus} can be used interchangeably with SendStatus,\n * this enum contains the known values that the service supports.\n * ### Known values supported by the service\n * **queued**: The message has passed basic validations and has been queued to be processed further. \\\n * **outForDelivery**: The message has been processed and is now out for delivery. \\\n * **dropped**: The message could not be processed and was dropped.\n */\nexport type SendStatus = string;\n\n/** Known values of {@link EmailImportance} that the service accepts. */\nexport enum KnownEmailImportance {\n /** High */\n High = \"high\",\n /** Normal */\n Normal = \"normal\",\n /** Low */\n Low = \"low\"\n}\n\n/**\n * Defines values for EmailImportance. \\\n * {@link KnownEmailImportance} can be used interchangeably with EmailImportance,\n * this enum contains the known values that the service supports.\n * ### Known values supported by the service\n * **high** \\\n * **normal** \\\n * **low**\n */\nexport type EmailImportance = string;\n\n/** Known values of {@link EmailAttachmentType} that the service accepts. */\nexport enum KnownEmailAttachmentType {\n /** Avi */\n Avi = \"avi\",\n /** Bmp */\n Bmp = \"bmp\",\n /** Doc */\n Doc = \"doc\",\n /** Docm */\n Docm = \"docm\",\n /** Docx */\n Docx = \"docx\",\n /** Gif */\n Gif = \"gif\",\n /** Jpeg */\n Jpeg = \"jpeg\",\n /** Mp3 */\n Mp3 = \"mp3\",\n /** One */\n One = \"one\",\n /** Pdf */\n Pdf = \"pdf\",\n /** Png */\n Png = \"png\",\n /** Ppsm */\n Ppsm = \"ppsm\",\n /** Ppsx */\n Ppsx = \"ppsx\",\n /** Ppt */\n Ppt = \"ppt\",\n /** Pptm */\n Pptm = \"pptm\",\n /** Pptx */\n Pptx = \"pptx\",\n /** Pub */\n Pub = \"pub\",\n /** Rpmsg */\n Rpmsg = \"rpmsg\",\n /** Rtf */\n Rtf = \"rtf\",\n /** Tif */\n Tif = \"tif\",\n /** Txt */\n Txt = \"txt\",\n /** Vsd */\n Vsd = \"vsd\",\n /** Wav */\n Wav = \"wav\",\n /** Wma */\n Wma = \"wma\",\n /** Xls */\n Xls = \"xls\",\n /** Xlsb */\n Xlsb = \"xlsb\",\n /** Xlsm */\n Xlsm = \"xlsm\",\n /** Xlsx */\n Xlsx = \"xlsx\"\n}\n\n/**\n * Defines values for EmailAttachmentType. \\\n * {@link KnownEmailAttachmentType} can be used interchangeably with EmailAttachmentType,\n * this enum contains the known values that the service supports.\n * ### Known values supported by the service\n * **avi** \\\n * **bmp** \\\n * **doc** \\\n * **docm** \\\n * **docx** \\\n * **gif** \\\n * **jpeg** \\\n * **mp3** \\\n * **one** \\\n * **pdf** \\\n * **png** \\\n * **ppsm** \\\n * **ppsx** \\\n * **ppt** \\\n * **pptm** \\\n * **pptx** \\\n * **pub** \\\n * **rpmsg** \\\n * **rtf** \\\n * **tif** \\\n * **txt** \\\n * **vsd** \\\n * **wav** \\\n * **wma** \\\n * **xls** \\\n * **xlsb** \\\n * **xlsm** \\\n * **xlsx**\n */\nexport type EmailAttachmentType = string;\n\n/** Optional parameters. */\nexport interface EmailGetSendStatusOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Contains response data for the getSendStatus operation. */\nexport type EmailGetSendStatusResponse = EmailGetSendStatusHeaders &\n SendStatusResult;\n\n/** Optional parameters. */\nexport interface EmailSendOptionalParams extends coreClient.OperationOptions {}\n\n/** Contains response data for the send operation. */\nexport type EmailSendResponse = EmailSendHeaders;\n\n/** Optional parameters. */\nexport interface EmailRestApiClientOptionalParams\n extends coreClient.ServiceClientOptions {\n /** Api Version */\n apiVersion?: string;\n /** Overrides client endpoint. */\n endpoint?: string;\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/generated/src/models/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAyIH,mEAAmE;AACnE,MAAM,CAAN,IAAY,eAOX;AAPD,WAAY,eAAe;IACzB,4FAA4F;IAC5F,oCAAiB,CAAA;IACjB,kEAAkE;IAClE,oDAAiC,CAAA;IACjC,0DAA0D;IAC1D,sCAAmB,CAAA;AACrB,CAAC,EAPW,eAAe,KAAf,eAAe,QAO1B;AAaD,wEAAwE;AACxE,MAAM,CAAN,IAAY,oBAOX;AAPD,WAAY,oBAAoB;IAC9B,WAAW;IACX,qCAAa,CAAA;IACb,aAAa;IACb,yCAAiB,CAAA;IACjB,UAAU;IACV,mCAAW,CAAA;AACb,CAAC,EAPW,oBAAoB,KAApB,oBAAoB,QAO/B;AAaD,4EAA4E;AAC5E,MAAM,CAAN,IAAY,wBAyDX;AAzDD,WAAY,wBAAwB;IAClC,UAAU;IACV,uCAAW,CAAA;IACX,UAAU;IACV,uCAAW,CAAA;IACX,UAAU;IACV,uCAAW,CAAA;IACX,WAAW;IACX,yCAAa,CAAA;IACb,WAAW;IACX,yCAAa,CAAA;IACb,UAAU;IACV,uCAAW,CAAA;IACX,WAAW;IACX,yCAAa,CAAA;IACb,UAAU;IACV,uCAAW,CAAA;IACX,UAAU;IACV,uCAAW,CAAA;IACX,UAAU;IACV,uCAAW,CAAA;IACX,UAAU;IACV,uCAAW,CAAA;IACX,WAAW;IACX,yCAAa,CAAA;IACb,WAAW;IACX,yCAAa,CAAA;IACb,UAAU;IACV,uCAAW,CAAA;IACX,WAAW;IACX,yCAAa,CAAA;IACb,WAAW;IACX,yCAAa,CAAA;IACb,UAAU;IACV,uCAAW,CAAA;IACX,YAAY;IACZ,2CAAe,CAAA;IACf,UAAU;IACV,uCAAW,CAAA;IACX,UAAU;IACV,uCAAW,CAAA;IACX,UAAU;IACV,uCAAW,CAAA;IACX,UAAU;IACV,uCAAW,CAAA;IACX,UAAU;IACV,uCAAW,CAAA;IACX,UAAU;IACV,uCAAW,CAAA;IACX,UAAU;IACV,uCAAW,CAAA;IACX,WAAW;IACX,yCAAa,CAAA;IACb,WAAW;IACX,yCAAa,CAAA;IACb,WAAW;IACX,yCAAa,CAAA;AACf,CAAC,EAzDW,wBAAwB,KAAxB,wBAAwB,QAyDnC","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 coreClient from \"@azure/core-client\";\n\n/** Status of an email message that was sent previously. */\nexport interface SendStatusResult {\n /** System generated id of an email message sent. */\n messageId: string;\n /** The type indicating the status of a request. */\n status: SendStatus;\n}\n\n/** The Communication Services error. */\nexport interface CommunicationErrorResponse {\n /** The Communication Services error. */\n error: CommunicationError;\n}\n\n/** The Communication Services error. */\nexport interface CommunicationError {\n /** The error code. */\n code: string;\n /** The error message. */\n message: string;\n /**\n * The error target.\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly target?: string;\n /**\n * Further details about specific errors that led to this error.\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly details?: CommunicationError[];\n /**\n * The inner error if any.\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly innerError?: CommunicationError;\n}\n\n/** Message payload for sending an email */\nexport interface EmailMessage {\n /** Custom email headers to be passed. */\n customHeaders?: EmailCustomHeader[];\n /** Sender email address from a verified domain. */\n sender: string;\n /** Email content to be sent. */\n content: EmailContent;\n /** The importance type for the email. */\n importance?: EmailImportance;\n /** Recipients for the email. */\n recipients: EmailRecipients;\n /** list of attachments */\n attachments?: EmailAttachment[];\n /** Email addresses where recipients' replies will be sent to. */\n replyTo?: EmailAddress[];\n /** 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. */\n disableUserEngagementTracking?: boolean;\n}\n\n/** Custom header for email. */\nexport interface EmailCustomHeader {\n /** Header name. */\n name: string;\n /** Header value. */\n value: string;\n}\n\n/** Content of the email. */\nexport interface EmailContent {\n /** Subject of the email message */\n subject: string;\n /** Plain text version of the email message. */\n plainText?: string;\n /** Html version of the email message. */\n html?: string;\n}\n\n/** Recipients of the email */\nexport interface EmailRecipients {\n /** Email To recipients */\n to?: EmailAddress[];\n /** Email CC recipients */\n cc?: EmailAddress[];\n /** Email BCC recipients */\n bcc?: EmailAddress[];\n}\n\n/** An object representing the email address and its display name */\nexport interface EmailAddress {\n /** Email address. */\n email: string;\n /** Email display name. */\n displayName?: string;\n}\n\n/** Attachment to the email. */\nexport interface EmailAttachment {\n /** Name of the attachment */\n name: string;\n /** The type of attachment file. */\n attachmentType: EmailAttachmentType;\n /** Base64 encoded contents of the attachment */\n contentBytesBase64: string;\n}\n\n/** Defines headers for Email_getSendStatus operation. */\nexport interface EmailGetSendStatusHeaders {\n /** Amount of time client should wait before retrying the request, specified in seconds */\n retryAfter?: number;\n}\n\n/** Defines headers for Email_getSendStatus operation. */\nexport interface EmailGetSendStatusExceptionHeaders {\n /** Error code - this will be the same as the code in the error property in the response body. */\n xMsErrorCode?: string;\n}\n\n/** Defines headers for Email_send operation. */\nexport interface EmailSendHeaders {\n /** Status of a repeatable request. */\n repeatabilityResult?: string;\n /** Location url of where to poll the status of this message from. */\n operationLocation?: string;\n /** Amount of time client should wait before retrying the request, specified in seconds */\n retryAfter?: number;\n /** System generated GUID indicating the id of this specific message, to be used for tracking purposes. */\n xMsRequestId?: string;\n}\n\n/** Defines headers for Email_send operation. */\nexport interface EmailSendExceptionHeaders {\n /** Error code - this will be the same as the code in the error property in the response body. */\n xMsErrorCode?: string;\n}\n\n/** Known values of {@link SendStatus} that the service accepts. */\nexport enum KnownSendStatus {\n /** The message has passed basic validations and has been queued to be processed further. */\n Queued = \"queued\",\n /** The message has been processed and is now out for delivery. */\n OutForDelivery = \"outForDelivery\",\n /** The message could not be processed and was dropped. */\n Dropped = \"dropped\"\n}\n\n/**\n * Defines values for SendStatus. \\\n * {@link KnownSendStatus} can be used interchangeably with SendStatus,\n * this enum contains the known values that the service supports.\n * ### Known values supported by the service\n * **queued**: The message has passed basic validations and has been queued to be processed further. \\\n * **outForDelivery**: The message has been processed and is now out for delivery. \\\n * **dropped**: The message could not be processed and was dropped.\n */\nexport type SendStatus = string;\n\n/** Known values of {@link EmailImportance} that the service accepts. */\nexport enum KnownEmailImportance {\n /** High */\n High = \"high\",\n /** Normal */\n Normal = \"normal\",\n /** Low */\n Low = \"low\"\n}\n\n/**\n * Defines values for EmailImportance. \\\n * {@link KnownEmailImportance} can be used interchangeably with EmailImportance,\n * this enum contains the known values that the service supports.\n * ### Known values supported by the service\n * **high** \\\n * **normal** \\\n * **low**\n */\nexport type EmailImportance = string;\n\n/** Known values of {@link EmailAttachmentType} that the service accepts. */\nexport enum KnownEmailAttachmentType {\n /** Avi */\n Avi = \"avi\",\n /** Bmp */\n Bmp = \"bmp\",\n /** Doc */\n Doc = \"doc\",\n /** Docm */\n Docm = \"docm\",\n /** Docx */\n Docx = \"docx\",\n /** Gif */\n Gif = \"gif\",\n /** Jpeg */\n Jpeg = \"jpeg\",\n /** Mp3 */\n Mp3 = \"mp3\",\n /** One */\n One = \"one\",\n /** Pdf */\n Pdf = \"pdf\",\n /** Png */\n Png = \"png\",\n /** Ppsm */\n Ppsm = \"ppsm\",\n /** Ppsx */\n Ppsx = \"ppsx\",\n /** Ppt */\n Ppt = \"ppt\",\n /** Pptm */\n Pptm = \"pptm\",\n /** Pptx */\n Pptx = \"pptx\",\n /** Pub */\n Pub = \"pub\",\n /** Rpmsg */\n Rpmsg = \"rpmsg\",\n /** Rtf */\n Rtf = \"rtf\",\n /** Tif */\n Tif = \"tif\",\n /** Txt */\n Txt = \"txt\",\n /** Vsd */\n Vsd = \"vsd\",\n /** Wav */\n Wav = \"wav\",\n /** Wma */\n Wma = \"wma\",\n /** Xls */\n Xls = \"xls\",\n /** Xlsb */\n Xlsb = \"xlsb\",\n /** Xlsm */\n Xlsm = \"xlsm\",\n /** Xlsx */\n Xlsx = \"xlsx\"\n}\n\n/**\n * Defines values for EmailAttachmentType. \\\n * {@link KnownEmailAttachmentType} can be used interchangeably with EmailAttachmentType,\n * this enum contains the known values that the service supports.\n * ### Known values supported by the service\n * **avi** \\\n * **bmp** \\\n * **doc** \\\n * **docm** \\\n * **docx** \\\n * **gif** \\\n * **jpeg** \\\n * **mp3** \\\n * **one** \\\n * **pdf** \\\n * **png** \\\n * **ppsm** \\\n * **ppsx** \\\n * **ppt** \\\n * **pptm** \\\n * **pptx** \\\n * **pub** \\\n * **rpmsg** \\\n * **rtf** \\\n * **tif** \\\n * **txt** \\\n * **vsd** \\\n * **wav** \\\n * **wma** \\\n * **xls** \\\n * **xlsb** \\\n * **xlsm** \\\n * **xlsx**\n */\nexport type EmailAttachmentType = string;\n\n/** Optional parameters. */\nexport interface EmailGetSendStatusOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Contains response data for the getSendStatus operation. */\nexport type EmailGetSendStatusResponse = EmailGetSendStatusHeaders &\n SendStatusResult;\n\n/** Optional parameters. */\nexport interface EmailSendOptionalParams extends coreClient.OperationOptions {}\n\n/** Contains response data for the send operation. */\nexport type EmailSendResponse = EmailSendHeaders;\n\n/** Optional parameters. */\nexport interface EmailRestApiClientOptionalParams\n extends coreClient.ServiceClientOptions {\n /** Api Version */\n apiVersion?: string;\n /** Overrides client endpoint. */\n endpoint?: string;\n}\n"]}
@@ -225,7 +225,6 @@ export const EmailRecipients = {
225
225
  modelProperties: {
226
226
  to: {
227
227
  serializedName: "to",
228
- required: true,
229
228
  type: {
230
229
  name: "Sequence",
231
230
  element: {
@@ -1 +1 @@
1
- {"version":3,"file":"mappers.js","sourceRoot":"","sources":["../../../../../src/generated/src/models/mappers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,MAAM,CAAC,MAAM,gBAAgB,GAA+B;IAC1D,IAAI,EAAE;QACJ,IAAI,EAAE,WAAW;QACjB,SAAS,EAAE,kBAAkB;QAC7B,eAAe,EAAE;YACf,SAAS,EAAE;gBACT,cAAc,EAAE,WAAW;gBAC3B,QAAQ,EAAE,IAAI;gBACd,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;iBACf;aACF;YACD,MAAM,EAAE;gBACN,cAAc,EAAE,QAAQ;gBACxB,QAAQ,EAAE,IAAI;gBACd,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;iBACf;aACF;SACF;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,0BAA0B,GAA+B;IACpE,IAAI,EAAE;QACJ,IAAI,EAAE,WAAW;QACjB,SAAS,EAAE,4BAA4B;QACvC,eAAe,EAAE;YACf,KAAK,EAAE;gBACL,cAAc,EAAE,OAAO;gBACvB,IAAI,EAAE;oBACJ,IAAI,EAAE,WAAW;oBACjB,SAAS,EAAE,oBAAoB;iBAChC;aACF;SACF;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAA+B;IAC5D,IAAI,EAAE;QACJ,IAAI,EAAE,WAAW;QACjB,SAAS,EAAE,oBAAoB;QAC/B,eAAe,EAAE;YACf,IAAI,EAAE;gBACJ,cAAc,EAAE,MAAM;gBACtB,QAAQ,EAAE,IAAI;gBACd,IAAI,EAAE;oBACJ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;gBACjC,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;iBACf;aACF;SACF;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAA+B;IAC1D,IAAI,EAAE;QACJ,IAAI,EAAE,WAAW;QACjB,SAAS,EAAE,kBAAkB;QAC7B,eAAe,EAAE;YACf,mBAAmB,EAAE;gBACnB,cAAc,EAAE,sBAAsB;gBACtC,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;iBACf;aACF;YACD,iBAAiB,EAAE;gBACjB,cAAc,EAAE,oBAAoB;gBACpC,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;iBACf;aACF;YACD,UAAU,EAAE;gBACV,cAAc,EAAE,aAAa;gBAC7B,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;iBACf;aACF;YACD,YAAY,EAAE;gBACZ,cAAc,EAAE,iBAAiB;gBACjC,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;iBACf;aACF;SACF;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAA+B;IACnE,IAAI,EAAE;QACJ,IAAI,EAAE,WAAW;QACjB,SAAS,EAAE,2BAA2B;QACtC,eAAe,EAAE;YACf,YAAY,EAAE;gBACZ,cAAc,EAAE,iBAAiB;gBACjC,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;iBACf;aACF;SACF;KACF;CACF,CAAC","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 coreClient from \"@azure/core-client\";\n\nexport const SendStatusResult: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"SendStatusResult\",\n modelProperties: {\n messageId: {\n serializedName: \"messageId\",\n required: true,\n type: {\n name: \"String\"\n }\n },\n status: {\n serializedName: \"status\",\n required: true,\n type: {\n name: \"String\"\n }\n }\n }\n }\n};\n\nexport const CommunicationErrorResponse: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"CommunicationErrorResponse\",\n modelProperties: {\n error: {\n serializedName: \"error\",\n type: {\n name: \"Composite\",\n className: \"CommunicationError\"\n }\n }\n }\n }\n};\n\nexport const CommunicationError: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"CommunicationError\",\n modelProperties: {\n code: {\n serializedName: \"code\",\n required: true,\n type: {\n name: \"String\"\n }\n },\n message: {\n serializedName: \"message\",\n required: true,\n type: {\n name: \"String\"\n }\n },\n target: {\n serializedName: \"target\",\n readOnly: true,\n type: {\n name: \"String\"\n }\n },\n details: {\n serializedName: \"details\",\n readOnly: true,\n type: {\n name: \"Sequence\",\n element: {\n type: {\n name: \"Composite\",\n className: \"CommunicationError\"\n }\n }\n }\n },\n innerError: {\n serializedName: \"innererror\",\n type: {\n name: \"Composite\",\n className: \"CommunicationError\"\n }\n }\n }\n }\n};\n\nexport const EmailMessage: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"EmailMessage\",\n modelProperties: {\n customHeaders: {\n serializedName: \"headers\",\n type: {\n name: \"Sequence\",\n element: {\n type: {\n name: \"Composite\",\n className: \"EmailCustomHeader\"\n }\n }\n }\n },\n sender: {\n serializedName: \"sender\",\n required: true,\n type: {\n name: \"String\"\n }\n },\n content: {\n serializedName: \"content\",\n type: {\n name: \"Composite\",\n className: \"EmailContent\"\n }\n },\n importance: {\n defaultValue: \"normal\",\n serializedName: \"importance\",\n type: {\n name: \"String\"\n }\n },\n recipients: {\n serializedName: \"recipients\",\n type: {\n name: \"Composite\",\n className: \"EmailRecipients\"\n }\n },\n attachments: {\n serializedName: \"attachments\",\n type: {\n name: \"Sequence\",\n element: {\n type: {\n name: \"Composite\",\n className: \"EmailAttachment\"\n }\n }\n }\n },\n replyTo: {\n serializedName: \"replyTo\",\n type: {\n name: \"Sequence\",\n element: {\n type: {\n name: \"Composite\",\n className: \"EmailAddress\"\n }\n }\n }\n },\n disableUserEngagementTracking: {\n serializedName: \"disableUserEngagementTracking\",\n type: {\n name: \"Boolean\"\n }\n }\n }\n }\n};\n\nexport const EmailCustomHeader: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"EmailCustomHeader\",\n modelProperties: {\n name: {\n serializedName: \"name\",\n required: true,\n type: {\n name: \"String\"\n }\n },\n value: {\n serializedName: \"value\",\n required: true,\n type: {\n name: \"String\"\n }\n }\n }\n }\n};\n\nexport const EmailContent: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"EmailContent\",\n modelProperties: {\n subject: {\n serializedName: \"subject\",\n required: true,\n type: {\n name: \"String\"\n }\n },\n plainText: {\n serializedName: \"plainText\",\n type: {\n name: \"String\"\n }\n },\n html: {\n serializedName: \"html\",\n type: {\n name: \"String\"\n }\n }\n }\n }\n};\n\nexport const EmailRecipients: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"EmailRecipients\",\n modelProperties: {\n to: {\n serializedName: \"to\",\n required: true,\n type: {\n name: \"Sequence\",\n element: {\n type: {\n name: \"Composite\",\n className: \"EmailAddress\"\n }\n }\n }\n },\n cc: {\n serializedName: \"CC\",\n type: {\n name: \"Sequence\",\n element: {\n type: {\n name: \"Composite\",\n className: \"EmailAddress\"\n }\n }\n }\n },\n bcc: {\n serializedName: \"bCC\",\n type: {\n name: \"Sequence\",\n element: {\n type: {\n name: \"Composite\",\n className: \"EmailAddress\"\n }\n }\n }\n }\n }\n }\n};\n\nexport const EmailAddress: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"EmailAddress\",\n modelProperties: {\n email: {\n serializedName: \"email\",\n required: true,\n type: {\n name: \"String\"\n }\n },\n displayName: {\n serializedName: \"displayName\",\n type: {\n name: \"String\"\n }\n }\n }\n }\n};\n\nexport const EmailAttachment: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"EmailAttachment\",\n modelProperties: {\n name: {\n serializedName: \"name\",\n required: true,\n type: {\n name: \"String\"\n }\n },\n attachmentType: {\n serializedName: \"attachmentType\",\n required: true,\n type: {\n name: \"String\"\n }\n },\n contentBytesBase64: {\n serializedName: \"contentBytesBase64\",\n required: true,\n type: {\n name: \"String\"\n }\n }\n }\n }\n};\n\nexport const EmailGetSendStatusHeaders: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"EmailGetSendStatusHeaders\",\n modelProperties: {\n retryAfter: {\n serializedName: \"retry-after\",\n type: {\n name: \"Number\"\n }\n }\n }\n }\n};\n\nexport const EmailGetSendStatusExceptionHeaders: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"EmailGetSendStatusExceptionHeaders\",\n modelProperties: {\n xMsErrorCode: {\n serializedName: \"x-ms-error-code\",\n type: {\n name: \"String\"\n }\n }\n }\n }\n};\n\nexport const EmailSendHeaders: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"EmailSendHeaders\",\n modelProperties: {\n repeatabilityResult: {\n serializedName: \"repeatability-result\",\n type: {\n name: \"String\"\n }\n },\n operationLocation: {\n serializedName: \"operation-location\",\n type: {\n name: \"String\"\n }\n },\n retryAfter: {\n serializedName: \"retry-after\",\n type: {\n name: \"Number\"\n }\n },\n xMsRequestId: {\n serializedName: \"x-ms-request-id\",\n type: {\n name: \"String\"\n }\n }\n }\n }\n};\n\nexport const EmailSendExceptionHeaders: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"EmailSendExceptionHeaders\",\n modelProperties: {\n xMsErrorCode: {\n serializedName: \"x-ms-error-code\",\n type: {\n name: \"String\"\n }\n }\n }\n }\n};\n"]}
1
+ {"version":3,"file":"mappers.js","sourceRoot":"","sources":["../../../../../src/generated/src/models/mappers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,MAAM,CAAC,MAAM,gBAAgB,GAA+B;IAC1D,IAAI,EAAE;QACJ,IAAI,EAAE,WAAW;QACjB,SAAS,EAAE,kBAAkB;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BACJ,IAAI,EAAE,QAAQ;iBACf;aACF;YACD,YAAY,EAAE;gBACZ,cAAc,EAAE,iBAAiB;gBACjC,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;iBACf;aACF;SACF;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAA+B;IACnE,IAAI,EAAE;QACJ,IAAI,EAAE,WAAW;QACjB,SAAS,EAAE,2BAA2B;QACtC,eAAe,EAAE;YACf,YAAY,EAAE;gBACZ,cAAc,EAAE,iBAAiB;gBACjC,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;iBACf;aACF;SACF;KACF;CACF,CAAC","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 coreClient from \"@azure/core-client\";\n\nexport const SendStatusResult: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"SendStatusResult\",\n modelProperties: {\n messageId: {\n serializedName: \"messageId\",\n required: true,\n type: {\n name: \"String\"\n }\n },\n status: {\n serializedName: \"status\",\n required: true,\n type: {\n name: \"String\"\n }\n }\n }\n }\n};\n\nexport const CommunicationErrorResponse: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"CommunicationErrorResponse\",\n modelProperties: {\n error: {\n serializedName: \"error\",\n type: {\n name: \"Composite\",\n className: \"CommunicationError\"\n }\n }\n }\n }\n};\n\nexport const CommunicationError: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"CommunicationError\",\n modelProperties: {\n code: {\n serializedName: \"code\",\n required: true,\n type: {\n name: \"String\"\n }\n },\n message: {\n serializedName: \"message\",\n required: true,\n type: {\n name: \"String\"\n }\n },\n target: {\n serializedName: \"target\",\n readOnly: true,\n type: {\n name: \"String\"\n }\n },\n details: {\n serializedName: \"details\",\n readOnly: true,\n type: {\n name: \"Sequence\",\n element: {\n type: {\n name: \"Composite\",\n className: \"CommunicationError\"\n }\n }\n }\n },\n innerError: {\n serializedName: \"innererror\",\n type: {\n name: \"Composite\",\n className: \"CommunicationError\"\n }\n }\n }\n }\n};\n\nexport const EmailMessage: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"EmailMessage\",\n modelProperties: {\n customHeaders: {\n serializedName: \"headers\",\n type: {\n name: \"Sequence\",\n element: {\n type: {\n name: \"Composite\",\n className: \"EmailCustomHeader\"\n }\n }\n }\n },\n sender: {\n serializedName: \"sender\",\n required: true,\n type: {\n name: \"String\"\n }\n },\n content: {\n serializedName: \"content\",\n type: {\n name: \"Composite\",\n className: \"EmailContent\"\n }\n },\n importance: {\n defaultValue: \"normal\",\n serializedName: \"importance\",\n type: {\n name: \"String\"\n }\n },\n recipients: {\n serializedName: \"recipients\",\n type: {\n name: \"Composite\",\n className: \"EmailRecipients\"\n }\n },\n attachments: {\n serializedName: \"attachments\",\n type: {\n name: \"Sequence\",\n element: {\n type: {\n name: \"Composite\",\n className: \"EmailAttachment\"\n }\n }\n }\n },\n replyTo: {\n serializedName: \"replyTo\",\n type: {\n name: \"Sequence\",\n element: {\n type: {\n name: \"Composite\",\n className: \"EmailAddress\"\n }\n }\n }\n },\n disableUserEngagementTracking: {\n serializedName: \"disableUserEngagementTracking\",\n type: {\n name: \"Boolean\"\n }\n }\n }\n }\n};\n\nexport const EmailCustomHeader: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"EmailCustomHeader\",\n modelProperties: {\n name: {\n serializedName: \"name\",\n required: true,\n type: {\n name: \"String\"\n }\n },\n value: {\n serializedName: \"value\",\n required: true,\n type: {\n name: \"String\"\n }\n }\n }\n }\n};\n\nexport const EmailContent: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"EmailContent\",\n modelProperties: {\n subject: {\n serializedName: \"subject\",\n required: true,\n type: {\n name: \"String\"\n }\n },\n plainText: {\n serializedName: \"plainText\",\n type: {\n name: \"String\"\n }\n },\n html: {\n serializedName: \"html\",\n type: {\n name: \"String\"\n }\n }\n }\n }\n};\n\nexport const EmailRecipients: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"EmailRecipients\",\n modelProperties: {\n to: {\n serializedName: \"to\",\n type: {\n name: \"Sequence\",\n element: {\n type: {\n name: \"Composite\",\n className: \"EmailAddress\"\n }\n }\n }\n },\n cc: {\n serializedName: \"CC\",\n type: {\n name: \"Sequence\",\n element: {\n type: {\n name: \"Composite\",\n className: \"EmailAddress\"\n }\n }\n }\n },\n bcc: {\n serializedName: \"bCC\",\n type: {\n name: \"Sequence\",\n element: {\n type: {\n name: \"Composite\",\n className: \"EmailAddress\"\n }\n }\n }\n }\n }\n }\n};\n\nexport const EmailAddress: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"EmailAddress\",\n modelProperties: {\n email: {\n serializedName: \"email\",\n required: true,\n type: {\n name: \"String\"\n }\n },\n displayName: {\n serializedName: \"displayName\",\n type: {\n name: \"String\"\n }\n }\n }\n }\n};\n\nexport const EmailAttachment: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"EmailAttachment\",\n modelProperties: {\n name: {\n serializedName: \"name\",\n required: true,\n type: {\n name: \"String\"\n }\n },\n attachmentType: {\n serializedName: \"attachmentType\",\n required: true,\n type: {\n name: \"String\"\n }\n },\n contentBytesBase64: {\n serializedName: \"contentBytesBase64\",\n required: true,\n type: {\n name: \"String\"\n }\n }\n }\n }\n};\n\nexport const EmailGetSendStatusHeaders: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"EmailGetSendStatusHeaders\",\n modelProperties: {\n retryAfter: {\n serializedName: \"retry-after\",\n type: {\n name: \"Number\"\n }\n }\n }\n }\n};\n\nexport const EmailGetSendStatusExceptionHeaders: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"EmailGetSendStatusExceptionHeaders\",\n modelProperties: {\n xMsErrorCode: {\n serializedName: \"x-ms-error-code\",\n type: {\n name: \"String\"\n }\n }\n }\n }\n};\n\nexport const EmailSendHeaders: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"EmailSendHeaders\",\n modelProperties: {\n repeatabilityResult: {\n serializedName: \"repeatability-result\",\n type: {\n name: \"String\"\n }\n },\n operationLocation: {\n serializedName: \"operation-location\",\n type: {\n name: \"String\"\n }\n },\n retryAfter: {\n serializedName: \"retry-after\",\n type: {\n name: \"Number\"\n }\n },\n xMsRequestId: {\n serializedName: \"x-ms-request-id\",\n type: {\n name: \"String\"\n }\n }\n }\n }\n};\n\nexport const EmailSendExceptionHeaders: coreClient.CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"EmailSendExceptionHeaders\",\n modelProperties: {\n xMsErrorCode: {\n serializedName: \"x-ms-error-code\",\n type: {\n name: \"String\"\n }\n }\n }\n }\n};\n"]}
@@ -128,5 +128,31 @@ describe(`EmailClient [Playback/Live]`, () => {
128
128
  assert.fail();
129
129
  }
130
130
  }).timeout(5000);
131
+ it("successfully sends an email with an empty to field", async function () {
132
+ const emailMessage = {
133
+ sender: env.SENDER_ADDRESS || "",
134
+ recipients: {
135
+ cc: [
136
+ {
137
+ email: env.RECIPIENT_ADDRESS || "",
138
+ displayName: "someRecipient",
139
+ },
140
+ ],
141
+ bcc: [
142
+ {
143
+ email: env.RECIPIENT_ADDRESS || "",
144
+ displayName: "someRecipient",
145
+ },
146
+ ],
147
+ },
148
+ content: {
149
+ subject: "someSubject",
150
+ plainText: "somePlainTextBody",
151
+ html: "<html><h1>someHtmlBody</html>",
152
+ },
153
+ };
154
+ const response = await client.send(emailMessage);
155
+ assert.isNotNull(response.messageId);
156
+ }).timeout(5000);
131
157
  });
132
158
  //# sourceMappingURL=emailClient.spec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"emailClient.spec.js","sourceRoot":"","sources":["../../../test/public/emailClient.spec.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAA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,kBAAkB,EAAE,8BAA8B;iBACnD;aACF;SACF,CAAC;QAEF,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACjD,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjB,EAAE,CAAC,sEAAsE,EAAE,KAAK;;QAC9E,MAAM,YAAY,GAAiB;YACjC,MAAM,EAAE,MAAA,GAAG,CAAC,cAAc,mCAAI,EAAE;YAChC,UAAU,EAAE;gBACV,EAAE,EAAE;oBACF;wBACE,KAAK,EAAE,MAAA,GAAG,CAAC,iBAAiB,mCAAI,EAAE;wBAClC,WAAW,EAAE,eAAe;qBAC7B;iBACF;aACF;YACD,OAAO,EAAE;gBACP,OAAO,EAAE,aAAa;gBACtB,SAAS,EAAE,mBAAmB;gBAC9B,IAAI,EAAE,+BAA+B;aACtC;SACF,CAAC;QAEF,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACjD,MAAM,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAC;QACrC,IAAI,SAAS,EAAE;YACb,MAAM,qBAAqB,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;YACpE,MAAM,CAAC,SAAS,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;SAChD;aAAM;YACL,MAAM,CAAC,IAAI,EAAE,CAAC;SACf;IACH,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AACnB,CAAC,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { EmailClient, EmailMessage } from \"../../src\";\nimport { Recorder, env } from \"@azure-tools/test-recorder\";\nimport { Context } from \"mocha\";\nimport { assert } from \"chai\";\nimport { createRecordedEmailClientWithConnectionString } from \"./utils/recordedClient\";\n\ndescribe(`EmailClient [Playback/Live]`, () => {\n let recorder: Recorder;\n let client: EmailClient;\n\n beforeEach(async function (this: Context) {\n ({ client, recorder } = await createRecordedEmailClientWithConnectionString(this));\n });\n\n afterEach(async function (this: Context) {\n if (!this.currentTest?.isPending()) {\n await recorder.stop();\n }\n });\n\n it(\"successfully sends an email to a single recipient\", async function () {\n const emailMessage: EmailMessage = {\n sender: env.SENDER_ADDRESS || \"\",\n recipients: {\n to: [\n {\n email: env.RECIPIENT_ADDRESS || \"\",\n displayName: \"someRecipient\",\n },\n ],\n },\n content: {\n subject: \"someSubject\",\n plainText: \"somePlainTextBody\",\n html: \"<html><h1>someHtmlBody</html>\",\n },\n };\n\n const response = await client.send(emailMessage);\n assert.isNotNull(response.messageId);\n }).timeout(5000);\n\n it(\"successfully sends an email to multiple types of recipients\", async function () {\n const emailMessage: EmailMessage = {\n sender: env.SENDER_ADDRESS ?? \"\",\n recipients: {\n to: [\n {\n email: env.RECIPIENT_ADDRESS ?? \"\",\n displayName: \"someRecipient\",\n },\n {\n email: env.RECIPIENT_ADDRESS ?? \"\",\n displayName: \"someRecipient\",\n },\n ],\n cc: [\n {\n email: env.RECIPIENT_ADDRESS ?? \"\",\n displayName: \"someRecipient\",\n },\n ],\n bcc: [\n {\n email: env.RECIPIENT_ADDRESS ?? \"\",\n displayName: \"someRecipient\",\n },\n ],\n },\n content: {\n subject: \"someSubject\",\n plainText: \"somePlainTextBody\",\n html: \"<html><h1>someHtmlBody</html>\",\n },\n };\n\n const response = await client.send(emailMessage);\n assert.isNotNull(response.messageId);\n }).timeout(5000);\n\n it(\"successfully sends an email with an attachment\", async function () {\n const emailMessage: EmailMessage = {\n sender: env.SENDER_ADDRESS ?? \"\",\n recipients: {\n to: [\n {\n email: env.RECIPIENT_ADDRESS ?? \"\",\n displayName: \"someRecipient\",\n },\n ],\n },\n content: {\n subject: \"someSubject\",\n plainText: \"somePlainTextBody\",\n html: \"<html><h1>someHtmlBody</html>\",\n },\n attachments: [\n {\n name: \"readme.txt\",\n attachmentType: \"txt\",\n contentBytesBase64: \"ZW1haWwgdGVzdCBhdHRhY2htZW50\",\n },\n ],\n };\n\n const response = await client.send(emailMessage);\n assert.isNotNull(response.messageId);\n }).timeout(5000);\n\n it(\"successfully retrieves the email status with the returned message id\", async function () {\n const emailMessage: EmailMessage = {\n sender: env.SENDER_ADDRESS ?? \"\",\n recipients: {\n to: [\n {\n email: env.RECIPIENT_ADDRESS ?? \"\",\n displayName: \"someRecipient\",\n },\n ],\n },\n content: {\n subject: \"someSubject\",\n plainText: \"somePlainTextBody\",\n html: \"<html><h1>someHtmlBody</html>\",\n },\n };\n\n const response = await client.send(emailMessage);\n const messageId = response.messageId;\n if (messageId) {\n const messageStatusResponse = await client.getSendStatus(messageId);\n assert.isNotNull(messageStatusResponse.status);\n } else {\n assert.fail();\n }\n }).timeout(5000);\n});\n"]}
1
+ {"version":3,"file":"emailClient.spec.js","sourceRoot":"","sources":["../../../test/public/emailClient.spec.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAY,GAAG,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,EAAE,6CAA6C,EAAE,MAAM,wBAAwB,CAAC;AAEvF,QAAQ,CAAC,6BAA6B,EAAE,GAAG,EAAE;IAC3C,IAAI,QAAkB,CAAC;IACvB,IAAI,MAAmB,CAAC;IAExB,UAAU,CAAC,KAAK;QACd,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,6CAA6C,CAAC,IAAI,CAAC,CAAC,CAAC;IACrF,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,KAAK;;QACb,IAAI,CAAC,CAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,SAAS,EAAE,CAAA,EAAE;YAClC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;SACvB;IACH,CAAC,CAAC,CAAC;IAEH,EA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,mBAAmB;gBAC9B,IAAI,EAAE,+BAA+B;aACtC;SACF,CAAC;QAEF,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACjD,MAAM,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAC;QACrC,IAAI,SAAS,EAAE;YACb,MAAM,qBAAqB,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;YACpE,MAAM,CAAC,SAAS,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;SAChD;aAAM;YACL,MAAM,CAAC,IAAI,EAAE,CAAC;SACf;IACH,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjB,EAAE,CAAC,oDAAoD,EAAE,KAAK;QAC5D,MAAM,YAAY,GAAiB;YACjC,MAAM,EAAE,GAAG,CAAC,cAAc,IAAI,EAAE;YAChC,UAAU,EAAE;gBACV,EAAE,EAAE;oBACF;wBACE,KAAK,EAAE,GAAG,CAAC,iBAAiB,IAAI,EAAE;wBAClC,WAAW,EAAE,eAAe;qBAC7B;iBACF;gBACD,GAAG,EAAE;oBACH;wBACE,KAAK,EAAE,GAAG,CAAC,iBAAiB,IAAI,EAAE;wBAClC,WAAW,EAAE,eAAe;qBAC7B;iBACF;aACF;YACD,OAAO,EAAE;gBACP,OAAO,EAAE,aAAa;gBACtB,SAAS,EAAE,mBAAmB;gBAC9B,IAAI,EAAE,+BAA+B;aACtC;SACF,CAAC;QAEF,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACjD,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AACnB,CAAC,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { EmailClient, EmailMessage } from \"../../src\";\nimport { Recorder, env } from \"@azure-tools/test-recorder\";\nimport { Context } from \"mocha\";\nimport { assert } from \"chai\";\nimport { createRecordedEmailClientWithConnectionString } from \"./utils/recordedClient\";\n\ndescribe(`EmailClient [Playback/Live]`, () => {\n let recorder: Recorder;\n let client: EmailClient;\n\n beforeEach(async function (this: Context) {\n ({ client, recorder } = await createRecordedEmailClientWithConnectionString(this));\n });\n\n afterEach(async function (this: Context) {\n if (!this.currentTest?.isPending()) {\n await recorder.stop();\n }\n });\n\n it(\"successfully sends an email to a single recipient\", async function () {\n const emailMessage: EmailMessage = {\n sender: env.SENDER_ADDRESS || \"\",\n recipients: {\n to: [\n {\n email: env.RECIPIENT_ADDRESS || \"\",\n displayName: \"someRecipient\",\n },\n ],\n },\n content: {\n subject: \"someSubject\",\n plainText: \"somePlainTextBody\",\n html: \"<html><h1>someHtmlBody</html>\",\n },\n };\n\n const response = await client.send(emailMessage);\n assert.isNotNull(response.messageId);\n }).timeout(5000);\n\n it(\"successfully sends an email to multiple types of recipients\", async function () {\n const emailMessage: EmailMessage = {\n sender: env.SENDER_ADDRESS ?? \"\",\n recipients: {\n to: [\n {\n email: env.RECIPIENT_ADDRESS ?? \"\",\n displayName: \"someRecipient\",\n },\n {\n email: env.RECIPIENT_ADDRESS ?? \"\",\n displayName: \"someRecipient\",\n },\n ],\n cc: [\n {\n email: env.RECIPIENT_ADDRESS ?? \"\",\n displayName: \"someRecipient\",\n },\n ],\n bcc: [\n {\n email: env.RECIPIENT_ADDRESS ?? \"\",\n displayName: \"someRecipient\",\n },\n ],\n },\n content: {\n subject: \"someSubject\",\n plainText: \"somePlainTextBody\",\n html: \"<html><h1>someHtmlBody</html>\",\n },\n };\n\n const response = await client.send(emailMessage);\n assert.isNotNull(response.messageId);\n }).timeout(5000);\n\n it(\"successfully sends an email with an attachment\", async function () {\n const emailMessage: EmailMessage = {\n sender: env.SENDER_ADDRESS ?? \"\",\n recipients: {\n to: [\n {\n email: env.RECIPIENT_ADDRESS ?? \"\",\n displayName: \"someRecipient\",\n },\n ],\n },\n content: {\n subject: \"someSubject\",\n plainText: \"somePlainTextBody\",\n html: \"<html><h1>someHtmlBody</html>\",\n },\n attachments: [\n {\n name: \"readme.txt\",\n attachmentType: \"txt\",\n contentBytesBase64: \"ZW1haWwgdGVzdCBhdHRhY2htZW50\",\n },\n ],\n };\n\n const response = await client.send(emailMessage);\n assert.isNotNull(response.messageId);\n }).timeout(5000);\n\n it(\"successfully retrieves the email status with the returned message id\", async function () {\n const emailMessage: EmailMessage = {\n sender: env.SENDER_ADDRESS ?? \"\",\n recipients: {\n to: [\n {\n email: env.RECIPIENT_ADDRESS ?? \"\",\n displayName: \"someRecipient\",\n },\n ],\n },\n content: {\n subject: \"someSubject\",\n plainText: \"somePlainTextBody\",\n html: \"<html><h1>someHtmlBody</html>\",\n },\n };\n\n const response = await client.send(emailMessage);\n const messageId = response.messageId;\n if (messageId) {\n const messageStatusResponse = await client.getSendStatus(messageId);\n assert.isNotNull(messageStatusResponse.status);\n } else {\n assert.fail();\n }\n }).timeout(5000);\n\n it(\"successfully sends an email with an empty to field\", async function () {\n const emailMessage: EmailMessage = {\n sender: env.SENDER_ADDRESS || \"\",\n recipients: {\n cc: [\n {\n email: env.RECIPIENT_ADDRESS || \"\",\n displayName: \"someRecipient\",\n },\n ],\n bcc: [\n {\n email: env.RECIPIENT_ADDRESS || \"\",\n displayName: \"someRecipient\",\n },\n ],\n },\n content: {\n subject: \"someSubject\",\n plainText: \"somePlainTextBody\",\n html: \"<html><h1>someHtmlBody</html>\",\n },\n };\n\n const response = await client.send(emailMessage);\n assert.isNotNull(response.messageId);\n }).timeout(5000);\n});\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure/communication-email",
3
- "version": "1.0.0-alpha.20221107.1",
3
+ "version": "1.0.0-alpha.20221124.1",
4
4
  "description": "The is the JS Client SDK for email. This SDK enables users to send emails and get the status of sent email message.",
5
5
  "author": "Microsoft Corporation",
6
6
  "license": "MIT",
@@ -1,5 +1,6 @@
1
1
  import { CommonClientOptions } from '@azure/core-client';
2
2
  import { KeyCredential } from '@azure/core-auth';
3
+ import { TokenCredential } from '@azure/core-auth';
3
4
 
4
5
  /** An object representing the email address and its display name */
5
6
  export declare interface EmailAddress {
@@ -74,6 +75,13 @@ export declare class EmailClient {
74
75
  * @param options - Optional. Options to configure the HTTP pipeline.
75
76
  */
76
77
  constructor(endpoint: string, credential: KeyCredential, options?: EmailClientOptions);
78
+ /**
79
+ * Initializes a new instance of the EmailClient class using a TokenCredential.
80
+ * @param endpoint - The endpoint of the service (ex: https://contoso.eastus.communications.azure.net).
81
+ * @param credential - TokenCredential that is used to authenticate requests to the service. Use the Azure KeyCredential or `@azure/identity` to create a credential.
82
+ * @param options - Optional. Options to configure the HTTP pipeline.
83
+ */
84
+ constructor(endpoint: string, credential: TokenCredential, options?: EmailClientOptions);
77
85
  /**
78
86
  * Queues an email message to be sent to one or more recipients
79
87
  * @param emailMessage - Message payload for sending an email
@@ -144,7 +152,7 @@ export declare interface EmailMessage {
144
152
  /** Recipients of the email */
145
153
  export declare interface EmailRecipients {
146
154
  /** Email To recipients */
147
- to: EmailAddress[];
155
+ to?: EmailAddress[];
148
156
  /** Email CC recipients */
149
157
  cc?: EmailAddress[];
150
158
  /** Email BCC recipients */