withings

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package withings is the worker for Withings: it talks to the Withings API for the backend. It plays the scale-source role (see pkg/shared/workerapi): "withings.connect" exchanges the code the user got when they allowed access, and "withings.import" fetches their measurements.

The worker has no database. The application's credentials and the user's tokens come with each job; a token pair the worker renews is handed back with SaveCredentials before it is used, because a Withings refresh token works once and losing the new pair disconnects the user. What to store is decided by the backend: this package only fetches and maps.

Index

Constants

View Source
const (
	KindConnect = Provider + "." + workerapi.ActionConnect // same as workerapi.Kind(Provider, workerapi.ActionConnect)
	KindImport  = Provider + "." + workerapi.ActionImport
)

The kinds this worker runs.

Provider is the provider's name: the first part of its kinds and the readings' Source.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// APIBase overrides the Withings API address (used by tests).
	APIBase string
}

Config holds what only a test changes; the application's credentials come with every job.

type Worker

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

Worker runs the Withings kinds of job.

func New

func New(cfg Config, client *http.Client) *Worker

New returns a worker. A nil client uses a 30 s timeout.

func (*Worker) Handlers

func (w *Worker) Handlers() map[string]runner.Handler

Handlers returns the handler of each kind, for runner.Runner.Handle.

Jump to

Keyboard shortcuts

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