UNPKG

@ingestkorea/client-sens

Version:

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

124 lines (123 loc) 7.86 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_AlimtalkTemplateButton = exports.deserializeIngestkorea_restJson_AlimtalkTemplateCommentAttachment = exports.deserializeIngestkorea_restJson_AlimtalkTemplateComment = exports.deserializeIngestkorea_restJson_AlimtalkTemplateDetail = exports.deserializeIngestkorea_restJson_GetAlimtalkTemplateOutput = exports.deserializeIngestkorea_restJson_GetAlimtalkTemplateCommand = exports.serializeIngestkorea_restJson_GetAlimtalkTemplateCommand = void 0; const util_http_handler_1 = require("@ingestkorea/util-http-handler"); const constants_1 = require("./constants"); const serializeIngestkorea_restJson_GetAlimtalkTemplateCommand = (input, config) => __awaiter(void 0, void 0, void 0, function* () { const hostname = "sens.apigw.ntruss.com"; const path = "/alimtalk/v2/services/" + config.serviceId.kakao + "/templates"; const headers = { host: hostname, }; const query = { channelId: input.channelId, templateCode: input.templateCode, }; return new util_http_handler_1.HttpRequest({ protocol: "https:", method: "GET", hostname: hostname, path: path, query: query, headers: headers, }); }); exports.serializeIngestkorea_restJson_GetAlimtalkTemplateCommand = serializeIngestkorea_restJson_GetAlimtalkTemplateCommand; const deserializeIngestkorea_restJson_GetAlimtalkTemplateCommand = (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); // GetAlimtalkTemplateOutput let contents = {}; contents = yield (0, exports.deserializeIngestkorea_restJson_GetAlimtalkTemplateOutput)(data); return Object.assign({ $metadata: Object.assign(Object.assign({}, (0, constants_1.deserializeMetadata)(httpResponse)), output.$metadata) }, contents); }); exports.deserializeIngestkorea_restJson_GetAlimtalkTemplateCommand = deserializeIngestkorea_restJson_GetAlimtalkTemplateCommand; const deserializeIngestkorea_restJson_GetAlimtalkTemplateOutput = (output) => __awaiter(void 0, void 0, void 0, function* () { return { templates: (0, exports.deserializeIngestkorea_restJson_AlimtalkTemplateDetail)(output), }; }); exports.deserializeIngestkorea_restJson_GetAlimtalkTemplateOutput = deserializeIngestkorea_restJson_GetAlimtalkTemplateOutput; const deserializeIngestkorea_restJson_AlimtalkTemplateDetail = (outputs) => { let result = outputs.map((output) => { return { createTime: output.createTime != undefined ? output.createTime : undefined, updateTime: output.updateTime != undefined ? output.updateTime : undefined, channelId: output.channelId != undefined ? output.channelId : undefined, templateCode: output.templateCode != undefined ? output.templateCode : undefined, templateName: output.templateName != undefined ? output.templateName : undefined, categoryCode: output.categoryCode != undefined ? output.categoryCode : undefined, categoryName: output.categoryName != undefined ? output.categoryName : undefined, messageType: output.messageType != undefined ? output.messageType : undefined, emphasizeType: output.emphasizeType != undefined ? output.emphasizeType : undefined, content: output.content != undefined ? output.content : undefined, adContent: output.adContent != undefined ? output.adContent : undefined, extraContent: output.extraContent != undefined ? output.extraContent : undefined, title: output.title != undefined ? output.title : undefined, additionalTitle: output.additionalTitle != undefined ? output.additionalTitle : undefined, comments: output.comments != undefined ? (0, exports.deserializeIngestkorea_restJson_AlimtalkTemplateComment)(output.comments) : undefined, templateInspectionStatus: output.templateInspectionStatus != undefined ? output.templateInspectionStatus : undefined, templateStatus: output.templateStatus != undefined ? output.templateStatus : undefined, buttons: output.buttons != undefined ? (0, exports.deserializeIngestkorea_restJson_AlimtalkTemplateButton)(output.buttons) : undefined, securityFlag: output.securityFlag != null ? output.securityFlag : undefined, isBlock: output.isBlock != null ? output.isBlock : undefined, isDormant: output.isDormant != null ? output.isDormant : undefined, }; }); return result; }; exports.deserializeIngestkorea_restJson_AlimtalkTemplateDetail = deserializeIngestkorea_restJson_AlimtalkTemplateDetail; const deserializeIngestkorea_restJson_AlimtalkTemplateComment = (outputs) => { let result = outputs.map((output) => { return { commentId: output.commentId != undefined ? output.commentId : undefined, content: output.content != undefined ? output.content : undefined, status: output.status != undefined ? output.status : undefined, createTime: output.createTime != undefined ? output.createTime : undefined, attachment: output.attachment != undefined ? (0, exports.deserializeIngestkorea_restJson_AlimtalkTemplateCommentAttachment)(output.attachment) : undefined, }; }); return result; }; exports.deserializeIngestkorea_restJson_AlimtalkTemplateComment = deserializeIngestkorea_restJson_AlimtalkTemplateComment; const deserializeIngestkorea_restJson_AlimtalkTemplateCommentAttachment = (outputs) => { let result = outputs.map((output) => { return { fileName: output.fileName != undefined ? output.fileName : undefined, fileUrl: output.fileUrl != undefined ? output.fileUrl : undefined, }; }); return result; }; exports.deserializeIngestkorea_restJson_AlimtalkTemplateCommentAttachment = deserializeIngestkorea_restJson_AlimtalkTemplateCommentAttachment; const deserializeIngestkorea_restJson_AlimtalkTemplateButton = (outputs) => { let result = outputs.map((output) => { return { order: output.order != undefined ? output.order : undefined, type: output.type != undefined ? output.type : undefined, name: output.name != undefined ? output.name : undefined, linkMobile: output.linkMobile != undefined ? output.linkMobile : undefined, linkPc: output.linkPc != undefined ? output.linkPc : undefined, schemeIos: output.schemeIos != undefined ? output.schemeIos : undefined, schemeAndroid: output.schemeAndroid != undefined ? output.schemeAndroid : undefined, }; }); return result; }; exports.deserializeIngestkorea_restJson_AlimtalkTemplateButton = deserializeIngestkorea_restJson_AlimtalkTemplateButton;