@or-sdk/hitl 0.34.58 → 0.34.59-beta.3241.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/README.md +40 -19
- package/package.json +2 -3
package/README.md
CHANGED
|
@@ -4,41 +4,62 @@ $ npm i @or-sdk/hitl
|
|
|
4
4
|
```
|
|
5
5
|
|
|
6
6
|
# Usage
|
|
7
|
-
|
|
7
|
+
To start using HitL API methods through this SDK it has be Initialized first. To do that a OneReach JWT authorization token and a HitL or Discovery service URL have to be passed to the constructor. After initializing the HitL SDK, its methods can be used to make requests to HitL APIs.
|
|
8
|
+
|
|
9
|
+
Available HitL APIs are:
|
|
10
|
+
- `agents` (see **AgentsApi** class for the documentation)
|
|
11
|
+
- `cannedMessages` (see **CannedMessagesApi** class for the documentation)
|
|
12
|
+
- `commands` (see **CommandsApi** class for the documentation)
|
|
13
|
+
- `conferences` (see **ConferencesApi** class for the documentation)
|
|
14
|
+
- `contactRuleGroups` (see **ContactRuleGroupsApi** class for the documentation)
|
|
15
|
+
- `contacts` (see **ContactsApi** class for the documentation)
|
|
16
|
+
- `contactsMeta` (see **ContactsMetaApi** class for the documentation)
|
|
17
|
+
- `eventTemplates` (see **EventTemplatesApi** class for the documentation)
|
|
18
|
+
- `filters` (see **FiltersApi** class for the documentation)
|
|
19
|
+
- `helpers` (see **HelpersApi** class for the documentation)
|
|
20
|
+
- `listeners` (see **ListenersApi** class for the documentation)
|
|
21
|
+
- `migrations` (see **MigrationsApi** class for the documentation)
|
|
22
|
+
- `ruleGroups` (see **RuleGroupsApi** class for the documentation)
|
|
23
|
+
- `sessionEvents` (see **SessionEventsApi** class for the documentation)
|
|
24
|
+
- `sessionRelations` (see **SessionRelationsApi** class for the documentation)
|
|
25
|
+
- `sessions` (see **SessionsApi** class for the documentation)
|
|
26
|
+
- `settings` (see **SettingsApi** class for the documentation)
|
|
27
|
+
- `tasks` (see **TasksApi** class for the documentation)
|
|
28
|
+
- `versions` (see **VersionsApi** class for the documentation)
|
|
29
|
+
|
|
30
|
+
# Examples
|
|
31
|
+
### In a flow
|
|
8
32
|
```
|
|
9
33
|
const HitlApi = require('@or-sdk/hitl').HITL;
|
|
10
34
|
|
|
11
35
|
// with direct api url
|
|
12
36
|
const hitlApi = new HitlApi({
|
|
13
|
-
token:
|
|
14
|
-
hitlUrl: this.config.env.HITL_API_URL
|
|
15
|
-
hitlEksUrl: 'https://hitl.svc.<client-env>.api.onereach.ai', // need only for migrations
|
|
37
|
+
token: this.config.flowToken,
|
|
38
|
+
hitlUrl: this.config.env.HITL_API_URL
|
|
16
39
|
});
|
|
17
40
|
|
|
18
41
|
// with service discovery(slower)
|
|
19
42
|
const hitlApi = new HitlApi({
|
|
20
|
-
token:
|
|
43
|
+
token: this.config.flowToken,
|
|
21
44
|
discoveryUrl: this.config.env.SERVICE_DISCOVERY_API_URL,
|
|
22
45
|
});
|
|
23
46
|
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
(all available HitL API part could be found in the `api` folder)
|
|
28
|
-
|
|
29
|
-
# Examples
|
|
30
|
-
|
|
31
|
-
## Basic usage
|
|
47
|
+
const ruleGroupsList = await hitlApi.ruleGroups.searchRuleGroups();
|
|
48
|
+
```
|
|
49
|
+
### Outside a flow
|
|
32
50
|
```
|
|
33
51
|
const HitlApi = require('@or-sdk/hitl').HITL;
|
|
34
52
|
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
53
|
+
const CLIENT_DOMAIN_PREFIX = ''; // A PDE client-environment domain prefix, e.g. "staging"
|
|
54
|
+
|
|
55
|
+
// Either "discoveryUrl" or "hitlUrl" should be specified, "hitlUrl" takes precedence if both are present
|
|
56
|
+
const { agents, cannedMessages, ruleGroups } = new HitlApi({
|
|
57
|
+
token: 'AUTH TOKEN HERE', // FLOW, SERVICE or USER JWT OneReach authorization token
|
|
58
|
+
discoveryUrl: `https://discovery.${CLIENT_DOMAIN_PREFIX}.api.onereach.ai`, // A service discovery URL, e.g. "https://discovery.staging.api.onereach.ai"
|
|
59
|
+
hitlUrl: `https://hitl.${CLIENT_DOMAIN_PREFIX}.api.onereach.ai`, // A HitL API URL, e.g. "https://hitl.staging.api.onereach.ai"
|
|
38
60
|
});
|
|
39
61
|
|
|
40
|
-
await migrations.runAllMigrations();
|
|
41
|
-
const status = await migrations.getRunMigrationsStatus();
|
|
42
62
|
const agentsList = await agents.getAgents();
|
|
43
|
-
const cannedMessages = cannedMessages.getCannedMessages({ id });
|
|
63
|
+
const cannedMessages = await cannedMessages.getCannedMessages({ id: 'MESSAGE ID HERE' });
|
|
64
|
+
const ruleGroupsList = await hitlApi.ruleGroups.searchRuleGroups();
|
|
44
65
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@or-sdk/hitl",
|
|
3
|
-
"version": "0.34.
|
|
3
|
+
"version": "0.34.59-beta.3241.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -30,6 +30,5 @@
|
|
|
30
30
|
},
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|
|
33
|
-
}
|
|
34
|
-
"gitHead": "2d96ff086243c46f51a884e6472cd95814eb4ce9"
|
|
33
|
+
}
|
|
35
34
|
}
|