galeone / galeone/fitbit

GET: Nutrition and Nutrition timeseries

Open
#1 1 comment 0 reactions 0 assignees View on GitHub
help wanted
Dominant language
Go
Stars
10
Forks
2
PR merge metrics
No merged PRs in 30d

Description

The Fitbit client misses the support for (at least all the GET endpoints of):

- nutrition https://dev.fitbit.com/build/reference/web-api/nutrition/
- nutrition timeseries: https://dev.fitbit.com/build/reference/web-api/nutrition-timeseries/

I don't log the food, so I don't have data for automatically generating with [galeone/rts](https://github.com/galeone/rts) the structs, and thus there's no support for this (yet).

If someone want's to help, it only needs to follow the steps in the readme to create an application, and than use rts in this way:

```go
var req *http.Client
req, err = fitbitAuthorizer.HTTP()
if err != nil {
return err
}

// Build the various requests path (pay attention to the parameters)
// and foreach of this `dest`
if res, err = req.Get(dest); err != nil {
return err
}

var body []byte
if body, err = io.ReadAll(res.Body); err != nil {
return err
}
bodyString := string(body)
// RTS usage: creates the content inside a "types" package
if pack, err = rts.DoRaw("types", bodyString); err != nil {ù
return err
}
// Save the content.
```

Once you have the generated content saved, you have to manually edit all the `Foo` structures (it's easy, just look at the documentation for the fields) and organized the structs in the very same way these are already organized in the `types` folder.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.