@ingestkorea/client-sens 1.5.2 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/pull_request_template.md +6 -1
- package/LICENSE +2 -2
- package/README.md +56 -38
- package/dist-cjs/SensClient.js +12 -12
- package/dist-cjs/commands/GetAlimtalkResultCommand.js +4 -7
- package/dist-cjs/commands/GetAlimtalkStatusCommand.js +4 -7
- package/dist-cjs/commands/GetAlimtalkTemplateCommand.js +4 -7
- package/dist-cjs/commands/GetSMSResultCommand.js +4 -6
- package/dist-cjs/commands/GetSMSStatusCommand.js +4 -6
- package/dist-cjs/commands/ListAlimtalkChannelsCommand.js +4 -7
- package/dist-cjs/commands/ListAlimtalkTemplatesCommand.js +4 -7
- package/dist-cjs/commands/SendAlimtalkCommand.js +8 -9
- package/dist-cjs/commands/SendMMSCommand.js +40 -30
- package/dist-cjs/commands/SendSMSCommand.js +19 -18
- package/dist-cjs/commands/constants.js +2 -2
- package/dist-cjs/middleware/index.js +4 -2
- package/dist-cjs/middleware/{metadata-ingestkorea.js → middleware-metadata.js} +3 -12
- package/dist-cjs/middleware/middleware-retry.js +58 -0
- package/dist-cjs/middleware/{signer-ncp.js → middleware-sign.js} +3 -7
- package/dist-cjs/middleware/middleware-sort-headers.js +25 -0
- package/dist-cjs/models/GetAlimtalkResult.js +0 -3
- package/dist-cjs/models/GetAlimtalkStatus.js +0 -3
- package/dist-cjs/models/GetAlimtalkTemplate.js +0 -2
- package/dist-cjs/models/GetSMSResult.js +0 -4
- package/dist-cjs/models/GetSMSStatus.js +0 -3
- package/dist-cjs/models/ListAlimtalkChannels.js +0 -3
- package/dist-cjs/models/ListAlimtalkTemplates.js +0 -5
- package/dist-cjs/models/MetadataBearer.js +2 -0
- package/dist-cjs/models/Middleware.js +2 -0
- package/dist-cjs/models/SendAlimtalk.js +0 -5
- package/dist-cjs/models/SendMMS.js +0 -2
- package/dist-cjs/models/SendSMS.js +0 -2
- package/dist-cjs/models/SensCommand.js +0 -2
- package/dist-cjs/models/index.js +2 -0
- package/dist-cjs/protocols/GetAlimtalkResult.js +11 -12
- package/dist-cjs/protocols/GetAlimtalkStatus.js +13 -14
- package/dist-cjs/protocols/GetAlimtalkTemplate.js +12 -12
- package/dist-cjs/protocols/GetSMSResult.js +15 -15
- package/dist-cjs/protocols/GetSMSStatus.js +13 -13
- package/dist-cjs/protocols/ListAlimtalkChannels.js +13 -13
- package/dist-cjs/protocols/ListAlimtalkTemplates.js +22 -21
- package/dist-cjs/protocols/SendAlimtalk.js +13 -14
- package/dist-cjs/protocols/SendMMS.js +11 -11
- package/dist-cjs/protocols/SendSMS.js +11 -11
- package/dist-cjs/protocols/constants.js +17 -8
- package/dist-es/SensClient.js +15 -15
- package/dist-es/commands/GetAlimtalkResultCommand.js +8 -11
- package/dist-es/commands/GetAlimtalkStatusCommand.js +8 -11
- package/dist-es/commands/GetAlimtalkTemplateCommand.js +8 -11
- package/dist-es/commands/GetSMSResultCommand.js +8 -10
- package/dist-es/commands/GetSMSStatusCommand.js +8 -10
- package/dist-es/commands/ListAlimtalkChannelsCommand.js +8 -11
- package/dist-es/commands/ListAlimtalkTemplatesCommand.js +8 -11
- package/dist-es/commands/SendAlimtalkCommand.js +13 -14
- package/dist-es/commands/SendMMSCommand.js +48 -38
- package/dist-es/commands/SendSMSCommand.js +23 -22
- package/dist-es/commands/constants.js +2 -2
- package/dist-es/commands/index.js +10 -10
- package/dist-es/index.js +2 -2
- package/dist-es/middleware/index.js +4 -2
- package/dist-es/middleware/middleware-metadata.js +6 -0
- package/dist-es/middleware/middleware-retry.js +51 -0
- package/dist-es/middleware/{signer-ncp.js → middleware-sign.js} +7 -11
- package/dist-es/middleware/middleware-sort-headers.js +12 -0
- package/dist-es/models/GetAlimtalkResult.js +0 -3
- package/dist-es/models/GetAlimtalkStatus.js +0 -3
- package/dist-es/models/GetAlimtalkTemplate.js +0 -2
- package/dist-es/models/GetSMSResult.js +0 -4
- package/dist-es/models/GetSMSStatus.js +0 -3
- package/dist-es/models/ListAlimtalkChannels.js +0 -3
- package/dist-es/models/ListAlimtalkTemplates.js +0 -5
- package/dist-es/models/MetadataBearer.js +1 -0
- package/dist-es/models/Middleware.js +1 -0
- package/dist-es/models/SendAlimtalk.js +0 -5
- package/dist-es/models/SendMMS.js +0 -2
- package/dist-es/models/SendSMS.js +0 -2
- package/dist-es/models/SensCommand.js +0 -2
- package/dist-es/models/index.js +13 -11
- package/dist-es/protocols/GetAlimtalkResult.js +18 -15
- package/dist-es/protocols/GetAlimtalkStatus.js +20 -17
- package/dist-es/protocols/GetAlimtalkTemplate.js +20 -16
- package/dist-es/protocols/GetSMSResult.js +22 -18
- package/dist-es/protocols/GetSMSStatus.js +20 -16
- package/dist-es/protocols/ListAlimtalkChannels.js +20 -16
- package/dist-es/protocols/ListAlimtalkTemplates.js +29 -24
- package/dist-es/protocols/SendAlimtalk.js +20 -17
- package/dist-es/protocols/SendMMS.js +18 -14
- package/dist-es/protocols/SendSMS.js +19 -15
- package/dist-es/protocols/constants.js +17 -9
- package/dist-es/protocols/index.js +10 -10
- package/dist-types/SensClient.d.ts +2 -2
- package/dist-types/commands/GetAlimtalkResultCommand.d.ts +8 -5
- package/dist-types/commands/GetAlimtalkStatusCommand.d.ts +8 -5
- package/dist-types/commands/GetAlimtalkTemplateCommand.d.ts +8 -5
- package/dist-types/commands/GetSMSResultCommand.d.ts +8 -5
- package/dist-types/commands/GetSMSStatusCommand.d.ts +8 -5
- package/dist-types/commands/ListAlimtalkChannelsCommand.d.ts +8 -5
- package/dist-types/commands/ListAlimtalkTemplatesCommand.d.ts +8 -5
- package/dist-types/commands/SendAlimtalkCommand.d.ts +8 -5
- package/dist-types/commands/SendMMSCommand.d.ts +8 -5
- package/dist-types/commands/SendSMSCommand.d.ts +8 -5
- package/dist-types/commands/index.d.ts +10 -10
- package/dist-types/index.d.ts +2 -2
- package/dist-types/middleware/index.d.ts +4 -2
- package/dist-types/middleware/middleware-metadata.d.ts +2 -0
- package/dist-types/middleware/middleware-retry.d.ts +2 -0
- package/dist-types/middleware/middleware-sign.d.ts +2 -0
- package/dist-types/middleware/middleware-sort-headers.d.ts +2 -0
- package/dist-types/models/GetAlimtalkResult.d.ts +1 -1
- package/dist-types/models/GetAlimtalkStatus.d.ts +1 -1
- package/dist-types/models/GetAlimtalkTemplate.d.ts +1 -1
- package/dist-types/models/MetadataBearer.d.ts +8 -0
- package/dist-types/models/Middleware.d.ts +12 -0
- package/dist-types/models/SendMMS.d.ts +1 -1
- package/dist-types/models/SendSMS.d.ts +3 -3
- package/dist-types/models/SensCommand.d.ts +6 -2
- package/dist-types/models/index.d.ts +13 -11
- package/dist-types/protocols/GetAlimtalkResult.d.ts +8 -5
- package/dist-types/protocols/GetAlimtalkStatus.d.ts +8 -5
- package/dist-types/protocols/GetAlimtalkTemplate.d.ts +8 -5
- package/dist-types/protocols/GetSMSResult.d.ts +8 -5
- package/dist-types/protocols/GetSMSStatus.d.ts +8 -5
- package/dist-types/protocols/ListAlimtalkChannels.d.ts +8 -5
- package/dist-types/protocols/ListAlimtalkTemplates.d.ts +8 -5
- package/dist-types/protocols/SendAlimtalk.d.ts +8 -5
- package/dist-types/protocols/SendMMS.d.ts +8 -5
- package/dist-types/protocols/SendSMS.d.ts +8 -5
- package/dist-types/protocols/constants.d.ts +3 -1
- package/dist-types/protocols/index.d.ts +10 -10
- package/package.json +4 -3
- package/dist-es/middleware/metadata-ingestkorea.js +0 -19
- package/dist-types/middleware/metadata-ingestkorea.d.ts +0 -3
- package/dist-types/middleware/signer-ncp.d.ts +0 -3
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
### Issue
|
|
2
|
+
|
|
2
3
|
Issue number, if available, prefixed with "#"
|
|
3
4
|
|
|
4
5
|
### Description
|
|
6
|
+
|
|
5
7
|
What does this implement/fix? Explain your changes.
|
|
6
8
|
|
|
7
9
|
### Testing
|
|
10
|
+
|
|
8
11
|
How was this change tested?
|
|
9
12
|
|
|
10
13
|
### Additional context
|
|
14
|
+
|
|
11
15
|
Add any other context about the PR here.
|
|
12
16
|
|
|
13
17
|
---
|
|
14
|
-
|
|
18
|
+
|
|
19
|
+
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
|
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2024 INGESTKOREA LLC.
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
18
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -3,11 +3,14 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/@ingestkorea/client-sens)
|
|
4
4
|
[](https://www.npmjs.com/package/@ingestkorea/client-sens)
|
|
5
5
|

|
|
6
|
+
[](https://www.npmjs.com/package/@ingestkorea/client-sens)
|
|
6
7
|
|
|
7
8
|
## Description
|
|
9
|
+
|
|
8
10
|
INGESTKOREA SDK Naver Cloud Platform SENS Client for Node.js.
|
|
9
11
|
|
|
10
12
|
## Installing
|
|
13
|
+
|
|
11
14
|
```sh
|
|
12
15
|
npm install @ingestkorea/client-sens
|
|
13
16
|
```
|
|
@@ -15,79 +18,89 @@ npm install @ingestkorea/client-sens
|
|
|
15
18
|
## Getting Started
|
|
16
19
|
|
|
17
20
|
### Pre-requisites
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
|
|
33
|
+
- SendAlimtalk
|
|
34
|
+
- GetAlimtalkStatus
|
|
35
|
+
- GetAlimtalkResult
|
|
36
|
+
- GetAlimtalkTemplate
|
|
37
|
+
- ListAlimtalkTemplates
|
|
38
|
+
- ListAlimtalkChannels
|
|
33
39
|
|
|
34
40
|
#### SMS, LMS, MMS
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
41
|
+
|
|
42
|
+
- SendSMS (SMS, LMS)
|
|
43
|
+
- SendMMS (MMS)
|
|
44
|
+
- GetSMSStatus (SMS, LMS, MMS)
|
|
45
|
+
- GetSMSResult (SMS, LMS, MMS)
|
|
39
46
|
|
|
40
47
|
### Import
|
|
48
|
+
|
|
41
49
|
```ts
|
|
42
50
|
import {
|
|
43
51
|
SensClient,
|
|
44
|
-
SendAlimtalkCommand,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
52
|
+
SendAlimtalkCommand,
|
|
53
|
+
SendAlimtalkCommandInput,
|
|
54
|
+
SendSMSCommand,
|
|
55
|
+
SendSMSCommandInput,
|
|
56
|
+
SendMMSCommand,
|
|
57
|
+
SendMMSCommandInput,
|
|
58
|
+
} from "@ingestkorea/client-sens";
|
|
48
59
|
```
|
|
49
60
|
|
|
50
61
|
### Usage
|
|
62
|
+
|
|
51
63
|
To send a request, you:
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
64
|
+
|
|
65
|
+
- Initiate client with configuration.
|
|
66
|
+
- Initiate command with input parameters.
|
|
67
|
+
- Call `send` operation on client with command object as input.
|
|
55
68
|
|
|
56
69
|
```ts
|
|
57
70
|
// a client can be shared by different commands.
|
|
58
71
|
const client = new SensClient({
|
|
59
72
|
credentials: {
|
|
60
73
|
accessKey: ACCESS_KEY,
|
|
61
|
-
secretKey: SECRET_KEY
|
|
74
|
+
secretKey: SECRET_KEY,
|
|
62
75
|
},
|
|
63
76
|
serviceId: {
|
|
64
|
-
sms:
|
|
65
|
-
kakao:
|
|
66
|
-
}
|
|
77
|
+
sms: "ncp:sms:kr:123456789xxx:your-service-name", // optional
|
|
78
|
+
kakao: "ncp:kkobizmsg:kr:9876xxx:your-service-name", // optional
|
|
79
|
+
},
|
|
67
80
|
});
|
|
68
81
|
|
|
69
82
|
/**
|
|
70
83
|
* accessKey, secretKey: https://www.ncloud.com/mypage/manage/authkey
|
|
71
84
|
* serviceId: https://console.ncloud.com/sens/project
|
|
72
|
-
*
|
|
85
|
+
*
|
|
73
86
|
* at least one serviceId required
|
|
74
87
|
* if you call send operation without serviceId, sdk throw error
|
|
75
88
|
*/
|
|
76
89
|
```
|
|
77
90
|
|
|
78
91
|
#### SendAlimtalk
|
|
92
|
+
|
|
79
93
|
```ts
|
|
80
94
|
let params: SendAlimtalkCommandInput = {
|
|
81
95
|
plusFriendId: PLUS_FRIEND_ID,
|
|
82
96
|
templateCode: TEMPLATE_CODE,
|
|
83
|
-
messages: [
|
|
84
|
-
{ to: '01012345678', content: CONTENT }
|
|
85
|
-
]
|
|
97
|
+
messages: [{ to: "01012345678", content: CONTENT }],
|
|
86
98
|
};
|
|
87
99
|
let command = new SendAlimtalkCommand(params);
|
|
88
100
|
```
|
|
89
101
|
|
|
90
102
|
#### SendSMS (SMS, LMS)
|
|
103
|
+
|
|
91
104
|
```ts
|
|
92
105
|
/**
|
|
93
106
|
* Automatically set message type('SMS' | 'LMS') according to content-length(euc-kr)
|
|
@@ -103,14 +116,15 @@ let params: SendSMSCommandInput = {
|
|
|
103
116
|
{ to: '0108765xxxx', content?: OPTIONAL_CONTENT_02, subject?: OPTIONAL_SUBJECT_01 },
|
|
104
117
|
]
|
|
105
118
|
};
|
|
106
|
-
/**
|
|
107
|
-
* If you do not define the subject and content within the messages,
|
|
119
|
+
/**
|
|
120
|
+
* If you do not define the subject and content within the messages,
|
|
108
121
|
* it is sent with the value specified as the default subject('제목없음') and content.
|
|
109
122
|
*/
|
|
110
123
|
let command = new SendSMSCommand(params);
|
|
111
124
|
```
|
|
112
125
|
|
|
113
126
|
#### SendMMS (MMS)
|
|
127
|
+
|
|
114
128
|
```ts
|
|
115
129
|
import { readFileSync } from 'node:fs';
|
|
116
130
|
|
|
@@ -125,36 +139,40 @@ let params: SendMMSCommandInput = {
|
|
|
125
139
|
files: [ // support jpg, jpeg
|
|
126
140
|
{ name: '/your/absolute/path/sample-image-1.jpg' },
|
|
127
141
|
{
|
|
128
|
-
name: '/your/absolute/path/sample-image-2.jpg',
|
|
142
|
+
name: '/your/absolute/path/sample-image-2.jpg',
|
|
129
143
|
body?: readFileSync('/your/absolute/path/sample-image-2.jpg', { encoding: 'base64' })
|
|
130
144
|
}
|
|
131
145
|
]
|
|
132
146
|
};
|
|
133
|
-
/**
|
|
134
|
-
* If you do not define the subject and content within the messages,
|
|
147
|
+
/**
|
|
148
|
+
* If you do not define the subject and content within the messages,
|
|
135
149
|
* it is sent with the value specified as the default subject('제목없음') and content.
|
|
136
150
|
*/
|
|
137
151
|
let command = new SendMMSCommand(params);
|
|
138
152
|
```
|
|
139
153
|
|
|
140
154
|
#### Async/await
|
|
155
|
+
|
|
141
156
|
```ts
|
|
142
157
|
(async () => {
|
|
143
158
|
try {
|
|
144
159
|
const data = await client.send(command);
|
|
145
160
|
console.dir(data, { depth: 4 });
|
|
146
|
-
} catch (err){
|
|
161
|
+
} catch (err) {
|
|
147
162
|
console.dir(err, { depth: 4 });
|
|
148
|
-
}
|
|
163
|
+
}
|
|
149
164
|
})();
|
|
150
165
|
```
|
|
151
166
|
|
|
152
167
|
#### Promises
|
|
168
|
+
|
|
153
169
|
```ts
|
|
154
|
-
client
|
|
155
|
-
.
|
|
156
|
-
.
|
|
170
|
+
client
|
|
171
|
+
.send(command)
|
|
172
|
+
.then((data) => console.dir(data, { depth: 4 }))
|
|
173
|
+
.catch((err) => console.dir(err, { depth: 4 }));
|
|
157
174
|
```
|
|
158
175
|
|
|
159
176
|
## License
|
|
160
|
-
|
|
177
|
+
|
|
178
|
+
This SDK is distributed under the [MIT License](https://opensource.org/licenses/MIT), see LICENSE for more information.
|
package/dist-cjs/SensClient.js
CHANGED
|
@@ -13,40 +13,38 @@ exports.SensClient = void 0;
|
|
|
13
13
|
const util_http_handler_1 = require("@ingestkorea/util-http-handler");
|
|
14
14
|
const util_error_handler_1 = require("@ingestkorea/util-error-handler");
|
|
15
15
|
const middleware_1 = require("./middleware");
|
|
16
|
-
;
|
|
17
|
-
;
|
|
18
16
|
class SensClient {
|
|
19
17
|
constructor(config) {
|
|
20
18
|
const resolvedCredentials = resolveCredentials(config);
|
|
21
19
|
const resolvedServiceId = resolveServiceId(config);
|
|
22
20
|
this.config = {
|
|
23
21
|
credentials: Object.assign({}, resolvedCredentials),
|
|
24
|
-
serviceId: Object.assign({}, resolvedServiceId)
|
|
22
|
+
serviceId: Object.assign({}, resolvedServiceId),
|
|
25
23
|
};
|
|
26
24
|
this.requestHandler = new util_http_handler_1.NodeHttpHandler({ connectionTimeout: 3000, socketTimeout: 3000 });
|
|
27
25
|
}
|
|
28
|
-
;
|
|
29
26
|
send(command) {
|
|
30
27
|
return __awaiter(this, void 0, void 0, function* () {
|
|
31
28
|
let input = command.input;
|
|
32
29
|
let request = yield command.serialize(input, this.config);
|
|
33
30
|
request = yield (0, middleware_1.middlewareNcpSigner)(request, this.config);
|
|
34
31
|
request = yield (0, middleware_1.middlewareIngestkoreaMetadata)(request, this.config);
|
|
35
|
-
|
|
32
|
+
request = yield (0, middleware_1.middlewareSortHeaders)(request, this.config);
|
|
33
|
+
let response = yield (0, middleware_1.middlewareRetry)(request, this.config, this.requestHandler);
|
|
36
34
|
let output = yield command.deserialize(response);
|
|
37
35
|
return output;
|
|
38
36
|
});
|
|
39
37
|
}
|
|
40
|
-
;
|
|
41
38
|
}
|
|
42
39
|
exports.SensClient = SensClient;
|
|
43
|
-
;
|
|
44
40
|
const resolveCredentials = (config) => {
|
|
45
41
|
const { credentials } = config;
|
|
46
42
|
if (!credentials)
|
|
47
43
|
throw new util_error_handler_1.IngestkoreaError({
|
|
48
|
-
code: 401,
|
|
49
|
-
|
|
44
|
+
code: 401,
|
|
45
|
+
type: "Unauthorized",
|
|
46
|
+
message: "Invalid Credentials",
|
|
47
|
+
description: "Invalid Credentials",
|
|
50
48
|
});
|
|
51
49
|
return credentials;
|
|
52
50
|
};
|
|
@@ -54,12 +52,14 @@ const resolveServiceId = (config) => {
|
|
|
54
52
|
const { serviceId } = config;
|
|
55
53
|
if (!serviceId)
|
|
56
54
|
throw new util_error_handler_1.IngestkoreaError({
|
|
57
|
-
code: 401,
|
|
58
|
-
|
|
55
|
+
code: 401,
|
|
56
|
+
type: "Unauthorized",
|
|
57
|
+
message: "Invalid Credentials",
|
|
58
|
+
description: "Invalid ServiceId",
|
|
59
59
|
});
|
|
60
60
|
return {
|
|
61
61
|
push: serviceId.push != undefined ? serviceId.push : undefined,
|
|
62
62
|
sms: serviceId.sms != undefined ? serviceId.sms : undefined,
|
|
63
|
-
kakao: serviceId.kakao != undefined ? serviceId.kakao : undefined
|
|
63
|
+
kakao: serviceId.kakao != undefined ? serviceId.kakao : undefined,
|
|
64
64
|
};
|
|
65
65
|
};
|
|
@@ -13,32 +13,29 @@ exports.GetAlimtalkResultCommand = void 0;
|
|
|
13
13
|
const models_1 = require("../models");
|
|
14
14
|
const GetAlimtalkResult_1 = require("../protocols/GetAlimtalkResult");
|
|
15
15
|
const util_error_handler_1 = require("@ingestkorea/util-error-handler");
|
|
16
|
-
;
|
|
17
|
-
;
|
|
18
16
|
class GetAlimtalkResultCommand extends models_1.SensCommand {
|
|
19
17
|
constructor(input) {
|
|
20
18
|
super(input);
|
|
21
19
|
this.input = Object.assign({}, input);
|
|
22
20
|
}
|
|
23
|
-
;
|
|
24
21
|
serialize(input, config) {
|
|
25
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
26
23
|
if (!config.serviceId.kakao)
|
|
27
24
|
throw new util_error_handler_1.IngestkoreaError({
|
|
28
|
-
code: 400,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
25
|
+
code: 400,
|
|
26
|
+
type: "Bad Request",
|
|
27
|
+
message: "Invalid Params",
|
|
28
|
+
description: "Please Check Kakao ServiceId",
|
|
29
29
|
});
|
|
30
30
|
let request = yield (0, SendAlimtalk_1.serializeIngestkorea_restJson_SendAlimtalkCommand)(input, config);
|
|
31
31
|
return request;
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
|
-
;
|
|
35
34
|
deserialize(response) {
|
|
36
35
|
return __awaiter(this, void 0, void 0, function* () {
|
|
37
36
|
let output = yield (0, SendAlimtalk_1.deserializeIngestkorea_restJson_SendAlimtalkCommand)(response);
|
|
38
37
|
return output;
|
|
39
38
|
});
|
|
40
39
|
}
|
|
41
|
-
;
|
|
42
40
|
}
|
|
43
41
|
exports.SendAlimtalkCommand = SendAlimtalkCommand;
|
|
44
|
-
;
|
|
45
42
|
const resolveAlimtalkMessage = (message) => {
|
|
46
43
|
const ALIMTALK_MAX = 1000;
|
|
47
44
|
if (message.content.length > ALIMTALK_MAX)
|
|
48
45
|
throw new util_error_handler_1.IngestkoreaError({
|
|
49
|
-
code: 400,
|
|
50
|
-
|
|
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
|
};
|