@epilot/message-client 1.1.1 → 1.1.4
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 +21 -0
- package/README.md +75 -26
- package/dist/client.d.ts +2 -1
- package/dist/client.js +16 -1
- package/dist/definition.js +1 -1
- package/dist/index.js +5 -1
- package/dist/openapi.d.ts +1276 -1059
- package/dist/openapi.json +82 -4589
- package/package.json +28 -12
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 epilot GmbH
|
|
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
|
|
13
|
+
all 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
|
|
21
|
+
THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,40 +1,89 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @epilot/message-client
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://github.com/epilot-dev/sdk-js/actions?query=workflow%3ACI)
|
|
4
|
+
[](https://www.npmjs.com/package/@epilot/message-client)
|
|
5
|
+
[](https://bundlephobia.com/package/@epilot/message-client)
|
|
6
|
+
[](https://github.com/epilot-dev/sdk-js/blob/main/LICENSE)
|
|
4
7
|
|
|
5
|
-
|
|
8
|
+
API Client for epilot [Message API](https://docs.epilot.io/api/message).
|
|
6
9
|
|
|
7
|
-
|
|
10
|
+
Uses [`openapi-client-axios`](https://github.com/anttiviljami/openapi-client-axios)
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
## Installation
|
|
10
13
|
|
|
11
14
|
```bash
|
|
12
|
-
npm install --save
|
|
15
|
+
npm install --save @epilot/message-client
|
|
13
16
|
```
|
|
14
17
|
|
|
15
|
-
|
|
18
|
+
## Usage
|
|
16
19
|
|
|
17
20
|
```typescript
|
|
18
21
|
import { getClient } from '@epilot/message-client';
|
|
22
|
+
const messageClient = getClient();
|
|
23
|
+
const sendResponse = await messageClient.sendMessage(null, {
|
|
24
|
+
"thread": {
|
|
25
|
+
"topic": "CUSTOMER_MESSAGE",
|
|
26
|
+
"assigned_to": [
|
|
27
|
+
"206801",
|
|
28
|
+
"200109"
|
|
29
|
+
],
|
|
30
|
+
"opportunity_id": 829072
|
|
31
|
+
},
|
|
32
|
+
"parent_id": "44d7a3eb-0cce-4bd3-a7cd-0b3e652de0c2",
|
|
33
|
+
"subject": "Request for solar panel price",
|
|
34
|
+
"html": "<div>We at ABC GmbH would like to request a price quote for the solar panel.</div>",
|
|
35
|
+
"text": "We at ABC GmbH would like to request a price quote for the solar panel.",
|
|
36
|
+
"from": {
|
|
37
|
+
"name": "epilot",
|
|
38
|
+
"address": "messaging@epilot.cloud",
|
|
39
|
+
"send_status": "SEND",
|
|
40
|
+
"send_error": {}
|
|
41
|
+
},
|
|
42
|
+
"reply_to": {
|
|
43
|
+
"name": "epilot",
|
|
44
|
+
"address": "messaging@epilot.cloud",
|
|
45
|
+
"send_status": "SEND",
|
|
46
|
+
"send_error": {}
|
|
47
|
+
},
|
|
48
|
+
"to": [
|
|
49
|
+
{
|
|
50
|
+
"name": "epilot",
|
|
51
|
+
"address": "messaging@epilot.cloud",
|
|
52
|
+
"send_status": "SEND",
|
|
53
|
+
"send_error": {}
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
"cc": [
|
|
57
|
+
{
|
|
58
|
+
"name": "epilot",
|
|
59
|
+
"address": "messaging@epilot.cloud",
|
|
60
|
+
"send_status": "SEND",
|
|
61
|
+
"send_error": {}
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
"bcc": [
|
|
65
|
+
{
|
|
66
|
+
"name": "epilot",
|
|
67
|
+
"address": "messaging@epilot.cloud",
|
|
68
|
+
"send_status": "SEND",
|
|
69
|
+
"send_error": {}
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
"file": {
|
|
73
|
+
"$relation": [
|
|
74
|
+
{
|
|
75
|
+
"entity_id": "f820ce3b-07b0-45ae-bcc6-babb2f53f79f",
|
|
76
|
+
"filename": "Produktinformationen_epilot360_Double_Opt_in.pdf",
|
|
77
|
+
"is_message_attachment": true,
|
|
78
|
+
"cid": "fb222496-a1a5-4639-94f2-07b5e35e4068",
|
|
79
|
+
"inline": false,
|
|
80
|
+
"send_as_link": false
|
|
81
|
+
}
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
});
|
|
19
85
|
```
|
|
20
86
|
|
|
21
|
-
|
|
22
|
-
```typescript
|
|
23
|
-
// get typed client
|
|
24
|
-
const client = await getClient();
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## BaseURL & Authorization
|
|
28
|
-
|
|
29
|
-
To pass an authorization header and set up the API url, you can use axios
|
|
30
|
-
defaults:
|
|
31
|
-
|
|
32
|
-
```typescript
|
|
33
|
-
const client = getClient();
|
|
34
|
-
client.defaults.baseURL = config.ENTITY_API_URL;
|
|
35
|
-
client.defaults.headers.common['authorization'] = `Bearer ${token}`;
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
## API Docs:
|
|
87
|
+
## Documentation
|
|
39
88
|
|
|
40
|
-
https://docs.
|
|
89
|
+
https://docs.epilot.io/docs/messaging/message-api
|
package/dist/client.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { Client } from './openapi';
|
|
2
|
+
export declare const getClient: () => Client;
|
package/dist/client.js
CHANGED
|
@@ -1,14 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
15
|
};
|
|
5
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
17
|
exports.getClient = void 0;
|
|
18
|
+
var lambda_powertools_correlation_ids_1 = __importDefault(require("@dazn/lambda-powertools-correlation-ids"));
|
|
7
19
|
var openapi_client_axios_1 = __importDefault(require("openapi-client-axios"));
|
|
8
20
|
var definition_1 = __importDefault(require("./definition"));
|
|
9
21
|
var getClient = function () {
|
|
22
|
+
var _a;
|
|
10
23
|
var api = new openapi_client_axios_1.default({ definition: definition_1.default, quick: true });
|
|
11
|
-
|
|
24
|
+
var apiClient = api.initSync();
|
|
25
|
+
apiClient.defaults.headers.common = __assign(__assign({}, ((_a = apiClient.defaults.headers.common) !== null && _a !== void 0 ? _a : {})), (lambda_powertools_correlation_ids_1.default.get() || {}));
|
|
26
|
+
return apiClient;
|
|
12
27
|
};
|
|
13
28
|
exports.getClient = getClient;
|
|
14
29
|
//# sourceMappingURL=client.js.map
|