@ingestkorea/client-sens 1.7.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +98 -63
- package/dist-cjs/SensClient.js +57 -28
- package/dist-cjs/commands/GetAlimtalkResultCommand.js +5 -32
- package/dist-cjs/commands/GetAlimtalkStatusCommand.js +9 -35
- package/dist-cjs/commands/GetAlimtalkTemplateCommand.js +5 -32
- package/dist-cjs/commands/GetSMSResultCommand.js +8 -33
- package/dist-cjs/commands/GetSMSStatusCommand.js +8 -33
- package/dist-cjs/commands/ListAlimtalkChannelsCommand.js +6 -33
- package/dist-cjs/commands/ListAlimtalkStatusCommand.js +19 -35
- package/dist-cjs/commands/ListAlimtalkTemplatesCommand.js +5 -32
- package/dist-cjs/commands/SendAlimtalkCommand.js +35 -43
- package/dist-cjs/commands/SendMMSCommand.js +67 -103
- package/dist-cjs/commands/SendSMSCommand.js +38 -71
- package/dist-cjs/commands/constants.js +1 -15
- package/dist-cjs/commands/index.js +11 -11
- package/dist-cjs/index.js +2 -2
- package/dist-cjs/middleware/constants.js +10 -0
- package/dist-cjs/middleware/index.js +3 -4
- package/dist-cjs/middleware/middleware-metadata.js +4 -5
- package/dist-cjs/middleware/middleware-retry.js +32 -27
- package/dist-cjs/middleware/middleware-sign.js +10 -9
- package/dist-cjs/models/SendAlimtalk.js +3 -0
- package/dist-cjs/models/SendMMS.js +3 -0
- package/dist-cjs/models/SensErrorInfo.js +13 -0
- package/dist-cjs/models/SensMiddleware.js +2 -0
- package/dist-cjs/models/index.js +16 -14
- package/dist-cjs/protocols/GetAlimtalkResult.js +19 -22
- package/dist-cjs/protocols/GetAlimtalkStatus.js +36 -37
- package/dist-cjs/protocols/GetAlimtalkTemplate.js +56 -90
- package/dist-cjs/protocols/GetSMSResult.js +30 -48
- package/dist-cjs/protocols/GetSMSStatus.js +31 -34
- package/dist-cjs/protocols/ListAlimtalkChannels.js +27 -31
- package/dist-cjs/protocols/ListAlimtalkStatus.js +22 -19
- package/dist-cjs/protocols/ListAlimtalkTemplates.js +31 -23
- package/dist-cjs/protocols/SendAlimtalk.js +22 -26
- package/dist-cjs/protocols/SendMMS.js +8 -38
- package/dist-cjs/protocols/SendSMS.js +19 -21
- package/dist-cjs/protocols/constants.js +98 -34
- package/dist-es/SensClient.js +63 -30
- package/dist-es/commands/GetAlimtalkResultCommand.js +9 -19
- package/dist-es/commands/GetAlimtalkStatusCommand.js +14 -19
- package/dist-es/commands/GetAlimtalkTemplateCommand.js +9 -19
- package/dist-es/commands/GetSMSResultCommand.js +10 -20
- package/dist-es/commands/GetSMSStatusCommand.js +10 -20
- package/dist-es/commands/ListAlimtalkChannelsCommand.js +10 -22
- package/dist-es/commands/ListAlimtalkStatusCommand.js +28 -27
- package/dist-es/commands/ListAlimtalkTemplatesCommand.js +9 -19
- package/dist-es/commands/SendAlimtalkCommand.js +34 -30
- package/dist-es/commands/SendMMSCommand.js +70 -100
- package/dist-es/commands/SendSMSCommand.js +51 -66
- package/dist-es/commands/constants.js +9 -16
- package/dist-es/commands/index.js +27 -11
- package/dist-es/index.js +18 -2
- package/dist-es/middleware/constants.js +10 -0
- package/dist-es/middleware/index.js +19 -4
- package/dist-es/middleware/middleware-metadata.js +11 -5
- package/dist-es/middleware/middleware-retry.js +39 -30
- package/dist-es/middleware/middleware-sign.js +19 -14
- package/dist-es/models/GetAlimtalkResult.js +2 -1
- package/dist-es/models/GetAlimtalkStatus.js +2 -1
- package/dist-es/models/GetAlimtalkTemplate.js +2 -1
- package/dist-es/models/GetSMSResult.js +2 -1
- package/dist-es/models/GetSMSStatus.js +2 -1
- package/dist-es/models/ListAlimtalkChannels.js +2 -1
- package/dist-es/models/ListAlimtalkStatus.js +2 -1
- package/dist-es/models/ListAlimtalkTemplates.js +2 -1
- package/dist-es/models/MetadataBearer.js +2 -1
- package/dist-es/models/SendAlimtalk.js +5 -1
- package/dist-es/models/SendMMS.js +5 -1
- package/dist-es/models/SendSMS.js +2 -1
- package/dist-es/models/SensClient.js +2 -0
- package/dist-es/models/SensCommand.js +5 -1
- package/dist-es/models/SensErrorInfo.js +13 -0
- package/dist-es/models/SensMiddleware.js +2 -0
- package/dist-es/models/index.js +32 -14
- package/dist-es/protocols/GetAlimtalkResult.js +24 -23
- package/dist-es/protocols/GetAlimtalkStatus.js +40 -36
- package/dist-es/protocols/GetAlimtalkTemplate.js +78 -87
- package/dist-es/protocols/GetSMSResult.js +44 -47
- package/dist-es/protocols/GetSMSStatus.js +35 -34
- package/dist-es/protocols/ListAlimtalkChannels.js +31 -31
- package/dist-es/protocols/ListAlimtalkStatus.js +26 -32
- package/dist-es/protocols/ListAlimtalkTemplates.js +35 -22
- package/dist-es/protocols/SendAlimtalk.js +26 -25
- package/dist-es/protocols/SendMMS.js +10 -49
- package/dist-es/protocols/SendSMS.js +23 -30
- package/dist-es/protocols/constants.js +112 -37
- package/dist-types/SensClient.d.ts +3 -20
- package/dist-types/commands/GetAlimtalkResultCommand.d.ts +5 -10
- package/dist-types/commands/GetAlimtalkStatusCommand.d.ts +5 -10
- package/dist-types/commands/GetAlimtalkTemplateCommand.d.ts +5 -10
- package/dist-types/commands/GetSMSResultCommand.d.ts +5 -10
- package/dist-types/commands/GetSMSStatusCommand.d.ts +5 -10
- package/dist-types/commands/ListAlimtalkChannelsCommand.d.ts +5 -10
- package/dist-types/commands/ListAlimtalkStatusCommand.d.ts +5 -10
- package/dist-types/commands/ListAlimtalkTemplatesCommand.d.ts +5 -10
- package/dist-types/commands/SendAlimtalkCommand.d.ts +5 -10
- package/dist-types/commands/SendMMSCommand.d.ts +5 -10
- package/dist-types/commands/SendSMSCommand.d.ts +9 -10
- package/dist-types/commands/constants.d.ts +0 -7
- package/dist-types/commands/index.d.ts +11 -11
- package/dist-types/index.d.ts +2 -2
- package/dist-types/middleware/constants.d.ts +7 -0
- package/dist-types/middleware/index.d.ts +3 -4
- package/dist-types/middleware/middleware-metadata.d.ts +2 -2
- package/dist-types/middleware/middleware-retry.d.ts +2 -2
- package/dist-types/middleware/middleware-sign.d.ts +2 -2
- package/dist-types/models/GetAlimtalkResult.d.ts +3 -3
- package/dist-types/models/GetAlimtalkStatus.d.ts +8 -5
- package/dist-types/models/GetAlimtalkTemplate.d.ts +5 -5
- package/dist-types/models/GetSMSResult.d.ts +5 -9
- package/dist-types/models/GetSMSStatus.d.ts +4 -4
- package/dist-types/models/ListAlimtalkChannels.d.ts +4 -4
- package/dist-types/models/ListAlimtalkStatus.d.ts +8 -8
- package/dist-types/models/ListAlimtalkTemplates.d.ts +2 -2
- package/dist-types/models/MetadataBearer.d.ts +3 -3
- package/dist-types/models/SendAlimtalk.d.ts +6 -4
- package/dist-types/models/SendMMS.d.ts +5 -3
- package/dist-types/models/SendSMS.d.ts +2 -2
- package/dist-types/models/SensClient.d.ts +17 -0
- package/dist-types/models/SensCommand.d.ts +4 -6
- package/dist-types/models/SensErrorInfo.d.ts +21 -0
- package/dist-types/models/SensMiddleware.d.ts +8 -0
- package/dist-types/models/index.d.ts +16 -14
- package/dist-types/protocols/GetAlimtalkResult.d.ts +4 -11
- package/dist-types/protocols/GetAlimtalkStatus.d.ts +6 -12
- package/dist-types/protocols/GetAlimtalkTemplate.d.ts +4 -14
- package/dist-types/protocols/GetSMSResult.d.ts +4 -12
- package/dist-types/protocols/GetSMSStatus.d.ts +5 -11
- package/dist-types/protocols/ListAlimtalkChannels.d.ts +4 -11
- package/dist-types/protocols/ListAlimtalkStatus.d.ts +4 -10
- package/dist-types/protocols/ListAlimtalkTemplates.d.ts +5 -12
- package/dist-types/protocols/SendAlimtalk.d.ts +5 -12
- package/dist-types/protocols/SendMMS.d.ts +4 -10
- package/dist-types/protocols/SendSMS.d.ts +5 -10
- package/dist-types/protocols/constants.d.ts +3 -2
- package/package.json +20 -4
- package/.github/pull_request_template.md +0 -19
- package/dist-cjs/middleware/middleware-sort-headers.js +0 -25
- package/dist-cjs/protocols/index.js +0 -28
- package/dist-es/middleware/middleware-sort-headers.js +0 -12
- package/dist-es/models/Middleware.js +0 -1
- package/dist-es/protocols/index.js +0 -12
- package/dist-types/middleware/middleware-sort-headers.d.ts +0 -2
- package/dist-types/models/Middleware.d.ts +0 -12
- package/dist-types/protocols/index.d.ts +0 -12
- /package/dist-cjs/models/{Middleware.js → SensClient.js} +0 -0
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2024 INGESTKOREA LLC.
|
|
3
|
+
Copyright (c) 2024-2026 INGESTKOREA LLC. All Rights Reserved.
|
|
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
|
package/README.md
CHANGED
|
@@ -7,7 +7,15 @@
|
|
|
7
7
|
|
|
8
8
|
## Description
|
|
9
9
|
|
|
10
|
-
INGESTKOREA SDK Naver Cloud Platform SENS Client for Node.js.
|
|
10
|
+
INGESTKOREA SDK - Naver Cloud Platform SENS Client for Node.js.
|
|
11
|
+
|
|
12
|
+
INGESTKOREA SDK - SENS Client for Node.js is a lightweight library that contains only the essential features frequently used in SENS.
|
|
13
|
+
|
|
14
|
+
This SDK performs tasks such as the following automatically.
|
|
15
|
+
|
|
16
|
+
- Authentication using an API Signature
|
|
17
|
+
- Retrying requests
|
|
18
|
+
- Handling error responses
|
|
11
19
|
|
|
12
20
|
## Installing
|
|
13
21
|
|
|
@@ -47,8 +55,12 @@ npm install @ingestkorea/client-sens
|
|
|
47
55
|
|
|
48
56
|
### Import
|
|
49
57
|
|
|
58
|
+
The INGESTKOREA SDK - SENS Client is modulized by `client` and `commands`.
|
|
59
|
+
|
|
60
|
+
To send a request, you only need to import the SensClient and the commands you need, for example SendMessageCommand:
|
|
61
|
+
|
|
50
62
|
```ts
|
|
51
|
-
import { SensClient, SendAlimtalkCommand
|
|
63
|
+
import { SensClient, SendAlimtalkCommand } from "@ingestkorea/client-sens";
|
|
52
64
|
```
|
|
53
65
|
|
|
54
66
|
### Usage
|
|
@@ -60,106 +72,123 @@ To send a request, you:
|
|
|
60
72
|
- Call `send` operation on client with command object as input.
|
|
61
73
|
|
|
62
74
|
```ts
|
|
63
|
-
// a client can be shared by different commands.
|
|
64
75
|
const client = new SensClient({
|
|
76
|
+
/**
|
|
77
|
+
* AccessKey, SecretKey: https://www.ncloud.com/mypage/manage/authkey
|
|
78
|
+
* serviceId: https://console.ncloud.com/sens/project
|
|
79
|
+
*/
|
|
65
80
|
credentials: {
|
|
66
|
-
accessKey:
|
|
67
|
-
secretKey:
|
|
81
|
+
accessKey: "YOUR_ACCESS_KEY",
|
|
82
|
+
secretKey: "YOUR_SECRET_KEY",
|
|
68
83
|
},
|
|
84
|
+
/**
|
|
85
|
+
* at least one serviceId required
|
|
86
|
+
* if you call send operation without serviceId, sdk throw error
|
|
87
|
+
*/
|
|
69
88
|
serviceId: {
|
|
70
|
-
|
|
71
|
-
|
|
89
|
+
kakao: "ncp:kkobizmsg:kr:xxxxxx:your-service-name",
|
|
90
|
+
sms: "ncp:sms:kr:xxxxxx:your-service-name",
|
|
72
91
|
},
|
|
73
92
|
});
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* accessKey, secretKey: https://www.ncloud.com/mypage/manage/authkey
|
|
77
|
-
* serviceId: https://console.ncloud.com/sens/project
|
|
78
|
-
*
|
|
79
|
-
* at least one serviceId required
|
|
80
|
-
* if you call send operation without serviceId, sdk throw error
|
|
81
|
-
*/
|
|
82
93
|
```
|
|
83
94
|
|
|
84
95
|
#### SendAlimtalk
|
|
85
96
|
|
|
86
97
|
```ts
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
98
|
+
const command = new SendAlimtalkCommand({
|
|
99
|
+
/** Required: Kakao PlusFriend ID (e.g., @kakao) */
|
|
100
|
+
plusFriendId: "PLUS_FRIEND_ID",
|
|
101
|
+
|
|
102
|
+
/** Required: Kakao Alimtalk TemplateCode ID (e.g., welcomeTemplate) */
|
|
103
|
+
templateCode: "TEMPLATE_CODE",
|
|
104
|
+
|
|
105
|
+
/** Required: List of messages to send (Max 100) */
|
|
106
|
+
messages: [
|
|
107
|
+
/** Recipient phone number (digits only), Message content */
|
|
108
|
+
{ to: "01012345678", content: "YOUR_CONTENT" },
|
|
109
|
+
],
|
|
91
110
|
});
|
|
92
111
|
```
|
|
93
112
|
|
|
94
113
|
#### ListAlimtalkStatus
|
|
95
114
|
|
|
96
115
|
```ts
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
116
|
+
const command = new ListAlimtalkStatusCommand({
|
|
117
|
+
/** Required: Kakao PlusFriend ID (e.g., @kakao) */
|
|
118
|
+
plusFriendId: "CHANNEL_ID",
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Optional: Start time in KST (Format: yyyy-MM-ddTHH:mm:ss.SSS)
|
|
122
|
+
* Defaults to 24 hours prior to requestEndTime if not provided.
|
|
123
|
+
*/
|
|
124
|
+
requestStartTime: "yyyy-MM-ddTHH:mm:ss.SSS",
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Optional: End time in KST (Format: yyyy-MM-ddTHH:mm:ss.SSS)
|
|
128
|
+
* Defaults to the current system time if not provided.
|
|
129
|
+
*/
|
|
130
|
+
requestEndTime: "yyyy-MM-ddTHH:mm:ss.SSS",
|
|
101
131
|
});
|
|
102
132
|
```
|
|
103
133
|
|
|
104
134
|
#### GetAlimtalkStatus
|
|
105
135
|
|
|
106
136
|
```ts
|
|
107
|
-
|
|
108
|
-
requestId: REQUEST_ID,
|
|
109
|
-
});
|
|
137
|
+
const command = new GetAlimtalkStatusCommand({ requestId: "ALIMTALK_REQUEST_ID" });
|
|
110
138
|
```
|
|
111
139
|
|
|
112
140
|
#### SendSMS (SMS, LMS)
|
|
113
141
|
|
|
142
|
+
- **Message Type Automation**: The SDK automatically determines the message type ('SMS' or 'LMS') based on the content length (EUC-KR encoding)
|
|
143
|
+
|
|
144
|
+
- SMS: Up to 90 bytes
|
|
145
|
+
- LMS: Up to 2,000 bytes
|
|
146
|
+
|
|
147
|
+
- **Default Value Policy**: If `subject` or `content` is not defined within the individual message object, the SDK uses the **top-level** `content` and the default subject ('제목없음').
|
|
148
|
+
|
|
114
149
|
```ts
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
150
|
+
const command = new SendSMSCommand({
|
|
151
|
+
/** Sender's phone number (digits only) for all messages in the batch. */
|
|
152
|
+
from: "01012345678",
|
|
153
|
+
|
|
154
|
+
/** Default message content */
|
|
155
|
+
content: "DEFAULT_CONTENT",
|
|
118
156
|
messages: [
|
|
119
|
-
|
|
120
|
-
{ to:
|
|
121
|
-
{ to: '0108765xxxx', content?: CONTENT_02, subject?: SUBJECT_01 },
|
|
122
|
-
]
|
|
123
|
-
});
|
|
157
|
+
/** Uses default message content */
|
|
158
|
+
{ to: "0101111xxxx" },
|
|
124
159
|
|
|
125
|
-
/**
|
|
126
|
-
|
|
127
|
-
* SMS: max 90bytes
|
|
128
|
-
* LMS: max 2000bytes
|
|
129
|
-
*/
|
|
160
|
+
/** Overrides with specific content */
|
|
161
|
+
{ to: "0102222xxxx", content: "CONTENT_01" },
|
|
130
162
|
|
|
131
|
-
/**
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
163
|
+
/** Overrides content & subject */
|
|
164
|
+
{ to: "0103333xxxx", content: "CONTENT_02", subject: "SUBJECT_01" },
|
|
165
|
+
],
|
|
166
|
+
});
|
|
135
167
|
```
|
|
136
168
|
|
|
137
169
|
#### SendMMS (MMS)
|
|
138
170
|
|
|
171
|
+
- **Multimedia Messaging**: Supports sending images along with your message. (Supported formats: `.jpg`, `.jpeg`)
|
|
172
|
+
|
|
173
|
+
- **Default Value Policy**: Same as `SendSMSCommand`, individual messages will inherit the top-level `content` and `subject` if not specified.
|
|
174
|
+
|
|
139
175
|
```ts
|
|
140
|
-
import { readFileSync } from
|
|
176
|
+
import { readFileSync } from "node:fs";
|
|
141
177
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
{
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
files: [ // support jpg, jpeg
|
|
151
|
-
{ name: '/your/absolute/path/sample-image-1.jpg' },
|
|
178
|
+
const command = new SendMMSCommand({
|
|
179
|
+
/** Same as SendSMSCommand */
|
|
180
|
+
...
|
|
181
|
+
files: [
|
|
182
|
+
// 1. Specify the absolute path (The SDK will handle the file reading)
|
|
183
|
+
{ name: "/your/absolute/path/sample-image-1.jpg" },
|
|
184
|
+
|
|
185
|
+
// 2. Pass base64 encoded data directly
|
|
152
186
|
{
|
|
153
|
-
name:
|
|
154
|
-
body
|
|
155
|
-
}
|
|
156
|
-
]
|
|
187
|
+
name: "custom-image-name.jpg",
|
|
188
|
+
body: readFileSync("/your/absolute/path/sample-image-2.jpg", { encoding: "base64" }),
|
|
189
|
+
},
|
|
190
|
+
],
|
|
157
191
|
});
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* If you do not define the subject and content within the messages,
|
|
161
|
-
* it is sent with the value specified as the default subject('제목없음') and content.
|
|
162
|
-
*/
|
|
163
192
|
```
|
|
164
193
|
|
|
165
194
|
#### Async/await
|
|
@@ -184,6 +213,12 @@ client
|
|
|
184
213
|
.catch((err) => console.dir(err, { depth: 4 }));
|
|
185
214
|
```
|
|
186
215
|
|
|
216
|
+
## Getting Help
|
|
217
|
+
|
|
218
|
+
We use the GitHub issues for tracking bugs and feature requests.
|
|
219
|
+
|
|
220
|
+
If it turns out that you may have found a bug, please open an issue.
|
|
221
|
+
|
|
187
222
|
## License
|
|
188
223
|
|
|
189
224
|
This SDK is distributed under the [MIT License](https://opensource.org/licenses/MIT), see LICENSE for more information.
|
package/dist-cjs/SensClient.js
CHANGED
|
@@ -11,54 +11,83 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.SensClient = void 0;
|
|
13
13
|
const util_http_handler_1 = require("@ingestkorea/util-http-handler");
|
|
14
|
-
const
|
|
15
|
-
const
|
|
14
|
+
const index_js_1 = require("./models/index.js");
|
|
15
|
+
const index_js_2 = require("./middleware/index.js");
|
|
16
16
|
class SensClient {
|
|
17
17
|
constructor(config) {
|
|
18
|
+
this.httpHandler = new util_http_handler_1.NodeHttpHandler({ connectionTimeout: 3000, socketTimeout: 3000 });
|
|
19
|
+
this.requestHandler = (input, context) => __awaiter(this, void 0, void 0, function* () { return this.httpHandler.handle(input.request); });
|
|
18
20
|
this.config = {
|
|
19
21
|
credentials: resolveCredentials(config),
|
|
20
22
|
serviceId: resolveServiceId(config),
|
|
21
23
|
};
|
|
22
|
-
this.requestHandler = new util_http_handler_1.NodeHttpHandler({ connectionTimeout: 3000, socketTimeout: 3000 });
|
|
23
24
|
}
|
|
24
25
|
send(command) {
|
|
25
26
|
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
const { input, serializer, deserializer } = command;
|
|
28
|
+
const middlewares = [index_js_2.middlewareIngestkoreaMetadata, index_js_2.middlewareNcpSign, index_js_2.middlewareRetry];
|
|
29
|
+
const handler = composeMiddleware(middlewares, this.requestHandler);
|
|
30
|
+
try {
|
|
31
|
+
const request = yield serializer(input, this.config);
|
|
32
|
+
const { response } = yield handler({ request }, this.config);
|
|
33
|
+
const output = yield deserializer(response, this.config);
|
|
34
|
+
return output;
|
|
35
|
+
}
|
|
36
|
+
catch (e) {
|
|
37
|
+
throw e;
|
|
38
|
+
}
|
|
34
39
|
});
|
|
35
40
|
}
|
|
36
41
|
}
|
|
37
42
|
exports.SensClient = SensClient;
|
|
43
|
+
const composeMiddleware = (middlewares, finalHandler) => {
|
|
44
|
+
const handler = middlewares.reduceRight((next, middleware) => {
|
|
45
|
+
return middleware(next);
|
|
46
|
+
}, finalHandler);
|
|
47
|
+
return handler;
|
|
48
|
+
};
|
|
38
49
|
const resolveCredentials = (config) => {
|
|
39
50
|
const { credentials } = config;
|
|
51
|
+
let error = new index_js_1.SensError({
|
|
52
|
+
code: 401,
|
|
53
|
+
type: "Unauthorized",
|
|
54
|
+
message: "Invalid Credentials",
|
|
55
|
+
invalidInputs: [{ type: "not-valid.args", message: "SensClient 초기화시 인증 정보를 확인해주세요" }],
|
|
56
|
+
});
|
|
40
57
|
if (!credentials)
|
|
41
|
-
throw
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
58
|
+
throw error;
|
|
59
|
+
if (!credentials.accessKey) {
|
|
60
|
+
error.invalidInputs[0].message = "AccessKey 정보를 확인해주세요";
|
|
61
|
+
throw error;
|
|
62
|
+
}
|
|
63
|
+
if (!credentials.secretKey) {
|
|
64
|
+
error.invalidInputs[0].message = "SecretKey 정보를 확인해주세요";
|
|
65
|
+
throw error;
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
accessKey: credentials.accessKey,
|
|
69
|
+
secretKey: credentials.secretKey,
|
|
70
|
+
};
|
|
48
71
|
};
|
|
49
72
|
const resolveServiceId = (config) => {
|
|
73
|
+
var _a, _b, _c;
|
|
50
74
|
const { serviceId } = config;
|
|
51
|
-
|
|
52
|
-
code:
|
|
53
|
-
type: "
|
|
54
|
-
message: "Invalid
|
|
55
|
-
|
|
75
|
+
let error = new index_js_1.SensError({
|
|
76
|
+
code: 400,
|
|
77
|
+
type: "Bad Request",
|
|
78
|
+
message: "Invalid ServiceId",
|
|
79
|
+
invalidInputs: [{ type: "not-valid.args", message: "SensClient 초기화시 서비스 정보를 확인해주세요" }],
|
|
56
80
|
});
|
|
57
|
-
if (!serviceId
|
|
58
|
-
throw
|
|
81
|
+
if (!serviceId)
|
|
82
|
+
throw error;
|
|
83
|
+
const isReady = !!Object.values(serviceId).filter((d) => !!d).length;
|
|
84
|
+
if (!isReady) {
|
|
85
|
+
error.invalidInputs[0].message = "최소 1개 이상의 서비스 정보가 필요합니다";
|
|
86
|
+
throw error;
|
|
87
|
+
}
|
|
59
88
|
return {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
89
|
+
kakao: (_a = serviceId.kakao) !== null && _a !== void 0 ? _a : "",
|
|
90
|
+
push: (_b = serviceId.push) !== null && _b !== void 0 ? _b : "",
|
|
91
|
+
sms: (_c = serviceId.sms) !== null && _c !== void 0 ? _c : "",
|
|
63
92
|
};
|
|
64
93
|
};
|
|
@@ -1,43 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.GetAlimtalkResultCommand = void 0;
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
class GetAlimtalkResultCommand extends models_1.SensCommand {
|
|
4
|
+
const index_js_1 = require("../models/index.js");
|
|
5
|
+
const GetAlimtalkResult_js_1 = require("../protocols/GetAlimtalkResult.js");
|
|
6
|
+
class GetAlimtalkResultCommand extends index_js_1.SensCommand {
|
|
17
7
|
constructor(input) {
|
|
18
8
|
super(input);
|
|
19
9
|
this.input = {
|
|
20
10
|
messageId: input.messageId,
|
|
21
11
|
};
|
|
22
|
-
|
|
23
|
-
|
|
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, GetAlimtalkResult_1.serializeIngestkorea_restJson_GetAlimtalkResultCommand)(input, config);
|
|
33
|
-
return request;
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
deserialize(response) {
|
|
37
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
-
let output = yield (0, GetAlimtalkResult_1.deserializeIngestkorea_restJson_GetAlimtalkResultCommand)(response);
|
|
39
|
-
return output;
|
|
40
|
-
});
|
|
12
|
+
this.serializer = GetAlimtalkResult_js_1.se_GetAlimtalkResultCommand;
|
|
13
|
+
this.deserializer = GetAlimtalkResult_js_1.de_GetAlimtalkResultCommand;
|
|
41
14
|
}
|
|
42
15
|
}
|
|
43
16
|
exports.GetAlimtalkResultCommand = GetAlimtalkResultCommand;
|
|
@@ -1,43 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.GetAlimtalkStatusCommand = void 0;
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
|
|
4
|
+
const index_js_1 = require("../models/index.js");
|
|
5
|
+
const GetAlimtalkStatus_js_1 = require("../protocols/GetAlimtalkStatus.js");
|
|
6
|
+
const MAX_LIMIT = 100;
|
|
7
|
+
const DEFAULT_LIMIT = 20;
|
|
8
|
+
class GetAlimtalkStatusCommand extends index_js_1.SensCommand {
|
|
17
9
|
constructor(input) {
|
|
10
|
+
var _a;
|
|
18
11
|
super(input);
|
|
19
|
-
this.input = {
|
|
20
|
-
|
|
21
|
-
|
|
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, GetAlimtalkStatus_1.serializeIngestkorea_restJson_GetAlimtalkStatusCommand)(input, config);
|
|
33
|
-
return request;
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
deserialize(response) {
|
|
37
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
-
let output = yield (0, GetAlimtalkStatus_1.deserializeIngestkorea_restJson_GetAlimtalkStatusCommand)(response);
|
|
39
|
-
return output;
|
|
40
|
-
});
|
|
12
|
+
this.input = Object.assign({ requestId: input.requestId, pageSize: Math.min(MAX_LIMIT, Math.max(1, (_a = input.pageSize) !== null && _a !== void 0 ? _a : DEFAULT_LIMIT)) }, (input.nextToken && { nextToken: input.nextToken }));
|
|
13
|
+
this.serializer = GetAlimtalkStatus_js_1.se_GetAlimtalkStatusCommand;
|
|
14
|
+
this.deserializer = GetAlimtalkStatus_js_1.de_GetAlimtalkStatusCommand;
|
|
41
15
|
}
|
|
42
16
|
}
|
|
43
17
|
exports.GetAlimtalkStatusCommand = GetAlimtalkStatusCommand;
|
|
@@ -1,44 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.GetAlimtalkTemplateCommand = void 0;
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
class GetAlimtalkTemplateCommand extends models_1.SensCommand {
|
|
4
|
+
const index_js_1 = require("../models/index.js");
|
|
5
|
+
const GetAlimtalkTemplate_js_1 = require("../protocols/GetAlimtalkTemplate.js");
|
|
6
|
+
class GetAlimtalkTemplateCommand extends index_js_1.SensCommand {
|
|
17
7
|
constructor(input) {
|
|
18
8
|
super(input);
|
|
19
9
|
this.input = {
|
|
20
10
|
channelId: input.channelId,
|
|
21
11
|
templateCode: input.templateCode,
|
|
22
12
|
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
if (!config.serviceId.kakao)
|
|
27
|
-
throw new util_error_handler_1.IngestkoreaError({
|
|
28
|
-
code: 400,
|
|
29
|
-
type: "Bad Request",
|
|
30
|
-
message: "Invalid Params",
|
|
31
|
-
description: "Please Check Kakao ServiceId",
|
|
32
|
-
});
|
|
33
|
-
let request = yield (0, GetAlimtalkTemplate_1.serializeIngestkorea_restJson_GetAlimtalkTemplateCommand)(input, config);
|
|
34
|
-
return request;
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
deserialize(response) {
|
|
38
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
-
let output = yield (0, GetAlimtalkTemplate_1.deserializeIngestkorea_restJson_GetAlimtalkTemplateCommand)(response);
|
|
40
|
-
return output;
|
|
41
|
-
});
|
|
13
|
+
this.serializer = GetAlimtalkTemplate_js_1.se_GetAlimtalkTemplateCommand;
|
|
14
|
+
this.deserializer = GetAlimtalkTemplate_js_1.de_GetAlimtalkTemplateCommand;
|
|
42
15
|
}
|
|
43
16
|
}
|
|
44
17
|
exports.GetAlimtalkTemplateCommand = GetAlimtalkTemplateCommand;
|
|
@@ -1,41 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.GetSMSResultCommand = void 0;
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
class GetSMSResultCommand extends models_1.SensCommand {
|
|
4
|
+
const index_js_1 = require("../models/index.js");
|
|
5
|
+
const GetSMSResult_js_1 = require("../protocols/GetSMSResult.js");
|
|
6
|
+
class GetSMSResultCommand extends index_js_1.SensCommand {
|
|
17
7
|
constructor(input) {
|
|
18
8
|
super(input);
|
|
19
|
-
this.input =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
throw new util_error_handler_1.IngestkoreaError({
|
|
25
|
-
code: 400,
|
|
26
|
-
type: "Bad Request",
|
|
27
|
-
message: "Invalid Params",
|
|
28
|
-
description: "Please Check SMS ServiceId",
|
|
29
|
-
});
|
|
30
|
-
let request = yield (0, GetSMSResult_1.serializeIngestkorea_restJson_GetSMSResultCommand)(input, config);
|
|
31
|
-
return request;
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
deserialize(response) {
|
|
35
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
-
let output = yield (0, GetSMSResult_1.deserializeIngestkorea_restJson_GetSMSResultCommand)(response);
|
|
37
|
-
return output;
|
|
38
|
-
});
|
|
9
|
+
this.input = {
|
|
10
|
+
messageId: input.messageId,
|
|
11
|
+
};
|
|
12
|
+
this.serializer = GetSMSResult_js_1.se_GetSMSResultCommand;
|
|
13
|
+
this.deserializer = GetSMSResult_js_1.de_GetSMSResultCommand;
|
|
39
14
|
}
|
|
40
15
|
}
|
|
41
16
|
exports.GetSMSResultCommand = GetSMSResultCommand;
|
|
@@ -1,41 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.GetSMSStatusCommand = void 0;
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
class GetSMSStatusCommand extends models_1.SensCommand {
|
|
4
|
+
const index_js_1 = require("../models/index.js");
|
|
5
|
+
const GetSMSStatus_js_1 = require("../protocols/GetSMSStatus.js");
|
|
6
|
+
class GetSMSStatusCommand extends index_js_1.SensCommand {
|
|
17
7
|
constructor(input) {
|
|
18
8
|
super(input);
|
|
19
|
-
this.input =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
throw new util_error_handler_1.IngestkoreaError({
|
|
25
|
-
code: 400,
|
|
26
|
-
type: "Bad Request",
|
|
27
|
-
message: "Invalid Params",
|
|
28
|
-
description: "Please Check SMS ServiceId",
|
|
29
|
-
});
|
|
30
|
-
let request = yield (0, GetSMSStatus_1.serializeIngestkorea_restJson_GetSMSStatusCommand)(input, config);
|
|
31
|
-
return request;
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
deserialize(response) {
|
|
35
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
-
let output = yield (0, GetSMSStatus_1.deserializeIngestkorea_restJson_GetSMSStatusCommand)(response);
|
|
37
|
-
return output;
|
|
38
|
-
});
|
|
9
|
+
this.input = {
|
|
10
|
+
requestId: input.requestId,
|
|
11
|
+
};
|
|
12
|
+
this.serializer = GetSMSStatus_js_1.se_GetSMSStatusCommand;
|
|
13
|
+
this.deserializer = GetSMSStatus_js_1.de_GetSMSStatusCommand;
|
|
39
14
|
}
|
|
40
15
|
}
|
|
41
16
|
exports.GetSMSStatusCommand = GetSMSStatusCommand;
|
|
@@ -1,41 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.ListAlimtalkChannelsCommand = void 0;
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
class ListAlimtalkChannelsCommand extends models_1.SensCommand {
|
|
4
|
+
const index_js_1 = require("../models/index.js");
|
|
5
|
+
const ListAlimtalkChannels_js_1 = require("../protocols/ListAlimtalkChannels.js");
|
|
6
|
+
class ListAlimtalkChannelsCommand extends index_js_1.SensCommand {
|
|
17
7
|
constructor(input) {
|
|
18
8
|
super(input);
|
|
19
|
-
this.input =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
if (!config.serviceId.kakao)
|
|
24
|
-
throw new util_error_handler_1.IngestkoreaError({
|
|
25
|
-
code: 400,
|
|
26
|
-
type: "Bad Request",
|
|
27
|
-
message: "Invalid Params",
|
|
28
|
-
description: "Please Check Kakao ServiceId",
|
|
29
|
-
});
|
|
30
|
-
let request = yield (0, ListAlimtalkChannels_1.serializeIngestkorea_restJson_ListAlimtalkChannelsCommand)(input, config);
|
|
31
|
-
return request;
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
deserialize(response) {
|
|
35
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
-
let output = yield (0, ListAlimtalkChannels_1.deserializeIngestkorea_restJson_ListAlimtalkChannelsCommand)(response);
|
|
37
|
-
return output;
|
|
38
|
-
});
|
|
9
|
+
this.input = {};
|
|
10
|
+
this.serializer = ListAlimtalkChannels_js_1.se_ListAlimtalkChannelsCommand;
|
|
11
|
+
this.deserializer = ListAlimtalkChannels_js_1.de_ListAlimtalkChannelsCommand;
|
|
39
12
|
}
|
|
40
13
|
}
|
|
41
14
|
exports.ListAlimtalkChannelsCommand = ListAlimtalkChannelsCommand;
|