@ingestkorea/client-sens 1.9.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 +99 -57
- package/dist-cjs/SensClient.js +42 -43
- 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 +22 -10
- package/dist-cjs/commands/ListAlimtalkTemplatesCommand.js +3 -0
- package/dist-cjs/commands/ListSMSStatusCommand.js +21 -10
- package/dist-cjs/commands/SendAlimtalkCommand.js +15 -14
- package/dist-cjs/commands/SendMMSCommand.js +16 -23
- package/dist-cjs/commands/SendSMSCommand.js +28 -16
- package/dist-cjs/commands/constants.js +8 -19
- package/dist-cjs/index.js +1 -0
- package/dist-cjs/middleware/constants.js +2 -1
- package/dist-cjs/middleware/middleware-metadata.js +7 -12
- package/dist-cjs/middleware/middleware-retry.js +48 -38
- package/dist-cjs/middleware/middleware-sign.js +8 -12
- package/dist-cjs/models/SensApiError.js +21 -0
- package/dist-cjs/models/{SensErrorInfo.js → SensClientError.js} +6 -1
- package/dist-cjs/models/SensCommand.js +1 -0
- package/dist-cjs/models/index.js +2 -1
- 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 +124 -82
- package/dist-es/SensClient.js +37 -31
- 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 +24 -28
- package/dist-es/commands/ListAlimtalkTemplatesCommand.js +8 -9
- package/dist-es/commands/ListSMSStatusCommand.js +25 -29
- package/dist-es/commands/SendAlimtalkCommand.js +18 -26
- package/dist-es/commands/SendMMSCommand.js +37 -48
- package/dist-es/commands/SendSMSCommand.js +25 -29
- package/dist-es/commands/constants.js +18 -39
- package/dist-es/commands/index.js +12 -28
- package/dist-es/index.js +3 -18
- 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 +47 -38
- 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/SensClientError.js +14 -0
- package/dist-es/models/SensCommand.js +2 -5
- package/dist-es/models/SensMiddleware.js +1 -2
- package/dist-es/models/index.js +18 -33
- 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 +126 -88
- package/dist-types/SensClient.d.ts +0 -1
- package/dist-types/index.d.ts +1 -0
- package/dist-types/middleware/constants.d.ts +1 -0
- package/dist-types/models/MetadataBearer.d.ts +1 -0
- package/dist-types/models/SensApiError.d.ts +55 -0
- package/dist-types/models/SensClient.d.ts +8 -1
- package/dist-types/models/SensClientError.d.ts +18 -0
- package/dist-types/models/index.d.ts +2 -1
- package/dist-types/protocols/constants.d.ts +1 -1
- package/package.json +4 -5
- package/dist-es/models/SensErrorInfo.js +0 -13
- package/dist-types/models/SensErrorInfo.d.ts +0 -21
|
@@ -1,60 +1,69 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { HttpHandlerError } from "@ingestkorea/util-http-handler";
|
|
2
|
+
import { SensError } from "../models/index.js";
|
|
3
|
+
import { INGESTKOREA_REQUEST_LOG, INGESTKOREA_RETRY, INGESTKOREA_RETRY_DELAY } from "./constants.js";
|
|
4
|
+
const RETRYABLE_ERROR_TYPE = [
|
|
5
|
+
"SDK.TIMEOUT",
|
|
6
|
+
"SDK.NETWORK_ERROR",
|
|
7
|
+
"Too Many Requests",
|
|
8
|
+
"Internal Server Error",
|
|
9
|
+
];
|
|
10
|
+
export const middlewareRetry = (next) => async (input, context) => {
|
|
9
11
|
const MAX_RETRIES = 3;
|
|
12
|
+
const MIN_DELAY_MS = 300;
|
|
10
13
|
const BASE_DELAY_MS = 500;
|
|
11
|
-
const MAX_DELAY_MS =
|
|
14
|
+
const MAX_DELAY_MS = 5_000;
|
|
12
15
|
let attempts = 0;
|
|
13
16
|
let totalRetryDelay = 0;
|
|
14
|
-
|
|
15
|
-
let lastError = new util_error_handler_1.IngestkoreaError({
|
|
16
|
-
code: 400,
|
|
17
|
-
type: "Bad Request",
|
|
18
|
-
message: "Invalid Request",
|
|
19
|
-
description: { attempts, maxRetries: MAX_RETRIES, totalRetryDelay },
|
|
20
|
-
});
|
|
17
|
+
input.request.headers = input.request.headers ?? {};
|
|
21
18
|
while (attempts < MAX_RETRIES) {
|
|
22
|
-
|
|
23
|
-
const requestLog = `attempt=${
|
|
24
|
-
input.request.headers[
|
|
19
|
+
attempts++;
|
|
20
|
+
const requestLog = `attempt=${attempts}; max=${MAX_RETRIES}; totalRetryDelay=${totalRetryDelay}`;
|
|
21
|
+
input.request.headers[INGESTKOREA_REQUEST_LOG] = requestLog;
|
|
25
22
|
try {
|
|
26
23
|
const { response } = await next(input, context);
|
|
27
|
-
response.headers[
|
|
28
|
-
response.headers[
|
|
24
|
+
response.headers[INGESTKOREA_RETRY] = attempts.toString();
|
|
25
|
+
response.headers[INGESTKOREA_RETRY_DELAY] = totalRetryDelay.toString();
|
|
29
26
|
return { response };
|
|
30
27
|
}
|
|
31
28
|
catch (error) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
29
|
+
let currentError;
|
|
30
|
+
if (error instanceof SensError) {
|
|
31
|
+
currentError = error;
|
|
32
|
+
}
|
|
33
|
+
else if (error instanceof HttpHandlerError) {
|
|
34
|
+
currentError = new SensError({
|
|
35
|
+
code: -1,
|
|
36
|
+
type: error.code,
|
|
37
|
+
message: error.message,
|
|
38
|
+
});
|
|
39
39
|
}
|
|
40
40
|
else {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
currentError = new SensError({
|
|
42
|
+
code: -1,
|
|
43
|
+
type: "SDK.UNKNOWN_ERROR",
|
|
44
|
+
message: error instanceof Error ? error.message : String(error),
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
const isRetryable = RETRYABLE_ERROR_TYPE.some((type) => currentError.type.startsWith(type));
|
|
48
|
+
if (!isRetryable) {
|
|
49
|
+
throw currentError;
|
|
45
50
|
}
|
|
46
51
|
if (attempts >= MAX_RETRIES) {
|
|
47
|
-
|
|
48
|
-
throw
|
|
52
|
+
currentError.errors.push(requestLog);
|
|
53
|
+
throw currentError;
|
|
49
54
|
}
|
|
50
55
|
const exp = BASE_DELAY_MS * 2 ** (attempts - 1);
|
|
51
56
|
const capped = Math.min(MAX_DELAY_MS, exp);
|
|
52
|
-
const
|
|
57
|
+
const baseWait = Math.max(MIN_DELAY_MS, Math.floor(capped / 2));
|
|
58
|
+
const jitter = Math.floor(Math.random() * (capped - baseWait));
|
|
59
|
+
const delay = baseWait + jitter;
|
|
53
60
|
totalRetryDelay += delay;
|
|
54
|
-
lastError.error.description = { attempts, maxRetries: MAX_RETRIES, totalRetryDelay };
|
|
55
61
|
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
56
62
|
}
|
|
57
63
|
}
|
|
58
|
-
throw
|
|
64
|
+
throw new SensError({
|
|
65
|
+
code: -1,
|
|
66
|
+
type: "SDK.UNKNOWN_ERROR",
|
|
67
|
+
message: "Unexpected retry loop termination",
|
|
68
|
+
});
|
|
59
69
|
};
|
|
60
|
-
exports.middlewareRetry = middlewareRetry;
|
|
@@ -1,25 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const util_http_handler_1 = require("@ingestkorea/util-http-handler");
|
|
6
|
-
const constants_js_1 = require("./constants.js");
|
|
7
|
-
const middlewareNcpSign = (next) => async (input, context) => {
|
|
1
|
+
import { createHmac } from "crypto";
|
|
2
|
+
import { buildQueryString } from "@ingestkorea/util-http-handler";
|
|
3
|
+
import { NCP_ACCESS_KEY, NCP_TIMESTAMP, NCP_SIGNATURE } from "./constants.js";
|
|
4
|
+
export const middlewareNcpSign = (next) => async (input, context) => {
|
|
8
5
|
const { accessKey, secretKey } = context.credentials;
|
|
9
6
|
const method = input.request.method;
|
|
10
|
-
const queryString =
|
|
7
|
+
const queryString = buildQueryString(input.request.query);
|
|
11
8
|
const path = queryString ? `${input.request.path}?${queryString}` : input.request.path;
|
|
12
9
|
const space = " ";
|
|
13
10
|
const newLine = "\n";
|
|
14
11
|
const timestamp = new Date().getTime().toString();
|
|
15
12
|
const stringToSign = [method + space + path, timestamp, accessKey].join(newLine);
|
|
16
|
-
const signature =
|
|
13
|
+
const signature = createHmac("sha256", secretKey).update(stringToSign).digest("base64");
|
|
17
14
|
input.request.headers = {
|
|
18
15
|
...input.request.headers,
|
|
19
|
-
[
|
|
20
|
-
[
|
|
21
|
-
[
|
|
16
|
+
[NCP_ACCESS_KEY]: accessKey,
|
|
17
|
+
[NCP_TIMESTAMP]: timestamp,
|
|
18
|
+
[NCP_SIGNATURE]: signature,
|
|
22
19
|
};
|
|
23
20
|
return next(input, context);
|
|
24
21
|
};
|
|
25
|
-
exports.middlewareNcpSign = middlewareNcpSign;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.ALIMTALK_MAX_CONTENT_LENGTH = exports.ALIMTALK_MAX_RECIPIENTS = void 0;
|
|
4
|
-
exports.ALIMTALK_MAX_RECIPIENTS = 100;
|
|
5
|
-
exports.ALIMTALK_MAX_CONTENT_LENGTH = 1000;
|
|
1
|
+
export const ALIMTALK_MAX_RECIPIENTS = 100;
|
|
2
|
+
export const ALIMTALK_MAX_CONTENT_LENGTH = 1000;
|
|
6
3
|
const ALIMTALK_BUTTON_TYPES = ["DS", "WL", "AL", "BK", "MD", "AC"];
|
|
7
4
|
const ALIMTALK_BUTTON_NAMES = ["배송 조회", "웹 링크", "앱 링크", "봇 키워드", "메시지 전달", "채널 추가"];
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.MMS_SUPPORT_FILE_EXTENSION = exports.MMS_MAX_SUPPORT_FILE_SIZE = void 0;
|
|
4
|
-
exports.MMS_MAX_SUPPORT_FILE_SIZE = 300; // KiByte
|
|
5
|
-
exports.MMS_SUPPORT_FILE_EXTENSION = [".jpg", ".jpeg"];
|
|
1
|
+
export const MMS_MAX_SUPPORT_FILE_SIZE = 300; // KiByte
|
|
2
|
+
export const MMS_SUPPORT_FILE_EXTENSION = [".jpg", ".jpeg"];
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export const SENS_ERROR_CODE_SPEC = {
|
|
2
|
+
400: "Bad Request",
|
|
3
|
+
401: "Unauthorized",
|
|
4
|
+
403: "Forbidden",
|
|
5
|
+
404: "Not Found",
|
|
6
|
+
429: "Too Many Requests",
|
|
7
|
+
500: "Internal Server Error",
|
|
8
|
+
};
|
|
9
|
+
export const NCLOUD_ERROR_CODE_SPEC = {
|
|
10
|
+
"100": { status: 400, type: SENS_ERROR_CODE_SPEC["400"] },
|
|
11
|
+
"200": { status: 401, type: SENS_ERROR_CODE_SPEC["401"] },
|
|
12
|
+
"210": { status: 403, type: SENS_ERROR_CODE_SPEC["403"] },
|
|
13
|
+
"300": { status: 404, type: SENS_ERROR_CODE_SPEC["404"] },
|
|
14
|
+
"400": { status: 429, type: SENS_ERROR_CODE_SPEC["429"] },
|
|
15
|
+
"410": { status: 429, type: SENS_ERROR_CODE_SPEC["429"] },
|
|
16
|
+
"420": { status: 429, type: SENS_ERROR_CODE_SPEC["429"] },
|
|
17
|
+
"900": { status: 500, type: SENS_ERROR_CODE_SPEC["500"] },
|
|
18
|
+
};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export class SensError extends Error {
|
|
2
|
+
code;
|
|
3
|
+
type;
|
|
4
|
+
errors;
|
|
5
|
+
timestamp;
|
|
6
|
+
constructor(info) {
|
|
7
|
+
super(info.message);
|
|
8
|
+
this.name = "SensError";
|
|
9
|
+
this.code = info.code;
|
|
10
|
+
this.type = info.type;
|
|
11
|
+
this.errors = info.errors || [];
|
|
12
|
+
this.timestamp = new Date().toISOString();
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.SensCommand = void 0;
|
|
4
|
-
class SensCommand {
|
|
1
|
+
export class SensCommand {
|
|
2
|
+
input;
|
|
5
3
|
constructor(input) {
|
|
6
4
|
this.input = input;
|
|
7
5
|
}
|
|
8
6
|
}
|
|
9
|
-
exports.SensCommand = SensCommand;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/dist-es/models/index.js
CHANGED
|
@@ -1,33 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
__exportStar(require("./GetAlimtalkTemplate.js"), exports);
|
|
20
|
-
__exportStar(require("./GetSMSResult.js"), exports);
|
|
21
|
-
__exportStar(require("./GetSMSStatus.js"), exports);
|
|
22
|
-
__exportStar(require("./ListAlimtalkChannels.js"), exports);
|
|
23
|
-
__exportStar(require("./ListAlimtalkStatus.js"), exports);
|
|
24
|
-
__exportStar(require("./ListAlimtalkTemplates.js"), exports);
|
|
25
|
-
__exportStar(require("./ListSMSStatus.js"), exports);
|
|
26
|
-
__exportStar(require("./MetadataBearer.js"), exports);
|
|
27
|
-
__exportStar(require("./SendAlimtalk.js"), exports);
|
|
28
|
-
__exportStar(require("./SendMMS.js"), exports);
|
|
29
|
-
__exportStar(require("./SendSMS.js"), exports);
|
|
30
|
-
__exportStar(require("./SensClient.js"), exports);
|
|
31
|
-
__exportStar(require("./SensCommand.js"), exports);
|
|
32
|
-
__exportStar(require("./SensErrorInfo.js"), exports);
|
|
33
|
-
__exportStar(require("./SensMiddleware.js"), exports);
|
|
1
|
+
export * from "./GetAlimtalkResult.js";
|
|
2
|
+
export * from "./GetAlimtalkStatus.js";
|
|
3
|
+
export * from "./GetAlimtalkTemplate.js";
|
|
4
|
+
export * from "./GetSMSResult.js";
|
|
5
|
+
export * from "./GetSMSStatus.js";
|
|
6
|
+
export * from "./ListAlimtalkChannels.js";
|
|
7
|
+
export * from "./ListAlimtalkStatus.js";
|
|
8
|
+
export * from "./ListAlimtalkTemplates.js";
|
|
9
|
+
export * from "./ListSMSStatus.js";
|
|
10
|
+
export * from "./MetadataBearer.js";
|
|
11
|
+
export * from "./SendAlimtalk.js";
|
|
12
|
+
export * from "./SendMMS.js";
|
|
13
|
+
export * from "./SendSMS.js";
|
|
14
|
+
export * from "./SensApiError.js";
|
|
15
|
+
export * from "./SensClient.js";
|
|
16
|
+
export * from "./SensClientError.js";
|
|
17
|
+
export * from "./SensCommand.js";
|
|
18
|
+
export * from "./SensMiddleware.js";
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const constants_js_1 = require("./constants.js");
|
|
6
|
-
const GetAlimtalkStatus_js_1 = require("./GetAlimtalkStatus.js");
|
|
7
|
-
const se_GetAlimtalkResultCommand = async (input, config) => {
|
|
1
|
+
import { HttpRequest } from "@ingestkorea/util-http-handler";
|
|
2
|
+
import { deserializeMetadata, parseBody, parseErrorBody, compact } from "./constants.js";
|
|
3
|
+
import { de_AlimtalkMessageStatus } from "./GetAlimtalkStatus.js";
|
|
4
|
+
export const se_GetAlimtalkResultCommand = async (input, config) => {
|
|
8
5
|
const hostname = "sens.apigw.ntruss.com";
|
|
9
6
|
const path = "/alimtalk/v2/services/" + config.serviceId.kakao + "/messages/" + input.messageId;
|
|
10
7
|
const headers = {
|
|
11
8
|
host: hostname,
|
|
12
9
|
};
|
|
13
|
-
return new
|
|
10
|
+
return new HttpRequest({
|
|
14
11
|
protocol: "https:",
|
|
15
12
|
method: "GET",
|
|
16
13
|
hostname,
|
|
@@ -18,21 +15,19 @@ const se_GetAlimtalkResultCommand = async (input, config) => {
|
|
|
18
15
|
headers,
|
|
19
16
|
});
|
|
20
17
|
};
|
|
21
|
-
|
|
22
|
-
const de_GetAlimtalkResultCommand = async (response, config) => {
|
|
18
|
+
export const de_GetAlimtalkResultCommand = async (response, config) => {
|
|
23
19
|
if (response.statusCode >= 300)
|
|
24
|
-
await
|
|
25
|
-
const data = await
|
|
20
|
+
await parseErrorBody(response);
|
|
21
|
+
const data = await parseBody(response);
|
|
26
22
|
const contents = de_GetAlimtalkResultResult(data);
|
|
27
23
|
return {
|
|
28
|
-
$metadata:
|
|
29
|
-
...
|
|
24
|
+
$metadata: deserializeMetadata(response),
|
|
25
|
+
...compact(contents),
|
|
30
26
|
};
|
|
31
27
|
};
|
|
32
|
-
exports.de_GetAlimtalkResultCommand = de_GetAlimtalkResultCommand;
|
|
33
28
|
const de_GetAlimtalkResultResult = (output) => {
|
|
34
29
|
return {
|
|
35
|
-
...
|
|
30
|
+
...de_AlimtalkMessageStatus(output),
|
|
36
31
|
failover: output.failover ? de_Failover(output.failover) : undefined,
|
|
37
32
|
};
|
|
38
33
|
};
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const constants_js_1 = require("./constants.js");
|
|
6
|
-
const SendAlimtalk_js_1 = require("./SendAlimtalk.js");
|
|
7
|
-
const se_GetAlimtalkStatusCommand = async (input, config) => {
|
|
1
|
+
import { HttpRequest } from "@ingestkorea/util-http-handler";
|
|
2
|
+
import { deserializeMetadata, parseBody, parseErrorBody, compact, convertToUtc } from "./constants.js";
|
|
3
|
+
import { de_AlimtalkMessageRequestStatus } from "./SendAlimtalk.js";
|
|
4
|
+
export const se_GetAlimtalkStatusCommand = async (input, config) => {
|
|
8
5
|
const hostname = "sens.apigw.ntruss.com";
|
|
9
6
|
const path = "/alimtalk/v2/services/" + config.serviceId.kakao + "/messages";
|
|
10
7
|
const headers = {
|
|
@@ -16,7 +13,7 @@ const se_GetAlimtalkStatusCommand = async (input, config) => {
|
|
|
16
13
|
}
|
|
17
14
|
return acc;
|
|
18
15
|
}, {});
|
|
19
|
-
return new
|
|
16
|
+
return new HttpRequest({
|
|
20
17
|
protocol: "https:",
|
|
21
18
|
method: "GET",
|
|
22
19
|
hostname,
|
|
@@ -25,19 +22,17 @@ const se_GetAlimtalkStatusCommand = async (input, config) => {
|
|
|
25
22
|
query,
|
|
26
23
|
});
|
|
27
24
|
};
|
|
28
|
-
|
|
29
|
-
const de_GetAlimtalkStatusCommand = async (response, config) => {
|
|
25
|
+
export const de_GetAlimtalkStatusCommand = async (response, config) => {
|
|
30
26
|
if (response.statusCode >= 300)
|
|
31
|
-
await
|
|
32
|
-
const data = await
|
|
33
|
-
const contents =
|
|
27
|
+
await parseErrorBody(response);
|
|
28
|
+
const data = await parseBody(response);
|
|
29
|
+
const contents = de_GetAlimtalkStatusResult(data);
|
|
34
30
|
return {
|
|
35
|
-
$metadata:
|
|
36
|
-
...
|
|
31
|
+
$metadata: deserializeMetadata(response),
|
|
32
|
+
...compact(contents),
|
|
37
33
|
};
|
|
38
34
|
};
|
|
39
|
-
|
|
40
|
-
const de_GetAlimtalkStatusResult = (output) => {
|
|
35
|
+
export const de_GetAlimtalkStatusResult = (output) => {
|
|
41
36
|
return {
|
|
42
37
|
requestId: output.requestId ? output.requestId : undefined,
|
|
43
38
|
statusCode: output.statusCode ? output.statusCode : undefined,
|
|
@@ -50,21 +45,19 @@ const de_GetAlimtalkStatusResult = (output) => {
|
|
|
50
45
|
nextToken: output.nextToken ? output.nextToken : undefined,
|
|
51
46
|
};
|
|
52
47
|
};
|
|
53
|
-
exports.de_GetAlimtalkStatusResult = de_GetAlimtalkStatusResult;
|
|
54
48
|
const de_AlimtalkMessageStatusList = (output) => {
|
|
55
|
-
return (output || []).filter((e) => e != null).map((entry) =>
|
|
49
|
+
return (output || []).filter((e) => e != null).map((entry) => de_AlimtalkMessageStatus(entry));
|
|
56
50
|
};
|
|
57
|
-
const de_AlimtalkMessageStatus = (output) => {
|
|
51
|
+
export const de_AlimtalkMessageStatus = (output) => {
|
|
58
52
|
return {
|
|
59
|
-
...
|
|
53
|
+
...de_AlimtalkMessageRequestStatus(output),
|
|
60
54
|
requestId: output.requestId ? output.requestId : undefined,
|
|
61
|
-
requestTime: output.requestTime ?
|
|
55
|
+
requestTime: output.requestTime ? convertToUtc(output.requestTime) : undefined,
|
|
62
56
|
plusFriendId: output.plusFriendId ? output.plusFriendId : undefined,
|
|
63
57
|
templateCode: output.templateCode ? output.templateCode : undefined,
|
|
64
|
-
completeTime: output.completeTime ?
|
|
58
|
+
completeTime: output.completeTime ? convertToUtc(output.completeTime) : undefined,
|
|
65
59
|
messageStatusCode: output.messageStatusCode ? output.messageStatusCode : undefined,
|
|
66
60
|
messageStatusName: output.messageStatusName ? output.messageStatusName : undefined,
|
|
67
61
|
messageStatusDesc: output.messageStatusDesc ? output.messageStatusDesc : undefined,
|
|
68
62
|
};
|
|
69
63
|
};
|
|
70
|
-
exports.de_AlimtalkMessageStatus = de_AlimtalkMessageStatus;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const constants_js_1 = require("./constants.js");
|
|
6
|
-
const ListAlimtalkTemplates_js_1 = require("./ListAlimtalkTemplates.js");
|
|
7
|
-
const se_GetAlimtalkTemplateCommand = async (input, config) => {
|
|
1
|
+
import { HttpRequest } from "@ingestkorea/util-http-handler";
|
|
2
|
+
import { deserializeMetadata, parseBody, parseErrorBody, compact, convertToUtc } from "./constants.js";
|
|
3
|
+
import { de_Template } from "./ListAlimtalkTemplates.js";
|
|
4
|
+
export const se_GetAlimtalkTemplateCommand = async (input, config) => {
|
|
8
5
|
const hostname = "sens.apigw.ntruss.com";
|
|
9
6
|
const path = "/alimtalk/v2/services/" + config.serviceId.kakao + "/templates";
|
|
10
7
|
const headers = {
|
|
@@ -14,7 +11,7 @@ const se_GetAlimtalkTemplateCommand = async (input, config) => {
|
|
|
14
11
|
channelId: input.channelId,
|
|
15
12
|
templateCode: input.templateCode,
|
|
16
13
|
};
|
|
17
|
-
return new
|
|
14
|
+
return new HttpRequest({
|
|
18
15
|
protocol: "https:",
|
|
19
16
|
method: "GET",
|
|
20
17
|
hostname,
|
|
@@ -23,18 +20,16 @@ const se_GetAlimtalkTemplateCommand = async (input, config) => {
|
|
|
23
20
|
headers,
|
|
24
21
|
});
|
|
25
22
|
};
|
|
26
|
-
|
|
27
|
-
const de_GetAlimtalkTemplateCommand = async (response, config) => {
|
|
23
|
+
export const de_GetAlimtalkTemplateCommand = async (response, config) => {
|
|
28
24
|
if (response.statusCode >= 300)
|
|
29
|
-
await
|
|
30
|
-
const data = await
|
|
25
|
+
await parseErrorBody(response);
|
|
26
|
+
const data = await parseBody(response);
|
|
31
27
|
const contents = de_GetAlimtalkTemplateResult(data);
|
|
32
28
|
return {
|
|
33
|
-
$metadata:
|
|
34
|
-
...
|
|
29
|
+
$metadata: deserializeMetadata(response),
|
|
30
|
+
...compact(contents),
|
|
35
31
|
};
|
|
36
32
|
};
|
|
37
|
-
exports.de_GetAlimtalkTemplateCommand = de_GetAlimtalkTemplateCommand;
|
|
38
33
|
const de_GetAlimtalkTemplateResult = (output) => {
|
|
39
34
|
return {
|
|
40
35
|
templates: Array.isArray(output) ? de_TemplateDetailList(output) : [],
|
|
@@ -45,7 +40,7 @@ const de_TemplateDetailList = (output) => {
|
|
|
45
40
|
};
|
|
46
41
|
const de_TemplateDetail = (output) => {
|
|
47
42
|
return {
|
|
48
|
-
...
|
|
43
|
+
...de_Template(output),
|
|
49
44
|
categoryCode: output.categoryCode != undefined ? output.categoryCode : undefined,
|
|
50
45
|
categoryName: output.categoryName != undefined ? output.categoryName : undefined,
|
|
51
46
|
messageType: output.messageType != undefined ? output.messageType : undefined,
|
|
@@ -72,7 +67,7 @@ const de_Comment = (output) => {
|
|
|
72
67
|
commentId: output.commentId != undefined ? output.commentId : undefined,
|
|
73
68
|
content: output.content != undefined ? output.content : undefined,
|
|
74
69
|
status: output.status != undefined ? output.status : undefined,
|
|
75
|
-
createTime: output.createTime != undefined ?
|
|
70
|
+
createTime: output.createTime != undefined ? convertToUtc(output.createTime) : undefined,
|
|
76
71
|
attachment: output.attachment != undefined ? de_AttachmentList(output.attachment) : [],
|
|
77
72
|
};
|
|
78
73
|
};
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const constants_js_1 = require("./constants.js");
|
|
6
|
-
const GetSMSStatus_js_1 = require("./GetSMSStatus.js");
|
|
7
|
-
const se_GetSMSResultCommand = async (input, config) => {
|
|
1
|
+
import { HttpRequest } from "@ingestkorea/util-http-handler";
|
|
2
|
+
import { deserializeMetadata, parseBody, parseErrorBody, compact } from "./constants.js";
|
|
3
|
+
import { de_SMSMessageRequestStatus } from "./GetSMSStatus.js";
|
|
4
|
+
export const se_GetSMSResultCommand = async (input, config) => {
|
|
8
5
|
const hostname = "sens.apigw.ntruss.com";
|
|
9
6
|
const path = "/sms/v2/services/" + config.serviceId.sms + "/messages" + "/" + input.messageId;
|
|
10
7
|
const headers = {
|
|
11
8
|
host: hostname,
|
|
12
9
|
};
|
|
13
|
-
return new
|
|
10
|
+
return new HttpRequest({
|
|
14
11
|
protocol: "https:",
|
|
15
12
|
method: "GET",
|
|
16
13
|
hostname,
|
|
@@ -18,18 +15,16 @@ const se_GetSMSResultCommand = async (input, config) => {
|
|
|
18
15
|
headers,
|
|
19
16
|
});
|
|
20
17
|
};
|
|
21
|
-
|
|
22
|
-
const de_GetSMSResultCommand = async (response, config) => {
|
|
18
|
+
export const de_GetSMSResultCommand = async (response, config) => {
|
|
23
19
|
if (response.statusCode >= 300)
|
|
24
|
-
await
|
|
25
|
-
const data = await
|
|
20
|
+
await parseErrorBody(response);
|
|
21
|
+
const data = await parseBody(response);
|
|
26
22
|
const contents = de_GetSMSResultResult(data);
|
|
27
23
|
return {
|
|
28
|
-
$metadata:
|
|
29
|
-
...
|
|
24
|
+
$metadata: deserializeMetadata(response),
|
|
25
|
+
...compact(contents),
|
|
30
26
|
};
|
|
31
27
|
};
|
|
32
|
-
exports.de_GetSMSResultCommand = de_GetSMSResultCommand;
|
|
33
28
|
const de_GetSMSResultResult = (output) => {
|
|
34
29
|
return {
|
|
35
30
|
statusCode: output.statusCode ? output.statusCode : undefined,
|
|
@@ -42,7 +37,7 @@ const de_SMSMessageStatusList = (output) => {
|
|
|
42
37
|
};
|
|
43
38
|
const de_SMSMessageStatus = (output) => {
|
|
44
39
|
return {
|
|
45
|
-
...
|
|
40
|
+
...de_SMSMessageRequestStatus(output),
|
|
46
41
|
subject: output.subject ? output.subject : undefined,
|
|
47
42
|
content: output.content ? output.content : undefined,
|
|
48
43
|
files: output.files ? de_FileList(output.files) : [],
|