@ingestkorea/client-sens 1.5.2 → 1.6.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 (133) hide show
  1. package/.github/pull_request_template.md +6 -1
  2. package/LICENSE +2 -2
  3. package/README.md +56 -38
  4. package/dist-cjs/SensClient.js +12 -12
  5. package/dist-cjs/commands/GetAlimtalkResultCommand.js +4 -7
  6. package/dist-cjs/commands/GetAlimtalkStatusCommand.js +4 -7
  7. package/dist-cjs/commands/GetAlimtalkTemplateCommand.js +4 -7
  8. package/dist-cjs/commands/GetSMSResultCommand.js +4 -6
  9. package/dist-cjs/commands/GetSMSStatusCommand.js +4 -6
  10. package/dist-cjs/commands/ListAlimtalkChannelsCommand.js +4 -7
  11. package/dist-cjs/commands/ListAlimtalkTemplatesCommand.js +4 -7
  12. package/dist-cjs/commands/SendAlimtalkCommand.js +8 -9
  13. package/dist-cjs/commands/SendMMSCommand.js +40 -30
  14. package/dist-cjs/commands/SendSMSCommand.js +19 -18
  15. package/dist-cjs/commands/constants.js +2 -2
  16. package/dist-cjs/middleware/index.js +4 -2
  17. package/dist-cjs/middleware/{metadata-ingestkorea.js → middleware-metadata.js} +3 -12
  18. package/dist-cjs/middleware/middleware-retry.js +58 -0
  19. package/dist-cjs/middleware/{signer-ncp.js → middleware-sign.js} +3 -7
  20. package/dist-cjs/middleware/middleware-sort-headers.js +25 -0
  21. package/dist-cjs/models/GetAlimtalkResult.js +0 -3
  22. package/dist-cjs/models/GetAlimtalkStatus.js +0 -3
  23. package/dist-cjs/models/GetAlimtalkTemplate.js +0 -2
  24. package/dist-cjs/models/GetSMSResult.js +0 -4
  25. package/dist-cjs/models/GetSMSStatus.js +0 -3
  26. package/dist-cjs/models/ListAlimtalkChannels.js +0 -3
  27. package/dist-cjs/models/ListAlimtalkTemplates.js +0 -5
  28. package/dist-cjs/models/MetadataBearer.js +2 -0
  29. package/dist-cjs/models/Middleware.js +2 -0
  30. package/dist-cjs/models/SendAlimtalk.js +0 -5
  31. package/dist-cjs/models/SendMMS.js +0 -2
  32. package/dist-cjs/models/SendSMS.js +0 -2
  33. package/dist-cjs/models/SensCommand.js +0 -2
  34. package/dist-cjs/models/index.js +2 -0
  35. package/dist-cjs/protocols/GetAlimtalkResult.js +11 -12
  36. package/dist-cjs/protocols/GetAlimtalkStatus.js +13 -14
  37. package/dist-cjs/protocols/GetAlimtalkTemplate.js +12 -12
  38. package/dist-cjs/protocols/GetSMSResult.js +15 -15
  39. package/dist-cjs/protocols/GetSMSStatus.js +13 -13
  40. package/dist-cjs/protocols/ListAlimtalkChannels.js +13 -13
  41. package/dist-cjs/protocols/ListAlimtalkTemplates.js +22 -21
  42. package/dist-cjs/protocols/SendAlimtalk.js +13 -14
  43. package/dist-cjs/protocols/SendMMS.js +11 -11
  44. package/dist-cjs/protocols/SendSMS.js +11 -11
  45. package/dist-cjs/protocols/constants.js +17 -8
  46. package/dist-es/SensClient.js +15 -15
  47. package/dist-es/commands/GetAlimtalkResultCommand.js +8 -11
  48. package/dist-es/commands/GetAlimtalkStatusCommand.js +8 -11
  49. package/dist-es/commands/GetAlimtalkTemplateCommand.js +8 -11
  50. package/dist-es/commands/GetSMSResultCommand.js +8 -10
  51. package/dist-es/commands/GetSMSStatusCommand.js +8 -10
  52. package/dist-es/commands/ListAlimtalkChannelsCommand.js +8 -11
  53. package/dist-es/commands/ListAlimtalkTemplatesCommand.js +8 -11
  54. package/dist-es/commands/SendAlimtalkCommand.js +13 -14
  55. package/dist-es/commands/SendMMSCommand.js +48 -38
  56. package/dist-es/commands/SendSMSCommand.js +23 -22
  57. package/dist-es/commands/constants.js +2 -2
  58. package/dist-es/commands/index.js +10 -10
  59. package/dist-es/index.js +2 -2
  60. package/dist-es/middleware/index.js +4 -2
  61. package/dist-es/middleware/middleware-metadata.js +6 -0
  62. package/dist-es/middleware/middleware-retry.js +51 -0
  63. package/dist-es/middleware/{signer-ncp.js → middleware-sign.js} +7 -11
  64. package/dist-es/middleware/middleware-sort-headers.js +12 -0
  65. package/dist-es/models/GetAlimtalkResult.js +0 -3
  66. package/dist-es/models/GetAlimtalkStatus.js +0 -3
  67. package/dist-es/models/GetAlimtalkTemplate.js +0 -2
  68. package/dist-es/models/GetSMSResult.js +0 -4
  69. package/dist-es/models/GetSMSStatus.js +0 -3
  70. package/dist-es/models/ListAlimtalkChannels.js +0 -3
  71. package/dist-es/models/ListAlimtalkTemplates.js +0 -5
  72. package/dist-es/models/MetadataBearer.js +1 -0
  73. package/dist-es/models/Middleware.js +1 -0
  74. package/dist-es/models/SendAlimtalk.js +0 -5
  75. package/dist-es/models/SendMMS.js +0 -2
  76. package/dist-es/models/SendSMS.js +0 -2
  77. package/dist-es/models/SensCommand.js +0 -2
  78. package/dist-es/models/index.js +13 -11
  79. package/dist-es/protocols/GetAlimtalkResult.js +18 -15
  80. package/dist-es/protocols/GetAlimtalkStatus.js +20 -17
  81. package/dist-es/protocols/GetAlimtalkTemplate.js +20 -16
  82. package/dist-es/protocols/GetSMSResult.js +22 -18
  83. package/dist-es/protocols/GetSMSStatus.js +20 -16
  84. package/dist-es/protocols/ListAlimtalkChannels.js +20 -16
  85. package/dist-es/protocols/ListAlimtalkTemplates.js +29 -24
  86. package/dist-es/protocols/SendAlimtalk.js +20 -17
  87. package/dist-es/protocols/SendMMS.js +18 -14
  88. package/dist-es/protocols/SendSMS.js +19 -15
  89. package/dist-es/protocols/constants.js +17 -9
  90. package/dist-es/protocols/index.js +10 -10
  91. package/dist-types/SensClient.d.ts +2 -2
  92. package/dist-types/commands/GetAlimtalkResultCommand.d.ts +8 -5
  93. package/dist-types/commands/GetAlimtalkStatusCommand.d.ts +8 -5
  94. package/dist-types/commands/GetAlimtalkTemplateCommand.d.ts +8 -5
  95. package/dist-types/commands/GetSMSResultCommand.d.ts +8 -5
  96. package/dist-types/commands/GetSMSStatusCommand.d.ts +8 -5
  97. package/dist-types/commands/ListAlimtalkChannelsCommand.d.ts +8 -5
  98. package/dist-types/commands/ListAlimtalkTemplatesCommand.d.ts +8 -5
  99. package/dist-types/commands/SendAlimtalkCommand.d.ts +8 -5
  100. package/dist-types/commands/SendMMSCommand.d.ts +8 -5
  101. package/dist-types/commands/SendSMSCommand.d.ts +8 -5
  102. package/dist-types/commands/index.d.ts +10 -10
  103. package/dist-types/index.d.ts +2 -2
  104. package/dist-types/middleware/index.d.ts +4 -2
  105. package/dist-types/middleware/middleware-metadata.d.ts +2 -0
  106. package/dist-types/middleware/middleware-retry.d.ts +2 -0
  107. package/dist-types/middleware/middleware-sign.d.ts +2 -0
  108. package/dist-types/middleware/middleware-sort-headers.d.ts +2 -0
  109. package/dist-types/models/GetAlimtalkResult.d.ts +1 -1
  110. package/dist-types/models/GetAlimtalkStatus.d.ts +1 -1
  111. package/dist-types/models/GetAlimtalkTemplate.d.ts +1 -1
  112. package/dist-types/models/MetadataBearer.d.ts +8 -0
  113. package/dist-types/models/Middleware.d.ts +12 -0
  114. package/dist-types/models/SendMMS.d.ts +1 -1
  115. package/dist-types/models/SendSMS.d.ts +3 -3
  116. package/dist-types/models/SensCommand.d.ts +6 -2
  117. package/dist-types/models/index.d.ts +13 -11
  118. package/dist-types/protocols/GetAlimtalkResult.d.ts +8 -5
  119. package/dist-types/protocols/GetAlimtalkStatus.d.ts +8 -5
  120. package/dist-types/protocols/GetAlimtalkTemplate.d.ts +8 -5
  121. package/dist-types/protocols/GetSMSResult.d.ts +8 -5
  122. package/dist-types/protocols/GetSMSStatus.d.ts +8 -5
  123. package/dist-types/protocols/ListAlimtalkChannels.d.ts +8 -5
  124. package/dist-types/protocols/ListAlimtalkTemplates.d.ts +8 -5
  125. package/dist-types/protocols/SendAlimtalk.d.ts +8 -5
  126. package/dist-types/protocols/SendMMS.d.ts +8 -5
  127. package/dist-types/protocols/SendSMS.d.ts +8 -5
  128. package/dist-types/protocols/constants.d.ts +3 -1
  129. package/dist-types/protocols/index.d.ts +10 -10
  130. package/package.json +4 -3
  131. package/dist-es/middleware/metadata-ingestkorea.js +0 -19
  132. package/dist-types/middleware/metadata-ingestkorea.d.ts +0 -3
  133. package/dist-types/middleware/signer-ncp.d.ts +0 -3
