@ingestkorea/client-sens
Version:
INGESTKOREA SDK Naver Cloud Platform SENS Client for Node.js.
102 lines (101 loc) • 5.03 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.de_GetAlimtalkTemplateCommand = exports.se_GetAlimtalkTemplateCommand = void 0;
const util_http_handler_1 = require("@ingestkorea/util-http-handler");
const constants_js_1 = require("./constants.js");
const ListAlimtalkTemplates_js_1 = require("./ListAlimtalkTemplates.js");
const se_GetAlimtalkTemplateCommand = async (input, config) => {
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,
path,
query,
headers,
});
};
exports.se_GetAlimtalkTemplateCommand = se_GetAlimtalkTemplateCommand;
const de_GetAlimtalkTemplateCommand = async (response, config) => {
if (response.statusCode >= 300)
await (0, constants_js_1.parseErrorBody)(response);
const data = await (0, constants_js_1.parseBody)(response);
const contents = de_GetAlimtalkTemplateResult(data);
return {
$metadata: (0, constants_js_1.deserializeMetadata)(response),
...(0, constants_js_1.compact)(contents),
};
};
exports.de_GetAlimtalkTemplateCommand = de_GetAlimtalkTemplateCommand;
const de_GetAlimtalkTemplateResult = (output) => {
return {
templates: Array.isArray(output) ? de_TemplateDetailList(output) : [],
};
};
const de_TemplateDetailList = (output) => {
return (output || []).filter((e) => e != null).map((entry) => de_TemplateDetail(entry));
};
const de_TemplateDetail = (output) => {
return {
...(0, ListAlimtalkTemplates_js_1.de_Template)(output),
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 ? de_CommentList(output.comments) : [],
templateInspectionStatus: output.templateInspectionStatus != undefined ? output.templateInspectionStatus : undefined,
templateStatus: output.templateStatus != undefined ? output.templateStatus : undefined,
buttons: output.buttons != undefined ? de_TemplateButtonExtendList(output.buttons) : [],
securityFlag: output.securityFlag !== undefined ? output.securityFlag : undefined,
isBlock: output.isBlock !== undefined ? output.isBlock : undefined,
isDormant: output.isDormant !== undefined ? output.isDormant : undefined,
};
};
const de_CommentList = (output) => {
return (output || []).filter((e) => e != null).map((entry) => de_Comment(entry));
};
const de_Comment = (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 ? (0, constants_js_1.convertToUtc)(output.createTime) : undefined,
attachment: output.attachment != undefined ? de_AttachmentList(output.attachment) : [],
};
};
const de_AttachmentList = (output) => {
return (output || []).filter((e) => e != null).map((entry) => de_Attachment(entry));
};
const de_Attachment = (output) => {
return {
fileName: output.fileName != undefined ? output.fileName : undefined,
fileUrl: output.fileUrl != undefined ? output.fileUrl : undefined,
};
};
const de_TemplateButtonExtendList = (output) => {
return (output || []).filter((e) => e != null).map((entry) => de_TemplateButtonExtend(entry));
};
const de_TemplateButtonExtend = (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,
};
};