You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

explore.ts 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import { del, get, patch, post } from './base'
  2. import type { App, AppCategory } from '@/models/explore'
  3. import type { AccessMode } from '@/models/access-control'
  4. export const fetchAppList = () => {
  5. return get<{
  6. categories: AppCategory[]
  7. recommended_apps: App[]
  8. }>('/explore/apps')
  9. }
  10. export const fetchAppDetail = (id: string): Promise<any> => {
  11. return get(`/explore/apps/${id}`)
  12. }
  13. export const fetchInstalledAppList = (app_id?: string | null) => {
  14. return get(`/installed-apps${app_id ? `?app_id=${app_id}` : ''}`)
  15. }
  16. export const installApp = (id: string) => {
  17. return post('/installed-apps', {
  18. body: {
  19. app_id: id,
  20. },
  21. })
  22. }
  23. export const uninstallApp = (id: string) => {
  24. return del(`/installed-apps/${id}`)
  25. }
  26. export const updatePinStatus = (id: string, isPinned: boolean) => {
  27. return patch(`/installed-apps/${id}`, {
  28. body: {
  29. is_pinned: isPinned,
  30. },
  31. })
  32. }
  33. export const getToolProviders = () => {
  34. return get('/workspaces/current/tool-providers')
  35. }
  36. export const getAppAccessModeByAppId = (appId: string) => {
  37. return get<{ accessMode: AccessMode }>(`/enterprise/webapp/app/access-mode?appId=${appId}`)
  38. }