スタートガイド
インストール手順と、このプラグインの完全なMarkdownガイドを含むセットアッププロンプトをコピーします。
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-firebase-functions`
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/firebase-functions/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.
インストール
「インストール」セクションAIアシストによるセットアップでプラグインをインストールできます。以下のコマンドを使用して、お使いの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-firebase-functions` plugin in my project.手動セットアップを希望する場合は、以下のコマンドを実行してプラグインをインストールし、下記のプラットフォーム別の手順に従ってください:
bun add @capgo/capacitor-firebase-functionsnpx cap syncインポート
「インポート」セクションimport { FirebaseFunctions } from '@capgo/capacitor-firebase-functions';クイックスタート
「クイックスタート」セクションimport { FirebaseFunctions } from '@capgo/capacitor-firebase-functions';
const result = await FirebaseFunctions.callByName({ name: 'myFunction' });console.log(result);例: callByUrl
「例: callByUrl」セクションimport { FirebaseFunctions } from '@capgo/capacitor-firebase-functions';
const result = await FirebaseFunctions.callByUrl({ url: 'https://us-central1-my-project.cloudfunctions.net/myFunction',});console.log(result);例: useEmulator
「例: useEmulator」セクションimport { FirebaseFunctions } from '@capgo/capacitor-firebase-functions';
await FirebaseFunctions.useEmulator({ host: "127.0.0.1" });よくある落とし穴
「よくある落とし穴」セクション- ネイティブ同期: 実行
npx cap syncプラグインのアップグレード後。 - 信頼できる情報源: 信頼
src/definitions.tsGitHub リポジトリ内。
API の概要
「API 概要」セクションcallByName
セクション「callByName」名前を指定して callable function を呼び出します。
import { FirebaseFunctions } from '@capgo/capacitor-firebase-functions';
const result = await FirebaseFunctions.callByName({ name: 'myFunction' });console.log(result);callByUrl
「callByUrl」セクションURLを指定してcallable functionを呼び出します。
import { FirebaseFunctions } from '@capgo/capacitor-firebase-functions';
const result = await FirebaseFunctions.callByUrl({ url: 'https://us-central1-my-project.cloudfunctions.net/myFunction',});console.log(result);useEmulator
「useEmulator」セクションアプリに計装処理を追加し、Cloud Functionsエミュレーターと通信できるようにします。
Androidでは、cleartext trafficを許可する必要があります。Capacitor の設定では:
{ server: { cleartext: true }}クリアテキスト通信は本番環境での使用を想定していません。
import { FirebaseFunctions } from '@capgo/capacitor-firebase-functions';
await FirebaseFunctions.useEmulator({ host: "127.0.0.1" });型リファレンス
「型リファレンス」セクションCallByNameOptions
「CallByNameOptions」セクションexport interface CallByNameOptions<RequestData = unknown> extends CallOptions<RequestData> { /** * The name of the callable function. * * @example 'myFunction' * @since 6.1.0 */ name: string; /** * The region of the callable function. * * @example 'us-central1' * @since 6.1.0 */ region?: string;}CallByNameResult
「CallByNameResult」セクションexport type CallByNameResult<ResponseData = unknown> = CallResult<ResponseData>;CallByUrlOptions
「CallByUrlOptions」セクションexport interface CallByUrlOptions<RequestData = unknown> extends CallOptions<RequestData> { /** * The URL of the callable function. * * @example 'https://us-central1-my-project.cloudfunctions.net/myFunction' * @since 6.1.0 */ url: string;}CallByUrlResult
「CallByUrlResult」セクションexport type CallByUrlResult<ResponseData = unknown> = CallResult<ResponseData>;UseEmulatorOptions
「UseEmulatorOptions」セクションexport interface UseEmulatorOptions { /** * The emulator host without any port or scheme. * * Note when using a Android Emulator device: 10.0.2.2 is the special IP address to connect to the 'localhost' of the host computer. * * @since 6.1.0 * @example "127.0.0.1" */ host: string; /** * The emulator port. * * @since 6.1.0 * @default 5001 * @example 5001 */ port?: number; /** * The region the callable functions are located in or a custom domain hosting the callable functions. * * @example 'us-central1' * @example 'https://mydomain.com' */ regionOrCustomDomain?: string;}GetPluginVersionResult
セクション「GetPluginVersionResult」export interface GetPluginVersionResult { /** * The semantic version of this plugin. * * @since 8.0.1 */ version: string;}CallResult
「CallResult」セクションexport interface CallResult<ResponseData = unknown> { /** * The result of the callable function. * * @since 6.1.0 */ data: ResponseData;}Source of Truth
「Source Of Truth」セクションこのページはプラグインの src/definitions.tsから生成されています。upstream で公開 API が変更されたら、再度 sync を実行してください。
Getting Startedの続きを進める
「Getting Started からの続き」セクション使用している場合 スタートガイド ダッシュボードと API の運用を計画するには、これを次と連携させます API の概要 「API の概要」の実装の詳細については、 はじめに 「はじめに」における実装の詳細については、 API キー API Keys の実装の詳細については、 デバイス Devices の実装詳細については、および Bundle Bundlesの実装詳細については