@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.
@@ -1,8 +1,511 @@
1
1
  /**
2
- * Re-export OpenAPI types generated by openapi-typescript
3
- *
4
- * The actual types are generated in openapi.d.ts by running:
5
- * npm run generate:types
2
+ * This file was auto-generated by openapi-typescript.
3
+ * Do not make direct changes to the file.
6
4
  */
7
- export type * from './openapi.d.js';
8
- //# sourceMappingURL=openapi.d.ts.map
5
+
6
+ export interface paths {
7
+ "/v1/auth/token": {
8
+ parameters: {
9
+ query?: never;
10
+ header?: never;
11
+ path?: never;
12
+ cookie?: never;
13
+ };
14
+ get?: never;
15
+ put?: never;
16
+ /**
17
+ * Get Authentication Bearer Token
18
+ * @description **POST** `/v1/auth/token`
19
+ *
20
+ * Exchange a token from your SSO provider (OIDC) for a BitBitPress authentication token required to use other endpoints.
21
+ *
22
+ * ### Setup
23
+ *
24
+ * Provide the following information to your BitBitPress contact:
25
+ *
26
+ * **For OIDC Providers:**
27
+ * - Issuer URL (e.g., `https://your-idp.com/.well-known/jwks.json`)
28
+ * - Client ID and Client Secret
29
+ *
30
+ * **For SAML Providers:**
31
+ * Not currently supported. Please ask your BitBitPress contact to enable SAML support.
32
+ *
33
+ * After setup, use this endpoint to exchange your authentication token for a BitBitPress token.
34
+ */
35
+ post: {
36
+ parameters: {
37
+ query?: never;
38
+ header?: never;
39
+ path?: never;
40
+ cookie?: never;
41
+ };
42
+ requestBody: {
43
+ content: {
44
+ "application/json": {
45
+ /** @description The token from your authentication provider */
46
+ ssoToken: string;
47
+ };
48
+ };
49
+ };
50
+ responses: {
51
+ /** @description Successful token exchange */
52
+ 200: {
53
+ headers: {
54
+ [name: string]: unknown;
55
+ };
56
+ content: {
57
+ "application/json": {
58
+ /** @example true */
59
+ success?: boolean;
60
+ data?: {
61
+ idToken?: string;
62
+ accessToken?: string;
63
+ refreshToken?: string;
64
+ expiresIn?: number;
65
+ };
66
+ };
67
+ };
68
+ };
69
+ /** @description Bad request - missing or invalid parameters */
70
+ 400: {
71
+ headers: {
72
+ [name: string]: unknown;
73
+ };
74
+ content: {
75
+ "application/json": {
76
+ /** @example Bad request */
77
+ error?: string;
78
+ };
79
+ };
80
+ };
81
+ /** @description Unauthorized errors */
82
+ 401: {
83
+ headers: {
84
+ [name: string]: unknown;
85
+ };
86
+ content: {
87
+ "application/json": {
88
+ /**
89
+ * @example Unauthorized: No authentication token provided
90
+ * @enum {string}
91
+ */
92
+ error?: "Unauthorized: No authentication token provided" | "Unauthorized: Token has expired" | "Unauthorized: Invalid token" | "Unauthorized: Authentication failed";
93
+ };
94
+ };
95
+ };
96
+ /** @description Internal server error */
97
+ 500: {
98
+ headers: {
99
+ [name: string]: unknown;
100
+ };
101
+ content: {
102
+ "application/json": {
103
+ /** @example false */
104
+ success?: boolean;
105
+ /** @example Internal server error: An unknown error occurred */
106
+ error?: string;
107
+ };
108
+ };
109
+ };
110
+ };
111
+ };
112
+ delete?: never;
113
+ options?: never;
114
+ head?: never;
115
+ patch?: never;
116
+ trace?: never;
117
+ };
118
+ "/v1/user/recommendations": {
119
+ parameters: {
120
+ query?: never;
121
+ header?: never;
122
+ path?: never;
123
+ cookie?: never;
124
+ };
125
+ get?: never;
126
+ put?: never;
127
+ /**
128
+ * Retrieve User Recommendations
129
+ * @description **POST** `/v1/user/recommendations` Returns recommended articles for the authenticated user based on their interests.
130
+ */
131
+ post: {
132
+ parameters: {
133
+ query?: never;
134
+ header: {
135
+ /** @description Bearer token for authentication */
136
+ authorization: string;
137
+ };
138
+ path?: never;
139
+ cookie?: never;
140
+ };
141
+ requestBody?: {
142
+ content: {
143
+ "application/json": {
144
+ /** @description Maximum number of recommendations to return */
145
+ limit?: number;
146
+ /** @description Cursor from previous response to fetch the next page of recommendations */
147
+ cursor?: string;
148
+ };
149
+ };
150
+ };
151
+ responses: {
152
+ /** @description Successful response */
153
+ 200: {
154
+ headers: {
155
+ [name: string]: unknown;
156
+ };
157
+ content: {
158
+ "application/json": {
159
+ /** @example true */
160
+ success?: boolean;
161
+ /** @description Recommended articles and pagination */
162
+ data?: {
163
+ /** @description List of recommended articles */
164
+ items?: {
165
+ /** @example Your article id */
166
+ id?: string;
167
+ /** @example BitBitPress's id */
168
+ assetId?: string;
169
+ /** @example Title */
170
+ title?: string;
171
+ /** @example Content */
172
+ content?: string;
173
+ /** @example 2021-01-01 */
174
+ publishedAt?: string;
175
+ /** @example 0.95 */
176
+ score?: number;
177
+ }[];
178
+ /** @description Cursor to request the next page, if any */
179
+ cursor?: string;
180
+ };
181
+ };
182
+ };
183
+ };
184
+ /** @description Bad request - missing or invalid parameters */
185
+ 400: {
186
+ headers: {
187
+ [name: string]: unknown;
188
+ };
189
+ content: {
190
+ "application/json": {
191
+ /** @example Bad request */
192
+ error?: string;
193
+ };
194
+ };
195
+ };
196
+ /** @description Unauthorized errors */
197
+ 401: {
198
+ headers: {
199
+ [name: string]: unknown;
200
+ };
201
+ content: {
202
+ "application/json": {
203
+ /**
204
+ * @example Unauthorized: No authentication token provided
205
+ * @enum {string}
206
+ */
207
+ error?: "Unauthorized: No authentication token provided" | "Unauthorized: Token has expired" | "Unauthorized: Invalid token" | "Unauthorized: Authentication failed";
208
+ };
209
+ };
210
+ };
211
+ /** @description Internal server error */
212
+ 500: {
213
+ headers: {
214
+ [name: string]: unknown;
215
+ };
216
+ content: {
217
+ "application/json": {
218
+ /** @example false */
219
+ success?: boolean;
220
+ /** @example Internal server error: An unknown error occurred */
221
+ error?: string;
222
+ };
223
+ };
224
+ };
225
+ };
226
+ };
227
+ delete?: never;
228
+ options?: never;
229
+ head?: never;
230
+ patch?: never;
231
+ trace?: never;
232
+ };
233
+ "/v1/user/signal": {
234
+ parameters: {
235
+ query?: never;
236
+ header?: never;
237
+ path?: never;
238
+ cookie?: never;
239
+ };
240
+ get?: never;
241
+ put?: never;
242
+ /**
243
+ * Record User Signal
244
+ * @description **POST** `/v1/user/signal` Records a user signal (e.g. clicked topic, read article) to inform profile interests. Signals are used power a user's recommendations.
245
+ */
246
+ post: {
247
+ parameters: {
248
+ query?: never;
249
+ header: {
250
+ /** @description Bearer token for authentication */
251
+ authorization: string;
252
+ };
253
+ path?: never;
254
+ cookie?: never;
255
+ };
256
+ requestBody: {
257
+ content: {
258
+ "application/json": {
259
+ /** @description User action with the text associated with the interaction. (e.g. liked "Warriors intend to keep Jimmy Butler despite season-ending injury") */
260
+ signal: string;
261
+ /**
262
+ * @description `active` = explicit intent (click, search, subscribe). `passive` = implicit (read, scroll, dwell).
263
+ * @enum {string}
264
+ */
265
+ type: "active" | "passive";
266
+ /** @description When true, indicates the signal is negative (e.g. dislike, unfollow). Use sparingly. Optional; defaults to false. */
267
+ negative?: boolean;
268
+ /** @description Optional context about the content that triggered this signal. */
269
+ contentContext?: {
270
+ /** @description The ID of the content (e.g. article ID). */
271
+ contentId: string;
272
+ /**
273
+ * @description The type of content.
274
+ * @enum {string}
275
+ */
276
+ contentType: "article";
277
+ };
278
+ };
279
+ };
280
+ };
281
+ responses: {
282
+ /** @description Signal recorded */
283
+ 200: {
284
+ headers: {
285
+ [name: string]: unknown;
286
+ };
287
+ content: {
288
+ "application/json": {
289
+ /**
290
+ * @description Whether the request succeeded
291
+ * @example true
292
+ */
293
+ success?: boolean;
294
+ /** @description Response payload */
295
+ data?: {
296
+ /**
297
+ * @description Whether the signal was recorded (false if no app user or empty signal)
298
+ * @example true
299
+ */
300
+ recorded?: boolean;
301
+ };
302
+ };
303
+ };
304
+ };
305
+ /** @description Bad request - missing or invalid parameters */
306
+ 400: {
307
+ headers: {
308
+ [name: string]: unknown;
309
+ };
310
+ content: {
311
+ "application/json": {
312
+ /** @example Bad request */
313
+ error?: string;
314
+ };
315
+ };
316
+ };
317
+ /** @description Unauthorized errors */
318
+ 401: {
319
+ headers: {
320
+ [name: string]: unknown;
321
+ };
322
+ content: {
323
+ "application/json": {
324
+ /**
325
+ * @example Unauthorized: No authentication token provided
326
+ * @enum {string}
327
+ */
328
+ error?: "Unauthorized: No authentication token provided" | "Unauthorized: Token has expired" | "Unauthorized: Invalid token" | "Unauthorized: Authentication failed";
329
+ };
330
+ };
331
+ };
332
+ /** @description Internal server error */
333
+ 500: {
334
+ headers: {
335
+ [name: string]: unknown;
336
+ };
337
+ content: {
338
+ "application/json": {
339
+ /** @example false */
340
+ success?: boolean;
341
+ /** @example Internal server error: An unknown error occurred */
342
+ error?: string;
343
+ };
344
+ };
345
+ };
346
+ };
347
+ };
348
+ delete?: never;
349
+ options?: never;
350
+ head?: never;
351
+ patch?: never;
352
+ trace?: never;
353
+ };
354
+ "/v1/user/synthesize": {
355
+ parameters: {
356
+ query?: never;
357
+ header?: never;
358
+ path?: never;
359
+ cookie?: never;
360
+ };
361
+ get?: never;
362
+ put?: never;
363
+ /**
364
+ * Synthesize User Content
365
+ * @description **POST** `/v1/user/synthesize`
366
+ *
367
+ * Synthesize content items personalized to the user. Each item specifies a type to inform the type of synthesis to perform.
368
+ */
369
+ post: {
370
+ parameters: {
371
+ query?: never;
372
+ header: {
373
+ /** @description Bearer token for authentication */
374
+ authorization: string;
375
+ };
376
+ path?: never;
377
+ cookie?: never;
378
+ };
379
+ requestBody: {
380
+ content: {
381
+ "application/json": {
382
+ /** @description Array of items to synthesize */
383
+ items: ({
384
+ /**
385
+ * @description Type of synthesis item.
386
+ * @enum {string}
387
+ */
388
+ type: "DAILY_SUMMARY" | "CUSTOM";
389
+ } | {
390
+ /** @enum {unknown} */
391
+ type?: "DAILY_SUMMARY";
392
+ } | {
393
+ /** @enum {unknown} */
394
+ type?: "CUSTOM";
395
+ /** @description Schema describing the output format. */
396
+ schema: {
397
+ /** @description Name of the field */
398
+ fieldName: string;
399
+ /** @description A prompt describing the value of the field */
400
+ fieldDescription: string;
401
+ }[];
402
+ /** @description Context data to provide to the prompt. */
403
+ contentContext: {
404
+ /** @description Your content id */
405
+ contentId?: string;
406
+ /**
407
+ * @description The type of content to synthesize
408
+ * @enum {string}
409
+ */
410
+ contentType?: "article";
411
+ };
412
+ })[];
413
+ };
414
+ };
415
+ };
416
+ responses: {
417
+ /**
418
+ * @description Streaming response (Server-Sent Events). Each event is a JSON object sent as `data: {JSON}\n\n`. Event types:
419
+ *
420
+ * **Connection Events:**
421
+ * ```json
422
+ * {"type":"connected" | "complete"}
423
+ * ```
424
+ *
425
+ * **Data Events:**
426
+ * ```json
427
+ * {
428
+ * "type": "DAILY_SUMMARY" | "CUSTOM",
429
+ * "index": number,
430
+ * "data": {...}
431
+ * }
432
+ * ```
433
+ *
434
+ * For `DAILY_SUMMARY` type, `data` will be:
435
+ * ```json
436
+ * {
437
+ * "summary": string | null
438
+ * }
439
+ * ```
440
+ *
441
+ * For `CUSTOM` type, `data` will be an object following your schema input, where `fieldNames` are keys.
442
+ */
443
+ 200: {
444
+ headers: {
445
+ [name: string]: unknown;
446
+ };
447
+ content: {
448
+ "application/json": string;
449
+ };
450
+ };
451
+ /** @description Bad request - missing or invalid parameters */
452
+ 400: {
453
+ headers: {
454
+ [name: string]: unknown;
455
+ };
456
+ content: {
457
+ "application/json": {
458
+ /** @example Bad request */
459
+ error?: string;
460
+ };
461
+ };
462
+ };
463
+ /** @description Unauthorized errors */
464
+ 401: {
465
+ headers: {
466
+ [name: string]: unknown;
467
+ };
468
+ content: {
469
+ "application/json": {
470
+ /**
471
+ * @example Unauthorized: No authentication token provided
472
+ * @enum {string}
473
+ */
474
+ error?: "Unauthorized: No authentication token provided" | "Unauthorized: Token has expired" | "Unauthorized: Invalid token" | "Unauthorized: Authentication failed";
475
+ };
476
+ };
477
+ };
478
+ /** @description Internal server error */
479
+ 500: {
480
+ headers: {
481
+ [name: string]: unknown;
482
+ };
483
+ content: {
484
+ "application/json": {
485
+ /** @example false */
486
+ success?: boolean;
487
+ /** @example Internal server error: An unknown error occurred */
488
+ error?: string;
489
+ };
490
+ };
491
+ };
492
+ };
493
+ };
494
+ delete?: never;
495
+ options?: never;
496
+ head?: never;
497
+ patch?: never;
498
+ trace?: never;
499
+ };
500
+ }
501
+ export type webhooks = Record<string, never>;
502
+ export interface components {
503
+ schemas: never;
504
+ responses: never;
505
+ parameters: never;
506
+ requestBodies: never;
507
+ headers: never;
508
+ pathItems: never;
509
+ }
510
+ export type $defs = Record<string, never>;
511
+ export type operations = Record<string, never>;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Re-export OpenAPI types generated by openapi-typescript
3
+ *
4
+ * The actual types are generated in openapi.d.ts by running:
5
+ * npm run generate:types
6
+ */
7
+ export type * from './openapi.d.js';
package/dist/index.d.ts CHANGED
@@ -7,4 +7,10 @@
7
7
  export type { BitBitPressClientConfig, BitBitPressClientOptions } from './client.js';
