cobrili-client 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.
- package/README.md +119 -0
- package/dist/index.browser.js +2468 -0
- package/dist/index.browser.js.map +1 -0
- package/dist/index.d.mts +13278 -0
- package/dist/index.d.ts +13278 -0
- package/dist/index.js +2466 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2443 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +58 -0
package/README.md
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# Cobrili-Client
|
|
2
|
+
|
|
3
|
+
Modern TypeScript API client for Cobrili REST API. Works in both Browser and Node.js environments.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- ✅ Full TypeScript support with type definitions
|
|
8
|
+
- ✅ Registry-driven API with all methods auto-generated
|
|
9
|
+
- ✅ Works in Browser and Node.js
|
|
10
|
+
- ✅ JSON-based communication
|
|
11
|
+
- ✅ Promise/async-await API
|
|
12
|
+
- ✅ Configurable base URL and headers
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install cobrili-client
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
### ES6 Import (Recommended)
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
import { createCobriliClient } from 'cobrili-client';
|
|
26
|
+
|
|
27
|
+
const client = createCobriliClient({
|
|
28
|
+
baseUrl: 'http://localhost:5000',
|
|
29
|
+
endpoint: '/api/cobrili',
|
|
30
|
+
headers: {
|
|
31
|
+
'Authorization': 'Basic ' + btoa('user:pass')
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// Login
|
|
36
|
+
const loginResult = await client.login({ loginUser: { username: 'user', password: 'pass' } });
|
|
37
|
+
|
|
38
|
+
// Get navigation
|
|
39
|
+
const nav = await client.getNavigationWithMetaData({ currentNavigationID: 0 });
|
|
40
|
+
|
|
41
|
+
// Get content
|
|
42
|
+
const content = await client.getContent({ topicID: 12345 });
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### CommonJS
|
|
46
|
+
|
|
47
|
+
```javascript
|
|
48
|
+
const { createCobriliClient } = require('cobrili-client');
|
|
49
|
+
|
|
50
|
+
const client = createCobriliClient({ baseUrl: 'http://localhost:5000' });
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## API Methods
|
|
54
|
+
|
|
55
|
+
All methods are auto-generated from the API registry. Import `API_METHODS` for the full list:
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
import { API_METHODS } from 'cobrili-client';
|
|
59
|
+
|
|
60
|
+
// List all available methods
|
|
61
|
+
console.log(Object.keys(API_METHODS));
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Authentication
|
|
65
|
+
- `login({ loginUser: { username, password } })` - Login with credentials
|
|
66
|
+
- `logout({})` - Logout
|
|
67
|
+
|
|
68
|
+
### Navigation
|
|
69
|
+
- `getNavigationWithMetaData({ currentNavigationID })` - Get navigation tree
|
|
70
|
+
- `navigateToTopic({ topicID, navigationID })` - Navigate to topic
|
|
71
|
+
|
|
72
|
+
### Content
|
|
73
|
+
- `getContent({ topicID })` - Get topic content
|
|
74
|
+
- `getTopicForExternalId({ externalIdForTopic, externalIdForHelpset })` - Find topic
|
|
75
|
+
|
|
76
|
+
### Helpset
|
|
77
|
+
- `getAllHelpsets({ masterHelpSetApplicationIdentifier, withMetadata })` - Get all helpsets
|
|
78
|
+
- `getHomeTopicId({ helpsetID })` - Get home topic
|
|
79
|
+
- `loadActiveHelpset({ helpsetID })` - Load a helpset
|
|
80
|
+
|
|
81
|
+
## License
|
|
82
|
+
|
|
83
|
+
MIT
|
|
84
|
+
- `historyBack(steps?)` / `historyForward(steps?)` - Navigate history
|
|
85
|
+
- `getBookmarkList()` - Get bookmarks
|
|
86
|
+
- `addBookmark(topicID, navigationID, title)` - Add bookmark
|
|
87
|
+
|
|
88
|
+
### Metadata
|
|
89
|
+
- `getUsedMetaValues(metaKey)` - Get meta values
|
|
90
|
+
- `getMetaValueForTopic(metaKey, topicID)` - Get meta for topic
|
|
91
|
+
- `getMetaKeyWhichRepresentsLanguage()` - Get language key
|
|
92
|
+
|
|
93
|
+
### System
|
|
94
|
+
- `getCurrentCobriliVersion()` - Get version
|
|
95
|
+
- `getConfigurationData()` - Get configuration
|
|
96
|
+
- `clearStaticCaches()` - Clear caches
|
|
97
|
+
- `healthCheck()` - Health check
|
|
98
|
+
|
|
99
|
+
## Response Format
|
|
100
|
+
|
|
101
|
+
```typescript
|
|
102
|
+
interface ApiResponse<T> {
|
|
103
|
+
success: boolean;
|
|
104
|
+
data: T;
|
|
105
|
+
status: number;
|
|
106
|
+
message?: string;
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Development
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
npm install
|
|
114
|
+
npm run build
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## License
|
|
118
|
+
|
|
119
|
+
MIT
|