explore.ts 888 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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 = () => {
  13. return get('/installed-apps')
  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. }