usecase

package
v0.0.0-...-e73248a Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found")

Functions

This section is empty.

Types

type DataStore

type DataStore interface {
	RecordHeart(ctx context.Context, userID string, hearts []domain.HeartData) error
	GetLatestHeartData(ctx context.Context, userID string) (domain.HeartData, error)
}

type FitbitClient

type FitbitClient interface {
	GenerateAuthURL(state string) (url.URL, string, error)
	Callback(ctx context.Context, code string, verifier string) (string, domain.OAuth2Token, error)
	GetName(ctx context.Context, token domain.OAuth2Token) (string, domain.OAuth2Token, error)
	GetHeartData(ctx context.Context, token domain.OAuth2Token, timeRange domain.FitbitTimeRange[tz.AsiaTokyo], detail domain.HeartDetail) ([]domain.HeartData, domain.OAuth2Token, error)
}

type TokenStore

type TokenStore interface {
	SaveOAuth2Token(ctx context.Context, userID string, token domain.OAuth2Token) error
	GetOAuth2Token(ctx context.Context, userID string) (domain.OAuth2Token, error)
}

type Usecase

type Usecase struct {
	// contains filtered or unexported fields
}

func NewUsecase

func NewUsecase(fitbitClient FitbitClient, tokenStore TokenStore, dataStore DataStore) *Usecase

func (*Usecase) Callback

func (u *Usecase) Callback(ctx context.Context, code string, verifier string) error

func (*Usecase) GetHeartNow

func (u *Usecase) GetHeartNow(ctx context.Context, userID string) (domain.HeartData, error)

func (*Usecase) RecordHeart

func (u *Usecase) RecordHeart(ctx context.Context, defaultFrom synchro.Time[tz.AsiaTokyo], userID string) error

func (*Usecase) SignIn

func (u *Usecase) SignIn() (string, string, url.URL, error)

Jump to

Keyboard shortcuts

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