АРХ - МЕЖПРОЕКТНАЯ КОММУНИКАЦИЯ: каркас Voice Tasker settings
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* Copyright (c) 2023-present Plane Software, Inc. and contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
import { API_BASE_URL } from "@plane/constants";
|
||||
import type {
|
||||
TWorkspaceAIConnectionTestResult,
|
||||
TWorkspaceAISettings,
|
||||
TWorkspaceAISettingsPayload,
|
||||
} from "@plane/types";
|
||||
import { APIService } from "@/services/api.service";
|
||||
|
||||
export class WorkspaceAIService extends APIService {
|
||||
constructor() {
|
||||
super(API_BASE_URL);
|
||||
}
|
||||
|
||||
async retrieveSettings(workspaceSlug: string): Promise<TWorkspaceAISettings> {
|
||||
return this.get(`/api/workspaces/${workspaceSlug}/voice-tasker/settings/`)
|
||||
.then((response) => response?.data)
|
||||
.catch((error) => {
|
||||
throw error?.response?.data;
|
||||
});
|
||||
}
|
||||
|
||||
async updateSettings(
|
||||
workspaceSlug: string,
|
||||
data: TWorkspaceAISettingsPayload
|
||||
): Promise<TWorkspaceAISettings> {
|
||||
return this.patch(`/api/workspaces/${workspaceSlug}/voice-tasker/settings/`, data)
|
||||
.then((response) => response?.data)
|
||||
.catch((error) => {
|
||||
throw error?.response?.data;
|
||||
});
|
||||
}
|
||||
|
||||
async testConnection(workspaceSlug: string): Promise<TWorkspaceAIConnectionTestResult> {
|
||||
return this.post(`/api/workspaces/${workspaceSlug}/voice-tasker/settings/test-connection/`)
|
||||
.then((response) => response?.data)
|
||||
.catch((error) => {
|
||||
throw error?.response?.data;
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user