34 lines
719 B
TypeScript
34 lines
719 B
TypeScript
import { apiGet, compactApiParams } from "@/services/api/request";
|
|
|
|
export type AssetLibraryItem = {
|
|
id: string;
|
|
title: string;
|
|
type: "text" | "image" | "video";
|
|
coverUrl: string;
|
|
tags: string[];
|
|
category: string;
|
|
description: string;
|
|
content: string;
|
|
url: string;
|
|
createdAt: string;
|
|
updatedAt: string;
|
|
};
|
|
|
|
export type AssetLibraryResponse = {
|
|
items: AssetLibraryItem[];
|
|
tags: string[];
|
|
total: number;
|
|
};
|
|
|
|
export type AssetLibraryQuery = {
|
|
keyword?: string;
|
|
type?: string;
|
|
tag?: string[];
|
|
page?: number;
|
|
pageSize?: number;
|
|
};
|
|
|
|
export async function fetchAssetLibrary(query: AssetLibraryQuery = {}) {
|
|
return apiGet<AssetLibraryResponse>("/api/assets", compactApiParams(query));
|
|
}
|