Ziwako Docs
ZiwakoGuide développeurSDK @ziwako/client

ProProfil

Profils professionnels via @ziwako/client — CRUD, équipe, invitations et visibilité publique.

La ressource ProProfil gère les entités professionnelles de la plateforme (freelances, institutions, sentinelles). Un ProProfil est lié à un utilisateur propriétaire (owner) et permet d'offrir des services, gérer des opportunités et recevoir des évaluations.

  • Factory : getProProfil() (@ziwako/client/axios)
  • Types : ProProfil, ProProfilResponse, ProProfilListResponse, CreateProProfilBody, UpdateProProfilBody, ProProfilMemberListResponse, ProProfilInvitationListResponse, ProProfilInvitationResponse
  • Endpoints : POST /proprofils, GET /proprofils, GET /proprofils/{id}, PUT /proprofils/{id}, DELETE /proprofils/{id}, GET /public/proprofils, GET /public/proprofils/{id}, gestion des membres (/members, /members/invite, /members/{memberId}), invitations (/invitations)
import { configure, getProProfil } from '@ziwako/client/axios';
configure({ accessToken: '...' });
const proprofils = getProProfil();

Le champ proType accepte : particular (indépendant), institution (entreprise), sentinel (rôle de veille).

Création et lecture

createProProfil

Enregistre un nouveau ProProfil, lié à un profil utilisateur existant (le propriétaire).

Signature : createProProfil(createProProfilBody?: CreateProProfilBody) → Promise<ProProfilResponse>

const response = await proprofils.createProProfil({
    fullName: 'Studio Créatif Kivu',
    proType: 'institution',
    owner: '64b8f2...',
    description: 'Agence de création digitale',
    contacts: { emails: ['hello@studio-kivu.com'] },
});

console.log(response.data?.id);
import { useCreateProProfil } from '@ziwako/client/react-query';

const mutation = useCreateProProfil({
    mutation: { onSuccess: (r) => console.log(r.data?.id) },
});

mutation.mutate({
    data: { fullName: 'Studio Créatif Kivu', proType: 'institution', owner: userProfilId },
});

listProProfil

Liste paginée des ProProfils enregistrés (annuaires, dashboards admin). Requiert une authentification.

Signature : listProProfil(params?: ListProProfilParams) → Promise<ProProfilListResponse>

const list = await proprofils.listProProfil({
    page: 1,
    limit: 20,
    sort: '-avgRating',
    filter: { status: 'active' },
});
console.log(list.data?.docs);
import { useListProProfil } from '@ziwako/client/react-query';

const { data } = useListProProfil({ page: 1, limit: 20 });

getProProfil

Récupère les données complètes d'un ProProfil : identité & contacts, logique métier (solde, plan, bénéfices du plan) et indicateurs de performance (note moyenne, temps de réponse).

Signature : getProProfil(id: string) → Promise<ProProfilResponse>

const response = await proprofils.getProProfil('64b8f2...');
console.log(response.data?.avgRating, response.data?.maxSimultaneousOpportunity);
import { useGetProProfil } from '@ziwako/client/react-query';

const { data } = useGetProProfil(proProfilId, { query: { enabled: !!proProfilId } });

updateProProfil

Met à jour les informations du ProProfil (contacts, description, logo, statut de visibilité). Le propriétaire ou un manager doit être authentifié ; pour les objets complexes comme contacts, envoyez l'objet complet.

Signature : updateProProfil(id: string, updateProProfilBody?: UpdateProProfilBody) → Promise<ProProfilResponse>

await proprofils.updateProProfil(proProfilId, {
    description: 'Agence repositionnée sur le branding',
    status: 'active',
});
import { useUpdateProProfil } from '@ziwako/client/react-query';

const mutation = useUpdateProProfil();
mutation.mutate({ id: proProfilId, data: { description: 'Nouvelle description' } });

deleteProProfil

