@flashbacktech/flashbackclient 0.2.53 → 0.2.55
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/api/client.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ import { AiLlmStatsResponse, CreateAiLlmRequest, CreateAiLlmResponse, DeleteAiLl
|
|
|
21
21
|
import { CreatePolicyRequest, GetPoliciesQuery, GetPolicyViolationsQuery, GetPolicyViolationsResponse, GetPolicyAlertsQuery, GetPolicyAlertsResponse, PolicyDTO, UpdatePolicyRequest, PolicyValidationRequest, PolicyValidationResponse, PolicyRecommendationRequest, PolicyRecommendationResponse } from './types/ai/policy';
|
|
22
22
|
import { CreateConversationRequest, CreateConversationResponse, SendPromptRequest, SendPromptResponse, GetConversationsRequest, GetConversationsResponse, GetConversationMessagesResponse, GetConversationMessagesRequest, DeleteConversationRequest, DeleteConversationResponse } from './types/ai/conversation';
|
|
23
23
|
import { GetLinksRequest, GetLinksResponse, CreateLinkRequest, CreateLinkResponse, UpdateLinkRequest, UpdateLinkResponse, DeleteLinkResponse, GetLinkByTokenResponse } from './types/platform/links';
|
|
24
|
-
import { GetCreditsBalanceResponse, GetCreditsTransactionsRequest, GetCreditsTransactionsResponse, GetCreditsConsumptionRequest, GetCreditsConsumptionResponse, BuyCreditsPackRequest, BuyCreditsPackResponse, GetCreditsPacksResponse, GetCreditsRatesResponse } from './types/platform/credits';
|
|
24
|
+
import { GetCreditsBalanceResponse, GetCreditsTransactionsRequest, GetCreditsTransactionsResponse, GetCreditsConsumptionRequest, GetCreditsConsumptionResponse, BuyCreditsPackRequest, BuyCreditsPackResponse, GetCreditsPacksResponse, GetCreditsRatesResponse, GetCreditsMonthlyStatsRequest, GetCreditsMonthlyStatsResponse } from './types/platform/credits';
|
|
25
25
|
interface ErrorResponse {
|
|
26
26
|
message?: string;
|
|
27
27
|
[key: string]: any;
|
|
@@ -282,5 +282,7 @@ export declare class ApiClient implements IApiClient {
|
|
|
282
282
|
buyCreditsPack: (body: BuyCreditsPackRequest) => Promise<BuyCreditsPackResponse>;
|
|
283
283
|
getCreditsPacks: () => Promise<GetCreditsPacksResponse>;
|
|
284
284
|
getCreditsRates: () => Promise<GetCreditsRatesResponse>;
|
|
285
|
+
/** Get aggregated monthly credit stats for histogram (consumption, purchases, grants, balance) */
|
|
286
|
+
getCreditsMonthlyStats: (query?: GetCreditsMonthlyStatsRequest) => Promise<GetCreditsMonthlyStatsResponse>;
|
|
285
287
|
}
|
|
286
288
|
export {};
|
package/dist/api/client.js
CHANGED
|
@@ -846,6 +846,10 @@ class ApiClient {
|
|
|
846
846
|
this.getCreditsRates = async () => {
|
|
847
847
|
return this.makeRequest('credits/rates', 'GET', null);
|
|
848
848
|
};
|
|
849
|
+
/** Get aggregated monthly credit stats for histogram (consumption, purchases, grants, balance) */
|
|
850
|
+
this.getCreditsMonthlyStats = async (query) => {
|
|
851
|
+
return this.makeRequest('credits/stats/monthly', 'GET', query ?? null);
|
|
852
|
+
};
|
|
849
853
|
this.baseURL = baseURL;
|
|
850
854
|
this.headers = {};
|
|
851
855
|
this.debug = false;
|
|
@@ -96,3 +96,31 @@ export interface GetCreditsRatesResponse {
|
|
|
96
96
|
error_code?: string;
|
|
97
97
|
message?: string;
|
|
98
98
|
}
|
|
99
|
+
export interface MonthlyCreditsStatsItem {
|
|
100
|
+
/** ISO date string for first day of month, e.g. "2025-01-01T00:00:00.000Z" */
|
|
101
|
+
month: string;
|
|
102
|
+
/** Credits consumed (as positive number for display, from negative transactions) */
|
|
103
|
+
consumption: number;
|
|
104
|
+
/** Credits from pack purchases */
|
|
105
|
+
purchases: number;
|
|
106
|
+
/** Credits from subscription grants */
|
|
107
|
+
grants: number;
|
|
108
|
+
/** Net change: grants + purchases - consumption */
|
|
109
|
+
balance: number;
|
|
110
|
+
}
|
|
111
|
+
export interface GetCreditsMonthlyStatsRequest {
|
|
112
|
+
/** Number of months to return (default 12, max 24) */
|
|
113
|
+
months?: number;
|
|
114
|
+
}
|
|
115
|
+
export interface GetCreditsMonthlyStatsResponse {
|
|
116
|
+
success: boolean;
|
|
117
|
+
data?: MonthlyCreditsStatsItem[];
|
|
118
|
+
totals?: {
|
|
119
|
+
consumption: number;
|
|
120
|
+
purchases: number;
|
|
121
|
+
grants: number;
|
|
122
|
+
balance: number;
|
|
123
|
+
};
|
|
124
|
+
error_code?: string;
|
|
125
|
+
message?: string;
|
|
126
|
+
}
|