コンテンツに進む

ページ/エリア: Capgo マーケティング ウェブサイト。役割: ウェブサイト コピー文。見られる場所: コンポーネント Hero.astro。メッセージ キー `hero_subtitle_v2` (Hero Subtitle V2)。

GitHub

AI-Assisted セットアップを使用してプラグインをインストールできます。AIツールに Capgo スキルを追加するには、以下のコマンドを実行してください。

ターミナルウィンドウ
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins

次に、以下のプロンプトを使用してください。

Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-contacts` plugin in my project.

Manual Setupを使用する場合は、以下のコマンドを実行してください。以下のプラットフォーム固有の指示に従ってください。

ターミナルウィンドウ
bun add @capgo/capacitor-contacts
bunx cap sync
import { CapacitorContacts } from '@capgo/capacitor-contacts';

デバイス上の連絡先の総数を数えます。

import { CapacitorContacts } from '@capgo/capacitor-contacts';
const result = await CapacitorContacts.countContacts();
console.log(result);

プログラムで新しい連絡先を作成します。

import { CapacitorContacts } from '@capgo/capacitor-contacts';
const result = await CapacitorContacts.createContact({ contact: {} });
console.log(result);

新しい連絡先グループを作成します。

import { CapacitorContacts } from '@capgo/capacitor-contacts';
const result = await CapacitorContacts.createGroup({ group: { name: 'example' } });
console.log(result);

IDで連絡先を削除します。

import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.deleteContactById({ id: 'id-123' });

グループをIDで削除します。

import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.deleteGroupById({ id: 'id-123' });

ネイティブの連絡先ビューアを使用して連絡先を表示します。

import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.displayContactById({ id: 'id-123' });

ネイティブの連絡先作成UIを表示します。

import { CapacitorContacts } from '@capgo/capacitor-contacts';
const result = await CapacitorContacts.displayCreateContact();
console.log(result);

特定の連絡先のネイティブの連絡先更新UIを表示します。

import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.displayUpdateContactById({ id: 'id-123' });

デバイス上のすべてのアカウントを取得します。

import { CapacitorContacts } from '@capgo/capacitor-contacts';
const result = await CapacitorContacts.getAccounts();
console.log(result);

特定の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.

デバイス上のすべての連絡先を取得します。

import { CapacitorContacts } from '@capgo/capacitor-contacts';
const result = await CapacitorContacts.getContacts();
// The result holds sensitive values: use it without logging it.

特定のIDを持つ特定のグループを取得します。

import { CapacitorContacts } from '@capgo/capacitor-contacts';
const result = await CapacitorContacts.getGroupById({ id: 'id-123' });
console.log(result);

すべての連絡先グループを取得します。

import { CapacitorContacts } from '@capgo/capacitor-contacts';
const result = await CapacitorContacts.getGroups();
console.log(result);

デバイス上の連絡先が利用可能かどうかを確認します。

import { CapacitorContacts } from '@capgo/capacitor-contacts';
const result = await CapacitorContacts.isAvailable();
console.log(result);

現在のプラットフォームでプラグインがサポートされているかどうかを確認します。

import { CapacitorContacts } from '@capgo/capacitor-contacts';
const result = await CapacitorContacts.isSupported();
console.log(result);

デバイスの連絡先設定を開きます。

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

1つの連絡先をネイティブの連絡先ピッカーから選択してください。

import { CapacitorContacts } from '@capgo/capacitor-contacts';
const result = await CapacitorContacts.pickContact();
// The result holds sensitive values: use it without logging it.

1つ以上の連絡先をネイティブの連絡先ピッカーから選択してください。

import { CapacitorContacts } from '@capgo/capacitor-contacts';
const result = await CapacitorContacts.pickContacts();
// The result holds sensitive values: use it without logging it.

既存の連絡先をIDで更新します。

import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.updateContactById({
id: 'id-123',
contact: {},
});

連絡先の現在の許可状態を確認します。

import { CapacitorContacts } from '@capgo/capacitor-contacts';
const result = await CapacitorContacts.checkPermissions();
console.log(result);

連絡先へのアクセスを許可する。

import { CapacitorContacts } from '@capgo/capacitor-contacts';
const result = await CapacitorContacts.requestPermissions();
console.log(result);

タイプ リファレンス

タイプ リファレンス

タイプ リファレンス

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

連絡先を作成する結果

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

連絡先の数を数える結果

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

グループを作成するためのオプション

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

グループを作成した結果

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

IDで連絡先を削除するためのオプション

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

IDでグループを削除するためのオプション

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

IDで表示するためのオプション

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

ネイティブの新規連絡先UIを表示するためのオプション

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

ネイティブの新規連絡先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;
}

ネイティブの連絡先更新UIを表示するためのオプション

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

アカウントを取得した結果

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

このページはプラグインの src/definitions.tsパブリック API がアップストリームで変更されたときは、再度同期を実行してください。

あなたが 「Getting Started」 ダッシュボードとAPIの作業を計画し、接続する Capgoを使用して@capgo/capacitor連絡先を取得します。 Using @capgo/capacitor-contacts APIの概要 APIの概要 導入 導入 APIのキー APIのキー デバイス デバイス