@ingestkorea/client-sens 1.6.0 → 1.7.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.
Files changed (58) hide show
  1. package/README.md +38 -27
  2. package/dist-cjs/SensClient.js +10 -11
  3. package/dist-cjs/commands/GetAlimtalkResultCommand.js +3 -1
  4. package/dist-cjs/commands/GetAlimtalkStatusCommand.js +3 -1
  5. package/dist-cjs/commands/GetAlimtalkTemplateCommand.js +4 -1
  6. package/dist-cjs/commands/ListAlimtalkStatusCommand.js +43 -0
  7. package/dist-cjs/commands/ListAlimtalkTemplatesCommand.js +3 -1
  8. package/dist-cjs/commands/SendAlimtalkCommand.js +14 -10
  9. package/dist-cjs/commands/constants.js +12 -1
  10. package/dist-cjs/commands/index.js +1 -0
  11. package/dist-cjs/middleware/middleware-metadata.js +1 -1
  12. package/dist-cjs/models/ListAlimtalkStatus.js +2 -0
  13. package/dist-cjs/models/SendAlimtalk.js +2 -0
  14. package/dist-cjs/models/index.js +1 -0
  15. package/dist-cjs/protocols/GetAlimtalkResult.js +5 -23
  16. package/dist-cjs/protocols/GetAlimtalkStatus.js +20 -29
  17. package/dist-cjs/protocols/GetAlimtalkTemplate.js +75 -3
  18. package/dist-cjs/protocols/ListAlimtalkStatus.js +45 -0
  19. package/dist-cjs/protocols/ListAlimtalkTemplates.js +14 -48
  20. package/dist-cjs/protocols/SendAlimtalk.js +15 -13
  21. package/dist-cjs/protocols/index.js +2 -0
  22. package/dist-es/SensClient.js +10 -11
  23. package/dist-es/commands/GetAlimtalkResultCommand.js +1 -1
  24. package/dist-es/commands/GetAlimtalkStatusCommand.js +1 -1
  25. package/dist-es/commands/GetAlimtalkTemplateCommand.js +2 -1
  26. package/dist-es/commands/ListAlimtalkStatusCommand.js +38 -0
  27. package/dist-es/commands/ListAlimtalkTemplatesCommand.js +1 -1
  28. package/dist-es/commands/SendAlimtalkCommand.js +18 -14
  29. package/dist-es/commands/constants.js +10 -0
  30. package/dist-es/commands/index.js +1 -0
  31. package/dist-es/middleware/middleware-metadata.js +1 -1
  32. package/dist-es/models/ListAlimtalkStatus.js +1 -0
  33. package/dist-es/models/SendAlimtalk.js +2 -0
  34. package/dist-es/models/index.js +1 -0
  35. package/dist-es/protocols/GetAlimtalkResult.js +2 -17
  36. package/dist-es/protocols/GetAlimtalkStatus.js +26 -26
  37. package/dist-es/protocols/GetAlimtalkTemplate.js +70 -2
  38. package/dist-es/protocols/ListAlimtalkStatus.js +48 -0
  39. package/dist-es/protocols/ListAlimtalkTemplates.js +11 -44
  40. package/dist-es/protocols/SendAlimtalk.js +13 -12
  41. package/dist-es/protocols/index.js +2 -0
  42. package/dist-types/commands/ListAlimtalkStatusCommand.d.ts +16 -0
  43. package/dist-types/commands/constants.d.ts +4 -0
  44. package/dist-types/commands/index.d.ts +1 -0
  45. package/dist-types/models/GetAlimtalkResult.d.ts +0 -1
  46. package/dist-types/models/GetAlimtalkStatus.d.ts +5 -0
  47. package/dist-types/models/GetAlimtalkTemplate.d.ts +42 -3
  48. package/dist-types/models/ListAlimtalkStatus.d.ts +16 -0
  49. package/dist-types/models/ListAlimtalkTemplates.d.ts +0 -20
  50. package/dist-types/models/SendAlimtalk.d.ts +13 -6
  51. package/dist-types/models/index.d.ts +1 -0
  52. package/dist-types/protocols/GetAlimtalkStatus.d.ts +1 -0
  53. package/dist-types/protocols/GetAlimtalkTemplate.d.ts +6 -2
  54. package/dist-types/protocols/ListAlimtalkStatus.d.ts +10 -0
  55. package/dist-types/protocols/ListAlimtalkTemplates.d.ts +4 -5
  56. package/dist-types/protocols/SendAlimtalk.d.ts +1 -0
  57. package/dist-types/protocols/index.d.ts +2 -0
  58. package/package.json +3 -2
package/README.md CHANGED
@@ -34,6 +34,7 @@ npm install @ingestkorea/client-sens
34
34
  - GetAlimtalkStatus
35
35
  - GetAlimtalkResult
36
36
  - GetAlimtalkTemplate
37
+ - ListAlimtalkStatus
37
38
  - ListAlimtalkTemplates
38
39
  - ListAlimtalkChannels
39
40
 
@@ -47,15 +48,7 @@ npm install @ingestkorea/client-sens
47
48
  ### Import
48
49
 
49
50
  ```ts
50
- import {
51
- SensClient,
52
- SendAlimtalkCommand,
53
- SendAlimtalkCommandInput,
54
- SendSMSCommand,
55
- SendSMSCommandInput,
56
- SendMMSCommand,
57
- SendMMSCommandInput,
58
- } from "@ingestkorea/client-sens";
51
+ import { SensClient, SendAlimtalkCommand, SendSMSCommand, SendMMSCommand } from "@ingestkorea/client-sens";
59
52
  ```
