From 4302124f873dd3e371b4a846527571b8a3615651 Mon Sep 17 00:00:00 2001 From: Alexandre Roux Date: Wed, 31 Jul 2024 20:02:31 +0200 Subject: [PATCH] new deps --- functions_call_flutter/.gitignore | 1 + .../lib/functions_call_flutter.dart | 9 +- .../lib/src/functions_call.dart | 119 ------------------ .../lib/src/functions_call_flutter.dart | 4 +- functions_call_flutter/pubspec.yaml | 5 + 5 files changed, 9 insertions(+), 129 deletions(-) delete mode 100644 functions_call_flutter/lib/src/functions_call.dart diff --git a/functions_call_flutter/.gitignore b/functions_call_flutter/.gitignore index 0ec4a8b..4ed48aa 100644 --- a/functions_call_flutter/.gitignore +++ b/functions_call_flutter/.gitignore @@ -30,3 +30,4 @@ build/ /.flutter-plugins /.flutter-plugins-dependencies /.metadata +/pubspec_overrides.yaml diff --git a/functions_call_flutter/lib/functions_call_flutter.dart b/functions_call_flutter/lib/functions_call_flutter.dart index 7eba210..ae49c3f 100644 --- a/functions_call_flutter/lib/functions_call_flutter.dart +++ b/functions_call_flutter/lib/functions_call_flutter.dart @@ -1,12 +1,5 @@ library; -export 'package:tekartik_firebase_functions/firebase_functions.dart' - show regionBelgium, regionUsCentral1, regionFrankfurt; -export 'src/functions_call.dart' - show - FirebaseFunctionsCallService, - FirebaseFunctionsCall, - FirebaseFunctionsCallable, - FirebaseFunctionsCallableOptions; +export 'package:tekartik_firebase_functions_call/functions_call.dart'; export 'src/functions_call_flutter.dart' show firebaseFunctionsCallServiceFlutter; diff --git a/functions_call_flutter/lib/src/functions_call.dart b/functions_call_flutter/lib/src/functions_call.dart deleted file mode 100644 index 0f5aaa0..0000000 --- a/functions_call_flutter/lib/src/functions_call.dart +++ /dev/null @@ -1,119 +0,0 @@ -import 'package:tekartik_firebase/firebase.dart'; - -/// Interface representing an HttpsCallable instance's options, -class FirebaseFunctionsCallableOptions { - /// Constructs a new [HttpsCallableOptions] instance with given `timeout` & `limitedUseAppCheckToken` - /// Defaults [timeout] to 60 seconds. - /// Defaults [limitedUseAppCheckToken] to `false` - FirebaseFunctionsCallableOptions( - {this.timeout = const Duration(seconds: 60), - this.limitedUseAppCheckToken = false}); - - /// Returns the timeout for this instance - Duration timeout; - - /// Sets whether or not to use limited-use App Check tokens when invoking the associated function. - bool limitedUseAppCheckToken; - - @override - String toString() => - 'FirebaseFunctionsCallableOptions(timeout: $timeout${limitedUseAppCheckToken == true ? ', limitedUseAppCheckToken: $limitedUseAppCheckToken' : ''})'; -} - -/// Firebase functions call -abstract class FirebaseFunctionsCall { - /// A reference to the Callable HTTPS trigger with the given name. - /// - /// Should be the name of the Callable function in Firebase - FirebaseFunctionsCallable callable( - String name, { - FirebaseFunctionsCallableOptions? options, - }); -} - -/// A reference to a particular Callable HTTPS trigger in Cloud Functions. -abstract class FirebaseFunctionsCallable { - /// Executes this Callable HTTPS trigger asynchronously. - /// - /// The data passed into the trigger can be any of the following types: - /// - /// `null` - /// `String` - /// `num` - /// [List], where the contained objects are also one of these types. - /// [Map], where the values are also one of these types. - /// - /// The request to the Cloud Functions backend made by this method - /// automatically includes a Firebase Instance ID token to identify the app - /// instance. If a user is logged in with Firebase Auth, an auth ID token for - /// the user is also automatically included. - Future call([Object? parameters]); -} - -/// Firebase functions callable result. -abstract class FirebaseFunctionsCallableResult { - /// The data that was returned from the Callable HTTPS trigger. - T get data; -} - -/// Firebase functions callable result default mixin -mixin FirebaseFunctionsCallableResultDefaultMixin - implements FirebaseFunctionsCallableResult { - @override - T get data => - throw UnimplementedError('FirebaseFunctionsCallableResult.data'); -} - -/// Firebase functions call default mixin -mixin FirebaseFunctionsCallDefaultMixin implements FirebaseFunctionsCall { - @override - FirebaseFunctionsCallable callable(String name, - {FirebaseFunctionsCallableOptions? options}) { - throw UnimplementedError('FirebaseFunctionsCall.callable'); - } -} - -/// Firebase functions call service -abstract class FirebaseFunctionsCallService { - /// Get the firebase functions call instance - FirebaseFunctionsCall functionsCall(App app, {required String region}); -} - -/// Firebase functions call service default mixin -mixin FirebaseFunctionsCallServiceDefaultMixin - implements FirebaseFunctionsCallService { - @override - FirebaseFunctionsCall functionsCall(App app, {required String region}) { - throw UnimplementedError( - 'FirebaseFunctionsCallService.functionsCall(${app.name}, $region)'); - } -} - -/// Firebase functions callable default mixin -mixin FirebaseFunctionsCallableDefaultMixin - implements FirebaseFunctionsCallable { - @override - Future call([Object? parameters]) { - throw UnimplementedError('FirebaseFunctionsCallable.call'); - } -} - -// ignore: unused_element -class _FirebaseFunctionsCallMock - with FirebaseFunctionsCallDefaultMixin - implements FirebaseFunctionsCall {} - -// ignore: unused_element -class _FirebaseFunctionsCallServiceMock - with FirebaseFunctionsCallServiceDefaultMixin - implements FirebaseFunctionsCallService {} - -// ignore: unused_element -class _FirebaseFunctionsCallableMock - with FirebaseFunctionsCallableDefaultMixin - implements FirebaseFunctionsCallable {} - -// ignore: unused_element -class _FirebaseFunctionsCallableResultsMock - with FirebaseFunctionsCallableResultDefaultMixin - implements FirebaseFunctionsCallableResult {} diff --git a/functions_call_flutter/lib/src/functions_call_flutter.dart b/functions_call_flutter/lib/src/functions_call_flutter.dart index c01641f..cd8e9a7 100644 --- a/functions_call_flutter/lib/src/functions_call_flutter.dart +++ b/functions_call_flutter/lib/src/functions_call_flutter.dart @@ -4,8 +4,7 @@ import 'package:tekartik_firebase/firebase.dart'; // ignore: implementation_imports import 'package:tekartik_firebase_flutter/src/firebase_flutter.dart' show FirebaseAppFlutter; - -import 'functions_call.dart'; +import 'package:tekartik_firebase_functions_call/functions_call.dart'; /// Firebase functions call service flutter final _firebaseFunctionsCallServiceFlutter = @@ -17,6 +16,7 @@ FirebaseFunctionsCallService get firebaseFunctionsCallServiceFlutter => /// Firebase functions call service flutter class FirebaseFunctionsCallServiceFlutter + with FirebaseFunctionsCallServiceDefaultMixin implements FirebaseFunctionsCallService { /// Most implementation need a single instance, keep it in memory! final _instances = {}; diff --git a/functions_call_flutter/pubspec.yaml b/functions_call_flutter/pubspec.yaml index c0caa2e..6f5f2bb 100644 --- a/functions_call_flutter/pubspec.yaml +++ b/functions_call_flutter/pubspec.yaml @@ -35,6 +35,11 @@ dependencies: url: https://github.com/tekartik/firebase_functions.dart ref: dart3a path: firebase_functions + tekartik_firebase_functions_call: + git: + url: https://github.com/tekartik/firebase_functions.dart + ref: dart3a + path: functions_call dev_dependencies: flutter_test: sdk: flutter