@bitbitpress/client 0.1.1 → 0.1.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 +59 -57
- package/dist/client.d.ts +4 -26
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +8 -1
- package/dist/client.js.map +1 -1
- package/dist/generated/openapi.d.ts +509 -6
- package/dist/generated/openapi.ts +7 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/request.d.ts.map +1 -1
- package/dist/request.js +1 -1
- package/dist/request.js.map +1 -1
- package/dist/user/index.d.ts +35 -30
- package/dist/user/index.d.ts.map +1 -1
- package/dist/user/index.js +1 -22
- package/dist/user/index.js.map +1 -1
- package/dist/user/recommendations.d.ts +4 -0
- package/dist/user/recommendations.d.ts.map +1 -1
- package/dist/user/recommendations.js +4 -0
- package/dist/user/recommendations.js.map +1 -1
- package/dist/user/signal.d.ts +4 -0
- package/dist/user/signal.d.ts.map +1 -1
- package/dist/user/signal.js +4 -0
- package/dist/user/signal.js.map +1 -1
- package/dist/user/synthesize.d.ts +4 -0
- package/dist/user/synthesize.d.ts.map +1 -1
- package/dist/user/synthesize.js +4 -0
- package/dist/user/synthesize.js.map +1 -1
- package/dist/user/token.d.ts +4 -0
- package/dist/user/token.d.ts.map +1 -1
- package/dist/user/token.js +4 -0
- package/dist/user/token.js.map +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -33,7 +33,10 @@ await client.user.authenticate('your-user\'s-auth-sso-token');
|
|
|
33
33
|
|
|
34
34
|
**Note:** You must call `authenticate()` before using any other user methods (recommendations, synthesize, etc.).
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
|
|
37
|
+
## API Reference
|
|
38
|
+
|
|
39
|
+
More details can also be found in your control room's API docs @ https://your-control-room.api.dev.bitbitpress.com/docs.
|
|
37
40
|
|
|
38
41
|
- [BitBitPressClient](#bitbitpressclient)
|
|
39
42
|
- [Authentication](#authentication)
|
|
@@ -46,17 +49,17 @@ await client.user.authenticate('your-user\'s-auth-sso-token');
|
|
|
46
49
|
- [synthesize](#synthesize)
|
|
47
50
|
- [Types](#types)
|
|
48
51
|
|
|
49
|
-
|
|
52
|
+
### BitBitPressClient
|
|
50
53
|
|
|
51
54
|
Main client class for interacting with the BitBitPress API.
|
|
52
55
|
|
|
53
|
-
|
|
56
|
+
#### Constructor
|
|
54
57
|
|
|
55
58
|
```typescript
|
|
56
59
|
new BitBitPressClient(options: BitBitPressClientOptions)
|
|
57
60
|
```
|
|
58
61
|
|
|
59
|
-
|
|
62
|
+
##### Parameters
|
|
60
63
|
|
|
61
64
|
- `options.baseUrl` (required): Base URL of the API server (your custom Control Room API Url)
|
|
62
65
|
- `options.fetch` (optional): Custom fetch implementation (useful for React Native or Node.js polyfills)
|
|
@@ -64,7 +67,7 @@ new BitBitPressClient(options: BitBitPressClientOptions)
|
|
|
64
67
|
- `options.timeout` (optional): Request timeout in milliseconds (default: `30000`)
|
|
65
68
|
- `options.synthesizeBatchTimeout` (optional): Batch timeout for `synthesizeItem` in milliseconds (default: `250`)
|
|
66
69
|
|
|
67
|
-
|
|
70
|
+
##### Example
|
|
68
71
|
|
|
69
72
|
```typescript
|
|
70
73
|
const client = new BitBitPressClient({
|
|
@@ -74,23 +77,23 @@ const client = new BitBitPressClient({
|
|
|
74
77
|
});
|
|
75
78
|
```
|
|
76
79
|
|
|
77
|
-
|
|
80
|
+
##### Methods
|
|
78
81
|
|
|
79
|
-
|
|
82
|
+
##### `setBaseUrl(baseUrl: string): void`
|
|
80
83
|
|
|
81
84
|
Update the base URL for API requests.
|
|
82
85
|
|
|
83
|
-
|
|
86
|
+
##### `get user`
|
|
84
87
|
|
|
85
88
|
Returns an object with user-related API methods. See [User Methods](#user-methods) below.
|
|
86
89
|
|
|
87
|
-
|
|
90
|
+
### Authentication
|
|
88
91
|
|
|
89
92
|
All user methods require authentication. You must call `client.user.authenticate()` before using other user methods.
|
|
90
93
|
|
|
91
|
-
|
|
94
|
+
### User Methods
|
|
92
95
|
|
|
93
|
-
|
|
96
|
+
#### authenticate
|
|
94
97
|
|
|
95
98
|
Exchanges an SSO token for an authentication token and automatically sets it for all subsequent user method calls.
|
|
96
99
|
|
|
@@ -98,28 +101,28 @@ Exchanges an SSO token for an authentication token and automatically sets it for
|
|
|
98
101
|
await client.user.authenticate(ssoToken: string): Promise<void>
|
|
99
102
|
```
|
|
100
103
|
|
|
101
|
-
|
|
104
|
+
##### Parameters
|
|
102
105
|
|
|
103
106
|
- `ssoToken` (required): The SSO token from your authentication provider
|
|
104
107
|
|
|
105
|
-
|
|
108
|
+
##### Returns
|
|
106
109
|
|
|
107
110
|
- `Promise<void>`: Resolves when authentication is complete
|
|
108
111
|
|
|
109
|
-
|
|
112
|
+
##### Example
|
|
110
113
|
|
|
111
114
|
```typescript
|
|
112
115
|
await client.user.authenticate('your-user-s-auth-sso-token');
|
|
113
116
|
// Token is now automatically set for all user methods
|
|
114
117
|
```
|
|
115
118
|
|
|
116
|
-
|
|
119
|
+
##### Throws
|
|
117
120
|
|
|
118
121
|
- `Error`: If token exchange fails or no access token is returned
|
|
119
122
|
|
|
120
123
|
---
|
|
121
124
|
|
|
122
|
-
|
|
125
|
+
#### token
|
|
123
126
|
|
|
124
127
|
Exchanges an SSO token for an authentication token without automatically setting it for user methods.
|
|
125
128
|
|
|
@@ -127,11 +130,11 @@ Exchanges an SSO token for an authentication token without automatically setting
|
|
|
127
130
|
client.user.token(ssoToken: string): Promise<TokenResponse>
|
|
128
131
|
```
|
|
129
132
|
|
|
130
|
-
|
|
133
|
+
##### Parameters
|
|
131
134
|
|
|
132
135
|
- `ssoToken` (required): The SSO token from your authentication provider
|
|
133
136
|
|
|
134
|
-
|
|
137
|
+
##### Returns
|
|
135
138
|
|
|
136
139
|
- `Promise<TokenResponse>`: The token response containing:
|
|
137
140
|
- `idToken?: string`
|
|
@@ -139,7 +142,7 @@ client.user.token(ssoToken: string): Promise<TokenResponse>
|
|
|
139
142
|
- `refreshToken?: string`
|
|
140
143
|
- `expiresIn?: number`
|
|
141
144
|
|
|
142
|
-
|
|
145
|
+
##### Example
|
|
143
146
|
|
|
144
147
|
```typescript
|
|
145
148
|
const tokenResponse = await client.user.token('your-sso-token');
|
|
@@ -148,7 +151,7 @@ console.log('Access token:', tokenResponse.accessToken);
|
|
|
148
151
|
|
|
149
152
|
---
|
|
150
153
|
|
|
151
|
-
|
|
154
|
+
#### recommendations
|
|
152
155
|
|
|
153
156
|
Get recommended articles for the authenticated user.
|
|
154
157
|
|
|
@@ -156,28 +159,27 @@ Get recommended articles for the authenticated user.
|
|
|
156
159
|
client.user.recommendations(options?: RecommendationsRequest): Promise<RecommendationsResponse>
|
|
157
160
|
```
|
|
158
161
|
|
|
159
|
-
|
|
162
|
+
##### Parameters
|
|
160
163
|
|
|
161
164
|
- `options.limit` (optional): Maximum number of recommendations to return
|
|
162
165
|
- `options.cursor` (optional): Cursor from previous response to fetch the next page
|
|
163
166
|
|
|
164
|
-
|
|
167
|
+
##### Returns
|
|
165
168
|
|
|
166
169
|
- `Promise<RecommendationsResponse>`: Response containing:
|
|
167
170
|
- `items?: Array<RecommendationItem>`: List of recommended articles
|
|
168
171
|
- `cursor?: string`: Cursor to request the next page, if any
|
|
169
172
|
|
|
170
|
-
|
|
173
|
+
##### RecommendationItem
|
|
171
174
|
|
|
172
175
|
- `id?: string`: Your article ID
|
|
173
176
|
- `assetId?: string`: BitBitPress's ID
|
|
174
177
|
- `title?: string`: Article title
|
|
175
|
-
- `summary?: string`: Generated summary
|
|
176
178
|
- `content?: string`: Article content
|
|
177
179
|
- `publishedAt?: string`: Publication date (e.g., "2021-01-01")
|
|
178
180
|
- `score?: number`: Recommendation score (e.g., 0.95)
|
|
179
181
|
|
|
180
|
-
|
|
182
|
+
##### Example
|
|
181
183
|
|
|
182
184
|
```typescript
|
|
183
185
|
const recommendations = await client.user.recommendations({
|
|
@@ -189,13 +191,13 @@ console.log('Recommendations:', recommendations.items);
|
|
|
189
191
|
console.log('Next cursor:', recommendations.cursor);
|
|
190
192
|
```
|
|
191
193
|
|
|
192
|
-
|
|
194
|
+
##### Throws
|
|
193
195
|
|
|
194
196
|
- `Error`: If the request fails or no data is returned
|
|
195
197
|
|
|
196
198
|
---
|
|
197
199
|
|
|
198
|
-
|
|
200
|
+
#### signal
|
|
199
201
|
|
|
200
202
|
Record a user signal (e.g., clicked topic, read article) to inform profile interests. Signals are used to power a user's recommendations.
|
|
201
203
|
|
|
@@ -203,28 +205,28 @@ Record a user signal (e.g., clicked topic, read article) to inform profile inter
|
|
|
203
205
|
client.user.signal(options: SignalRequest): Promise<SignalResponse>
|
|
204
206
|
```
|
|
205
207
|
|
|
206
|
-
|
|
208
|
+
##### Parameters
|
|
207
209
|
|
|
208
|
-
- `options.signal` (required): User action with the text associated with the interaction (e.g., `'
|
|
210
|
+
- `options.signal` (required): User action with the text associated with the interaction (e.g., `'searched for \"best restaurants\"'`)
|
|
209
211
|
- `options.type` (required): Signal type - `"active"` or `"passive"`
|
|
210
212
|
- `"active"`: Explicit intent (click, search, subscribe)
|
|
211
213
|
- `"passive"`: Implicit intent (read, scroll, dwell)
|
|
212
214
|
- `options.negative` (optional): When `true`, indicates the signal is negative (e.g., dislike, unfollow). Defaults to `false`. Use sparingly.
|
|
213
215
|
- `options.contentContext` (optional): Context about the content that triggered this signal
|
|
214
|
-
- `contentId` (required): The ID of the content (e.g., article ID)
|
|
216
|
+
- `contentId` (required): The ID of the content (e.g., your article ID)
|
|
215
217
|
- `contentType` (required): The type of content (currently only `"article"`)
|
|
216
218
|
|
|
217
|
-
|
|
219
|
+
##### Returns
|
|
218
220
|
|
|
219
221
|
- `Promise<SignalResponse>`: Response containing:
|
|
220
|
-
- `recorded?: boolean`: Whether the signal was recorded (false if no
|
|
222
|
+
- `recorded?: boolean`: Whether the signal was recorded (false if no user or empty signal)
|
|
221
223
|
|
|
222
|
-
|
|
224
|
+
##### Example
|
|
223
225
|
|
|
224
226
|
```typescript
|
|
225
227
|
// Active signal (explicit intent)
|
|
226
228
|
await client.user.signal({
|
|
227
|
-
signal: '
|
|
229
|
+
signal: 'searched "best restaurants"',
|
|
228
230
|
type: 'active',
|
|
229
231
|
contentContext: {
|
|
230
232
|
contentId: 'article-123',
|
|
@@ -250,13 +252,13 @@ await client.user.signal({
|
|
|
250
252
|
});
|
|
251
253
|
```
|
|
252
254
|
|
|
253
|
-
|
|
255
|
+
##### Throws
|
|
254
256
|
|
|
255
257
|
- `Error`: If the request fails or no data is returned
|
|
256
258
|
|
|
257
259
|
---
|
|
258
260
|
|
|
259
|
-
|
|
261
|
+
#### synthesizeItem
|
|
260
262
|
|
|
261
263
|
Synthesize a single item (batched). Items are automatically batched and sent together after the configured timeout. Returns a promise that resolves with the `data` field from the event (excluding 'connected' and 'complete' events).
|
|
262
264
|
|
|
@@ -264,17 +266,17 @@ Synthesize a single item (batched). Items are automatically batched and sent tog
|
|
|
264
266
|
client.user.synthesizeItem(item: SynthesizeRequest['items'][number]): Promise<unknown>
|
|
265
267
|
```
|
|
266
268
|
|
|
267
|
-
|
|
269
|
+
##### Parameters
|
|
268
270
|
|
|
269
271
|
- `item` (required): A single synthesize item (same format as items in `synthesize`)
|
|
270
272
|
|
|
271
|
-
|
|
273
|
+
##### Returns
|
|
272
274
|
|
|
273
275
|
- `Promise<unknown>`: A promise that resolves with the `data` field from the event for this specific item. The data will be:
|
|
274
276
|
- For `DAILY_SUMMARY`: `{ summary: string | null }`
|
|
275
277
|
- For `CUSTOM`: An object following your schema input, where `fieldNames` are keys
|
|
276
278
|
|
|
277
|
-
|
|
279
|
+
##### Behavior
|
|
278
280
|
|
|
279
281
|
- Items added within the batch timeout window (default: 250ms) are grouped together and sent in a single request
|
|
280
282
|
- Each item's promise resolves immediately when its data event arrives (based on the `index` field)
|
|
@@ -282,7 +284,7 @@ client.user.synthesizeItem(item: SynthesizeRequest['items'][number]): Promise<un
|
|
|
282
284
|
- Only data events (DAILY_SUMMARY or CUSTOM) resolve the promise - 'connected' and 'complete' events are ignored
|
|
283
285
|
- The batch timeout can be configured when creating the client via `synthesizeBatchTimeout`
|
|
284
286
|
|
|
285
|
-
|
|
287
|
+
##### Example
|
|
286
288
|
|
|
287
289
|
```typescript
|
|
288
290
|
// Items are automatically batched and sent together after the timeout
|
|
@@ -310,7 +312,7 @@ console.log('Custom data:', customData);
|
|
|
310
312
|
|
|
311
313
|
---
|
|
312
314
|
|
|
313
|
-
|
|
315
|
+
#### synthesize
|
|
314
316
|
|
|
315
317
|
Synthesize user content (streaming). Returns a stream of events for all items.
|
|
316
318
|
|
|
@@ -318,27 +320,27 @@ Synthesize user content (streaming). Returns a stream of events for all items.
|
|
|
318
320
|
client.user.synthesize(items: SynthesizeRequest['items']): Promise<AsyncIterable<SynthesizeEvent>>
|
|
319
321
|
```
|
|
320
322
|
|
|
321
|
-
|
|
323
|
+
##### Parameters
|
|
322
324
|
|
|
323
325
|
- `items` (required): Array of items to synthesize. Each item can be:
|
|
324
326
|
- `{ type: "DAILY_SUMMARY" }`: Generate a daily summary
|
|
325
327
|
- `{ type: "CUSTOM", schema: Array<SchemaField>, contentContext: ContentContext }`: Custom synthesis with schema (contentContext is required for CUSTOM items)
|
|
326
328
|
|
|
327
|
-
|
|
329
|
+
##### SchemaField
|
|
328
330
|
|
|
329
331
|
- `fieldName` (required): Name of the field
|
|
330
332
|
- `fieldDescription` (required): A prompt describing the value of the field
|
|
331
333
|
|
|
332
|
-
|
|
334
|
+
##### ContentContext (required for CUSTOM items)
|
|
333
335
|
|
|
334
336
|
- `contentId` (optional): Your content ID
|
|
335
337
|
- `contentType` (optional): The type of content to synthesize (currently only `"article"`)
|
|
336
338
|
|
|
337
|
-
|
|
339
|
+
##### Returns
|
|
338
340
|
|
|
339
341
|
- `Promise<AsyncIterable<SynthesizeEvent>>`: An async iterable stream of events
|
|
340
342
|
|
|
341
|
-
|
|
343
|
+
##### SynthesizeEvent
|
|
342
344
|
|
|
343
345
|
Events in the stream can be:
|
|
344
346
|
|
|
@@ -347,7 +349,7 @@ Events in the stream can be:
|
|
|
347
349
|
- `{ type: "CUSTOM", index: number, data: {...} }`: Custom data following your schema
|
|
348
350
|
- `{ type: "complete" }`: Stream complete
|
|
349
351
|
|
|
350
|
-
|
|
352
|
+
##### Example
|
|
351
353
|
|
|
352
354
|
```typescript
|
|
353
355
|
const stream = await client.user.synthesize([
|
|
@@ -387,9 +389,9 @@ for await (const event of stream) {
|
|
|
387
389
|
|
|
388
390
|
---
|
|
389
391
|
|
|
390
|
-
|
|
392
|
+
### Types
|
|
391
393
|
|
|
392
|
-
|
|
394
|
+
#### BitBitPressClientConfig
|
|
393
395
|
|
|
394
396
|
```typescript
|
|
395
397
|
interface BitBitPressClientConfig {
|
|
@@ -401,7 +403,7 @@ interface BitBitPressClientConfig {
|
|
|
401
403
|
}
|
|
402
404
|
```
|
|
403
405
|
|
|
404
|
-
|
|
406
|
+
#### TokenRequest
|
|
405
407
|
|
|
406
408
|
```typescript
|
|
407
409
|
type TokenRequest = {
|
|
@@ -409,7 +411,7 @@ type TokenRequest = {
|
|
|
409
411
|
}
|
|
410
412
|
```
|
|
411
413
|
|
|
412
|
-
|
|
414
|
+
#### TokenResponse
|
|
413
415
|
|
|
414
416
|
```typescript
|
|
415
417
|
type TokenResponse = {
|
|
@@ -420,7 +422,7 @@ type TokenResponse = {
|
|
|
420
422
|
}
|
|
421
423
|
```
|
|
422
424
|
|
|
423
|
-
|
|
425
|
+
#### RecommendationsRequest
|
|
424
426
|
|
|
425
427
|
```typescript
|
|
426
428
|
type RecommendationsRequest = {
|
|
@@ -429,7 +431,7 @@ type RecommendationsRequest = {
|
|
|
429
431
|
}
|
|
430
432
|
```
|
|
431
433
|
|
|
432
|
-
|
|
434
|
+
#### RecommendationsResponse
|
|
433
435
|
|
|
434
436
|
```typescript
|
|
435
437
|
type RecommendationsResponse = {
|
|
@@ -446,7 +448,7 @@ type RecommendationsResponse = {
|
|
|
446
448
|
}
|
|
447
449
|
```
|
|
448
450
|
|
|
449
|
-
|
|
451
|
+
#### SignalRequest
|
|
450
452
|
|
|
451
453
|
```typescript
|
|
452
454
|
type SignalRequest = {
|
|
@@ -460,7 +462,7 @@ type SignalRequest = {
|
|
|
460
462
|
}
|
|
461
463
|
```
|
|
462
464
|
|
|
463
|
-
|
|
465
|
+
#### SignalResponse
|
|
464
466
|
|
|
465
467
|
```typescript
|
|
466
468
|
type SignalResponse = {
|
|
@@ -468,7 +470,7 @@ type SignalResponse = {
|
|
|
468
470
|
}
|
|
469
471
|
```
|
|
470
472
|
|
|
471
|
-
|
|
473
|
+
#### SynthesizeRequest
|
|
472
474
|
|
|
473
475
|
```typescript
|
|
474
476
|
type SynthesizeRequest = {
|
|
@@ -489,7 +491,7 @@ type SynthesizeRequest = {
|
|
|
489
491
|
}
|
|
490
492
|
```
|
|
491
493
|
|
|
492
|
-
|
|
494
|
+
#### SynthesizeEvent
|
|
493
495
|
|
|
494
496
|
```typescript
|
|
495
497
|
type SynthesizeEvent = {
|
package/dist/client.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type UserMethods } from './user/index.js';
|
|
1
2
|
/**
|
|
2
3
|
* Configuration for the BitBitPress client
|
|
3
4
|
*/
|
|
@@ -39,6 +40,7 @@ export interface BitBitPressClientOptions extends BitBitPressClientConfig {
|
|
|
39
40
|
*/
|
|
40
41
|
export declare class BitBitPressClient {
|
|
41
42
|
private config;
|
|
43
|
+
private userMethodsInstance?;
|
|
42
44
|
constructor(options: BitBitPressClientOptions);
|
|
43
45
|
/**
|
|
44
46
|
* Update the base URL
|
|
@@ -54,32 +56,8 @@ export declare class BitBitPressClient {
|
|
|
54
56
|
private getSynthesizeBatchTimeout;
|
|
55
57
|
/**
|
|
56
58
|
* User-related API methods
|
|
59
|
+
* Provides type-safe access to user endpoints like signal, recommendations, synthesize, etc.
|
|
57
60
|
*/
|
|
58
|
-
get user():
|
|
59
|
-
authenticate(ssoToken: string): Promise<void>;
|
|
60
|
-
token: (ssoToken: import("./user/token.js").TokenRequest["ssoToken"]) => Promise<{
|
|
61
|
-
idToken?: string;
|
|
62
|
-
accessToken?: string;
|
|
63
|
-
refreshToken?: string;
|
|
64
|
-
expiresIn?: number;
|
|
65
|
-
}>;
|
|
66
|
-
recommendations: (options?: import("./user/recommendations.js").RecommendationsRequest) => Promise<{
|
|
67
|
-
items?: {
|
|
68
|
-
id?: string;
|
|
69
|
-
assetId?: string;
|
|
70
|
-
title?: string;
|
|
71
|
-
summary?: string;
|
|
72
|
-
content?: string;
|
|
73
|
-
publishedAt?: string;
|
|
74
|
-
score?: number;
|
|
75
|
-
}[];
|
|
76
|
-
cursor?: string;
|
|
77
|
-
}>;
|
|
78
|
-
signal: (options: import("./user/signal.js").SignalRequest) => Promise<{
|
|
79
|
-
recorded?: boolean;
|
|
80
|
-
}>;
|
|
81
|
-
synthesize: (items: import("./user/typeDefs.js").SynthesizeRequest["items"]) => Promise<AsyncIterable<import("./user/synthesize.js").SynthesizeEvent>>;
|
|
82
|
-
synthesizeItem: (item: import("./user/typeDefs.js").SynthesizeRequest["items"][number]) => Promise<unknown>;
|
|
83
|
-
};
|
|
61
|
+
get user(): UserMethods;
|
|
84
62
|
}
|
|
85
63
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEtE;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IAErB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEjC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;OAIG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,wBAAyB,SAAQ,uBAAuB;CAAG;AAE5E;;;;;GAKG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CACkE;IAChF,OAAO,CAAC,mBAAmB,CAAC,CAAc;gBAE9B,OAAO,EAAE,wBAAwB;IAqB7C;;OAEG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAMjC;;OAEG;IACH,OAAO,CAAC,gBAAgB;IASxB;;OAEG;IACH,OAAO,CAAC,yBAAyB;IAIjC;;;OAGG;IACH,IAAI,IAAI,IAAI,WAAW,CAQtB;CACF"}
|
package/dist/client.js
CHANGED
|
@@ -10,6 +10,7 @@ const index_js_1 = require("./user/index.js");
|
|
|
10
10
|
*/
|
|
11
11
|
class BitBitPressClient {
|
|
12
12
|
config;
|
|
13
|
+
userMethodsInstance;
|
|
13
14
|
constructor(options) {
|
|
14
15
|
if (!options.baseUrl) {
|
|
15
16
|
throw new Error('baseUrl is required. Please provide your custom Control Room API Url.');
|
|
@@ -31,6 +32,8 @@ class BitBitPressClient {
|
|
|
31
32
|
*/
|
|
32
33
|
setBaseUrl(baseUrl) {
|
|
33
34
|
this.config.baseUrl = baseUrl;
|
|
35
|
+
// Invalidate cached user methods instance so it gets recreated with new baseUrl
|
|
36
|
+
this.userMethodsInstance = undefined;
|
|
34
37
|
}
|
|
35
38
|
/**
|
|
36
39
|
* Get request configuration for making API calls
|
|
@@ -51,9 +54,13 @@ class BitBitPressClient {
|
|
|
51
54
|
}
|
|
52
55
|
/**
|
|
53
56
|
* User-related API methods
|
|
57
|
+
* Provides type-safe access to user endpoints like signal, recommendations, synthesize, etc.
|
|
54
58
|
*/
|
|
55
59
|
get user() {
|
|
56
|
-
|
|
60
|
+
if (!this.userMethodsInstance) {
|
|
61
|
+
this.userMethodsInstance = (0, index_js_1.createUserMethods)(this.getRequestConfig(), this.getSynthesizeBatchTimeout());
|
|
62
|
+
}
|
|
63
|
+
return this.userMethodsInstance;
|
|
57
64
|
}
|
|
58
65
|
}
|
|
59
66
|
exports.BitBitPressClient = BitBitPressClient;
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;AACA,8CAAsE;AAwCtE;;;;;GAKG;AACH,MAAa,iBAAiB;IACpB,MAAM,CACkE;IACxE,mBAAmB,CAAe;IAE1C,YAAY,OAAiC;QAC3C,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CAAC,uEAAuE,CAAC,CAAC;QAC3F,CAAC;QAED,IAAI,CAAC,MAAM,GAAG;YACZ,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,KAAK;YACjC,sBAAsB,EAAE,OAAO,CAAC,sBAAsB;YACtD,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC,OAAO,UAAU,KAAK,WAAW,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;YAC1F,OAAO,EAAE,OAAO,CAAC,OAAO;SACzB,CAAC;QAEF,8BAA8B;QAC9B,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CACb,iIAAiI,CAClI,CAAC;QACJ,CAAC;IACH,CAAC;IAED;;OAEG;IACH,UAAU,CAAC,OAAe;QACxB,IAAI,CAAC,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC;QAC9B,gFAAgF;QAChF,IAAI,CAAC,mBAAmB,GAAG,SAAS,CAAC;IACvC,CAAC;IAED;;OAEG;IACK,gBAAgB;QACtB,OAAO;YACL,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO;YAC5B,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO;YAC5B,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,KAAM;YACzB,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO;SAC7B,CAAC;IACJ,CAAC;IAED;;OAEG;IACK,yBAAyB;QAC/B,OAAO,IAAI,CAAC,MAAM,CAAC,sBAAsB,CAAC;IAC5C,CAAC;IAED;;;OAGG;IACH,IAAI,IAAI;QACN,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,CAAC;YAC9B,IAAI,CAAC,mBAAmB,GAAG,IAAA,4BAAiB,EAC1C,IAAI,CAAC,gBAAgB,EAAE,EACvB,IAAI,CAAC,yBAAyB,EAAE,CACjC,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,CAAC,mBAAmB,CAAC;IAClC,CAAC;CACF;AAnED,8CAmEC"}
|