API Client
Browser client for Tee Time APIs.
Package: libs/services/client/teetime-api-client
Usage
import { listClubs, getTeeSheet, listMyBuddies } from '@digiwedge/teetime-api-client';
const clubs = await listClubs({ name: 'Royal' });
const sheet = await getTeeSheet(courseId, new Date());
const buddies = await listMyBuddies(); // uses /players/me/buddies and returns contact details
Configure base URL via environment or rely on same‑origin in production. Helpers prefixed with
listMy*/addMy*/removeMy* resolve the current player from the session/JWT automatically.
Frontend integration tips
- Buddy data & helpers:
/players/me/buddiesreturns contact details underbuddy.firstName,buddy.lastName,buddy.fullName,buddy.email,buddy.phoneNumber(aliasesname/surname/phoneremain for back-compat). Use thebuddyobject directly; avoid extra player lookups. Prefer thelistMy*/addMy*/removeMy*helpers so the client resolves the player automatically. - Eligibility context for pricing: visitor pricing/search accepts optional
{ tenantId, membershipNumber, providerCode }to apply reciprocity/association discounts. Pass these query params when available (they degrade to standard visitor pricing on failure):const params = new URLSearchParams({
tenantId: 'tenant-uuid',
membershipNumber: '123456',
providerCode: 'SAGA_NETWORK', // or GOLFRSA / DOTGOLF / NEDBANK_GREENTIME / DISCOVERY_VITALITY
});
const slots = await fetch(`/api/courses/${courseId}/tee-times/visitor?${params.toString()}`, {
credentials: 'include',
}).then((r) => r.json()); - Same-origin in prod: Frontends should prefer relative API calls; only set base URL in dev/preview. Ensure credentials/cookies are allowed when using session-backed flows.