@ingestkorea/client-sens 1.5.2 → 1.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/pull_request_template.md +6 -1
- package/.prettierignore +3 -0
- package/LICENSE +2 -2
- package/README.md +56 -38
- package/dist-cjs/commands/GetAlimtalkResultCommand.js +4 -7
- package/dist-cjs/commands/GetAlimtalkStatusCommand.js +4 -7
- package/dist-cjs/commands/GetAlimtalkTemplateCommand.js +4 -7
- package/dist-cjs/commands/GetSMSResultCommand.js +4 -6
- package/dist-cjs/commands/GetSMSStatusCommand.js +4 -6
- package/dist-cjs/commands/ListAlimtalkChannelsCommand.js +4 -7
- package/dist-cjs/commands/ListAlimtalkTemplatesCommand.js +4 -7
- package/dist-cjs/commands/SendAlimtalkCommand.js +8 -9
- package/dist-cjs/commands/SendMMSCommand.js +40 -30
- package/dist-cjs/commands/SendSMSCommand.js +19 -18
- package/dist-cjs/commands/constants.js +2 -2
- package/dist-cjs/middleware/metadata-ingestkorea.js +2 -2
- package/dist-cjs/middleware/signer-ncp.js +3 -7
- package/dist-cjs/models/GetAlimtalkResult.js +0 -3
- package/dist-cjs/models/GetAlimtalkStatus.js +0 -3
- package/dist-cjs/models/GetAlimtalkTemplate.js +0 -2
- package/dist-cjs/models/GetSMSResult.js +0 -4
- package/dist-cjs/models/GetSMSStatus.js +0 -3
- package/dist-cjs/models/ListAlimtalkChannels.js +0 -3
- package/dist-cjs/models/ListAlimtalkTemplates.js +0 -5
- package/dist-cjs/models/SendAlimtalk.js +0 -5
- package/dist-cjs/models/SendMMS.js +0 -2
- package/dist-cjs/models/SendSMS.js +0 -2
- package/dist-cjs/models/SensCommand.js +0 -2
- package/dist-cjs/protocols/GetAlimtalkResult.js +7 -6
- package/dist-cjs/protocols/GetAlimtalkStatus.js +8 -7
- package/dist-cjs/protocols/GetAlimtalkTemplate.js +6 -6
- package/dist-cjs/protocols/GetSMSResult.js +11 -9
- package/dist-cjs/protocols/GetSMSStatus.js +9 -7
- package/dist-cjs/protocols/ListAlimtalkChannels.js +7 -7
- package/dist-cjs/protocols/ListAlimtalkTemplates.js +16 -15
- package/dist-cjs/protocols/SendAlimtalk.js +9 -8
- package/dist-cjs/protocols/SendMMS.js +5 -5
- package/dist-cjs/protocols/SendSMS.js +5 -5
- package/dist-cjs/protocols/constants.js +10 -7
- package/dist-es/commands/GetAlimtalkResultCommand.js +8 -11
- package/dist-es/commands/GetAlimtalkStatusCommand.js +8 -11
- package/dist-es/commands/GetAlimtalkTemplateCommand.js +8 -11
- package/dist-es/commands/GetSMSResultCommand.js +8 -10
- package/dist-es/commands/GetSMSStatusCommand.js +8 -10
- package/dist-es/commands/ListAlimtalkChannelsCommand.js +8 -11
- package/dist-es/commands/ListAlimtalkTemplatesCommand.js +8 -11
- package/dist-es/commands/SendAlimtalkCommand.js +13 -14
- package/dist-es/commands/SendMMSCommand.js +48 -38
- package/dist-es/commands/SendSMSCommand.js +23 -22
- package/dist-es/commands/constants.js +2 -2
- package/dist-es/commands/index.js +10 -10
- package/dist-es/middleware/index.js +2 -2
- package/dist-es/middleware/metadata-ingestkorea.js +3 -3
- package/dist-es/middleware/signer-ncp.js +7 -11
- package/dist-es/models/GetAlimtalkResult.js +0 -3
- package/dist-es/models/GetAlimtalkStatus.js +0 -3
- package/dist-es/models/GetAlimtalkTemplate.js +0 -2
- package/dist-es/models/GetSMSResult.js +0 -4
- package/dist-es/models/GetSMSStatus.js +0 -3
- package/dist-es/models/ListAlimtalkChannels.js +0 -3
- package/dist-es/models/ListAlimtalkTemplates.js +0 -5
- package/dist-es/models/SendAlimtalk.js +0 -5
- package/dist-es/models/SendMMS.js +0 -2
- package/dist-es/models/SendSMS.js +0 -2
- package/dist-es/models/SensCommand.js +0 -2
- package/dist-es/models/index.js +11 -11
- package/dist-es/protocols/GetAlimtalkResult.js +10 -9
- package/dist-es/protocols/GetAlimtalkStatus.js +11 -10
- package/dist-es/protocols/GetAlimtalkTemplate.js +10 -10
- package/dist-es/protocols/GetSMSResult.js +14 -12
- package/dist-es/protocols/GetSMSStatus.js +12 -10
- package/dist-es/protocols/ListAlimtalkChannels.js +10 -10
- package/dist-es/protocols/ListAlimtalkTemplates.js +19 -18
- package/dist-es/protocols/SendAlimtalk.js +12 -11
- package/dist-es/protocols/SendMMS.js +8 -8
- package/dist-es/protocols/SendSMS.js +9 -9
- package/dist-es/protocols/constants.js +12 -9
- package/dist-es/protocols/index.js +10 -10
- package/dist-types/commands/GetAlimtalkResultCommand.d.ts +3 -3
- package/dist-types/commands/GetAlimtalkStatusCommand.d.ts +3 -3
- package/dist-types/commands/GetAlimtalkTemplateCommand.d.ts +3 -3
- package/dist-types/commands/GetSMSResultCommand.d.ts +3 -3
- package/dist-types/commands/GetSMSStatusCommand.d.ts +3 -3
- package/dist-types/commands/ListAlimtalkChannelsCommand.d.ts +3 -3
- package/dist-types/commands/ListAlimtalkTemplatesCommand.d.ts +3 -3
- package/dist-types/commands/SendAlimtalkCommand.d.ts +3 -3
- package/dist-types/commands/SendMMSCommand.d.ts +3 -3
- package/dist-types/commands/SendSMSCommand.d.ts +3 -3
- package/dist-types/commands/index.d.ts +10 -10
- package/dist-types/middleware/index.d.ts +2 -2
- package/dist-types/middleware/metadata-ingestkorea.d.ts +2 -2
- package/dist-types/middleware/signer-ncp.d.ts +2 -2
- package/dist-types/models/GetAlimtalkResult.d.ts +1 -1
- package/dist-types/models/GetAlimtalkStatus.d.ts +1 -1
- package/dist-types/models/GetAlimtalkTemplate.d.ts +1 -1
- package/dist-types/models/SendMMS.d.ts +1 -1
- package/dist-types/models/SendSMS.d.ts +3 -3
- package/dist-types/models/SensCommand.d.ts +1 -1
- package/dist-types/models/index.d.ts +11 -11
- package/dist-types/protocols/GetAlimtalkResult.d.ts +4 -4
- package/dist-types/protocols/GetAlimtalkStatus.d.ts +4 -4
- package/dist-types/protocols/GetAlimtalkTemplate.d.ts +4 -4
- package/dist-types/protocols/GetSMSResult.d.ts +4 -4
- package/dist-types/protocols/GetSMSStatus.d.ts +4 -4
- package/dist-types/protocols/ListAlimtalkChannels.d.ts +4 -4
- package/dist-types/protocols/ListAlimtalkTemplates.d.ts +4 -4
- package/dist-types/protocols/SendAlimtalk.d.ts +4 -4
- package/dist-types/protocols/SendMMS.d.ts +4 -4
- package/dist-types/protocols/SendSMS.d.ts +4 -4
- package/dist-types/protocols/constants.d.ts +1 -1
- package/dist-types/protocols/index.d.ts +10 -10
- package/package.json +4 -3
|
@@ -17,77 +17,83 @@ const constants_1 = require("./constants");
|
|
|
17
17
|
const node_path_1 = require("node:path");
|
|
18
18
|
const node_crypto_1 = require("node:crypto");
|
|
19
19
|
const node_fs_1 = require("node:fs");
|
|
20
|
-
;
|
|
21
|
-
;
|
|
22
20
|
class SendMMSCommand extends models_1.SensCommand {
|
|
23
21
|
constructor(input) {
|
|
24
22
|
super(input);
|
|
25
23
|
this.input = Object.assign(Object.assign({}, input), { from: (0, constants_1.prettyPhoneNum)(input.from), content: resolveInputContent(input.content), type: resolveInputMessageType(input.type), messages: resolveInputMessages(input.messages), files: resolveInputFiles(input.files) });
|
|
26
24
|
}
|
|
27
|
-
;
|
|
28
25
|
serialize(input, config) {
|
|
29
26
|
return __awaiter(this, void 0, void 0, function* () {
|
|
30
27
|
if (!config.serviceId.sms)
|
|
31
28
|
throw new util_error_handler_1.IngestkoreaError({
|
|
32
|
-
code: 400,
|
|
29
|
+
code: 400,
|
|
30
|
+
type: "Bad Request",
|
|
31
|
+
message: "Invalid Params",
|
|
32
|
+
description: "Please Check SMS ServiceId",
|
|
33
33
|
});
|
|
34
34
|
let request = yield (0, SendMMS_1.serializeIngestkorea_restJson_SendMMSCommand)(input, config);
|
|
35
35
|
return request;
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
|
-
;
|
|
39
38
|
deserialize(response) {
|
|
40
39
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41
40
|
let output = yield (0, SendMMS_1.deserializeIngestkorea_restJson_SendMMSCommand)(response);
|
|
42
41
|
return output;
|
|
43
42
|
});
|
|
44
43
|
}
|
|
45
|
-
;
|
|
46
44
|
}
|
|
47
45
|
exports.SendMMSCommand = SendMMSCommand;
|
|
48
|
-
;
|
|
49
46
|
const resolveInputContent = (content) => {
|
|
50
47
|
const resolvedContent = (0, constants_1.trimText)(content);
|
|
51
48
|
const contentLength = (0, constants_1.getContentLength)(resolvedContent);
|
|
52
49
|
if (!contentLength)
|
|
53
50
|
throw new util_error_handler_1.IngestkoreaError({
|
|
54
|
-
code: 400,
|
|
55
|
-
|
|
51
|
+
code: 400,
|
|
52
|
+
type: "Bad Request",
|
|
53
|
+
message: "Invalid Request",
|
|
54
|
+
description: `Please check input message`,
|
|
56
55
|
});
|
|
57
56
|
if (contentLength > constants_1.LMS_MAX)
|
|
58
57
|
throw new util_error_handler_1.IngestkoreaError({
|
|
59
|
-
code: 400,
|
|
60
|
-
|
|
58
|
+
code: 400,
|
|
59
|
+
type: "Bad Request",
|
|
60
|
+
message: "Invalid Request",
|
|
61
|
+
description: `Maximum message length is ${constants_1.LMS_MAX}bytes`,
|
|
61
62
|
});
|
|
62
63
|
return resolvedContent;
|
|
63
64
|
};
|
|
64
|
-
const resolveInputMessages = (messages) => messages.map(message => {
|
|
65
|
+
const resolveInputMessages = (messages) => messages.map((message) => {
|
|
65
66
|
return Object.assign(Object.assign({ to: (0, constants_1.prettyPhoneNum)(message.to) }, (message.content != undefined && { content: resolveInputContent(message.content) })), (message.subject != undefined && { subject: (0, constants_1.trimText)(message.subject) }));
|
|
66
67
|
});
|
|
67
68
|
const resolveInputMessageType = (type) => {
|
|
68
|
-
if (type ==
|
|
69
|
+
if (type == "SMS" || type == "LMS")
|
|
69
70
|
throw new util_error_handler_1.IngestkoreaError({
|
|
70
|
-
code: 400,
|
|
71
|
-
|
|
71
|
+
code: 400,
|
|
72
|
+
type: "Bad Request",
|
|
73
|
+
message: "Invalid Request",
|
|
74
|
+
description: `Please Call SendSMSCommand`,
|
|
72
75
|
});
|
|
73
|
-
return
|
|
76
|
+
return "MMS";
|
|
74
77
|
};
|
|
75
78
|
const resolveInputFiles = (files) => {
|
|
76
79
|
if (!files.length)
|
|
77
80
|
throw new util_error_handler_1.IngestkoreaError({
|
|
78
|
-
code: 400,
|
|
79
|
-
|
|
81
|
+
code: 400,
|
|
82
|
+
type: "Bad Request",
|
|
83
|
+
message: "Invalid Request",
|
|
84
|
+
description: `Please Check Input Files`,
|
|
80
85
|
});
|
|
81
|
-
const output = files.map(file => {
|
|
86
|
+
const output = files.map((file) => {
|
|
82
87
|
const resolvedFileName = verifyFileName(file.name);
|
|
83
88
|
const resolvedFileBody = file.body != undefined ? file.body : getFileBody(file.name);
|
|
84
|
-
let byte = Buffer.from(resolvedFileBody,
|
|
89
|
+
let byte = Buffer.from(resolvedFileBody, "base64").length;
|
|
85
90
|
let kib = Math.ceil(byte / 1024);
|
|
86
91
|
if (kib > constants_1.MMS_FILE_MAX)
|
|
87
92
|
throw new util_error_handler_1.IngestkoreaError({
|
|
88
|
-
code: 400,
|
|
89
|
-
|
|
90
|
-
|
|
93
|
+
code: 400,
|
|
94
|
+
type: "Bad Request",
|
|
95
|
+
message: "Invalid Request",
|
|
96
|
+
description: `Input File is ${kib}KiByte. Maximum File Size is ${constants_1.MMS_FILE_MAX}Kibyte`,
|
|
91
97
|
});
|
|
92
98
|
return { name: resolvedFileName, body: resolvedFileBody };
|
|
93
99
|
});
|
|
@@ -97,19 +103,23 @@ const verifyFileName = (fileName) => {
|
|
|
97
103
|
let { ext } = (0, node_path_1.parse)(fileName);
|
|
98
104
|
const uuid = (0, node_crypto_1.randomUUID)();
|
|
99
105
|
const extension = ext.replace(/jpeg|jpg/gi, "jpg");
|
|
100
|
-
if (extension !=
|
|
106
|
+
if (extension != ".jpg")
|
|
101
107
|
throw new util_error_handler_1.IngestkoreaError({
|
|
102
|
-
code: 400,
|
|
103
|
-
|
|
108
|
+
code: 400,
|
|
109
|
+
type: "Bad Request",
|
|
110
|
+
message: "Invalid Request",
|
|
111
|
+
description: `File Extension is not .jpg or .jpeg`,
|
|
104
112
|
});
|
|
105
|
-
return [uuid, extension].join(
|
|
113
|
+
return [uuid, extension].join("");
|
|
106
114
|
};
|
|
107
115
|
/** @returns base64 */
|
|
108
116
|
const getFileBody = (fileName) => {
|
|
109
117
|
if (!(0, node_fs_1.existsSync)(fileName))
|
|
110
118
|
throw new util_error_handler_1.IngestkoreaError({
|
|
111
|
-
code: 400,
|
|
112
|
-
|
|
119
|
+
code: 400,
|
|
120
|
+
type: "Bad Request",
|
|
121
|
+
message: "Invalid Request",
|
|
122
|
+
description: `${fileName} does not exist.`,
|
|
113
123
|
});
|
|
114
|
-
return (0, node_fs_1.readFileSync)(fileName, { encoding:
|
|
124
|
+
return (0, node_fs_1.readFileSync)(fileName, { encoding: "base64" });
|
|
115
125
|
};
|
|
@@ -14,72 +14,73 @@ const models_1 = require("../models");
|
|
|
14
14
|
const SendSMS_1 = require("../protocols/SendSMS");
|
|
15
15
|
const util_error_handler_1 = require("@ingestkorea/util-error-handler");
|
|
16
16
|
const constants_1 = require("./constants");
|
|
17
|
-
;
|
|
18
|
-
;
|
|
19
17
|
class SendSMSCommand extends models_1.SensCommand {
|
|
20
18
|
constructor(input) {
|
|
21
19
|
super(input);
|
|
22
20
|
const { content, messageType: defaultMessageType } = resolveInputContent(input.content);
|
|
23
21
|
const { messages, messageType: childMessageType } = resolveInputMessages(input.messages);
|
|
24
|
-
this.input = Object.assign(Object.assign({}, input), { from: (0, constants_1.prettyPhoneNum)(input.from), content: content, type: defaultMessageType === childMessageType ? defaultMessageType :
|
|
22
|
+
this.input = Object.assign(Object.assign({}, input), { from: (0, constants_1.prettyPhoneNum)(input.from), content: content, type: defaultMessageType === childMessageType ? defaultMessageType : "LMS", messages: messages });
|
|
25
23
|
}
|
|
26
|
-
;
|
|
27
24
|
serialize(input, config) {
|
|
28
25
|
return __awaiter(this, void 0, void 0, function* () {
|
|
29
26
|
if (!config.serviceId.sms)
|
|
30
27
|
throw new util_error_handler_1.IngestkoreaError({
|
|
31
|
-
code: 400,
|
|
28
|
+
code: 400,
|
|
29
|
+
type: "Bad Request",
|
|
30
|
+
message: "Invalid Params",
|
|
31
|
+
description: "Please Check SMS ServiceId",
|
|
32
32
|
});
|
|
33
33
|
let request = yield (0, SendSMS_1.serializeIngestkorea_restJson_SendSMSCommand)(input, config);
|
|
34
34
|
return request;
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
|
-
;
|
|
38
37
|
deserialize(response) {
|
|
39
38
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40
39
|
let output = yield (0, SendSMS_1.deserializeIngestkorea_restJson_SendSMSCommand)(response);
|
|
41
40
|
return output;
|
|
42
41
|
});
|
|
43
42
|
}
|
|
44
|
-
;
|
|
45
43
|
}
|
|
46
44
|
exports.SendSMSCommand = SendSMSCommand;
|
|
47
|
-
;
|
|
48
45
|
const getMessageType = (input) => {
|
|
49
46
|
const contentLength = (0, constants_1.getContentLength)(input);
|
|
50
47
|
if (!contentLength)
|
|
51
48
|
throw new util_error_handler_1.IngestkoreaError({
|
|
52
|
-
code: 400,
|
|
53
|
-
|
|
49
|
+
code: 400,
|
|
50
|
+
type: "Bad Request",
|
|
51
|
+
message: "Invalid Request",
|
|
52
|
+
description: `Please check input message`,
|
|
54
53
|
});
|
|
55
54
|
if (contentLength > constants_1.LMS_MAX)
|
|
56
55
|
throw new util_error_handler_1.IngestkoreaError({
|
|
57
|
-
code: 400,
|
|
58
|
-
|
|
56
|
+
code: 400,
|
|
57
|
+
type: "Bad Request",
|
|
58
|
+
message: "Invalid Request",
|
|
59
|
+
description: `Maximum message length is ${constants_1.LMS_MAX}bytes`,
|
|
59
60
|
});
|
|
60
|
-
return contentLength > constants_1.SMS_MAX ?
|
|
61
|
+
return contentLength > constants_1.SMS_MAX ? "LMS" : "SMS";
|
|
61
62
|
};
|
|
62
63
|
const resolveInputContent = (content) => {
|
|
63
64
|
const resolvedContent = (0, constants_1.trimText)(content);
|
|
64
65
|
const messageType = getMessageType(resolvedContent);
|
|
65
66
|
return {
|
|
66
67
|
content: resolvedContent,
|
|
67
|
-
messageType: messageType
|
|
68
|
+
messageType: messageType,
|
|
68
69
|
};
|
|
69
70
|
};
|
|
70
71
|
const resolveInputMessages = (messages) => {
|
|
71
72
|
let init = {
|
|
72
73
|
messages: [],
|
|
73
|
-
messageType:
|
|
74
|
+
messageType: "SMS",
|
|
74
75
|
};
|
|
75
76
|
const output = messages.reduce((acc, message) => {
|
|
76
77
|
const to = (0, constants_1.prettyPhoneNum)(message.to);
|
|
77
78
|
const content = message.content != undefined ? (0, constants_1.trimText)(message.content) : undefined;
|
|
78
79
|
const subject = message.subject != undefined ? (0, constants_1.trimText)(message.subject) : undefined;
|
|
79
|
-
const messageType = content != undefined ? getMessageType(content) :
|
|
80
|
-
if (messageType ==
|
|
80
|
+
const messageType = content != undefined ? getMessageType(content) : "SMS";
|
|
81
|
+
if (messageType == "LMS")
|
|
81
82
|
acc.messageType = messageType;
|
|
82
|
-
acc.messages.push(Object.assign(Object.assign({ to: to }, (content != undefined && { content: content })), (subject != undefined && acc.messageType ===
|
|
83
|
+
acc.messages.push(Object.assign(Object.assign({ to: to }, (content != undefined && { content: content })), (subject != undefined && acc.messageType === "LMS" && { subject: subject })));
|
|
83
84
|
return acc;
|
|
84
85
|
}, init);
|
|
85
86
|
return output;
|
|
@@ -10,10 +10,10 @@ const prettyPhoneNum = (input) => input.replace(/\-/gi, "");
|
|
|
10
10
|
exports.prettyPhoneNum = prettyPhoneNum;
|
|
11
11
|
/** @returns content-length(euc-kr) */
|
|
12
12
|
const getContentLength = (input) => {
|
|
13
|
-
return input.split(
|
|
13
|
+
return input.split("").reduce((acc, text) => {
|
|
14
14
|
let byte = Buffer.from(text).length;
|
|
15
15
|
let modulo = byte % 3;
|
|
16
|
-
modulo ? acc += 1 : acc += 2;
|
|
16
|
+
modulo ? (acc += 1) : (acc += 2);
|
|
17
17
|
return acc;
|
|
18
18
|
}, 0);
|
|
19
19
|
};
|
|
@@ -11,8 +11,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.middlewareIngestkoreaMetadata = void 0;
|
|
13
13
|
const middlewareIngestkoreaMetadata = (request, config) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14
|
-
const { longDate } = yield convertFormatDate(request.headers[
|
|
15
|
-
request.headers = Object.assign(Object.assign({}, request.headers), { [
|
|
14
|
+
const { longDate } = yield convertFormatDate(request.headers["x-ncp-apigw-timestamp"]);
|
|
15
|
+
request.headers = Object.assign(Object.assign({}, request.headers), { ["x-ingestkorea-date"]: longDate, ["x-ingestkorea-user-agent"]: "@ingestkorea/client-sens/1.5.x" });
|
|
16
16
|
return request;
|
|
17
17
|
});
|
|
18
18
|
exports.middlewareIngestkoreaMetadata = middlewareIngestkoreaMetadata;
|
|
@@ -20,13 +20,9 @@ const middlewareNcpSigner = (request, config) => __awaiter(void 0, void 0, void
|
|
|
20
20
|
const space = " ";
|
|
21
21
|
const newLine = "\n";
|
|
22
22
|
const timestamp = new Date().getTime().toString();
|
|
23
|
-
const stringToSign = [
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
accessKey
|
|
27
|
-
].join(newLine);
|
|
28
|
-
const signature = (0, crypto_1.createHmac)("sha256", secretKey).update(stringToSign).digest('base64');
|
|
29
|
-
request.headers = Object.assign(Object.assign({}, request.headers), { ['x-ncp-iam-access-key']: accessKey, ['x-ncp-apigw-timestamp']: timestamp, ['x-ncp-apigw-signature-v2']: signature });
|
|
23
|
+
const stringToSign = [method + space + path, timestamp, accessKey].join(newLine);
|
|
24
|
+
const signature = (0, crypto_1.createHmac)("sha256", secretKey).update(stringToSign).digest("base64");
|
|
25
|
+
request.headers = Object.assign(Object.assign({}, request.headers), { ["x-ncp-iam-access-key"]: accessKey, ["x-ncp-apigw-timestamp"]: timestamp, ["x-ncp-apigw-signature-v2"]: signature });
|
|
30
26
|
return request;
|
|
31
27
|
});
|
|
32
28
|
exports.middlewareNcpSigner = middlewareNcpSigner;
|
|
@@ -16,14 +16,14 @@ const serializeIngestkorea_restJson_GetAlimtalkResultCommand = (input, config) =
|
|
|
16
16
|
const hostname = "sens.apigw.ntruss.com";
|
|
17
17
|
const path = "/alimtalk/v2/services/" + config.serviceId.kakao + "/messages/" + input.messageId;
|
|
18
18
|
const headers = {
|
|
19
|
-
|
|
19
|
+
host: hostname,
|
|
20
20
|
};
|
|
21
21
|
return new util_http_handler_1.HttpRequest({
|
|
22
|
-
protocol:
|
|
23
|
-
method:
|
|
22
|
+
protocol: "https:",
|
|
23
|
+
method: "GET",
|
|
24
24
|
hostname: hostname,
|
|
25
25
|
path: path,
|
|
26
|
-
headers: headers
|
|
26
|
+
headers: headers,
|
|
27
27
|
});
|
|
28
28
|
});
|
|
29
29
|
exports.serializeIngestkorea_restJson_GetAlimtalkResultCommand = serializeIngestkorea_restJson_GetAlimtalkResultCommand;
|
|
@@ -55,8 +55,9 @@ const deserializeIngestkorea_restJson_GetAlimtalkResultOutput = (output) => __aw
|
|
|
55
55
|
messageStatusCode: output.messageStatusCode != undefined ? output.messageStatusCode : undefined,
|
|
56
56
|
messageStatusName: output.messageStatusName != undefined ? output.messageStatusName : undefined,
|
|
57
57
|
messageStatusDesc: output.messageStatusDesc != undefined ? output.messageStatusDesc : undefined,
|
|
58
|
-
failover: output.failover != undefined
|
|
59
|
-
(0, exports.deserializeIngestkorea_restJson_AlimtalkFailover)(output.failover)
|
|
58
|
+
failover: output.failover != undefined
|
|
59
|
+
? (0, exports.deserializeIngestkorea_restJson_AlimtalkFailover)(output.failover)
|
|
60
|
+
: undefined,
|
|
60
61
|
};
|
|
61
62
|
});
|
|
62
63
|
exports.deserializeIngestkorea_restJson_GetAlimtalkResultOutput = deserializeIngestkorea_restJson_GetAlimtalkResultOutput;
|
|
@@ -16,18 +16,18 @@ const serializeIngestkorea_restJson_GetAlimtalkStatusCommand = (input, config) =
|
|
|
16
16
|
const hostname = "sens.apigw.ntruss.com";
|
|
17
17
|
const path = "/alimtalk/v2/services/" + config.serviceId.kakao + "/messages";
|
|
18
18
|
const headers = {
|
|
19
|
-
|
|
19
|
+
host: hostname,
|
|
20
20
|
};
|
|
21
21
|
const query = {
|
|
22
|
-
requestId: input.requestId
|
|
22
|
+
requestId: input.requestId,
|
|
23
23
|
};
|
|
24
24
|
return new util_http_handler_1.HttpRequest({
|
|
25
|
-
protocol:
|
|
26
|
-
method:
|
|
25
|
+
protocol: "https:",
|
|
26
|
+
method: "GET",
|
|
27
27
|
hostname: hostname,
|
|
28
28
|
path: path,
|
|
29
29
|
headers: headers,
|
|
30
|
-
query: query
|
|
30
|
+
query: query,
|
|
31
31
|
});
|
|
32
32
|
});
|
|
33
33
|
exports.serializeIngestkorea_restJson_GetAlimtalkStatusCommand = serializeIngestkorea_restJson_GetAlimtalkStatusCommand;
|
|
@@ -48,12 +48,13 @@ const deserializeIngestkorea_restJson_GetAlimtalkStatusOutput = (output) => __aw
|
|
|
48
48
|
statusCode: statusCode != undefined ? statusCode : undefined,
|
|
49
49
|
statusName: statusName != undefined ? statusName : undefined,
|
|
50
50
|
messages: messages != undefined
|
|
51
|
-
? (0, exports.deserializeIngestkorea_restJson_GetAlimtalkStatusMessages)(messages)
|
|
51
|
+
? (0, exports.deserializeIngestkorea_restJson_GetAlimtalkStatusMessages)(messages)
|
|
52
|
+
: undefined,
|
|
52
53
|
};
|
|
53
54
|
});
|
|
54
55
|
exports.deserializeIngestkorea_restJson_GetAlimtalkStatusOutput = deserializeIngestkorea_restJson_GetAlimtalkStatusOutput;
|
|
55
56
|
const deserializeIngestkorea_restJson_GetAlimtalkStatusMessages = (outputs) => {
|
|
56
|
-
const result = outputs.map(output => {
|
|
57
|
+
const result = outputs.map((output) => {
|
|
57
58
|
return {
|
|
58
59
|
messageId: output.messageId != undefined ? output.messageId : undefined,
|
|
59
60
|
to: output.to != undefined ? output.to : undefined,
|
|
@@ -17,19 +17,19 @@ const serializeIngestkorea_restJson_GetAlimtalkTemplateCommand = (input, config)
|
|
|
17
17
|
const hostname = "sens.apigw.ntruss.com";
|
|
18
18
|
const path = "/alimtalk/v2/services/" + config.serviceId.kakao + "/templates";
|
|
19
19
|
const headers = {
|
|
20
|
-
|
|
20
|
+
host: hostname,
|
|
21
21
|
};
|
|
22
22
|
const query = {
|
|
23
23
|
channelId: input.channelId,
|
|
24
|
-
templateCode: input.templateCode
|
|
24
|
+
templateCode: input.templateCode,
|
|
25
25
|
};
|
|
26
26
|
return new util_http_handler_1.HttpRequest({
|
|
27
|
-
protocol:
|
|
28
|
-
method:
|
|
27
|
+
protocol: "https:",
|
|
28
|
+
method: "GET",
|
|
29
29
|
hostname: hostname,
|
|
30
30
|
path: path,
|
|
31
31
|
query: query,
|
|
32
|
-
headers: headers
|
|
32
|
+
headers: headers,
|
|
33
33
|
});
|
|
34
34
|
});
|
|
35
35
|
exports.serializeIngestkorea_restJson_GetAlimtalkTemplateCommand = serializeIngestkorea_restJson_GetAlimtalkTemplateCommand;
|
|
@@ -45,7 +45,7 @@ const deserializeIngestkorea_restJson_GetAlimtalkTemplateCommand = (output) => _
|
|
|
45
45
|
exports.deserializeIngestkorea_restJson_GetAlimtalkTemplateCommand = deserializeIngestkorea_restJson_GetAlimtalkTemplateCommand;
|
|
46
46
|
const deserializeIngestkorea_restJson_GetAlimtalkTemplateOutput = (output) => __awaiter(void 0, void 0, void 0, function* () {
|
|
47
47
|
return {
|
|
48
|
-
templates: (0, ListAlimtalkTemplates_1.deserializeIngestkorea_restJson_AlimtalkTemplate)(output)
|
|
48
|
+
templates: (0, ListAlimtalkTemplates_1.deserializeIngestkorea_restJson_AlimtalkTemplate)(output),
|
|
49
49
|
};
|
|
50
50
|
});
|
|
51
51
|
exports.deserializeIngestkorea_restJson_GetAlimtalkTemplateOutput = deserializeIngestkorea_restJson_GetAlimtalkTemplateOutput;
|
|
@@ -14,13 +14,13 @@ const util_http_handler_1 = require("@ingestkorea/util-http-handler");
|
|
|
14
14
|
const constants_1 = require("./constants");
|
|
15
15
|
const serializeIngestkorea_restJson_GetSMSResultCommand = (input, config) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
16
|
const hostname = "sens.apigw.ntruss.com";
|
|
17
|
-
const path = "/sms/v2/services/" + config.serviceId.sms + "/messages" +
|
|
17
|
+
const path = "/sms/v2/services/" + config.serviceId.sms + "/messages" + "/" + input.messageId;
|
|
18
18
|
const headers = {
|
|
19
|
-
|
|
19
|
+
host: hostname,
|
|
20
20
|
};
|
|
21
21
|
return new util_http_handler_1.HttpRequest({
|
|
22
|
-
protocol:
|
|
23
|
-
method:
|
|
22
|
+
protocol: "https:",
|
|
23
|
+
method: "GET",
|
|
24
24
|
hostname: hostname,
|
|
25
25
|
path: path,
|
|
26
26
|
headers: headers,
|
|
@@ -41,12 +41,14 @@ const deserializeIngestkorea_restJson_GetSMSResultOutput = (output) => __awaiter
|
|
|
41
41
|
return {
|
|
42
42
|
statusCode: output.statusCode ? output.statusCode : undefined,
|
|
43
43
|
statusName: output.statusName ? output.statusName : undefined,
|
|
44
|
-
messages: output.messages
|
|
44
|
+
messages: output.messages
|
|
45
|
+
? (0, exports.deserializeIngestkorea_restJson_SMSResultMessage)(output.messages)
|
|
46
|
+
: undefined,
|
|
45
47
|
};
|
|
46
48
|
});
|
|
47
49
|
exports.deserializeIngestkorea_restJson_GetSMSResultOutput = deserializeIngestkorea_restJson_GetSMSResultOutput;
|
|
48
50
|
const deserializeIngestkorea_restJson_SMSResultMessage = (outputs) => {
|
|
49
|
-
let result = outputs.map(output => {
|
|
51
|
+
let result = outputs.map((output) => {
|
|
50
52
|
return {
|
|
51
53
|
requestTime: output.requestTime != undefined ? output.requestTime : undefined,
|
|
52
54
|
contentType: output.contentType != undefined ? output.contentType : undefined,
|
|
@@ -60,16 +62,16 @@ const deserializeIngestkorea_restJson_SMSResultMessage = (outputs) => {
|
|
|
60
62
|
statusName: output.statusName != undefined ? output.statusName : undefined,
|
|
61
63
|
completeTime: output.completeTime != undefined ? output.completeTime : undefined,
|
|
62
64
|
telcoCode: output.telcoCode != undefined ? output.telcoCode : undefined,
|
|
63
|
-
files: output.files != undefined ? (0, exports.deserializeIngestkorea_restJson_File)(output.files) : undefined
|
|
65
|
+
files: output.files != undefined ? (0, exports.deserializeIngestkorea_restJson_File)(output.files) : undefined,
|
|
64
66
|
};
|
|
65
67
|
});
|
|
66
68
|
return result;
|
|
67
69
|
};
|
|
68
70
|
exports.deserializeIngestkorea_restJson_SMSResultMessage = deserializeIngestkorea_restJson_SMSResultMessage;
|
|
69
71
|
const deserializeIngestkorea_restJson_File = (outputs) => {
|
|
70
|
-
let result = outputs.map(output => {
|
|
72
|
+
let result = outputs.map((output) => {
|
|
71
73
|
return {
|
|
72
|
-
name: output.name != undefined ? output.name : undefined
|
|
74
|
+
name: output.name != undefined ? output.name : undefined,
|
|
73
75
|
};
|
|
74
76
|
});
|
|
75
77
|
return result;
|
|
@@ -16,14 +16,14 @@ const serializeIngestkorea_restJson_GetSMSStatusCommand = (input, config) => __a
|
|
|
16
16
|
const hostname = "sens.apigw.ntruss.com";
|
|
17
17
|
const path = "/sms/v2/services/" + config.serviceId.sms + "/messages";
|
|
18
18
|
const headers = {
|
|
19
|
-
|
|
19
|
+
host: hostname,
|
|
20
20
|
};
|
|
21
21
|
const query = {
|
|
22
|
-
requestId: input.requestId
|
|
22
|
+
requestId: input.requestId,
|
|
23
23
|
};
|
|
24
24
|
return new util_http_handler_1.HttpRequest({
|
|
25
|
-
protocol:
|
|
26
|
-
method:
|
|
25
|
+
protocol: "https:",
|
|
26
|
+
method: "GET",
|
|
27
27
|
hostname: hostname,
|
|
28
28
|
path: path,
|
|
29
29
|
query: query,
|
|
@@ -46,19 +46,21 @@ const deserializeIngestkorea_restJson_GetSMSStatusOutput = (output) => __awaiter
|
|
|
46
46
|
requestId: output.requestId ? output.requestId : undefined,
|
|
47
47
|
statusCode: output.statusCode ? output.statusCode : undefined,
|
|
48
48
|
statusName: output.statusName ? output.statusName : undefined,
|
|
49
|
-
messages: output.messages
|
|
49
|
+
messages: output.messages
|
|
50
|
+
? (0, exports.deserializeIngestkorea_restJson_SMSStatusMessage)(output.messages)
|
|
51
|
+
: undefined,
|
|
50
52
|
};
|
|
51
53
|
});
|
|
52
54
|
exports.deserializeIngestkorea_restJson_GetSMSStatusOutput = deserializeIngestkorea_restJson_GetSMSStatusOutput;
|
|
53
55
|
const deserializeIngestkorea_restJson_SMSStatusMessage = (outputs) => {
|
|
54
|
-
let result = outputs.map(output => {
|
|
56
|
+
let result = outputs.map((output) => {
|
|
55
57
|
return {
|
|
56
58
|
messageId: output.messageId != undefined ? output.messageId : undefined,
|
|
57
59
|
requestTime: output.requestTime != undefined ? output.requestTime : undefined,
|
|
58
60
|
contentType: output.contentType != undefined ? output.contentType : undefined,
|
|
59
61
|
countryCode: output.countryCode != undefined ? output.countryCode : undefined,
|
|
60
62
|
from: output.from != undefined ? output.from : undefined,
|
|
61
|
-
to: output.to != undefined ? output.to : undefined
|
|
63
|
+
to: output.to != undefined ? output.to : undefined,
|
|
62
64
|
};
|
|
63
65
|
});
|
|
64
66
|
return result;
|
|
@@ -16,14 +16,14 @@ const serializeIngestkorea_restJson_ListAlimtalkChannelsCommand = (input, config
|
|
|
16
16
|
const hostname = "sens.apigw.ntruss.com";
|
|
17
17
|
const path = "/alimtalk/v2/services/" + config.serviceId.kakao + "/channels";
|
|
18
18
|
const headers = {
|
|
19
|
-
|
|
19
|
+
host: hostname,
|
|
20
20
|
};
|
|
21
21
|
return new util_http_handler_1.HttpRequest({
|
|
22
|
-
protocol:
|
|
23
|
-
method:
|
|
22
|
+
protocol: "https:",
|
|
23
|
+
method: "GET",
|
|
24
24
|
hostname: hostname,
|
|
25
25
|
path: path,
|
|
26
|
-
headers: headers
|
|
26
|
+
headers: headers,
|
|
27
27
|
});
|
|
28
28
|
});
|
|
29
29
|
exports.serializeIngestkorea_restJson_ListAlimtalkChannelsCommand = serializeIngestkorea_restJson_ListAlimtalkChannelsCommand;
|
|
@@ -39,12 +39,12 @@ const deserializeIngestkorea_restJson_ListAlimtalkChannelsCommand = (output) =>
|
|
|
39
39
|
exports.deserializeIngestkorea_restJson_ListAlimtalkChannelsCommand = deserializeIngestkorea_restJson_ListAlimtalkChannelsCommand;
|
|
40
40
|
const deserializeIngestkorea_restJson_ListAlimtalkChannelsOutput = (outputs) => __awaiter(void 0, void 0, void 0, function* () {
|
|
41
41
|
return {
|
|
42
|
-
channels: (0, exports.deserializeIngestkorea_restJson_Channel)(outputs)
|
|
42
|
+
channels: (0, exports.deserializeIngestkorea_restJson_Channel)(outputs),
|
|
43
43
|
};
|
|
44
44
|
});
|
|
45
45
|
exports.deserializeIngestkorea_restJson_ListAlimtalkChannelsOutput = deserializeIngestkorea_restJson_ListAlimtalkChannelsOutput;
|
|
46
46
|
const deserializeIngestkorea_restJson_Channel = (outputs) => {
|
|
47
|
-
const result = outputs.map(output => {
|
|
47
|
+
const result = outputs.map((output) => {
|
|
48
48
|
return {
|
|
49
49
|
createTime: output.createTime != undefined ? output.createTime : undefined,
|
|
50
50
|
updateTime: output.updateTime != undefined ? output.updateTime : undefined,
|
|
@@ -52,7 +52,7 @@ const deserializeIngestkorea_restJson_Channel = (outputs) => {
|
|
|
52
52
|
channelId: output.channelId != undefined ? output.channelId : undefined,
|
|
53
53
|
channelName: output.channelName != undefined ? output.channelName : undefined,
|
|
54
54
|
channelStatus: output.channelStatus != undefined ? output.channelStatus : undefined,
|
|
55
|
-
useSmsFailover: output.useSmsFailover != undefined ? output.useSmsFailover : undefined
|
|
55
|
+
useSmsFailover: output.useSmsFailover != undefined ? output.useSmsFailover : undefined,
|
|
56
56
|
};
|
|
57
57
|
});
|
|
58
58
|
return result;
|