From d36aaeb9679a2bc6dfadc53928fe08f081203c0f Mon Sep 17 00:00:00 2001 From: William Carroll Date: Sun, 20 Nov 2022 21:24:47 -0800 Subject: fix(wpcarro/ynab): Remove .skip-subtree **TL;DR:** - Delete half-baked packaging attempts (`job.nix`, `token.nix`). - Ensure golang code compiles. - Some "packages" were being treated like "programs" presumably for debugging/testing purposes back when I was working on this. Make those behave like libraries. - Remove stale imports. - Fix syntax errors. - Miscellaneous other chores. - Drop `shell.nix` and `use_nix` directive. Change-Id: I63c275680bac55a3cad3b9cb48d51cdc431fbe48 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7318 Autosubmit: wpcarro Tested-by: BuildkiteCI Reviewed-by: wpcarro --- users/wpcarro/tools/monzo_ynab/monzo/client.go | 4 ++-- users/wpcarro/tools/monzo_ynab/monzo/serde.go | 12 +----------- 2 files changed, 3 insertions(+), 13 deletions(-) (limited to 'users/wpcarro/tools/monzo_ynab/monzo') diff --git a/users/wpcarro/tools/monzo_ynab/monzo/client.go b/users/wpcarro/tools/monzo_ynab/monzo/client.go index 8c6c41e29f40..9621ffc5ad51 100644 --- a/users/wpcarro/tools/monzo_ynab/monzo/client.go +++ b/users/wpcarro/tools/monzo_ynab/monzo/client.go @@ -27,8 +27,8 @@ func Create() *Client { } // Returns a slice of transactions from the last 24 hours. -func (c *Client) Transactions24Hours() []monzoSerde.Transaction { - token := tokens.AccessToken() +func (c *Client) TransactionsLast24Hours() []monzoSerde.Transaction { + token := tokens.GetState().AccessToken form := url.Values{"account_id": {accountID}} client := http.Client{} req, _ := http.NewRequest("POST", "https://api.monzo.com/transactions", diff --git a/users/wpcarro/tools/monzo_ynab/monzo/serde.go b/users/wpcarro/tools/monzo_ynab/monzo/serde.go index a38585eca632..e2f55dad4597 100644 --- a/users/wpcarro/tools/monzo_ynab/monzo/serde.go +++ b/users/wpcarro/tools/monzo_ynab/monzo/serde.go @@ -1,11 +1,9 @@ // This package hosts the serialization and deserialization logic for all of the // data types with which our application interacts from the Monzo API. -package main +package monzoSerde import ( "encoding/json" - "fmt" - "io/ioutil" "time" ) @@ -72,11 +70,3 @@ func deserializeTx(x string) (*Transaction, error) { err := json.Unmarshal([]byte(x), target) return target, err } - -func main() { - b, _ := ioutil.ReadFile("./fixture.json") - tx := string(b) - target, _ := deserializeTx(tx) - out, _ := serializeTx(target) - fmt.Println(out) -} -- cgit 1.4.1