Getting Started
Copiez un prompt de configuration avec les étapes d'installation et la guide markdown complète 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
Sous-titre « Installer »Vous pouvez utiliser notre configuration assistée par l'IA pour installer le plugin. Ajoutez les Capgo compétences à votre outil IA à l'aide de la commande suivante :
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-pluginsEnsuite, utilisez la prompt suivante :
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-contacts` plugin in my project.Si vous préférez la configuration manuelle, installez le plugin en exécutant les commandes suivantes et suivez les instructions spécifiques à la plateforme ci-dessous :
bun 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éer un contact »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 « créerUnGroupe »Créez un nouveau groupe de contacts.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.createGroup({} as CreateGroupOptions);deleteContactById
Section intitulée « supprimerUnContactParId »Supprimez un contact par son ID.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.deleteContactById({} as DeleteContactByIdOptions);deleteGroupById
Section intitulée « supprimerUnGroupeParId »Supprimez un groupe par son ID.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.deleteGroupById({} as DeleteGroupByIdOptions);displayContactById
Section intitulée « afficherUnContactParId »Affichez 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 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électeur 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électeur 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
Titre de la section « Résultat du comptage de contacts »Résultat du comptage des contacts.
export interface CountContactsResult { /** * Total number of contacts. * * @since 1.0.0 */ count: number;}CreateContactOptions
Titre de la section « Options de création de contact »Options pour créer 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
Titre de la section « Résultat de la création de contact »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
Titre de la section « Options de création de groupe »Options pour créer 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 “Afficher les options de création de contact”Options pour afficher l'interface de création de contact native.
export interface DisplayCreateContactOptions { /** * Optional pre-filled contact information for the create UI. * * @since 1.0.0 */ contact?: Omit<Contact, 'id'>;}DisplayCreateContactResult
Section intitulée “Afficher le résultat de création de contact”Résultat de l'affichage de l'interface de création de contact native.
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 “Afficher les options de mise à jour de contact par ID”Options pour afficher l'interface de mise à jour de contact native.
export interface DisplayUpdateContactByIdOptions { /** * The ID of the contact to update. * * @since 1.0.0 */ id: string;}GetAccountsResult
Section intitulée “Résultat de récupération des comptes”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.ts. Re-run la synchronisation lorsque les informations publiques API changent en amont.
Continuez de la page d'accueil
Section intitulée “Continuez de la page d'accueil”Si vous utilisez Page d'accueil pour planifier le tableau de bord et les opérations API, connectez-l’avec Utilisation de @capgo/capacitor-contacts pour la capacité native dans Utilisation de @capgo/capacitor-contacts, Vue d'ensemble de API pour les détails d'implémentation dans API Vue d'ensemble Introduction pour les détails d'implémentation dans Introduction API Clés pour les détails d'implémentation dans API Clés, et Appareils pour les détails d'implémentation dans Appareils.