payee

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2018 License: BSD-2-Clause Imports: 2 Imported by: 2

Documentation

Overview

Package payee implements payee entities and services

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Location

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

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

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

Service wraps YNAB payee API endpoints

func NewService

func NewService(c api.ClientReader) *Service

NewService facilitates the creation of a new payee service instance

func (*Service) GetPayee

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

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

Example
package main

import (
	"fmt"
	"reflect"

	"go.bmvs.io/ynab"
)

func main() {
	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

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

Example
package main

import (
	"fmt"
	"reflect"

	"go.bmvs.io/ynab"
)

func main() {
	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

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

Example
package main

import (
	"fmt"
	"reflect"

	"go.bmvs.io/ynab"
)

func main() {
	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

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

Example
package main

import (
	"fmt"
	"reflect"

	"go.bmvs.io/ynab"
)

func main() {
	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

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

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

Example
package main

import (
	"fmt"
	"reflect"

	"go.bmvs.io/ynab"
)

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

}
Output:

[]*payee.Payee

Jump to

Keyboard shortcuts

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