@azure/communication-sms
Version:
SDK for Azure Communication SMS service which facilitates the sending of SMS messages.
49 lines • 1.77 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.
*/
import { tracingClient } from "../tracing.js";
import * as coreClient from "@azure/core-client";
import * as Mappers from "../models/mappers.js";
import * as Parameters from "../models/parameters.js";
/** Class containing Sms operations. */
export 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 tracingClient.withSpan("SmsApiClient.send", options !== null && options !== void 0 ? options : {}, async (options) => {
return this.client.sendOperationRequest({ sendMessageRequest, options }, sendOperationSpec);
});
}
}
// 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