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

          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
            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
              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.