UNPKG

@ingestkorea/client-sens

Version:

INGESTKOREA SDK Naver Cloud Platform SENS Client for Node.js.

78 lines (77 loc) 4.81 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.deserializeIngestkorea_restJson_File = exports.deserializeIngestkorea_restJson_SMSResultMessage = exports.deserializeIngestkorea_restJson_GetSMSResultOutput = exports.deserializeIngestkorea_restJson_GetSMSResultCommand = exports.serializeIngestkorea_restJson_GetSMSResultCommand = void 0; const util_http_handler_1 = require("@ingestkorea/util-http-handler"); const constants_1 = require("./constants"); const serializeIngestkorea_restJson_GetSMSResultCommand = (input, config) => __awaiter(void 0, void 0, void 0, function* () { const hostname = "sens.apigw.ntruss.com"; const path = "/sms/v2/services/" + config.serviceId.sms + "/messages" + "/" + input.messageId; const headers = { host: hostname, }; return new util_http_handler_1.HttpRequest({ protocol: "https:", method: "GET", hostname: hostname, path: path, headers: headers, }); }); exports.serializeIngestkorea_restJson_GetSMSResultCommand = serializeIngestkorea_restJson_GetSMSResultCommand; const deserializeIngestkorea_restJson_GetSMSResultCommand = (response) => __awaiter(void 0, void 0, void 0, function* () { const { response: httpResponse, output } = response; if (httpResponse.statusCode > 300) yield (0, constants_1.parseErrorBody)(httpResponse); const data = yield (0, constants_1.parseBody)(httpResponse); // GetSMSResultOutput let contents = {}; contents = yield (0, exports.deserializeIngestkorea_restJson_GetSMSResultOutput)(data); return Object.assign({ $metadata: Object.assign(Object.assign({}, (0, constants_1.deserializeMetadata)(httpResponse)), output.$metadata) }, contents); }); exports.deserializeIngestkorea_restJson_GetSMSResultCommand = deserializeIngestkorea_restJson_GetSMSResultCommand; const deserializeIngestkorea_restJson_GetSMSResultOutput = (output) => __awaiter(void 0, void 0, void 0, function* () { return { statusCode: output.statusCode ? output.statusCode : undefined, statusName: output.statusName ? output.statusName : undefined, messages: output.messages ? (0, exports.deserializeIngestkorea_restJson_SMSResultMessage)(output.messages) : undefined, }; }); exports.deserializeIngestkorea_restJson_GetSMSResultOutput = deserializeIngestkorea_restJson_GetSMSResultOutput; const deserializeIngestkorea_restJson_SMSResultMessage = (outputs) => { let result = outputs.map((output) => { return { requestTime: output.requestTime != undefined ? output.requestTime : undefined, contentType: output.contentType != undefined ? output.contentType : undefined, content: output.content != undefined ? output.content : undefined, countryCode: output.countryCode != undefined ? output.countryCode : undefined, from: output.from != undefined ? output.from : undefined, to: output.to != undefined ? output.to : undefined, status: output.status != undefined ? output.status : undefined, statusCode: output.statusCode != undefined ? output.statusCode : undefined, statusMessage: output.statusMessage != undefined ? output.statusMessage : undefined, statusName: output.statusName != undefined ? output.statusName : undefined, completeTime: output.completeTime != undefined ? output.completeTime : undefined, telcoCode: output.telcoCode != undefined ? output.telcoCode : undefined, files: output.files != undefined ? (0, exports.deserializeIngestkorea_restJson_File)(output.files) : undefined, }; }); return result; }; exports.deserializeIngestkorea_restJson_SMSResultMessage = deserializeIngestkorea_restJson_SMSResultMessage; const deserializeIngestkorea_restJson_File = (outputs) => { let result = outputs.map((output) => { return { name: output.name != undefined ? output.name : undefined, }; }); return result; }; exports.deserializeIngestkorea_restJson_File = deserializeIngestkorea_restJson_File;