@oxyhq/services
Version:
Reusable OxyHQ module to handle authentication, user management, karma system, device-based session management and more 🚀
35 lines • 1.59 kB
TypeScript
import { OxyServices } from '../../core/OxyServices';
import { Asset, AssetUploadProgress } from '../../models/interfaces';
export declare const setOxyAssetInstance: (instance: OxyServices) => void;
/**
* Hook for managing assets with Zustand store integration
*/
export declare const useAssets: () => {
assets: Asset[];
uploadProgress: Record<string, AssetUploadProgress>;
loading: {
uploading: boolean;
linking: boolean;
deleting: boolean;
};
errors: {
upload?: string;
link?: string;
delete?: string;
};
upload: (file: File, metadata?: Record<string, any>) => Promise<Asset | null>;
link: (assetId: string, app: string, entityType: string, entityId: string) => Promise<void>;
unlink: (assetId: string, app: string, entityType: string, entityId: string) => Promise<void>;
getUrl: (assetId: string, variant?: string, expiresIn?: number) => Promise<string>;
getAsset: (assetId: string) => Promise<Asset>;
deleteAsset: (assetId: string, force?: boolean) => Promise<void>;
restore: (assetId: string) => Promise<void>;
getVariants: (assetId: string) => Promise<import("../../models/interfaces").AssetVariant[]>;
getAssetsByApp: (app: string) => Asset[];
getAssetsByEntity: (app: string, entityType: string, entityId: string) => Asset[];
getAssetUsageCount: (assetId: string) => number;
isAssetLinked: (assetId: string, app: string, entityType: string, entityId: string) => boolean;
clearErrors: () => void;
reset: () => void;
};
//# sourceMappingURL=useAssets.d.ts.map