@ingestkorea/client-sens 1.10.0 → 1.11.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/README.md +98 -57
- package/dist-cjs/SensClient.js +31 -35
- package/dist-cjs/commands/GetAlimtalkResultCommand.js +3 -0
- package/dist-cjs/commands/GetAlimtalkStatusCommand.js +8 -1
- package/dist-cjs/commands/GetAlimtalkTemplateCommand.js +3 -0
- package/dist-cjs/commands/GetSMSResultCommand.js +3 -0
- package/dist-cjs/commands/GetSMSStatusCommand.js +8 -1
- package/dist-cjs/commands/ListAlimtalkChannelsCommand.js +3 -0
- package/dist-cjs/commands/ListAlimtalkStatusCommand.js +17 -3
- package/dist-cjs/commands/ListAlimtalkTemplatesCommand.js +3 -0
- package/dist-cjs/commands/ListSMSStatusCommand.js +16 -3
- package/dist-cjs/commands/SendAlimtalkCommand.js +9 -1
- package/dist-cjs/commands/SendMMSCommand.js +7 -4
- package/dist-cjs/commands/SendSMSCommand.js +23 -9
- package/dist-cjs/commands/constants.js +2 -2
- package/dist-cjs/index.js +1 -1
- package/dist-cjs/middleware/constants.js +2 -1
- package/dist-cjs/middleware/middleware-metadata.js +7 -12
- package/dist-cjs/middleware/middleware-retry.js +37 -20
- package/dist-cjs/middleware/middleware-sign.js +8 -12
- package/dist-cjs/models/{SensErrorInfo.js → SensApiError.js} +1 -11
- package/dist-cjs/models/{SensError.js → SensClientError.js} +4 -0
- package/dist-cjs/models/SensCommand.js +1 -0
- package/dist-cjs/models/index.js +2 -2
- package/dist-cjs/protocols/GetAlimtalkResult.js +14 -17
- package/dist-cjs/protocols/GetAlimtalkStatus.js +21 -17
- package/dist-cjs/protocols/GetAlimtalkTemplate.js +29 -17
- package/dist-cjs/protocols/GetSMSResult.js +16 -17
- package/dist-cjs/protocols/GetSMSStatus.js +10 -16
- package/dist-cjs/protocols/ListAlimtalkChannels.js +10 -16
- package/dist-cjs/protocols/ListAlimtalkStatus.js +10 -16
- package/dist-cjs/protocols/ListAlimtalkTemplates.js +12 -19
- package/dist-cjs/protocols/ListSMSStatus.js +10 -16
- package/dist-cjs/protocols/SendAlimtalk.js +10 -16
- package/dist-cjs/protocols/SendMMS.js +4 -13
- package/dist-cjs/protocols/SendSMS.js +11 -17
- package/dist-cjs/protocols/constants.js +91 -75
- package/dist-es/SensClient.js +25 -22
- package/dist-es/commands/GetAlimtalkResultCommand.js +8 -9
- package/dist-es/commands/GetAlimtalkStatusCommand.js +8 -9
- package/dist-es/commands/GetAlimtalkTemplateCommand.js +8 -9
- package/dist-es/commands/GetSMSResultCommand.js +8 -9
- package/dist-es/commands/GetSMSStatusCommand.js +8 -9
- package/dist-es/commands/ListAlimtalkChannelsCommand.js +8 -9
- package/dist-es/commands/ListAlimtalkStatusCommand.js +19 -21
- package/dist-es/commands/ListAlimtalkTemplatesCommand.js +8 -9
- package/dist-es/commands/ListSMSStatusCommand.js +20 -22
- package/dist-es/commands/SendAlimtalkCommand.js +12 -13
- package/dist-es/commands/SendMMSCommand.js +28 -29
- package/dist-es/commands/SendSMSCommand.js +20 -22
- package/dist-es/commands/constants.js +12 -22
- package/dist-es/commands/index.js +12 -28
- package/dist-es/index.js +3 -19
- package/dist-es/middleware/constants.js +8 -10
- package/dist-es/middleware/index.js +3 -19
- package/dist-es/middleware/middleware-metadata.js +4 -7
- package/dist-es/middleware/middleware-retry.js +39 -19
- package/dist-es/middleware/middleware-sign.js +9 -13
- package/dist-es/models/GetAlimtalkResult.js +1 -2
- package/dist-es/models/GetAlimtalkStatus.js +1 -2
- package/dist-es/models/GetAlimtalkTemplate.js +1 -2
- package/dist-es/models/GetSMSResult.js +1 -2
- package/dist-es/models/GetSMSStatus.js +1 -2
- package/dist-es/models/ListAlimtalkChannels.js +1 -2
- package/dist-es/models/ListAlimtalkStatus.js +1 -2
- package/dist-es/models/ListAlimtalkTemplates.js +1 -2
- package/dist-es/models/ListSMSStatus.js +1 -2
- package/dist-es/models/MetadataBearer.js +1 -2
- package/dist-es/models/SendAlimtalk.js +2 -5
- package/dist-es/models/SendMMS.js +2 -5
- package/dist-es/models/SendSMS.js +1 -2
- package/dist-es/models/SensApiError.js +18 -0
- package/dist-es/models/SensClient.js +1 -2
- package/dist-es/models/{SensError.js → SensClientError.js} +5 -5
- package/dist-es/models/SensCommand.js +2 -5
- package/dist-es/models/SensMiddleware.js +1 -2
- package/dist-es/models/index.js +18 -34
- package/dist-es/protocols/GetAlimtalkResult.js +11 -16
- package/dist-es/protocols/GetAlimtalkStatus.js +17 -24
- package/dist-es/protocols/GetAlimtalkTemplate.js +12 -17
- package/dist-es/protocols/GetSMSResult.js +11 -16
- package/dist-es/protocols/GetSMSStatus.js +15 -22
- package/dist-es/protocols/ListAlimtalkChannels.js +11 -16
- package/dist-es/protocols/ListAlimtalkStatus.js +11 -16
- package/dist-es/protocols/ListAlimtalkTemplates.js +15 -22
- package/dist-es/protocols/ListSMSStatus.js +11 -16
- package/dist-es/protocols/SendAlimtalk.js +12 -18
- package/dist-es/protocols/SendMMS.js +5 -10
- package/dist-es/protocols/SendSMS.js +12 -18
- package/dist-es/protocols/constants.js +96 -84
- package/dist-types/SensClient.d.ts +0 -1
- package/dist-types/index.d.ts +1 -1
- package/dist-types/middleware/constants.d.ts +1 -0
- package/dist-types/models/MetadataBearer.d.ts +1 -0
- package/dist-types/models/{SensErrorInfo.d.ts → SensApiError.d.ts} +0 -2
- package/dist-types/models/SensClient.d.ts +8 -0
- package/dist-types/models/{SensError.d.ts → SensClientError.d.ts} +3 -2
- package/dist-types/models/index.d.ts +2 -2
- package/package.json +4 -4
- package/dist-es/models/SensErrorInfo.js +0 -31
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NCP_SIGNATURE = exports.NCP_TIMESTAMP = exports.NCP_ACCESS_KEY = exports.INGESTKOREA_RETRY_DELAY = exports.INGESTKOREA_RETRY = exports.INGESTKOREA_REQUEST_LOG = exports.INGESTKOREA_USER_AGENT = void 0;
|
|
3
|
+
exports.NCP_TRACE_ID = exports.NCP_SIGNATURE = exports.NCP_TIMESTAMP = exports.NCP_ACCESS_KEY = exports.INGESTKOREA_RETRY_DELAY = exports.INGESTKOREA_RETRY = exports.INGESTKOREA_REQUEST_LOG = exports.INGESTKOREA_USER_AGENT = void 0;
|
|
4
4
|
exports.INGESTKOREA_USER_AGENT = "x-ingestkorea-user-agent";
|
|
5
5
|
exports.INGESTKOREA_REQUEST_LOG = "x-ingestkorea-request";
|
|
6
6
|
exports.INGESTKOREA_RETRY = "x-ingestkorea-attempts";
|
|
@@ -8,3 +8,4 @@ exports.INGESTKOREA_RETRY_DELAY = "x-ingestkorea-total-retry-delay";
|
|
|
8
8
|
exports.NCP_ACCESS_KEY = "x-ncp-iam-access-key";
|
|
9
9
|
exports.NCP_TIMESTAMP = "x-ncp-apigw-timestamp";
|
|
10
10
|
exports.NCP_SIGNATURE = "x-ncp-apigw-signature-v2";
|
|
11
|
+
exports.NCP_TRACE_ID = "x-ncp-trace-id";
|
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.middlewareIngestkoreaMetadata = void 0;
|
|
13
4
|
const constants_js_1 = require("./constants.js");
|
|
14
|
-
const middlewareIngestkoreaMetadata = (next) => (input, context) =>
|
|
15
|
-
input.request.headers =
|
|
5
|
+
const middlewareIngestkoreaMetadata = (next) => async (input, context) => {
|
|
6
|
+
input.request.headers = {
|
|
7
|
+
...input.request.headers,
|
|
8
|
+
[constants_js_1.INGESTKOREA_USER_AGENT]: "@ingestkorea/client-sens/1.11.x",
|
|
9
|
+
connection: context.httpHandler.keepAlive ? "keep-alive" : "close", // temp
|
|
10
|
+
};
|
|
16
11
|
return next(input, context);
|
|
17
|
-
}
|
|
12
|
+
};
|
|
18
13
|
exports.middlewareIngestkoreaMetadata = middlewareIngestkoreaMetadata;
|
|
@@ -1,50 +1,67 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.middlewareRetry = void 0;
|
|
4
|
+
const util_http_handler_1 = require("@ingestkorea/util-http-handler");
|
|
13
5
|
const index_js_1 = require("../models/index.js");
|
|
14
6
|
const constants_js_1 = require("./constants.js");
|
|
15
|
-
const
|
|
7
|
+
const RETRYABLE_ERROR_TYPE = [
|
|
8
|
+
"SDK.TIMEOUT",
|
|
9
|
+
"SDK.NETWORK_ERROR",
|
|
10
|
+
"Too Many Requests",
|
|
11
|
+
"Internal Server Error",
|
|
12
|
+
];
|
|
13
|
+
const middlewareRetry = (next) => async (input, context) => {
|
|
16
14
|
const MAX_RETRIES = 3;
|
|
17
15
|
const MIN_DELAY_MS = 300;
|
|
18
16
|
const BASE_DELAY_MS = 500;
|
|
19
|
-
const MAX_DELAY_MS =
|
|
17
|
+
const MAX_DELAY_MS = 5_000;
|
|
20
18
|
let attempts = 0;
|
|
21
19
|
let totalRetryDelay = 0;
|
|
22
|
-
input.request.headers =
|
|
20
|
+
input.request.headers = input.request.headers ?? {};
|
|
23
21
|
while (attempts < MAX_RETRIES) {
|
|
24
22
|
attempts++;
|
|
25
23
|
const requestLog = `attempt=${attempts}; max=${MAX_RETRIES}; totalRetryDelay=${totalRetryDelay}`;
|
|
26
24
|
input.request.headers[constants_js_1.INGESTKOREA_REQUEST_LOG] = requestLog;
|
|
27
25
|
try {
|
|
28
|
-
const { response } =
|
|
26
|
+
const { response } = await next(input, context);
|
|
29
27
|
response.headers[constants_js_1.INGESTKOREA_RETRY] = attempts.toString();
|
|
30
28
|
response.headers[constants_js_1.INGESTKOREA_RETRY_DELAY] = totalRetryDelay.toString();
|
|
31
29
|
return { response };
|
|
32
30
|
}
|
|
33
31
|
catch (error) {
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
let currentError;
|
|
33
|
+
if (error instanceof index_js_1.SensError) {
|
|
34
|
+
currentError = error;
|
|
35
|
+
}
|
|
36
|
+
else if (error instanceof util_http_handler_1.HttpHandlerError) {
|
|
37
|
+
currentError = new index_js_1.SensError({
|
|
36
38
|
code: -1,
|
|
37
|
-
type:
|
|
38
|
-
message: error
|
|
39
|
+
type: error.code,
|
|
40
|
+
message: error.message,
|
|
39
41
|
});
|
|
40
42
|
}
|
|
41
|
-
|
|
43
|
+
else {
|
|
44
|
+
currentError = new index_js_1.SensError({
|
|
45
|
+
code: -1,
|
|
46
|
+
type: "SDK.UNKNOWN_ERROR",
|
|
47
|
+
message: error instanceof Error ? error.message : String(error),
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
const isRetryable = RETRYABLE_ERROR_TYPE.some((type) => currentError.type.startsWith(type));
|
|
51
|
+
if (!isRetryable) {
|
|
52
|
+
throw currentError;
|
|
53
|
+
}
|
|
54
|
+
if (attempts >= MAX_RETRIES) {
|
|
55
|
+
currentError.errors.push(requestLog);
|
|
56
|
+
throw currentError;
|
|
57
|
+
}
|
|
58
|
+
const exp = BASE_DELAY_MS * 2 ** (attempts - 1);
|
|
42
59
|
const capped = Math.min(MAX_DELAY_MS, exp);
|
|
43
60
|
const baseWait = Math.max(MIN_DELAY_MS, Math.floor(capped / 2));
|
|
44
61
|
const jitter = Math.floor(Math.random() * (capped - baseWait));
|
|
45
62
|
const delay = baseWait + jitter;
|
|
46
63
|
totalRetryDelay += delay;
|
|
47
|
-
|
|
64
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
48
65
|
}
|
|
49
66
|
}
|
|
50
67
|
throw new index_js_1.SensError({
|
|
@@ -52,5 +69,5 @@ const middlewareRetry = (next) => (input, context) => __awaiter(void 0, void 0,
|
|
|
52
69
|
type: "SDK.UNKNOWN_ERROR",
|
|
53
70
|
message: "Unexpected retry loop termination",
|
|
54
71
|
});
|
|
55
|
-
}
|
|
72
|
+
};
|
|
56
73
|
exports.middlewareRetry = middlewareRetry;
|
|
@@ -1,19 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.middlewareNcpSign = void 0;
|
|
13
4
|
const crypto_1 = require("crypto");
|
|
14
5
|
const util_http_handler_1 = require("@ingestkorea/util-http-handler");
|
|
15
6
|
const constants_js_1 = require("./constants.js");
|
|
16
|
-
const middlewareNcpSign = (next) => (input, context) =>
|
|
7
|
+
const middlewareNcpSign = (next) => async (input, context) => {
|
|
17
8
|
const { accessKey, secretKey } = context.credentials;
|
|
18
9
|
const method = input.request.method;
|
|
19
10
|
const queryString = (0, util_http_handler_1.buildQueryString)(input.request.query);
|
|
@@ -23,7 +14,12 @@ const middlewareNcpSign = (next) => (input, context) => __awaiter(void 0, void 0
|
|
|
23
14
|
const timestamp = new Date().getTime().toString();
|
|
24
15
|
const stringToSign = [method + space + path, timestamp, accessKey].join(newLine);
|
|
25
16
|
const signature = (0, crypto_1.createHmac)("sha256", secretKey).update(stringToSign).digest("base64");
|
|
26
|
-
input.request.headers =
|
|
17
|
+
input.request.headers = {
|
|
18
|
+
...input.request.headers,
|
|
19
|
+
[constants_js_1.NCP_ACCESS_KEY]: accessKey,
|
|
20
|
+
[constants_js_1.NCP_TIMESTAMP]: timestamp,
|
|
21
|
+
[constants_js_1.NCP_SIGNATURE]: signature,
|
|
22
|
+
};
|
|
27
23
|
return next(input, context);
|
|
28
|
-
}
|
|
24
|
+
};
|
|
29
25
|
exports.middlewareNcpSign = middlewareNcpSign;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.NCLOUD_ERROR_CODE_SPEC = exports.SENS_ERROR_CODE_SPEC = void 0;
|
|
4
4
|
exports.SENS_ERROR_CODE_SPEC = {
|
|
5
5
|
400: "Bad Request",
|
|
6
6
|
401: "Unauthorized",
|
|
@@ -19,13 +19,3 @@ exports.NCLOUD_ERROR_CODE_SPEC = {
|
|
|
19
19
|
"420": { status: 429, type: exports.SENS_ERROR_CODE_SPEC["429"] },
|
|
20
20
|
"900": { status: 500, type: exports.SENS_ERROR_CODE_SPEC["500"] },
|
|
21
21
|
};
|
|
22
|
-
exports.SENS_ERROR_BODY_SPEC = [
|
|
23
|
-
["status", "number", true],
|
|
24
|
-
["errorMessage", "string", false],
|
|
25
|
-
["errors", "object", false],
|
|
26
|
-
];
|
|
27
|
-
exports.NCLOUD_ERROR_BODY_SPEC = [
|
|
28
|
-
["errorCode", "string", true],
|
|
29
|
-
["message", "string", false],
|
|
30
|
-
["details", "string", false],
|
|
31
|
-
];
|
package/dist-cjs/models/index.js
CHANGED
|
@@ -27,8 +27,8 @@ __exportStar(require("./MetadataBearer.js"), exports);
|
|
|
27
27
|
__exportStar(require("./SendAlimtalk.js"), exports);
|
|
28
28
|
__exportStar(require("./SendMMS.js"), exports);
|
|
29
29
|
__exportStar(require("./SendSMS.js"), exports);
|
|
30
|
+
__exportStar(require("./SensApiError.js"), exports);
|
|
30
31
|
__exportStar(require("./SensClient.js"), exports);
|
|
32
|
+
__exportStar(require("./SensClientError.js"), exports);
|
|
31
33
|
__exportStar(require("./SensCommand.js"), exports);
|
|
32
|
-
__exportStar(require("./SensError.js"), exports);
|
|
33
|
-
__exportStar(require("./SensErrorInfo.js"), exports);
|
|
34
34
|
__exportStar(require("./SensMiddleware.js"), exports);
|
|
@@ -1,19 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.de_GetAlimtalkResultCommand = exports.se_GetAlimtalkResultCommand = void 0;
|
|
13
4
|
const util_http_handler_1 = require("@ingestkorea/util-http-handler");
|
|
14
5
|
const constants_js_1 = require("./constants.js");
|
|
15
6
|
const GetAlimtalkStatus_js_1 = require("./GetAlimtalkStatus.js");
|
|
16
|
-
const se_GetAlimtalkResultCommand = (input, config) =>
|
|
7
|
+
const se_GetAlimtalkResultCommand = async (input, config) => {
|
|
17
8
|
const hostname = "sens.apigw.ntruss.com";
|
|
18
9
|
const path = "/alimtalk/v2/services/" + config.serviceId.kakao + "/messages/" + input.messageId;
|
|
19
10
|
const headers = {
|
|
@@ -26,18 +17,24 @@ const se_GetAlimtalkResultCommand = (input, config) => __awaiter(void 0, void 0,
|
|
|
26
17
|
path,
|
|
27
18
|
headers,
|
|
28
19
|
});
|
|
29
|
-
}
|
|
20
|
+
};
|
|
30
21
|
exports.se_GetAlimtalkResultCommand = se_GetAlimtalkResultCommand;
|
|
31
|
-
const de_GetAlimtalkResultCommand = (response, config) =>
|
|
22
|
+
const de_GetAlimtalkResultCommand = async (response, config) => {
|
|
32
23
|
if (response.statusCode >= 300)
|
|
33
|
-
|
|
34
|
-
const data =
|
|
24
|
+
await (0, constants_js_1.parseErrorBody)(response);
|
|
25
|
+
const data = await (0, constants_js_1.parseBody)(response);
|
|
35
26
|
const contents = de_GetAlimtalkResultResult(data);
|
|
36
|
-
return
|
|
37
|
-
|
|
27
|
+
return {
|
|
28
|
+
$metadata: (0, constants_js_1.deserializeMetadata)(response),
|
|
29
|
+
...(0, constants_js_1.compact)(contents),
|
|
30
|
+
};
|
|
31
|
+
};
|
|
38
32
|
exports.de_GetAlimtalkResultCommand = de_GetAlimtalkResultCommand;
|
|
39
33
|
const de_GetAlimtalkResultResult = (output) => {
|
|
40
|
-
return
|
|
34
|
+
return {
|
|
35
|
+
...(0, GetAlimtalkStatus_js_1.de_AlimtalkMessageStatus)(output),
|
|
36
|
+
failover: output.failover ? de_Failover(output.failover) : undefined,
|
|
37
|
+
};
|
|
41
38
|
};
|
|
42
39
|
const de_Failover = (output) => {
|
|
43
40
|
return {
|
|
@@ -1,19 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.de_AlimtalkMessageStatus = exports.de_GetAlimtalkStatusResult = exports.de_GetAlimtalkStatusCommand = exports.se_GetAlimtalkStatusCommand = void 0;
|
|
13
4
|
const util_http_handler_1 = require("@ingestkorea/util-http-handler");
|
|
14
5
|
const constants_js_1 = require("./constants.js");
|
|
15
6
|
const SendAlimtalk_js_1 = require("./SendAlimtalk.js");
|
|
16
|
-
const se_GetAlimtalkStatusCommand = (input, config) =>
|
|
7
|
+
const se_GetAlimtalkStatusCommand = async (input, config) => {
|
|
17
8
|
const hostname = "sens.apigw.ntruss.com";
|
|
18
9
|
const path = "/alimtalk/v2/services/" + config.serviceId.kakao + "/messages";
|
|
19
10
|
const headers = {
|
|
@@ -33,15 +24,18 @@ const se_GetAlimtalkStatusCommand = (input, config) => __awaiter(void 0, void 0,
|
|
|
33
24
|
headers,
|
|
34
25
|
query,
|
|
35
26
|
});
|
|
36
|
-
}
|
|
27
|
+
};
|
|
37
28
|
exports.se_GetAlimtalkStatusCommand = se_GetAlimtalkStatusCommand;
|
|
38
|
-
const de_GetAlimtalkStatusCommand = (response, config) =>
|
|
29
|
+
const de_GetAlimtalkStatusCommand = async (response, config) => {
|
|
39
30
|
if (response.statusCode >= 300)
|
|
40
|
-
|
|
41
|
-
const data =
|
|
31
|
+
await (0, constants_js_1.parseErrorBody)(response);
|
|
32
|
+
const data = await (0, constants_js_1.parseBody)(response);
|
|
42
33
|
const contents = (0, exports.de_GetAlimtalkStatusResult)(data);
|
|
43
|
-
return
|
|
44
|
-
|
|
34
|
+
return {
|
|
35
|
+
$metadata: (0, constants_js_1.deserializeMetadata)(response),
|
|
36
|
+
...(0, constants_js_1.compact)(contents),
|
|
37
|
+
};
|
|
38
|
+
};
|
|
45
39
|
exports.de_GetAlimtalkStatusCommand = de_GetAlimtalkStatusCommand;
|
|
46
40
|
const de_GetAlimtalkStatusResult = (output) => {
|
|
47
41
|
return {
|
|
@@ -61,6 +55,16 @@ const de_AlimtalkMessageStatusList = (output) => {
|
|
|
61
55
|
return (output || []).filter((e) => e != null).map((entry) => (0, exports.de_AlimtalkMessageStatus)(entry));
|
|
62
56
|
};
|
|
63
57
|
const de_AlimtalkMessageStatus = (output) => {
|
|
64
|
-
return
|
|
58
|
+
return {
|
|
59
|
+
...(0, SendAlimtalk_js_1.de_AlimtalkMessageRequestStatus)(output),
|
|
60
|
+
requestId: output.requestId ? output.requestId : undefined,
|
|
61
|
+
requestTime: output.requestTime ? (0, constants_js_1.convertToUtc)(output.requestTime) : undefined,
|
|
62
|
+
plusFriendId: output.plusFriendId ? output.plusFriendId : undefined,
|
|
63
|
+
templateCode: output.templateCode ? output.templateCode : undefined,
|
|
64
|
+
completeTime: output.completeTime ? (0, constants_js_1.convertToUtc)(output.completeTime) : undefined,
|
|
65
|
+
messageStatusCode: output.messageStatusCode ? output.messageStatusCode : undefined,
|
|
66
|
+
messageStatusName: output.messageStatusName ? output.messageStatusName : undefined,
|
|
67
|
+
messageStatusDesc: output.messageStatusDesc ? output.messageStatusDesc : undefined,
|
|
68
|
+
};
|
|
65
69
|
};
|
|
66
70
|
exports.de_AlimtalkMessageStatus = de_AlimtalkMessageStatus;
|
|
@@ -1,19 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.de_GetAlimtalkTemplateCommand = exports.se_GetAlimtalkTemplateCommand = void 0;
|
|
13
4
|
const util_http_handler_1 = require("@ingestkorea/util-http-handler");
|
|
14
5
|
const constants_js_1 = require("./constants.js");
|
|
15
6
|
const ListAlimtalkTemplates_js_1 = require("./ListAlimtalkTemplates.js");
|
|
16
|
-
const se_GetAlimtalkTemplateCommand = (input, config) =>
|
|
7
|
+
const se_GetAlimtalkTemplateCommand = async (input, config) => {
|
|
17
8
|
const hostname = "sens.apigw.ntruss.com";
|
|
18
9
|
const path = "/alimtalk/v2/services/" + config.serviceId.kakao + "/templates";
|
|
19
10
|
const headers = {
|
|
@@ -31,15 +22,18 @@ const se_GetAlimtalkTemplateCommand = (input, config) => __awaiter(void 0, void
|
|
|
31
22
|
query,
|
|
32
23
|
headers,
|
|
33
24
|
});
|
|
34
|
-
}
|
|
25
|
+
};
|
|
35
26
|
exports.se_GetAlimtalkTemplateCommand = se_GetAlimtalkTemplateCommand;
|
|
36
|
-
const de_GetAlimtalkTemplateCommand = (response, config) =>
|
|
27
|
+
const de_GetAlimtalkTemplateCommand = async (response, config) => {
|
|
37
28
|
if (response.statusCode >= 300)
|
|
38
|
-
|
|
39
|
-
const data =
|
|
29
|
+
await (0, constants_js_1.parseErrorBody)(response);
|
|
30
|
+
const data = await (0, constants_js_1.parseBody)(response);
|
|
40
31
|
const contents = de_GetAlimtalkTemplateResult(data);
|
|
41
|
-
return
|
|
42
|
-
|
|
32
|
+
return {
|
|
33
|
+
$metadata: (0, constants_js_1.deserializeMetadata)(response),
|
|
34
|
+
...(0, constants_js_1.compact)(contents),
|
|
35
|
+
};
|
|
36
|
+
};
|
|
43
37
|
exports.de_GetAlimtalkTemplateCommand = de_GetAlimtalkTemplateCommand;
|
|
44
38
|
const de_GetAlimtalkTemplateResult = (output) => {
|
|
45
39
|
return {
|
|
@@ -50,7 +44,25 @@ const de_TemplateDetailList = (output) => {
|
|
|
50
44
|
return (output || []).filter((e) => e != null).map((entry) => de_TemplateDetail(entry));
|
|
51
45
|
};
|
|
52
46
|
const de_TemplateDetail = (output) => {
|
|
53
|
-
return
|
|
47
|
+
return {
|
|
48
|
+
...(0, ListAlimtalkTemplates_js_1.de_Template)(output),
|
|
49
|
+
categoryCode: output.categoryCode != undefined ? output.categoryCode : undefined,
|
|
50
|
+
categoryName: output.categoryName != undefined ? output.categoryName : undefined,
|
|
51
|
+
messageType: output.messageType != undefined ? output.messageType : undefined,
|
|
52
|
+
emphasizeType: output.emphasizeType != undefined ? output.emphasizeType : undefined,
|
|
53
|
+
content: output.content != undefined ? output.content : undefined,
|
|
54
|
+
adContent: output.adContent != undefined ? output.adContent : undefined,
|
|
55
|
+
extraContent: output.extraContent != undefined ? output.extraContent : undefined,
|
|
56
|
+
title: output.title != undefined ? output.title : undefined,
|
|
57
|
+
additionalTitle: output.additionalTitle != undefined ? output.additionalTitle : undefined,
|
|
58
|
+
comments: output.comments != undefined ? de_CommentList(output.comments) : [],
|
|
59
|
+
templateInspectionStatus: output.templateInspectionStatus != undefined ? output.templateInspectionStatus : undefined,
|
|
60
|
+
templateStatus: output.templateStatus != undefined ? output.templateStatus : undefined,
|
|
61
|
+
buttons: output.buttons != undefined ? de_TemplateButtonExtendList(output.buttons) : [],
|
|
62
|
+
securityFlag: output.securityFlag !== undefined ? output.securityFlag : undefined,
|
|
63
|
+
isBlock: output.isBlock !== undefined ? output.isBlock : undefined,
|
|
64
|
+
isDormant: output.isDormant !== undefined ? output.isDormant : undefined,
|
|
65
|
+
};
|
|
54
66
|
};
|
|
55
67
|
const de_CommentList = (output) => {
|
|
56
68
|
return (output || []).filter((e) => e != null).map((entry) => de_Comment(entry));
|
|
@@ -1,19 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.de_GetSMSResultCommand = exports.se_GetSMSResultCommand = void 0;
|
|
13
4
|
const util_http_handler_1 = require("@ingestkorea/util-http-handler");
|
|
14
5
|
const constants_js_1 = require("./constants.js");
|
|
15
6
|
const GetSMSStatus_js_1 = require("./GetSMSStatus.js");
|
|
16
|
-
const se_GetSMSResultCommand = (input, config) =>
|
|
7
|
+
const se_GetSMSResultCommand = async (input, config) => {
|
|
17
8
|
const hostname = "sens.apigw.ntruss.com";
|
|
18
9
|
const path = "/sms/v2/services/" + config.serviceId.sms + "/messages" + "/" + input.messageId;
|
|
19
10
|
const headers = {
|
|
@@ -26,15 +17,18 @@ const se_GetSMSResultCommand = (input, config) => __awaiter(void 0, void 0, void
|
|
|
26
17
|
path,
|
|
27
18
|
headers,
|
|
28
19
|
});
|
|
29
|
-
}
|
|
20
|
+
};
|
|
30
21
|
exports.se_GetSMSResultCommand = se_GetSMSResultCommand;
|
|
31
|
-
const de_GetSMSResultCommand = (response, config) =>
|
|
22
|
+
const de_GetSMSResultCommand = async (response, config) => {
|
|
32
23
|
if (response.statusCode >= 300)
|
|
33
|
-
|
|
34
|
-
const data =
|
|
24
|
+
await (0, constants_js_1.parseErrorBody)(response);
|
|
25
|
+
const data = await (0, constants_js_1.parseBody)(response);
|
|
35
26
|
const contents = de_GetSMSResultResult(data);
|
|
36
|
-
return
|
|
37
|
-
|
|
27
|
+
return {
|
|
28
|
+
$metadata: (0, constants_js_1.deserializeMetadata)(response),
|
|
29
|
+
...(0, constants_js_1.compact)(contents),
|
|
30
|
+
};
|
|
31
|
+
};
|
|
38
32
|
exports.de_GetSMSResultCommand = de_GetSMSResultCommand;
|
|
39
33
|
const de_GetSMSResultResult = (output) => {
|
|
40
34
|
return {
|
|
@@ -47,7 +41,12 @@ const de_SMSMessageStatusList = (output) => {
|
|
|
47
41
|
return (output || []).filter((e) => e != null).map((entry) => de_SMSMessageStatus(entry));
|
|
48
42
|
};
|
|
49
43
|
const de_SMSMessageStatus = (output) => {
|
|
50
|
-
return
|
|
44
|
+
return {
|
|
45
|
+
...(0, GetSMSStatus_js_1.de_SMSMessageRequestStatus)(output),
|
|
46
|
+
subject: output.subject ? output.subject : undefined,
|
|
47
|
+
content: output.content ? output.content : undefined,
|
|
48
|
+
files: output.files ? de_FileList(output.files) : [],
|
|
49
|
+
};
|
|
51
50
|
};
|
|
52
51
|
const de_FileList = (output) => {
|
|
53
52
|
return (output || []).filter((e) => e != null).map((entry) => de_File(entry));
|
|
@@ -1,18 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.de_SMSMessageRequestStatus = exports.de_GetSMSStatusResult = exports.de_GetSMSStatusCommand = exports.se_GetSMSStatusCommand = void 0;
|
|
13
4
|
const util_http_handler_1 = require("@ingestkorea/util-http-handler");
|
|
14
5
|
const constants_js_1 = require("./constants.js");
|
|
15
|
-
const se_GetSMSStatusCommand = (input, config) =>
|
|
6
|
+
const se_GetSMSStatusCommand = async (input, config) => {
|
|
16
7
|
const hostname = "sens.apigw.ntruss.com";
|
|
17
8
|
const path = "/sms/v2/services/" + config.serviceId.sms + "/messages";
|
|
18
9
|
const headers = {
|
|
@@ -32,15 +23,18 @@ const se_GetSMSStatusCommand = (input, config) => __awaiter(void 0, void 0, void
|
|
|
32
23
|
query,
|
|
33
24
|
headers,
|
|
34
25
|
});
|
|
35
|
-
}
|
|
26
|
+
};
|
|
36
27
|
exports.se_GetSMSStatusCommand = se_GetSMSStatusCommand;
|
|
37
|
-
const de_GetSMSStatusCommand = (response, config) =>
|
|
28
|
+
const de_GetSMSStatusCommand = async (response, config) => {
|
|
38
29
|
if (response.statusCode >= 300)
|
|
39
|
-
|
|
40
|
-
const data =
|
|
30
|
+
await (0, constants_js_1.parseErrorBody)(response);
|
|
31
|
+
const data = await (0, constants_js_1.parseBody)(response);
|
|
41
32
|
const contents = (0, exports.de_GetSMSStatusResult)(data);
|
|
42
|
-
return
|
|
43
|
-
|
|
33
|
+
return {
|
|
34
|
+
$metadata: (0, constants_js_1.deserializeMetadata)(response),
|
|
35
|
+
...(0, constants_js_1.compact)(contents),
|
|
36
|
+
};
|
|
37
|
+
};
|
|
44
38
|
exports.de_GetSMSStatusCommand = de_GetSMSStatusCommand;
|
|
45
39
|
const de_GetSMSStatusResult = (output) => {
|
|
46
40
|
return {
|
|
@@ -1,18 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.de_ListAlimtalkChannelsCommand = exports.se_ListAlimtalkChannelsCommand = void 0;
|
|
13
4
|
const util_http_handler_1 = require("@ingestkorea/util-http-handler");
|
|
14
5
|
const constants_js_1 = require("./constants.js");
|
|
15
|
-
const se_ListAlimtalkChannelsCommand = (input, config) =>
|
|
6
|
+
const se_ListAlimtalkChannelsCommand = async (input, config) => {
|
|
16
7
|
const hostname = "sens.apigw.ntruss.com";
|
|
17
8
|
const path = "/alimtalk/v2/services/" + config.serviceId.kakao + "/channels";
|
|
18
9
|
const headers = {
|
|
@@ -25,15 +16,18 @@ const se_ListAlimtalkChannelsCommand = (input, config) => __awaiter(void 0, void
|
|
|
25
16
|
path: path,
|
|
26
17
|
headers: headers,
|
|
27
18
|
});
|
|
28
|
-
}
|
|
19
|
+
};
|
|
29
20
|
exports.se_ListAlimtalkChannelsCommand = se_ListAlimtalkChannelsCommand;
|
|
30
|
-
const de_ListAlimtalkChannelsCommand = (response, config) =>
|
|
21
|
+
const de_ListAlimtalkChannelsCommand = async (response, config) => {
|
|
31
22
|
if (response.statusCode >= 300)
|
|
32
|
-
|
|
33
|
-
const data =
|
|
23
|
+
await (0, constants_js_1.parseErrorBody)(response);
|
|
24
|
+
const data = await (0, constants_js_1.parseBody)(response);
|
|
34
25
|
const contents = de_ListAlimtalkChannelsResult(data);
|
|
35
|
-
return
|
|
36
|
-
|
|
26
|
+
return {
|
|
27
|
+
$metadata: (0, constants_js_1.deserializeMetadata)(response),
|
|
28
|
+
...(0, constants_js_1.compact)(contents),
|
|
29
|
+
};
|
|
30
|
+
};
|
|
37
31
|
exports.de_ListAlimtalkChannelsCommand = de_ListAlimtalkChannelsCommand;
|
|
38
32
|
const de_ListAlimtalkChannelsResult = (output) => {
|
|
39
33
|
return {
|
|
@@ -1,19 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.de_ListAlimtalkStatusCommand = exports.se_ListAlimtalkStatusCommand = void 0;
|
|
13
4
|
const util_http_handler_1 = require("@ingestkorea/util-http-handler");
|
|
14
5
|
const constants_js_1 = require("./constants.js");
|
|
15
6
|
const GetAlimtalkStatus_js_1 = require("./GetAlimtalkStatus.js");
|
|
16
|
-
const se_ListAlimtalkStatusCommand = (input, config) =>
|
|
7
|
+
const se_ListAlimtalkStatusCommand = async (input, config) => {
|
|
17
8
|
const hostname = "sens.apigw.ntruss.com";
|
|
18
9
|
const path = "/alimtalk/v2/services/" + config.serviceId.kakao + "/messages";
|
|
19
10
|
const headers = {
|
|
@@ -33,15 +24,18 @@ const se_ListAlimtalkStatusCommand = (input, config) => __awaiter(void 0, void 0
|
|
|
33
24
|
headers: headers,
|
|
34
25
|
query,
|
|
35
26
|
});
|
|
36
|
-
}
|
|
27
|
+
};
|
|
37
28
|
exports.se_ListAlimtalkStatusCommand = se_ListAlimtalkStatusCommand;
|
|
38
|
-
const de_ListAlimtalkStatusCommand = (response, config) =>
|
|
29
|
+
const de_ListAlimtalkStatusCommand = async (response, config) => {
|
|
39
30
|
if (response.statusCode >= 300)
|
|
40
|
-
|
|
41
|
-
const data =
|
|
31
|
+
await (0, constants_js_1.parseErrorBody)(response);
|
|
32
|
+
const data = await (0, constants_js_1.parseBody)(response);
|
|
42
33
|
const contents = de_ListAlimtalkStatusResult(data);
|
|
43
|
-
return
|
|
44
|
-
|
|
34
|
+
return {
|
|
35
|
+
$metadata: (0, constants_js_1.deserializeMetadata)(response),
|
|
36
|
+
...(0, constants_js_1.compact)(contents),
|
|
37
|
+
};
|
|
38
|
+
};
|
|
45
39
|
exports.de_ListAlimtalkStatusCommand = de_ListAlimtalkStatusCommand;
|
|
46
40
|
const de_ListAlimtalkStatusResult = (output) => {
|
|
47
41
|
return (0, GetAlimtalkStatus_js_1.de_GetAlimtalkStatusResult)(output);
|