Documentation ¶
Index ¶
- Variables
- func ErrorResp(w http.ResponseWriter, message interface{})
- func GetAPIVersion() string
- func GetEnv(params ...string) string
- func GetRootDir() string
- func LoadAWSConfig() aws.Config
- func LoadDotEnv()
- func PublishSNS(arn string, message string) error
- func PublishSlack(webhook string, message string, channel string) error
- func SuccessResp(w http.ResponseWriter, message interface{})
- func SyncNetworth(db *DynamoDBClient, username string) error
- type APIResponse
- type Account
- type DynamoDBClient
- func (d DynamoDBClient) GetAccounts(username string) ([]Account, error)
- func (d DynamoDBClient) GetNetworth(username string) (Networth, error)
- func (d DynamoDBClient) GetNetworthByDateRange(username string, startDate string, endDate string) ([]Networth, error)
- func (d DynamoDBClient) GetTransactions(username string, accountID string) ([]Transaction, error)
- func (d DynamoDBClient) Set(table string, partitionKey string, sortKey string, valMap map[string]string) error
- func (d DynamoDBClient) SetAccount(username string, itemID string, account *plaid.Account) error
- func (d DynamoDBClient) SetNetworth(username string, networth float64, assets float64, liabilities float64) error
- func (d DynamoDBClient) SetToken(username string, token *Token) error
- func (d DynamoDBClient) SetTransaction(username string, transaction plaid.Transaction) error
- func (d DynamoDBClient) SetWebhook(webhook Webhook) error
- type KMSClient
- type Networth
- type PlaidClient
- type SlackBody
- type Token
- type Tokens
- type Transaction
- type Webhook
- type WebhookError
Constants ¶
This section is empty.
Variables ¶
var AWSRegion = GetEnv("AWS_REGION", "us-east-1")
AWSRegion default aws region
Functions ¶
func ErrorResp ¶
func ErrorResp(w http.ResponseWriter, message interface{})
ErrorResp error response helper for api
func PublishSNS ¶
PublishSNS publish message to SNS topic
func PublishSlack ¶
PublishSlack publish message to Slack
func SuccessResp ¶
func SuccessResp(w http.ResponseWriter, message interface{})
SuccessResp success response helper for api
func SyncNetworth ¶
func SyncNetworth(db *DynamoDBClient, username string) error
SyncNetworth save net worth to db for current datetime
Types ¶
type APIResponse ¶
type APIResponse struct {
Data interface{} `json:"data"`
}
APIResponse api reponse
type DynamoDBClient ¶
DynamoDBClient db client struct
func NewDynamoDBClient ¶
func NewDynamoDBClient() *DynamoDBClient
NewDynamoDBClient new dynamodb client
func (DynamoDBClient) GetAccounts ¶
func (d DynamoDBClient) GetAccounts(username string) ([]Account, error)
GetAccounts return all accounts from db for a username
func (DynamoDBClient) GetNetworth ¶
func (d DynamoDBClient) GetNetworth(username string) (Networth, error)
GetNetworth return Networth struct
func (DynamoDBClient) GetNetworthByDateRange ¶
func (d DynamoDBClient) GetNetworthByDateRange(username string, startDate string, endDate string) ([]Networth, error)
GetNetworthByDateRange return net worth based on date
func (DynamoDBClient) GetTransactions ¶
func (d DynamoDBClient) GetTransactions(username string, accountID string) ([]Transaction, error)
GetTransactions return all transactions from db for a username
func (DynamoDBClient) Set ¶
func (d DynamoDBClient) Set(table string, partitionKey string, sortKey string, valMap map[string]string) error
Set key / val to db
func (DynamoDBClient) SetAccount ¶
SetAccount save account to db
func (DynamoDBClient) SetNetworth ¶
func (d DynamoDBClient) SetNetworth(username string, networth float64, assets float64, liabilities float64) error
SetNetworth value as of today date and current timestamp
func (DynamoDBClient) SetToken ¶
func (d DynamoDBClient) SetToken(username string, token *Token) error
SetToken save token to db
func (DynamoDBClient) SetTransaction ¶
func (d DynamoDBClient) SetTransaction(username string, transaction plaid.Transaction) error
SetTransaction save transaction to db
func (DynamoDBClient) SetWebhook ¶
func (d DynamoDBClient) SetWebhook(webhook Webhook) error
SetWebhook save webhook to db
type Networth ¶
type Networth struct { Networth float64 `json:"networth"` Assets float64 `json:"assets"` Liabilities float64 `json:"liabilities"` DateTime string `json:"sort"` }
Networth struct
type PlaidClient ¶
PlaidClient plaid client
func NewPlaidClient ¶
func NewPlaidClient(clientID string, secret string, publicKey string, environment string) *PlaidClient
NewPlaidClient new Plaid client
type SlackBody ¶
type SlackBody struct { Text string `json:"text"` Username string `json:"username"` IconURL string `json:"icon_url"` Channel string `json:"channel"` }
SlackBody struct
type Token ¶
type Token struct { ItemID string `json:"item_id"` AccessToken string `json:"access_token"` // AccountID string `json:"account_id"` InstitutionID string `json:"institution_id"` InstitutionName string `json:"institution_name"` }
Token holds the structure single token
type Tokens ¶
type Tokens struct {
Tokens []*Token `json:"tokens"`
}
Tokens holds the structure multiple tokens
type Webhook ¶
type Webhook struct { WebhookType string `json:"webhook_type"` // "TRANSACTIONS", WebhookCode string `json:"webhook_code"` // INITIAL_UPDATE HISTORICAL_UPDATE DEFAULT_UPDATE TRANSACTIONS_REMOVED ItemID string `json:"item_id"` // "wz666MBjYWTp2PDzzggYhM6oWWmBb", Error WebhookError `json:"error"` // null, NewTransactions int `json:"new_transactions"` //19 RemovedTransactions []string `json:"removed_transactions"` // ["yBVBEwrPyJs8GvR77N7QTxnGg6wG74H7dEDN6", "kgygNvAVPzSX9KkddNdWHaVGRVex1MHm3k9no"], }
Webhook body
type WebhookError ¶
type WebhookError struct { DisplayMessage string `json:"display_message"` //: "The provided credentials were not correct. Please try again.", ErrorCode string `json:"error_code"` //: "ITEM_LOGIN_REQUIRED", ErrorMessage string `json:"error_message"` //: "the provided credentials were not correct", ErrorType string `json:"error_type"` //: "ITEM_ERROR", Status int `json:"status"` //: 400 }
WebhookError struct contains error fields from webhook