ynab

package
v0.0.0-...-2c2ce42 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultBaseURL = "https://api.youneedabudget.com/v1/"
View Source
var Endpoint = oauth2.Endpoint{
	AuthURL:  "https://app.youneedabudget.com/oauth/authorize",
	TokenURL: "https://app.youneedabudget.com/oauth/token",
}

Endpoint is YNAB's OAuth 2.0 endpoint.

Functions

func StringVal

func StringVal(p *string) string

Types

type Account

type Account struct {
	Id               string  `json:"id"`
	Name             string  `json:"name"`
	Type             string  `json:"type"`
	OnBudget         bool    `json:"on_budget"`
	Closed           bool    `json:"closed"`
	Note             *string `json:"note"`
	Balance          int     `json:"balance"`
	ClearedBalance   int     `json:"cleared_balance"`
	UnclearedBalance int     `json:"uncleared_balance"`
}

type AccountResponse

type AccountResponse struct {
	Data AccountWrapper `json:"data"`
}

type AccountWrapper

type AccountWrapper struct {
	Account Account `json:"account"`
}

type AccountsResponse

type AccountsResponse struct {
	Data AccountsWrapper `json:"data"`
}

type AccountsService

type AccountsService service

func (*AccountsService) Get

func (as *AccountsService) Get(budgetId string, accountId string) (Account, error)

https://api.youneedabudget.com/v1#/Accounts/getAccountById

func (*AccountsService) List

func (as *AccountsService) List(budgetId string) ([]Account, error)

https://api.youneedabudget.com/v1#/Accounts/getAccounts

type AccountsWrapper

type AccountsWrapper struct {
	Accounts []Account `json:"accounts"`
}

type ApiError

type ApiError struct {
	Id     string `json:"id"`
	Name   string `json:"name"`
	Detail string `json:"detail"`
}

type BudgetDetail

type BudgetDetail struct {
	BudgetSummary
	Accounts                 []Account                     `json:"accounts"`
	Payees                   []Payee                       `json:"payees"`
	PayeeLocations           []PayeeLocation               `json:"payee_locations"`
	CategoryGroups           []CategoryGroup               `json:"category_groups"`
	Categories               []Category                    `json:"categories"`
	Months                   []MonthDetail                 `json:"months"`
	Transactions             []TransactionSummary          `json:"transactions"`
	Subtransactions          []SubTransaction              `json:"subtransactions"`
	ScheduledTransactions    []ScheduledTransactionSummary `json:"scheduled_transactions"`
	ScheduledSubtransactions []ScheduledSubTransaction     `json:"scheduled_subtransactions"`
}

type BudgetDetailResponse

type BudgetDetailResponse struct {
	Data BudgetDetailWrapper `json:"data"`
}

type BudgetDetailWrapper

type BudgetDetailWrapper struct {
	Budget          BudgetDetail `json:"budget"`
	ServerKnowledge int          `json:"server_knowledge"`
}

type BudgetSummary

type BudgetSummary struct {
	Id             string         `json:"id"`
	Name           string         `json:"name"`
	LastModifiedOn *string        `json:"last_modified_on"`
	DateFormat     DateFormat     `json:"date_format"`
	CurrencyFormat CurrencyFormat `json:"currency_format"`
}

type BudgetSummaryResponse

type BudgetSummaryResponse struct {
	Data BudgetSummaryWrapper `json:"data"`
}

type BudgetSummaryWrapper

type BudgetSummaryWrapper struct {
	Budgets []BudgetSummary `json:"budgets"`
}

type BudgetsService

type BudgetsService service

func (*BudgetsService) Get

func (bs *BudgetsService) Get(id string) (BudgetDetail, error)

type BulkIdWrapper

type BulkIdWrapper struct {
	Bulk BulkIds `json:"bulk"`
}

type BulkIds

type BulkIds struct {
	TransactionIds     []string `json:"transaction_ids"`
	DuplicateImportIds []string `json:"duplicate_import_ids"`
}

type BulkResponse

type BulkResponse struct {
	Data BulkIdWrapper `json:"data"`
}

type BulkTransactions

type BulkTransactions struct {
	Transactions []SaveTransaction `json:"transactions"`
}

type CategoriesResponse

type CategoriesResponse struct {
	Data CategoryGroupsWrapper `json:"data"`
}

type CategoriesService

type CategoriesService service

func (*CategoriesService) Get

func (cs *CategoriesService) Get(budgetId string, categoryId string) (Category, error)

https://api.youneedabudget.com/v1#/Categories/getCategoryById

type Category

type Category struct {
	Id              string  `json:"id"`
	CategoryGroupId string  `json:"category_group_id"`
	Name            string  `json:"name"`
	Hidden          bool    `json:"hidden"`
	Note            *string `json:"note"`
	Budgeted        int     `json:"budgeted"`
	Activity        int     `json:"activity"`
	Balance         int     `json:"balance"`
}

type CategoryGroup

type CategoryGroup struct {
	Id     string `json:"id"`
	Name   string `json:"name"`
	Hidden bool   `json:"hidden"`
}

type CategoryGroupWithCategories

type CategoryGroupWithCategories struct {
	CategoryGroup
	Categories []Category `json:"categories"`
}

type CategoryGroupsWrapper

type CategoryGroupsWrapper struct {
	CategoryGroups []CategoryGroupWithCategories `json:"category_groups"`
}

type CategoryResponse

type CategoryResponse struct {
	Data CategoryWrapper `json:"data"`
}

type CategoryWrapper

type CategoryWrapper struct {
	Category Category `json:"category"`
}

type Client

type Client struct {
	BaseURL *url.URL

	AccountsService              *AccountsService
	BudgetService                *BudgetsService
	CategoriesService            *CategoriesService
	MonthsService                *MonthsService
	PayeeLocationsService        *PayeeLocationsService
	PayeesService                *PayeesService
	ScheduledTransactionsService *ScheduledTransactionsService
	TransactionsService          *TransactionsService
	UserService                  *UserService
	// contains filtered or unexported fields
}

func NewClient

func NewClient(baseUrl *url.URL, httpClient *http.Client, accessToken string) *Client

func NewDefaultClient

func NewDefaultClient(accessToken string) *Client

func NewOAuthClient

func NewOAuthClient(oauthConfig *oauth2.Config, oauthToken *oauth2.Token) *Client

type CurrencyFormat

type CurrencyFormat struct {
	IsoCode          string `json:"iso_code"`
	ExampleFormat    string `json:"example_format"`
	DecimalDigits    int    `json:"decimal_digits"`
	DecimalSeparator string `json:"decimal_separator"`
	SymbolFirst      bool   `json:"symbol_first"`
	GroupSeparator   string `json:"group_separator"`
	CurrencySymbol   string `json:"currency_symbol"`
	DisplaySymbol    bool   `json:"display_symbol"`
}

type DateFormat

type DateFormat struct {
	Format string `json:"format"`
}

type ErrorResponse

type ErrorResponse struct {
	Response     *http.Response
	ErrorDetails ApiError `json:"error"`
}

func (ErrorResponse) Error

func (r ErrorResponse) Error() string

type HybridTransaction

type HybridTransaction struct {
	TransactionSummary
	Type                string `json:"type"`
	ParentTransactionId string `json:"parent_transaction_id"`
	AccountName         string `json:"account_name"`
	PayeeName           string `json:"payee_name"`
	CategoryName        string `json:"category_name"`
}

type HybridTransactionsResponse

type HybridTransactionsResponse struct {
	Data HybridTransactionsWrapper `json:"data"`
}

type HybridTransactionsWrapper

type HybridTransactionsWrapper struct {
	Transactions []HybridTransaction `json:"transactions"`
}

type MonthDetail

type MonthDetail struct {
	MonthSummary
	Categories []Category `json:"categories"`
}

type MonthDetailResponse

type MonthDetailResponse struct {
	Data MonthDetailWrapper `json:"data"`
}

