パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v0.2.0

firebaseapis

API発見サービスによって記述されたGoogle APIにアクセスするための自動生成クライアントライブラリ。

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
2万
いいね数
21
Pub ポイント
160

パッケージをインストール

flutter pub add firebaseapis

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

firebaseapis パッケージは、API の発見サービスを介して Google API にアクセスするための自動生成されたクライアントライブラリを提供します。Flutter および Dart 向けに構築されており、公式の API 説明から型安全な API を生成することで、Firebase および他の Google サービスとのシームレスな統合を可能にします。これにより、開発者は Android、iOS、Web、macOS、Windows、Linux プラットフォーム上のアプリから、Drive、カレンダー、クラウドストレージなど Google の広大なエコシステムと直接やり取りできます。このパッケージは invertase.io によってメンテナンスされており、現代的な Flutter 開発ワークフローをサポートしています。

用途

  • Google Drive との統合
  • Googleカレンダーのデータにアクセスする
  • Google IDからユーザー情報を取得しています
  • クラウドストレージ操作の管理
  • Google スプレッドシートとのデータ同期
  • YouTube Data API に接続しています

主な機能

  • 公式API発見ドキュメントから自動生成
  • 型安全な Dart インターフェース
  • クロスプラットフォーム対応(Android、iOS、Web、macOS、Windows、Linux)
  • Firebase プロジェクトとのシームレスな統合
  • OAuth2 認証フローをサポートしています
  • 新しいGoogle APIリリースを含む定期的な更新

適している対象

  • Google API アクセスが必要なアプリの開発者
  • 複数のGoogleサービスとの統合を必要とするプロジェクト
  • すべての主要OSをターゲットとしたクロスプラットフォームアプリケーション
  • Firebase をバックエンドインフラとして使用するチーム
  • Google サービスへの安全で認証された API 呼び出しを必要とするアプリ

注意事項

  • Google API インターフェースの発見形式について理解が必要
  • 認証のセットアップ(OAuth2)は複雑になることがあります
  • 大規模な生成されたコードベースはビルドサイズを増加させる可能性があります
  • 生成されたAPIリファレンス以外のドキュメントは限られている
  • 軽量クライアントで十分な単純な使用ケースには理想的ではありません

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

Firebase API Client Libraries for Dart

Chat on Discord

melos

This is based on the googleapis.dart repository but instead aimed at supporting Firebase related APIs only. Additionally, this adds support for several unlisted (but discoverable) Firebase APIs that are not listed on the official discovery API that googleapis.dart uses (and is currently limited to) as well as several private APIs (APIs that require an API key to view discovery information).

See ./generated/firebaseapis/README.md for information on all the currently supported APIs.

Usage Example

// Import the APIs you want to use
import 'package:firebaseapis/firebaseremoteconfig/v1.dart' as remote_config;
import 'package:firebaseapis/firebaserules/v1.dart' as firebase_rules;
// Import Auth client
import 'package:googleapis_auth/auth_io.dart' as auth;

// Get an Auth Client
final authClient = await auth.clientViaApplicationDefaultCredentials(scopes: [
  remote_config.FirebaseRemoteConfigApi.cloudPlatformScope,
]);

// Call some APIs
final rc = remote_config.FirebaseRemoteConfigApi(authClient);
final config =
  await rc.projects.getRemoteConfig('projects/<your-project-id>');
print(config.parameters);
print(config.parameters?.values.first.defaultValue);
print(config.parameters?.values.first.description);
print(config.parameters?.values.first.valueType);

final fr = firebase_rules.FirebaseRulesApi(authClient);
final rules =
  await fr.projects.rulesets.list('projects/<your-project-id>');
print(rules.rulesets?.first.name);
print(rules.rulesets?.first.source?.files?.first.content);

Custom Request Headers

Custom request headers can be set by adding to requestHeaders:

import 'package:firebaseapis/src/user_agent.dart';

Future<void> main() async {
  requestHeaders.addAll({
    'cool-header': 'cool-value',
  });
  print(requestHeaders);
}

Contributing

This project uses Melos to manage the project and dependencies.

To install Melos, run the following command from your SSH client:

dart pub global activate melos

Next, at the root of your locally cloned repository bootstrap the projects dependencies:

melos bootstrap

The bootstrap command locally links all dependencies within the project without having to provide manual dependency_overrides. This allows all plugins, examples and tests to build from the local clone project.

You do not need to run flutter pub get once bootstrap has been completed.

Adding a new API

To add a new API and generate library code for it is fairly straightforward;

  1. Add the API to the apis list in ./config.yaml
  2. Run melos run config:download to update the downloaded discovery document JSON files that are in ./discovery.
    • Note: several APIs require an API key to be able to read the discovery information. Set a API_KEY environment variable before running the command to be able to download the discovery documents for these private APIs, e.g. API_KEY=<your-key-here> melos run config:download.
  3. Run melos run config:generate to generate new Dart library code for the API, which outputs to ./generated/firebaseapis.

Maintained by Invertase.

カテゴリー

依存関係

依存関係一覧 2 件

  • _discoveryapis_commons^1.0.0
  • http>=0.13.0 <2.0.0

ソースリポジトリ

このパッケージを使用しているプロジェクト