projects
/
kraftakt.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0760c07
)
Package fitbit: Pass date as time.Time, remove location argument.
author
Florian Forster
<ff@octo.it>
Thu, 1 Feb 2018 06:36:45 +0000
(07:36 +0100)
committer
Florian Forster
<ff@octo.it>
Thu, 1 Feb 2018 06:36:45 +0000
(07:36 +0100)
fitbit/sleep.go
patch
|
blob
|
history
diff --git
a/fitbit/sleep.go
b/fitbit/sleep.go
index
76fc197
..
d0a42cf
100644
(file)
--- a/
fitbit/sleep.go
+++ b/
fitbit/sleep.go
@@
-101,10
+101,10
@@
func parseSleep(ctx context.Context, data []byte, loc *time.Location) (*Sleep, e
return &ret, nil
}
return &ret, nil
}
-// Sleep returns the sleep log for date
. Times are parsed in the user's timeozne, loc
.
-func (c *Client) Sleep(ctx context.Context,
date string, loc *time.Location
) (*Sleep, error) {
+// Sleep returns the sleep log for date
t. Times are parsed in the same timezone as t
.
+func (c *Client) Sleep(ctx context.Context,
t time.Time
) (*Sleep, error) {
url := fmt.Sprintf("https://api.fitbit.com/1.2/user/%s/sleep/date/%s.json",
url := fmt.Sprintf("https://api.fitbit.com/1.2/user/%s/sleep/date/%s.json",
- c.fitbitUserID,
date
)
+ c.fitbitUserID,
t.Format("2006-01-02")
)
res, err := c.client.Get(url)
if err != nil {
res, err := c.client.Get(url)
if err != nil {
@@
-118,5
+118,5
@@
func (c *Client) Sleep(ctx context.Context, date string, loc *time.Location) (*S
}
log.Debugf(ctx, "GET %s -> %s", url, data)
}
log.Debugf(ctx, "GET %s -> %s", url, data)
- return parseSleep(ctx, data,
loc
)
+ return parseSleep(ctx, data,
t.Location()
)
}
}