feat: add get marketpalce get

This commit is contained in:
Joel
2024-10-29 14:53:14 +08:00
parent e135707f88
commit 6726ca102e
6 changed files with 42 additions and 15 deletions

View File

@ -1,5 +1,5 @@
import type { Fetcher } from 'swr'
import { del, get, post, upload } from './base'
import { del, get, getMarketplace, post, upload } from './base'
import type {
CreateEndpointRequest,
EndpointOperationResponse,
@ -79,6 +79,10 @@ export const fetchManifest = async (uniqueIdentifier: string) => {
return get<PluginDeclaration>(`/workspaces/current/plugin/fetch-manifest?plugin_unique_identifier=${uniqueIdentifier}`)
}
export const fetchManifestFromMarketPlace = async (uniqueIdentifier: string) => {
return getMarketplace<PluginDeclaration>(`/plugins/identifier?unique_identifier=${uniqueIdentifier}`)
}
export const installPackageFromMarketPlace = async (uniqueIdentifier: string) => {
return post<InstallPackageResponse>('/workspaces/current/plugin/install/marketplace', {
body: { plugin_unique_identifiers: [uniqueIdentifier] },