@@ -1,14 +1,19 @@
1
1
  ### Issue
2
+
2
3
  Issue number, if available, prefixed with "#"
3
4
 
4
5
  ### Description
6
+
5
7
  What does this implement/fix? Explain your changes.
6
8
 
7
9
  ### Testing
10
+
8
11
  How was this change tested?
9
12
 
10
13
  ### Additional context
14
+
11
15
  Add any other context about the PR here.
12
16
 
13
17
  ---
14
- By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
18
+
19
+ By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2022 INGESTKOREA LLC.
3
+ Copyright (c) 2024 INGESTKOREA LLC.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
21
+ SOFTWARE.
package/README.md CHANGED
@@ -3,11 +3,14 @@
3
3
  [![npm (scoped)](https://img.shields.io/npm/v/@ingestkorea/client-sens?style=flat-square)](https://www.npmjs.com/package/@ingestkorea/client-sens)
4
4
  [![npm downloads](https://img.shields.io/npm/dm/@ingestkorea/client-sens?style=flat-square)](https://www.npmjs.com/package/@ingestkorea/client-sens)
5
5
  ![build status](https://codebuild.ap-northeast-2.amazonaws.com/badges?uuid=eyJlbmNyeXB0ZWREYXRhIjoiOTYrKzNDRklOaWJxS2ZoTkZvY05TU2VGVFdxWFlSWE9DZXJTYVBlbCtwc0J5YTcvdUFKRjlSc1RDTHNDV1J4YnhxMmRLaFdIakpSVWN3QzBHQXp0KzdRPSIsIml2UGFyYW1ldGVyU3BlYyI6IjQ1dUtTMlE1UWhmWmFTRGsiLCJtYXRlcmlhbFNldFNlcmlhbCI6MX0%3D&branch=main)
6
+ [![license](https://img.shields.io/github/license/ingestkorea/client-sens?style=flat-square)](https://www.npmjs.com/package/@ingestkorea/client-sens)
6
7
 
7
8
  ## Description
9
+
8
10
  INGESTKOREA SDK Naver Cloud Platform SENS Client for Node.js.
9
11
 
10
12
  ## Installing
13
+
11
14
  ```sh
12
15
  npm install @ingestkorea/client-sens
13
16
  ```
@@ -15,79 +18,89 @@ npm install @ingestkorea/client-sens
15
18
  ## Getting Started
16
19
 
17
20
  ### Pre-requisites
18
- + Use TypeScript v4.x
19
- + Includes the TypeScript definitions for node.
21
+
22
+ - Use TypeScript v5.x
23
+ - Includes the TypeScript definitions for node.
20
24
  ```sh
25
+ npm install -D typescript # save dev mode
21
26
  npm install -D @types/node # save dev mode
22
27
  ```
23
28
 
24
29
  ### Support Commands
25
30
 
26
31
  #### Kakao Alimtalk
27
- + SendAlimtalk
28
- + GetAlimtalkStatus (`GetRequestStatus` is deprecated)
29
- + GetAlimtalkResult (`GetRequestResult` is deprecated)
30
- + GetAlimtalkTemplate (`GetTemplate` is deprecated)
31
- + ListAlimtalkTemplates (`ListTemplates` is deprecated)
32
- + ListAlimtalkChannels (`ListChannels` is deprecated)
32
+
33
+ - SendAlimtalk
34
+ - GetAlimtalkStatus
35
+ - GetAlimtalkResult
36
+ - GetAlimtalkTemplate
37
+ - ListAlimtalkTemplates
38
+ - ListAlimtalkChannels
33
39
 
34
40
  #### SMS, LMS, MMS
35
- + SendSMS (SMS, LMS)
36
- + SendMMS (MMS)
37
- + GetSMSStatus (SMS, LMS, MMS)
38
- + GetSMSResult (SMS, LMS, MMS)
41
+
42
+ - SendSMS (SMS, LMS)
43
+ - SendMMS (MMS)
44
+ - GetSMSStatus (SMS, LMS, MMS)
45
+ - GetSMSResult (SMS, LMS, MMS)
39
46
 
40
47
  ### Import
48
+
41
49
  ```ts
42
50
  import {
43
51
  SensClient,
44
- SendAlimtalkCommand, SendAlimtalkCommandInput,
45
- SendSMSCommand, SendSMSCommandInput,
46
- SendMMSCommand, SendMMSCommandInput,
47
- } from '@ingestkorea/client-sens';
52
+ SendAlimtalkCommand,
53
+ SendAlimtalkCommandInput,
54
+ SendSMSCommand,
55
+ SendSMSCommandInput,
56
+ SendMMSCommand,
57
+ SendMMSCommandInput,
58
+ } from "@ingestkorea/client-sens";
48
59
  ```
49
60
 
50
61
  ### Usage
62
+
51
63
  To send a request, you:
52
- + Initiate client with configuration.
53
- + Initiate command with input parameters.
54
- + Call `send` operation on client with command object as input.
64
+
65
+ - Initiate client with configuration.
66
+ - Initiate command with input parameters.
67
+ - Call `send` operation on client with command object as input.
55
68
 
56
69
  ```ts
57
70
  // a client can be shared by different commands.
58
71
  const client = new SensClient({
59
72
  credentials: {
60
73
  accessKey: ACCESS_KEY,
61
- secretKey: SECRET_KEY
74
+ secretKey: SECRET_KEY,
62
75
  },
63
76
  serviceId: {
64
- sms: 'ncp:sms:kr:123456789xxx:your-service-name', // optional
65
- kakao: 'ncp:kkobizmsg:kr:9876xxx:your-service-name' // optional
66
- }
77
+ sms: "ncp:sms:kr:123456789xxx:your-service-name", // optional
78
+ kakao: "ncp:kkobizmsg:kr:9876xxx:your-service-name", // optional
79
+ },
67
80
  });
68
81
 
69
82
  /**
70
83
  * accessKey, secretKey: https://www.ncloud.com/mypage/manage/authkey
71
84
  * serviceId: https://console.ncloud.com/sens/project
72
- *
85
+ *
73
86
  * at least one serviceId required
74
87
  * if you call send operation without serviceId, sdk throw error
75
88
  */
76
89
  ```
77
90
 
78
91
  #### SendAlimtalk
92
+
79
93
  ```ts
80
94
  let params: SendAlimtalkCommandInput = {
81
95
  plusFriendId: PLUS_FRIEND_ID,
82
96
  templateCode: TEMPLATE_CODE,
83
- messages: [
84
- { to: '01012345678', content: CONTENT }
85
- ]
97
+ messages: [{ to: "01012345678", content: CONTENT }],
86
98
  };
87
99
  let command = new SendAlimtalkCommand(params);
88
100
  ```
89
101
 
90
102
  #### SendSMS (SMS, LMS)
103
+
91
104
  ```ts
92
105
  /**
93
106
  * Automatically set message type('SMS' | 'LMS') according to content-length(euc-kr)
@@ -103,14 +116,15 @@ let params: SendSMSCommandInput = {
103
116
  { to: '0108765xxxx', content?: OPTIONAL_CONTENT_02, subject?: OPTIONAL_SUBJECT_01 },
104
117
  ]
105
118
  };
106
- /**
107
- * If you do not define the subject and content within the messages,
119
+ /**
120
+ * If you do not define the subject and content within the messages,
108
121
  * it is sent with the value specified as the default subject('제목없음') and content.
109
122
  */
110
123
  let command = new SendSMSCommand(params);
111
124
  ```
112
125
 
113
126
  #### SendMMS (MMS)
127
+
114
128
  ```ts
115
129
  import { readFileSync } from 'node:fs';
116
130
 
@@ -125,36 +139,40 @@ let params: SendMMSCommandInput = {
125
139
  files: [ // support jpg, jpeg
126
140
  { name: '/your/absolute/path/sample-image-1.jpg' },
127
141
  {
128
- name: '/your/absolute/path/sample-image-2.jpg',
142
+ name: '/your/absolute/path/sample-image-2.jpg',
129
143
  body?: readFileSync('/your/absolute/path/sample-image-2.jpg', { encoding: 'base64' })
130
144
  }
131
145
  ]
132
146
  };
133
- /**
134
- * If you do not define the subject and content within the messages,
147
+ /**
148
+ * If you do not define the subject and content within the messages,
135
149
  * it is sent with the value specified as the default subject('제목없음') and content.
136
150
  */
137
151
  let command = new SendMMSCommand(params);
138
152
  ```
139
153
 
140
154
  #### Async/await
155
+
141
156
  ```ts
142
157
  (async () => {
143
158
  try {
144
159
  const data = await client.send(command);
145
160
  console.dir(data, { depth: 4 });
146
- } catch (err){
161
+ } catch (err) {
147
162
  console.dir(err, { depth: 4 });
148
- };
163
+ }
149
164
  })();
150
165
  ```
151
166
 
152
167
  #### Promises
168
+
153
169
  ```ts
154
- client.send(command)
155
- .then(data => console.dir(data, { depth: 4 }))
156
- .catch(err => console.dir(err, { depth: 4 }));
170
+ client
171
+ .send(command)
172
+ .then((data) => console.dir(data, { depth: 4 }))
173
+ .catch((err) => console.dir(err, { depth: 4 }));
157
174
  ```
158
175
 
159
176
  ## License
160
- This SDK is distributed under the [MIT License](https://opensource.org/licenses/MIT), see LICENSE for more information.
177
+
178
+ This SDK is distributed under the [MIT License](https://opensource.org/licenses/MIT), see LICENSE for more information.
@@ -13,40 +13,38 @@ exports.SensClient = void 0;
13
13
  const util_http_handler_1 = require("@ingestkorea/util-http-handler");
14
14
  const util_error_handler_1 = require("@ingestkorea/util-error-handler");
15
15
  const middleware_1 = require("./middleware");
16
- ;
17
- ;
18
16
  class SensClient {
19
17
  constructor(config) {
20
18
  const resolvedCredentials = resolveCredentials(config);
21
19
  const resolvedServiceId = resolveServiceId(config);
22
20
  this.config = {
23
21
  credentials: Object.assign({}, resolvedCredentials),
24
- serviceId: Object.assign({}, resolvedServiceId)
22
+ serviceId: Object.assign({}, resolvedServiceId),
25
23
  };
26
24
  this.requestHandler = new util_http_handler_1.NodeHttpHandler({ connectionTimeout: 3000, socketTimeout: 3000 });
27
25
  }
28
- ;
29
26
  send(command) {
30
27
  return __awaiter(this, void 0, void 0, function* () {
31
28
  let input = command.input;
32
29
  let request = yield command.serialize(input, this.config);
33
30
  request = yield (0, middleware_1.middlewareNcpSigner)(request, this.config);
34
31
  request = yield (0, middleware_1.middlewareIngestkoreaMetadata)(request, this.config);
35
- let { response } = yield this.requestHandler.handle(request);
32
+ request = yield (0, middleware_1.middlewareSortHeaders)(request, this.config);
33
+ let response = yield (0, middleware_1.middlewareRetry)(request, this.config, this.requestHandler);
36
34
  let output = yield command.deserialize(response);
37
35
  return output;
38
36
  });
39
37
  }
40
- ;
41
38
  }
42
39
  exports.SensClient = SensClient;
43
- ;
44
40
  const resolveCredentials = (config) => {
45
41
  const { credentials } = config;
46
42
  if (!credentials)
47
43
  throw new util_error_handler_1.IngestkoreaError({
48
- code: 401, type: 'Unauthorized',
49
- message: 'Invalid Credentials', description: 'Invalid Credentials'
44
+ code: 401,
45
+ type: "Unauthorized",
46
+ message: "Invalid Credentials",
47
+ description: "Invalid Credentials",
50
48
  });
51
49
  return credentials;
52
50
  };
@@ -54,12 +52,14 @@ const resolveServiceId = (config) => {
54
52
  const { serviceId } = config;
55
53
  if (!serviceId)
56
54
  throw new util_error_handler_1.IngestkoreaError({
57
- code: 401, type: 'Unauthorized',
58
- message: 'Invalid Credentials', description: 'Invalid ServiceId'
55
+ code: 401,
56
+ type: "Unauthorized",
57
+ message: "Invalid Credentials",
58
+ description: "Invalid ServiceId",
59
59
  });
60
60
  return {
61
61
  push: serviceId.push != undefined ? serviceId.push : undefined,
62
62
  sms: serviceId.sms != undefined ? serviceId.sms : undefined,
63
- kakao: serviceId.kakao != undefined ? serviceId.kakao : undefined
63
+ kakao: serviceId.kakao != undefined ? serviceId.kakao : undefined,
64
64
  };
65
65
  };
@@ -13,32 +13,29 @@ exports.GetAlimtalkResultCommand = void 0;
13
13
  const models_1 = require("../models");
14
14
  const GetAlimtalkResult_1 = require("../protocols/GetAlimtalkResult");
15
15
  const util_error_handler_1 = require("@ingestkorea/util-error-handler");
16
- ;
17
- ;
18
16
  class GetAlimtalkResultCommand extends models_1.SensCommand {
19
17
  constructor(input) {
20
18
  super(input);
21
19
  this.input = Object.assign({}, input);
22
20
  }
23
- ;
24
21
  serialize(input, config) {
25
22
  return __awaiter(this, void 0, void 0, function* () {
26
23
  if (!config.serviceId.kakao)
27
24
  throw new util_error_handler_1.IngestkoreaError({
28
- code: 400, type: 'Bad Request', message: 'Invalid Params', description: 'Please Check Kakao ServiceId'
25
+ code: 400,
26
+ type: "Bad Request",
27
+ message: "Invalid Params",
28
+ description: "Please Check Kakao ServiceId",
29
29
  });
30
30
  let request = yield (0, GetAlimtalkResult_1.serializeIngestkorea_restJson_GetAlimtalkResultCommand)(input, config);
31
31
  return request;
32
32
  });
33
33
  }
34
- ;
35
34
  deserialize(response) {
36
35
  return __awaiter(this, void 0, void 0, function* () {
37
36
  let output = yield (0, GetAlimtalkResult_1.deserializeIngestkorea_restJson_GetAlimtalkResultCommand)(response);
38
37
  return output;
39
38
  });
40
39
  }
41
- ;
42
40
  }
43
41
  exports.GetAlimtalkResultCommand = GetAlimtalkResultCommand;
44
- ;
@@ -13,32 +13,29 @@ exports.GetAlimtalkStatusCommand = void 0;
13
13
  const models_1 = require("../models");
14
14
  const GetAlimtalkStatus_1 = require("../protocols/GetAlimtalkStatus");
15
15
  const util_error_handler_1 = require("@ingestkorea/util-error-handler");
16
- ;
17
- ;
18
16
  class GetAlimtalkStatusCommand extends models_1.SensCommand {
19
17
  constructor(input) {
20
18
  super(input);
21
19
  this.input = Object.assign({}, input);
22
20
  }
23
- ;
24
21
  serialize(input, config) {
25
22
  return __awaiter(this, void 0, void 0, function* () {
26
23
  if (!config.serviceId.kakao)
27
24
  throw new util_error_handler_1.IngestkoreaError({
28
- code: 400, type: 'Bad Request', message: 'Invalid Params', description: 'Please Check Kakao ServiceId'
25
+ code: 400,
26
+ type: "Bad Request",
27
+ message: "Invalid Params",
28
+ description: "Please Check Kakao ServiceId",
29
29
  });
30
30
  let request = yield (0, GetAlimtalkStatus_1.serializeIngestkorea_restJson_GetAlimtalkStatusCommand)(input, config);
31
31
  return request;
32
32
  });
33
33
  }
34
- ;
35
34
  deserialize(response) {
36
35
  return __awaiter(this, void 0, void 0, function* () {
37
36
  let output = yield (0, GetAlimtalkStatus_1.deserializeIngestkorea_restJson_GetAlimtalkStatusCommand)(response);
38
37
  return output;
39
38
  });
40
39
  }
41
- ;
42
40
  }
43
41
  exports.GetAlimtalkStatusCommand = GetAlimtalkStatusCommand;
44
- ;
@@ -13,32 +13,29 @@ exports.GetAlimtalkTemplateCommand = void 0;
13
13
  const models_1 = require("../models");
14
14
  const GetAlimtalkTemplate_1 = require("../protocols/GetAlimtalkTemplate");
15
15
  const util_error_handler_1 = require("@ingestkorea/util-error-handler");
16
- ;
17
- ;
18
16
  class GetAlimtalkTemplateCommand extends models_1.SensCommand {
19
17
  constructor(input) {
20
18
  super(input);
21
19
  this.input = Object.assign({}, input);
22
20
  }
23
- ;
24
21
  serialize(input, config) {
25
22
  return __awaiter(this, void 0, void 0, function* () {
26
23
  if (!config.serviceId.kakao)
27
24
  throw new util_error_handler_1.IngestkoreaError({
28
- code: 400, type: 'Bad Request', message: 'Invalid Params', description: 'Please Check Kakao ServiceId'
25
+ code: 400,
26
+ type: "Bad Request",
27
+ message: "Invalid Params",
28
+ description: "Please Check Kakao ServiceId",
29
29
  });
30
30
  let request = yield (0, GetAlimtalkTemplate_1.serializeIngestkorea_restJson_GetAlimtalkTemplateCommand)(input, config);
31
31
  return request;
32
32
  });
33
33
  }
34
- ;
35
34
  deserialize(response) {
36
35
  return __awaiter(this, void 0, void 0, function* () {
37
36
  let output = yield (0, GetAlimtalkTemplate_1.deserializeIngestkorea_restJson_GetAlimtalkTemplateCommand)(response);
38
37
  return output;
39
38
  });
40
39
  }
41
- ;
42
40
  }
43
41
  exports.GetAlimtalkTemplateCommand = GetAlimtalkTemplateCommand;
44
- ;
@@ -13,31 +13,29 @@ exports.GetSMSResultCommand = void 0;
13
13
  const models_1 = require("../models");
14
14
  const GetSMSResult_1 = require("../protocols/GetSMSResult");
15
15
  const util_error_handler_1 = require("@ingestkorea/util-error-handler");
16
- ;
17
- ;
18
16
  class GetSMSResultCommand extends models_1.SensCommand {
19
17
  constructor(input) {
20
18
  super(input);
21
19
  this.input = Object.assign({}, input);
22
20
  }
23
- ;
24
21
  serialize(input, config) {
25
22
  return __awaiter(this, void 0, void 0, function* () {
26
23
  if (!config.serviceId.sms)
27
24
  throw new util_error_handler_1.IngestkoreaError({
28
- code: 400, type: 'Bad Request', message: 'Invalid Params', description: 'Please Check SMS ServiceId'
25
+ code: 400,
26
+ type: "Bad Request",
27
+ message: "Invalid Params",
28
+ description: "Please Check SMS ServiceId",
29
29
  });
30
30
  let request = yield (0, GetSMSResult_1.serializeIngestkorea_restJson_GetSMSResultCommand)(input, config);
31
31
  return request;
32
32
  });
33
33
  }
34
- ;
35
34
  deserialize(response) {
36
35
  return __awaiter(this, void 0, void 0, function* () {
37
36
  let output = yield (0, GetSMSResult_1.deserializeIngestkorea_restJson_GetSMSResultCommand)(response);
38
37
  return output;
39
38
  });
40
39
  }
41
- ;
42
40
  }
43
41
  exports.GetSMSResultCommand = GetSMSResultCommand;
@@ -13,31 +13,29 @@ exports.GetSMSStatusCommand = void 0;
13
13
  const models_1 = require("../models");
14
14
  const GetSMSStatus_1 = require("../protocols/GetSMSStatus");
15
15
  const util_error_handler_1 = require("@ingestkorea/util-error-handler");
16
- ;
17
- ;
18
16
  class GetSMSStatusCommand extends models_1.SensCommand {
19
17
  constructor(input) {
20
18
  super(input);
21
19
  this.input = Object.assign({}, input);
22
20
  }
23
- ;
24
21
  serialize(input, config) {
25
22
  return __awaiter(this, void 0, void 0, function* () {
26
23
  if (!config.serviceId.sms)
27
24
  throw new util_error_handler_1.IngestkoreaError({
28
- code: 400, type: 'Bad Request', message: 'Invalid Params', description: 'Please Check SMS ServiceId'
25
+ code: 400,
26
+ type: "Bad Request",
27
+ message: "Invalid Params",
28
+ description: "Please Check SMS ServiceId",
29
29
  });
30
30
  let request = yield (0, GetSMSStatus_1.serializeIngestkorea_restJson_GetSMSStatusCommand)(input, config);
31
31
  return request;
32
32
  });
33
33
  }
34
- ;
35
34
  deserialize(response) {
36
35
  return __awaiter(this, void 0, void 0, function* () {
37
36
  let output = yield (0, GetSMSStatus_1.deserializeIngestkorea_restJson_GetSMSStatusCommand)(response);
38
37
  return output;
39
38
  });
40
39
  }
41
- ;
42
40
  }
43
41
  exports.GetSMSStatusCommand = GetSMSStatusCommand;
@@ -13,32 +13,29 @@ exports.ListAlimtalkChannelsCommand = void 0;
13
13
  const models_1 = require("../models");
14
14
  const ListAlimtalkChannels_1 = require("../protocols/ListAlimtalkChannels");
15
15
  const util_error_handler_1 = require("@ingestkorea/util-error-handler");
16
- ;
17
- ;
18
16
  class ListAlimtalkChannelsCommand extends models_1.SensCommand {
19
17
  constructor(input) {
20
18
  super(input);
21
19
  this.input = Object.assign({}, input);
22
20
  }
23
- ;
24
21
  serialize(input, config) {
25
22
  return __awaiter(this, void 0, void 0, function* () {
26
23
  if (!config.serviceId.kakao)
27
24
  throw new util_error_handler_1.IngestkoreaError({
28
- code: 400, type: 'Bad Request', message: 'Invalid Params', description: 'Please Check Kakao ServiceId'
25
+ code: 400,
26
+ type: "Bad Request",
27
+ message: "Invalid Params",
28
+ description: "Please Check Kakao ServiceId",
29
29
  });
30
30
  let request = yield (0, ListAlimtalkChannels_1.serializeIngestkorea_restJson_ListAlimtalkChannelsCommand)(input, config);
31
31
  return request;
32
32
  });
33
33
  }
34
- ;
35
34
  deserialize(response) {
36
35
  return __awaiter(this, void 0, void 0, function* () {
37
36
  let output = yield (0, ListAlimtalkChannels_1.deserializeIngestkorea_restJson_ListAlimtalkChannelsCommand)(response);
38
37
  return output;
39
38
  });
40
39
  }
41
- ;
42
40
  }
43
41
  exports.ListAlimtalkChannelsCommand = ListAlimtalkChannelsCommand;
44
- ;
@@ -13,32 +13,29 @@ exports.ListAlimtalkTemplatesCommand = void 0;
13
13
  const models_1 = require("../models");
14
14
  const ListAlimtalkTemplates_1 = require("../protocols/ListAlimtalkTemplates");
15
15
  const util_error_handler_1 = require("@ingestkorea/util-error-handler");
16
- ;
17
- ;
18
16
  class ListAlimtalkTemplatesCommand extends models_1.SensCommand {
19
17
  constructor(input) {
20
18
  super(input);
21
19
  this.input = Object.assign({}, input);
22
20
  }
23
- ;
24
21
  serialize(input, config) {
25
22
  return __awaiter(this, void 0, void 0, function* () {
26
23
  if (!config.serviceId.kakao)
27
24
  throw new util_error_handler_1.IngestkoreaError({
28
- code: 400, type: 'Bad Request', message: 'Invalid Params', description: 'Please Check Kakao ServiceId'
25
+ code: 400,
26
+ type: "Bad Request",
27
+ message: "Invalid Params",
28
+ description: "Please Check Kakao ServiceId",
29
29
  });
30
30
  let request = yield (0, ListAlimtalkTemplates_1.serializeIngestkorea_restJson_ListAlimtalkTemplatesCommand)(input, config);
31
31
  return request;
32
32
  });
33
33
  }
34
- ;
35
34
  deserialize(response) {
36
35
  return __awaiter(this, void 0, void 0, function* () {
37
36
  let output = yield (0, ListAlimtalkTemplates_1.deserializeIngestkorea_restJson_ListAlimtalkTemplatesCommand)(response);
38
37
  return output;
39
38
  });
40
39
  }
41
- ;
42
40
  }
43
41
  exports.ListAlimtalkTemplatesCommand = ListAlimtalkTemplatesCommand;
44
- ;
@@ -13,41 +13,40 @@ exports.SendAlimtalkCommand = void 0;
13
13
  const models_1 = require("../models");
14
14
  const SendAlimtalk_1 = require("../protocols/SendAlimtalk");
15
15
  const util_error_handler_1 = require("@ingestkorea/util-error-handler");
16
- ;
17
- ;
18
16
  class SendAlimtalkCommand extends models_1.SensCommand {
19
17
  constructor(input) {
20
18
  super(input);
21
19
  this.input = Object.assign(Object.assign({}, input), { plusFriendId: input.plusFriendId, templateCode: input.templateCode, messages: input.messages.map(resolveAlimtalkMessage) });
22
20
  }
23
- ;
24
21
  serialize(input, config) {
25
22
  return __awaiter(this, void 0, void 0, function* () {
26
23
  if (!config.serviceId.kakao)
27
24
  throw new util_error_handler_1.IngestkoreaError({
28
- code: 400, type: 'Bad Request', message: 'Invalid Params', description: 'Please Check Kakao ServiceId'
25
+ code: 400,
26
+ type: "Bad Request",
27
+ message: "Invalid Params",
28
+ description: "Please Check Kakao ServiceId",
29
29
  });
30
30
  let request = yield (0, SendAlimtalk_1.serializeIngestkorea_restJson_SendAlimtalkCommand)(input, config);
31
31
  return request;
32
32
  });
33
33
  }
34
- ;
35
34
  deserialize(response) {
36
35
  return __awaiter(this, void 0, void 0, function* () {
37
36
  let output = yield (0, SendAlimtalk_1.deserializeIngestkorea_restJson_SendAlimtalkCommand)(response);
38
37
  return output;
39
38
  });
40
39
  }
41
- ;
42
40
  }
43
41
  exports.SendAlimtalkCommand = SendAlimtalkCommand;
44
- ;
45
42
  const resolveAlimtalkMessage = (message) => {
46
43
  const ALIMTALK_MAX = 1000;
47
44
  if (message.content.length > ALIMTALK_MAX)
48
45
  throw new util_error_handler_1.IngestkoreaError({
49
- code: 400, type: 'Bad Request',
50
- message: 'Invalid Params', description: `Maximum message length is ${ALIMTALK_MAX}`
46
+ code: 400,
47
+ type: "Bad Request",
48
+ message: "Invalid Params",
49
+ description: `Maximum message length is ${ALIMTALK_MAX}`,
51
50
  });
52
51
  return Object.assign({ to: message.to.replace(/\-/gi, ""), content: message.content }, (message.buttons != undefined && { buttons: message.buttons }));
53
52
  };