v0.0.0-...-33b12f9 Latest Latest

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

Go to latest
Published: Sep 29, 2021 License: MIT Imports: 10 Imported by: 0




This section is empty.


This section is empty.


This section is empty.


type Client

type Client struct {
	// contains filtered or unexported fields

Client is an OurGroceries client.

func NewClient

func NewClient(cookieJar *cookiejar.Jar, httpClient HTTPClient) Client

NewClient returns a Client.

func (*Client) AddItem

func (client *Client) AddItem(listID string, item string) error

AddItem adds an item to the given list.

func (*Client) GetList

func (client *Client) GetList(listID string) ([]Item, error)

GetList gets grocery items for a list.

func (*Client) GetLists

func (client *Client) GetLists() ([]ListID, error)

GetLists gets the grocery lists from OurGroceries.

func (*Client) Login

func (client *Client) Login(email string, password string) error

Login authenticates with OurGroceries and returns the user's teamID

type HTTPClient

type HTTPClient interface {
	Do(r *http.Request) (*http.Response, error)

HTTPClient in an interface for http.Client

type Item

type Item struct {
	ID         string `json:"id"`
	Value      string `json:"value"`
	CategoryID string `json:"categoryid,omitempty"`

Item is a grocey list item

func HandleGetList

func HandleGetList(bytes []byte, err error) ([]Item, error)

HandleGetList returns []Item from the response body of getList. TODO: make HandleGetList a private function

type ListID

type ListID struct {
	Name string `json:"name,omitempty"`
	ID   string `json:"id,omitempty"`

ListID is a grocery list identifier

Jump to

Keyboard shortcuts

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