refactor(api): simplify app type parameter handling to single required parameter
Replace the previous dual-parameter approach (app_type/app/appType) with a single required `app: String` parameter across all Tauri commands. This change: - Introduces unified `parse_app()` helper replacing complex `resolve_app_type()` logic - Updates all backend commands in config, mcp, and provider modules - Aligns frontend API calls to use consistent `app` parameter naming - Simplifies MSW test handlers by removing optional parameter handling This improves API clarity and reduces parameter ambiguity while maintaining backward compatibility through error handling.
This commit is contained in:
@@ -11,7 +11,7 @@ export interface EndpointLatencyResult {
|
||||
|
||||
export const vscodeApi = {
|
||||
async getLiveProviderSettings(appType: AppType) {
|
||||
return await invoke("read_live_provider_settings", { app_type: appType });
|
||||
return await invoke("read_live_provider_settings", { app: appType });
|
||||
},
|
||||
|
||||
async testApiEndpoints(
|
||||
@@ -29,7 +29,7 @@ export const vscodeApi = {
|
||||
providerId: string,
|
||||
): Promise<CustomEndpoint[]> {
|
||||
return await invoke("get_custom_endpoints", {
|
||||
app_type: appType,
|
||||
app: appType,
|
||||
provider_id: providerId,
|
||||
});
|
||||
},
|
||||
@@ -40,7 +40,7 @@ export const vscodeApi = {
|
||||
url: string,
|
||||
): Promise<void> {
|
||||
await invoke("add_custom_endpoint", {
|
||||
app_type: appType,
|
||||
app: appType,
|
||||
provider_id: providerId,
|
||||
url,
|
||||
});
|
||||
@@ -52,7 +52,7 @@ export const vscodeApi = {
|
||||
url: string,
|
||||
): Promise<void> {
|
||||
await invoke("remove_custom_endpoint", {
|
||||
app_type: appType,
|
||||
app: appType,
|
||||
provider_id: providerId,
|
||||
url,
|
||||
});
|
||||
@@ -64,7 +64,7 @@ export const vscodeApi = {
|
||||
url: string,
|
||||
): Promise<void> {
|
||||
await invoke("update_endpoint_last_used", {
|
||||
app_type: appType,
|
||||
app: appType,
|
||||
provider_id: providerId,
|
||||
url,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user