regenerate endpoint source

This commit is contained in:
tk 2025-08-16 19:37:06 +02:00
parent be2a58cbd9
commit 83f773abe1
15 changed files with 3594 additions and 60 deletions

View file

@ -19,29 +19,29 @@ import 'package:serverpod_auth_client/serverpod_auth_client.dart' as _i7;
import 'protocol.dart' as _i8;
/// {@category Endpoint}
class EndpointShowLatestNewsWidget extends _i1.EndpointRef {
EndpointShowLatestNewsWidget(_i1.EndpointCaller caller) : super(caller);
class EndpointQuote extends _i1.EndpointRef {
EndpointQuote(_i1.EndpointCaller caller) : super(caller);
@override
String get name => 'showLatestNewsWidget';
String get name => 'quote';
_i2.Future<_i3.Quote> createQuote(_i4.CreateQuoteRequest req) =>
caller.callServerEndpoint<_i3.Quote>(
'showLatestNewsWidget',
'quote',
'createQuote',
{'req': req},
);
_i2.Future<void> updateQuote(_i3.Quote quote) =>
caller.callServerEndpoint<void>(
'showLatestNewsWidget',
'quote',
'updateQuote',
{'quote': quote},
);
_i2.Future<List<_i3.Quote>> getAllQuotes() =>
caller.callServerEndpoint<List<_i3.Quote>>(
'showLatestNewsWidget',
'quote',
'getAllQuotes',
{},
);
@ -103,19 +103,22 @@ class Client extends _i1.ServerpodClientShared {
disconnectStreamsOnLostInternetConnection:
disconnectStreamsOnLostInternetConnection,
) {
showLatestNewsWidget = EndpointShowLatestNewsWidget(this);
quote = EndpointQuote(this);
votes = EndpointVotes(this);
modules = Modules(this);
}
late final EndpointShowLatestNewsWidget showLatestNewsWidget;
late final EndpointQuote quote;
late final EndpointVotes votes;
late final Modules modules;
@override
Map<String, _i1.EndpointRef> get endpointRefLookup =>
{'showLatestNewsWidget': showLatestNewsWidget};
Map<String, _i1.EndpointRef> get endpointRefLookup => {
'quote': quote,
'votes': votes,
};
@override
Map<String, _i1.ModuleEndpointCaller> get moduleLookup =>

View file

@ -0,0 +1,120 @@
/* 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;
import '../quotes/quote.dart' as _i2;
abstract class Vote implements _i1.SerializableModel {
Vote._({
this.id,
required this.userId,
required this.createdAt,
required this.quote,
required this.upvote,
});
factory Vote({
int? id,
required int userId,
required DateTime createdAt,
required _i2.Quote quote,
required bool upvote,
}) = _VoteImpl;
factory Vote.fromJson(Map<String, dynamic> jsonSerialization) {
return Vote(
id: jsonSerialization['id'] as int?,
userId: jsonSerialization['userId'] as int,
createdAt:
_i1.DateTimeJsonExtension.fromJson(jsonSerialization['createdAt']),
quote: _i2.Quote.fromJson(
(jsonSerialization['quote'] as Map<String, dynamic>)),
upvote: jsonSerialization['upvote'] as bool,
);
}
/// The database id, set if the object has been inserted into the
/// database or if it has been fetched from the database. Otherwise,
/// the id will be null.
int? id;
int userId;
DateTime createdAt;
_i2.Quote quote;
bool upvote;
/// Returns a shallow copy of this [Vote]
/// with some or all fields replaced by the given arguments.
@_i1.useResult
Vote copyWith({
int? id,
int? userId,
DateTime? createdAt,
_i2.Quote? quote,
bool? upvote,
});
@override
Map<String, dynamic> toJson() {
return {
if (id != null) 'id': id,
'userId': userId,
'createdAt': createdAt.toJson(),
'quote': quote.toJson(),
'upvote': upvote,
};
}
@override
String toString() {
return _i1.SerializationManager.encode(this);
}
}
class _Undefined {}
class _VoteImpl extends Vote {
_VoteImpl({
int? id,
required int userId,
required DateTime createdAt,
required _i2.Quote quote,
required bool upvote,
}) : super._(
id: id,
userId: userId,
createdAt: createdAt,
quote: quote,
upvote: upvote,
);
/// Returns a shallow copy of this [Vote]
/// with some or all fields replaced by the given arguments.
@_i1.useResult
@override
Vote copyWith({
Object? id = _Undefined,
int? userId,
DateTime? createdAt,
_i2.Quote? quote,
bool? upvote,
}) {
return Vote(
id: id is int? ? id : this.id,
userId: userId ?? this.userId,
createdAt: createdAt ?? this.createdAt,
quote: quote ?? this.quote.copyWith(),
upvote: upvote ?? this.upvote,
);
}
}

View file

@ -0,0 +1,108 @@
/* 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;
import '../quotes/quote.dart' as _i2;
abstract class VoteRequest implements _i1.SerializableModel {
VoteRequest._({
this.id,
required this.userId,
required this.quote,
required this.upvote,
});
factory VoteRequest({
int? id,
required int userId,
required _i2.Quote quote,
required bool upvote,
}) = _VoteRequestImpl;
factory VoteRequest.fromJson(Map<String, dynamic> jsonSerialization) {
return VoteRequest(
id: jsonSerialization['id'] as int?,
userId: jsonSerialization['userId'] as int,
quote: _i2.Quote.fromJson(
(jsonSerialization['quote'] as Map<String, dynamic>)),
upvote: jsonSerialization['upvote'] as bool,
);
}
/// The database id, set if the object has been inserted into the
/// database or if it has been fetched from the database. Otherwise,
/// the id will be null.
int? id;
int userId;
_i2.Quote quote;
bool upvote;
/// Returns a shallow copy of this [VoteRequest]
/// with some or all fields replaced by the given arguments.
@_i1.useResult
VoteRequest copyWith({
int? id,
int? userId,
_i2.Quote? quote,
bool? upvote,
});
@override
Map<String, dynamic> toJson() {
return {
if (id != null) 'id': id,
'userId': userId,
'quote': quote.toJson(),
'upvote': upvote,
};
}
@override
String toString() {
return _i1.SerializationManager.encode(this);
}
}
class _Undefined {}
class _VoteRequestImpl extends VoteRequest {
_VoteRequestImpl({
int? id,
required int userId,
required _i2.Quote quote,
required bool upvote,
}) : super._(
id: id,
userId: userId,
quote: quote,
upvote: upvote,
);
/// Returns a shallow copy of this [VoteRequest]
/// with some or all fields replaced by the given arguments.
@_i1.useResult
@override
VoteRequest copyWith({
Object? id = _Undefined,
int? userId,
_i2.Quote? quote,
bool? upvote,
}) {
return VoteRequest(
id: id is int? ? id : this.id,
userId: userId ?? this.userId,
quote: quote ?? this.quote.copyWith(),
upvote: upvote ?? this.upvote,
);
}
}

View file

@ -22,16 +22,22 @@ class Endpoints extends _i1.EndpointDispatch {
@override
void initializeEndpoints(_i1.Server server) {
var endpoints = <String, _i1.Endpoint>{
'showLatestNewsWidget': _i2.ShowLatestNewsWidget()
'quote': _i2.QuoteEndpoint()
..initialize(
server,
'showLatestNewsWidget',
'quote',
null,
)
),
'votes': _i3.VotesEndpoint()
..initialize(
server,
'votes',
null,
),
};
connectors['showLatestNewsWidget'] = _i1.EndpointConnector(
name: 'showLatestNewsWidget',
endpoint: endpoints['showLatestNewsWidget']!,
connectors['quote'] = _i1.EndpointConnector(
name: 'quote',
endpoint: endpoints['quote']!,
methodConnectors: {
'createQuote': _i1.MethodConnector(
name: 'createQuote',
@ -46,8 +52,7 @@ class Endpoints extends _i1.EndpointDispatch {
_i1.Session session,
Map<String, dynamic> params,
) async =>
(endpoints['showLatestNewsWidget'] as _i2.ShowLatestNewsWidget)
.createQuote(
(endpoints['quote'] as _i2.QuoteEndpoint).createQuote(
session,
params['req'],
),
@ -65,8 +70,7 @@ class Endpoints extends _i1.EndpointDispatch {
_i1.Session session,
Map<String, dynamic> params,
) async =>
(endpoints['showLatestNewsWidget'] as _i2.ShowLatestNewsWidget)
.updateQuote(
(endpoints['quote'] as _i2.QuoteEndpoint).updateQuote(
session,
params['quote'],
),
@ -99,8 +103,7 @@ class Endpoints extends _i1.EndpointDispatch {
_i1.Session session,
Map<String, dynamic> params,
) async =>
(endpoints['showLatestNewsWidget'] as _i2.ShowLatestNewsWidget)
.getAllQuotes(
(endpoints['votes'] as _i3.VotesEndpoint).postVote(
session,
params['voteRequest'],
),

View file

@ -0,0 +1,441 @@
/* 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;
import '../quotes/quote.dart' as _i2;
abstract class Vote implements _i1.TableRow<int?>, _i1.ProtocolSerialization {
Vote._({
this.id,
required this.userId,
required this.createdAt,
required this.quote,
required this.upvote,
});
factory Vote({
int? id,
required int userId,
required DateTime createdAt,
required _i2.Quote quote,
required bool upvote,
}) = _VoteImpl;
factory Vote.fromJson(Map<String, dynamic> jsonSerialization) {
return Vote(
id: jsonSerialization['id'] as int?,
userId: jsonSerialization['userId'] as int,
createdAt:
_i1.DateTimeJsonExtension.fromJson(jsonSerialization['createdAt']),
quote: _i2.Quote.fromJson(
(jsonSerialization['quote'] as Map<String, dynamic>)),
upvote: jsonSerialization['upvote'] as bool,
);
}
static final t = VoteTable();
static const db = VoteRepository._();
@override
int? id;
int userId;
DateTime createdAt;
_i2.Quote quote;
bool upvote;
@override
_i1.Table<int?> get table => t;
/// Returns a shallow copy of this [Vote]
/// with some or all fields replaced by the given arguments.
@_i1.useResult
Vote copyWith({
int? id,
int? userId,
DateTime? createdAt,
_i2.Quote? quote,
bool? upvote,
});
@override
Map<String, dynamic> toJson() {
return {
if (id != null) 'id': id,
'userId': userId,
'createdAt': createdAt.toJson(),
'quote': quote.toJson(),
'upvote': upvote,
};
}
@override
Map<String, dynamic> toJsonForProtocol() {
return {
if (id != null) 'id': id,
'userId': userId,
'createdAt': createdAt.toJson(),
'quote': quote.toJsonForProtocol(),
'upvote': upvote,
};
}
static VoteInclude include() {
return VoteInclude._();
}
static VoteIncludeList includeList({
_i1.WhereExpressionBuilder<VoteTable>? where,
int? limit,
int? offset,
_i1.OrderByBuilder<VoteTable>? orderBy,
bool orderDescending = false,
_i1.OrderByListBuilder<VoteTable>? orderByList,
VoteInclude? include,
}) {
return VoteIncludeList._(
where: where,
limit: limit,
offset: offset,
orderBy: orderBy?.call(Vote.t),
orderDescending: orderDescending,
orderByList: orderByList?.call(Vote.t),
include: include,
);
}
@override
String toString() {
return _i1.SerializationManager.encode(this);
}
}
class _Undefined {}
class _VoteImpl extends Vote {
_VoteImpl({
int? id,
required int userId,
required DateTime createdAt,
required _i2.Quote quote,
required bool upvote,
}) : super._(
id: id,
userId: userId,
createdAt: createdAt,
quote: quote,
upvote: upvote,
);
/// Returns a shallow copy of this [Vote]
/// with some or all fields replaced by the given arguments.
@_i1.useResult
@override
Vote copyWith({
Object? id = _Undefined,
int? userId,
DateTime? createdAt,
_i2.Quote? quote,
bool? upvote,
}) {
return Vote(
id: id is int? ? id : this.id,
userId: userId ?? this.userId,
createdAt: createdAt ?? this.createdAt,
quote: quote ?? this.quote.copyWith(),
upvote: upvote ?? this.upvote,
);
}
}
class VoteTable extends _i1.Table<int?> {
VoteTable({super.tableRelation}) : super(tableName: 'vote') {
userId = _i1.ColumnInt(
'userId',
this,
);
createdAt = _i1.ColumnDateTime(
'createdAt',
this,
);
quote = _i1.ColumnSerializable(
'quote',
this,
);
upvote = _i1.ColumnBool(
'upvote',
this,
);
}
late final _i1.ColumnInt userId;
late final _i1.ColumnDateTime createdAt;
late final _i1.ColumnSerializable quote;
late final _i1.ColumnBool upvote;
@override
List<_i1.Column> get columns => [
id,
userId,
createdAt,
quote,
upvote,
];
}
class VoteInclude extends _i1.IncludeObject {
VoteInclude._();
@override
Map<String, _i1.Include?> get includes => {};
@override
_i1.Table<int?> get table => Vote.t;
}
class VoteIncludeList extends _i1.IncludeList {
VoteIncludeList._({
_i1.WhereExpressionBuilder<VoteTable>? where,
super.limit,
super.offset,
super.orderBy,
super.orderDescending,
super.orderByList,
super.include,
}) {
super.where = where?.call(Vote.t);
}
@override
Map<String, _i1.Include?> get includes => include?.includes ?? {};
@override
_i1.Table<int?> get table => Vote.t;
}
class VoteRepository {
const VoteRepository._();
/// Returns a list of [Vote]s matching the given query parameters.
///
/// Use [where] to specify which items to include in the return value.
/// If none is specified, all items will be returned.
///
/// To specify the order of the items use [orderBy] or [orderByList]
/// when sorting by multiple columns.
///
/// The maximum number of items can be set by [limit]. If no limit is set,
/// all items matching the query will be returned.
///
/// [offset] defines how many items to skip, after which [limit] (or all)
/// items are read from the database.
///
/// ```dart
/// var persons = await Persons.db.find(
/// session,
/// where: (t) => t.lastName.equals('Jones'),
/// orderBy: (t) => t.firstName,
/// limit: 100,
/// );
/// ```
Future<List<Vote>> find(
_i1.Session session, {
_i1.WhereExpressionBuilder<VoteTable>? where,
int? limit,
int? offset,
_i1.OrderByBuilder<VoteTable>? orderBy,
bool orderDescending = false,
_i1.OrderByListBuilder<VoteTable>? orderByList,
_i1.Transaction? transaction,
}) async {
return session.db.find<Vote>(
where: where?.call(Vote.t),
orderBy: orderBy?.call(Vote.t),
orderByList: orderByList?.call(Vote.t),
orderDescending: orderDescending,
limit: limit,
offset: offset,
transaction: transaction,
);
}
/// Returns the first matching [Vote] matching the given query parameters.
///
/// Use [where] to specify which items to include in the return value.
/// If none is specified, all items will be returned.
///
/// To specify the order use [orderBy] or [orderByList]
/// when sorting by multiple columns.
///
/// [offset] defines how many items to skip, after which the next one will be picked.
///
/// ```dart
/// var youngestPerson = await Persons.db.findFirstRow(
/// session,
/// where: (t) => t.lastName.equals('Jones'),
/// orderBy: (t) => t.age,
/// );
/// ```
Future<Vote?> findFirstRow(
_i1.Session session, {
_i1.WhereExpressionBuilder<VoteTable>? where,
int? offset,
_i1.OrderByBuilder<VoteTable>? orderBy,
bool orderDescending = false,
_i1.OrderByListBuilder<VoteTable>? orderByList,
_i1.Transaction? transaction,
}) async {
return session.db.findFirstRow<Vote>(
where: where?.call(Vote.t),
orderBy: orderBy?.call(Vote.t),
orderByList: orderByList?.call(Vote.t),
orderDescending: orderDescending,
offset: offset,
transaction: transaction,
);
}
/// Finds a single [Vote] by its [id] or null if no such row exists.
Future<Vote?> findById(
_i1.Session session,
int id, {
_i1.Transaction? transaction,
}) async {
return session.db.findById<Vote>(
id,
transaction: transaction,
);
}
/// Inserts all [Vote]s in the list and returns the inserted rows.
///
/// The returned [Vote]s will have their `id` fields set.
///
/// This is an atomic operation, meaning that if one of the rows fails to
/// insert, none of the rows will be inserted.
Future<List<Vote>> insert(
_i1.Session session,
List<Vote> rows, {
_i1.Transaction? transaction,
}) async {
return session.db.insert<Vote>(
rows,
transaction: transaction,
);
}
/// Inserts a single [Vote] and returns the inserted row.
///
/// The returned [Vote] will have its `id` field set.
Future<Vote> insertRow(
_i1.Session session,
Vote row, {
_i1.Transaction? transaction,
}) async {
return session.db.insertRow<Vote>(
row,
transaction: transaction,
);
}
/// Updates all [Vote]s in the list and returns the updated rows. If
/// [columns] is provided, only those columns will be updated. Defaults to
/// all columns.
/// This is an atomic operation, meaning that if one of the rows fails to
/// update, none of the rows will be updated.
Future<List<Vote>> update(
_i1.Session session,
List<Vote> rows, {
_i1.ColumnSelections<VoteTable>? columns,
_i1.Transaction? transaction,
}) async {
return session.db.update<Vote>(
rows,
columns: columns?.call(Vote.t),
transaction: transaction,
);
}
/// Updates a single [Vote]. The row needs to have its id set.
/// Optionally, a list of [columns] can be provided to only update those
/// columns. Defaults to all columns.
Future<Vote> updateRow(
_i1.Session session,
Vote row, {
_i1.ColumnSelections<VoteTable>? columns,
_i1.Transaction? transaction,
}) async {
return session.db.updateRow<Vote>(
row,
columns: columns?.call(Vote.t),
transaction: transaction,
);
}
/// Deletes all [Vote]s in the list and returns the deleted rows.
/// This is an atomic operation, meaning that if one of the rows fail to
/// be deleted, none of the rows will be deleted.
Future<List<Vote>> delete(
_i1.Session session,
List<Vote> rows, {
_i1.Transaction? transaction,
}) async {
return session.db.delete<Vote>(
rows,
transaction: transaction,
);
}
/// Deletes a single [Vote].
Future<Vote> deleteRow(
_i1.Session session,
Vote row, {
_i1.Transaction? transaction,
}) async {
return session.db.deleteRow<Vote>(
row,
transaction: transaction,
);
}
/// Deletes all rows matching the [where] expression.
Future<List<Vote>> deleteWhere(
_i1.Session session, {
required _i1.WhereExpressionBuilder<VoteTable> where,
_i1.Transaction? transaction,
}) async {
return session.db.deleteWhere<Vote>(
where: where(Vote.t),
transaction: transaction,
);
}
/// Counts the number of rows matching the [where] expression. If omitted,
/// will return the count of all rows in the table.
Future<int> count(
_i1.Session session, {
_i1.WhereExpressionBuilder<VoteTable>? where,
int? limit,
_i1.Transaction? transaction,
}) async {
return session.db.count<Vote>(
where: where?.call(Vote.t),
limit: limit,
transaction: transaction,
);
}
}

View file

@ -0,0 +1,422 @@
/* 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;
import '../quotes/quote.dart' as _i2;
abstract class VoteRequest
implements _i1.TableRow<int?>, _i1.ProtocolSerialization {
VoteRequest._({
this.id,
required this.userId,
required this.quote,
required this.upvote,
});
factory VoteRequest({
int? id,
required int userId,
required _i2.Quote quote,
required bool upvote,
}) = _VoteRequestImpl;
factory VoteRequest.fromJson(Map<String, dynamic> jsonSerialization) {
return VoteRequest(
id: jsonSerialization['id'] as int?,
userId: jsonSerialization['userId'] as int,
quote: _i2.Quote.fromJson(
(jsonSerialization['quote'] as Map<String, dynamic>)),
upvote: jsonSerialization['upvote'] as bool,
);
}
static final t = VoteRequestTable();
static const db = VoteRequestRepository._();
@override
int? id;
int userId;
_i2.Quote quote;
bool upvote;
@override
_i1.Table<int?> get table => t;
/// Returns a shallow copy of this [VoteRequest]
/// with some or all fields replaced by the given arguments.
@_i1.useResult
VoteRequest copyWith({
int? id,
int? userId,
_i2.Quote? quote,
bool? upvote,
});
@override
Map<String, dynamic> toJson() {
return {
if (id != null) 'id': id,
'userId': userId,
'quote': quote.toJson(),
'upvote': upvote,
};
}
@override
Map<String, dynamic> toJsonForProtocol() {
return {
if (id != null) 'id': id,
'userId': userId,
'quote': quote.toJsonForProtocol(),
'upvote': upvote,
};
}
static VoteRequestInclude include() {
return VoteRequestInclude._();
}
static VoteRequestIncludeList includeList({
_i1.WhereExpressionBuilder<VoteRequestTable>? where,
int? limit,
int? offset,
_i1.OrderByBuilder<VoteRequestTable>? orderBy,
bool orderDescending = false,
_i1.OrderByListBuilder<VoteRequestTable>? orderByList,
VoteRequestInclude? include,
}) {
return VoteRequestIncludeList._(
where: where,
limit: limit,
offset: offset,
orderBy: orderBy?.call(VoteRequest.t),
orderDescending: orderDescending,
orderByList: orderByList?.call(VoteRequest.t),
include: include,
);
}
@override
String toString() {
return _i1.SerializationManager.encode(this);
}
}
class _Undefined {}
class _VoteRequestImpl extends VoteRequest {
_VoteRequestImpl({
int? id,
required int userId,
required _i2.Quote quote,
required bool upvote,
}) : super._(
id: id,
userId: userId,
quote: quote,
upvote: upvote,
);
/// Returns a shallow copy of this [VoteRequest]
/// with some or all fields replaced by the given arguments.
@_i1.useResult
@override
VoteRequest copyWith({
Object? id = _Undefined,
int? userId,
_i2.Quote? quote,
bool? upvote,
}) {
return VoteRequest(
id: id is int? ? id : this.id,
userId: userId ?? this.userId,
quote: quote ?? this.quote.copyWith(),
upvote: upvote ?? this.upvote,
);
}
}
class VoteRequestTable extends _i1.Table<int?> {
VoteRequestTable({super.tableRelation}) : super(tableName: 'vote_request') {
userId = _i1.ColumnInt(
'userId',
this,
);
quote = _i1.ColumnSerializable(
'quote',
this,
);
upvote = _i1.ColumnBool(
'upvote',
this,
);
}
late final _i1.ColumnInt userId;
late final _i1.ColumnSerializable quote;
late final _i1.ColumnBool upvote;
@override
List<_i1.Column> get columns => [
id,
userId,
quote,
upvote,
];
}
class VoteRequestInclude extends _i1.IncludeObject {
VoteRequestInclude._();
@override
Map<String, _i1.Include?> get includes => {};
@override
_i1.Table<int?> get table => VoteRequest.t;
}
class VoteRequestIncludeList extends _i1.IncludeList {
VoteRequestIncludeList._({
_i1.WhereExpressionBuilder<VoteRequestTable>? where,
super.limit,
super.offset,
super.orderBy,
super.orderDescending,
super.orderByList,
super.include,
}) {
super.where = where?.call(VoteRequest.t);
}
@override
Map<String, _i1.Include?> get includes => include?.includes ?? {};
@override
_i1.Table<int?> get table => VoteRequest.t;
}
class VoteRequestRepository {
const VoteRequestRepository._();
/// Returns a list of [VoteRequest]s matching the given query parameters.
///
/// Use [where] to specify which items to include in the return value.
/// If none is specified, all items will be returned.
///
/// To specify the order of the items use [orderBy] or [orderByList]
/// when sorting by multiple columns.
///
/// The maximum number of items can be set by [limit]. If no limit is set,
/// all items matching the query will be returned.
///
/// [offset] defines how many items to skip, after which [limit] (or all)
/// items are read from the database.
///
/// ```dart
/// var persons = await Persons.db.find(
/// session,
/// where: (t) => t.lastName.equals('Jones'),
/// orderBy: (t) => t.firstName,
/// limit: 100,
/// );
/// ```
Future<List<VoteRequest>> find(
_i1.Session session, {
_i1.WhereExpressionBuilder<VoteRequestTable>? where,
int? limit,
int? offset,
_i1.OrderByBuilder<VoteRequestTable>? orderBy,
bool orderDescending = false,
_i1.OrderByListBuilder<VoteRequestTable>? orderByList,
_i1.Transaction? transaction,
}) async {
return session.db.find<VoteRequest>(
where: where?.call(VoteRequest.t),
orderBy: orderBy?.call(VoteRequest.t),
orderByList: orderByList?.call(VoteRequest.t),
orderDescending: orderDescending,
limit: limit,
offset: offset,
transaction: transaction,
);
}
/// Returns the first matching [VoteRequest] matching the given query parameters.
///
/// Use [where] to specify which items to include in the return value.
/// If none is specified, all items will be returned.
///
/// To specify the order use [orderBy] or [orderByList]
/// when sorting by multiple columns.
///
/// [offset] defines how many items to skip, after which the next one will be picked.
///
/// ```dart
/// var youngestPerson = await Persons.db.findFirstRow(
/// session,
/// where: (t) => t.lastName.equals('Jones'),
/// orderBy: (t) => t.age,
/// );
/// ```
Future<VoteRequest?> findFirstRow(
_i1.Session session, {
_i1.WhereExpressionBuilder<VoteRequestTable>? where,
int? offset,
_i1.OrderByBuilder<VoteRequestTable>? orderBy,
bool orderDescending = false,
_i1.OrderByListBuilder<VoteRequestTable>? orderByList,
_i1.Transaction? transaction,
}) async {
return session.db.findFirstRow<VoteRequest>(
where: where?.call(VoteRequest.t),
orderBy: orderBy?.call(VoteRequest.t),
orderByList: orderByList?.call(VoteRequest.t),
orderDescending: orderDescending,
offset: offset,
transaction: transaction,
);
}
/// Finds a single [VoteRequest] by its [id] or null if no such row exists.
Future<VoteRequest?> findById(
_i1.Session session,
int id, {
_i1.Transaction? transaction,
}) async {
return session.db.findById<VoteRequest>(
id,
transaction: transaction,
);
}
/// Inserts all [VoteRequest]s in the list and returns the inserted rows.
///
/// The returned [VoteRequest]s will have their `id` fields set.
///
/// This is an atomic operation, meaning that if one of the rows fails to
/// insert, none of the rows will be inserted.
Future<List<VoteRequest>> insert(
_i1.Session session,
List<VoteRequest> rows, {
_i1.Transaction? transaction,
}) async {
return session.db.insert<VoteRequest>(
rows,
transaction: transaction,
);
}
/// Inserts a single [VoteRequest] and returns the inserted row.
///
/// The returned [VoteRequest] will have its `id` field set.
Future<VoteRequest> insertRow(
_i1.Session session,
VoteRequest row, {
_i1.Transaction? transaction,
}) async {
return session.db.insertRow<VoteRequest>(
row,
transaction: transaction,
);
}
/// Updates all [VoteRequest]s in the list and returns the updated rows. If
/// [columns] is provided, only those columns will be updated. Defaults to
/// all columns.
/// This is an atomic operation, meaning that if one of the rows fails to
/// update, none of the rows will be updated.
Future<List<VoteRequest>> update(
_i1.Session session,
List<VoteRequest> rows, {
_i1.ColumnSelections<VoteRequestTable>? columns,
_i1.Transaction? transaction,
}) async {
return session.db.update<VoteRequest>(
rows,
columns: columns?.call(VoteRequest.t),
transaction: transaction,
);
}
/// Updates a single [VoteRequest]. The row needs to have its id set.
/// Optionally, a list of [columns] can be provided to only update those
/// columns. Defaults to all columns.
Future<VoteRequest> updateRow(
_i1.Session session,
VoteRequest row, {
_i1.ColumnSelections<VoteRequestTable>? columns,
_i1.Transaction? transaction,
}) async {
return session.db.updateRow<VoteRequest>(
row,
columns: columns?.call(VoteRequest.t),
transaction: transaction,
);
}
/// Deletes all [VoteRequest]s in the list and returns the deleted rows.
/// This is an atomic operation, meaning that if one of the rows fail to
/// be deleted, none of the rows will be deleted.
Future<List<VoteRequest>> delete(
_i1.Session session,
List<VoteRequest> rows, {
_i1.Transaction? transaction,
}) async {
return session.db.delete<VoteRequest>(
rows,
transaction: transaction,
);
}
/// Deletes a single [VoteRequest].
Future<VoteRequest> deleteRow(
_i1.Session session,
VoteRequest row, {
_i1.Transaction? transaction,
}) async {
return session.db.deleteRow<VoteRequest>(
row,
transaction: transaction,
);
}
/// Deletes all rows matching the [where] expression.
Future<List<VoteRequest>> deleteWhere(
_i1.Session session, {
required _i1.WhereExpressionBuilder<VoteRequestTable> where,
_i1.Transaction? transaction,
}) async {
return session.db.deleteWhere<VoteRequest>(
where: where(VoteRequest.t),
transaction: transaction,
);
}
/// Counts the number of rows matching the [where] expression. If omitted,
/// will return the count of all rows in the table.
Future<int> count(
_i1.Session session, {
_i1.WhereExpressionBuilder<VoteRequestTable>? where,
int? limit,
_i1.Transaction? transaction,
}) async {
return session.db.count<VoteRequest>(
where: where?.call(VoteRequest.t),
limit: limit,
transaction: transaction,
);
}
}

View file

@ -0,0 +1,7 @@
class: Vote
table: vote
fields:
userId: int
createdAt: DateTime
quote: Quote
upvote: bool

View file

@ -0,0 +1,6 @@
class: VoteRequest
table: vote_request
fields:
userId: int
quote: Quote
upvote: bool

View file

@ -0,0 +1,21 @@
import 'package:serverpod/serverpod.dart';
import 'package:wien_talks_server/src/generated/protocol.dart';
class VotesEndpoint extends Endpoint {
Future<Vote> postVote(Session session, VoteRequest voteRequest) async {
final row = Vote(
createdAt: DateTime.now(),
quote: voteRequest.quote,
upvote: voteRequest.upvote,
userId: voteRequest.userId);
final persistedVote = await Vote.db.insertRow(session, row);
return persistedVote;
}
Future<List<Vote>> getAllVotes(Session session) async {
final rows = Vote.db.find(session, limit: 50);
return rows;
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,394 @@
BEGIN;
--
-- Class Quote as table quote
--
CREATE TABLE "quote" (
"id" bigserial PRIMARY KEY,
"userId" bigint NOT NULL,
"text" text NOT NULL,
"authorName" text,
"lat" double precision NOT NULL,
"long" double precision NOT NULL,
"createdAt" timestamp without time zone NOT NULL,
"visibility" bigint NOT NULL,
"upvotes" bigint NOT NULL,
"downvotes" bigint NOT NULL,
"tags" json
);
--
-- Class CloudStorageEntry as table serverpod_cloud_storage
--
CREATE TABLE "serverpod_cloud_storage" (
"id" bigserial PRIMARY KEY,
"storageId" text NOT NULL,
"path" text NOT NULL,
"addedTime" timestamp without time zone NOT NULL,
"expiration" timestamp without time zone,
"byteData" bytea NOT NULL,
"verified" boolean NOT NULL
);
-- Indexes
CREATE UNIQUE INDEX "serverpod_cloud_storage_path_idx" ON "serverpod_cloud_storage" USING btree ("storageId", "path");
CREATE INDEX "serverpod_cloud_storage_expiration" ON "serverpod_cloud_storage" USING btree ("expiration");
--
-- Class CloudStorageDirectUploadEntry as table serverpod_cloud_storage_direct_upload
--
CREATE TABLE "serverpod_cloud_storage_direct_upload" (
"id" bigserial PRIMARY KEY,
"storageId" text NOT NULL,
"path" text NOT NULL,
"expiration" timestamp without time zone NOT NULL,
"authKey" text NOT NULL
);
-- Indexes
CREATE UNIQUE INDEX "serverpod_cloud_storage_direct_upload_storage_path" ON "serverpod_cloud_storage_direct_upload" USING btree ("storageId", "path");
--
-- Class FutureCallEntry as table serverpod_future_call
--
CREATE TABLE "serverpod_future_call" (
"id" bigserial PRIMARY KEY,
"name" text NOT NULL,
"time" timestamp without time zone NOT NULL,
"serializedObject" text,
"serverId" text NOT NULL,
"identifier" text
);
-- Indexes
CREATE INDEX "serverpod_future_call_time_idx" ON "serverpod_future_call" USING btree ("time");
CREATE INDEX "serverpod_future_call_serverId_idx" ON "serverpod_future_call" USING btree ("serverId");
CREATE INDEX "serverpod_future_call_identifier_idx" ON "serverpod_future_call" USING btree ("identifier");
--
-- Class ServerHealthConnectionInfo as table serverpod_health_connection_info
--
CREATE TABLE "serverpod_health_connection_info" (
"id" bigserial PRIMARY KEY,
"serverId" text NOT NULL,
"timestamp" timestamp without time zone NOT NULL,
"active" bigint NOT NULL,
"closing" bigint NOT NULL,
"idle" bigint NOT NULL,
"granularity" bigint NOT NULL
);
-- Indexes
CREATE UNIQUE INDEX "serverpod_health_connection_info_timestamp_idx" ON "serverpod_health_connection_info" USING btree ("timestamp", "serverId", "granularity");
--
-- Class ServerHealthMetric as table serverpod_health_metric
--
CREATE TABLE "serverpod_health_metric" (
"id" bigserial PRIMARY KEY,
"name" text NOT NULL,
"serverId" text NOT NULL,
"timestamp" timestamp without time zone NOT NULL,
"isHealthy" boolean NOT NULL,
"value" double precision NOT NULL,
"granularity" bigint NOT NULL
);
-- Indexes
CREATE UNIQUE INDEX "serverpod_health_metric_timestamp_idx" ON "serverpod_health_metric" USING btree ("timestamp", "serverId", "name", "granularity");
--
-- Class LogEntry as table serverpod_log
--
CREATE TABLE "serverpod_log" (
"id" bigserial PRIMARY KEY,
"sessionLogId" bigint NOT NULL,
"messageId" bigint,
"reference" text,
"serverId" text NOT NULL,
"time" timestamp without time zone NOT NULL,
"logLevel" bigint NOT NULL,
"message" text NOT NULL,
"error" text,
"stackTrace" text,
"order" bigint NOT NULL
);
-- Indexes
CREATE INDEX "serverpod_log_sessionLogId_idx" ON "serverpod_log" USING btree ("sessionLogId");
--
-- Class MessageLogEntry as table serverpod_message_log
--
CREATE TABLE "serverpod_message_log" (
"id" bigserial PRIMARY KEY,
"sessionLogId" bigint NOT NULL,
"serverId" text NOT NULL,
"messageId" bigint NOT NULL,
"endpoint" text NOT NULL,
"messageName" text NOT NULL,
"duration" double precision NOT NULL,
"error" text,
"stackTrace" text,
"slow" boolean NOT NULL,
"order" bigint NOT NULL
);
--
-- Class MethodInfo as table serverpod_method
--
CREATE TABLE "serverpod_method" (
"id" bigserial PRIMARY KEY,
"endpoint" text NOT NULL,
"method" text NOT NULL
);
-- Indexes
CREATE UNIQUE INDEX "serverpod_method_endpoint_method_idx" ON "serverpod_method" USING btree ("endpoint", "method");
--
-- Class DatabaseMigrationVersion as table serverpod_migrations
--
CREATE TABLE "serverpod_migrations" (
"id" bigserial PRIMARY KEY,
"module" text NOT NULL,
"version" text NOT NULL,
"timestamp" timestamp without time zone
);
-- Indexes
CREATE UNIQUE INDEX "serverpod_migrations_ids" ON "serverpod_migrations" USING btree ("module");
--
-- Class QueryLogEntry as table serverpod_query_log
--
CREATE TABLE "serverpod_query_log" (
"id" bigserial PRIMARY KEY,
"serverId" text NOT NULL,
"sessionLogId" bigint NOT NULL,
"messageId" bigint,
"query" text NOT NULL,
"duration" double precision NOT NULL,
"numRows" bigint,
"error" text,
"stackTrace" text,
"slow" boolean NOT NULL,
"order" bigint NOT NULL
);
-- Indexes
CREATE INDEX "serverpod_query_log_sessionLogId_idx" ON "serverpod_query_log" USING btree ("sessionLogId");
--
-- Class ReadWriteTestEntry as table serverpod_readwrite_test
--
CREATE TABLE "serverpod_readwrite_test" (
"id" bigserial PRIMARY KEY,
"number" bigint NOT NULL
);
--
-- Class RuntimeSettings as table serverpod_runtime_settings
--
CREATE TABLE "serverpod_runtime_settings" (
"id" bigserial PRIMARY KEY,
"logSettings" json NOT NULL,
"logSettingsOverrides" json NOT NULL,
"logServiceCalls" boolean NOT NULL,
"logMalformedCalls" boolean NOT NULL
);
--
-- Class SessionLogEntry as table serverpod_session_log
--
CREATE TABLE "serverpod_session_log" (
"id" bigserial PRIMARY KEY,
"serverId" text NOT NULL,
"time" timestamp without time zone NOT NULL,
"module" text,
"endpoint" text,
"method" text,
"duration" double precision,
"numQueries" bigint,
"slow" boolean,
"error" text,
"stackTrace" text,
"authenticatedUserId" bigint,
"isOpen" boolean,
"touched" timestamp without time zone NOT NULL
);
-- Indexes
CREATE INDEX "serverpod_session_log_serverid_idx" ON "serverpod_session_log" USING btree ("serverId");
CREATE INDEX "serverpod_session_log_touched_idx" ON "serverpod_session_log" USING btree ("touched");
CREATE INDEX "serverpod_session_log_isopen_idx" ON "serverpod_session_log" USING btree ("isOpen");
--
-- Class AuthKey as table serverpod_auth_key
--
CREATE TABLE "serverpod_auth_key" (
"id" bigserial PRIMARY KEY,
"userId" bigint NOT NULL,
"hash" text NOT NULL,
"scopeNames" json NOT NULL,
"method" text NOT NULL
);
-- Indexes
CREATE INDEX "serverpod_auth_key_userId_idx" ON "serverpod_auth_key" USING btree ("userId");
--
-- Class EmailAuth as table serverpod_email_auth
--
CREATE TABLE "serverpod_email_auth" (
"id" bigserial PRIMARY KEY,
"userId" bigint NOT NULL,
"email" text NOT NULL,
"hash" text NOT NULL
);
-- Indexes
CREATE UNIQUE INDEX "serverpod_email_auth_email" ON "serverpod_email_auth" USING btree ("email");
--
-- Class EmailCreateAccountRequest as table serverpod_email_create_request
--
CREATE TABLE "serverpod_email_create_request" (
"id" bigserial PRIMARY KEY,
"userName" text NOT NULL,
"email" text NOT NULL,
"hash" text NOT NULL,
"verificationCode" text NOT NULL
);
-- Indexes
CREATE UNIQUE INDEX "serverpod_email_auth_create_account_request_idx" ON "serverpod_email_create_request" USING btree ("email");
--
-- Class EmailFailedSignIn as table serverpod_email_failed_sign_in
--
CREATE TABLE "serverpod_email_failed_sign_in" (
"id" bigserial PRIMARY KEY,
"email" text NOT NULL,
"time" timestamp without time zone NOT NULL,
"ipAddress" text NOT NULL
);
-- Indexes
CREATE INDEX "serverpod_email_failed_sign_in_email_idx" ON "serverpod_email_failed_sign_in" USING btree ("email");
CREATE INDEX "serverpod_email_failed_sign_in_time_idx" ON "serverpod_email_failed_sign_in" USING btree ("time");
--
-- Class EmailReset as table serverpod_email_reset
--
CREATE TABLE "serverpod_email_reset" (
"id" bigserial PRIMARY KEY,
"userId" bigint NOT NULL,
"verificationCode" text NOT NULL,
"expiration" timestamp without time zone NOT NULL
);
-- Indexes
CREATE UNIQUE INDEX "serverpod_email_reset_verification_idx" ON "serverpod_email_reset" USING btree ("verificationCode");
--
-- Class GoogleRefreshToken as table serverpod_google_refresh_token
--
CREATE TABLE "serverpod_google_refresh_token" (
"id" bigserial PRIMARY KEY,
"userId" bigint NOT NULL,
"refreshToken" text NOT NULL
);
-- Indexes
CREATE UNIQUE INDEX "serverpod_google_refresh_token_userId_idx" ON "serverpod_google_refresh_token" USING btree ("userId");
--
-- Class UserImage as table serverpod_user_image
--
CREATE TABLE "serverpod_user_image" (
"id" bigserial PRIMARY KEY,
"userId" bigint NOT NULL,
"version" bigint NOT NULL,
"url" text NOT NULL
);
-- Indexes
CREATE INDEX "serverpod_user_image_user_id" ON "serverpod_user_image" USING btree ("userId", "version");
--
-- Class UserInfo as table serverpod_user_info
--
CREATE TABLE "serverpod_user_info" (
"id" bigserial PRIMARY KEY,
"userIdentifier" text NOT NULL,
"userName" text,
"fullName" text,
"email" text,
"created" timestamp without time zone NOT NULL,
"imageUrl" text,
"scopeNames" json NOT NULL,
"blocked" boolean NOT NULL
);
-- Indexes
CREATE UNIQUE INDEX "serverpod_user_info_user_identifier" ON "serverpod_user_info" USING btree ("userIdentifier");
CREATE INDEX "serverpod_user_info_email" ON "serverpod_user_info" USING btree ("email");
--
-- Foreign relations for "serverpod_log" table
--
ALTER TABLE ONLY "serverpod_log"
ADD CONSTRAINT "serverpod_log_fk_0"
FOREIGN KEY("sessionLogId")
REFERENCES "serverpod_session_log"("id")
ON DELETE CASCADE
ON UPDATE NO ACTION;
--
-- Foreign relations for "serverpod_message_log" table
--
ALTER TABLE ONLY "serverpod_message_log"
ADD CONSTRAINT "serverpod_message_log_fk_0"
FOREIGN KEY("sessionLogId")
REFERENCES "serverpod_session_log"("id")
ON DELETE CASCADE
ON UPDATE NO ACTION;
--
-- Foreign relations for "serverpod_query_log" table
--
ALTER TABLE ONLY "serverpod_query_log"
ADD CONSTRAINT "serverpod_query_log_fk_0"
FOREIGN KEY("sessionLogId")
REFERENCES "serverpod_session_log"("id")
ON DELETE CASCADE
ON UPDATE NO ACTION;
--
-- MIGRATION VERSION FOR wien_talks
--
INSERT INTO "serverpod_migrations" ("module", "version", "timestamp")
VALUES ('wien_talks', '20250816171653001', now())
ON CONFLICT ("module")
DO UPDATE SET "version" = '20250816171653001', "timestamp" = now();
--
-- MIGRATION VERSION FOR serverpod
--
INSERT INTO "serverpod_migrations" ("module", "version", "timestamp")
VALUES ('serverpod', '20240516151843329', now())
ON CONFLICT ("module")
DO UPDATE SET "version" = '20240516151843329', "timestamp" = now();
--
-- MIGRATION VERSION FOR serverpod_auth
--
INSERT INTO "serverpod_migrations" ("module", "version", "timestamp")
VALUES ('serverpod_auth', '20240520102713718', now())
ON CONFLICT ("module")
DO UPDATE SET "version" = '20240520102713718', "timestamp" = now();
COMMIT;

View file

@ -0,0 +1,107 @@
{
"moduleName": "wien_talks",
"tables": [
{
"name": "quote",
"dartName": "Quote",
"module": "wien_talks",
"schema": "public",
"columns": [
{
"name": "id",
"columnType": 6,
"isNullable": false,
"columnDefault": "nextval('quote_id_seq'::regclass)",
"dartType": "int?"
},
{
"name": "userId",
"columnType": 6,
"isNullable": false,
"dartType": "int"
},
{
"name": "text",
"columnType": 0,
"isNullable": false,
"dartType": "String"
},
{
"name": "authorName",
"columnType": 0,
"isNullable": true,
"dartType": "String?"
},
{
"name": "lat",
"columnType": 3,
"isNullable": false,
"dartType": "double"
},
{
"name": "long",
"columnType": 3,
"isNullable": false,
"dartType": "double"
},
{
"name": "createdAt",
"columnType": 4,
"isNullable": false,
"dartType": "DateTime"
},
{
"name": "visibility",
"columnType": 6,
"isNullable": false,
"dartType": "int"
},
{
"name": "upvotes",
"columnType": 6,
"isNullable": false,
"dartType": "int"
},
{
"name": "downvotes",
"columnType": 6,
"isNullable": false,
"dartType": "int"
},
{
"name": "tags",
"columnType": 8,
"isNullable": true,
"dartType": "List<String>?"
}
],
"foreignKeys": [],
"indexes": [
{
"indexName": "quote_pkey",
"elements": [
{
"type": 0,
"definition": "id"
}
],
"type": "btree",
"isUnique": true,
"isPrimary": true
}
],
"managed": true
}
],
"installedModules": [
{
"module": "serverpod",
"version": "20240516151843329"
},
{
"module": "serverpod_auth",
"version": "20240520102713718"
}
],
"migrationApiVersion": 1
}

View file

@ -0,0 +1,5 @@
{
"actions": [],
"warnings": [],
"migrationApiVersion": 1
}

View file

@ -0,0 +1,29 @@
BEGIN;
--
-- MIGRATION VERSION FOR wien_talks
--
INSERT INTO "serverpod_migrations" ("module", "version", "timestamp")
VALUES ('wien_talks', '20250816171653001', now())
ON CONFLICT ("module")
DO UPDATE SET "version" = '20250816171653001', "timestamp" = now();
--
-- MIGRATION VERSION FOR serverpod
--
INSERT INTO "serverpod_migrations" ("module", "version", "timestamp")
VALUES ('serverpod', '20240516151843329', now())
ON CONFLICT ("module")
DO UPDATE SET "version" = '20240516151843329', "timestamp" = now();
--
-- MIGRATION VERSION FOR serverpod_auth
--
INSERT INTO "serverpod_migrations" ("module", "version", "timestamp")
VALUES ('serverpod_auth', '20240520102713718', now())
ON CONFLICT ("module")
DO UPDATE SET "version" = '20240520102713718', "timestamp" = now();
COMMIT;

View file

@ -105,7 +105,9 @@ void withServerpod(
}
class TestEndpoints {
late final _ShowLatestNewsWidget showLatestNewsWidget;
late final _QuoteEndpoint quote;
late final _VotesEndpoint votes;
}
class _InternalTestEndpoints extends TestEndpoints
@ -115,15 +117,22 @@ class _InternalTestEndpoints extends TestEndpoints
_i2.SerializationManager serializationManager,
_i2.EndpointDispatch endpoints,
) {
showLatestNewsWidget = _ShowLatestNewsWidget(
quote = _QuoteEndpoint(
endpoints,
serializationManager,
);
votes = _VotesEndpoint(
endpoints,
serializationManager,
);
}
}
class _ShowLatestNewsWidget {
_ShowLatestNewsWidget(this._endpointDispatch, this._serializationManager);
class _QuoteEndpoint {
_QuoteEndpoint(
this._endpointDispatch,
this._serializationManager,
);
final _i2.EndpointDispatch _endpointDispatch;
@ -136,23 +145,21 @@ class _ShowLatestNewsWidget {
return _i1.callAwaitableFunctionAndHandleExceptions(() async {
var _localUniqueSession =
(sessionBuilder as _i1.InternalTestSessionBuilder).internalBuild(
endpoint: 'showLatestNewsWidget',
endpoint: 'quote',
method: 'createQuote',
);
try {
var _localCallContext = await _endpointDispatch.getMethodCallContext(
createSessionCallback: (_) => _localUniqueSession,
endpointPath: 'showLatestNewsWidget',
endpointPath: 'quote',
methodName: 'createQuote',
parameters: _i1.testObjectToJson({'req': req}),
serializationManager: _serializationManager,
);
var _localReturnValue =
await (_localCallContext.method.call(
var _localReturnValue = await (_localCallContext.method.call(
_localUniqueSession,
_localCallContext.arguments,
)
as _i3.Future<_i4.Quote>);
) as _i3.Future<_i4.Quote>);
return _localReturnValue;
} finally {
await _localUniqueSession.close();
@ -167,23 +174,21 @@ class _ShowLatestNewsWidget {
return _i1.callAwaitableFunctionAndHandleExceptions(() async {
var _localUniqueSession =
(sessionBuilder as _i1.InternalTestSessionBuilder).internalBuild(
endpoint: 'showLatestNewsWidget',
endpoint: 'quote',
method: 'updateQuote',
);
try {
var _localCallContext = await _endpointDispatch.getMethodCallContext(
createSessionCallback: (_) => _localUniqueSession,
endpointPath: 'showLatestNewsWidget',
endpointPath: 'quote',
methodName: 'updateQuote',
parameters: _i1.testObjectToJson({'quote': quote}),
serializationManager: _serializationManager,
);
var _localReturnValue =
await (_localCallContext.method.call(
var _localReturnValue = await (_localCallContext.method.call(
_localUniqueSession,
_localCallContext.arguments,
)
as _i3.Future<void>);
) as _i3.Future<void>);
return _localReturnValue;
} finally {
await _localUniqueSession.close();
@ -192,29 +197,92 @@ class _ShowLatestNewsWidget {
}
_i3.Future<List<_i4.Quote>> getAllQuotes(
_i1.TestSessionBuilder sessionBuilder, {
required int limit,
}) async {
_i1.TestSessionBuilder sessionBuilder) async {
return _i1.callAwaitableFunctionAndHandleExceptions(() async {
var _localUniqueSession =
(sessionBuilder as _i1.InternalTestSessionBuilder).internalBuild(
endpoint: 'showLatestNewsWidget',
endpoint: 'quote',
method: 'getAllQuotes',
);
try {
var _localCallContext = await _endpointDispatch.getMethodCallContext(
createSessionCallback: (_) => _localUniqueSession,
endpointPath: 'showLatestNewsWidget',
endpointPath: 'quote',
methodName: 'getAllQuotes',
parameters: _i1.testObjectToJson({'limit': limit}),
parameters: _i1.testObjectToJson({}),
serializationManager: _serializationManager,
);
var _localReturnValue =
await (_localCallContext.method.call(
var _localReturnValue = await (_localCallContext.method.call(
_localUniqueSession,
_localCallContext.arguments,
)
as _i3.Future<List<_i6.Vote>>);
) as _i3.Future<List<_i4.Quote>>);
return _localReturnValue;
} finally {
await _localUniqueSession.close();
}
});
}
}
class _VotesEndpoint {
_VotesEndpoint(
this._endpointDispatch,
this._serializationManager,
);
final _i2.EndpointDispatch _endpointDispatch;
final _i2.SerializationManager _serializationManager;
_i3.Future<_i6.Vote> postVote(
_i1.TestSessionBuilder sessionBuilder,
_i7.VoteRequest voteRequest,
) async {
return _i1.callAwaitableFunctionAndHandleExceptions(() async {
var _localUniqueSession =
(sessionBuilder as _i1.InternalTestSessionBuilder).internalBuild(
endpoint: 'votes',
method: 'postVote',
);
try {
var _localCallContext = await _endpointDispatch.getMethodCallContext(
createSessionCallback: (_) => _localUniqueSession,
endpointPath: 'votes',
methodName: 'postVote',
parameters: _i1.testObjectToJson({'voteRequest': voteRequest}),
serializationManager: _serializationManager,
);
var _localReturnValue = await (_localCallContext.method.call(
_localUniqueSession,
_localCallContext.arguments,
) as _i3.Future<_i6.Vote>);
return _localReturnValue;
} finally {
await _localUniqueSession.close();
}
});
}
_i3.Future<List<_i6.Vote>> getAllVotes(
_i1.TestSessionBuilder sessionBuilder) async {
return _i1.callAwaitableFunctionAndHandleExceptions(() async {
var _localUniqueSession =
(sessionBuilder as _i1.InternalTestSessionBuilder).internalBuild(
endpoint: 'votes',
method: 'getAllVotes',
);
try {
var _localCallContext = await _endpointDispatch.getMethodCallContext(
createSessionCallback: (_) => _localUniqueSession,
endpointPath: 'votes',
methodName: 'getAllVotes',
parameters: _i1.testObjectToJson({}),
serializationManager: _serializationManager,
);
var _localReturnValue = await (_localCallContext.method.call(
_localUniqueSession,
_localCallContext.arguments,
) as _i3.Future<List<_i6.Vote>>);
return _localReturnValue;
} finally {
await _localUniqueSession.close();