buxfer

package module
v0.0.0-...-5917867 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2018 License: GPL-3.0 Imports: 7 Imported by: 0

README

Buxfer API (in Go!)

Example

package main

import (
	"fmt"
	
	"github.com/tserkov/go-buxfer-api"
)

func main() {
	// Acquire an authorization token first
	token, err := buxfer.Login("my_username", "my_password")

	// Then use the token to call an endpoint, like accounts
	accounts, _ := buxfer.GetAccounts(token)

    for _, account := range accounts {
		fmt.Printf(
			"I have %s%.2f in my %s account!\n",
			account.Currency,
			account.Balance,
			account.Name,
		)
    }
}

Methods

Login(username string, password string)

get a unique 'token' which must included on all future requests

AddTransaction(token string, transaction AddTransactionParameters)

add a transaction

Accounts(token string)

list of accounts with balances

Budgets(token string)

list of your budgets

Contacts(token string)

list of your contacts

Groups(token string)

list of your groups

Loans(token string)

list of your loans

Reminders(token string)

list of your reminders

Tags(token string)

list of your transaction tags

Transactions(token string, params TransactionParameters)

list of transactions, 25 at a time

UploadStatement(token string, statement StatementParameters)

upload a bank or credit card statement

Documentation

Index

Constants

View Source
const (
	API_LOGIN_URL    = "https://www.buxfer.com/api/login?userid=%s&password=%s"
	API_ENDPOINT_URL = "https://www.buxfer.com/api/%s?token=%s"
)

Variables

This section is empty.

Functions

func AddTransaction

func AddTransaction(token string, tx *TransactionParameters) (bool, error)

func Login

func Login(username, password string) (string, error)

func UploadStatement

func UploadStatement(token string, stmt *StatementParameters) (float64, error)

Types

type Account

type Account struct {
	ID         int       `json:"id"`
	Name       string    `json:"name"`
	Bank       string    `json:"bank"`
	Balance    float64   `json:"balance"`
	Currency   string    `json:"currency"`
	LastSynced time.Time `json:"lastsynced"`
}

func GetAccounts

func GetAccounts(token string) ([]Account, error)

type AccountsResponse

type AccountsResponse struct {
	Accounts []Account `json:"accounts"`
	Status   string    `json:"status"`
}

type AccountsResponseRoot

type AccountsResponseRoot struct {
	Response AccountsResponse `json:"response"`
}

type AddTransactionParameters

type AddTransactionParameters struct {
	Description   string
	Amount        float64
	AccountID     string
	FromAccountID string
	ToAccountID   string
	Date          time.Time // YYYY-MM-DD
	Tags          string    // comma-separated
	Type          string    // income, expense, transfer, refund, sharedBill, paidForFriend, loan
	Status        string    // cleared, pending

	// type=sharedBill only
	Payers      []Payer
	Sharers     []Sharer
	IsEvenSplit bool

	// type=loan only
	LoanedBy   string
	BorrowedBy string

	// type=paidForFriend only
	PaidBy  string
	PaidFor string
}

type AddTransactionResponse

type AddTransactionResponse struct {
	Status           string `json:"status"`
	TransactionAdded bool   `json:"transactionAdded"`
	ParseStatus      string `json:"parseStatus"`
}

type AddTransactionResponseRoot

type AddTransactionResponseRoot struct {
	Response AddTransactionResponse `json:"response"`
}

type Budget

type Budget struct {
	ID            string   `json:"id"`
	Name          string   `json:"name"`
	Limit         string   `json:"limit"`
	Remaining     float64  `json:"remaining"`
	Period        string   `json:"period"`
	CurrentPeriod string   `json:"currentPeriod"`
	Tags          string   `json:"tags"`
	Keywords      []string `json:"keywords"`
}

func GetBudgets

func GetBudgets(token string) ([]Budget, error)

type BudgetsResponse

type BudgetsResponse struct {
	Status  string   `json:"status"`
	Budgets []Budget `json:"budgets"`
}

type BudgetsResponseRoot

type BudgetsResponseRoot struct {
	Response BudgetsResponse `json:"response"`
}

type Contact

type Contact struct {
	ID      string  `json:"id"`
	Name    string  `json:"name"`
	Email   string  `json:"email"`
	Balance float64 `json:"balance"`
}

func GetContacts

func GetContacts(token string) ([]Contact, error)

type ContactsResponse

type ContactsResponse struct {
	Status   string    `json:"status"`
	Contacts []Contact `json:"contacts"`
}

type ContactsResponseRoot

