-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample_test.go
56 lines (49 loc) · 1.26 KB
/
example_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package runalyze_test
import (
"context"
"fmt"
"os"
"time"
"github.com/joho/godotenv"
"github.com/lildude/runalyze"
)
// Note: the examples listed here are compiled but not executed while testing.
// See the documentation on [Testing](https://golang.org/pkg/testing/#hdr-Examples)
// for further details.
func Example_sleep() {
godotenv.Load(".env")
ctx := context.Background()
cl := runalyze.NewClient(os.Getenv("RUNALYZE_ACCESS_TOKEN"))
startSleep, _ := time.Parse(time.RFC3339, "2020-11-07T23:00:00Z")
sleep := runalyze.Sleep{
DateTime: startSleep,
Duration: 460,
RemDuration: 80,
LightSleepDuration: 70,
DeepSleepDuration: 70,
AwakeDuration: 70,
Quality: 8,
}
resp, err := cl.CreateSleep(ctx, sleep)
if err != nil {
fmt.Println(err.Error())
}
fmt.Println(resp.Status)
}
func Example_bloodPressure() {
godotenv.Load(".env")
ctx := context.Background()
cl := runalyze.NewClient(os.Getenv("RUNALYZE_ACCESS_TOKEN"))
date, _ := time.Parse(time.RFC3339, "2020-11-07T23:00:00Z")
bp := runalyze.BloodPressure{
DateTime: date,
Systolic: 120,
Diastolic: 80,
HeartRate: 70,
}
resp, err := cl.CreateBloodPressure(ctx, bp)
if err != nil {
fmt.Println("Whoops!")
}
fmt.Println(resp.Status)
}