8
8
  export { BitBitPressClient } from './client.js';
9
9
  export type * from './generated/openapi.js';
10
+ export type { UserMethods } from './user/index.js';
11
+ export type { SignalRequest, SignalResponse } from './user/signal.js';
12
+ export type { RecommendationsRequest, RecommendationsResponse } from './user/recommendations.js';
13
+ export type { TokenRequest, TokenResponse } from './user/token.js';
14
+ export type { SynthesizeRequest } from './user/typeDefs.js';
15
+ export type { SynthesizeEvent } from './user/synthesize.js';
10
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,YAAY,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGhD,mBAAmB,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,YAAY,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGhD,mBAAmB,wBAAwB,CAAC;AAG5C,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,C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C,CAAC,GAAG,OAAO,EAC3C,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,CAAC,CAAC,CAgFZ"}
1
+ {"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../src/request.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;AAErE;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,UAAU,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAC;CAChE;AAED;;GAEG;AACH,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,OAAO;IACtC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,KAAK,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED;;GAEG;AACH,wBAAsB,WAAW,CAAC,CAAC,GAAG,OAAO,EAC3C,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,CAAC,CAAC,CA+EZ"}
package/dist/request.js CHANGED
@@ -23,7 +23,7 @@ async function makeRequest(config, options) {
23
23
  };
