@ingestkorea/client-sens 1.4.3 → 1.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/pull_request_template.md +6 -1
- package/.prettierignore +3 -0
- package/LICENSE +2 -2
- package/README.md +89 -39
- 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 +10 -11
- package/dist-cjs/commands/SendMMSCommand.js +125 -0
- package/dist-cjs/commands/SendSMSCommand.js +43 -41
- package/dist-cjs/commands/constants.js +20 -0
- package/dist-cjs/commands/index.js +1 -0
- package/dist-cjs/middleware/metadata-ingestkorea.js +2 -2
- package/dist-cjs/middleware/signer-ncp.js +3 -7
- 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/SendAlimtalk.js +0 -5
- package/dist-cjs/models/SendMMS.js +2 -0
- package/dist-cjs/models/SendSMS.js +0 -2
- package/dist-cjs/models/SensCommand.js +0 -2
- package/dist-cjs/models/index.js +1 -0
- package/dist-cjs/protocols/GetAlimtalkResult.js +7 -6
- package/dist-cjs/protocols/GetAlimtalkStatus.js +8 -7
- package/dist-cjs/protocols/GetAlimtalkTemplate.js +6 -6
- package/dist-cjs/protocols/GetSMSResult.js +12 -10
- package/dist-cjs/protocols/GetSMSStatus.js +10 -8
- package/dist-cjs/protocols/ListAlimtalkChannels.js +7 -7
- package/dist-cjs/protocols/ListAlimtalkTemplates.js +16 -15
- package/dist-cjs/protocols/SendAlimtalk.js +9 -8
- package/dist-cjs/protocols/SendMMS.js +51 -0
- package/dist-cjs/protocols/SendSMS.js +6 -6
- package/dist-cjs/protocols/constants.js +10 -7
- package/dist-cjs/protocols/index.js +1 -0
- 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 +15 -16
- package/dist-es/commands/SendMMSCommand.js +119 -0
- package/dist-es/commands/SendSMSCommand.js +51 -49
- package/dist-es/commands/constants.js +14 -0
- package/dist-es/commands/index.js +10 -9
- package/dist-es/middleware/index.js +2 -2
- package/dist-es/middleware/metadata-ingestkorea.js +3 -3
- package/dist-es/middleware/signer-ncp.js +7 -11
- 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/SendAlimtalk.js +0 -5
- package/dist-es/models/SendMMS.js +1 -0
- package/dist-es/models/SendSMS.js +0 -2
- package/dist-es/models/SensCommand.js +0 -2
- package/dist-es/models/index.js +11 -10
- package/dist-es/protocols/GetAlimtalkResult.js +10 -9
- package/dist-es/protocols/GetAlimtalkStatus.js +11 -10
- package/dist-es/protocols/GetAlimtalkTemplate.js +10 -10
- package/dist-es/protocols/GetSMSResult.js +14 -12
- package/dist-es/protocols/GetSMSStatus.js +12 -10
- package/dist-es/protocols/ListAlimtalkChannels.js +10 -10
- package/dist-es/protocols/ListAlimtalkTemplates.js +19 -18
- package/dist-es/protocols/SendAlimtalk.js +12 -11
- package/dist-es/protocols/SendMMS.js +47 -0
- package/dist-es/protocols/SendSMS.js +9 -9
- package/dist-es/protocols/constants.js +12 -9
- package/dist-es/protocols/index.js +10 -9
- package/dist-types/commands/GetAlimtalkResultCommand.d.ts +3 -3
- package/dist-types/commands/GetAlimtalkStatusCommand.d.ts +3 -3
- package/dist-types/commands/GetAlimtalkTemplateCommand.d.ts +3 -3
- package/dist-types/commands/GetSMSResultCommand.d.ts +3 -3
- package/dist-types/commands/GetSMSStatusCommand.d.ts +3 -3
- package/dist-types/commands/ListAlimtalkChannelsCommand.d.ts +3 -3
- package/dist-types/commands/ListAlimtalkTemplatesCommand.d.ts +3 -3
- package/dist-types/commands/SendAlimtalkCommand.d.ts +3 -3
- package/dist-types/commands/SendMMSCommand.d.ts +13 -0
- package/dist-types/commands/SendSMSCommand.d.ts +3 -3
- package/dist-types/commands/constants.d.ts +7 -0
- package/dist-types/commands/index.d.ts +10 -9
- package/dist-types/middleware/index.d.ts +2 -2
- package/dist-types/middleware/metadata-ingestkorea.d.ts +2 -2
- package/dist-types/middleware/signer-ncp.d.ts +2 -2
- 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/SendMMS.d.ts +10 -0
- package/dist-types/models/SendSMS.d.ts +3 -3
- package/dist-types/models/SensCommand.d.ts +1 -1
- package/dist-types/models/index.d.ts +11 -10
- package/dist-types/protocols/GetAlimtalkResult.d.ts +4 -4
- package/dist-types/protocols/GetAlimtalkStatus.d.ts +4 -4
- package/dist-types/protocols/GetAlimtalkTemplate.d.ts +4 -4
- package/dist-types/protocols/GetSMSResult.d.ts +4 -4
- package/dist-types/protocols/GetSMSStatus.d.ts +4 -4
- package/dist-types/protocols/ListAlimtalkChannels.d.ts +4 -4
- package/dist-types/protocols/ListAlimtalkTemplates.d.ts +4 -4
- package/dist-types/protocols/SendAlimtalk.d.ts +4 -4
- package/dist-types/protocols/SendMMS.d.ts +7 -0
- package/dist-types/protocols/SendSMS.d.ts +4 -4
- package/dist-types/protocols/constants.d.ts +1 -1
- package/dist-types/protocols/index.d.ts +10 -9
- package/package.json +5 -5
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
### Issue
|
|
2
|
+
|
|
2
3
|
Issue number, if available, prefixed with "#"
|
|
3
4
|
|
|
4
5
|
### Description
|
|
6
|
+
|
|
5
7
|
What does this implement/fix? Explain your changes.
|
|
6
8
|
|
|
7
9
|
### Testing
|
|
10
|
+
|
|
8
11
|
How was this change tested?
|
|
9
12
|
|
|
10
13
|
### Additional context
|
|
14
|
+
|
|
11
15
|
Add any other context about the PR here.
|
|
12
16
|
|
|
13
17
|
---
|
|
14
|
-
|
|
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/.prettierignore
ADDED
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
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
# @ingestkorea/client-sens
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@ingestkorea/client-sens)
|
|
4
|
-
[](https://www.npmjs.com/package/@ingestkorea/client-sens)
|
|
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,77 +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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
|
|
33
|
+
- SendAlimtalk
|
|
34
|
+
- GetAlimtalkStatus
|
|
35
|
+
- GetAlimtalkResult
|
|
36
|
+
- GetAlimtalkTemplate
|
|
37
|
+
- ListAlimtalkTemplates
|
|
38
|
+
- ListAlimtalkChannels
|
|
39
|
+
|
|
40
|
+
#### SMS, LMS, MMS
|
|
41
|
+
|
|
42
|
+
- SendSMS (SMS, LMS)
|
|
43
|
+
- SendMMS (MMS)
|
|
44
|
+
- GetSMSStatus (SMS, LMS, MMS)
|
|
45
|
+
- GetSMSResult (SMS, LMS, MMS)
|
|
38
46
|
|
|
39
47
|
### Import
|
|
48
|
+
|
|
40
49
|
```ts
|
|
41
50
|
import {
|
|
42
51
|
SensClient,
|
|
43
|
-
SendAlimtalkCommand,
|
|
44
|
-
|
|
45
|
-
|
|
52
|
+
SendAlimtalkCommand,
|
|
53
|
+
SendAlimtalkCommandInput,
|
|
54
|
+
SendSMSCommand,
|
|
55
|
+
SendSMSCommandInput,
|
|
56
|
+
SendMMSCommand,
|
|
57
|
+
SendMMSCommandInput,
|
|
58
|
+
} from "@ingestkorea/client-sens";
|
|
46
59
|
```
|
|
47
60
|
|
|
48
61
|
### Usage
|
|
62
|
+
|
|
49
63
|
To send a request, you:
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
64
|
+
|
|
65
|
+
- Initiate client with configuration.
|
|
66
|
+
- Initiate command with input parameters.
|
|
67
|
+
- Call `send` operation on client with command object as input.
|
|
53
68
|
|
|
54
69
|
```ts
|
|
55
70
|
// a client can be shared by different commands.
|
|
56
71
|
const client = new SensClient({
|
|
57
72
|
credentials: {
|
|
58
73
|
accessKey: ACCESS_KEY,
|
|
59
|
-
secretKey: SECRET_KEY
|
|
74
|
+
secretKey: SECRET_KEY,
|
|
60
75
|
},
|
|
61
76
|
serviceId: {
|
|
62
|
-
sms:
|
|
63
|
-
kakao:
|
|
64
|
-
}
|
|
77
|
+
sms: "ncp:sms:kr:123456789xxx:your-service-name", // optional
|
|
78
|
+
kakao: "ncp:kkobizmsg:kr:9876xxx:your-service-name", // optional
|
|
79
|
+
},
|
|
65
80
|
});
|
|
66
81
|
|
|
67
82
|
/**
|
|
68
83
|
* accessKey, secretKey: https://www.ncloud.com/mypage/manage/authkey
|
|
69
84
|
* serviceId: https://console.ncloud.com/sens/project
|
|
70
|
-
*
|
|
85
|
+
*
|
|
71
86
|
* at least one serviceId required
|
|
72
87
|
* if you call send operation without serviceId, sdk throw error
|
|
73
88
|
*/
|
|
74
89
|
```
|
|
75
90
|
|
|
76
91
|
#### SendAlimtalk
|
|
92
|
+
|
|
77
93
|
```ts
|
|
78
94
|
let params: SendAlimtalkCommandInput = {
|
|
79
95
|
plusFriendId: PLUS_FRIEND_ID,
|
|
80
96
|
templateCode: TEMPLATE_CODE,
|
|
81
|
-
messages: [
|
|
82
|
-
{ to: '01012345678', content: CONTENT }
|
|
83
|
-
]
|
|
97
|
+
messages: [{ to: "01012345678", content: CONTENT }],
|
|
84
98
|
};
|
|
85
99
|
let command = new SendAlimtalkCommand(params);
|
|
86
100
|
```
|
|
87
101
|
|
|
88
|
-
#### SendSMS
|
|
102
|
+
#### SendSMS (SMS, LMS)
|
|
103
|
+
|
|
89
104
|
```ts
|
|
90
105
|
/**
|
|
91
106
|
* Automatically set message type('SMS' | 'LMS') according to content-length(euc-kr)
|
|
@@ -96,33 +111,68 @@ let params: SendSMSCommandInput = {
|
|
|
96
111
|
from: '01012345678',
|
|
97
112
|
content: DEFAULT_CONTENT,
|
|
98
113
|
messages: [
|
|
114
|
+
{ to: '0109182xxxx' },
|
|
115
|
+
{ to: '0104321xxxx', content?: OPTIONAL_CONTENT_01 }
|
|
116
|
+
{ to: '0108765xxxx', content?: OPTIONAL_CONTENT_02, subject?: OPTIONAL_SUBJECT_01 },
|
|
117
|
+
]
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* If you do not define the subject and content within the messages,
|
|
121
|
+
* it is sent with the value specified as the default subject('제목없음') and content.
|
|
122
|
+
*/
|
|
123
|
+
let command = new SendSMSCommand(params);
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
#### SendMMS (MMS)
|
|
127
|
+
|
|
128
|
+
```ts
|
|
129
|
+
import { readFileSync } from 'node:fs';
|
|
130
|
+
|
|
131
|
+
let params: SendMMSCommandInput = {
|
|
132
|
+
from: '01012345678',
|
|
133
|
+
content: DEFAULT_CONTENT,
|
|
134
|
+
messages: [
|
|
135
|
+
{ to: '0109182xxxx' },
|
|
136
|
+
{ to: '0104321xxxx', content?: OPTIONAL_CONTENT_01 }
|
|
137
|
+
{ to: '0108765xxxx', content?: OPTIONAL_CONTENT_02, subject?: OPTIONAL_SUBJECT_01 },
|
|
138
|
+
],
|
|
139
|
+
files: [ // support jpg, jpeg
|
|
140
|
+
{ name: '/your/absolute/path/sample-image-1.jpg' },
|
|
99
141
|
{
|
|
100
|
-
|
|
101
|
-
|
|
142
|
+
name: '/your/absolute/path/sample-image-2.jpg',
|
|
143
|
+
body?: readFileSync('/your/absolute/path/sample-image-2.jpg', { encoding: 'base64' })
|
|
102
144
|
}
|
|
103
145
|
]
|
|
104
146
|
};
|
|
105
|
-
|
|
147
|
+
/**
|
|
148
|
+
* If you do not define the subject and content within the messages,
|
|
149
|
+
* it is sent with the value specified as the default subject('제목없음') and content.
|
|
150
|
+
*/
|
|
151
|
+
let command = new SendMMSCommand(params);
|
|
106
152
|
```
|
|
107
153
|
|
|
108
154
|
#### Async/await
|
|
155
|
+
|
|
109
156
|
```ts
|
|
110
157
|
(async () => {
|
|
111
158
|
try {
|
|
112
159
|
const data = await client.send(command);
|
|
113
160
|
console.dir(data, { depth: 4 });
|
|
114
|
-
} catch (err){
|
|
161
|
+
} catch (err) {
|
|
115
162
|
console.dir(err, { depth: 4 });
|
|
116
|
-
}
|
|
163
|
+
}
|
|
117
164
|
})();
|
|
118
165
|
```
|
|
119
166
|
|
|
120
167
|
#### Promises
|
|
168
|
+
|
|
121
169
|
```ts
|
|
122
|
-
client
|
|
123
|
-
.
|
|
124
|
-
.
|
|
170
|
+
client
|
|
171
|
+
.send(command)
|
|
172
|
+
.then((data) => console.dir(data, { depth: 4 }))
|
|
173
|
+
.catch((err) => console.dir(err, { depth: 4 }));
|
|
125
174
|
```
|
|
126
175
|
|
|
127
176
|
## License
|
|
128
|
-
|
|
177
|
+
|
|
178
|
+
This SDK is distributed under the [MIT License](https://opensource.org/licenses/MIT), see LICENSE for more information.
|
|
@@ -13,32 +13,29 @@ exports.GetAlimtalkResultCommand = void 0;
|
|
|
13
13
|
const models_1 = require("../models");
|
|
14
14
|
const GetAlimtalkResult_1 = require("../protocols/GetAlimtalkResult");
|
|
15
15
|
const util_error_handler_1 = require("@ingestkorea/util-error-handler");
|
|
16
|
-
;
|
|
17
|
-
;
|
|
18
16
|
class GetAlimtalkResultCommand extends models_1.SensCommand {
|
|
19
17
|
constructor(input) {
|
|
20
18
|
super(input);
|
|
21
19
|
this.input = Object.assign({}, input);
|
|
22
20
|
}
|
|
23
|
-
;
|
|
24
21
|
serialize(input, config) {
|
|
25
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
26
23
|
if (!config.serviceId.kakao)
|
|
27
24
|
throw new util_error_handler_1.IngestkoreaError({
|
|
28
|
-
code: 400,
|
|
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
|
-
const
|
|
47
|
-
if (message.content.length >
|
|
43
|
+
const ALIMTALK_MAX = 1000;
|
|
44
|
+
if (message.content.length > ALIMTALK_MAX)
|
|
48
45
|
throw new util_error_handler_1.IngestkoreaError({
|
|
49
|
-
code: 400,
|
|
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
|
};
|