@azure/communication-sms
Version:
SDK for Azure Communication SMS service which facilitates the sending of SMS messages.
54 lines • 2.01 kB
JavaScript
;
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.SmsImpl = void 0;
const tslib_1 = require("tslib");
const tracing_js_1 = require("../tracing.js");
const coreClient = tslib_1.__importStar(require("@azure/core-client"));
const Mappers = tslib_1.__importStar(require("../models/mappers.js"));
const Parameters = tslib_1.__importStar(require("../models/parameters.js"));
/** Class containing Sms operations. */
class SmsImpl {
/**
* Initialize a new instance of the class Sms class.
* @param client Reference to the service client
*/
constructor(client) {
this.client = client;
}
/**
* Sends a SMS message from a phone number that belongs to the authenticated account.
* @param sendMessageRequest Represents the body of the send message request.
* @param options The options parameters.
*/
async send(sendMessageRequest, options) {
return tracing_js_1.tracingClient.withSpan("SmsApiClient.send", options !== null && options !== void 0 ? options : {}, async (options) => {
return this.client.sendOperationRequest({ sendMessageRequest, options }, sendOperationSpec);
});
}
}
exports.SmsImpl = SmsImpl;
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const sendOperationSpec = {
path: "/sms",
httpMethod: "POST",
responses: {
202: {
bodyMapper: Mappers.SmsSendResponse,
},
},
requestBody: Parameters.sendMessageRequest,
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.endpoint],
headerParameters: [Parameters.contentType, Parameters.accept],
mediaType: "json",
serializer,
};
//# sourceMappingURL=sms.js.map