explore.ts 946 B

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