Démarrage
Copiez une commande de configuration avec les étapes d'installation et la guide markdown complet pour ce plugin.
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-contacts`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/contacts/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
Installer
Installationbun add @capgo/capacitor-contactsbunx cap syncImporter
Section intitulée « Importer »import { CapacitorContacts } from '@capgo/capacitor-contacts';API Vue d'ensemble
Section intitulée « API Vue d'ensemble »countContacts
Section intitulée « countContacts »Compter le nombre total de contacts sur le dispositif.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.countContacts();createContact
Section intitulée « créerContact »Créer un nouveau contact de manière programmée.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.createContact({} as CreateContactOptions);createGroup
Section intitulée “createGroup”Créer un nouveau groupe de contacts.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.createGroup({} as CreateGroupOptions);deleteContactById
Section intitulée “deleteContactById”Supprimer un contact par ID.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.deleteContactById({} as DeleteContactByIdOptions);deleteGroupById
Section intitulée “deleteGroupById”Supprimer un groupe par ID.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.deleteGroupById({} as DeleteGroupByIdOptions);displayContactById
Section intitulée “displayContactById”Afficher un contact à l'aide du visionneur de contacts natif.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.displayContactById({} as DisplayContactByIdOptions);displayCreateContact
Section intitulée « displayCreateContact »Afficher l'interface utilisateur native de création de contact.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.displayCreateContact();displayUpdateContactById
Section intitulée « displayUpdateContactById »Afficher l'interface utilisateur native de mise à jour de contact pour un contact spécifique.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.displayUpdateContactById({} as DisplayUpdateContactByIdOptions);getAccounts
Section intitulée « getAccounts »Récupérer tous les comptes disponibles sur le dispositif.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.getAccounts();getContactById
Section intitulée « getContactById »Récupérer un contact spécifique par son ID.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.getContactById({} as GetContactByIdOptions);getContacts
Section intitulée « getContacts »Récupérer tous les contacts du dispositif.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.getContacts();getGroupById
Section intitulée « getGroupById »Récupérer un groupe spécifique par son ID.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.getGroupById({} as GetGroupByIdOptions);getGroups
Section intitulée « getGroups »Récupérer tous les groupes de contacts.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.getGroups();isAvailable
Section intitulée « isAvailable »Vérifier si les contacts sont disponibles sur le dispositif.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.isAvailable();isSupported
Section intitulée « isSupported »Vérifiez si le plugin est pris en charge sur la plateforme actuelle.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.isSupported();openSettings
Section intitulée « openSettings »Ouvrez les paramètres de contacts du dispositif.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.openSettings();pickContact
Section intitulée « pickContact »Sélectionnez un contact unique à l'aide du sélectionneur de contacts natif.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.pickContact();pickContacts
Section intitulée « pickContacts »Sélectionnez un ou plusieurs contacts à l'aide du sélectionneur de contacts natif.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.pickContacts();updateContactById
Section intitulée « mise à jour par ID de contact »Mettre à jour un contact existant par son ID.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.updateContactById({} as UpdateContactByIdOptions);checkPermissions
Section intitulée « vérification des permissions »Vérifier l'état actuel des permissions pour les contacts.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.checkPermissions();requestPermissions
Section intitulée « demande de permissions »Demander les permissions pour accéder aux contacts.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.requestPermissions();Référence de type
Section intitulée « Référence de type »CountContactsResult
Section intitulée “CountContactsResult”Résultat de comptage des contacts.
export interface CountContactsResult { /** * Total number of contacts. * * @since 1.0.0 */ count: number;}CreateContactOptions
Section intitulée “CreateContactOptions”Options pour la création d'un contact.
export interface CreateContactOptions { /** * Contact information to create. The 'id' field will be generated automatically. * * @since 1.0.0 */ contact: Omit<Contact, 'id'>;}CreateContactResult
Section intitulée “CreateContactResult”Résultat de la création d'un contact.
export interface CreateContactResult { /** * The ID of the newly created contact. * * @since 1.0.0 */ id: string;}CreateGroupOptions
Section intitulée “CreateGroupOptions”Options pour la création d'un groupe.
export interface CreateGroupOptions { /** * Group information to create. The 'id' field will be generated automatically. * * @since 1.0.0 */ group: Omit<Group, 'id'>;}CreateGroupResult
Section intitulée « Résultat de création de groupe »Résultat de la création d'un groupe.
export interface CreateGroupResult { /** * The ID of the newly created group. * * @since 1.0.0 */ id: string;}DeleteContactByIdOptions
Section intitulée « Options de suppression d'un contact par ID »Options pour supprimer un contact par son ID.
export interface DeleteContactByIdOptions { /** * The ID of the contact to delete. * * @since 1.0.0 */ id: string;}DeleteGroupByIdOptions
Section intitulée « Options de suppression d'un groupe par ID »Options pour supprimer un groupe par son ID.
export interface DeleteGroupByIdOptions { /** * The ID of the group to delete. * * @since 1.0.0 */ id: string;}DisplayContactByIdOptions
Section intitulée « Options de visualisation d'un contact par ID »Options pour afficher un contact par son ID.
export interface DisplayContactByIdOptions { /** * The ID of the contact to display. * * @since 1.0.0 */ id: string;}DisplayCreateContactOptions
Section intitulée « DisplayCreateContactOptions »Options pour afficher l'interface utilisateur native de création de contact.
export interface DisplayCreateContactOptions { /** * Optional pre-filled contact information for the create UI. * * @since 1.0.0 */ contact?: Omit<Contact, 'id'>;}DisplayCreateContactResult
Section intitulée « DisplayCreateContactResult »Résultat de l'affichage de l'interface utilisateur native de création de contact.
export interface DisplayCreateContactResult { /** * The ID of the created contact, if one was created. Undefined if the user cancelled. * * @since 1.0.0 */ id?: string;}DisplayUpdateContactByIdOptions
Section intitulée « DisplayUpdateContactByIdOptions »Options pour afficher l'interface utilisateur native de mise à jour de contact.
export interface DisplayUpdateContactByIdOptions { /** * The ID of the contact to update. * * @since 1.0.0 */ id: string;}GetAccountsResult
Section intitulée « GetAccountsResult »Résultat de la récupération des comptes.
export interface GetAccountsResult { /** * List of accounts available on the device. * * @since 1.0.0 */ accounts: Account[];}Source Of Truth
Section intitulée « Source Of Truth »Cette page est générée à partir du plugin’s src/definitions.tsRe-générez la synchronisation lorsque le public API change en amont.