@bitbitpress/client 1.0.0 → 1.0.2

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 CHANGED
@@ -51,6 +51,8 @@ More details can also be found in your control room's API docs @ https://your-co
51
51
  - [signalItem](#signalitem)
52
52
  - [synthesizeItem](#synthesizeitem)
53
53
  - [synthesize](#synthesize)
54
+ - [interactions](#interactions)
55
+ - [respondToInteraction](#respondtointeraction)
54
56
  - [Data Methods](#data-methods)
55
57
  - [assets](#assets)
56
58
  - [Types](#types)
@@ -453,7 +455,7 @@ client.user.synthesizeItem(
453
455
 
454
456
  ##### Parameters
455
457
 
456
- - `item` (required): A single synthesize item (same shape as items in `synthesize`): `inputs`, `output` (schema as JSON string or Zod 4 schema), optional `configurationKeyName`, optional `searchOptionsOverrides` (e.g. `{ lookbackMinutes: 1440 }` for 24-hour lookback)
458
+ - `item` (required): A single synthesize item (same shape as items in `synthesize`): `inputs`, `output` (schema as JSON string or Zod 4 schema), optional `configurationKeyName`, optional `limit` (number of results to return; defaults to `1`), optional `searchOptionsOverrides` (e.g. `{ lookbackMinutes: 1440 }` for 24-hour lookback)
457
459
  - `onStreamingData` (optional): Callback invoked with streaming data whenever a stream event has `complete: false` for this item. Type: `(data: unknown) => void`.
458
460
 
459
461
  ##### Returns
@@ -513,6 +515,7 @@ client.user.synthesize(
513
515
  - `inputs` (optional): Context for synthesis — array of `{ type: "externalId" | "text" | "excludeExternalIds", value: string }` (article ID, freeform text, or comma-separated external IDs to exclude)
514
516
  - `output`: `{ schema: string | ZodType }` — output schema as a JSON string or Zod 4 schema (top-level type must be `"object"`; supports object, string, number, boolean, array, and enum)
515
517
  - `configurationKeyName` (optional): Key name for configuration
518
+ - `limit` (optional): Number of results to return. Defaults to `1`.
516
519
  - `searchOptionsOverrides` (optional): Per-request overrides, e.g. `{ lookbackMinutes: 1440 }` for 24-hour lookback.
517
520
  - `options` (optional): `{ onStreamingData?: (index: number, data: unknown) => void }` — if provided, `onStreamingData` is called for each data event with `complete: false`, with the item's index and streaming data
518
521
 
@@ -578,6 +581,98 @@ for await (const event of stream) {
578
581
 
579
582
  ---
580
583
 
584
+ #### interactions
585
+
586
+ Batch-resolve interaction state for items from a synthesis output. Returns aggregates and whether the current user has already responded to each.
587
+
588
+ ```typescript
589
+ client.user.interactions(options: InteractionsRequest): Promise<InteractionsResponse>
590
+ ```
591
+
592
+ ##### Parameters
593
+
594
+ - `options.synthesisConfigKeyName` (required): Key name of the synthesis config these interactions belong to
595
+ - `options.interactions` (required): Array of interactions to resolve, each with:
596
+ - `type` (required): Interaction type — `"POLL"`
597
+ - `content` (required): Canonical JSON string of the interaction content (e.g. question + options for a POLL)
598
+
599
+ ##### Returns
600
+
601
+ - `Promise<InteractionsResponse>`: Array of resolved interaction items, each with:
602
+ - `id: string`: Interaction ID
603
+ - `type: string`: Interaction type
604
+ - `content: string`: Canonical JSON string of the interaction content
605
+ - `hasResponded: boolean`: Whether the current user has already responded
606
+ - `aggregates: Record<string, unknown>`: Current aggregate data (e.g. vote counts)
607
+
608
+ ##### Example
609
+
610
+ ```typescript
611
+ const interactions = await client.user.interactions({
612
+ synthesisConfigKeyName: 'my-synthesis-config',
613
+ interactions: [
614
+ {
615
+ type: 'POLL',
616
+ content: JSON.stringify({ question: 'Which do you prefer?', options: [{ id: 'a', text: 'Option A' }, { id: 'b', text: 'Option B' }] }),
617
+ },
618
+ ],
619
+ });
620
+
621
+ for (const item of interactions) {
622
+ console.log('Interaction ID:', item.id);
623
+ console.log('Has responded:', item.hasResponded);
624
+ console.log('Aggregates:', item.aggregates);
625
+ }
626
+ ```
627
+
628
+ ##### Throws
629
+
630
+ - `Error`: If the request fails or no data is returned
631
+
632
+ ---
633
+
634
+ #### respondToInteraction
635
+
636
+ Submit or update a response to an interaction (e.g. a poll answer). Returns updated aggregates.
637
+
638
+ ```typescript
639
+ client.user.respondToInteraction(
640
+ interactionId: string,
641
+ options: InteractionResponseRequest,
642
+ ): Promise<InteractionResponseResponse>
643
+ ```
644
+
645
+ ##### Parameters
646
+
647
+ - `interactionId` (required): ID of the interaction to respond to (from `interactions()`)
648
+ - `options.type` (required): Interaction type — `"POLL"`
649
+ - `options.responseData` (required): Response data:
650
+ - `response` (required): Selected option ID
651
+
652
+ ##### Returns
653
+
654
+ - `Promise<InteractionResponseResponse>`: Response containing:
655
+ - `aggregates: Record<string, unknown>`: Updated aggregate data after recording the response
656
+ - `appUserResponse: Record<string, unknown>`: The user's recorded response
657
+
658
+ ##### Example
659
+
660
+ ```typescript
661
+ const result = await client.user.respondToInteraction('interaction-id-123', {
662
+ type: 'POLL',
663
+ responseData: { response: 'option-a-id' },
664
+ });
665
+
666
+ console.log('Updated aggregates:', result.aggregates);
667
+ console.log('Recorded response:', result.appUserResponse);
668
+ ```
669
+
670
+ ##### Throws
671
+
672
+ - `Error`: If the request fails or no data is returned
673
+
674
+ ---
675
+
581
676
  ### Data Methods
582
677
 
583
678
  Data methods require authentication. Call `client.user.authenticate()` before using them.
@@ -745,12 +840,13 @@ type SignalResponse = {
745
840
 
746
841
  #### SynthesizeRequest
747
842
 
748
- Request body for POST `/v1/user/synthesize` (from OpenAPI). Each item has `inputs`, `output`, optional `configurationKeyName`, and optional `searchOptionsOverrides`.
843
+ Request body for POST `/v1/user/synthesize` (from OpenAPI). Each item has `inputs`, `output`, optional `configurationKeyName`, optional `limit` (defaults to `1`), and optional `searchOptionsOverrides`.
749
844
 
750
845
  ```typescript
751
846
  type SynthesizeRequest = {
752
847
  items: Array<{
753
848
  configurationKeyName?: string;
849
+ limit?: number; // number of results to return; defaults to 1
754
850
  searchOptionsOverrides?: { lookbackMinutes?: number };
755
851
  inputs?: Array<{ type: 'externalId' | 'text' | 'excludeExternalIds'; value: string }>;
756
852
  output: {
@@ -830,3 +926,63 @@ interface SynthesizeOptions {
830
926
  onStreamingData?: (index: number, data: unknown) => void;
831
927
  }
832
928
  ```
929
+
930
+ #### InteractionsRequest
931
+
932
+ Request body for POST `/v1/user/interactions`.
933
+
934
+ ```typescript
935
+ type InteractionsRequest = {
936
+ synthesisConfigKeyName: string;
937
+ interactions: Array<{
938
+ type: 'POLL';
939
+ content: string; // canonical JSON string of the interaction content
940
+ }>;
941
+ }
942
+ ```
943
+
944
+ #### InteractionItem
945
+
946
+ A single resolved interaction item returned in `InteractionsResponse`.
947
+
948
+ ```typescript
949
+ type InteractionItem = {
950
+ id: string;
951
+ type: string;
952
+ content: string;
953
+ hasResponded: boolean;
954
+ aggregates: Record<string, unknown>;
955
+ }
956
+ ```
957
+
958
+ #### InteractionsResponse
959
+
960
+ Return type of `interactions`. Array of `InteractionItem`.
961
+
962
+ ```typescript
963
+ type InteractionsResponse = InteractionItem[];
964
+ ```
965
+
966
+ #### InteractionResponseRequest
967
+
968
+ Request body for POST `/v1/user/interactions/:interactionId/responses`.
969
+
970
+ ```typescript
971
+ type InteractionResponseRequest = {
972
+ type: 'POLL';
973
+ responseData: {
974
+ response: string; // selected option id
975
+ };
976
+ }
977
+ ```
978
+
979
+ #### InteractionResponseResponse
980
+
981
+ Return type of `respondToInteraction`.
982
+
983
+ ```typescript
984
+ type InteractionResponseResponse = {
985
+ aggregates: Record<string, unknown>;
986
+ appUserResponse: Record<string, unknown>;
987
+ }
988
+ ```
@@ -14,7 +14,7 @@ export interface paths {
14
14
  get?: never;
15
15
  put?: never;
16
16
  /**
17
- * Get Authentication Bearer Token
17
+ * Auth - Exchange Token
18
18
  * @description **POST** `/v1/auth/token`
19
19
  *
20
20
  * Exchange a token from your SSO provider (OIDC) for a BitBitPress authentication token required to use other endpoints.
@@ -123,7 +123,7 @@ export interface paths {
123
123
  cookie?: never;
124
124
  };
125
125
  /**
126
- * Get User Profile
126
+ * Profile - Get User Profile
127
127
  * @description **GET** `/v1/user/profile` Returns the user's profile, including interest tags.
128
128
  */
129
129
  get: {
@@ -208,7 +208,7 @@ export interface paths {
208
208
  };
209
209
  };
210
210
  /**
211
- * Update User Profile
211
+ * Profile - Update User Profile
212
212
  * @description **PUT** `/v1/user/profile` Updates the user's interest tags. Supports full replace via `interestTags`, or add/remove via `addInterestTags` and `removeInterestTags` arrays.
213
213
  */
214
214
  put: {
@@ -313,7 +313,7 @@ export interface paths {
313
313
  get?: never;
314
314
  put?: never;
315
315
  /**
316
- * Retrieve User Recommendations
316
+ * User - Get Recommendations
317
317
  * @description **POST** `/v1/user/recommendations` Returns recommended articles for the authenticated user based on their interests.
318
318
  *
319
319
  * #### Available fields (`fields` in request body)
@@ -438,7 +438,7 @@ export interface paths {
438
438
  get?: never;
439
439
  put?: never;
440
440
  /**
441
- * Report Bit
441
+ * User - Create Report
442
442
  * @description **POST** `/v1/user/report` Creates a user-provided bit to be ingested into the system. This may include news or any other content that the user wants to share.
443
443
  */
444
444
  post: {
@@ -534,7 +534,7 @@ export interface paths {
534
534
  get?: never;
535
535
  put?: never;
536
536
  /**
537
- * Record User Signals
537
+ * Profile - Record Signals
538
538
  * @description **POST** `/v1/user/signal` Records user signals (e.g. clicked topic, read article) to inform profile interests. Signals power the user's recommendations.
539
539
  */
540
540
  post: {
@@ -653,7 +653,7 @@ export interface paths {
653
653
  get?: never;
654
654
  put?: never;
655
655
  /**
656
- * Synthesize User Content
656
+ * Synthesis - Synthesize Content
657
657
  * @description **POST** `/v1/user/synthesize`
658
658
  *
659
659
  * Synthesize content items personalized to the user.
@@ -675,6 +675,8 @@ export interface paths {
675
675
  items: {
676
676
  /** @description Optional configuration key name. Loads an existing synthesis config by this name; omit for default configuration. */
677
677
  configurationKeyName?: string;
678
+ /** @description Number of results to return. Defaults to 1. */
679
+ limit?: number;
678
680
  /** @description Per-request overrides for search options. */
679
681
  searchOptionsOverrides?: {
680
682
  /** @description Override for search lookback window in minutes (e.g. 1440 for last 24 hours). */
@@ -784,6 +786,240 @@ export interface paths {
784
786
  patch?: never;
785
787
  trace?: never;
786
788
  };
789
+ "/v1/user/interactions": {
790
+ parameters: {
791
+ query?: never;
792
+ header?: never;
793
+ path?: never;
794
+ cookie?: never;
795
+ };
796
+ get?: never;
797
+ put?: never;
798
+ /**
799
+ * Synthesis - Get User Interactions
800
+ * @description **POST** `/v1/user/interactions`
801
+ *
802
+ * Batch-resolve interaction state for items from a synthesis output. Returns aggregates and whether the current user has already responded to each.
803
+ */
804
+ post: {
805
+ parameters: {
806
+ query?: never;
807
+ header: {
808
+ authorization: string;
809
+ };
810
+ path?: never;
811
+ cookie?: never;
812
+ };
813
+ requestBody: {
814
+ content: {
815
+ "application/json": {
816
+ /** @description keyName of the synthesis config these interactions belong to. */
817
+ synthesisConfigKeyName: string;
818
+ /** @description Interactions to resolve, in order. */
819
+ interactions: {
820
+ /**
821
+ * @description Interaction type.
822
+ * @enum {string}
823
+ */
824
+ type: "POLL";
825
+ /** @description Canonical JSON string of the interaction content (e.g. question + options for a POLL). */
826
+ content: string;
827
+ }[];
828
+ };
829
+ };
830
+ };
831
+ responses: {
832
+ /** @description Default Response */
833
+ 200: {
834
+ headers: {
835
+ [name: string]: unknown;
836
+ };
837
+ content: {
838
+ "application/json": {
839
+ success: boolean;
840
+ data: {
841
+ id: string;
842
+ type: string;
843
+ content: string;
844
+ hasResponded: boolean;
845
+ aggregates: {
846
+ [key: string]: unknown;
847
+ };
848
+ }[];
849
+ };
850
+ };
851
+ };
852
+ /** @description Bad request - missing or invalid parameters */
853
+ 400: {
854
+ headers: {
855
+ [name: string]: unknown;
856
+ };
857
+ content: {
858
+ "application/json": {
859
+ /** @example Bad request */
860
+ error?: string;
861
+ };
862
+ };
863
+ };
864
+ /** @description Unauthorized errors */
865
+ 401: {
866
+ headers: {
867
+ [name: string]: unknown;
868
+ };
869
+ content: {
870
+ "application/json": {
871
+ /**
872
+ * @example Unauthorized: No authentication token provided
873
+ * @enum {string}
874
+ */
875
+ error?: "Unauthorized: No authentication token provided" | "Unauthorized: Token has expired" | "Unauthorized: Invalid token" | "Unauthorized: Authentication failed";
876
+ };
877
+ };
878
+ };
879
+ /** @description Internal server error */
880
+ 500: {
881
+ headers: {
882
+ [name: string]: unknown;
883
+ };
884
+ content: {
885
+ "application/json": {
886
+ /** @example false */
887
+ success?: boolean;
888
+ /** @example Internal server error: An unknown error occurred */
889
+ error?: string;
890
+ };
891
+ };
892
+ };
893
+ };
894
+ };
895
+ delete?: never;
896
+ options?: never;
897
+ head?: never;
898
+ patch?: never;
899
+ trace?: never;
900
+ };
901
+ "/v1/user/interactions/{interactionId}/responses": {
902
+ parameters: {
903
+ query?: never;
904
+ header?: never;
905
+ path?: never;
906
+ cookie?: never;
907
+ };
908
+ get?: never;
909
+ put?: never;
910
+ /**
911
+ * Synthesis - Create User Interaction Response
912
+ * @description **POST** `/v1/user/interactions/:interactionId/responses`
913
+ *
914
+ * Submit or update a response to an interaction. Returns updated aggregates.
915
+ */
916
+ post: {
917
+ parameters: {
918
+ query?: never;
919
+ header: {
920
+ authorization: string;
921
+ };
922
+ path: {
923
+ interactionId: string;
924
+ };
925
+ cookie?: never;
926
+ };
927
+ requestBody: {
928
+ content: {
929
+ "application/json": {
930
+ /**
931
+ * @description Interaction type.
932
+ * @enum {string}
933
+ */
934
+ type: "POLL";
935
+ /** @description For POLL: the selected option id. */
936
+ responseData: {
937
+ /** @description Selected option id. */
938
+ response: string;
939
+ };
940
+ };
941
+ };
942
+ };
943
+ responses: {
944
+ /** @description Default Response */
945
+ 200: {
946
+ headers: {
947
+ [name: string]: unknown;
948
+ };
949
+ content: {
950
+ "application/json": {
951
+ success: boolean;
952
+ data: {
953
+ aggregates: {
954
+ [key: string]: unknown;
955
+ };
956
+ appUserResponse: {
957
+ [key: string]: unknown;
958
+ };
959
+ };
960
+ };
961
+ };
962
+ };
963
+ /** @description Bad request - missing or invalid parameters */
964
+ 400: {
965
+ headers: {
966
+ [name: string]: unknown;
967
+ };
968
+ content: {
969
+ "application/json": {
970
+ /** @example Bad request */
971
+ error?: string;
972
+ };
973
+ };
974
+ };
975
+ /** @description Unauthorized errors */
976
+ 401: {
977
+ headers: {
978
+ [name: string]: unknown;
979
+ };
980
+ content: {
981
+ "application/json": {
982
+ /**
983
+ * @example Unauthorized: No authentication token provided
984
+ * @enum {string}
985
+ */
986
+ error?: "Unauthorized: No authentication token provided" | "Unauthorized: Token has expired" | "Unauthorized: Invalid token" | "Unauthorized: Authentication failed";
987
+ };
988
+ };
989
+ };
990
+ /** @description Default Response */
991
+ 404: {
992
+ headers: {
993
+ [name: string]: unknown;
994
+ };
995
+ content: {
996
+ "application/json": {
997
+ error?: string;
998
+ };
999
+ };
1000
+ };
1001
+ /** @description Internal server error */
1002
+ 500: {
1003
+ headers: {
1004
+ [name: string]: unknown;
1005
+ };
1006
+ content: {
1007
+ "application/json": {
1008
+ /** @example false */
1009
+ success?: boolean;
1010
+ /** @example Internal server error: An unknown error occurred */
1011
+ error?: string;
1012
+ };
1013
+ };
1014
+ };
1015
+ };
1016
+ };
1017
+ delete?: never;
1018
+ options?: never;
1019
+ head?: never;
1020
+ patch?: never;
1021
+ trace?: never;
1022
+ };
787
1023
  "/v1/data/assets": {
788
1024
  parameters: {
789
1025
  query?: never;
@@ -794,7 +1030,7 @@ export interface paths {
794
1030
  get?: never;
795
1031
  put?: never;
796
1032
  /**
797
- * Fetch Assets by IDs
1033
+ * Data - Get Assets
798
1034
  * @description **POST** `/v1/data/assets` Fetches assets by IDs and returns requested fields.
799
1035
  *
800
1036
  * #### Request body
@@ -802,7 +1038,7 @@ export interface paths {
802
1038
  * | Field | Type | Required | Description |
803
1039
  * |-------|------|----------|-------------|
804
1040
  * | `assetIds` | string[] | yes | List of asset IDs to fetch |
805
- * | `assetFields` | string[] | yes | Fields to return (dot or bracket notation, e.g. tags[0], images[1].src). Allowed: title, tags, images, videos, publishedAt, externalId, externalData, and subfields. Empty array returns objects with only `assetId`. |
1041
+ * | `assetFields` | string[] | yes | Fields to return (dot or bracket notation, e.g. tags[0], images[1].src). Allowed: assetId, title, tags, images, videos, publishedAt, externalId, externalData, sourceUrl, dataSource.name, and subfields. Empty array returns objects with only `assetId`. `externalData`'s subfields are unique to your source data. |
806
1042
  */
807
1043
  post: {
808
1044
  parameters: {
@@ -819,7 +1055,7 @@ export interface paths {
819
1055
  "application/json": {
820
1056
  /** @description List of asset IDs to fetch */
821
1057
  assetIds: string[];
822
- /** @description Asset fields to return (dot or bracket notation). Allowed: title, tags, images, videos, publishedAt, externalId, externalData, and subfields. Empty array returns objects with only assetId. */
1058
+ /** @description Asset fields to return (dot or bracket notation). Allowed: assetId, title, tags, images, videos, publishedAt, externalId, externalData, assetType, sourceUrl, dataSource.name, and subfields. Empty array returns objects with only assetId. */
823
1059
  assetFields: string[];
824
1060
  };
825
1061
  };
@@ -893,6 +1129,159 @@ export interface paths {
893
1129
  patch?: never;
894
1130
  trace?: never;
895
1131
  };
1132
+ "/admin/v1/assets/upsert": {
1133
+ parameters: {
1134
+ query?: never;
1135
+ header?: never;
1136
+ path?: never;
1137
+ cookie?: never;
1138
+ };
1139
+ get?: never;
1140
+ put?: never;
1141
+ /**
1142
+ * Upsert Asset
1143
+ * @description **POST** `/admin/v1/assets/upsert` Creates or updates an asset in the system. If an asset with the same `externalId` already exists it will be updated; otherwise a new asset is created and queued for ingestion.
1144
+ */
1145
+ post: {
1146
+ parameters: {
1147
+ query?: never;
1148
+ header?: never;
1149
+ path?: never;
1150
+ cookie?: never;
1151
+ };
1152
+ requestBody: {
1153
+ content: {
1154
+ "application/json": {
1155
+ /** @description Key name of the Admin API data source to associate this asset with */
1156
+ dataSourceKey: string;
1157
+ /** @description Unique identifier for the asset in your system */
1158
+ externalId: string;
1159
+ /** @description Title of the asset */
1160
+ title: string;
1161
+ /** @description Full text content of the asset */
1162
+ content: string;
1163
+ /**
1164
+ * @description Format of the content field. Defaults to text/plain.
1165
+ * @enum {string}
1166
+ */
1167
+ mimeType?: "text/plain" | "text/markdown" | "text/html";
1168
+ /** @description Canonical URL of the original source */
1169
+ sourceUrl?: string;
1170
+ /** @description ISO 8601 publication timestamp */
1171
+ publishedAt?: string;
1172
+ /** @description Author or byline */
1173
+ byline?: string;
1174
+ /** @description List of tags or categories */
1175
+ tags?: string[];
1176
+ /** @description Images associated with the asset */
1177
+ images?: {
1178
+ /** @description Image URL */
1179
+ src: string;
1180
+ /** @description Alt text */
1181
+ alt?: string;
1182
+ /** @description External identifier for the image */
1183
+ externalId?: string;
1184
+ /** @description Image width in pixels */
1185
+ width?: number;
1186
+ /** @description Image height in pixels */
1187
+ height?: number;
1188
+ /** @description Photo credit or attribution */
1189
+ credit?: string;
1190
+ }[];
1191
+ /** @description Videos associated with the asset */
1192
+ videos?: {
1193
+ /** @description One or more video source URLs with MIME types */
1194
+ sources: {
1195
+ /** @description MIME type of the video source (e.g. video/mp4) */
1196
+ mimeType: string;
1197
+ /** @description Video source URL */
1198
+ src: string;
1199
+ }[];
1200
+ /** @description Alt text for the video */
1201
+ alt?: string;
1202
+ /** @description External identifier for the video */
1203
+ externalId?: string;
1204
+ /** @description Video credit or attribution */
1205
+ credit?: string;
1206
+ /** @description Poster image URL */
1207
+ posterUrl?: string;
1208
+ /** @description Video caption */
1209
+ caption?: string;
1210
+ /** @description Video width in pixels */
1211
+ width?: number;
1212
+ /** @description Video height in pixels */
1213
+ height?: number;
1214
+ }[];
1215
+ /** @description Arbitrary additional data to store with the asset */
1216
+ externalData?: {
1217
+ [key: string]: unknown;
1218
+ };
1219
+ };
1220
+ };
1221
+ };
1222
+ responses: {
1223
+ /** @description Successful response */
1224
+ 200: {
1225
+ headers: {
1226
+ [name: string]: unknown;
1227
+ };
1228
+ content: {
1229
+ "application/json": {
1230
+ success: boolean;
1231
+ data: {
1232
+ /** @description Internal asset identifier */
1233
+ assetId: string;
1234
+ /** @description True if a new asset was created */
1235
+ created: boolean;
1236
+ /** @description True if the asset was queued for ingestion */
1237
+ queued: boolean;
1238
+ };
1239
+ };
1240
+ };
1241
+ };
1242
+ /** @description Bad request - missing or invalid parameters */
1243
+ 400: {
1244
+ headers: {
1245
+ [name: string]: unknown;
1246
+ };
1247
+ content: {
1248
+ "application/json": {
1249
+ error?: string;
1250
+ };
1251
+ };
1252
+ };
1253
+ /** @description Unauthorized errors */
1254
+ 401: {
1255
+ headers: {
1256
+ [name: string]: unknown;
1257
+ };
1258
+ content: {
1259
+ "application/json": {
1260
+ /** @enum {string} */
1261
+ error?: "Unauthorized: No API key provided" | "Unauthorized: Invalid or revoked API key";
1262
+ };
1263
+ };
1264
+ };
1265
+ /** @description Internal server error */
1266
+ 500: {
1267
+ headers: {
1268
+ [name: string]: unknown;
1269
+ };
1270
+ content: {
1271
+ "application/json": {
1272
+ success?: boolean;
1273
+ error?: string;
1274
+ };
1275
+ };
1276
+ };
1277
+ };
1278
+ };
1279
+ delete?: never;
1280
+ options?: never;
1281
+ head?: never;
1282
+ patch?: never;
1283
+ trace?: never;
1284
+ };
896
1285
  }
897
1286
  export type webhooks = Record<string, never>;
898
1287
  export interface components {
package/dist/index.d.ts CHANGED
@@ -19,4 +19,5 @@ export type { TokenRequest, TokenResponse } from './user/token.js';
19
19
  export type { BitBitPressSynthesizeRequest, RecommendationsRequestBody, SynthesizeInput, SynthesizeItem, SynthesizeItems, SynthesizeOutputSchema, SynthesizeRequest, } from './user/typeDefs.js';
20
20
  export type { SynthesizeEvent, SynthesizeItemResponse, SynthesizeOptions } from './user/synthesize.js';
21
21
  export type { SynthesizeOnStreamingData } from './user/synthesize-batch-manager.js';
22
+ export type { InteractionItem, InteractionResponseRequest, InteractionResponseResponse, InteractionsRequest, InteractionsResponse, } from './user/interaction.js';
22
23
  //# 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;AAChD,YAAY,EACV,gBAAgB,EAChB,YAAY,EACZ,mBAAmB,EACnB,yBAAyB,EACzB,WAAW,EACX,QAAQ,GACT,MAAM,cAAc,CAAC;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CAAC;AACnD,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACtE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC9E,YAAY,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACjG,YAAY,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC/E,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACtE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACnE,YAAY,EACV,4BAA4B,EAC5B,0BAA0B,EAC1B,eAAe,EACf,cAAc,EACd,eAAe,EACf,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,eAAe,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACvG,YAAY,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AACpF,YAAY,EACV,eAAe,EACf,0BAA0B,EAC1B,2BAA2B,EAC3B,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,uBAAuB,CAAC"}
@@ -8,6 +8,7 @@ import { type Signal, type SignalRequest, type SignalResponse } from './signal.j
8
8
  import { type SynthesizeEvent, type SynthesizeItemResponse } from './synthesize.js';
9
9
  import { type TokenRequest, type TokenResponse } from './token.js';
10
10
  import type { SynthesizeItem, SynthesizeItems } from './typeDefs.js';
11
+ import { type InteractionResponseRequest, type InteractionResponseResponse, type InteractionsRequest, type InteractionsResponse } from './interaction.js';
11
12
  /**
12
13
  * User-related API methods interface (aligned with OpenAPI spec paths).
13
14
  */
@@ -70,7 +71,7 @@ export interface UserMethods {
70
71
  /**
71
72
  * Synthesize content items personalized to the user (streaming SSE).
72
73
  *
73
- * @param items - Array of items: optional inputs (type: externalId | text | excludeExternalIds, value), output (schema), optional configurationKeyName, optional searchOptionsOverrides (e.g. lookbackMinutes)
74
+ * @param items - Array of items: optional inputs (type: externalId | text | excludeExternalIds, value), output (schema), optional configurationKeyName, optional limit (number of results to return; defaults to 1), optional searchOptionsOverrides (e.g. lookbackMinutes)
74
75
  * @param options - Optional: onStreamingData(index, data) called for each streaming data update per item index
75
76
  * @returns AsyncIterable yielding connection events (connected, complete) and data events (index, data?, complete, error?)
76
77
  */
@@ -85,6 +86,22 @@ export interface UserMethods {
85
86
  * @returns Promise that resolves with the synthesized data for that item's index
86
87
  */
87
88
  synthesizeItem(item: SynthesizeItem, onStreamingData?: SynthesizeOnStreamingData): Promise<SynthesizeItemResponse>;
89
+ /**
90
+ * Batch-resolve interaction state for items from a synthesis output.
91
+ * Returns aggregates and whether the current user has already responded to each.
92
+ *
93
+ * @param options - synthesisConfigKeyName and interactions array (type + content)
94
+ * @returns Array of resolved interaction items (id, type, content, hasResponded, aggregates)
95
+ */
96
+ interactions(options: InteractionsRequest): Promise<NonNullable<InteractionsResponse>>;
97
+ /**
98
+ * Submit or update a response to an interaction (e.g. a poll answer). Returns updated aggregates.
99
+ *
100
+ * @param interactionId - ID of the interaction to respond to
101
+ * @param options - type (e.g. 'POLL') and responseData (e.g. { response: 'optionId' })
102
+ * @returns Updated aggregates and the user's recorded response
103
+ */
104
+ respondToInteraction(interactionId: string, options: InteractionResponseRequest): Promise<NonNullable<InteractionResponseResponse>>;
88
105
  }
89
106
  /**
90
107
  * User-related API methods (uses shared auth store).
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/user/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAA0B,KAAK,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AACvG,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC7B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EAAE;QAAE,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;KAAE,GACrE,OAAO,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC,CAAC;IAE3C;;;;;;OAMG;IACH,cAAc,CACZ,IAAI,EAAE,cAAc,EACpB,eAAe,CAAC,EAAE,yBAAyB,GAC1C,OAAO,CAAC,sBAAsB,CAAC,CAAC;IAEnC;;;;;;OAMG;IACH,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,WAAW,CAAC,oBAAoB,CAAC,CAAC,CAAC;IAEvF;;;;;;OAMG;IACH,oBAAoB,CAClB,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,WAAW,CAAC,2BAA2B,CAAC,CAAC,CAAC;CACtD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,aAAa,EACrB,sBAAsB,GAAE,MAAY,EACpC,kBAAkB,GAAE,MAAY,GAC/B,WAAW,CAgDb"}
@@ -9,6 +9,7 @@ const signal_js_1 = require("./signal.js");
9
9
  const signal_batch_manager_js_1 = require("./signal-batch-manager.js");
10
10
  const synthesize_js_1 = require("./synthesize.js");
11
11
  const token_js_1 = require("./token.js");
12
+ const interaction_js_1 = require("./interaction.js");
12
13
  /**
13
14
  * User-related API methods (uses shared auth store).
14
15
  */
@@ -27,6 +28,8 @@ function createUserMethods(authStore, config, synthesizeBatchTimeout = 250, sign
27
28
  signalItem: (signal) => signalBatchManager.addSignal(signal),
28
29
  synthesize: (items, options) => getConfigWithToken().then((cfg) => (0, synthesize_js_1.synthesize)(cfg, items, options)),
29
30
  synthesizeItem: (item, onStreamingData) => synthesizeBatchManager.addItem(item, onStreamingData),
31
+ interactions: (options) => getConfigWithToken().then((cfg) => (0, interaction_js_1.getInteractions)(cfg, options)),
32
+ respondToInteraction: (interactionId, options) => getConfigWithToken().then((cfg) => (0, interaction_js_1.respondToInteraction)(cfg, interactionId, options)),
30
33
  };
31
34
  }
32
35
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/user/index.ts"],"names":[],"mappings":";;AA+GA,8CA+CC;AA5JD,+EAAuG;AACvG,6DAI8B;AAC9B,6CAAuG;AACvG,2CAAiF;AACjF,2CAAiG;AACjG,uEAA+D;AAC/D,mDAAgG;AAChG,yCAAkF;AA+FlF;;GAEG;AACH,SAAgB,iBAAiB,CAC/B,SAAoB,EACpB,MAAqB,EACrB,yBAAiC,GAAG,EACpC,qBAA6B,GAAG;IAEhC,MAAM,kBAAkB,GAAG,SAAS,CAAC,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAExE,MAAM,sBAAsB,GAAG,IAAI,oDAAsB,CACvD,kBAAkB,EAClB,sBAAsB,CACvB,CAAC;IACF,MAAM,kBAAkB,GAAG,IAAI,4CAAkB,CAC/C,kBAAkB,EAClB,kBAAkB,CACnB,CAAC;IAEF,OAAO;QACL,YAAY,EAAE,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC;QAEpD,KAAK,EAAE,CAAC,QAAkC,EAAE,EAAE,CAAC,IAAA,wBAAa,EAAC,MAAM,EAAE,QAAQ,CAAC;QAE9E,OAAO,EAAE,GAAG,EAAE,CAAC,kBAAkB,EAAE,CAAC,IAAI,CAAC,uBAAU,CAAC;QAEpD,aAAa,EAAE,CAAC,OAA6B,EAAE,EAAE,CAC/C,kBAAkB,EAAE,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,uBAAU,EAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAE9D,eAAe,EAAE,CAAC,OAAgC,EAAE,EAAE,CACpD,kBAAkB,EAAE,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,uCAAkB,EAAC,GAAG,EAA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AU,EAAC,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QAErE,cAAc,EAAE,CACd,IAAoB,EACpB,eAA2C,EACV,EAAE,CAAC,sBAAsB,CAAC,OAAO,CAAC,IAAI,EAAE,eAAe,CAAC;QAE3F,YAAY,EAAE,CAAC,OAA4B,EAAE,EAAE,CAC7C,kBAAkB,EAAE,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,gCAAe,EAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAEnE,oBAAoB,EAAE,CAAC,aAAqB,EAAE,OAAmC,EAAE,EAAE,CACnF,kBAAkB,EAAE,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,qCAAoB,EAAC,GAAG,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;KACxF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,27 @@
1
+ import type { paths } from '../generated/openapi.js';
2
+ import type { RequestConfig } from '../request.js';
3
+ export type InteractionsRequest = paths['/v1/user/interactions']['post']['requestBody']['content']['application/json'];
4
+ export type InteractionsResponse = paths['/v1/user/interactions']['post']['responses'][200]['content']['application/json']['data'];
5
+ export type InteractionResponseRequest = paths['/v1/user/interactions/{interactionId}/responses']['post']['requestBody']['content']['application/json'];
6
+ export type InteractionResponseResponse = paths['/v1/user/interactions/{interactionId}/responses']['post']['responses'][200]['content']['application/json']['data'];
7
+ /** Single resolved interaction item (id, type, content, hasResponded, aggregates). */
8
+ export type InteractionItem = InteractionsResponse[number];
9
+ /**
10
+ * Batch-resolve interaction state for items from a synthesis output.
11
+ * Returns aggregates and whether the current user has already responded to each.
12
+ *
13
+ * @param config - Request configuration with base URL, timeout, fetch, and optional token
14
+ * @param options - synthesisConfigKeyName and interactions array (type + content)
15
+ * @returns Array of resolved interaction items (id, type, content, hasResponded, aggregates)
16
+ */
17
+ export declare function getInteractions(config: RequestConfig, options: InteractionsRequest): Promise<NonNullable<InteractionsResponse>>;
18
+ /**
19
+ * Submit or update a response to an interaction (e.g. a poll answer). Returns updated aggregates.
20
+ *
21
+ * @param config - Request configuration with base URL, timeout, fetch, and optional token
22
+ * @param interactionId - ID of the interaction to respond to
23
+ * @param options - type (e.g. 'POLL') and responseData (e.g. { response: 'optionId' })
24
+ * @returns Updated aggregates and the user's recorded response
25
+ */
26
+ export declare function respondToInteraction(config: RequestConfig, interactionId: string, options: InteractionResponseRequest): Promise<NonNullable<InteractionResponseResponse>>;
27
+ //# sourceMappingURL=interaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interaction.d.ts","sourceRoot":"","sources":["../../src/user/interaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAGnD,MAAM,MAAM,mBAAmB,GAC7B,KAAK,CAAC,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC;AACvF,MAAM,MAAM,oBAAoB,GAC9B,KAAK,CAAC,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAElG,MAAM,MAAM,0BAA0B,GACpC,KAAK,CAAC,iDAAiD,CAAC,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC;AACjH,MAAM,MAAM,2BAA2B,GACrC,KAAK,CAAC,iDAAiD,CAAC,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5H,sFAAsF;AACtF,MAAM,MAAM,eAAe,GAAG,oBAAoB,CAAC,MAAM,CAAC,CAAC;AAE3D;;;;;;;GAOG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,WAAW,CAAC,oBAAoB,CAAC,CAAC,CAY5C;AAED;;;;;;;GAOG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,aAAa,EACrB,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,WAAW,CAAC,2BAA2B,CAAC,CAAC,CAYnD"}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getInteractions = getInteractions;
4
+ exports.respondToInteraction = respondToInteraction;
5
+ const request_js_1 = require("../request.js");
6
+ /**
7
+ * Batch-resolve interaction state for items from a synthesis output.
8
+ * Returns aggregates and whether the current user has already responded to each.
9
+ *
10
+ * @param config - Request configuration with base URL, timeout, fetch, and optional token
11
+ * @param options - synthesisConfigKeyName and interactions array (type + content)
12
+ * @returns Array of resolved interaction items (id, type, content, hasResponded, aggregates)
13
+ */
14
+ async function getInteractions(config, options) {
15
+ const response = await (0, request_js_1.makeRequest)(config, {
16
+ method: 'POST',
17
+ path: '/v1/user/interactions',
18
+ body: options,
19
+ });
20
+ if (!response) {
21
+ throw new Error('Failed to get interactions: no data in response');
22
+ }
23
+ return response;
24
+ }
25
+ /**
26
+ * Submit or update a response to an interaction (e.g. a poll answer). Returns updated aggregates.
27
+ *
28
+ * @param config - Request configuration with base URL, timeout, fetch, and optional token
29
+ * @param interactionId - ID of the interaction to respond to
30
+ * @param options - type (e.g. 'POLL') and responseData (e.g. { response: 'optionId' })
31
+ * @returns Updated aggregates and the user's recorded response
32
+ */
33
+ async function respondToInteraction(config, interactionId, options) {
34
+ const response = await (0, request_js_1.makeRequest)(config, {
35
+ method: 'POST',
36
+ path: `/v1/user/interactions/${interactionId}/responses`,
37
+ body: options,
38
+ });
39
+ if (!response) {
40
+ throw new Error('Failed to respond to interaction: no data in response');
41
+ }
42
+ return response;
43
+ }
44
+ //# sourceMappingURL=interaction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interaction.js","sourceRoot":"","sources":["../../src/user/interaction.ts"],"names":[],"mappings":";;AAyBA,0CAeC;AAUD,oDAgBC;AAhED,8CAA4C;AAe5C;;;;;;;GAOG;AACI,KAAK,UAAU,eAAe,CACnC,MAAqB,EACrB,OAA4B;IAE5B,MAAM,QAAQ,GAAG,MAAM,IAAA,wBAAW,EAAuB,MAAM,EAAE;QAC/D,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,uBAAuB;QAC7B,IAAI,EAAE,OAAO;KACd,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACrE,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;;;;GAOG;AACI,KAAK,UAAU,oBAAoB,CACxC,MAAqB,EACrB,aAAqB,EACrB,OAAmC;IAEnC,MAAM,QAAQ,GAAG,MAAM,IAAA,wBAAW,EAA8B,MAAM,EAAE;QACtE,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,yBAAyB,aAAa,YAAY;QACxD,IAAI,EAAE,OAAO;KACd,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;IAC3E,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -30,7 +30,7 @@ export interface SynthesizeOptions {
30
30
  * Synthesize content items personalized to the user (streaming SSE).
31
31
  *
32
32
  * @param config - Request configuration with base URL, timeout, fetch, and optional token
33
- * @param items - Array of items: each has optional inputs (`type`: externalId | text | excludeExternalIds, `value`), output (schema as JSON string or Zod 4 schema), optional configurationKeyName, optional searchOptionsOverrides (e.g. lookbackMinutes)
33
+ * @param items - Array of items: each has optional inputs (`type`: externalId | text | excludeExternalIds, `value`), output (schema as JSON string or Zod 4 schema), optional configurationKeyName, optional limit (number of results to return; defaults to 1), optional searchOptionsOverrides (e.g. lookbackMinutes)
34
34
  * @param options - Optional: onStreamingData(index, data) called for each streaming data update per item index
35
35
  * @returns AsyncIterable yielding connection events (connected, complete) and data events (index, data?, complete, error?). Data may be partial until an event with complete: true for that index.
36
36
  */
@@ -27,7 +27,7 @@ function normalizeSynthesizeItems(items) {
27
27
  * Synthesize content items personalized to the user (streaming SSE).
28
28
  *
29
29
  * @param config - Request configuration with base URL, timeout, fetch, and optional token
30
- * @param items - Array of items: each has optional inputs (`type`: externalId | text | excludeExternalIds, `value`), output (schema as JSON string or Zod 4 schema), optional configurationKeyName, optional searchOptionsOverrides (e.g. lookbackMinutes)
30
+ * @param items - Array of items: each has optional inputs (`type`: externalId | text | excludeExternalIds, `value`), output (schema as JSON string or Zod 4 schema), optional configurationKeyName, optional limit (number of results to return; defaults to 1), optional searchOptionsOverrides (e.g. lookbackMinutes)
31
31
  * @param options - Optional: onStreamingData(index, data) called for each streaming data update per item index
32
32
  * @returns AsyncIterable yielding connection events (connected, complete) and data events (index, data?, complete, error?). Data may be partial until an event with complete: true for that index.
33
33
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitbitpress/client",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "BitBitPress TypeScript client library",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",