@ingestkorea/client-sens 1.0.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.
Files changed (66) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +83 -0
  3. package/dist-cjs/SensClient.js +60 -0
  4. package/dist-cjs/commands/GetRequestResultCommand.js +39 -0
  5. package/dist-cjs/commands/GetRequestStatusCommand.js +39 -0
  6. package/dist-cjs/commands/ListChannelsCommand.js +39 -0
  7. package/dist-cjs/commands/SendAlimtalkCommand.js +39 -0
  8. package/dist-cjs/commands/index.js +20 -0
  9. package/dist-cjs/index.js +18 -0
  10. package/dist-cjs/middleware/index.js +17 -0
  11. package/dist-cjs/middleware/signer.js +31 -0
  12. package/dist-cjs/models/GetRequestResult.js +5 -0
  13. package/dist-cjs/models/GetRequestStatus.js +5 -0
  14. package/dist-cjs/models/ListChannels.js +5 -0
  15. package/dist-cjs/models/SendAlimtalk.js +7 -0
  16. package/dist-cjs/models/SensCommand.js +11 -0
  17. package/dist-cjs/models/index.js +21 -0
  18. package/dist-cjs/protocols/GetRequestResult.js +77 -0
  19. package/dist-cjs/protocols/GetRequestStatus.js +76 -0
  20. package/dist-cjs/protocols/ListChannels.js +60 -0
  21. package/dist-cjs/protocols/SendAlimtalk.js +73 -0
  22. package/dist-cjs/protocols/constants.js +55 -0
  23. package/dist-cjs/protocols/index.js +20 -0
  24. package/dist-es/SensClient.js +45 -0
  25. package/dist-es/commands/GetRequestResultCommand.js +24 -0
  26. package/dist-es/commands/GetRequestStatusCommand.js +24 -0
  27. package/dist-es/commands/ListChannelsCommand.js +24 -0
  28. package/dist-es/commands/SendAlimtalkCommand.js +24 -0
  29. package/dist-es/commands/index.js +4 -0
  30. package/dist-es/index.js +2 -0
  31. package/dist-es/middleware/index.js +1 -0
  32. package/dist-es/middleware/signer.js +23 -0
  33. package/dist-es/models/GetRequestResult.js +4 -0
  34. package/dist-es/models/GetRequestStatus.js +4 -0
  35. package/dist-es/models/ListChannels.js +4 -0
  36. package/dist-es/models/SendAlimtalk.js +6 -0
  37. package/dist-es/models/SensCommand.js +7 -0
  38. package/dist-es/models/index.js +5 -0
  39. package/dist-es/protocols/GetRequestResult.js +63 -0
  40. package/dist-es/protocols/GetRequestStatus.js +62 -0
  41. package/dist-es/protocols/ListChannels.js +46 -0
  42. package/dist-es/protocols/SendAlimtalk.js +59 -0
  43. package/dist-es/protocols/constants.js +41 -0
  44. package/dist-es/protocols/index.js +4 -0
  45. package/dist-types/SensClient.d.ts +21 -0
  46. package/dist-types/commands/GetRequestResultCommand.d.ts +13 -0
  47. package/dist-types/commands/GetRequestStatusCommand.d.ts +13 -0
  48. package/dist-types/commands/ListChannelsCommand.d.ts +13 -0
  49. package/dist-types/commands/SendAlimtalkCommand.d.ts +13 -0
  50. package/dist-types/commands/index.d.ts +4 -0
  51. package/dist-types/index.d.ts +2 -0
  52. package/dist-types/middleware/index.d.ts +1 -0
  53. package/dist-types/middleware/signer.d.ts +3 -0
  54. package/dist-types/models/GetRequestResult.d.ts +20 -0
  55. package/dist-types/models/GetRequestStatus.d.ts +19 -0
  56. package/dist-types/models/ListChannels.d.ts +14 -0
  57. package/dist-types/models/SendAlimtalk.d.ts +33 -0
  58. package/dist-types/models/SensCommand.d.ts +7 -0
  59. package/dist-types/models/index.d.ts +5 -0
  60. package/dist-types/protocols/GetRequestResult.d.ts +8 -0
  61. package/dist-types/protocols/GetRequestStatus.d.ts +8 -0
  62. package/dist-types/protocols/ListChannels.d.ts +8 -0
  63. package/dist-types/protocols/SendAlimtalk.d.ts +8 -0
  64. package/dist-types/protocols/constants.d.ts +3 -0
  65. package/dist-types/protocols/index.d.ts +4 -0
  66. package/package.json +33 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 INGESTKOREA LLC.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,83 @@
