Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Category ¶
type Category struct { ID string `json:"id"` CategoryGroupID string `json:"category_group_id"` Name string `json:"name"` Hidden bool `json:"hidden"` // Budgeted Budgeted amount in current month in milliunits format Budgeted int64 `json:"budgeted"` // Activity Activity amount in current month in milliunits format Activity int64 `json:"activity"` // Balance Balance in current month in milliunits format Balance int64 `json:"balance"` // Deleted Deleted category groups will only be included in delta requests Deleted bool `json:"deleted"` Note *string `json:"note"` // OriginalCategoryGroupID If category is hidden this is the ID of the category // group it originally belonged to before it was hidden OriginalCategoryGroupID *string `json:"original_category_group_id"` }
Category represents a category for a budget
type Group ¶
type Group struct { ID string `json:"id"` Name string `json:"name"` Hidden bool `json:"hidden"` Deleted bool `json:"deleted"` }
Group represents a resumed category group for a budget
type GroupWithCategories ¶
type GroupWithCategories struct { ID string `json:"id"` Name string `json:"name"` Hidden bool `json:"hidden"` // Deleted Deleted category groups will only be included in delta requests Deleted bool `json:"deleted"` Categories []*Category `json:"categories"` }
GroupWithCategories represents a category group for a budget
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service wraps YNAB category API endpoints
func NewService ¶
func NewService(c api.ClientReader) *Service
NewService facilitates the creation of a new category service instance
func (*Service) GetCategories ¶
func (s *Service) GetCategories(budgetID string) ([]*GroupWithCategories, error)
GetCategories fetches the list of category groups for a budget https://api.youneedabudget.com/v1#/Categories/getCategories
Example ¶
package main import ( "fmt" "reflect" "go.bmvs.io/ynab" ) func main() { c := ynab.NewClient("<valid_ynab_access_token>") categories, _ := c.Category().GetCategories("<valid_budget_id>") fmt.Println(reflect.TypeOf(categories)) }
Output: []*category.GroupWithCategories
func (*Service) GetCategory ¶
GetCategory fetches a specific category from a budget https://api.youneedabudget.com/v1#/Categories/getCategoryById
Example ¶
package main import ( "fmt" "reflect" "go.bmvs.io/ynab" ) func main() { c := ynab.NewClient("<valid_ynab_access_token>") category, _ := c.Category().GetCategory("<valid_budget_id>", "<valid_category_id>") fmt.Println(reflect.TypeOf(category)) }
Output: *category.Category
Click to show internal directories.
Click to hide internal directories.