Add Go snippets

This commit is contained in:
Erdem Yerebasmaz
2023-11-06 18:24:04 +03:00
committed by Erdem Yerebasmaz
parent f65bcc1653
commit dc64895b65
31 changed files with 513 additions and 213 deletions

View 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
}