@bitbitpress/client 0.1.1 → 0.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.
Files changed (41) hide show
  1. package/README.md +142 -57
  2. package/dist/client.d.ts +4 -26
  3. package/dist/client.d.ts.map +1 -1
  4. package/dist/client.js +8 -1
  5. package/dist/client.js.map +1 -1
  6. package/dist/generated/openapi.d.ts +703 -6
  7. package/dist/generated/openapi.ts +7 -0
  8. package/dist/index.d.ts +8 -0
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/request.d.ts.map +1 -1
  11. package/dist/request.js +1 -1
  12. package/dist/request.js.map +1 -1
  13. package/dist/user/index.d.ts +50 -30
  14. package/dist/user/index.d.ts.map +1 -1
  15. package/dist/user/index.js +5 -22
  16. package/dist/user/index.js.map +1 -1
  17. package/dist/user/profile.d.ts +11 -0
  18. package/dist/user/profile.d.ts.map +1 -0
  19. package/dist/user/profile.js +21 -0
  20. package/dist/user/profile.js.map +1 -0
  21. package/dist/user/recommendations.d.ts +4 -0
  22. package/dist/user/recommendations.d.ts.map +1 -1
  23. package/dist/user/recommendations.js +4 -0
  24. package/dist/user/recommendations.js.map +1 -1
  25. package/dist/user/report.d.ts +13 -0
  26. package/dist/user/report.d.ts.map +1 -0
  27. package/dist/user/report.js +23 -0
  28. package/dist/user/report.js.map +1 -0
  29. package/dist/user/signal.d.ts +4 -0
  30. package/dist/user/signal.d.ts.map +1 -1
  31. package/dist/user/signal.js +4 -0
  32. package/dist/user/signal.js.map +1 -1
  33. package/dist/user/synthesize.d.ts +4 -0
  34. package/dist/user/synthesize.d.ts.map +1 -1
  35. package/dist/user/synthesize.js +4 -0
  36. package/dist/user/synthesize.js.map +1 -1
  37. package/dist/user/token.d.ts +4 -0
  38. package/dist/user/token.d.ts.map +1 -1
  39. package/dist/user/token.js +4 -0
  40. package/dist/user/token.js.map +1 -1
  41. package/package.json +3 -2
