Scans
QR codes et scans via @ziwako/client — CRUD, build et versions publiques.
La ressource Scans gère les QR codes et objets scannables de la plateforme : création, mise à jour, build (génération du QR), et versions publiques destinées à l'affichage.
- Factory :
getScans()(@ziwako/client/axios) - Types :
Scan,ScanResponse,ScanListResponse,PublicScanResponse,CreateScanBody,UpdateScanBody,BuildScanBody,ListScansParams,ListePublicScanParams - Endpoints :
GET /scans/{id},PUT /scans/{id},POST /scans,GET /scans,GET /public/scans,GET /public/scans/{id},PUT /scans/{id}/build
import { configure, getScans } from '@ziwako/client/axios';
configure({ accessToken: '...' });
const scans = getScans();getScan
Récupère un scan par son id (données complètes).
Signature : getScan(id: string) → Promise<ScanResponse>
const response = await scans.getScan('64b8f2...');
console.log(response.data?.code);import { useGetScan } from '@ziwako/client/react-query';
const { data } = useGetScan(scanId);updateScan
Met à jour un scan (contenu, config, destination...).
Signature : updateScan(id: string, updateScanBody?: UpdateScanBody) → Promise<ScanResponse>
await scans.updateScan(scanId, { destination: 'https://ziwako.com/produits/123' });import { useUpdateScan } from '@ziwako/client/react-query';
const mutation = useUpdateScan();
mutation.mutate({ id: scanId, data: { destination: 'https://ziwako.com/produits/123' } });createScan
Crée un nouveau scan (QR code).
Signature : createScan(createScanBody?: CreateScanBody) → Promise<ScanResponse>
const response = await scans.createScan({
title: 'QR produit casque',
destination: 'https://ziwako.com/produits/123',
owner: proProfilId,
});
console.log(response.data?.id);import { useCreateScan } from '@ziwako/client/react-query';
const mutation = useCreateScan();
mutation.mutate({ data: { title: 'QR produit casque', destination: 'https://ziwako.com/produits/123', owner: proProfilId } });listScans
Liste paginée des scans d'un propriétaire.
Signature : listScans(params?: ListScansParams) → Promise<ScanListResponse>
const list = await scans.listScans({ page: 1, limit: 20, filter: { owner: proProfilId } });import { useListScans } from '@ziwako/client/react-query';
const { data } = useListScans({ page: 1, limit: 20 });listePublicScan
Liste les scans publics. Endpoint public.
Signature : listePublicScan(params?: ListePublicScanParams) → Promise<ListePublicScan200>
const list = await scans.listePublicScan({ page: 1, limit: 20 });
console.log(list.data?.docs);import { useListePublicScan } from '@ziwako/client/react-query';
const { data } = useListePublicScan({ limit: 20 });getPublicScan
Récupère un scan public (contenu affichable après scan du QR). Endpoint public.
Signature : getPublicScan(id: string) → Promise<PublicScanResponse>
const response = await scans.getPublicScan('64b8f2...');
console.log(response.data?.destination);import { useGetPublicScan } from '@ziwako/client/react-query';
const { data } = useGetPublicScan(scanId);buildScan
Génère (ou régénère) le QR code associé à un scan, avec une configuration optionnelle.
Signature : buildScan(id: string, buildScanBody?: BuildScanBody) → Promise<ScanResponse>
await scans.buildScan(scanId, { config: { size: 300, margin: 4 } });import { useBuildScan } from '@ziwako/client/react-query';
const mutation = useBuildScan();
mutation.mutate({ id: scanId, data: { config: { size: 300, margin: 4 } } });