Documentation
¶
Overview ¶
Package client handles pincher-api calls
Index ¶
- type Account
- type Budget
- type Cache
- type Category
- type CategoryReport
- type Client
- func (c *Client) API() string
- func (c *Client) AssignAmountToCategory(amount int64, toCategoryName, fromCategoryName, monthID string) error
- func (c *Client) ClearCache()
- func (c *Client) CreateAccount(name, notes, accountType string) (success bool, error error)
- func (c *Client) CreateBudget(name, notes string) (success bool, error error)
- func (c *Client) CreateCategory(name, notes, groupName string) (success bool, error error)
- func (c *Client) CreateGroup(name, notes string) (success bool, error error)
- func (c *Client) CreatePayee(name, notes string) (success bool, error error)
- func (c *Client) CreateUser(username, password string) (success bool, error error)
- func (c *Client) Delete(url, token string, payload any) (*http.Response, error)
- func (c *Client) DeleteAccount(accountID, deleteHard string) error
- func (c *Client) DeleteBudget(budgetID string) error
- func (c *Client) DeleteCategory(categoryID string) error
- func (c *Client) DeleteGroup(groupID string) error
- func (c *Client) DeletePayee(payeeID, newPayeeName string) error
- func (c *Client) DeleteUser(username, password string) error
- func (c *Client) Get(url, token string, out any) (response *http.Response, respFromCache bool, err error)
- func (c *Client) GetAccessToken() error
- func (c *Client) GetAccessTokenWithUser() (user User, err error)
- func (c *Client) GetAccounts(urlQuery string) ([]Account, error)
- func (c *Client) GetBudgetReport(monthID string) (MonthReport, error)
- func (c *Client) GetBudgets(urlQuery string) ([]Budget, error)
- func (c *Client) GetCategories(urlQuery string) ([]Category, error)
- func (c *Client) GetCategoryReports(monthID string) ([]CategoryReport, error)
- func (c *Client) GetGroups(urlQuery string) ([]Group, error)
- func (c *Client) GetPayees(urlQuery string) ([]Payee, error)
- func (c *Client) GetServerReady() (bool, error)
- func (c *Client) GetTxns(urlQuery string) ([]TransactionDetail, error)
- func (c *Client) LoadCacheFile() error
- func (c *Client) LogTxn(accountName, transferAccountName, transactionDate, payeeName, notes string, ...) (success bool, error error)
- func (c *Client) LoginUser(username, password string) (User, error)
- func (c *Client) MakeRequest(method, path, token string, body any) (*http.Request, error)
- func (c *Client) Patch(url, token string, payload any) (*http.Response, error)
- func (c *Client) Post(url, token string, payload, out any) (*http.Response, error)
- func (c *Client) Put(url, token string, payload any) (*http.Response, error)
- func (c *Client) RestoreAccount(accountID, name string) error
- func (c *Client) RevokeRefreshToken() error
- func (c *Client) SaveCacheFile() error
- func (c *Client) UpdateAccount(accountID, name, notes, accountType string) error
- func (c *Client) UpdateBudget(budgetID, name, notes string) error
- func (c *Client) UpdateCategory(categoryID, name, notes, groupID string) error
- func (c *Client) UpdateGroup(groupID, name, notes string) error
- func (c *Client) UpdatePayee(payeeID, name, notes string) error
- func (c *Client) UpdateUser(username, password string) error
- type Group
- type Meta
- type MonthReport
- type Payee
- type Transaction
- type TransactionDetail
- type TransactionSplit
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
CachedEntries map[string]cacheEntry `json:"cached_entries"`
// contains filtered or unexported fields
}
func (*Cache) DeleteAllStartsWith ¶
DeleteAllStartsWith removes all cached entries whose key starts with the given prefix. This can be used to invalidate all entries related to a resource that may have had an instance updated or removed.
type CategoryReport ¶
type Client ¶
type Client struct {
http.Client
ViewedBudget Budget
BaseURL string
RefreshToken string
// contains filtered or unexported fields
}
func (*Client) AssignAmountToCategory ¶
func (*Client) ClearCache ¶
func (c *Client) ClearCache()
ClearCache calls the Clear() function on the cache attached to the client and forces an early save of the cache file.
func (*Client) CreateAccount ¶
func (*Client) CreateBudget ¶
func (*Client) CreateCategory ¶
func (*Client) CreateGroup ¶
func (*Client) CreatePayee ¶
func (*Client) CreateUser ¶
func (*Client) DeleteAccount ¶
func (*Client) DeleteBudget ¶
func (*Client) DeleteCategory ¶
func (*Client) DeleteGroup ¶
func (*Client) DeletePayee ¶
func (*Client) DeleteUser ¶
func (*Client) Get ¶
func (c *Client) Get(url, token string, out any) (response *http.Response, respFromCache bool, err error)
Get wrapper for doRequest
func (*Client) GetAccessToken ¶
func (*Client) GetAccessTokenWithUser ¶
func (*Client) GetBudgetReport ¶
func (c *Client) GetBudgetReport(monthID string) (MonthReport, error)
func (*Client) GetCategoryReports ¶
func (c *Client) GetCategoryReports(monthID string) ([]CategoryReport, error)
func (*Client) GetServerReady ¶
GetServerReady reports back with a 200 Status Code
func (*Client) LoadCacheFile ¶
LoadCacheFile looks for a file with the given name within the user cache directory and attempts to load it into the cache.
func (*Client) MakeRequest ¶
func (*Client) RestoreAccount ¶
func (*Client) RevokeRefreshToken ¶
func (*Client) SaveCacheFile ¶
SaveCacheFile saves the current cache to a local file with the given name under the user cache directory.
func (*Client) UpdateAccount ¶
func (*Client) UpdateBudget ¶
func (*Client) UpdateCategory ¶
func (*Client) UpdateGroup ¶
func (*Client) UpdatePayee ¶
func (*Client) UpdateUser ¶
type MonthReport ¶
type Transaction ¶
type Transaction struct {
ID uuid.UUID `json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
BudgetID uuid.UUID `json:"budget_id"`
LoggerID uuid.UUID `json:"logger_id"`
AccountID uuid.UUID `json:"account_id"`
TransactionType string `json:"transaction_type"`
TransactionDate time.Time `json:"transaction_date"`
PayeeID uuid.UUID `json:"payee_id"`
Notes string `json:"notes"`
Cleared bool `json:"is_cleared"`
}
type TransactionDetail ¶
type TransactionDetail struct {
ID uuid.UUID `json:"id"`
TransactionDate time.Time `json:"transaction_date"`
TransactionType string `json:"transaction_type"`
Notes string `json:"notes"`
PayeeName string `json:"payee_name"`
BudgetName string `json:"budget_name"`
AccountName string `json:"account_name"`
LoggerName string `json:"logger_name"`
TotalAmount int64 `json:"total_amount"`
Splits map[string]int64 `json:"splits"`
Cleared bool `json:"cleared"`
}