Mulai
Copas prompt pengaturan dengan langkah instalasi dan panduan markdown lengkap untuk plugin ini.
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.
Instalasi
Bab yang berjudul “Instalasi”Anda dapat menggunakan Pengaturan Bantu AI untuk menginstal plugin. Tambahkan Capgo kemampuan ke alat AI Anda menggunakan perintah berikut:
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-pluginsLalu gunakan prompt berikut:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-contacts` plugin in my project.Jika Anda lebih suka Pengaturan Manual, instal plugin dengan menjalankan perintah-perintah berikut dan ikuti instruksi khusus platform di bawah ini:
bun add @capgo/capacitor-contactsbunx cap syncImport
Bab berjudul “Import”import { CapacitorContacts } from '@capgo/capacitor-contacts';API Pengantar
Bab berjudul “API Pengantar”countContacts
Bab berjudul “countContacts”Hitung jumlah kontak total pada perangkat.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.countContacts();createContact
Bab berjudul “createContact”Buat kontak baru secara programatik.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.createContact({} as CreateContactOptions);createGroup
Bab berjudul “createGroup”Buat kelompok kontak baru.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.createGroup({} as CreateGroupOptions);deleteContactById
Bab berjudul “deleteContactById”Hapus kontak dengan ID.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.deleteContactById({} as DeleteContactByIdOptions);deleteGroupById
Bab berjudul “deleteGroupById”Hapus kelompok dengan ID.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.deleteGroupById({} as DeleteGroupByIdOptions);displayContactById
Bab berjudul “displayContactById”Tampilkan kontak menggunakan viewer kontak asli.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.displayContactById({} as DisplayContactByIdOptions);displayCreateContact
Bagian berjudul “displayCreateContact”Tampilkan antarmuka UI untuk membuat kontak asli.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.displayCreateContact();displayUpdateContactById
Bagian berjudul “displayUpdateContactById”Tampilkan antarmuka UI untuk memperbarui kontak asli untuk kontak tertentu.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.displayUpdateContactById({} as DisplayUpdateContactByIdOptions);getAccounts
Bagian berjudul “getAccounts”Dapatkan semua akun yang tersedia di perangkat.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.getAccounts();getContactById
Bagian berjudul “getContactById”Dapatkan kontak tertentu berdasarkan ID.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.getContactById({} as GetContactByIdOptions);getContacts
Bab berjudul “getContacts”Dapatkan semua kontak dari perangkat.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.getContacts();getGroupById
Bab berjudul “getGroupById”Dapatkan grup tertentu berdasarkan ID.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.getGroupById({} as GetGroupByIdOptions);getGroups
Bab berjudul “getGroups”Dapatkan semua kelompok kontak.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.getGroups();isAvailable
Bab berjudul “isAvailable”Periksa apakah kontak tersedia di perangkat.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.isAvailable();isSupported
Bab berjudul “isSupported”Periksa apakah plugin tersebut mendukung platform saat ini.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.isSupported();openSettings
Bab berjudul “openSettings”Buka pengaturan kontak perangkat.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.openSettings();pickContact
Bab berjudul “pickContact”Pilih kontak tunggal menggunakan picker kontak native.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.pickContact();pickContacts
Bab berjudul “pickContacts”Pilih satu atau lebih kontak menggunakan picker kontak native.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.pickContacts();updateContactById
Bab berjudul “updateContactById”Update kontak yang sudah ada berdasarkan ID.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.updateContactById({} as UpdateContactByIdOptions);checkPermissions
Bab berjudul “checkPermissions”Periksa status izin saat ini untuk kontak.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.checkPermissions();requestPermissions
Bab berjudul “requestPermissions”Minta izin untuk mengakses kontak.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.requestPermissions();Referensi Tipe
Bab berjudul “Referensi Tipe”CountContactsResult
Judul Bagian “CountContactsResult”Hasil dari menghitung kontak.
export interface CountContactsResult { /** * Total number of contacts. * * @since 1.0.0 */ count: number;}CreateContactOptions
Judul Bagian “CreateContactOptions”Opsi untuk membuat kontak.
export interface CreateContactOptions { /** * Contact information to create. The 'id' field will be generated automatically. * * @since 1.0.0 */ contact: Omit<Contact, 'id'>;}CreateContactResult
Judul Bagian “CreateContactResult”Hasil dari membuat kontak.
export interface CreateContactResult { /** * The ID of the newly created contact. * * @since 1.0.0 */ id: string;}CreateGroupOptions
Judul Bagian “CreateGroupOptions”Opsi untuk membuat grup.
export interface CreateGroupOptions { /** * Group information to create. The 'id' field will be generated automatically. * * @since 1.0.0 */ group: Omit<Group, 'id'>;}CreateGroupResult
Judul Bagian “CreateGroupResult”Hasil dari pembuatan grup.
export interface CreateGroupResult { /** * The ID of the newly created group. * * @since 1.0.0 */ id: string;}DeleteContactByIdOptions
Judul Bagian “DeleteContactByIdOptions”Opsi untuk menghapus kontak berdasarkan ID.
export interface DeleteContactByIdOptions { /** * The ID of the contact to delete. * * @since 1.0.0 */ id: string;}DeleteGroupByIdOptions
Judul Bagian “DeleteGroupByIdOptions”Opsi untuk menghapus grup berdasarkan ID.
export interface DeleteGroupByIdOptions { /** * The ID of the group to delete. * * @since 1.0.0 */ id: string;}DisplayContactByIdOptions
Judul Bagian “DisplayContactByIdOptions”Opsi untuk menampilkan kontak berdasarkan ID.
export interface DisplayContactByIdOptions { /** * The ID of the contact to display. * * @since 1.0.0 */ id: string;}DisplayCreateContactOptions
Judul Bagian “Tampilkan Opsi Membuat Kontak””Opsi untuk menampilkan antarmuka pengguna asli membuat kontak.
export interface DisplayCreateContactOptions { /** * Optional pre-filled contact information for the create UI. * * @since 1.0.0 */ contact?: Omit<Contact, 'id'>;}DisplayCreateContactResult
Judul Bagian “Tampilkan Hasil Membuat Kontak””Hasil dari menampilkan antarmuka pengguna asli membuat kontak.
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
Judul Bagian “Tampilkan Opsi Mengupdate Kontak dengan ID””Opsi untuk menampilkan antarmuka pengguna asli mengupdate kontak.
export interface DisplayUpdateContactByIdOptions { /** * The ID of the contact to update. * * @since 1.0.0 */ id: string;}GetAccountsResult
Judul Bagian “Dapatkan Hasil Akun””Hasil dari mendapatkan akun.
export interface GetAccountsResult { /** * List of accounts available on the device. * * @since 1.0.0 */ accounts: Account[];}Sumber Kebenaran
Judul Bagian “Sumber Kebenaran”Halaman ini dibuat dari plugin’s src/definitions.ts. Re-run sinkronisasi ketika API publik berubah di atas.
Teruskan dari Getting Started
Judul Bagian “Teruskan dari Getting Started”Jika Anda menggunakan Getting Started untuk merencanakan dashboard dan API operasi, hubungkannya dengan Menggunakan @capgo/capacitor-contacts untuk kemampuan asli di Menggunakan @capgo/capacitor-contacts, API Ringkasan untuk detail implementasi di API Panduan Umum Penjelasan untuk detail implementasi di Penjelasan API Kunci untuk detail implementasi di API Kunci, dan Perangkat untuk detail implementasi di Perangkat.