package/README.md CHANGED
@@ -33,30 +33,35 @@ 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
- ### API Reference
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)
40
43
  - [User Methods](#user-methods)
41
44
  - [authenticate](#authenticate)
42
45
  - [token](#token)
46
+ - [profile](#profile)
43
47
  - [recommendations](#recommendations)
48
+ - [report](#report)
44
49
  - [signal](#signal)
45
50
  - [synthesizeItem](#synthesizeitem)
46
51
  - [synthesize](#synthesize)
47
52
  - [Types](#types)
48
53
 
49
- ## BitBitPressClient
54
+ ### BitBitPressClient
50
55
 
51
56
  Main client class for interacting with the BitBitPress API.
52
57
 
53
- ### Constructor
58
+ #### Constructor
54
59
 
55
60
  ```typescript
56
61
  new BitBitPressClient(options: BitBitPressClientOptions)
57
62
  ```
58
63
 
59
- #### Parameters
64
+ ##### Parameters
60
65
 
61
66
  - `options.baseUrl` (required): Base URL of the API server (your custom Control Room API Url)
62
67
  - `options.fetch` (optional): Custom fetch implementation (useful for React Native or Node.js polyfills)
@@ -64,7 +69,7 @@ new BitBitPressClient(options: BitBitPressClientOptions)
64
69
  - `options.timeout` (optional): Request timeout in milliseconds (default: `30000`)
65
70
  - `options.synthesizeBatchTimeout` (optional): Batch timeout for `synthesizeItem` in milliseconds (default: `250`)
66
71
 
67
- #### Example
72
+ ##### Example
68
73
 
69
74
  ```typescript
70
75
  const client = new BitBitPressClient({
@@ -74,23 +79,23 @@ const client = new BitBitPressClient({
74
79
  });
75
80
  ```
76
81
 
77
- ### Methods
82
+ ##### Methods
78
83
 
79
- #### `setBaseUrl(baseUrl: string): void`
84
+ ##### `setBaseUrl(baseUrl: string): void`
80
85
 
81
86
  Update the base URL for API requests.
82
87
 
83
- #### `get user`
88
+ ##### `get user`
84
89
 
85
90
  Returns an object with user-related API methods. See [User Methods](#user-methods) below.
86
91
 
87
- ## Authentication
92
+ ### Authentication
88
93
 
89
94
  All user methods require authentication. You must call `client.user.authenticate()` before using other user methods.
90
95
 
91
- ## User Methods
96
+ ### User Methods
92
97
 
93
- ### authenticate
98
+ #### authenticate
94
99
 
95
100
  Exchanges an SSO token for an authentication token and automatically sets it for all subsequent user method calls.
96
101
 
@@ -98,28 +103,28 @@ Exchanges an SSO token for an authentication token and automatically sets it for
98
103
  await client.user.authenticate(ssoToken: string): Promise<void>
99
104
  ```
100
105
 
101
- #### Parameters
106
+ ##### Parameters
102
107
 
103
108
  - `ssoToken` (required): The SSO token from your authentication provider
104
109
 
105
- #### Returns
110
+ ##### Returns
106
111
 
107
112
  - `Promise<void>`: Resolves when authentication is complete
108
113
 
109
- #### Example
114
+ ##### Example
110
115
 
111
116
  ```typescript
112
117
  await client.user.authenticate('your-user-s-auth-sso-token');
113
118
  // Token is now automatically set for all user methods
114
119
  ```
115
120
 
116
- #### Throws
121
+ ##### Throws
117
122
 
118
123
  - `Error`: If token exchange fails or no access token is returned
119
124
 
120
125
  ---
121
126
 
122
- ### token
127
+ #### token
123
128
 
124
129
  Exchanges an SSO token for an authentication token without automatically setting it for user methods.
125
130
 
@@ -127,11 +132,11 @@ Exchanges an SSO token for an authentication token without automatically setting
127
132
  client.user.token(ssoToken: string): Promise<TokenResponse>
128
133
  ```
129
134
 
130
- #### Parameters
135
+ ##### Parameters
131
136
 
132
137
  - `ssoToken` (required): The SSO token from your authentication provider
133
138
 
134
- #### Returns
139
+ ##### Returns
135
140
 
136
141
  - `Promise<TokenResponse>`: The token response containing:
137
142
  - `idToken?: string`
@@ -139,7 +144,7 @@ client.user.token(ssoToken: string): Promise<TokenResponse>
139
144
  - `refreshToken?: string`
140
145
  - `expiresIn?: number`
141
146
 
142
- #### Example
147
+ ##### Example
143
148
 
144
149
  ```typescript
145
150
  const tokenResponse = await client.user.token('your-sso-token');
@@ -148,7 +153,33 @@ console.log('Access token:', tokenResponse.accessToken);
148
153
 
149
154
  ---
150
155
 
151
- ### recommendations
156
+ #### profile
157
+
158
+ Get user profile information, including suggested interest topics.
159
+
160
+ ```typescript
161
+ client.user.profile(): Promise<ProfileResponse>
162
+ ```
163
+
164
+ ##### Returns
165
+
166
+ - `Promise<ProfileResponse>`: Response containing:
167
+ - `suggestedInterestTopics?: string[]`: Suggested interest topics for the user
168
+
169
+ ##### Example
170
+
171
+ ```typescript
172
+ const profile = await client.user.profile();
173
+ console.log('Suggested topics:', profile.suggestedInterestTopics);
174
+ ```
175
+
176
+ ##### Throws
177
+
178
+ - `Error`: If the request fails or no data is returned
179
+
180
+ ---
181
+
182
+ #### recommendations
152
183
 
153
184
  Get recommended articles for the authenticated user.
154
185
 
@@ -156,28 +187,27 @@ Get recommended articles for the authenticated user.
156
187
  client.user.recommendations(options?: RecommendationsRequest): Promise<RecommendationsResponse>
157
188
  ```
158
189
 
159
- #### Parameters
190
+ ##### Parameters
160
191
 
161
192
  - `options.limit` (optional): Maximum number of recommendations to return
162
193
  - `options.cursor` (optional): Cursor from previous response to fetch the next page
163
194
 
164
- #### Returns
195
+ ##### Returns
165
196
 
166
197
  - `Promise<RecommendationsResponse>`: Response containing:
167
198
  - `items?: Array<RecommendationItem>`: List of recommended articles
168
199
  - `cursor?: string`: Cursor to request the next page, if any
169
200
 
170
- #### RecommendationItem
201
+ ##### RecommendationItem
171
202
 
172
203
  - `id?: string`: Your article ID
173
204
  - `assetId?: string`: BitBitPress's ID
174
205
  - `title?: string`: Article title
175
- - `summary?: string`: Generated summary
176
206
  - `content?: string`: Article content
177
207
  - `publishedAt?: string`: Publication date (e.g., "2021-01-01")
178
208
  - `score?: number`: Recommendation score (e.g., 0.95)
179
209
 
180
- #### Example
210
+ ##### Example
181
211
 
182
212
  ```typescript
183
213
  const recommendations = await client.user.recommendations({
@@ -189,13 +219,45 @@ console.log('Recommendations:', recommendations.items);
189
219
  console.log('Next cursor:', recommendations.cursor);
190
220
  ```
191
221
 
192
- #### Throws
222
+ ##### Throws
223
+
224
+ - `Error`: If the request fails or no data is returned
225
+
226
+ ---
227
+
228
+ #### report
229
+
230
+ Report a bit (create a user-provided bit to be ingested into the system). This may include news or any other content that the user wants to share.
231
+
232
+ ```typescript
233
+ client.user.report(options: ReportRequest): Promise<ReportResponse>
234
+ ```
235
+
236
+ ##### Parameters
237
+
238
+ - `options.title` (optional): Title of the reported content
239
+ - `options.content` (required): Content body of the report
240
+
241
+ ##### Returns
242
+
243
+ - `Promise<ReportResponse>`: Response containing the report data
244
+
245
+ ##### Example
246
+
247
+ ```typescript
248
+ await client.user.report({
249
+ title: 'Breaking News: Important Update',
250
+ content: 'This is the content of the news article or bit that the user wants to share.',
251
+ });
252
+ ```
253
+
254
+ ##### Throws
193
255
 
194
256
  - `Error`: If the request fails or no data is returned
195
257
 
196
258
  ---
197
259
 
198
- ### signal
260
+ #### signal
199
261
 
200
262
  Record a user signal (e.g., clicked topic, read article) to inform profile interests. Signals are used to power a user's recommendations.
201
263
 
@@ -203,28 +265,28 @@ Record a user signal (e.g., clicked topic, read article) to inform profile inter
203
265
  client.user.signal(options: SignalRequest): Promise<SignalResponse>
204
266
  ```
205
267
 
206
- #### Parameters
268
+ ##### Parameters
207
269
 
208
- - `options.signal` (required): User action with the text associated with the interaction (e.g., `'clicked "Warriors intend to keep Jimmy Butler despite season-ending injury"'`)
270
+ - `options.signal` (required): User action with the text associated with the interaction (e.g., `'searched for \"best restaurants\"'`)
209
271
  - `options.type` (required): Signal type - `"active"` or `"passive"`
210
272
  - `"active"`: Explicit intent (click, search, subscribe)
211
273
  - `"passive"`: Implicit intent (read, scroll, dwell)
212
274
  - `options.negative` (optional): When `true`, indicates the signal is negative (e.g., dislike, unfollow). Defaults to `false`. Use sparingly.
213
275
  - `options.contentContext` (optional): Context about the content that triggered this signal
214
- - `contentId` (required): The ID of the content (e.g., article ID)
276
+ - `contentId` (required): The ID of the content (e.g., your article ID)
215
277
  - `contentType` (required): The type of content (currently only `"article"`)
216
278
 
217
- #### Returns
279
+ ##### Returns
218
280
 
219
281
  - `Promise<SignalResponse>`: Response containing:
220
- - `recorded?: boolean`: Whether the signal was recorded (false if no app user or empty signal)
282
+ - `recorded?: boolean`: Whether the signal was recorded (false if no user or empty signal)
221
283
 
222
- #### Example
284
+ ##### Example
223
285
 
224
286
  ```typescript
225
287
  // Active signal (explicit intent)
226
288
  await client.user.signal({
227
- signal: 'clicked "Warriors intend to keep Jimmy Butler despite season-ending injury"',
289
+ signal: 'searched "best restaurants"',
228
290
  type: 'active',
229
291
  contentContext: {
230
292
  contentId: 'article-123',
@@ -250,13 +312,13 @@ await client.user.signal({
250
312
  });
251
313
  ```
252
314
 
253
- #### Throws
315
+ ##### Throws
254
316
 
255
317
  - `Error`: If the request fails or no data is returned
256
318
 
257
319
  ---
258
320
 
259
- ### synthesizeItem
321
+ #### synthesizeItem
260
322
 
261
323
  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
324
 
@@ -264,17 +326,17 @@ Synthesize a single item (batched). Items are automatically batched and sent tog
264
326
  client.user.synthesizeItem(item: SynthesizeRequest['items'][number]): Promise<unknown>
265
327
  ```
266
328
 
267
- #### Parameters
329
+ ##### Parameters
268
330
 
269
331
  - `item` (required): A single synthesize item (same format as items in `synthesize`)
270
332
 
271
- #### Returns
333
+ ##### Returns
272
334
 
273
335
  - `Promise<unknown>`: A promise that resolves with the `data` field from the event for this specific item. The data will be:
274
336
  - For `DAILY_SUMMARY`: `{ summary: string | null }`
275
337
  - For `CUSTOM`: An object following your schema input, where `fieldNames` are keys
276
338
 
277
- #### Behavior
339
+ ##### Behavior
278
340
 
279
341
  - Items added within the batch timeout window (default: 250ms) are grouped together and sent in a single request
280
342
  - Each item's promise resolves immediately when its data event arrives (based on the `index` field)
@@ -282,7 +344,7 @@ client.user.synthesizeItem(item: SynthesizeRequest['items'][number]): Promise<un
282
344
  - Only data events (DAILY_SUMMARY or CUSTOM) resolve the promise - 'connected' and 'complete' events are ignored
283
345
  - The batch timeout can be configured when creating the client via `synthesizeBatchTimeout`
284
346
 
285
- #### Example
347
+ ##### Example
286
348
 
287
349
  ```typescript
288
350
  // Items are automatically batched and sent together after the timeout
@@ -310,7 +372,7 @@ console.log('Custom data:', customData);
310
372
 
311
373
  ---
312
374
 
313
- ### synthesize
375
+ #### synthesize
314
376
 
315
377
  Synthesize user content (streaming). Returns a stream of events for all items.
316
378
 
@@ -318,27 +380,27 @@ Synthesize user content (streaming). Returns a stream of events for all items.
318
380
  client.user.synthesize(items: SynthesizeRequest['items']): Promise<AsyncIterable<SynthesizeEvent>>
319
381
  ```
320
382
 
321
- #### Parameters
383
+ ##### Parameters
322
384
 
323
385
  - `items` (required): Array of items to synthesize. Each item can be:
324
386
  - `{ type: "DAILY_SUMMARY" }`: Generate a daily summary
325
387
  - `{ type: "CUSTOM", schema: Array<SchemaField>, contentContext: ContentContext }`: Custom synthesis with schema (contentContext is required for CUSTOM items)
326
388
 
327
- #### SchemaField
389
+ ##### SchemaField
328
390
 
329
391
  - `fieldName` (required): Name of the field
330
392
  - `fieldDescription` (required): A prompt describing the value of the field
331
393
 
332
- #### ContentContext (required for CUSTOM items)
394
+ ##### ContentContext (required for CUSTOM items)
333
395
 
334
396
  - `contentId` (optional): Your content ID
335
397
  - `contentType` (optional): The type of content to synthesize (currently only `"article"`)
336
398
 
337
- #### Returns
399
+ ##### Returns
338
400
 
339
401
  - `Promise<AsyncIterable<SynthesizeEvent>>`: An async iterable stream of events
340
402
 
341
- #### SynthesizeEvent
403
+ ##### SynthesizeEvent
342
404
 
343
405
  Events in the stream can be:
344
406
 
@@ -347,7 +409,7 @@ Events in the stream can be:
347
409
  - `{ type: "CUSTOM", index: number, data: {...} }`: Custom data following your schema
348
410
  - `{ type: "complete" }`: Stream complete
349
411
 
350
- #### Example
412
+ ##### Example
351
413
 
352
414
  ```typescript
353
415
  const stream = await client.user.synthesize([
@@ -387,9 +449,9 @@ for await (const event of stream) {
387
449
 
388
450
  ---
389
451
 
390
- ## Types
452
+ ### Types
391
453
 
392
- ### BitBitPressClientConfig
454
+ #### BitBitPressClientConfig
393
455
 
394
456
  ```typescript
395
457
  interface BitBitPressClientConfig {
@@ -401,7 +463,7 @@ interface BitBitPressClientConfig {
401
463
  }
402
464
  ```
403
465
 
404
- ### TokenRequest
466
+ #### TokenRequest
405
467
 
406
468
  ```typescript
407
469
  type TokenRequest = {
@@ -409,7 +471,7 @@ type TokenRequest = {
409
471
  }
410
472
  ```
411
473
 
412
- ### TokenResponse
474
+ #### TokenResponse
413
475
 
414
476
  ```typescript
415
477
  type TokenResponse = {
@@ -420,7 +482,7 @@ type TokenResponse = {
420
482
  }
421
483
  ```
422
484
 
423
- ### RecommendationsRequest
485
+ #### RecommendationsRequest
424
486
 
425
487
  ```typescript
426
488
  type RecommendationsRequest = {
@@ -429,7 +491,15 @@ type RecommendationsRequest = {
429
491
  }
430
492
  ```
431
493
 
432
- ### RecommendationsResponse
494
+ #### ProfileResponse
495
+
496
+ ```typescript
497
+ type ProfileResponse = {
498
+ suggestedInterestTopics?: string[];
499
+ }
500
+ ```
501
+
502
+ #### RecommendationsResponse
433
503
 
434
504
  ```typescript
435
505
  type RecommendationsResponse = {
@@ -446,7 +516,22 @@ type RecommendationsResponse = {
446
516
  }
447
517
  ```
448
518
 
449
- ### SignalRequest
519
+ #### ReportRequest
520
+
521
+ ```typescript
522
+ type ReportRequest = {
523
+ title?: string;
524
+ content: string;
525
+ }
526
+ ```
527
+
528
+ #### ReportResponse
529
+
530
+ ```typescript
531
+ type ReportResponse = unknown;
532
+ ```
533
+
534
+ #### SignalRequest
450
535
 
451
536
  ```typescript
452
537
  type SignalRequest = {
@@ -460,7 +545,7 @@ type SignalRequest = {
460
545
  }
461
546
  ```
462
547
 
463
- ### SignalResponse
548
+ #### SignalResponse
464
549
 
465
550
  ```typescript
466
551
  type SignalResponse = {
@@ -468,7 +553,7 @@ type SignalResponse = {
468
553
  }
469
554
  ```
470
555
 
471
- ### SynthesizeRequest
556
+ #### SynthesizeRequest
472
557
 
473
558
  ```typescript
474
559
  type SynthesizeRequest = {
@@ -489,7 +574,7 @@ type SynthesizeRequest = {
489
574
  }
490
575
  ```
491
576
 
492
- ### SynthesizeEvent
577
+ #### SynthesizeEvent
493
578
 
494
579
  ```typescript
495
580
  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
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAGA;;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;gBAEpE,OAAO,EAAE,wBAAwB;IAqB7C;;OAEG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIjC;;OAEG;IACH,OAAO,CAAC,gBAAgB;IASxB;;OAEG;IACH,OAAO,CAAC,yBAAyB;IAIjC;;OAEG;IACH,IAAI,IAAI;;;;;;;;;;kBAIq4G,CAAC;uBAA0H,CAAC;qBAA6G,CAAC;uBAA2H,CAAC;uBAAiH,CAAC;2BAAwH,CAAC;qBAA4G,CAAC;;;;;;;;+BANnkI,uDAET;MAEE;CACF"}
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
- return (0, index_js_1.createUserMethods)(this.getRequestConfig(), this.getSynthesizeBatchTimeout());
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;
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;AACA,8CAAoD;AAwCpD;;;;;GAKG;AACH,MAAa,iBAAiB;IACpB,MAAM,CACkE;IAEhF,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;IAChC,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,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