1
+ # @ingestkorea/client-sens
2
+
3
+ [![npm (scoped)](https://img.shields.io/npm/v/@ingestkorea/client-sens?style=flat-square)](https://www.npmjs.com/package/@ingestkorea/client-sens)
4
+ [![NPM downloads](https://img.shields.io/npm/dm/@ingestkorea/client-sens?style=flat-square)](https://www.npmjs.com/package/@ingestkorea/client-sens)
5
+
6
+ ## Description
7
+ INGESTKOREA SDK NCP SENS Client for Node.js.
8
+
9
+ ## Installing
10
+ ```sh
11
+ npm install @ingestkorea/client-sens
12
+ ```
13
+
14
+ ## Getting Started
15
+
16
+ ### Pre-requisites
17
+ + Use TypeScript v4.x
18
+ + Includes the TypeScript definitions for node.
19
+ ```sh
20
+ npm install -D @types/node # save dev mode
21
+ ```
22
+
23
+ ### Support Methods
24
+ + SendAlimtalk
25
+ + GetRequestStatus
26
+ + GetRequestResult
27
+ + ListChannels
28
+
29
+ ### Import
30
+ ```ts
31
+ import {
32
+ SensClient,
33
+ SendAlimtalkCommand, SendAlimtalkCommandInput
34
+ } from '@ingestkorea/client-sens';
35
+ ```
36
+
37
+ ### Usage
38
+ To send a request, you:
39
+ + Initiate client with configuration.
40
+ + Initiate command with input parameters.
41
+ + Call `send` operation on client with command object as input.
42
+
43
+ ```ts
44
+ // a client can be shared by different commands.
45
+ const client = new SensClient({
46
+ credentials: {
47
+ accessKey: ACCESS_KEY,
48
+ secretKey: SECRET_KEY
49
+ },
50
+ serviceId: 'ncp:kkobizmsg:kr:1234567:your-service-name'
51
+ });
52
+
53
+ let params: SendAlimtalkCommandInput = {
54
+ plusFriendId: PLUS_FRIEND_ID,
55
+ templateCode: TEMPLATE_CODE,
56
+ messages: [
57
+ { to: '01012345678', content: CONTENT }
58
+ ]
59
+ };
60
+ let command = new SendAlimtalkCommand(params);
61
+ ```
62
+
63
+ #### Async/await
64
+ ```ts
65
+ (async () => {
66
+ try {
67
+ const data1 = await client.send(command);
68
+ console.dir(data1, { depth: 4 });
69
+ } catch (err){
70
+ console.dir(err, { depth: 4 });
71
+ };
72
+ })();
73
+ ```
74
+
75
+ #### Promises
76
+ ```ts
77
+ client.send(command)
78
+ .then(data => console.dir(data, { depth: 4 }))
79
+ .catch(err => console.dir(err, { depth: 4 }));
80
+ ```
81
+
82
+ ## License
83
+ This SDK is distributed under the [MIT License](https://opensource.org/licenses/MIT), see LICENSE for more information.
@@ -0,0 +1,60 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.SensClient = void 0;
13
+ const util_http_handler_1 = require("@ingestkorea/util-http-handler");
14
+ const util_error_handler_1 = require("@ingestkorea/util-error-handler");
15
+ const middleware_1 = require("./middleware");
16
+ ;
17
+ ;
18
+ class SensClient {
19
+ constructor(config) {
20
+ const resolvedCredentials = resolveCredentials(config);
21
+ const resolvedServiceId = resolveServiceId(config);
22
+ this.config = {
23
+ credentials: Object.assign({}, resolvedCredentials),
24
+ serviceId: resolvedServiceId
25
+ };
26
+ this.httpHandler = new util_http_handler_1.NodeHttpHandler({ connectionTimeout: 3000, socketTimeout: 3000 });
27
+ }
28
+ ;
29
+ send(command) {
30
+ return __awaiter(this, void 0, void 0, function* () {
31
+ let input = command.input;
32
+ let request = yield command.serialize(input, this.config);
33
+ request = yield (0, middleware_1.middlewareSigner)(request, this.config);
34
+ let { response } = yield this.httpHandler.handle(request);
35
+ let output = yield command.deserialize(response);
36
+ return output;
37
+ });
38
+ }
39
+ ;
40
+ }
41
+ exports.SensClient = SensClient;
42
+ ;
43
+ const resolveCredentials = (config) => {
44
+ const { credentials } = config;
45
+ if (!credentials)
46
+ throw new util_error_handler_1.IngestkoreaError({
47
+ code: 401, type: 'Unauthorized',
48
+ message: 'Invalid Credentials', description: 'Invalid Credentials'
49
+ });
50
+ return credentials;
51
+ };
52
+ const resolveServiceId = (config) => {
53
+ const { serviceId } = config;
54
+ if (!serviceId)
55
+ throw new util_error_handler_1.IngestkoreaError({
56
+ code: 401, type: 'Unauthorized',
57
+ message: 'Invalid Credentials', description: 'Invalid ServiceId'
58
+ });
59
+ return serviceId;
60
+ };
@@ -0,0 +1,39 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.GetRequestResultCommand = void 0;
13
+ const models_1 = require("../models");
14
+ const GetRequestResult_1 = require("../protocols/GetRequestResult");
15
+ ;
16
+ ;
17
+ class GetRequestResultCommand extends models_1.SensCommand {
18
+ constructor(input) {
19
+ super(input);
20
+ this.input = Object.assign({}, input);
21
+ }
22
+ ;
23
+ serialize(input, config) {
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ let request = yield (0, GetRequestResult_1.serializeIngestkorea_restJson_GetRequestResultCommand)(input, config);
26
+ return request;
27
+ });
28
+ }
29
+ ;
30
+ deserialize(response) {
31
+ return __awaiter(this, void 0, void 0, function* () {
32
+ let output = yield (0, GetRequestResult_1.deserializeIngestkorea_restJson_GetRequestResultCommand)(response);
33
+ return output;
34
+ });
35
+ }
36
+ ;
37
+ }
38
+ exports.GetRequestResultCommand = GetRequestResultCommand;
39
+ ;
@@ -0,0 +1,39 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.GetRequestStatusCommand = void 0;
13
+ const models_1 = require("../models");
14
+ const GetRequestStatus_1 = require("../protocols/GetRequestStatus");
15
+ ;
16
+ ;
17
+ class GetRequestStatusCommand extends models_1.SensCommand {
18
+ constructor(input) {
19
+ super(input);
20
+ this.input = Object.assign({}, input);
21
+ }
22
+ ;
23
+ serialize(input, config) {
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ let request = yield (0, GetRequestStatus_1.serializeIngestkorea_restJson_GetRequestStatusCommand)(input, config);
26
+ return request;
27
+ });
28
+ }
29
+ ;
30
+ deserialize(response) {
31
+ return __awaiter(this, void 0, void 0, function* () {
32
+ let output = yield (0, GetRequestStatus_1.deserializeIngestkorea_restJson_GetRequestStatusCommand)(response);
33
+ return output;
34
+ });
35
+ }
36
+ ;
37
+ }
38
+ exports.GetRequestStatusCommand = GetRequestStatusCommand;
39
+ ;
@@ -0,0 +1,39 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ListChannelsCommand = void 0;
13
+ const models_1 = require("../models");
14
+ const ListChannels_1 = require("../protocols/ListChannels");
15
+ ;
16
+ ;
17
+ class ListChannelsCommand extends models_1.SensCommand {
18
+ constructor(input) {
19
+ super(input);
20
+ this.input = Object.assign({}, input);
21
+ }
22
+ ;
23
+ serialize(input, config) {
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ let request = yield (0, ListChannels_1.serializeIngestkorea_restJson_ListChannelsCommand)(input, config);
26
+ return request;
27
+ });
28
+ }
29
+ ;
30
+ deserialize(response) {
31
+ return __awaiter(this, void 0, void 0, function* () {
32
+ let output = yield (0, ListChannels_1.deserializeIngestkorea_restJson_ListChannelsCommand)(response);
33
+ return output;
34
+ });
35
+ }
36
+ ;
37
+ }
38
+ exports.ListChannelsCommand = ListChannelsCommand;
39
+ ;
@@ -0,0 +1,39 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.SendAlimtalkCommand = void 0;
13
+ const models_1 = require("../models");
14
+ const SendAlimtalk_1 = require("../protocols/SendAlimtalk");
15
+ ;
16
+ ;
17
+ class SendAlimtalkCommand extends models_1.SensCommand {
18
+ constructor(input) {
19
+ super(input);
20
+ this.input = Object.assign({}, input);
21
+ }
22
+ ;
23
+ serialize(input, config) {
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ let request = yield (0, SendAlimtalk_1.serializeIngestkorea_restJson_SendAlimtalkCommand)(input, config);
26
+ return request;
27
+ });
28
+ }
29
+ ;
30
+ deserialize(response) {
31
+ return __awaiter(this, void 0, void 0, function* () {
32
+ let output = yield (0, SendAlimtalk_1.deserializeIngestkorea_restJson_SendAlimtalkCommand)(response);
33
+ return output;
34
+ });
35
+ }
36
+ ;
37
+ }
38
+ exports.SendAlimtalkCommand = SendAlimtalkCommand;
39
+ ;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./SendAlimtalkCommand"), exports);
18
+ __exportStar(require("./GetRequestStatusCommand"), exports);
19
+ __exportStar(require("./GetRequestResultCommand"), exports);
20
+ __exportStar(require("./ListChannelsCommand"), exports);
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./commands"), exports);
18
+ __exportStar(require("./SensClient"), exports);
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./signer"), exports);
@@ -0,0 +1,31 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.middlewareSigner = void 0;
13
+ const crypto_1 = require("crypto");
14
+ const middlewareSigner = (request, config) => __awaiter(void 0, void 0, void 0, function* () {
15
+ const { accessKey, secretKey } = config.credentials;
16
+ const method = request.method;
17
+ const queryString = new URLSearchParams(request.query).toString();
18
+ const path = queryString ? `${request.path}?${queryString}` : request.path;
19
+ const space = " ";
20
+ const newLine = "\n";
21
+ const timestamp = new Date().getTime().toString();
22
+ const stringToSign = [
23
+ method + space + path,
24
+ timestamp,
25
+ accessKey
26
+ ].join(newLine);
27
+ const signature = (0, crypto_1.createHmac)("sha256", secretKey).update(stringToSign).digest('base64');
28
+ request.headers = Object.assign(Object.assign({}, request.headers), { ['x-ncp-iam-access-key']: accessKey, ['x-ncp-apigw-timestamp']: timestamp, ['x-ncp-apigw-signature-v2']: signature });
29
+ return request;
30
+ });
31
+ exports.middlewareSigner = middlewareSigner;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ ;
4
+ ;
5
+ ;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ ;
4
+ ;
5
+ ;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ ;
4
+ ;
5
+ ;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ ;
4
+ ;
5
+ ;
6
+ ;
7
+ ;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SensCommand = void 0;
4
+ class SensCommand {
5
+ constructor(input) {
6
+ this.input = input;
7
+ }
8
+ ;
9
+ }
10
+ exports.SensCommand = SensCommand;
11
+ ;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./SensCommand"), exports);
18
+ __exportStar(require("./SendAlimtalk"), exports);
19
+ __exportStar(require("./GetRequestStatus"), exports);
20
+ __exportStar(require("./GetRequestResult"), exports);
21
+ __exportStar(require("./ListChannels"), exports);
@@ -0,0 +1,77 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.deserializeIngestkorea_restJson_GetRequestResultFailover = exports.deserializeIngestkorea_restJson_GetRequestResultOutput = exports.deserializeIngestkorea_restJson_GetRequestResultCommand = exports.serializeIngestkorea_restJson_GetRequestResultCommand = void 0;
13
+ const util_http_handler_1 = require("@ingestkorea/util-http-handler");
14
+ const constants_1 = require("./constants");
15
+ const serializeIngestkorea_restJson_GetRequestResultCommand = (input, config) => __awaiter(void 0, void 0, void 0, function* () {
16
+ const hostname = "sens.apigw.ntruss.com";
17
+ const path = "/alimtalk/v2/services/" + config.serviceId + "/messages/" + input.messageId;
18
+ const headers = {
19
+ "host": hostname
20
+ };
21
+ return new util_http_handler_1.HttpRequest({
22
+ protocol: 'https:',
23
+ method: 'GET',
24
+ hostname: hostname,
25
+ path: path,
26
+ headers: headers
27
+ });
28
+ });
29
+ exports.serializeIngestkorea_restJson_GetRequestResultCommand = serializeIngestkorea_restJson_GetRequestResultCommand;
30
+ const deserializeIngestkorea_restJson_GetRequestResultCommand = (output) => __awaiter(void 0, void 0, void 0, function* () {
31
+ if (output.statusCode > 300)
32
+ yield (0, constants_1.parseErrorBody)(output);
33
+ const data = yield (0, constants_1.parseBody)(output); // GetRequestResultOutput
34
+ let contents = {};
35
+ contents = yield (0, exports.deserializeIngestkorea_restJson_GetRequestResultOutput)(data);
36
+ const response = Object.assign({}, contents);
37
+ return response;
38
+ });
39
+ exports.deserializeIngestkorea_restJson_GetRequestResultCommand = deserializeIngestkorea_restJson_GetRequestResultCommand;
40
+ const deserializeIngestkorea_restJson_GetRequestResultOutput = (output) => __awaiter(void 0, void 0, void 0, function* () {
41
+ return {
42
+ requestId: output.requestId != undefined ? output.requestId : undefined,
43
+ messageId: output.messageId != undefined ? output.messageId : undefined,
44
+ to: output.to != undefined ? output.to : undefined,
45
+ countryCode: output.countryCode != undefined ? output.countryCode : undefined,
46
+ content: output.content != undefined ? output.content : undefined,
47
+ requestStatusCode: output.requestStatusCode != undefined ? output.requestStatusCode : undefined,
48
+ requestStatusName: output.requestStatusName != undefined ? output.requestStatusName : undefined,
49
+ requestStatusDesc: output.requestStatusDesc != undefined ? output.requestStatusDesc : undefined,
50
+ useSmsFailover: output.useSmsFailover != undefined ? output.useSmsFailover : undefined,
51
+ requestTime: output.requestTime != undefined ? output.requestTime : undefined,
52
+ plusFriendId: output.plusFriendId != undefined ? output.plusFriendId : undefined,
53
+ templateCode: output.templateCode != undefined ? output.templateCode : undefined,
54
+ completeTime: output.completeTime != undefined ? output.completeTime : undefined,
55
+ messageStatusCode: output.messageStatusCode != undefined ? output.messageStatusCode : undefined,
56
+ messageStatusName: output.messageStatusName != undefined ? output.messageStatusName : undefined,
57
+ messageStatusDesc: output.messageStatusDesc != undefined ? output.messageStatusDesc : undefined,
58
+ failover: output.failover != undefined ?
59
+ (0, exports.deserializeIngestkorea_restJson_GetRequestResultFailover)(output.failover) : undefined,
60
+ };
61
+ });
62
+ exports.deserializeIngestkorea_restJson_GetRequestResultOutput = deserializeIngestkorea_restJson_GetRequestResultOutput;
63
+ const deserializeIngestkorea_restJson_GetRequestResultFailover = (output) => {
64
+ return {
65
+ smsServiceId: output.smsServiceId != undefined ? output.smsServiceId : undefined,
66
+ requestId: output.requestId != undefined ? output.requestId : undefined,
67
+ requestStatusCode: output.requestStatusCode != undefined ? output.requestStatusCode : undefined,
68
+ requestStatusName: output.requestStatusName != undefined ? output.requestStatusName : undefined,
69
+ requestStatusDesc: output.requestStatusDesc != undefined ? output.requestStatusDesc : undefined,
70
+ messageId: output.messageId != undefined ? output.messageId : undefined,
71
+ messageStatus: output.messageStatus != undefined ? output.messageStatus : undefined,
72
+ messageStatusCode: output.messageStatusCode != undefined ? output.messageStatusCode : undefined,
73
+ messageStatusName: output.messageStatusName != undefined ? output.messageStatusName : undefined,
74
+ messageStatusDesc: output.messageStatusDesc != undefined ? output.messageStatusDesc : undefined,
75
+ };
76
+ };
77
+ exports.deserializeIngestkorea_restJson_GetRequestResultFailover = deserializeIngestkorea_restJson_GetRequestResultFailover;
@@ -0,0 +1,76 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.deserializeIngestkorea_restJson_GetRequestStatusMessages = exports.deserializeIngestkorea_restJson_GetRequestStatusOutput = exports.deserializeIngestkorea_restJson_GetRequestStatusCommand = exports.serializeIngestkorea_restJson_GetRequestStatusCommand = void 0;
13
+ const util_http_handler_1 = require("@ingestkorea/util-http-handler");
14
+ const constants_1 = require("./constants");
15
+ const serializeIngestkorea_restJson_GetRequestStatusCommand = (input, config) => __awaiter(void 0, void 0, void 0, function* () {
16
+ const hostname = "sens.apigw.ntruss.com";
17
+ const path = "/alimtalk/v2/services/" + config.serviceId + "/messages";
18
+ const headers = {
19
+ "host": hostname
20
+ };
21
+ const query = {
22
+ requestId: input.requestId
23
+ };
24
+ return new util_http_handler_1.HttpRequest({
25
+ protocol: 'https:',
26
+ method: 'GET',
27
+ hostname: hostname,
28
+ path: path,
29
+ headers: headers,
30
+ query: query
31
+ });
32
+ });
33
+ exports.serializeIngestkorea_restJson_GetRequestStatusCommand = serializeIngestkorea_restJson_GetRequestStatusCommand;
34
+ const deserializeIngestkorea_restJson_GetRequestStatusCommand = (output) => __awaiter(void 0, void 0, void 0, function* () {
35
+ if (output.statusCode > 300)
36
+ yield (0, constants_1.parseErrorBody)(output);
37
+ const data = yield (0, constants_1.parseBody)(output); // GetRequestStatusOutput
38
+ let contents = {};
39
+ contents = yield (0, exports.deserializeIngestkorea_restJson_GetRequestStatusOutput)(data);
40
+ const response = Object.assign({}, contents);
41
+ return response;
42
+ });
43
+ exports.deserializeIngestkorea_restJson_GetRequestStatusCommand = deserializeIngestkorea_restJson_GetRequestStatusCommand;
44
+ const deserializeIngestkorea_restJson_GetRequestStatusOutput = (output) => __awaiter(void 0, void 0, void 0, function* () {
45
+ const { requestId, statusCode, statusName, messages } = output;
46
+ return {
47
+ requestId: requestId != undefined ? requestId : undefined,
48
+ statusCode: statusCode != undefined ? statusCode : undefined,
49
+ statusName: statusName != undefined ? statusName : undefined,
50
+ messages: messages != undefined ? (0, exports.deserializeIngestkorea_restJson_GetRequestStatusMessages)(messages) : undefined
51
+ };
52
+ });
53
+ exports.deserializeIngestkorea_restJson_GetRequestStatusOutput = deserializeIngestkorea_restJson_GetRequestStatusOutput;
54
+ const deserializeIngestkorea_restJson_GetRequestStatusMessages = (outputs) => {
55
+ const result = outputs.map(output => {
56
+ return {
57
+ messageId: output.messageId != undefined ? output.messageId : undefined,
58
+ to: output.to != undefined ? output.to : undefined,
59
+ countryCode: output.countryCode != undefined ? output.countryCode : undefined,
60
+ content: output.content != undefined ? output.content : undefined,
61
+ requestStatusCode: output.requestStatusCode != undefined ? output.requestStatusCode : undefined,
62
+ requestStatusName: output.requestStatusName != undefined ? output.requestStatusName : undefined,
63
+ requestStatusDesc: output.requestStatusDesc != undefined ? output.requestStatusDesc : undefined,
64
+ useSmsFailover: output.useSmsFailover != undefined ? output.useSmsFailover : undefined,
65
+ requestTime: output.requestTime != undefined ? output.requestTime : undefined,
66
+ plusFriendId: output.plusFriendId != undefined ? output.plusFriendId : undefined,
67
+ templateCode: output.templateCode != undefined ? output.templateCode : undefined,
68
+ completeTime: output.completeTime != undefined ? output.completeTime : undefined,
69
+ messageStatusCode: output.messageStatusCode != undefined ? output.messageStatusCode : undefined,
70
+ messageStatusName: output.messageStatusName != undefined ? output.messageStatusName : undefined,
71
+ messageStatusDesc: output.messageStatusDesc != undefined ? output.messageStatusDesc : undefined,
72
+ };
73
+ });
74
+ return result;
75
+ };
76
+ exports.deserializeIngestkorea_restJson_GetRequestStatusMessages = deserializeIngestkorea_restJson_GetRequestStatusMessages;