mirror of
https://github.com/aljazceru/breez-sdk-docs.git
synced 2025-12-17 13:54:20 +01:00
Add Go snippets
This commit is contained in:
committed by
Erdem Yerebasmaz
parent
f65bcc1653
commit
dc64895b65
30
snippets/go/list_payments.go
Normal file
30
snippets/go/list_payments.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package example
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/breez/breez-sdk-go/breez_sdk"
|
||||
)
|
||||
|
||||
func ListPayments() {
|
||||
// ANCHOR: list-payments
|
||||
if payments, err := sdk.ListPayments(breez_sdk.ListPaymentsRequest{Filter: breez_sdk.PaymentTypeFilterAll}); err == nil {
|
||||
log.Printf("%#v", payments)
|
||||
}
|
||||
// ANCHOR_END: list-payments
|
||||
}
|
||||
|
||||
func ListPaymentsFiltered() {
|
||||
// ANCHOR: list-payments-filtered
|
||||
fromTimestamp := int64(1696880000)
|
||||
includeFailures := true
|
||||
listPaymentsRequest := breez_sdk.ListPaymentsRequest{
|
||||
Filter: breez_sdk.PaymentTypeFilterSent,
|
||||
FromTimestamp: &fromTimestamp,
|
||||
IncludeFailures: &includeFailures,
|
||||
}
|
||||
if payments, err := sdk.ListPayments(listPaymentsRequest); err == nil {
|
||||
log.Printf("%#v", payments)
|
||||
}
|
||||
// ANCHOR_END: list-payments-filtered
|
||||
}
|
||||
Reference in New Issue
Block a user