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.
Installez
Section intitulée « Installer »Vous pouvez utiliser notre configuration assistée par l'IA pour installer le plugin. Ajoutez les Capgo compétences à votre outil IA en utilisant 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 Présentation
Section intitulée “API Présentation”countContacts
Section intitulée “countContacts”Comptez le nombre total de contacts sur le dispositif.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
const result = await CapacitorContacts.countContacts();console.log(result);createContact
Section intitulée “createContact”Créer un nouveau contact de manière programmée.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
const result = await CapacitorContacts.createContact({ contact: {} });console.log(result);createGroup
Section intitulée “createGroup”Créer un nouveau groupe de contacts.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
const result = await CapacitorContacts.createGroup({ group: { name: 'example' } });console.log(result);deleteContactById
Section intitulée “deleteContactById”Supprimer un contact par son ID.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.deleteContactById({ id: 'id-123' });deleteGroupById
Section intitulée « deleteGroupById »Supprimer un groupe par son ID.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.deleteGroupById({ id: 'id-123' });displayContactById
Section intitulée « displayContactById »Afficher un contact à l'aide du visionneur de contacts natif.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.displayContactById({ id: 'id-123' });displayCreateContact
Section intitulée « displayCreateContact »Display the native create contact UI.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
const result = await CapacitorContacts.displayCreateContact();console.log(result);displayUpdateContactById
Section intitulée « displayUpdateContactById »Afficher l'interface utilisateur de mise à jour native pour un contact spécifique.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.displayUpdateContactById({ id: 'id-123' });getAccounts
Sous-section intitulée « getAccounts »Récupérer tous les comptes disponibles sur le dispositif.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
const result = await CapacitorContacts.getAccounts();console.log(result);getContactById
Sous-section intitulée « getContactById »Récupérer un contact spécifique par son ID.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
const result = await CapacitorContacts.getContactById({ id: 'id-123' });// The result holds sensitive values: use it without logging it.getContacts
Sous-section intitulée « getContacts »Récupérer tous les contacts du dispositif.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
const result = await CapacitorContacts.getContacts();// The result holds sensitive values: use it without logging it.getGroupById
Sous-section intitulée « getGroupById »Récupérer un groupe spécifique par son ID.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
const result = await CapacitorContacts.getGroupById({ id: 'id-123' });console.log(result);getGroups
Section intitulée “getGroups”Récupérer tous les groupes de contacts.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
const result = await CapacitorContacts.getGroups();console.log(result);isAvailable
Section intitulée “isAvailable”Vérifier si les contacts sont disponibles sur le dispositif.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
const result = await CapacitorContacts.isAvailable();console.log(result);isSupported
Section intitulée “isSupported”Vérifier si le plugin est pris en charge sur la plateforme actuelle.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
const result = await CapacitorContacts.isSupported();console.log(result);openSettings
Section intitulée “openSettings”Ouvrez les paramètres de contacts du dispositif.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.openSettings();pickContact
Sous-section intitulée « pickContact »Sélectionnez un contact unique à l'aide du sélectionneur de contacts natif.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
const result = await CapacitorContacts.pickContact();// The result holds sensitive values: use it without logging it.pickContacts
Sous-section intitulée « pickContacts »Sélectionnez un ou plusieurs contacts à l'aide du sélectionneur de contacts natif.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
const result = await CapacitorContacts.pickContacts();// The result holds sensitive values: use it without logging it.updateContactById
Sous-section intitulée « updateContactById »Mettre à jour un contact existant par son ID.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.updateContactById({ id: 'id-123', contact: {},});checkPermissions
Sous-section intitulée « checkPermissions »Vérifiez l'état actuel des autorisations pour les contacts.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
const result = await CapacitorContacts.checkPermissions();console.log(result);requestPermissions
Section intitulée « demandeAutorisations »Demander les autorisations pour accéder aux contacts.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
const result = await CapacitorContacts.requestPermissions();console.log(result);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
Options de création de contactOptions 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
Résultat de la création de contactRé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 « 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
Résultat de la création de groupeRé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
Options de suppression du contact par IDOptions pour supprimer un contact par son ID.
export interface DeleteContactByIdOptions { /** * The ID of the contact to delete. * * @since 1.0.0 */ id: string;}DeleteGroupByIdOptions
Options de suppression du groupe par IDOptions pour supprimer un groupe par ID.
export interface DeleteGroupByIdOptions { /** * The ID of the group to delete. * * @since 1.0.0 */ id: string;}DisplayContactByIdOptions
Section intitulée “Options de visualisation du contact par ID”Options pour afficher un contact par ID.
export interface DisplayContactByIdOptions { /** * The ID of the contact to display. * * @since 1.0.0 */ id: string;}DisplayCreateContactOptions
Afficher les options de création de contactOptions 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
Afficher le résultat de la création de contactResult from displaying the native create contact UI.
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
Afficher les options d'actualisation du contact par IDOptions for displaying the native update contact UI.
export interface DisplayUpdateContactByIdOptions { /** * The ID of the contact to update. * * @since 1.0.0 */ id: string;}GetAccountsResult
Section titled “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 de vérité
Section intitulée « Source de vérité »Cette page est générée à partir du plugin. src/definitions.tsRe-run the synchronisation lorsque le public API change en amont.
Continuez de l'étape de démarrage
Section intitulée “Continuez de l’Accueil”Si vous utilisez Getting Started pour planifier votre tableau de bord et les opérations API, connectez-l’à Utilisez @capgo/capacitor-contacts pour la capacité native dans Utilisez @capgo/capacitor-contacts, API Vue d'ensemble pour le détail d'implémentation dans API Vue d'ensemble, Introduction pour le détail d'implémentation dans Introduction, API Clés pour le détail d'implémentation dans API Clés, et Appareils pour les détails d'implémentation dans Appareils.