priori-chat-sdk 1.0.25 → 1.0.27
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/dist/index.d.mts +195 -6
- package/dist/index.d.ts +195 -6
- package/dist/index.js +123 -0
- package/dist/index.mjs +123 -0
- package/package.json +12 -10
- package/src/index.ts +6 -0
package/dist/index.d.mts
CHANGED
|
@@ -8,6 +8,10 @@ type ApiAttribute = {
|
|
|
8
8
|
*/
|
|
9
9
|
value: string;
|
|
10
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* Image sending behaviour enum for client configuration
|
|
13
|
+
*/
|
|
14
|
+
type ApiImageSendingBehaviour = "disabled" | "low" | "moderate" | "high" | "aggressive";
|
|
11
15
|
type ApiModerationCategory = "underage_site_use" | "sexual_minors" | "beastiality" | "sexual_violence" | "prompt_injection";
|
|
12
16
|
type ApiModerationInfo = {
|
|
13
17
|
category: ApiModerationCategory;
|
|
@@ -18,6 +22,10 @@ type ApiModerationInfo = {
|
|
|
18
22
|
severity: ApiModerationSeverity;
|
|
19
23
|
};
|
|
20
24
|
type ApiModerationSeverity = "Low" | "Medium" | "High" | "Critical";
|
|
25
|
+
/**
|
|
26
|
+
* Bot orientation — controls gender identity, pronouns, and attraction in the system prompt.
|
|
27
|
+
*/
|
|
28
|
+
type ApiOrientation = "straight_female" | "lesbian_female" | "gay_man" | "straight_man" | "trans_mtf" | "trans_ftm" | "bisexual";
|
|
21
29
|
/**
|
|
22
30
|
* Represents an API key info (without the actual key)
|
|
23
31
|
*/
|
|
@@ -45,6 +53,7 @@ type Bot = {
|
|
|
45
53
|
* Name of the bot
|
|
46
54
|
*/
|
|
47
55
|
name: string;
|
|
56
|
+
orientation: ApiOrientation;
|
|
48
57
|
};
|
|
49
58
|
type Chatter = {
|
|
50
59
|
/**
|
|
@@ -61,6 +70,7 @@ type Chatter = {
|
|
|
61
70
|
*/
|
|
62
71
|
type ClientConfig = {
|
|
63
72
|
chat_images_enabled?: boolean | null;
|
|
73
|
+
image_sending_behaviour?: ApiImageSendingBehaviour | null;
|
|
64
74
|
language?: Language | null;
|
|
65
75
|
max_delay?: number | null;
|
|
66
76
|
min_delay?: number | null;
|
|
@@ -148,6 +158,7 @@ type CreateBotRequestBody = {
|
|
|
148
158
|
* Name of the bot
|
|
149
159
|
*/
|
|
150
160
|
name: string;
|
|
161
|
+
orientation?: ApiOrientation | null;
|
|
151
162
|
};
|
|
152
163
|
type CreateBotResponse = {
|
|
153
164
|
bot: Bot;
|
|
@@ -168,6 +179,32 @@ type CreateChatterResponse = {
|
|
|
168
179
|
type CreateConversationResponse = {
|
|
169
180
|
conversation: Conversation$1;
|
|
170
181
|
};
|
|
182
|
+
type CreateConversionRequestBody = {
|
|
183
|
+
/**
|
|
184
|
+
* Amount of the conversion, can be negative for refunds. Value in cents.
|
|
185
|
+
*/
|
|
186
|
+
amount?: number | null;
|
|
187
|
+
/**
|
|
188
|
+
* Optional bot ID to attribute the conversion to a specific bot
|
|
189
|
+
*/
|
|
190
|
+
bot_id?: string | null;
|
|
191
|
+
/**
|
|
192
|
+
* Optional conversation ID to attribute the conversion to a specific conversation
|
|
193
|
+
*/
|
|
194
|
+
conversation_id?: string | null;
|
|
195
|
+
/**
|
|
196
|
+
* Optional metadata to attach to the conversion, can be any JSON object
|
|
197
|
+
*/
|
|
198
|
+
metadata?: unknown;
|
|
199
|
+
/**
|
|
200
|
+
* Optional unix timestamp (seconds) of when the conversion happened. Defaults to current time.
|
|
201
|
+
*/
|
|
202
|
+
timestamp?: number | null;
|
|
203
|
+
/**
|
|
204
|
+
* User ID of the user who made the conversion. Should be the same as 'user_id' used in /messages
|
|
205
|
+
*/
|
|
206
|
+
user_id: string;
|
|
207
|
+
};
|
|
171
208
|
type DeactivateApiKeyResponse = {
|
|
172
209
|
/**
|
|
173
210
|
* Success message
|
|
@@ -182,6 +219,15 @@ type DeleteContentResponse = {
|
|
|
182
219
|
};
|
|
183
220
|
type GenerateResponseSyncRequest = {
|
|
184
221
|
batch_size?: number;
|
|
222
|
+
/**
|
|
223
|
+
* Grammar degradation multiplier (0.0 = no degradation, 1.0 = full). Omit to disable.
|
|
224
|
+
*/
|
|
225
|
+
degrade_grammar_factor?: number | null;
|
|
226
|
+
/**
|
|
227
|
+
* Optional list of messages to use instead of the conversation's stored message history.
|
|
228
|
+
*/
|
|
229
|
+
override_messages?: Array<Message$1> | null;
|
|
230
|
+
vault_image_behaviour?: VaultImageBehaviour | null;
|
|
185
231
|
};
|
|
186
232
|
type GenerateResponseSyncResponse = {
|
|
187
233
|
candidates: Array<ResponseCandidate>;
|
|
@@ -236,13 +282,27 @@ type GetMemoriesResponse = {
|
|
|
236
282
|
*/
|
|
237
283
|
user_memories: Array<MemoryResponse>;
|
|
238
284
|
};
|
|
285
|
+
type GetPlatformResponse = {
|
|
286
|
+
platform: Platform;
|
|
287
|
+
};
|
|
239
288
|
type GetUserResponse = {
|
|
240
289
|
user: User;
|
|
241
290
|
};
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
291
|
+
type ImageItem = {
|
|
292
|
+
/**
|
|
293
|
+
* Optional custom content ID for the image
|
|
294
|
+
*/
|
|
295
|
+
new_id?: string | null;
|
|
296
|
+
/**
|
|
297
|
+
* Whether this image is public (displayed on profile) or private (vault)
|
|
298
|
+
*/
|
|
299
|
+
public: boolean;
|
|
300
|
+
/**
|
|
301
|
+
* URL of the image (S3 URL for existing content, or external URL for new upload)
|
|
302
|
+
*/
|
|
303
|
+
url: string;
|
|
304
|
+
};
|
|
305
|
+
type Language = "en" | "de" | "ru" | "ar" | "es" | "nl" | "uk" | "fr" | "it";
|
|
246
306
|
type ListApiKeysResponse = {
|
|
247
307
|
/**
|
|
248
308
|
* List of API keys for the client
|
|
@@ -302,6 +362,12 @@ type ListConversationsResponse = {
|
|
|
302
362
|
*/
|
|
303
363
|
conversations: Array<ConversationHeader>;
|
|
304
364
|
};
|
|
365
|
+
type ListPlatformsResponse = {
|
|
366
|
+
/**
|
|
367
|
+
* List of all platforms accessible to the current client
|
|
368
|
+
*/
|
|
369
|
+
platforms: Array<Platform>;
|
|
370
|
+
};
|
|
305
371
|
type MediaTypeFilter = "image" | "video";
|
|
306
372
|
type MemoryResponse = {
|
|
307
373
|
/**
|
|
@@ -334,6 +400,20 @@ type Message$1 = {
|
|
|
334
400
|
*/
|
|
335
401
|
text: string;
|
|
336
402
|
};
|
|
403
|
+
type Platform = {
|
|
404
|
+
/**
|
|
405
|
+
* Platform-specific instructions injected into the system prompt before bot-specific instructions. Used to customize AI behavior for platform-specific norms and guidelines.
|
|
406
|
+
*/
|
|
407
|
+
custom_instruction?: string | null;
|
|
408
|
+
/**
|
|
409
|
+
* Unique identifier for the platform
|
|
410
|
+
*/
|
|
411
|
+
id: string;
|
|
412
|
+
/**
|
|
413
|
+
* Name of the platform (immutable, case-sensitive, must be unique per client)
|
|
414
|
+
*/
|
|
415
|
+
name: string;
|
|
416
|
+
};
|
|
337
417
|
type ResponseCandidate = {
|
|
338
418
|
messages: Array<Message$1>;
|
|
339
419
|
};
|
|
@@ -354,6 +434,7 @@ type SearchedMessage = {
|
|
|
354
434
|
* The text content of the matched message
|
|
355
435
|
*/
|
|
356
436
|
message_text: string;
|
|
437
|
+
moderation?: ApiModerationInfo | null;
|
|
357
438
|
/**
|
|
358
439
|
* Unix timestamp when the message was sent
|
|
359
440
|
*/
|
|
@@ -382,10 +463,16 @@ type UpdateBotRequest = {
|
|
|
382
463
|
* Freeform text description
|
|
383
464
|
*/
|
|
384
465
|
freeform?: string | null;
|
|
466
|
+
/**
|
|
467
|
+
* Optional list of images to set for this bot.
|
|
468
|
+
* When provided, all existing bot images are replaced with these.
|
|
469
|
+
*/
|
|
470
|
+
images?: Array<ImageItem> | null;
|
|
385
471
|
/**
|
|
386
472
|
* Name of the bot
|
|
387
473
|
*/
|
|
388
474
|
name?: string | null;
|
|
475
|
+
orientation?: ApiOrientation | null;
|
|
389
476
|
};
|
|
390
477
|
type UpdateBotResponse = {
|
|
391
478
|
bot: Bot;
|
|
@@ -395,6 +482,7 @@ type UpdateBotResponse = {
|
|
|
395
482
|
*/
|
|
396
483
|
type UpdateClientConfigRequest = {
|
|
397
484
|
chat_images_enabled?: boolean | null;
|
|
485
|
+
image_sending_behaviour?: ApiImageSendingBehaviour | null;
|
|
398
486
|
language?: Language | null;
|
|
399
487
|
max_delay?: number | null;
|
|
400
488
|
min_delay?: number | null;
|
|
@@ -407,6 +495,18 @@ type UpdateClientConfigRequest = {
|
|
|
407
495
|
type UpdateClientConfigResponse = {
|
|
408
496
|
config: ClientConfig;
|
|
409
497
|
};
|
|
498
|
+
type UpdatePlatformRequestBody = {
|
|
499
|
+
/**
|
|
500
|
+
* Platform-specific instructions to inject into the system prompt before bot-specific instructions
|
|
501
|
+
*/
|
|
502
|
+
custom_instruction?: string | null;
|
|
503
|
+
};
|
|
504
|
+
type UpdatePlatformResponse = {
|
|
505
|
+
/**
|
|
506
|
+
* Whether the update was successful
|
|
507
|
+
*/
|
|
508
|
+
success: boolean;
|
|
509
|
+
};
|
|
410
510
|
type UpdateUserRequest = {
|
|
411
511
|
/**
|
|
412
512
|
* List of user attributes
|
|
@@ -444,6 +544,10 @@ type UploadContentRequest = {
|
|
|
444
544
|
};
|
|
445
545
|
type UploadContentResponse = {
|
|
446
546
|
content: Content;
|
|
547
|
+
/**
|
|
548
|
+
* Whether the content was newly created (true) or already existed (false)
|
|
549
|
+
*/
|
|
550
|
+
created: boolean;
|
|
447
551
|
};
|
|
448
552
|
type User = {
|
|
449
553
|
/**
|
|
@@ -463,6 +567,7 @@ type User = {
|
|
|
463
567
|
*/
|
|
464
568
|
username: string;
|
|
465
569
|
};
|
|
570
|
+
type VaultImageBehaviour = "force" | "never";
|
|
466
571
|
type CreateApiKeyData = {
|
|
467
572
|
body: CreateApiKeyRequest;
|
|
468
573
|
path?: never;
|
|
@@ -621,6 +726,22 @@ type ListConversationsData = {
|
|
|
621
726
|
* Filter conversations with last message before this timestamp (Unix epoch)
|
|
622
727
|
*/
|
|
623
728
|
max_last_message_date?: number | null;
|
|
729
|
+
/**
|
|
730
|
+
* Filter by moderation severity (repeatable). Values: Low, Medium, High, Critical
|
|
731
|
+
*/
|
|
732
|
+
severities?: Array<string> | null;
|
|
733
|
+
/**
|
|
734
|
+
* Filter by moderation category (repeatable). Values: underage_site_use, sexual_minors, beastiality, sexual_violence, prompt_injection
|
|
735
|
+
*/
|
|
736
|
+
categories?: Array<string> | null;
|
|
737
|
+
/**
|
|
738
|
+
* Maximum number of conversations to return (default: 1000)
|
|
739
|
+
*/
|
|
740
|
+
limit?: number | null;
|
|
741
|
+
/**
|
|
742
|
+
* Number of conversations to skip before returning results (default: 0)
|
|
743
|
+
*/
|
|
744
|
+
offset?: number | null;
|
|
624
745
|
};
|
|
625
746
|
url: "/api/conversations";
|
|
626
747
|
};
|
|
@@ -647,10 +768,21 @@ type UpdateUserData = {
|
|
|
647
768
|
url: "/api/users/{user_id}";
|
|
648
769
|
};
|
|
649
770
|
|
|
771
|
+
interface GetPlatformOptions {
|
|
772
|
+
platform_id: string;
|
|
773
|
+
}
|
|
774
|
+
interface UpdatePlatformOptions extends UpdatePlatformRequestBody {
|
|
775
|
+
platform_id: string;
|
|
776
|
+
}
|
|
777
|
+
|
|
650
778
|
/**
|
|
651
779
|
* Options for listing conversations
|
|
652
780
|
*/
|
|
653
|
-
interface ListConversationsOptions extends NonNullable<ListConversationsData['query']> {
|
|
781
|
+
interface ListConversationsOptions extends Omit<NonNullable<ListConversationsData['query']>, 'severities' | 'categories'> {
|
|
782
|
+
/** Filter by moderation severity */
|
|
783
|
+
severities?: Array<ApiModerationSeverity> | null;
|
|
784
|
+
/** Filter by moderation category */
|
|
785
|
+
categories?: Array<ApiModerationCategory> | null;
|
|
654
786
|
}
|
|
655
787
|
/**
|
|
656
788
|
* Options for getting a conversation by ID
|
|
@@ -1326,6 +1458,63 @@ declare class PrioriChat {
|
|
|
1326
1458
|
* ```
|
|
1327
1459
|
*/
|
|
1328
1460
|
deactivateChatter(options: DeactivateChatterData["path"]): Promise<void>;
|
|
1461
|
+
/**
|
|
1462
|
+
* Lists all platforms accessible to the current client
|
|
1463
|
+
* @example
|
|
1464
|
+
* ```ts
|
|
1465
|
+
* const client = new PrioriChat("your-api-key");
|
|
1466
|
+
*
|
|
1467
|
+
* const result = await client.listPlatforms();
|
|
1468
|
+
* console.log(`Found ${result.platforms.length} platforms`);
|
|
1469
|
+
* ```
|
|
1470
|
+
*/
|
|
1471
|
+
listPlatforms(): Promise<ListPlatformsResponse>;
|
|
1472
|
+
/**
|
|
1473
|
+
* Retrieves a specific platform by ID
|
|
1474
|
+
* @example
|
|
1475
|
+
* ```ts
|
|
1476
|
+
* const client = new PrioriChat("your-api-key");
|
|
1477
|
+
*
|
|
1478
|
+
* const result = await client.getPlatform({
|
|
1479
|
+
* platform_id: "12345678-1234-1234-1234-123456789012"
|
|
1480
|
+
* });
|
|
1481
|
+
*
|
|
1482
|
+
* console.log(`Platform name: ${result.platform.name}`);
|
|
1483
|
+
* ```
|
|
1484
|
+
*/
|
|
1485
|
+
getPlatform(options: GetPlatformOptions): Promise<GetPlatformResponse>;
|
|
1486
|
+
/**
|
|
1487
|
+
* Updates an existing platform
|
|
1488
|
+
* @example
|
|
1489
|
+
* ```ts
|
|
1490
|
+
* const client = new PrioriChat("your-api-key");
|
|
1491
|
+
*
|
|
1492
|
+
* const result = await client.updatePlatform({
|
|
1493
|
+
* platform_id: "12345678-1234-1234-1234-123456789012",
|
|
1494
|
+
* custom_instruction: "Be warm and helpful"
|
|
1495
|
+
* });
|
|
1496
|
+
*
|
|
1497
|
+
* console.log(`Updated platform successfully`);
|
|
1498
|
+
* ```
|
|
1499
|
+
*/
|
|
1500
|
+
updatePlatform(options: UpdatePlatformOptions): Promise<UpdatePlatformResponse>;
|
|
1501
|
+
/**
|
|
1502
|
+
* Creates a conversion record for tracking revenue or events
|
|
1503
|
+
* @example
|
|
1504
|
+
* ```ts
|
|
1505
|
+
* const client = new PrioriChat("your-api-key");
|
|
1506
|
+
*
|
|
1507
|
+
* await client.createConversion({
|
|
1508
|
+
* user_id: "user-123",
|
|
1509
|
+
* bot_id: "12345678-1234-1234-1234-123456789012",
|
|
1510
|
+
* amount: 4999, // Value in cents
|
|
1511
|
+
* timestamp: Math.floor(Date.now() / 1000)
|
|
1512
|
+
* });
|
|
1513
|
+
*
|
|
1514
|
+
* console.log("Conversion recorded");
|
|
1515
|
+
* ```
|
|
1516
|
+
*/
|
|
1517
|
+
createConversion(options: CreateConversionRequestBody): Promise<void>;
|
|
1329
1518
|
}
|
|
1330
1519
|
|
|
1331
|
-
export { type ApiAttribute, ApiError, type ApiKeyInfo, type ApiModerationCategory, type ApiModerationInfo, type ApiModerationSeverity, type AttachedMedia, type Bot, type Chatter, type ClientConfig, type Content, Conversation, type ConversationCallbacks, type ConversationHeader, type ConversationOptions, type Conversation$1 as ConversationType, type ConversationWithId, type ConversationWithUserBot, type CreateApiKeyRequest, type CreateApiKeyResponse, type CreateBotRequestBody, type CreateBotResponse, type CreateChatterRequestBody, type CreateChatterResponse, type CreateConversationOptions, type CreateConversationResponse, type DeactivateApiKeyData, type DeactivateApiKeyResponse, type DeactivateChatterData, type DeleteContentResponse, type GenerateResponseOptions, type GenerateResponseSyncRequest, type GenerateResponseSyncResponse, type GetBotResponse, type GetChatterData, type GetChatterResponse, type GetClientConfigResponse, type GetConversationOptions, type GetConversationResponse, type GetMemoriesResponse, type GetUserData, type GetUserResponse, type Language, type ListApiKeysResponse, type ListBotsResponse, type ListChattersResponse, type ListContentQuery, type ListContentResponse, type ListConversationsOptions, type ListConversationsResponse, type MediaTypeFilter, type MemoryResponse, type Message, PrioriChat, type ResponseCandidate, type SearchedMessage, type Summary, type UpdateBotRequest, type UpdateBotResponse, type UpdateClientConfigRequest, type UpdateClientConfigResponse, type UpdateUserData, type UpdateUserRequest, type UpdateUserResponse, type UploadContentRequest, type UploadContentResponse, type User };
|
|
1520
|
+
export { type ApiAttribute, ApiError, type ApiKeyInfo, type ApiModerationCategory, type ApiModerationInfo, type ApiModerationSeverity, type AttachedMedia, type Bot, type Chatter, type ClientConfig, type Content, Conversation, type ConversationCallbacks, type ConversationHeader, type ConversationOptions, type Conversation$1 as ConversationType, type ConversationWithId, type ConversationWithUserBot, type CreateApiKeyRequest, type CreateApiKeyResponse, type CreateBotRequestBody, type CreateBotResponse, type CreateChatterRequestBody, type CreateChatterResponse, type CreateConversationOptions, type CreateConversationResponse, type CreateConversionRequestBody, type DeactivateApiKeyData, type DeactivateApiKeyResponse, type DeactivateChatterData, type DeleteContentResponse, type GenerateResponseOptions, type GenerateResponseSyncRequest, type GenerateResponseSyncResponse, type GetBotResponse, type GetChatterData, type GetChatterResponse, type GetClientConfigResponse, type GetConversationOptions, type GetConversationResponse, type GetMemoriesResponse, type GetPlatformResponse, type GetUserData, type GetUserResponse, type Language, type ListApiKeysResponse, type ListBotsResponse, type ListChattersResponse, type ListContentQuery, type ListContentResponse, type ListConversationsOptions, type ListConversationsResponse, type ListPlatformsResponse, type MediaTypeFilter, type MemoryResponse, type Message, type Platform, PrioriChat, type ResponseCandidate, type SearchedMessage, type Summary, type UpdateBotRequest, type UpdateBotResponse, type UpdateClientConfigRequest, type UpdateClientConfigResponse, type UpdatePlatformRequestBody, type UpdatePlatformResponse, type UpdateUserData, type UpdateUserRequest, type UpdateUserResponse, type UploadContentRequest, type UploadContentResponse, type User };
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,10 @@ type ApiAttribute = {
|
|
|
8
8
|
*/
|
|
9
9
|
value: string;
|
|
10
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* Image sending behaviour enum for client configuration
|
|
13
|
+
*/
|
|
14
|
+
type ApiImageSendingBehaviour = "disabled" | "low" | "moderate" | "high" | "aggressive";
|
|
11
15
|
type ApiModerationCategory = "underage_site_use" | "sexual_minors" | "beastiality" | "sexual_violence" | "prompt_injection";
|
|
12
16
|
type ApiModerationInfo = {
|
|
13
17
|
category: ApiModerationCategory;
|
|
@@ -18,6 +22,10 @@ type ApiModerationInfo = {
|
|
|
18
22
|
severity: ApiModerationSeverity;
|
|
19
23
|
};
|
|
20
24
|
type ApiModerationSeverity = "Low" | "Medium" | "High" | "Critical";
|
|
25
|
+
/**
|
|
26
|
+
* Bot orientation — controls gender identity, pronouns, and attraction in the system prompt.
|
|
27
|
+
*/
|
|
28
|
+
type ApiOrientation = "straight_female" | "lesbian_female" | "gay_man" | "straight_man" | "trans_mtf" | "trans_ftm" | "bisexual";
|
|
21
29
|
/**
|
|
22
30
|
* Represents an API key info (without the actual key)
|
|
23
31
|
*/
|
|
@@ -45,6 +53,7 @@ type Bot = {
|
|
|
45
53
|
* Name of the bot
|
|
46
54
|
*/
|
|
47
55
|
name: string;
|
|
56
|
+
orientation: ApiOrientation;
|
|
48
57
|
};
|
|
49
58
|
type Chatter = {
|
|
50
59
|
/**
|
|
@@ -61,6 +70,7 @@ type Chatter = {
|
|
|
61
70
|
*/
|
|
62
71
|
type ClientConfig = {
|
|
63
72
|
chat_images_enabled?: boolean | null;
|
|
73
|
+
image_sending_behaviour?: ApiImageSendingBehaviour | null;
|
|
64
74
|
language?: Language | null;
|
|
65
75
|
max_delay?: number | null;
|
|
66
76
|
min_delay?: number | null;
|
|
@@ -148,6 +158,7 @@ type CreateBotRequestBody = {
|
|
|
148
158
|
* Name of the bot
|
|
149
159
|
*/
|
|
150
160
|
name: string;
|
|
161
|
+
orientation?: ApiOrientation | null;
|
|
151
162
|
};
|
|
152
163
|
type CreateBotResponse = {
|
|
153
164
|
bot: Bot;
|
|
@@ -168,6 +179,32 @@ type CreateChatterResponse = {
|
|
|
168
179
|
type CreateConversationResponse = {
|
|
169
180
|
conversation: Conversation$1;
|
|
170
181
|
};
|
|
182
|
+
type CreateConversionRequestBody = {
|
|
183
|
+
/**
|
|
184
|
+
* Amount of the conversion, can be negative for refunds. Value in cents.
|
|
185
|
+
*/
|
|
186
|
+
amount?: number | null;
|
|
187
|
+
/**
|
|
188
|
+
* Optional bot ID to attribute the conversion to a specific bot
|
|
189
|
+
*/
|
|
190
|
+
bot_id?: string | null;
|
|
191
|
+
/**
|
|
192
|
+
* Optional conversation ID to attribute the conversion to a specific conversation
|
|
193
|
+
*/
|
|
194
|
+
conversation_id?: string | null;
|
|
195
|
+
/**
|
|
196
|
+
* Optional metadata to attach to the conversion, can be any JSON object
|
|
197
|
+
*/
|
|
198
|
+
metadata?: unknown;
|
|
199
|
+
/**
|
|
200
|
+
* Optional unix timestamp (seconds) of when the conversion happened. Defaults to current time.
|
|
201
|
+
*/
|
|
202
|
+
timestamp?: number | null;
|
|
203
|
+
/**
|
|
204
|
+
* User ID of the user who made the conversion. Should be the same as 'user_id' used in /messages
|
|
205
|
+
*/
|
|
206
|
+
user_id: string;
|
|
207
|
+
};
|
|
171
208
|
type DeactivateApiKeyResponse = {
|
|
172
209
|
/**
|
|
173
210
|
* Success message
|
|
@@ -182,6 +219,15 @@ type DeleteContentResponse = {
|
|
|
182
219
|
};
|
|
183
220
|
type GenerateResponseSyncRequest = {
|
|
184
221
|
batch_size?: number;
|
|
222
|
+
/**
|
|
223
|
+
* Grammar degradation multiplier (0.0 = no degradation, 1.0 = full). Omit to disable.
|
|
224
|
+
*/
|
|
225
|
+
degrade_grammar_factor?: number | null;
|
|
226
|
+
/**
|
|
227
|
+
* Optional list of messages to use instead of the conversation's stored message history.
|
|
228
|
+
*/
|
|
229
|
+
override_messages?: Array<Message$1> | null;
|
|
230
|
+
vault_image_behaviour?: VaultImageBehaviour | null;
|
|
185
231
|
};
|
|
186
232
|
type GenerateResponseSyncResponse = {
|
|
187
233
|
candidates: Array<ResponseCandidate>;
|
|
@@ -236,13 +282,27 @@ type GetMemoriesResponse = {
|
|
|
236
282
|
*/
|
|
237
283
|
user_memories: Array<MemoryResponse>;
|
|
238
284
|
};
|
|
285
|
+
type GetPlatformResponse = {
|
|
286
|
+
platform: Platform;
|
|
287
|
+
};
|
|
239
288
|
type GetUserResponse = {
|
|
240
289
|
user: User;
|
|
241
290
|
};
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
291
|
+
type ImageItem = {
|
|
292
|
+
/**
|
|
293
|
+
* Optional custom content ID for the image
|
|
294
|
+
*/
|
|
295
|
+
new_id?: string | null;
|
|
296
|
+
/**
|
|
297
|
+
* Whether this image is public (displayed on profile) or private (vault)
|
|
298
|
+
*/
|
|
299
|
+
public: boolean;
|
|
300
|
+
/**
|
|
301
|
+
* URL of the image (S3 URL for existing content, or external URL for new upload)
|
|
302
|
+
*/
|
|
303
|
+
url: string;
|
|
304
|
+
};
|
|
305
|
+
type Language = "en" | "de" | "ru" | "ar" | "es" | "nl" | "uk" | "fr" | "it";
|
|
246
306
|
type ListApiKeysResponse = {
|
|
247
307
|
/**
|
|
248
308
|
* List of API keys for the client
|
|
@@ -302,6 +362,12 @@ type ListConversationsResponse = {
|
|
|
302
362
|
*/
|
|
303
363
|
conversations: Array<ConversationHeader>;
|
|
304
364
|
};
|
|
365
|
+
type ListPlatformsResponse = {
|
|
366
|
+
/**
|
|
367
|
+
* List of all platforms accessible to the current client
|
|
368
|
+
*/
|
|
369
|
+
platforms: Array<Platform>;
|
|
370
|
+
};
|
|
305
371
|
type MediaTypeFilter = "image" | "video";
|
|
306
372
|
type MemoryResponse = {
|
|
307
373
|
/**
|
|
@@ -334,6 +400,20 @@ type Message$1 = {
|
|
|
334
400
|
*/
|
|
335
401
|
text: string;
|
|
336
402
|
};
|
|
403
|
+
type Platform = {
|
|
404
|
+
/**
|
|
405
|
+
* Platform-specific instructions injected into the system prompt before bot-specific instructions. Used to customize AI behavior for platform-specific norms and guidelines.
|
|
406
|
+
*/
|
|
407
|
+
custom_instruction?: string | null;
|
|
408
|
+
/**
|
|
409
|
+
* Unique identifier for the platform
|
|
410
|
+
*/
|
|
411
|
+
id: string;
|
|
412
|
+
/**
|
|
413
|
+
* Name of the platform (immutable, case-sensitive, must be unique per client)
|
|
414
|
+
*/
|
|
415
|
+
name: string;
|
|
416
|
+
};
|
|
337
417
|
type ResponseCandidate = {
|
|
338
418
|
messages: Array<Message$1>;
|
|
339
419
|
};
|
|
@@ -354,6 +434,7 @@ type SearchedMessage = {
|
|
|
354
434
|
* The text content of the matched message
|
|
355
435
|
*/
|
|
356
436
|
message_text: string;
|
|
437
|
+
moderation?: ApiModerationInfo | null;
|
|
357
438
|
/**
|
|
358
439
|
* Unix timestamp when the message was sent
|
|
359
440
|
*/
|
|
@@ -382,10 +463,16 @@ type UpdateBotRequest = {
|
|
|
382
463
|
* Freeform text description
|
|
383
464
|
*/
|
|
384
465
|
freeform?: string | null;
|
|
466
|
+
/**
|
|
467
|
+
* Optional list of images to set for this bot.
|
|
468
|
+
* When provided, all existing bot images are replaced with these.
|
|
469
|
+
*/
|
|
470
|
+
images?: Array<ImageItem> | null;
|
|
385
471
|
/**
|
|
386
472
|
* Name of the bot
|
|
387
473
|
*/
|
|
388
474
|
name?: string | null;
|
|
475
|
+
orientation?: ApiOrientation | null;
|
|
389
476
|
};
|
|
390
477
|
type UpdateBotResponse = {
|
|
391
478
|
bot: Bot;
|
|
@@ -395,6 +482,7 @@ type UpdateBotResponse = {
|
|
|
395
482
|
*/
|
|
396
483
|
type UpdateClientConfigRequest = {
|
|
397
484
|
chat_images_enabled?: boolean | null;
|
|
485
|
+
image_sending_behaviour?: ApiImageSendingBehaviour | null;
|
|
398
486
|
language?: Language | null;
|
|
399
487
|
max_delay?: number | null;
|
|
400
488
|
min_delay?: number | null;
|
|
@@ -407,6 +495,18 @@ type UpdateClientConfigRequest = {
|
|
|
407
495
|
type UpdateClientConfigResponse = {
|
|
408
496
|
config: ClientConfig;
|
|
409
497
|
};
|
|
498
|
+
type UpdatePlatformRequestBody = {
|
|
499
|
+
/**
|
|
500
|
+
* Platform-specific instructions to inject into the system prompt before bot-specific instructions
|
|
501
|
+
*/
|
|
502
|
+
custom_instruction?: string | null;
|
|
503
|
+
};
|
|
504
|
+
type UpdatePlatformResponse = {
|
|
505
|
+
/**
|
|
506
|
+
* Whether the update was successful
|
|
507
|
+
*/
|
|
508
|
+
success: boolean;
|
|
509
|
+
};
|
|
410
510
|
type UpdateUserRequest = {
|
|
411
511
|
/**
|
|
412
512
|
* List of user attributes
|
|
@@ -444,6 +544,10 @@ type UploadContentRequest = {
|
|
|
444
544
|
};
|
|
445
545
|
type UploadContentResponse = {
|
|
446
546
|
content: Content;
|
|
547
|
+
/**
|
|
548
|
+
* Whether the content was newly created (true) or already existed (false)
|
|
549
|
+
*/
|
|
550
|
+
created: boolean;
|
|
447
551
|
};
|
|
448
552
|
type User = {
|
|
449
553
|
/**
|
|
@@ -463,6 +567,7 @@ type User = {
|
|
|
463
567
|
*/
|
|
464
568
|
username: string;
|
|
465
569
|
};
|
|
570
|
+
type VaultImageBehaviour = "force" | "never";
|
|
466
571
|
type CreateApiKeyData = {
|
|
467
572
|
body: CreateApiKeyRequest;
|
|
468
573
|
path?: never;
|
|
@@ -621,6 +726,22 @@ type ListConversationsData = {
|
|
|
621
726
|
* Filter conversations with last message before this timestamp (Unix epoch)
|
|
622
727
|
*/
|
|
623
728
|
max_last_message_date?: number | null;
|
|
729
|
+
/**
|
|
730
|
+
* Filter by moderation severity (repeatable). Values: Low, Medium, High, Critical
|
|
731
|
+
*/
|
|
732
|
+
severities?: Array<string> | null;
|
|
733
|
+
/**
|
|
734
|
+
* Filter by moderation category (repeatable). Values: underage_site_use, sexual_minors, beastiality, sexual_violence, prompt_injection
|
|
735
|
+
*/
|
|
736
|
+
categories?: Array<string> | null;
|
|
737
|
+
/**
|
|
738
|
+
* Maximum number of conversations to return (default: 1000)
|
|
739
|
+
*/
|
|
740
|
+
limit?: number | null;
|
|
741
|
+
/**
|
|
742
|
+
* Number of conversations to skip before returning results (default: 0)
|
|
743
|
+
*/
|
|
744
|
+
offset?: number | null;
|
|
624
745
|
};
|
|
625
746
|
url: "/api/conversations";
|
|
626
747
|
};
|
|
@@ -647,10 +768,21 @@ type UpdateUserData = {
|
|
|
647
768
|
url: "/api/users/{user_id}";
|
|
648
769
|
};
|
|
649
770
|
|
|
771
|
+
interface GetPlatformOptions {
|
|
772
|
+
platform_id: string;
|
|
773
|
+
}
|
|
774
|
+
interface UpdatePlatformOptions extends UpdatePlatformRequestBody {
|
|
775
|
+
platform_id: string;
|
|
776
|
+
}
|
|
777
|
+
|
|
650
778
|
/**
|
|
651
779
|
* Options for listing conversations
|
|
652
780
|
*/
|
|
653
|
-
interface ListConversationsOptions extends NonNullable<ListConversationsData['query']> {
|
|
781
|
+
interface ListConversationsOptions extends Omit<NonNullable<ListConversationsData['query']>, 'severities' | 'categories'> {
|
|
782
|
+
/** Filter by moderation severity */
|
|
783
|
+
severities?: Array<ApiModerationSeverity> | null;
|
|
784
|
+
/** Filter by moderation category */
|
|
785
|
+
categories?: Array<ApiModerationCategory> | null;
|
|
654
786
|
}
|
|
655
787
|
/**
|
|
656
788
|
* Options for getting a conversation by ID
|
|
@@ -1326,6 +1458,63 @@ declare class PrioriChat {
|
|
|
1326
1458
|
* ```
|
|
1327
1459
|
*/
|
|
1328
1460
|
deactivateChatter(options: DeactivateChatterData["path"]): Promise<void>;
|
|
1461
|
+
/**
|
|
1462
|
+
* Lists all platforms accessible to the current client
|
|
1463
|
+
* @example
|
|
1464
|
+
* ```ts
|
|
1465
|
+
* const client = new PrioriChat("your-api-key");
|
|
1466
|
+
*
|
|
1467
|
+
* const result = await client.listPlatforms();
|
|
1468
|
+
* console.log(`Found ${result.platforms.length} platforms`);
|
|
1469
|
+
* ```
|
|
1470
|
+
*/
|
|
1471
|
+
listPlatforms(): Promise<ListPlatformsResponse>;
|
|
1472
|
+
/**
|
|
1473
|
+
* Retrieves a specific platform by ID
|
|
1474
|
+
* @example
|
|
1475
|
+
* ```ts
|
|
1476
|
+
* const client = new PrioriChat("your-api-key");
|
|
1477
|
+
*
|
|
1478
|
+
* const result = await client.getPlatform({
|
|
1479
|
+
* platform_id: "12345678-1234-1234-1234-123456789012"
|
|
1480
|
+
* });
|
|
1481
|
+
*
|
|
1482
|
+
* console.log(`Platform name: ${result.platform.name}`);
|
|
1483
|
+
* ```
|
|
1484
|
+
*/
|
|
1485
|
+
getPlatform(options: GetPlatformOptions): Promise<GetPlatformResponse>;
|
|
1486
|
+
/**
|
|
1487
|
+
* Updates an existing platform
|
|
1488
|
+
* @example
|
|
1489
|
+
* ```ts
|
|
1490
|
+
* const client = new PrioriChat("your-api-key");
|
|
1491
|
+
*
|
|
1492
|
+
* const result = await client.updatePlatform({
|
|
1493
|
+
* platform_id: "12345678-1234-1234-1234-123456789012",
|
|
1494
|
+
* custom_instruction: "Be warm and helpful"
|
|
1495
|
+
* });
|
|
1496
|
+
*
|
|
1497
|
+
* console.log(`Updated platform successfully`);
|
|
1498
|
+
* ```
|
|
1499
|
+
*/
|
|
1500
|
+
updatePlatform(options: UpdatePlatformOptions): Promise<UpdatePlatformResponse>;
|
|
1501
|
+
/**
|
|
1502
|
+
* Creates a conversion record for tracking revenue or events
|
|
1503
|
+
* @example
|
|
1504
|
+
* ```ts
|
|
1505
|
+
* const client = new PrioriChat("your-api-key");
|
|
1506
|
+
*
|
|
1507
|
+
* await client.createConversion({
|
|
1508
|
+
* user_id: "user-123",
|
|
1509
|
+
* bot_id: "12345678-1234-1234-1234-123456789012",
|
|
1510
|
+
* amount: 4999, // Value in cents
|
|
1511
|
+
* timestamp: Math.floor(Date.now() / 1000)
|
|
1512
|
+
* });
|
|
1513
|
+
*
|
|
1514
|
+
* console.log("Conversion recorded");
|
|
1515
|
+
* ```
|
|
1516
|
+
*/
|
|
1517
|
+
createConversion(options: CreateConversionRequestBody): Promise<void>;
|
|
1329
1518
|
}
|
|
1330
1519
|
|
|
1331
|
-
export { type ApiAttribute, ApiError, type ApiKeyInfo, type ApiModerationCategory, type ApiModerationInfo, type ApiModerationSeverity, type AttachedMedia, type Bot, type Chatter, type ClientConfig, type Content, Conversation, type ConversationCallbacks, type ConversationHeader, type ConversationOptions, type Conversation$1 as ConversationType, type ConversationWithId, type ConversationWithUserBot, type CreateApiKeyRequest, type CreateApiKeyResponse, type CreateBotRequestBody, type CreateBotResponse, type CreateChatterRequestBody, type CreateChatterResponse, type CreateConversationOptions, type CreateConversationResponse, type DeactivateApiKeyData, type DeactivateApiKeyResponse, type DeactivateChatterData, type DeleteContentResponse, type GenerateResponseOptions, type GenerateResponseSyncRequest, type GenerateResponseSyncResponse, type GetBotResponse, type GetChatterData, type GetChatterResponse, type GetClientConfigResponse, type GetConversationOptions, type GetConversationResponse, type GetMemoriesResponse, type GetUserData, type GetUserResponse, type Language, type ListApiKeysResponse, type ListBotsResponse, type ListChattersResponse, type ListContentQuery, type ListContentResponse, type ListConversationsOptions, type ListConversationsResponse, type MediaTypeFilter, type MemoryResponse, type Message, PrioriChat, type ResponseCandidate, type SearchedMessage, type Summary, type UpdateBotRequest, type UpdateBotResponse, type UpdateClientConfigRequest, type UpdateClientConfigResponse, type UpdateUserData, type UpdateUserRequest, type UpdateUserResponse, type UploadContentRequest, type UploadContentResponse, type User };
|
|
1520
|
+
export { type ApiAttribute, ApiError, type ApiKeyInfo, type ApiModerationCategory, type ApiModerationInfo, type ApiModerationSeverity, type AttachedMedia, type Bot, type Chatter, type ClientConfig, type Content, Conversation, type ConversationCallbacks, type ConversationHeader, type ConversationOptions, type Conversation$1 as ConversationType, type ConversationWithId, type ConversationWithUserBot, type CreateApiKeyRequest, type CreateApiKeyResponse, type CreateBotRequestBody, type CreateBotResponse, type CreateChatterRequestBody, type CreateChatterResponse, type CreateConversationOptions, type CreateConversationResponse, type CreateConversionRequestBody, type DeactivateApiKeyData, type DeactivateApiKeyResponse, type DeactivateChatterData, type DeleteContentResponse, type GenerateResponseOptions, type GenerateResponseSyncRequest, type GenerateResponseSyncResponse, type GetBotResponse, type GetChatterData, type GetChatterResponse, type GetClientConfigResponse, type GetConversationOptions, type GetConversationResponse, type GetMemoriesResponse, type GetPlatformResponse, type GetUserData, type GetUserResponse, type Language, type ListApiKeysResponse, type ListBotsResponse, type ListChattersResponse, type ListContentQuery, type ListContentResponse, type ListConversationsOptions, type ListConversationsResponse, type ListPlatformsResponse, type MediaTypeFilter, type MemoryResponse, type Message, type Platform, PrioriChat, type ResponseCandidate, type SearchedMessage, type Summary, type UpdateBotRequest, type UpdateBotResponse, type UpdateClientConfigRequest, type UpdateClientConfigResponse, type UpdatePlatformRequestBody, type UpdatePlatformResponse, type UpdateUserData, type UpdateUserRequest, type UpdateUserResponse, type UploadContentRequest, type UploadContentResponse, type User };
|
package/dist/index.js
CHANGED
|
@@ -701,6 +701,41 @@ var sendMessage = (options) => {
|
|
|
701
701
|
}
|
|
702
702
|
});
|
|
703
703
|
};
|
|
704
|
+
var createConversion = (options) => {
|
|
705
|
+
return (options.client ?? client).post({
|
|
706
|
+
url: "/api/conversion",
|
|
707
|
+
...options,
|
|
708
|
+
headers: {
|
|
709
|
+
"Content-Type": "application/json",
|
|
710
|
+
...options.headers
|
|
711
|
+
}
|
|
712
|
+
});
|
|
713
|
+
};
|
|
714
|
+
var listPlatforms = (options) => {
|
|
715
|
+
return (options?.client ?? client).get({
|
|
716
|
+
responseType: "json",
|
|
717
|
+
url: "/api/platforms",
|
|
718
|
+
...options
|
|
719
|
+
});
|
|
720
|
+
};
|
|
721
|
+
var getPlatform = (options) => {
|
|
722
|
+
return (options.client ?? client).get({
|
|
723
|
+
responseType: "json",
|
|
724
|
+
url: "/api/platforms/{platform_id}",
|
|
725
|
+
...options
|
|
726
|
+
});
|
|
727
|
+
};
|
|
728
|
+
var updatePlatform = (options) => {
|
|
729
|
+
return (options.client ?? client).patch({
|
|
730
|
+
responseType: "json",
|
|
731
|
+
url: "/api/platforms/{platform_id}",
|
|
732
|
+
...options,
|
|
733
|
+
headers: {
|
|
734
|
+
"Content-Type": "application/json",
|
|
735
|
+
...options.headers
|
|
736
|
+
}
|
|
737
|
+
});
|
|
738
|
+
};
|
|
704
739
|
var getUser = (options) => {
|
|
705
740
|
return (options.client ?? client).get({
|
|
706
741
|
responseType: "json",
|
|
@@ -866,6 +901,29 @@ async function deactivateChatterImpl(options) {
|
|
|
866
901
|
});
|
|
867
902
|
}
|
|
868
903
|
|
|
904
|
+
// src/methods/platforms.ts
|
|
905
|
+
async function listPlatformsImpl() {
|
|
906
|
+
const result = await listPlatforms({});
|
|
907
|
+
return result.data;
|
|
908
|
+
}
|
|
909
|
+
async function getPlatformImpl(options) {
|
|
910
|
+
const result = await getPlatform({ path: options });
|
|
911
|
+
return result.data;
|
|
912
|
+
}
|
|
913
|
+
async function updatePlatformImpl(options) {
|
|
914
|
+
const { platform_id, ...body } = options;
|
|
915
|
+
const result = await updatePlatform({
|
|
916
|
+
path: { platform_id },
|
|
917
|
+
body
|
|
918
|
+
});
|
|
919
|
+
return result.data;
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
// src/methods/conversions.ts
|
|
923
|
+
async function createConversionImpl(options) {
|
|
924
|
+
await createConversion({ body: options });
|
|
925
|
+
}
|
|
926
|
+
|
|
869
927
|
// src/conversation.ts
|
|
870
928
|
var Conversation = class _Conversation {
|
|
871
929
|
constructor(client2, options, callbacks = {}) {
|
|
@@ -1650,6 +1708,71 @@ var PrioriChat = class {
|
|
|
1650
1708
|
async deactivateChatter(options) {
|
|
1651
1709
|
return deactivateChatterImpl.call(this, options);
|
|
1652
1710
|
}
|
|
1711
|
+
/**
|
|
1712
|
+
* Lists all platforms accessible to the current client
|
|
1713
|
+
* @example
|
|
1714
|
+
* ```ts
|
|
1715
|
+
* const client = new PrioriChat("your-api-key");
|
|
1716
|
+
*
|
|
1717
|
+
* const result = await client.listPlatforms();
|
|
1718
|
+
* console.log(`Found ${result.platforms.length} platforms`);
|
|
1719
|
+
* ```
|
|
1720
|
+
*/
|
|
1721
|
+
async listPlatforms() {
|
|
1722
|
+
return listPlatformsImpl.call(this);
|
|
1723
|
+
}
|
|
1724
|
+
/**
|
|
1725
|
+
* Retrieves a specific platform by ID
|
|
1726
|
+
* @example
|
|
1727
|
+
* ```ts
|
|
1728
|
+
* const client = new PrioriChat("your-api-key");
|
|
1729
|
+
*
|
|
1730
|
+
* const result = await client.getPlatform({
|
|
1731
|
+
* platform_id: "12345678-1234-1234-1234-123456789012"
|
|
1732
|
+
* });
|
|
1733
|
+
*
|
|
1734
|
+
* console.log(`Platform name: ${result.platform.name}`);
|
|
1735
|
+
* ```
|
|
1736
|
+
*/
|
|
1737
|
+
async getPlatform(options) {
|
|
1738
|
+
return getPlatformImpl.call(this, options);
|
|
1739
|
+
}
|
|
1740
|
+
/**
|
|
1741
|
+
* Updates an existing platform
|
|
1742
|
+
* @example
|
|
1743
|
+
* ```ts
|
|
1744
|
+
* const client = new PrioriChat("your-api-key");
|
|
1745
|
+
*
|
|
1746
|
+
* const result = await client.updatePlatform({
|
|
1747
|
+
* platform_id: "12345678-1234-1234-1234-123456789012",
|
|
1748
|
+
* custom_instruction: "Be warm and helpful"
|
|
1749
|
+
* });
|
|
1750
|
+
*
|
|
1751
|
+
* console.log(`Updated platform successfully`);
|
|
1752
|
+
* ```
|
|
1753
|
+
*/
|
|
1754
|
+
async updatePlatform(options) {
|
|
1755
|
+
return updatePlatformImpl.call(this, options);
|
|
1756
|
+
}
|
|
1757
|
+
/**
|
|
1758
|
+
* Creates a conversion record for tracking revenue or events
|
|
1759
|
+
* @example
|
|
1760
|
+
* ```ts
|
|
1761
|
+
* const client = new PrioriChat("your-api-key");
|
|
1762
|
+
*
|
|
1763
|
+
* await client.createConversion({
|
|
1764
|
+
* user_id: "user-123",
|
|
1765
|
+
* bot_id: "12345678-1234-1234-1234-123456789012",
|
|
1766
|
+
* amount: 4999, // Value in cents
|
|
1767
|
+
* timestamp: Math.floor(Date.now() / 1000)
|
|
1768
|
+
* });
|
|
1769
|
+
*
|
|
1770
|
+
* console.log("Conversion recorded");
|
|
1771
|
+
* ```
|
|
1772
|
+
*/
|
|
1773
|
+
async createConversion(options) {
|
|
1774
|
+
return createConversionImpl.call(this, options);
|
|
1775
|
+
}
|
|
1653
1776
|
};
|
|
1654
1777
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1655
1778
|
0 && (module.exports = {
|
package/dist/index.mjs
CHANGED
|
@@ -665,6 +665,41 @@ var sendMessage = (options) => {
|
|
|
665
665
|
}
|
|
666
666
|
});
|
|
667
667
|
};
|
|
668
|
+
var createConversion = (options) => {
|
|
669
|
+
return (options.client ?? client).post({
|
|
670
|
+
url: "/api/conversion",
|
|
671
|
+
...options,
|
|
672
|
+
headers: {
|
|
673
|
+
"Content-Type": "application/json",
|
|
674
|
+
...options.headers
|
|
675
|
+
}
|
|
676
|
+
});
|
|
677
|
+
};
|
|
678
|
+
var listPlatforms = (options) => {
|
|
679
|
+
return (options?.client ?? client).get({
|
|
680
|
+
responseType: "json",
|
|
681
|
+
url: "/api/platforms",
|
|
682
|
+
...options
|
|
683
|
+
});
|
|
684
|
+
};
|
|
685
|
+
var getPlatform = (options) => {
|
|
686
|
+
return (options.client ?? client).get({
|
|
687
|
+
responseType: "json",
|
|
688
|
+
url: "/api/platforms/{platform_id}",
|
|
689
|
+
...options
|
|
690
|
+
});
|
|
691
|
+
};
|
|
692
|
+
var updatePlatform = (options) => {
|
|
693
|
+
return (options.client ?? client).patch({
|
|
694
|
+
responseType: "json",
|
|
695
|
+
url: "/api/platforms/{platform_id}",
|
|
696
|
+
...options,
|
|
697
|
+
headers: {
|
|
698
|
+
"Content-Type": "application/json",
|
|
699
|
+
...options.headers
|
|
700
|
+
}
|
|
701
|
+
});
|
|
702
|
+
};
|
|
668
703
|
var getUser = (options) => {
|
|
669
704
|
return (options.client ?? client).get({
|
|
670
705
|
responseType: "json",
|
|
@@ -830,6 +865,29 @@ async function deactivateChatterImpl(options) {
|
|
|
830
865
|
});
|
|
831
866
|
}
|
|
832
867
|
|
|
868
|
+
// src/methods/platforms.ts
|
|
869
|
+
async function listPlatformsImpl() {
|
|
870
|
+
const result = await listPlatforms({});
|
|
871
|
+
return result.data;
|
|
872
|
+
}
|
|
873
|
+
async function getPlatformImpl(options) {
|
|
874
|
+
const result = await getPlatform({ path: options });
|
|
875
|
+
return result.data;
|
|
876
|
+
}
|
|
877
|
+
async function updatePlatformImpl(options) {
|
|
878
|
+
const { platform_id, ...body } = options;
|
|
879
|
+
const result = await updatePlatform({
|
|
880
|
+
path: { platform_id },
|
|
881
|
+
body
|
|
882
|
+
});
|
|
883
|
+
return result.data;
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
// src/methods/conversions.ts
|
|
887
|
+
async function createConversionImpl(options) {
|
|
888
|
+
await createConversion({ body: options });
|
|
889
|
+
}
|
|
890
|
+
|
|
833
891
|
// src/conversation.ts
|
|
834
892
|
var Conversation = class _Conversation {
|
|
835
893
|
constructor(client2, options, callbacks = {}) {
|
|
@@ -1614,6 +1672,71 @@ var PrioriChat = class {
|
|
|
1614
1672
|
async deactivateChatter(options) {
|
|
1615
1673
|
return deactivateChatterImpl.call(this, options);
|
|
1616
1674
|
}
|
|
1675
|
+
/**
|
|
1676
|
+
* Lists all platforms accessible to the current client
|
|
1677
|
+
* @example
|
|
1678
|
+
* ```ts
|
|
1679
|
+
* const client = new PrioriChat("your-api-key");
|
|
1680
|
+
*
|
|
1681
|
+
* const result = await client.listPlatforms();
|
|
1682
|
+
* console.log(`Found ${result.platforms.length} platforms`);
|
|
1683
|
+
* ```
|
|
1684
|
+
*/
|
|
1685
|
+
async listPlatforms() {
|
|
1686
|
+
return listPlatformsImpl.call(this);
|
|
1687
|
+
}
|
|
1688
|
+
/**
|
|
1689
|
+
* Retrieves a specific platform by ID
|
|
1690
|
+
* @example
|
|
1691
|
+
* ```ts
|
|
1692
|
+
* const client = new PrioriChat("your-api-key");
|
|
1693
|
+
*
|
|
1694
|
+
* const result = await client.getPlatform({
|
|
1695
|
+
* platform_id: "12345678-1234-1234-1234-123456789012"
|
|
1696
|
+
* });
|
|
1697
|
+
*
|
|
1698
|
+
* console.log(`Platform name: ${result.platform.name}`);
|
|
1699
|
+
* ```
|
|
1700
|
+
*/
|
|
1701
|
+
async getPlatform(options) {
|
|
1702
|
+
return getPlatformImpl.call(this, options);
|
|
1703
|
+
}
|
|
1704
|
+
/**
|
|
1705
|
+
* Updates an existing platform
|
|
1706
|
+
* @example
|
|
1707
|
+
* ```ts
|
|
1708
|
+
* const client = new PrioriChat("your-api-key");
|
|
1709
|
+
*
|
|
1710
|
+
* const result = await client.updatePlatform({
|
|
1711
|
+
* platform_id: "12345678-1234-1234-1234-123456789012",
|
|
1712
|
+
* custom_instruction: "Be warm and helpful"
|
|
1713
|
+
* });
|
|
1714
|
+
*
|
|
1715
|
+
* console.log(`Updated platform successfully`);
|
|
1716
|
+
* ```
|
|
1717
|
+
*/
|
|
1718
|
+
async updatePlatform(options) {
|
|
1719
|
+
return updatePlatformImpl.call(this, options);
|
|
1720
|
+
}
|
|
1721
|
+
/**
|
|
1722
|
+
* Creates a conversion record for tracking revenue or events
|
|
1723
|
+
* @example
|
|
1724
|
+
* ```ts
|
|
1725
|
+
* const client = new PrioriChat("your-api-key");
|
|
1726
|
+
*
|
|
1727
|
+
* await client.createConversion({
|
|
1728
|
+
* user_id: "user-123",
|
|
1729
|
+
* bot_id: "12345678-1234-1234-1234-123456789012",
|
|
1730
|
+
* amount: 4999, // Value in cents
|
|
1731
|
+
* timestamp: Math.floor(Date.now() / 1000)
|
|
1732
|
+
* });
|
|
1733
|
+
*
|
|
1734
|
+
* console.log("Conversion recorded");
|
|
1735
|
+
* ```
|
|
1736
|
+
*/
|
|
1737
|
+
async createConversion(options) {
|
|
1738
|
+
return createConversionImpl.call(this, options);
|
|
1739
|
+
}
|
|
1617
1740
|
};
|
|
1618
1741
|
export {
|
|
1619
1742
|
ApiError,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "priori-chat-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.27",
|
|
4
4
|
"description": "TypeScript SDK for Priori Chat API",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -8,9 +8,19 @@
|
|
|
8
8
|
"files": [
|
|
9
9
|
"dist"
|
|
10
10
|
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"codegen": "openapi-ts",
|
|
13
|
+
"codegen:watch": "openapi-ts --watch",
|
|
14
|
+
"build": "tsup src/index.ts --format esm,cjs --dts",
|
|
15
|
+
"test": "vitest run",
|
|
16
|
+
"lint": "eslint . --ext .ts",
|
|
17
|
+
"prepack": "pnpm codegen && pnpm build",
|
|
18
|
+
"docs": "typedoc --skipErrorChecking"
|
|
19
|
+
},
|
|
11
20
|
"keywords": [],
|
|
12
21
|
"author": "",
|
|
13
22
|
"license": "ISC",
|
|
23
|
+
"packageManager": "pnpm@10.7.0",
|
|
14
24
|
"devDependencies": {
|
|
15
25
|
"@hey-api/openapi-ts": "^0.77.0",
|
|
16
26
|
"@microsoft/api-extractor": "^7.52.8",
|
|
@@ -22,13 +32,5 @@
|
|
|
22
32
|
"@hey-api/client-fetch": "^0.13.1",
|
|
23
33
|
"axios": "^1.10.0",
|
|
24
34
|
"zod": "^3.25.68"
|
|
25
|
-
},
|
|
26
|
-
"scripts": {
|
|
27
|
-
"codegen": "openapi-ts",
|
|
28
|
-
"codegen:watch": "openapi-ts --watch",
|
|
29
|
-
"build": "tsup src/index.ts --format esm,cjs --dts",
|
|
30
|
-
"test": "vitest run",
|
|
31
|
-
"lint": "eslint . --ext .ts",
|
|
32
|
-
"docs": "typedoc --skipErrorChecking"
|
|
33
35
|
}
|
|
34
|
-
}
|
|
36
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -68,4 +68,10 @@ export type {
|
|
|
68
68
|
GetChatterData,
|
|
69
69
|
ListChattersResponse,
|
|
70
70
|
DeactivateChatterData,
|
|
71
|
+
Platform,
|
|
72
|
+
ListPlatformsResponse,
|
|
73
|
+
GetPlatformResponse,
|
|
74
|
+
UpdatePlatformRequestBody,
|
|
75
|
+
UpdatePlatformResponse,
|
|
76
|
+
CreateConversionRequestBody,
|
|
71
77
|
} from "./client/types.gen";
|