はじめに
このプラグインのインストール手順と完全な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.
インストール
「Install」セクション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」セクションimport { FirebaseFunctions } from '@capgo/capacitor-firebase-functions';クイックスタート
「Quick start」セクション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" });よくある落とし穴
「Common pitfalls」セクション- Native sync: 実行
npx cap syncプラグインのアップグレード後。 - 信頼できる唯一の情報源: 信頼
src/definitions.tsの GitHub リポジトリ内。
API の概要
「API 概要」セクションcallByName
「callByName」セクション関数名を指定してCallable関数を呼び出します。
import { FirebaseFunctions } from '@capgo/capacitor-firebase-functions';
const result = await FirebaseFunctions.callByName({ name: 'myFunction' });console.log(result);callByUrl
「callByUrl」セクションURLを指定してCallable関数を呼び出します。
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 }}なお、cleartext trafficは本番環境での使用を想定していません。
import { FirebaseFunctions } from '@capgo/capacitor-firebase-functions';
await FirebaseFunctions.useEmulator({ host: "127.0.0.1" });型リファレンス
「Type Reference」セクション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;}信頼できる情報源
「信頼できる情報源」セクションこのページはプラグインの src/definitions.tsから生成されています。上流の公開 API が変更された場合は、再度 sync を実行してください。
Getting Started から続ける
「Getting Started」の続き以下を使用している場合: はじめに ダッシュボードと API の操作を計画するには、以下と連携してください API の概要 API Overview の実装の詳細については、 はじめに Introduction の実装の詳細については、 API キー API Keysの実装詳細については、 デバイス Devicesにおける実装の詳細については、 バンドル Bundlesにおける実装の詳細については、