@ingestkorea/client-sens
Version:
INGESTKOREA SDK Naver Cloud Platform SENS Client for Node.js.
65 lines (64 loc) • 3.85 kB
JavaScript
;
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.parseTemplate = exports.deserializeIngestkorea_restJson_AlimtalkTemplates = exports.deserializeIngestkorea_restJson_ListAlimtalkTemplatesOutput = exports.deserializeIngestkorea_restJson_ListAlimtalkTemplatesCommand = exports.serializeIngestkorea_restJson_ListAlimtalkTemplatesCommand = void 0;
const util_http_handler_1 = require("@ingestkorea/util-http-handler");
const constants_1 = require("./constants");
const serializeIngestkorea_restJson_ListAlimtalkTemplatesCommand = (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,
};
return new util_http_handler_1.HttpRequest({
protocol: "https:",
method: "GET",
hostname: hostname,
path: path,
query: query,
headers: headers,
});
});
exports.serializeIngestkorea_restJson_ListAlimtalkTemplatesCommand = serializeIngestkorea_restJson_ListAlimtalkTemplatesCommand;
const deserializeIngestkorea_restJson_ListAlimtalkTemplatesCommand = (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); // ListAlimtalkTemplatesOutput
let contents = {};
contents = yield (0, exports.deserializeIngestkorea_restJson_ListAlimtalkTemplatesOutput)(data);
return Object.assign({ $metadata: Object.assign(Object.assign({}, (0, constants_1.deserializeMetadata)(httpResponse)), output.$metadata) }, contents);
});
exports.deserializeIngestkorea_restJson_ListAlimtalkTemplatesCommand = deserializeIngestkorea_restJson_ListAlimtalkTemplatesCommand;
const deserializeIngestkorea_restJson_ListAlimtalkTemplatesOutput = (output) => __awaiter(void 0, void 0, void 0, function* () {
return {
templates: (0, exports.deserializeIngestkorea_restJson_AlimtalkTemplates)(output),
};
});
exports.deserializeIngestkorea_restJson_ListAlimtalkTemplatesOutput = deserializeIngestkorea_restJson_ListAlimtalkTemplatesOutput;
const deserializeIngestkorea_restJson_AlimtalkTemplates = (outputs) => {
let result = outputs.map(exports.parseTemplate);
return result;
};
exports.deserializeIngestkorea_restJson_AlimtalkTemplates = deserializeIngestkorea_restJson_AlimtalkTemplates;
const parseTemplate = (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,
};
};
exports.parseTemplate = parseTemplate;