@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.
- package/README.md +142 -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 +703 -6
- package/dist/generated/openapi.ts +7 -0
- package/dist/index.d.ts +8 -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 +50 -30
- package/dist/user/index.d.ts.map +1 -1
- package/dist/user/index.js +5 -22
- package/dist/user/index.js.map +1 -1
- package/dist/user/profile.d.ts +11 -0
- package/dist/user/profile.d.ts.map +1 -0
- package/dist/user/profile.js +21 -0
- package/dist/user/profile.js.map +1 -0
- 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/report.d.ts +13 -0
- package/dist/user/report.d.ts.map +1 -0
- package/dist/user/report.js +23 -0
- package/dist/user/report.js.map +1 -0
- 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,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
|
-
|
|
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
|
-
|
|
54
|
+
### BitBitPressClient
|
|
50
55
|
|
|
51
56
|
Main client class for interacting with the BitBitPress API.
|
|
52
57
|
|
|
53
|
-
|
|
58
|
+
#### Constructor
|
|
54
59
|
|
|
55
60
|
```typescript
|
|
56
61
|
new BitBitPressClient(options: BitBitPressClientOptions)
|
|
57
62
|
```
|
|
58
63
|
|
|
59
|
-
|
|
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
|
-
|
|
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
|
-
|
|
82
|
+
##### Methods
|
|
78
83
|
|
|
79
|
-
|
|
84
|
+
##### `setBaseUrl(baseUrl: string): void`
|
|
80
85
|
|
|
81
86
|
Update the base URL for API requests.
|
|
82
87
|
|
|
83
|
-
|
|
88
|
+
##### `get user`
|
|
84
89
|
|
|
85
90
|
Returns an object with user-related API methods. See [User Methods](#user-methods) below.
|
|
86
91
|
|
|
87
|
-
|
|
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
|
-
|
|
96
|
+
### User Methods
|
|
92
97
|
|
|
93
|
-
|
|
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
|
-
|
|
106
|
+
##### Parameters
|
|
102
107
|
|
|
103
108
|
- `ssoToken` (required): The SSO token from your authentication provider
|
|
104
109
|
|
|
105
|
-
|
|
110
|
+
##### Returns
|
|
106
111
|
|
|
107
112
|
- `Promise<void>`: Resolves when authentication is complete
|
|
108
113
|
|
|
109
|
-
|
|
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
|
-
|
|
121
|
+
##### Throws
|
|
117
122
|
|
|
118
123
|
- `Error`: If token exchange fails or no access token is returned
|
|
119
124
|
|
|
120
125
|
---
|
|
121
126
|
|
|
122
|
-
|
|
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
|
-
|
|
135
|
+
##### Parameters
|
|
131
136
|
|
|
132
137
|
- `ssoToken` (required): The SSO token from your authentication provider
|
|
133
138
|
|
|
134
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
268
|
+
##### Parameters
|
|
207
269
|
|
|
208
|
-
- `options.signal` (required): User action with the text associated with the interaction (e.g., `'
|
|
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
|
-
|
|
279
|
+
##### Returns
|
|
218
280
|
|
|
219
281
|
- `Promise<SignalResponse>`: Response containing:
|
|
220
|
-
- `recorded?: boolean`: Whether the signal was recorded (false if no
|
|
282
|
+
- `recorded?: boolean`: Whether the signal was recorded (false if no user or empty signal)
|
|
221
283
|
|
|
222
|
-
|
|
284
|
+
##### Example
|
|
223
285
|
|
|
224
286
|
```typescript
|
|
225
287
|
// Active signal (explicit intent)
|
|
226
288
|
await client.user.signal({
|
|
227
|
-
signal: '
|
|
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
|
-
|
|
315
|
+
##### Throws
|
|
254
316
|
|
|
255
317
|
- `Error`: If the request fails or no data is returned
|
|
256
318
|
|
|
257
319
|
---
|
|
258
320
|
|
|
259
|
-
|
|
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
|
-
|
|
329
|
+
##### Parameters
|
|
268
330
|
|
|
269
331
|
- `item` (required): A single synthesize item (same format as items in `synthesize`)
|
|
270
332
|
|
|
271
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
399
|
+
##### Returns
|
|
338
400
|
|
|
339
401
|
- `Promise<AsyncIterable<SynthesizeEvent>>`: An async iterable stream of events
|
|
340
402
|
|
|
341
|
-
|
|
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
|
-
|
|
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
|
-
|
|
452
|
+
### Types
|
|
391
453
|
|
|
392
|
-
|
|
454
|
+
#### BitBitPressClientConfig
|
|
393
455
|
|
|
394
456
|
```typescript
|
|
395
457
|
interface BitBitPressClientConfig {
|
|
@@ -401,7 +463,7 @@ interface BitBitPressClientConfig {
|
|
|
401
463
|
}
|
|
402
464
|
```
|
|
403
465
|
|
|
404
|
-
|
|
466
|
+
#### TokenRequest
|
|
405
467
|
|
|
406
468
|
```typescript
|
|
407
469
|
type TokenRequest = {
|
|
@@ -409,7 +471,7 @@ type TokenRequest = {
|
|
|
409
471
|
}
|
|
410
472
|
```
|
|
411
473
|
|
|
412
|
-
|
|
474
|
+
#### TokenResponse
|
|
413
475
|
|
|
414
476
|
```typescript
|
|
415
477
|
type TokenResponse = {
|
|
@@ -420,7 +482,7 @@ type TokenResponse = {
|
|
|
420
482
|
}
|
|
421
483
|
```
|
|
422
484
|
|
|
423
|
-
|
|
485
|
+
#### RecommendationsRequest
|
|
424
486
|
|
|
425
487
|
```typescript
|
|
426
488
|
type RecommendationsRequest = {
|
|
@@ -429,7 +491,15 @@ type RecommendationsRequest = {
|
|
|
429
491
|
}
|
|
430
492
|
```
|
|
431
493
|
|
|
432
|
-
|
|
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
|
-
|
|
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
|
-
|
|
548
|
+
#### SignalResponse
|
|
464
549
|
|
|
465
550
|
```typescript
|
|
466
551
|
type SignalResponse = {
|
|
@@ -468,7 +553,7 @@ type SignalResponse = {
|
|
|
468
553
|
}
|
|
469
554
|
```
|
|
470
555
|
|
|
471
|
-
|
|
556
|
+
#### SynthesizeRequest
|
|
472
557
|
|
|
473
558
|
```typescript
|
|
474
559
|
type SynthesizeRequest = {
|
|
@@ -489,7 +574,7 @@ type SynthesizeRequest = {
|
|
|
489
574
|
}
|
|
490
575
|
```
|
|
491
576
|
|
|
492
|
-
|
|
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
|
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"}
|