Create Dart snippets and reference them

Co-Authored-By: ok300 <106775972+ok300@users.noreply.github.com>
This commit is contained in:
Erdem Yerebasmaz
2023-10-24 21:25:46 +03:00
parent c29cad2bd2
commit ec4955c488
35 changed files with 1039 additions and 272 deletions

View File

@@ -0,0 +1,33 @@
import 'package:breez_sdk/breez_sdk.dart';
import 'package:breez_sdk/bridge_generated.dart';
Future<List<Payment>> listPayments() async {
// ANCHOR: list-payments
ListPaymentsRequest req = ListPaymentsRequest(filter: PaymentTypeFilter.All);
List<Payment> paymentsList = await BreezSDK().listPayments(req: req);
print(paymentsList);
// ANCHOR_END: list-payments
return paymentsList;
}
Future<List<Payment>> listPaymentsFiltered({
DateTime? startDate,
DateTime? endDate,
bool? includeFailures,
int? offset,
int? limit,
}) async {
// ANCHOR: list-payments-filtered
ListPaymentsRequest req = ListPaymentsRequest(
filter: PaymentTypeFilter.Sent,
fromTimestamp: startDate?.millisecondsSinceEpoch,
toTimestamp: endDate?.millisecondsSinceEpoch,
includeFailures: includeFailures,
offset: offset,
limit: limit,
);
List<Payment> paymentsList = await BreezSDK().listPayments(req: req);
print(paymentsList);
// ANCHOR_END: list-payments-filtered
return paymentsList;
}