type ContactsResponseRoot struct {
	Response ContactsResponse `json:"response"`
}

type Group

type Group struct {
	ID           string        `json:"id"`
	Name         string        `json:"name"`
	Consolidated bool          `json:"consolidated"`
	Members      []GroupMember `json:"members"`
}

func GetGroups

func GetGroups(token string) ([]Group, error)

type GroupMember

type GroupMember struct {
	ID      string  `json:"id"`
	Name    string  `json:"name"`
	Email   string  `json:"email"`
	Balance float64 `json:"balance"`
}

type GroupsResponse

type GroupsResponse struct {
	Status string  `json:"status"`
	Groups []Group `json:"groups"`
}

type GroupsResponseRoot

type GroupsResponseRoot struct {
	Response GroupsResponse `json:"response"`
}

type Loan

type Loan struct {
	Entity      string  `json:"entity"`
	Type        string  `json:"type"`
	Balance     float64 `json:"balance"`
	Description string  `json:"description"`
}

func GetLoans

func GetLoans(token string) ([]Loan, error)

type LoansResponse

type LoansResponse struct {
	Status string `json:"status"`
	Loans  []Loan `json:"loans"`
}

type LoansResponseRoot

type LoansResponseRoot struct {
	Response LoansResponse `json:"response"`
}

type LoginResponse

type LoginResponse struct {
	Status string `json:"status"`
	Token  string `json:"token"`
}

type LoginResponseRoot

type LoginResponseRoot struct {
	Response LoginResponse `json:"response"`
}

type Reminder

type Reminder struct {
	ID        string  `json:"id"`
	Name      string  `json:"name"`
	StartDate string  `json:"startDate"`
	Period    string  `json:"period"`
	Amount    float64 `json:"amount"`
	AccountID string  `json:"accountId"`
}

func GetReminders

func GetReminders(token string) ([]Reminder, error)

type RemindersResponse

type RemindersResponse struct {
	Status    string     `json:"status"`
	Reminders []Reminder `json:"reminders"`
}

type RemindersResponseRoot

type RemindersResponseRoot struct {
	Response RemindersResponse `json:"response"`
}

type StatementParameters

type StatementParameters struct {
	AccountID  string
	Statement  string
	DateFormat string // "MM/DD/YYYY" or "DD/MM/YYYY"
}

type Tag

type Tag struct {
	ID       string `json:"id"`
	Name     string `json:"name"`
	ParentID string `json:"parentId"`
}

func GetTags

func GetTags(token string) ([]Tag, error)

type TagsResponse

type TagsResponse struct {
	Status string `json:"status"`
	Tags   []Tag  `json:"tag"`
}

type TagsResponseRoot

type TagsResponseRoot struct {
	Response TagsResponse `json:"response"`
}

type Transaction

type Transaction struct {
	ID          string  `json:"id"`
	Description string  `json:"description"`
	Date        string  `json:"date"`
	Type        string  `json:"type"`
	Amount      float64 `json:"amount"`
	AccountID   string  `json:"accountId"`
	Tags        string  `json:"tags"`
	ExtraInfo   string  `json:"extraInfo"`
}

type TransactionsParameters

type TransactionsParameters struct {
	AccountID   string    `json:"accountId,omitempty"`
	AccountName string    `json:"accountName,omitempty"`
	BudgetID    string    `json:"budgetId,omitempty"`
	BudgetName  string    `json:"budgetName,omitempty"`
	ContactID   string    `json:"contactId,omitempty"`
	ContactName string    `json:"contactName,omitempty"`
	EndDate     time.Time `json:"endDate,omitempty"`
	GroupID     string    `json:"groupId,omitempty"`
	GroupName   string    `json:"groupName,omitempty"`
	Month       time.Time `json:"month,omitempty"`
	StartDate   time.Time `json:"startDate,omitempty"`
	TagID       string    `json:"tagId,omitempty"`
	TagName     string    `json:"tagName,omitempty"`
}

type TransactionsResponse

type TransactionsResponse struct {
	Status          string        `json:"status"`
	NumTransactions int           `json:"numTransactions"`
	Transactions    []Transaction `json:"transactions"`
}

type TransactionsResponseRoot

type TransactionsResponseRoot struct {
	Response TransactionsResponse `json:"response"`
}

type UploadStatementResponse

type UploadStatementResponse struct {
	Status   string  `json:"status"`
	Uploaded bool    `json:"uploaded"`
	Balance  float64 `json:"balance"`
}

type UploadStatementResponseRoot

type UploadStatementResponseRoot struct {
	Response UploadStatementResponse `json:"response"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL