Skip to main content

Overview

The @timeback/core package provides a unified client that aggregates all Timeback API clients with shared OAuth authentication:
  • OneRoster: Rostering and gradebook data
  • EduBridge: Simplified enrollments and analytics
  • Caliper: Learning analytics events
  • QTI: Assessment content management
  • PowerPath: Placement tests and adaptive learning
All sub-clients share a single OAuth token, reducing authentication overhead.

Installation

npm install @timeback/core

Quick Start

import { TimebackClient } from '@timeback/core'

const timeback = new TimebackClient({
	env: 'staging',
	auth: {
		clientId: process.env.TIMEBACK_CLIENT_ID!,
		clientSecret: process.env.TIMEBACK_CLIENT_SECRET!,
	},
})

// Access any API through the unified client
const { data: schools } = await timeback.oneroster.schools.list()
const { data: users } = await timeback.oneroster.users.list({ where: { role: 'student' } })
await timeback.caliper.emit(event)

Configuration

Environment Mode

Connect to Timeback’s hosted APIs:
const timeback = new TimebackClient({
	env: 'staging', // or 'production'
	auth: {
		clientId: process.env.TIMEBACK_CLIENT_ID!,
		clientSecret: process.env.TIMEBACK_CLIENT_SECRET!,
	},
})

Base URL Mode

Connect to a self-hosted or custom endpoint:
const timeback = new TimebackClient({
	baseUrl: 'https://timeback.myschool.edu',
	auth: {
		clientId: process.env.CLIENT_ID!,
		clientSecret: process.env.CLIENT_SECRET!,
		authUrl: 'https://timeback.myschool.edu/oauth/token',
	},
})

Accessing APIs

Each API is lazily initialized on first access:
// OneRoster - rostering and gradebook
timeback.oneroster.users.list()
timeback.oneroster.schools.get(schoolId)
timeback.oneroster.enrollments.list({ where: { role: 'student' } })

// EduBridge - simplified enrollments and analytics
timeback.edubridge.enrollments.list(userId)
timeback.edubridge.analytics.activity({ studentId })

// Caliper - learning analytics
timeback.caliper.events.list()
timeback.caliper.emit(event)

// QTI - assessments
timeback.qti.items.list()
timeback.qti.items.get(identifier)

// PowerPath - adaptive learning
timeback.powerpath.assignments.list({ student: studentId })
timeback.powerpath.placement.level({ student: studentId, subject: 'Math' })

Lifecycle

Check Authentication

Verify OAuth credentials are working:
const result = await timeback.checkAuth()

if (result.success) {
	console.log('Auth OK, latency:', result.latencyMs, 'ms')
} else {
	console.error('Auth failed:', result.error)
}

Close the Client

Release resources when done:
timeback.close()

// After close(), further API calls will throw
console.log(timeback.closed) // true

Next Steps