@flashbacktech/flashbackclient 0.2.15 → 0.2.16

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.
@@ -18,6 +18,7 @@ import { UserUpdateRequest, UserUpdateResponse } from './types/platform/user';
18
18
  import { CreateRepoAiApiKeyRequest, CreateRepoAiApiKeyResponse, DeleteRepoAiApiKeyResponse, GetRepoAiApiKeysResponse, UpdateRepoAiApiKeyRequest, UpdateRepoAiApiKeyResponse } from './types/ai/aiapikey';
19
19
  import { AiLlmStatsResponse, CreateAiLlmRequest, CreateAiLlmResponse, DeleteAiLlmResponse, GetAiLlmsResponse, UpdateAiLlmRequest, UpdateAiLlmResponse, ValidateAiLlmResponse } from './types/ai/aillm';
20
20
  import { CreatePolicyRequest, GetPoliciesQuery, GetPolicyViolationsQuery, GetPolicyViolationsResponse, PolicyDTO, UpdatePolicyRequest } from './types/ai/policy';
21
+ import { CreateConversationRequest, CreateConversationResponse, SendPromptRequest, SendPromptResponse, GetConversationsRequest, GetConversationsResponse, GetConversationMessagesResponse } from './types/ai/conversation';
21
22
  interface ErrorResponse {
22
23
  message?: string;
23
24
  [key: string]: any;
@@ -230,6 +231,10 @@ export declare class ApiClient implements IApiClient {
230
231
  getRepoAiApiKeys: (repoId: string) => Promise<GetRepoAiApiKeysResponse>;
231
232
  updateRepoAiApiKey: (repoId: string, apikeyId: string, data: UpdateRepoAiApiKeyRequest) => Promise<UpdateRepoAiApiKeyResponse>;
232
233
  deleteRepoAiApiKey: (repoId: string, apikeyId: string) => Promise<DeleteRepoAiApiKeyResponse>;
234
+ createConversation: (data: CreateConversationRequest) => Promise<CreateConversationResponse>;
235
+ sendPrompt: (conversationId: string, data: SendPromptRequest) => Promise<SendPromptResponse>;
236
+ getConversations: (query: GetConversationsRequest) => Promise<GetConversationsResponse>;
237
+ getConversationMessages: (conversationId: string) => Promise<GetConversationMessagesResponse>;
233
238
  createPolicy: (data: CreatePolicyRequest) => Promise<{
234
239
  success: boolean;
235
240
  policy: PolicyDTO;
@@ -539,6 +539,41 @@ class ApiClient {
539
539
  this.deleteRepoAiApiKey = async (repoId, apikeyId) => {
540
540
  return this.makeRequest(`repo/${repoId}/ai/apikey/${apikeyId}`, 'DELETE', null);
541
541
  };
542
+ ////// Conversation API calls
543
+ this.createConversation = async (data) => {
544
+ return this.makeRequest('conversation', 'POST', data);
545
+ };
546
+ this.sendPrompt = async (conversationId, data) => {
547
+ return this.makeRequest(`conversation/${conversationId}/prompt`, 'POST', data);
548
+ };
549
+ this.getConversations = async (query) => {
550
+ const queryParams = new URLSearchParams();
551
+ if (query.take !== undefined) {
552
+ queryParams.append('take', query.take.toString());
553
+ }
554
+ if (query.skip !== undefined) {
555
+ queryParams.append('skip', query.skip.toString());
556
+ }
557
+ if (query.from) {
558
+ queryParams.append('from', query.from);
559
+ }
560
+ if (query.to) {
561
+ queryParams.append('to', query.to);
562
+ }
563
+ if (query.userId) {
564
+ queryParams.append('userId', query.userId);
565
+ }
566
+ if (query.workspaceId) {
567
+ queryParams.append('workspaceId', query.workspaceId);
568
+ }
569
+ if (query.repoId) {
570
+ queryParams.append('repoId', query.repoId);
571
+ }
572
+ return this.makeRequest(`conversation?${queryParams.toString()}`, 'GET', null);
573
+ };
574
+ this.getConversationMessages = async (conversationId) => {
575
+ return this.makeRequest(`conversation/${conversationId}/messages`, 'GET', null);
576
+ };
542
577
  ////// Policy API calls
543
578
  this.createPolicy = async (data) => {
544
579
  return this.makeRequest('policy', 'POST', data);
@@ -0,0 +1,62 @@
1
+ export interface CreateConversationRequest {
2
+ repoId: string;
3
+ }
4
+ export interface CreateConversationResponse {
5
+ success: boolean;
6
+ conversationId?: string;
7
+ message?: string;
8
+ }
9
+ export interface SendPromptRequest {
10
+ prompt: string;
11
+ }
12
+ export interface SendPromptResponse {
13
+ success: boolean;
14
+ message?: string;
15
+ }
16
+ export interface GetConversationsRequest {
17
+ take?: number;
18
+ skip?: number;
19
+ from?: string;
20
+ to?: string;
21
+ userId?: string;
22
+ workspaceId?: string;
23
+ repoId?: string;
24
+ }
25
+ export interface ConversationDTO {
26
+ id: string;
27
+ orgId: string;
28
+ createdBy: string;
29
+ createdAt: string;
30
+ lastUpdatedAt: string;
31
+ workspaceId: string;
32
+ repoId: string;
33
+ tokensIn: string;
34
+ tokensOut: string;
35
+ creator?: {
36
+ id: string;
37
+ name: string;
38
+ lastName: string;
39
+ email: string;
40
+ };
41
+ }
42
+ export interface GetConversationsResponse {
43
+ success: boolean;
44
+ conversations: ConversationDTO[];
45
+ total: number;
46
+ message?: string;
47
+ }
48
+ export interface MessageDTO {
49
+ id: string;
50
+ conversationId: string;
51
+ role: string;
52
+ content: string;
53
+ tokenCount?: number;
54
+ model?: string;
55
+ metadata?: Record<string, unknown>;
56
+ createdAt: string;
57
+ }
58
+ export interface GetConversationMessagesResponse {
59
+ success: boolean;
60
+ messages: MessageDTO[];
61
+ message?: string;
62
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flashbacktech/flashbackclient",
3
- "version": "0.2.15",
3
+ "version": "0.2.16",
4
4
  "type": "commonjs",
5
5
  "publishConfig": {
6
6
  "access": "public"