@ingestkorea/client-sens 1.4.3 → 1.5.3

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 (116) hide show
  1. package/.github/pull_request_template.md +6 -1
  2. package/.prettierignore +3 -0
  3. package/LICENSE +2 -2
  4. package/README.md +89 -39
  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 +10 -11
  13. package/dist-cjs/commands/SendMMSCommand.js +125 -0
  14. package/dist-cjs/commands/SendSMSCommand.js +43 -41
  15. package/dist-cjs/commands/constants.js +20 -0
  16. package/dist-cjs/commands/index.js +1 -0
  17. package/dist-cjs/middleware/metadata-ingestkorea.js +2 -2
  18. package/dist-cjs/middleware/signer-ncp.js +3 -7
  19. package/dist-cjs/models/GetAlimtalkResult.js +0 -3
  20. package/dist-cjs/models/GetAlimtalkStatus.js +0 -3
  21. package/dist-cjs/models/GetAlimtalkTemplate.js +0 -2
  22. package/dist-cjs/models/GetSMSResult.js +0 -4
  23. package/dist-cjs/models/GetSMSStatus.js +0 -3
  24. package/dist-cjs/models/ListAlimtalkChannels.js +0 -3
  25. package/dist-cjs/models/ListAlimtalkTemplates.js +0 -5
  26. package/dist-cjs/models/SendAlimtalk.js +0 -5
  27. package/dist-cjs/models/SendMMS.js +2 -0
  28. package/dist-cjs/models/SendSMS.js +0 -2
  29. package/dist-cjs/models/SensCommand.js +0 -2
  30. package/dist-cjs/models/index.js +1 -0
  31. package/dist-cjs/protocols/GetAlimtalkResult.js +7 -6
  32. package/dist-cjs/protocols/GetAlimtalkStatus.js +8 -7
  33. package/dist-cjs/protocols/GetAlimtalkTemplate.js +6 -6
  34. package/dist-cjs/protocols/GetSMSResult.js +12 -10
  35. package/dist-cjs/protocols/GetSMSStatus.js +10 -8
  36. package/dist-cjs/protocols/ListAlimtalkChannels.js +7 -7
  37. package/dist-cjs/protocols/ListAlimtalkTemplates.js +16 -15
  38. package/dist-cjs/protocols/SendAlimtalk.js +9 -8
  39. package/dist-cjs/protocols/SendMMS.js +51 -0
  40. package/dist-cjs/protocols/SendSMS.js +6 -6
  41. package/dist-cjs/protocols/constants.js +10 -7
  42. package/dist-cjs/protocols/index.js +1 -0
  43. package/dist-es/commands/GetAlimtalkResultCommand.js +8 -11
  44. package/dist-es/commands/GetAlimtalkStatusCommand.js +8 -11
  45. package/dist-es/commands/GetAlimtalkTemplateCommand.js +8 -11
  46. package/dist-es/commands/GetSMSResultCommand.js +8 -10
  47. package/dist-es/commands/GetSMSStatusCommand.js +8 -10
  48. package/dist-es/commands/ListAlimtalkChannelsCommand.js +8 -11
  49. package/dist-es/commands/ListAlimtalkTemplatesCommand.js +8 -11
  50. package/dist-es/commands/SendAlimtalkCommand.js +15 -16
  51. package/dist-es/commands/SendMMSCommand.js +119 -0
  52. package/dist-es/commands/SendSMSCommand.js +51 -49
  53. package/dist-es/commands/constants.js +14 -0
  54. package/dist-es/commands/index.js +10 -9
  55. package/dist-es/middleware/index.js +2 -2
  56. package/dist-es/middleware/metadata-ingestkorea.js +3 -3
  57. package/dist-es/middleware/signer-ncp.js +7 -11
  58. package/dist-es/models/GetAlimtalkResult.js +0 -3
  59. package/dist-es/models/GetAlimtalkStatus.js +0 -3
  60. package/dist-es/models/GetAlimtalkTemplate.js +0 -2
  61. package/dist-es/models/GetSMSResult.js +0 -4
  62. package/dist-es/models/GetSMSStatus.js +0 -3
  63. package/dist-es/models/ListAlimtalkChannels.js +0 -3
  64. package/dist-es/models/ListAlimtalkTemplates.js +0 -5
  65. package/dist-es/models/SendAlimtalk.js +0 -5
  66. package/dist-es/models/SendMMS.js +1 -0
  67. package/dist-es/models/SendSMS.js +0 -2
  68. package/dist-es/models/SensCommand.js +0 -2
  69. package/dist-es/models/index.js +11 -10
  70. package/dist-es/protocols/GetAlimtalkResult.js +10 -9
  71. package/dist-es/protocols/GetAlimtalkStatus.js +11 -10
  72. package/dist-es/protocols/GetAlimtalkTemplate.js +10 -10
  73. package/dist-es/protocols/GetSMSResult.js +14 -12
  74. package/dist-es/protocols/GetSMSStatus.js +12 -10
  75. package/dist-es/protocols/ListAlimtalkChannels.js +10 -10
  76. package/dist-es/protocols/ListAlimtalkTemplates.js +19 -18
  77. package/dist-es/protocols/SendAlimtalk.js +12 -11
  78. package/dist-es/protocols/SendMMS.js +47 -0
  79. package/dist-es/protocols/SendSMS.js +9 -9
  80. package/dist-es/protocols/constants.js +12 -9
  81. package/dist-es/protocols/index.js +10 -9
  82. package/dist-types/commands/GetAlimtalkResultCommand.d.ts +3 -3
  83. package/dist-types/commands/GetAlimtalkStatusCommand.d.ts +3 -3
  84. package/dist-types/commands/GetAlimtalkTemplateCommand.d.ts +3 -3
  85. package/dist-types/commands/GetSMSResultCommand.d.ts +3 -3
  86. package/dist-types/commands/GetSMSStatusCommand.d.ts +3 -3
  87. package/dist-types/commands/ListAlimtalkChannelsCommand.d.ts +3 -3
  88. package/dist-types/commands/ListAlimtalkTemplatesCommand.d.ts +3 -3
  89. package/dist-types/commands/SendAlimtalkCommand.d.ts +3 -3
  90. package/dist-types/commands/SendMMSCommand.d.ts +13 -0
  91. package/dist-types/commands/SendSMSCommand.d.ts +3 -3
  92. package/dist-types/commands/constants.d.ts +7 -0
  93. package/dist-types/commands/index.d.ts +10 -9
  94. package/dist-types/middleware/index.d.ts +2 -2
  95. package/dist-types/middleware/metadata-ingestkorea.d.ts +2 -2
  96. package/dist-types/middleware/signer-ncp.d.ts +2 -2
  97. package/dist-types/models/GetAlimtalkResult.d.ts +1 -1
  98. package/dist-types/models/GetAlimtalkStatus.d.ts +1 -1
  99. package/dist-types/models/GetAlimtalkTemplate.d.ts +1 -1
  100. package/dist-types/models/SendMMS.d.ts +10 -0
  101. package/dist-types/models/SendSMS.d.ts +3 -3
  102. package/dist-types/models/SensCommand.d.ts +1 -1
  103. package/dist-types/models/index.d.ts +11 -10
  104. package/dist-types/protocols/GetAlimtalkResult.d.ts +4 -4
  105. package/dist-types/protocols/GetAlimtalkStatus.d.ts +4 -4
  106. package/dist-types/protocols/GetAlimtalkTemplate.d.ts +4 -4
  107. package/dist-types/protocols/GetSMSResult.d.ts +4 -4
  108. package/dist-types/protocols/GetSMSStatus.d.ts +4 -4
  109. package/dist-types/protocols/ListAlimtalkChannels.d.ts +4 -4
  110. package/dist-types/protocols/ListAlimtalkTemplates.d.ts +4 -4
  111. package/dist-types/protocols/SendAlimtalk.d.ts +4 -4
  112. package/dist-types/protocols/SendMMS.d.ts +7 -0
  113. package/dist-types/protocols/SendSMS.d.ts +4 -4
  114. package/dist-types/protocols/constants.d.ts +1 -1
  115. package/dist-types/protocols/index.d.ts +10 -9
  116. package/package.json +5 -5
