mirror of
https://github.com/aljazceru/breez-sdk-docs.git
synced 2025-12-17 13:54:20 +01:00
Create Dart snippets and reference them
Co-Authored-By: ok300 <106775972+ok300@users.noreply.github.com>
This commit is contained in:
33
snippets/dart_snippets/lib/list_payments.dart
Normal file
33
snippets/dart_snippets/lib/list_payments.dart
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user