@codeguide/core 0.0.28 → 0.0.33
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/__tests__/services/codespace/codespace-v2.test.ts +53 -0
- package/__tests__/services/usage/usage-service.test.ts +458 -104
- package/codeguide.ts +3 -0
- package/dist/codeguide.d.ts +2 -1
- package/dist/codeguide.js +1 -0
- package/dist/index.d.ts +4 -3
- package/dist/services/base/base-service.d.ts +21 -0
- package/dist/services/base/base-service.js +114 -0
- package/dist/services/codespace/codespace-service.d.ts +64 -1
- package/dist/services/codespace/codespace-service.js +272 -0
- package/dist/services/codespace/codespace-types.d.ts +213 -12
- package/dist/services/codespace/index.d.ts +1 -1
- package/dist/services/index.d.ts +2 -0
- package/dist/services/index.js +4 -1
- package/dist/services/projects/project-types.d.ts +66 -32
- package/dist/services/starter-kits/index.d.ts +2 -0
- package/dist/services/starter-kits/index.js +20 -0
- package/dist/services/starter-kits/starter-kits-service.d.ts +13 -0
- package/dist/services/starter-kits/starter-kits-service.js +27 -0
- package/dist/services/starter-kits/starter-kits-types.d.ts +34 -0
- package/dist/services/starter-kits/starter-kits-types.js +2 -0
- package/dist/services/subscriptions/subscription-service.d.ts +11 -1
- package/dist/services/subscriptions/subscription-service.js +14 -0
- package/dist/services/tasks/task-service.d.ts +2 -1
- package/dist/services/tasks/task-service.js +8 -0
- package/dist/services/tasks/task-types.d.ts +26 -7
- package/dist/services/usage/usage-service.d.ts +5 -2
- package/dist/services/usage/usage-service.js +58 -9
- package/dist/services/usage/usage-types.d.ts +157 -34
- package/dist/types.d.ts +18 -2
- package/docs/.vitepress/README.md +51 -0
- package/docs/.vitepress/config.ts +139 -0
- package/docs/.vitepress/theme/custom.css +80 -0
- package/docs/.vitepress/theme/index.ts +13 -0
- package/docs/.vitepress/tsconfig.json +19 -0
- package/docs/QUICKSTART.md +77 -0
- package/docs/README.md +134 -0
- package/docs/README_SETUP.md +46 -0
- package/docs/authentication.md +351 -0
- package/docs/codeguide-client.md +350 -0
- package/docs/codespace-models.md +1004 -0
- package/docs/codespace-service.md +444 -0
- package/docs/index.md +135 -0
- package/docs/package.json +14 -0
- package/docs/projects-service.md +688 -0
- package/docs/security-keys-service.md +773 -0
- package/docs/starter-kits-service.md +249 -0
- package/docs/task-service.md +955 -0
- package/docs/testsprite_tests/TC001_Homepage_Load_and_Hero_Section_Display.py +70 -0
- package/docs/testsprite_tests/TC002_Sidebar_Navigation_ExpandCollapse_Functionality.py +73 -0
- package/docs/testsprite_tests/TC003_Full_Text_Local_Search_with_Keyboard_Shortcut.py +90 -0
- package/docs/testsprite_tests/TC004_Dark_Mode_Toggle_and_Persistence.py +73 -0
- package/docs/testsprite_tests/TC005_Mobile_Responsiveness_and_Touch_Navigation.py +113 -0
- package/docs/testsprite_tests/TC006_GitHub_Integration_Edit_this_page_Links.py +73 -0
- package/docs/testsprite_tests/TC007_Syntax_Highlighting_and_Code_Copy_Functionality.py +73 -0
- package/docs/testsprite_tests/TC008_Auto_Generated_Table_of_Contents_Accuracy.py +73 -0
- package/docs/testsprite_tests/TC009_SEO_and_Content_Discoverability_Verification.py +73 -0
- package/docs/testsprite_tests/TC010_Accessibility_Compliance_WCAG_AA.py +73 -0
- package/docs/testsprite_tests/TC011_Local_Development_Workflow_Build_and_Hot_Reload.py +74 -0
- package/docs/testsprite_tests/TC012_Performance_Metrics_Compliance.py +73 -0
- package/docs/testsprite_tests/standard_prd.json +122 -0
- package/docs/testsprite_tests/testsprite-mcp-test-report.html +2508 -0
- package/docs/testsprite_tests/testsprite-mcp-test-report.md +273 -0
- package/docs/testsprite_tests/testsprite_frontend_test_plan.json +390 -0
- package/docs/usage-service.md +291 -1
- package/index.ts +11 -3
- package/package.json +17 -2
- package/plans/CODESPACE_LOGS_STREAMING_GUIDE.md +320 -0
- package/plans/CODESPACE_TASK_LOGS_API_COMPLETE_GUIDE.md +821 -0
- package/services/base/base-service.ts +130 -0
- package/services/codespace/codespace-service.ts +359 -0
- package/services/codespace/codespace-types.ts +295 -13
- package/services/codespace/index.ts +21 -1
- package/services/index.ts +2 -0
- package/services/projects/README.md +107 -34
- package/services/projects/project-types.ts +69 -32
- package/services/starter-kits/index.ts +2 -0
- package/services/starter-kits/starter-kits-service.ts +33 -0
- package/services/starter-kits/starter-kits-types.ts +38 -0
- package/services/subscriptions/subscription-service.ts +23 -5
- package/services/tasks/task-service.ts +10 -0
- package/services/tasks/task-types.ts +29 -7
- package/services/usage/usage-service.ts +59 -10
- package/services/usage/usage-types.ts +186 -36
- package/types.ts +22 -2
|
@@ -21,19 +21,38 @@ export interface RawTask {
|
|
|
21
21
|
priority?: string;
|
|
22
22
|
status?: string;
|
|
23
23
|
}
|
|
24
|
-
export interface
|
|
24
|
+
export interface ProjectTaskSubtask {
|
|
25
25
|
id: string;
|
|
26
26
|
title: string;
|
|
27
|
-
description
|
|
27
|
+
description: string;
|
|
28
|
+
details: string;
|
|
28
29
|
status: string;
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
test_strategy: string;
|
|
31
|
+
priority: string;
|
|
32
|
+
ordinal: number;
|
|
31
33
|
task_group_id: string;
|
|
32
|
-
parent_task_id
|
|
34
|
+
parent_task_id: string;
|
|
35
|
+
ai_result: string;
|
|
36
|
+
created_at: string;
|
|
37
|
+
user_id: string;
|
|
38
|
+
}
|
|
39
|
+
export interface ProjectTask {
|
|
40
|
+
id: string;
|
|
41
|
+
title: string;
|
|
42
|
+
description: string;
|
|
43
|
+
details: string;
|
|
44
|
+
status: string;
|
|
45
|
+
test_strategy: string;
|
|
46
|
+
priority: string;
|
|
33
47
|
ordinal: number;
|
|
48
|
+
task_group_id: string;
|
|
49
|
+
parent_task_id: string;
|
|
50
|
+
ai_result: string;
|
|
34
51
|
created_at: string;
|
|
35
|
-
|
|
36
|
-
subtasks?:
|
|
52
|
+
user_id: string;
|
|
53
|
+
subtasks?: ProjectTaskSubtask[];
|
|
54
|
+
updated_at?: string;
|
|
55
|
+
subtasks_legacy?: ProjectTask[];
|
|
37
56
|
}
|
|
38
57
|
export interface CreateTaskGroupRequest {
|
|
39
58
|
name: string;
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { BaseService } from '../base/base-service';
|
|
2
|
-
import { TrackUsageRequest, TrackUsageResponse, CreditBalanceResponse, CreditCheckRequest, CreditCheckResponse, UsageSummaryRequest, UsageSummaryResponse, AuthorizationResponse, FreeUserStatusResponse, CalculateUsageRequest, CalculateUsageResponse, TrackCodespaceUsageRequest, TrackCodespaceUsageResponse, CodespaceTaskUsageResponse } from './usage-types';
|
|
2
|
+
import { TrackUsageRequest, TrackUsageResponse, CreditBalanceResponse, CreditCheckRequest, CreditCheckResponse, UsageSummaryRequest, UsageSummaryResponse, AuthorizationResponse, FreeUserStatusResponse, CalculateUsageRequest, CalculateUsageResponse, TrackCodespaceUsageRequest, TrackCodespaceUsageResponse, CodespaceTaskUsageResponse, DashboardAnalyticsRequest, DashboardAnalyticsResponse, UsageDetailsRequest, UsageDetailsResponse, ServiceBreakdownRequest, ServiceBreakdownResponse } from './usage-types';
|
|
3
3
|
export declare class UsageService extends BaseService {
|
|
4
4
|
trackUsage(request: TrackUsageRequest): Promise<TrackUsageResponse>;
|
|
5
5
|
getCreditBalance(): Promise<CreditBalanceResponse>;
|
|
6
6
|
checkCredits(params: CreditCheckRequest): Promise<CreditCheckResponse>;
|
|
7
|
-
getUsageSummary(params?: UsageSummaryRequest): Promise<UsageSummaryResponse>;
|
|
8
7
|
getAuthorization(): Promise<AuthorizationResponse>;
|
|
9
8
|
getFreeUserStatus(): Promise<FreeUserStatusResponse>;
|
|
10
9
|
calculateUsageCost(params: CalculateUsageRequest): Promise<CalculateUsageResponse>;
|
|
11
10
|
trackCodespaceUsage(request: TrackCodespaceUsageRequest): Promise<TrackCodespaceUsageResponse>;
|
|
12
11
|
getCodespaceTaskUsage(codespaceTaskId: string): Promise<CodespaceTaskUsageResponse>;
|
|
13
12
|
healthCheck(): Promise<boolean>;
|
|
13
|
+
getDashboardAnalytics(params?: DashboardAnalyticsRequest): Promise<DashboardAnalyticsResponse>;
|
|
14
|
+
getUsageDetails(params?: UsageDetailsRequest): Promise<UsageDetailsResponse>;
|
|
15
|
+
getUsageSummary(params?: UsageSummaryRequest): Promise<UsageSummaryResponse>;
|
|
16
|
+
getServiceBreakdown(params?: ServiceBreakdownRequest): Promise<ServiceBreakdownResponse>;
|
|
14
17
|
}
|
|
@@ -11,6 +11,7 @@ class UsageService extends base_service_1.BaseService {
|
|
|
11
11
|
}
|
|
12
12
|
async checkCredits(params) {
|
|
13
13
|
const queryParams = new URLSearchParams();
|
|
14
|
+
queryParams.append('model_key', params.model_key);
|
|
14
15
|
if (params.input_tokens !== undefined)
|
|
15
16
|
queryParams.append('input_tokens', params.input_tokens.toString());
|
|
16
17
|
if (params.output_tokens !== undefined)
|
|
@@ -20,15 +21,6 @@ class UsageService extends base_service_1.BaseService {
|
|
|
20
21
|
const url = `/usage/credit-check?${queryParams.toString()}`;
|
|
21
22
|
return this.get(url);
|
|
22
23
|
}
|
|
23
|
-
async getUsageSummary(params) {
|
|
24
|
-
const queryParams = new URLSearchParams();
|
|
25
|
-
if (params?.start_date)
|
|
26
|
-
queryParams.append('start_date', params.start_date);
|
|
27
|
-
if (params?.end_date)
|
|
28
|
-
queryParams.append('end_date', params.end_date);
|
|
29
|
-
const url = `/usage/summary${queryParams.toString() ? `?${queryParams.toString()}` : ''}`;
|
|
30
|
-
return this.get(url);
|
|
31
|
-
}
|
|
32
24
|
async getAuthorization() {
|
|
33
25
|
return this.get('/usage/authorization');
|
|
34
26
|
}
|
|
@@ -64,5 +56,62 @@ class UsageService extends base_service_1.BaseService {
|
|
|
64
56
|
return false;
|
|
65
57
|
}
|
|
66
58
|
}
|
|
59
|
+
// Dashboard Analytics Methods
|
|
60
|
+
async getDashboardAnalytics(params) {
|
|
61
|
+
const queryParams = new URLSearchParams();
|
|
62
|
+
if (params?.period)
|
|
63
|
+
queryParams.append('period', params.period);
|
|
64
|
+
if (params?.start_date)
|
|
65
|
+
queryParams.append('start_date', params.start_date);
|
|
66
|
+
if (params?.end_date)
|
|
67
|
+
queryParams.append('end_date', params.end_date);
|
|
68
|
+
if (params?.service_type)
|
|
69
|
+
queryParams.append('service_type', params.service_type);
|
|
70
|
+
const url = `/usage/dashboard/analytics${queryParams.toString() ? `?${queryParams.toString()}` : ''}`;
|
|
71
|
+
return this.get(url);
|
|
72
|
+
}
|
|
73
|
+
async getUsageDetails(params) {
|
|
74
|
+
const queryParams = new URLSearchParams();
|
|
75
|
+
if (params?.period)
|
|
76
|
+
queryParams.append('period', params.period);
|
|
77
|
+
if (params?.start_date)
|
|
78
|
+
queryParams.append('start_date', params.start_date);
|
|
79
|
+
if (params?.end_date)
|
|
80
|
+
queryParams.append('end_date', params.end_date);
|
|
81
|
+
if (params?.service_type)
|
|
82
|
+
queryParams.append('service_type', params.service_type);
|
|
83
|
+
if (params?.page !== undefined)
|
|
84
|
+
queryParams.append('page', params.page.toString());
|
|
85
|
+
if (params?.page_size !== undefined)
|
|
86
|
+
queryParams.append('page_size', params.page_size.toString());
|
|
87
|
+
if (params?.sort_by)
|
|
88
|
+
queryParams.append('sort_by', params.sort_by);
|
|
89
|
+
if (params?.sort_order)
|
|
90
|
+
queryParams.append('sort_order', params.sort_order);
|
|
91
|
+
const url = `/usage/dashboard/details${queryParams.toString() ? `?${queryParams.toString()}` : ''}`;
|
|
92
|
+
return this.get(url);
|
|
93
|
+
}
|
|
94
|
+
async getUsageSummary(params) {
|
|
95
|
+
const queryParams = new URLSearchParams();
|
|
96
|
+
if (params?.period)
|
|
97
|
+
queryParams.append('period', params.period);
|
|
98
|
+
if (params?.start_date)
|
|
99
|
+
queryParams.append('start_date', params.start_date);
|
|
100
|
+
if (params?.end_date)
|
|
101
|
+
queryParams.append('end_date', params.end_date);
|
|
102
|
+
const url = `/usage/dashboard/summary${queryParams.toString() ? `?${queryParams.toString()}` : ''}`;
|
|
103
|
+
return this.get(url);
|
|
104
|
+
}
|
|
105
|
+
async getServiceBreakdown(params) {
|
|
106
|
+
const queryParams = new URLSearchParams();
|
|
107
|
+
if (params?.period)
|
|
108
|
+
queryParams.append('period', params.period);
|
|
109
|
+
if (params?.start_date)
|
|
110
|
+
queryParams.append('start_date', params.start_date);
|
|
111
|
+
if (params?.end_date)
|
|
112
|
+
queryParams.append('end_date', params.end_date);
|
|
113
|
+
const url = `/usage/dashboard/services${queryParams.toString() ? `?${queryParams.toString()}` : ''}`;
|
|
114
|
+
return this.get(url);
|
|
115
|
+
}
|
|
67
116
|
}
|
|
68
117
|
exports.UsageService = UsageService;
|
|
@@ -11,7 +11,7 @@ export interface TrackUsageResponse {
|
|
|
11
11
|
remaining_credits: number;
|
|
12
12
|
message: string;
|
|
13
13
|
}
|
|
14
|
-
export interface
|
|
14
|
+
export interface CreditBalanceData {
|
|
15
15
|
user_id: string;
|
|
16
16
|
total_consumed: number;
|
|
17
17
|
total_allotted: number;
|
|
@@ -24,6 +24,9 @@ export interface CreditBalanceResponse {
|
|
|
24
24
|
status: string;
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
+
export interface CreditBalanceResponse {
|
|
28
|
+
data: CreditBalanceData;
|
|
29
|
+
}
|
|
27
30
|
export interface CreditCheckRequest {
|
|
28
31
|
model_key: string;
|
|
29
32
|
input_tokens?: number;
|
|
@@ -36,31 +39,6 @@ export interface CreditCheckResponse {
|
|
|
36
39
|
remaining_credits: number;
|
|
37
40
|
model_key: string;
|
|
38
41
|
}
|
|
39
|
-
export interface UsageSummaryRequest {
|
|
40
|
-
start_date?: string;
|
|
41
|
-
end_date?: string;
|
|
42
|
-
}
|
|
43
|
-
export interface UsageSummaryResponse {
|
|
44
|
-
user_id: string;
|
|
45
|
-
period: {
|
|
46
|
-
start_date: string;
|
|
47
|
-
end_date: string;
|
|
48
|
-
};
|
|
49
|
-
usage_summary: {
|
|
50
|
-
total_credits_used: number;
|
|
51
|
-
total_calls: number;
|
|
52
|
-
model_breakdown: Record<string, any>;
|
|
53
|
-
daily_usage: Array<{
|
|
54
|
-
date: string;
|
|
55
|
-
credits_used: number;
|
|
56
|
-
calls: number;
|
|
57
|
-
}>;
|
|
58
|
-
};
|
|
59
|
-
subscription: {
|
|
60
|
-
plan: string;
|
|
61
|
-
status: string;
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
42
|
export interface CreditBalance {
|
|
65
43
|
total_allotted: number;
|
|
66
44
|
total_consumed: number;
|
|
@@ -165,18 +143,163 @@ export interface TrackCodespaceUsageResponse {
|
|
|
165
143
|
cost_amount: number;
|
|
166
144
|
created_at: string;
|
|
167
145
|
}
|
|
146
|
+
export interface CodespaceTaskUsageData {
|
|
147
|
+
total_records: number;
|
|
148
|
+
total_credits_consumed: number;
|
|
149
|
+
latest_usage: string;
|
|
150
|
+
}
|
|
168
151
|
export interface CodespaceTaskUsageResponse {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
total_input_tokens: number;
|
|
172
|
-
total_output_tokens: number;
|
|
173
|
-
total_call_seconds: number;
|
|
174
|
-
total_cost: number;
|
|
175
|
-
};
|
|
176
|
-
usage_records: TrackCodespaceUsageResponse[];
|
|
152
|
+
status: string;
|
|
153
|
+
data: CodespaceTaskUsageData;
|
|
177
154
|
}
|
|
178
155
|
export interface HealthResponse {
|
|
179
156
|
status: string;
|
|
180
157
|
timestamp: string;
|
|
181
158
|
version: string;
|
|
182
159
|
}
|
|
160
|
+
export type PeriodType = '7d' | '1w' | '1m' | '3m';
|
|
161
|
+
export type ServiceType = 'docs' | 'chat' | 'codespace_task' | 'api';
|
|
162
|
+
export type SortOrder = 'asc' | 'desc';
|
|
163
|
+
export type SortByField = 'created_at' | 'credits_consumed' | 'cost_amount';
|
|
164
|
+
export interface DashboardAnalyticsRequest {
|
|
165
|
+
period?: PeriodType;
|
|
166
|
+
start_date?: string;
|
|
167
|
+
end_date?: string;
|
|
168
|
+
service_type?: ServiceType;
|
|
169
|
+
}
|
|
170
|
+
export interface DailyUsage {
|
|
171
|
+
date: string;
|
|
172
|
+
credits_consumed: number;
|
|
173
|
+
cost_usd: number;
|
|
174
|
+
requests_count: number;
|
|
175
|
+
average_credits_per_request: number;
|
|
176
|
+
}
|
|
177
|
+
export interface ServiceUsage {
|
|
178
|
+
service_type: ServiceType;
|
|
179
|
+
credits_consumed: number;
|
|
180
|
+
requests_count: number;
|
|
181
|
+
}
|
|
182
|
+
export interface AnalyticsTotals {
|
|
183
|
+
credits_consumed: number;
|
|
184
|
+
cost_usd: number;
|
|
185
|
+
requests_count: number;
|
|
186
|
+
}
|
|
187
|
+
export interface AnalyticsAverages {
|
|
188
|
+
daily_credits: number;
|
|
189
|
+
daily_requests: number;
|
|
190
|
+
}
|
|
191
|
+
export interface AnalyticsTrends {
|
|
192
|
+
credits_consumed: number;
|
|
193
|
+
requests_count: number;
|
|
194
|
+
}
|
|
195
|
+
export interface PeriodInfo {
|
|
196
|
+
start: string;
|
|
197
|
+
end: string;
|
|
198
|
+
label: string;
|
|
199
|
+
}
|
|
200
|
+
export interface DashboardAnalyticsResponse {
|
|
201
|
+
status: string;
|
|
202
|
+
data: {
|
|
203
|
+
period: PeriodInfo;
|
|
204
|
+
daily_usage: DailyUsage[];
|
|
205
|
+
totals: AnalyticsTotals;
|
|
206
|
+
averages: AnalyticsAverages;
|
|
207
|
+
trends: AnalyticsTrends;
|
|
208
|
+
top_services: ServiceUsage[];
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
export interface UsageDetailsRequest {
|
|
212
|
+
period?: PeriodType;
|
|
213
|
+
start_date?: string;
|
|
214
|
+
end_date?: string;
|
|
215
|
+
service_type?: ServiceType;
|
|
216
|
+
page?: number;
|
|
217
|
+
page_size?: number;
|
|
218
|
+
sort_by?: SortByField;
|
|
219
|
+
sort_order?: SortOrder;
|
|
220
|
+
}
|
|
221
|
+
export interface UsageDetailRecord {
|
|
222
|
+
id: string;
|
|
223
|
+
created_at: string;
|
|
224
|
+
service_type: ServiceType;
|
|
225
|
+
model_name: string;
|
|
226
|
+
usage_type: string;
|
|
227
|
+
units_consumed: number;
|
|
228
|
+
credits_consumed: number;
|
|
229
|
+
cost_amount: number | null;
|
|
230
|
+
}
|
|
231
|
+
export interface UsageDetailsPagination {
|
|
232
|
+
page: number;
|
|
233
|
+
page_size: number;
|
|
234
|
+
total_count: number;
|
|
235
|
+
total_pages: number;
|
|
236
|
+
has_next: boolean;
|
|
237
|
+
has_prev: boolean;
|
|
238
|
+
}
|
|
239
|
+
export interface UsageDetailsFilters {
|
|
240
|
+
period: string | null;
|
|
241
|
+
start_date: string | null;
|
|
242
|
+
end_date: string | null;
|
|
243
|
+
service_type: string | null;
|
|
244
|
+
}
|
|
245
|
+
export interface UsageDetailsResponse {
|
|
246
|
+
status: string;
|
|
247
|
+
data: UsageDetailRecord[];
|
|
248
|
+
pagination: UsageDetailsPagination;
|
|
249
|
+
filters: UsageDetailsFilters;
|
|
250
|
+
}
|
|
251
|
+
export interface UsageSummaryRequest {
|
|
252
|
+
period?: PeriodType;
|
|
253
|
+
start_date?: string;
|
|
254
|
+
end_date?: string;
|
|
255
|
+
}
|
|
256
|
+
export interface CurrentPeriodUsage {
|
|
257
|
+
credits_consumed: number;
|
|
258
|
+
cost_usd: number;
|
|
259
|
+
requests_count: number;
|
|
260
|
+
}
|
|
261
|
+
export interface PreviousPeriodUsage {
|
|
262
|
+
credits_consumed: number;
|
|
263
|
+
cost_usd: number;
|
|
264
|
+
requests_count: number;
|
|
265
|
+
}
|
|
266
|
+
export interface BillingCycleInfo {
|
|
267
|
+
total_allotted: number;
|
|
268
|
+
total_consumed: number;
|
|
269
|
+
remaining_credits: number;
|
|
270
|
+
}
|
|
271
|
+
export interface UsageSummaryResponse {
|
|
272
|
+
status: string;
|
|
273
|
+
data: {
|
|
274
|
+
current_period: CurrentPeriodUsage;
|
|
275
|
+
previous_period: PreviousPeriodUsage;
|
|
276
|
+
billing_cycle: BillingCycleInfo;
|
|
277
|
+
utilization_percentage: number;
|
|
278
|
+
remaining_credits: number;
|
|
279
|
+
daily_average: number;
|
|
280
|
+
projected_monthly: number;
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
export interface ServiceBreakdownRequest {
|
|
284
|
+
period?: PeriodType;
|
|
285
|
+
start_date?: string;
|
|
286
|
+
end_date?: string;
|
|
287
|
+
}
|
|
288
|
+
export interface ServiceBreakdown {
|
|
289
|
+
service_type: ServiceType;
|
|
290
|
+
credits_consumed: number;
|
|
291
|
+
percentage: number;
|
|
292
|
+
cost_usd: number;
|
|
293
|
+
requests_count: number;
|
|
294
|
+
trend: number;
|
|
295
|
+
}
|
|
296
|
+
export interface ServiceBreakdownData {
|
|
297
|
+
period: PeriodInfo;
|
|
298
|
+
services: ServiceBreakdown[];
|
|
299
|
+
total_credits: number;
|
|
300
|
+
total_cost: number;
|
|
301
|
+
}
|
|
302
|
+
export interface ServiceBreakdownResponse {
|
|
303
|
+
status: string;
|
|
304
|
+
data: ServiceBreakdownData;
|
|
305
|
+
}
|
package/dist/types.d.ts
CHANGED
|
@@ -108,8 +108,8 @@ export interface Product {
|
|
|
108
108
|
id: string;
|
|
109
109
|
active: boolean;
|
|
110
110
|
name: string;
|
|
111
|
-
description: string;
|
|
112
|
-
image: string;
|
|
111
|
+
description: string | null;
|
|
112
|
+
image: string | null;
|
|
113
113
|
metadata: Record<string, any>;
|
|
114
114
|
marketing_features: string[];
|
|
115
115
|
live_mode: boolean;
|
|
@@ -140,6 +140,13 @@ export interface UserSubscriptionsResponse {
|
|
|
140
140
|
status: string;
|
|
141
141
|
data: Subscription[];
|
|
142
142
|
}
|
|
143
|
+
export interface SubscriptionProductsResponse {
|
|
144
|
+
status: string;
|
|
145
|
+
data: Array<{
|
|
146
|
+
product: Product;
|
|
147
|
+
prices: Price[];
|
|
148
|
+
}>;
|
|
149
|
+
}
|
|
143
150
|
export interface CancelSubscriptionRequest {
|
|
144
151
|
cancel_at_period_end: boolean;
|
|
145
152
|
}
|
|
@@ -148,6 +155,15 @@ export interface CancelSubscriptionResponse {
|
|
|
148
155
|
message: string;
|
|
149
156
|
data: Subscription;
|
|
150
157
|
}
|
|
158
|
+
export interface CreateCheckoutSessionRequest {
|
|
159
|
+
price_id: string;
|
|
160
|
+
success_url: string;
|
|
161
|
+
cancel_url: string;
|
|
162
|
+
}
|
|
163
|
+
export interface CreateCheckoutSessionResponse {
|
|
164
|
+
status: string;
|
|
165
|
+
checkout_url: string;
|
|
166
|
+
}
|
|
151
167
|
export interface CancellationFunnelInitiateRequest {
|
|
152
168
|
subscription_id: string;
|
|
153
169
|
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# VitePress Documentation Setup
|
|
2
|
+
|
|
3
|
+
This directory contains the VitePress configuration for the @codeguide/core documentation.
|
|
4
|
+
|
|
5
|
+
## Structure
|
|
6
|
+
|
|
7
|
+
- `config.ts` - Main VitePress configuration file (TypeScript)
|
|
8
|
+
- `theme/` - Custom theme files
|
|
9
|
+
- `index.ts` - Theme entry point
|
|
10
|
+
- `custom.css` - Custom styles
|
|
11
|
+
|
|
12
|
+
## Development
|
|
13
|
+
|
|
14
|
+
To run the documentation locally:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
cd packages/core
|
|
18
|
+
npm install
|
|
19
|
+
npm run docs:dev
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Then open http://localhost:5173
|
|
23
|
+
|
|
24
|
+
## Building
|
|
25
|
+
|
|
26
|
+
To build the documentation for production:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm run docs:build
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The output will be in `packages/core/docs/.vitepress/dist`
|
|
33
|
+
|
|
34
|
+
## Preview
|
|
35
|
+
|
|
36
|
+
To preview the built documentation:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npm run docs:preview
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Configuration
|
|
43
|
+
|
|
44
|
+
The main configuration is in `config.ts`. Key features:
|
|
45
|
+
|
|
46
|
+
- TypeScript-based configuration
|
|
47
|
+
- Sidebar navigation
|
|
48
|
+
- Search functionality
|
|
49
|
+
- Edit links to GitHub
|
|
50
|
+
- Custom theme styling
|
|
51
|
+
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { defineConfig } from 'vitepress'
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
title: '@codeguide/core',
|
|
5
|
+
description: 'Documentation for @codeguide/core package - TypeScript SDK for CodeGuide API',
|
|
6
|
+
|
|
7
|
+
// Server configuration
|
|
8
|
+
server: {
|
|
9
|
+
port: 5174,
|
|
10
|
+
host: true,
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
// Base URL if deploying to a subdirectory
|
|
14
|
+
base: '/',
|
|
15
|
+
|
|
16
|
+
// Theme configuration
|
|
17
|
+
themeConfig: {
|
|
18
|
+
// Logo (optional)
|
|
19
|
+
logo: '/logo.png', // You can add a logo later
|
|
20
|
+
|
|
21
|
+
// Site title in nav
|
|
22
|
+
siteTitle: '@codeguide/core',
|
|
23
|
+
|
|
24
|
+
// Navigation bar
|
|
25
|
+
nav: [
|
|
26
|
+
{ text: 'Home', link: '/' },
|
|
27
|
+
{ text: 'Getting Started', link: '/codeguide-client' },
|
|
28
|
+
{ text: 'Services', link: '/projects-service' },
|
|
29
|
+
{ text: 'GitHub', link: 'https://github.com/CodeGuide-dev/codeguide' },
|
|
30
|
+
],
|
|
31
|
+
|
|
32
|
+
// Sidebar navigation
|
|
33
|
+
sidebar: [
|
|
34
|
+
{
|
|
35
|
+
text: 'Getting Started',
|
|
36
|
+
items: [
|
|
37
|
+
{ text: 'Overview', link: '/' },
|
|
38
|
+
{ text: 'CodeGuide Client', link: '/codeguide-client' },
|
|
39
|
+
{ text: 'Authentication', link: '/authentication' },
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
text: 'Services',
|
|
44
|
+
items: [
|
|
45
|
+
{ text: 'Projects Service', link: '/projects-service' },
|
|
46
|
+
{ text: 'Codespace Service', link: '/codespace-service' },
|
|
47
|
+
{ text: 'Codespace Models', link: '/codespace-models' },
|
|
48
|
+
{ text: 'Security Keys Service', link: '/security-keys-service' },
|
|
49
|
+
{ text: 'Usage Service', link: '/usage-service' },
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
|
|
54
|
+
// Social links
|
|
55
|
+
socialLinks: [
|
|
56
|
+
{ icon: 'github', link: 'https://github.com/CodeGuide-dev/codeguide' },
|
|
57
|
+
],
|
|
58
|
+
|
|
59
|
+
// Search configuration
|
|
60
|
+
search: {
|
|
61
|
+
provider: 'local',
|
|
62
|
+
options: {
|
|
63
|
+
locales: {
|
|
64
|
+
root: {
|
|
65
|
+
translations: {
|
|
66
|
+
button: {
|
|
67
|
+
buttonText: 'Search',
|
|
68
|
+
buttonAriaLabel: 'Search documentation',
|
|
69
|
+
},
|
|
70
|
+
modal: {
|
|
71
|
+
noResultsText: 'No results for',
|
|
72
|
+
resetButtonTitle: 'Reset search',
|
|
73
|
+
footer: {
|
|
74
|
+
selectText: 'to select',
|
|
75
|
+
navigateText: 'to navigate',
|
|
76
|
+
closeText: 'to close',
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
// Footer
|
|
86
|
+
footer: {
|
|
87
|
+
message: 'Released under the MIT License.',
|
|
88
|
+
copyright: 'Copyright © 2024 CodeGuide Team',
|
|
89
|
+
},
|
|
90
|
+
|
|
91
|
+
// Edit link
|
|
92
|
+
editLink: {
|
|
93
|
+
pattern: 'https://github.com/CodeGuide-dev/codeguide/blob/main/packages/core/docs/:path',
|
|
94
|
+
text: 'Edit this page on GitHub',
|
|
95
|
+
},
|
|
96
|
+
|
|
97
|
+
// Carbon ads (optional - remove if not needed)
|
|
98
|
+
// carbonAds: {
|
|
99
|
+
// code: 'your-code',
|
|
100
|
+
// placement: 'your-placement'
|
|
101
|
+
// },
|
|
102
|
+
|
|
103
|
+
// Last updated
|
|
104
|
+
lastUpdated: {
|
|
105
|
+
text: 'Last updated',
|
|
106
|
+
},
|
|
107
|
+
|
|
108
|
+
// Outline configuration
|
|
109
|
+
outline: {
|
|
110
|
+
level: [2, 3],
|
|
111
|
+
label: 'On this page',
|
|
112
|
+
},
|
|
113
|
+
|
|
114
|
+
// Doc footer (prev/next links)
|
|
115
|
+
docFooter: {
|
|
116
|
+
prev: 'Previous page',
|
|
117
|
+
next: 'Next page',
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
|
|
121
|
+
// Markdown configuration
|
|
122
|
+
markdown: {
|
|
123
|
+
lineNumbers: true,
|
|
124
|
+
theme: {
|
|
125
|
+
light: 'github-light',
|
|
126
|
+
dark: 'github-dark',
|
|
127
|
+
},
|
|
128
|
+
// Disable Vue component parsing in markdown to avoid conflicts
|
|
129
|
+
breaks: false,
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
// Head configuration
|
|
133
|
+
head: [
|
|
134
|
+
['meta', { name: 'viewport', content: 'width=device-width, initial-scale=1.0' }],
|
|
135
|
+
['meta', { name: 'description', content: 'Documentation for @codeguide/core package' }],
|
|
136
|
+
['link', { rel: 'icon', href: '/favicon.ico' }],
|
|
137
|
+
],
|
|
138
|
+
})
|
|
139
|
+
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/* Custom styles for VitePress theme */
|
|
2
|
+
|
|
3
|
+
:root {
|
|
4
|
+
--vp-c-brand: #42b983;
|
|
5
|
+
--vp-c-brand-light: #42b983;
|
|
6
|
+
--vp-c-brand-lighter: #66d9a3;
|
|
7
|
+
--vp-c-brand-lightest: #8ae5b8;
|
|
8
|
+
--vp-c-brand-dark: #35495e;
|
|
9
|
+
--vp-c-brand-darker: #2c3e50;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/* Code block styling */
|
|
13
|
+
.vp-code-group .tabs {
|
|
14
|
+
border-radius: 8px 8px 0 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.vp-code-group .blocks {
|
|
18
|
+
border-radius: 0 0 8px 8px;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/* Custom code block background */
|
|
22
|
+
div[class*='language-'] {
|
|
23
|
+
background-color: var(--vp-code-block-bg);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/* Improve table styling */
|
|
27
|
+
table {
|
|
28
|
+
display: table;
|
|
29
|
+
width: 100%;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* Better spacing for method documentation */
|
|
33
|
+
.method-doc {
|
|
34
|
+
margin-bottom: 2rem;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.method-doc h3 {
|
|
38
|
+
margin-top: 2rem;
|
|
39
|
+
padding-bottom: 0.5rem;
|
|
40
|
+
border-bottom: 1px solid var(--vp-c-divider);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* Improve code example readability */
|
|
44
|
+
.vp-code-group {
|
|
45
|
+
margin: 1.5rem 0;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* Better list spacing */
|
|
49
|
+
.vp-doc ul,
|
|
50
|
+
.vp-doc ol {
|
|
51
|
+
padding-left: 1.5rem;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/* Improve type definition blocks */
|
|
55
|
+
.type-definition {
|
|
56
|
+
background-color: var(--vp-c-bg-soft);
|
|
57
|
+
padding: 1rem;
|
|
58
|
+
border-radius: 8px;
|
|
59
|
+
margin: 1rem 0;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/* Custom badge styling */
|
|
63
|
+
.badge {
|
|
64
|
+
display: inline-block;
|
|
65
|
+
padding: 0.25rem 0.5rem;
|
|
66
|
+
border-radius: 4px;
|
|
67
|
+
font-size: 0.875rem;
|
|
68
|
+
font-weight: 500;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.badge-required {
|
|
72
|
+
background-color: var(--vp-c-red-soft);
|
|
73
|
+
color: var(--vp-c-red);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.badge-optional {
|
|
77
|
+
background-color: var(--vp-c-yellow-soft);
|
|
78
|
+
color: var(--vp-c-yellow);
|
|
79
|
+
}
|
|
80
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Theme } from 'vitepress'
|
|
2
|
+
import DefaultTheme from 'vitepress/theme'
|
|
3
|
+
import './custom.css'
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
extends: DefaultTheme,
|
|
7
|
+
enhanceApp({ app }) {
|
|
8
|
+
// You can add custom Vue components here if needed
|
|
9
|
+
// Example:
|
|
10
|
+
// app.component('CustomComponent', CustomComponent)
|
|
11
|
+
},
|
|
12
|
+
} satisfies Theme
|
|
13
|
+
|