@@ -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.
@@ -0,0 +1,3 @@
1
+ node_modules/
2
+ dist-*/
3
+ package-lock.json
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
@@ -1,13 +1,16 @@
1
1
  # @ingestkorea/client-sens
2
2
 
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
- [![NPM downloads](https://img.shields.io/npm/dm/@ingestkorea/client-sens?style=flat-square)](https://www.npmjs.com/package/@ingestkorea/client-sens)
5
- ![Build Status](https://codebuild.ap-northeast-2.amazonaws.com/badges?uuid=eyJlbmNyeXB0ZWREYXRhIjoiOTYrKzNDRklOaWJxS2ZoTkZvY05TU2VGVFdxWFlSWE9DZXJTYVBlbCtwc0J5YTcvdUFKRjlSc1RDTHNDV1J4YnhxMmRLaFdIakpSVWN3QzBHQXp0KzdRPSIsIml2UGFyYW1ldGVyU3BlYyI6IjQ1dUtTMlE1UWhmWmFTRGsiLCJtYXRlcmlhbFNldFNlcmlhbCI6MX0%3D&branch=main)
4
+ [![npm downloads](https://img.shields.io/npm/dm/@ingestkorea/client-sens?style=flat-square)](https://www.npmjs.com/package/@ingestkorea/client-sens)
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,77 +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)
33
-
34
- #### SMS(LMS)
35
- + SendSMS
36
- + GetSMSStatus
37
- + GetSMSResult
32
+
33
+ - SendAlimtalk
34
+ - GetAlimtalkStatus
35
+ - GetAlimtalkResult
36
+ - GetAlimtalkTemplate
37
+ - ListAlimtalkTemplates
38
+ - ListAlimtalkChannels
39
+
40
+ #### SMS, LMS, MMS
41
+
42
+ - SendSMS (SMS, LMS)
43
+ - SendMMS (MMS)
44
+ - GetSMSStatus (SMS, LMS, MMS)
45
+ - GetSMSResult (SMS, LMS, MMS)
38
46
 
39
47
  ### Import
48
+
40
49
  ```ts
41
50
  import {
42
51
  SensClient,
43
- SendAlimtalkCommand, SendAlimtalkCommandInput,
44
- SendSMSCommand, SendSMSCommandInput,
45
- } from '@ingestkorea/client-sens';
52
+ SendAlimtalkCommand,
53
+ SendAlimtalkCommandInput,
54
+ SendSMSCommand,
55
+ SendSMSCommandInput,
56
+ SendMMSCommand,
57
+ SendMMSCommandInput,
58
+ } from "@ingestkorea/client-sens";
46
59
  ```
47
60
 
48
61
  ### Usage
62
+
49
63
  To send a request, you:
50
- + Initiate client with configuration.
51
- + Initiate command with input parameters.
52
- + 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.
53
68
 
54
69
  ```ts
55
70
  // a client can be shared by different commands.
56
71
  const client = new SensClient({
57
72
  credentials: {
58
73
  accessKey: ACCESS_KEY,
59
- secretKey: SECRET_KEY
74
+ secretKey: SECRET_KEY,
60
75
  },
61
76
  serviceId: {
62
- sms: 'ncp:sms:kr:123456789xxx:your-service-name', // optional
63
- kakao: 'ncp:kkobizmsg:kr:9876xxx:your-service-name' // optional
64
- }
77
+ sms: "ncp:sms:kr:123456789xxx:your-service-name", // optional
78
+ kakao: "ncp:kkobizmsg:kr:9876xxx:your-service-name", // optional
79
+ },
65
80
  });
66
81
 
67
82
  /**
68
83
  * accessKey, secretKey: https://www.ncloud.com/mypage/manage/authkey
69
84
  * serviceId: https://console.ncloud.com/sens/project
70
- *
85
+ *
71
86
  * at least one serviceId required
72
87
  * if you call send operation without serviceId, sdk throw error
73
88
  */
74
89
  ```
75
90
 
76
91
  #### SendAlimtalk
92
+
77
93
  ```ts
78
94
  let params: SendAlimtalkCommandInput = {
79
95
  plusFriendId: PLUS_FRIEND_ID,
80
96
  templateCode: TEMPLATE_CODE,
81
- messages: [
82
- { to: '01012345678', content: CONTENT }
83
- ]
97
+ messages: [{ to: "01012345678", content: CONTENT }],
84
98
  };
85
99
  let command = new SendAlimtalkCommand(params);
86
100
  ```
87
101
 
88
- #### SendSMS
102
+ #### SendSMS (SMS, LMS)
103
+
89
104
  ```ts
90
105
  /**
91
106
  * Automatically set message type('SMS' | 'LMS') according to content-length(euc-kr)
@@ -96,33 +111,68 @@ let params: SendSMSCommandInput = {
96
111
  from: '01012345678',
97
112
  content: DEFAULT_CONTENT,
98
113
  messages: [
114
+ { to: '0109182xxxx' },
115
+ { to: '0104321xxxx', content?: OPTIONAL_CONTENT_01 }
116
+ { to: '0108765xxxx', content?: OPTIONAL_CONTENT_02, subject?: OPTIONAL_SUBJECT_01 },
117
+ ]
118
+ };
119
+ /**
120
+ * If you do not define the subject and content within the messages,
121
+ * it is sent with the value specified as the default subject('제목없음') and content.
122
+ */
123
+ let command = new SendSMSCommand(params);
124
+ ```
125
+
126
+ #### SendMMS (MMS)
127
+
128
+ ```ts
129
+ import { readFileSync } from 'node:fs';
130
+
131
+ let params: SendMMSCommandInput = {
132
+ from: '01012345678',
133
+ content: DEFAULT_CONTENT,
134
+ messages: [
135
+ { to: '0109182xxxx' },
136
+ { to: '0104321xxxx', content?: OPTIONAL_CONTENT_01 }
137
+ { to: '0108765xxxx', content?: OPTIONAL_CONTENT_02, subject?: OPTIONAL_SUBJECT_01 },
138
+ ],
139
+ files: [ // support jpg, jpeg
140
+ { name: '/your/absolute/path/sample-image-1.jpg' },
99
141
  {
100
- to: '01087654321',
101
- content: OPTIONAL_CONTENT // optional // this OPTIONAL_CONTENT override above DEFAULT_CONTENT
142
+ name: '/your/absolute/path/sample-image-2.jpg',
143
+ body?: readFileSync('/your/absolute/path/sample-image-2.jpg', { encoding: 'base64' })
102
144
  }
103
145
  ]
104
146
  };
105
- let command = new SendSMSCommand(params);
147
+ /**
148
+ * If you do not define the subject and content within the messages,
149
+ * it is sent with the value specified as the default subject('제목없음') and content.
150
+ */
151
+ let command = new SendMMSCommand(params);
106
152
  ```
107
153
 
108
154
  #### Async/await
155
+
109
156
  ```ts
110
157
  (async () => {
111
158
  try {
112
159
  const data = await client.send(command);
113
160
  console.dir(data, { depth: 4 });
114
- } catch (err){
161
+ } catch (err) {
115
162
  console.dir(err, { depth: 4 });
116
- };
163
+ }
117
164
  })();
118
165
  ```
119
166
 
120
167
  #### Promises
168
+
121
169
  ```ts
122
- client.send(command)
123
- .then(data => console.dir(data, { depth: 4 }))
124
- .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 }));
125
174
  ```
126
175
 
127
176
  ## License
128
- 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,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
- const MAXIMUM_STRING_LENGTH = 1000;
47
- if (message.content.length > MAXIMUM_STRING_LENGTH)
43
+ const ALIMTALK_MAX = 1000;
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 ${MAXIMUM_STRING_LENGTH}`
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
  };