@ingestkorea/client-sens 1.6.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 +114 -68
- package/dist-cjs/SensClient.js +59 -31
- package/dist-cjs/commands/GetAlimtalkResultCommand.js +8 -33
- package/dist-cjs/commands/GetAlimtalkStatusCommand.js +9 -33
- package/dist-cjs/commands/GetAlimtalkTemplateCommand.js +9 -33
- 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 +27 -0
- package/dist-cjs/commands/ListAlimtalkTemplatesCommand.js +8 -33
- package/dist-cjs/commands/SendAlimtalkCommand.js +36 -40
- package/dist-cjs/commands/SendMMSCommand.js +67 -103
- package/dist-cjs/commands/SendSMSCommand.js +38 -71
- package/dist-cjs/commands/constants.js +1 -4
- package/dist-cjs/commands/index.js +11 -10
- 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 +5 -0
- package/dist-cjs/models/SendMMS.js +3 -0
- package/dist-cjs/models/SensClient.js +2 -0
- package/dist-cjs/models/SensErrorInfo.js +13 -0
- package/dist-cjs/models/SensMiddleware.js +2 -0
- package/dist-cjs/models/index.js +16 -13
- package/dist-cjs/protocols/GetAlimtalkResult.js +19 -40
- package/dist-cjs/protocols/GetAlimtalkStatus.js +40 -50
- package/dist-cjs/protocols/GetAlimtalkTemplate.js +60 -22
- 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 +48 -0
- package/dist-cjs/protocols/ListAlimtalkTemplates.js +36 -62
- package/dist-cjs/protocols/SendAlimtalk.js +33 -35
- 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 +65 -33
- package/dist-es/commands/GetAlimtalkResultCommand.js +10 -20
- package/dist-es/commands/GetAlimtalkStatusCommand.js +15 -20
- package/dist-es/commands/GetAlimtalkTemplateCommand.js +11 -20
- 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 +39 -0
- package/dist-es/commands/ListAlimtalkTemplatesCommand.js +10 -20
- package/dist-es/commands/SendAlimtalkCommand.js +40 -32
- package/dist-es/commands/SendMMSCommand.js +70 -100
- package/dist-es/commands/SendSMSCommand.js +51 -66
- package/dist-es/commands/constants.js +9 -6
- package/dist-es/commands/index.js +27 -10
- 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 -0
- package/dist-es/models/ListAlimtalkTemplates.js +2 -1
- package/dist-es/models/MetadataBearer.js +2 -1
- package/dist-es/models/SendAlimtalk.js +7 -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 -13
- package/dist-es/protocols/GetAlimtalkResult.js +24 -38
- package/dist-es/protocols/GetAlimtalkStatus.js +54 -50
- package/dist-es/protocols/GetAlimtalkTemplate.js +82 -23
- 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 +42 -0
- package/dist-es/protocols/ListAlimtalkTemplates.js +41 -61
- package/dist-es/protocols/SendAlimtalk.js +37 -35
- 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 +11 -0
- 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 -3
- package/dist-types/commands/index.d.ts +11 -10
- 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 -4
- package/dist-types/models/GetAlimtalkStatus.d.ts +13 -5
- package/dist-types/models/GetAlimtalkTemplate.d.ts +42 -3
- 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 +16 -0
- package/dist-types/models/ListAlimtalkTemplates.d.ts +2 -22
- package/dist-types/models/MetadataBearer.d.ts +3 -3
- package/dist-types/models/SendAlimtalk.d.ts +19 -10
- 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 -13
- package/dist-types/protocols/GetAlimtalkResult.d.ts +4 -11
- package/dist-types/protocols/GetAlimtalkStatus.d.ts +6 -11
- package/dist-types/protocols/GetAlimtalkTemplate.d.ts +4 -10
- 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 -0
- package/dist-types/protocols/ListAlimtalkTemplates.d.ts +5 -13
- package/dist-types/protocols/SendAlimtalk.d.ts +5 -11
- 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 +22 -5
- 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 -26
- 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 -10
- 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 -10
- /package/dist-cjs/models/{Middleware.js → ListAlimtalkStatus.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
|
|
|
@@ -34,6 +42,7 @@ npm install @ingestkorea/client-sens
|
|
|
34
42
|
- GetAlimtalkStatus
|
|
35
43
|
- GetAlimtalkResult
|
|
36
44
|
- GetAlimtalkTemplate
|
|
45
|
+
- ListAlimtalkStatus
|
|
37
46
|
- ListAlimtalkTemplates
|
|
38
47
|
- ListAlimtalkChannels
|
|
39
48
|
|
|
@@ -46,16 +55,12 @@ npm install @ingestkorea/client-sens
|
|
|
46
55
|
|
|
47
56
|
### Import
|
|
48
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
|
+
|
|
49
62
|
```ts
|
|
50
|
-
import {
|
|
51
|
-
SensClient,
|
|
52
|
-
SendAlimtalkCommand,
|
|
53
|
-
SendAlimtalkCommandInput,
|
|
54
|
-
SendSMSCommand,
|
|
55
|
-
SendSMSCommandInput,
|
|
56
|
-
SendMMSCommand,
|
|
57
|
-
SendMMSCommandInput,
|
|
58
|
-
} from "@ingestkorea/client-sens";
|
|
63
|
+
import { SensClient, SendAlimtalkCommand } from "@ingestkorea/client-sens";
|
|
59
64
|
```
|
|
60
65
|
|
|
61
66
|
### Usage
|
|
@@ -67,88 +72,123 @@ To send a request, you:
|
|
|
67
72
|
- Call `send` operation on client with command object as input.
|
|
68
73
|
|
|
69
74
|
```ts
|
|
70
|
-
// a client can be shared by different commands.
|
|
71
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
|
+
*/
|
|
72
80
|
credentials: {
|
|
73
|
-
accessKey:
|
|
74
|
-
secretKey:
|
|
81
|
+
accessKey: "YOUR_ACCESS_KEY",
|
|
82
|
+
secretKey: "YOUR_SECRET_KEY",
|
|
75
83
|
},
|
|
84
|
+
/**
|
|
85
|
+
* at least one serviceId required
|
|
86
|
+
* if you call send operation without serviceId, sdk throw error
|
|
87
|
+
*/
|
|
76
88
|
serviceId: {
|
|
77
|
-
|
|
78
|
-
|
|
89
|
+
kakao: "ncp:kkobizmsg:kr:xxxxxx:your-service-name",
|
|
90
|
+
sms: "ncp:sms:kr:xxxxxx:your-service-name",
|
|
79
91
|
},
|
|
80
92
|
});
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* accessKey, secretKey: https://www.ncloud.com/mypage/manage/authkey
|
|
84
|
-
* serviceId: https://console.ncloud.com/sens/project
|
|
85
|
-
*
|
|
86
|
-
* at least one serviceId required
|
|
87
|
-
* if you call send operation without serviceId, sdk throw error
|
|
88
|
-
*/
|
|
89
93
|
```
|
|
90
94
|
|
|
91
95
|
#### SendAlimtalk
|
|
92
96
|
|
|
93
97
|
```ts
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
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
|
+
],
|
|
110
|
+
});
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
#### ListAlimtalkStatus
|
|
114
|
+
|
|
115
|
+
```ts
|
|
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",
|
|
131
|
+
});
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
#### GetAlimtalkStatus
|
|
135
|
+
|
|
136
|
+
```ts
|
|
137
|
+
const command = new GetAlimtalkStatusCommand({ requestId: "ALIMTALK_REQUEST_ID" });
|
|
100
138
|
```
|
|
101
139
|
|
|
102
140
|
#### SendSMS (SMS, LMS)
|
|
103
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
|
+
|
|
104
149
|
```ts
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
*/
|
|
110
|
-
|
|
111
|
-
from: '01012345678',
|
|
112
|
-
content: DEFAULT_CONTENT,
|
|
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",
|
|
113
156
|
messages: [
|
|
114
|
-
|
|
115
|
-
{ to:
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
157
|
+
/** Uses default message content */
|
|
158
|
+
{ to: "0101111xxxx" },
|
|
159
|
+
|
|
160
|
+
/** Overrides with specific content */
|
|
161
|
+
{ to: "0102222xxxx", content: "CONTENT_01" },
|
|
162
|
+
|
|
163
|
+
/** Overrides content & subject */
|
|
164
|
+
{ to: "0103333xxxx", content: "CONTENT_02", subject: "SUBJECT_01" },
|
|
165
|
+
],
|
|
166
|
+
});
|
|
124
167
|
```
|
|
125
168
|
|
|
126
169
|
#### SendMMS (MMS)
|
|
127
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
|
+
|
|
128
175
|
```ts
|
|
129
|
-
import { readFileSync } from
|
|
176
|
+
import { readFileSync } from "node:fs";
|
|
130
177
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
{
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
files: [ // support jpg, jpeg
|
|
140
|
-
{ 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
|
|
141
186
|
{
|
|
142
|
-
name:
|
|
143
|
-
body
|
|
144
|
-
}
|
|
145
|
-
]
|
|
146
|
-
};
|
|
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);
|
|
187
|
+
name: "custom-image-name.jpg",
|
|
188
|
+
body: readFileSync("/your/absolute/path/sample-image-2.jpg", { encoding: "base64" }),
|
|
189
|
+
},
|
|
190
|
+
],
|
|
191
|
+
});
|
|
152
192
|
```
|
|
153
193
|
|
|
154
194
|
#### Async/await
|
|
@@ -173,6 +213,12 @@ client
|
|
|
173
213
|
.catch((err) => console.dir(err, { depth: 4 }));
|
|
174
214
|
```
|
|
175
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
|
+
|
|
176
222
|
## License
|
|
177
223
|
|
|
178
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,55 +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
|
-
|
|
19
|
-
|
|
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); });
|
|
20
20
|
this.config = {
|
|
21
|
-
credentials:
|
|
22
|
-
serviceId:
|
|
21
|
+
credentials: resolveCredentials(config),
|
|
22
|
+
serviceId: resolveServiceId(config),
|
|
23
23
|
};
|
|
24
|
-
this.requestHandler = new util_http_handler_1.NodeHttpHandler({ connectionTimeout: 3000, socketTimeout: 3000 });
|
|
25
24
|
}
|
|
26
25
|
send(command) {
|
|
27
26
|
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
+
}
|
|
36
39
|
});
|
|
37
40
|
}
|
|
38
41
|
}
|
|
39
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
|
+
};
|
|
40
49
|
const resolveCredentials = (config) => {
|
|
41
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
|
+
});
|
|
42
57
|
if (!credentials)
|
|
43
|
-
throw
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
+
};
|
|
50
71
|
};
|
|
51
72
|
const resolveServiceId = (config) => {
|
|
73
|
+
var _a, _b, _c;
|
|
52
74
|
const { serviceId } = config;
|
|
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 초기화시 서비스 정보를 확인해주세요" }],
|
|
80
|
+
});
|
|
53
81
|
if (!serviceId)
|
|
54
|
-
throw
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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
|
+
}
|
|
60
88
|
return {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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 : "",
|
|
64
92
|
};
|
|
65
93
|
};
|
|
@@ -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.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
|
-
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 Kakao ServiceId",
|
|
29
|
-
});
|
|
30
|
-
let request = yield (0, GetAlimtalkResult_1.serializeIngestkorea_restJson_GetAlimtalkResultCommand)(input, config);
|
|
31
|
-
return request;
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
deserialize(response) {
|
|
35
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
-
let output = yield (0, GetAlimtalkResult_1.deserializeIngestkorea_restJson_GetAlimtalkResultCommand)(response);
|
|
37
|
-
return output;
|
|
38
|
-
});
|
|
9
|
+
this.input = {
|
|
10
|
+
messageId: input.messageId,
|
|
11
|
+
};
|
|
12
|
+
this.serializer = GetAlimtalkResult_js_1.se_GetAlimtalkResultCommand;
|
|
13
|
+
this.deserializer = GetAlimtalkResult_js_1.de_GetAlimtalkResultCommand;
|
|
39
14
|
}
|
|
40
15
|
}
|
|
41
16
|
exports.GetAlimtalkResultCommand = GetAlimtalkResultCommand;
|
|
@@ -1,41 +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 = Object.assign({}, 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, GetAlimtalkStatus_1.serializeIngestkorea_restJson_GetAlimtalkStatusCommand)(input, config);
|
|
31
|
-
return request;
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
deserialize(response) {
|
|
35
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
-
let output = yield (0, GetAlimtalkStatus_1.deserializeIngestkorea_restJson_GetAlimtalkStatusCommand)(response);
|
|
37
|
-
return output;
|
|
38
|
-
});
|
|
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;
|
|
39
15
|
}
|
|
40
16
|
}
|
|
41
17
|
exports.GetAlimtalkStatusCommand = GetAlimtalkStatusCommand;
|
|
@@ -1,41 +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
|
-
this.input =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
code: 400,
|
|
26
|
-
type: "Bad Request",
|
|
27
|
-
message: "Invalid Params",
|
|
28
|
-
description: "Please Check Kakao ServiceId",
|
|
29
|
-
});
|
|
30
|
-
let request = yield (0, GetAlimtalkTemplate_1.serializeIngestkorea_restJson_GetAlimtalkTemplateCommand)(input, config);
|
|
31
|
-
return request;
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
deserialize(response) {
|
|
35
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
-
let output = yield (0, GetAlimtalkTemplate_1.deserializeIngestkorea_restJson_GetAlimtalkTemplateCommand)(response);
|
|
37
|
-
return output;
|
|
38
|
-
});
|
|
9
|
+
this.input = {
|
|
10
|
+
channelId: input.channelId,
|
|
11
|
+
templateCode: input.templateCode,
|
|
12
|
+
};
|
|
13
|
+
this.serializer = GetAlimtalkTemplate_js_1.se_GetAlimtalkTemplateCommand;
|
|
14
|
+
this.deserializer = GetAlimtalkTemplate_js_1.de_GetAlimtalkTemplateCommand;
|
|
39
15
|
}
|
|
40
16
|
}
|
|
41
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;
|