ynab: go.bmvs.io/ynab/api/payee Index | Examples | Files

package payee

import "go.bmvs.io/ynab/api/payee"

Package payee implements payee entities and services

Index

Examples

Package Files

entity.go service.go

type Location Uses

type Location struct {
    ID      string `json:"id"`
    PayeeID string `json:"payee_id"`
    // Deleted Deleted payees will only be included in delta requests
    Deleted bool `json:"deleted"`

    Latitude  *float64 `json:"latitude,string"`
    Longitude *float64 `json:"longitude,string"`
}

Location represents a location for a payee When a transaction is saved with an specified payee on the YNAB mobile apps, the GPS coordinates for that location are stored, so that the next time the user is in the same place (like the Grocery store) YNAB can pre-populate nearby payees for you. Locations will not be available for all payees.

type Payee Uses

type Payee struct {
    ID   string `json:"id"`
    Name string `json:"name"`
    // Deleted Deleted payees will only be included in delta requests
    Deleted bool `json:"deleted"`

    // TransferAccountID If a transfer payee, the account_id to which this
    // payee transfers to
    TransferAccountID *string `json:"transfer_account_id"`
}

Payee represents a payee for a budget

type Service Uses

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

Service wraps YNAB payee API endpoints

func NewService Uses

func NewService(c api.ClientReader) *Service

NewService facilitates the creation of a new payee service instance

func (*Service) GetPayee Uses

func (s *Service) GetPayee(budgetID, payeeID string) (*Payee, error)

GetPayee fetches a specific payee from a budget https://api.youneedabudget.com/v1#/Payees/getPayeeById

Code:

c := ynab.NewClient("<valid_ynab_access_token>")
p, _ := c.Payee().GetPayee("<valid_budget_id>", "<valid_payee_id>")
fmt.Println(reflect.TypeOf(p))

Output:

*payee.Payee

func (*Service) GetPayeeLocation Uses

func (s *Service) GetPayeeLocation(budgetID, payeeLocationID string) (*Location, error)

GetPayeeLocation fetches a specific payee location from a budget https://api.youneedabudget.com/v1#/Payee_Locations/getPayeeLocationById

Code:

c := ynab.NewClient("<valid_ynab_access_token>")
l, _ := c.Payee().GetPayeeLocation("<valid_budget_id>", "<valid_payee_location_id>")
fmt.Println(reflect.TypeOf(l))

Output:

*payee.Location

func (*Service) GetPayeeLocations Uses

func (s *Service) GetPayeeLocations(budgetID string) ([]*Location, error)

GetPayeeLocations fetches the list of payee locations from a budget https://api.youneedabudget.com/v1#/Payee_Locations/getPayeeLocations

Code:

c := ynab.NewClient("<valid_ynab_access_token>")
locations, _ := c.Payee().GetPayeeLocations("<valid_budget_id>")
fmt.Println(reflect.TypeOf(locations))

Output:

[]*payee.Location

func (*Service) GetPayeeLocationsByPayee Uses

func (s *Service) GetPayeeLocationsByPayee(budgetID, payeeID string) ([]*Location, error)

GetPayeeLocationsByPayee fetches the list of locations of a specific payee from a budget https://api.youneedabudget.com/v1#/Payee_Locations/getPayeeLocationsByPayee

Code:

c := ynab.NewClient("<valid_ynab_access_token>")
locations, _ := c.Payee().GetPayeeLocationsByPayee("<valid_budget_id>", "<valid_payee_id>")
fmt.Println(reflect.TypeOf(locations))

Output:

[]*payee.Location

func (*Service) GetPayees Uses

func (s *Service) GetPayees(budgetID string) ([]*Payee, error)

GetPayees fetches the list of payees from a budget https://api.youneedabudget.com/v1#/Payees/getPayees

Code:

c := ynab.NewClient("<valid_ynab_access_token>")
payees, _ := c.Payee().GetPayees("<valid_budget_id>")
fmt.Println(reflect.TypeOf(payees))

Output:

[]*payee.Payee

Package payee imports 2 packages (graph) and is imported by 2 packages. Updated 2018-10-07. Refresh now. Tools for package owners.