Documentation
¶
Overview ¶
Package month implements month entities and services
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"` // Income the total amount in transactions categorized to "Inflow: To be Budgeted" // in the month (milliunits format) Income *int64 `json:"income"` // Budgeted the total amount budgeted in the month (milliunits format) Budgeted *int64 `json:"budgeted"` // Activity the total amount in transactions in the month, excluding those // categorized to "Inflow: To be Budgeted" (milliunits format) Activity *int64 `json:"activity"` }
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 ¶
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 ¶
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"` // Income the total amount in transactions categorized to "Inflow: To be Budgeted" // in the month (milliunits format) Income *int64 `json:"income"` // Budgeted the total amount budgeted in the month (milliunits format) Budgeted *int64 `json:"budgeted"` // Activity the total amount in transactions in the month, excluding those // categorized to "Inflow: To be Budgeted" (milliunits format) Activity *int64 `json:"activity"` }
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.