feat: marketplace types

pull/9940/head
StyleZhang 2 years ago
parent 0ef35a0ee0
commit ae00211691

@ -1,11 +1,9 @@
'use client'
import Card from '@/app/components/plugins/card' import Card from '@/app/components/plugins/card'
import CardMoreInfo from '@/app/components/plugins/card/card-more-info' import CardMoreInfo from '@/app/components/plugins/card/card-more-info'
import { toolNotion } from '@/app/components/plugins/card/card-mock' import { toolNotion } from '@/app/components/plugins/card/card-mock'
import { getLocaleOnServer } from '@/i18n/server'
const List = () => { const List = () => {
const locale = getLocaleOnServer()
return ( return (
<div className='px-12 py-2 bg-background-default-subtle'> <div className='px-12 py-2 bg-background-default-subtle'>
<div className='py-3'> <div className='py-3'>

@ -0,0 +1,19 @@
import type { Plugin } from '../types'
export type MarketplaceCollection = {
name: string
description: string
rule: string
created_at: string
updated_at: string
}
export type MarketplaceCollectionsResponse = {
collections: MarketplaceCollection[]
total: number
}
export type MarketplaceCollectionPluginsResponse = {
plugins: Plugin[]
total: number
}

@ -9,6 +9,10 @@ import type {
UpdateEndpointRequest, UpdateEndpointRequest,
} from '@/app/components/plugins/types' } from '@/app/components/plugins/types'
import type { DebugInfo as DebugInfoTypes } from '@/app/components/plugins/types' import type { DebugInfo as DebugInfoTypes } from '@/app/components/plugins/types'
import type {
MarketplaceCollectionPluginsResponse,
MarketplaceCollectionsResponse,
} from '@/app/components/plugins/marketplace/types'
export const createEndpoint: Fetcher<EndpointOperationResponse, { url: string; body: CreateEndpointRequest }> = ({ url, body }) => { export const createEndpoint: Fetcher<EndpointOperationResponse, { url: string; body: CreateEndpointRequest }> = ({ url, body }) => {
// url = /workspaces/current/endpoints/create // url = /workspaces/current/endpoints/create
@ -64,3 +68,11 @@ export const installPackageFromLocal = async (uniqueIdentifier: string) => {
body: { plugin_unique_identifiers: [uniqueIdentifier] }, body: { plugin_unique_identifiers: [uniqueIdentifier] },
}) })
} }
export const fetchMarketplaceCollections: Fetcher<MarketplaceCollectionsResponse, { url: string; }> = ({ url }) => {
return get<MarketplaceCollectionsResponse>(url)
}
export const fetchMarketplaceCollectionPlugins: Fetcher<MarketplaceCollectionPluginsResponse, { url: string }> = ({ url }) => {
return get<MarketplaceCollectionPluginsResponse>(url)
}

Loading…
Cancel
Save