mirror of
https://github.com/timokz/flutter-vienna-hackathon-25.git
synced 2025-11-08 23:44:19 +01:00
Compare commits
No commits in common. "07870891dadc211308de927f04f9fbe8cbd8762d" and "c36081eddfe449bf717a01c8e7f8f26ae06f3640" have entirely different histories.
07870891da
...
c36081eddf
21 changed files with 634 additions and 94 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,2 +1 @@
|
|||
wien_talks/wien_talks_flutter/pubspec.lock
|
||||
wien_talks/wien_talks_flutter/android/app/google-services.json
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
include defines.mk
|
||||
|
||||
|
||||
.PHONY: local
|
||||
.PHONY := local
|
||||
local:
|
||||
$(MAKE) -C wien_talks_server local
|
||||
|
||||
|
|
|
|||
|
|
@ -11,10 +11,29 @@
|
|||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'package:serverpod_client/serverpod_client.dart' as _i1;
|
||||
import 'dart:async' as _i2;
|
||||
import 'package:wien_talks_client/src/protocol/quotes/quote.dart' as _i3;
|
||||
import 'package:wien_talks_client/src/protocol/quotes/create_quote.dart' as _i4;
|
||||
import 'package:serverpod_auth_client/serverpod_auth_client.dart' as _i5;
|
||||
import 'protocol.dart' as _i6;
|
||||
import 'package:wien_talks_client/src/protocol/greeting.dart' as _i3;
|
||||
import 'package:wien_talks_client/src/protocol/quotes/quote.dart' as _i4;
|
||||
import 'package:wien_talks_client/src/protocol/quotes/create_quote.dart' as _i5;
|
||||
import 'package:serverpod_auth_client/serverpod_auth_client.dart' as _i6;
|
||||
import 'protocol.dart' as _i7;
|
||||
|
||||
/// This is an example endpoint that returns a greeting message through
|
||||
/// its [hello] method.
|
||||
/// {@category Endpoint}
|
||||
class EndpointGreeting extends _i1.EndpointRef {
|
||||
EndpointGreeting(_i1.EndpointCaller caller) : super(caller);
|
||||
|
||||
@override
|
||||
String get name => 'greeting';
|
||||
|
||||
/// Returns a personalized greeting message: "Hello {name}".
|
||||
_i2.Future<_i3.Greeting> hello(String name) =>
|
||||
caller.callServerEndpoint<_i3.Greeting>(
|
||||
'greeting',
|
||||
'hello',
|
||||
{'name': name},
|
||||
);
|
||||
}
|
||||
|
||||
/// {@category Endpoint}
|
||||
class EndpointQuote extends _i1.EndpointRef {
|
||||
|
|
@ -23,37 +42,37 @@ class EndpointQuote extends _i1.EndpointRef {
|
|||
@override
|
||||
String get name => 'quote';
|
||||
|
||||
_i2.Future<void> updateQuote(_i3.Quote quote) =>
|
||||
_i2.Future<void> updateQuote(_i4.Quote quote) =>
|
||||
caller.callServerEndpoint<void>(
|
||||
'quote',
|
||||
'updateQuote',
|
||||
{'quote': quote},
|
||||
);
|
||||
|
||||
_i2.Stream<_i3.Quote> quoteUpdates() =>
|
||||
caller.callStreamingServerEndpoint<_i2.Stream<_i3.Quote>, _i3.Quote>(
|
||||
_i2.Stream<_i4.Quote> quoteUpdates() =>
|
||||
caller.callStreamingServerEndpoint<_i2.Stream<_i4.Quote>, _i4.Quote>(
|
||||
'quote',
|
||||
'quoteUpdates',
|
||||
{},
|
||||
{},
|
||||
);
|
||||
|
||||
_i2.Future<_i3.Quote> createQuote(_i4.CreateQuoteRequest req) =>
|
||||
caller.callServerEndpoint<_i3.Quote>(
|
||||
_i2.Future<_i4.Quote> createQuote(_i5.CreateQuoteRequest req) =>
|
||||
caller.callServerEndpoint<_i4.Quote>(
|
||||
'quote',
|
||||
'createQuote',
|
||||
{'req': req},
|
||||
);
|
||||
|
||||
_i2.Future<_i3.Quote> getQuoteById(int id) =>
|
||||
caller.callServerEndpoint<_i3.Quote>(
|
||||
_i2.Future<_i4.Quote> getQuoteById(int id) =>
|
||||
caller.callServerEndpoint<_i4.Quote>(
|
||||
'quote',
|
||||
'getQuoteById',
|
||||
{'id': id},
|
||||
);
|
||||
|
||||
_i2.Future<List<_i3.Quote>> getAllQuotes() =>
|
||||
caller.callServerEndpoint<List<_i3.Quote>>(
|
||||
_i2.Future<List<_i4.Quote>> getAllQuotes() =>
|
||||
caller.callServerEndpoint<List<_i4.Quote>>(
|
||||
'quote',
|
||||
'getAllQuotes',
|
||||
{},
|
||||
|
|
@ -62,10 +81,10 @@ class EndpointQuote extends _i1.EndpointRef {
|
|||
|
||||
class Modules {
|
||||
Modules(Client client) {
|
||||
auth = _i5.Caller(client);
|
||||
auth = _i6.Caller(client);
|
||||
}
|
||||
|
||||
late final _i5.Caller auth;
|
||||
late final _i6.Caller auth;
|
||||
}
|
||||
|
||||
class Client extends _i1.ServerpodClientShared {
|
||||
|
|
@ -84,7 +103,7 @@ class Client extends _i1.ServerpodClientShared {
|
|||
bool? disconnectStreamsOnLostInternetConnection,
|
||||
}) : super(
|
||||
host,
|
||||
_i6.Protocol(),
|
||||
_i7.Protocol(),
|
||||
securityContext: securityContext,
|
||||
authenticationKeyManager: authenticationKeyManager,
|
||||
streamingConnectionTimeout: streamingConnectionTimeout,
|
||||
|
|
@ -94,16 +113,22 @@ class Client extends _i1.ServerpodClientShared {
|
|||
disconnectStreamsOnLostInternetConnection:
|
||||
disconnectStreamsOnLostInternetConnection,
|
||||
) {
|
||||
greeting = EndpointGreeting(this);
|
||||
quote = EndpointQuote(this);
|
||||
modules = Modules(this);
|
||||
}
|
||||
|
||||
late final EndpointGreeting greeting;
|
||||
|
||||
late final EndpointQuote quote;
|
||||
|
||||
late final Modules modules;
|
||||
|
||||
@override
|
||||
Map<String, _i1.EndpointRef> get endpointRefLookup => {'quote': quote};
|
||||
Map<String, _i1.EndpointRef> get endpointRefLookup => {
|
||||
'greeting': greeting,
|
||||
'quote': quote,
|
||||
};
|
||||
|
||||
@override
|
||||
Map<String, _i1.ModuleEndpointCaller> get moduleLookup =>
|
||||
|
|
|
|||
95
wien_talks/wien_talks_client/lib/src/protocol/greeting.dart
Normal file
95
wien_talks/wien_talks_client/lib/src/protocol/greeting.dart
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
/* AUTOMATICALLY GENERATED CODE DO NOT MODIFY */
|
||||
/* To generate run: "serverpod generate" */
|
||||
|
||||
// ignore_for_file: implementation_imports
|
||||
// ignore_for_file: library_private_types_in_public_api
|
||||
// ignore_for_file: non_constant_identifier_names
|
||||
// ignore_for_file: public_member_api_docs
|
||||
// ignore_for_file: type_literal_in_constant_pattern
|
||||
// ignore_for_file: use_super_parameters
|
||||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'package:serverpod_client/serverpod_client.dart' as _i1;
|
||||
|
||||
/// A greeting message which can be sent to or from the server.
|
||||
abstract class Greeting implements _i1.SerializableModel {
|
||||
Greeting._({
|
||||
required this.message,
|
||||
required this.author,
|
||||
required this.timestamp,
|
||||
});
|
||||
|
||||
factory Greeting({
|
||||
required String message,
|
||||
required String author,
|
||||
required DateTime timestamp,
|
||||
}) = _GreetingImpl;
|
||||
|
||||
factory Greeting.fromJson(Map<String, dynamic> jsonSerialization) {
|
||||
return Greeting(
|
||||
message: jsonSerialization['message'] as String,
|
||||
author: jsonSerialization['author'] as String,
|
||||
timestamp:
|
||||
_i1.DateTimeJsonExtension.fromJson(jsonSerialization['timestamp']),
|
||||
);
|
||||
}
|
||||
|
||||
/// The greeting message.
|
||||
String message;
|
||||
|
||||
/// The author of the greeting message.
|
||||
String author;
|
||||
|
||||
/// The time when the message was created.
|
||||
DateTime timestamp;
|
||||
|
||||
/// Returns a shallow copy of this [Greeting]
|
||||
/// with some or all fields replaced by the given arguments.
|
||||
@_i1.useResult
|
||||
Greeting copyWith({
|
||||
String? message,
|
||||
String? author,
|
||||
DateTime? timestamp,
|
||||
});
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'message': message,
|
||||
'author': author,
|
||||
'timestamp': timestamp.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return _i1.SerializationManager.encode(this);
|
||||
}
|
||||
}
|
||||
|
||||
class _GreetingImpl extends Greeting {
|
||||
_GreetingImpl({
|
||||
required String message,
|
||||
required String author,
|
||||
required DateTime timestamp,
|
||||
}) : super._(
|
||||
message: message,
|
||||
author: author,
|
||||
timestamp: timestamp,
|
||||
);
|
||||
|
||||
/// Returns a shallow copy of this [Greeting]
|
||||
/// with some or all fields replaced by the given arguments.
|
||||
@_i1.useResult
|
||||
@override
|
||||
Greeting copyWith({
|
||||
String? message,
|
||||
String? author,
|
||||
DateTime? timestamp,
|
||||
}) {
|
||||
return Greeting(
|
||||
message: message ?? this.message,
|
||||
author: author ?? this.author,
|
||||
timestamp: timestamp ?? this.timestamp,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -10,10 +10,12 @@
|
|||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'package:serverpod_client/serverpod_client.dart' as _i1;
|
||||
import 'quotes/create_quote.dart' as _i2;
|
||||
import 'quotes/quote.dart' as _i3;
|
||||
import 'package:wien_talks_client/src/protocol/quotes/quote.dart' as _i4;
|
||||
import 'package:serverpod_auth_client/serverpod_auth_client.dart' as _i5;
|
||||
import 'greeting.dart' as _i2;
|
||||
import 'quotes/create_quote.dart' as _i3;
|
||||
import 'quotes/quote.dart' as _i4;
|
||||
import 'package:wien_talks_client/src/protocol/quotes/quote.dart' as _i5;
|
||||
import 'package:serverpod_auth_client/serverpod_auth_client.dart' as _i6;
|
||||
export 'greeting.dart';
|
||||
export 'quotes/create_quote.dart';
|
||||
export 'quotes/quote.dart';
|
||||
export 'client.dart';
|
||||
|
|
@ -31,17 +33,23 @@ class Protocol extends _i1.SerializationManager {
|
|||
Type? t,
|
||||
]) {
|
||||
t ??= T;
|
||||
if (t == _i2.CreateQuoteRequest) {
|
||||
return _i2.CreateQuoteRequest.fromJson(data) as T;
|
||||
if (t == _i2.Greeting) {
|
||||
return _i2.Greeting.fromJson(data) as T;
|
||||
}
|
||||
if (t == _i3.Quote) {
|
||||
return _i3.Quote.fromJson(data) as T;
|
||||
if (t == _i3.CreateQuoteRequest) {
|
||||
return _i3.CreateQuoteRequest.fromJson(data) as T;
|
||||
}
|
||||
if (t == _i1.getType<_i2.CreateQuoteRequest?>()) {
|
||||
return (data != null ? _i2.CreateQuoteRequest.fromJson(data) : null) as T;
|
||||
if (t == _i4.Quote) {
|
||||
return _i4.Quote.fromJson(data) as T;
|
||||
}
|
||||
if (t == _i1.getType<_i3.Quote?>()) {
|
||||
return (data != null ? _i3.Quote.fromJson(data) : null) as T;
|
||||
if (t == _i1.getType<_i2.Greeting?>()) {
|
||||
return (data != null ? _i2.Greeting.fromJson(data) : null) as T;
|
||||
}
|
||||
if (t == _i1.getType<_i3.CreateQuoteRequest?>()) {
|
||||
return (data != null ? _i3.CreateQuoteRequest.fromJson(data) : null) as T;
|
||||
}
|
||||
if (t == _i1.getType<_i4.Quote?>()) {
|
||||
return (data != null ? _i4.Quote.fromJson(data) : null) as T;
|
||||
}
|
||||
if (t == _i1.getType<List<String>?>()) {
|
||||
return (data != null
|
||||
|
|
@ -53,11 +61,11 @@ class Protocol extends _i1.SerializationManager {
|
|||
? (data as List).map((e) => deserialize<String>(e)).toList()
|
||||
: null) as T;
|
||||
}
|
||||
if (t == List<_i4.Quote>) {
|
||||
return (data as List).map((e) => deserialize<_i4.Quote>(e)).toList() as T;
|
||||
if (t == List<_i5.Quote>) {
|
||||
return (data as List).map((e) => deserialize<_i5.Quote>(e)).toList() as T;
|
||||
}
|
||||
try {
|
||||
return _i5.Protocol().deserialize<T>(data, t);
|
||||
return _i6.Protocol().deserialize<T>(data, t);
|
||||
} on _i1.DeserializationTypeNotFoundException catch (_) {}
|
||||
return super.deserialize<T>(data, t);
|
||||
}
|
||||
|
|
@ -66,13 +74,16 @@ class Protocol extends _i1.SerializationManager {
|
|||
String? getClassNameForObject(Object? data) {
|
||||
String? className = super.getClassNameForObject(data);
|
||||
if (className != null) return className;
|
||||
if (data is _i2.CreateQuoteRequest) {
|
||||
if (data is _i2.Greeting) {
|
||||
return 'Greeting';
|
||||
}
|
||||
if (data is _i3.CreateQuoteRequest) {
|
||||
return 'CreateQuoteRequest';
|
||||
}
|
||||
if (data is _i3.Quote) {
|
||||
if (data is _i4.Quote) {
|
||||
return 'Quote';
|
||||
}
|
||||
className = _i5.Protocol().getClassNameForObject(data);
|
||||
className = _i6.Protocol().getClassNameForObject(data);
|
||||
if (className != null) {
|
||||
return 'serverpod_auth.$className';
|
||||
}
|
||||
|
|
@ -85,15 +96,18 @@ class Protocol extends _i1.SerializationManager {
|
|||
if (dataClassName is! String) {
|
||||
return super.deserializeByClassName(data);
|
||||
}
|
||||
if (dataClassName == 'Greeting') {
|
||||
return deserialize<_i2.Greeting>(data['data']);
|
||||
}
|
||||
if (dataClassName == 'CreateQuoteRequest') {
|
||||
return deserialize<_i2.CreateQuoteRequest>(data['data']);
|
||||
return deserialize<_i3.CreateQuoteRequest>(data['data']);
|
||||
}
|
||||
if (dataClassName == 'Quote') {
|
||||
return deserialize<_i3.Quote>(data['data']);
|
||||
return deserialize<_i4.Quote>(data['data']);
|
||||
}
|
||||
if (dataClassName.startsWith('serverpod_auth.')) {
|
||||
data['className'] = dataClassName.substring(15);
|
||||
return _i5.Protocol().deserializeByClassName(data);
|
||||
return _i6.Protocol().deserializeByClassName(data);
|
||||
}
|
||||
return super.deserializeByClassName(data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,6 +47,75 @@ class MyApp extends StatelessWidget {
|
|||
}
|
||||
}
|
||||
|
||||
class MyHomePage extends StatefulWidget {
|
||||
const MyHomePage({super.key, required this.title});
|
||||
|
||||
final String title;
|
||||
|
||||
@override
|
||||
MyHomePageState createState() => MyHomePageState();
|
||||
}
|
||||
|
||||
class MyHomePageState extends State<MyHomePage> {
|
||||
/// Holds the last result or null if no result exists yet.
|
||||
String? _resultMessage;
|
||||
|
||||
/// Holds the last error message that we've received from the server or null
|
||||
/// if no error exists yet.
|
||||
String? _errorMessage;
|
||||
|
||||
final _textEditingController = TextEditingController();
|
||||
|
||||
/// Calls the `hello` method of the `greeting` endpoint. Will set either the
|
||||
/// `_resultMessage` or `_errorMessage` field, depending on if the call
|
||||
/// is successful.
|
||||
void _callHello() async {
|
||||
try {
|
||||
final result = await client.greeting.hello(_textEditingController.text);
|
||||
setState(() {
|
||||
_errorMessage = null;
|
||||
_resultMessage = result.message;
|
||||
});
|
||||
} catch (e) {
|
||||
setState(() {
|
||||
_errorMessage = '$e';
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: Text(widget.title)),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 16.0),
|
||||
child: TextField(
|
||||
controller: _textEditingController,
|
||||
decoration: const InputDecoration(hintText: 'Enter your name'),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 16.0),
|
||||
child: ElevatedButton(
|
||||
onPressed: _callHello,
|
||||
child: const Text('Send to Server'),
|
||||
),
|
||||
),
|
||||
ResultDisplay(
|
||||
resultMessage: _resultMessage,
|
||||
errorMessage: _errorMessage,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// ResultDisplays shows the result of the call. Either the returned result
|
||||
/// from the `example.greeting` endpoint method or an error message.
|
||||
class ResultDisplay extends StatelessWidget {
|
||||
|
|
|
|||
|
|
@ -11,6 +11,21 @@ class NewsScreen extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var column = Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
HeadingText(text: "Latest news"),
|
||||
...[Text("News 1"), Text("News 2")],
|
||||
SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
OutlinedButton(
|
||||
onPressed: () {
|
||||
context.pushNamed("create_event");
|
||||
},
|
||||
child: Text("Submit your own event")),
|
||||
],
|
||||
);
|
||||
return ScreenWidget(
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import Foundation
|
|||
import connectivity_plus
|
||||
import file_picker
|
||||
import file_selector_macos
|
||||
import google_sign_in_ios
|
||||
import location
|
||||
import path_provider_foundation
|
||||
import shared_preferences_foundation
|
||||
|
|
@ -18,7 +17,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
|||
ConnectivityPlusPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlusPlugin"))
|
||||
FilePickerPlugin.register(with: registry.registrar(forPlugin: "FilePickerPlugin"))
|
||||
FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))
|
||||
FLTGoogleSignInPlugin.register(with: registry.registrar(forPlugin: "FLTGoogleSignInPlugin"))
|
||||
LocationPlugin.register(with: registry.registrar(forPlugin: "LocationPlugin"))
|
||||
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
||||
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
|
||||
|
|
|
|||
|
|
@ -45,7 +45,6 @@ dependencies:
|
|||
# The following adds the Cupertino Icons font to your application.
|
||||
# Use with the CupertinoIcons class for iOS style icons.
|
||||
cupertino_icons: ^1.0.8
|
||||
google_sign_in: ^7.1.1
|
||||
|
||||
dev_dependencies:
|
||||
flutter_lints: '>=3.0.0 <7.0.0'
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ COMPOSE_PROJECT := $(shell basename $(shell pwd))
|
|||
.env: .env.template
|
||||
cp -a .env.template .env
|
||||
|
||||
.PHONY: local local-env local-stop local-down local-clean
|
||||
.PHONY := local local-env local-stop local-down local-clean
|
||||
local: .env
|
||||
docker compose -f $(COMPOSE_FILE_LOCAL) up -d
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
import 'package:serverpod/serverpod.dart';
|
||||
import 'package:serverpod_auth_server/serverpod_auth_server.dart' as auth;
|
||||
import 'package:wien_talks_server/src/birthday_reminder.dart';
|
||||
import 'package:wien_talks_server/src/web/routes/root.dart';
|
||||
|
||||
import 'src/generated/endpoints.dart';
|
||||
import 'src/generated/protocol.dart';
|
||||
|
||||
// This is the starting point of your Serverpod server. In most cases, you will
|
||||
// only need to make additions to this file if you add future calls, are
|
||||
|
|
@ -12,7 +14,7 @@ void run(List<String> args) async {
|
|||
// Initialize Serverpod and connect it with your generated code.
|
||||
final pod = Serverpod(
|
||||
args,
|
||||
auth.Protocol(),
|
||||
Protocol(),
|
||||
Endpoints(),
|
||||
authenticationHandler: auth.authenticationHandler,
|
||||
);
|
||||
|
|
@ -36,8 +38,28 @@ void run(List<String> args) async {
|
|||
// the background. Their schedule is persisted to the database, so you will
|
||||
// not lose them if the server is restarted.
|
||||
|
||||
pod.registerFutureCall(
|
||||
BirthdayReminder(),
|
||||
FutureCallNames.birthdayReminder.name,
|
||||
);
|
||||
|
||||
// You can schedule future calls for a later time during startup. But you can
|
||||
// also schedule them in any endpoint or webroute through the session object.
|
||||
// there is also [futureCallAtTime] if you want to schedule a future call at a
|
||||
// specific time.
|
||||
await pod.futureCallWithDelay(
|
||||
FutureCallNames.birthdayReminder.name,
|
||||
Greeting(
|
||||
message: 'Hello!',
|
||||
author: 'Serverpod Server',
|
||||
timestamp: DateTime.now(),
|
||||
),
|
||||
Duration(seconds: 5),
|
||||
);
|
||||
}
|
||||
|
||||
/// Names of all future calls in the server.
|
||||
///
|
||||
/// This is better than using a string literal, as it will reduce the risk of
|
||||
/// typos and make it easier to refactor the code.
|
||||
enum FutureCallNames { birthdayReminder }
|
||||
|
|
|
|||
18
wien_talks/wien_talks_server/lib/src/birthday_reminder.dart
Normal file
18
wien_talks/wien_talks_server/lib/src/birthday_reminder.dart
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import 'package:wien_talks_server/src/generated/protocol.dart';
|
||||
import 'package:serverpod/serverpod.dart';
|
||||
|
||||
/// This is a simple example of a future call that logs a birthday reminder.
|
||||
///
|
||||
/// In a real-world application, you would implement the logic to send a
|
||||
/// an email or a push notification to the user.
|
||||
class BirthdayReminder extends FutureCall<Greeting> {
|
||||
@override
|
||||
Future<void> invoke(Session session, Greeting? object) async {
|
||||
// This is where you would implement the logic to send a birthday reminder.
|
||||
// For example, you could send an email or a notification to the user.
|
||||
// You can access the user information from the `object` parameter if
|
||||
// needed.
|
||||
|
||||
session.log('${object?.message} Remember to send a birthday card!');
|
||||
}
|
||||
}
|
||||
|
|
@ -10,23 +10,54 @@
|
|||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'package:serverpod/serverpod.dart' as _i1;
|
||||
import '../quotes/quotes_endpoint.dart' as _i2;
|
||||
import 'package:wien_talks_server/src/generated/quotes/quote.dart' as _i3;
|
||||
import '../greeting_endpoint.dart' as _i2;
|
||||
import '../quotes/quotes_endpoint.dart' as _i3;
|
||||
import 'package:wien_talks_server/src/generated/quotes/quote.dart' as _i4;
|
||||
import 'package:wien_talks_server/src/generated/quotes/create_quote.dart'
|
||||
as _i4;
|
||||
import 'package:serverpod_auth_server/serverpod_auth_server.dart' as _i5;
|
||||
as _i5;
|
||||
import 'package:serverpod_auth_server/serverpod_auth_server.dart' as _i6;
|
||||
|
||||
class Endpoints extends _i1.EndpointDispatch {
|
||||
@override
|
||||
void initializeEndpoints(_i1.Server server) {
|
||||
var endpoints = <String, _i1.Endpoint>{
|
||||
'quote': _i2.QuoteEndpoint()
|
||||
'greeting': _i2.GreetingEndpoint()
|
||||
..initialize(
|
||||
server,
|
||||
'greeting',
|
||||
null,
|
||||
),
|
||||
'quote': _i3.QuoteEndpoint()
|
||||
..initialize(
|
||||
server,
|
||||
'quote',
|
||||
null,
|
||||
)
|
||||
),
|
||||
};
|
||||
connectors['greeting'] = _i1.EndpointConnector(
|
||||
name: 'greeting',
|
||||
endpoint: endpoints['greeting']!,
|
||||
methodConnectors: {
|
||||
'hello': _i1.MethodConnector(
|
||||
name: 'hello',
|
||||
params: {
|
||||
'name': _i1.ParameterDescription(
|
||||
name: 'name',
|
||||
type: _i1.getType<String>(),
|
||||
nullable: false,
|
||||
)
|
||||
},
|
||||
call: (
|
||||
_i1.Session session,
|
||||
Map<String, dynamic> params,
|
||||
) async =>
|
||||
(endpoints['greeting'] as _i2.GreetingEndpoint).hello(
|
||||
session,
|
||||
params['name'],
|
||||
),
|
||||
)
|
||||
},
|
||||
);
|
||||
connectors['quote'] = _i1.EndpointConnector(
|
||||
name: 'quote',
|
||||
endpoint: endpoints['quote']!,
|
||||
|
|
@ -36,7 +67,7 @@ class Endpoints extends _i1.EndpointDispatch {
|
|||
params: {
|
||||
'quote': _i1.ParameterDescription(
|
||||
name: 'quote',
|
||||
type: _i1.getType<_i3.Quote>(),
|
||||
type: _i1.getType<_i4.Quote>(),
|
||||
nullable: false,
|
||||
)
|
||||
},
|
||||
|
|
@ -44,7 +75,7 @@ class Endpoints extends _i1.EndpointDispatch {
|
|||
_i1.Session session,
|
||||
Map<String, dynamic> params,
|
||||
) async =>
|
||||
(endpoints['quote'] as _i2.QuoteEndpoint).updateQuote(
|
||||
(endpoints['quote'] as _i3.QuoteEndpoint).updateQuote(
|
||||
session,
|
||||
params['quote'],
|
||||
),
|
||||
|
|
@ -54,7 +85,7 @@ class Endpoints extends _i1.EndpointDispatch {
|
|||
params: {
|
||||
'req': _i1.ParameterDescription(
|
||||
name: 'req',
|
||||
type: _i1.getType<_i4.CreateQuoteRequest>(),
|
||||
type: _i1.getType<_i5.CreateQuoteRequest>(),
|
||||
nullable: false,
|
||||
)
|
||||
},
|
||||
|
|
@ -62,7 +93,7 @@ class Endpoints extends _i1.EndpointDispatch {
|
|||
_i1.Session session,
|
||||
Map<String, dynamic> params,
|
||||
) async =>
|
||||
(endpoints['quote'] as _i2.QuoteEndpoint).createQuote(
|
||||
(endpoints['quote'] as _i3.QuoteEndpoint).createQuote(
|
||||
session,
|
||||
params['req'],
|
||||
),
|
||||
|
|
@ -80,7 +111,7 @@ class Endpoints extends _i1.EndpointDispatch {
|
|||
_i1.Session session,
|
||||
Map<String, dynamic> params,
|
||||
) async =>
|
||||
(endpoints['quote'] as _i2.QuoteEndpoint).getQuoteById(
|
||||
(endpoints['quote'] as _i3.QuoteEndpoint).getQuoteById(
|
||||
session,
|
||||
params['id'],
|
||||
),
|
||||
|
|
@ -92,7 +123,7 @@ class Endpoints extends _i1.EndpointDispatch {
|
|||
_i1.Session session,
|
||||
Map<String, dynamic> params,
|
||||
) async =>
|
||||
(endpoints['quote'] as _i2.QuoteEndpoint).getAllQuotes(session),
|
||||
(endpoints['quote'] as _i3.QuoteEndpoint).getAllQuotes(session),
|
||||
),
|
||||
'quoteUpdates': _i1.MethodStreamConnector(
|
||||
name: 'quoteUpdates',
|
||||
|
|
@ -104,10 +135,10 @@ class Endpoints extends _i1.EndpointDispatch {
|
|||
Map<String, dynamic> params,
|
||||
Map<String, Stream> streamParams,
|
||||
) =>
|
||||
(endpoints['quote'] as _i2.QuoteEndpoint).quoteUpdates(session),
|
||||
(endpoints['quote'] as _i3.QuoteEndpoint).quoteUpdates(session),
|
||||
),
|
||||
},
|
||||
);
|
||||
modules['serverpod_auth'] = _i5.Endpoints()..initializeEndpoints(server);
|
||||
modules['serverpod_auth'] = _i6.Endpoints()..initializeEndpoints(server);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
105
wien_talks/wien_talks_server/lib/src/generated/greeting.dart
Normal file
105
wien_talks/wien_talks_server/lib/src/generated/greeting.dart
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
/* AUTOMATICALLY GENERATED CODE DO NOT MODIFY */
|
||||
/* To generate run: "serverpod generate" */
|
||||
|
||||
// ignore_for_file: implementation_imports
|
||||
// ignore_for_file: library_private_types_in_public_api
|
||||
// ignore_for_file: non_constant_identifier_names
|
||||
// ignore_for_file: public_member_api_docs
|
||||
// ignore_for_file: type_literal_in_constant_pattern
|
||||
// ignore_for_file: use_super_parameters
|
||||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'package:serverpod/serverpod.dart' as _i1;
|
||||
|
||||
/// A greeting message which can be sent to or from the server.
|
||||
abstract class Greeting
|
||||
implements _i1.SerializableModel, _i1.ProtocolSerialization {
|
||||
Greeting._({
|
||||
required this.message,
|
||||
required this.author,
|
||||
required this.timestamp,
|
||||
});
|
||||
|
||||
factory Greeting({
|
||||
required String message,
|
||||
required String author,
|
||||
required DateTime timestamp,
|
||||
}) = _GreetingImpl;
|
||||
|
||||
factory Greeting.fromJson(Map<String, dynamic> jsonSerialization) {
|
||||
return Greeting(
|
||||
message: jsonSerialization['message'] as String,
|
||||
author: jsonSerialization['author'] as String,
|
||||
timestamp:
|
||||
_i1.DateTimeJsonExtension.fromJson(jsonSerialization['timestamp']),
|
||||
);
|
||||
}
|
||||
|
||||
/// The greeting message.
|
||||
String message;
|
||||
|
||||
/// The author of the greeting message.
|
||||
String author;
|
||||
|
||||
/// The time when the message was created.
|
||||
DateTime timestamp;
|
||||
|
||||
/// Returns a shallow copy of this [Greeting]
|
||||
/// with some or all fields replaced by the given arguments.
|
||||
@_i1.useResult
|
||||
Greeting copyWith({
|
||||
String? message,
|
||||
String? author,
|
||||
DateTime? timestamp,
|
||||
});
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'message': message,
|
||||
'author': author,
|
||||
'timestamp': timestamp.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJsonForProtocol() {
|
||||
return {
|
||||
'message': message,
|
||||
'author': author,
|
||||
'timestamp': timestamp.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return _i1.SerializationManager.encode(this);
|
||||
}
|
||||
}
|
||||
|
||||
class _GreetingImpl extends Greeting {
|
||||
_GreetingImpl({
|
||||
required String message,
|
||||
required String author,
|
||||
required DateTime timestamp,
|
||||
}) : super._(
|
||||
message: message,
|
||||
author: author,
|
||||
timestamp: timestamp,
|
||||
);
|
||||
|
||||
/// Returns a shallow copy of this [Greeting]
|
||||
/// with some or all fields replaced by the given arguments.
|
||||
@_i1.useResult
|
||||
@override
|
||||
Greeting copyWith({
|
||||
String? message,
|
||||
String? author,
|
||||
DateTime? timestamp,
|
||||
}) {
|
||||
return Greeting(
|
||||
message: message ?? this.message,
|
||||
author: author ?? this.author,
|
||||
timestamp: timestamp ?? this.timestamp,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -12,9 +12,11 @@
|
|||
import 'package:serverpod/serverpod.dart' as _i1;
|
||||
import 'package:serverpod/protocol.dart' as _i2;
|
||||
import 'package:serverpod_auth_server/serverpod_auth_server.dart' as _i3;
|
||||
import 'quotes/create_quote.dart' as _i4;
|
||||
import 'quotes/quote.dart' as _i5;
|
||||
import 'package:wien_talks_server/src/generated/quotes/quote.dart' as _i6;
|
||||
import 'greeting.dart' as _i4;
|
||||
import 'quotes/create_quote.dart' as _i5;
|
||||
import 'quotes/quote.dart' as _i6;
|
||||
import 'package:wien_talks_server/src/generated/quotes/quote.dart' as _i7;
|
||||
export 'greeting.dart';
|
||||
export 'quotes/create_quote.dart';
|
||||
export 'quotes/quote.dart';
|
||||
|
||||
|
|
@ -128,17 +130,23 @@ class Protocol extends _i1.SerializationManagerServer {
|
|||
Type? t,
|
||||
]) {
|
||||
t ??= T;
|
||||
if (t == _i4.CreateQuoteRequest) {
|
||||
return _i4.CreateQuoteRequest.fromJson(data) as T;
|
||||
if (t == _i4.Greeting) {
|
||||
return _i4.Greeting.fromJson(data) as T;
|
||||
}
|
||||
if (t == _i5.Quote) {
|
||||
return _i5.Quote.fromJson(data) as T;
|
||||
if (t == _i5.CreateQuoteRequest) {
|
||||
return _i5.CreateQuoteRequest.fromJson(data) as T;
|
||||
}
|
||||
if (t == _i1.getType<_i4.CreateQuoteRequest?>()) {
|
||||
return (data != null ? _i4.CreateQuoteRequest.fromJson(data) : null) as T;
|
||||
if (t == _i6.Quote) {
|
||||
return _i6.Quote.fromJson(data) as T;
|
||||
}
|
||||
if (t == _i1.getType<_i5.Quote?>()) {
|
||||
return (data != null ? _i5.Quote.fromJson(data) : null) as T;
|
||||
if (t == _i1.getType<_i4.Greeting?>()) {
|
||||
return (data != null ? _i4.Greeting.fromJson(data) : null) as T;
|
||||
}
|
||||
if (t == _i1.getType<_i5.CreateQuoteRequest?>()) {
|
||||
return (data != null ? _i5.CreateQuoteRequest.fromJson(data) : null) as T;
|
||||
}
|
||||
if (t == _i1.getType<_i6.Quote?>()) {
|
||||
return (data != null ? _i6.Quote.fromJson(data) : null) as T;
|
||||
}
|
||||
if (t == _i1.getType<List<String>?>()) {
|
||||
return (data != null
|
||||
|
|
@ -150,8 +158,8 @@ class Protocol extends _i1.SerializationManagerServer {
|
|||
? (data as List).map((e) => deserialize<String>(e)).toList()
|
||||
: null) as T;
|
||||
}
|
||||
if (t == List<_i6.Quote>) {
|
||||
return (data as List).map((e) => deserialize<_i6.Quote>(e)).toList() as T;
|
||||
if (t == List<_i7.Quote>) {
|
||||
return (data as List).map((e) => deserialize<_i7.Quote>(e)).toList() as T;
|
||||
}
|
||||
try {
|
||||
return _i3.Protocol().deserialize<T>(data, t);
|
||||
|
|
@ -166,10 +174,13 @@ class Protocol extends _i1.SerializationManagerServer {
|
|||
String? getClassNameForObject(Object? data) {
|
||||
String? className = super.getClassNameForObject(data);
|
||||
if (className != null) return className;
|
||||
if (data is _i4.CreateQuoteRequest) {
|
||||
if (data is _i4.Greeting) {
|
||||
return 'Greeting';
|
||||
}
|
||||
if (data is _i5.CreateQuoteRequest) {
|
||||
return 'CreateQuoteRequest';
|
||||
}
|
||||
if (data is _i5.Quote) {
|
||||
if (data is _i6.Quote) {
|
||||
return 'Quote';
|
||||
}
|
||||
className = _i2.Protocol().getClassNameForObject(data);
|
||||
|
|
@ -189,11 +200,14 @@ class Protocol extends _i1.SerializationManagerServer {
|
|||
if (dataClassName is! String) {
|
||||
return super.deserializeByClassName(data);
|
||||
}
|
||||
if (dataClassName == 'Greeting') {
|
||||
return deserialize<_i4.Greeting>(data['data']);
|
||||
}
|
||||
if (dataClassName == 'CreateQuoteRequest') {
|
||||
return deserialize<_i4.CreateQuoteRequest>(data['data']);
|
||||
return deserialize<_i5.CreateQuoteRequest>(data['data']);
|
||||
}
|
||||
if (dataClassName == 'Quote') {
|
||||
return deserialize<_i5.Quote>(data['data']);
|
||||
return deserialize<_i6.Quote>(data['data']);
|
||||
}
|
||||
if (dataClassName.startsWith('serverpod.')) {
|
||||
data['className'] = dataClassName.substring(10);
|
||||
|
|
@ -221,8 +235,8 @@ class Protocol extends _i1.SerializationManagerServer {
|
|||
}
|
||||
}
|
||||
switch (t) {
|
||||
case _i5.Quote:
|
||||
return _i5.Quote.t;
|
||||
case _i6.Quote:
|
||||
return _i6.Quote.t;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
greeting:
|
||||
- hello:
|
||||
quote:
|
||||
- updateQuote:
|
||||
- quoteUpdates:
|
||||
|
|
|
|||
24
wien_talks/wien_talks_server/lib/src/greeting.spy.yaml
Normal file
24
wien_talks/wien_talks_server/lib/src/greeting.spy.yaml
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
# Yaml-files in the `models` directory specify which serializable objects
|
||||
# should be generated. When you add or modify a file, you will need to run
|
||||
# `serverpod generate` to make the generated classes available in the server and
|
||||
# client.
|
||||
#
|
||||
# Please consult the documentation for more information on what you can add to
|
||||
# your yaml-files.
|
||||
|
||||
### A greeting message which can be sent to or from the server.
|
||||
class: Greeting
|
||||
|
||||
# Add the table key, if this class represents a row in the database.
|
||||
#table: greeting
|
||||
|
||||
# The fields (and columns if connected to the database) of the class.
|
||||
# For a list of supported types, please see the documentation.
|
||||
# https://docs.serverpod.dev/concepts/working-with-endpoints
|
||||
fields:
|
||||
### The greeting message.
|
||||
message: String
|
||||
### The author of the greeting message.
|
||||
author: String
|
||||
### The time when the message was created.
|
||||
timestamp: DateTime
|
||||
34
wien_talks/wien_talks_server/lib/src/greeting_endpoint.dart
Normal file
34
wien_talks/wien_talks_server/lib/src/greeting_endpoint.dart
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
import 'generated/protocol.dart';
|
||||
import 'package:serverpod/serverpod.dart';
|
||||
|
||||
// This is an example endpoint of your server. It's best practice to use the
|
||||
// `Endpoint` ending of the class name, but it will be removed when accessing
|
||||
// the endpoint from the client. I.e., this endpoint can be accessed through
|
||||
// `client.greeting` on the client side.
|
||||
|
||||
// After adding or modifying an endpoint, you will need to run
|
||||
// `serverpod generate` to update the server and client code.
|
||||
|
||||
/// This is an example endpoint that returns a greeting message through
|
||||
/// its [hello] method.
|
||||
class GreetingEndpoint extends Endpoint {
|
||||
// This method is called when the client calls the `hello` method on the
|
||||
// `greeting` endpoint.
|
||||
//
|
||||
// The `Session` parameter contains the context of the client request.
|
||||
// It provides access to the database and other server-side resources like
|
||||
// secrets from your password file, the cache, storage, and server-event
|
||||
// messaging.
|
||||
//
|
||||
// You can use any serializable type as a parameter or return type, read more
|
||||
// in the [docs](https://docs.serverpod.dev/concepts/working-with-endpoints).
|
||||
|
||||
/// Returns a personalized greeting message: "Hello {name}".
|
||||
Future<Greeting> hello(Session session, String name) async {
|
||||
return Greeting(
|
||||
message: 'Hello $name',
|
||||
author: 'Serverpod',
|
||||
timestamp: DateTime.now(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,3 @@
|
|||
import 'dart:math';
|
||||
|
||||
import 'package:serverpod/serverpod.dart';
|
||||
import 'package:wien_talks_server/src/generated/protocol.dart';
|
||||
import 'package:wien_talks_server/src/quotes/quote_util.dart';
|
||||
|
|
@ -23,14 +21,21 @@ class QuoteEndpoint extends Endpoint {
|
|||
|
||||
Future<Quote> createQuote(Session session, CreateQuoteRequest req) async {
|
||||
final authInfo = await session.authenticated;
|
||||
final userId = Random().nextInt(100);
|
||||
final userId = authInfo?.userId;
|
||||
|
||||
if (userId == null) {
|
||||
throw Exception('Not signed in');
|
||||
}
|
||||
|
||||
String text = validateQuote(req);
|
||||
|
||||
final quote = Quote(
|
||||
id: 0,
|
||||
userId: userId,
|
||||
text: text,
|
||||
authorName: req.authorName,
|
||||
authorName: req.authorName?.trim().isEmpty == true
|
||||
? null
|
||||
: req.authorName!.trim(),
|
||||
lat: req.lat,
|
||||
long: req.lng,
|
||||
createdAt: DateTime.now().toUtc(),
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
import 'package:test/test.dart';
|
||||
|
||||
// Import the generated test helper file, it contains everything you need.
|
||||
import 'test_tools/serverpod_test_tools.dart';
|
||||
|
||||
void main() {
|
||||
// This is an example test that uses the `withServerpod` test helper.
|
||||
// `withServerpod` enables you to call your endpoints directly from the test like regular functions.
|
||||
// Note that after adding or modifying an endpoint, you will need to run
|
||||
// `serverpod generate` to update the test tools code.
|
||||
// Refer to the docs for more information on how to use the test helper.
|
||||
withServerpod('Given Greeting endpoint', (sessionBuilder, endpoints) {
|
||||
test(
|
||||
'when calling `hello` with name then returned greeting includes name',
|
||||
() async {
|
||||
// Call the endpoint method by using the `endpoints` parameter and
|
||||
// pass `sessionBuilder` as a first argument. Refer to the docs on
|
||||
// how to use the `sessionBuilder` to set up different test scenarios.
|
||||
final greeting = await endpoints.greeting.hello(sessionBuilder, 'Bob');
|
||||
expect(greeting.message, 'Hello Bob');
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
|
|
@ -14,9 +14,10 @@
|
|||
import 'package:serverpod_test/serverpod_test.dart' as _i1;
|
||||
import 'package:serverpod/serverpod.dart' as _i2;
|
||||
import 'dart:async' as _i3;
|
||||
import 'package:wien_talks_server/src/generated/quotes/quote.dart' as _i4;
|
||||
import 'package:wien_talks_server/src/generated/greeting.dart' as _i4;
|
||||
import 'package:wien_talks_server/src/generated/quotes/quote.dart' as _i5;
|
||||
import 'package:wien_talks_server/src/generated/quotes/create_quote.dart'
|
||||
as _i5;
|
||||
as _i6;
|
||||
import 'package:wien_talks_server/src/generated/protocol.dart';
|
||||
import 'package:wien_talks_server/src/generated/endpoints.dart';
|
||||
export 'package:serverpod_test/serverpod_test_public_exports.dart';
|
||||
|
|
@ -103,6 +104,8 @@ void withServerpod(
|
|||
}
|
||||
|
||||
class TestEndpoints {
|
||||
late final _GreetingEndpoint greeting;
|
||||
|
||||
late final _QuoteEndpoint quote;
|
||||
}
|
||||
|
||||
|
|
@ -113,6 +116,10 @@ class _InternalTestEndpoints extends TestEndpoints
|
|||
_i2.SerializationManager serializationManager,
|
||||
_i2.EndpointDispatch endpoints,
|
||||
) {
|
||||
greeting = _GreetingEndpoint(
|
||||
endpoints,
|
||||
serializationManager,
|
||||
);
|
||||
quote = _QuoteEndpoint(
|
||||
endpoints,
|
||||
serializationManager,
|
||||
|
|
@ -120,6 +127,46 @@ class _InternalTestEndpoints extends TestEndpoints
|
|||
}
|
||||
}
|
||||
|
||||
class _GreetingEndpoint {
|
||||
_GreetingEndpoint(
|
||||
this._endpointDispatch,
|
||||
this._serializationManager,
|
||||
);
|
||||
|
||||
final _i2.EndpointDispatch _endpointDispatch;
|
||||
|
||||
final _i2.SerializationManager _serializationManager;
|
||||
|
||||
_i3.Future<_i4.Greeting> hello(
|
||||
_i1.TestSessionBuilder sessionBuilder,
|
||||
String name,
|
||||
) async {
|
||||
return _i1.callAwaitableFunctionAndHandleExceptions(() async {
|
||||
var _localUniqueSession =
|
||||
(sessionBuilder as _i1.InternalTestSessionBuilder).internalBuild(
|
||||
endpoint: 'greeting',
|
||||
method: 'hello',
|
||||
);
|
||||
try {
|
||||
var _localCallContext = await _endpointDispatch.getMethodCallContext(
|
||||
createSessionCallback: (_) => _localUniqueSession,
|
||||
endpointPath: 'greeting',
|
||||
methodName: 'hello',
|
||||
parameters: _i1.testObjectToJson({'name': name}),
|
||||
serializationManager: _serializationManager,
|
||||
);
|
||||
var _localReturnValue = await (_localCallContext.method.call(
|
||||
_localUniqueSession,
|
||||
_localCallContext.arguments,
|
||||
) as _i3.Future<_i4.Greeting>);
|
||||
return _localReturnValue;
|
||||
} finally {
|
||||
await _localUniqueSession.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class _QuoteEndpoint {
|
||||
_QuoteEndpoint(
|
||||
this._endpointDispatch,
|
||||
|
|
@ -132,7 +179,7 @@ class _QuoteEndpoint {
|
|||
|
||||
_i3.Future<void> updateQuote(
|
||||
_i1.TestSessionBuilder sessionBuilder,
|
||||
_i4.Quote quote,
|
||||
_i5.Quote quote,
|
||||
) async {
|
||||
return _i1.callAwaitableFunctionAndHandleExceptions(() async {
|
||||
var _localUniqueSession =
|
||||
|
|
@ -159,8 +206,8 @@ class _QuoteEndpoint {
|
|||
});
|
||||
}
|
||||
|
||||
_i3.Stream<_i4.Quote> quoteUpdates(_i1.TestSessionBuilder sessionBuilder) {
|
||||
var _localTestStreamManager = _i1.TestStreamManager<_i4.Quote>();
|
||||
_i3.Stream<_i5.Quote> quoteUpdates(_i1.TestSessionBuilder sessionBuilder) {
|
||||
var _localTestStreamManager = _i1.TestStreamManager<_i5.Quote>();
|
||||
_i1.callStreamFunctionAndHandleExceptions(
|
||||
() async {
|
||||
var _localUniqueSession =
|
||||
|
|
@ -188,9 +235,9 @@ class _QuoteEndpoint {
|
|||
return _localTestStreamManager.outputStreamController.stream;
|
||||
}
|
||||
|
||||
_i3.Future<_i4.Quote> createQuote(
|
||||
_i3.Future<_i5.Quote> createQuote(
|
||||
_i1.TestSessionBuilder sessionBuilder,
|
||||
_i5.CreateQuoteRequest req,
|
||||
_i6.CreateQuoteRequest req,
|
||||
) async {
|
||||
return _i1.callAwaitableFunctionAndHandleExceptions(() async {
|
||||
var _localUniqueSession =
|
||||
|
|
@ -209,7 +256,7 @@ class _QuoteEndpoint {
|
|||
var _localReturnValue = await (_localCallContext.method.call(
|
||||
_localUniqueSession,
|
||||
_localCallContext.arguments,
|
||||
) as _i3.Future<_i4.Quote>);
|
||||
) as _i3.Future<_i5.Quote>);
|
||||
return _localReturnValue;
|
||||
} finally {
|
||||
await _localUniqueSession.close();
|
||||
|
|
@ -217,7 +264,7 @@ class _QuoteEndpoint {
|
|||
});
|
||||
}
|
||||
|
||||
_i3.Future<_i4.Quote> getQuoteById(
|
||||
_i3.Future<_i5.Quote> getQuoteById(
|
||||
_i1.TestSessionBuilder sessionBuilder,
|
||||
int id,
|
||||
) async {
|
||||
|
|
@ -238,7 +285,7 @@ class _QuoteEndpoint {
|
|||
var _localReturnValue = await (_localCallContext.method.call(
|
||||
_localUniqueSession,
|
||||
_localCallContext.arguments,
|
||||
) as _i3.Future<_i4.Quote>);
|
||||
) as _i3.Future<_i5.Quote>);
|
||||
return _localReturnValue;
|
||||
} finally {
|
||||
await _localUniqueSession.close();
|
||||
|
|
@ -246,7 +293,7 @@ class _QuoteEndpoint {
|
|||
});
|
||||
}
|
||||
|
||||
_i3.Future<List<_i4.Quote>> getAllQuotes(
|
||||
_i3.Future<List<_i5.Quote>> getAllQuotes(
|
||||
_i1.TestSessionBuilder sessionBuilder) async {
|
||||
return _i1.callAwaitableFunctionAndHandleExceptions(() async {
|
||||
var _localUniqueSession =
|
||||
|
|
@ -265,7 +312,7 @@ class _QuoteEndpoint {
|
|||
var _localReturnValue = await (_localCallContext.method.call(
|
||||
_localUniqueSession,
|
||||
_localCallContext.arguments,
|
||||
) as _i3.Future<List<_i4.Quote>>);
|
||||
) as _i3.Future<List<_i5.Quote>>);
|
||||
return _localReturnValue;
|
||||
} finally {
|
||||
await _localUniqueSession.close();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue