month

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2018 License: BSD-2-Clause Imports: 3 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Month

type Month struct {
	Month      api.Date             `json:"month"`
	Categories []*category.Category `json:"categories"`

	Note         *string `json:"note"`
	ToBeBudgeted *int64  `json:"to_be_budgeted"`
	AgeOfMoney   *int64  `json:"age_of_money"`
}

Month represents a month for a budget Each budget contains one or more months, which is where To be Budgeted, Age of Money and Category (budgeted / activity / balances) amounts are available.

type Service

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

Service wraps YNAB month API endpoints

func NewService

func NewService(c api.ClientReader) *Service

NewService facilitates the creation of a new month service instance

func (*Service) GetMonth

func (s *Service) GetMonth(budgetID string, month api.Date) (*Month, error)

GetMonth fetches a specific month from a budget https://api.youneedabudget.com/v1#/Months/getBudgetMonth

Example
package main

import (
	"fmt"
	"reflect"

	"go.bmvs.io/ynab"
	"go.bmvs.io/ynab/api"
)

func main() {
	c := ynab.NewClient("<valid_ynab_access_token>")
	d, _ := api.DateFromString("2010-01-01")
	m, _ := c.Month().GetMonth("<valid_budget_id>", d)
	fmt.Println(reflect.TypeOf(m))

}
Output:

*month.Month

func (*Service) GetMonths

func (s *Service) GetMonths(budgetID string) ([]*Summary, error)

GetMonths fetches the list of months from a budget https://api.youneedabudget.com/v1#/Months/getBudgetMonths

Example
package main

import (
	"fmt"
	"reflect"

	"go.bmvs.io/ynab"
)

func main() {
	c := ynab.NewClient("<valid_ynab_access_token>")
	months, _ := c.Month().GetMonths("<valid_budget_id>")
	fmt.Println(reflect.TypeOf(months))

}
Output:

[]*month.Summary

type Summary

type Summary struct {
	Month api.Date `json:"month"`

	Note         *string `json:"note"`
	ToBeBudgeted *int64  `json:"to_be_budgeted"`
	AgeOfMoney   *int64  `json:"age_of_money"`
}

Summary represents the summary of a month for a budget Each budget contains one or more months, which is where To be Budgeted, Age of Money and Category (budgeted / activity / balances) amounts are available.

Jump to

Keyboard shortcuts

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