24
24
  // Add authentication token if available
25
25
  if (config.token) {
26
- requestHeaders.Authorization = `Bearer ${config.token}`;
26
+ requestHeaders.authorization = `Bearer ${config.token}`;
27
27
  }
28
28
  // Prepare request options
29
29
  const requestOptions = {
@@ -1 +1 @@
1
- {"version":3,"file":"request.js","sourceRoot":"","sources":["../src/request.ts"],"names":[],"mappings":";;AAuCA,kCAmFC;AAtFD;;GAEG;AACI,KAAK,UAAU,WAAW,CAC/B,MAAqB,EACrB,OAAuB;IAEvB,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,GAAG,EAAE,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAE7D,kCAAkC;IAClC,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IAC1C,IAAI,MAAM,EAAE,CAAC;QACX,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YAClD,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;gBAC1C,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YAC9C,CAAC;QACH,CAAC;IACH,CAAC;IAED,kBAAkB;IAClB,MAAM,cAAc,GAA2B;QAC7C,cAAc,EAAE,kBAAkB;QAClC,GAAG,MAAM,CAAC,OAAO;QACjB,GAAG,OAAO;KACX,CAAC;IAEF,wCAAwC;IACxC,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QACjB,cAAc,CAAC,aAAa,GAAG,UAAU,MAAM,CAAC,KAAK,EAAE,CAAC;IAC1D,CAAC;IAED,0BAA0B;IAC1B,MAAM,cAAc,GAAgB;QAClC,MAAM;QACN,OAAO,EAAE,cAAc;KACxB,CAAC;IAEF,gCAAgC;IAChC,IAAI,IAAI,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;QAC7B,cAAc,C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KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;wBACzC,MAAM,IAAI,CAAC;oBACb,CAAC;oBAAC,MAAM,CAAC;wBACP,oBAAoB;oBACtB,CAAC;gBACH,CAAC;YACH,CAAC;oBAAS,CAAC;gBACT,MAAM,CAAC,WAAW,EAAE,CAAC;YACvB,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -1,56 +1,61 @@
1
1
  import type { RequestConfig } from '../request.js';
2
- import { type RecommendationsRequest } from './recommendations.js';
3
- import { type SignalRequest } from './signal.js';
4
- import { type TokenRequest } from './token.js';
2
+ import { type RecommendationsRequest, type RecommendationsResponse } from './recommendations.js';
3
+ import { type SignalRequest, type SignalResponse } from './signal.js';
4
+ import { type SynthesizeEvent } from './synthesize.js';
5
+ import { type TokenRequest, type TokenResponse } from './token.js';
5
6
  import type { SynthesizeRequest } from './typeDefs.js';
6
7
  /**
7
- * User-related API methods
8
+ * User-related API methods interface
9
+ * Provides type-safe access to all user API endpoints
8
10
  */
9
- export declare function createUserMethods(config: RequestConfig, synthesizeBatchTimeout?: number): {
11
+ export interface UserMethods {
10
12
  /**
11
13
  * Authenticate with SSO token
12
14
  * Exchanges SSO token for authentication token and sets it for all user methods
15
+ *
16
+ * @param ssoToken - The SSO token to exchange for an authentication token
17
+ * @returns Promise that resolves when authentication is complete
13
18
  */
14
19
  authenticate(ssoToken: string): Promise<void>;
15
20
  /**
16
21
  * Exchange SSO token for authentication token (returns token without setting it)
22
+ *
23
+ * @param ssoToken - The SSO token to exchange
24
+ * @returns Promise that resolves with the token response containing idToken or accessToken
17
25
  */
18
- token: (ssoToken: TokenRequest["ssoToken"]) => Promise<{
19
- idToken?: string;
20
- accessToken?: string;
21
- refreshToken?: string;
22
- expiresIn?: number;
23
- }>;
26
+ token(ssoToken: TokenRequest['ssoToken']): Promise<TokenResponse>;
24
27
  /**
25
28
  * Get recommended articles for the authenticated user
29
+ *
30
+ * @param options - Optional request parameters for recommendations
31
+ * @returns Promise that resolves with recommended articles
26
32
  */
27
- recommendations: (options?: RecommendationsRequest) => Promise<{
28
- items?: {
29
- id?: string;
30
- assetId?: string;
31
- title?: string;
32
- summary?: string;
33
- content?: string;
34
- publishedAt?: string;
35
- score?: number;
36
- }[];
37
- cursor?: string;
38
- }>;
33
+ recommendations(options?: RecommendationsRequest): Promise<NonNullable<RecommendationsResponse>>;
39
34
  /**
40
35
  * Record a user signal (e.g. clicked topic, read article) to inform profile interests
36
+ *
37
+ * @param options - Signal request parameters
38
+ * @returns Promise that resolves with the signal response
41
39
  */
42
- signal: (options: SignalRequest) => Promise<{
43
- recorded?: boolean;
44
- }>;
40
+ signal(options: SignalRequest): Promise<NonNullable<SignalResponse>>;
45
41
  /**
46
42
  * Synthesize user content (streaming)
43
+ *
44
+ * @param items - Array of items to synthesize
45
+ * @returns AsyncIterable that yields synthesis events
47
46
  */
48
- synthesize: (items: SynthesizeRequest["items"]) => Promise<AsyncIterable<import("./synthesize.js").SynthesizeEvent>>;
47
+ synthesize(items: SynthesizeRequest['items']): Promise<AsyncIterable<SynthesizeEvent>>;
49
48
  /**
50
49
  * Synthesize a single item (batched)
51
50
  * Items are batched and sent together after the configured timeout
52
- * Returns a promise that resolves with the data field from the event (excluding 'connected' and 'complete' events)
51
+ *
52
+ * @param item - Single item to synthesize
53
+ * @returns Promise that resolves with the data field from the event (excluding 'connected' and 'complete' events)
53
54
  */
54
- synthesizeItem: (item: SynthesizeRequest["items"][number]) => Promise<unknown>;
55
- };
55
+ synthesizeItem(item: SynthesizeRequest['items'][number]): Promise<unknown>;
56
+ }
57
+ /**
58
+ * User-related API methods
59
+ */
60
+ export declare function createUserMethods(config: RequestConfig, synthesizeBatchTimeout?: number): UserMethods;
56
61
  //# sourceMappingURL=index.d.ts.map