type MonthDetailWrapper

type MonthDetailWrapper struct {
	Month MonthDetail `json:"month"`
}

type MonthSummariesResponse

type MonthSummariesResponse struct {
	Data MonthSummariesWrapper `json:"data"`
}

type MonthSummariesWrapper

type MonthSummariesWrapper struct {
	Months []MonthSummary `json:"months"`
}

type MonthSummary

type MonthSummary struct {
	Month        string  `json:"month"`
	Note         *string `json:"note"`
	ToBeBudgeted *int    `json:"to_be_budgeted"`
	AgeOfMoney   *int    `json:"age_of_money"`
}

type MonthsService

type MonthsService service

type Payee

type Payee struct {
	Id                string  `json:"id"`
	Name              string  `json:"name"`
	TransferAccountId *string `json:"transfer_account_id"`
}

type PayeeLocation

type PayeeLocation struct {
	Id        string  `json:"id"`
	PayeeId   string  `json:"payee_id"`
	Latitude  *string `json:"latitude"`
	Longitude *string `json:"longitude"`
}

type PayeeLocationResponse

type PayeeLocationResponse struct {
	Data PayeeLocationWrapper `json:"data"`
}

type PayeeLocationWrapper

type PayeeLocationWrapper struct {
	PayeeLocation PayeeLocation `json:"payee_location"`
}

type PayeeLocationsResponse

type PayeeLocationsResponse struct {
	Data PayeeLocationsWrapper `json:"data"`
}

type PayeeLocationsService

type PayeeLocationsService service

func (*PayeeLocationsService) Get

func (pls *PayeeLocationsService) Get(budgetId string, payeeLocationId string) (PayeeLocation, error)

https://api.youneedabudget.com/v1#/Payee_Locations/getPayeeLocationById

type PayeeLocationsWrapper

type PayeeLocationsWrapper struct {
	PayeeLocations []PayeeLocation `json:"payee_locations"`
}

type PayeeResponse

type PayeeResponse struct {
	Data PayeeWrapper `json:"data"`
}

type PayeeWrapper

type PayeeWrapper struct {
	Payee Payee `json:"payee"`
}

type PayeesResponse

type PayeesResponse struct {
	Data PayeesWrapper `json:"data"`
}

type PayeesService

type PayeesService service

func (*PayeesService) Get

func (ps *PayeesService) Get(budgetId string, payeeId string) (Payee, error)

https://api.youneedabudget.com/v1#/Payees/getPayeeById

func (*PayeesService) List

func (ps *PayeesService) List(budgetId string) ([]Payee, error)

https://api.youneedabudget.com/v1#/Payees/getPayees

type PayeesWrapper

type PayeesWrapper struct {
	Payees []Payee `json:"payees"`
}

type SaveTransaction

type SaveTransaction struct {
	AccountId  string `json:"account_id"`
	Date       string `json:"date"`
	Amount     int    `json:"amount"`
	PayeeId    string `json:"payee_id,omitempty"`
	PayeeName  string `json:"payee_name,omitempty"`
	CategoryId string `json:"category_id,omitempty"`
	Memo       string `json:"memo,omitempty"`
	Cleared    string `json:"cleared,omitempty"`
	Approved   bool   `json:"approved,omitempty"`
	FlagColor  string `json:"flag_color,omitempty"`
	ImportId   string `json:"import_id,omitempty"`
}

func NewSaveTransaction

func NewSaveTransaction(accountId string, date string, amount int) *SaveTransaction

type SaveTransactionWrapper

type SaveTransactionWrapper struct {
	Transaction *SaveTransaction `json:"transaction"`
}

type ScheduledSubTransaction

type ScheduledSubTransaction struct {
	Id                     string  `json:"id"`
	ScheduledTransactionId string  `json:"scheduled_transaction_id"`
	Amount                 int     `json:"amount"`
	Memo                   *string `json:"memo"`
	PayeeId                *string `json:"payee_id"`
	CategoryId             *string `json:"category_id"`
	TransferAccountId      *string `json:"transfer_account_id"`
}

