This repository has been archived by the owner on Feb 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from engvik/feature/json-output
feature: json output
- Loading branch information
Showing
35 changed files
with
1,044 additions
and
195 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package json | ||
|
||
import ( | ||
"encoding/json" | ||
"log" | ||
|
||
"github.com/engvik/sbanken-go" | ||
) | ||
|
||
func (w *Writer) ListAccounts(accounts []sbanken.Account) { | ||
json, err := json.MarshalIndent(accounts, "", " ") | ||
if err != nil { | ||
log.Printf("Error creating json output: %s\n", err) | ||
return | ||
} | ||
|
||
log.Println(string(json)) | ||
} | ||
|
||
func (w *Writer) ReadAccount(account sbanken.Account) { | ||
json, err := json.MarshalIndent(account, "", " ") | ||
if err != nil { | ||
log.Printf("Error creating json output: %s\n", err) | ||
return | ||
} | ||
|
||
log.Println(string(json)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package json | ||
|
||
import ( | ||
"encoding/json" | ||
"log" | ||
|
||
"github.com/engvik/sbanken-go" | ||
) | ||
|
||
func (w *Writer) ListCards(cards []sbanken.Card) { | ||
json, err := json.MarshalIndent(cards, "", " ") | ||
if err != nil { | ||
log.Printf("Error creating json output: %s\n", err) | ||
return | ||
} | ||
|
||
log.Println(string(json)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package json | ||
|
||
import ( | ||
"encoding/json" | ||
"log" | ||
|
||
"github.com/engvik/sbanken-go" | ||
) | ||
|
||
func (w *Writer) GetCustomer(customer sbanken.Customer) { | ||
json, err := json.MarshalIndent(customer, "", " ") | ||
if err != nil { | ||
log.Printf("Error creating json output: %s\n", err) | ||
return | ||
} | ||
|
||
log.Println(string(json)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package json | ||
|
||
import ( | ||
"encoding/json" | ||
"log" | ||
|
||
"github.com/engvik/sbanken-go" | ||
) | ||
|
||
func (w *Writer) ListEfakturas(efakturas []sbanken.Efaktura) { | ||
json, err := json.MarshalIndent(efakturas, "", " ") | ||
if err != nil { | ||
log.Printf("Error creating json output: %s\n", err) | ||
return | ||
} | ||
|
||
log.Println(string(json)) | ||
} | ||
|
||
func (w *Writer) PayEfaktura(q *sbanken.EfakturaPayQuery) { | ||
json, err := json.MarshalIndent(q, "", " ") | ||
if err != nil { | ||
log.Printf("Error creating json output: %s\n", err) | ||
return | ||
} | ||
|
||
log.Println(string(json)) | ||
} | ||
|
||
func (w *Writer) ReadEfaktura(efaktura sbanken.Efaktura) { | ||
json, err := json.MarshalIndent(efaktura, "", " ") | ||
if err != nil { | ||
log.Printf("Error creating json output: %s\n", err) | ||
return | ||
} | ||
|
||
log.Println(string(json)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package json | ||
|
||
import ( | ||
"io" | ||
"log" | ||
) | ||
|
||
type Writer struct{} | ||
|
||
func NewWriter() *Writer { | ||
return &Writer{} | ||
} | ||
|
||
func (w *Writer) SetOutputMirror(m io.Writer) { | ||
log.SetFlags(0) | ||
log.SetOutput(m) | ||
} | ||
|
||
func (w *Writer) SetStyle(_ string) {} | ||
|
||
func (w *Writer) SetColors(_ bool) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package json | ||
|
||
import ( | ||
"encoding/json" | ||
"log" | ||
|
||
"github.com/engvik/sbanken-go" | ||
) | ||
|
||
func (w *Writer) ListPayments(payments []sbanken.Payment) { | ||
json, err := json.MarshalIndent(payments, "", " ") | ||
if err != nil { | ||
log.Printf("Error creating json output: %s\n", err) | ||
return | ||
} | ||
|
||
log.Println(string(json)) | ||
} | ||
|
||
func (w *Writer) ReadPayment(payment sbanken.Payment) { | ||
json, err := json.MarshalIndent(payment, "", " ") | ||
if err != nil { | ||
log.Printf("Error creating json output: %s\n", err) | ||
return | ||
} | ||
|
||
log.Println(string(json)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package json | ||
|
||
import ( | ||
"encoding/json" | ||
"log" | ||
|
||
"github.com/engvik/sbanken-go" | ||
) | ||
|
||
func (w *Writer) ListStandingOrders(standingOrders []sbanken.StandingOrder, _ bool) { | ||
json, err := json.MarshalIndent(standingOrders, "", " ") | ||
if err != nil { | ||
log.Printf("Error creating json output: %s\n", err) | ||
return | ||
} | ||
|
||
log.Println(string(json)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package json | ||
|
||
import ( | ||
"encoding/json" | ||
"log" | ||
|
||
"github.com/engvik/sbanken-go" | ||
) | ||
|
||
func (w *Writer) ListTransactions(transactions []sbanken.Transaction, _ bool, _ bool, _ bool) { | ||
json, err := json.MarshalIndent(transactions, "", " ") | ||
if err != nil { | ||
log.Printf("Error creating json output: %s\n", err) | ||
return | ||
} | ||
|
||
log.Println(string(json)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package json | ||
|
||
import ( | ||
"encoding/json" | ||
"log" | ||
|
||
"github.com/engvik/sbanken-go" | ||
) | ||
|
||
func (w *Writer) Transfer(q *sbanken.TransferQuery) { | ||
json, err := json.MarshalIndent(q, "", " ") | ||
if err != nil { | ||
log.Printf("Error creating json output: %s\n", err) | ||
return | ||
} | ||
|
||
log.Println(string(json)) | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.