ФУНКЦИИ - МЕЖПРОЕКТНАЯ КОММУНИКАЦИЯ: администрирование воркспейсов и feature-gates в God Mode
This commit is contained in:
@@ -5,7 +5,13 @@
|
||||
*/
|
||||
|
||||
import { API_BASE_URL } from "@plane/constants";
|
||||
import type { IWorkspace, TWorkspacePaginationInfo } from "@plane/types";
|
||||
import type {
|
||||
IWorkspace,
|
||||
TInstanceWorkspaceFeatureKey,
|
||||
TInstanceWorkspaceFeaturesResponse,
|
||||
TInstanceWorkspaceMember,
|
||||
TWorkspacePaginationInfo,
|
||||
} from "@plane/types";
|
||||
import { APIService } from "../api.service";
|
||||
|
||||
/**
|
||||
@@ -68,4 +74,55 @@ export class InstanceWorkspaceService extends APIService {
|
||||
throw error?.response?.data;
|
||||
});
|
||||
}
|
||||
|
||||
async listMembers(workspaceId: string): Promise<TInstanceWorkspaceMember[]> {
|
||||
return this.get(`/api/instances/workspaces/${workspaceId}/members/`)
|
||||
.then((response) => response?.data)
|
||||
.catch((error) => {
|
||||
throw error?.response?.data;
|
||||
});
|
||||
}
|
||||
|
||||
async updateMemberRole(
|
||||
workspaceId: string,
|
||||
workspaceMemberId: string,
|
||||
role: TInstanceWorkspaceMember["role"]
|
||||
): Promise<TInstanceWorkspaceMember> {
|
||||
return this.patch(`/api/instances/workspaces/${workspaceId}/members/${workspaceMemberId}/`, { role })
|
||||
.then((response) => response?.data)
|
||||
.catch((error) => {
|
||||
throw error?.response?.data;
|
||||
});
|
||||
}
|
||||
|
||||
async removeMember(workspaceId: string, workspaceMemberId: string): Promise<void> {
|
||||
return this.delete(`/api/instances/workspaces/${workspaceId}/members/${workspaceMemberId}/`)
|
||||
.then((response) => response?.data)
|
||||
.catch((error) => {
|
||||
throw error?.response?.data;
|
||||
});
|
||||
}
|
||||
|
||||
async retrieveFeatures(workspaceId: string): Promise<TInstanceWorkspaceFeaturesResponse> {
|
||||
return this.get(`/api/instances/workspaces/${workspaceId}/features/`)
|
||||
.then((response) => response?.data)
|
||||
.catch((error) => {
|
||||
throw error?.response?.data;
|
||||
});
|
||||
}
|
||||
|
||||
async updateFeature(
|
||||
workspaceId: string,
|
||||
featureKey: TInstanceWorkspaceFeatureKey,
|
||||
isEnabled: boolean
|
||||
): Promise<TInstanceWorkspaceFeaturesResponse> {
|
||||
return this.patch(`/api/instances/workspaces/${workspaceId}/features/`, {
|
||||
feature_key: featureKey,
|
||||
is_enabled: isEnabled,
|
||||
})
|
||||
.then((response) => response?.data)
|
||||
.catch((error) => {
|
||||
throw error?.response?.data;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user