api

package
v0.0.0-...-f3318cb Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FetchAccessToken

func FetchAccessToken(clientID string, clientSecret string) (string, error)

FetchAccessToken fetches access token

func NewMockServer

func NewMockServer() (*http.ServeMux, *url.URL)

NewMockServer initializes mockServer

Types

type Client

type Client struct {
	EndpointURL *url.URL
	HTTPClient  *http.Client
	UserAgent   string
	AccessToken string
}

Client represents a HTTP client

func NewClient

func NewClient(endpointURL string, httpClient *http.Client, userAgent, token string) (*Client, error)

NewClient creates a new http client

func NewTestClient

func NewTestClient(mockServerURL *url.URL) *Client

NewTestClient initializes mockClient

func (*Client) GetActivity

func (client *Client) GetActivity(ctx context.Context, datePeriod oura.DatePeriod) (*oura.Activities, error)

GetActivity requests GET /v1/activity

func (*Client) GetReadiness

func (client *Client) GetReadiness(ctx context.Context, datePeriod oura.DatePeriod) (*oura.Readinesses, error)

GetReadiness requests GET /v1/readiness

func (*Client) GetSleep

func (client *Client) GetSleep(ctx context.Context, datePeriod oura.DatePeriod) (*oura.SleepPeriods, error)

GetSleep requests GET /v1/sleep

func (*Client) GetUserInfo

func (client *Client) GetUserInfo(ctx context.Context) (*oura.UserInfo, error)

GetUserInfo requests GET /v1/userinfo

Jump to

Keyboard shortcuts

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