60
53
 
61
54
  ### Usage
@@ -91,36 +84,54 @@ const client = new SensClient({
91
84
  #### SendAlimtalk
92
85
 
93
86
  ```ts
94
- let params: SendAlimtalkCommandInput = {
87
+ let command = new SendAlimtalkCommand({
95
88
  plusFriendId: PLUS_FRIEND_ID,
96
89
  templateCode: TEMPLATE_CODE,
97
90
  messages: [{ to: "01012345678", content: CONTENT }],
98
- };
99
- let command = new SendAlimtalkCommand(params);
91
+ });
92
+ ```
93
+
94
+ #### ListAlimtalkStatus
95
+
96
+ ```ts
97
+ let command = new ListAlimtalkStatusCommand({
98
+ plusFriendId: CHANNEL_ID,
99
+ requestStartTime: "yyyy-MM-ddTHH:mm:ss.SSS", // Optional(KST) // default: current - 24hours
100
+ requestEndTime: "yyyy-MM-ddTHH:mm:ss.SSS", // Optional(KST) // default: current
101
+ });
102
+ ```
103
+
104
+ #### GetAlimtalkStatus
105
+
106
+ ```ts
107
+ let command = new GetAlimtalkStatusCommand({
108
+ requestId: REQUEST_ID,
109
+ });
100
110
  ```
101
111
 
102
112
  #### SendSMS (SMS, LMS)
103
113
 
104
114
  ```ts
105
- /**
106
- * Automatically set message type('SMS' | 'LMS') according to content-length(euc-kr)
107
- * SMS: max 90bytes
108
- * LMS: max 2000bytes
109
- */
110
- let params: SendSMSCommandInput = {
115
+ let command = new SendSMSCommand({
111
116
  from: '01012345678',
112
117
  content: DEFAULT_CONTENT,
113
118
  messages: [
114
119
  { to: '0109182xxxx' },
115
- { to: '0104321xxxx', content?: OPTIONAL_CONTENT_01 }
116
- { to: '0108765xxxx', content?: OPTIONAL_CONTENT_02, subject?: OPTIONAL_SUBJECT_01 },
120
+ { to: '0104321xxxx', content?: ONTENT_01 }
121
+ { to: '0108765xxxx', content?: CONTENT_02, subject?: SUBJECT_01 },
117
122
  ]
118
- };
123
+ });
124
+
125
+ /**
126
+ * Automatically set message type('SMS' | 'LMS') according to content-length(euc-kr)
127
+ * SMS: max 90bytes
128
+ * LMS: max 2000bytes
129
+ */
130
+
119
131
  /**
120
132
  * If you do not define the subject and content within the messages,
121
133
  * it is sent with the value specified as the default subject('제목없음') and content.
122
134
  */
123
- let command = new SendSMSCommand(params);
124
135
  ```
125
136
 
126
137
  #### SendMMS (MMS)
@@ -128,13 +139,13 @@ let command = new SendSMSCommand(params);
128
139
  ```ts
129
140
  import { readFileSync } from 'node:fs';
130
141
 
131
- let params: SendMMSCommandInput = {
142
+ let command = new SendMMSCommand({
132
143
  from: '01012345678',
133
144
  content: DEFAULT_CONTENT,
134
145
  messages: [
135
146
  { to: '0109182xxxx' },
136
- { to: '0104321xxxx', content?: OPTIONAL_CONTENT_01 }
137
- { to: '0108765xxxx', content?: OPTIONAL_CONTENT_02, subject?: OPTIONAL_SUBJECT_01 },
147
+ { to: '0104321xxxx', content?: CONTENT_01 }
148
+ { to: '0108765xxxx', content?: CONTENT_02, subject?: SUBJECT_01 },
138
149
  ],
139
150
  files: [ // support jpg, jpeg
140
151
  { name: '/your/absolute/path/sample-image-1.jpg' },
@@ -143,12 +154,12 @@ let params: SendMMSCommandInput = {
143
154
  body?: readFileSync('/your/absolute/path/sample-image-2.jpg', { encoding: 'base64' })
144
155
  }
145
156
  ]
146
- };
157
+ });
158
+
147
159
  /**
148
160
  * If you do not define the subject and content within the messages,
149
161
  * it is sent with the value specified as the default subject('제목없음') and content.
150
162
  */
151
- let command = new SendMMSCommand(params);
152
163
  ```
153
164
 
154
165
  #### Async/await
@@ -15,11 +15,9 @@ const util_error_handler_1 = require("@ingestkorea/util-error-handler");
15
15
  const middleware_1 = require("./middleware");
16
16
  class SensClient {
17
17
  constructor(config) {
18
- const resolvedCredentials = resolveCredentials(config);
19
- const resolvedServiceId = resolveServiceId(config);
20
18
  this.config = {
21
- credentials: Object.assign({}, resolvedCredentials),
22
- serviceId: Object.assign({}, resolvedServiceId),
19
+ credentials: resolveCredentials(config),
20
+ serviceId: resolveServiceId(config),
23
21
  };
24
22
  this.requestHandler = new util_http_handler_1.NodeHttpHandler({ connectionTimeout: 3000, socketTimeout: 3000 });
25
23
  }
@@ -50,13 +48,14 @@ const resolveCredentials = (config) => {
50
48
  };
51
49
  const resolveServiceId = (config) => {
52
50
  const { serviceId } = config;
53
- if (!serviceId)
54
- throw new util_error_handler_1.IngestkoreaError({
55
- code: 401,
56
- type: "Unauthorized",
57
- message: "Invalid Credentials",
58
- description: "Invalid ServiceId",
59
- });
51
+ const lastError = new util_error_handler_1.IngestkoreaError({
52
+ code: 401,
53
+ type: "Unauthorized",
54
+ message: "Invalid Credentials",
55
+ description: "Invalid ServiceId",
56
+ });
57
+ if (!serviceId || !Object.keys(serviceId).length)
58
+ throw lastError;
60
59
  return {
61
60
  push: serviceId.push != undefined ? serviceId.push : undefined,
62
61
  sms: serviceId.sms != undefined ? serviceId.sms : undefined,
@@ -16,7 +16,9 @@ const util_error_handler_1 = require("@ingestkorea/util-error-handler");
16
16
  class GetAlimtalkResultCommand extends models_1.SensCommand {
17
17
  constructor(input) {
18
18
  super(input);
19
- this.input = Object.assign({}, input);
19
+ this.input = {
20
+ messageId: input.messageId,
21
+ };
20
22
  }
21
23
  serialize(input, config) {
22
24
  return __awaiter(this, void 0, void 0, function* () {
@@ -16,7 +16,9 @@ const util_error_handler_1 = require("@ingestkorea/util-error-handler");
16
16
  class GetAlimtalkStatusCommand extends models_1.SensCommand {
17
17
  constructor(input) {
18
18
  super(input);
19
- this.input = Object.assign({}, input);
19
+ this.input = {
20
+ requestId: input.requestId,
21
+ };
20
22
  }
21
23
  serialize(input, config) {
22
24
  return __awaiter(this, void 0, void 0, function* () {
@@ -16,7 +16,10 @@ const util_error_handler_1 = require("@ingestkorea/util-error-handler");
16
16
  class GetAlimtalkTemplateCommand extends models_1.SensCommand {
17
17
  constructor(input) {
18
18
  super(input);
19
- this.input = Object.assign({}, input);
19
+ this.input = {
20
+ channelId: input.channelId,
21
+ templateCode: input.templateCode,
22
+ };
20
23
  }
21
24
  serialize(input, config) {
22
25
  return __awaiter(this, void 0, void 0, function* () {
@@ -0,0 +1,43 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ListAlimtalkStatusCommand = void 0;
13
+ const models_1 = require("../models");
14
+ const ListAlimtalkStatus_1 = require("../protocols/ListAlimtalkStatus");
15
+ const util_error_handler_1 = require("@ingestkorea/util-error-handler");
16
+ const constants_1 = require("./constants");
17
+ class ListAlimtalkStatusCommand extends models_1.SensCommand {
18
+ constructor(input) {
19
+ super(input);
20
+ const { startTime, endTime } = (0, constants_1.getRequestDuration)();
21
+ this.input = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ plusFriendId: input.plusFriendId }, (input.requestId && { requestId: input.requestId })), (input.messageId && { messageId: input.messageId })), (input.requestStatusName && { requestStatusName: input.requestStatusName })), (input.messageStatusName && { messageStatusName: input.messageStatusName })), (input.templateCode && { templateCode: input.templateCode })), (input.to && { to: input.to.replace(/\-/gi, "") })), { requestStartTime: input.requestStartTime ? input.requestStartTime : startTime, requestEndTime: input.requestEndTime ? input.requestEndTime : endTime, pageIndex: input.pageIndex ? input.pageIndex : 0, pageSize: input.pageSize && input.pageSize <= 100 ? input.pageSize : 20 });
22
+ }
23
+ serialize(input, config) {
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ if (!config.serviceId.kakao)
26
+ throw new util_error_handler_1.IngestkoreaError({
27
+ code: 400,
28
+ type: "Bad Request",
29
+ message: "Invalid Params",
30
+ description: "Please Check Kakao ServiceId",
31
+ });
32
+ let request = yield (0, ListAlimtalkStatus_1.serializeIngestkorea_restJson_ListAlimtalkStatusCommand)(input, config);
33
+ return request;
34
+ });
35
+ }
36
+ deserialize(response) {
37
+ return __awaiter(this, void 0, void 0, function* () {
38
+ let output = yield (0, ListAlimtalkStatus_1.deserializeIngestkorea_restJson_ListAlimtalkStatusCommand)(response);
39
+ return output;
40
+ });
41
+ }
42
+ }
43
+ exports.ListAlimtalkStatusCommand = ListAlimtalkStatusCommand;
@@ -16,7 +16,9 @@ const util_error_handler_1 = require("@ingestkorea/util-error-handler");
16
16
  class ListAlimtalkTemplatesCommand extends models_1.SensCommand {
17
17
  constructor(input) {
18
18
  super(input);
19
- this.input = Object.assign({}, input);
19
+ this.input = {
20
+ channelId: input.channelId,
21
+ };
20
22
  }
21
23
  serialize(input, config) {
22
24
  return __awaiter(this, void 0, void 0, function* () {
@@ -16,7 +16,7 @@ const util_error_handler_1 = require("@ingestkorea/util-error-handler");
16
16
  class SendAlimtalkCommand extends models_1.SensCommand {
17
17
  constructor(input) {
18
18
  super(input);
19
- this.input = Object.assign(Object.assign({}, input), { plusFriendId: input.plusFriendId, templateCode: input.templateCode, messages: input.messages.map(resolveAlimtalkMessage) });
19
+ this.input = Object.assign(Object.assign({}, input), { plusFriendId: input.plusFriendId, templateCode: input.templateCode, messages: resolveAlimtalkMessage(input.messages) });
20
20
  }
21
21
  serialize(input, config) {
22
22
  return __awaiter(this, void 0, void 0, function* () {
@@ -39,14 +39,18 @@ class SendAlimtalkCommand extends models_1.SensCommand {
39
39
  }
40
40
  }
41
41
  exports.SendAlimtalkCommand = SendAlimtalkCommand;
42
- const resolveAlimtalkMessage = (message) => {
42
+ const resolveAlimtalkMessage = (messages) => {
43
43
  const ALIMTALK_MAX = 1000;
44
- if (message.content.length > ALIMTALK_MAX)
45
- throw new util_error_handler_1.IngestkoreaError({
46
- code: 400,
47
- type: "Bad Request",
48
- message: "Invalid Params",
49
- description: `Maximum message length is ${ALIMTALK_MAX}`,
50
- });
51
- return Object.assign({ to: message.to.replace(/\-/gi, ""), content: message.content }, (message.buttons != undefined && { buttons: message.buttons }));
44
+ const lastError = new util_error_handler_1.IngestkoreaError({
45
+ code: 400,
46
+ type: "Bad Request",
47
+ message: "Invalid Params",
48
+ description: `Maximum message length is ${ALIMTALK_MAX}`,
49
+ });
50
+ const result = messages.map((message) => {
51
+ if (message.content.length > ALIMTALK_MAX)
52
+ throw lastError;
53
+ return Object.assign({ to: message.to.replace(/\-/gi, ""), content: message.content }, (message.buttons && message.buttons.length && { buttons: message.buttons }));
54
+ });
55
+ return result;
52
56
  };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getContentLength = exports.prettyPhoneNum = exports.trimText = exports.MMS_FILE_MAX = exports.LMS_MAX = exports.SMS_MAX = void 0;
3
+ exports.getRequestDuration = exports.getContentLength = exports.prettyPhoneNum = exports.trimText = exports.MMS_FILE_MAX = exports.LMS_MAX = exports.SMS_MAX = void 0;
4
4
  exports.SMS_MAX = 90;
5
5
  exports.LMS_MAX = 2000;
6
6
  exports.MMS_FILE_MAX = 300; // KiByte
@@ -18,3 +18,14 @@ const getContentLength = (input) => {
18
18
  }, 0);
19
19
  };
20
20
  exports.getContentLength = getContentLength;
21
+ const getRequestDuration = (input) => {
22
+ const OFFSET = 9 * 60 * 60 * 1000;
23
+ const hours = input ? Math.abs(input) : 24;
24
+ const hours_ms = hours * 60 * 60 * 1000;
25
+ const current_ms = new Date().getTime() + OFFSET;
26
+ const startTime_ms = current_ms - hours_ms;
27
+ let current_kst = new Date(current_ms).toISOString().replace(/\.\d{3}Z$/, "");
28
+ let startTime_kst = new Date(startTime_ms).toISOString().replace(/\.\d{3}Z$/, "");
29
+ return { startTime: startTime_kst, endTime: current_kst };
30
+ };
31
+ exports.getRequestDuration = getRequestDuration;
@@ -18,6 +18,7 @@ __exportStar(require("./SendAlimtalkCommand"), exports);
18
18
  __exportStar(require("./GetAlimtalkStatusCommand"), exports);
19
19
  __exportStar(require("./GetAlimtalkResultCommand"), exports);
20
20
  __exportStar(require("./GetAlimtalkTemplateCommand"), exports);
21
+ __exportStar(require("./ListAlimtalkStatusCommand"), exports);
21
22
  __exportStar(require("./ListAlimtalkTemplatesCommand"), exports);
22
23
  __exportStar(require("./ListAlimtalkChannelsCommand"), exports);
23
24
  __exportStar(require("./SendSMSCommand"), exports);
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.middlewareIngestkoreaMetadata = void 0;
13
13
  const REQUEST_HEADER = "x-ingestkorea-request";
14
14
  const middlewareIngestkoreaMetadata = (request, config) => __awaiter(void 0, void 0, void 0, function* () {
15
- request.headers["x-ingestkorea-user-agent"] = "@ingestkorea/client-sens/1.6.x";
15
+ request.headers["x-ingestkorea-user-agent"] = "@ingestkorea/client-sens/1.7.x";
16
16
  request.headers[REQUEST_HEADER] = "attempt=1";
17
17
  return request;
18
18
  });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const ALIMTALK_BUTTON_TYPES = ["DS", "WL", "AL", "BK", "MD", "AC"];
4
+ const ALIMTALK_BUTTON_NAMES = ["배송 조회", "웹 링크", "앱 링크", "봇 키워드", "메시지 전달", "채널 추가"];
@@ -21,6 +21,7 @@ __exportStar(require("./SendAlimtalk"), exports);
21
21
  __exportStar(require("./GetAlimtalkStatus"), exports);
22
22
  __exportStar(require("./GetAlimtalkResult"), exports);
23
23
  __exportStar(require("./GetAlimtalkTemplate"), exports);
24
+ __exportStar(require("./ListAlimtalkStatus"), exports);
24
25
  __exportStar(require("./ListAlimtalkTemplates"), exports);
25
26
  __exportStar(require("./ListAlimtalkChannels"), exports);
26
27
  __exportStar(require("./SendSMS"), exports);
@@ -11,7 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.deserializeIngestkorea_restJson_AlimtalkFailover = exports.deserializeIngestkorea_restJson_GetAlimtalkResultOutput = exports.deserializeIngestkorea_restJson_GetAlimtalkResultCommand = exports.serializeIngestkorea_restJson_GetAlimtalkResultCommand = void 0;
13
13
  const util_http_handler_1 = require("@ingestkorea/util-http-handler");
14
- const constants_1 = require("./constants");
14
+ const _1 = require("./");
15
15
  const serializeIngestkorea_restJson_GetAlimtalkResultCommand = (input, config) => __awaiter(void 0, void 0, void 0, function* () {
16
16
  const hostname = "sens.apigw.ntruss.com";
17
17
  const path = "/alimtalk/v2/services/" + config.serviceId.kakao + "/messages/" + input.messageId;
@@ -30,33 +30,15 @@ exports.serializeIngestkorea_restJson_GetAlimtalkResultCommand = serializeIngest
30
30
  const deserializeIngestkorea_restJson_GetAlimtalkResultCommand = (response) => __awaiter(void 0, void 0, void 0, function* () {
31
31
  const { response: httpResponse, output } = response;
32
32
  if (httpResponse.statusCode > 300)
33
- yield (0, constants_1.parseErrorBody)(httpResponse);
34
- const data = yield (0, constants_1.parseBody)(httpResponse);
33
+ yield (0, _1.parseErrorBody)(httpResponse);
34
+ const data = yield (0, _1.parseBody)(httpResponse);
35
35
  let contents = {};
36
36
  contents = yield (0, exports.deserializeIngestkorea_restJson_GetAlimtalkResultOutput)(data);
37
- return Object.assign({ $metadata: Object.assign(Object.assign({}, (0, constants_1.deserializeMetadata)(httpResponse)), output.$metadata) }, contents);
37
+ return Object.assign({ $metadata: Object.assign(Object.assign({}, (0, _1.deserializeMetadata)(httpResponse)), output.$metadata) }, contents);
38
38
  });
39
39
  exports.deserializeIngestkorea_restJson_GetAlimtalkResultCommand = deserializeIngestkorea_restJson_GetAlimtalkResultCommand;
40
40
  const deserializeIngestkorea_restJson_GetAlimtalkResultOutput = (output) => __awaiter(void 0, void 0, void 0, function* () {
41
- return {
42
- requestId: output.requestId != undefined ? output.requestId : undefined,
43
- messageId: output.messageId != undefined ? output.messageId : undefined,
44
- to: output.to != undefined ? output.to : undefined,
45
- countryCode: output.countryCode != undefined ? output.countryCode : undefined,
46
- content: output.content != undefined ? output.content : undefined,
47
- requestStatusCode: output.requestStatusCode != undefined ? output.requestStatusCode : undefined,
48
- requestStatusName: output.requestStatusName != undefined ? output.requestStatusName : undefined,
49
- requestStatusDesc: output.requestStatusDesc != undefined ? output.requestStatusDesc : undefined,
50
- useSmsFailover: output.useSmsFailover != undefined ? output.useSmsFailover : undefined,
51
- requestTime: output.requestTime != undefined ? output.requestTime : undefined,
52
- plusFriendId: output.plusFriendId != undefined ? output.plusFriendId : undefined,
53
- templateCode: output.templateCode != undefined ? output.templateCode : undefined,
54
- completeTime: output.completeTime != undefined ? output.completeTime : undefined,
55
- messageStatusCode: output.messageStatusCode != undefined ? output.messageStatusCode : undefined,
56
- messageStatusName: output.messageStatusName != undefined ? output.messageStatusName : undefined,
57
- messageStatusDesc: output.messageStatusDesc != undefined ? output.messageStatusDesc : undefined,
58
- failover: output.failover != undefined ? (0, exports.deserializeIngestkorea_restJson_AlimtalkFailover)(output.failover) : undefined,
59
- };
41
+ return Object.assign(Object.assign({}, (0, _1.parseStatusMessage)(output)), { failover: output.failover != undefined ? (0, exports.deserializeIngestkorea_restJson_AlimtalkFailover)(output.failover) : undefined });
60
42
  });
61
43
  exports.deserializeIngestkorea_restJson_GetAlimtalkResultOutput = deserializeIngestkorea_restJson_GetAlimtalkResultOutput;
62
44
  const deserializeIngestkorea_restJson_AlimtalkFailover = (output) => {
@@ -9,9 +9,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.deserializeIngestkorea_restJson_GetAlimtalkStatusMessages = exports.deserializeIngestkorea_restJson_GetAlimtalkStatusOutput = exports.deserializeIngestkorea_restJson_GetAlimtalkStatusCommand = exports.serializeIngestkorea_restJson_GetAlimtalkStatusCommand = void 0;
12
+ exports.parseStatusMessage = exports.deserializeIngestkorea_restJson_GetAlimtalkStatusMessages = exports.deserializeIngestkorea_restJson_GetAlimtalkStatusOutput = exports.deserializeIngestkorea_restJson_GetAlimtalkStatusCommand = exports.serializeIngestkorea_restJson_GetAlimtalkStatusCommand = void 0;
13
13
  const util_http_handler_1 = require("@ingestkorea/util-http-handler");
14
- const constants_1 = require("./constants");
14
+ const _1 = require("./");
15
15
  const serializeIngestkorea_restJson_GetAlimtalkStatusCommand = (input, config) => __awaiter(void 0, void 0, void 0, function* () {
16
16
  const hostname = "sens.apigw.ntruss.com";
17
17
  const path = "/alimtalk/v2/services/" + config.serviceId.kakao + "/messages";
@@ -34,43 +34,34 @@ exports.serializeIngestkorea_restJson_GetAlimtalkStatusCommand = serializeIngest
34
34
  const deserializeIngestkorea_restJson_GetAlimtalkStatusCommand = (response) => __awaiter(void 0, void 0, void 0, function* () {
35
35
  const { response: httpResponse, output } = response;
36
36
  if (httpResponse.statusCode > 300)
37
- yield (0, constants_1.parseErrorBody)(httpResponse);
38
- const data = yield (0, constants_1.parseBody)(httpResponse); // GetAlimtalkStatusOutput
37
+ yield (0, _1.parseErrorBody)(httpResponse);
38
+ const data = yield (0, _1.parseBody)(httpResponse);
39
39
  let contents = {};
40
40
  contents = yield (0, exports.deserializeIngestkorea_restJson_GetAlimtalkStatusOutput)(data);
41
- return Object.assign({ $metadata: Object.assign(Object.assign({}, (0, constants_1.deserializeMetadata)(httpResponse)), output.$metadata) }, contents);
41
+ return Object.assign({ $metadata: Object.assign(Object.assign({}, (0, _1.deserializeMetadata)(httpResponse)), output.$metadata) }, contents);
42
42
  });
43
43
  exports.deserializeIngestkorea_restJson_GetAlimtalkStatusCommand = deserializeIngestkorea_restJson_GetAlimtalkStatusCommand;
44
44
  const deserializeIngestkorea_restJson_GetAlimtalkStatusOutput = (output) => __awaiter(void 0, void 0, void 0, function* () {
45
- const { requestId, statusCode, statusName, messages } = output;
46
45
  return {
47
- requestId: requestId != undefined ? requestId : undefined,
48
- statusCode: statusCode != undefined ? statusCode : undefined,
49
- statusName: statusName != undefined ? statusName : undefined,
50
- messages: messages != undefined ? (0, exports.deserializeIngestkorea_restJson_GetAlimtalkStatusMessages)(messages) : undefined,
46
+ requestId: output.requestId != undefined ? output.requestId : undefined,
47
+ statusCode: output.statusCode != undefined ? output.statusCode : undefined,
48
+ statusName: output.statusName != undefined ? output.statusName : undefined,
49
+ messages: output.messages != undefined
50
+ ? (0, exports.deserializeIngestkorea_restJson_GetAlimtalkStatusMessages)(output.messages)
51
+ : undefined,
52
+ pageSize: output.pageSize != undefined ? output.pageSize : undefined,
53
+ pageIndex: output.pageIndex != undefined ? output.pageIndex : undefined,
54
+ itemCount: output.itemCount != undefined ? output.itemCount : undefined,
55
+ hasMore: output.hasMore != undefined ? output.hasMore : undefined,
51
56
  };
52
57
  });
53
58
  exports.deserializeIngestkorea_restJson_GetAlimtalkStatusOutput = deserializeIngestkorea_restJson_GetAlimtalkStatusOutput;
54
59
  const deserializeIngestkorea_restJson_GetAlimtalkStatusMessages = (outputs) => {
55
- const result = outputs.map((output) => {
56
- return {
57
- messageId: output.messageId != undefined ? output.messageId : undefined,
58
- to: output.to != undefined ? output.to : undefined,
59
- countryCode: output.countryCode != undefined ? output.countryCode : undefined,
60
- content: output.content != undefined ? output.content : undefined,
61
- requestStatusCode: output.requestStatusCode != undefined ? output.requestStatusCode : undefined,
62
- requestStatusName: output.requestStatusName != undefined ? output.requestStatusName : undefined,
63
- requestStatusDesc: output.requestStatusDesc != undefined ? output.requestStatusDesc : undefined,
64
- useSmsFailover: output.useSmsFailover != undefined ? output.useSmsFailover : undefined,
65
- requestTime: output.requestTime != undefined ? output.requestTime : undefined,
66
- plusFriendId: output.plusFriendId != undefined ? output.plusFriendId : undefined,
67
- templateCode: output.templateCode != undefined ? output.templateCode : undefined,
68
- completeTime: output.completeTime != undefined ? output.completeTime : undefined,
69
- messageStatusCode: output.messageStatusCode != undefined ? output.messageStatusCode : undefined,
70
- messageStatusName: output.messageStatusName != undefined ? output.messageStatusName : undefined,
71
- messageStatusDesc: output.messageStatusDesc != undefined ? output.messageStatusDesc : undefined,
72
- };
73
- });
60
+ const result = outputs.map(exports.parseStatusMessage);
74
61
  return result;
75
62
  };
76
63
  exports.deserializeIngestkorea_restJson_GetAlimtalkStatusMessages = deserializeIngestkorea_restJson_GetAlimtalkStatusMessages;
64
+ const parseStatusMessage = (output) => {
65
+ return Object.assign(Object.assign({}, (0, _1.parseReceivedMessage)(output)), { requestId: output.requestId != undefined ? output.requestId : undefined, requestTime: output.requestTime != undefined ? output.requestTime : undefined, plusFriendId: output.plusFriendId != undefined ? output.plusFriendId : undefined, templateCode: output.templateCode != undefined ? output.templateCode : undefined, completeTime: output.completeTime != undefined ? output.completeTime : undefined, messageStatusCode: output.messageStatusCode != undefined ? output.messageStatusCode : undefined, messageStatusName: output.messageStatusName != undefined ? output.messageStatusName : undefined, messageStatusDesc: output.messageStatusDesc != undefined ? output.messageStatusDesc : undefined });
66
+ };
67
+ exports.parseStatusMessage = parseStatusMessage;
@@ -9,9 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.deserializeIngestkorea_restJson_GetAlimtalkTemplateOutput = exports.deserializeIngestkorea_restJson_GetAlimtalkTemplateCommand = exports.serializeIngestkorea_restJson_GetAlimtalkTemplateCommand = void 0;
12
+ exports.deserializeIngestkorea_restJson_AlimtalkTemplateButton = exports.deserializeIngestkorea_restJson_AlimtalkTemplateCommentAttachment = exports.deserializeIngestkorea_restJson_AlimtalkTemplateComment = exports.deserializeIngestkorea_restJson_AlimtalkTemplateDetail = exports.deserializeIngestkorea_restJson_GetAlimtalkTemplateOutput = exports.deserializeIngestkorea_restJson_GetAlimtalkTemplateCommand = exports.serializeIngestkorea_restJson_GetAlimtalkTemplateCommand = void 0;
13
13
  const util_http_handler_1 = require("@ingestkorea/util-http-handler");
14
- const ListAlimtalkTemplates_1 = require("./ListAlimtalkTemplates");
15
14
  const constants_1 = require("./constants");
16
15
  const serializeIngestkorea_restJson_GetAlimtalkTemplateCommand = (input, config) => __awaiter(void 0, void 0, void 0, function* () {
17
16
  const hostname = "sens.apigw.ntruss.com";
@@ -45,7 +44,80 @@ const deserializeIngestkorea_restJson_GetAlimtalkTemplateCommand = (response) =>
45
44
  exports.deserializeIngestkorea_restJson_GetAlimtalkTemplateCommand = deserializeIngestkorea_restJson_GetAlimtalkTemplateCommand;
46
45
  const deserializeIngestkorea_restJson_GetAlimtalkTemplateOutput = (output) => __awaiter(void 0, void 0, void 0, function* () {
47
46
  return {
48
- templates: (0, ListAlimtalkTemplates_1.deserializeIngestkorea_restJson_AlimtalkTemplate)(output),
47
+ templates: (0, exports.deserializeIngestkorea_restJson_AlimtalkTemplateDetail)(output),
49
48
  };
50
49
  });
51
50
  exports.deserializeIngestkorea_restJson_GetAlimtalkTemplateOutput = deserializeIngestkorea_restJson_GetAlimtalkTemplateOutput;
51
+ const deserializeIngestkorea_restJson_AlimtalkTemplateDetail = (outputs) => {
52
+ let result = outputs.map((output) => {
53
+ return {
54
+ createTime: output.createTime != undefined ? output.createTime : undefined,
55
+ updateTime: output.updateTime != undefined ? output.updateTime : undefined,
56
+ channelId: output.channelId != undefined ? output.channelId : undefined,
57
+ templateCode: output.templateCode != undefined ? output.templateCode : undefined,
58
+ templateName: output.templateName != undefined ? output.templateName : undefined,
59
+ categoryCode: output.categoryCode != undefined ? output.categoryCode : undefined,
60
+ categoryName: output.categoryName != undefined ? output.categoryName : undefined,
61
+ messageType: output.messageType != undefined ? output.messageType : undefined,
62
+ emphasizeType: output.emphasizeType != undefined ? output.emphasizeType : undefined,
63
+ content: output.content != undefined ? output.content : undefined,
64
+ adContent: output.adContent != undefined ? output.adContent : undefined,
65
+ extraContent: output.extraContent != undefined ? output.extraContent : undefined,
66
+ title: output.title != undefined ? output.title : undefined,
67
+ additionalTitle: output.additionalTitle != undefined ? output.additionalTitle : undefined,
68
+ comments: output.comments != undefined
69
+ ? (0, exports.deserializeIngestkorea_restJson_AlimtalkTemplateComment)(output.comments)
70
+ : undefined,
71
+ templateInspectionStatus: output.templateInspectionStatus != undefined ? output.templateInspectionStatus : undefined,
72
+ templateStatus: output.templateStatus != undefined ? output.templateStatus : undefined,
73
+ buttons: output.buttons != undefined
74
+ ? (0, exports.deserializeIngestkorea_restJson_AlimtalkTemplateButton)(output.buttons)
75
+ : undefined,
76
+ securityFlag: output.securityFlag != null ? output.securityFlag : undefined,
77
+ isBlock: output.isBlock != null ? output.isBlock : undefined,
78
+ isDormant: output.isDormant != null ? output.isDormant : undefined,
79
+ };
80
+ });
81
+ return result;
82
+ };
83
+ exports.deserializeIngestkorea_restJson_AlimtalkTemplateDetail = deserializeIngestkorea_restJson_AlimtalkTemplateDetail;
84
+ const deserializeIngestkorea_restJson_AlimtalkTemplateComment = (outputs) => {
85
+ let result = outputs.map((output) => {
86
+ return {
87
+ commentId: output.commentId != undefined ? output.commentId : undefined,
88
+ content: output.content != undefined ? output.content : undefined,
89
+ status: output.status != undefined ? output.status : undefined,
90
+ createTime: output.createTime != undefined ? output.createTime : undefined,
91
+ attachment: output.attachment != undefined
92
+ ? (0, exports.deserializeIngestkorea_restJson_AlimtalkTemplateCommentAttachment)(output.attachment)
93
+ : undefined,
94
+ };
95
+ });
96
+ return result;
97
+ };
98
+ exports.deserializeIngestkorea_restJson_AlimtalkTemplateComment = deserializeIngestkorea_restJson_AlimtalkTemplateComment;
99
+ const deserializeIngestkorea_restJson_AlimtalkTemplateCommentAttachment = (outputs) => {
100
+ let result = outputs.map((output) => {
101
+ return {
102
+ fileName: output.fileName != undefined ? output.fileName : undefined,
103
+ fileUrl: output.fileUrl != undefined ? output.fileUrl : undefined,
104
+ };
105
+ });
106
+ return result;
107
+ };
108
+ exports.deserializeIngestkorea_restJson_AlimtalkTemplateCommentAttachment = deserializeIngestkorea_restJson_AlimtalkTemplateCommentAttachment;
109
+ const deserializeIngestkorea_restJson_AlimtalkTemplateButton = (outputs) => {
110
+ let result = outputs.map((output) => {
111
+ return {
112
+ order: output.order != undefined ? output.order : undefined,
113
+ type: output.type != undefined ? output.type : undefined,
114
+ name: output.name != undefined ? output.name : undefined,
115
+ linkMobile: output.linkMobile != undefined ? output.linkMobile : undefined,
116
+ linkPc: output.linkPc != undefined ? output.linkPc : undefined,
117
+ schemeIos: output.schemeIos != undefined ? output.schemeIos : undefined,
118
+ schemeAndroid: output.schemeAndroid != undefined ? output.schemeAndroid : undefined,
119
+ };
120
+ });
121
+ return result;
122
+ };
123
+ exports.deserializeIngestkorea_restJson_AlimtalkTemplateButton = deserializeIngestkorea_restJson_AlimtalkTemplateButton;
@@ -0,0 +1,45 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.deserializeIngestkorea_restJson_ListAlimtalkStatusOutput = exports.deserializeIngestkorea_restJson_ListAlimtalkStatusCommand = exports.serializeIngestkorea_restJson_ListAlimtalkStatusCommand = void 0;
13
+ const util_http_handler_1 = require("@ingestkorea/util-http-handler");
14
+ const _1 = require("./");
15
+ const serializeIngestkorea_restJson_ListAlimtalkStatusCommand = (input, config) => __awaiter(void 0, void 0, void 0, function* () {
16
+ const hostname = "sens.apigw.ntruss.com";
17
+ const path = "/alimtalk/v2/services/" + config.serviceId.kakao + "/messages";
18
+ const headers = {
19
+ host: hostname,
20
+ };
21
+ const query = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ plusFriendId: input.plusFriendId }, (input.requestId && { requestId: input.requestId })), (input.messageId && { messageId: input.messageId })), (input.requestStatusName && { requestStatusName: input.requestStatusName })), (input.messageStatusName && { messageStatusName: input.messageStatusName })), (input.templateCode && { templateCode: input.templateCode })), (input.to && { to: input.to.replace(/\-/gi, "") })), (input.requestStartTime && { requestStartTime: input.requestStartTime })), (input.requestEndTime && { requestEndTime: input.requestEndTime })), (input.pageIndex != null && { pageIndex: input.pageIndex.toString() })), (input.pageSize && { pageSize: input.pageSize.toString() }));
22
+ return new util_http_handler_1.HttpRequest({
23
+ protocol: "https:",
24
+ method: "GET",
25
+ hostname: hostname,
26
+ path: path,
27
+ headers: headers,
28
+ query: query,
29
+ });
30
+ });
31
+ exports.serializeIngestkorea_restJson_ListAlimtalkStatusCommand = serializeIngestkorea_restJson_ListAlimtalkStatusCommand;
32
+ const deserializeIngestkorea_restJson_ListAlimtalkStatusCommand = (response) => __awaiter(void 0, void 0, void 0, function* () {
33
+ const { response: httpResponse, output } = response;
34
+ if (httpResponse.statusCode > 300)
35
+ yield (0, _1.parseErrorBody)(httpResponse);
36
+ const data = yield (0, _1.parseBody)(httpResponse);
37
+ let contents = {};
38
+ contents = yield (0, exports.deserializeIngestkorea_restJson_ListAlimtalkStatusOutput)(data);
39
+ return Object.assign({ $metadata: Object.assign(Object.assign({}, (0, _1.deserializeMetadata)(httpResponse)), output.$metadata) }, contents);
40
+ });
41
+ exports.deserializeIngestkorea_restJson_ListAlimtalkStatusCommand = deserializeIngestkorea_restJson_ListAlimtalkStatusCommand;
42
+ const deserializeIngestkorea_restJson_ListAlimtalkStatusOutput = (output) => __awaiter(void 0, void 0, void 0, function* () {
43
+ return (0, _1.deserializeIngestkorea_restJson_GetAlimtalkStatusOutput)(output);
44
+ });
45
+ exports.deserializeIngestkorea_restJson_ListAlimtalkStatusOutput = deserializeIngestkorea_restJson_ListAlimtalkStatusOutput;