Zum Inhalt springen

Einstieg

Installieren

Einrichten
Terminalfenster
bun add @capgo/capacitor-contacts
bunx cap sync
import { CapacitorContacts } from '@capgo/capacitor-contacts';

Die Gesamtzahl der Kontakte auf dem Gerät ermitteln.

import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.countContacts();

Ein neues Kontakt programmatisch erstellen.

import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.createContact({} as CreateContactOptions);

Erstellen Sie ein neues Kontaktgruppen.

import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.createGroup({} as CreateGroupOptions);

Löschen Sie einen Kontakt durch ID.

import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.deleteContactById({} as DeleteContactByIdOptions);

Löschen Sie eine Gruppe durch ID.

import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.deleteGroupById({} as DeleteGroupByIdOptions);

Anzeigen Sie einen Kontakt mit dem native Kontakt-Viewer.

import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.displayContactById({} as DisplayContactByIdOptions);

Zeige die native UI für die Erstellung von Kontaktinformationen.

import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.displayCreateContact();

Zeige die native UI für die Aktualisierung von Kontaktinformationen für einen bestimmten Kontakt.

import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.displayUpdateContactById({} as DisplayUpdateContactByIdOptions);

Ermittle alle auf dem Gerät verfügbaren Konten.

import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.getAccounts();

Ermittle einen bestimmten Kontakt nach ID.

import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.getContactById({} as GetContactByIdOptions);

Alle Kontakte vom Gerät abrufen.

import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.getContacts();

Ein bestimmtes Gruppe nach ID abrufen.

import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.getGroupById({} as GetGroupByIdOptions);

Alle Kontaktgruppen abrufen.

import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.getGroups();

Überprüfen, ob Kontakte auf dem Gerät verfügbar sind.

import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.isAvailable();

Überprüfen, ob das Plugin auf der aktuellen Plattform unterstützt wird.

import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.isSupported();

Öffnen Sie die Kontakteinstellungen des Geräts.

import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.openSettings();

Wählen Sie einen Kontakt mit dem nativen Kontaktpicker aus.

import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.pickContact();

Wählen Sie einen oder mehrere Kontakte mit dem nativen Kontaktpicker aus.

import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.pickContacts();

Ein bestehendes Kontakt durch die ID aktualisieren.

import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.updateContactById({} as UpdateContactByIdOptions);

Überprüfen Sie den aktuellen Status der Kontakte-Berechtigungen.

import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.checkPermissions();

Berechtigungen anfordern, um auf Kontakte zuzugreifen.

import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.requestPermissions();

Erfolg aus der Kontakzanfertigung.

export interface CountContactsResult {
/**
* Total number of contacts.
*
* @since 1.0.0
*/
count: number;
}

Optionen für die Erstellung eines Kontakts.

export interface CreateContactOptions {
/**
* Contact information to create. The 'id' field will be generated automatically.
*
* @since 1.0.0
*/
contact: Omit<Contact, 'id'>;
}

Erfolg aus der Erstellung eines Kontakts.

export interface CreateContactResult {
/**
* The ID of the newly created contact.
*
* @since 1.0.0
*/
id: string;
}

Optionen für die Erstellung einer Gruppe.

export interface CreateGroupOptions {
/**
* Group information to create. The 'id' field will be generated automatically.
*
* @since 1.0.0
*/
group: Omit<Group, 'id'>;
}

Ergebnis der Erstellung einer Gruppe.

export interface CreateGroupResult {
/**
* The ID of the newly created group.
*
* @since 1.0.0
*/
id: string;
}

Optionen für die Löschung eines Kontakts durch ID.

export interface DeleteContactByIdOptions {
/**
* The ID of the contact to delete.
*
* @since 1.0.0
*/
id: string;
}

Optionen für die Löschung einer Gruppe durch ID.

export interface DeleteGroupByIdOptions {
/**
* The ID of the group to delete.
*
* @since 1.0.0
*/
id: string;
}

Optionen für die Anzeige eines Kontakts durch ID.

export interface DisplayContactByIdOptions {
/**
* The ID of the contact to display.
*
* @since 1.0.0
*/
id: string;
}

Optionen für die Anzeige der nativen Erstellungsoptionen für Kontakte

export interface DisplayCreateContactOptions {
/**
* Optional pre-filled contact information for the create UI.
*
* @since 1.0.0
*/
contact?: Omit<Contact, 'id'>;
}

Ergebnis der Anzeige der nativen Erstellungsoptionen für Kontakte

export interface DisplayCreateContactResult {
/**
* The ID of the created contact, if one was created. Undefined if the user cancelled.
*
* @since 1.0.0
*/
id?: string;
}

Optionen für die Anzeige der nativen Aktualisierungsoptionen für Kontakte

export interface DisplayUpdateContactByIdOptions {
/**
* The ID of the contact to update.
*
* @since 1.0.0
*/
id: string;
}

Ergebnis der Abrufung von Konten

export interface GetAccountsResult {
/**
* List of accounts available on the device.
*
* @since 1.0.0
*/
accounts: Account[];
}

Diese Seite wird aus dem Plugin generiert. src/definitions.tsRe-run die Synchronisation, wenn die öffentliche API upstream geändert wird.