UNPKG

react-playmakers

Version:

React wrapper providing utilities for PlayMakers integration

41 lines (40 loc) 1.97 kB
import React from "react"; import { AssetExtendedType, AssetPayloadType, AssetType } from "../types/assets.types"; type AssetPushMethod = (updatedAsset?: Partial<AssetPayloadType & { newFile: File; }>) => Promise<AssetType>; type AssetFetchMethod = (quiet?: boolean) => Promise<AssetType>; type AssetPushFileMethod = (file: File | null) => Promise<void>; type AssetDeleteMethod = () => Promise<void>; interface UseAssetReturn extends Partial<AssetType> { asset: AssetType | null; fetched: boolean; setAsset: React.Dispatch<React.SetStateAction<AssetType | null>>; setFile: React.Dispatch<React.SetStateAction<File | null>>; push: AssetPushMethod; delete: AssetDeleteMethod; pushFile: AssetPushFileMethod; refresh: AssetFetchMethod; } export declare const useAsset: (id?: string) => UseAssetReturn; type AssetsFetchMethod = (quiet?: boolean) => Promise<AssetExtendedType[]>; type AssetsFetchMoreMethod = (refresh?: boolean) => Promise<void>; interface UseAssetsReturn { assets: AssetExtendedType[]; fetched: boolean; hasMore: boolean; currentPage: number; fetchMore: AssetsFetchMoreMethod; refresh: AssetsFetchMethod; } export declare const useAssets: (params?: { [key: string]: any; }) => UseAssetsReturn; export declare const useAssetsByProject: (projectId: string, params?: any) => UseAssetsReturn; export declare const useAssetsBySchema: (schemaId: string, params?: any) => UseAssetsReturn; export declare const useAssetsByTags: (tags: Array<string>, params?: any) => UseAssetsReturn; export declare const useTutorials: (params?: any) => UseAssetsReturn; export declare const useTutorialsByProject: (projectId?: string, params?: any) => UseAssetsReturn; export declare const useTutorialsBySchema: (schemaId: string, params?: any) => UseAssetsReturn; export declare const useTutorialsByTags: (tags: Array<string>, params?: any) => UseAssetsReturn; export {};