moneyloverc

package module
v0.0.0-...-23434b7 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2019 License: MIT Imports: 12 Imported by: 0

README

moneyloverc

moneylover.me Go client library

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DebugPayload = false

DebugPayload can be set to `true` to debug HTTP payloads.

Functions

This section is empty.

Types

type Campaign

type Campaign struct {
	ID          string    `json:"_id"`
	Name        string    `json:"name"`
	Icon        string    `json:"icon"`
	Type        int       `json:"type"`
	StartAmount int       `json:"start_amount"`
	GoalAmount  int       `json:"goal_amount"`
	Owner       string    `json:"owner"`
	EndDate     time.Time `json:"end_date"`
	LastEditBy  string    `json:"lastEditBy"`
	TokenDevice string    `json:"tokenDevice"`
	CurrencyID  int       `json:"currency_id"`
	IsPublic    bool      `json:"isPublic"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
	IsDelete    bool      `json:"isDelete"`
	Status      bool      `json:"status"`
}

Campaign contains an information about an event.

func (Campaign) String

func (c Campaign) String() string

type Category

type Category struct {
	ID       string       `json:"_id"`
	Icon     string       `json:"icon"`
	Metadata string       `json:"metadata"`
	Name     string       `json:"name"`
	Type     CategoryType `json:"type"`
}

Category contains an information about transaction category.

func (Category) String

func (c Category) String() string

type CategoryType

type CategoryType int

CategoryType defines two types of categories, income or expense.

const (
	// CategoryTypeIncome is income.
	CategoryTypeIncome CategoryType = iota + 1

	// CategoryTypeExpense is expense.
	CategoryTypeExpense
)

func (CategoryType) String

func (t CategoryType) String() string

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client provides a way to communicate with moneylover.

func Login

func Login(email, password string) (*Client, error)

Login creates a Client by logging into moneylover service.

func Restore

func Restore(refreshToken, clientID string) *Client

Restore creates a Client by restoring from a working refresh token.

func (Client) AddTransaction

func (c Client) AddTransaction(t TransactionInput) (map[string]interface{}, error)

AddTransaction adds the given transaction.

func (Client) GetCategories

func (c Client) GetCategories(walletID string) ([]Category, error)

GetCategories retrieves a list of Category(s) in the given wallet.

func (Client) GetTransactions

func (c Client) GetTransactions(walletID string, startDate, endDate time.Time) ([]Transaction, error)

GetTransactions retrieves a list of Transaction(s).

func (Client) GetUserInfo

func (c Client) GetUserInfo() (UserInfo, error)

GetUserInfo retrieves UserInfo for the logged in user.

func (Client) GetWallets

func (c Client) GetWallets() ([]Wallet, error)

GetWallets retrieves a list of Wallet(s).

func (*Client) Refresh

func (c *Client) Refresh() error

Refresh renew the access token of the current client.

func (Client) String

func (c Client) String() string

type Transaction

type Transaction struct {
	ID            string     `json:"_id"`
	Note          string     `json:"note"`
	Account       *Wallet    `json:"account"`
	Category      *Category  `json:"category"`
	Amount        float64    `json:"amount"`
	Date          time.Time  `json:"displayDate"`
	Images        []string   `json:"images"`
	ExcludeReport bool       `json:"exclude_report"`
	Campaigns     []Campaign `json:"campaign"`
	With          []string   `json:"with"`
}

Transaction is an income or an expense entry in moneylover.

func (Transaction) String

func (t Transaction) String() string

type TransactionInput

type TransactionInput struct {
	Note     string    `json:"note"`
	Account  string    `json:"account"`
	Category string    `json:"category"`
	Amount   float64   `json:"amount"`
	Date     time.Time `json:"displayDate"`
}

TransactionInput is an income or an expense entry to be posted to moneylover.

func (TransactionInput) String

func (t TransactionInput) String() string

type UserInfo

type UserInfo struct {
	ID          string   `json:"_id"`
	DeviceID    string   `json:"deviceId"`
	Email       string   `json:"email"`
	IconPackage []string `json:"icon_package"`
	Purchased   bool     `json:"purchased"`
}

UserInfo contains an information about the logged in user.

func (UserInfo) String

func (u UserInfo) String() string

type Wallet

type Wallet struct {
	ID                      string `json:"_id"`
	Name                    string `json:"name"`
	CurrencyID              int    `json:"currency_id"`
	Owner                   string `json:"owner"`
	TransactionNotification bool   `json:"transaction_notification"`
	Archived                bool   `json:"archived"`
	AccountType             int    `json:"account_type"`
	ExcludeTotal            bool   `json:"exclude_total"`
	Icon                    string `json:"icon"`
	ListUser                []struct {
		ID   string `json:"_id"`
		Name string `json:"name"`
	} `json:"listUser"`
	UpdateAt time.Time           `json:"updateAt"`
	IsDelete bool                `json:"isDelete"`
	Balance  []map[string]string `json:"balance"`
}

Wallet contains an information about wallet.

func (Wallet) String

func (w Wallet) String() string

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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