| 
									
										
										
										
											2023-06-01 23:19:36 +08:00
										 |  |  | import { del, get, patch, post } from './base' | 
					
						
							| 
									
										
										
										
											2024-02-27 19:16:22 +08:00
										 |  |  | import type { App, AppCategory } from '@/models/explore' | 
					
						
							| 
									
										
										
										
											2023-05-25 16:59:47 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | export const fetchAppList = () => { | 
					
						
							| 
									
										
										
										
											2024-02-27 19:16:22 +08:00
										 |  |  |   return get<{ | 
					
						
							|  |  |  |     categories: AppCategory[] | 
					
						
							|  |  |  |     recommended_apps: App[] | 
					
						
							|  |  |  |   }>('/explore/apps') | 
					
						
							| 
									
										
										
										
											2023-05-25 16:59:47 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-01 23:19:36 +08:00
										 |  |  | export const fetchAppDetail = (id: string): Promise<any> => { | 
					
						
							| 
									
										
										
										
											2023-05-25 16:59:47 +08:00
										 |  |  |   return get(`/explore/apps/${id}`) | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export const fetchInstalledAppList = () => { | 
					
						
							|  |  |  |   return get('/installed-apps') | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export const installApp = (id: string) => { | 
					
						
							|  |  |  |   return post('/installed-apps', { | 
					
						
							|  |  |  |     body: { | 
					
						
							| 
									
										
										
										
											2023-06-01 23:19:36 +08:00
										 |  |  |       app_id: id, | 
					
						
							|  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2023-05-25 16:59:47 +08:00
										 |  |  |   }) | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export const uninstallApp = (id: string) => { | 
					
						
							|  |  |  |   return del(`/installed-apps/${id}`) | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export const updatePinStatus = (id: string, isPinned: boolean) => { | 
					
						
							|  |  |  |   return patch(`/installed-apps/${id}`, { | 
					
						
							|  |  |  |     body: { | 
					
						
							| 
									
										
										
										
											2023-06-01 23:19:36 +08:00
										 |  |  |       is_pinned: isPinned, | 
					
						
							|  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2023-05-25 16:59:47 +08:00
										 |  |  |   }) | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2023-07-27 13:27:34 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | export const getToolProviders = () => { | 
					
						
							|  |  |  |   return get('/workspaces/current/tool-providers') | 
					
						
							|  |  |  | } |