Supprime définitivement un ProProfil : historique de services, notes, opportunités et indicateurs sont retirés. Irréversible — pour une suspension temporaire, préférez status: 'inactive' | 'suspended' via updateProProfil.

Signature : deleteProProfil(id: string) → Promise<DeleteProProfil200>

await proprofils.deleteProProfil(proProfilId);
import { useDeleteProProfil } from '@ziwako/client/react-query';

const mutation = useDeleteProProfil();
mutation.mutate({ id: proProfilId });

Visibilité publique

getPublicProProfil

Vue « vitrine » d'un ProProfil, sanitisée pour le public : identité, description, photos, notes agrégées, badges et canaux de contact publics. Les données sensibles (solde, plan) sont exclues.

Signature : getPublicProProfil(id: string) → Promise<ProProfilResponse>

const response = await proprofils.getPublicProProfil('64b8f2...');
console.log(response.data?.fullName, response.data?.badges);
import { useGetPublicProProfil } from '@ziwako/client/react-query';

const { data } = useGetPublicProProfil(proProfilId);

listPublicProProfil

Parcours paginé des ProProfils publics — endpoint principal pour les répertoires et les pages « Explorer ». Les données renvoyées sont sanitissées.

Signature : listPublicProProfil(params?: ListPublicProProfilParams) → Promise<ProProfilListResponse>

const list = await proprofils.listPublicProProfil({ page: 1, limit: 24, sort: '-avgRating' });
import { useListPublicProProfil } from '@ziwako/client/react-query';

const { data } = useListPublicProProfil({ page: 1, limit: 24 });

Équipe (membres)

inviteMember

Le propriétaire ou un admin invite un nouveau membre dans l'équipe du ProProfil. Une invitation est générée et un email est envoyé au destinataire ; le rôle définit les permissions à l'acceptation (admin, member, support, ...).

Signature : inviteMember(proProfilId: string, inviteMemberBody?: InviteMemberBody) → Promise<InviteMember200>

await proprofils.inviteMember(proProfilId, {
    profilId: '64b8f2...',
    role: 'member',
});
import { useInviteMember } from '@ziwako/client/react-query';

const mutation = useInviteMember();
mutation.mutate({ proProfilId, data: { profilId: '64b8f2...', role: 'member' } });

addMember

Ajoute directement un membre à l'équipe (sans flux d'invitation).

Signature : addMember(proProfilId: string) → Promise<ProProfilResponse>

await proprofils.addMember(proProfilId);
import { useAddMember } from '@ziwako/client/react-query';

const mutation = useAddMember();
mutation.mutate({ proProfilId });

listMembers

Liste les membres de l'équipe d'un ProProfil.

Signature : listMembers(proProfilId: string, params?: ListMembersParams) → Promise<ProProfilMemberListResponse>

const list = await proprofils.listMembers(proProfilId, { page: 1, limit: 50 });
console.log(list.data?.docs);
import { useListMembers } from '@ziwako/client/react-query';

const { data } = useListMembers(proProfilId);

updateMemberRole

Change le rôle d'un membre de l'équipe (promotion, rétrogradation, affectation à un département). La modification est immédiate. Le rôle de l'Owner ne peut pas être modifié.

Signature : updateMemberRole(proProfilId: string, memberId: string, updateMemberRoleBody?: UpdateMemberRoleBody) → Promise<ProProfilResponse>

await proprofils.updateMemberRole(proProfilId, memberId, { role: 'admin' });
import { useUpdateMemberRole } from '@ziwako/client/react-query';

const mutation = useUpdateMemberRole();
mutation.mutate({ proProfilId, memberId, data: { role: 'admin' } });

removeMember

Retire un membre de l'équipe : il perd immédiatement tous les privilèges liés au ProProfil (gestion d'opportunités, réponses, édition), sans supprimer son compte personnel. L'Owner ne peut pas être retiré.

