패키지, 저장소 및 앱 카테고리 검색

패키지 상세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, 웹, macOS, Windows, Linux 플랫폼의 앱에서 Drive, 캘린더, 클라우드 스토리지 등 Google의 방대한 에코시스템과 직접 상호작용할 수 있습니다. 이 패키지는 invertase.io에서 유지보수되며 현대적인 Flutter 개발 워크플로우를 지원합니다.

사용 사례

  • Google Drive와의 통합
  • Google 캘린더 데이터에 액세스하기
  • Google Identity에서 사용자 정보를 가져오는 중
  • 클라우드 스토리지 작업 관리
  • 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

소스 저장소

이 패키지를 사용하는 프로젝트