/
entity.go
66 lines (57 loc) · 2.54 KB
/
entity.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// Copyright (c) 2018, Bruno M V Souza <github@b.bmvs.io>. All rights reserved.
// Use of this source code is governed by a BSD-2-Clause license that can be
// found in the LICENSE file.
// Package category implements category entities and services
package category // import "github.com/brunomvsouza/ynab.go/api/category"
import "github.com/brunomvsouza/ynab.go/api"
// Category represents a category for a budget
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"`
GoalType *Goal `json:"goal_type"`
// GoalCreationMonth the month a goal was created
GoalCreationMonth *api.Date `json:"goal_creation_month"`
// GoalTarget the goal target amount in milliunits
GoalTarget *int64 `json:"goal_target"`
// GoalTargetMonth if the goal type is GoalTargetCategoryBalanceByDate,
// this is the target month for the goal to be completed
GoalTargetMonth *api.Date `json:"goal_target_month"`
// GoalPercentageComplete the percentage completion of the goal
GoalPercentageComplete *uint16 `json:"goal_percentage_complete"`
}
// Group represents a resumed category group for a budget
type Group 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"`
}
// GroupWithCategories represents a category group for a budget
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"`
}
// SearchResultSnapshot represents a versioned snapshot for an account search
type SearchResultSnapshot struct {
GroupWithCategories []*GroupWithCategories
ServerKnowledge uint64
}