Signature : removeMember(proProfilId: string, memberId: string) → Promise<ProProfilResponse>

await proprofils.removeMember(proProfilId, memberId);
import { useRemoveMember } from '@ziwako/client/react-query';

const mutation = useRemoveMember();
mutation.mutate({ proProfilId, memberId });

checkMemberShip

Vérifie la relation entre un profil utilisateur et un ProProfil : endpoint de contrôle de permission avant une action sensible (édition, publication d'opportunité). Retourne le statut d'appartenance et le rôle assigné.

Signature : checkMemberShip(proProfilId: string, memberid: string) → Promise<CheckMemberShip200>

const check = await proprofils.checkMemberShip(proProfilId, profilId);
console.log(check.data?.isMember, check.data?.role);
import { useCheckMemberShip } from '@ziwako/client/react-query';

const { data } = useCheckMemberShip(proProfilId, profilId);

Invitations

listPendingMemberInvitations

Liste les invitations en attente d'un ProProfil.

Signature : listPendingMemberInvitations(proProfilId: string, params?: ListPendingMemberInvitationsParams) → Promise<ProProfilInvitationListResponse>

const list = await proprofils.listPendingMemberInvitations(proProfilId);
import { useListPendingMemberInvitations } from '@ziwako/client/react-query';

const { data } = useListPendingMemberInvitations(proProfilId);

listSendingMemberInvitation

Liste les invitations envoyées par un ProProfil.

Signature : listSendingMemberInvitation(proProfilId: string, params?: ListSendingMemberInvitationParams) → Promise<ProProfilInvitationListResponse>

const list = await proprofils.listSendingMemberInvitation(proProfilId);
import { useListSendingMemberInvitation } from '@ziwako/client/react-query';

const { data } = useListSendingMemberInvitation(proProfilId);

accepteMemberInvitation

Accepte une invitation : le destinataire devient membre actif de l'organisation.

Signature : accepteMemberInvitation(invitationId: string) → Promise<ProProfilInvitationResponse>

await proprofils.accepteMemberInvitation(invitationId);
import { useAccepteMemberInvitation } from '@ziwako/client/react-query';

const mutation = useAccepteMemberInvitation();
mutation.mutate({ invitationId });

declineMemberInvitation

Refuse une invitation.

Signature : declineMemberInvitation(invitationId: string) → Promise<ProProfilInvitationResponse>

await proprofils.declineMemberInvitation(invitationId);
import { useDeclineMemberInvitation } from '@ziwako/client/react-query';

const mutation = useDeclineMemberInvitation();
mutation.mutate({ invitationId });

revokeMemberInvitation

Révoque une invitation émise par le ProProfil.

Signature : revokeMemberInvitation(proProfilId: string, invitationId: string) → Promise<ProProfilInvitationResponse>

await proprofils.revokeMemberInvitation(proProfilId, invitationId);
import { useRevokeMemberInvitation } from '@ziwako/client/react-query';

const mutation = useRevokeMemberInvitation();
mutation.mutate({ proProfilId, invitationId });

getProProfilInvitation

Récupère une invitation précise d'un ProProfil.

Signature : getProProfilInvitation(proProfilId: string, invitationId: string) → Promise<ProProfilInvitationResponse>

const invitation = await proprofils.getProProfilInvitation(proProfilId, invitationId);
import { useGetProProfilInvitation } from '@ziwako/client/react-query';

const { data } = useGetProProfilInvitation(proProfilId, invitationId);

resendMemberInvitation

Renvoye l'email d'invitation à un destinataire.

Signature : resendMemberInvitation(proProfilId: string, invitationId: string) → Promise<ProProfilInvitationResponse>

await proprofils.resendMemberInvitation(proProfilId, invitationId);
import { useResendMemberInvitation } from '@ziwako/client/react-query';

const mutation = useResendMemberInvitation();
mutation.mutate({ proProfilId, invitationId });