o2g-node-sdk 2.5.1 → 2.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/README.md CHANGED
@@ -8,11 +8,6 @@ A Node.js SDK for the ALE International O2G (OmniPCX OpenTouch Gateway) platform
8
8
  - An OmniPCX Enterprise node connected to an O2G server
9
9
  - An O2G API license appropriate for the services you intend to use
10
10
 
11
- ## Getting Started
12
-
13
- New to TypeScript or Node.js? Follow the [Getting Started guide](GETTING_STARTED.md)
14
- for a complete step-by-step walkthrough from installing the tools to your first login.
15
-
16
11
  ## Installation
17
12
 
18
13
  ```bash
@@ -55,6 +50,11 @@ await O2G.telephony.makeCall("1234", "5678");
55
50
  await O2G.shutdown();
56
51
  ```
57
52
 
53
+ ## Getting Started
54
+
55
+ New to TypeScript or Node.js? Follow the [Getting Started guide](GETTING_STARTED.md)
56
+ for a complete step-by-step walkthrough from installing the tools to your first login.
57
+
58
58
  ## Sessions
59
59
 
60
60
  Three types of sessions are supported:
@@ -171,20 +171,26 @@ await O2G.callCenterPilot.monitorStart("60141");
171
171
  ### Search the directory
172
172
 
173
173
  ```typescript
174
- import { O2G, Criteria, SearchResult } from 'o2g-node-sdk';
174
+ import { O2G, Criteria, FilterItem, OperationFilter, SearchResult } from 'o2g-node-sdk';
175
175
 
176
- const criteria = new Criteria({ lastName: "Smith" });
176
+ // Search users whose last name begins with "Smith"
177
+ const criteria = Criteria.create(FilterItem.LAST_NAME, OperationFilter.BEGINS_WITH, "Smith");
177
178
  await O2G.directory.search(criteria, 10);
178
179
 
179
180
  let finished = false;
180
181
  while (!finished) {
181
182
  const result = await O2G.directory.getResults();
182
- if (result?.resultCode === SearchResult.ResultCode.OK) {
183
- result.items.forEach(item => console.log(item.firstName, item.lastName));
184
- } else if (result?.resultCode === SearchResult.ResultCode.FINISH) {
185
- finished = true;
186
- } else {
183
+ if (result?.status === SearchResult.Status.NOK) {
184
+ // Search still in progress — wait before retrying
187
185
  await new Promise(resolve => setTimeout(resolve, 500));
186
+ } else if (result?.status === SearchResult.Status.OK) {
187
+ // Process available results
188
+ result.items?.forEach(item => {
189
+ item.contacts?.forEach(contact => console.log(contact.firstName, contact.lastName));
190
+ });
191
+ } else {
192
+ // FINISH or TIMEOUT — search is complete
193
+ finished = true;
188
194
  }
189
195
  }
190
196
  ```