File size: 857 Bytes
a43ac26
 
 
 
 
 
 
d0c18f0
a43ac26
d0c18f0
 
a43ac26
 
 
 
 
 
 
 
d0c18f0
 
a43ac26
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/**
 * 插件 API client
 *
 * 旧安装/校验/卸载 API 已禁用,返回 410 Gone。
 * 详见 R-002、R-009。
 */

import { apiClient } from './client';
import { PluginListItem, PluginDetail, PluginOperationResult, PluginStats } from '@typings/plugin';

export const pluginsApi = {
  /**
   * 获取插件列表
   */
  list: () => apiClient.get<PluginListItem[]>('/plugins/'),

  /**
   * 获取插件统计
   */
  stats: () => apiClient.get<PluginStats>('/plugins/stats'),

  /**
   * 获取插件详情
   */
  get: (name: string) => apiClient.get<PluginDetail>(`/plugins/${name}`),

  /**
   * 启用插件
   */
  enable: (name: string) =>
    apiClient.post<PluginOperationResult>(`/plugins/${name}/enable`),

  /**
   * 禁用插件
   */
  disable: (name: string) =>
    apiClient.post<PluginOperationResult>(`/plugins/${name}/disable`),
};