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

package api

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

Package api implements shared structures and behaviours of the API services

Index

Examples

Package Files

client.go date.go error.go ratelimit.go

Constants

const DateLayout = "2006-01-02"

DateLayout expected layout format for the Date type

type ClientReader Uses

type ClientReader interface {
    GET(url string, responseModel interface{}) error
}

ClientReader contract for a read only client

type ClientReaderWriter Uses

type ClientReaderWriter interface {
    ClientReader
    ClientWriter
}

ClientReaderWriter contract for a read-write client

type ClientWriter Uses

type ClientWriter interface {
    POST(url string, responseModel interface{}, requestBody []byte) error
    PUT(url string, responseModel interface{}, requestBody []byte) error
}

ClientWriter contract for a write only client

type Date Uses

type Date struct {
    time.Time
}

Date represents a budget date

func DateFromString Uses

func DateFromString(s string) (Date, error)

DateFromString creates a new Date from a given string date formatted as DateLayout

Code:

date, _ := api.DateFromString("2020-01-20")
fmt.Println(date)

Output:

2020-01-20 00:00:00 +0000 UTC

func (*Date) MarshalJSON Uses

func (d *Date) MarshalJSON() ([]byte, error)

MarshalJSON parses the expected format for a Date

func (*Date) UnmarshalJSON Uses

func (d *Date) UnmarshalJSON(b []byte) error

UnmarshalJSON parses the expected format for a Date

type Error Uses

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

Error represents an API Error

func (Error) Error Uses

func (e Error) Error() string

Error returns the string version of the error

type RateLimit Uses

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

RateLimit represents an API rate limit

func ParseRateLimit Uses

func ParseRateLimit(rateLimit string) (*RateLimit, error)

ParseRateLimit returns a *RateLimit for a given rate limit string

Code:

r, _ := api.ParseRateLimit("1/200")
fmt.Println(r.Used())

Output:

1

func (*RateLimit) Total Uses

func (r *RateLimit) Total() uint64

Total represents the total rate limit

func (*RateLimit) Used Uses

func (r *RateLimit) Used() uint64

Used represents the used rate limit

Directories

PathSynopsis
accountPackage account implements account entities and services
budgetPackage budget implements budget entities and services
categoryPackage category implements category entities and services
monthPackage month implements month entities and services
payeePackage payee implements payee entities and services
transactionPackage transaction implements transaction entities and services
userPackage user implements transaction user and services

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