@ingestkorea/client-sens 1.7.0 → 1.8.0
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/LICENSE +1 -1
- package/README.md +98 -63
- package/dist-cjs/SensClient.js +57 -28
- package/dist-cjs/commands/GetAlimtalkResultCommand.js +5 -32
- package/dist-cjs/commands/GetAlimtalkStatusCommand.js +9 -35
- package/dist-cjs/commands/GetAlimtalkTemplateCommand.js +5 -32
- package/dist-cjs/commands/GetSMSResultCommand.js +8 -33
- package/dist-cjs/commands/GetSMSStatusCommand.js +8 -33
- package/dist-cjs/commands/ListAlimtalkChannelsCommand.js +6 -33
- package/dist-cjs/commands/ListAlimtalkStatusCommand.js +19 -35
- package/dist-cjs/commands/ListAlimtalkTemplatesCommand.js +5 -32
- package/dist-cjs/commands/SendAlimtalkCommand.js +35 -43
- package/dist-cjs/commands/SendMMSCommand.js +67 -103
- package/dist-cjs/commands/SendSMSCommand.js +38 -71
- package/dist-cjs/commands/constants.js +1 -15
- package/dist-cjs/commands/index.js +11 -11
- package/dist-cjs/index.js +2 -2
- package/dist-cjs/middleware/constants.js +10 -0
- package/dist-cjs/middleware/index.js +3 -4
- package/dist-cjs/middleware/middleware-metadata.js +4 -5
- package/dist-cjs/middleware/middleware-retry.js +32 -27
- package/dist-cjs/middleware/middleware-sign.js +10 -9
- package/dist-cjs/models/SendAlimtalk.js +3 -0
- package/dist-cjs/models/SendMMS.js +3 -0
- package/dist-cjs/models/SensErrorInfo.js +13 -0
- package/dist-cjs/models/SensMiddleware.js +2 -0
- package/dist-cjs/models/index.js +16 -14
- package/dist-cjs/protocols/GetAlimtalkResult.js +19 -22
- package/dist-cjs/protocols/GetAlimtalkStatus.js +36 -37
- package/dist-cjs/protocols/GetAlimtalkTemplate.js +56 -90
- package/dist-cjs/protocols/GetSMSResult.js +30 -48
- package/dist-cjs/protocols/GetSMSStatus.js +31 -34
- package/dist-cjs/protocols/ListAlimtalkChannels.js +27 -31
- package/dist-cjs/protocols/ListAlimtalkStatus.js +22 -19
- package/dist-cjs/protocols/ListAlimtalkTemplates.js +31 -23
- package/dist-cjs/protocols/SendAlimtalk.js +22 -26
- package/dist-cjs/protocols/SendMMS.js +8 -38
- package/dist-cjs/protocols/SendSMS.js +19 -21
- package/dist-cjs/protocols/constants.js +98 -34
- package/dist-es/SensClient.js +63 -30
- package/dist-es/commands/GetAlimtalkResultCommand.js +9 -19
- package/dist-es/commands/GetAlimtalkStatusCommand.js +14 -19
- package/dist-es/commands/GetAlimtalkTemplateCommand.js +9 -19
- package/dist-es/commands/GetSMSResultCommand.js +10 -20
- package/dist-es/commands/GetSMSStatusCommand.js +10 -20
- package/dist-es/commands/ListAlimtalkChannelsCommand.js +10 -22
- package/dist-es/commands/ListAlimtalkStatusCommand.js +28 -27
- package/dist-es/commands/ListAlimtalkTemplatesCommand.js +9 -19
- package/dist-es/commands/SendAlimtalkCommand.js +34 -30
- package/dist-es/commands/SendMMSCommand.js +70 -100
- package/dist-es/commands/SendSMSCommand.js +51 -66
- package/dist-es/commands/constants.js +9 -16
- package/dist-es/commands/index.js +27 -11
- package/dist-es/index.js +18 -2
- package/dist-es/middleware/constants.js +10 -0
- package/dist-es/middleware/index.js +19 -4
- package/dist-es/middleware/middleware-metadata.js +11 -5
- package/dist-es/middleware/middleware-retry.js +39 -30
- package/dist-es/middleware/middleware-sign.js +19 -14
- package/dist-es/models/GetAlimtalkResult.js +2 -1
- package/dist-es/models/GetAlimtalkStatus.js +2 -1
- package/dist-es/models/GetAlimtalkTemplate.js +2 -1
- package/dist-es/models/GetSMSResult.js +2 -1
- package/dist-es/models/GetSMSStatus.js +2 -1
- package/dist-es/models/ListAlimtalkChannels.js +2 -1
- package/dist-es/models/ListAlimtalkStatus.js +2 -1
- package/dist-es/models/ListAlimtalkTemplates.js +2 -1
- package/dist-es/models/MetadataBearer.js +2 -1
- package/dist-es/models/SendAlimtalk.js +5 -1
- package/dist-es/models/SendMMS.js +5 -1
- package/dist-es/models/SendSMS.js +2 -1
- package/dist-es/models/SensClient.js +2 -0
- package/dist-es/models/SensCommand.js +5 -1
- package/dist-es/models/SensErrorInfo.js +13 -0
- package/dist-es/models/SensMiddleware.js +2 -0
- package/dist-es/models/index.js +32 -14
- package/dist-es/protocols/GetAlimtalkResult.js +24 -23
- package/dist-es/protocols/GetAlimtalkStatus.js +40 -36
- package/dist-es/protocols/GetAlimtalkTemplate.js +78 -87
- package/dist-es/protocols/GetSMSResult.js +44 -47
- package/dist-es/protocols/GetSMSStatus.js +35 -34
- package/dist-es/protocols/ListAlimtalkChannels.js +31 -31
- package/dist-es/protocols/ListAlimtalkStatus.js +26 -32
- package/dist-es/protocols/ListAlimtalkTemplates.js +35 -22
- package/dist-es/protocols/SendAlimtalk.js +26 -25
- package/dist-es/protocols/SendMMS.js +10 -49
- package/dist-es/protocols/SendSMS.js +23 -30
- package/dist-es/protocols/constants.js +112 -37
- package/dist-types/SensClient.d.ts +3 -20
- package/dist-types/commands/GetAlimtalkResultCommand.d.ts +5 -10
- package/dist-types/commands/GetAlimtalkStatusCommand.d.ts +5 -10
- package/dist-types/commands/GetAlimtalkTemplateCommand.d.ts +5 -10
- package/dist-types/commands/GetSMSResultCommand.d.ts +5 -10
- package/dist-types/commands/GetSMSStatusCommand.d.ts +5 -10
- package/dist-types/commands/ListAlimtalkChannelsCommand.d.ts +5 -10
- package/dist-types/commands/ListAlimtalkStatusCommand.d.ts +5 -10
- package/dist-types/commands/ListAlimtalkTemplatesCommand.d.ts +5 -10
- package/dist-types/commands/SendAlimtalkCommand.d.ts +5 -10
- package/dist-types/commands/SendMMSCommand.d.ts +5 -10
- package/dist-types/commands/SendSMSCommand.d.ts +9 -10
- package/dist-types/commands/constants.d.ts +0 -7
- package/dist-types/commands/index.d.ts +11 -11
- package/dist-types/index.d.ts +2 -2
- package/dist-types/middleware/constants.d.ts +7 -0
- package/dist-types/middleware/index.d.ts +3 -4
- package/dist-types/middleware/middleware-metadata.d.ts +2 -2
- package/dist-types/middleware/middleware-retry.d.ts +2 -2
- package/dist-types/middleware/middleware-sign.d.ts +2 -2
- package/dist-types/models/GetAlimtalkResult.d.ts +3 -3
- package/dist-types/models/GetAlimtalkStatus.d.ts +8 -5
- package/dist-types/models/GetAlimtalkTemplate.d.ts +5 -5
- package/dist-types/models/GetSMSResult.d.ts +5 -9
- package/dist-types/models/GetSMSStatus.d.ts +4 -4
- package/dist-types/models/ListAlimtalkChannels.d.ts +4 -4
- package/dist-types/models/ListAlimtalkStatus.d.ts +8 -8
- package/dist-types/models/ListAlimtalkTemplates.d.ts +2 -2
- package/dist-types/models/MetadataBearer.d.ts +3 -3
- package/dist-types/models/SendAlimtalk.d.ts +6 -4
- package/dist-types/models/SendMMS.d.ts +5 -3
- package/dist-types/models/SendSMS.d.ts +2 -2
- package/dist-types/models/SensClient.d.ts +17 -0
- package/dist-types/models/SensCommand.d.ts +4 -6
- package/dist-types/models/SensErrorInfo.d.ts +21 -0
- package/dist-types/models/SensMiddleware.d.ts +8 -0
- package/dist-types/models/index.d.ts +16 -14
- package/dist-types/protocols/GetAlimtalkResult.d.ts +4 -11
- package/dist-types/protocols/GetAlimtalkStatus.d.ts +6 -12
- package/dist-types/protocols/GetAlimtalkTemplate.d.ts +4 -14
- package/dist-types/protocols/GetSMSResult.d.ts +4 -12
- package/dist-types/protocols/GetSMSStatus.d.ts +5 -11
- package/dist-types/protocols/ListAlimtalkChannels.d.ts +4 -11
- package/dist-types/protocols/ListAlimtalkStatus.d.ts +4 -10
- package/dist-types/protocols/ListAlimtalkTemplates.d.ts +5 -12
- package/dist-types/protocols/SendAlimtalk.d.ts +5 -12
- package/dist-types/protocols/SendMMS.d.ts +4 -10
- package/dist-types/protocols/SendSMS.d.ts +5 -10
- package/dist-types/protocols/constants.d.ts +3 -2
- package/package.json +20 -4
- package/.github/pull_request_template.md +0 -19
- package/dist-cjs/middleware/middleware-sort-headers.js +0 -25
- package/dist-cjs/protocols/index.js +0 -28
- package/dist-es/middleware/middleware-sort-headers.js +0 -12
- package/dist-es/models/Middleware.js +0 -1
- package/dist-es/protocols/index.js +0 -12
- package/dist-types/middleware/middleware-sort-headers.d.ts +0 -2
- package/dist-types/models/Middleware.d.ts +0 -12
- package/dist-types/protocols/index.d.ts +0 -12
- /package/dist-cjs/models/{Middleware.js → SensClient.js} +0 -0
|
@@ -9,56 +9,120 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
13
|
-
const util_error_handler_1 = require("@ingestkorea/util-error-handler");
|
|
12
|
+
exports.compact = exports.parseErrorBody = exports.parseBody = exports.deserializeMetadata = void 0;
|
|
14
13
|
const util_http_handler_1 = require("@ingestkorea/util-http-handler");
|
|
14
|
+
const index_js_1 = require("../models/index.js");
|
|
15
|
+
const constants_js_1 = require("../middleware/constants.js");
|
|
16
|
+
const deserializeMetadata = (response) => {
|
|
17
|
+
const attempts = response.headers[constants_js_1.INGESTKOREA_RETRY] || "1";
|
|
18
|
+
const totalRetryDelay = response.headers[constants_js_1.INGESTKOREA_RETRY_DELAY] || "0";
|
|
19
|
+
return {
|
|
20
|
+
httpStatusCode: response.statusCode,
|
|
21
|
+
attempts: Number(attempts),
|
|
22
|
+
totalRetryDelay: Number(totalRetryDelay),
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
exports.deserializeMetadata = deserializeMetadata;
|
|
15
26
|
const parseBody = (output) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
27
|
const { statusCode, headers, body: streamBody } = output;
|
|
17
|
-
|
|
18
|
-
if (!isValid) {
|
|
28
|
+
if (!isJsonResponse(headers["content-type"])) {
|
|
19
29
|
yield (0, util_http_handler_1.destroyStream)(streamBody);
|
|
20
|
-
|
|
21
|
-
code: 400,
|
|
30
|
+
throw new index_js_1.SensError({
|
|
31
|
+
code: statusCode !== null && statusCode !== void 0 ? statusCode : 400,
|
|
22
32
|
type: "Bad Request",
|
|
23
|
-
message: "
|
|
24
|
-
description: "content-type is not application/json",
|
|
33
|
+
message: "response content-type is not application/json",
|
|
25
34
|
});
|
|
26
|
-
if ((0, util_error_handler_1.ingestkoreaErrorCodeChecker)(statusCode))
|
|
27
|
-
customError.error.code = statusCode;
|
|
28
|
-
throw customError;
|
|
29
35
|
}
|
|
30
36
|
const data = yield (0, util_http_handler_1.collectBodyString)(streamBody);
|
|
31
|
-
if (data.length)
|
|
32
|
-
|
|
37
|
+
if (data.length) {
|
|
38
|
+
try {
|
|
39
|
+
return JSON.parse(data);
|
|
40
|
+
}
|
|
41
|
+
catch (e) {
|
|
42
|
+
yield (0, util_http_handler_1.destroyStream)(streamBody);
|
|
43
|
+
throw new index_js_1.SensError({
|
|
44
|
+
code: statusCode !== null && statusCode !== void 0 ? statusCode : 400,
|
|
45
|
+
type: "Bad Request",
|
|
46
|
+
message: "parse response body error",
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
33
50
|
return {};
|
|
34
51
|
});
|
|
35
52
|
exports.parseBody = parseBody;
|
|
36
53
|
const parseErrorBody = (output) => __awaiter(void 0, void 0, void 0, function* () {
|
|
37
54
|
const { statusCode, headers, body: streamBody } = output;
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
let customError = new util_error_handler_1.IngestkoreaError({
|
|
41
|
-
code: 400,
|
|
55
|
+
const error = new index_js_1.SensError({
|
|
56
|
+
code: statusCode !== null && statusCode !== void 0 ? statusCode : 400,
|
|
42
57
|
type: "Bad Request",
|
|
43
|
-
message: "
|
|
44
|
-
description: "content-type is not application/json",
|
|
58
|
+
message: "something wrong",
|
|
45
59
|
});
|
|
46
|
-
if ((
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
throw
|
|
60
|
+
if (!isJsonResponse(headers["content-type"])) {
|
|
61
|
+
yield (0, util_http_handler_1.destroyStream)(streamBody);
|
|
62
|
+
error.message = "response content-type is not application/json";
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
50
65
|
const data = yield (0, util_http_handler_1.collectBodyString)(streamBody);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
66
|
+
yield (0, util_http_handler_1.destroyStream)(streamBody);
|
|
67
|
+
const sensErrorBody = isSensErrorBody(data);
|
|
68
|
+
if (!sensErrorBody) {
|
|
69
|
+
throw error;
|
|
70
|
+
}
|
|
71
|
+
throw new index_js_1.SensError(Object.assign({ code: sensErrorBody.status, type: SENS_ERROR_CODE_SPEC[sensErrorBody.status] || "Unknown Error", message: sensErrorBody.errorMessage || "Something wrong" }, (sensErrorBody.errors &&
|
|
72
|
+
Array.isArray(sensErrorBody.errors) && {
|
|
73
|
+
invalidInputs: sensErrorBody.errors.map((msg) => {
|
|
74
|
+
return { type: "not-valid.args", message: msg };
|
|
75
|
+
}),
|
|
76
|
+
})));
|
|
54
77
|
});
|
|
55
78
|
exports.parseErrorBody = parseErrorBody;
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
79
|
+
const SENS_ERROR_CODE_SPEC = {
|
|
80
|
+
400: "Bad Request",
|
|
81
|
+
401: "Unauthorized",
|
|
82
|
+
403: "Forbidden",
|
|
83
|
+
404: "Not Found",
|
|
84
|
+
429: "Too Many Requests",
|
|
85
|
+
500: "Internal Server Error",
|
|
86
|
+
};
|
|
87
|
+
const SENS_ERROR_BODY_SPEC = [
|
|
88
|
+
["status", "number", true],
|
|
89
|
+
["errorMessage", "string", false],
|
|
90
|
+
["errors", "object", false],
|
|
91
|
+
];
|
|
92
|
+
const isSensErrorBody = (input) => {
|
|
93
|
+
if (typeof input !== "string")
|
|
94
|
+
return null;
|
|
95
|
+
try {
|
|
96
|
+
const data = JSON.parse(input);
|
|
97
|
+
if (!data || typeof data !== "object")
|
|
98
|
+
return null;
|
|
99
|
+
const isValid = SENS_ERROR_BODY_SPEC.every(([key, type, required]) => {
|
|
100
|
+
const value = data[key];
|
|
101
|
+
if (required && (value === undefined || value === null))
|
|
102
|
+
return false;
|
|
103
|
+
if (value !== undefined && typeof value !== type)
|
|
104
|
+
return false;
|
|
105
|
+
return true;
|
|
106
|
+
});
|
|
107
|
+
return isValid ? data : null;
|
|
108
|
+
}
|
|
109
|
+
catch (_a) {
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
const compact = (obj) => {
|
|
114
|
+
if (Array.isArray(obj)) {
|
|
115
|
+
return obj.map((item) => (0, exports.compact)(item));
|
|
116
|
+
}
|
|
117
|
+
if (typeof obj === "object" && obj !== null) {
|
|
118
|
+
return Object.fromEntries(Object.entries(obj)
|
|
119
|
+
.filter(([_, value]) => value !== undefined) // undefined 필드 제거
|
|
120
|
+
.map(([key, value]) => [key, (0, exports.compact)(value)]) // 내부 값 재귀 처리
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
return obj;
|
|
124
|
+
};
|
|
125
|
+
exports.compact = compact;
|
|
126
|
+
const isJsonResponse = (contentType) => {
|
|
127
|
+
return /application\/json/gi.exec(contentType || "") ? true : false;
|
|
63
128
|
};
|
|
64
|
-
exports.deserializeMetadata = deserializeMetadata;
|
package/dist-es/SensClient.js
CHANGED
|
@@ -1,49 +1,82 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SensClient = void 0;
|
|
4
|
+
const util_http_handler_1 = require("@ingestkorea/util-http-handler");
|
|
5
|
+
const index_js_1 = require("./models/index.js");
|
|
6
|
+
const index_js_2 = require("./middleware/index.js");
|
|
7
|
+
class SensClient {
|
|
5
8
|
constructor(config) {
|
|
9
|
+
this.httpHandler = new util_http_handler_1.NodeHttpHandler({ connectionTimeout: 3000, socketTimeout: 3000 });
|
|
10
|
+
this.requestHandler = async (input, context) => this.httpHandler.handle(input.request);
|
|
6
11
|
this.config = {
|
|
7
12
|
credentials: resolveCredentials(config),
|
|
8
13
|
serviceId: resolveServiceId(config),
|
|
9
14
|
};
|
|
10
|
-
this.requestHandler = new NodeHttpHandler({ connectionTimeout: 3000, socketTimeout: 3000 });
|
|
11
15
|
}
|
|
12
16
|
async send(command) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
const { input, serializer, deserializer } = command;
|
|
18
|
+
const middlewares = [index_js_2.middlewareIngestkoreaMetadata, index_js_2.middlewareNcpSign, index_js_2.middlewareRetry];
|
|
19
|
+
const handler = composeMiddleware(middlewares, this.requestHandler);
|
|
20
|
+
try {
|
|
21
|
+
const request = await serializer(input, this.config);
|
|
22
|
+
const { response } = await handler({ request }, this.config);
|
|
23
|
+
const output = await deserializer(response, this.config);
|
|
24
|
+
return output;
|
|
25
|
+
}
|
|
26
|
+
catch (e) {
|
|
27
|
+
throw e;
|
|
28
|
+
}
|
|
21
29
|
}
|
|
22
30
|
}
|
|
31
|
+
exports.SensClient = SensClient;
|
|
32
|
+
const composeMiddleware = (middlewares, finalHandler) => {
|
|
33
|
+
const handler = middlewares.reduceRight((next, middleware) => {
|
|
34
|
+
return middleware(next);
|
|
35
|
+
}, finalHandler);
|
|
36
|
+
return handler;
|
|
37
|
+
};
|
|
23
38
|
const resolveCredentials = (config) => {
|
|
24
39
|
const { credentials } = config;
|
|
40
|
+
let error = new index_js_1.SensError({
|
|
41
|
+
code: 401,
|
|
42
|
+
type: "Unauthorized",
|
|
43
|
+
message: "Invalid Credentials",
|
|
44
|
+
invalidInputs: [{ type: "not-valid.args", message: "SensClient 초기화시 인증 정보를 확인해주세요" }],
|
|
45
|
+
});
|
|
25
46
|
if (!credentials)
|
|
26
|
-
throw
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
47
|
+
throw error;
|
|
48
|
+
if (!credentials.accessKey) {
|
|
49
|
+
error.invalidInputs[0].message = "AccessKey 정보를 확인해주세요";
|
|
50
|
+
throw error;
|
|
51
|
+
}
|
|
52
|
+
if (!credentials.secretKey) {
|
|
53
|
+
error.invalidInputs[0].message = "SecretKey 정보를 확인해주세요";
|
|
54
|
+
throw error;
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
accessKey: credentials.accessKey,
|
|
58
|
+
secretKey: credentials.secretKey,
|
|
59
|
+
};
|
|
33
60
|
};
|
|
34
61
|
const resolveServiceId = (config) => {
|
|
62
|
+
var _a, _b, _c;
|
|
35
63
|
const { serviceId } = config;
|
|
36
|
-
|
|
37
|
-
code:
|
|
38
|
-
type: "
|
|
39
|
-
message: "Invalid
|
|
40
|
-
|
|
64
|
+
let error = new index_js_1.SensError({
|
|
65
|
+
code: 400,
|
|
66
|
+
type: "Bad Request",
|
|
67
|
+
message: "Invalid ServiceId",
|
|
68
|
+
invalidInputs: [{ type: "not-valid.args", message: "SensClient 초기화시 서비스 정보를 확인해주세요" }],
|
|
41
69
|
});
|
|
42
|
-
if (!serviceId
|
|
43
|
-
throw
|
|
70
|
+
if (!serviceId)
|
|
71
|
+
throw error;
|
|
72
|
+
const isReady = !!Object.values(serviceId).filter((d) => !!d).length;
|
|
73
|
+
if (!isReady) {
|
|
74
|
+
error.invalidInputs[0].message = "최소 1개 이상의 서비스 정보가 필요합니다";
|
|
75
|
+
throw error;
|
|
76
|
+
}
|
|
44
77
|
return {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
78
|
+
kakao: (_a = serviceId.kakao) !== null && _a !== void 0 ? _a : "",
|
|
79
|
+
push: (_b = serviceId.push) !== null && _b !== void 0 ? _b : "",
|
|
80
|
+
sms: (_c = serviceId.sms) !== null && _c !== void 0 ? _c : "",
|
|
48
81
|
};
|
|
49
82
|
};
|
|
@@ -1,26 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetAlimtalkResultCommand = void 0;
|
|
4
|
+
const index_js_1 = require("../models/index.js");
|
|
5
|
+
const GetAlimtalkResult_js_1 = require("../protocols/GetAlimtalkResult.js");
|
|
6
|
+
class GetAlimtalkResultCommand extends index_js_1.SensCommand {
|
|
5
7
|
constructor(input) {
|
|
6
8
|
super(input);
|
|
7
9
|
this.input = {
|
|
8
10
|
messageId: input.messageId,
|
|
9
11
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
if (!config.serviceId.kakao)
|
|
13
|
-
throw new IngestkoreaError({
|
|
14
|
-
code: 400,
|
|
15
|
-
type: "Bad Request",
|
|
16
|
-
message: "Invalid Params",
|
|
17
|
-
description: "Please Check Kakao ServiceId",
|
|
18
|
-
});
|
|
19
|
-
let request = await serializeIngestkorea_restJson_GetAlimtalkResultCommand(input, config);
|
|
20
|
-
return request;
|
|
21
|
-
}
|
|
22
|
-
async deserialize(response) {
|
|
23
|
-
let output = await deserializeIngestkorea_restJson_GetAlimtalkResultCommand(response);
|
|
24
|
-
return output;
|
|
12
|
+
this.serializer = GetAlimtalkResult_js_1.se_GetAlimtalkResultCommand;
|
|
13
|
+
this.deserializer = GetAlimtalkResult_js_1.de_GetAlimtalkResultCommand;
|
|
25
14
|
}
|
|
26
15
|
}
|
|
16
|
+
exports.GetAlimtalkResultCommand = GetAlimtalkResultCommand;
|
|
@@ -1,26 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetAlimtalkStatusCommand = void 0;
|
|
4
|
+
const index_js_1 = require("../models/index.js");
|
|
5
|
+
const GetAlimtalkStatus_js_1 = require("../protocols/GetAlimtalkStatus.js");
|
|
6
|
+
const MAX_LIMIT = 100;
|
|
7
|
+
const DEFAULT_LIMIT = 20;
|
|
8
|
+
class GetAlimtalkStatusCommand extends index_js_1.SensCommand {
|
|
5
9
|
constructor(input) {
|
|
10
|
+
var _a;
|
|
6
11
|
super(input);
|
|
7
12
|
this.input = {
|
|
8
13
|
requestId: input.requestId,
|
|
14
|
+
pageSize: Math.min(MAX_LIMIT, Math.max(1, (_a = input.pageSize) !== null && _a !== void 0 ? _a : DEFAULT_LIMIT)),
|
|
15
|
+
...(input.nextToken && { nextToken: input.nextToken }),
|
|
9
16
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
if (!config.serviceId.kakao)
|
|
13
|
-
throw new IngestkoreaError({
|
|
14
|
-
code: 400,
|
|
15
|
-
type: "Bad Request",
|
|
16
|
-
message: "Invalid Params",
|
|
17
|
-
description: "Please Check Kakao ServiceId",
|
|
18
|
-
});
|
|
19
|
-
let request = await serializeIngestkorea_restJson_GetAlimtalkStatusCommand(input, config);
|
|
20
|
-
return request;
|
|
21
|
-
}
|
|
22
|
-
async deserialize(response) {
|
|
23
|
-
let output = await deserializeIngestkorea_restJson_GetAlimtalkStatusCommand(response);
|
|
24
|
-
return output;
|
|
17
|
+
this.serializer = GetAlimtalkStatus_js_1.se_GetAlimtalkStatusCommand;
|
|
18
|
+
this.deserializer = GetAlimtalkStatus_js_1.de_GetAlimtalkStatusCommand;
|
|
25
19
|
}
|
|
26
20
|
}
|
|
21
|
+
exports.GetAlimtalkStatusCommand = GetAlimtalkStatusCommand;
|
|
@@ -1,27 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetAlimtalkTemplateCommand = void 0;
|
|
4
|
+
const index_js_1 = require("../models/index.js");
|
|
5
|
+
const GetAlimtalkTemplate_js_1 = require("../protocols/GetAlimtalkTemplate.js");
|
|
6
|
+
class GetAlimtalkTemplateCommand extends index_js_1.SensCommand {
|
|
5
7
|
constructor(input) {
|
|
6
8
|
super(input);
|
|
7
9
|
this.input = {
|
|
8
10
|
channelId: input.channelId,
|
|
9
11
|
templateCode: input.templateCode,
|
|
10
12
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if (!config.serviceId.kakao)
|
|
14
|
-
throw new IngestkoreaError({
|
|
15
|
-
code: 400,
|
|
16
|
-
type: "Bad Request",
|
|
17
|
-
message: "Invalid Params",
|
|
18
|
-
description: "Please Check Kakao ServiceId",
|
|
19
|
-
});
|
|
20
|
-
let request = await serializeIngestkorea_restJson_GetAlimtalkTemplateCommand(input, config);
|
|
21
|
-
return request;
|
|
22
|
-
}
|
|
23
|
-
async deserialize(response) {
|
|
24
|
-
let output = await deserializeIngestkorea_restJson_GetAlimtalkTemplateCommand(response);
|
|
25
|
-
return output;
|
|
13
|
+
this.serializer = GetAlimtalkTemplate_js_1.se_GetAlimtalkTemplateCommand;
|
|
14
|
+
this.deserializer = GetAlimtalkTemplate_js_1.de_GetAlimtalkTemplateCommand;
|
|
26
15
|
}
|
|
27
16
|
}
|
|
17
|
+
exports.GetAlimtalkTemplateCommand = GetAlimtalkTemplateCommand;
|
|
@@ -1,26 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetSMSResultCommand = void 0;
|
|
4
|
+
const index_js_1 = require("../models/index.js");
|
|
5
|
+
const GetSMSResult_js_1 = require("../protocols/GetSMSResult.js");
|
|
6
|
+
class GetSMSResultCommand extends index_js_1.SensCommand {
|
|
5
7
|
constructor(input) {
|
|
6
8
|
super(input);
|
|
7
9
|
this.input = {
|
|
8
|
-
|
|
10
|
+
messageId: input.messageId,
|
|
9
11
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
if (!config.serviceId.sms)
|
|
13
|
-
throw new IngestkoreaError({
|
|
14
|
-
code: 400,
|
|
15
|
-
type: "Bad Request",
|
|
16
|
-
message: "Invalid Params",
|
|
17
|
-
description: "Please Check SMS ServiceId",
|
|
18
|
-
});
|
|
19
|
-
let request = await serializeIngestkorea_restJson_GetSMSResultCommand(input, config);
|
|
20
|
-
return request;
|
|
21
|
-
}
|
|
22
|
-
async deserialize(response) {
|
|
23
|
-
let output = await deserializeIngestkorea_restJson_GetSMSResultCommand(response);
|
|
24
|
-
return output;
|
|
12
|
+
this.serializer = GetSMSResult_js_1.se_GetSMSResultCommand;
|
|
13
|
+
this.deserializer = GetSMSResult_js_1.de_GetSMSResultCommand;
|
|
25
14
|
}
|
|
26
15
|
}
|
|
16
|
+
exports.GetSMSResultCommand = GetSMSResultCommand;
|
|
@@ -1,26 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetSMSStatusCommand = void 0;
|
|
4
|
+
const index_js_1 = require("../models/index.js");
|
|
5
|
+
const GetSMSStatus_js_1 = require("../protocols/GetSMSStatus.js");
|
|
6
|
+
class GetSMSStatusCommand extends index_js_1.SensCommand {
|
|
5
7
|
constructor(input) {
|
|
6
8
|
super(input);
|
|
7
9
|
this.input = {
|
|
8
|
-
|
|
10
|
+
requestId: input.requestId,
|
|
9
11
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
if (!config.serviceId.sms)
|
|
13
|
-
throw new IngestkoreaError({
|
|
14
|
-
code: 400,
|
|
15
|
-
type: "Bad Request",
|
|
16
|
-
message: "Invalid Params",
|
|
17
|
-
description: "Please Check SMS ServiceId",
|
|
18
|
-
});
|
|
19
|
-
let request = await serializeIngestkorea_restJson_GetSMSStatusCommand(input, config);
|
|
20
|
-
return request;
|
|
21
|
-
}
|
|
22
|
-
async deserialize(response) {
|
|
23
|
-
let output = await deserializeIngestkorea_restJson_GetSMSStatusCommand(response);
|
|
24
|
-
return output;
|
|
12
|
+
this.serializer = GetSMSStatus_js_1.se_GetSMSStatusCommand;
|
|
13
|
+
this.deserializer = GetSMSStatus_js_1.de_GetSMSStatusCommand;
|
|
25
14
|
}
|
|
26
15
|
}
|
|
16
|
+
exports.GetSMSStatusCommand = GetSMSStatusCommand;
|
|
@@ -1,26 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ListAlimtalkChannelsCommand = void 0;
|
|
4
|
+
const index_js_1 = require("../models/index.js");
|
|
5
|
+
const ListAlimtalkChannels_js_1 = require("../protocols/ListAlimtalkChannels.js");
|
|
6
|
+
class ListAlimtalkChannelsCommand extends index_js_1.SensCommand {
|
|
5
7
|
constructor(input) {
|
|
6
8
|
super(input);
|
|
7
|
-
this.input = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
async serialize(input, config) {
|
|
12
|
-
if (!config.serviceId.kakao)
|
|
13
|
-
throw new IngestkoreaError({
|
|
14
|
-
code: 400,
|
|
15
|
-
type: "Bad Request",
|
|
16
|
-
message: "Invalid Params",
|
|
17
|
-
description: "Please Check Kakao ServiceId",
|
|
18
|
-
});
|
|
19
|
-
let request = await serializeIngestkorea_restJson_ListAlimtalkChannelsCommand(input, config);
|
|
20
|
-
return request;
|
|
21
|
-
}
|
|
22
|
-
async deserialize(response) {
|
|
23
|
-
let output = await deserializeIngestkorea_restJson_ListAlimtalkChannelsCommand(response);
|
|
24
|
-
return output;
|
|
9
|
+
this.input = {};
|
|
10
|
+
this.serializer = ListAlimtalkChannels_js_1.se_ListAlimtalkChannelsCommand;
|
|
11
|
+
this.deserializer = ListAlimtalkChannels_js_1.de_ListAlimtalkChannelsCommand;
|
|
25
12
|
}
|
|
26
13
|
}
|
|
14
|
+
exports.ListAlimtalkChannelsCommand = ListAlimtalkChannelsCommand;
|
|
@@ -1,38 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ListAlimtalkStatusCommand = void 0;
|
|
4
|
+
const index_js_1 = require("../models/index.js");
|
|
5
|
+
const ListAlimtalkStatus_js_1 = require("../protocols/ListAlimtalkStatus.js");
|
|
6
|
+
const KST_OFFSET = 9 * 60 * 60 * 1000;
|
|
7
|
+
const DURATION_LIMIT = 24 * 60 * 60 * 1000;
|
|
8
|
+
const MAX_LIMIT = 100;
|
|
9
|
+
const DEFAULT_LIMIT = 20;
|
|
10
|
+
class ListAlimtalkStatusCommand extends index_js_1.SensCommand {
|
|
6
11
|
constructor(input) {
|
|
12
|
+
var _a;
|
|
7
13
|
super(input);
|
|
8
|
-
const { startTime, endTime } =
|
|
14
|
+
const { startTime, endTime } = getDefaultRequestDurationKST({ durationLimit: DURATION_LIMIT });
|
|
9
15
|
this.input = {
|
|
10
16
|
plusFriendId: input.plusFriendId,
|
|
11
|
-
|
|
12
|
-
|
|
17
|
+
requestStartTime: input.requestStartTime ? input.requestStartTime : startTime,
|
|
18
|
+
requestEndTime: input.requestEndTime ? input.requestEndTime : endTime,
|
|
19
|
+
pageSize: Math.min(MAX_LIMIT, Math.max(1, (_a = input.pageSize) !== null && _a !== void 0 ? _a : DEFAULT_LIMIT)),
|
|
13
20
|
...(input.requestStatusName && { requestStatusName: input.requestStatusName }),
|
|
14
21
|
...(input.messageStatusName && { messageStatusName: input.messageStatusName }),
|
|
22
|
+
...(input.requestId && { requestId: input.requestId }),
|
|
23
|
+
...(input.messageId && { messageId: input.messageId }),
|
|
15
24
|
...(input.templateCode && { templateCode: input.templateCode }),
|
|
16
25
|
...(input.to && { to: input.to.replace(/\-/gi, "") }),
|
|
17
|
-
|
|
18
|
-
requestEndTime: input.requestEndTime ? input.requestEndTime : endTime,
|
|
19
|
-
pageIndex: input.pageIndex ? input.pageIndex : 0,
|
|
20
|
-
pageSize: input.pageSize && input.pageSize <= 100 ? input.pageSize : 20,
|
|
26
|
+
...(input.nextToken && { nextToken: input.nextToken }),
|
|
21
27
|
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if (!config.serviceId.kakao)
|
|
25
|
-
throw new IngestkoreaError({
|
|
26
|
-
code: 400,
|
|
27
|
-
type: "Bad Request",
|
|
28
|
-
message: "Invalid Params",
|
|
29
|
-
description: "Please Check Kakao ServiceId",
|
|
30
|
-
});
|
|
31
|
-
let request = await serializeIngestkorea_restJson_ListAlimtalkStatusCommand(input, config);
|
|
32
|
-
return request;
|
|
33
|
-
}
|
|
34
|
-
async deserialize(response) {
|
|
35
|
-
let output = await deserializeIngestkorea_restJson_ListAlimtalkStatusCommand(response);
|
|
36
|
-
return output;
|
|
28
|
+
this.serializer = ListAlimtalkStatus_js_1.se_ListAlimtalkStatusCommand;
|
|
29
|
+
this.deserializer = ListAlimtalkStatus_js_1.de_ListAlimtalkStatusCommand;
|
|
37
30
|
}
|
|
38
31
|
}
|
|
32
|
+
exports.ListAlimtalkStatusCommand = ListAlimtalkStatusCommand;
|
|
33
|
+
const getDefaultRequestDurationKST = (config) => {
|
|
34
|
+
const now = new Date().getTime() + KST_OFFSET;
|
|
35
|
+
return {
|
|
36
|
+
startTime: new Date(now - config.durationLimit).toISOString().replace(/\.\d{3}Z$/, ""),
|
|
37
|
+
endTime: new Date(now).toISOString().replace(/\.\d{3}Z$/, ""),
|
|
38
|
+
};
|
|
39
|
+
};
|
|
@@ -1,26 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ListAlimtalkTemplatesCommand = void 0;
|
|
4
|
+
const index_js_1 = require("../models/index.js");
|
|
5
|
+
const ListAlimtalkTemplates_js_1 = require("../protocols/ListAlimtalkTemplates.js");
|
|
6
|
+
class ListAlimtalkTemplatesCommand extends index_js_1.SensCommand {
|
|
5
7
|
constructor(input) {
|
|
6
8
|
super(input);
|
|
7
9
|
this.input = {
|
|
8
10
|
channelId: input.channelId,
|
|
9
11
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
if (!config.serviceId.kakao)
|
|
13
|
-
throw new IngestkoreaError({
|
|
14
|
-
code: 400,
|
|
15
|
-
type: "Bad Request",
|
|
16
|
-
message: "Invalid Params",
|
|
17
|
-
description: "Please Check Kakao ServiceId",
|
|
18
|
-
});
|
|
19
|
-
let request = await serializeIngestkorea_restJson_ListAlimtalkTemplatesCommand(input, config);
|
|
20
|
-
return request;
|
|
21
|
-
}
|
|
22
|
-
async deserialize(response) {
|
|
23
|
-
let output = await deserializeIngestkorea_restJson_ListAlimtalkTemplatesCommand(response);
|
|
24
|
-
return output;
|
|
12
|
+
this.serializer = ListAlimtalkTemplates_js_1.se_ListAlimtalkTemplatesCommand;
|
|
13
|
+
this.deserializer = ListAlimtalkTemplates_js_1.de_ListAlimtalkTemplatesCommand;
|
|
25
14
|
}
|
|
26
15
|
}
|
|
16
|
+
exports.ListAlimtalkTemplatesCommand = ListAlimtalkTemplatesCommand;
|