type ScheduledTransactionDetail

type ScheduledTransactionDetail struct {
	ScheduledTransactionSummary

	AccountName  string `json:"account_name"`
	PayeeName    string `json:"payee_name"`
	CategoryName string `json:"category_name"`

	SubTransactions []ScheduledSubTransaction `json:"subtransactions"`
}

type ScheduledTransactionResponse

type ScheduledTransactionResponse struct {
	Data ScheduledTransactionWrapper `json:"data"`
}

type ScheduledTransactionSummary

type ScheduledTransactionSummary struct {
	Id                string  `json:"id"`
	DateFirst         string  `json:"date_first"`
	DateNext          string  `json:"date_next"`
	Frequency         string  `json:"frequency"`
	Amount            int     `json:"amount"`
	Memo              *string `json:"memo"`
	FlagColor         *string `json:"flag_color"`
	AccountId         string  `json:"account_id"`
	PayeeId           *string `json:"payee_id"`
	CategoryId        *string `json:"category_id"`
	TransferAccountId *string `json:"transfer_account_id"`
}

type ScheduledTransactionWrapper

type ScheduledTransactionWrapper struct {
	ScheduledTransaction ScheduledTransactionDetail `json:"scheduled_transaction"`
}

type ScheduledTransactionsResponse

type ScheduledTransactionsResponse struct {
	Data ScheduledTransactionsWrapper `json:"data"`
}

type ScheduledTransactionsWrapper

type ScheduledTransactionsWrapper struct {
	ScheduledTransactions []ScheduledTransactionDetail `json:"scheduled_transactions"`
}

type SubTransaction

type SubTransaction struct {
	Id                string  `json:"id"`
	TransactionId     string  `json:"transaction_id"`
	Amount            int     `json:"amount"`
	Memo              *string `json:"memo"`
	PayeeId           *string `json:"payee_id"`
	CategoryId        *string `json:"category_id"`
	TransferAccountId *string `json:"transfer_account_id"`
}

type TransactionDetail

type TransactionDetail struct {
	TransactionSummary
	AccountName     string           `json:"account_name"`
	PayeeName       string           `json:"payee_name"`
	CategoryName    string           `json:"category_name"`
	SubTransactions []SubTransaction `json:"subtransactions"`
}

type TransactionResponse

type TransactionResponse struct {
	Data TransactionWrapper `json:"data"`
}

type TransactionSummary

type TransactionSummary struct {
	Id                string  `json:"id"`
	Date              string  `json:"date"`
	Amount            int     `json:"amount"`
	Memo              *string `json:"memo"`
	Cleared           string  `json:"cleared"`
	Approved          bool    `json:"approved"`
	FlagColor         *string `json:"flag_color"`
	AccountId         string  `json:"account_id"`
	PayeeId           *string `json:"payee_id"`
	CategoryId        *string `json:"category_id"`
	TransferAccountId *string `json:"transfer_account_id"`
	ImportId          *string `json:"import_id"`
}

type TransactionWrapper

type TransactionWrapper struct {
	Transaction TransactionDetail `json:"transaction"`
}

type TransactionsResponse

type TransactionsResponse struct {
	Data TransactionsWrapper `json:"data"`
}

type TransactionsService

type TransactionsService service

func (*TransactionsService) Edit

func (ts *TransactionsService) Edit(budgetId string, transactionId string, transaction *SaveTransaction) (TransactionDetail, error)

https://api.youneedabudget.com/v1#/Transactions/updateTransaction

type TransactionsWrapper

type TransactionsWrapper struct {
	Transactions []TransactionDetail `json:"transactions"`
}

type User

type User struct {
	Id string `json:"id"`
}

type UserResponse

type UserResponse struct {
	Data UserWrapper `json:"data"`
}

type UserService

type UserService service

type UserWrapper

type UserWrapper struct {
	User User `json:"user"`
}

Jump to

Keyboard shortcuts

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