MyFitnesspal-API-Golang

module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2022 License: GPL-3.0

README

(Unofficial) MyFitnessPal Golang API Wrapper

This is an unofficial MyFitnessPal API Wrapper which uses the "internal" MyFitnessPal APIs and not the official one.

Installation

go get -u github.com/jnelle/MyFitnesspal-API-Golang

How to use it?

Example with credentials
import "github.com/jnelle/MyFitnesspal-API-Golang/app/client"

func main() {
	mfp := client.MFPClient{Username: "YOUR_EMAIL", Password: "YOUR_PASSWORD"}

	err := mfp.InitialLoad()
	if err != nil {
		log.Fatalln(err)
	}

	food, err := mfp.SearchFoodWithoutPagination("Pizza")
	if err != nil {
		log.Fatalln(err)
	}
	fmt.Println(food.Items[0])

}
Example without credentials
import "github.com/jnelle/MyFitnesspal-API-Golang/app/client"

func main() {
	mfp := client.MFPClient{}

	// Example without using credentials and with pagination
	resultOffset, err := mfp.SearchFoodWithoutAuth("Pizza", 5, 1)
	if err != nil {
		log.Fatalln(err)
	}

	fmt.Println(resultOffset)

	resultOffset, err = mfp.SearchFoodWithoutAuth("Pizza", 10, 2)
	if err != nil {
		log.Fatalln(err)
	}

	fmt.Println(resultOffset)


}

TODOS

  • Add pagination for searchfood method with credentials
  • For additional features just create an issue

Directories

Path Synopsis
app
internal

Jump to

Keyboard shortcuts

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