ynab: go.bmvs.io/ynab/api/month Index | Examples | Files

package month

import "go.bmvs.io/ynab/api/month"

Package month implements month entities and services

Index

Examples

Package Files

entity.go service.go

type Month Uses

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 Uses

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

Service wraps YNAB month API endpoints

func NewService Uses

func NewService(c api.ClientReader) *Service

NewService facilitates the creation of a new month service instance

func (*Service) GetMonth Uses

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

Code:

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 Uses

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

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

Code:

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

Output:

[]*month.Summary

type Summary Uses

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.

Package month imports 3 packages (graph) and is imported by 2 packages. Updated 2018-10-07. Refresh now. Tools for package owners.