http

package
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 17, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseMillidollars added in v0.4.1

func ParseMillidollars(millidollars int64) (int64, int16)

ParseMillidollars parses the "millidollar" unit returned by YNAB into dollars and cents

func ToMillidollars added in v0.4.1

func ToMillidollars(dollars int64, cents int16) int64

ToMillidollars converts the given dollars and cents to millidollars for YNAB's API

Types

type APIError

type APIError struct {
	ID     string `json:"id"`
	Name   string `json:"name"`
	Detail string `json:"detail"`
}

type Client

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

func NewClient

func NewClient(accessToken string) (*Client, error)

func (*Client) Get

func (c *Client) Get(requestPath string) (*http.Response, error)

Get issues an HTTP GET request to the given request path

func (*Client) GetBudgets

func (c *Client) GetBudgets() ([]*model.Budget, error)

func (*Client) GetCategories

func (c *Client) GetCategories(budget *model.Budget) ([]*model.BudgetCategoryGroup, error)

func (*Client) GetJSON

func (c *Client) GetJSON(requestPath string, result interface{}) error

GetJSON issues a GET request for JSON data to the given request path and populates the given result with the body of the response

func (*Client) GetMonthlyAverageSpent

func (c *Client) GetMonthlyAverageSpent(budget *model.Budget, category *model.BudgetCategory, monthLookback int) (int64, int16, error)

func (*Client) GetReadyToAssign added in v0.4.1

func (c *Client) GetReadyToAssign(budget *model.Budget) (int64, int16, error)

func (*Client) Patch

func (c *Client) Patch(requestPath string, requestBody io.Reader) (*http.Response, error)

Patch issues a PATCH request to the given request path with the given request body

func (*Client) PatchJSON

func (c *Client) PatchJSON(requestPath string, requestBody interface{}) error

PatchJSON submits a PATCH request formatted as JSON

func (*Client) SetBudget

func (c *Client) SetBudget(budget *model.Budget, category *model.BudgetCategory, newDollars int64, newCents int16) error

type ErrorContainer

type ErrorContainer struct {
	APIError *APIError `json:"error"`
}

func (*ErrorContainer) Error

func (ec *ErrorContainer) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL