Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

1.4 KB
Raw Blame
import { request } from './apiCore.js';

// Apple Health
export const ingestAppleHealth = (data) => request('/health/ingest', {
  method: 'POST',
  body: JSON.stringify(data)
});
export const getAppleHealthMetrics = (metricName, from, to, options = {}) => {
  const params = new URLSearchParams();
  if (from) params.set('from', from);
  if (to) params.set('to', to);
  return request(`/health/metrics/${metricName}/daily?${params}`, options);
};
export const getAvailableHealthMetrics = () => request('/health/metrics/available');
export const getLatestHealthMetrics = (metricNames, options = {}) =>
  request(`/health/metrics/latest?metrics=${metricNames.join(',')}`, options);
export const getAppleHealthCorrelation = (from, to) => {
  const params = new URLSearchParams();
  if (from) params.set('from', from);
  if (to) params.set('to', to);
  return request(`/health/correlation?${params}`);
};
export const uploadAppleHealthXml = (file, options = {}) => {
  const formData = new FormData();
  formData.append('file', file);
  // request() detects FormData bodies and lets the browser set the multipart
  // boundary automatically. Accept `options` so callers with their own error
  // UI can pass `{ silent: true }` to suppress the helper's toast.
  return request('/health/import/xml', { method: 'POST', body: formData, ...options });
};

// Genome / Health Correlations
export const getGenomeHealthCorrelations = () => request('/insights/genome-health');